/[emacs]/emacs/lisp/server.el
ViewVC logotype

Diff of /emacs/lisp/server.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.78 by fx, Tue Dec 18 16:42:38 2001 UTC revision 1.79 by rms, Thu Aug 15 20:13:48 2002 UTC
# Line 251  Prefix arg means just kill any existing Line 251  Prefix arg means just kill any existing
251                         (substring request (match-beginning 0) (1- (match-end 0))))                         (substring request (match-beginning 0) (1- (match-end 0))))
252                        (pos 0))                        (pos 0))
253                    (setq request (substring request (match-end 0)))                    (setq request (substring request (match-end 0)))
254                    (if (string-match "\\`-nowait" arg)                    (cond
255                        (setq nowait t)                     ((string-match "\\`-nowait" arg)
256                      (cond                      (setq nowait t))
257                          ;; ARG is a line number option.                     ;; ARG is a line number option.
258                       ((string-match "\\`\\+[0-9]+\\'" arg)                     ((string-match "\\`\\+[0-9]+\\'" arg)
259                        (setq lineno (string-to-int (substring arg 1))))                      (setq lineno (string-to-int (substring arg 1))))
260                       ;; ARG is line number:column option.                     ;; ARG is line number:column option.
261                       ((string-match "\\`+\\([0-9]+\\):\\([0-9]+\\)\\'" arg)                     ((string-match "\\`+\\([0-9]+\\):\\([0-9]+\\)\\'" arg)
262                        (setq lineno (string-to-int (match-string 1 arg))                      (setq lineno (string-to-int (match-string 1 arg))
263                              columnno (string-to-int (match-string 2 arg))))                            columnno (string-to-int (match-string 2 arg))))
264                       (t                     (t
265                        ;; ARG is a file name.                      ;; ARG is a file name.
266                        ;; Collapse multiple slashes to single slashes.                      ;; Collapse multiple slashes to single slashes.
267                        (setq arg (command-line-normalize-file-name arg))                      (setq arg (command-line-normalize-file-name arg))
268                        ;; Undo the quoting that emacsclient does                      ;; Undo the quoting that emacsclient does
269                        ;; for certain special characters.                      ;; for certain special characters.
270                        (while (string-match "&." arg pos)                      (while (string-match "&." arg pos)
271                          (setq pos (1+ (match-beginning 0)))                        (setq pos (1+ (match-beginning 0)))
272                          (let ((nextchar (aref arg pos)))                        (let ((nextchar (aref arg pos)))
273                            (cond ((= nextchar ?&)                          (cond ((= nextchar ?&)
274                                   (setq arg (replace-match "&" t t arg)))                                 (setq arg (replace-match "&" t t arg)))
275                                  ((= nextchar ?-)                                ((= nextchar ?-)
276                                   (setq arg (replace-match "-" t t arg)))                                 (setq arg (replace-match "-" t t arg)))
277                                  (t                                (t
278                                   (setq arg (replace-match " " t t arg))))))                                 (setq arg (replace-match " " t t arg))))))
279                        ;; Now decode the file name if necessary.                      ;; Now decode the file name if necessary.
280                        (if coding-system                      (if coding-system
281                            (setq arg (decode-coding-string arg coding-system)))                          (setq arg (decode-coding-string arg coding-system)))
282                        (setq files                      (setq files
283                              (cons (list arg lineno columnno)                            (cons (list arg lineno columnno)
284                                    files))                                  files))
285                        (setq lineno 1)                      (setq lineno 1)
286                        (setq columnno 0))))))                      (setq columnno 0)))))
287                (run-hooks 'pre-command-hook)                (run-hooks 'pre-command-hook)
288                (server-visit-files files client nowait)                (server-visit-files files client nowait)
289                (run-hooks 'post-command-hook)                (run-hooks 'post-command-hook)
# Line 304  Prefix arg means just kill any existing Line 304  Prefix arg means just kill any existing
304    ;; Save for later any partial line that remains.    ;; Save for later any partial line that remains.
305    (setq server-previous-string string))    (setq server-previous-string string))
306    
307    (defun server-goto-line-column (file-line-col)
308      (goto-line (nth 1 file-line-col))
309      (let ((column-number (nth 2 file-line-col)))
310        (if (> column-number 0)
311            (move-to-column (1- column-number)))))
312    
313  (defun server-visit-files (files client &optional nowait)  (defun server-visit-files (files client &optional nowait)
314    "Finds FILES and returns the list CLIENT with the buffers nconc'd.    "Finds FILES and returns the list CLIENT with the buffers nconc'd.
315  FILES is an alist whose elements are (FILENAME LINENUMBER COLUMNNUMBER).  FILES is an alist whose elements are (FILENAME LINENUMBER COLUMNNUMBER).
# Line 325  so don't mark these buffers specially, j Line 331  so don't mark these buffers specially, j
331              (if (and obuf (set-buffer obuf))              (if (and obuf (set-buffer obuf))
332                  (progn                  (progn
333                    (cond ((file-exists-p filen)                    (cond ((file-exists-p filen)
334                           (if (or (not (verify-visited-file-modtime obuf))                           (if (not (verify-visited-file-modtime obuf))
                                  (buffer-modified-p obuf))  
335                               (revert-buffer t nil)))                               (revert-buffer t nil)))
336                          (t                          (t
337                           (if (y-or-n-p                           (if (y-or-n-p
# Line 335  so don't mark these buffers specially, j Line 340  so don't mark these buffers specially, j
340                                        ", write buffer to file? "))                                        ", write buffer to file? "))
341                               (write-file filen))))                               (write-file filen))))
342                    (setq server-existing-buffer t)                    (setq server-existing-buffer t)
343                    (goto-line (nth 1 (car files))))                    (server-goto-line-column (car files)))
344                (set-buffer (find-file-noselect filen))                (set-buffer (find-file-noselect filen))
345                (goto-line (nth 1 (car files)))                (server-goto-line-column (car files))
               (let ((column-number (nth 2 (car files))))  
                 (when (> column-number 0)  
                   (move-to-column (1- column-number))))  
346                (run-hooks 'server-visit-hook)))                (run-hooks 'server-visit-hook)))
347            (if (not nowait)            (if (not nowait)
348                (setq server-buffer-clients                (setq server-buffer-clients

Legend:
Removed from v.1.78  
changed lines
  Added in v.1.79

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26