Subject: bug#14676: 24.3.50; winner doesn't immediately notice windows created by server

From: Michael Heerdegen <[email-masked]>
Date: Sun, 23 Jun 2013 00:44:13 +0200

Stefan Monnier <[email-masked]> writes:

> Can you show me the patch you tested?

I tested this:

*** /home/micha/today/server.el	2013-06-23 00:21:58.737341216 +0200
--- /home/micha/today/server-new.el	2013-06-23 00:27:31.470493560 +0200
***************
*** 1292,1298 ****
                (message "%s" (substitute-command-keys
                               "When done with a buffer, type \\[server-edit]")))))
            (when (and frame (null tty-name))
!             (server-unselect-display frame)))
        ((quit error)
         (when (eq (car err) 'quit)
           (message "Quit emacsclient request"))
--- 1292,1299 ----
                (message "%s" (substitute-command-keys
                               "When done with a buffer, type \\[server-edit]")))))
            (when (and frame (null tty-name))
!             (server-unselect-display frame))
! 	  (run-hooks 'post-command-hook))
        ((quit error)
         (when (eq (car err) 'quit)
           (message "Quit emacsclient request"))
***************
*** 1360,1368 ****
              (unless server-buffer-clients
                (setq server-existing-buffer t)))
            (server-goto-line-column (cdr file))
!           (run-hooks 'server-visit-hook)
! 	  ;; hooks may be specific to current buffer:
! 	  (run-hooks 'post-command-hook))
  	(unless nowait
  	  ;; When the buffer is killed, inform the clients.
  	  (add-hook 'kill-buffer-hook 'server-kill-buffer nil t)
--- 1361,1367 ----
              (unless server-buffer-clients
                (setq server-existing-buffer t)))
            (server-goto-line-column (cdr file))
!           (run-hooks 'server-visit-hook))
  	(unless nowait
  	  ;; When the buffer is killed, inform the clients.
  	  (add-hook 'kill-buffer-hook 'server-kill-buffer nil t)

Note that I don't know anything about server.el, I just did what you
proposed.

Anyway, it fixes the problem - with my setup as well as for -Q.

BTW, I didn't know what was meant with this comment:

| ;; hooks may be specific to current buffer:

so I just removed it.

Michael.