emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help-window-select and info-lookup-symbol


From: Helmut Eller
Subject: Re: help-window-select and info-lookup-symbol
Date: Tue, 21 Jul 2009 17:07:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

* martin rudalics [2009-07-21 16:12+0200] writes:

>> We do it by walking windows before and after display-buffer.  I guess
>> that window-config objects also contain the information it's just not
>> accessible from Lisp.
>
> AFAICT they don't have it.  It would be very simple to have window.el
> provide a global variable that has the necessary information.
> `with-help-window' could use it as well.  BTW you don't restore
> `window-start' and `window-point' when you restore the buffer?

Nope.  To much work :-).  Well, it the most common case the window will
just be deleted and it doesn't matter.

>> That's the code that stashes the data into the buffer-local variable:
>>
>> (defun slime-display-popup-buffer (select)
>>   "Display the current buffer.
>> Save the selected-window in a buffer-local variable, so that we
>> can restore it later."
>>   (let ((selected-window (selected-window))
>>         (old-windows))
>>     (walk-windows (lambda (w) (push (cons w (window-buffer w)) old-windows))
>>                   nil t)
>>     (let ((new-window (display-buffer (current-buffer))))
>>       (unless slime-popup-restore-data
>>         (set (make-local-variable 'slime-popup-restore-data)
>>              (list new-window
>>                    selected-window
>>                    (cdr (find new-window old-windows :key #'car)))))
>>       (when select
>>         (select-window new-window))
>>       (current-buffer))))
>
> Doesn't that fail when you manually switch to a buffer B in such a
> window?  In that case `slime-popup-restore-data' would remain non-nil
> and a later call of `slime-display-popup-buffer' would not save the
> value of B.

Hmm.. no it wouldn't.  I wouldn't call that failing though.  One could
also argue that if the user switches to B and back that's a temporary
excursion and should have no permanent effect.  Right or Wrong depends
on the users expectations.  If the window was freshly created by
slime-display-popup-buffer the user might well expect that pressing q
will close it.  OTOH, some users have strange expectations; they expect
the exact opposite from what I would :-)

That's why a style-guide would be good: that "adjusts" the expectations.

Helmut.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]