changeset 73891:7e65038a5be1

(server-raise-frame): New option. (server-switch-buffer): Use it.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 10 Nov 2006 09:46:51 +0000
parents 2896142f6964
children ead560ccb1c3
files lisp/server.el
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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)