From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: help-window-select and info-lookup-symbol Date: Tue, 21 Jul 2009 15:51:36 +0200 Message-ID: References: <4A6439A9.6080406@gmx.at> <4A65C23E.3010801@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248184332 777 80.91.229.12 (21 Jul 2009 13:52:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jul 2009 13:52:12 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 21 15:52:05 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MTFlC-00012V-Cp for ged-emacs-devel@m.gmane.org; Tue, 21 Jul 2009 15:52:02 +0200 Original-Received: from localhost ([127.0.0.1]:33405 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTFlB-0002cu-VE for ged-emacs-devel@m.gmane.org; Tue, 21 Jul 2009 09:52:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTFl6-0002cV-2g for emacs-devel@gnu.org; Tue, 21 Jul 2009 09:51:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTFl1-0002bc-8T for emacs-devel@gnu.org; Tue, 21 Jul 2009 09:51:55 -0400 Original-Received: from [199.232.76.173] (port=56314 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTFl1-0002bZ-3r for emacs-devel@gnu.org; Tue, 21 Jul 2009 09:51:51 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:43232 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MTFl0-0005gQ-Gt for emacs-devel@gnu.org; Tue, 21 Jul 2009 09:51:50 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MTFky-0002dA-Cy for emacs-devel@gnu.org; Tue, 21 Jul 2009 13:51:48 +0000 Original-Received: from 212.46.177.79 ([212.46.177.79]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Jul 2009 13:51:48 +0000 Original-Received: from eller.helmut by 212.46.177.79 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Jul 2009 13:51:48 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 212.46.177.79 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:HS2fokf3fOlkRjH2yHMac53DOoU= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:112902 Archived-At: * martin rudalics [2009-07-21 15:27+0200] writes: >> (defun slime-close-popup-window () >> (when slime-popup-restore-data >> (destructuring-bind (popup-window selected-window old-buffer) >> slime-popup-restore-data >> (bury-buffer) >> (when (eq popup-window (selected-window)) >> (cond ((and (not old-buffer) (not (one-window-p))) >> (delete-window popup-window)) >> ((and old-buffer (buffer-live-p old-buffer)) >> (set-window-buffer popup-window old-buffer)))) >> (when (window-live-p selected-window) >> (select-window selected-window))) >> (kill-local-variable 'slime-popup-restore-data))) >> >> popup-window is the window that displays the help content at W2. >> selected-window was selected at W1. >> old-buffer was the buffer associated with popup-window at W1. > > How do you get the `old-buffer' and `popup-window' values in general? > By comparing window configurations before and after `display-buffer'? > My code included for every window a variable telling whether that window > was split off by `display-buffer' or which buffer the window displayed > before it was "used" by `display-buffer'. 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. > > I recall it proved very nasty to save the old buffer value when the > window is re-used again by `display-buffer' because I had to avoid that > a "valuable" non-help content buffer value would get overwritten by the > "uselss" value of a help-content buffer. 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)))) Helmut.