emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saveplace does not work with emacsclient


From: Stefan Monnier
Subject: Re: saveplace does not work with emacsclient
Date: Tue, 15 Jan 2008 16:50:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>> I have temporarily fixed the bug now, by setting
>> 
>> (setq server-visit-hook (quote (save-place-find-file-hook)))
>> 
>> in my .emacs file. I must yet see whether this interferes with inverse
>> search, ie when emacsclient(w) is called with the +[line] option.

> No, it doesn't interfere, so it's a good solution for the moment.
> Something similar should preferably be present either in saveplace.el or
> in server.el.

Can you try the patch below (and remove your temporary workaround of
course) and tell us if it fixes the problem?


        Stefan


--- orig/lisp/server.el
+++ mod/lisp/server.el
@@ -805,8 +805,8 @@
                 (tty-name nil)       ;nil, `window-system', or the tty name.
                 tty-type             ;string.
                (files nil)
-               (lineno 1)
-               (columnno 0)
+               (lineno nil)
+               (columnno nil)
                command-line-args-left
                arg)
            ;; Remove this line from STRING.
@@ -889,9 +889,10 @@
                    (setq file (command-line-normalize-file-name file))
                    (push (list file lineno columnno) files)
                    (server-log (format "New file: %s (%d:%d)"
-                                        file lineno columnno) proc))
-                 (setq lineno 1
-                       columnno 0))
+                                        file (or lineno 0) (or columnno 0))
+                                proc))
+                 (setq lineno nil
+                       columnno nil))
 
                 ;; -eval EXPR:  Evaluate a Lisp expression.
                 ((and (equal "-eval" arg)
@@ -901,8 +902,8 @@
                        (setq expr (decode-coding-string expr coding-system)))
                     (push (lambda () (server-eval-and-print expr proc))
                           commands)
-                   (setq lineno 1
-                         columnno 0)))
+                   (setq lineno nil
+                         columnno nil)))
 
                 ;; -env NAME=VALUE:  An environment variable.
                 ((and (equal "-env" arg) command-line-args-left)
@@ -995,10 +996,11 @@
   "Move point to the position indicated in FILE-LINE-COL.
 FILE-LINE-COL should be a three-element list as described in
 `server-visit-files'."
-  (goto-line (nth 1 file-line-col))
-  (let ((column-number (nth 2 file-line-col)))
-    (when (> column-number 0)
-      (move-to-column (1- column-number)))))
+  (when (nth 1 file-line-col)
+    (goto-line (nth 1 file-line-col))
+    (let ((column-number (nth 2 file-line-col)))
+      (when (> column-number 0)
+        (move-to-column (1- column-number))))))
 
 (defun server-visit-files (files proc &optional nowait)
   "Find FILES and return a list of buffers created.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]