From: Joakim Hove <hove@bccs.no>
Subject: Re: Displaying the window number in the mode line?
Date: Thu, 22 May 2003 13:46:58 +0200 [thread overview]
Message-ID: <4yel2rgq4t.fsf@skjellgran.ii.uib.no> (raw)
In-Reply-To: mailman.6560.1053566934.21513.help-gnu-emacs@gnu.org
myrkraverk@users.sourceforge.net writes:
> Hi,
>
> I've made a crude hack to jump to a window with specific number, the
> functions are available at
>
> http://www.emacswiki.org/cgi-bin/wiki.pl?SwitchingWindows
>
> and have been revised a little by better elisp hackers than me :)
Looks interesting!
> This has resulted in my desire to display the window[1] number in the
> mode line. So far I've the following function to evalute the number
> of the selected window:
>
> (defun my-window-number ()
> (number-to-string
> (1- (length (memq (selected-window) (nreverse
> (window-list)))))))
>
> Then I create this list with items I want to show in the modeline:
>
> (setq window-number-string
> (list "W"
> '(:eval (my-window-number)) " "))
>
I can not really help you - but some comments:
1. The *global*-mode-string is just that - i.e. it is gloablly shared
among all windows (and even frames) - hence any code which simply
sets global-mode-string to some value will result in the same value
displayed in all windows. So (as far as I can see)
global-mode-string is not the variable to use - others can maybe
suggeste another variable to use for this?
> And add it to the global-mode-string:
>
> (add-to-list 'global-mode-string '("" window-number-string))
2. global-mode-string is a string - not a list. The following
implements (my understanding of) what you want to achieve, but with
the caveat mentioned above:
(setq global-mode-string (format "Window: %s" (my-window-number)))
The natural solution (if you can solve problem 1) above, would be
to wrap this in a function, and then add this function as a hook
called when splitting windows (I don't know if there is any such
hook).
Good Luck
Joakim
--
Joakim Hove / hove@bccs.no / (55 5) 84076
next parent reply other threads:[~2003-05-22 11:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.6560.1053566934.21513.help-gnu-emacs@gnu.org>
2003-05-22 11:46 ` Joakim Hove [this message]
2003-05-22 13:21 ` Displaying the window number in the mode line? myrkraverk
2003-05-23 9:25 ` Oliver Scholz
2003-05-22 1:14 myrkraverk
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4yel2rgq4t.fsf@skjellgran.ii.uib.no \
--to=hove@bccs.no \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.