Subject: RE: bug#13154: 24.3.50; emacs_backtrace.txt (different one)

From: "Drew Adams" <[email-masked]>
Date: Fri, 14 Dec 2012 07:51:13 -0800

>  >> FWIW, it's not clear to me that `w-o-t-t-b' inside `s-e' 
>  >> is "evil".  It might be ineffectual in some contexts,
>  >> in the sense that it might not do what some users
>  >> mistakenly might expect, but - for my own understanding - 
>  >> just why do you consider it evil?
>  >
>  > Martin will probably tell,
> 
> It's evil because `with-output-to-temp-buffer' may pop up a new frame
> while `save-window-excursion' gives you the false impression 
> that it can cope with that situation.

That's exactly what I meant by "It might be ineffectual in some contexts, in the
sense that it might not do what some users mistakenly might expect."

In practice (IMHO), that is probably more of a problem/annoyance for Emacs Dev,
having to field false-bug reports from users, than it is a real problem for
users.  Just one opinion.

>  >> * I found an occurrence in my version of 
>  >> `describe-function', which is based on
>  >> the vanilla Emacs 22 version in this respect.  It has to 
>  >> work for 22+, and 22 does not have macro `with-help-window'.
>  >>
>  >> * I found one other occurrence of 
>  >> `with-output-to-temp-buffer' inside `save-excursion', but
>  >> that code is used only when running Emacs 22, and it is a
>  >> copy of the vanilla Emacs 22 code (for 
>  >> `describe-text-properties').  IOW, the fault is with
>  >> vanilla Emacs in this case, and this case cannot be
>  >> manifested in Emacs 24 anyway.
> 
> `save-window-excursion' and not `save-excursion', I presume.

No, `save-excursion'.  It is `save-excursion' that occurs in the vanilla Emacs
22 code, in both cases (vanilla `describe-function' and `describe-variable', for
Emacs 22 and prior).  Emacs was "evil" for decades...

> I still don't know whether you are sure that Drew runs some 
> code within `window-configuration-change-hook'.

Didn't know I was expected to look for that one.  Grepping for
`window-configuration-change-hook' finds the following two occurrences:

1. Inside the definition of command `dired-sort-dialogue' (from Francis Wright's
library dired-sort-menu.el).  But I did not invoke this command, AFAIK.

(add-hook 'window-configuration-change-hook
          'dired-sort-dialogue-auto-kill-2)

2. In pp-c-l.el.  I do use this one.

(add-hook 'window-configuration-change-hook
          'refresh-pretty-control-l)

(defun refresh-pretty-control-l ()
  "Reinitialize `pretty-control-l-mode', if on, to update the display."
  (interactive)
  (when pretty-control-l-mode (pretty-control-l-mode t)))

`pretty-control-l-mode' is a global minor mode that does only this:

(walk-windows 
  (lambda (window)
    (let ((display-table  (or (window-display-table window)
                              (make-display-table))))
      (aset display-table ?\014
            (and pretty-control-l-mode
                 (pp^L-^L-display-table-entry window)))
      (set-window-display-table window display-table)))
  'no-minibuf
  'visible)

HTH.