aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKenichi Handa2013-09-12 23:48:18 +0900
committerKenichi Handa2013-09-12 23:48:18 +0900
commit56d968a488c68563c5eae8264b7d3adfee9dc684 (patch)
tree712adf1c2f7e12ac9d169958ea63760ad42fc6ce /lisp
parentb5623270b6047528786d4550cebe0b228ecadb6b (diff)
parent4dfa4b9bd944fa385b248b5b0b56e95979119420 (diff)
downloademacs-56d968a488c68563c5eae8264b7d3adfee9dc684.tar.gz
emacs-56d968a488c68563c5eae8264b7d3adfee9dc684.zip
merge trunk
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog285
-rw-r--r--lisp/arc-mode.el4
-rw-r--r--lisp/array.el11
-rw-r--r--lisp/autorevert.el2
-rw-r--r--lisp/bookmark.el31
-rw-r--r--lisp/calc/calc-help.el2
-rw-r--r--lisp/calc/calc.el48
-rw-r--r--lisp/cedet/ChangeLog75
-rw-r--r--lisp/cedet/data-debug.el18
-rw-r--r--lisp/cedet/semantic/grammar.el26
-rw-r--r--lisp/chistory.el18
-rw-r--r--lisp/comint.el28
-rw-r--r--lisp/dframe.el5
-rw-r--r--lisp/dired-x.el3
-rw-r--r--lisp/dired.el2
-rw-r--r--lisp/echistory.el1
-rw-r--r--lisp/emacs-lisp/copyright.el26
-rw-r--r--lisp/emacs-lisp/debug.el8
-rw-r--r--lisp/emacs-lisp/eldoc.el41
-rw-r--r--lisp/emulation/tpu-edt.el5
-rw-r--r--lisp/emulation/ws-mode.el114
-rw-r--r--lisp/eshell/em-alias.el17
-rw-r--r--lisp/eshell/em-glob.el5
-rw-r--r--lisp/eshell/em-ls.el38
-rw-r--r--lisp/eshell/em-pred.el2
-rw-r--r--lisp/eshell/em-rebind.el2
-rw-r--r--lisp/eshell/em-unix.el6
-rw-r--r--lisp/eshell/esh-arg.el2
-rw-r--r--lisp/eshell/esh-cmd.el2
-rw-r--r--lisp/eshell/esh-mode.el210
-rw-r--r--lisp/eshell/esh-opt.el59
-rw-r--r--lisp/eshell/esh-util.el10
-rw-r--r--lisp/eshell/esh-var.el128
-rw-r--r--lisp/eshell/eshell.el2
-rw-r--r--lisp/files.el94
-rw-r--r--lisp/gnus/ChangeLog65
-rw-r--r--lisp/gnus/gnus-art.el39
-rw-r--r--lisp/gnus/gnus-bookmark.el11
-rw-r--r--lisp/gnus/gnus-cus.el8
-rw-r--r--lisp/gnus/gnus-group.el20
-rw-r--r--lisp/gnus/gnus-icalendar.el8
-rw-r--r--lisp/gnus/gnus-kill.el46
-rw-r--r--lisp/gnus/gnus-srvr.el13
-rw-r--r--lisp/gnus/score-mode.el26
-rw-r--r--lisp/ibuffer.el15
-rw-r--r--lisp/info.el46
-rw-r--r--lisp/locate.el44
-rw-r--r--lisp/mail/mspools.el10
-rw-r--r--lisp/mail/rmail.el2
-rw-r--r--lisp/mail/rmailsum.el11
-rw-r--r--lisp/man.el15
-rw-r--r--lisp/mpc.el17
-rw-r--r--lisp/net/eudc-hotlist.el37
-rw-r--r--lisp/net/eudc.el16
-rw-r--r--lisp/net/mairix.el41
-rw-r--r--lisp/net/newst-treeview.el6
-rw-r--r--lisp/net/quickurl.el8
-rw-r--r--lisp/net/tramp-adb.el8
-rw-r--r--lisp/net/tramp-cache.el7
-rw-r--r--lisp/net/tramp-cmds.el18
-rw-r--r--lisp/net/tramp-compat.el72
-rw-r--r--lisp/net/tramp-gvfs.el31
-rw-r--r--lisp/net/tramp-gw.el2
-rw-r--r--lisp/net/tramp-sh.el192
-rw-r--r--lisp/net/tramp-smb.el24
-rw-r--r--lisp/net/tramp.el77
-rw-r--r--lisp/obsolete/options.el16
-rw-r--r--lisp/play/5x5.el15
-rw-r--r--lisp/play/blackbox.el11
-rw-r--r--lisp/play/bubbles.el37
-rw-r--r--lisp/play/landmark.el17
-rw-r--r--lisp/play/mpuz.el12
-rw-r--r--lisp/play/snake.el16
-rw-r--r--lisp/play/spook.el4
-rw-r--r--lisp/profiler.el3
-rw-r--r--lisp/progmodes/cc-mode.el4
-rw-r--r--lisp/progmodes/cperl-mode.el20
-rw-r--r--lisp/progmodes/executable.el19
-rw-r--r--lisp/progmodes/octave.el3
-rw-r--r--lisp/progmodes/python.el4
-rw-r--r--lisp/progmodes/ruby-mode.el1
-rw-r--r--lisp/progmodes/sh-script.el17
-rw-r--r--lisp/reveal.el41
-rw-r--r--lisp/savehist.el2
-rw-r--r--lisp/saveplace.el5
-rw-r--r--lisp/shell.el21
-rw-r--r--lisp/simple.el114
-rw-r--r--lisp/subr.el45
-rw-r--r--lisp/term/ns-win.el1
-rw-r--r--lisp/term/pc-win.el9
-rw-r--r--lisp/vc/ediff.el2
-rw-r--r--lisp/vc/vc-bzr.el6
-rw-r--r--lisp/vc/vc-cvs.el7
-rw-r--r--lisp/vc/vc-dispatcher.el2
-rw-r--r--lisp/vc/vc-git.el4
-rw-r--r--lisp/vc/vc-svn.el24
-rw-r--r--lisp/vc/vc.el3
-rw-r--r--lisp/w32-common-fns.el5
98 files changed, 1397 insertions, 1358 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 324cefe7ed6..5cae5873f92 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,287 @@
3 * composite.el (compose-gstring-for-graphic): Handle enclosing 3 * composite.el (compose-gstring-for-graphic): Handle enclosing
4 mark. 4 mark.
5 5
62013-09-12 Glenn Morris <rgm@gnu.org>
7
8 * vc/vc-svn.el (vc-svn-dir-status-files, vc-svn-dir-extra-headers)
9 (vc-svn-ignore, vc-svn-retrieve-tag): Mark unused arguments.
10
11 * subr.el (do-after-load-evaluation): Also give compiler warnings
12 when obsolete files are used (except by obsolete files).
13
14 * vc/vc-svn.el (vc-svn-parse-status): If there are multiple files
15 in the status output, assume `filename' is the first. (Bug#15322)
16
17 * vc/vc.el (vc-deduce-fileset): Doc fix.
18
19 * calc/calc-help.el (Info-goto-node):
20 * progmodes/cperl-mode.el (Info-find-node):
21 * vc/ediff.el (Info-goto-node): Update declarations.
22
23 * vc/vc-dispatcher.el (vc-dir-refresh): Declare.
24
25 * vc/vc-bzr.el (vc-compilation-mode): Declare.
26 (vc-bzr-pull): Require vc-dispatcher.
27 * vc/vc-git.el (vc-compilation-mode): Declare.
28 (vc-git-pull): Require vc-dispatcher.
29
30 * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Declare.
31
32 * progmodes/octave.el (help-button-action): Declare.
33
34 * shell.el (shell-directory-tracker): Output error as a message
35 rather than just returning it as a string.
36 (shell-process-pushd): Remove useless use of message.
37
38 * dframe.el (dframe-timer-fn):
39 * files.el (dir-locals-read-from-file):
40 * mpc.el (mpc--status-timer-run, mpc--status-idle-timer-run)
41 (mpc-format):
42 * reveal.el (reveal-post-command):
43 * saveplace.el (load-save-place-alist-from-file):
44 * shell.el (shell-resync-dirs):
45 * w32-common-fns.el (x-get-selection-value):
46 * emacs-lisp/copyright.el (copyright-find-copyright):
47 * emacs-lisp/eldoc.el (eldoc-print-current-symbol-info):
48 * emulation/tpu-edt.el (tpu-copy-keyfile):
49 * play/bubbles.el (bubbles--mark-neighbourhood):
50 * progmodes/executable.el
51 (executable-make-buffer-file-executable-if-script-p):
52 * term/pc-win.el (x-get-selection-value): Use with-demoted-errors.
53
542013-09-12 Stefan Monnier <monnier@iro.umontreal.ca>
55
56 Cleanup Eshell to rely less on dynamic scoping.
57 * eshell/esh-opt.el (eshell-eval-using-options): Don't bind usage-msg,
58 last-value, and ext-command here. Bind `args' closer to `body'.
59 (temp-args, last-value, usage-msg, ext-command, args): Don't defvar.
60 (eshell--args): Declare new dynamic var.
61 (eshell-do-opt): Add argument `args'. Bind our own usage-msg,
62 last-value, and ext-command. Pass `args' to `body'.
63 (eshell-process-args): Bind eshell--args.
64 (eshell-set-option): Use eshell--args.
65 * eshell/eshell.el (eshell): Use derived-mode-p.
66 * eshell/esh-var.el (eshell-parse-variable): Use backquote.
67 (eshell-parse-variable-ref): Remove unused vars `end' and `err'.
68 (eshell-glob-function): Declare.
69 * eshell/esh-util.el: Require cl-lib.
70 (eshell-read-hosts-file): Avoid add-to-list.
71 * eshell/esh-cmd.el (eshell-parse-lisp-argument): Remove unused var
72 `err'.
73 * eshell/em-unix.el (compilation-scroll-output, locate-history-list):
74 Declare.
75 (eshell/diff): Remove unused var `err'.
76 * eshell/em-rebind.el (eshell-delete-backward-char): Remove unused arg
77 `killflag'.
78 * eshell/em-pred.el (eshell-parse-modifiers): Remove unused var `err'.
79 * eshell/em-ls.el (eshell-ls-highlight-alist): Move defvars before
80 first use.
81 * eshell/em-glob.el (eshell-glob-matches, message-shown):
82 Move declaration before first use.
83 * eshell/em-alias.el (eshell-maybe-replace-by-alias): Use backquotes.
84 * autorevert.el (auto-revert-notify-handler): Use `cl-dolist' since we
85 rely on cl-return.
86
872013-09-12 Glenn Morris <rgm@gnu.org>
88
89 * term/ns-win.el (global-map): Remove binding for ispell-next,
90 deleted 1999-05-29. (Bug#15357)
91
922013-09-11 Glenn Morris <rgm@gnu.org>
93
94 * echistory.el (electric-command-history): Remove call to deleted func.
95
96 * play/landmark.el (landmark-mode): Fix typos.
97
98 * vc/vc-cvs.el (cvs-append-to-ignore): Fix arg spec.
99 Check cvs-sort-ignore-file is bound.
100
101 * savehist.el: No need for cl when compiling on Emacs.
102
1032013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
104
105 * eshell/esh-mode.el (eshell-mode-syntax-table): Fix up initialization
106 (bug#15338).
107 (eshell-self-insert-command, eshell-send-invisible):
108 Remove unused argument.
109 (eshell-handle-control-codes): Remove unused var `orig'.
110 Avoid delete-backward-char.
111
112 * files.el (set-auto-mode): Simplify a bit further.
113
1142013-09-11 Glenn Morris <rgm@gnu.org>
115
116 * files.el (interpreter-mode-alist): Remove \\` \\' parts.
117 (set-auto-mode): Don't regexp-quote elements.
118 * progmodes/python.el (interpreter-mode-alist): Remove \\` \\'.
119 * progmodes/cc-mode.el (interpreter-mode-alist):
120 * progmodes/ruby-mode.el (interpreter-mode-alist):
121 Revert previous change.
122
1232013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
124
125 * play/snake.el (snake-mode):
126 * play/mpuz.el (mpuz-mode):
127 * play/landmark.el (lm-mode):
128 * play/blackbox.el (blackbox-mode):
129 * play/5x5.el (5x5-mode):
130 * obsolete/options.el (Edit-options-mode):
131 * net/quickurl.el (quickurl-list-mode):
132 * net/newst-treeview.el (newsticker-treeview-mode):
133 * mail/rmailsum.el (rmail-summary-mode):
134 * mail/mspools.el (mspools-mode):
135 * locate.el (locate-mode):
136 * ibuffer.el (ibuffer-mode):
137 * emulation/ws-mode.el (wordstar-mode):
138 * emacs-lisp/debug.el (debugger-mode):
139 * array.el (array-mode):
140 * net/eudc.el (eudc-mode): Use define-derived-mode.
141 * net/mairix.el (mairix-searches-mode-font-lock-keywords):
142 Move initialization into declaration.
143 (mairix-searches-mode): Use define-derived-mode.
144 * net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode.
145 (eudc-edit-hotlist): Use dolist.
146 * man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table.
147 (Man-mode): Use define-derived-mode.
148 * info.el (Info-edit-mode-map): Rename from Info-edit-map.
149 (Info-edit-mode): Use define-derived-mode.
150 (Info-cease-edit): Use Info-mode.
151 * eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization
152 into declaration.
153 (eshell-mode): Use define-derived-mode.
154 * chistory.el (command-history-mode-map): Rename from
155 command-history-map.
156 (command-history-mode): Use define-derived-mode.
157 (Command-history-setup): Remove function.
158 * calc/calc.el (calc-trail-mode-map): New var.
159 (calc-trail-mode): Use define-derived-mode.
160 (calc-trail-buffer): Set calc-main-buffer manually.
161 * bookmark.el (bookmark-insert-annotation): New function.
162 (bookmark-edit-annotation): Use it.
163 (bookmark-edit-annotation-mode): Make it a proper major mode.
164 (bookmark-send-edited-annotation): Use derived-mode-p.
165 * arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit
166 closer to its ideal place. Use \' to match EOS.
167
168 * profiler.el (profiler-calltree-find): Use function-equal.
169
1702013-09-10 Glenn Morris <rgm@gnu.org>
171
172 * files.el (interpreter-mode-alist): Convert to regexps.
173 (set-auto-mode): Adapt for this. (Bug#15306)
174 * progmodes/cperl-mode.el (cperl-clobber-mode-lists):
175 Comment out unused variable.
176 * progmodes/cc-mode.el (interpreter-mode-alist):
177 * progmodes/python.el (interpreter-mode-alist):
178 * progmodes/ruby-mode.el (interpreter-mode-alist): Convert to regexps.
179 * progmodes/sh-script.el (sh-set-shell):
180 No longer use interpreter-mode-alist to get list of shells.
181
182 * progmodes/cc-mode.el (awk-mode): Remove duplicate autoload.
183
1842013-09-10 Stefan Monnier <monnier@iro.umontreal.ca>
185
186 * simple.el: Use set-temporary-overlay-map for universal-argument.
187 (universal-argument-map): Don't use default-bindings (bug#15317).
188 Bind switch-frame explicitly. Replace universal-argument-minus with
189 a conditional binding.
190 (universal-argument-num-events, saved-overriding-map): Remove.
191 (restore-overriding-map): Remove.
192 (universal-argument--mode): Rename from save&set-overriding-map,
193 and rewrite.
194 (universal-argument, universal-argument-more, negative-argument)
195 (digit-argument): Adjust accordingly.
196 (universal-argument-minus): Remove.
197 (universal-argument-other-key): Remove.
198
199 * subr.el (with-demoted-errors): Add `format' argument.
200
2012013-09-10 Michael Albinus <michael.albinus@gmx.de>
202
203 * net/tramp.el (tramp-cleanup): Remove. Functionality added to
204 `tramp-cleanup-connection'.
205
206 * net/tramp-cmds.el (tramp-cleanup-connection): Add optional
207 parameters KEEP-DEBUG and KEEP-PASSWORD.
208
209 * net/tramp.el (tramp-file-name-handler):
210 * net/tramp-adb.el (tramp-adb-maybe-open-connection):
211 * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell)
212 (tramp-maybe-open-connection):
213 * net/tramp-smb.el (tramp-smb-maybe-open-connection):
214 Use `tramp-cleanup-connection'.
215
216 * net/tramp-sh.el (tramp-maybe-open-connection):
217 Catch 'uname-changed inside the progress reporter.
218
2192013-09-10 Glenn Morris <rgm@gnu.org>
220
221 * simple.el (read-minibuffer): Unbreak it. (Bug#15318)
222
223 * dired-x.el (dired-mark-sexp): Unbreak for systems where ls
224 returns "alternate access method" in mode (eg "-rw-r--r--.").
225
2262013-09-08 Glenn Morris <rgm@gnu.org>
227
228 * saveplace.el (load-save-place-alist-from-file):
229 Demote errors. (Bug#15305)
230
2312013-09-08 Michael Albinus <michael.albinus@gmx.de>
232
233 Improve compatibility with older Emacsen, and XEmacs.
234
235 * net/tramp.el (tramp-find-method, tramp-find-user): Call `propertize'
236 only if it is bound. It isn't for XEmacs.
237 (with-tramp-progress-reporter): Do not let-bind `result'.
238 This yields to scoping errors in XEmacs.
239 (tramp-handle-make-auto-save-file-name): New function, moved from
240 tramp-sh.el.
241
242 * net/tramp-adb.el (tramp-adb-file-name-handler-alist): Add handler
243 for `make-auto-save-file-name'.
244 (tramp-adb--gnu-switches-to-ash):
245 Use `tramp-compat-replace-regexp-in-string'.
246
247 * net/tramp-cache.el (tramp-cache-print): Call
248 `substring-no-properties' only if it is bound. It isn't for XEmacs.
249
250 * net/tramp-cmds.el (tramp-bug): Call `propertize' only if it is
251 bound. It isn't for XEmacs.
252
253 * net/tramp-compat.el (tramp-compat-copy-file):
254 Catch `wrong-number-of-arguments' error.
255 (tramp-compat-replace-regexp-in-string): New defun.
256
257 * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add handler
258 for `make-auto-save-file-name'.
259 (tramp-gvfs-handle-copy-file): Use `tramp-compat-funcall' for
260 `copy-file'.
261 (tramp-gvfs-file-gvfs-monitor-file-process-filter)
262 (tramp-gvfs-file-name): Use `tramp-compat-replace-regexp-in-string'.
263 (tramp-synce-list-devices): Use `push' instead of `pushnew'.
264
265 * net/tramp-gw.el (tramp-gw-open-network-stream):
266 Use `tramp-compat-replace-regexp-in-string'.
267
268 * net/tramp-sh.el (tramp-sh-file-name-handler-alist):
269 Call `tramp-handle-make-auto-save-file-name'.
270 (tramp-sh-handle-make-auto-save-file-name): Move to tramp.el.
271 (tramp-sh-file-gvfs-monitor-dir-process-filter)
272 (tramp-sh-file-inotifywait-process-filter):
273 Use `tramp-compat-replace-regexp-in-string'.
274 (tramp-compute-multi-hops): Use `push' instead of `pushnew'.
275
276 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add handler
277 for `make-auto-save-file-name'.
278 (tramp-smb-handle-copy-directory):
279 Call `tramp-compat-replace-regexp-in-string'.
280 (tramp-smb-get-file-entries): Use `push' instead of `pushnew'.
281 (tramp-smb-handle-copy-file): Improve error message.
282 (tramp-smb-handle-rename-file): Rename directly only in case
283 `newname' does not exist yet. This is a restriction of smbclient.
284 (tramp-smb-maybe-open-connection): Rerun the function only when
285 `auth-sources' is non-nil.
286
62013-09-08 Kenichi Handa <handa@gnu.org> 2872013-09-08 Kenichi Handa <handa@gnu.org>
7 288
8 * international/characters.el: Set category "^" (Combining) for 289 * international/characters.el: Set category "^" (Combining) for
@@ -14,8 +295,8 @@
14 * progmodes/cc-langs.el (c-type-decl-suffix-key): Now matches ")" 295 * progmodes/cc-langs.el (c-type-decl-suffix-key): Now matches ")"
15 in Java Mode. 296 in Java Mode.
16 (c-recognize-typeless-decls): Set the Java value to t. 297 (c-recognize-typeless-decls): Set the Java value to t.
17 * progmodes/cc-engine.el (c-forward-decl-or-cast-1): While 298 * progmodes/cc-engine.el (c-forward-decl-or-cast-1):
18 handling a "(", add a check for, effectively, Java, and handle a 299 While handling a "(", add a check for, effectively, Java, and handle a
19 "typeless" declaration there. 300 "typeless" declaration there.
20 301
212013-09-07 Roland Winkler <winkler@gnu.org> 3022013-09-07 Roland Winkler <winkler@gnu.org>
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index a4f7015c844..c22205d5634 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -683,9 +683,9 @@ archive.
683 ;; At present we cannot create archives from scratch 683 ;; At present we cannot create archives from scratch
684 (funcall (or (default-value 'major-mode) 'fundamental-mode)) 684 (funcall (or (default-value 'major-mode) 'fundamental-mode))
685 (if (and (not force) archive-files) nil 685 (if (and (not force) archive-files) nil
686 (kill-all-local-variables)
686 (let* ((type (archive-find-type)) 687 (let* ((type (archive-find-type))
687 (typename (capitalize (symbol-name type)))) 688 (typename (capitalize (symbol-name type))))
688 (kill-all-local-variables)
689 (make-local-variable 'archive-subtype) 689 (make-local-variable 'archive-subtype)
690 (setq archive-subtype type) 690 (setq archive-subtype type)
691 691
@@ -761,7 +761,7 @@ archive.
761 ((looking-at "..-l[hz][0-9ds]-") 'lzh) 761 ((looking-at "..-l[hz][0-9ds]-") 'lzh)
762 ((looking-at "....................[\334]\247\304\375") 'zoo) 762 ((looking-at "....................[\334]\247\304\375") 'zoo)
763 ((and (looking-at "\C-z") ; signature too simple, IMHO 763 ((and (looking-at "\C-z") ; signature too simple, IMHO
764 (string-match "\\.[aA][rR][cC]$" 764 (string-match "\\.[aA][rR][cC]\\'"
765 (or buffer-file-name (buffer-name)))) 765 (or buffer-file-name (buffer-name))))
766 'arc) 766 'arc)
767 ;; This pattern modeled on the BSD/GNU+Linux `file' command. 767 ;; This pattern modeled on the BSD/GNU+Linux `file' command.
diff --git a/lisp/array.el b/lisp/array.el
index e60cbdfffc1..8c4f609e626 100644
--- a/lisp/array.el
+++ b/lisp/array.el
@@ -800,7 +800,7 @@ Return COLUMN."
800(put 'array-mode 'mode-class 'special) 800(put 'array-mode 'mode-class 'special)
801 801
802;;;###autoload 802;;;###autoload
803(defun array-mode () 803(define-derived-mode array-mode fundamental-mode "Array"
804 "Major mode for editing arrays. 804 "Major mode for editing arrays.
805 805
806 Array mode is a specialized mode for editing arrays. An array is 806 Array mode is a specialized mode for editing arrays. An array is
@@ -863,9 +863,6 @@ take a numeric prefix argument):
863 \\[array-display-local-variables] Display the current values of local variables. 863 \\[array-display-local-variables] Display the current values of local variables.
864 864
865Entering array mode calls the function `array-mode-hook'." 865Entering array mode calls the function `array-mode-hook'."
866
867 (interactive)
868 (kill-all-local-variables)
869 (make-local-variable 'array-buffer-line) 866 (make-local-variable 'array-buffer-line)
870 (make-local-variable 'array-buffer-column) 867 (make-local-variable 'array-buffer-column)
871 (make-local-variable 'array-row) 868 (make-local-variable 'array-row)
@@ -888,13 +885,9 @@ Entering array mode calls the function `array-mode-hook'."
888 (+ (floor (1- array-max-column) array-columns-per-line) 885 (+ (floor (1- array-max-column) array-columns-per-line)
889 (if array-rows-numbered 2 1))) 886 (if array-rows-numbered 2 1)))
890 (message "") 887 (message "")
891 (setq major-mode 'array-mode)
892 (setq mode-name "Array")
893 (force-mode-line-update) 888 (force-mode-line-update)
894 (set (make-local-variable 'truncate-lines) t) 889 (set (make-local-variable 'truncate-lines) t)
895 (setq overwrite-mode 'overwrite-mode-textual) 890 (setq overwrite-mode 'overwrite-mode-textual))
896 (use-local-map array-mode-map)
897 (run-mode-hooks 'array-mode-hook))
898 891
899 892
900 893
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 0e2b6f32cf3..65526f07e1b 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -548,7 +548,7 @@ will use an up-to-date value of `auto-revert-interval'"
548 (cl-assert (stringp file)) 548 (cl-assert (stringp file))
549 (when (eq action 'renamed) (cl-assert (stringp file1))) 549 (when (eq action 'renamed) (cl-assert (stringp file1)))
550 ;; Loop over all buffers, in order to find the intended one. 550 ;; Loop over all buffers, in order to find the intended one.
551 (dolist (buffer buffers) 551 (cl-dolist (buffer buffers)
552 (when (buffer-live-p buffer) 552 (when (buffer-live-p buffer)
553 (with-current-buffer buffer 553 (with-current-buffer buffer
554 (when (and (stringp buffer-file-name) 554 (when (and (stringp buffer-file-name)
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 9514317809b..ce0d6831a3a 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -862,31 +862,25 @@ It takes one argument, the name of the bookmark, as a string.")
862 map) 862 map)
863 "Keymap for editing an annotation of a bookmark.") 863 "Keymap for editing an annotation of a bookmark.")
864 864
865 865(defun bookmark-insert-annotation (bookmark-name-or-record)
866(defun bookmark-edit-annotation-mode (bookmark-name-or-record)
867 "Mode for editing the annotation of bookmark BOOKMARK-NAME-OR-RECORD.
868When you have finished composing, type \\[bookmark-send-annotation].
869
870\\{bookmark-edit-annotation-mode-map}"
871 (interactive)
872 (kill-all-local-variables)
873 (make-local-variable 'bookmark-annotation-name)
874 (setq bookmark-annotation-name bookmark-name-or-record)
875 (use-local-map bookmark-edit-annotation-mode-map)
876 (setq major-mode 'bookmark-edit-annotation-mode
877 mode-name "Edit Bookmark Annotation")
878 (insert (funcall bookmark-edit-annotation-text-func bookmark-name-or-record)) 866 (insert (funcall bookmark-edit-annotation-text-func bookmark-name-or-record))
879 (let ((annotation (bookmark-get-annotation bookmark-name-or-record))) 867 (let ((annotation (bookmark-get-annotation bookmark-name-or-record)))
880 (if (and annotation (not (string-equal annotation ""))) 868 (if (and annotation (not (string-equal annotation "")))
881 (insert annotation))) 869 (insert annotation))))
882 (run-mode-hooks 'text-mode-hook)) 870
871(define-derived-mode bookmark-edit-annotation-mode
872 text-mode "Edit Bookmark Annotation"
873 "Mode for editing the annotation of bookmarks.
874When you have finished composing, type \\[bookmark-send-annotation].
875
876\\{bookmark-edit-annotation-mode-map}")
883 877
884 878
885(defun bookmark-send-edited-annotation () 879(defun bookmark-send-edited-annotation ()
886 "Use buffer contents as annotation for a bookmark. 880 "Use buffer contents as annotation for a bookmark.
887Lines beginning with `#' are ignored." 881Lines beginning with `#' are ignored."
888 (interactive) 882 (interactive)
889 (if (not (eq major-mode 'bookmark-edit-annotation-mode)) 883 (if (not (derived-mode-p 'bookmark-edit-annotation-mode))
890 (error "Not in bookmark-edit-annotation-mode")) 884 (error "Not in bookmark-edit-annotation-mode"))
891 (goto-char (point-min)) 885 (goto-char (point-min))
892 (while (< (point) (point-max)) 886 (while (< (point) (point-max))
@@ -906,7 +900,10 @@ Lines beginning with `#' are ignored."
906(defun bookmark-edit-annotation (bookmark-name-or-record) 900(defun bookmark-edit-annotation (bookmark-name-or-record)
907 "Pop up a buffer for editing bookmark BOOKMARK-NAME-OR-RECORD's annotation." 901 "Pop up a buffer for editing bookmark BOOKMARK-NAME-OR-RECORD's annotation."
908 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) 902 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*"))
909 (bookmark-edit-annotation-mode bookmark-name-or-record)) 903 (bookmark-insert-annotation bookmark-name-or-record)
904 (bookmark-edit-annotation-mode)
905 (set (make-local-variable 'bookmark-annotation-name)
906 bookmark-name-or-record))
910 907
911 908
912(defun bookmark-buffer-name () 909(defun bookmark-buffer-name ()
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index 2b7b56c3f89..641453568ca 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -30,7 +30,7 @@
30(require 'calc-macs) 30(require 'calc-macs)
31 31
32;; Declare functions which are defined elsewhere. 32;; Declare functions which are defined elsewhere.
33(declare-function Info-goto-node "info" (nodename &optional fork)) 33(declare-function Info-goto-node "info" (nodename &optional fork strict-case))
34(declare-function Info-last "info" ()) 34(declare-function Info-last "info" ())
35 35
36 36
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 2eeb880c34d..2795a177a41 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1387,7 +1387,12 @@ Notations: 3.14e6 3.14 * 10^6
1387 (calc-check-defines)) 1387 (calc-check-defines))
1388 (setplist 'calc-define nil))))) 1388 (setplist 'calc-define nil)))))
1389 1389
1390(defun calc-trail-mode (&optional buf) 1390(defvar calc-trail-mode-map
1391 (let ((map (make-sparse-keymap)))
1392 (set-keymap-parent map calc-mode-map)
1393 map))
1394
1395(define-derived-mode calc-trail-mode fundamental-mode "Calc Trail"
1391 "Calc Trail mode. 1396 "Calc Trail mode.
1392This mode is used by the *Calc Trail* buffer, which records all results 1397This mode is used by the *Calc Trail* buffer, which records all results
1393obtained by the GNU Emacs Calculator. 1398obtained by the GNU Emacs Calculator.
@@ -1397,26 +1402,18 @@ the Trail.
1397 1402
1398This buffer uses the same key map as the *Calculator* buffer; calculator 1403This buffer uses the same key map as the *Calculator* buffer; calculator
1399commands given here will actually operate on the *Calculator* stack." 1404commands given here will actually operate on the *Calculator* stack."
1400 (interactive)
1401 (fundamental-mode)
1402 (use-local-map calc-mode-map)
1403 (setq major-mode 'calc-trail-mode)
1404 (setq mode-name "Calc Trail")
1405 (setq truncate-lines t) 1405 (setq truncate-lines t)
1406 (setq buffer-read-only t) 1406 (setq buffer-read-only t)
1407 (make-local-variable 'overlay-arrow-position) 1407 (make-local-variable 'overlay-arrow-position)
1408 (make-local-variable 'overlay-arrow-string) 1408 (make-local-variable 'overlay-arrow-string)
1409 (when buf
1410 (set (make-local-variable 'calc-main-buffer) buf))
1411 (when (= (buffer-size) 0) 1409 (when (= (buffer-size) 0)
1412 (let ((buffer-read-only nil)) 1410 (let ((buffer-read-only nil))
1413 (insert (propertize "Emacs Calculator Trail\n" 'face 'italic)))) 1411 (insert (propertize "Emacs Calculator Trail\n" 'face 'italic)))))
1414 (run-mode-hooks 'calc-trail-mode-hook))
1415 1412
1416(defun calc-create-buffer () 1413(defun calc-create-buffer ()
1417 "Create and initialize a buffer for the Calculator." 1414 "Create and initialize a buffer for the Calculator."
1418 (set-buffer (get-buffer-create "*Calculator*")) 1415 (set-buffer (get-buffer-create "*Calculator*"))
1419 (or (eq major-mode 'calc-mode) 1416 (or (derived-mode-p 'calc-mode)
1420 (calc-mode)) 1417 (calc-mode))
1421 (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000)) 1418 (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
1422 (when calc-always-load-extensions 1419 (when calc-always-load-extensions
@@ -1439,7 +1436,7 @@ commands given here will actually operate on the *Calculator* stack."
1439 (when (get-buffer-window "*Calc Keypad*") 1436 (when (get-buffer-window "*Calc Keypad*")
1440 (calc-keypad) 1437 (calc-keypad)
1441 (set-buffer (window-buffer))) 1438 (set-buffer (window-buffer)))
1442 (if (eq major-mode 'calc-mode) 1439 (if (derived-mode-p 'calc-mode)
1443 (calc-quit) 1440 (calc-quit)
1444 (let ((oldbuf (current-buffer))) 1441 (let ((oldbuf (current-buffer)))
1445 (calc-create-buffer) 1442 (calc-create-buffer)
@@ -1490,7 +1487,7 @@ commands given here will actually operate on the *Calculator* stack."
1490 (if (and (equal (buffer-name) "*Gnuplot Trail*") 1487 (if (and (equal (buffer-name) "*Gnuplot Trail*")
1491 (> (recursion-depth) 0)) 1488 (> (recursion-depth) 0))
1492 (exit-recursive-edit) 1489 (exit-recursive-edit)
1493 (if (eq major-mode 'calc-edit-mode) 1490 (if (derived-mode-p 'calc-edit-mode)
1494 (calc-edit-finish arg) 1491 (calc-edit-finish arg)
1495 (if calc-was-keypad-mode 1492 (if calc-was-keypad-mode
1496 (calc-keypad) 1493 (calc-keypad)
@@ -1504,13 +1501,13 @@ commands given here will actually operate on the *Calculator* stack."
1504 (if (and (equal (buffer-name) "*Gnuplot Trail*") 1501 (if (and (equal (buffer-name) "*Gnuplot Trail*")
1505 (> (recursion-depth) 0)) 1502 (> (recursion-depth) 0))
1506 (exit-recursive-edit)) 1503 (exit-recursive-edit))
1507 (if (eq major-mode 'calc-edit-mode) 1504 (if (derived-mode-p 'calc-edit-mode)
1508 (calc-edit-cancel) 1505 (calc-edit-cancel)
1509 (if (and interactive 1506 (if (and interactive
1510 calc-embedded-info 1507 calc-embedded-info
1511 (eq (current-buffer) (aref calc-embedded-info 0))) 1508 (eq (current-buffer) (aref calc-embedded-info 0)))
1512 (calc-embedded nil) 1509 (calc-embedded nil)
1513 (unless (eq major-mode 'calc-mode) 1510 (unless (derived-mode-p 'calc-mode)
1514 (calc-create-buffer)) 1511 (calc-create-buffer))
1515 (run-hooks 'calc-end-hook) 1512 (run-hooks 'calc-end-hook)
1516 (if (integerp calc-undo-length) 1513 (if (integerp calc-undo-length)
@@ -1631,10 +1628,10 @@ See calc-keypad for details."
1631 (if (math-lessp 1 time) 1628 (if (math-lessp 1 time)
1632 (calc-record time "(t)")))) 1629 (calc-record time "(t)"))))
1633 (or (memq 'no-align calc-command-flags) 1630 (or (memq 'no-align calc-command-flags)
1634 (eq major-mode 'calc-trail-mode) 1631 (derived-mode-p 'calc-trail-mode)
1635 (calc-align-stack-window)) 1632 (calc-align-stack-window))
1636 (and (memq 'position-point calc-command-flags) 1633 (and (memq 'position-point calc-command-flags)
1637 (if (eq major-mode 'calc-mode) 1634 (if (derived-mode-p 'calc-mode)
1638 (progn 1635 (progn
1639 (goto-char (point-min)) 1636 (goto-char (point-min))
1640 (forward-line (1- calc-final-point-line)) 1637 (forward-line (1- calc-final-point-line))
@@ -1664,7 +1661,7 @@ See calc-keypad for details."
1664 (setq calc-command-flags (cons f calc-command-flags)))) 1661 (setq calc-command-flags (cons f calc-command-flags))))
1665 1662
1666(defun calc-select-buffer () 1663(defun calc-select-buffer ()
1667 (or (eq major-mode 'calc-mode) 1664 (or (derived-mode-p 'calc-mode)
1668 (if calc-main-buffer 1665 (if calc-main-buffer
1669 (set-buffer calc-main-buffer) 1666 (set-buffer calc-main-buffer)
1670 (let ((buf (get-buffer "*Calculator*"))) 1667 (let ((buf (get-buffer "*Calculator*")))
@@ -1801,7 +1798,7 @@ See calc-keypad for details."
1801 (and calc-embedded-info (calc-embedded-mode-line-change)))))) 1798 (and calc-embedded-info (calc-embedded-mode-line-change))))))
1802 1799
1803(defun calc-align-stack-window () 1800(defun calc-align-stack-window ()
1804 (if (eq major-mode 'calc-mode) 1801 (if (derived-mode-p 'calc-mode)
1805 (progn 1802 (progn
1806 (let ((win (get-buffer-window (current-buffer)))) 1803 (let ((win (get-buffer-window (current-buffer))))
1807 (if win 1804 (if win
@@ -1988,7 +1985,7 @@ See calc-keypad for details."
1988(defvar calc-any-evaltos nil) 1985(defvar calc-any-evaltos nil)
1989(defun calc-refresh (&optional align) 1986(defun calc-refresh (&optional align)
1990 (interactive) 1987 (interactive)
1991 (and (eq major-mode 'calc-mode) 1988 (and (derived-mode-p 'calc-mode)
1992 (not calc-executing-macro) 1989 (not calc-executing-macro)
1993 (let* ((buffer-read-only nil) 1990 (let* ((buffer-read-only nil)
1994 (save-point (point)) 1991 (save-point (point))
@@ -2016,7 +2013,7 @@ See calc-keypad for details."
2016 (calc-align-stack-window) 2013 (calc-align-stack-window)
2017 (goto-char save-point)) 2014 (goto-char save-point))
2018 (if save-mark (set-mark save-mark)))) 2015 (if save-mark (set-mark save-mark))))
2019 (and calc-embedded-info (not (eq major-mode 'calc-mode)) 2016 (and calc-embedded-info (not (derived-mode-p 'calc-mode))
2020 (with-current-buffer (aref calc-embedded-info 1) 2017 (with-current-buffer (aref calc-embedded-info 1)
2021 (calc-refresh align))) 2018 (calc-refresh align)))
2022 (setq calc-refresh-count (1+ calc-refresh-count))) 2019 (setq calc-refresh-count (1+ calc-refresh-count)))
@@ -2078,12 +2075,13 @@ the United States."
2078 (null (buffer-name calc-trail-buffer))) 2075 (null (buffer-name calc-trail-buffer)))
2079 (save-excursion 2076 (save-excursion
2080 (setq calc-trail-buffer (get-buffer-create "*Calc Trail*")) 2077 (setq calc-trail-buffer (get-buffer-create "*Calc Trail*"))
2081 (let ((buf (or (and (not (eq major-mode 'calc-mode)) 2078 (let ((buf (or (and (not (derived-mode-p 'calc-mode))
2082 (get-buffer "*Calculator*")) 2079 (get-buffer "*Calculator*"))
2083 (current-buffer)))) 2080 (current-buffer))))
2084 (set-buffer calc-trail-buffer) 2081 (set-buffer calc-trail-buffer)
2085 (or (eq major-mode 'calc-trail-mode) 2082 (unless (derived-mode-p 'calc-trail-mode)
2086 (calc-trail-mode buf))))) 2083 (calc-trail-mode)
2084 (set (make-local-variable 'calc-main-buffer) buf)))))
2087 (or (and calc-trail-pointer 2085 (or (and calc-trail-pointer
2088 (eq (marker-buffer calc-trail-pointer) calc-trail-buffer)) 2086 (eq (marker-buffer calc-trail-pointer) calc-trail-buffer))
2089 (with-current-buffer calc-trail-buffer 2087 (with-current-buffer calc-trail-buffer
@@ -2152,7 +2150,7 @@ the United States."
2152 2150
2153(defun calc-trail-here () 2151(defun calc-trail-here ()
2154 (interactive) 2152 (interactive)
2155 (if (eq major-mode 'calc-trail-mode) 2153 (if (derived-mode-p 'calc-trail-mode)
2156 (progn 2154 (progn
2157 (beginning-of-line) 2155 (beginning-of-line)
2158 (if (bobp) 2156 (if (bobp)
diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog
index 50467fa6e37..f5528202bb4 100644
--- a/lisp/cedet/ChangeLog
+++ b/lisp/cedet/ChangeLog
@@ -1,3 +1,12 @@
12013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode.
4 (semantic-grammar-mode-syntax-table): Rename from
5 semantic-grammar-syntax-table.
6 (semantic-grammar-mode-map): Rename from semantic-grammar-map.
7 * data-debug.el (data-debug-mode-map): Rename from data-debug-map.
8 (data-debug-mode): Use define-derived-mode.
9
12013-09-05 Glenn Morris <rgm@gnu.org> 102013-09-05 Glenn Morris <rgm@gnu.org>
2 11
3 * semantic/fw.el (semantic-make-local-hook): 12 * semantic/fw.el (semantic-make-local-hook):
@@ -15,15 +24,15 @@
15 24
16 * semantic/decorate/mode.el 25 * semantic/decorate/mode.el
17 (semantic-decoration-on-includes-p-default) 26 (semantic-decoration-on-includes-p-default)
18 (semantic-decoration-on-includes-highlight-default): Declare for 27 (semantic-decoration-on-includes-highlight-default): Declare for
19 byte compiler. 28 byte compiler.
20 29
21 * semantic/wisent/python.el (semantic/format): New require. 30 * semantic/wisent/python.el (semantic/format): New require.
22 31
232013-07-27 Eric Ludlam <zappo@gnu.org> 322013-07-27 Eric Ludlam <zappo@gnu.org>
24 33
25 * lisp/cedet/semantic/edit.el (semantic-edits-splice-remove): Wrap 34 * lisp/cedet/semantic/edit.el (semantic-edits-splice-remove):
26 debug message removing middle tag in semantic-edits-verbose-flag 35 Wrap debug message removing middle tag in semantic-edits-verbose-flag
27 check. 36 check.
28 37
292013-07-27 David Engster <deng@randomsample.de> 382013-07-27 David Engster <deng@randomsample.de>
@@ -69,8 +78,8 @@
69 `semantic/decorate/include' anymore. 78 `semantic/decorate/include' anymore.
70 (semantic-toggle-decoration-style): Error if an unknown decoration 79 (semantic-toggle-decoration-style): Error if an unknown decoration
71 style is toggled. 80 style is toggled.
72 (define-semantic-decoration-style): Add new :load option. When 81 (define-semantic-decoration-style): Add new :load option.
73 :load is specified, add autoload tokens for the definition 82 When :load is specified, add autoload tokens for the definition
74 functions so that code is loaded when the mode is used. 83 functions so that code is loaded when the mode is used.
75 (semantic-decoration-on-includes): New autoload definition for 84 (semantic-decoration-on-includes): New autoload definition for
76 highlighting includes. 85 highlighting includes.
@@ -94,8 +103,8 @@
94 * semantic/ctxt.el (semantic-ctxt-end-of-symbol): New. 103 * semantic/ctxt.el (semantic-ctxt-end-of-symbol): New.
95 (semantic-ctxt-current-symbol-default): New. 104 (semantic-ctxt-current-symbol-default): New.
96 105
97 * semantic/bovine/el.el (semantic-default-elisp-setup): Add 106 * semantic/bovine/el.el (semantic-default-elisp-setup):
98 autoload cookie. Explain existence. 107 Add autoload cookie. Explain existence.
99 (footer): Add local variable for loaddefs. 108 (footer): Add local variable for loaddefs.
100 109
101 * semantic/db.el (semanticdb-file-table-object): Add new filter, 110 * semantic/db.el (semanticdb-file-table-object): Add new filter,
@@ -120,7 +129,7 @@
120 * ede/cpp-root.el (ede-preprocessor-map): Protect against init 129 * ede/cpp-root.el (ede-preprocessor-map): Protect against init
121 problems. 130 problems.
122 131
123 * ede/proj.el (ede-proj-target): Added a new "custom" option for 132 * ede/proj.el (ede-proj-target): Add a new "custom" option for
124 custom symbols representing a compiler or linker instead of 133 custom symbols representing a compiler or linker instead of
125 restricting things to only the predefined compilers and linkers. 134 restricting things to only the predefined compilers and linkers.
126 135
@@ -198,15 +207,15 @@
1982013-04-27 David Engster <deng@randomsample.de> 2072013-04-27 David Engster <deng@randomsample.de>
199 208
200 * semantic/complete.el 209 * semantic/complete.el
201 (semantic-collector-calculate-completions-raw): If 210 (semantic-collector-calculate-completions-raw):
202 `completionslist' is not set, refresh the cache if necessary and 211 If `completionslist' is not set, refresh the cache if necessary and
203 use it for completions. This fixes the 212 use it for completions. This fixes the
204 `semantic-collector-buffer-deep' collector (bug#14265). 213 `semantic-collector-buffer-deep' collector (bug#14265).
205 214
2062013-03-26 Leo Liu <sdl.web@gmail.com> 2152013-03-26 Leo Liu <sdl.web@gmail.com>
207 216
208 * semantic/senator.el (senator-copy-tag-to-register): Move 217 * semantic/senator.el (senator-copy-tag-to-register):
209 register handling logic from register.el. (Bug#14052) 218 Move register handling logic from register.el. (Bug#14052)
210 219
2112013-03-21 Eric Ludlam <zappo@gnu.org> 2202013-03-21 Eric Ludlam <zappo@gnu.org>
212 221
@@ -223,17 +232,17 @@
223 232
224 * semantic/find.el (semantic-filter-tags-by-class): New function. 233 * semantic/find.el (semantic-filter-tags-by-class): New function.
225 234
226 * semantic/tag-ls.el (semantic-tag-similar-p-default): Add 235 * semantic/tag-ls.el (semantic-tag-similar-p-default):
227 short-circuit in case tag1 and 2 are identical. 236 Add short-circuit in case tag1 and 2 are identical.
228 237
229 * semantic/analyze/fcn.el 238 * semantic/analyze/fcn.el
230 (semantic-analyze-dereference-metatype-stack): Use 239 (semantic-analyze-dereference-metatype-stack):
231 `semantic-tag-similar-p' instead of 'eq' when comparing two tags 240 Use `semantic-tag-similar-p' instead of 'eq' when comparing two tags
232 during metatype evaluation in case they are the same, but not the 241 during metatype evaluation in case they are the same, but not the
233 same node. (Tweaked patch from Tomasz Gajewski) (Tiny change) 242 same node. (Tweaked patch from Tomasz Gajewski) (Tiny change)
234 243
235 * semantic/db-find.el (semanticdb-partial-synchronize): Fix 244 * semantic/db-find.el (semanticdb-partial-synchronize):
236 require to semantic/db-typecache to be correct. 245 Fix require to semantic/db-typecache to be correct.
237 (semanticdb-find-tags-external-children-of-type): Make this a 246 (semanticdb-find-tags-external-children-of-type): Make this a
238 brutish search by default. 247 brutish search by default.
239 248
@@ -243,19 +252,19 @@
243 input tag as the place to start searching for externally defined 252 input tag as the place to start searching for externally defined
244 methods. 253 methods.
245 254
246 * semantic/db-file.el (semanticdb-default-save-directory): Doc 255 * semantic/db-file.el (semanticdb-default-save-directory):
247 fix: Add ref to default value. 256 Doc fix: Add ref to default value.
248 257
249 * semantic/complete.el (semantic-complete-post-command-hook): When 258 * semantic/complete.el (semantic-complete-post-command-hook):
250 detecting if cursor is outside completion area, do so if cursor 259 When detecting if cursor is outside completion area, do so if cursor
251 moves before start of overlay, or the original starting location 260 moves before start of overlay, or the original starting location
252 of the overlay (i.e., if user deletes past beginning of the 261 of the overlay (i.e., if user deletes past beginning of the
253 overlay region). 262 overlay region).
254 (semantic-complete-inline-tag-engine): Initialize original start 263 (semantic-complete-inline-tag-engine): Initialize original start
255 of `semantic-complete-inline-overlay'. 264 of `semantic-complete-inline-overlay'.
256 265
257 * semantic/bovine/c.el (semantic-c-describe-environment): Update 266 * semantic/bovine/c.el (semantic-c-describe-environment):
258 some section titles. Test semanticdb table before printing it. 267 Update some section titles. Test semanticdb table before printing it.
259 (semantic-c-reset-preprocessor-symbol-map): Update 268 (semantic-c-reset-preprocessor-symbol-map): Update
260 `semantic-lex-spp-macro-symbol-obarray' outside the loop over all 269 `semantic-lex-spp-macro-symbol-obarray' outside the loop over all
261 the files contributing to its value. 270 the files contributing to its value.
@@ -271,8 +280,8 @@
271 * srecode/cpp.el (srecode-semantic-handle-:c): Replace all 280 * srecode/cpp.el (srecode-semantic-handle-:c): Replace all
272 characters in FILENAME_SYMBOL that aren't valid CPP symbol chars. 281 characters in FILENAME_SYMBOL that aren't valid CPP symbol chars.
273 282
274 * srecode/map.el (srecode-map-validate-file-for-mode): Force 283 * srecode/map.el (srecode-map-validate-file-for-mode):
275 semantic to load if it is not active in the template being added 284 Force semantic to load if it is not active in the template being added
276 to the map. 285 to the map.
277 286
278 * srecode/srt.el: Add local variables for setting the autoload 287 * srecode/srt.el: Add local variables for setting the autoload
@@ -287,7 +296,7 @@
287 has both a version variable and a Version: comment, always use 296 has both a version variable and a Version: comment, always use
288 `call-next-method'. 297 `call-next-method'.
289 298
290 * ede/cpp-root.el (ede-set-project-variables): Deleted. 299 * ede/cpp-root.el (ede-set-project-variables): Delete.
291 `ede-preprocessor-map' does the job this function was attempting 300 `ede-preprocessor-map' does the job this function was attempting
292 to do with :spp-table. 301 to do with :spp-table.
293 (ede-preprocessor-map): Update file tests to provide better 302 (ede-preprocessor-map): Update file tests to provide better
@@ -302,8 +311,8 @@
3022013-03-21 David Engster <deng@randomsample.de> 3112013-03-21 David Engster <deng@randomsample.de>
303 312
304 * semantic/bovine/c.el (semantic-get-local-variables): Also add a 313 * semantic/bovine/c.el (semantic-get-local-variables): Also add a
305 new variable 'this' if we are in an inline member function. For 314 new variable 'this' if we are in an inline member function.
306 detecting this, we check overlays at point if there is a class 315 For detecting this, we check overlays at point if there is a class
307 spanning the current function. Also, the variable 'this' has to 316 spanning the current function. Also, the variable 'this' has to
308 be a pointer. 317 be a pointer.
309 318
@@ -350,14 +359,14 @@
350 359
3512013-03-21 Tomasz Gajewski <tomga@wp.pl> (tiny change) 3602013-03-21 Tomasz Gajewski <tomga@wp.pl> (tiny change)
352 361
353 * ede/cpp-root.el (ede-project-autoload, initialize-instance): Fix 362 * ede/cpp-root.el (ede-project-autoload, initialize-instance):
354 EDE file symbol to match rename. Fix ede-cpp-root symbol to 363 Fix EDE file symbol to match rename. Fix ede-cpp-root symbol to
355 include -project in name. 364 include -project in name.
356 365
3572013-03-21 Alex Ott <alexott@gmail.com> 3662013-03-21 Alex Ott <alexott@gmail.com>
358 367
359 * cedet-files.el (cedet-files-list-recursively): New. Recursively 368 * cedet-files.el (cedet-files-list-recursively): New.
360 find files whose names are matching to given regex. 369 Recursively find files whose names are matching to given regex.
361 370
362 * ede.el (ede-current-project): Rewrite to avoid imperative style. 371 * ede.el (ede-current-project): Rewrite to avoid imperative style.
363 372
diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el
index c468ec1046a..4658c604211 100644
--- a/lisp/cedet/data-debug.el
+++ b/lisp/cedet/data-debug.el
@@ -869,7 +869,8 @@ If PARENT is non-nil, it is somehow related as a parent to thing."
869 table) 869 table)
870 "Syntax table used in data-debug macro buffers.") 870 "Syntax table used in data-debug macro buffers.")
871 871
872(defvar data-debug-map 872(define-obsolete-variable-alias 'data-debug-map 'data-debug-mode-map "24.1")
873(defvar data-debug-mode-map
873 (let ((km (make-sparse-keymap))) 874 (let ((km (make-sparse-keymap)))
874 (suppress-keymap km) 875 (suppress-keymap km)
875 (define-key km [mouse-2] 'data-debug-expand-or-contract-mouse) 876 (define-key km [mouse-2] 'data-debug-expand-or-contract-mouse)
@@ -887,22 +888,15 @@ If PARENT is non-nil, it is somehow related as a parent to thing."
887 :group 'data-debug 888 :group 'data-debug
888 :type 'hook) 889 :type 'hook)
889 890
890(defun data-debug-mode () 891(define-derived-mode data-debug-mode fundamental-mode "DATA-DEBUG"
891 "Major-mode for the Analyzer debugger. 892 "Major-mode for the Analyzer debugger.
892 893
893\\{data-debug-map}" 894\\{data-debug-mode-map}"
894 (interactive) 895 (setq comment-start ";;"
895 (kill-all-local-variables)
896 (setq major-mode 'data-debug-mode
897 mode-name "DATA-DEBUG"
898 comment-start ";;"
899 comment-end "" 896 comment-end ""
900 buffer-read-only t) 897 buffer-read-only t)
901 (set (make-local-variable 'comment-start-skip) 898 (setq-local comment-start-skip
902 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") 899 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
903 (set-syntax-table data-debug-mode-syntax-table)
904 (use-local-map data-debug-map)
905 (run-hooks 'data-debug-hook)
906 (buffer-disable-undo) 900 (buffer-disable-undo)
907 (set (make-local-variable 'font-lock-global-modes) nil) 901 (set (make-local-variable 'font-lock-global-modes) nil)
908 (font-lock-mode -1) 902 (font-lock-mode -1)
diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el
index ce658cd5d54..60c4ccadf65 100644
--- a/lisp/cedet/semantic/grammar.el
+++ b/lisp/cedet/semantic/grammar.el
@@ -860,7 +860,7 @@ Lisp code."
860 ;; Use Unix EOLs, so that the file is portable to all platforms. 860 ;; Use Unix EOLs, so that the file is portable to all platforms.
861 (setq buffer-file-coding-system 'raw-text-unix) 861 (setq buffer-file-coding-system 'raw-text-unix)
862 (erase-buffer) 862 (erase-buffer)
863 (unless (eq major-mode 'emacs-lisp-mode) 863 (unless (derived-mode-p 'emacs-lisp-mode)
864 (emacs-lisp-mode)) 864 (emacs-lisp-mode))
865 865
866;;;; Header + Prologue 866;;;; Header + Prologue
@@ -1102,7 +1102,9 @@ END is the limit of the search."
1102;;;; Define major mode 1102;;;; Define major mode
1103;;;; 1103;;;;
1104 1104
1105(defvar semantic-grammar-syntax-table 1105(define-obsolete-variable-alias 'semantic-grammar-syntax-table
1106 'semantic-grammar-mode-syntax-table "24.1")
1107(defvar semantic-grammar-mode-syntax-table
1106 (let ((table (make-syntax-table (standard-syntax-table)))) 1108 (let ((table (make-syntax-table (standard-syntax-table))))
1107 (modify-syntax-entry ?\: "." table) ;; COLON 1109 (modify-syntax-entry ?\: "." table) ;; COLON
1108 (modify-syntax-entry ?\> "." table) ;; GT 1110 (modify-syntax-entry ?\> "." table) ;; GT
@@ -1170,7 +1172,9 @@ END is the limit of the search."
1170 semantic-grammar-mode-keywords-1 1172 semantic-grammar-mode-keywords-1
1171 "Font Lock keywords used to highlight Semantic grammar buffers.") 1173 "Font Lock keywords used to highlight Semantic grammar buffers.")
1172 1174
1173(defvar semantic-grammar-map 1175(define-obsolete-variable-alias 'semantic-grammar-map
1176 'semantic-grammar-mode-map "24.1")
1177(defvar semantic-grammar-mode-map
1174 (let ((km (make-sparse-keymap))) 1178 (let ((km (make-sparse-keymap)))
1175 1179
1176 (define-key km "|" 'semantic-grammar-electric-punctuation) 1180 (define-key km "|" 'semantic-grammar-electric-punctuation)
@@ -1271,22 +1275,17 @@ the change bounds to encompass the whole nonterminal tag."
1271 (semantic-tag-start outer) 1275 (semantic-tag-start outer)
1272 (semantic-tag-end outer))))) 1276 (semantic-tag-end outer)))))
1273 1277
1274(defun semantic-grammar-mode () 1278(define-derived-mode semantic-grammar-mode
1279 fundamental-mode "Semantic Grammar Framework"
1275 "Initialize a buffer for editing Semantic grammars. 1280 "Initialize a buffer for editing Semantic grammars.
1276 1281
1277\\{semantic-grammar-map}" 1282\\{semantic-grammar-mode-map}"
1278 (interactive)
1279 (kill-all-local-variables)
1280 (setq major-mode 'semantic-grammar-mode
1281 mode-name "Semantic Grammar Framework")
1282 (set (make-local-variable 'parse-sexp-ignore-comments) t) 1283 (set (make-local-variable 'parse-sexp-ignore-comments) t)
1283 (set (make-local-variable 'comment-start) ";;") 1284 (set (make-local-variable 'comment-start) ";;")
1284 ;; Look within the line for a ; following an even number of backslashes 1285 ;; Look within the line for a ; following an even number of backslashes
1285 ;; after either a non-backslash or the line beginning. 1286 ;; after either a non-backslash or the line beginning.
1286 (set (make-local-variable 'comment-start-skip) 1287 (set (make-local-variable 'comment-start-skip)
1287 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") 1288 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
1288 (set-syntax-table semantic-grammar-syntax-table)
1289 (use-local-map semantic-grammar-map)
1290 (set (make-local-variable 'indent-line-function) 1289 (set (make-local-variable 'indent-line-function)
1291 'semantic-grammar-indent) 1290 'semantic-grammar-indent)
1292 (set (make-local-variable 'fill-paragraph-function) 1291 (set (make-local-variable 'fill-paragraph-function)
@@ -1335,15 +1334,14 @@ the change bounds to encompass the whole nonterminal tag."
1335 (semantic-make-local-hook 'semantic-edits-new-change-functions) 1334 (semantic-make-local-hook 'semantic-edits-new-change-functions)
1336 (add-hook 'semantic-edits-new-change-functions 1335 (add-hook 'semantic-edits-new-change-functions
1337 'semantic-grammar-edits-new-change-hook-fcn 1336 'semantic-grammar-edits-new-change-hook-fcn
1338 nil t) 1337 nil t))
1339 (semantic-run-mode-hooks 'semantic-grammar-mode-hook))
1340 1338
1341;;;; 1339;;;;
1342;;;; Useful commands 1340;;;; Useful commands
1343;;;; 1341;;;;
1344 1342
1345(defvar semantic-grammar-skip-quoted-syntax-table 1343(defvar semantic-grammar-skip-quoted-syntax-table
1346 (let ((st (copy-syntax-table semantic-grammar-syntax-table))) 1344 (let ((st (copy-syntax-table semantic-grammar-mode-syntax-table)))
1347 (modify-syntax-entry ?\' "$" st) 1345 (modify-syntax-entry ?\' "$" st)
1348 st) 1346 st)
1349 "Syntax table to skip a whole quoted expression in grammar code. 1347 "Syntax table to skip a whole quoted expression in grammar code.
diff --git a/lisp/chistory.el b/lisp/chistory.el
index 509324ade88..9a77793b1e1 100644
--- a/lisp/chistory.el
+++ b/lisp/chistory.el
@@ -121,7 +121,9 @@ The buffer is left in Command History mode."
121 (error "No command history") 121 (error "No command history")
122 (command-history-mode))))) 122 (command-history-mode)))))
123 123
124(defvar command-history-map 124(define-obsolete-variable-alias 'command-history-map
125 'command-history-mode-map "24.1")
126(defvar command-history-mode-map
125 (let ((map (make-sparse-keymap))) 127 (let ((map (make-sparse-keymap)))
126 (set-keymap-parent map lisp-mode-shared-map) 128 (set-keymap-parent map lisp-mode-shared-map)
127 (suppress-keymap map) 129 (suppress-keymap map)
@@ -132,21 +134,11 @@ The buffer is left in Command History mode."
132 map) 134 map)
133 "Keymap for `command-history-mode'.") 135 "Keymap for `command-history-mode'.")
134 136
135(defun command-history-mode () 137(define-derived-mode command-history-mode fundamental-mode "Command History"
136 "Major mode for listing and repeating recent commands. 138 "Major mode for listing and repeating recent commands.
137 139
138Keybindings: 140Keybindings:
139\\{command-history-map}" 141\\{command-history-mode-map}"
140 (interactive)
141 (Command-history-setup)
142 (setq major-mode 'command-history-mode)
143 (setq mode-name "Command History")
144 (use-local-map command-history-map)
145 (run-mode-hooks 'command-history-mode-hook))
146
147(defun Command-history-setup ()
148 (kill-all-local-variables)
149 (use-local-map command-history-map)
150 (lisp-mode-variables nil) 142 (lisp-mode-variables nil)
151 (set-syntax-table emacs-lisp-mode-syntax-table) 143 (set-syntax-table emacs-lisp-mode-syntax-table)
152 (setq buffer-read-only t)) 144 (setq buffer-read-only t))
diff --git a/lisp/comint.el b/lisp/comint.el
index 0ce7053c031..7572e8baabc 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3793,25 +3793,21 @@ REGEXP-GROUP is the regular expression group in REGEXP to use."
3793;; comint-mode will take care of it. The following example, from shell.el, 3793;; comint-mode will take care of it. The following example, from shell.el,
3794;; is typical: 3794;; is typical:
3795;; 3795;;
3796;; (defvar shell-mode-map '()) 3796;; (defvar shell-mode-map
3797;; (cond ((not shell-mode-map) 3797;; (let ((map (make-sparse-keymap)))
3798;; (setq shell-mode-map (copy-keymap comint-mode-map)) 3798;; (set-keymap-parent map comint-mode-map)
3799;; (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command) 3799;; (define-key map "\C-c\C-f" 'shell-forward-command)
3800;; (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command) 3800;; (define-key map "\C-c\C-b" 'shell-backward-command)
3801;; (define-key shell-mode-map "\t" 'completion-at-point) 3801;; (define-key map "\t" 'completion-at-point)
3802;; (define-key shell-mode-map "\M-?" 3802;; (define-key map "\M-?"
3803;; 'comint-dynamic-list-filename-completions))) 3803;; 'comint-dynamic-list-filename-completions)
3804;; map))
3804;; 3805;;
3805;; (defun shell-mode () 3806;; (define-derived-mode shell-mode comint-mode "Shell"
3806;; (interactive) 3807;; "Doc."
3807;; (comint-mode)
3808;; (setq comint-prompt-regexp shell-prompt-pattern) 3808;; (setq comint-prompt-regexp shell-prompt-pattern)
3809;; (setq major-mode 'shell-mode)
3810;; (setq mode-name "Shell")
3811;; (use-local-map shell-mode-map)
3812;; (setq-local shell-directory-stack nil) 3809;; (setq-local shell-directory-stack nil)
3813;; (add-hook 'comint-input-filter-functions 'shell-directory-tracker) 3810;; (add-hook 'comint-input-filter-functions 'shell-directory-tracker))
3814;; (run-mode-hooks 'shell-mode-hook))
3815;; 3811;;
3816;; 3812;;
3817;; Completion for comint-mode users 3813;; Completion for comint-mode users
diff --git a/lisp/dframe.el b/lisp/dframe.el
index 66967075e34..3ef30d055b6 100644
--- a/lisp/dframe.el
+++ b/lisp/dframe.el
@@ -758,9 +758,8 @@ who requested the timer. NULL-ON-ERROR is ignored."
758Evaluates all cached timer functions in sequence." 758Evaluates all cached timer functions in sequence."
759 (let ((l dframe-client-functions)) 759 (let ((l dframe-client-functions))
760 (while (and l (sit-for 0)) 760 (while (and l (sit-for 0))
761 (condition-case er 761 (with-demoted-errors "DFRAME TIMER ERROR: %S"
762 (funcall (car l)) 762 (funcall (car l)))
763 (error (message "DFRAME TIMER ERROR: %S" er)))
764 (setq l (cdr l))))) 763 (setq l (cdr l)))))
765 764
766;;; Menu hacking for mouse-3 765;;; Menu hacking for mouse-3
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index c6ecbf1e718..c15f3b5b121 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -1459,6 +1459,9 @@ to mark all zero length files."
1459 s nil)) 1459 s nil))
1460 (setq mode (buffer-substring (point) (+ mode-len (point)))) 1460 (setq mode (buffer-substring (point) (+ mode-len (point))))
1461 (forward-char mode-len) 1461 (forward-char mode-len)
1462 ;; Skip any extended attributes marker ("." or "+").
1463 (or (looking-at " ")
1464 (forward-char 1))
1462 (setq nlink (read (current-buffer))) 1465 (setq nlink (read (current-buffer)))
1463 ;; Karsten Wenger <kw@cis.uni-muenchen.de> fixed uid. 1466 ;; Karsten Wenger <kw@cis.uni-muenchen.de> fixed uid.
1464 (setq uid (buffer-substring (1+ (point)) 1467 (setq uid (buffer-substring (1+ (point))
diff --git a/lisp/dired.el b/lisp/dired.el
index f873aea9bf0..345e8d57113 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -4352,7 +4352,7 @@ instead.
4352 4352
4353;;;*** 4353;;;***
4354 4354
4355;;;### (autoloads nil "dired-x" "dired-x.el" "1bf4009b81e55bf51947bc87b2c82994") 4355;;;### (autoloads nil "dired-x" "dired-x.el" "11fd4a8afa32507cc32d4a04d852587f")
4356;;; Generated autoloads from dired-x.el 4356;;; Generated autoloads from dired-x.el
4357 4357
4358(autoload 'dired-jump "dired-x" "\ 4358(autoload 'dired-jump "dired-x" "\
diff --git a/lisp/echistory.el b/lisp/echistory.el
index fc576aa6484..5989c9b8445 100644
--- a/lisp/echistory.el
+++ b/lisp/echistory.el
@@ -117,7 +117,6 @@ The Command History listing is recomputed each time this mode is invoked."
117 (save-window-excursion 117 (save-window-excursion
118 (list-command-history) 118 (list-command-history)
119 (set-buffer "*Command History*") 119 (set-buffer "*Command History*")
120 (Command-history-setup)
121 (setq major-mode 'electric-command-history) 120 (setq major-mode 'electric-command-history)
122 (setq mode-name "Electric History") 121 (setq mode-name "Electric History")
123 (use-local-map electric-history-map)) 122 (use-local-map electric-history-map))
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index b3fc6fb887a..2b2189e70e3 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -1,7 +1,6 @@
1;;; copyright.el --- update the copyright notice in current buffer 1;;; copyright.el --- update the copyright notice in current buffer
2 2
3;; Copyright (C) 1991-1995, 1998, 2001-2013 Free Software Foundation, 3;; Copyright (C) 1991-1995, 1998, 2001-2013 Free Software Foundation, Inc.
4;; Inc.
5 4
6;; Author: Daniel Pfeiffer <occitan@esperanto.org> 5;; Author: Daniel Pfeiffer <occitan@esperanto.org>
7;; Keywords: maint, tools 6;; Keywords: maint, tools
@@ -145,18 +144,17 @@ The header must match `copyright-regexp' and `copyright-names-regexp', if set.
145This function sets the match-data that `copyright-update-year' uses." 144This function sets the match-data that `copyright-update-year' uses."
146 (widen) 145 (widen)
147 (goto-char (copyright-start-point)) 146 (goto-char (copyright-start-point))
148 (condition-case err 147 ;; In case the regexp is rejected. This is useful because
149 ;; (1) Need the extra \\( \\) around copyright-regexp because we 148 ;; copyright-update is typically called from before-save-hook where
150 ;; goto (match-end 1) below. See note (2) below. 149 ;; such an error is very inconvenient for the user.
151 (copyright-re-search (concat "\\(" copyright-regexp 150 (with-demoted-errors "Can't update copyright: %s"
152 "\\)\\([ \t]*\n\\)?.*\\(?:" 151 ;; (1) Need the extra \\( \\) around copyright-regexp because we
153 copyright-names-regexp "\\)") 152 ;; goto (match-end 1) below. See note (2) below.
154 (copyright-limit) 153 (copyright-re-search (concat "\\(" copyright-regexp
155 t) 154 "\\)\\([ \t]*\n\\)?.*\\(?:"
156 ;; In case the regexp is rejected. This is useful because 155 copyright-names-regexp "\\)")
157 ;; copyright-update is typically called from before-save-hook where 156 (copyright-limit)
158 ;; such an error is very inconvenient for the user. 157 t)))
159 (error (message "Can't update copyright: %s" err) nil)))
160 158
161(defun copyright-find-end () 159(defun copyright-find-end ()
162 "Possibly adjust the search performed by `copyright-find-copyright'. 160 "Possibly adjust the search performed by `copyright-find-copyright'.
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 709a094e73b..6c7a0d2db1d 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -626,7 +626,7 @@ The environment used is the one when entering the activation frame at point."
626 626
627(put 'debugger-mode 'mode-class 'special) 627(put 'debugger-mode 'mode-class 'special)
628 628
629(defun debugger-mode () 629(define-derived-mode debugger-mode fundamental-mode "Debugger"
630 "Mode for backtrace buffers, selected in debugger. 630 "Mode for backtrace buffers, selected in debugger.
631\\<debugger-mode-map> 631\\<debugger-mode-map>
632A line starts with `*' if exiting that frame will call the debugger. 632A line starts with `*' if exiting that frame will call the debugger.
@@ -641,13 +641,9 @@ which functions will enter the debugger when called.
641 641
642Complete list of commands: 642Complete list of commands:
643\\{debugger-mode-map}" 643\\{debugger-mode-map}"
644 (kill-all-local-variables)
645 (setq major-mode 'debugger-mode)
646 (setq mode-name "Debugger")
647 (setq truncate-lines t) 644 (setq truncate-lines t)
648 (set-syntax-table emacs-lisp-mode-syntax-table) 645 (set-syntax-table emacs-lisp-mode-syntax-table)
649 (use-local-map debugger-mode-map) 646 (use-local-map debugger-mode-map))
650 (run-mode-hooks 'debugger-mode-hook))
651 647
652(defcustom debugger-record-buffer "*Debugger-record*" 648(defcustom debugger-record-buffer "*Debugger-record*"
653 "Buffer name for expression values, for \\[debugger-record-expression]." 649 "Buffer name for expression values, for \\[debugger-record-expression]."
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 9b9fd325941..250f93800ec 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -309,27 +309,26 @@ This variable is expected to be made buffer-local by modes (other than
309Emacs Lisp mode) that support ElDoc.") 309Emacs Lisp mode) that support ElDoc.")
310 310
311(defun eldoc-print-current-symbol-info () 311(defun eldoc-print-current-symbol-info ()
312 (condition-case err 312 ;; This is run from post-command-hook or some idle timer thing,
313 (and (or (eldoc-display-message-p) eldoc-post-insert-mode) 313 ;; so we need to be careful that errors aren't ignored.
314 (if eldoc-documentation-function 314 (with-demoted-errors "eldoc error: %s"
315 (eldoc-message (funcall eldoc-documentation-function)) 315 (and (or (eldoc-display-message-p) eldoc-post-insert-mode)
316 (let* ((current-symbol (eldoc-current-symbol)) 316 (if eldoc-documentation-function
317 (current-fnsym (eldoc-fnsym-in-current-sexp)) 317 (eldoc-message (funcall eldoc-documentation-function))
318 (doc (cond 318 (let* ((current-symbol (eldoc-current-symbol))
319 ((null current-fnsym) 319 (current-fnsym (eldoc-fnsym-in-current-sexp))
320 nil) 320 (doc (cond
321 ((eq current-symbol (car current-fnsym)) 321 ((null current-fnsym)
322 (or (apply 'eldoc-get-fnsym-args-string 322 nil)
323 current-fnsym) 323 ((eq current-symbol (car current-fnsym))
324 (eldoc-get-var-docstring current-symbol))) 324 (or (apply 'eldoc-get-fnsym-args-string
325 (t 325 current-fnsym)
326 (or (eldoc-get-var-docstring current-symbol) 326 (eldoc-get-var-docstring current-symbol)))
327 (apply 'eldoc-get-fnsym-args-string 327 (t
328 current-fnsym)))))) 328 (or (eldoc-get-var-docstring current-symbol)
329 (eldoc-message doc)))) 329 (apply 'eldoc-get-fnsym-args-string
330 ;; This is run from post-command-hook or some idle timer thing, 330 current-fnsym))))))
331 ;; so we need to be careful that errors aren't ignored. 331 (eldoc-message doc))))))
332 (error (message "eldoc error: %s" err))))
333 332
334(defun eldoc-get-fnsym-args-string (sym &optional index) 333(defun eldoc-get-fnsym-args-string (sym &optional index)
335 "Return a string containing the parameter list of the function SYM. 334 "Return a string containing the parameter list of the function SYM.
diff --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el
index 1ec0ecc943c..e2fcf2eae41 100644
--- a/lisp/emulation/tpu-edt.el
+++ b/lisp/emulation/tpu-edt.el
@@ -2374,9 +2374,8 @@ If FILE is nil, try to load a default file. The default file names are
2374 (goto-char (point-min)) 2374 (goto-char (point-min))
2375 (beep) 2375 (beep)
2376 (and (tpu-y-or-n-p "Copy key definitions to the new file now? ") 2376 (and (tpu-y-or-n-p "Copy key definitions to the new file now? ")
2377 (condition-case conditions 2377 (with-demoted-errors "Sorry, couldn't copy - %s."
2378 (copy-file oldname newname) 2378 (copy-file oldname newname)))
2379 (error (message "Sorry, couldn't copy - %s." (cdr conditions)))))
2380 (kill-buffer "*TPU-Notice*"))) 2379 (kill-buffer "*TPU-Notice*")))
2381 2380
2382(defvar tpu-edt-old-global-values nil) 2381(defvar tpu-edt-old-global-values nil)
diff --git a/lisp/emulation/ws-mode.el b/lisp/emulation/ws-mode.el
index 03d7076195e..dfb81b3829c 100644
--- a/lisp/emulation/ws-mode.el
+++ b/lisp/emulation/ws-mode.el
@@ -73,8 +73,7 @@
73 (define-key map "\C-x" 'save-buffers-kill-emacs) 73 (define-key map "\C-x" 'save-buffers-kill-emacs)
74 (define-key map "y" 'ws-delete-block) 74 (define-key map "y" 'ws-delete-block)
75 (define-key map "\C-y" 'ws-delete-block) 75 (define-key map "\C-y" 'ws-delete-block)
76 map) 76 map))
77 "")
78 77
79(defvar wordstar-C-o-map 78(defvar wordstar-C-o-map
80 (let ((map (make-keymap))) 79 (let ((map (make-keymap)))
@@ -140,8 +139,7 @@
140 (define-key map "y" 'ws-kill-eol) 139 (define-key map "y" 'ws-kill-eol)
141 (define-key map "\C-y" 'ws-kill-eol) 140 (define-key map "\C-y" 'ws-kill-eol)
142 (define-key map "\177" 'ws-kill-bol) 141 (define-key map "\177" 'ws-kill-bol)
143 map) 142 map))
144 "")
145 143
146(defvar wordstar-mode-map 144(defvar wordstar-mode-map
147 (let ((map (make-keymap))) 145 (let ((map (make-keymap)))
@@ -170,17 +168,16 @@
170 (define-key map "\C-x" 'next-line) 168 (define-key map "\C-x" 'next-line)
171 (define-key map "\C-y" 'kill-complete-line) 169 (define-key map "\C-y" 'kill-complete-line)
172 (define-key map "\C-z" 'scroll-up-line) 170 (define-key map "\C-z" 'scroll-up-line)
173 map) 171 map))
174 "")
175 172
176;; wordstar-C-j-map not yet implemented 173;; wordstar-C-j-map not yet implemented
177(defvar wordstar-C-j-map nil "") 174(defvar wordstar-C-j-map nil)
178 175
179 176
180(put 'wordstar-mode 'mode-class 'special) 177(put 'wordstar-mode 'mode-class 'special)
181 178
182;;;###autoload 179;;;###autoload
183(defun wordstar-mode () 180(define-derived-mode wordstar-mode fundamental-mode "WordStar"
184 "Major mode with WordStar-like key bindings. 181 "Major mode with WordStar-like key bindings.
185 182
186BUGS: 183BUGS:
@@ -191,106 +188,7 @@ BUGS:
191 - Search and replace (C-q a) is only available in forward direction 188 - Search and replace (C-q a) is only available in forward direction
192 189
193No key bindings beginning with ESC are installed, they will work 190No key bindings beginning with ESC are installed, they will work
194Emacs-like. 191Emacs-like.")
195
196The key bindings are:
197
198 C-a backward-word
199 C-b fill-paragraph
200 C-c scroll-up-line
201 C-d forward-char
202 C-e previous-line
203 C-f forward-word
204 C-g delete-char
205 C-h backward-char
206 C-i indent-for-tab-command
207 C-j help-for-help
208 C-k ordstar-C-k-map
209 C-l ws-repeat-search
210 C-n open-line
211 C-p quoted-insert
212 C-r scroll-down-line
213 C-s backward-char
214 C-t kill-word
215 C-u keyboard-quit
216 C-v overwrite-mode
217 C-w scroll-down
218 C-x next-line
219 C-y kill-complete-line
220 C-z scroll-up
221
222 C-k 0 ws-set-marker-0
223 C-k 1 ws-set-marker-1
224 C-k 2 ws-set-marker-2
225 C-k 3 ws-set-marker-3
226 C-k 4 ws-set-marker-4
227 C-k 5 ws-set-marker-5
228 C-k 6 ws-set-marker-6
229 C-k 7 ws-set-marker-7
230 C-k 8 ws-set-marker-8
231 C-k 9 ws-set-marker-9
232 C-k b ws-begin-block
233 C-k c ws-copy-block
234 C-k d save-buffers-kill-emacs
235 C-k f find-file
236 C-k h ws-show-markers
237 C-k i ws-indent-block
238 C-k k ws-end-block
239 C-k p ws-print-block
240 C-k q kill-emacs
241 C-k r insert-file
242 C-k s save-some-buffers
243 C-k t ws-mark-word
244 C-k u ws-exdent-block
245 C-k C-u keyboard-quit
246 C-k v ws-move-block
247 C-k w ws-write-block
248 C-k x kill-emacs
249 C-k y ws-delete-block
250
251 C-o c wordstar-center-line
252 C-o b switch-to-buffer
253 C-o j justify-current-line
254 C-o k kill-buffer
255 C-o l list-buffers
256 C-o m auto-fill-mode
257 C-o r set-fill-column
258 C-o C-u keyboard-quit
259 C-o wd delete-other-windows
260 C-o wh split-window-right
261 C-o wo other-window
262 C-o wv split-window-below
263
264 C-q 0 ws-find-marker-0
265 C-q 1 ws-find-marker-1
266 C-q 2 ws-find-marker-2
267 C-q 3 ws-find-marker-3
268 C-q 4 ws-find-marker-4
269 C-q 5 ws-find-marker-5
270 C-q 6 ws-find-marker-6
271 C-q 7 ws-find-marker-7
272 C-q 8 ws-find-marker-8
273 C-q 9 ws-find-marker-9
274 C-q a ws-query-replace
275 C-q b ws-to-block-begin
276 C-q c end-of-buffer
277 C-q d end-of-line
278 C-q f ws-search
279 C-q k ws-to-block-end
280 C-q l ws-undo
281 C-q p ws-last-cursorp
282 C-q r beginning-of-buffer
283 C-q C-u keyboard-quit
284 C-q w ws-last-error
285 C-q y ws-kill-eol
286 C-q DEL ws-kill-bol
287"
288 (interactive)
289 (kill-all-local-variables)
290 (use-local-map wordstar-mode-map)
291 (setq mode-name "WordStar")
292 (setq major-mode 'wordstar-mode)
293 (run-mode-hooks 'wordstar-mode-hook))
294 192
295 193
296(defun wordstar-center-paragraph () 194(defun wordstar-center-paragraph ()
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el
index a46b48c01b3..9a9cc4cd567 100644
--- a/lisp/eshell/em-alias.el
+++ b/lisp/eshell/em-alias.el
@@ -221,18 +221,11 @@ file named by `eshell-aliases-file'.")
221 (let ((alias (eshell-lookup-alias command))) 221 (let ((alias (eshell-lookup-alias command)))
222 (if alias 222 (if alias
223 (throw 'eshell-replace-command 223 (throw 'eshell-replace-command
224 (list 224 `(let ((eshell-command-name ',eshell-last-command-name)
225 'let 225 (eshell-command-arguments ',eshell-last-arguments)
226 (list 226 (eshell-prevent-alias-expansion
227 (list 'eshell-command-name 227 ',(cons command eshell-prevent-alias-expansion)))
228 (list 'quote eshell-last-command-name)) 228 ,(eshell-parse-command (nth 1 alias))))))))
229 (list 'eshell-command-arguments
230 (list 'quote eshell-last-arguments))
231 (list 'eshell-prevent-alias-expansion
232 (list 'quote
233 (cons command
234 eshell-prevent-alias-expansion))))
235 (eshell-parse-command (nth 1 alias))))))))
236 229
237(defun eshell-alias-completions (name) 230(defun eshell-alias-completions (name)
238 "Find all possible completions for NAME. 231 "Find all possible completions for NAME.
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el
index a58c7730ded..b5ca8119470 100644
--- a/lisp/eshell/em-glob.el
+++ b/lisp/eshell/em-glob.el
@@ -180,6 +180,8 @@ interpretation."
180 (goto-char (1+ end)))))))))) 180 (goto-char (1+ end))))))))))
181 181
182(defvar eshell-glob-chars-regexp nil) 182(defvar eshell-glob-chars-regexp nil)
183(defvar eshell-glob-matches)
184(defvar message-shown)
183 185
184(defun eshell-glob-regexp (pattern) 186(defun eshell-glob-regexp (pattern)
185 "Convert glob-pattern PATTERN to a regular expression. 187 "Convert glob-pattern PATTERN to a regular expression.
@@ -262,9 +264,6 @@ the form:
262 (error "No matches found: %s" glob) 264 (error "No matches found: %s" glob)
263 glob)))) 265 glob))))
264 266
265(defvar eshell-glob-matches)
266(defvar message-shown)
267
268;; FIXME does this really need to abuse eshell-glob-matches, message-shown? 267;; FIXME does this really need to abuse eshell-glob-matches, message-shown?
269(defun eshell-glob-entries (path globs &optional recurse-p) 268(defun eshell-glob-entries (path globs &optional recurse-p)
270 "Glob the entries in PATHS, possibly recursing if RECURSE-P is non-nil." 269 "Glob the entries in PATHS, possibly recursing if RECURSE-P is non-nil."
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 41db4cd03d1..3dee1adb58a 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -268,6 +268,25 @@ scope during the evaluation of TEST-SEXP."
268 :type '(repeat (cons function face)) 268 :type '(repeat (cons function face))
269 :group 'eshell-ls) 269 :group 'eshell-ls)
270 270
271(defvar block-size)
272(defvar dereference-links)
273(defvar dir-literal)
274(defvar error-func)
275(defvar flush-func)
276(defvar human-readable)
277(defvar ignore-pattern)
278(defvar insert-func)
279(defvar listing-style)
280(defvar numeric-uid-gid)
281(defvar reverse-list)
282(defvar show-all)
283(defvar show-almost-all)
284(defvar show-recursive)
285(defvar show-size)
286(defvar sort-method)
287(defvar ange-cache)
288(defvar dired-flag)
289
271;;; Functions: 290;;; Functions:
272 291
273(defun eshell-ls-insert-directory 292(defun eshell-ls-insert-directory
@@ -315,25 +334,6 @@ instead."
315 334
316(put 'eshell/ls 'eshell-no-numeric-conversions t) 335(put 'eshell/ls 'eshell-no-numeric-conversions t)
317 336
318(defvar block-size)
319(defvar dereference-links)
320(defvar dir-literal)
321(defvar error-func)
322(defvar flush-func)
323(defvar human-readable)
324(defvar ignore-pattern)
325(defvar insert-func)
326(defvar listing-style)
327(defvar numeric-uid-gid)
328(defvar reverse-list)
329(defvar show-all)
330(defvar show-almost-all)
331(defvar show-recursive)
332(defvar show-size)
333(defvar sort-method)
334(defvar ange-cache)
335(defvar dired-flag)
336
337(declare-function eshell-glob-regexp "em-glob" (pattern)) 337(declare-function eshell-glob-regexp "em-glob" (pattern))
338 338
339(defun eshell-do-ls (&rest args) 339(defun eshell-do-ls (&rest args)
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 3a7f46ebe83..14d3020530f 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -307,7 +307,7 @@ functions. PRED-FUNCS take a filename and return t if the test
307succeeds; MOD-FUNCS take any string and preform a modification, 307succeeds; MOD-FUNCS take any string and preform a modification,
308returning the resultant string." 308returning the resultant string."
309 (let (result negate follow preds mods) 309 (let (result negate follow preds mods)
310 (condition-case err 310 (condition-case nil
311 (while (not (eobp)) 311 (while (not (eobp))
312 (let ((char (char-after))) 312 (let ((char (char-after)))
313 (cond 313 (cond
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el
index 341191fc62f..a526d590307 100644
--- a/lisp/eshell/em-rebind.el
+++ b/lisp/eshell/em-rebind.el
@@ -218,7 +218,7 @@ lock it at that."
218 (cdar bindings)) 218 (cdar bindings))
219 (setq bindings (cdr bindings))))) 219 (setq bindings (cdr bindings)))))
220 220
221(defun eshell-delete-backward-char (n &optional killflag) 221(defun eshell-delete-backward-char (n)
222 "Delete the last character, unless it's part of the output." 222 "Delete the last character, unless it's part of the output."
223 (interactive "P") 223 (interactive "P")
224 (let ((count (prefix-numeric-value n))) 224 (let ((count (prefix-numeric-value n)))
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index af54d875cb0..b9b1c1635a5 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -714,6 +714,8 @@ available..."
714 (goto-char (point-min)) 714 (goto-char (point-min))
715 (resize-temp-buffer-window)))))) 715 (resize-temp-buffer-window))))))
716 716
717(defvar compilation-scroll-output)
718
717(defun eshell-grep (command args &optional maybe-use-occur) 719(defun eshell-grep (command args &optional maybe-use-occur)
718 "Generic service function for the various grep aliases. 720 "Generic service function for the various grep aliases.
719It calls Emacs's grep utility if the command is not redirecting output, 721It calls Emacs's grep utility if the command is not redirecting output,
@@ -989,7 +991,7 @@ Show wall-clock time elapsed during execution of COMMAND.")
989 (setq args nil) 991 (setq args nil)
990 (setcdr (last args 3) nil)) 992 (setcdr (last args 3) nil))
991 (with-current-buffer 993 (with-current-buffer
992 (condition-case err 994 (condition-case nil
993 (diff-no-select 995 (diff-no-select
994 old new 996 old new
995 (nil-blank-string (eshell-flatten-and-stringify args))) 997 (nil-blank-string (eshell-flatten-and-stringify args)))
@@ -1014,6 +1016,8 @@ Show wall-clock time elapsed during execution of COMMAND.")
1014 1016
1015(put 'eshell/diff 'eshell-no-numeric-conversions t) 1017(put 'eshell/diff 'eshell-no-numeric-conversions t)
1016 1018
1019(defvar locate-history-list)
1020
1017(defun eshell/locate (&rest args) 1021(defun eshell/locate (&rest args)
1018 "Alias \"locate\" to call Emacs `locate' function." 1022 "Alias \"locate\" to call Emacs `locate' function."
1019 (if (or eshell-plain-locate-behavior 1023 (if (or eshell-plain-locate-behavior
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index d7dfd27d8d3..e3a12d5ece5 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -278,7 +278,7 @@ Point is left at the end of the arguments."
278 (eshell-resolve-current-argument) 278 (eshell-resolve-current-argument)
279 eshell-current-argument)) 279 eshell-current-argument))
280 280
281(defsubst eshell-operator (&rest args) 281(defsubst eshell-operator (&rest _args)
282 "A stub function that generates an error if a floating operator is found." 282 "A stub function that generates an error if a floating operator is found."
283 (error "Unhandled operator in input text")) 283 (error "Unhandled operator in input text"))
284 284
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index ef8a53f3c0b..c2922983ae2 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -650,7 +650,7 @@ For an external command, it means an exit code of 0."
650 (looking-at eshell-lisp-regexp)) 650 (looking-at eshell-lisp-regexp))
651 (let* ((here (point)) 651 (let* ((here (point))
652 (obj 652 (obj
653 (condition-case err 653 (condition-case nil
654 (read (current-buffer)) 654 (read (current-buffer))
655 (end-of-file 655 (end-of-file
656 (throw 'eshell-incomplete ?\())))) 656 (throw 'eshell-incomplete ?\()))))
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index ed5fecf09ff..54a36428d58 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -220,74 +220,67 @@ This is used by `eshell-watch-for-password-prompt'."
220(defvar eshell-last-output-end nil) 220(defvar eshell-last-output-end nil)
221 221
222(defvar eshell-currently-handling-window nil) 222(defvar eshell-currently-handling-window nil)
223(defvar eshell-mode-syntax-table nil)
224(defvar eshell-mode-abbrev-table nil)
225 223
226(define-abbrev-table 'eshell-mode-abbrev-table ()) 224(define-abbrev-table 'eshell-mode-abbrev-table ())
227 225
228(if (not eshell-mode-syntax-table) 226(defvar eshell-mode-syntax-table
229 (let ((i 0)) 227 (let ((st (make-syntax-table))
230 (setq eshell-mode-syntax-table (make-syntax-table)) 228 (i 0))
231 (while (< i ?0) 229 (while (< i ?0)
232 (modify-syntax-entry i "_ " eshell-mode-syntax-table) 230 (modify-syntax-entry i "_ " st)
233 (setq i (1+ i))) 231 (setq i (1+ i)))
234 (setq i (1+ ?9)) 232 (setq i (1+ ?9))
235 (while (< i ?A) 233 (while (< i ?A)
236 (modify-syntax-entry i "_ " eshell-mode-syntax-table) 234 (modify-syntax-entry i "_ " st)
237 (setq i (1+ i))) 235 (setq i (1+ i)))
238 (setq i (1+ ?Z)) 236 (setq i (1+ ?Z))
239 (while (< i ?a) 237 (while (< i ?a)
240 (modify-syntax-entry i "_ " eshell-mode-syntax-table) 238 (modify-syntax-entry i "_ " st)
241 (setq i (1+ i))) 239 (setq i (1+ i)))
242 (setq i (1+ ?z)) 240 (setq i (1+ ?z))
243 (while (< i 128) 241 (while (< i 128)
244 (modify-syntax-entry i "_ " eshell-mode-syntax-table) 242 (modify-syntax-entry i "_ " st)
245 (setq i (1+ i))) 243 (setq i (1+ i)))
246 (modify-syntax-entry ? " " eshell-mode-syntax-table) 244 (modify-syntax-entry ? " " st)
247 (modify-syntax-entry ?\t " " eshell-mode-syntax-table) 245 (modify-syntax-entry ?\t " " st)
248 (modify-syntax-entry ?\f " " eshell-mode-syntax-table) 246 (modify-syntax-entry ?\f " " st)
249 (modify-syntax-entry ?\n "> " eshell-mode-syntax-table) 247 (modify-syntax-entry ?\n "> " st)
250 ;; Give CR the same syntax as newline, for selective-display. 248 ;; Give CR the same syntax as newline, for selective-display.
251 (modify-syntax-entry ?\^m "> " eshell-mode-syntax-table) 249 (modify-syntax-entry ?\^m "> " st)
252;;; (modify-syntax-entry ?\; "< " eshell-mode-syntax-table) 250 ;; (modify-syntax-entry ?\; "< " st)
253 (modify-syntax-entry ?` "' " eshell-mode-syntax-table) 251 (modify-syntax-entry ?` "' " st)
254 (modify-syntax-entry ?' "' " eshell-mode-syntax-table) 252 (modify-syntax-entry ?' "' " st)
255 (modify-syntax-entry ?, "' " eshell-mode-syntax-table) 253 (modify-syntax-entry ?, "' " st)
256 ;; Used to be singlequote; changed for flonums. 254 ;; Used to be singlequote; changed for flonums.
257 (modify-syntax-entry ?. "_ " eshell-mode-syntax-table) 255 (modify-syntax-entry ?. "_ " st)
258 (modify-syntax-entry ?- "_ " eshell-mode-syntax-table) 256 (modify-syntax-entry ?- "_ " st)
259 (modify-syntax-entry ?| ". " eshell-mode-syntax-table) 257 (modify-syntax-entry ?| ". " st)
260 (modify-syntax-entry ?# "' " eshell-mode-syntax-table) 258 (modify-syntax-entry ?# "' " st)
261 (modify-syntax-entry ?\" "\" " eshell-mode-syntax-table) 259 (modify-syntax-entry ?\" "\" " st)
262 (modify-syntax-entry ?\\ "/ " eshell-mode-syntax-table) 260 (modify-syntax-entry ?\\ "/ " st)
263 (modify-syntax-entry ?\( "() " eshell-mode-syntax-table) 261 (modify-syntax-entry ?\( "() " st)
264 (modify-syntax-entry ?\) ")( " eshell-mode-syntax-table) 262 (modify-syntax-entry ?\) ")( " st)
265 (modify-syntax-entry ?\{ "(} " eshell-mode-syntax-table) 263 (modify-syntax-entry ?\{ "(} " st)
266 (modify-syntax-entry ?\} "){ " eshell-mode-syntax-table) 264 (modify-syntax-entry ?\} "){ " st)
267 (modify-syntax-entry ?\[ "(] " eshell-mode-syntax-table) 265 (modify-syntax-entry ?\[ "(] " st)
268 (modify-syntax-entry ?\] ")[ " eshell-mode-syntax-table) 266 (modify-syntax-entry ?\] ")[ " st)
269 ;; All non-word multibyte characters should be `symbol'. 267 ;; All non-word multibyte characters should be `symbol'.
270 (if (featurep 'xemacs) 268 (map-char-table
271 (map-char-table 269 (if (featurep 'xemacs)
272 (function 270 (lambda (key _val)
273 (lambda (key val) 271 (and (characterp key)
274 (and (characterp key) 272 (>= (char-int key) 256)
275 (>= (char-int key) 256) 273 (/= (char-syntax key) ?w)
276 (/= (char-syntax key) ?w) 274 (modify-syntax-entry key "_ " st)))
277 (modify-syntax-entry key "_ " 275 (lambda (key _val)
278 eshell-mode-syntax-table)))) 276 (and (if (consp key)
279 (standard-syntax-table)) 277 (and (>= (car key) 128)
280 (map-char-table 278 (/= (char-syntax (car key)) ?w))
281 (function 279 (and (>= key 256)
282 (lambda (key val) 280 (/= (char-syntax key) ?w)))
283 (and (if (consp key) 281 (modify-syntax-entry key "_ " st))))
284 (and (>= (car key) 128) 282 (standard-syntax-table))
285 (/= (char-syntax (car key)) ?w)) 283 st))
286 (and (>= key 256)
287 (/= (char-syntax key) ?w)))
288 (modify-syntax-entry key "_ "
289 eshell-mode-syntax-table))))
290 (standard-syntax-table)))))
291 284
292;;; User Functions: 285;;; User Functions:
293 286
@@ -303,25 +296,18 @@ and the hook `eshell-exit-hook'."
303 (run-hooks 'eshell-exit-hook)) 296 (run-hooks 'eshell-exit-hook))
304 297
305;;;###autoload 298;;;###autoload
306(defun eshell-mode () 299(define-derived-mode eshell-mode fundamental-mode "EShell"
307 "Emacs shell interactive mode. 300 "Emacs shell interactive mode."
308 301 (setq-local eshell-mode t)
309\\{eshell-mode-map}"
310 (kill-all-local-variables)
311
312 (setq major-mode 'eshell-mode)
313 (setq mode-name "EShell")
314 (set (make-local-variable 'eshell-mode) t)
315 302
316 (make-local-variable 'eshell-mode-map) 303 ;; FIXME: What the hell!?
317 (setq eshell-mode-map (make-sparse-keymap)) 304 (setq-local eshell-mode-map (make-sparse-keymap))
318 (use-local-map eshell-mode-map) 305 (use-local-map eshell-mode-map)
319 306
320 (when eshell-status-in-mode-line 307 (when eshell-status-in-mode-line
321 (make-local-variable 'eshell-command-running-string) 308 (make-local-variable 'eshell-command-running-string)
322 (let ((fmt (copy-sequence mode-line-format))) 309 (let ((fmt (copy-sequence mode-line-format)))
323 (make-local-variable 'mode-line-format) 310 (setq-local mode-line-format fmt))
324 (setq mode-line-format fmt))
325 (let ((mode-line-elt (memq 'mode-line-modified mode-line-format))) 311 (let ((mode-line-elt (memq 'mode-line-modified mode-line-format)))
326 (if mode-line-elt 312 (if mode-line-elt
327 (setcar mode-line-elt 'eshell-command-running-string)))) 313 (setcar mode-line-elt 'eshell-command-running-string))))
@@ -331,11 +317,9 @@ and the hook `eshell-exit-hook'."
331 (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output) 317 (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output)
332 (define-key eshell-mode-map [(control ?a)] 'eshell-bol) 318 (define-key eshell-mode-map [(control ?a)] 'eshell-bol)
333 319
334 (set (make-local-variable 'eshell-command-prefix) 320 (setq-local eshell-command-prefix (make-symbol "eshell-command-prefix"))
335 (make-symbol "eshell-command-prefix"))
336 (fset eshell-command-prefix (make-sparse-keymap)) 321 (fset eshell-command-prefix (make-sparse-keymap))
337 (set (make-local-variable 'eshell-command-map) 322 (setq-local eshell-command-map (symbol-function eshell-command-prefix))
338 (symbol-function eshell-command-prefix))
339 (define-key eshell-mode-map [(control ?c)] eshell-command-prefix) 323 (define-key eshell-mode-map [(control ?c)] eshell-command-prefix)
340 324
341 ;; without this, find-tag complains about read-only text being 325 ;; without this, find-tag complains about read-only text being
@@ -359,7 +343,6 @@ and the hook `eshell-exit-hook'."
359 (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument) 343 (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument)
360 344
361 (setq local-abbrev-table eshell-mode-abbrev-table) 345 (setq local-abbrev-table eshell-mode-abbrev-table)
362 (set-syntax-table eshell-mode-syntax-table)
363 346
364 (set (make-local-variable 'dired-directory) default-directory) 347 (set (make-local-variable 'dired-directory) default-directory)
365 (set (make-local-variable 'list-buffers-directory) 348 (set (make-local-variable 'list-buffers-directory)
@@ -442,7 +425,6 @@ and the hook `eshell-exit-hook'."
442 425
443 (if eshell-first-time-p 426 (if eshell-first-time-p
444 (run-hooks 'eshell-first-time-mode-hook)) 427 (run-hooks 'eshell-first-time-mode-hook))
445 (run-mode-hooks 'eshell-mode-hook)
446 (run-hooks 'eshell-post-command-hook)) 428 (run-hooks 'eshell-post-command-hook))
447 429
448(put 'eshell-mode 'mode-class 'special) 430(put 'eshell-mode 'mode-class 'special)
@@ -470,8 +452,8 @@ and the hook `eshell-exit-hook'."
470 (add-hook 'pre-command-hook 'eshell-intercept-commands t t) 452 (add-hook 'pre-command-hook 'eshell-intercept-commands t t)
471 (message "Sending subprocess input directly"))) 453 (message "Sending subprocess input directly")))
472 454
473(defun eshell-self-insert-command (N) 455(defun eshell-self-insert-command ()
474 (interactive "i") 456 (interactive)
475 (process-send-string 457 (process-send-string
476 (eshell-interactive-process) 458 (eshell-interactive-process)
477 (char-to-string (if (symbolp last-command-event) 459 (char-to-string (if (symbolp last-command-event)
@@ -944,10 +926,10 @@ a key."
944(custom-add-option 'eshell-output-filter-functions 926(custom-add-option 'eshell-output-filter-functions
945 'eshell-truncate-buffer) 927 'eshell-truncate-buffer)
946 928
947(defun eshell-send-invisible (str) 929(defun eshell-send-invisible ()
948 "Read a string without echoing. 930 "Read a string without echoing.
949Then send it to the process running in the current buffer." 931Then send it to the process running in the current buffer."
950 (interactive "P") ; Defeat snooping via C-x ESC ESC 932 (interactive) ; Don't pass str as argument, to avoid snooping via C-x ESC ESC
951 (let ((str (read-passwd 933 (let ((str (read-passwd
952 (format "%s Password: " 934 (format "%s Password: "
953 (process-name (eshell-interactive-process)))))) 935 (process-name (eshell-interactive-process))))))
@@ -969,7 +951,7 @@ This function could be in the list `eshell-output-filter-functions'."
969 (beginning-of-line) 951 (beginning-of-line)
970 (if (re-search-forward eshell-password-prompt-regexp 952 (if (re-search-forward eshell-password-prompt-regexp
971 eshell-last-output-end t) 953 eshell-last-output-end t)
972 (eshell-send-invisible nil))))) 954 (eshell-send-invisible)))))
973 955
974(custom-add-option 'eshell-output-filter-functions 956(custom-add-option 'eshell-output-filter-functions
975 'eshell-watch-for-password-prompt) 957 'eshell-watch-for-password-prompt)
@@ -977,32 +959,30 @@ This function could be in the list `eshell-output-filter-functions'."
977(defun eshell-handle-control-codes () 959(defun eshell-handle-control-codes ()
978 "Act properly when certain control codes are seen." 960 "Act properly when certain control codes are seen."
979 (save-excursion 961 (save-excursion
980 (let ((orig (point))) 962 (goto-char eshell-last-output-block-begin)
981 (goto-char eshell-last-output-block-begin) 963 (unless (eolp)
982 (unless (eolp) 964 (beginning-of-line))
983 (beginning-of-line)) 965 (while (< (point) eshell-last-output-end)
984 (while (< (point) eshell-last-output-end) 966 (let ((char (char-after)))
985 (let ((char (char-after))) 967 (cond
986 (cond 968 ((eq char ?\r)
987 ((eq char ?\r) 969 (if (< (1+ (point)) eshell-last-output-end)
988 (if (< (1+ (point)) eshell-last-output-end) 970 (if (memq (char-after (1+ (point)))
989 (if (memq (char-after (1+ (point))) 971 '(?\n ?\r))
990 '(?\n ?\r)) 972 (delete-char 1)
991 (delete-char 1) 973 (let ((end (1+ (point))))
992 (let ((end (1+ (point)))) 974 (beginning-of-line)
993 (beginning-of-line) 975 (delete-region (point) end)))
994 (delete-region (point) end))) 976 (add-text-properties (point) (1+ (point))
995 (add-text-properties (point) (1+ (point)) 977 '(invisible t))
996 '(invisible t)) 978 (forward-char)))
997 (forward-char))) 979 ((eq char ?\a)
998 ((eq char ?\a) 980 (delete-char 1)
999 (delete-char 1) 981 (beep))
1000 (beep)) 982 ((eq char ?\C-h)
1001 ((eq char ?\C-h) 983 (delete-region (1- (point)) (1+ (point))))
1002 (delete-backward-char 1) 984 (t
1003 (delete-char 1)) 985 (forward-char)))))))
1004 (t
1005 (forward-char))))))))
1006 986
1007(custom-add-option 'eshell-output-filter-functions 987(custom-add-option 'eshell-output-filter-functions
1008 'eshell-handle-control-codes) 988 'eshell-handle-control-codes)
diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el
index 33625433022..c62cbc7e1dc 100644
--- a/lisp/eshell/esh-opt.el
+++ b/lisp/eshell/esh-opt.el
@@ -28,11 +28,11 @@
28(require 'esh-ext) 28(require 'esh-ext)
29 29
30;; Unused. 30;; Unused.
31;;; (defgroup eshell-opt nil 31;; (defgroup eshell-opt nil
32;;; "The options processing code handles command argument parsing for 32;; "The options processing code handles command argument parsing for
33;;; Eshell commands implemented in Lisp." 33;; Eshell commands implemented in Lisp."
34;;; :tag "Command options processing" 34;; :tag "Command options processing"
35;;; :group 'eshell) 35;; :group 'eshell)
36 36
37;;; User Functions: 37;;; User Functions:
38 38
@@ -103,32 +103,25 @@ interned variable `args' (created using a `let' form)."
103 macro-args 103 macro-args
104 (list 'eshell-stringify-list 104 (list 'eshell-stringify-list
105 (list 'eshell-flatten-list macro-args))))) 105 (list 'eshell-flatten-list macro-args)))))
106 (let ,(append (delq nil (mapcar (lambda (opt) 106 (let ,(delq nil (mapcar (lambda (opt)
107 (and (listp opt) (nth 3 opt))) 107 (and (listp opt) (nth 3 opt)))
108 (cadr options))) 108 (cadr options)))
109 '(usage-msg last-value ext-command args))
110 ;; FIXME: `options' ends up hiding some variable names under `quote', 109 ;; FIXME: `options' ends up hiding some variable names under `quote',
111 ;; which is incompatible with lexical scoping!! 110 ;; which is incompatible with lexical scoping!!
112 (eshell-do-opt ,name ,options (lambda () ,@body-forms))))) 111 (eshell-do-opt ,name ,options (lambda (args) ,@body-forms) temp-args))))
113 112
114;;; Internal Functions: 113;;; Internal Functions:
115 114
116(defvar temp-args)
117(defvar last-value)
118(defvar usage-msg)
119(defvar ext-command)
120;; Documented part of the interface; see eshell-eval-using-options. 115;; Documented part of the interface; see eshell-eval-using-options.
121(defvar args) 116(defvar eshell--args)
122 117
123(defun eshell-do-opt (name options body-fun) 118(defun eshell-do-opt (name options body-fun args)
124 "Helper function for `eshell-eval-using-options'. 119 "Helper function for `eshell-eval-using-options'.
125This code doesn't really need to be macro expanded everywhere." 120This code doesn't really need to be macro expanded everywhere."
126 (setq args temp-args) 121 (let* (last-value
127 (if (setq 122 (ext-command
128 ext-command
129 (catch 'eshell-ext-command 123 (catch 'eshell-ext-command
130 (when (setq 124 (let ((usage-msg
131 usage-msg
132 (catch 'eshell-usage 125 (catch 'eshell-usage
133 (setq last-value nil) 126 (setq last-value nil)
134 (if (and (= (length args) 0) 127 (if (and (= (length args) 0)
@@ -136,12 +129,14 @@ This code doesn't really need to be macro expanded everywhere."
136 (throw 'eshell-usage 129 (throw 'eshell-usage
137 (eshell-show-usage name options))) 130 (eshell-show-usage name options)))
138 (setq args (eshell-process-args name args options) 131 (setq args (eshell-process-args name args options)
139 last-value (funcall body-fun)) 132 last-value (funcall body-fun args))
140 nil)) 133 nil)))
141 (error "%s" usage-msg)))) 134 (when usage-msg
135 (error "%s" usage-msg))))))
136 (if ext-command
142 (throw 'eshell-external 137 (throw 'eshell-external
143 (eshell-external-command ext-command args)) 138 (eshell-external-command ext-command args))
144 last-value)) 139 last-value)))
145 140
146(defun eshell-show-usage (name options) 141(defun eshell-show-usage (name options)
147 "Display the usage message for NAME, using OPTIONS." 142 "Display the usage message for NAME, using OPTIONS."
@@ -197,12 +192,13 @@ will be modified."
197 (if (not (nth 3 opt)) 192 (if (not (nth 3 opt))
198 (eshell-show-usage name options) 193 (eshell-show-usage name options)
199 (if (eq (nth 2 opt) t) 194 (if (eq (nth 2 opt) t)
200 (if (> ai (length args)) 195 (if (> ai (length eshell--args))
201 (error "%s: missing option argument" name) 196 (error "%s: missing option argument" name)
202 (set (nth 3 opt) (nth ai args)) 197 (set (nth 3 opt) (nth ai eshell--args))
203 (if (> ai 0) 198 (if (> ai 0)
204 (setcdr (nthcdr (1- ai) args) (nthcdr (1+ ai) args)) 199 (setcdr (nthcdr (1- ai) eshell--args)
205 (setq args (cdr args)))) 200 (nthcdr (1+ ai) eshell--args))
201 (setq eshell--args (cdr eshell--args))))
206 (set (nth 3 opt) (or (nth 2 opt) t))))) 202 (set (nth 3 opt) (or (nth 2 opt) t)))))
207 203
208(defun eshell-process-option (name switch kind ai options) 204(defun eshell-process-option (name switch kind ai options)
@@ -232,14 +228,15 @@ switch is unrecognized."
232 (setq extcmd (eshell-search-path (cadr extcmd))) 228 (setq extcmd (eshell-search-path (cadr extcmd)))
233 (if extcmd 229 (if extcmd
234 (throw 'eshell-ext-command extcmd) 230 (throw 'eshell-ext-command extcmd)
235 (if (characterp switch) 231 (error (if (characterp switch) "%s: unrecognized option -%c"
236 (error "%s: unrecognized option -%c" name switch) 232 "%s: unrecognized option --%s")
237 (error "%s: unrecognized option --%s" name switch)))))))) 233 name switch)))))))
238 234
239(defun eshell-process-args (name args options) 235(defun eshell-process-args (name args options)
240 "Process the given ARGS using OPTIONS. 236 "Process the given ARGS using OPTIONS.
241This assumes that symbols have been intern'd by `eshell-eval-using-options'." 237This assumes that symbols have been intern'd by `eshell-eval-using-options'."
242 (let ((ai 0) arg) 238 (let ((ai 0) arg
239 (eshell--args args))
243 (while (< ai (length args)) 240 (while (< ai (length args))
244 (setq arg (nth ai args)) 241 (setq arg (nth ai args))
245 (if (not (and (stringp arg) 242 (if (not (and (stringp arg)
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index dd344eb50a2..968d1ebad79 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -23,6 +23,8 @@
23 23
24;;; Code: 24;;; Code:
25 25
26(eval-when-compile (require 'cl-lib))
27
26(defgroup eshell-util nil 28(defgroup eshell-util nil
27 "This is general utility code, meant for use by Eshell itself." 29 "This is general utility code, meant for use by Eshell itself."
28 :tag "General utilities" 30 :tag "General utilities"
@@ -484,12 +486,12 @@ list."
484 (while (re-search-forward 486 (while (re-search-forward
485 "^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t) 487 "^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t)
486 (if (match-string 1) 488 (if (match-string 1)
487 (add-to-list 'hosts (match-string 1))) 489 (cl-pushnew (match-string 1) hosts :test #'equal))
488 (if (match-string 2) 490 (if (match-string 2)
489 (add-to-list 'hosts (match-string 2))) 491 (cl-pushnew (match-string 2) hosts :test #'equal))
490 (if (match-string 4) 492 (if (match-string 4)
491 (add-to-list 'hosts (match-string 4))))) 493 (cl-pushnew (match-string 4) hosts :test #'equal))))
492 (sort hosts 'string-lessp))) 494 (sort hosts #'string-lessp)))
493 495
494(defun eshell-read-hosts (file result-var timestamp-var) 496(defun eshell-read-hosts (file result-var timestamp-var)
495 "Read the contents of /etc/passwd for user names." 497 "Read the contents of /etc/passwd for user names."
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index 188b8165248..75c36a68544 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -395,12 +395,9 @@ process any indices that come after the variable reference."
395 indices (and (not (eobp)) 395 indices (and (not (eobp))
396 (eq (char-after) ?\[) 396 (eq (char-after) ?\[)
397 (eshell-parse-indices)) 397 (eshell-parse-indices))
398 value (list 'let 398 value `(let ((indices ',indices)) ,value))
399 (list (list 'indices
400 (list 'quote indices)))
401 value))
402 (if get-len 399 (if get-len
403 (list 'length value) 400 `(length ,value)
404 value))) 401 value)))
405 402
406(defun eshell-parse-variable-ref () 403(defun eshell-parse-variable-ref ()
@@ -414,67 +411,68 @@ Possible options are:
414 <LONG-NAME> disambiguates the length of the name 411 <LONG-NAME> disambiguates the length of the name
415 {COMMAND} result of command is variable's value 412 {COMMAND} result of command is variable's value
416 (LISP-FORM) result of Lisp form is variable's value" 413 (LISP-FORM) result of Lisp form is variable's value"
417 (let (end) 414 (cond
418 (cond 415 ((eq (char-after) ?{)
419 ((eq (char-after) ?{) 416 (let ((end (eshell-find-delimiter ?\{ ?\})))
420 (let ((end (eshell-find-delimiter ?\{ ?\}))) 417 (if (not end)
421 (if (not end) 418 (throw 'eshell-incomplete ?\{)
422 (throw 'eshell-incomplete ?\{) 419 (prog1
423 (prog1 420 (list 'eshell-convert
424 (list 'eshell-convert 421 (list 'eshell-command-to-value
425 (list 'eshell-command-to-value 422 (list 'eshell-as-subcommand
426 (list 'eshell-as-subcommand 423 (eshell-parse-command
427 (eshell-parse-command 424 (cons (1+ (point)) end)))))
428 (cons (1+ (point)) end))))) 425 (goto-char (1+ end))))))
429 (goto-char (1+ end)))))) 426 ((memq (char-after) '(?\' ?\"))
430 ((memq (char-after) '(?\' ?\")) 427 (let ((name (if (eq (char-after) ?\')
431 (let ((name (if (eq (char-after) ?\') 428 (eshell-parse-literal-quote)
432 (eshell-parse-literal-quote) 429 (eshell-parse-double-quote))))
433 (eshell-parse-double-quote)))) 430 (if name
434 (if name
435 (list 'eshell-get-variable (eval name) 'indices)))) 431 (list 'eshell-get-variable (eval name) 'indices))))
436 ((eq (char-after) ?\<) 432 ((eq (char-after) ?\<)
437 (let ((end (eshell-find-delimiter ?\< ?\>))) 433 (let ((end (eshell-find-delimiter ?\< ?\>)))
438 (if (not end) 434 (if (not end)
439 (throw 'eshell-incomplete ?\<) 435 (throw 'eshell-incomplete ?\<)
440 (let* ((temp (make-temp-file temporary-file-directory)) 436 (let* ((temp (make-temp-file temporary-file-directory))
441 (cmd (concat (buffer-substring (1+ (point)) end) 437 (cmd (concat (buffer-substring (1+ (point)) end)
442 " > " temp))) 438 " > " temp)))
443 (prog1 439 (prog1
444 (list 440 (list
445 'let (list (list 'eshell-current-handles 441 'let (list (list 'eshell-current-handles
446 (list 'eshell-create-handles temp 442 (list 'eshell-create-handles temp
447 (list 'quote 'overwrite)))) 443 (list 'quote 'overwrite))))
448 (list 444 (list
449 'progn 445 'progn
450 (list 'eshell-as-subcommand 446 (list 'eshell-as-subcommand
451 (eshell-parse-command cmd)) 447 (eshell-parse-command cmd))
452 (list 'ignore 448 (list 'ignore
453 (list 'nconc 'eshell-this-command-hook 449 (list 'nconc 'eshell-this-command-hook
454 (list 'list 450 (list 'list
455 (list 'function 451 (list 'function
456 (list 'lambda nil 452 (list 'lambda nil
457 (list 'delete-file temp)))))) 453 (list 'delete-file temp))))))
458 (list 'quote temp))) 454 (list 'quote temp)))
459 (goto-char (1+ end))))))) 455 (goto-char (1+ end)))))))
460 ((eq (char-after) ?\() 456 ((eq (char-after) ?\()
461 (condition-case err 457 (condition-case nil
462 (list 'eshell-command-to-value 458 (list 'eshell-command-to-value
463 (list 'eshell-lisp-command 459 (list 'eshell-lisp-command
464 (list 'quote (read (current-buffer))))) 460 (list 'quote (read (current-buffer)))))
465 (end-of-file 461 (end-of-file
466 (throw 'eshell-incomplete ?\()))) 462 (throw 'eshell-incomplete ?\())))
467 ((assoc (char-to-string (char-after)) 463 ((assoc (char-to-string (char-after))
468 eshell-variable-aliases-list) 464 eshell-variable-aliases-list)
469 (forward-char) 465 (forward-char)
470 (list 'eshell-get-variable 466 (list 'eshell-get-variable
471 (char-to-string (char-before)) 'indices)) 467 (char-to-string (char-before)) 'indices))
472 ((looking-at eshell-variable-name-regexp) 468 ((looking-at eshell-variable-name-regexp)
473 (prog1 469 (prog1
474 (list 'eshell-get-variable (match-string 0) 'indices) 470 (list 'eshell-get-variable (match-string 0) 'indices)
475 (goto-char (match-end 0)))) 471 (goto-char (match-end 0))))
476 (t 472 (t
477 (error "Invalid variable reference"))))) 473 (error "Invalid variable reference"))))
474
475(defvar eshell-glob-function)
478 476
479(defun eshell-parse-indices () 477(defun eshell-parse-indices ()
480 "Parse and return a list of list of indices." 478 "Parse and return a list of list of indices."
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index 9bdf8b3eb68..e3f8f0d11bc 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -300,7 +300,7 @@ buffer selected (or created)."
300 (get-buffer-create eshell-buffer-name))))) 300 (get-buffer-create eshell-buffer-name)))))
301 (cl-assert (and buf (buffer-live-p buf))) 301 (cl-assert (and buf (buffer-live-p buf)))
302 (pop-to-buffer-same-window buf) 302 (pop-to-buffer-same-window buf)
303 (unless (eq major-mode 'eshell-mode) 303 (unless (derived-mode-p 'eshell-mode)
304 (eshell-mode)) 304 (eshell-mode))
305 buf)) 305 buf))
306 306
diff --git a/lisp/files.el b/lisp/files.el
index f9ff3c936bd..ca55c646699 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2447,35 +2447,20 @@ and `magic-mode-alist', which determines modes based on file contents.")
2447 (mapcar 2447 (mapcar
2448 (lambda (l) 2448 (lambda (l)
2449 (cons (purecopy (car l)) (cdr l))) 2449 (cons (purecopy (car l)) (cdr l)))
2450 '(("perl" . perl-mode) 2450 '(("\\(mini\\)?perl5?" . perl-mode)
2451 ("perl5" . perl-mode) 2451 ("wishx?" . tcl-mode)
2452 ("miniperl" . perl-mode) 2452 ("tcl\\(sh\\)?" . tcl-mode)
2453 ("wish" . tcl-mode)
2454 ("wishx" . tcl-mode)
2455 ("tcl" . tcl-mode)
2456 ("tclsh" . tcl-mode)
2457 ("expect" . tcl-mode) 2453 ("expect" . tcl-mode)
2458 ("scm" . scheme-mode) 2454 ("scm" . scheme-mode)
2459 ("ash" . sh-mode) 2455 ("[acjkwz]sh" . sh-mode)
2460 ("bash" . sh-mode) 2456 ("r?bash2?" . sh-mode)
2461 ("bash2" . sh-mode) 2457 ("\\(dt\\|pd\\|w\\)ksh" . sh-mode)
2462 ("csh" . sh-mode)
2463 ("dtksh" . sh-mode)
2464 ("es" . sh-mode) 2458 ("es" . sh-mode)
2465 ("itcsh" . sh-mode) 2459 ("i?tcsh" . sh-mode)
2466 ("jsh" . sh-mode)
2467 ("ksh" . sh-mode)
2468 ("oash" . sh-mode) 2460 ("oash" . sh-mode)
2469 ("pdksh" . sh-mode)
2470 ("rbash" . sh-mode)
2471 ("rc" . sh-mode) 2461 ("rc" . sh-mode)
2472 ("rpm" . sh-mode) 2462 ("rpm" . sh-mode)
2473 ("sh" . sh-mode) 2463 ("sh5?" . sh-mode)
2474 ("sh5" . sh-mode)
2475 ("tcsh" . sh-mode)
2476 ("wksh" . sh-mode)
2477 ("wsh" . sh-mode)
2478 ("zsh" . sh-mode)
2479 ("tail" . text-mode) 2464 ("tail" . text-mode)
2480 ("more" . text-mode) 2465 ("more" . text-mode)
2481 ("less" . text-mode) 2466 ("less" . text-mode)
@@ -2486,9 +2471,10 @@ and `magic-mode-alist', which determines modes based on file contents.")
2486 ("emacs" . emacs-lisp-mode))) 2471 ("emacs" . emacs-lisp-mode)))
2487 "Alist mapping interpreter names to major modes. 2472 "Alist mapping interpreter names to major modes.
2488This is used for files whose first lines match `auto-mode-interpreter-regexp'. 2473This is used for files whose first lines match `auto-mode-interpreter-regexp'.
2489Each element looks like (INTERPRETER . MODE). 2474Each element looks like (REGEXP . MODE).
2490If INTERPRETER matches the name of the interpreter specified in the first line 2475If \\\\`REGEXP\\\\' matches the name (minus any directory part) of
2491of a script, mode MODE is enabled. 2476the interpreter specified in the first line of a script, enable
2477major mode MODE.
2492 2478
2493See also `auto-mode-alist'.") 2479See also `auto-mode-alist'.")
2494 2480
@@ -2683,19 +2669,23 @@ we don't actually set it to the same mode the buffer already has."
2683 ;; If we didn't, look for an interpreter specified in the first line. 2669 ;; If we didn't, look for an interpreter specified in the first line.
2684 ;; As a special case, allow for things like "#!/bin/env perl", which 2670 ;; As a special case, allow for things like "#!/bin/env perl", which
2685 ;; finds the interpreter anywhere in $PATH. 2671 ;; finds the interpreter anywhere in $PATH.
2686 (unless done 2672 (and (not done)
2687 (setq mode (save-excursion 2673 (setq mode (save-excursion
2688 (goto-char (point-min)) 2674 (goto-char (point-min))
2689 (if (looking-at auto-mode-interpreter-regexp) 2675 (if (looking-at auto-mode-interpreter-regexp)
2690 (match-string 2) 2676 (match-string 2))))
2691 "")) 2677 ;; Map interpreter name to a mode, signaling we're done at the
2692 ;; Map interpreter name to a mode, signaling we're done at the 2678 ;; same time.
2693 ;; same time. 2679 (setq done (assoc-default
2694 done (assoc (file-name-nondirectory mode) 2680 (file-name-nondirectory mode)
2695 interpreter-mode-alist)) 2681 (mapcar (lambda (e)
2696 ;; If we found an interpreter mode to use, invoke it now. 2682 (cons
2697 (if done 2683 (format "\\`%s\\'" (car e))
2698 (set-auto-mode-0 (cdr done) keep-mode-if-same))) 2684 (cdr e)))
2685 interpreter-mode-alist)
2686 #'string-match-p))
2687 ;; If we found an interpreter mode to use, invoke it now.
2688 (set-auto-mode-0 done keep-mode-if-same))
2699 ;; Next try matching the buffer beginning against magic-mode-alist. 2689 ;; Next try matching the buffer beginning against magic-mode-alist.
2700 (unless done 2690 (unless done
2701 (if (setq done (save-excursion 2691 (if (setq done (save-excursion
@@ -3647,21 +3637,17 @@ FILE is the name of the file holding the variables to apply.
3647The new class name is the same as the directory in which FILE 3637The new class name is the same as the directory in which FILE
3648is found. Returns the new class name." 3638is found. Returns the new class name."
3649 (with-temp-buffer 3639 (with-temp-buffer
3650 ;; This is with-demoted-errors, but we want to mention dir-locals 3640 (with-demoted-errors "Error reading dir-locals: %S"
3651 ;; in any error message. 3641 (insert-file-contents file)
3652 (condition-case err 3642 (unless (zerop (buffer-size))
3653 (progn 3643 (let* ((dir-name (file-name-directory file))
3654 (insert-file-contents file) 3644 (class-name (intern dir-name))
3655 (unless (zerop (buffer-size)) 3645 (variables (let ((read-circle nil))
3656 (let* ((dir-name (file-name-directory file)) 3646 (read (current-buffer)))))
3657 (class-name (intern dir-name)) 3647 (dir-locals-set-class-variables class-name variables)
3658 (variables (let ((read-circle nil)) 3648 (dir-locals-set-directory-class dir-name class-name
3659 (read (current-buffer))))) 3649 (nth 5 (file-attributes file)))
3660 (dir-locals-set-class-variables class-name variables) 3650 class-name)))))
3661 (dir-locals-set-directory-class dir-name class-name
3662 (nth 5 (file-attributes file)))
3663 class-name)))
3664 (error (message "Error reading dir-locals: %S" err) nil))))
3665 3651
3666(defcustom enable-remote-dir-locals nil 3652(defcustom enable-remote-dir-locals nil
3667 "Non-nil means dir-local variables will be applied to remote files." 3653 "Non-nil means dir-local variables will be applied to remote files."
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index c75588536a4..2eea1fb833e 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,34 @@
12013-09-12 Glenn Morris <rgm@gnu.org>
2
3 * gnus-icalendar.el (gnus-icalendar-event--build-reply-event-body):
4 Avoid using `find', which i) might not be defined at runtime;
5 ii) does not work, since its default test is eql, not equal.
6 (gnus-mime-action-alist): Declare.
7
82013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
9
10 * score-mode.el (gnus-score-mode-map): Move initialization
11 into declaration.
12 (gnus-score-mode): Use define-derived-mode.
13 * gnus-srvr.el (gnus-browse-mode): Use define-derived-mode.
14 * gnus-kill.el (gnus-kill-file-mode-map): Move initialization
15 into declaration.
16 (gnus-kill-file-mode): Use define-derived-mode.
17 (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill):
18 Use derived-mode-p.
19 * gnus-group.el (gnus-group-mode): Use define-derived-mode.
20 (gnus-group-setup-buffer, gnus-group-name-at-point)
21 (gnus-group-make-web-group, gnus-group-enter-directory)
22 (gnus-group-suspend): Use derived-mode-p.
23 * gnus-cus.el (gnus-custom-mode): Use define-derived-mode.
24 * gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode.
25 * gnus-art.el (gnus-article-mode): Use define-derived-mode.
26 (gnus-article-setup-buffer, gnus-article-prepare)
27 (gnus-article-prepare-display, gnus-sticky-article)
28 (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers)
29 (gnus-bind-safe-url-regexp, gnus-article-check-buffer)
30 (gnus-article-read-summary-keys): Use derived-mode-p.
31
12013-08-28 Katsumi Yamaoka <yamaoka@jpl.org> 322013-08-28 Katsumi Yamaoka <yamaoka@jpl.org>
2 33
3 * mm-decode.el (mm-temp-files-delete): Fix file deletion logic. 34 * mm-decode.el (mm-temp-files-delete): Fix file deletion logic.
@@ -177,15 +208,15 @@
1772013-07-10 David Engster <deng@randomsample.de> 2082013-07-10 David Engster <deng@randomsample.de>
178 209
179 * gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks 210 * gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks
180 if `gnus-newsrc-file-version' does not match `gnus-version'. This 211 if `gnus-newsrc-file-version' does not match `gnus-version'.
181 fixes a bug in Emacs trunk where the 'unexist' marks were always 212 This fixes a bug in Emacs trunk where the 'unexist' marks were always
182 removed at startup because "Gnus v5.13" was considered smaller than "Ma 213 removed at startup because "Gnus v5.13" was considered smaller than "Ma
183 Gnus v0.03". 214 Gnus v0.03".
184 215
1852013-07-10 Tassilo Horn <tsdh@gnu.org> 2162013-07-10 Tassilo Horn <tsdh@gnu.org>
186 217
187 * gnus.el (gnus-summary-line-format): Reference 218 * gnus.el (gnus-summary-line-format):
188 `gnus-user-date-format-alist' for the &user-date; format, not 219 Reference `gnus-user-date-format-alist' for the &user-date; format, not
189 `gnus-summary-user-date-format-alist'. 220 `gnus-summary-user-date-format-alist'.
190 221
1912013-07-08 Lars Magne Ingebrigtsen <larsi@gnus.org> 2222013-07-08 Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -467,7 +498,7 @@
467 498
468 * shr.el (shr-render-td): Support horizontal alignment. 499 * shr.el (shr-render-td): Support horizontal alignment.
469 500
470 * eww.el (eww-put-color): Removed. 501 * eww.el (eww-put-color): Remove.
471 (eww-colorize-region): Use `add-face-text-property'. 502 (eww-colorize-region): Use `add-face-text-property'.
472 503
473 * shr.el (shr-add-font): Append face data, so that we get the correct 504 * shr.el (shr-add-font): Append face data, so that we get the correct
@@ -522,7 +553,7 @@
522 553
5232013-06-16 Rüdiger Sonderfeld <ruediger@c-plusplus.de> 5542013-06-16 Rüdiger Sonderfeld <ruediger@c-plusplus.de>
524 555
525 * shr.el (shr-dom-to-xml): Fixed function call. 556 * shr.el (shr-dom-to-xml): Fix function call.
526 557
527 * eww.el (eww): New group. 558 * eww.el (eww): New group.
528 (eww-header-line-format): New custom variable. 559 (eww-header-line-format): New custom variable.
@@ -558,8 +589,8 @@
558 (auth-source-netrc-parse): Refactor and improve netrc parser to support 589 (auth-source-netrc-parse): Refactor and improve netrc parser to support
559 single-quoted strings and multiline entries. 590 single-quoted strings and multiline entries.
560 (auth-source-netrc-parse-next-interesting) 591 (auth-source-netrc-parse-next-interesting)
561 (auth-source-netrc-parse-one, auth-source-netrc-parse-entries): New 592 (auth-source-netrc-parse-one, auth-source-netrc-parse-entries):
562 functions to support parser. 593 New functions to support parser.
563 594
5642013-06-14 Lars Magne Ingebrigtsen <larsi@gnus.org> 5952013-06-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
565 596
@@ -707,8 +738,8 @@
707 * registry.el (initialize-instance, registry-lookup) 738 * registry.el (initialize-instance, registry-lookup)
708 (registry-lookup-breaks-before-lexbind, registry-lookup-secondary) 739 (registry-lookup-breaks-before-lexbind, registry-lookup-secondary)
709 (registry-lookup-secondary-value, registry-search, registry-delete) 740 (registry-lookup-secondary-value, registry-search, registry-delete)
710 (registry-insert, registry-reindex, registry-size, registry-prune): Do 741 (registry-insert, registry-reindex, registry-size, registry-prune):
711 not wrap methods in `eval-and-compile'. This breaks due to latest 742 Do not wrap methods in `eval-and-compile'. This breaks due to latest
712 changes in EIEIO (introduction of eieio-core.el). 743 changes in EIEIO (introduction of eieio-core.el).
713 744
7142013-05-30 Glenn Morris <rgm@gnu.org> 7452013-05-30 Glenn Morris <rgm@gnu.org>
@@ -988,8 +1019,8 @@
9882013-03-26 Andrew Cohen <cohen@bu.edu> 10192013-03-26 Andrew Cohen <cohen@bu.edu>
989 1020
990 * nnir.el: Major rewrite. Cleaner separation between searches and group 1021 * nnir.el: Major rewrite. Cleaner separation between searches and group
991 management. Marks are now shown in nnir summary buffers. Rudimentary 1022 management. Marks are now shown in nnir summary buffers.
992 support for real (i.e. not ephemeral) nnir groups. 1023 Rudimentary support for real (i.e. not ephemeral) nnir groups.
993 (gnus-summary-make-nnir-group): New function for initiating searches 1024 (gnus-summary-make-nnir-group): New function for initiating searches
994 from a summary buffer. 1025 from a summary buffer.
995 1026
@@ -1018,8 +1049,8 @@
10182013-02-22 David Engster <deng@randomsample.de> 10492013-02-22 David Engster <deng@randomsample.de>
1019 1050
1020 * gnus-registry.el (gnus-registry-save): Provide class name when 1051 * gnus-registry.el (gnus-registry-save): Provide class name when
1021 calling `eieio-persistent-read' to avoid "unsafe call" warning. Use 1052 calling `eieio-persistent-read' to avoid "unsafe call" warning.
1022 `condition-case' to stay compatible with older EIEIO versions which 1053 Use `condition-case' to stay compatible with older EIEIO versions which
1023 only accept one argument. 1054 only accept one argument.
1024 1055
10252013-02-17 Daiki Ueno <ueno@gnu.org> 10562013-02-17 Daiki Ueno <ueno@gnu.org>
@@ -5295,7 +5326,7 @@
5295 a creation default, pass the whole port list down. It will be 5326 a creation default, pass the whole port list down. It will be
5296 completed. 5327 completed.
5297 5328
5298 * auth-source.el (auth-source-search): Updated docs to talk about 5329 * auth-source.el (auth-source-search): Update docs to talk about
5299 multiple creation choices. 5330 multiple creation choices.
5300 (auth-source-netrc-create): Accept a list as a value (from the search 5331 (auth-source-netrc-create): Accept a list as a value (from the search
5301 parameters) and do completion on that list. Keep a separate netrc line 5332 parameters) and do completion on that list. Keep a separate netrc line
@@ -5362,7 +5393,7 @@
5362 (gnus-summary-exit): Kill the correct article buffer on exit from a 5393 (gnus-summary-exit): Kill the correct article buffer on exit from a
5363 `C-d' group. 5394 `C-d' group.
5364 5395
5365 * gnus-start.el (gnus-use-backend-marks): Removed, since it duplicates 5396 * gnus-start.el (gnus-use-backend-marks): Remove, since it duplicates
5366 gnus-propagate-marks. 5397 gnus-propagate-marks.
5367 5398
5368 * gnus-sum.el (gnus-summary-exit-no-update): Restore the group conf 5399 * gnus-sum.el (gnus-summary-exit-no-update): Restore the group conf
@@ -18399,7 +18430,7 @@
18399 18430
184002005-11-19 Kevin Greiner <kevin.greiner@compsol.cc> 184312005-11-19 Kevin Greiner <kevin.greiner@compsol.cc>
18401 18432
18402 * gnus-sum.el (gnus-fetch-old-headers): Updated docs to warn that 18433 * gnus-sum.el (gnus-fetch-old-headers): Update docs to warn that
18403 it can seriously impact performance as it bypasses the agent's 18434 it can seriously impact performance as it bypasses the agent's
18404 local caches. 18435 local caches.
18405 18436
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index e65b9fb99e4..b80aa3a24e9 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -3683,7 +3683,7 @@ function and want to see what the date was before converting."
3683 (walk-windows 3683 (walk-windows
3684 (lambda (w) 3684 (lambda (w)
3685 (set-buffer (window-buffer w)) 3685 (set-buffer (window-buffer w))
3686 (when (eq major-mode 'gnus-article-mode) 3686 (when (derived-mode-p 'gnus-article-mode)
3687 (let ((old-line (count-lines (point-min) (point))) 3687 (let ((old-line (count-lines (point-min) (point)))
3688 (old-column (- (point) (line-beginning-position))) 3688 (old-column (- (point) (line-beginning-position)))
3689 (window-start (window-start w)) 3689 (window-start (window-start w))
@@ -4455,7 +4455,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is
4455(defvar bookmark-make-record-function) 4455(defvar bookmark-make-record-function)
4456(defvar shr-put-image-function) 4456(defvar shr-put-image-function)
4457 4457
4458(defun gnus-article-mode () 4458(define-derived-mode gnus-article-mode fundamental-mode "Article"
4459 "Major mode for displaying an article. 4459 "Major mode for displaying an article.
4460 4460
4461All normal editing commands are switched off. 4461All normal editing commands are switched off.
@@ -4470,13 +4470,8 @@ commands:
4470\\[gnus-article-mail]\t Send a reply to the address near point 4470\\[gnus-article-mail]\t Send a reply to the address near point
4471\\[gnus-article-describe-briefly]\t Describe the current mode briefly 4471\\[gnus-article-describe-briefly]\t Describe the current mode briefly
4472\\[gnus-info-find-node]\t Go to the Gnus info node" 4472\\[gnus-info-find-node]\t Go to the Gnus info node"
4473 (interactive)
4474 (kill-all-local-variables)
4475 (gnus-simplify-mode-line) 4473 (gnus-simplify-mode-line)
4476 (setq mode-name "Article")
4477 (setq major-mode 'gnus-article-mode)
4478 (make-local-variable 'minor-mode-alist) 4474 (make-local-variable 'minor-mode-alist)
4479 (use-local-map gnus-article-mode-map)
4480 (when (gnus-visual-p 'article-menu 'menu) 4475 (when (gnus-visual-p 'article-menu 'menu)
4481 (gnus-article-make-menu-bar) 4476 (gnus-article-make-menu-bar)
4482 (when gnus-summary-tool-bar-map 4477 (when gnus-summary-tool-bar-map
@@ -4504,9 +4499,7 @@ commands:
4504 (buffer-disable-undo) 4499 (buffer-disable-undo)
4505 (setq buffer-read-only t 4500 (setq buffer-read-only t
4506 show-trailing-whitespace nil) 4501 show-trailing-whitespace nil)
4507 (set-syntax-table gnus-article-mode-syntax-table) 4502 (mm-enable-multibyte))
4508 (mm-enable-multibyte)
4509 (gnus-run-mode-hooks 'gnus-article-mode-hook))
4510 4503
4511(defun gnus-article-setup-buffer () 4504(defun gnus-article-setup-buffer ()
4512 "Initialize the article buffer." 4505 "Initialize the article buffer."
@@ -4554,7 +4547,7 @@ commands:
4554 (setq gnus-article-mime-handle-alist nil) 4547 (setq gnus-article-mime-handle-alist nil)
4555 (buffer-disable-undo) 4548 (buffer-disable-undo)
4556 (setq buffer-read-only t) 4549 (setq buffer-read-only t)
4557 (unless (eq major-mode 'gnus-article-mode) 4550 (unless (derived-mode-p 'gnus-article-mode)
4558 (gnus-article-mode)) 4551 (gnus-article-mode))
4559 (setq truncate-lines gnus-article-truncate-lines) 4552 (setq truncate-lines gnus-article-truncate-lines)
4560 (current-buffer)) 4553 (current-buffer))
@@ -4603,7 +4596,7 @@ If ARTICLE is an id, HEADER should be the article headers.
4603If ALL-HEADERS is non-nil, no headers are hidden." 4596If ALL-HEADERS is non-nil, no headers are hidden."
4604 (save-excursion 4597 (save-excursion
4605 ;; Make sure we start in a summary buffer. 4598 ;; Make sure we start in a summary buffer.
4606 (unless (eq major-mode 'gnus-summary-mode) 4599 (unless (derived-mode-p 'gnus-summary-mode)
4607 (set-buffer gnus-summary-buffer)) 4600 (set-buffer gnus-summary-buffer))
4608 (setq gnus-summary-buffer (current-buffer)) 4601 (setq gnus-summary-buffer (current-buffer))
4609 (let* ((gnus-article (if header (mail-header-number header) article)) 4602 (let* ((gnus-article (if header (mail-header-number header) article))
@@ -4714,7 +4707,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
4714 (let ((gnus-article-buffer (current-buffer)) 4707 (let ((gnus-article-buffer (current-buffer))
4715 buffer-read-only 4708 buffer-read-only
4716 (inhibit-read-only t)) 4709 (inhibit-read-only t))
4717 (unless (eq major-mode 'gnus-article-mode) 4710 (unless (derived-mode-p 'gnus-article-mode)
4718 (gnus-article-mode)) 4711 (gnus-article-mode))
4719 (setq buffer-read-only nil 4712 (setq buffer-read-only nil
4720 gnus-article-wash-types nil 4713 gnus-article-wash-types nil
@@ -4776,7 +4769,7 @@ If a prefix ARG is given, ask for a name for this sticky article buffer."
4776 "*")) 4769 "*"))
4777 (if (and (gnus-buffer-live-p new-art-buf-name) 4770 (if (and (gnus-buffer-live-p new-art-buf-name)
4778 (with-current-buffer new-art-buf-name 4771 (with-current-buffer new-art-buf-name
4779 (eq major-mode 'gnus-sticky-article-mode))) 4772 (derived-mode-p 'gnus-sticky-article-mode)))
4780 (switch-to-buffer new-art-buf-name) 4773 (switch-to-buffer new-art-buf-name)
4781 (setq new-art-buf-name (rename-buffer new-art-buf-name t))) 4774 (setq new-art-buf-name (rename-buffer new-art-buf-name t)))
4782 (gnus-sticky-article-mode)) 4775 (gnus-sticky-article-mode))
@@ -4792,7 +4785,7 @@ If none is given, assume the current buffer and kill it if it has
4792 (unless buffer 4785 (unless buffer
4793 (setq buffer (current-buffer))) 4786 (setq buffer (current-buffer)))
4794 (with-current-buffer buffer 4787 (with-current-buffer buffer
4795 (when (eq major-mode 'gnus-sticky-article-mode) 4788 (when (derived-mode-p 'gnus-sticky-article-mode)
4796 (gnus-kill-buffer buffer)))) 4789 (gnus-kill-buffer buffer))))
4797 4790
4798(defun gnus-kill-sticky-article-buffers (arg) 4791(defun gnus-kill-sticky-article-buffers (arg)
@@ -4801,11 +4794,11 @@ If a prefix ARG is given, ask for confirmation."
4801 (interactive "P") 4794 (interactive "P")
4802 (dolist (buf (gnus-buffers)) 4795 (dolist (buf (gnus-buffers))
4803 (with-current-buffer buf 4796 (with-current-buffer buf
4804 (when (eq major-mode 'gnus-sticky-article-mode) 4797 (when (derived-mode-p 'gnus-sticky-article-mode)
4805 (if (not arg) 4798 (if (not arg)
4806 (gnus-kill-buffer buf) 4799 (gnus-kill-buffer buf)
4807 (when (yes-or-no-p (concat "Kill buffer " (buffer-name buf) "? ")) 4800 (when (yes-or-no-p (concat "Kill buffer " (buffer-name buf) "? "))
4808 (gnus-kill-buffer buf))))))) 4801 (gnus-kill-buffer buf)))))))
4809 4802
4810;;; 4803;;;
4811;;; Gnus MIME viewing functions 4804;;; Gnus MIME viewing functions
@@ -4893,7 +4886,7 @@ General format specifiers can also be used. See Info node
4893(defmacro gnus-bind-safe-url-regexp (&rest body) 4886(defmacro gnus-bind-safe-url-regexp (&rest body)
4894 "Bind `mm-w3m-safe-url-regexp' according to `gnus-safe-html-newsgroups'." 4887 "Bind `mm-w3m-safe-url-regexp' according to `gnus-safe-html-newsgroups'."
4895 `(let ((mm-w3m-safe-url-regexp 4888 `(let ((mm-w3m-safe-url-regexp
4896 (let ((group (if (and (eq major-mode 'gnus-article-mode) 4889 (let ((group (if (and (derived-mode-p 'gnus-article-mode)
4897 (gnus-buffer-live-p 4890 (gnus-buffer-live-p
4898 gnus-article-current-summary)) 4891 gnus-article-current-summary))
4899 (with-current-buffer gnus-article-current-summary 4892 (with-current-buffer gnus-article-current-summary
@@ -6477,7 +6470,7 @@ not have a face in `gnus-article-boring-faces'."
6477 6470
6478(defun gnus-article-check-buffer () 6471(defun gnus-article-check-buffer ()
6479 "Beep if not in an article buffer." 6472 "Beep if not in an article buffer."
6480 (unless (equal major-mode 'gnus-article-mode) 6473 (unless (derived-mode-p 'gnus-article-mode)
6481 (error "Command invoked outside of a Gnus article buffer"))) 6474 (error "Command invoked outside of a Gnus article buffer")))
6482 6475
6483(defun gnus-article-read-summary-keys (&optional arg key not-restore-window) 6476(defun gnus-article-read-summary-keys (&optional arg key not-restore-window)
@@ -6592,7 +6585,7 @@ not have a face in `gnus-article-boring-faces'."
6592 new-sum-point 6585 new-sum-point
6593 (window-live-p win) 6586 (window-live-p win)
6594 (with-current-buffer (window-buffer win) 6587 (with-current-buffer (window-buffer win)
6595 (eq major-mode 'gnus-summary-mode))) 6588 (derived-mode-p 'gnus-summary-mode)))
6596 (set-window-point win new-sum-point) 6589 (set-window-point win new-sum-point)
6597 (set-window-start win new-sum-start) 6590 (set-window-start win new-sum-start)
6598 (set-window-hscroll win new-sum-hscroll)))) 6591 (set-window-hscroll win new-sum-hscroll))))
diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el
index 7a3d273622a..c31cb1aef36 100644
--- a/lisp/gnus/gnus-bookmark.el
+++ b/lisp/gnus/gnus-bookmark.el
@@ -190,7 +190,7 @@ So the cdr of each bookmark is an alist too.")
190 "Set a bookmark for this article." 190 "Set a bookmark for this article."
191 (interactive) 191 (interactive)
192 (gnus-bookmark-maybe-load-default-file) 192 (gnus-bookmark-maybe-load-default-file)
193 (if (or (not (eq major-mode 'gnus-summary-mode)) 193 (if (or (not (derived-mode-p 'gnus-summary-mode))
194 (not gnus-article-current)) 194 (not gnus-article-current))
195 (error "Please select an article in the Gnus summary buffer") 195 (error "Please select an article in the Gnus summary buffer")
196 (let* ((group (car gnus-article-current)) 196 (let* ((group (car gnus-article-current))
@@ -473,7 +473,7 @@ That is, all information but the name."
473;; Been to lazy to use gnus-bookmark-save... 473;; Been to lazy to use gnus-bookmark-save...
474(defalias 'gnus-bookmark-bmenu-save 'gnus-bookmark-write-file) 474(defalias 'gnus-bookmark-bmenu-save 'gnus-bookmark-write-file)
475 475
476(defun gnus-bookmark-bmenu-mode () 476(define-derived-mode gnus-bookmark-bmenu-mode fundamental-mode "Bookmark Menu"
477 "Major mode for editing a list of Gnus bookmarks. 477 "Major mode for editing a list of Gnus bookmarks.
478Each line describes one of the bookmarks in Gnus. 478Each line describes one of the bookmarks in Gnus.
479Letters do not insert themselves; instead, they are commands. 479Letters do not insert themselves; instead, they are commands.
@@ -497,13 +497,8 @@ Gnus bookmarks names preceded by a \"*\" have annotations.
497 in another buffer. 497 in another buffer.
498\\[gnus-bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer. 498\\[gnus-bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer.
499\\[gnus-bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark." 499\\[gnus-bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark."
500 (kill-all-local-variables)
501 (use-local-map gnus-bookmark-bmenu-mode-map)
502 (setq truncate-lines t) 500 (setq truncate-lines t)
503 (setq buffer-read-only t) 501 (setq buffer-read-only t))
504 (setq major-mode 'gnus-bookmark-bmenu-mode)
505 (setq mode-name "Bookmark Menu")
506 (gnus-run-mode-hooks 'gnus-bookmark-bmenu-mode-hook))
507 502
508;; avoid compilation warnings 503;; avoid compilation warnings
509(defvar gnus-bookmark-bmenu-toggle-infos nil) 504(defvar gnus-bookmark-bmenu-toggle-infos nil)
diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el
index c8fb5b5dc73..247c081a20f 100644
--- a/lisp/gnus/gnus-cus.el
+++ b/lisp/gnus/gnus-cus.el
@@ -33,7 +33,7 @@
33 33
34;;; Widgets: 34;;; Widgets:
35 35
36(defun gnus-custom-mode () 36(define-derived-mode gnus-custom-mode fundamental-mode "Gnus Customize"
37 "Major mode for editing Gnus customization buffers. 37 "Major mode for editing Gnus customization buffers.
38 38
39The following commands are available: 39The following commands are available:
@@ -45,9 +45,6 @@ The following commands are available:
45 45
46Entry to this mode calls the value of `gnus-custom-mode-hook' 46Entry to this mode calls the value of `gnus-custom-mode-hook'
47if that value is non-nil." 47if that value is non-nil."
48 (kill-all-local-variables)
49 (setq major-mode 'gnus-custom-mode
50 mode-name "Gnus Customize")
51 (use-local-map widget-keymap) 48 (use-local-map widget-keymap)
52 ;; Emacs stuff: 49 ;; Emacs stuff:
53 (when (and (facep 'custom-button-face) 50 (when (and (facep 'custom-button-face)
@@ -63,8 +60,7 @@ if that value is non-nil."
63 (set (make-local-variable 'widget-push-button-prefix) "") 60 (set (make-local-variable 'widget-push-button-prefix) "")
64 (set (make-local-variable 'widget-push-button-suffix) "") 61 (set (make-local-variable 'widget-push-button-suffix) "")
65 (set (make-local-variable 'widget-link-prefix) "") 62 (set (make-local-variable 'widget-link-prefix) "")
66 (set (make-local-variable 'widget-link-suffix) "")) 63 (set (make-local-variable 'widget-link-suffix) "")))
67 (gnus-run-mode-hooks 'gnus-custom-mode-hook))
68 64
69;;; Group Customization: 65;;; Group Customization:
70 66
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 9533f5819a4..c8945e57531 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -1105,7 +1105,7 @@ When FORCE, rebuild the tool bar."
1105 (set (make-local-variable 'tool-bar-map) map)))) 1105 (set (make-local-variable 'tool-bar-map) map))))
1106 gnus-group-tool-bar-map) 1106 gnus-group-tool-bar-map)
1107 1107
1108(defun gnus-group-mode () 1108(define-derived-mode gnus-group-mode fundamental-mode "Group"
1109 "Major mode for reading news. 1109 "Major mode for reading news.
1110 1110
1111All normal editing commands are switched off. 1111All normal editing commands are switched off.
@@ -1122,17 +1122,12 @@ For more in-depth information on this mode, read the manual (`\\[gnus-info-find-
1122The following commands are available: 1122The following commands are available:
1123 1123
1124\\{gnus-group-mode-map}" 1124\\{gnus-group-mode-map}"
1125 (interactive)
1126 (kill-all-local-variables)
1127 (when (gnus-visual-p 'group-menu 'menu) 1125 (when (gnus-visual-p 'group-menu 'menu)
1128 (gnus-group-make-menu-bar) 1126 (gnus-group-make-menu-bar)
1129 (gnus-group-make-tool-bar)) 1127 (gnus-group-make-tool-bar))
1130 (gnus-simplify-mode-line) 1128 (gnus-simplify-mode-line)
1131 (setq major-mode 'gnus-group-mode)
1132 (setq mode-name "Group")
1133 (gnus-group-set-mode-line) 1129 (gnus-group-set-mode-line)
1134 (setq mode-line-process nil) 1130 (setq mode-line-process nil)
1135 (use-local-map gnus-group-mode-map)
1136 (buffer-disable-undo) 1131 (buffer-disable-undo)
1137 (setq truncate-lines t) 1132 (setq truncate-lines t)
1138 (setq buffer-read-only t 1133 (setq buffer-read-only t
@@ -1143,8 +1138,7 @@ The following commands are available:
1143 (when gnus-use-undo 1138 (when gnus-use-undo
1144 (gnus-undo-mode 1)) 1139 (gnus-undo-mode 1))
1145 (when gnus-slave 1140 (when gnus-slave
1146 (gnus-slave-mode)) 1141 (gnus-slave-mode)))
1147 (gnus-run-mode-hooks 'gnus-group-mode-hook))
1148 1142
1149(defun gnus-update-group-mark-positions () 1143(defun gnus-update-group-mark-positions ()
1150 (save-excursion 1144 (save-excursion
@@ -1193,7 +1187,7 @@ The following commands are available:
1193 1187
1194(defun gnus-group-setup-buffer () 1188(defun gnus-group-setup-buffer ()
1195 (set-buffer (gnus-get-buffer-create gnus-group-buffer)) 1189 (set-buffer (gnus-get-buffer-create gnus-group-buffer))
1196 (unless (eq major-mode 'gnus-group-mode) 1190 (unless (derived-mode-p 'gnus-group-mode)
1197 (gnus-group-mode))) 1191 (gnus-group-mode)))
1198 1192
1199(defun gnus-group-name-charset (method group) 1193(defun gnus-group-name-charset (method group)
@@ -2147,7 +2141,7 @@ be permanent."
2147 2141
2148(defun gnus-group-name-at-point () 2142(defun gnus-group-name-at-point ()
2149 "Return a group name from around point if it exists, or nil." 2143 "Return a group name from around point if it exists, or nil."
2150 (if (eq major-mode 'gnus-group-mode) 2144 (if (derived-mode-p 'gnus-group-mode)
2151 (let ((group (gnus-group-group-name))) 2145 (let ((group (gnus-group-group-name)))
2152 (when group 2146 (when group
2153 (gnus-group-decoded-name group))) 2147 (gnus-group-decoded-name group)))
@@ -3114,7 +3108,7 @@ If SOLID (the prefix), create a solid group."
3114 (gnus-group-read-ephemeral-group 3108 (gnus-group-read-ephemeral-group
3115 group method t 3109 group method t
3116 (cons (current-buffer) 3110 (cons (current-buffer)
3117 (if (eq major-mode 'gnus-summary-mode) 'summary 'group)))))) 3111 (if (derived-mode-p 'gnus-summary-mode) 'summary 'group))))))
3118 3112
3119(defvar nnrss-group-alist) 3113(defvar nnrss-group-alist)
3120(eval-when-compile 3114(eval-when-compile
@@ -3229,7 +3223,7 @@ mail messages or news articles in files that have numeric names."
3229 (unless (gnus-group-read-ephemeral-group 3223 (unless (gnus-group-read-ephemeral-group
3230 name method t 3224 name method t
3231 (cons (current-buffer) 3225 (cons (current-buffer)
3232 (if (eq major-mode 'gnus-summary-mode) 3226 (if (derived-mode-p 'gnus-summary-mode)
3233 'summary 'group))) 3227 'summary 'group)))
3234 (error "Couldn't enter %s" dir)))) 3228 (error "Couldn't enter %s" dir))))
3235 3229
@@ -4319,7 +4313,7 @@ The hook `gnus-suspend-gnus-hook' is called before actually suspending."
4319 (unless (or (eq buf group-buf) 4313 (unless (or (eq buf group-buf)
4320 (eq buf gnus-dribble-buffer) 4314 (eq buf gnus-dribble-buffer)
4321 (with-current-buffer buf 4315 (with-current-buffer buf
4322 (eq major-mode 'message-mode))) 4316 (derived-mode-p 'message-mode)))
4323 (gnus-kill-buffer buf))) 4317 (gnus-kill-buffer buf)))
4324 (setq gnus-backlog-articles nil) 4318 (setq gnus-backlog-articles nil)
4325 (gnus-kill-gnus-frames) 4319 (gnus-kill-gnus-frames)
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index a946a586033..e4e1ec29ae9 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -257,9 +257,9 @@ status will be retrieved from the first matching attendee record."
257 ((string= key "ATTENDEE") (update-attendee-status line)) 257 ((string= key "ATTENDEE") (update-attendee-status line))
258 ((string= key "SUMMARY") (update-summary line)) 258 ((string= key "SUMMARY") (update-summary line))
259 ((string= key "DTSTAMP") (update-dtstamp)) 259 ((string= key "DTSTAMP") (update-dtstamp))
260 ((find key '("ORGANIZER" "DTSTART" "DTEND" 260 ((member key '("ORGANIZER" "DTSTART" "DTEND"
261 "LOCATION" "DURATION" "SEQUENCE" 261 "LOCATION" "DURATION" "SEQUENCE"
262 "RECURRENCE-ID" "UID")) line) 262 "RECURRENCE-ID" "UID")) line)
263 (t nil)))) 263 (t nil))))
264 (when new-line 264 (when new-line
265 (push new-line reply-event-lines)))))) 265 (push new-line reply-event-lines))))))
@@ -816,6 +816,8 @@ is searched."
816 (gnus-icalendar-show-org-agenda 816 (gnus-icalendar-show-org-agenda
817 (with-current-buffer gnus-article-buffer gnus-icalendar-event))) 817 (with-current-buffer gnus-article-buffer gnus-icalendar-event)))
818 818
819(defvar gnus-mime-action-alist) ; gnus-art
820
819(defun gnus-icalendar-setup () 821(defun gnus-icalendar-setup ()
820 (add-to-list 'mm-inlined-types "text/calendar") 822 (add-to-list 'mm-inlined-types "text/calendar")
821 (add-to-list 'mm-automatic-display "text/calendar") 823 (add-to-list 'mm-automatic-display "text/calendar")
diff --git a/lisp/gnus/gnus-kill.el b/lisp/gnus/gnus-kill.el
index b3f06de0868..011288e280b 100644
--- a/lisp/gnus/gnus-kill.el
+++ b/lisp/gnus/gnus-kill.el
@@ -75,20 +75,20 @@ of time."
75;;; Gnus Kill File Mode 75;;; Gnus Kill File Mode
76;;; 76;;;
77 77
78(defvar gnus-kill-file-mode-map nil) 78(defvar gnus-kill-file-mode-map
79 79 (let ((map (make-sparse-keymap)))
80(unless gnus-kill-file-mode-map 80 (set-keymap-parent map emacs-lisp-mode-map)
81 (gnus-define-keymap (setq gnus-kill-file-mode-map 81 (gnus-define-keymap map
82 (copy-keymap emacs-lisp-mode-map)) 82 "\C-c\C-k\C-s" gnus-kill-file-kill-by-subject
83 "\C-c\C-k\C-s" gnus-kill-file-kill-by-subject 83 "\C-c\C-k\C-a" gnus-kill-file-kill-by-author
84 "\C-c\C-k\C-a" gnus-kill-file-kill-by-author 84 "\C-c\C-k\C-t" gnus-kill-file-kill-by-thread
85 "\C-c\C-k\C-t" gnus-kill-file-kill-by-thread 85 "\C-c\C-k\C-x" gnus-kill-file-kill-by-xref
86 "\C-c\C-k\C-x" gnus-kill-file-kill-by-xref 86 "\C-c\C-a" gnus-kill-file-apply-buffer
87 "\C-c\C-a" gnus-kill-file-apply-buffer 87 "\C-c\C-e" gnus-kill-file-apply-last-sexp
88 "\C-c\C-e" gnus-kill-file-apply-last-sexp 88 "\C-c\C-c" gnus-kill-file-exit)
89 "\C-c\C-c" gnus-kill-file-exit)) 89 map))
90 90
91(defun gnus-kill-file-mode () 91(define-derived-mode gnus-kill-file-mode emacs-lisp-mode "Kill"
92 "Major mode for editing kill files. 92 "Major mode for editing kill files.
93 93
94If you are using this mode - you probably shouldn't. Kill files 94If you are using this mode - you probably shouldn't. Kill files
@@ -151,15 +151,7 @@ which are marked as read in the previous Gnus sessions. Marks other
151than `D' should be used for articles which should really be deleted. 151than `D' should be used for articles which should really be deleted.
152 152
153Entry to this mode calls emacs-lisp-mode-hook and 153Entry to this mode calls emacs-lisp-mode-hook and
154gnus-kill-file-mode-hook with no arguments, if that value is non-nil." 154gnus-kill-file-mode-hook with no arguments, if that value is non-nil.")
155 (interactive)
156 (kill-all-local-variables)
157 (use-local-map gnus-kill-file-mode-map)
158 (set-syntax-table emacs-lisp-mode-syntax-table)
159 (setq major-mode 'gnus-kill-file-mode)
160 (setq mode-name "Kill")
161 (lisp-mode-variables nil)
162 (gnus-run-mode-hooks 'emacs-lisp-mode-hook 'gnus-kill-file-mode-hook))
163 155
164(defun gnus-kill-file-edit-file (newsgroup) 156(defun gnus-kill-file-edit-file (newsgroup)
165 "Begin editing a kill file for NEWSGROUP. 157 "Begin editing a kill file for NEWSGROUP.
@@ -175,10 +167,10 @@ If NEWSGROUP is nil, the global kill file is selected."
175 (let ((buffer (find-file-noselect file))) 167 (let ((buffer (find-file-noselect file)))
176 (cond ((get-buffer-window buffer) 168 (cond ((get-buffer-window buffer)
177 (pop-to-buffer buffer)) 169 (pop-to-buffer buffer))
178 ((eq major-mode 'gnus-group-mode) 170 ((derived-mode-p 'gnus-group-mode)
179 (gnus-configure-windows 'group) ;Take all windows. 171 (gnus-configure-windows 'group) ;Take all windows.
180 (pop-to-buffer buffer)) 172 (pop-to-buffer buffer))
181 ((eq major-mode 'gnus-summary-mode) 173 ((derived-mode-p 'gnus-summary-mode)
182 (gnus-configure-windows 'article) 174 (gnus-configure-windows 'article)
183 (pop-to-buffer gnus-article-buffer) 175 (pop-to-buffer gnus-article-buffer)
184 (bury-buffer gnus-article-buffer) 176 (bury-buffer gnus-article-buffer)
@@ -201,7 +193,7 @@ If NEWSGROUP is nil, the global kill file is selected."
201 ;; REGEXP: The string to kill. 193 ;; REGEXP: The string to kill.
202 (save-excursion 194 (save-excursion
203 (let (string) 195 (let (string)
204 (unless (eq major-mode 'gnus-kill-file-mode) 196 (unless (derived-mode-p 'gnus-kill-file-mode)
205 (gnus-kill-set-kill-buffer)) 197 (gnus-kill-set-kill-buffer))
206 (unless dont-move 198 (unless dont-move
207 (goto-char (point-max))) 199 (goto-char (point-max)))
@@ -520,7 +512,7 @@ COMMAND must be a Lisp expression or a string representing a key sequence."
520 (setq kill-list (cdr kill-list)))) 512 (setq kill-list (cdr kill-list))))
521 (gnus-execute field kill-list command nil (not all)))))) 513 (gnus-execute field kill-list command nil (not all))))))
522 (switch-to-buffer old-buffer) 514 (switch-to-buffer old-buffer)
523 (when (and (eq major-mode 'gnus-kill-file-mode) regexp (not silent)) 515 (when (and (derived-mode-p 'gnus-kill-file-mode) regexp (not silent))
524 (gnus-pp-gnus-kill 516 (gnus-pp-gnus-kill
525 (nconc (list 'gnus-kill field 517 (nconc (list 'gnus-kill field
526 (if (consp regexp) (list 'quote regexp) regexp)) 518 (if (consp regexp) (list 'quote regexp) regexp))
diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el
index 69774587d80..2f151e570d7 100644
--- a/lisp/gnus/gnus-srvr.el
+++ b/lisp/gnus/gnus-srvr.el
@@ -244,6 +244,7 @@ For more in-depth information on this mode, read the manual
244The following commands are available: 244The following commands are available:
245 245
246\\{gnus-server-mode-map}" 246\\{gnus-server-mode-map}"
247 ;; FIXME: Use define-derived-mode.
247 (interactive) 248 (interactive)
248 (when (gnus-visual-p 'server-menu 'menu) 249 (when (gnus-visual-p 'server-menu 'menu)
249 (gnus-server-make-menu-bar)) 250 (gnus-server-make-menu-bar))
@@ -869,7 +870,7 @@ claim them."
869 (gnus-message 5 "Connecting to %s...done" (nth 1 method)) 870 (gnus-message 5 "Connecting to %s...done" (nth 1 method))
870 t)))) 871 t))))
871 872
872(defun gnus-browse-mode () 873(define-derived-mode gnus-browse-mode fundamental-mode "Browse Server"
873 "Major mode for browsing a foreign server. 874 "Major mode for browsing a foreign server.
874 875
875All normal editing commands are switched off. 876All normal editing commands are switched off.
@@ -884,20 +885,14 @@ buffer.
8842) `\\[gnus-browse-read-group]' to read a group ephemerally. 8852) `\\[gnus-browse-read-group]' to read a group ephemerally.
885 886
8863) `\\[gnus-browse-exit]' to return to the group buffer." 8873) `\\[gnus-browse-exit]' to return to the group buffer."
887 (interactive)
888 (kill-all-local-variables)
889 (when (gnus-visual-p 'browse-menu 'menu) 888 (when (gnus-visual-p 'browse-menu 'menu)
890 (gnus-browse-make-menu-bar)) 889 (gnus-browse-make-menu-bar))
891 (gnus-simplify-mode-line) 890 (gnus-simplify-mode-line)
892 (setq major-mode 'gnus-browse-mode)
893 (setq mode-name "Browse Server")
894 (setq mode-line-process nil) 891 (setq mode-line-process nil)
895 (use-local-map gnus-browse-mode-map)
896 (buffer-disable-undo) 892 (buffer-disable-undo)
897 (setq truncate-lines t) 893 (setq truncate-lines t)
898 (gnus-set-default-directory) 894 (gnus-set-default-directory)
899 (setq buffer-read-only t) 895 (setq buffer-read-only t))
900 (gnus-run-mode-hooks 'gnus-browse-mode-hook))
901 896
902(defun gnus-browse-read-group (&optional no-article number) 897(defun gnus-browse-read-group (&optional no-article number)
903 "Enter the group at the current line. 898 "Enter the group at the current line.
@@ -1022,7 +1017,7 @@ doing the deletion."
1022(defun gnus-browse-exit () 1017(defun gnus-browse-exit ()
1023 "Quit browsing and return to the group buffer." 1018 "Quit browsing and return to the group buffer."
1024 (interactive) 1019 (interactive)
1025 (when (eq major-mode 'gnus-browse-mode) 1020 (when (derived-mode-p 'gnus-browse-mode)
1026 (gnus-kill-buffer (current-buffer))) 1021 (gnus-kill-buffer (current-buffer)))
1027 ;; Insert the newly subscribed groups in the group buffer. 1022 ;; Insert the newly subscribed groups in the group buffer.
1028 (with-current-buffer gnus-group-buffer 1023 (with-current-buffer gnus-group-buffer
diff --git a/lisp/gnus/score-mode.el b/lisp/gnus/score-mode.el
index ec24f1f9670..58767cfcc7a 100644
--- a/lisp/gnus/score-mode.el
+++ b/lisp/gnus/score-mode.el
@@ -40,13 +40,13 @@
40(defvar gnus-score-edit-exit-function nil 40(defvar gnus-score-edit-exit-function nil
41 "Function run on exit from the score buffer.") 41 "Function run on exit from the score buffer.")
42 42
43(defvar gnus-score-mode-map nil) 43(defvar gnus-score-mode-map
44(unless gnus-score-mode-map 44 (let ((map (make-sparse-keymap)))
45 (setq gnus-score-mode-map (make-sparse-keymap)) 45 (set-keymap-parent map emacs-lisp-mode-map)
46 (set-keymap-parent gnus-score-mode-map emacs-lisp-mode-map) 46 (define-key map "\C-c\C-c" 'gnus-score-edit-exit)
47 (define-key gnus-score-mode-map "\C-c\C-c" 'gnus-score-edit-exit) 47 (define-key map "\C-c\C-d" 'gnus-score-edit-insert-date)
48 (define-key gnus-score-mode-map "\C-c\C-d" 'gnus-score-edit-insert-date) 48 (define-key map "\C-c\C-p" 'gnus-score-pretty-print)
49 (define-key gnus-score-mode-map "\C-c\C-p" 'gnus-score-pretty-print)) 49 map))
50 50
51(defvar score-mode-syntax-table 51(defvar score-mode-syntax-table
52 (let ((table (copy-syntax-table lisp-mode-syntax-table))) 52 (let ((table (copy-syntax-table lisp-mode-syntax-table)))
@@ -58,21 +58,13 @@
58(defvar score-mode-coding-system mm-universal-coding-system) 58(defvar score-mode-coding-system mm-universal-coding-system)
59 59
60;;;###autoload 60;;;###autoload
61(defun gnus-score-mode () 61(define-derived-mode gnus-score-mode emacs-lisp-mode "Score"
62 "Mode for editing Gnus score files. 62 "Mode for editing Gnus score files.
63This mode is an extended emacs-lisp mode. 63This mode is an extended emacs-lisp mode.
64 64
65\\{gnus-score-mode-map}" 65\\{gnus-score-mode-map}"
66 (interactive)
67 (kill-all-local-variables)
68 (use-local-map gnus-score-mode-map)
69 (gnus-score-make-menu-bar) 66 (gnus-score-make-menu-bar)
70 (set-syntax-table score-mode-syntax-table) 67 (make-local-variable 'gnus-score-edit-exit-function))
71 (setq major-mode 'gnus-score-mode)
72 (setq mode-name "Score")
73 (lisp-mode-variables nil)
74 (make-local-variable 'gnus-score-edit-exit-function)
75 (gnus-run-mode-hooks 'emacs-lisp-mode-hook 'gnus-score-mode-hook))
76 68
77(defun gnus-score-make-menu-bar () 69(defun gnus-score-make-menu-bar ()
78 (unless (boundp 'gnus-score-menu) 70 (unless (boundp 'gnus-score-menu)
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index ce29505d6f2..8356a186f13 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -156,7 +156,7 @@ elisp byte-compiler."
156 (null buffer-file-name)) 156 (null buffer-file-name))
157 italic) 157 italic)
158 (30 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face) 158 (30 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face)
159 (35 (eq major-mode 'dired-mode) font-lock-function-name-face)) 159 (35 (derived-mode-p 'dired-mode) font-lock-function-name-face))
160 "An alist describing how to fontify buffers. 160 "An alist describing how to fontify buffers.
161Each element should be of the form (PRIORITY FORM FACE), where 161Each element should be of the form (PRIORITY FORM FACE), where
162PRIORITY is an integer, FORM is an arbitrary form to evaluate in the 162PRIORITY is an integer, FORM is an arbitrary form to evaluate in the
@@ -2358,7 +2358,7 @@ FORMATS is the value to use for `ibuffer-formats'.
2358 ;; We switch to the buffer's window in order to be able 2358 ;; We switch to the buffer's window in order to be able
2359 ;; to modify the value of point 2359 ;; to modify the value of point
2360 (select-window (get-buffer-window buf 0)) 2360 (select-window (get-buffer-window buf 0))
2361 (or (eq major-mode 'ibuffer-mode) 2361 (or (derived-mode-p 'ibuffer-mode)
2362 (ibuffer-mode)) 2362 (ibuffer-mode))
2363 (setq ibuffer-restore-window-config-on-quit other-window-p) 2363 (setq ibuffer-restore-window-config-on-quit other-window-p)
2364 (when shrink 2364 (when shrink
@@ -2383,7 +2383,7 @@ FORMATS is the value to use for `ibuffer-formats'.
2383 (message "Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help")))))) 2383 (message "Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help"))))))
2384 2384
2385(put 'ibuffer-mode 'mode-class 'special) 2385(put 'ibuffer-mode 'mode-class 'special)
2386(defun ibuffer-mode () 2386(define-derived-mode ibuffer-mode special-mode "IBuffer"
2387 "A major mode for viewing a list of buffers. 2387 "A major mode for viewing a list of buffers.
2388In Ibuffer, you can conveniently perform many operations on the 2388In Ibuffer, you can conveniently perform many operations on the
2389currently open buffers, in addition to filtering your view to a 2389currently open buffers, in addition to filtering your view to a
@@ -2564,10 +2564,6 @@ filter groups are displayed in this order of precedence.
2564You may rearrange filter groups by using the regular 2564You may rearrange filter groups by using the regular
2565'\\[ibuffer-kill-line]' and '\\[ibuffer-yank]' pair. Yanked groups 2565'\\[ibuffer-kill-line]' and '\\[ibuffer-yank]' pair. Yanked groups
2566will be inserted before the group at point." 2566will be inserted before the group at point."
2567 (kill-all-local-variables)
2568 (use-local-map ibuffer-mode-map)
2569 (setq major-mode 'ibuffer-mode)
2570 (setq mode-name "Ibuffer")
2571 ;; Include state info next to the mode name. 2567 ;; Include state info next to the mode name.
2572 (set (make-local-variable 'mode-line-process) 2568 (set (make-local-variable 'mode-line-process)
2573 '(" by " 2569 '(" by "
@@ -2627,13 +2623,12 @@ will be inserted before the group at point."
2627 (ibuffer-update-format) 2623 (ibuffer-update-format)
2628 (when ibuffer-default-directory 2624 (when ibuffer-default-directory
2629 (setq default-directory ibuffer-default-directory)) 2625 (setq default-directory ibuffer-default-directory))
2630 (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) 2626 (add-hook 'change-major-mode-hook 'font-lock-defontify nil t))
2631 (run-mode-hooks 'ibuffer-mode-hook))
2632 2627
2633 2628
2634;;; Start of automatically extracted autoloads. 2629;;; Start of automatically extracted autoloads.
2635 2630
2636;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" "d06b2735a74954e0c6922a811de7608c") 2631;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" "85795a4045d20654599b73b88e8e1bc9")
2637;;; Generated autoloads from ibuf-ext.el 2632;;; Generated autoloads from ibuf-ext.el
2638 2633
2639(autoload 'ibuffer-auto-mode "ibuf-ext" "\ 2634(autoload 'ibuffer-auto-mode "ibuf-ext" "\
diff --git a/lisp/info.el b/lisp/info.el
index 65cd7eddcfd..93442689319 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -790,7 +790,7 @@ See a list of available Info commands in `Info-mode'."
790 790
791(defun info-setup (file-or-node buffer) 791(defun info-setup (file-or-node buffer)
792 "Display Info node FILE-OR-NODE in BUFFER." 792 "Display Info node FILE-OR-NODE in BUFFER."
793 (if (and buffer (not (eq major-mode 'Info-mode))) 793 (if (and buffer (not (derived-mode-p 'Info-mode)))
794 (Info-mode)) 794 (Info-mode))
795 (if file-or-node 795 (if file-or-node
796 ;; If argument already contains parentheses, don't add another set 796 ;; If argument already contains parentheses, don't add another set
@@ -931,7 +931,7 @@ STRICT-CASE is non-nil)."
931 (info-initialize) 931 (info-initialize)
932 (setq filename (Info-find-file filename)) 932 (setq filename (Info-find-file filename))
933 ;; Go into Info buffer. 933 ;; Go into Info buffer.
934 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 934 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
935 ;; Record the node we are leaving, if we were in one. 935 ;; Record the node we are leaving, if we were in one.
936 (and (not no-going-back) 936 (and (not no-going-back)
937 Info-current-file 937 Info-current-file
@@ -961,7 +961,7 @@ otherwise, that defaults to `Top'."
961 "Go to an Info node FILENAME and NODENAME, re-reading disk contents. 961 "Go to an Info node FILENAME and NODENAME, re-reading disk contents.
962When *info* is already displaying FILENAME and NODENAME, the window position 962When *info* is already displaying FILENAME and NODENAME, the window position
963is preserved, if possible." 963is preserved, if possible."
964 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 964 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
965 (let ((old-filename Info-current-file) 965 (let ((old-filename Info-current-file)
966 (old-nodename Info-current-node) 966 (old-nodename Info-current-node)
967 (window-selected (eq (selected-window) (get-buffer-window))) 967 (window-selected (eq (selected-window) (get-buffer-window)))
@@ -1065,7 +1065,7 @@ is non-nil)."
1065 1065
1066(defun Info-find-node-2 (filename nodename &optional no-going-back strict-case) 1066(defun Info-find-node-2 (filename nodename &optional no-going-back strict-case)
1067 (buffer-disable-undo (current-buffer)) 1067 (buffer-disable-undo (current-buffer))
1068 (or (eq major-mode 'Info-mode) 1068 (or (derived-mode-p 'Info-mode)
1069 (Info-mode)) 1069 (Info-mode))
1070 (widen) 1070 (widen)
1071 (setq Info-current-node nil) 1071 (setq Info-current-node nil)
@@ -2212,7 +2212,7 @@ End of submatch 0, 1, and 3 are the same, so you can safely concat."
2212 (interactive) 2212 (interactive)
2213 ;; In case another window is currently selected 2213 ;; In case another window is currently selected
2214 (save-window-excursion 2214 (save-window-excursion
2215 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 2215 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
2216 (Info-goto-node (Info-extract-pointer "next")))) 2216 (Info-goto-node (Info-extract-pointer "next"))))
2217 2217
2218(defun Info-prev () 2218(defun Info-prev ()
@@ -2220,7 +2220,7 @@ End of submatch 0, 1, and 3 are the same, so you can safely concat."
2220 (interactive) 2220 (interactive)
2221 ;; In case another window is currently selected 2221 ;; In case another window is currently selected
2222 (save-window-excursion 2222 (save-window-excursion
2223 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 2223 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
2224 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous")))) 2224 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous"))))
2225 2225
2226(defun Info-up (&optional same-file) 2226(defun Info-up (&optional same-file)
@@ -2229,7 +2229,7 @@ If SAME-FILE is non-nil, do not move to a different Info file."
2229 (interactive) 2229 (interactive)
2230 ;; In case another window is currently selected 2230 ;; In case another window is currently selected
2231 (save-window-excursion 2231 (save-window-excursion
2232 (or (eq major-mode 'Info-mode) (switch-to-buffer "*info*")) 2232 (or (derived-mode-p 'Info-mode) (switch-to-buffer "*info*"))
2233 (let ((old-node Info-current-node) 2233 (let ((old-node Info-current-node)
2234 (old-file Info-current-file) 2234 (old-file Info-current-file)
2235 (node (Info-extract-pointer "up")) p) 2235 (node (Info-extract-pointer "up")) p)
@@ -4082,7 +4082,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
4082(defun Info-menu-update () 4082(defun Info-menu-update ()
4083 "Update the Info menu for the current node." 4083 "Update the Info menu for the current node."
4084 (condition-case nil 4084 (condition-case nil
4085 (if (or (not (eq major-mode 'Info-mode)) 4085 (if (or (not (derived-mode-p 'Info-mode))
4086 (equal (list Info-current-file Info-current-node) 4086 (equal (list Info-current-file Info-current-node)
4087 Info-menu-last-node)) 4087 Info-menu-last-node))
4088 () 4088 ()
@@ -4285,7 +4285,7 @@ Advanced commands:
4285;; When an Info buffer is killed, make sure the associated tags buffer 4285;; When an Info buffer is killed, make sure the associated tags buffer
4286;; is killed too. 4286;; is killed too.
4287(defun Info-kill-buffer () 4287(defun Info-kill-buffer ()
4288 (and (eq major-mode 'Info-mode) 4288 (and (derived-mode-p 'Info-mode)
4289 Info-tag-table-buffer 4289 Info-tag-table-buffer
4290 (kill-buffer Info-tag-table-buffer))) 4290 (kill-buffer Info-tag-table-buffer)))
4291 4291
@@ -4302,10 +4302,11 @@ Advanced commands:
4302 (copy-marker (marker-position m))) 4302 (copy-marker (marker-position m)))
4303 (make-marker)))))) 4303 (make-marker))))))
4304 4304
4305(defvar Info-edit-map (let ((map (make-sparse-keymap))) 4305(define-obsolete-variable-alias 'Info-edit-map 'Info-edit-mode-map "24.1")
4306 (set-keymap-parent map text-mode-map) 4306(defvar Info-edit-mode-map (let ((map (make-sparse-keymap)))
4307 (define-key map "\C-c\C-c" 'Info-cease-edit) 4307 (set-keymap-parent map text-mode-map)
4308 map) 4308 (define-key map "\C-c\C-c" 'Info-cease-edit)
4309 map)
4309 "Local keymap used within `e' command of Info.") 4310 "Local keymap used within `e' command of Info.")
4310 4311
4311(make-obsolete-variable 'Info-edit-map 4312(make-obsolete-variable 'Info-edit-map
@@ -4315,19 +4316,14 @@ Advanced commands:
4315;; Info-edit mode is suitable only for specially formatted data. 4316;; Info-edit mode is suitable only for specially formatted data.
4316(put 'Info-edit-mode 'mode-class 'special) 4317(put 'Info-edit-mode 'mode-class 'special)
4317 4318
4318(defun Info-edit-mode () 4319(define-derived-mode Info-edit-mode text-mode "Info Edit"
4319 "Major mode for editing the contents of an Info node. 4320 "Major mode for editing the contents of an Info node.
4320Like text mode with the addition of `Info-cease-edit' 4321Like text mode with the addition of `Info-cease-edit'
4321which returns to Info mode for browsing. 4322which returns to Info mode for browsing.
4322\\{Info-edit-map}" 4323\\{Info-edit-map}"
4323 (use-local-map Info-edit-map)
4324 (setq major-mode 'Info-edit-mode)
4325 (setq mode-name "Info Edit")
4326 (kill-local-variable 'mode-line-buffer-identification)
4327 (setq buffer-read-only nil) 4324 (setq buffer-read-only nil)
4328 (force-mode-line-update) 4325 (force-mode-line-update)
4329 (buffer-enable-undo (current-buffer)) 4326 (buffer-enable-undo (current-buffer)))
4330 (run-mode-hooks 'Info-edit-mode-hook))
4331 4327
4332(make-obsolete 'Info-edit-mode 4328(make-obsolete 'Info-edit-mode
4333 "editing Info nodes by hand is not recommended." "24.4") 4329 "editing Info nodes by hand is not recommended." "24.4")
@@ -4352,11 +4348,7 @@ This feature will be removed in future.")
4352 (and (buffer-modified-p) 4348 (and (buffer-modified-p)
4353 (y-or-n-p "Save the file? ") 4349 (y-or-n-p "Save the file? ")
4354 (save-buffer)) 4350 (save-buffer))
4355 (use-local-map Info-mode-map) 4351 (Info-mode)
4356 (setq major-mode 'Info-mode)
4357 (setq mode-name "Info")
4358 (Info-set-mode-line)
4359 (setq buffer-read-only t)
4360 (force-mode-line-update) 4352 (force-mode-line-update)
4361 (and (marker-position Info-tag-table-marker) 4353 (and (marker-position Info-tag-table-marker)
4362 (buffer-modified-p) 4354 (buffer-modified-p)
@@ -4469,7 +4461,7 @@ COMMAND must be a symbol or string."
4469 ;; Get Info running, and pop to it in another window. 4461 ;; Get Info running, and pop to it in another window.
4470 (save-window-excursion 4462 (save-window-excursion
4471 (info)) 4463 (info))
4472 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) 4464 (or (derived-mode-p 'Info-mode) (pop-to-buffer "*info*"))
4473 ;; Bind Info-history to nil, to prevent the last Index node 4465 ;; Bind Info-history to nil, to prevent the last Index node
4474 ;; visited by Info-find-emacs-command-nodes from being 4466 ;; visited by Info-find-emacs-command-nodes from being
4475 ;; pushed onto the history. 4467 ;; pushed onto the history.
@@ -5133,7 +5125,7 @@ INDENT is the current indentation depth."
5133NODESPEC is a string of the form: (file)node." 5125NODESPEC is a string of the form: (file)node."
5134 ;; Set up a buffer we can use to fake-out Info. 5126 ;; Set up a buffer we can use to fake-out Info.
5135 (with-current-buffer (get-buffer-create " *info-browse-tmp*") 5127 (with-current-buffer (get-buffer-create " *info-browse-tmp*")
5136 (if (not (equal major-mode 'Info-mode)) 5128 (if (not (derived-mode-p 'Info-mode))
5137 (Info-mode)) 5129 (Info-mode))
5138 ;; Get the node into this buffer 5130 ;; Get the node into this buffer
5139 (if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" nodespec)) 5131 (if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" nodespec))
diff --git a/lisp/locate.el b/lisp/locate.el
index ab0417070e7..99a99853da9 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -95,7 +95,7 @@
95;; 95;;
96;; (defadvice dired-make-relative (before set-no-error activate) 96;; (defadvice dired-make-relative (before set-no-error activate)
97;; "For locate mode and Windows, don't return errors" 97;; "For locate mode and Windows, don't return errors"
98;; (if (and (eq major-mode 'locate-mode) 98;; (if (and (derived-mode-p 'locate-mode)
99;; (memq system-type '(windows-nt ms-dos))) 99;; (memq system-type '(windows-nt ms-dos)))
100;; (ad-set-arg 2 t) 100;; (ad-set-arg 2 t)
101;; )) 101;; ))
@@ -448,7 +448,7 @@ file name or is inside a subdirectory."
448;; Define a mode for locate 448;; Define a mode for locate
449;; Default directory is set to "/" so that dired commands, which 449;; Default directory is set to "/" so that dired commands, which
450;; expect to be in a tree, will work properly 450;; expect to be in a tree, will work properly
451(defun locate-mode () 451(define-derived-mode locate-mode special-mode "Locate"
452 "Major mode for the `*Locate*' buffer made by \\[locate]. 452 "Major mode for the `*Locate*' buffer made by \\[locate].
453\\<locate-mode-map>\ 453\\<locate-mode-map>\
454In that buffer, you can use almost all the usual dired bindings. 454In that buffer, you can use almost all the usual dired bindings.
@@ -463,39 +463,31 @@ Specific `locate-mode' commands, such as \\[locate-find-directory],
463do not work in subdirectories. 463do not work in subdirectories.
464 464
465\\{locate-mode-map}" 465\\{locate-mode-map}"
466 ;; Not to be called interactively.
467 (kill-all-local-variables)
468 ;; Avoid clobbering this variable 466 ;; Avoid clobbering this variable
469 (make-local-variable 'dired-subdir-alist) 467 (make-local-variable 'dired-subdir-alist)
470 (use-local-map locate-mode-map) 468 (setq default-directory "/"
471 (setq major-mode 'locate-mode
472 mode-name "Locate"
473 default-directory "/"
474 buffer-read-only t 469 buffer-read-only t
475 selective-display t) 470 selective-display t)
476 (dired-alist-add-1 default-directory (point-min-marker)) 471 (dired-alist-add-1 default-directory (point-min-marker))
477 (set (make-local-variable 'dired-directory) "/") 472 (set (make-local-variable 'dired-directory) "/")
478 (set (make-local-variable 'dired-subdir-switches) locate-ls-subdir-switches) 473 (set (make-local-variable 'dired-subdir-switches) locate-ls-subdir-switches)
479 (setq dired-switches-alist nil) 474 (setq dired-switches-alist nil)
480 (make-local-variable 'directory-listing-before-filename-regexp)
481 ;; This should support both Unix and Windoze style names 475 ;; This should support both Unix and Windoze style names
482 (setq directory-listing-before-filename-regexp 476 (setq-local directory-listing-before-filename-regexp
483 (concat "^.\\(" 477 (concat "^.\\("
484 (make-string (1- locate-filename-indentation) ?\s) 478 (make-string (1- locate-filename-indentation) ?\s)
485 "\\)\\|" 479 "\\)\\|"
486 (default-value 'directory-listing-before-filename-regexp))) 480 (default-value
487 (make-local-variable 'dired-actual-switches) 481 'directory-listing-before-filename-regexp)))
488 (setq dired-actual-switches "") 482 (setq-local dired-actual-switches "")
489 (make-local-variable 'dired-permission-flags-regexp) 483 (setq-local dired-permission-flags-regexp
490 (setq dired-permission-flags-regexp 484 (concat "^.\\("
491 (concat "^.\\(" 485 (make-string (1- locate-filename-indentation) ?\s)
492 (make-string (1- locate-filename-indentation) ?\s) 486 "\\)\\|"
493 "\\)\\|" 487 (default-value 'dired-permission-flags-regexp)))
494 (default-value 'dired-permission-flags-regexp))) 488
495 (make-local-variable 'revert-buffer-function) 489 (setq-local revert-buffer-function #'locate-update)
496 (setq revert-buffer-function 'locate-update) 490 (setq-local page-delimiter "\n\n"))
497 (set (make-local-variable 'page-delimiter) "\n\n")
498 (run-mode-hooks 'locate-mode-hook))
499(put 'locate-mode 'derived-mode-parent 'dired-mode) 491(put 'locate-mode 'derived-mode-parent 'dired-mode)
500 492
501(defun locate-do-setup (search-string) 493(defun locate-do-setup (search-string)
diff --git a/lisp/mail/mspools.el b/lisp/mail/mspools.el
index 5e01a7149a8..b2618ef42db 100644
--- a/lisp/mail/mspools.el
+++ b/lisp/mail/mspools.el
@@ -344,19 +344,13 @@ nil."
344 (interactive) 344 (interactive)
345 (kill-buffer mspools-buffer)) 345 (kill-buffer mspools-buffer))
346 346
347(defun mspools-mode () 347(define-derived-mode mspools-mode special-mode "MSpools"
348 "Major mode for output from mspools-show. 348 "Major mode for output from mspools-show.
349\\<mspools-mode-map>Move point to one of the items in this buffer, then use 349\\<mspools-mode-map>Move point to one of the items in this buffer, then use
350\\[mspools-visit-spool] to go to the spool that the current line refers to. 350\\[mspools-visit-spool] to go to the spool that the current line refers to.
351\\[revert-buffer] to regenerate the list of spools. 351\\[revert-buffer] to regenerate the list of spools.
352\\{mspools-mode-map}" 352\\{mspools-mode-map}"
353 (kill-all-local-variables) 353 (setq-local revert-buffer-function 'mspools-revert-buffer))
354 (make-local-variable 'revert-buffer-function)
355 (setq revert-buffer-function 'mspools-revert-buffer)
356 (use-local-map mspools-mode-map)
357 (setq major-mode 'mspools-mode)
358 (setq mode-name "MSpools")
359 (run-mode-hooks 'mspools-mode-hook))
360 354
361(defun mspools-get-spool-files () 355(defun mspools-get-spool-files ()
362 "Find the list of spool files and display them in *spools* buffer." 356 "Find the list of spool files and display them in *spools* buffer."
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index aa244ddae81..bb4801a523d 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -4768,7 +4768,7 @@ If prefix argument REVERSE is non-nil, sorts in reverse order.
4768 4768
4769;;;*** 4769;;;***
4770 4770
4771;;;### (autoloads nil "rmailsum" "rmailsum.el" "a9b3bbd9b82dd566524a1209b5cdb7dd") 4771;;;### (autoloads nil "rmailsum" "rmailsum.el" "9005bd5da3e21d1cc173e86fd9fec3c9")
4772;;; Generated autoloads from rmailsum.el 4772;;; Generated autoloads from rmailsum.el
4773 4773
4774(autoload 'rmail-summary "rmailsum" "\ 4774(autoload 'rmail-summary "rmailsum" "\
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 3a0a7824ad8..cced2231522 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -408,7 +408,7 @@ If FUNCTION is nil, includes all messages."
408 (unless rmail-buffer 408 (unless rmail-buffer
409 (error "No RMAIL buffer found")) 409 (error "No RMAIL buffer found"))
410 (let (mesg was-in-summary sumbuf) 410 (let (mesg was-in-summary sumbuf)
411 (if (eq major-mode 'rmail-summary-mode) 411 (if (derived-mode-p 'rmail-summary-mode)
412 (setq was-in-summary t)) 412 (setq was-in-summary t))
413 (with-current-buffer rmail-buffer 413 (with-current-buffer rmail-buffer
414 (setq rmail-summary-buffer (rmail-new-summary-1 desc redo function args) 414 (setq rmail-summary-buffer (rmail-new-summary-1 desc redo function args)
@@ -1035,7 +1035,7 @@ Optional prefix ARG means undelete ARG previous messages."
1035;; Rmail Summary mode is suitable only for specially formatted data. 1035;; Rmail Summary mode is suitable only for specially formatted data.
1036(put 'rmail-summary-mode 'mode-class 'special) 1036(put 'rmail-summary-mode 'mode-class 'special)
1037 1037
1038(defun rmail-summary-mode () 1038(define-derived-mode rmail-summary-mode special-mode "RMAIL Summary"
1039 "Rmail Summary Mode is invoked from Rmail Mode by using \\<rmail-mode-map>\\[rmail-summary]. 1039 "Rmail Summary Mode is invoked from Rmail Mode by using \\<rmail-mode-map>\\[rmail-summary].
1040As commands are issued in the summary buffer, they are applied to the 1040As commands are issued in the summary buffer, they are applied to the
1041corresponding mail messages in the rmail buffer. 1041corresponding mail messages in the rmail buffer.
@@ -1058,10 +1058,6 @@ Commands for sorting the summary:
1058\\[rmail-summary-sort-by-correspondent] Sort by correspondent. 1058\\[rmail-summary-sort-by-correspondent] Sort by correspondent.
1059\\[rmail-summary-sort-by-lines] Sort by lines. 1059\\[rmail-summary-sort-by-lines] Sort by lines.
1060\\[rmail-summary-sort-by-labels] Sort by labels." 1060\\[rmail-summary-sort-by-labels] Sort by labels."
1061 (interactive)
1062 (kill-all-local-variables)
1063 (setq major-mode 'rmail-summary-mode)
1064 (setq mode-name "RMAIL Summary")
1065 (setq truncate-lines t) 1061 (setq truncate-lines t)
1066 (setq buffer-read-only t) 1062 (setq buffer-read-only t)
1067 (set-syntax-table text-mode-syntax-table) 1063 (set-syntax-table text-mode-syntax-table)
@@ -1074,8 +1070,7 @@ Commands for sorting the summary:
1074 (make-local-variable 'revert-buffer-function) 1070 (make-local-variable 'revert-buffer-function)
1075 (make-local-variable 'font-lock-defaults) 1071 (make-local-variable 'font-lock-defaults)
1076 (setq font-lock-defaults '(rmail-summary-font-lock-keywords t)) 1072 (setq font-lock-defaults '(rmail-summary-font-lock-keywords t))
1077 (rmail-summary-enable) 1073 (rmail-summary-enable))
1078 (run-mode-hooks 'rmail-summary-mode-hook))
1079 1074
1080;; Summary features need to be disabled during edit mode. 1075;; Summary features need to be disabled during edit mode.
1081(defun rmail-summary-disable () 1076(defun rmail-summary-disable ()
diff --git a/lisp/man.el b/lisp/man.el
index 34131f43692..9eb0ccd719a 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -413,7 +413,7 @@ Otherwise, the value is whatever the function
413 413
414(defvar Man-topic-history nil "Topic read history.") 414(defvar Man-topic-history nil "Topic read history.")
415 415
416(defvar man-mode-syntax-table 416(defvar Man-mode-syntax-table
417 (let ((table (copy-syntax-table (standard-syntax-table)))) 417 (let ((table (copy-syntax-table (standard-syntax-table))))
418 (modify-syntax-entry ?. "w" table) 418 (modify-syntax-entry ?. "w" table)
419 (modify-syntax-entry ?_ "w" table) 419 (modify-syntax-entry ?_ "w" table)
@@ -1350,7 +1350,7 @@ manpage command."
1350 1350
1351(put 'Man-mode 'mode-class 'special) 1351(put 'Man-mode 'mode-class 'special)
1352 1352
1353(defun Man-mode () 1353(define-derived-mode Man-mode fundamental-mode "Man"
1354 "A mode for browsing Un*x manual pages. 1354 "A mode for browsing Un*x manual pages.
1355 1355
1356The following man commands are available in the buffer. Try 1356The following man commands are available in the buffer. Try
@@ -1387,11 +1387,7 @@ The following variables may be of some use. Try
1387 1387
1388The following key bindings are currently in effect in the buffer: 1388The following key bindings are currently in effect in the buffer:
1389\\{Man-mode-map}" 1389\\{Man-mode-map}"
1390 (interactive) 1390 (setq buffer-auto-save-file-name nil
1391 (kill-all-local-variables)
1392 (setq major-mode 'Man-mode
1393 mode-name "Man"
1394 buffer-auto-save-file-name nil
1395 mode-line-buffer-identification 1391 mode-line-buffer-identification
1396 (list (default-value 'mode-line-buffer-identification) 1392 (list (default-value 'mode-line-buffer-identification)
1397 " {" 'Man-page-mode-string "}") 1393 " {" 'Man-page-mode-string "}")
@@ -1399,8 +1395,6 @@ The following key bindings are currently in effect in the buffer:
1399 buffer-read-only t) 1395 buffer-read-only t)
1400 (buffer-disable-undo) 1396 (buffer-disable-undo)
1401 (auto-fill-mode -1) 1397 (auto-fill-mode -1)
1402 (use-local-map Man-mode-map)
1403 (set-syntax-table man-mode-syntax-table)
1404 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0))) 1398 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
1405 (set (make-local-variable 'outline-regexp) Man-heading-regexp) 1399 (set (make-local-variable 'outline-regexp) Man-heading-regexp)
1406 (set (make-local-variable 'outline-level) (lambda () 1)) 1400 (set (make-local-variable 'outline-level) (lambda () 1))
@@ -1409,8 +1403,7 @@ The following key bindings are currently in effect in the buffer:
1409 (Man-build-page-list) 1403 (Man-build-page-list)
1410 (Man-strip-page-headers) 1404 (Man-strip-page-headers)
1411 (Man-unindent) 1405 (Man-unindent)
1412 (Man-goto-page 1 t) 1406 (Man-goto-page 1 t))
1413 (run-mode-hooks 'Man-mode-hook))
1414 1407
1415(defsubst Man-build-section-alist () 1408(defsubst Man-build-section-alist ()
1416 "Build the list of manpage sections." 1409 "Build the list of manpage sections."
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 825eb3c05d4..bd61c261246 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -491,10 +491,9 @@ to call FUN for any change whatsoever.")
491 (cancel-timer mpc--status-timer) 491 (cancel-timer mpc--status-timer)
492 (setq mpc--status-timer nil))) 492 (setq mpc--status-timer nil)))
493(defun mpc--status-timer-run () 493(defun mpc--status-timer-run ()
494 (condition-case err 494 (with-demoted-errors "MPC: %s"
495 (when (process-get (mpc-proc) 'ready) 495 (when (process-get (mpc-proc) 'ready)
496 (with-local-quit (mpc-status-refresh))) 496 (with-local-quit (mpc-status-refresh)))))
497 (error (message "MPC: %s" err))))
498 497
499(defvar mpc--status-idle-timer nil) 498(defvar mpc--status-idle-timer nil)
500(defun mpc--status-idle-timer-start () 499(defun mpc--status-idle-timer-start ()
@@ -520,9 +519,8 @@ to call FUN for any change whatsoever.")
520 (run-with-idle-timer 10 t 'mpc--status-idle-timer-run)))) 519 (run-with-idle-timer 10 t 'mpc--status-idle-timer-run))))
521(defun mpc--status-idle-timer-run () 520(defun mpc--status-idle-timer-run ()
522 (when (process-get (mpc-proc) 'ready) 521 (when (process-get (mpc-proc) 'ready)
523 (condition-case err 522 (with-demoted-errors "MPC: %s"
524 (with-local-quit (mpc-status-refresh)) 523 (with-local-quit (mpc-status-refresh))))
525 (error (message "MPC: %s" err))))
526 (mpc--status-timer-start)) 524 (mpc--status-timer-start))
527 525
528(defun mpc--status-timers-refresh () 526(defun mpc--status-timers-refresh ()
@@ -999,9 +997,8 @@ If PLAYLIST is t or nil or missing, use the main playlist."
999 (`Cover 997 (`Cover
1000 (let* ((dir (file-name-directory (cdr (assq 'file info)))) 998 (let* ((dir (file-name-directory (cdr (assq 'file info))))
1001 (cover (concat dir "cover.jpg")) 999 (cover (concat dir "cover.jpg"))
1002 (file (condition-case err 1000 (file (with-demoted-errors "MPC: %s"
1003 (mpc-file-local-copy cover) 1001 (mpc-file-local-copy cover)))
1004 (error (message "MPC: %s" err))))
1005 image) 1002 image)
1006 ;; (debug) 1003 ;; (debug)
1007 (push `(equal ',dir (file-name-directory (cdr (assq 'file info)))) pred) 1004 (push `(equal ',dir (file-name-directory (cdr (assq 'file info)))) pred)
diff --git a/lisp/net/eudc-hotlist.el b/lisp/net/eudc-hotlist.el
index a8a51b7d61b..57675a483b2 100644
--- a/lisp/net/eudc-hotlist.el
+++ b/lisp/net/eudc-hotlist.el
@@ -44,7 +44,7 @@
44 (define-key map "x" 'kill-this-buffer) 44 (define-key map "x" 'kill-this-buffer)
45 map)) 45 map))
46 46
47(defun eudc-hotlist-mode () 47(define-derived-mode eudc-hotlist-mode fundamental-mode "EUDC-Servers"
48 "Major mode used to edit the hotlist of servers. 48 "Major mode used to edit the hotlist of servers.
49 49
50These are the special commands of this mode: 50These are the special commands of this mode:
@@ -54,18 +54,12 @@ These are the special commands of this mode:
54 t -- Transpose the server at point and the previous one 54 t -- Transpose the server at point and the previous one
55 q -- Commit the changes and quit. 55 q -- Commit the changes and quit.
56 x -- Quit without committing the changes." 56 x -- Quit without committing the changes."
57 (interactive)
58 (kill-all-local-variables)
59 (setq major-mode 'eudc-hotlist-mode)
60 (setq mode-name "EUDC-Servers")
61 (use-local-map eudc-hotlist-mode-map)
62 (when (featurep 'xemacs) 57 (when (featurep 'xemacs)
63 (setq mode-popup-menu eudc-hotlist-menu) 58 (setq mode-popup-menu eudc-hotlist-menu)
64 (when (featurep 'menubar) 59 (when (featurep 'menubar)
65 (set-buffer-menubar current-menubar) 60 (set-buffer-menubar current-menubar)
66 (add-submenu nil (cons "EUDC-Hotlist" (cdr (cdr eudc-hotlist-menu)))))) 61 (add-submenu nil (cons "EUDC-Hotlist" (cdr (cdr eudc-hotlist-menu))))))
67 (setq buffer-read-only t) 62 (setq buffer-read-only t))
68 (run-mode-hooks 'eudc-hotlist-mode-hook))
69 63
70;;;###autoload 64;;;###autoload
71(defun eudc-edit-hotlist () 65(defun eudc-edit-hotlist ()
@@ -76,10 +70,8 @@ These are the special commands of this mode:
76 (switch-to-buffer (get-buffer-create "*EUDC Servers*")) 70 (switch-to-buffer (get-buffer-create "*EUDC Servers*"))
77 (setq buffer-read-only nil) 71 (setq buffer-read-only nil)
78 (erase-buffer) 72 (erase-buffer)
79 (mapc (function 73 (dolist (entry eudc-server-hotlist)
80 (lambda (entry) 74 (setq proto-col (max (length (car entry)) proto-col)))
81 (setq proto-col (max (length (car entry)) proto-col))))
82 eudc-server-hotlist)
83 (setq proto-col (+ 3 proto-col)) 75 (setq proto-col (+ 3 proto-col))
84 (setq gap (make-string (- proto-col 6) ?\ )) 76 (setq gap (make-string (- proto-col 6) ?\ ))
85 (insert " EUDC Servers\n" 77 (insert " EUDC Servers\n"
@@ -89,17 +81,16 @@ These are the special commands of this mode:
89 "------" gap "--------\n" 81 "------" gap "--------\n"
90 "\n") 82 "\n")
91 (setq eudc-hotlist-list-beginning (point)) 83 (setq eudc-hotlist-list-beginning (point))
92 (mapc (lambda (entry) 84 (dolist (entry eudc-server-hotlist)
93 (insert (car entry)) 85 (insert (car entry))
94 (indent-to proto-col) 86 (indent-to proto-col)
95 (insert (symbol-name (cdr entry)) "\n")) 87 (insert (symbol-name (cdr entry)) "\n"))
96 eudc-server-hotlist) 88 (eudc-hotlist-mode)))
97 (eudc-hotlist-mode)))
98 89
99(defun eudc-hotlist-add-server () 90(defun eudc-hotlist-add-server ()
100 "Add a new server to the list after current one." 91 "Add a new server to the list after current one."
101 (interactive) 92 (interactive)
102 (if (not (eq major-mode 'eudc-hotlist-mode)) 93 (if (not (derived-mode-p 'eudc-hotlist-mode))
103 (error "Not in a EUDC hotlist edit buffer")) 94 (error "Not in a EUDC hotlist edit buffer"))
104 (let ((server (read-from-minibuffer "Server: ")) 95 (let ((server (read-from-minibuffer "Server: "))
105 (protocol (completing-read "Protocol: " 96 (protocol (completing-read "Protocol: "
@@ -117,7 +108,7 @@ These are the special commands of this mode:
117(defun eudc-hotlist-delete-server () 108(defun eudc-hotlist-delete-server ()
118 "Delete the server at point from the list." 109 "Delete the server at point from the list."
119 (interactive) 110 (interactive)
120 (if (not (eq major-mode 'eudc-hotlist-mode)) 111 (if (not (derived-mode-p 'eudc-hotlist-mode))
121 (error "Not in a EUDC hotlist edit buffer")) 112 (error "Not in a EUDC hotlist edit buffer"))
122 (let ((buffer-read-only nil)) 113 (let ((buffer-read-only nil))
123 (save-excursion 114 (save-excursion
@@ -130,7 +121,7 @@ These are the special commands of this mode:
130(defun eudc-hotlist-quit-edit () 121(defun eudc-hotlist-quit-edit ()
131 "Quit the hotlist editing mode and save changes to the hotlist." 122 "Quit the hotlist editing mode and save changes to the hotlist."
132 (interactive) 123 (interactive)
133 (if (not (eq major-mode 'eudc-hotlist-mode)) 124 (if (not (derived-mode-p 'eudc-hotlist-mode))
134 (error "Not in a EUDC hotlist edit buffer")) 125 (error "Not in a EUDC hotlist edit buffer"))
135 (let (hotlist) 126 (let (hotlist)
136 (goto-char eudc-hotlist-list-beginning) 127 (goto-char eudc-hotlist-list-beginning)
@@ -149,7 +140,7 @@ These are the special commands of this mode:
149(defun eudc-hotlist-select-server () 140(defun eudc-hotlist-select-server ()
150 "Select the server at point as the current server." 141 "Select the server at point as the current server."
151 (interactive) 142 (interactive)
152 (if (not (eq major-mode 'eudc-hotlist-mode)) 143 (if (not (derived-mode-p 'eudc-hotlist-mode))
153 (error "Not in a EUDC hotlist edit buffer")) 144 (error "Not in a EUDC hotlist edit buffer"))
154 (save-excursion 145 (save-excursion
155 (beginning-of-line) 146 (beginning-of-line)
@@ -163,7 +154,7 @@ These are the special commands of this mode:
163(defun eudc-hotlist-transpose-servers () 154(defun eudc-hotlist-transpose-servers ()
164 "Swap the order of the server with the previous one in the list." 155 "Swap the order of the server with the previous one in the list."
165 (interactive) 156 (interactive)
166 (if (not (eq major-mode 'eudc-hotlist-mode)) 157 (if (not (derived-mode-p 'eudc-hotlist-mode))
167 (error "Not in a EUDC hotlist edit buffer")) 158 (error "Not in a EUDC hotlist edit buffer"))
168 (let ((buffer-read-only nil)) 159 (let ((buffer-read-only nil))
169 (save-excursion 160 (save-excursion
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index c474ac9380d..453c19b27f9 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -652,7 +652,7 @@ Each copy is added a new field containing one of the values of FIELD."
652 result)) 652 result))
653 653
654 654
655(defun eudc-mode () 655(define-derived-mode eudc-mode special-mode "EUDC"
656 "Major mode used in buffers displaying the results of directory queries. 656 "Major mode used in buffers displaying the results of directory queries.
657There is no sense in calling this command from a buffer other than 657There is no sense in calling this command from a buffer other than
658one containing the results of a directory query. 658one containing the results of a directory query.
@@ -663,15 +663,9 @@ These are the special commands of EUDC mode:
663 n -- Move to next record. 663 n -- Move to next record.
664 p -- Move to previous record. 664 p -- Move to previous record.
665 b -- Insert record at point into the BBDB database." 665 b -- Insert record at point into the BBDB database."
666 (interactive)
667 (kill-all-local-variables)
668 (setq major-mode 'eudc-mode)
669 (setq mode-name "EUDC")
670 (use-local-map eudc-mode-map)
671 (if (not (featurep 'xemacs)) 666 (if (not (featurep 'xemacs))
672 (easy-menu-define eudc-emacs-menu eudc-mode-map "" (eudc-menu)) 667 (easy-menu-define eudc-emacs-menu eudc-mode-map "" (eudc-menu))
673 (setq mode-popup-menu (eudc-menu))) 668 (setq mode-popup-menu (eudc-menu))))
674 (run-mode-hooks 'eudc-mode-hook))
675 669
676;;}}} 670;;}}}
677 671
@@ -1084,7 +1078,7 @@ queries the server for the existing fields and displays a corresponding form."
1084(defun eudc-move-to-next-record () 1078(defun eudc-move-to-next-record ()
1085 "Move to next record, in a buffer displaying directory query results." 1079 "Move to next record, in a buffer displaying directory query results."
1086 (interactive) 1080 (interactive)
1087 (if (not (eq major-mode 'eudc-mode)) 1081 (if (not (derived-mode-p 'eudc-mode))
1088 (error "Not in a EUDC buffer") 1082 (error "Not in a EUDC buffer")
1089 (let ((pt (next-overlay-change (point)))) 1083 (let ((pt (next-overlay-change (point))))
1090 (if (< pt (point-max)) 1084 (if (< pt (point-max))
@@ -1094,7 +1088,7 @@ queries the server for the existing fields and displays a corresponding form."
1094(defun eudc-move-to-previous-record () 1088(defun eudc-move-to-previous-record ()
1095 "Move to previous record, in a buffer displaying directory query results." 1089 "Move to previous record, in a buffer displaying directory query results."
1096 (interactive) 1090 (interactive)
1097 (if (not (eq major-mode 'eudc-mode)) 1091 (if (not (derived-mode-p 'eudc-mode))
1098 (error "Not in a EUDC buffer") 1092 (error "Not in a EUDC buffer")
1099 (let ((pt (previous-overlay-change (point)))) 1093 (let ((pt (previous-overlay-change (point))))
1100 (if (> pt (point-min)) 1094 (if (> pt (point-min))
@@ -1122,7 +1116,7 @@ queries the server for the existing fields and displays a corresponding form."
1122 (overlay-get (car (overlays-at (point))) 'eudc-record)) 1116 (overlay-get (car (overlays-at (point))) 'eudc-record))
1123 :help "Insert record at point into the BBDB database"] 1117 :help "Insert record at point into the BBDB database"]
1124 ["Insert All Records into BBDB" eudc-batch-export-records-to-bbdb 1118 ["Insert All Records into BBDB" eudc-batch-export-records-to-bbdb
1125 (and (eq major-mode 'eudc-mode) 1119 (and (derived-mode-p 'eudc-mode)
1126 (or (featurep 'bbdb) 1120 (or (featurep 'bbdb)
1127 (prog1 (locate-library "bbdb") (message "")))) 1121 (prog1 (locate-library "bbdb") (message ""))))
1128 :help "Insert all the records returned by a directory query into BBDB"] 1122 :help "Insert all the records returned by a directory query into BBDB"]
diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index e6a5f8299ac..f2d404afa58 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -757,31 +757,24 @@ VALUES may contain values for editable fields from current article."
757 map) 757 map)
758 "'mairix-searches-mode' keymap.") 758 "'mairix-searches-mode' keymap.")
759 759
760(defvar mairix-searches-mode-font-lock-keywords) 760(defvar mairix-searches-mode-font-lock-keywords
761 761 '(("^\\([0-9]+\\)"
762(defun mairix-searches-mode () 762 (1 font-lock-constant-face))
763 ("^[0-9 ]+\\(Name:\\) \\(.*\\)"
764 (1 font-lock-keyword-face) (2 font-lock-string-face))
765 ("^[ ]+\\(Query:\\) \\(.*\\) , "
766 (1 font-lock-keyword-face) (2 font-lock-string-face))
767 (", \\(Threads:\\) \\(.*\\)"
768 (1 font-lock-keyword-face) (2 font-lock-constant-face))
769 ("^\\([A-Z].*\\)$"
770 (1 font-lock-comment-face))
771 ("^[ ]+\\(Folder:\\) \\(.*\\)"
772 (1 font-lock-keyword-face) (2 font-lock-string-face))))
773
774(define-derived-mode mairix-searches-mode fundamental-mode "mairix-searches"
763 "Major mode for editing mairix searches." 775 "Major mode for editing mairix searches."
764 (interactive) 776 :syntax-table text-mode-syntax-table
765 (kill-all-local-variables) 777 (setq-local font-lock-defaults '(mairix-searches-mode-font-lock-keywords)))
766 (setq major-mode 'mairix-searches-mode)
767 (setq mode-name "mairix-searches")
768 (set-syntax-table text-mode-syntax-table)
769 (use-local-map mairix-searches-mode-map)
770 (make-local-variable 'font-lock-defaults)
771 (setq mairix-searches-mode-font-lock-keywords
772 (list (list "^\\([0-9]+\\)"
773 '(1 font-lock-constant-face))
774 (list "^[0-9 ]+\\(Name:\\) \\(.*\\)"
775 '(1 font-lock-keyword-face) '(2 font-lock-string-face))
776 (list "^[ ]+\\(Query:\\) \\(.*\\) , "
777 '(1 font-lock-keyword-face) '(2 font-lock-string-face))
778 (list ", \\(Threads:\\) \\(.*\\)"
779 '(1 font-lock-keyword-face) '(2 font-lock-constant-face))
780 (list "^\\([A-Z].*\\)$"
781 '(1 font-lock-comment-face))
782 (list "^[ ]+\\(Folder:\\) \\(.*\\)"
783 '(1 font-lock-keyword-face) '(2 font-lock-string-face))))
784 (setq font-lock-defaults '(mairix-searches-mode-font-lock-keywords)))
785 778
786(defun mairix-build-search-list () 779(defun mairix-build-search-list ()
787 "Display saved searches in current buffer." 780 "Display saved searches in current buffer."
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index d6c8f6f557d..411d4dfdb43 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -1909,13 +1909,9 @@ Return t if groups have changed, nil otherwise."
1909 map) 1909 map)
1910 "Mode map for newsticker treeview.") 1910 "Mode map for newsticker treeview.")
1911 1911
1912(defun newsticker-treeview-mode () 1912(define-derived-mode newsticker-treeview-mode fundamental-mode "Newsticker TV"
1913 "Major mode for Newsticker Treeview. 1913 "Major mode for Newsticker Treeview.
1914\\{newsticker-treeview-mode-map}" 1914\\{newsticker-treeview-mode-map}"
1915 (kill-all-local-variables)
1916 (use-local-map newsticker-treeview-mode-map)
1917 (setq major-mode 'newsticker-treeview-mode)
1918 (setq mode-name "Newsticker TV")
1919 (if (boundp 'tool-bar-map) 1915 (if (boundp 'tool-bar-map)
1920 (set (make-local-variable 'tool-bar-map) 1916 (set (make-local-variable 'tool-bar-map)
1921 newsticker-treeview-tool-bar-map)) 1917 newsticker-treeview-tool-bar-map))
diff --git a/lisp/net/quickurl.el b/lisp/net/quickurl.el
index 1e05d8db336..08ae9574a33 100644
--- a/lisp/net/quickurl.el
+++ b/lisp/net/quickurl.el
@@ -429,18 +429,12 @@ current buffer, this default action can be modified via
429(put 'quickurl-list-mode 'mode-class 'special) 429(put 'quickurl-list-mode 'mode-class 'special)
430 430
431;;;###autoload 431;;;###autoload
432(defun quickurl-list-mode () 432(define-derived-mode quickurl-list-mode fundamental-mode "quickurl list"
433 "A mode for browsing the quickurl URL list. 433 "A mode for browsing the quickurl URL list.
434 434
435The key bindings for `quickurl-list-mode' are: 435The key bindings for `quickurl-list-mode' are:
436 436
437\\{quickurl-list-mode-map}" 437\\{quickurl-list-mode-map}"
438 (interactive)
439 (kill-all-local-variables)
440 (use-local-map quickurl-list-mode-map)
441 (setq major-mode 'quickurl-list-mode
442 mode-name "quickurl list")
443 (run-mode-hooks 'quickurl-list-mode-hook)
444 (setq buffer-read-only t 438 (setq buffer-read-only t
445 truncate-lines t)) 439 truncate-lines t))
446 440
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index a5f59227ef7..595037ab943 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -137,7 +137,7 @@
137 (insert-directory . tramp-adb-handle-insert-directory) 137 (insert-directory . tramp-adb-handle-insert-directory)
138 (insert-file-contents . tramp-handle-insert-file-contents) 138 (insert-file-contents . tramp-handle-insert-file-contents)
139 (load . tramp-handle-load) 139 (load . tramp-handle-load)
140 ;; `make-auto-save-file-name' performed by default handler. 140 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
141 (make-directory . tramp-adb-handle-make-directory) 141 (make-directory . tramp-adb-handle-make-directory)
142 (make-directory-internal . ignore) 142 (make-directory-internal . ignore)
143 (make-symbolic-link . ignore) 143 (make-symbolic-link . ignore)
@@ -407,9 +407,9 @@ Convert (\"-al\") to (\"-a\" \"-l\"). Remove arguments like \"--dired\"."
407 (split-string 407 (split-string
408 (apply 'concat 408 (apply 'concat
409 (mapcar (lambda (s) 409 (mapcar (lambda (s)
410 (replace-regexp-in-string 410 (tramp-compat-replace-regexp-in-string
411 "\\(.\\)" " -\\1" 411 "\\(.\\)" " -\\1"
412 (replace-regexp-in-string "^-" "" s))) 412 (tramp-compat-replace-regexp-in-string "^-" "" s)))
413 ;; FIXME: Warning about removed switches (long and non-dash). 413 ;; FIXME: Warning about removed switches (long and non-dash).
414 (delq nil 414 (delq nil
415 (mapcar 415 (mapcar
@@ -1153,11 +1153,11 @@ connection if a previous connection has died for some reason."
1153 (read (current-buffer)))))) 1153 (read (current-buffer))))))
1154 (when (and (stringp old-getprop) 1154 (when (and (stringp old-getprop)
1155 (not (string-equal old-getprop new-getprop))) 1155 (not (string-equal old-getprop new-getprop)))
1156 (tramp-cleanup vec)
1157 (tramp-message 1156 (tramp-message
1158 vec 3 1157 vec 3
1159 "Connection reset, because remote host changed from `%s' to `%s'" 1158 "Connection reset, because remote host changed from `%s' to `%s'"
1160 old-getprop new-getprop) 1159 old-getprop new-getprop)
1160 (tramp-cleanup-connection vec t)
1161 (tramp-adb-maybe-open-connection vec))) 1161 (tramp-adb-maybe-open-connection vec)))
1162 1162
1163 ;; Change user if indicated. 1163 ;; Change user if indicated.
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index b89c5124721..b4e5e4ffd0f 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -289,7 +289,12 @@ KEY identifies the connection, it is either a process or a vector."
289 (when (vectorp key) 289 (when (vectorp key)
290 (dotimes (i (length key)) 290 (dotimes (i (length key))
291 (when (stringp (aref key i)) 291 (when (stringp (aref key i))
292 (aset key i (substring-no-properties (aref key i)))))) 292 (aset key i
293 (funcall
294 ;; `substring-no-properties' does not exist in XEmacs.
295 (if (functionp 'substring-no-properties)
296 'substring-no-properties 'identity)
297 (aref key i))))))
293 (let ((tmp (format 298 (let ((tmp (format
294 "(%s %s)" 299 "(%s %s)"
295 (if (processp key) 300 (if (processp key)
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 937db34a346..5015929534d 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -55,9 +55,11 @@
55 (buffer-list)))) 55 (buffer-list))))
56 56
57;;;###tramp-autoload 57;;;###tramp-autoload
58(defun tramp-cleanup-connection (vec) 58(defun tramp-cleanup-connection (vec &optional keep-debug keep-password)
59 "Flush all connection related objects. 59 "Flush all connection related objects.
60This includes password cache, file cache, connection cache, buffers. 60This includes password cache, file cache, connection cache,
61buffers. KEEP-DEBUG non-nil preserves the debug buffer.
62KEEP-PASSWORD non-nil preserves the password cache.
61When called interactively, a Tramp connection has to be selected." 63When called interactively, a Tramp connection has to be selected."
62 (interactive 64 (interactive
63 ;; When interactive, select the Tramp remote identification. 65 ;; When interactive, select the Tramp remote identification.
@@ -80,14 +82,15 @@ When called interactively, a Tramp connection has to be selected."
80 "Enter Tramp connection: " connections nil t 82 "Enter Tramp connection: " connections nil t
81 (try-completion "" connections))) 83 (try-completion "" connections)))
82 (when (and name (file-remote-p name)) 84 (when (and name (file-remote-p name))
83 (with-parsed-tramp-file-name name nil v)))))) 85 (with-parsed-tramp-file-name name nil v))))
86 nil nil))
84 87
85 (if (not vec) 88 (if (not vec)
86 ;; Nothing to do. 89 ;; Nothing to do.
87 (message "No Tramp connection found.") 90 (message "No Tramp connection found.")
88 91
89 ;; Flush password cache. 92 ;; Flush password cache.
90 (tramp-clear-passwd vec) 93 (unless keep-password (tramp-clear-passwd vec))
91 94
92 ;; Flush file cache. 95 ;; Flush file cache.
93 (tramp-flush-directory-property vec "") 96 (tramp-flush-directory-property vec "")
@@ -101,7 +104,8 @@ When called interactively, a Tramp connection has to be selected."
101 ;; Remove buffers. 104 ;; Remove buffers.
102 (dolist 105 (dolist
103 (buf (list (get-buffer (tramp-buffer-name vec)) 106 (buf (list (get-buffer (tramp-buffer-name vec))
104 (get-buffer (tramp-debug-buffer-name vec)) 107 (unless keep-debug
108 (get-buffer (tramp-debug-buffer-name vec)))
105 (tramp-get-connection-property vec "process-buffer" nil))) 109 (tramp-get-connection-property vec "process-buffer" nil)))
106 (when (bufferp buf) (kill-buffer buf))))) 110 (when (bufferp buf) (kill-buffer buf)))))
107 111
@@ -190,7 +194,9 @@ This includes password cache, file cache, connection cache, buffers."
190 194
191 'tramp-load-report-modules ; pre-hook 195 'tramp-load-report-modules ; pre-hook
192 'tramp-append-tramp-buffers ; post-hook 196 'tramp-append-tramp-buffers ; post-hook
193 (propertize "\n" 'display "\ 197 (funcall
198 (if (functionp 'propertize) 'propertize 'progn)
199 "\n" 'display "\
194Enter your bug report in this message, including as much detail 200Enter your bug report in this message, including as much detail
195as you possibly can about the problem, what you did to cause it 201as you possibly can about the problem, what you did to cause it
196and what the local and remote machines are. 202and what the local and remote machines are.
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 8f9d9d8fee5..ca70c1384cb 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -313,13 +313,21 @@ Not actually used. Use `(format \"%o\" i)' instead?"
313 "Like `copy-file' for Tramp files (compat function)." 313 "Like `copy-file' for Tramp files (compat function)."
314 (cond 314 (cond
315 (preserve-extended-attributes 315 (preserve-extended-attributes
316 (tramp-compat-funcall 316 (condition-case nil
317 'copy-file filename newname ok-if-already-exists keep-date 317 (tramp-compat-funcall
318 preserve-uid-gid preserve-extended-attributes)) 318 'copy-file filename newname ok-if-already-exists keep-date
319 preserve-uid-gid preserve-extended-attributes)
320 (wrong-number-of-arguments
321 (tramp-compat-copy-file
322 filename newname ok-if-already-exists keep-date preserve-uid-gid))))
319 (preserve-uid-gid 323 (preserve-uid-gid
320 (tramp-compat-funcall 324 (condition-case nil
321 'copy-file filename newname ok-if-already-exists keep-date 325 (tramp-compat-funcall
322 preserve-uid-gid)) 326 'copy-file filename newname ok-if-already-exists keep-date
327 preserve-uid-gid)
328 (wrong-number-of-arguments
329 (tramp-compat-copy-file
330 filename newname ok-if-already-exists keep-date))))
323 (t 331 (t
324 (copy-file filename newname ok-if-already-exists keep-date)))) 332 (copy-file filename newname ok-if-already-exists keep-date))))
325 333
@@ -518,6 +526,58 @@ EOL-TYPE can be one of `dos', `unix', or `mac'."
518 "`dos', `unix', or `mac'"))))) 526 "`dos', `unix', or `mac'")))))
519 (t (error "Can't change EOL conversion -- is MULE missing?")))) 527 (t (error "Can't change EOL conversion -- is MULE missing?"))))
520 528
529;; `replace-regexp-in-string' does not exist in XEmacs.
530;; Implementation is taken from Emacs 24.
531(if (fboundp 'replace-regexp-in-string)
532 (defalias 'tramp-compat-replace-regexp-in-string 'replace-regexp-in-string)
533 (defun tramp-compat-replace-regexp-in-string
534 (regexp rep string &optional fixedcase literal subexp start)
535 "Replace all matches for REGEXP with REP in STRING.
536
537Return a new string containing the replacements.
538
539Optional arguments FIXEDCASE, LITERAL and SUBEXP are like the
540arguments with the same names of function `replace-match'. If START
541is non-nil, start replacements at that index in STRING.
542
543REP is either a string used as the NEWTEXT arg of `replace-match' or a
544function. If it is a function, it is called with the actual text of each
545match, and its value is used as the replacement text. When REP is called,
546the match data are the result of matching REGEXP against a substring
547of STRING.
548
549To replace only the first match (if any), make REGEXP match up to \\'
550and replace a sub-expression, e.g.
551 (replace-regexp-in-string \"\\\\(foo\\\\).*\\\\'\" \"bar\" \" foo foo\" nil nil 1)
552 => \" bar foo\""
553
554 (let ((l (length string))
555 (start (or start 0))
556 matches str mb me)
557 (save-match-data
558 (while (and (< start l) (string-match regexp string start))
559 (setq mb (match-beginning 0)
560 me (match-end 0))
561 ;; If we matched the empty string, make sure we advance by one char
562 (when (= me mb) (setq me (min l (1+ mb))))
563 ;; Generate a replacement for the matched substring.
564 ;; Operate only on the substring to minimize string consing.
565 ;; Set up match data for the substring for replacement;
566 ;; presumably this is likely to be faster than munging the
567 ;; match data directly in Lisp.
568 (string-match regexp (setq str (substring string mb me)))
569 (setq matches
570 (cons (replace-match (if (stringp rep)
571 rep
572 (funcall rep (match-string 0 str)))
573 fixedcase literal str subexp)
574 (cons (substring string start mb) ; unmatched prefix
575 matches)))
576 (setq start me))
577 ;; Reconstruct a string from the pieces.
578 (setq matches (cons (substring string start l) matches)) ; leftover
579 (apply #'concat (nreverse matches))))))
580
521(add-hook 'tramp-unload-hook 581(add-hook 'tramp-unload-hook
522 (lambda () 582 (lambda ()
523 (unload-feature 'tramp-compat 'force))) 583 (unload-feature 'tramp-compat 'force)))
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index a1ead96eaea..e764e4767dd 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -453,7 +453,7 @@ Every entry is a list (NAME ADDRESS).")
453 (insert-directory . tramp-gvfs-handle-insert-directory) 453 (insert-directory . tramp-gvfs-handle-insert-directory)
454 (insert-file-contents . tramp-gvfs-handle-insert-file-contents) 454 (insert-file-contents . tramp-gvfs-handle-insert-file-contents)
455 (load . tramp-handle-load) 455 (load . tramp-handle-load)
456 ;; `make-auto-save-file-name' performed by default handler. 456 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
457 (make-directory . tramp-gvfs-handle-make-directory) 457 (make-directory . tramp-gvfs-handle-make-directory)
458 (make-directory-internal . ignore) 458 (make-directory-internal . ignore)
459 (make-symbolic-link . ignore) 459 (make-symbolic-link . ignore)
@@ -594,15 +594,19 @@ is no information where to trace the message.")
594 (and (tramp-tramp-file-p newname) 594 (and (tramp-tramp-file-p newname)
595 (not (tramp-gvfs-file-name-p newname)))) 595 (not (tramp-gvfs-file-name-p newname))))
596 596
597 ;; We cannot copy directly. 597 ;; We cannot call `copy-file' directly. Use
598 ;; `tramp-compat-funcall' for backward compatibility (number
599 ;; of arguments).
598 (let ((tmpfile (tramp-compat-make-temp-file filename))) 600 (let ((tmpfile (tramp-compat-make-temp-file filename)))
599 (cond 601 (cond
600 (preserve-extended-attributes 602 (preserve-extended-attributes
601 (copy-file 603 (tramp-compat-funcall
604 'copy-file
602 filename tmpfile t keep-date preserve-uid-gid 605 filename tmpfile t keep-date preserve-uid-gid
603 preserve-extended-attributes)) 606 preserve-extended-attributes))
604 (preserve-uid-gid 607 (preserve-uid-gid
605 (copy-file filename tmpfile t keep-date preserve-uid-gid)) 608 (tramp-compat-funcall
609 'copy-file filename tmpfile t keep-date preserve-uid-gid))
606 (t 610 (t
607 (copy-file filename tmpfile t keep-date))) 611 (copy-file filename tmpfile t keep-date)))
608 (rename-file tmpfile newname ok-if-already-exists)) 612 (rename-file tmpfile newname ok-if-already-exists))
@@ -950,7 +954,7 @@ is no information where to trace the message.")
950 (tramp-message proc 6 "%S\n%s" proc string) 954 (tramp-message proc 6 "%S\n%s" proc string)
951 (setq string (concat rest-string string) 955 (setq string (concat rest-string string)
952 ;; Attribute change is returned in unused wording. 956 ;; Attribute change is returned in unused wording.
953 string (replace-regexp-in-string 957 string (tramp-compat-replace-regexp-in-string
954 "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) 958 "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string))
955 959
956 (while (string-match 960 (while (string-match
@@ -960,7 +964,7 @@ is no information where to trace the message.")
960 "Event = \\([^[:blank:]]+\\)[\n\r]+") 964 "Event = \\([^[:blank:]]+\\)[\n\r]+")
961 string) 965 string)
962 (let ((action (intern-soft 966 (let ((action (intern-soft
963 (replace-regexp-in-string 967 (tramp-compat-replace-regexp-in-string
964 "_" "-" (downcase (match-string 2 string))))) 968 "_" "-" (downcase (match-string 2 string)))))
965 (file (match-string 1 string))) 969 (file (match-string 1 string)))
966 (setq string (replace-match "" nil nil string)) 970 (setq string (replace-match "" nil nil string))
@@ -1158,7 +1162,8 @@ is no information where to trace the message.")
1158(defun tramp-gvfs-file-name (object-path) 1162(defun tramp-gvfs-file-name (object-path)
1159 "Retrieve file name from D-Bus OBJECT-PATH." 1163 "Retrieve file name from D-Bus OBJECT-PATH."
1160 (dbus-unescape-from-identifier 1164 (dbus-unescape-from-identifier
1161 (replace-regexp-in-string "^.*/\\([^/]+\\)$" "\\1" object-path))) 1165 (tramp-compat-replace-regexp-in-string
1166 "^.*/\\([^/]+\\)$" "\\1" object-path)))
1162 1167
1163(defun tramp-bluez-address (device) 1168(defun tramp-bluez-address (device)
1164 "Return bluetooth device address from a given bluetooth DEVICE name." 1169 "Return bluetooth device address from a given bluetooth DEVICE name."
@@ -1709,11 +1714,13 @@ They are retrieved from the hal daemon."
1709 (when (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t 1714 (when (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t
1710 :system tramp-hal-service device tramp-hal-interface-device 1715 :system tramp-hal-service device tramp-hal-interface-device
1711 "PropertyExists" "sync.plugin") 1716 "PropertyExists" "sync.plugin")
1712 (pushnew 1717 (let ((prop
1713 (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t 1718 (with-tramp-dbus-call-method
1714 :system tramp-hal-service device tramp-hal-interface-device 1719 tramp-gvfs-dbus-event-vector t
1715 "GetPropertyString" "pda.pocketpc.name") 1720 :system tramp-hal-service device tramp-hal-interface-device
1716 tramp-synce-devices :test #'equal))) 1721 "GetPropertyString" "pda.pocketpc.name")))
1722 (unless (member prop tramp-synce-devices)
1723 (push prop tramp-synce-devices)))))
1717 (tramp-message tramp-gvfs-dbus-event-vector 10 "%s" tramp-synce-devices) 1724 (tramp-message tramp-gvfs-dbus-event-vector 10 "%s" tramp-synce-devices)
1718 tramp-synce-devices)) 1725 tramp-synce-devices))
1719 1726
diff --git a/lisp/net/tramp-gw.el b/lisp/net/tramp-gw.el
index 53dbdbc45d4..e2c7461228f 100644
--- a/lisp/net/tramp-gw.el
+++ b/lisp/net/tramp-gw.el
@@ -238,7 +238,7 @@ authentication is requested from proxy server, provide it."
238 tramp-gw-vector 6 "\n%s" 238 tramp-gw-vector 6 "\n%s"
239 (format 239 (format
240 "%s%s\r\n" command 240 "%s%s\r\n" command
241 (replace-regexp-in-string ;; no password in trace! 241 (tramp-compat-replace-regexp-in-string ;; no password in trace!
242 "Basic [^\r\n]+" "Basic xxxxx" authentication t))) 242 "Basic [^\r\n]+" "Basic xxxxx" authentication t)))
243 (with-current-buffer buffer 243 (with-current-buffer buffer
244 ;; Trap errors to be traced in the right trace buffer. Often, 244 ;; Trap errors to be traced in the right trace buffer. Often,
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 8ca94122af1..f91cbb29a1d 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -850,7 +850,7 @@ of command line.")
850 (insert-file-contents-literally 850 (insert-file-contents-literally
851 . tramp-sh-handle-insert-file-contents-literally) 851 . tramp-sh-handle-insert-file-contents-literally)
852 (load . tramp-handle-load) 852 (load . tramp-handle-load)
853 (make-auto-save-file-name . tramp-sh-handle-make-auto-save-file-name) 853 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
854 (make-directory . tramp-sh-handle-make-directory) 854 (make-directory . tramp-sh-handle-make-directory)
855 (make-symbolic-link . tramp-sh-handle-make-symbolic-link) 855 (make-symbolic-link . tramp-sh-handle-make-symbolic-link)
856 (process-file . tramp-sh-handle-process-file) 856 (process-file . tramp-sh-handle-process-file)
@@ -2978,48 +2978,6 @@ the result will be a local, non-Tramp, filename."
2978 (fset 'find-buffer-file-type find-buffer-file-type-function) 2978 (fset 'find-buffer-file-type find-buffer-file-type-function)
2979 (fmakunbound 'find-buffer-file-type))))) 2979 (fmakunbound 'find-buffer-file-type)))))
2980 2980
2981(defun tramp-sh-handle-make-auto-save-file-name ()
2982 "Like `make-auto-save-file-name' for Tramp files.
2983Returns a file name in `tramp-auto-save-directory' for autosaving this file."
2984 (let ((tramp-auto-save-directory tramp-auto-save-directory)
2985 (buffer-file-name
2986 (tramp-subst-strs-in-string
2987 '(("_" . "|")
2988 ("/" . "_a")
2989 (":" . "_b")
2990 ("|" . "__")
2991 ("[" . "_l")
2992 ("]" . "_r"))
2993 (buffer-file-name))))
2994 ;; File name must be unique. This is ensured with Emacs 22 (see
2995 ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for
2996 ;; all other cases we must do it ourselves.
2997 (when (boundp 'auto-save-file-name-transforms)
2998 (mapc
2999 (lambda (x)
3000 (when (and (string-match (car x) buffer-file-name)
3001 (not (car (cddr x))))
3002 (setq tramp-auto-save-directory
3003 (or tramp-auto-save-directory
3004 (tramp-compat-temporary-file-directory)))))
3005 (symbol-value 'auto-save-file-name-transforms)))
3006 ;; Create directory.
3007 (when tramp-auto-save-directory
3008 (setq buffer-file-name
3009 (expand-file-name buffer-file-name tramp-auto-save-directory))
3010 (unless (file-exists-p tramp-auto-save-directory)
3011 (make-directory tramp-auto-save-directory t)))
3012 ;; Run plain `make-auto-save-file-name'. There might be an advice when
3013 ;; it is not a magic file name operation (since Emacs 22).
3014 ;; We must deactivate it temporarily.
3015 (if (not (ad-is-active 'make-auto-save-file-name))
3016 (tramp-run-real-handler 'make-auto-save-file-name nil)
3017 ;; else
3018 (ad-deactivate 'make-auto-save-file-name)
3019 (prog1
3020 (tramp-run-real-handler 'make-auto-save-file-name nil)
3021 (ad-activate 'make-auto-save-file-name)))))
3022
3023;; CCC grok LOCKNAME 2981;; CCC grok LOCKNAME
3024(defun tramp-sh-handle-write-region 2982(defun tramp-sh-handle-write-region
3025 (start end filename &optional append visit lockname confirm) 2983 (start end filename &optional append visit lockname confirm)
@@ -3425,7 +3383,7 @@ Fall back to normal file name handler if no Tramp handler exists."
3425 (tramp-message proc 6 "%S\n%s" proc string) 3383 (tramp-message proc 6 "%S\n%s" proc string)
3426 (setq string (concat rest-string string) 3384 (setq string (concat rest-string string)
3427 ;; Attribute change is returned in unused wording. 3385 ;; Attribute change is returned in unused wording.
3428 string (replace-regexp-in-string 3386 string (tramp-compat-replace-regexp-in-string
3429 "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) 3387 "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string))
3430 3388
3431 (while (string-match 3389 (while (string-match
@@ -3439,7 +3397,7 @@ Fall back to normal file name handler if no Tramp handler exists."
3439 (list 3397 (list
3440 proc 3398 proc
3441 (intern-soft 3399 (intern-soft
3442 (replace-regexp-in-string 3400 (tramp-compat-replace-regexp-in-string
3443 "_" "-" (downcase (match-string 4 string)))) 3401 "_" "-" (downcase (match-string 4 string))))
3444 ;; File names are returned as absolute paths. We must 3402 ;; File names are returned as absolute paths. We must
3445 ;; add the remote prefix. 3403 ;; add the remote prefix.
@@ -3475,7 +3433,8 @@ Fall back to normal file name handler if no Tramp handler exists."
3475 proc 3433 proc
3476 (mapcar 3434 (mapcar
3477 (lambda (x) 3435 (lambda (x)
3478 (intern-soft (replace-regexp-in-string "_" "-" (downcase x)))) 3436 (intern-soft
3437 (tramp-compat-replace-regexp-in-string "_" "-" (downcase x))))
3479 (split-string (match-string 1 line) "," 'omit-nulls)) 3438 (split-string (match-string 1 line) "," 'omit-nulls))
3480 (match-string 3 line)))) 3439 (match-string 3 line))))
3481 ;; Usually, we would add an Emacs event now. Unfortunately, 3440 ;; Usually, we would add an Emacs event now. Unfortunately,
@@ -3846,11 +3805,12 @@ process to set up. VEC specifies the connection."
3846 vec "uname" 3805 vec "uname"
3847 (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) 3806 (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))
3848 (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) 3807 (when (and (stringp old-uname) (not (string-equal old-uname new-uname)))
3849 (tramp-cleanup vec)
3850 (tramp-message 3808 (tramp-message
3851 vec 3 3809 vec 3
3852 "Connection reset, because remote host changed from `%s' to `%s'" 3810 "Connection reset, because remote host changed from `%s' to `%s'"
3853 old-uname new-uname) 3811 old-uname new-uname)
3812 ;; We want to keep the password.
3813 (tramp-cleanup-connection vec t t)
3854 (throw 'uname-changed (tramp-maybe-open-connection vec)))) 3814 (throw 'uname-changed (tramp-maybe-open-connection vec))))
3855 3815
3856 ;; Check whether the remote host suffers from buggy 3816 ;; Check whether the remote host suffers from buggy
@@ -4252,7 +4212,7 @@ Gateway hops are already opened."
4252 ?h (or (tramp-file-name-host (car target-alist)) "")))) 4212 ?h (or (tramp-file-name-host (car target-alist)) ""))))
4253 (with-parsed-tramp-file-name proxy l 4213 (with-parsed-tramp-file-name proxy l
4254 ;; Add the hop. 4214 ;; Add the hop.
4255 (pushnew l target-alist :test #'equal) 4215 (push l target-alist)
4256 ;; Start next search. 4216 ;; Start next search.
4257 (setq choices tramp-default-proxies-alist))))) 4217 (setq choices tramp-default-proxies-alist)))))
4258 4218
@@ -4270,11 +4230,11 @@ Gateway hops are already opened."
4270 vec 'file-error 4230 vec 'file-error
4271 "Connection `%s' is not supported for gateway access." hop)) 4231 "Connection `%s' is not supported for gateway access." hop))
4272 ;; Open the gateway connection. 4232 ;; Open the gateway connection.
4273 (pushnew 4233 (push
4274 (vector 4234 (vector
4275 (tramp-file-name-method hop) (tramp-file-name-user hop) 4235 (tramp-file-name-method hop) (tramp-file-name-user hop)
4276 (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil nil) 4236 (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil nil)
4277 target-alist :test #'equal) 4237 target-alist)
4278 ;; For the password prompt, we need the correct values. 4238 ;; For the password prompt, we need the correct values.
4279 ;; Therefore, we must remember the gateway vector. But we 4239 ;; Therefore, we must remember the gateway vector. But we
4280 ;; cannot do it as connection property, because it shouldn't 4240 ;; cannot do it as connection property, because it shouldn't
@@ -4328,68 +4288,68 @@ Does not do anything if a connection is already open, but re-opens the
4328connection if a previous connection has died for some reason." 4288connection if a previous connection has died for some reason."
4329 (tramp-check-proper-host vec) 4289 (tramp-check-proper-host vec)
4330 4290
4331 (catch 'uname-changed 4291 (let ((p (tramp-get-connection-process vec))
4332 (let ((p (tramp-get-connection-process vec)) 4292 (process-name (tramp-get-connection-property vec "process-name" nil))
4333 (process-name (tramp-get-connection-property vec "process-name" nil)) 4293 (process-environment (copy-sequence process-environment))
4334 (process-environment (copy-sequence process-environment)) 4294 (pos (with-current-buffer (tramp-get-connection-buffer vec) (point))))
4335 (pos (with-current-buffer (tramp-get-connection-buffer vec) (point)))) 4295
4336 4296 ;; If Tramp opens the same connection within a short time frame,
4337 ;; If Tramp opens the same connection within a short time frame, 4297 ;; there is a problem. We shall signal this.
4338 ;; there is a problem. We shall signal this. 4298 (unless (or (and p (processp p) (memq (process-status p) '(run open)))
4339 (unless (or (and p (processp p) (memq (process-status p) '(run open))) 4299 (not (equal (butlast (append vec nil) 2)
4340 (not (equal (butlast (append vec nil) 2) 4300 (car tramp-current-connection)))
4341 (car tramp-current-connection))) 4301 (> (tramp-time-diff
4342 (> (tramp-time-diff 4302 (current-time) (cdr tramp-current-connection))
4343 (current-time) (cdr tramp-current-connection)) 4303 (or tramp-connection-min-time-diff 0)))
4344 (or tramp-connection-min-time-diff 0))) 4304 (throw 'suppress 'suppress))
4345 (throw 'suppress 'suppress)) 4305
4346 4306 ;; If too much time has passed since last command was sent, look
4347 ;; If too much time has passed since last command was sent, look 4307 ;; whether process is still alive. If it isn't, kill it. When
4348 ;; whether process is still alive. If it isn't, kill it. When 4308 ;; using ssh, it can sometimes happen that the remote end has hung
4349 ;; using ssh, it can sometimes happen that the remote end has 4309 ;; up but the local ssh client doesn't recognize this until it
4350 ;; hung up but the local ssh client doesn't recognize this until 4310 ;; tries to send some data to the remote end. So that's why we
4351 ;; it tries to send some data to the remote end. So that's why 4311 ;; try to send a command from time to time, then look again
4352 ;; we try to send a command from time to time, then look again 4312 ;; whether the process is really alive.
4353 ;; whether the process is really alive. 4313 (condition-case nil
4354 (condition-case nil 4314 (when (and (> (tramp-time-diff
4355 (when (and (> (tramp-time-diff 4315 (current-time)
4356 (current-time) 4316 (tramp-get-connection-property
4357 (tramp-get-connection-property 4317 p "last-cmd-time" '(0 0 0)))
4358 p "last-cmd-time" '(0 0 0))) 4318 60)
4359 60) 4319 p (processp p) (memq (process-status p) '(run open)))
4360 p (processp p) (memq (process-status p) '(run open))) 4320 (tramp-send-command vec "echo are you awake" t t)
4361 (tramp-send-command vec "echo are you awake" t t) 4321 (unless (and (memq (process-status p) '(run open))
4362 (unless (and (memq (process-status p) '(run open)) 4322 (tramp-wait-for-output p 10))
4363 (tramp-wait-for-output p 10)) 4323 ;; The error will be caught locally.
4364 ;; The error will be caught locally. 4324 (tramp-error vec 'file-error "Awake did fail")))
4365 (tramp-error vec 'file-error "Awake did fail"))) 4325 (file-error
4366 (file-error 4326 (tramp-cleanup-connection vec t)
4367 (tramp-cleanup vec) 4327 (setq p nil)))
4368 (setq p nil))) 4328
4369 4329 ;; New connection must be opened.
4370 ;; New connection must be opened. 4330 (condition-case err
4371 (condition-case err 4331 (unless (and p (processp p) (memq (process-status p) '(run open)))
4372 (unless (and p (processp p) (memq (process-status p) '(run open))) 4332
4373 4333 ;; We call `tramp-get-buffer' in order to get a debug buffer
4374 ;; We call `tramp-get-buffer' in order to get a debug 4334 ;; for messages from the beginning.
4375 ;; buffer for messages from the beginning. 4335 (tramp-get-buffer vec)
4376 (tramp-get-buffer vec) 4336
4377 4337 ;; If `non-essential' is non-nil, don't reopen a new connection.
4378 ;; If `non-essential' is non-nil, don't reopen a new connection. 4338 (when (and (boundp 'non-essential) (symbol-value 'non-essential))
4379 (when (and (boundp 'non-essential) (symbol-value 'non-essential)) 4339 (throw 'non-essential 'non-essential))
4380 (throw 'non-essential 'non-essential)) 4340
4381 4341 (with-tramp-progress-reporter
4382 (with-tramp-progress-reporter 4342 vec 3
4383 vec 3 4343 (if (zerop (length (tramp-file-name-user vec)))
4384 (if (zerop (length (tramp-file-name-user vec))) 4344 (format "Opening connection for %s using %s"
4385 (format "Opening connection for %s using %s"
4386 (tramp-file-name-host vec)
4387 (tramp-file-name-method vec))
4388 (format "Opening connection for %s@%s using %s"
4389 (tramp-file-name-user vec)
4390 (tramp-file-name-host vec) 4345 (tramp-file-name-host vec)
4391 (tramp-file-name-method vec))) 4346 (tramp-file-name-method vec))
4347 (format "Opening connection for %s@%s using %s"
4348 (tramp-file-name-user vec)
4349 (tramp-file-name-host vec)
4350 (tramp-file-name-method vec)))
4392 4351
4352 (catch 'uname-changed
4393 ;; Start new process. 4353 ;; Start new process.
4394 (when (and p (processp p)) 4354 (when (and p (processp p))
4395 (delete-process p)) 4355 (delete-process p))
@@ -4544,13 +4504,13 @@ connection if a previous connection has died for some reason."
4544 target-alist (cdr target-alist))) 4504 target-alist (cdr target-alist)))
4545 4505
4546 ;; Make initial shell settings. 4506 ;; Make initial shell settings.
4547 (tramp-open-connection-setup-interactive-shell p vec)))) 4507 (tramp-open-connection-setup-interactive-shell p vec)))))
4548 4508
4549 ;; When the user did interrupt, we must cleanup. 4509 ;; When the user did interrupt, we must cleanup.
4550 (quit 4510 (quit
4551 (tramp-cleanup vec) 4511 (tramp-cleanup-connection vec t)
4552 ;; Propagate the quit signal. 4512 ;; Propagate the quit signal.
4553 (signal (car err) (cdr err))))))) 4513 (signal (car err) (cdr err))))))
4554 4514
4555(defun tramp-send-command (vec command &optional neveropen nooutput) 4515(defun tramp-send-command (vec command &optional neveropen nooutput)
4556 "Send the COMMAND to connection VEC. 4516 "Send the COMMAND to connection VEC.
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index f05a54f46f7..27f3bd41e9c 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -229,7 +229,7 @@ See `tramp-actions-before-shell' for more info.")
229 (insert-directory . tramp-smb-handle-insert-directory) 229 (insert-directory . tramp-smb-handle-insert-directory)
230 (insert-file-contents . tramp-handle-insert-file-contents) 230 (insert-file-contents . tramp-handle-insert-file-contents)
231 (load . tramp-handle-load) 231 (load . tramp-handle-load)
232 ;; `make-auto-save-file-name' performed by default handler. 232 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
233 (make-directory . tramp-smb-handle-make-directory) 233 (make-directory . tramp-smb-handle-make-directory)
234 (make-directory-internal . tramp-smb-handle-make-directory-internal) 234 (make-directory-internal . tramp-smb-handle-make-directory-internal)
235 (make-symbolic-link . tramp-smb-handle-make-symbolic-link) 235 (make-symbolic-link . tramp-smb-handle-make-symbolic-link)
@@ -403,7 +403,7 @@ pass to the OPERATION."
403 (port (tramp-file-name-port v)) 403 (port (tramp-file-name-port v))
404 (share (tramp-smb-get-share v)) 404 (share (tramp-smb-get-share v))
405 (localname (file-name-as-directory 405 (localname (file-name-as-directory
406 (replace-regexp-in-string 406 (tramp-compat-replace-regexp-in-string
407 "\\\\" "/" (tramp-smb-get-localname v)))) 407 "\\\\" "/" (tramp-smb-get-localname v))))
408 (tmpdir (make-temp-name 408 (tmpdir (make-temp-name
409 (expand-file-name 409 (expand-file-name
@@ -537,7 +537,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
537 (unless (tramp-smb-send-command 537 (unless (tramp-smb-send-command
538 v (format "put \"%s\" \"%s\"" 538 v (format "put \"%s\" \"%s\""
539 filename (tramp-smb-get-localname v))) 539 filename (tramp-smb-get-localname v)))
540 (tramp-error v 'file-error "Cannot copy `%s'" filename)))))) 540 (tramp-error
541 v 'file-error "Cannot copy `%s' to `%s'" filename newname))))))
541 542
542 ;; KEEP-DATE handling. 543 ;; KEEP-DATE handling.
543 (when keep-date 544 (when keep-date
@@ -1151,7 +1152,8 @@ target of the symlink differ."
1151 (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) 1152 (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
1152 0 (format "Renaming %s to %s" filename newname) 1153 0 (format "Renaming %s to %s" filename newname)
1153 1154
1154 (if (and (tramp-equal-remote filename newname) 1155 (if (and (not (file-exists-p newname))
1156 (tramp-equal-remote filename newname)
1155 (string-equal 1157 (string-equal
1156 (tramp-smb-get-share (tramp-dissect-file-name filename)) 1158 (tramp-smb-get-share (tramp-dissect-file-name filename))
1157 (tramp-smb-get-share (tramp-dissect-file-name newname)))) 1159 (tramp-smb-get-share (tramp-dissect-file-name newname))))
@@ -1364,14 +1366,14 @@ Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
1364 (while (not (eobp)) 1366 (while (not (eobp))
1365 (setq entry (tramp-smb-read-file-entry share)) 1367 (setq entry (tramp-smb-read-file-entry share))
1366 (forward-line) 1368 (forward-line)
1367 (when entry (pushnew entry res :test #'equal)))) 1369 (when entry (push entry res))))
1368 1370
1369 ;; Cache share entries. 1371 ;; Cache share entries.
1370 (unless share 1372 (unless share
1371 (tramp-set-connection-property v "share-cache" res))) 1373 (tramp-set-connection-property v "share-cache" res)))
1372 1374
1373 ;; Add directory itself. 1375 ;; Add directory itself.
1374 (pushnew '("" "drwxrwxrwx" 0 (0 0)) res :test #'equal) 1376 (push '("" "drwxrwxrwx" 0 (0 0)) res)
1375 1377
1376 ;; There's a very strange error (debugged with XEmacs 21.4.14) 1378 ;; There's a very strange error (debugged with XEmacs 21.4.14)
1377 ;; If there's no short delay, it returns nil. No idea about. 1379 ;; If there's no short delay, it returns nil. No idea about.
@@ -1719,11 +1721,15 @@ If ARGUMENT is non-nil, use it as argument for
1719 (error 1721 (error
1720 (with-current-buffer (tramp-get-connection-buffer vec) 1722 (with-current-buffer (tramp-get-connection-buffer vec)
1721 (goto-char (point-min)) 1723 (goto-char (point-min))
1722 (if (search-forward-regexp 1724 (if (and (boundp 'auth-sources)
1723 tramp-smb-wrong-passwd-regexp nil t) 1725 (symbol-value 'auth-sources)
1726 (search-forward-regexp
1727 tramp-smb-wrong-passwd-regexp nil t))
1724 ;; Disable `auth-source' and `password-cache'. 1728 ;; Disable `auth-source' and `password-cache'.
1729 (tramp-message
1730 vec 3 "Retry connection with new password")
1725 (let (auth-sources) 1731 (let (auth-sources)
1726 (tramp-cleanup vec) 1732 (tramp-cleanup-connection vec t)
1727 (tramp-smb-maybe-open-connection vec argument)) 1733 (tramp-smb-maybe-open-connection vec argument))
1728 ;; Propagate the error. 1734 ;; Propagate the error.
1729 (signal (car err) (cdr err))))))))))))) 1735 (signal (car err) (cdr err)))))))))))))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 727536b2e10..fe4f7b8bb54 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1222,10 +1222,11 @@ their replacement."
1222 ;; This works with the current set of `tramp-obsolete-methods'. 1222 ;; This works with the current set of `tramp-obsolete-methods'.
1223 ;; Must be improved, if their are more sophisticated replacements. 1223 ;; Must be improved, if their are more sophisticated replacements.
1224 (setq result (substring result 0 -1))) 1224 (setq result (substring result 0 -1)))
1225 ;; We must mark, whether a default value has been used. 1225 ;; We must mark, whether a default value has been used. Not
1226 (if (or method (null result)) 1226 ;; applicable for XEmacs.
1227 (if (or method (null result) (null (functionp 'propertize)))
1227 result 1228 result
1228 (propertize result 'tramp-default t)))) 1229 (tramp-compat-funcall 'propertize result 'tramp-default t))))
1229 1230
1230(defun tramp-find-user (method user host) 1231(defun tramp-find-user (method user host)
1231 "Return the right user string to use. 1232 "Return the right user string to use.
@@ -1243,10 +1244,11 @@ This is USER, if non-nil. Otherwise, do a lookup in
1243 (setq choices nil))) 1244 (setq choices nil)))
1244 luser) 1245 luser)
1245 tramp-default-user))) 1246 tramp-default-user)))
1246 ;; We must mark, whether a default value has been used. 1247 ;; We must mark, whether a default value has been used. Not
1247 (if (or user (null result)) 1248 ;; applicable for XEmacs.
1249 (if (or user (null result) (null (functionp 'propertize)))
1248 result 1250 result
1249 (propertize result 'tramp-default t)))) 1251 (tramp-compat-funcall 'propertize result 'tramp-default t))))
1250 1252
1251(defun tramp-find-host (method user host) 1253(defun tramp-find-host (method user host)
1252 "Return the right host string to use. 1254 "Return the right host string to use.
@@ -1641,7 +1643,7 @@ without a visible progress reporter."
1641 (declare (indent 3) (debug t)) 1643 (declare (indent 3) (debug t))
1642 `(progn 1644 `(progn
1643 (tramp-message ,vec ,level "%s..." ,message) 1645 (tramp-message ,vec ,level "%s..." ,message)
1644 (let ((result "failed") 1646 (let ((cookie "failed")
1645 (tm 1647 (tm
1646 ;; We start a pulsing progress reporter after 3 seconds. Feature 1648 ;; We start a pulsing progress reporter after 3 seconds. Feature
1647 ;; introduced in Emacs 24.1. 1649 ;; introduced in Emacs 24.1.
@@ -1656,10 +1658,10 @@ without a visible progress reporter."
1656 #'tramp-progress-reporter-update pr))))))) 1658 #'tramp-progress-reporter-update pr)))))))
1657 (unwind-protect 1659 (unwind-protect
1658 ;; Execute the body. 1660 ;; Execute the body.
1659 (prog1 (progn ,@body) (setq result "done")) 1661 (prog1 (progn ,@body) (setq cookie "done"))
1660 ;; Stop progress reporter. 1662 ;; Stop progress reporter.
1661 (if tm (tramp-compat-funcall 'cancel-timer tm)) 1663 (if tm (tramp-compat-funcall 'cancel-timer tm))
1662 (tramp-message ,vec ,level "%s...%s" ,message result))))) 1664 (tramp-message ,vec ,level "%s...%s" ,message cookie)))))
1663 1665
1664(tramp-compat-font-lock-add-keywords 1666(tramp-compat-font-lock-add-keywords
1665 'emacs-lisp-mode '("\\<with-tramp-progress-reporter\\>")) 1667 'emacs-lisp-mode '("\\<with-tramp-progress-reporter\\>"))
@@ -1710,19 +1712,6 @@ letter into the file name. This function removes it."
1710 (replace-match "/" nil t name) 1712 (replace-match "/" nil t name)
1711 name))) 1713 name)))
1712 1714
1713(defun tramp-cleanup (vec)
1714 "Cleanup connection VEC, but keep the debug buffer."
1715 (with-current-buffer (tramp-get-debug-buffer vec)
1716 ;; Keep the debug buffer.
1717 (rename-buffer
1718 (generate-new-buffer-name tramp-temp-buffer-name) 'unique)
1719 (tramp-cleanup-connection vec)
1720 (if (= (point-min) (point-max))
1721 (kill-buffer nil)
1722 (rename-buffer (tramp-debug-buffer-name vec) 'unique))
1723 ;; We call `tramp-get-buffer' in order to keep the debug buffer.
1724 (tramp-get-buffer vec)))
1725
1726;;; Config Manipulation Functions: 1715;;; Config Manipulation Functions:
1727 1716
1728;;;###tramp-autoload 1717;;;###tramp-autoload
@@ -2145,7 +2134,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2145 (tramp-message 2134 (tramp-message
2146 v 1 "Suppress received in operation %s" 2135 v 1 "Suppress received in operation %s"
2147 (append (list operation) args)) 2136 (append (list operation) args))
2148 (tramp-cleanup v) 2137 (tramp-cleanup-connection v t)
2149 (tramp-run-real-handler operation args))) 2138 (tramp-run-real-handler operation args)))
2150 (t result))) 2139 (t result)))
2151 2140
@@ -3920,6 +3909,48 @@ Return the local name of the temporary file."
3920 3909
3921;;; Auto saving to a special directory: 3910;;; Auto saving to a special directory:
3922 3911
3912(defun tramp-handle-make-auto-save-file-name ()
3913 "Like `make-auto-save-file-name' for Tramp files.
3914Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3915 (let ((tramp-auto-save-directory tramp-auto-save-directory)
3916 (buffer-file-name
3917 (tramp-subst-strs-in-string
3918 '(("_" . "|")
3919 ("/" . "_a")
3920 (":" . "_b")
3921 ("|" . "__")
3922 ("[" . "_l")
3923 ("]" . "_r"))
3924 (buffer-file-name))))
3925 ;; File name must be unique. This is ensured with Emacs 22 (see
3926 ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for
3927 ;; all other cases we must do it ourselves.
3928 (when (boundp 'auto-save-file-name-transforms)
3929 (mapc
3930 (lambda (x)
3931 (when (and (string-match (car x) buffer-file-name)
3932 (not (car (cddr x))))
3933 (setq tramp-auto-save-directory
3934 (or tramp-auto-save-directory
3935 (tramp-compat-temporary-file-directory)))))
3936 (symbol-value 'auto-save-file-name-transforms)))
3937 ;; Create directory.
3938 (when tramp-auto-save-directory
3939 (setq buffer-file-name
3940 (expand-file-name buffer-file-name tramp-auto-save-directory))
3941 (unless (file-exists-p tramp-auto-save-directory)
3942 (make-directory tramp-auto-save-directory t)))
3943 ;; Run plain `make-auto-save-file-name'. There might be an advice when
3944 ;; it is not a magic file name operation (since Emacs 22).
3945 ;; We must deactivate it temporarily.
3946 (if (not (ad-is-active 'make-auto-save-file-name))
3947 (tramp-run-real-handler 'make-auto-save-file-name nil)
3948 ;; else
3949 (ad-deactivate 'make-auto-save-file-name)
3950 (prog1
3951 (tramp-run-real-handler 'make-auto-save-file-name nil)
3952 (ad-activate 'make-auto-save-file-name)))))
3953
3923(unless (tramp-exists-file-name-handler 'make-auto-save-file-name) 3954(unless (tramp-exists-file-name-handler 'make-auto-save-file-name)
3924 (defadvice make-auto-save-file-name 3955 (defadvice make-auto-save-file-name
3925 (around tramp-advice-make-auto-save-file-name () activate) 3956 (around tramp-advice-make-auto-save-file-name () activate)
diff --git a/lisp/obsolete/options.el b/lisp/obsolete/options.el
index f25003e5652..16941167fb6 100644
--- a/lisp/obsolete/options.el
+++ b/lisp/obsolete/options.el
@@ -88,7 +88,7 @@ The Custom feature is intended to make this obsolete."
88;; Edit Options mode is suitable only for specially formatted data. 88;; Edit Options mode is suitable only for specially formatted data.
89(put 'Edit-options-mode 'mode-class 'special) 89(put 'Edit-options-mode 'mode-class 'special)
90 90
91(defun Edit-options-mode () 91(define-derived-mode Edit-options-mode emacs-lisp-mode "Options"
92 "\\<Edit-options-mode-map>\ 92 "\\<Edit-options-mode-map>\
93Major mode for editing Emacs user option settings. 93Major mode for editing Emacs user option settings.
94Special commands are: 94Special commands are:
@@ -100,17 +100,9 @@ Changed values made by these commands take effect immediately.
100 100
101Each variable description is a paragraph. 101Each variable description is a paragraph.
102For convenience, the characters \\[backward-paragraph] and \\[forward-paragraph] move back and forward by paragraphs." 102For convenience, the characters \\[backward-paragraph] and \\[forward-paragraph] move back and forward by paragraphs."
103 (kill-all-local-variables) 103 (setq-local paragraph-separate "[^\^@-\^?]")
104 (set-syntax-table emacs-lisp-mode-syntax-table) 104 (setq-local paragraph-start "\t")
105 (use-local-map Edit-options-mode-map) 105 (setq-local truncate-lines t))
106 (make-local-variable 'paragraph-separate)
107 (setq paragraph-separate "[^\^@-\^?]")
108 (make-local-variable 'paragraph-start)
109 (setq paragraph-start "\t")
110 (setq truncate-lines t)
111 (setq major-mode 'Edit-options-mode)
112 (setq mode-name "Options")
113 (run-mode-hooks 'Edit-options-mode-hook))
114 106
115(defun Edit-options-set () (interactive) 107(defun Edit-options-set () (interactive)
116 (Edit-options-modify 108 (Edit-options-modify
diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el
index 2e3f500766f..4bd0c4ddcf4 100644
--- a/lisp/play/5x5.el
+++ b/lisp/play/5x5.el
@@ -185,19 +185,8 @@ GRID is the grid of positions to click.")
185 185
186;; Gameplay functions. 186;; Gameplay functions.
187 187
188(put '5x5-mode 'mode-class 'special) 188(define-derived-mode 5x5-mode special-mode "5x5"
189 189 "A mode for playing `5x5'."
190(defun 5x5-mode ()
191 "A mode for playing `5x5'.
192
193The key bindings for `5x5-mode' are:
194
195\\{5x5-mode-map}"
196 (kill-all-local-variables)
197 (use-local-map 5x5-mode-map)
198 (setq major-mode '5x5-mode
199 mode-name "5x5")
200 (run-mode-hooks '5x5-mode-hook)
201 (setq buffer-read-only t 190 (setq buffer-read-only t
202 truncate-lines t) 191 truncate-lines t)
203 (buffer-disable-undo)) 192 (buffer-disable-undo))
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el
index d38f799756b..ce2c928db0d 100644
--- a/lisp/play/blackbox.el
+++ b/lisp/play/blackbox.el
@@ -113,9 +113,8 @@
113 map)) 113 map))
114 114
115;; Blackbox mode is suitable only for specially formatted data. 115;; Blackbox mode is suitable only for specially formatted data.
116(put 'blackbox-mode 'mode-class 'special)
117 116
118(defun blackbox-mode () 117(define-derived-mode blackbox-mode special-mode "Blackbox"
119 "Major mode for playing blackbox. 118 "Major mode for playing blackbox.
120To learn how to play blackbox, see the documentation for function `blackbox'. 119To learn how to play blackbox, see the documentation for function `blackbox'.
121 120
@@ -124,13 +123,7 @@ The usual mnemonic keys move the cursor around the box.
124 123
125\\[bb-romp] -- send in a ray from point, or toggle a ball at point 124\\[bb-romp] -- send in a ray from point, or toggle a ball at point
126\\[bb-done] -- end game and get score" 125\\[bb-done] -- end game and get score"
127 (interactive) 126 (setq truncate-lines t))
128 (kill-all-local-variables)
129 (use-local-map blackbox-mode-map)
130 (setq truncate-lines t)
131 (setq major-mode 'blackbox-mode)
132 (setq mode-name "Blackbox")
133 (run-mode-hooks 'blackbox-mode-hook))
134 127
135;;;###autoload 128;;;###autoload
136(defun blackbox (num) 129(defun blackbox (num)
diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el
index 665e98a69b2..ca7a4013796 100644
--- a/lisp/play/bubbles.el
+++ b/lisp/play/bubbles.el
@@ -1108,25 +1108,24 @@ Set `bubbles--col-offset' and `bubbles--row-offset'."
1108Use optional parameter POS instead of point if given." 1108Use optional parameter POS instead of point if given."
1109 (when bubbles--playing 1109 (when bubbles--playing
1110 (unless pos (setq pos (point))) 1110 (unless pos (setq pos (point)))
1111 (condition-case err 1111 (with-demoted-errors "Bubbles: Internal error %s"
1112 (let ((char (char-after pos)) 1112 (let ((char (char-after pos))
1113 (inhibit-read-only t) 1113 (inhibit-read-only t)
1114 (row (bubbles--row (point))) 1114 (row (bubbles--row (point)))
1115 (col (bubbles--col (point)))) 1115 (col (bubbles--col (point))))
1116 (add-text-properties (point-min) (point-max) 1116 (add-text-properties (point-min) (point-max)
1117 '(face default active nil)) 1117 '(face default active nil))
1118 (let ((count 0)) 1118 (let ((count 0))
1119 (when (and row col (not (eq char (bubbles--empty-char)))) 1119 (when (and row col (not (eq char (bubbles--empty-char))))
1120 (setq count (bubbles--mark-direct-neighbours row col char)) 1120 (setq count (bubbles--mark-direct-neighbours row col char))
1121 (unless (> count 1) 1121 (unless (> count 1)
1122 (add-text-properties (point-min) (point-max) 1122 (add-text-properties (point-min) (point-max)
1123 '(face default active nil)) 1123 '(face default active nil))
1124 (setq count 0))) 1124 (setq count 0)))
1125 (bubbles--update-neighbourhood-score count)) 1125 (bubbles--update-neighbourhood-score count))
1126 (put-text-property (point-min) (point-max) 'pointer 'arrow) 1126 (put-text-property (point-min) (point-max) 'pointer 'arrow)
1127 (bubbles--update-faces-or-images) 1127 (bubbles--update-faces-or-images)
1128 (sit-for 0)) 1128 (sit-for 0)))))
1129 (error (message "Bubbles: Internal error %s" err)))))
1130 1129
1131(defun bubbles--neighbourhood-available () 1130(defun bubbles--neighbourhood-available ()
1132 "Return t if another valid neighborhood is available." 1131 "Return t if another valid neighborhood is available."
diff --git a/lisp/play/landmark.el b/lisp/play/landmark.el
index cf86d7a9de5..8ee633e3917 100644
--- a/lisp/play/landmark.el
+++ b/lisp/play/landmark.el
@@ -233,10 +233,8 @@
233(put 'landmark-mode 'intangible 1) 233(put 'landmark-mode 'intangible 1)
234;; This one is for when they set view-read-only to t: Landmark cannot 234;; This one is for when they set view-read-only to t: Landmark cannot
235;; allow View Mode to be activated in its buffer. 235;; allow View Mode to be activated in its buffer.
236(put 'landmark-mode 'mode-class 'special) 236(define-derived-mode landmark-mode special-mode "Lm"
237 237 "Major mode for playing Lm against Emacs.
238(defun landmark-mode ()
239 "Major mode for playing Landmark against Emacs.
240You and Emacs play in turn by marking a free square. You mark it with X 238You and Emacs play in turn by marking a free square. You mark it with X
241and Emacs marks it with O. The winner is the first to get five contiguous 239and Emacs marks it with O. The winner is the first to get five contiguous
242marks horizontally, vertically or in diagonal. 240marks horizontally, vertically or in diagonal.
@@ -247,16 +245,9 @@ Other useful commands:
247\\{landmark-mode-map} 245\\{landmark-mode-map}
248Entry to this mode calls the value of `landmark-mode-hook' if that value 246Entry to this mode calls the value of `landmark-mode-hook' if that value
249is non-nil. One interesting value is `turn-on-font-lock'." 247is non-nil. One interesting value is `turn-on-font-lock'."
250 (interactive)
251 (kill-all-local-variables)
252 (setq major-mode 'landmark-mode
253 mode-name "Landmark")
254 (landmark-display-statistics) 248 (landmark-display-statistics)
255 (use-local-map landmark-mode-map) 249 (setq-local font-lock-defaults '(landmark-font-lock-keywords t))
256 (make-local-variable 'font-lock-defaults) 250 (setq buffer-read-only t))
257 (setq font-lock-defaults '(landmark-font-lock-keywords t)
258 buffer-read-only t)
259 (run-mode-hooks 'landmark-mode-hook))
260 251
261 252
262;;;_ + THE SCORE TABLE. 253;;;_ + THE SCORE TABLE.
diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el
index e4e627a5293..f4c26bfc6c4 100644
--- a/lisp/play/mpuz.el
+++ b/lisp/play/mpuz.el
@@ -94,7 +94,9 @@ The value t means never ding, and `error' means only ding on wrong input."
94 map) 94 map)
95 "Local keymap to use in Mult Puzzle.") 95 "Local keymap to use in Mult Puzzle.")
96 96
97(defun mpuz-mode () 97
98
99(define-derived-mode mpuz-mode fundamental-mode "Mult Puzzle"
98 "Multiplication puzzle mode. 100 "Multiplication puzzle mode.
99 101
100You have to guess which letters stand for which digits in the 102You have to guess which letters stand for which digits in the
@@ -106,13 +108,7 @@ then the digit. Thus, to guess that A=3, type `A 3'.
106To leave the game to do other editing work, just switch buffers. 108To leave the game to do other editing work, just switch buffers.
107Then you may resume the game with M-x mpuz. 109Then you may resume the game with M-x mpuz.
108You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]." 110You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]."
109 (interactive) 111 (setq tab-width 30))
110 (kill-all-local-variables)
111 (setq major-mode 'mpuz-mode
112 mode-name "Mult Puzzle"
113 tab-width 30)
114 (use-local-map mpuz-mode-map)
115 (run-mode-hooks 'mpuz-mode-hook))
116 112
117 113
118;; Some variables for statistics 114;; Some variables for statistics
diff --git a/lisp/play/snake.el b/lisp/play/snake.el
index 85acfb116d2..4c110914298 100644
--- a/lisp/play/snake.el
+++ b/lisp/play/snake.el
@@ -353,21 +353,13 @@ Argument SNAKE-BUFFER is the name of the buffer."
353 353
354(put 'snake-mode 'mode-class 'special) 354(put 'snake-mode 'mode-class 'special)
355 355
356(defun snake-mode () 356(define-derived-mode snake-mode special-mode "Snake"
357 "A mode for playing Snake. 357 "A mode for playing Snake."
358
359Snake mode keybindings:
360 \\{snake-mode-map}
361"
362 (kill-all-local-variables)
363 358
364 (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t) 359 (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t)
365 360
366 (use-local-map snake-null-map) 361 (use-local-map snake-null-map)
367 362
368 (setq major-mode 'snake-mode)
369 (setq mode-name "Snake")
370
371 (unless (featurep 'emacs) 363 (unless (featurep 'emacs)
372 (setq mode-popup-menu 364 (setq mode-popup-menu
373 '("Snake Commands" 365 '("Snake Commands"
@@ -382,9 +374,7 @@ Snake mode keybindings:
382 (setq gamegrid-use-glyphs snake-use-glyphs-flag) 374 (setq gamegrid-use-glyphs snake-use-glyphs-flag)
383 (setq gamegrid-use-color snake-use-color-flag) 375 (setq gamegrid-use-color snake-use-color-flag)
384 376
385 (gamegrid-init (snake-display-options)) 377 (gamegrid-init (snake-display-options)))
386
387 (run-mode-hooks 'snake-mode-hook))
388 378
389;;;###autoload 379;;;###autoload
390(defun snake () 380(defun snake ()
diff --git a/lisp/play/spook.el b/lisp/play/spook.el
index 08c31d3878b..d2ecd3a62cc 100644
--- a/lisp/play/spook.el
+++ b/lisp/play/spook.el
@@ -69,10 +69,6 @@
69 "Checking authorization..." 69 "Checking authorization..."
70 "Checking authorization...Approved")) 70 "Checking authorization...Approved"))
71 71
72;; Note: the implementation that used to take up most of this file has been
73;; cleaned up, generalized, gratuitously broken by esr, and now resides in
74;; cookie1.el.
75
76(provide 'spook) 72(provide 'spook)
77 73
78;;; spook.el ends here 74;;; spook.el ends here
diff --git a/lisp/profiler.el b/lisp/profiler.el
index 609a0308cf0..93ab10015ea 100644
--- a/lisp/profiler.el
+++ b/lisp/profiler.el
@@ -256,10 +256,9 @@ Optional argument MODE means only check for the specified mode (cpu or mem)."
256(defun profiler-calltree-find (tree entry) 256(defun profiler-calltree-find (tree entry)
257 "Return a child tree of ENTRY under TREE." 257 "Return a child tree of ENTRY under TREE."
258 (let (result (children (profiler-calltree-children tree))) 258 (let (result (children (profiler-calltree-children tree)))
259 ;; FIXME: Use `assoc'.
260 (while (and children (null result)) 259 (while (and children (null result))
261 (let ((child (car children))) 260 (let ((child (car children)))
262 (when (equal (profiler-calltree-entry child) entry) 261 (when (function-equal (profiler-calltree-entry child) entry)
263 (setq result child)) 262 (setq result child))
264 (setq children (cdr children)))) 263 (setq children (cdr children))))
265 result)) 264 result))
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 1e8d6cba8c4..e977a415d62 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1594,10 +1594,6 @@ Key bindings:
1594;;;###autoload (add-to-list 'interpreter-mode-alist '("nawk" . awk-mode)) 1594;;;###autoload (add-to-list 'interpreter-mode-alist '("nawk" . awk-mode))
1595;;;###autoload (add-to-list 'interpreter-mode-alist '("gawk" . awk-mode)) 1595;;;###autoload (add-to-list 'interpreter-mode-alist '("gawk" . awk-mode))
1596 1596
1597;;; Autoload directives must be on the top level, so we construct an
1598;;; autoload form instead.
1599;;;###autoload (autoload 'awk-mode "cc-mode" "Major mode for editing AWK code." t)
1600
1601(c-define-abbrev-table 'awk-mode-abbrev-table 1597(c-define-abbrev-table 'awk-mode-abbrev-table
1602 '(("else" "else" c-electric-continued-statement 0) 1598 '(("else" "else" c-electric-continued-statement 0)
1603 ("while" "while" c-electric-continued-statement 0)) 1599 ("while" "while" c-electric-continued-statement 0))
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 770e78bb3b1..8a7d1e77bd2 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -412,15 +412,15 @@ Affects: `cperl-font-lock', `cperl-electric-lbrace-space',
412 "use cperl-vc-rcs-header or cperl-vc-sccs-header instead." 412 "use cperl-vc-rcs-header or cperl-vc-sccs-header instead."
413 "22.1") 413 "22.1")
414 414
415(defcustom cperl-clobber-mode-lists 415;; (defcustom cperl-clobber-mode-lists
416 (not 416;; (not
417 (and 417;; (and
418 (boundp 'interpreter-mode-alist) 418;; (boundp 'interpreter-mode-alist)
419 (assoc "miniperl" interpreter-mode-alist) 419;; (assoc "miniperl" interpreter-mode-alist)
420 (assoc "\\.\\([pP][Llm]\\|al\\)$" auto-mode-alist))) 420;; (assoc "\\.\\([pP][Llm]\\|al\\)$" auto-mode-alist)))
421 "*Whether to install us into `interpreter-' and `extension' mode lists." 421;; "*Whether to install us into `interpreter-' and `extension' mode lists."
422 :type 'boolean 422;; :type 'boolean
423 :group 'cperl) 423;; :group 'cperl)
424 424
425(defcustom cperl-info-on-command-no-prompt nil 425(defcustom cperl-info-on-command-no-prompt nil
426 "*Not-nil (and non-null) means not to prompt on C-h f. 426 "*Not-nil (and non-null) means not to prompt on C-h f.
@@ -6535,7 +6535,7 @@ side-effect of memorizing only. Examples in `cperl-style-examples'."
6535 (eval '(mode-compile)))) ; Avoid a warning 6535 (eval '(mode-compile)))) ; Avoid a warning
6536 6536
6537(declare-function Info-find-node "info" 6537(declare-function Info-find-node "info"
6538 (filename nodename &optional no-going-back)) 6538 (filename nodename &optional no-going-back strict-case))
6539 6539
6540(defun cperl-info-buffer (type) 6540(defun cperl-info-buffer (type)
6541 ;; Returns buffer with documentation. Creates if missing. 6541 ;; Returns buffer with documentation. Creates if missing.
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el
index a305393c7d8..7b08df8b85f 100644
--- a/lisp/progmodes/executable.el
+++ b/lisp/progmodes/executable.el
@@ -269,16 +269,15 @@ file modes."
269 (save-restriction 269 (save-restriction
270 (widen) 270 (widen)
271 (string= "#!" (buffer-substring (point-min) (+ 2 (point-min))))) 271 (string= "#!" (buffer-substring (point-min) (+ 2 (point-min)))))
272 (condition-case nil 272 ;; Eg file-modes can return nil (bug#9879). It should not,
273 (let* ((current-mode (file-modes (buffer-file-name))) 273 ;; in this context, but we should handle it all the same.
274 (add-mode (logand ?\111 (default-file-modes)))) 274 (with-demoted-errors "Unable to make file executable: %s"
275 (or (/= (logand ?\111 current-mode) 0) 275 (let* ((current-mode (file-modes (buffer-file-name)))
276 (zerop add-mode) 276 (add-mode (logand ?\111 (default-file-modes))))
277 (set-file-modes (buffer-file-name) 277 (or (/= (logand ?\111 current-mode) 0)
278 (logior current-mode add-mode)))) 278 (zerop add-mode)
279 ;; Eg file-modes can return nil (bug#9879). It should not, 279 (set-file-modes (buffer-file-name)
280 ;; in this context, but we should handle it all the same. 280 (logior current-mode add-mode)))))))
281 (error (message "Unable to make file executable")))))
282 281
283(provide 'executable) 282(provide 'executable)
284 283
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index de1c26a7fa7..f20a57940be 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -1581,6 +1581,9 @@ code line."
1581 :group 'octave 1581 :group 'octave
1582 :version "24.4") 1582 :version "24.4")
1583 1583
1584;; Used in a mode derived from help-mode.
1585(declare-function help-button-action "help-mode" (button))
1586
1584(define-button-type 'octave-help-file 1587(define-button-type 'octave-help-file
1585 'follow-link t 1588 'follow-link t
1586 'action #'help-button-action 1589 'action #'help-button-action
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index be151bf8114..5f919bf495f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -225,7 +225,7 @@
225;;;###autoload 225;;;###autoload
226(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) 226(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode))
227;;;###autoload 227;;;###autoload
228(add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode)) 228(add-to-list 'interpreter-mode-alist (cons (purecopy "python[0-9.]*") 'python-mode))
229 229
230(defgroup python nil 230(defgroup python nil
231 "Python Language's flying circus support for Emacs." 231 "Python Language's flying circus support for Emacs."
@@ -2140,7 +2140,7 @@ the python shell:
2140 1. When Optional Argument NOMAIN is non-nil everything under an 2140 1. When Optional Argument NOMAIN is non-nil everything under an
2141 \"if __name__ == '__main__'\" block will be removed. 2141 \"if __name__ == '__main__'\" block will be removed.
2142 2. When a subregion of the buffer is sent, it takes care of 2142 2. When a subregion of the buffer is sent, it takes care of
2143 appending extra whitelines so tracebacks are correct. 2143 appending extra empty lines so tracebacks are correct.
2144 3. Wraps indented regions under an \"if True:\" block so the 2144 3. Wraps indented regions under an \"if True:\" block so the
2145 interpreter evaluates them correctly." 2145 interpreter evaluates them correctly."
2146 (let ((substring (buffer-substring-no-properties start end)) 2146 (let ((substring (buffer-substring-no-properties start end))
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 0f868255589..902616e3023 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1377,6 +1377,7 @@ If the result is do-end block, it will always be multiline."
1377;; Unusual code layout confuses the byte-compiler. 1377;; Unusual code layout confuses the byte-compiler.
1378(declare-function ruby-syntax-propertize-expansion "ruby-mode" ()) 1378(declare-function ruby-syntax-propertize-expansion "ruby-mode" ())
1379(declare-function ruby-syntax-expansion-allowed-p "ruby-mode" (parse-state)) 1379(declare-function ruby-syntax-expansion-allowed-p "ruby-mode" (parse-state))
1380(declare-function ruby-syntax-propertize-function "ruby-mode" (start end))
1380 1381
1381(if (eval-when-compile (fboundp #'syntax-propertize-rules)) 1382(if (eval-when-compile (fboundp #'syntax-propertize-rules))
1382 ;; New code that works independently from font-lock. 1383 ;; New code that works independently from font-lock.
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 292bc2369a6..3ea2afb6fc3 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2170,11 +2170,18 @@ the visited file executable, and NO-QUERY-FLAG (the second argument)
2170controls whether to query about making the visited file executable. 2170controls whether to query about making the visited file executable.
2171 2171
2172Calls the value of `sh-set-shell-hook' if set." 2172Calls the value of `sh-set-shell-hook' if set."
2173 (interactive (list (completing-read (format "Shell \(default %s\): " 2173 (interactive (list (completing-read
2174 sh-shell-file) 2174 (format "Shell \(default %s\): "
2175 interpreter-mode-alist 2175 sh-shell-file)
2176 (lambda (x) (eq (cdr x) 'sh-mode)) 2176 ;; This used to use interpreter-mode-alist, but that is
2177 nil nil nil sh-shell-file) 2177 ;; no longer appropriate now that uses regexps.
2178 ;; Maybe there could be a separate variable that lists
2179 ;; the shells, used here and to construct i-mode-alist.
2180 ;; But the following is probably good enough:
2181 (append (mapcar (lambda (e) (symbol-name (car e)))
2182 sh-ancestor-alist)
2183 '("csh" "rc" "sh"))
2184 nil nil nil nil sh-shell-file)
2178 (eq executable-query 'function) 2185 (eq executable-query 'function)
2179 t)) 2186 t))
2180 (if (string-match "\\.exe\\'" shell) 2187 (if (string-match "\\.exe\\'" shell)
diff --git a/lisp/reveal.el b/lisp/reveal.el
index 92c1178041c..6740f7e923f 100644
--- a/lisp/reveal.el
+++ b/lisp/reveal.el
@@ -72,27 +72,26 @@ Each element has the form (WINDOW . OVERLAY).")
72 ;; - we only refresh spots in the current window. 72 ;; - we only refresh spots in the current window.
73 ;; FIXME: do we actually know that (current-buffer) = (window-buffer) ? 73 ;; FIXME: do we actually know that (current-buffer) = (window-buffer) ?
74 (with-local-quit 74 (with-local-quit
75 (condition-case err 75 (with-demoted-errors "Reveal: %s"
76 (let ((old-ols 76 (let ((old-ols
77 (delq nil 77 (delq nil
78 (mapcar 78 (mapcar
79 (lambda (x) 79 (lambda (x)
80 ;; We refresh any spot in the current window as well 80 ;; We refresh any spot in the current window as well
81 ;; as any spots associated with a dead window or 81 ;; as any spots associated with a dead window or
82 ;; a window which does not show this buffer any more. 82 ;; a window which does not show this buffer any more.
83 (cond 83 (cond
84 ((eq (car x) (selected-window)) (cdr x)) 84 ((eq (car x) (selected-window)) (cdr x))
85 ((not (and (window-live-p (car x)) 85 ((not (and (window-live-p (car x))
86 (eq (window-buffer (car x)) (current-buffer)))) 86 (eq (window-buffer (car x)) (current-buffer))))
87 ;; Adopt this since it's owned by a window that's 87 ;; Adopt this since it's owned by a window that's
88 ;; either not live or at least not showing this 88 ;; either not live or at least not showing this
89 ;; buffer any more. 89 ;; buffer any more.
90 (setcar x (selected-window)) 90 (setcar x (selected-window))
91 (cdr x)))) 91 (cdr x))))
92 reveal-open-spots)))) 92 reveal-open-spots))))
93 (setq old-ols (reveal-open-new-overlays old-ols)) 93 (setq old-ols (reveal-open-new-overlays old-ols))
94 (reveal-close-old-overlays old-ols)) 94 (reveal-close-old-overlays old-ols)))))
95 (error (message "Reveal: %s" err)))))
96 95
97(defun reveal-open-new-overlays (old-ols) 96(defun reveal-open-new-overlays (old-ols)
98 (let ((repeat t)) 97 (let ((repeat t))
diff --git a/lisp/savehist.el b/lisp/savehist.el
index 374e57feb1f..379818b2707 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -49,7 +49,7 @@
49 49
50(require 'custom) 50(require 'custom)
51(eval-when-compile 51(eval-when-compile
52 (require 'cl)) 52 (if (featurep 'xemacs) (require 'cl)))
53 53
54;; User variables 54;; User variables
55 55
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index 2ddac6d6c43..e070a7da489 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -255,8 +255,9 @@ may have changed\) back to `save-place-alist'."
255 (insert-file-contents file) 255 (insert-file-contents file)
256 (goto-char (point-min)) 256 (goto-char (point-min))
257 (setq save-place-alist 257 (setq save-place-alist
258 (car (read-from-string 258 (with-demoted-errors "Error reading save-place-file: %S"
259 (buffer-substring (point-min) (point-max))))) 259 (car (read-from-string
260 (buffer-substring (point-min) (point-max))))))
260 261
261 ;; If there is a limit, and we're over it, then we'll 262 ;; If there is a limit, and we're over it, then we'll
262 ;; have to truncate the end of the list: 263 ;; have to truncate the end of the list:
diff --git a/lisp/shell.el b/lisp/shell.el
index 3ca2564b65c..2047543f288 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -1,7 +1,6 @@
1;;; shell.el --- specialized comint.el for running the shell -*- lexical-binding: t -*- 1;;; shell.el --- specialized comint.el for running the shell -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1988, 1993-1997, 2000-2013 Free Software Foundation, 3;; Copyright (C) 1988, 1993-1997, 2000-2013 Free Software Foundation, Inc.
4;; Inc.
5 4
6;; Author: Olin Shivers <shivers@cs.cmu.edu> 5;; Author: Olin Shivers <shivers@cs.cmu.edu>
7;; Simon Marshall <simon@gnu.org> 6;; Simon Marshall <simon@gnu.org>
@@ -792,7 +791,7 @@ and `shell-pushd-dunique' control the behavior of the relevant command.
792Environment variables are expanded, see function `substitute-in-file-name'." 791Environment variables are expanded, see function `substitute-in-file-name'."
793 (if shell-dirtrackp 792 (if shell-dirtrackp
794 ;; We fail gracefully if we think the command will fail in the shell. 793 ;; We fail gracefully if we think the command will fail in the shell.
795 (condition-case nil 794 (with-demoted-errors "Couldn't cd: %s"
796 (let ((start (progn (string-match 795 (let ((start (progn (string-match
797 (concat "^" shell-command-separator-regexp) 796 (concat "^" shell-command-separator-regexp)
798 str) ; skip whitespace 797 str) ; skip whitespace
@@ -825,8 +824,7 @@ Environment variables are expanded, see function `substitute-in-file-name'."
825 (setq start (progn (string-match shell-command-separator-regexp 824 (setq start (progn (string-match shell-command-separator-regexp
826 str end) 825 str end)
827 ;; skip again 826 ;; skip again
828 (match-end 0))))) 827 (match-end 0))))))))
829 (error "Couldn't cd"))))
830 828
831(defun shell-unquote-argument (string) 829(defun shell-unquote-argument (string)
832 "Remove all kinds of shell quoting from STRING." 830 "Remove all kinds of shell quoting from STRING."
@@ -908,7 +906,7 @@ Environment variables are expanded, see function `substitute-in-file-name'."
908 (cond ((> num (length shell-dirstack)) 906 (cond ((> num (length shell-dirstack))
909 (message "Directory stack not that deep.")) 907 (message "Directory stack not that deep."))
910 ((= num 0) 908 ((= num 0)
911 (error (message "Couldn't cd"))) 909 (error "Couldn't cd"))
912 (shell-pushd-dextract 910 (shell-pushd-dextract
913 (let ((dir (nth (1- num) shell-dirstack))) 911 (let ((dir (nth (1- num) shell-dirstack)))
914 (shell-process-popd arg) 912 (shell-process-popd arg)
@@ -1015,12 +1013,11 @@ command again."
1015 ds)) 1013 ds))
1016 (setq i (match-end 0))) 1014 (setq i (match-end 0)))
1017 (let ((ds (nreverse ds))) 1015 (let ((ds (nreverse ds)))
1018 (condition-case nil 1016 (with-demoted-errors "Couldn't cd: %s"
1019 (progn (shell-cd (car ds)) 1017 (shell-cd (car ds))
1020 (setq shell-dirstack (cdr ds) 1018 (setq shell-dirstack (cdr ds)
1021 shell-last-dir (car shell-dirstack)) 1019 shell-last-dir (car shell-dirstack))
1022 (shell-dirstack-message)) 1020 (shell-dirstack-message)))))
1023 (error (message "Couldn't cd"))))))
1024 (if started-at-pmark (goto-char (marker-position pmark))))) 1021 (if started-at-pmark (goto-char (marker-position pmark)))))
1025 1022
1026;; For your typing convenience: 1023;; For your typing convenience:
diff --git a/lisp/simple.el b/lisp/simple.el
index c5e5b313b7b..593f36d1ee1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1231,7 +1231,7 @@ is a string to insert in the minibuffer before reading.
1231Such arguments are used as in `read-from-minibuffer'.)" 1231Such arguments are used as in `read-from-minibuffer'.)"
1232 ;; Used for interactive spec `x'. 1232 ;; Used for interactive spec `x'.
1233 (read-from-minibuffer prompt initial-contents minibuffer-local-map 1233 (read-from-minibuffer prompt initial-contents minibuffer-local-map
1234 t minibuffer-history)) 1234 t 'minibuffer-history))
1235 1235
1236(defun eval-minibuffer (prompt &optional initial-contents) 1236(defun eval-minibuffer (prompt &optional initial-contents)
1237 "Return value of Lisp expression read using the minibuffer. 1237 "Return value of Lisp expression read using the minibuffer.
@@ -3180,12 +3180,18 @@ see other processes running on the system, use `list-system-processes'."
3180 nil) 3180 nil)
3181 3181
3182(defvar universal-argument-map 3182(defvar universal-argument-map
3183 (let ((map (make-sparse-keymap))) 3183 (let ((map (make-sparse-keymap))
3184 (define-key map [t] 'universal-argument-other-key) 3184 (universal-argument-minus
3185 (define-key map (vector meta-prefix-char t) 'universal-argument-other-key) 3185 ;; For backward compatibility, minus with no modifiers is an ordinary
3186 (define-key map [switch-frame] nil) 3186 ;; command if digits have already been entered.
3187 `(menu-item "" negative-argument
3188 :filter ,(lambda (cmd)
3189 (if (integerp prefix-arg) nil cmd)))))
3190 (define-key map [switch-frame]
3191 (lambda (e) (interactive "e")
3192 (handle-switch-frame e) (universal-argument--mode)))
3187 (define-key map [?\C-u] 'universal-argument-more) 3193 (define-key map [?\C-u] 'universal-argument-more)
3188 (define-key map [?-] 'universal-argument-minus) 3194 (define-key map [?-] universal-argument-minus)
3189 (define-key map [?0] 'digit-argument) 3195 (define-key map [?0] 'digit-argument)
3190 (define-key map [?1] 'digit-argument) 3196 (define-key map [?1] 'digit-argument)
3191 (define-key map [?2] 'digit-argument) 3197 (define-key map [?2] 'digit-argument)
@@ -3206,30 +3212,12 @@ see other processes running on the system, use `list-system-processes'."
3206 (define-key map [kp-7] 'digit-argument) 3212 (define-key map [kp-7] 'digit-argument)
3207 (define-key map [kp-8] 'digit-argument) 3213 (define-key map [kp-8] 'digit-argument)
3208 (define-key map [kp-9] 'digit-argument) 3214 (define-key map [kp-9] 'digit-argument)
3209 (define-key map [kp-subtract] 'universal-argument-minus) 3215 (define-key map [kp-subtract] universal-argument-minus)
3210 map) 3216 map)
3211 "Keymap used while processing \\[universal-argument].") 3217 "Keymap used while processing \\[universal-argument].")
3212 3218
3213(defvar universal-argument-num-events nil 3219(defun universal-argument--mode ()
3214 "Number of argument-specifying events read by `universal-argument'. 3220 (set-temporary-overlay-map universal-argument-map))
3215`universal-argument-other-key' uses this to discard those events
3216from (this-command-keys), and reread only the final command.")
3217
3218(defvar saved-overriding-map t
3219 "The saved value of `overriding-terminal-local-map'.
3220That variable gets restored to this value on exiting \"universal
3221argument mode\".")
3222
3223(defun save&set-overriding-map (map)
3224 "Set `overriding-terminal-local-map' to MAP."
3225 (when (eq saved-overriding-map t)
3226 (setq saved-overriding-map overriding-terminal-local-map)
3227 (setq overriding-terminal-local-map map)))
3228
3229(defun restore-overriding-map ()
3230 "Restore `overriding-terminal-local-map' to its saved value."
3231 (setq overriding-terminal-local-map saved-overriding-map)
3232 (setq saved-overriding-map t))
3233 3221
3234(defun universal-argument () 3222(defun universal-argument ()
3235 "Begin a numeric argument for the following command. 3223 "Begin a numeric argument for the following command.
@@ -3243,33 +3231,27 @@ which is different in effect from any particular numeric argument.
3243These commands include \\[set-mark-command] and \\[start-kbd-macro]." 3231These commands include \\[set-mark-command] and \\[start-kbd-macro]."
3244 (interactive) 3232 (interactive)
3245 (setq prefix-arg (list 4)) 3233 (setq prefix-arg (list 4))
3246 (setq universal-argument-num-events (length (this-command-keys))) 3234 (universal-argument--mode))
3247 (save&set-overriding-map universal-argument-map))
3248 3235
3249;; A subsequent C-u means to multiply the factor by 4 if we've typed
3250;; nothing but C-u's; otherwise it means to terminate the prefix arg.
3251(defun universal-argument-more (arg) 3236(defun universal-argument-more (arg)
3237 ;; A subsequent C-u means to multiply the factor by 4 if we've typed
3238 ;; nothing but C-u's; otherwise it means to terminate the prefix arg.
3252 (interactive "P") 3239 (interactive "P")
3253 (if (consp arg) 3240 (setq prefix-arg (if (consp arg)
3254 (setq prefix-arg (list (* 4 (car arg)))) 3241 (list (* 4 (car arg)))
3255 (if (eq arg '-) 3242 (if (eq arg '-)
3256 (setq prefix-arg (list -4)) 3243 (list -4)
3257 (setq prefix-arg arg) 3244 arg)))
3258 (restore-overriding-map))) 3245 (when (consp prefix-arg) (universal-argument--mode)))
3259 (setq universal-argument-num-events (length (this-command-keys))))
3260 3246
3261(defun negative-argument (arg) 3247(defun negative-argument (arg)
3262 "Begin a negative numeric argument for the next command. 3248 "Begin a negative numeric argument for the next command.
3263\\[universal-argument] following digits or minus sign ends the argument." 3249\\[universal-argument] following digits or minus sign ends the argument."
3264 (interactive "P") 3250 (interactive "P")
3265 (cond ((integerp arg) 3251 (setq prefix-arg (cond ((integerp arg) (- arg))
3266 (setq prefix-arg (- arg))) 3252 ((eq arg '-) nil)
3267 ((eq arg '-) 3253 (t '-)))
3268 (setq prefix-arg nil)) 3254 (universal-argument--mode))
3269 (t
3270 (setq prefix-arg '-)))
3271 (setq universal-argument-num-events (length (this-command-keys)))
3272 (save&set-overriding-map universal-argument-map))
3273 3255
3274(defun digit-argument (arg) 3256(defun digit-argument (arg)
3275 "Part of the numeric argument for the next command. 3257 "Part of the numeric argument for the next command.
@@ -3279,37 +3261,15 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]."
3279 last-command-event 3261 last-command-event
3280 (get last-command-event 'ascii-character))) 3262 (get last-command-event 'ascii-character)))
3281 (digit (- (logand char ?\177) ?0))) 3263 (digit (- (logand char ?\177) ?0)))
3282 (cond ((integerp arg) 3264 (setq prefix-arg (cond ((integerp arg)
3283 (setq prefix-arg (+ (* arg 10) 3265 (+ (* arg 10)
3284 (if (< arg 0) (- digit) digit)))) 3266 (if (< arg 0) (- digit) digit)))
3285 ((eq arg '-) 3267 ((eq arg '-)
3286 ;; Treat -0 as just -, so that -01 will work. 3268 ;; Treat -0 as just -, so that -01 will work.
3287 (setq prefix-arg (if (zerop digit) '- (- digit)))) 3269 (if (zerop digit) '- (- digit)))
3288 (t 3270 (t
3289 (setq prefix-arg digit)))) 3271 digit))))
3290 (setq universal-argument-num-events (length (this-command-keys))) 3272 (universal-argument--mode))
3291 (save&set-overriding-map universal-argument-map))
3292
3293;; For backward compatibility, minus with no modifiers is an ordinary
3294;; command if digits have already been entered.
3295(defun universal-argument-minus (arg)
3296 (interactive "P")
3297 (if (integerp arg)
3298 (universal-argument-other-key arg)
3299 (negative-argument arg)))
3300
3301;; Anything else terminates the argument and is left in the queue to be
3302;; executed as a command.
3303(defun universal-argument-other-key (arg)
3304 (interactive "P")
3305 (setq prefix-arg arg)
3306 (let* ((key (this-command-keys))
3307 (keylist (listify-key-sequence key)))
3308 (setq unread-command-events
3309 (append (nthcdr universal-argument-num-events keylist)
3310 unread-command-events)))
3311 (reset-this-command-lengths)
3312 (restore-overriding-map))
3313 3273
3314 3274
3315(defvar filter-buffer-substring-functions nil 3275(defvar filter-buffer-substring-functions nil
diff --git a/lisp/subr.el b/lisp/subr.el
index 0a28d4778d4..7df1e86b5bf 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3350,16 +3350,22 @@ even if this catches the signal."
3350(define-obsolete-function-alias 'condition-case-no-debug 3350(define-obsolete-function-alias 'condition-case-no-debug
3351 'condition-case-unless-debug "24.1") 3351 'condition-case-unless-debug "24.1")
3352 3352
3353(defmacro with-demoted-errors (&rest body) 3353(defmacro with-demoted-errors (format &rest body)
3354 "Run BODY and demote any errors to simple messages. 3354 "Run BODY and demote any errors to simple messages.
3355If `debug-on-error' is non-nil, run BODY without catching its errors. 3355If `debug-on-error' is non-nil, run BODY without catching its errors.
3356This is to be used around code which is not expected to signal an error 3356This is to be used around code which is not expected to signal an error
3357but which should be robust in the unexpected case that an error is signaled." 3357but which should be robust in the unexpected case that an error is signaled.
3358 (declare (debug t) (indent 0)) 3358For backward compatibility, if FORMAT is not a constant string, it
3359 (let ((err (make-symbol "err"))) 3359is assumed to be part of BODY, in which case the message format
3360used is \"Error: %S\"."
3361 (declare (debug t) (indent 1))
3362 (let ((err (make-symbol "err"))
3363 (format (if (and (stringp format) body) format
3364 (prog1 "Error: %S"
3365 (if format (push format body))))))
3360 `(condition-case-unless-debug ,err 3366 `(condition-case-unless-debug ,err
3361 (progn ,@body) 3367 ,(macroexp-progn body)
3362 (error (message "Error: %S" ,err) nil)))) 3368 (error (message ,format ,err) nil))))
3363 3369
3364(defmacro combine-after-change-calls (&rest body) 3370(defmacro combine-after-change-calls (&rest body)
3365 "Execute BODY, but don't call the after-change functions till the end. 3371 "Execute BODY, but don't call the after-change functions till the end.
@@ -3901,12 +3907,27 @@ This function is called directly from the C code."
3901 (mapc #'funcall (cdr a-l-element)))) 3907 (mapc #'funcall (cdr a-l-element))))
3902 ;; Complain when the user uses obsolete files. 3908 ;; Complain when the user uses obsolete files.
3903 (when (string-match-p "/obsolete/[^/]*\\'" abs-file) 3909 (when (string-match-p "/obsolete/[^/]*\\'" abs-file)
3904 (run-with-timer 0 nil 3910 ;; Maybe we should just use display-warning? This seems yucky...
3905 (lambda (file) 3911 (let* ((file (file-name-nondirectory abs-file))
3906 (message "Package %s is obsolete!" 3912 (msg (format "Package %s is obsolete!"
3907 (substring file 0 3913 (substring file 0
3908 (string-match "\\.elc?\\>" file)))) 3914 (string-match "\\.elc?\\>" file)))))
3909 (file-name-nondirectory abs-file))) 3915 ;; Cribbed from cl--compiling-file.
3916 (if (and (boundp 'byte-compile--outbuffer)
3917 (bufferp (symbol-value 'byte-compile--outbuffer))
3918 (equal (buffer-name (symbol-value 'byte-compile--outbuffer))
3919 " *Compiler Output*"))
3920 ;; Don't warn about obsolete files using other obsolete files.
3921 (unless (and (stringp byte-compile-current-file)
3922 (string-match-p "/obsolete/[^/]*\\'"
3923 (expand-file-name
3924 byte-compile-current-file
3925 byte-compile-root-dir)))
3926 (byte-compile-log-warning msg))
3927 (run-with-timer 0 nil
3928 (lambda (msg)
3929 (message "%s" msg)) msg))))
3930
3910 ;; Finally, run any other hook. 3931 ;; Finally, run any other hook.
3911 (run-hook-with-args 'after-load-functions abs-file)) 3932 (run-hook-with-args 'after-load-functions abs-file))
3912 3933
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index b92ca1244fb..b4693a5451a 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -104,7 +104,6 @@ The properties returned may include `top', `left', `height', and `width'."
104(define-key global-map [?\s-~] 'ns-prev-frame) 104(define-key global-map [?\s-~] 'ns-prev-frame)
105(define-key global-map [?\s--] 'center-line) 105(define-key global-map [?\s--] 'center-line)
106(define-key global-map [?\s-:] 'ispell) 106(define-key global-map [?\s-:] 'ispell)
107(define-key global-map [?\s-\;] 'ispell-next)
108(define-key global-map [?\s-?] 'info) 107(define-key global-map [?\s-?] 'info)
109(define-key global-map [?\s-^] 'kill-some-buffers) 108(define-key global-map [?\s-^] 'kill-some-buffers)
110(define-key global-map [?\s-&] 'kill-this-buffer) 109(define-key global-map [?\s-&] 'kill-this-buffer)
diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el
index 96831cea9a6..e5229bd3f0a 100644
--- a/lisp/term/pc-win.el
+++ b/lisp/term/pc-win.el
@@ -1,7 +1,7 @@
1;;; pc-win.el --- setup support for `PC windows' (whatever that is) 1;;; pc-win.el --- setup support for `PC windows' (whatever that is)
2 2
3;; Copyright (C) 1994, 1996-1997, 1999, 2001-2013 Free Software 3;; Copyright (C) 1994, 1996-1997, 1999, 2001-2013
4;; Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Morten Welinder <terra@diku.dk> 6;; Author: Morten Welinder <terra@diku.dk>
7;; Maintainer: FSF 7;; Maintainer: FSF
@@ -238,9 +238,8 @@ is not used)."
238 (if x-select-enable-clipboard 238 (if x-select-enable-clipboard
239 (let (text) 239 (let (text)
240 ;; Don't die if x-get-selection signals an error. 240 ;; Don't die if x-get-selection signals an error.
241 (condition-case c 241 (with-demoted-errors "w16-get-clipboard-data:%s"
242 (setq text (w16-get-clipboard-data)) 242 (setq text (w16-get-clipboard-data)))
243 (error (message "w16-get-clipboard-data:%s" c)))
244 (if (string= text "") (setq text nil)) 243 (if (string= text "") (setq text nil))
245 (cond 244 (cond
246 ((not text) nil) 245 ((not text) nil)
diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el
index 9ab592587c9..fc47bf0fc10 100644
--- a/lisp/vc/ediff.el
+++ b/lisp/vc/ediff.el
@@ -1481,7 +1481,7 @@ When called interactively, displays the version."
1481 (format "Ediff %s of %s" ediff-version ediff-date))) 1481 (format "Ediff %s of %s" ediff-version ediff-date)))
1482 1482
1483;; info is run first, and will autoload info.el. 1483;; info is run first, and will autoload info.el.
1484(declare-function Info-goto-node "info" (nodename &optional fork)) 1484(declare-function Info-goto-node "info" (nodename &optional fork strict-case))
1485 1485
1486;;;###autoload 1486;;;###autoload
1487(defun ediff-documentation (&optional node) 1487(defun ediff-documentation (&optional node)
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 5f5416dc2ff..00604088c17 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -320,11 +320,10 @@ in the repository root directory of FILE."
320 ("^Using saved parent location: \\(.+\\)" 1 nil nil 0)) 320 ("^Using saved parent location: \\(.+\\)" 1 nil nil 0))
321 "Value of `compilation-error-regexp-alist' in *vc-bzr* buffers.") 321 "Value of `compilation-error-regexp-alist' in *vc-bzr* buffers.")
322 322
323;; Follows vc-bzr-(async-)command, which uses vc-do-(async-)command 323;; To be called via vc-pull from vc.el, which requires vc-dispatcher.
324;; from vc-dispatcher.
325(declare-function vc-exec-after "vc-dispatcher" (code)) 324(declare-function vc-exec-after "vc-dispatcher" (code))
326;; Follows vc-exec-after.
327(declare-function vc-set-async-update "vc-dispatcher" (process-buffer)) 325(declare-function vc-set-async-update "vc-dispatcher" (process-buffer))
326(declare-function vc-compilation-mode "vc-dispatcher" (backend))
328 327
329(defun vc-bzr-pull (prompt) 328(defun vc-bzr-pull (prompt)
330 "Pull changes into the current Bzr branch. 329 "Pull changes into the current Bzr branch.
@@ -354,6 +353,7 @@ prompt for the Bzr command to run."
354 (setq vc-bzr-program (car args) 353 (setq vc-bzr-program (car args)
355 command (cadr args) 354 command (cadr args)
356 args (cddr args))) 355 args (cddr args)))
356 (require 'vc-dispatcher)
357 (let ((buf (apply 'vc-bzr-async-command command args))) 357 (let ((buf (apply 'vc-bzr-async-command command args)))
358 (with-current-buffer buf (vc-run-delayed (vc-compilation-mode 'bzr))) 358 (with-current-buffer buf (vc-run-delayed (vc-compilation-mode 'bzr)))
359 (vc-set-async-update buf)))) 359 (vc-set-async-update buf))))
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 931193c46e0..11a30991391 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -1226,10 +1226,11 @@ is non-nil."
1226 table (lambda () (vc-cvs-revision-table (car files)))))) 1226 table (lambda () (vc-cvs-revision-table (car files))))))
1227 table)) 1227 table))
1228 1228
1229(defun vc-cvs-ignore (file) 1229(defun vc-cvs-ignore (file &optional _directory _remove)
1230 "Ignore FILE under CVS." 1230 "Ignore FILE under CVS."
1231 (cvs-append-to-ignore (file-name-directory file) file)) 1231 (cvs-append-to-ignore (file-name-directory file) file))
1232 1232
1233;; FIXME This should be in the vc-cvs- namespace if it is to live here.
1233(defun cvs-append-to-ignore (dir str &optional old-dir) 1234(defun cvs-append-to-ignore (dir str &optional old-dir)
1234 "In DIR, add STR to the .cvsignore file. 1235 "In DIR, add STR to the .cvsignore file.
1235If OLD-DIR is non-nil, then this is a directory that we don't want 1236If OLD-DIR is non-nil, then this is a directory that we don't want
@@ -1245,7 +1246,9 @@ to hear about anymore."
1245 (goto-char (point-max)) 1246 (goto-char (point-max))
1246 (unless (bolp) (insert "\n")) 1247 (unless (bolp) (insert "\n"))
1247 (insert str (if old-dir "/\n" "\n")) 1248 (insert str (if old-dir "/\n" "\n"))
1248 (if cvs-sort-ignore-file (sort-lines nil (point-min) (point-max))) 1249 ;; FIXME this is a pcvs variable.
1250 (if (bound-and-true-p cvs-sort-ignore-file)
1251 (sort-lines nil (point-min) (point-max)))
1249 (save-buffer))) 1252 (save-buffer)))
1250 1253
1251(provide 'vc-cvs) 1254(provide 'vc-cvs)
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 7888752553e..62fb72d0fbc 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -398,6 +398,8 @@ Display the buffer in some window, but don't select it."
398 (set (make-local-variable 'compilation-error-regexp-alist) 398 (set (make-local-variable 'compilation-error-regexp-alist)
399 error-regexp-alist))) 399 error-regexp-alist)))
400 400
401(declare-function vc-dir-refresh "vc-dir" ())
402
401(defun vc-set-async-update (process-buffer) 403(defun vc-set-async-update (process-buffer)
402 "Set a `vc-exec-after' action appropriate to the current buffer. 404 "Set a `vc-exec-after' action appropriate to the current buffer.
403This action will update the current buffer after the current 405This action will update the current buffer after the current
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index a4ce3a2c46c..e730db17526 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -706,6 +706,9 @@ It is based on `log-edit-mode', and has Git-specific extensions.")
706 '(("^ \\(.+\\) |" 1 nil nil 0)) 706 '(("^ \\(.+\\) |" 1 nil nil 0))
707 "Value of `compilation-error-regexp-alist' in *vc-git* buffers.") 707 "Value of `compilation-error-regexp-alist' in *vc-git* buffers.")
708 708
709;; To be called via vc-pull from vc.el, which requires vc-dispatcher.
710(declare-function vc-compilation-mode "vc-dispatcher" (backend))
711
709(defun vc-git-pull (prompt) 712(defun vc-git-pull (prompt)
710 "Pull changes into the current Git branch. 713 "Pull changes into the current Git branch.
711Normally, this runs \"git pull\". If PROMPT is non-nil, prompt 714Normally, this runs \"git pull\". If PROMPT is non-nil, prompt
@@ -725,6 +728,7 @@ for the Git command to run."
725 (setq git-program (car args) 728 (setq git-program (car args)
726 command (cadr args) 729 command (cadr args)
727 args (cddr args))) 730 args (cddr args)))
731 (require 'vc-dispatcher)
728 (apply 'vc-do-async-command buffer root git-program command args) 732 (apply 'vc-do-async-command buffer root git-program command args)
729 (with-current-buffer buffer (vc-run-delayed (vc-compilation-mode 'git))) 733 (with-current-buffer buffer (vc-run-delayed (vc-compilation-mode 'git)))
730 (vc-set-async-update buffer))) 734 (vc-set-async-update buffer)))
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index afc76c09742..36f27548123 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -234,12 +234,12 @@ RESULT is a list of conses (FILE . STATE) for directory DIR."
234 (vc-run-delayed 234 (vc-run-delayed
235 (vc-svn-after-dir-status callback remote)))) 235 (vc-svn-after-dir-status callback remote))))
236 236
237(defun vc-svn-dir-status-files (dir files _default-state callback) 237(defun vc-svn-dir-status-files (_dir files _default-state callback)
238 (apply 'vc-svn-command (current-buffer) 'async nil "status" files) 238 (apply 'vc-svn-command (current-buffer) 'async nil "status" files)
239 (vc-run-delayed 239 (vc-run-delayed
240 (vc-svn-after-dir-status callback))) 240 (vc-svn-after-dir-status callback)))
241 241
242(defun vc-svn-dir-extra-headers (dir) 242(defun vc-svn-dir-extra-headers (_dir)
243 "Generate extra status headers for a Subversion working copy." 243 "Generate extra status headers for a Subversion working copy."
244 (let (process-file-side-effects) 244 (let (process-file-side-effects)
245 (vc-svn-command "*vc*" 0 nil "info")) 245 (vc-svn-command "*vc*" 0 nil "info"))
@@ -352,7 +352,7 @@ This is only possible if SVN is responsible for FILE's directory.")
352 (concat "-r" rev)) 352 (concat "-r" rev))
353 (vc-switches 'SVN 'checkout)))) 353 (vc-switches 'SVN 'checkout))))
354 354
355(defun vc-svn-ignore (file &optional directory remove) 355(defun vc-svn-ignore (file &optional _directory _remove)
356 "Ignore FILE under Subversion. 356 "Ignore FILE under Subversion.
357FILE is a file wildcard, relative to the root directory of DIRECTORY." 357FILE is a file wildcard, relative to the root directory of DIRECTORY."
358 (vc-svn-command t 0 file "propedit" "svn:ignore")) 358 (vc-svn-command t 0 file "propedit" "svn:ignore"))
@@ -593,7 +593,7 @@ NAME is assumed to be a URL."
593 (vc-svn-command nil 0 dir "copy" name) 593 (vc-svn-command nil 0 dir "copy" name)
594 (when branchp (vc-svn-retrieve-tag dir name nil))) 594 (when branchp (vc-svn-retrieve-tag dir name nil)))
595 595
596(defun vc-svn-retrieve-tag (dir name update) 596(defun vc-svn-retrieve-tag (dir name _update)
597 "Retrieve a tag at and below DIR. 597 "Retrieve a tag at and below DIR.
598NAME is the name of the tag; if it is empty, do a `svn update'. 598NAME is the name of the tag; if it is empty, do a `svn update'.
599If UPDATE is non-nil, then update (resynch) any affected buffers. 599If UPDATE is non-nil, then update (resynch) any affected buffers.
@@ -674,19 +674,23 @@ and that it passes `vc-svn-global-switches' to it before FLAGS."
674 674
675(defun vc-svn-parse-status (&optional filename) 675(defun vc-svn-parse-status (&optional filename)
676 "Parse output of \"svn status\" command in the current buffer. 676 "Parse output of \"svn status\" command in the current buffer.
677Set file properties accordingly. Unless FILENAME is non-nil, parse only 677Set file properties accordingly. If FILENAME is non-nil, return its status."
678information about FILENAME and return its status." 678 (let (multifile file status propstat)
679 (let (file status propstat)
680 (goto-char (point-min)) 679 (goto-char (point-min))
681 (while (re-search-forward 680 (while (re-search-forward
682 ;; Ignore the files with status X. 681 ;; Ignore the files with status X.
683 "^\\(?:\\?\\|[ ACDGIMR!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\)\\) +" nil t) 682 "^\\(?:\\?\\|[ ACDGIMR!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\)\\) +" nil t)
684 ;; If the username contains spaces, the output format is ambiguous, 683 ;; If the username contains spaces, the output format is ambiguous,
685 ;; so don't trust the output's filename unless we have to. 684 ;; so don't trust the output's filename unless we have to.
686 (setq file (or filename 685 (setq file (or (unless multifile filename)
687 (expand-file-name 686 (expand-file-name
688 (buffer-substring (point) (line-end-position))))) 687 (buffer-substring (point) (line-end-position))))
689 (setq status (char-after (line-beginning-position)) 688 ;; If we are parsing the result of running status on a directory,
689 ;; there could be multiple files in the output.
690 ;; We assume that filename, if supplied, applies to the first
691 ;; listed file (ie, the directory). Bug#15322.
692 multifile t
693 status (char-after (line-beginning-position))
690 ;; Status of the item's properties ([ MC]). 694 ;; Status of the item's properties ([ MC]).
691 propstat (char-after (1+ (line-beginning-position)))) 695 propstat (char-after (1+ (line-beginning-position))))
692 (if (eq status ??) 696 (if (eq status ??)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 39e3fbdc29a..fa5c87d44e3 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -965,7 +965,8 @@ Within directories, only files already under version control are noticed."
965 "Deduce a set of files and a backend to which to apply an operation. 965 "Deduce a set of files and a backend to which to apply an operation.
966Return (BACKEND FILESET FILESET-ONLY-FILES STATE CHECKOUT-MODEL). 966Return (BACKEND FILESET FILESET-ONLY-FILES STATE CHECKOUT-MODEL).
967 967
968If we're in VC-dir mode, FILESET is the list of marked files. 968If we're in VC-dir mode, FILESET is the list of marked files,
969or the directory if no files are marked.
969Otherwise, if in a buffer visiting a version-controlled file, 970Otherwise, if in a buffer visiting a version-controlled file,
970FILESET is a single-file fileset containing that file. 971FILESET is a single-file fileset containing that file.
971Otherwise, if ALLOW-UNREGISTERED is non-nil and the visited file 972Otherwise, if ALLOW-UNREGISTERED is non-nil and the visited file
diff --git a/lisp/w32-common-fns.el b/lisp/w32-common-fns.el
index 9f3501a01d7..5d8d7171860 100644
--- a/lisp/w32-common-fns.el
+++ b/lisp/w32-common-fns.el
@@ -107,9 +107,8 @@ Consult the selection. Treat empty strings as if they were unset."
107 (if x-select-enable-clipboard 107 (if x-select-enable-clipboard
108 (let (text) 108 (let (text)
109 ;; Don't die if x-get-selection signals an error. 109 ;; Don't die if x-get-selection signals an error.
110 (condition-case c 110 (with-demoted-errors "w32-get-clipboard-data:%s"
111 (setq text (w32-get-clipboard-data)) 111 (setq text (w32-get-clipboard-data)))
112 (error (message "w32-get-clipboard-data:%s" c)))
113 (if (string= text "") (setq text nil)) 112 (if (string= text "") (setq text nil))
114 (cond 113 (cond
115 ((not text) nil) 114 ((not text) nil)