-2006-10-28 Han-Wen Nienhuys <hanwen@lilypond.org>
+2006-10-28 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+ git commit e5d9c526aec8d0c7c7727068b13c346c475ac7c3
+
+ * emacsclient.patch:
+ * server.el.patch:
+ move server/emacsclient to elisp/
+
+ git commit f6191da666fd8897411e866594616cd0f7ae6350
+
+ * buildscripts/git-update-changelog.py (Commit.note_del_file):
+ apply patches too
+
+ * elisp/server.el.patch:
+ move emacs patches.
+
+ git commit 80844c903201b9df79ae81d4edcfbd299e08a9f7
+
+ * elisp/emacsclient.patch:
+ emacsclient too.
git commit 64179afe25bf5723fe9bb5a6631799c050d12de2
def read_pipe (x):
print 'pipe', x
return os.popen (x).read ()
+def system (x):
+ print x
+ return os.system (x)
+
+class PatchFailed(Exception):
+ pass
class Commit:
def __init__ (self, dict):
self.date = ' '.join (self.date.split (' ')[:-1])
self.date = time.strptime (self.date, '%a %b %d %H:%M:%S %Y')
-
+
m = re.search ('(.*)<(.*)>', self.author)
- self.email = m.group (2)
- self.name = m.group (1)
-
+ self.email = m.group (2).strip ()
+ self.name = m.group (1).strip ()
+ self.diff = read_pipe ('git show %s' % self.committish)
def touched_files (self):
files = []
def note_file (x):
files.append (x.group (1))
return ''
-
- diff = read_pipe ('git show %s' % self.committish)
+
re.sub ('\n--- a/([^\n]+)\n',
- note_file, diff)
+ note_file, self.diff)
re.sub('\n--- /dev/null\n\\+\\+\\+ b/([^\n]+)',
- note_file, diff)
+ note_file, self.diff)
return files
-def parse_commit_log (log):
- print log
+ def apply (self, add_del_files):
+ def note_add_file (x):
+ add_del_files.append (('add', x.group (1)))
+ return ''
+
+ def note_del_file (x):
+ add_del_files.append (('del', x.group (1)))
+ return ''
+
+
+ re.sub('\n--- /dev/null\n\\+\\+\\+ b/([^\n]+)',
+ note_add_file, self.diff)
+
+ re.sub('\n--- a/([^\n]+)\n\\+\\+\\+ /dev/null',
+ note_del_file, self.diff)
+
+ p = os.popen ('patch -f -p1 ', 'w')
+ p.write (self.diff)
+
+ if p.close ():
+ raise PatchFailed, self.committish
+
+def parse_commit_log (log):
committish = re.search ('^([^\n]+)', log).group (1)
author = re.search ('\nAuthor:\s+([^\n]+)', log).group (1)
date_match = re.search ('\nDate:\s+([^\n]+)', log)
return []
commits = map (parse_commit_log, re.split ('\ncommit ', log))
+ commits.reverse ()
return commits
def main ():
- p = optparse.OptionParser ("usage git-update-changelog.py --options")
+ p = optparse.OptionParser (usage="usage git-update-changelog.py [options]",
+ description="""
+Apply GIT patches and update change log.
+
+Run this file from the CVS directory, with --git-dir
+""")
p.add_option ("--start",
action='store',
default='',
dest="start",
help="start of log messages to merge.")
+
+ p.add_option ("--git-dir",
+ action='store',
+ default='',
+ dest="gitdir",
+ help="the GIT directory to merge.")
(options, args) = p.parse_args ()
print 'processing commits from ', id, options.start
+ if options.gitdir:
+ os.environ['GIT_DIR'] = options.gitdir
+
commits = parse_add_changes (options.start)
if not commits:
return
first = header (commits[0]) + '\n'
if first == log[:len (first)]:
log = log[len (first):]
-
+
+ file_adddel = []
for c in commits:
+ print 'patch ', c.committish
+ try:
+ c.apply (file_adddel)
+ except PatchFailed:
+ break
+
if c.touched_files () == ['ChangeLog']:
continue
new_log += changelog_body (c)
last_commit = c
+ for (op, f) in file_adddel:
+ if op == 'del':
+ system ('cvs remove %(f)s' % locals ())
+ if op == 'add':
+ system ('cvs add %(f)s' % locals ())
+
new_log = header (last_commit) + new_log + '\n'
log = new_log + log
+
try:
os.unlink ('ChangeLog~')
- except IOError:
+ except OSError:
pass
os.rename ('ChangeLog', 'ChangeLog~')
--- /dev/null
+diff -ur emacs-20.5/lib-src/ChangeLog emacs-hanwen/lib-src/ChangeLog
+--- emacs-20.5/lib-src/ChangeLog Fri Dec 10 17:25:36 1999
++++ emacs-hanwen/lib-src/ChangeLog Sun Jul 16 23:00:54 2000
+@@ -1,3 +1,7 @@
++2000-07-16 Han-Wen Nienhuys <hanwen@cs.uu.nl>
++
++ * emacsclient.c: Added support for +LINE:COLUMN style arguments.
++
+ 1999-12-04 Gerd Moellmann <gerd@gnu.org>
+
+ * Version 20.5 released.
+Only in emacs-hanwen/lib-src: ChangeLog~
+diff -ur emacs-20.5/lib-src/emacsclient.c emacs-hanwen/lib-src/emacsclient.c
+--- emacs-20.5/lib-src/emacsclient.c Wed Nov 3 14:12:46 1999
++++ emacs-hanwen/lib-src/emacsclient.c Sun Jul 16 22:10:35 2000
+@@ -27,6 +27,7 @@
+ #undef close
+ #undef signal
+
++#include <ctype.h>
+ #include <stdio.h>
+ #include <getopt.h>
+ #ifdef STDC_HEADERS
+@@ -323,7 +324,7 @@
+ if (*argv[i] == '+')
+ {
+ char *p = argv[i] + 1;
+- while (*p >= '0' && *p <= '9') p++;
++ while (isdigit (*p) || *p == ':') p++;
+ if (*p != 0)
+ fprintf (out, "%s/", quote_file_name (cwd));
+ }
+@@ -466,7 +467,8 @@
+ if (*modified_arg == '+')
+ {
+ char *p = modified_arg + 1;
+- while (*p >= '0' && *p <= '9') p++;
++ while (isdigit (*p) || *p == ':')
++ p++;
+ if (*p != 0)
+ need_cwd = 1;
+ }
+Only in emacs-hanwen/lib-src: emacsclient.c~
+diff -ur emacs-20.5/lib-src/emacsserver.c emacs-hanwen/lib-src/emacsserver.c
+--- emacs-20.5/lib-src/emacsserver.c Mon Feb 22 21:44:14 1999
++++ emacs-hanwen/lib-src/emacsserver.c Sun Jul 16 22:09:52 2000
+@@ -61,6 +61,7 @@
+ #include <errno.h>
+ #include <sys/stat.h>
+
++
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+Only in emacs-hanwen/lib-src: emacsserver.c~
+Only in emacs-hanwen/lib-src: suf.el~
+diff -ur emacs-20.5/lisp/ChangeLog emacs-hanwen/lisp/ChangeLog
+--- emacs-20.5/lisp/ChangeLog Fri Dec 10 17:25:02 1999
++++ emacs-hanwen/lisp/ChangeLog Sun Jul 16 23:00:04 2000
+@@ -1,3 +1,8 @@
++2000-07-16 Han-Wen Nienhuys <hanwen@cs.uu.nl>
++
++ * server.el (server-process-filter,server-visit-files): add support for "LINE:COLUMN"
++ style emacsclient calls.
++
+ 1999-12-04 Gerd Moellmann <gerd@gnu.org>
+
+ * Version 20.5 released.
+Only in emacs-hanwen/lisp: ChangeLog~
+diff -ur emacs-20.5/lisp/server.el emacs-hanwen/lisp/server.el
+--- emacs-20.5/lisp/server.el Sat Mar 13 01:20:25 1999
++++ emacs-hanwen/lisp/server.el Sun Jul 16 23:04:41 2000
+@@ -215,7 +215,8 @@
+ default-file-name-coding-system)))
+ client nowait
+ (files nil)
+- (lineno 1))
++ (lineno 1)
++ (columnno 0))
+ ;; Remove this line from STRING.
+ (setq string (substring string (match-end 0)))
+ (if (string-match "^Error: " request)
+@@ -232,9 +233,17 @@
+ (setq request (substring request (match-end 0)))
+ (if (string-match "\\`-nowait" arg)
+ (setq nowait t)
+- (if (string-match "\\`\\+[0-9]+\\'" arg)
+- ;; ARG is a line number option.
+- (setq lineno (read (substring arg 1)))
++ (cond
++ ;; ARG is a line number option.
++ ((string-match "\\`\\+[0-9]+\\'" arg)
++ (setq lineno (read (substring arg 1)))
++ )
++ ;; ARG is line number / column option.
++ ((string-match "\\`\\+[0-9]+:[0-9]+\\'" arg)
++ (setq lineno (read (substring arg 1 (string-match ":" arg))))
++ (setq columnno (read (substring arg (+ 1 (string-match ":" arg)))))
++ )
++ (t
+ ;; ARG is a file name.
+ ;; Collapse multiple slashes to single slashes.
+ (setq arg (command-line-normalize-file-name arg))
+@@ -253,9 +262,11 @@
+ (if coding-system
+ (setq arg (decode-coding-string arg coding-system)))
+ (setq files
+- (cons (list arg lineno)
++ (cons (list arg lineno columnno)
+ files))
+- (setq lineno 1)))))
++ (setq lineno 1)
++ (setq columnno 0)
++ )))))
+ (server-visit-files files client nowait)
+ ;; CLIENT is now a list (CLIENTNUM BUFFERS...)
+ (or nowait
+@@ -267,9 +278,11 @@
+ ;; Save for later any partial line that remains.
+ (setq server-previous-string string))
+
++
++
+ (defun server-visit-files (files client &optional nowait)
+ "Finds FILES and returns the list CLIENT with the buffers nconc'd.
+-FILES is an alist whose elements are (FILENAME LINENUMBER).
++FILES is an alist whose elements are (FILENAME LINENUMBER COLUMNNUMBER).
+ NOWAIT non-nil means this client is not waiting for the results,
+ so don't mark these buffers specially, just visit them normally."
+ ;; Bind last-nonmenu-event to force use of keyboard, not mouse, for queries.
+@@ -297,6 +310,7 @@
+ (set-buffer (find-file-noselect filen))
+ (run-hooks 'server-visit-hook)))
+ (goto-line (nth 1 (car files)))
++ (move-to-column (nth 2 (car files)))
+ (if (not nowait)
+ (setq server-buffer-clients
+ (cons (car client) server-buffer-clients)))
+@@ -304,6 +318,7 @@
+ (setq files (cdr files)))
+ (set-buffer obuf))
+ (nconc client client-record)))
++
+ \f
+ (defun server-buffer-done (buffer &optional for-killing)
+ "Mark BUFFER as \"done\" for its client(s).
+Only in emacs-hanwen/lisp: server.el.orig
+Only in emacs-hanwen/lisp: server.el~
--- /dev/null
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Subject: Bugfix and feature for server.el
+To: emacs-devel@gnu.org
+cc: Han-Wen <hanwen@cs.uu.nl>
+Date: Sat, 10 Aug 2002 17:46:22 +0200
+Organization: Jan at Peder
+
+
+Find the following fix attached. We had a problem with our
+application that uses `emacslient --no-wait' to edit input files.
+
+Emacs-21.2 (unlike previous versions), when invoked through
+`emacsclient --no-wait', wants to revert buffers whenever they have
+been edited, and does allow any editing, which is annoying. When
+invoking with --no-wait, we are typically `moving around' and editing
+the same file all the time; and do not want to revert.
+
+When it does revert the buffer, it does not use the column argument of
+emacsclient; this is now fixed.
+
+Greetings,
+Han-Wen and Jan.
+
+
+Btw: this message was sent to bug-gnu-emacs about three weeks ago, but
+ that list seems to be slightly foobarred? We both have current
+ disclaimers with GNU.
+
+
+ChangeLog:
+2002-07-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * server.el (server-process-filter): Cleanup stray if. Add
+ 'no-revert to file list entry when emacsclient was invoked with
+ '--no-wait'.
+ (server-visit-files): New function goto-line-column. Accept
+ 'no-revert option. Bugfix: also goto column when reverting
+ buffer.
+
+--- server.el.~1.78.~ 2001-12-18 17:42:38.000000000 +0100
++++ server.el 2002-08-10 17:32:10.000000000 +0200
+@@ -251,40 +251,43 @@ Prefix arg means just kill any existing
+ (substring request (match-beginning 0) (1- (match-end 0))))
+ (pos 0))
+ (setq request (substring request (match-end 0)))
+- (if (string-match "\\`-nowait" arg)
+- (setq nowait t)
+- (cond
+- ;; ARG is a line number option.
+- ((string-match "\\`\\+[0-9]+\\'" arg)
++ (cond
++ ((string-match "\\`-nowait" arg)
++ (setq nowait t))
++ ;; ARG is a line number option.
++ ((string-match "\\`\\+[0-9]+\\'" arg)
+ (setq lineno (string-to-int (substring arg 1))))
+- ;; ARG is line number:column option.
+- ((string-match "\\`+\\([0-9]+\\):\\([0-9]+\\)\\'" arg)
+- (setq lineno (string-to-int (match-string 1 arg))
+- columnno (string-to-int (match-string 2 arg))))
+- (t
+- ;; ARG is a file name.
+- ;; Collapse multiple slashes to single slashes.
+- (setq arg (command-line-normalize-file-name arg))
+- ;; Undo the quoting that emacsclient does
+- ;; for certain special characters.
+- (while (string-match "&." arg pos)
+- (setq pos (1+ (match-beginning 0)))
+- (let ((nextchar (aref arg pos)))
+- (cond ((= nextchar ?&)
+- (setq arg (replace-match "&" t t arg)))
+- ((= nextchar ?-)
+- (setq arg (replace-match "-" t t arg)))
+- (t
+- (setq arg (replace-match " " t t arg))))))
+- ;; Now decode the file name if necessary.
+- (if coding-system
+- (setq arg (decode-coding-string arg coding-system)))
+- (setq files
+- (cons (list arg lineno columnno)
+- files))
+- (setq lineno 1)
+- (setq columnno 0))))))
+- (run-hooks 'pre-command-hook)
++ ;; ARG is line number:column option.
++ ((string-match "\\`+\\([0-9]+\\):\\([0-9]+\\)\\'" arg)
++ (setq lineno (string-to-int (match-string 1 arg))
++ columnno (string-to-int (match-string 2 arg))))
++ (t
++ ;; ARG is a file name.
++ ;; Collapse multiple slashes to single slashes.
++ (setq arg (command-line-normalize-file-name arg))
++ ;; Undo the quoting that emacsclient does
++ ;; for certain special characters.
++ (while (string-match "&." arg pos)
++ (setq pos (1+ (match-beginning 0)))
++ (let ((nextchar (aref arg pos)))
++ (cond ((= nextchar ?&)
++ (setq arg (replace-match "&" t t arg)))
++ ((= nextchar ?-)
++ (setq arg (replace-match "-" t t arg)))
++ (t
++ (setq arg (replace-match " " t t arg))))))
++ ;; Now decode the file name if necessary.
++ (if coding-system
++ (setq arg (decode-coding-string arg coding-system)))
++ (setq files
++ ;; When invoking emacsclient with --no-wait, we are
++ ;; typically `moving around' and editing the same file;
++ ;; and do not want to revert. Should make --no-revert
++ ;; option for emacsclient?
++ (cons (list arg lineno columnno (if nowait 'no-revert nil))
++ files))
++ (setq lineno 1)
++ (setq columnno 0)))))
+ (server-visit-files files client nowait)
+ (run-hooks 'post-command-hook)
+ ;; CLIENT is now a list (CLIENTNUM BUFFERS...)
+@@ -309,6 +312,13 @@ Prefix arg means just kill any existing
+ FILES is an alist whose elements are (FILENAME LINENUMBER COLUMNNUMBER).
+ NOWAIT non-nil means this client is not waiting for the results,
+ so don't mark these buffers specially, just visit them normally."
++
++ (defun goto-line-column (file-line-col)
++ (goto-line (nth 1 file-line-col))
++ (let ((column-number (nth 2 file-line-col)))
++ (if (> column-number 0)
++ (move-to-column (1- column-number)))))
++
+ ;; Bind last-nonmenu-event to force use of keyboard, not mouse, for queries.
+ (let (client-record (last-nonmenu-event t) (obuf (current-buffer)))
+ ;; Restore the current buffer afterward, but not using save-excursion,
+@@ -322,7 +332,8 @@ so don't mark these buffers specially, j
+ (let* ((filen (car (car files)))
+ (obuf (get-file-buffer filen)))
+ (push filen file-name-history)
+- (if (and obuf (set-buffer obuf))
++ (if (and obuf (set-buffer obuf)
++ (not (memq 'no-revert (car files))))
+ (progn
+ (cond ((file-exists-p filen)
+ (if (or (not (verify-visited-file-modtime obuf))
+@@ -335,12 +346,9 @@ so don't mark these buffers specially, j
+ ", write buffer to file? "))
+ (write-file filen))))
+ (setq server-existing-buffer t)
+- (goto-line (nth 1 (car files))))
++ (goto-line-column (car files)))
+ (set-buffer (find-file-noselect filen))
+- (goto-line (nth 1 (car files)))
+- (let ((column-number (nth 2 (car files))))
+- (when (> column-number 0)
+- (move-to-column (1- column-number))))
++ (goto-line-column (car files))
+ (run-hooks 'server-visit-hook)))
+ (if (not nowait)
+ (setq server-buffer-clients
+
+--
+Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
+http://www.xs4all.nl/~jantien | http://www.lilypond.org
+
+
+
+
+++ /dev/null
-diff -ur emacs-20.5/lib-src/ChangeLog emacs-hanwen/lib-src/ChangeLog
---- emacs-20.5/lib-src/ChangeLog Fri Dec 10 17:25:36 1999
-+++ emacs-hanwen/lib-src/ChangeLog Sun Jul 16 23:00:54 2000
-@@ -1,3 +1,7 @@
-+2000-07-16 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-+
-+ * emacsclient.c: Added support for +LINE:COLUMN style arguments.
-+
- 1999-12-04 Gerd Moellmann <gerd@gnu.org>
-
- * Version 20.5 released.
-Only in emacs-hanwen/lib-src: ChangeLog~
-diff -ur emacs-20.5/lib-src/emacsclient.c emacs-hanwen/lib-src/emacsclient.c
---- emacs-20.5/lib-src/emacsclient.c Wed Nov 3 14:12:46 1999
-+++ emacs-hanwen/lib-src/emacsclient.c Sun Jul 16 22:10:35 2000
-@@ -27,6 +27,7 @@
- #undef close
- #undef signal
-
-+#include <ctype.h>
- #include <stdio.h>
- #include <getopt.h>
- #ifdef STDC_HEADERS
-@@ -323,7 +324,7 @@
- if (*argv[i] == '+')
- {
- char *p = argv[i] + 1;
-- while (*p >= '0' && *p <= '9') p++;
-+ while (isdigit (*p) || *p == ':') p++;
- if (*p != 0)
- fprintf (out, "%s/", quote_file_name (cwd));
- }
-@@ -466,7 +467,8 @@
- if (*modified_arg == '+')
- {
- char *p = modified_arg + 1;
-- while (*p >= '0' && *p <= '9') p++;
-+ while (isdigit (*p) || *p == ':')
-+ p++;
- if (*p != 0)
- need_cwd = 1;
- }
-Only in emacs-hanwen/lib-src: emacsclient.c~
-diff -ur emacs-20.5/lib-src/emacsserver.c emacs-hanwen/lib-src/emacsserver.c
---- emacs-20.5/lib-src/emacsserver.c Mon Feb 22 21:44:14 1999
-+++ emacs-hanwen/lib-src/emacsserver.c Sun Jul 16 22:09:52 2000
-@@ -61,6 +61,7 @@
- #include <errno.h>
- #include <sys/stat.h>
-
-+
- #ifdef HAVE_UNISTD_H
- #include <unistd.h>
- #endif
-Only in emacs-hanwen/lib-src: emacsserver.c~
-Only in emacs-hanwen/lib-src: suf.el~
-diff -ur emacs-20.5/lisp/ChangeLog emacs-hanwen/lisp/ChangeLog
---- emacs-20.5/lisp/ChangeLog Fri Dec 10 17:25:02 1999
-+++ emacs-hanwen/lisp/ChangeLog Sun Jul 16 23:00:04 2000
-@@ -1,3 +1,8 @@
-+2000-07-16 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-+
-+ * server.el (server-process-filter,server-visit-files): add support for "LINE:COLUMN"
-+ style emacsclient calls.
-+
- 1999-12-04 Gerd Moellmann <gerd@gnu.org>
-
- * Version 20.5 released.
-Only in emacs-hanwen/lisp: ChangeLog~
-diff -ur emacs-20.5/lisp/server.el emacs-hanwen/lisp/server.el
---- emacs-20.5/lisp/server.el Sat Mar 13 01:20:25 1999
-+++ emacs-hanwen/lisp/server.el Sun Jul 16 23:04:41 2000
-@@ -215,7 +215,8 @@
- default-file-name-coding-system)))
- client nowait
- (files nil)
-- (lineno 1))
-+ (lineno 1)
-+ (columnno 0))
- ;; Remove this line from STRING.
- (setq string (substring string (match-end 0)))
- (if (string-match "^Error: " request)
-@@ -232,9 +233,17 @@
- (setq request (substring request (match-end 0)))
- (if (string-match "\\`-nowait" arg)
- (setq nowait t)
-- (if (string-match "\\`\\+[0-9]+\\'" arg)
-- ;; ARG is a line number option.
-- (setq lineno (read (substring arg 1)))
-+ (cond
-+ ;; ARG is a line number option.
-+ ((string-match "\\`\\+[0-9]+\\'" arg)
-+ (setq lineno (read (substring arg 1)))
-+ )
-+ ;; ARG is line number / column option.
-+ ((string-match "\\`\\+[0-9]+:[0-9]+\\'" arg)
-+ (setq lineno (read (substring arg 1 (string-match ":" arg))))
-+ (setq columnno (read (substring arg (+ 1 (string-match ":" arg)))))
-+ )
-+ (t
- ;; ARG is a file name.
- ;; Collapse multiple slashes to single slashes.
- (setq arg (command-line-normalize-file-name arg))
-@@ -253,9 +262,11 @@
- (if coding-system
- (setq arg (decode-coding-string arg coding-system)))
- (setq files
-- (cons (list arg lineno)
-+ (cons (list arg lineno columnno)
- files))
-- (setq lineno 1)))))
-+ (setq lineno 1)
-+ (setq columnno 0)
-+ )))))
- (server-visit-files files client nowait)
- ;; CLIENT is now a list (CLIENTNUM BUFFERS...)
- (or nowait
-@@ -267,9 +278,11 @@
- ;; Save for later any partial line that remains.
- (setq server-previous-string string))
-
-+
-+
- (defun server-visit-files (files client &optional nowait)
- "Finds FILES and returns the list CLIENT with the buffers nconc'd.
--FILES is an alist whose elements are (FILENAME LINENUMBER).
-+FILES is an alist whose elements are (FILENAME LINENUMBER COLUMNNUMBER).
- NOWAIT non-nil means this client is not waiting for the results,
- so don't mark these buffers specially, just visit them normally."
- ;; Bind last-nonmenu-event to force use of keyboard, not mouse, for queries.
-@@ -297,6 +310,7 @@
- (set-buffer (find-file-noselect filen))
- (run-hooks 'server-visit-hook)))
- (goto-line (nth 1 (car files)))
-+ (move-to-column (nth 2 (car files)))
- (if (not nowait)
- (setq server-buffer-clients
- (cons (car client) server-buffer-clients)))
-@@ -304,6 +318,7 @@
- (setq files (cdr files)))
- (set-buffer obuf))
- (nconc client client-record)))
-+
- \f
- (defun server-buffer-done (buffer &optional for-killing)
- "Mark BUFFER as \"done\" for its client(s).
-Only in emacs-hanwen/lisp: server.el.orig
-Only in emacs-hanwen/lisp: server.el~
+++ /dev/null
-From: Jan Nieuwenhuizen <janneke@gnu.org>
-Subject: Bugfix and feature for server.el
-To: emacs-devel@gnu.org
-cc: Han-Wen <hanwen@cs.uu.nl>
-Date: Sat, 10 Aug 2002 17:46:22 +0200
-Organization: Jan at Peder
-
-
-Find the following fix attached. We had a problem with our
-application that uses `emacslient --no-wait' to edit input files.
-
-Emacs-21.2 (unlike previous versions), when invoked through
-`emacsclient --no-wait', wants to revert buffers whenever they have
-been edited, and does allow any editing, which is annoying. When
-invoking with --no-wait, we are typically `moving around' and editing
-the same file all the time; and do not want to revert.
-
-When it does revert the buffer, it does not use the column argument of
-emacsclient; this is now fixed.
-
-Greetings,
-Han-Wen and Jan.
-
-
-Btw: this message was sent to bug-gnu-emacs about three weeks ago, but
- that list seems to be slightly foobarred? We both have current
- disclaimers with GNU.
-
-
-ChangeLog:
-2002-07-21 Jan Nieuwenhuizen <janneke@gnu.org>
-
- * server.el (server-process-filter): Cleanup stray if. Add
- 'no-revert to file list entry when emacsclient was invoked with
- '--no-wait'.
- (server-visit-files): New function goto-line-column. Accept
- 'no-revert option. Bugfix: also goto column when reverting
- buffer.
-
---- server.el.~1.78.~ 2001-12-18 17:42:38.000000000 +0100
-+++ server.el 2002-08-10 17:32:10.000000000 +0200
-@@ -251,40 +251,43 @@ Prefix arg means just kill any existing
- (substring request (match-beginning 0) (1- (match-end 0))))
- (pos 0))
- (setq request (substring request (match-end 0)))
-- (if (string-match "\\`-nowait" arg)
-- (setq nowait t)
-- (cond
-- ;; ARG is a line number option.
-- ((string-match "\\`\\+[0-9]+\\'" arg)
-+ (cond
-+ ((string-match "\\`-nowait" arg)
-+ (setq nowait t))
-+ ;; ARG is a line number option.
-+ ((string-match "\\`\\+[0-9]+\\'" arg)
- (setq lineno (string-to-int (substring arg 1))))
-- ;; ARG is line number:column option.
-- ((string-match "\\`+\\([0-9]+\\):\\([0-9]+\\)\\'" arg)
-- (setq lineno (string-to-int (match-string 1 arg))
-- columnno (string-to-int (match-string 2 arg))))
-- (t
-- ;; ARG is a file name.
-- ;; Collapse multiple slashes to single slashes.
-- (setq arg (command-line-normalize-file-name arg))
-- ;; Undo the quoting that emacsclient does
-- ;; for certain special characters.
-- (while (string-match "&." arg pos)
-- (setq pos (1+ (match-beginning 0)))
-- (let ((nextchar (aref arg pos)))
-- (cond ((= nextchar ?&)
-- (setq arg (replace-match "&" t t arg)))
-- ((= nextchar ?-)
-- (setq arg (replace-match "-" t t arg)))
-- (t
-- (setq arg (replace-match " " t t arg))))))
-- ;; Now decode the file name if necessary.
-- (if coding-system
-- (setq arg (decode-coding-string arg coding-system)))
-- (setq files
-- (cons (list arg lineno columnno)
-- files))
-- (setq lineno 1)
-- (setq columnno 0))))))
-- (run-hooks 'pre-command-hook)
-+ ;; ARG is line number:column option.
-+ ((string-match "\\`+\\([0-9]+\\):\\([0-9]+\\)\\'" arg)
-+ (setq lineno (string-to-int (match-string 1 arg))
-+ columnno (string-to-int (match-string 2 arg))))
-+ (t
-+ ;; ARG is a file name.
-+ ;; Collapse multiple slashes to single slashes.
-+ (setq arg (command-line-normalize-file-name arg))
-+ ;; Undo the quoting that emacsclient does
-+ ;; for certain special characters.
-+ (while (string-match "&." arg pos)
-+ (setq pos (1+ (match-beginning 0)))
-+ (let ((nextchar (aref arg pos)))
-+ (cond ((= nextchar ?&)
-+ (setq arg (replace-match "&" t t arg)))
-+ ((= nextchar ?-)
-+ (setq arg (replace-match "-" t t arg)))
-+ (t
-+ (setq arg (replace-match " " t t arg))))))
-+ ;; Now decode the file name if necessary.
-+ (if coding-system
-+ (setq arg (decode-coding-string arg coding-system)))
-+ (setq files
-+ ;; When invoking emacsclient with --no-wait, we are
-+ ;; typically `moving around' and editing the same file;
-+ ;; and do not want to revert. Should make --no-revert
-+ ;; option for emacsclient?
-+ (cons (list arg lineno columnno (if nowait 'no-revert nil))
-+ files))
-+ (setq lineno 1)
-+ (setq columnno 0)))))
- (server-visit-files files client nowait)
- (run-hooks 'post-command-hook)
- ;; CLIENT is now a list (CLIENTNUM BUFFERS...)
-@@ -309,6 +312,13 @@ Prefix arg means just kill any existing
- FILES is an alist whose elements are (FILENAME LINENUMBER COLUMNNUMBER).
- NOWAIT non-nil means this client is not waiting for the results,
- so don't mark these buffers specially, just visit them normally."
-+
-+ (defun goto-line-column (file-line-col)
-+ (goto-line (nth 1 file-line-col))
-+ (let ((column-number (nth 2 file-line-col)))
-+ (if (> column-number 0)
-+ (move-to-column (1- column-number)))))
-+
- ;; Bind last-nonmenu-event to force use of keyboard, not mouse, for queries.
- (let (client-record (last-nonmenu-event t) (obuf (current-buffer)))
- ;; Restore the current buffer afterward, but not using save-excursion,
-@@ -322,7 +332,8 @@ so don't mark these buffers specially, j
- (let* ((filen (car (car files)))
- (obuf (get-file-buffer filen)))
- (push filen file-name-history)
-- (if (and obuf (set-buffer obuf))
-+ (if (and obuf (set-buffer obuf)
-+ (not (memq 'no-revert (car files))))
- (progn
- (cond ((file-exists-p filen)
- (if (or (not (verify-visited-file-modtime obuf))
-@@ -335,12 +346,9 @@ so don't mark these buffers specially, j
- ", write buffer to file? "))
- (write-file filen))))
- (setq server-existing-buffer t)
-- (goto-line (nth 1 (car files))))
-+ (goto-line-column (car files)))
- (set-buffer (find-file-noselect filen))
-- (goto-line (nth 1 (car files)))
-- (let ((column-number (nth 2 (car files))))
-- (when (> column-number 0)
-- (move-to-column (1- column-number))))
-+ (goto-line-column (car files))
- (run-hooks 'server-visit-hook)))
- (if (not nowait)
- (setq server-buffer-clients
-
---
-Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
-http://www.xs4all.nl/~jantien | http://www.lilypond.org
-
-
-
-