Subject: bug#19012: 25.0.50; `help-window-select'

From: martin rudalics <[email-masked]>
Date: Fri, 14 Nov 2014 18:39:59 +0100

> Thanks for checking.  Hopefully someone else can check on
 > Windows 7 64-bit.

Do the following: With emacs -Q eval the code below in *scratch*.  Next
do

1. M-x view-lossage

2. Go back to the *scratch* window.

3. M-x view-lossage

4. In the *scratch* window move to the line that reads
    (defvar selected-window nil), move right after selected-window,
    type C-x C-e.

Here I get #<window 6 on *Help*>.  What do you get?

martin

(defvar selected-window nil)

(setq pop-up-frames  t)
(setq help-window-select  t)
(setq w32-grab-focus-on-raise  nil)
(add-to-list 'special-display-buffer-names
	      '("*Help*" foo ((background-color . "Thistle"))))
(defun foo (buf &optional args)
   (let (win)
     (setq win  (funcall special-display-function buf args))
     (raise-frame)
     win))

(defun view-lossage ()
   "Display last few input keystrokes and the commands run.

To record all your input, use `open-dribble-file'."
   (interactive)
   (help-setup-xref (list #'view-lossage)
		   (called-interactively-p 'interactive))
   (with-help-window (help-buffer)
     (princ " ")
     (princ (mapconcat (lambda (key)
			(cond
			 ((and (consp key) (null (car key)))
			  (format "[%s]\n" (if (symbolp (cdr key)) (cdr key)
					   "anonymous-command")))
			 ((or (integerp key) (symbolp key) (listp key))
			  (single-key-description key))
			 (t
			  (prin1-to-string key nil))))
		      (recent-keys 'include-cmds)
		      " "))
     (with-current-buffer standard-output
       (goto-char (point-min))
       (while (not (eobp))
	(move-to-column 50)
	(unless (eolp)
	  (fill-region (line-beginning-position) (line-end-position)))
	(forward-line 1))
       ;; jidanni wants to see the last keystrokes immediately.
       (set-marker help-window-point-marker (point))))

   (setq selected-window (selected-window)))