]> git.eshelyaron.com Git - emacs.git/commitdiff
(server-buffer): New const.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 26 Jan 2008 21:54:44 +0000 (21:54 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 26 Jan 2008 21:54:44 +0000 (21:54 +0000)
(server-log): New var.
(server-log): Use them.
(server-process-filter): (Try to) run the continuation in the same cwd
as the client's.

lisp/ChangeLog
lisp/server.el

index 2bb50cd13a4bf89dbb68be5d7bfd13dd3f3906d8..d6db38e535c98e2dfdc358f7b0c4a9241bc95412 100644 (file)
@@ -1,7 +1,15 @@
+2008-01-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * server.el (server-buffer): New const.
+       (server-log): New var.
+       (server-log): Use them.
+       (server-process-filter): (Try to) run the continuation in the same cwd
+       as the client's.
+
 2008-01-26  Alan Mackenzie  <acm@muc.de>
 
-       * progmodes/cc-defs.el (c-save-buffer-state): Bind
-       buffer-file-name and buffer-file-truename to nil, to prevent
+       * progmodes/cc-defs.el (c-save-buffer-state):
+       Bind buffer-file-name and buffer-file-truename to nil, to prevent
        primitives generating "buffer is read only" messages.
 
 2008-01-20  Ulf Jasper  <ulf.jasper@web.de>
@@ -38,8 +46,8 @@
        (`vc-directory').  Maybe the implementation can be optimized.
 
        * net/tramp.el (tramp-dissect-file-name): Raise an error when
-       Tramp 2.0 syntax is used.  Suggested by Trent W. Buck
-       <trentbuck@gmail.com>.
+       Tramp 2.0 syntax is used.
+       Suggested by Trent W. Buck <trentbuck@gmail.com>.
 
 2008-01-26  Eli Zaretskii  <eliz@gnu.org>
 
@@ -53,7 +61,7 @@
 
        * blank-mode.el: New version 9.1.  Handle "long" line tail
        visualization.  Doc fix.
-       (blank-line-length): Renamed to blank-line-column.
+       (blank-line-length): Rename to blank-line-column.
        (blank-chars-value-list, blank-toggle-option-alist, blank-help-text):
        Initialization fix.
        (blank-replace-spaces-by-tabs): New fun.
 2008-01-24  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp.el (tramp-do-copy-or-rename-file): Flush the cache of
-       the source file in case of `rename'.  Reported by Pete Forman
-       <pete.forman@westerngeco.com>.
+       the source file in case of `rename'.
+       Reported by Pete Forman <pete.forman@westerngeco.com>.
 
 2008-01-24  Ken Manheimer  <ken.manheimer@gmail.com>
 
        (kill-buffer-if-not-modified): New function.
        (view-file): Don't kill the buffer if it is modified.
 
-       * progmodes/ebrowse.el (ebrowse-view-file-other-window):
-       Delete function.
-       (ebrowse-view/find-file-and-search-pattern): Call
-       view-file-other-window instead of ebrowse-view-file-other-window.
+       * progmodes/ebrowse.el (ebrowse-view-file-other-window): Delete.
+       (ebrowse-view/find-file-and-search-pattern):
+       Call view-file-other-window instead of ebrowse-view-file-other-window.
        (ebrowse-view-file-other-frame): Don't call
        current-window-configuration.  Fix second argument in the call to
        view-mode-enter.  Doc fix.
 
 2008-01-23  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * files.el (safe-local-eval-forms): Mark
-       (add-hook 'write-file-hooks 'time-stamp) as safe.
+       * files.el (safe-local-eval-forms):
+       Mark (add-hook 'write-file-hooks 'time-stamp) as safe.
 
 2008-01-23  Nick Roberts  <nickrob@snap.net.nz>
 
 
        * repeat.el (repeat-undo-count): New variable.
        (repeat): For self-insertions make undo boundary only after 20
-       repetitions.  Inhibit point recording when repeat-repeat-char is
-       non-nil.
+       repetitions.  Inhibit point recording unless repeat-repeat-char is nil.
 
 2008-01-19  Reiner Steib  <Reiner.Steib@gmx.de>
 
index 23f8eb36947bac3545d4f35420b39b255d6c7a53..d3606f5c8605fee8e4657c05721afeff8220d61e 100644 (file)
@@ -294,11 +294,20 @@ If NOFRAME is non-nil, let the frames live.  (To be used from
 (defvar server-log-time-function 'current-time-string
   "Function to generate timestamps for the *server* buffer.")
 
+(defconst server-buffer " *server*"
+  "Buffer used internally by Emacs's server.
+One use is to log the I/O for debugging purposes (see `server-log'),
+the other is to provide a current buffer in which the process filter can
+safely let-bind buffer-local variables like default-directory.")
+
+(defvar server-log nil
+  "If non-nil, log the server's inputs and outputs in the `server-buffer'.")
+
 (defun server-log (string &optional client)
-  "If a *server* buffer exists, write STRING to it for logging purposes.
+  "If `server-log' is non-nil, log STRING to `server-buffer'.
 If CLIENT is non-nil, add a description of it to the logged message."
-  (when (get-buffer "*server*")
-    (with-current-buffer "*server*"
+  (when server-log
+    (with-current-buffer (get-buffer-create server-buffer)
       (goto-char (point-max))
       (insert (funcall server-log-time-function)
              (cond
@@ -497,7 +506,7 @@ kill any existing server communications subprocess."
                       ;; Those are decoded by server-process-filter according
                       ;; to file-name-coding-system.
                       :coding 'raw-text
-                      ;; The rest of the args depends on the kind of socket used.
+                      ;; The other args depend on the kind of socket used.
                       (if server-use-tcp
                           (list :family nil
                                 :service t
@@ -928,17 +937,24 @@ The following commands are accepted by the client:
                      (server-create-window-system-frame display nowait proc))
                     (t (server-create-tty-frame tty-name tty-type proc))))
 
-            (process-put proc 'continuation
-                         (lexical-let ((proc proc)
-                                       (files files)
-                                       (nowait nowait)
-                                       (commands commands)
-                                       (dontkill dontkill)
-                                       (frame frame)
-                                       (tty-name tty-name))
-                           (lambda ()
-                             (server-execute proc files nowait commands
-                                             dontkill frame tty-name))))
+            (process-put
+             proc 'continuation
+             (lexical-let ((proc proc)
+                           (files files)
+                           (nowait nowait)
+                           (commands commands)
+                           (dontkill dontkill)
+                           (frame frame)
+                           (dir dir)
+                           (tty-name tty-name))
+               (lambda ()
+                 (with-current-buffer (get-buffer-create server-buffer)
+                   ;; Use the same cwd as the emacsclient, if possible, so
+                   ;; relative file names work correctly, even in `eval'.
+                   (let ((default-directory
+                           (if (file-directory-p dir) dir default-directory)))
+                     (server-execute proc files nowait commands
+                                     dontkill frame tty-name))))))
 
             (when (or frame files)
               (server-goto-toplevel proc))