unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Clemens Fischer <ino-qc@spotteswoode.dnsalias.org>
Subject: Re: highlight current window/modeline after switching to it (solved)
Date: Sat, 22 Nov 2003 12:37:55 +0100	[thread overview]
Message-ID: <smkgpr9y.fsf_-_@ID-23066.news.dfncis.de> (raw)
In-Reply-To: 3FBA6C9A.8090203@yahoo.com

* 2003-11-18 Kevin Rodgers:

>> ;(defadvice other-window (around other-window-flash activate)
>> ;  (interactive "p")
>> ;  (setq display-time-string-forms
>> ;        '( day "/" month "/" (substring year -2)
>> ;               " " 24-hours ":" minutes
>> ;               (if time-zone " (") time-zone (if time-zone ")")))
>> ;  ad-do-it
>> ;  (setq display-time-string-forms
>> ;        '( "* " day "/" month "/" (substring year -2)
>> ;           " " 24-hours ":" minutes
>> ;           (if time-zone " (") time-zone (if time-zone ")")))
>> ;  (force-mode-line-update t)
>> ;)
>> this version leaves me with the little `*' i wanted to signify the
>> active window, but in all and everyone of them:  no help.
>
> Try making it buffer local, and simplify your code at the same time:
>
> (set (make-local-variable 'display-time-string-forms)
>       (default-value 'display-time-string-forms))
> ad-do-it
> (set (make-local-variable 'display-time-string-forms)
>       (cons "* " (default-value 'display-time-string-forms)))

your proposal(s) looked entirely logical, but i couldn't get them to
work.  so i returned to a version using hooks.  this one isn't
perfect, because at times, when eg. M-x gnus manages my buffers, i
have to press the key 'other-window is bound to once to see the mark
indicating the M-x selected-window.

;; -ino: 221103-1133
(setq cf-model-selected '(
      "-"
      mode-line-mule-info
      mode-line-modified
      mode-line-frame-identification
      mode-line-buffer-identification
      " * "
      global-mode-string
      "   %[(" mode-name
      mode-line-process minor-mode-alist "%n"
      ")%]--"
      (which-func-mode ("" which-func-format "--"))
      (line-number-mode "L%L--")
      (column-number-mode "C%c--")
      (-3 . "%p")
      "-%-"
))

(setq cf-model-egal '(
      "-"
      mode-line-mule-info
      mode-line-modified
      mode-line-frame-identification
      mode-line-buffer-identification
      "   "
      global-mode-string
      "   %[(" mode-name
      mode-line-process minor-mode-alist "%n"
      ")%]--"
      (which-func-mode ("" which-func-format "--"))
      (line-number-mode "L%L--")
      (column-number-mode "C%c--")
      (-3 . "%p")
      "-%-"
))

(defun cf-before-other-win nil
  (if (or (eq this-command 'other-window)
          (eq this-command 'select-window))
      (setq mode-line-format cf-model-egal)))

(defun cf-after-other-win nil
  (if (or (eq this-command 'other-window)
          (eq this-command 'select-window))
      (progn
        (setq mode-line-format cf-model-selected)
        (force-mode-line-update t))))

(add-hook 'pre-command-hook 'cf-before-other-win)
(add-hook 'post-command-hook 'cf-after-other-win)

> Crufty!  Does setting deactivate-mark temporarily while a pre- or
> post-command-hook function is being evaluated actually have an
> effect?

i didn't check this at all, it was part of some code pasted there.  i
don't use it.

> And the local com variable is completely unnecessary: just test (eq
> last-command 'other-window)

thanks for this tip!  the previous version had M-x string= instead,
because it's doc-string indicated it would compare symbols using their
print-string.

question:  can i be sure that elisp will always keep only one copy of
any symbol, so that i can effectively compare the pointers to them,
which is the cheapest form of comparison?

> [making elisp re-read anything it prints and get the same structure]
> It's just too ugly.

too bad.  so i have to remember that elisp gets text properties, but
there are exceptions in certain other cases.

  clemens

  parent reply	other threads:[~2003-11-22 11:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-13 20:27 highlight current window/modeline after switching to it clemens fischer
2003-11-16 19:36 ` Clemens Fischer
     [not found] ` <mailman.213.1069158630.399.help-gnu-emacs@gnu.org>
2003-11-18 19:01   ` Kevin Rodgers
2003-11-18 21:12     ` Chris McMahan
2003-11-19 12:43       ` François Fleuret
2003-11-19 14:48         ` Chris McMahan
2003-11-19 17:01           ` Kevin Rodgers
2003-11-22  9:32       ` Clemens Fischer
2003-11-22 11:37     ` Clemens Fischer [this message]
     [not found]     ` <mailman.439.1069506956.399.help-gnu-emacs@gnu.org>
2003-11-24 18:33       ` highlight current window/modeline after switching to it (solved) Kevin Rodgers

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=smkgpr9y.fsf_-_@ID-23066.news.dfncis.de \
    --to=ino-qc@spotteswoode.dnsalias.org \
    /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.
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).