From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Drew Adams" Subject: RE: naming and/or directly addressing particular windows? Date: Sat, 1 Dec 2012 07:59:39 -0800 Message-ID: <9480173485434C39B7ACE90E55A0FBD7@us.oracle.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org To: 'Matt Price' , 'Bastien' Cc: 'drain' , Help-gnu-emacs@gnu.org, 'Org Mode' List-Id: emacs-orgmode.gnu.org > Anyway: is it possible to give/get a name for a window that persists > long enough to be called in functions? This might help: (defun icicle-make-window-alist (&optional all-p) "Return an alist of entries (WNAME . WINDOW), where WNAME names WINDOW. The name of the buffer in a window is used as its name, unless there is more than one window displaying the same buffer. In that case, WNAME includes a suffix [NUMBER], to make it a unique name. The NUMBER order among window names that differ only by their [NUMBER] is arbitrary. Non-nil argument ALL-P means use windows from all visible frames. Otherwise, use only windows from the selected frame." (lexical-let ((win-alist ()) (count 2) wname new-name) (walk-windows (lambda (w) (setq wname (buffer-name (window-buffer w))) (if (not (assoc wname win-alist)) (push (cons wname w) win-alist) (setq new-name wname) (while (assoc new-name win-alist) (setq new-name (format "%s[%d]" wname count) count (1+ count))) (push (cons new-name w) win-alist)) (setq count 2)) 'no-mini (if all-p 'visible 'this-frame)) win-alist)) (This is used in command `icicle-select-window-by-name', which in turn is the action function for multi-command `icicle-select-window'. Code here: http://www.emacswiki.org/emacs-en/download/icicles-cmd1.el.) I'm guessing that there are other, similar functions available on Emacs Wiki - start here, perhaps: http://www.emacswiki.org/emacs/CategoryWindows