# HG changeset patch # User Juanma Barranquero # Date 1163152011 0 # Node ID 7e65038a5be17ac8583ecfa30e42f76bf9f7da52 # Parent 2896142f696404ac8f8a94005d239e883d0be595 (server-raise-frame): New option. (server-switch-buffer): Use it. diff -r 2896142f6964 -r 7e65038a5be1 lisp/server.el --- a/lisp/server.el Fri Nov 10 09:38:11 2006 +0000 +++ b/lisp/server.el Fri Nov 10 09:46:51 2006 +0000 @@ -112,6 +112,12 @@ :version "22.1") (put 'server-auth-dir 'risky-local-variable t) +(defcustom server-raise-frame t + "*If non-nil, raise frame when switching to a buffer." + :group 'server + :type 'boolean + :version "22.1") + (defcustom server-visit-hook nil "*Hook run when visiting a file for the Emacs server." :group 'server @@ -702,11 +708,9 @@ (let ((win (get-buffer-window next-buffer 0))) (if (and win (not server-window)) ;; The buffer is already displayed: just reuse the window. - (let ((frame (window-frame win))) - (when (eq (frame-visible-p frame) 'icon) - (raise-frame frame)) - (select-window win) - (set-buffer next-buffer)) + (progn + (select-window win) + (set-buffer next-buffer)) ;; Otherwise, let's find an appropriate window. (cond ((and (windowp server-window) (window-live-p server-window)) @@ -730,7 +734,9 @@ (switch-to-buffer next-buffer) ;; After all the above, we might still have ended up with ;; a minibuffer/dedicated-window (if there's no other). - (error (pop-to-buffer next-buffer))))))))) + (error (pop-to-buffer next-buffer))))))) + (when server-raise-frame + (select-frame-set-input-focus (window-frame (selected-window)))))) (define-key ctl-x-map "#" 'server-edit)