emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: 'Matt Price' <moptop99@gmail.com>, 'Bastien' <bzg@altern.org>
Cc: 'drain' <aeuster@gmail.com>,
	Help-gnu-emacs@gnu.org, 'Org Mode' <emacs-orgmode@gnu.org>
Subject: RE: naming and/or directly addressing particular windows?
Date: Sat, 1 Dec 2012 07:59:39 -0800	[thread overview]
Message-ID: <9480173485434C39B7ACE90E55A0FBD7@us.oracle.com> (raw)
In-Reply-To: <CAN_Dec_UM_nY0teK_6LY+rkZGrxMycQHqGTi5vtoTK9NMtm+Vw@mail.gmail.com>

> 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

  reply	other threads:[~2012-12-01 15:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-01 15:22 naming and/or directly addressing particular windows? Matt Price
2012-12-01 15:59 ` Drew Adams [this message]
2012-12-02  5:31   ` Matt Price
2012-12-01 16:58 ` Eduardo Ochs
2012-12-02  2:41   ` Matt Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9480173485434C39B7ACE90E55A0FBD7@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=Help-gnu-emacs@gnu.org \
    --cc=aeuster@gmail.com \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).