+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>
(`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>
* 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>
(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
;; 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
(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))