unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
Cc: Emacs Devel <emacs-devel@gnu.org>, Jason Rumney <jasonr@gnu.org>
Subject: Re: emacsclient/server finished, documentation, raising frames
Date: Thu, 9 Nov 2006 02:47:27 +0100	[thread overview]
Message-ID: <f7ccd24b0611081747w45b8b31fg611e39e485b49ede@mail.gmail.com> (raw)
In-Reply-To: <f7ccd24b0611071359g299df35fp84f40bd4d0ac279b@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1452 bytes --]

Discussion has stagnated, but still something should be done.

So this is a little patch to implement what Jason proposed: an option
to choose whether server.el raises the frame or not when switching to
a buffer.

The patch does *not* try to raise the frame in two situations:

  - In the weird "No server buffers remain to edit" case (which, if I
understand the code correctly, only happens as a result of a user
interaction, and not by calling emacsclient, so focus is not an
issue).^(1)

  - When `server-window' is a function. It is trivial to raise the
frame also in this situation (just moving the `(when
server-raise-window ...)' out of the enclosing `if'), but I feel that
it is better this way. If the user wants to raise the frame, he can do
it easily in his function, and if not, doing it ourselves would only
cause him trouble.^(2)

Does anyone oppose to installing this patch and settling the issue for
now? We can always redesign `server-window' and `server-switch-buffer'
after the release, if needed.

                          /L/e/k/t/u


^(1) BTW, I'd like to know the use case that makes this happen. I've
had to trick Emacs into killing a server-edited buffer without
server.el knowing about it to be able to trigger this part of the
code.

^(2) Counterargument: if the user has a `server-window' function and
doesn't want server.el raising the frame, he can set
`server-raise-frame' to nil. So one way or the other is fine by me.

[-- Attachment #2: server.patch --]
[-- Type: application/octet-stream, Size: 2058 bytes --]

Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.10278
diff -u -2 -r1.10278 ChangeLog
--- lisp/ChangeLog	8 Nov 2006 19:22:33 -0000	1.10278
+++ lisp/ChangeLog	9 Nov 2006 01:18:27 -0000
@@ -1,2 +1,7 @@
+2006-11-09  Juanma Barranquero  <lekktu@gmail.com>
+
+	* server.el (server-raise-frame): New option.
+	(server-switch-buffer): Use it.
+
 2006-11-08  Alan Mackenzie  <acm@muc.de>
 
Index: lisp/server.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/server.el,v
retrieving revision 1.120
diff -u -2 -r1.120 server.el
--- lisp/server.el	7 Nov 2006 10:42:52 -0000	1.120
+++ lisp/server.el	9 Nov 2006 01:18:03 -0000
@@ -113,4 +113,10 @@
 (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."
@@ -703,9 +709,7 @@
 	  (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)
@@ -731,5 +735,8 @@
 	      ;; 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)

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2006-11-09  1:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-07 12:00 emacsclient/server finished, documentation, raising frames Juanma Barranquero
2006-11-07 12:23 ` Jason Rumney
2006-11-07 14:11   ` Stefan Monnier
2006-11-07 14:27     ` Kim F. Storm
2006-11-07 14:48     ` Juanma Barranquero
2006-11-07 15:00       ` Kim F. Storm
2006-11-07 17:07       ` Stefan Monnier
2006-11-07 17:23         ` Juanma Barranquero
2006-11-07 18:22           ` Stefan Monnier
2006-11-07 21:59             ` Juanma Barranquero
2006-11-09  1:47               ` Juanma Barranquero [this message]
2006-11-09 23:30                 ` Juanma Barranquero
2006-11-09 23:45                   ` Lennart Borgman
2006-11-09 23:50                     ` Juanma Barranquero
2006-11-11  2:09                     ` Richard Stallman
2006-11-11 11:44                       ` Lennart Borgman
2006-11-11 14:16                       ` Juanma Barranquero
2006-11-12  5:14                         ` Richard Stallman
2006-11-12  5:23                           ` Juanma Barranquero
2006-11-10  9:57                 ` Juanma Barranquero
2006-11-07 14:49     ` Andreas Schwab
2006-11-07 17:09       ` Stefan Monnier
2006-11-07 17:16         ` Andreas Schwab
2006-11-07 17:36         ` Juanma Barranquero
2006-11-07 14:55     ` Jason Rumney
2006-11-07 15:27   ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0611081747w45b8b31fg611e39e485b49ede@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=jasonr@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).