aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoakim Verona2013-06-12 12:32:25 +0200
committerJoakim Verona2013-06-12 12:32:25 +0200
commite6fa6da6899bf1b4877b96c450eae3934085d560 (patch)
tree48e6fda463d24a792ec8428fb8044a250ee2ff82 /lisp
parent4f0994366d33f8f76db4662cc126720866df3461 (diff)
parent84d6f46535554f9f51aae3314313112e8d755c65 (diff)
downloademacs-e6fa6da6899bf1b4877b96c450eae3934085d560.tar.gz
emacs-e6fa6da6899bf1b4877b96c450eae3934085d560.zip
Merge branch 'trunk' into xwidget
Conflicts: src/Makefile.in src/keyboard.c src/termhooks.h
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog733
-rw-r--r--lisp/ChangeLog.26
-rw-r--r--lisp/Makefile.in5
-rw-r--r--lisp/allout.el2
-rw-r--r--lisp/autorevert.el57
-rw-r--r--lisp/bindings.el1
-rw-r--r--lisp/cedet/ChangeLog93
-rw-r--r--lisp/cedet/ede.el21
-rw-r--r--lisp/cedet/ede/base.el66
-rw-r--r--lisp/cedet/ede/cpp-root.el5
-rw-r--r--lisp/cedet/ede/proj.el2
-rw-r--r--lisp/cedet/semantic.el3
-rw-r--r--lisp/cedet/semantic/analyze/fcn.el2
-rw-r--r--lisp/cedet/semantic/bovine/c.el2
-rw-r--r--lisp/cedet/semantic/bovine/el.el9
-rw-r--r--lisp/cedet/semantic/complete.el2
-rw-r--r--lisp/cedet/semantic/ctxt.el83
-rw-r--r--lisp/cedet/semantic/db.el2
-rw-r--r--lisp/cedet/semantic/decorate/mode.el44
-rw-r--r--lisp/cedet/semantic/ede-grammar.el2
-rw-r--r--lisp/cedet/semantic/edit.el5
-rw-r--r--lisp/cedet/semantic/grammar.el5
-rw-r--r--lisp/cedet/semantic/idle.el54
-rw-r--r--lisp/cedet/semantic/lex.el2
-rw-r--r--lisp/cedet/semantic/wisent/python.el14
-rw-r--r--lisp/cedet/srecode/args.el1
-rw-r--r--lisp/cedet/srecode/compile.el28
-rw-r--r--lisp/cedet/srecode/java.el1
-rw-r--r--lisp/cedet/srecode/srt-wy.el6
-rw-r--r--lisp/emacs-lisp/bytecomp.el189
-rw-r--r--lisp/emacs-lisp/cconv.el15
-rw-r--r--lisp/emacs-lisp/cl-lib.el4
-rw-r--r--lisp/emacs-lisp/cl-loaddefs.el11
-rw-r--r--lisp/emacs-lisp/cl-macs.el50
-rw-r--r--lisp/emacs-lisp/edebug.el5
-rw-r--r--lisp/emacs-lisp/eieio-base.el1
-rw-r--r--lisp/emacs-lisp/eieio-core.el2264
-rw-r--r--lisp/emacs-lisp/eieio.el2234
-rw-r--r--lisp/emacs-lisp/generic.el89
-rw-r--r--lisp/emacs-lisp/lisp-mode.el11
-rw-r--r--lisp/emacs-lisp/lisp.el104
-rw-r--r--lisp/emacs-lisp/macroexp.el15
-rw-r--r--lisp/emacs-lisp/package-x.el63
-rw-r--r--lisp/emacs-lisp/package.el378
-rw-r--r--lisp/emacs-lisp/smie.el175
-rw-r--r--lisp/emacs-lisp/syntax.el13
-rw-r--r--lisp/emacs-lisp/trace.el12
-rw-r--r--lisp/epa.el27
-rw-r--r--lisp/erc/ChangeLog4
-rw-r--r--lisp/erc/erc-backend.el3
-rw-r--r--lisp/eshell/em-cmpl.el16
-rw-r--r--lisp/eshell/em-dirs.el3
-rw-r--r--lisp/eshell/em-script.el7
-rw-r--r--lisp/eshell/em-term.el76
-rw-r--r--lisp/eshell/esh-ext.el17
-rw-r--r--lisp/eshell/esh-mode.el7
-rw-r--r--lisp/finder.el3
-rw-r--r--lisp/font-lock.el2
-rw-r--r--lisp/gnus/ChangeLog105
-rw-r--r--lisp/gnus/eww.el349
-rw-r--r--lisp/gnus/gnus-art.el104
-rw-r--r--lisp/gnus/gnus-ems.el4
-rw-r--r--lisp/gnus/mm-view.el20
-rw-r--r--lisp/gnus/nnmail.el6
-rw-r--r--lisp/gnus/registry.el376
-rw-r--r--lisp/gnus/shr.el63
-rw-r--r--lisp/gnus/sieve-manage.el248
-rw-r--r--lisp/gnus/sieve.el13
-rw-r--r--lisp/gnus/spam-stat.el3
-rw-r--r--lisp/help-fns.el21
-rw-r--r--lisp/help-mode.el4
-rw-r--r--lisp/hi-lock.el38
-rw-r--r--lisp/ido.el108
-rw-r--r--lisp/ielm.el15
-rw-r--r--lisp/image.el7
-rw-r--r--lisp/international/mule-conf.el1
-rw-r--r--lisp/isearch.el91
-rw-r--r--lisp/ldefs-boot.el583
-rw-r--r--lisp/loadup.el1
-rw-r--r--lisp/minibuffer.el16
-rw-r--r--lisp/net/net-utils.el4
-rw-r--r--lisp/net/rlogin.el27
-rw-r--r--lisp/net/tls.el5
-rw-r--r--lisp/newcomment.el44
-rw-r--r--lisp/obsolete/sym-comp.el11
-rw-r--r--lisp/paren.el296
-rw-r--r--lisp/pcmpl-gnu.el3
-rw-r--r--lisp/progmodes/cc-bytecomp.el16
-rw-r--r--lisp/progmodes/cc-cmds.el1
-rw-r--r--lisp/progmodes/cc-defs.el14
-rw-r--r--lisp/progmodes/cc-engine.el7
-rw-r--r--lisp/progmodes/cc-fonts.el1
-rw-r--r--lisp/progmodes/cc-mode.el5
-rw-r--r--lisp/progmodes/cc-vars.el23
-rw-r--r--lisp/progmodes/cfengine.el10
-rw-r--r--lisp/progmodes/compile.el6
-rw-r--r--lisp/progmodes/gdb-mi.el2
-rw-r--r--lisp/progmodes/octave.el185
-rw-r--r--lisp/progmodes/perl-mode.el49
-rw-r--r--lisp/progmodes/prog-mode.el119
-rw-r--r--lisp/progmodes/prolog.el44
-rw-r--r--lisp/progmodes/python.el5
-rw-r--r--lisp/progmodes/ruby-mode.el110
-rw-r--r--lisp/progmodes/tcl.el2
-rw-r--r--lisp/replace.el166
-rw-r--r--lisp/simple.el28
-rw-r--r--lisp/skeleton.el12
-rw-r--r--lisp/subr.el479
-rw-r--r--lisp/term/ns-win.el5
-rw-r--r--lisp/vc/log-view.el40
-rw-r--r--lisp/vc/vc.el28
111 files changed, 6493 insertions, 4484 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3fa1ffe40a7..ae429db7a7a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,657 @@
12013-06-12 Glenn Morris <rgm@gnu.org>
2
3 * ido.el (ido-delete-ignored-files): Remove.
4 (ido-wide-find-dirs-or-files, ido-make-file-list-1):
5 Go back to calling ido-ignore-item-p directly.
6
72013-06-12 Eyal Lotem <eyal.lotem@gmail.com> (tiny change)
8
9 * ido.el (ido-wide-find-dirs-or-files): Respect ido-case-fold.
10
11 * ido.el (ido-delete-ignored-files): New function,
12 split from ido-make-file-list-1.
13 (ido-wide-find-dirs-or-files): Maybe ignore files. (Bug#13003)
14 (ido-make-file-list-1): Use ido-delete-ignored-files.
15
162013-06-12 Leo Liu <sdl.web@gmail.com>
17
18 * progmodes/octave.el (inferior-octave-startup)
19 (inferior-octave-completion-table)
20 (inferior-octave-track-window-width-change)
21 (octave-eldoc-function-signatures, octave-help)
22 (octave-find-definition): Use single quoted strings.
23 (inferior-octave-startup-args): Change default value.
24 (inferior-octave-startup): Do not hard code "-i" and
25 "--no-line-editing".
26 (inferior-octave-resync-dirs): Add optional arg NOERROR.
27 (inferior-octave-directory-tracker): Use it.
28 (octave-goto-function-definition): Robustify.
29 (octave-help): Support highlighting operators in 'See also'.
30 (octave-find-definition): Find subfunctions only in Octave mode.
31
322013-06-12 Stefan Monnier <monnier@iro.umontreal.ca>
33
34 * help-fns.el (help-fns--compiler-macro): If the handler function is
35 named, then put a link to it.
36 * help-mode.el (help-function-cmacro): Adjust regexp for cl-lib names.
37 * emacs-lisp/cl-macs.el (cl--compiler-macro-typep): New function.
38 (cl-typep): Use it.
39 (cl-eval-when): Simplify debug spec.
40 (cl-define-compiler-macro): Use eval-and-compile. Give a name to the
41 compiler-macro function instead of setting `compiler-macro-file'.
42
432013-06-12 Stefan Monnier <monnier@iro.umontreal.ca>
44 Daniel Hackney <dan@haxney.org>
45
46 First part of Daniel Hackney's patch to package.el.
47 * emacs-lisp/package.el: Use defstruct.
48 (package-desc): New, main struct.
49 (package--bi-desc, package--ac-desc): New structs, used to describe the
50 format in external files.
51 (package-desc-vers): Replace with package-desc-version accessor.
52 (package-desc-doc): Replace with package-desc-summary accessor.
53 (package-activate-1): Remove `package' arg since the pkg-vec now
54 includes the name.
55 (define-package): Use package-desc-from-define.
56 (package-unpack-single): Change file-name arg to be a symbol.
57 (package--add-to-archive-contents): Use package-desc-create and new
58 accessor functions to package--ac-desc.
59 (package-buffer-info, package-tar-file-info): Return a package-desc.
60 (package-install-from-buffer): Remove `type' argument. Change pkg-info
61 arg to be a package-desc.
62 (package-install-file): Adjust accordingly. Use \' to match EOS.
63 (package--from-builtin): New function.
64 (describe-package-1, package-menu--generate): Use it.
65 (package--make-autoloads-and-compile): Change name arg to be a symbol.
66 (package-generate-autoloads): Idem and return the name of the file.
67 * emacs-lisp/package-x.el (package-upload-buffer-internal):
68 Change pkg-info arg to be a package-desc.
69 Use package-make-ac-desc.
70 (package-upload-file): Use \' to match EOS.
71 * finder.el (finder-compile-keywords): Use package-make-builtin.
72
732013-06-11 Stefan Monnier <monnier@iro.umontreal.ca>
74
75 * vc/vc.el (vc-deduce-fileset): Change error message.
76 (vc-read-backend): New function.
77 (vc-next-action): Use it.
78
79 * subr.el (function-arity): Remove (mistakenly added) (bug#14590).
80
81 * progmodes/prolog.el (prolog-make-keywords-regexp): Remove.
82 (prolog-font-lock-keywords): Use regexp-opt instead.
83 Don't manually highlight strings.
84 (prolog-mode-variables): Simplify comment-start-skip.
85 (prolog-consult-compile): Use display-buffer. Remove unused old-filter.
86
87 * emacs-lisp/generic.el (generic--normalise-comments)
88 (generic-set-comment-syntax, generic-set-comment-vars): New functions.
89 (generic-mode-set-comments): Use them.
90 (generic-bracket-support): Use setq-local.
91 (generic-make-keywords-list): Declare obsolete.
92
932013-06-11 Glenn Morris <rgm@gnu.org>
94
95 * emacs-lisp/lisp-mode.el (lisp-mode-variables):
96 Prettify after setting font-lock-defaults. (Bug#14574)
97
982013-06-11 Juanma Barranquero <lekktu@gmail.com>
99
100 * replace.el (query-replace, occur-read-regexp-defaults-function)
101 (replace-search):
102 * subr.el (declare-function, number-sequence, local-set-key)
103 (substitute-key-definition, locate-user-emacs-file)
104 (with-silent-modifications, split-string, eval-after-load):
105 Fix typos, remove unneeded backslashes and reflow some docstrings.
106
1072013-06-11 Stefan Monnier <monnier@iro.umontreal.ca>
108
109 * international/mule-conf.el (file-coding-system-alist): Use utf-8 as
110 default for Elisp files.
111
1122013-06-11 Glenn Morris <rgm@gnu.org>
113
114 * vc/log-view.el (log-view-mode-map): Inherit from special-mode-map,
115 although define-derived-mode was doing this anyway. (Bug#14583)
116
1172013-06-10 Juanma Barranquero <lekktu@gmail.com>
118
119 * allout.el (allout-encryption-plaintext-sanitization-regexps):
120 Fix make-variable-buffer-local call to refer to the correct variable.
121
1222013-06-10 Aidan Gauland <aidalgol@amuri.net>
123
124 * eshell/em-term.el (eshell-visual-commands)
125 (eshell-visual-subcommands, eshell-visual-options):
126 Add summary line to docstrings. Add cross-references.
127
1282013-06-10 Glenn Morris <rgm@gnu.org>
129
130 * epa.el (epa-read-file-name): New function. (Bug#14510)
131 (epa-decrypt-file): Make plain-file optional. Use epa-read-file-name.
132
1332013-06-09 Aidan Gauland <aidalgol@amuri.net>
134
135 * eshell/em-term.el (eshell-visual-command-p): Fix bug that caused
136 output redirection to be ignored with visual commands.
137
1382013-06-09 Aidan Gauland <aidalgol@amuri.net>
139
140 * eshell/em-term.el (eshell-visual-command-p): New function.
141 (eshell-term-initialize): Move long lambda to separate function
142 eshell-visual-command-p.
143 * eshell/em-dirs.el (eshell-dirs-initialise):
144 * eshell/em-script.el (eshell-script-initialize):
145 Add missing #' to lambda.
146
1472013-06-08 Leo Liu <sdl.web@gmail.com>
148
149 * progmodes/octave.el (octave-add-log-current-defun): New function.
150 (octave-mode): Set add-log-current-defun-function.
151 (octave-goto-function-definition): Do not move point if not found.
152 (octave-find-definition): Enhance to try subfunctions first.
153
1542013-06-08 Glenn Morris <rgm@gnu.org>
155
156 * emacs-lisp/bytecomp.el (byte-compile-char-before)
157 (byte-compile-backward-char, byte-compile-backward-word):
158 Improve previous change, to handle non-explicit nil.
159
1602013-06-07 Stefan Monnier <monnier@iro.umontreal.ca>
161
162 * emacs-lisp/smie.el: Improve show-paren-mode behavior.
163 (smie--opener/closer-at-point): New function.
164 (smie--matching-block-data): Use it. Don't match from right after an
165 opener or right before a closer. Obey smie-blink-matching-inners.
166 Don't signal a mismatch for repeated inners like "switch..case..case".
167
1682013-06-07 Leo Liu <sdl.web@gmail.com>
169
170 * progmodes/octave.el (octave-mode): Set comment-use-global-state
171 to t. (Bug#14303)
172 (octave-function-header-regexp): Fix. (Bug#14570)
173 (octave-help-mode-finish-hook, octave-help-mode-finish):
174 Remove. Just use temp-buffer-show-hook.
175
176 * newcomment.el (comment-search-backward): Revert last change.
177 (Bug#14434)
178
179 * emacs-lisp/smie.el (smie--matching-block-data): Minor simplification.
180
1812013-06-07 Eli Zaretskii <eliz@gnu.org>
182
183 * Makefile.in (TAGS TAGS-LISP): Pass the (long) list of *.el files
184 through xargs, to avoid failure due to MS-Windows limitations on
185 command-line length.
186
1872013-06-06 Glenn Morris <rgm@gnu.org>
188
189 * font-lock.el (lisp-font-lock-keywords-2):
190 Treat user-error like error.
191
192 * emacs-lisp/bytecomp.el (byte-compile-char-before)
193 (byte-compile-backward-char, byte-compile-backward-word):
194 Handle explicit nil arguments. (Bug#14565)
195
1962013-06-05 Alan Mackenzie <acm@muc.de>
197
198 * isearch.el (isearch-allow-prefix): New user option.
199 (isearch-other-meta-char): Don't exit isearch when a prefix
200 argument is typed whilst `isearch-allow-prefix' is non-nil.
201 (Bug#9706)
202
2032013-06-05 Stefan Monnier <monnier@iro.umontreal.ca>
204
205 * autorevert.el (auto-revert-notify-handler): Use memq.
206 Hide assertion failure.
207
208 * skeleton.el: Use cl-lib.
209 (skeleton-further-elements): Use defvar-local.
210 (skeleton-insert): Use cl-progv.
211
2122013-06-05 Teodor Zlatanov <tzz@lifelogs.com>
213
214 * progmodes/prog-mode.el (prog-prettify-symbols)
215 (prog-prettify-install): Update docstrings.
216
2172013-06-05 Stefan Monnier <monnier@iro.umontreal.ca>
218
219 * simple.el: Move all the prog-mode code to prog-mode.el.
220 * progmodes/prog-mode.el: New file.
221 * loadup.el: Add prog-mode.el.
222
2232013-06-05 Teodor Zlatanov <tzz@lifelogs.com>
224
225 * simple.el (prog-prettify-symbols): Add version.
226 (prog-prettify-install): Add convenience function to prettify symbols.
227
228 * progmodes/perl-mode.el (perl--augmented-font-lock-keywords)
229 (perl--augmented-font-lock-keywords-1)
230 (perl--augmented-font-lock-keywords-2, perl-mode): Remove unneeded
231 variables and use it.
232
233 * progmodes/cfengine.el (cfengine3--augmented-font-lock-keywords)
234 (cfengine3-mode): Remove unneeded variable and use it.
235
236 * emacs-lisp/lisp-mode.el (lisp--augmented-font-lock-keywords)
237 (lisp--augmented-font-lock-keywords-1)
238 (lisp--augmented-font-lock-keywords-2, lisp-mode-variables):
239 Remove unneeded variables and use it.
240
2412013-06-05 João Távora <joaotavora@gmail.com>
242
243 * net/tls.el (open-tls-stream): Remove unneeded buffer contents up
244 to point when opening the connection. (Bug#14380)
245
2462013-06-05 Stefan Monnier <monnier@iro.umontreal.ca>
247
248 * subr.el (load-history-regexp, load-history-filename-element)
249 (eval-after-load, after-load-functions, do-after-load-evaluation)
250 (eval-next-after-load, display-delayed-warnings)
251 (collapse-delayed-warnings, delayed-warnings-hook): Move after the
252 definition of save-match-data.
253 (overriding-local-map): Remove accidental obsolescence declaration.
254
255 * emacs-lisp/edebug.el (edebug-result): Move before first use.
256
2572013-06-05 Teodor Zlatanov <tzz@lifelogs.com>
258
259 Generalize symbol prettify support to prog-mode and implement it
260 for perl-mode, cfengine3-mode, and emacs-lisp-mode.
261 * simple.el (prog-prettify-symbols-alist, prog-prettify-symbols)
262 (prog--prettify-font-lock-compose-symbol)
263 (prog-prettify-font-lock-symbols-keywords): New variables and
264 functions to support symbol prettification.
265 * emacs-lisp/lisp-mode.el (lisp--augmented-font-lock-keywords)
266 (lisp--augmented-font-lock-keywords-1)
267 (lisp--augmented-font-lock-keywords-2, lisp-mode-variables)
268 (lisp--prettify-symbols-alist): Implement prettify of lambda.
269 * progmodes/cfengine.el (cfengine3--augmented-font-lock-keywords)
270 (cfengine3--prettify-symbols-alist, cfengine3-mode):
271 Implement prettify of -> => :: strings.
272 * progmodes/perl-mode.el (perl-prettify-symbols)
273 (perl--font-lock-compose-symbol)
274 (perl--font-lock-symbols-keywords): Move to prog-mode.
275 (perl--prettify-symbols-alist): Prettify -> => :: strings.
276 (perl-font-lock-keywords-1)
277 (perl-font-lock-keywords-2): Remove explicit prettify support.
278 (perl--augmented-font-lock-keywords)
279 (perl--augmented-font-lock-keywords-1)
280 (perl--augmented-font-lock-keywords-2, perl-mode):
281 Implement prettify support.
282
2832013-06-05 Leo Liu <sdl.web@gmail.com>
284
285 Re-implement smie matching block highlight using
286 show-paren-data-function. (Bug#14395)
287 * emacs-lisp/smie.el (smie-matching-block-highlight)
288 (smie--highlight-matching-block-overlay)
289 (smie--highlight-matching-block-lastpos)
290 (smie-highlight-matching-block)
291 (smie-highlight-matching-block-mode): Remove.
292 (smie--matching-block-data-cache): New variable.
293 (smie--matching-block-data): New function.
294 (smie-setup): Use smie--matching-block-data for
295 show-paren-data-function.
296
297 * progmodes/octave.el (octave-mode-menu): Fix.
298 (octave-find-definition): Skip garbage lines.
299
3002013-06-05 Stefan Monnier <monnier@iro.umontreal.ca>
301
302 Fix compilation error with simultaneous dynamic+lexical scoping.
303 Add warning when a defvar appears after the first let-binding.
304 * emacs-lisp/bytecomp.el (byte-compile-lexical-variables): New var.
305 (byte-compile-close-variables): Initialize it.
306 (byte-compile--declare-var): New function.
307 (byte-compile-file-form-defvar)
308 (byte-compile-file-form-define-abbrev-table)
309 (byte-compile-file-form-custom-declare-variable): Use it.
310 (byte-compile-make-lambda-lexenv): Change the argument. Simplify.
311 (byte-compile-lambda): Share call to byte-compile-arglist-vars.
312 (byte-compile-bind): Handle dynamic bindings that shadow
313 lexical bindings.
314 (byte-compile-unbind): Make arg non-optional.
315 (byte-compile-let): Simplify.
316 * emacs-lisp/cconv.el (byte-compile-lexical-variables): Declare var.
317 (cconv--analyse-function, cconv-analyse-form): Populate it.
318 Protect byte-compile-bound-variables to limit the scope of defvars.
319 (cconv-analyse-form): Add missing rule for (defvar <foo>).
320 Remove unneeded rule for `declare'.
321
322 * emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin): Use macroexp-let2
323 so as to avoid depending on cl-adjoin at run-time.
324 * emacs-lisp/cl-lib.el (cl-pushnew): Use backquotes.
325
326 * emacs-lisp/macroexp.el (macroexp--compiling-p): New function.
327 (macroexp--warn-and-return): Use it.
328
3292013-06-05 Leo Liu <sdl.web@gmail.com>
330
331 * eshell/esh-mode.el (eshell-mode): Fix key bindings.
332
3332013-06-04 Leo Liu <sdl.web@gmail.com>
334
335 * progmodes/compile.el (compile-goto-error): Add optional arg NOMSG.
336 (compilation-auto-jump): Suppress the "Mark set" message to give
337 way to exit message.
338
3392013-06-04 Alan Mackenzie <acm@muc.de>
340
341 Remove faulty optimisation from indentation calculation.
342 * progmodes/cc-engine.el (c-guess-basic-syntax): Don't calculate
343 search limit based on 2000 characters back from indent-point.
344
3452013-06-03 Tassilo Horn <tsdh@gnu.org>
346
347 * eshell/em-term.el (cl-lib): Require `cl-lib'.
348
3492013-06-03 Stefan Monnier <monnier@iro.umontreal.ca>
350
351 * emacs-lisp/lisp.el: Use lexical-binding.
352 (lisp--local-variables-1, lisp--local-variables): New functions.
353 (lisp--local-variables-completion-table): New var.
354 (lisp-completion-at-point): Use it complete let-bound vars.
355
356 * emacs-lisp/lisp-mode.el (eval-sexp-add-defvars): Expand macros
357 eagerly (bug#14422).
358
3592013-06-03 Michael Albinus <michael.albinus@gmx.de>
360
361 * autorevert.el (auto-revert-notify-enabled)
362 (auto-revert-notify-rm-watch, auto-revert-notify-add-watch)
363 (auto-revert-notify-event-p, auto-revert-notify-event-file-name)
364 (auto-revert-notify-handler): Handle also gfilenotify.
365
366 * subr.el (file-notify-handle-event): New defun. Replacing ...
367 (inotify-event-p, inotify-handle-event, w32notify-handle-event):
368 Remove.
369
3702013-06-03 Juri Linkov <juri@jurta.org>
371
372 * bindings.el (search-map): Bind `highlight-symbol-at-point' to
373 `M-s h .'. (Bug#14427)
374
375 * hi-lock.el (highlight-symbol-at-point): New alias for the new
376 command `hi-lock-face-symbol-at-point'.
377 (hi-lock-face-symbol-at-point): New command.
378 (hi-lock-map): Bind `highlight-symbol-at-point' to `C-x w .'.
379 (hi-lock-menu): Add `highlight-symbol-at-point'.
380 (hi-lock-mode): Doc fix.
381
382 * isearch.el (isearch-forward-symbol-at-point): New command.
383 (search-map): Bind `isearch-forward-symbol-at-point' to `M-s .'.
384 (isearch-highlight-regexp): Add a regexp which matches
385 words/symbols for word/symbol mode.
386
387 * subr.el (find-tag-default-bounds): New function with the body
388 mostly moved from `find-tag-default'.
389 (find-tag-default): Move most code to `find-tag-default-bounds',
390 call it and apply `buffer-substring-no-properties' afterwards.
391
3922013-06-03 Tassilo Horn <tsdh@gnu.org>
393
394 * eshell/em-term.el (eshell-term-initialize):
395 Use `cl-intersection' rather than `intersection'.
396
3972013-06-02 Xue Fuqiao <xfq.free@gmail.com>
398
399 * vc/log-view.el: Doc fix.
400 (log-view-mode-map): Copy keymap from `special-mode-map'.
401
4022013-06-02 Eric Ludlam <zappo@gnu.org>
403
404 * emacs-lisp/eieio.el (eieio--defalias, eieio-hook)
405 (eieio-error-unsupported-class-tags, eieio-skip-typecheck)
406 (eieio-optimize-primary-methods-flag, eieio-initializing-object)
407 (eieio-unbound, eieio-default-superclass)
408 (eieio--define-field-accessors, method-static, method-before)
409 (method-primary, method-after, method-num-lists)
410 (method-generic-before, method-generic-primary)
411 (method-generic-after, method-num-slots)
412 (eieio-specialized-key-to-generic-key)
413 (eieio--check-type, class-v, class-p)
414 (eieio-class-name, define-obsolete-function-alias)
415 (eieio-class-parents-fast, eieio-class-children-fast)
416 (same-class-fast-p, class-constructor, generic-p)
417 (generic-primary-only-p, generic-primary-only-one-p)
418 (class-option-assoc, class-option, eieio-object-p)
419 (class-abstract-p, class-method-invocation-order)
420 (eieio-defclass-autoload-map, eieio-defclass-autoload)
421 (eieio-class-un-autoload, eieio-defclass)
422 (eieio-eval-default-p, eieio-perform-slot-validation-for-default)
423 (eieio-add-new-slot, eieio-copy-parents-into-subclass)
424 (eieio--defgeneric-init-form, eieio-defgeneric-form)
425 (eieio-defgeneric-reset-generic-form)
426 (eieio-defgeneric-form-primary-only)
427 (eieio-defgeneric-reset-generic-form-primary-only)
428 (eieio-defgeneric-form-primary-only-one)
429 (eieio-defgeneric-reset-generic-form-primary-only-one)
430 (eieio-unbind-method-implementations)
431 (eieio--defmethod, eieio--typep)
432 (eieio-perform-slot-validation, eieio-validate-slot-value)
433 (eieio-validate-class-slot-value, eieio-barf-if-slot-unbound)
434 (eieio-oref, eieio-oref-default, eieio-default-eval-maybe)
435 (eieio-oset, eieio-oset-default, eieio-slot-originating-class-p)
436 (eieio-slot-name-index, eieio-class-slot-name-index)
437 (eieio-set-defaults, eieio-initarg-to-attribute)
438 (eieio-attribute-to-initarg, eieio-c3-candidate)
439 (eieio-c3-merge-lists, eieio-class-precedence-c3)
440 (eieio-class-precedence-dfs, eieio-class-precedence-bfs)
441 (eieio-class-precedence-list, eieio-generic-call-methodname)
442 (eieio-generic-call-arglst, eieio-generic-call-key)
443 (eieio-generic-call-next-method-list)
444 (eieio-pre-method-execution-functions, eieio-generic-call)
445 (eieio-generic-call-primary-only, eieiomt-method-list)
446 (eieiomt-optimizing-obarray, eieiomt-install)
447 (eieiomt-add, eieiomt-next, eieiomt-sym-optimize)
448 (eieio-generic-form, eieio-defmethod, make-obsolete)
449 (eieio-defgeneric, make-obsolete): Move to eieio-core.el
450 (defclass): Remove `eval-and-compile' from macro.
451 (call-next-method, shared-initialize): Instead of using
452 `scoped-class' variable, use new eieio--scoped-class, and
453 eieio--with-scoped-class.
454 (initialize-instance): Rename local variable 'scoped-class' to
455 'this-class' to remove ambiguitity from old global.
456
457 * emacs-lisp/eieio-core.el: New file. Derived from key parts of
458 eieio.el.
459 (eieio--scoped-class-stack): New variable
460 (eieio--scoped-class): New fcn
461 (eieio--with-scoped-class): New scoping macro.
462 (eieio-defclass): Use pushnew instead of add-to-list.
463 (eieio-defgeneric-form-primary-only-one, eieio-oset-default)
464 (eieio-slot-name-index, eieio-set-defaults, eieio-generic-call)
465 (eieio-generic-call-primary-only, eieiomt-add): Instead of using
466 `scoped-class' variable, use new eieio--scoped-class, and
467 eieio--with-scoped-class.
468
469 * emacs-lisp/eieio-base.el (cl-lib): Require during compile.
470
4712013-06-02 Tassilo Horn <tsdh@gnu.org>
472
473 * eshell/esh-ext.el (eshell-external-command): Pass args to
474 `eshell-find-interpreter'.
475 (eshell-find-interpreter): Add new second parameter ARGS.
476
477 * eshell/em-script.el (eshell-script-initialize): Add second arg
478 to the function added as MATCH to `eshell-interpreter-alist'.
479
480 * eshell/em-dirs.el (eshell-dirs-initialize): Add second arg to
481 the function added as MATCH to `eshell-interpreter-alist'.
482
483 * eshell/em-term.el (eshell-visual-subcommands): New defcustom.
484 (eshell-visual-options): New defcustom.
485 (eshell-escape-control-x): Adapt docstring.
486 (eshell-term-initialize): Test `eshell-visual-subcommands' and
487 `eshell-visual-options' in addition to `eshell-visual-commands'.
488 (eshell-exec-visual): Pass args to `eshell-find-interpreter'.
489
4902013-06-01 Fabián Ezequiel Gallina <fgallina@gnu.org>
491
492 * progmodes/python.el (python-indent-block-enders): Add break,
493 continue and raise keywords.
494
4952013-06-01 Glenn Morris <rgm@gnu.org>
496
497 * pcmpl-gnu.el (pcomplete/tar): Check obsolete variable is bound.
498
499 Plain (f)boundp silences compilation warnings since Emacs 22.1.
500 * progmodes/cc-cmds.el (delete-forward-p):
501 * progmodes/cc-defs.el (buffer-syntactic-context-depth):
502 * progmodes/cc-engine.el (buffer-syntactic-context):
503 * progmodes/cc-fonts.el (face-property-instance):
504 * progmodes/cc-mode.el (set-keymap-parents):
505 * progmodes/cc-vars.el (get-char-table): No need for cc-bytecomp-defun.
506 * progmodes/cc-defs.el (c-set-region-active, c-beginning-of-defun-1)
507 * progmodes/cc-mode.el (c-make-inherited-keymap): Use plain fboundp.
508 * progmodes/cc-defs.el (zmacs-region-stays, zmacs-regions)
509 (lookup-syntax-properties): Remove unecessary cc-bytecomp-defvar.
510
511 * progmodes/cc-vars.el (other): Emacs has this widget since
512 at least 21.1, so don't (re)define it.
513
514 * eshell/em-cmpl.el (eshell-cmpl-initialize):
515 Replace the obsolete alias pcomplete-arg-quote-list.
516
5172013-06-01 Leo Liu <sdl.web@gmail.com>
518
519 * progmodes/octave.el (octave-mode-syntax-table): Give `.'
520 punctuation syntax.
521 (inferior-octave-minimal-columns)
522 (inferior-octave-last-column-width): New variables.
523 (inferior-octave-track-window-width-change): New function.
524 (inferior-octave-mode): Adjust column width so that Octave output,
525 for example from 'ls', can fit into the window nicely.
526
5272013-05-31 Dmitry Gutov <dgutov@yandex.ru>
528
529 * progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p):
530 Highlight expansions inside regexp literals.
531
5322013-05-31 Glenn Morris <rgm@gnu.org>
533
534 * obsolete/sym-comp.el (symbol-complete):
535 Replace obsolete completion-annotate-function.
536
537 * progmodes/cc-vars.el (c-make-macro-with-semi-re): Silence compiler.
538
5392013-05-31 Dmitry Gutov <dgutov@yandex.ru>
540
541 * progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p):
542 New function, checks if point is inside a literal that allows
543 expression expansion.
544 (ruby-syntax-propertize-expansion): Use it.
545 (ruby-syntax-propertize-function): Bind `case-fold-search' to nil
546 around the body.
547
5482013-05-30 Juri Linkov <juri@jurta.org>
549
550 * isearch.el (isearch-mode-map): Bind `isearch-toggle-invisible'
551 to "\M-si".
552 (isearch-invisible): New variable.
553 (isearch-forward): Doc fix.
554 (isearch-mode): Set `isearch-invisible'
555 to the value of `search-invisible'.
556 (isearch-toggle-case-fold): Doc fix.
557 (isearch-toggle-invisible): New command.
558 (isearch-query-replace): Let-bind `search-invisible'
559 to the value of `isearch-invisible'.
560 (isearch-search): Use `isearch-invisible' instead of
561 `search-invisible'. Let-bind `search-invisible'
562 to the value of `isearch-invisible'. (Bug#11378)
563
5642013-05-30 Juri Linkov <juri@jurta.org>
565
566 * replace.el (perform-replace): Avoid `isearch-range-invisible'
567 call when `query-flag' is nil and `search-invisible' is non-nil.
568 (Bug#11746)
569
5702013-05-30 Glenn Morris <rgm@gnu.org>
571
572 * progmodes/gdb-mi.el (gdb-wait-for-pending): Fix typo.
573
574 * progmodes/cc-bytecomp.el (cc-bytecomp-noruntime-functions): New.
575 (cc-require): Suppress spurious "noruntime" warnings.
576 (cc-require-when-compile): Use fboundp, for sake of compiler.
577
578 * progmodes/cc-mode.el: Move load of cc-vars before that of
579 cc-langs (which in turn loads cc-vars), to quieten compiler.
580
5812013-05-30 Stefan Monnier <monnier@iro.umontreal.ca>
582
583 * paren.el: Simplify the code.
584 (show-paren-mode): Always start the timer.
585 (show-paren--idle-timer): Rename from show-paren-idle-timer.
586 (show-paren--overlay, show-paren--overlay-1): Rename from
587 show-paren-overlay and show-paren-overlay-1, and initialize to an
588 overlay rather than to nil.
589 (show-paren-function): Misc cleanup and simplifications.
590
5912013-05-30 Stefan Monnier <monnier@iro.umontreal.ca>
592
593 * paren.el (show-paren-data-function): New hook.
594 (show-paren--default): New function, extracted from show-paren-function.
595 (show-paren-function): Use show-paren-data-function.
596
5972013-05-30 Glenn Morris <rgm@gnu.org>
598
599 * ielm.el (ielm-map, ielm-complete-symbol):
600 Use completion-at-point rather than obsolete functions.
601 (inferior-emacs-lisp-mode): Doc fix.
602 Set completion-at-point-functions, rather than
603 comint-dynamic-complete-functions.
604
605 * eshell/em-cmpl.el (eshell-complete-lisp-symbol): New function.
606 (eshell-cmpl-initialize, eshell-complete-parse-arguments):
607 Replace obsolete lisp-complete-symbol with eshell-complete-lisp-symbol.
608
609 * image.el (image-animated-p): Tweak definition.
610
611 * net/rlogin.el (rlogin-program, rlogin-explicit-args): Default to ssh.
612 (rlogin-process-connection-type): Tweak default. Add set-after.
613 (rlogin-host): Doc fix.
614 (rlogin): Tweak prompt.
615 (rlogin-tab-or-complete): Use completion-at-point rather than alias.
616
617 * net/net-utils.el (nslookup-mode-map, ftp-mode-map):
618 * progmodes/tcl.el (inferior-tcl-mode-map):
619 Use completion-at-point rather than obsolete alias.
620
621 * emacs-lisp/eieio.el (eieio-eval-default-p): Move before use.
622
623 * minibuffer.el (read-file-name-completion-ignore-case):
624 Move before completion--in-region, for eager macro expansion.
625
6262013-05-29 Juri Linkov <juri@jurta.org>
627
628 * replace.el (occur-engine): Rename `globalcount' to `global-lines'
629 for total count of matching lines. Add `global-matches' for total
630 count of matches. Rename `matches' to `lines' for count of
631 matching lines. Add `matches' for count of matches.
632 Rename `lines' to `curr-line' for line count. Rename `prev-lines'
633 to `prev-line' for line number of prev match endpt.
634 Increment `matches' for every match. Print the number of
635 matching lines in the header.
636 (occur-context-lines): Rename `lines' to `curr-line'.
637 Rename `prev-lines' to `prev-line'. (Bug#14017)
638
6392013-05-29 Juri Linkov <juri@jurta.org>
640
641 * replace.el (perform-replace): Add `skip-read-only-count',
642 `skip-filtered-count', `skip-invisible-count' let-bound to 0.
643 Increment them for corresponding conditions and report the number
644 of skipped occurrences in the final message. (Bug#11746)
645 (query-replace, query-replace-regexp, query-replace-regexp-eval)
646 (replace-string, replace-regexp): Doc fix.
647
6482013-05-29 Stefan Monnier <monnier@iro.umontreal.ca>
649
650 * emacs-lisp/trace.el (trace--read-args): Provide a default.
651
652 * emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Inherit from
653 prog-mode-map (bug#14504).
654
12013-05-29 Leo Liu <sdl.web@gmail.com> 6552013-05-29 Leo Liu <sdl.web@gmail.com>
2 656
3 * progmodes/octave.el (octave-indent-comment): Tweak regexps. 657 * progmodes/octave.el (octave-indent-comment): Tweak regexps.
@@ -24,12 +678,11 @@
242013-05-28 Alan Mackenzie <acm@muc.de> 6782013-05-28 Alan Mackenzie <acm@muc.de>
25 679
26 Handle "capitalised keywords" correctly. 680 Handle "capitalised keywords" correctly.
27 * progmodes/cc-mode.el (c-after-change): bind case-fold-search to 681 * progmodes/cc-mode.el (c-after-change): Bind case-fold-search to nil.
28 nil.
29 682
302013-05-28 Aidan Gauland <aidalgol@amuri.net> 6832013-05-28 Aidan Gauland <aidalgol@amuri.net>
31 684
32 * eshell/em-unix.el: Added -r option to cp 685 * eshell/em-unix.el: Add -r option to cp.
33 686
342013-05-28 Glenn Morris <rgm@gnu.org> 6872013-05-28 Glenn Morris <rgm@gnu.org>
35 688
@@ -1540,7 +2193,7 @@
1540 2193
1541 * emacs-lisp/syntax.el (syntax-propertize-multiline): 2194 * emacs-lisp/syntax.el (syntax-propertize-multiline):
1542 Use `syntax-multiline' text property consistently instead of 2195 Use `syntax-multiline' text property consistently instead of
1543 `font-lock-multiline'. (bug#14237). 2196 `font-lock-multiline'. (Bug#14237)
1544 2197
15452013-04-26 Glenn Morris <rgm@gnu.org> 21982013-04-26 Glenn Morris <rgm@gnu.org>
1546 2199
@@ -1728,9 +2381,9 @@
1728 2381
17292013-04-21 Xue Fuqiao <xfq.free@gmail.com> 23822013-04-21 Xue Fuqiao <xfq.free@gmail.com>
1730 2383
1731 * comint.el: (comint-dynamic-complete-functions, comint-mode-map): 2384 * comint.el (comint-dynamic-complete-functions, comint-mode-map):
1732 `comint-dynamic-complete' is obsolete since 24.1, replaced by 2385 `comint-dynamic-complete' is obsolete since 24.1, replaced by
1733 `completion-at-point'. (Bug#13774) 2386 `completion-at-point'. (Bug#13774)
1734 2387
1735 * startup.el (normal-no-mouse-startup-screen): Bug fix, the 2388 * startup.el (normal-no-mouse-startup-screen): Bug fix, the
1736 default key binding for `describe-distribution' has been moved to 2389 default key binding for `describe-distribution' has been moved to
@@ -1759,7 +2412,8 @@
1759 2412
1760 * comint.el (comint-redirect-original-filter-function): Remove. 2413 * comint.el (comint-redirect-original-filter-function): Remove.
1761 (comint-redirect-cleanup, comint-redirect-send-command-to-process): 2414 (comint-redirect-cleanup, comint-redirect-send-command-to-process):
1762 * vc/vc-cvs.el (vc-cvs-annotate-process-filter,vc-cvs-annotate-command): 2415 * vc/vc-cvs.el (vc-cvs-annotate-process-filter)
2416 (vc-cvs-annotate-command):
1763 * progmodes/octave-inf.el (inferior-octave-send-list-and-digest): 2417 * progmodes/octave-inf.el (inferior-octave-send-list-and-digest):
1764 * progmodes/prolog.el (prolog-consult-compile): 2418 * progmodes/prolog.el (prolog-consult-compile):
1765 * progmodes/gdb-mi.el (gdb, gdb--check-interpreter): 2419 * progmodes/gdb-mi.el (gdb, gdb--check-interpreter):
@@ -2200,9 +2854,8 @@
2200 2854
22012013-04-03 Alan Mackenzie <acm@muc.de> 28552013-04-03 Alan Mackenzie <acm@muc.de>
2202 2856
2203 Handle `parse-partial-sexp' landing inside a comment opener 2857 Handle `parse-partial-sexp' landing inside a comment opener (Bug#13244).
2204 (Bug#13244). Also adapt to the new values of element 7 of a parse 2858 Also adapt to the new values of element 7 of a parse state.
2205 state.
2206 2859
2207 * progmodes/cc-engine.el (c-state-pp-to-literal): New optional 2860 * progmodes/cc-engine.el (c-state-pp-to-literal): New optional
2208 parameter `not-in-delimiter'. Handle being inside comment opener. 2861 parameter `not-in-delimiter'. Handle being inside comment opener.
@@ -2838,7 +3491,7 @@
28382013-03-08 Jambunathan K <kjambunathan@gmail.com> 34912013-03-08 Jambunathan K <kjambunathan@gmail.com>
2839 3492
2840 * hi-lock.el (hi-lock-read-regexp-defaults-function): New var. 3493 * hi-lock.el (hi-lock-read-regexp-defaults-function): New var.
2841 (hi-lock-read-regexp-defaults): New defun. 3494 (hi-lock-read-regexp-defaults): New defun.
2842 (hi-lock-line-face-buffer, hi-lock-face-buffer) 3495 (hi-lock-line-face-buffer, hi-lock-face-buffer)
2843 (hi-lock-face-phrase-buffer): Propagate above change. 3496 (hi-lock-face-phrase-buffer): Propagate above change.
2844 Update docstring (bug#13892). 3497 Update docstring (bug#13892).
@@ -2894,7 +3547,7 @@
2894 3547
2895 Correct the position of point in some line-up functions. 3548 Correct the position of point in some line-up functions.
2896 * progmodes/cc-align.el (c-lineup-whitesmith-in-block) 3549 * progmodes/cc-align.el (c-lineup-whitesmith-in-block)
2897 (c-lineup-assignments, c-lineup-gcc-asm-reg ): take position of 3550 (c-lineup-assignments, c-lineup-gcc-asm-reg ): Take position of
2898 point at column 0 rather than at a random place in the line. 3551 point at column 0 rather than at a random place in the line.
2899 3552
29002013-03-05 Michael Albinus <michael.albinus@gmx.de> 35532013-03-05 Michael Albinus <michael.albinus@gmx.de>
@@ -4429,7 +5082,7 @@
44292013-01-12 Eli Zaretskii <eliz@gnu.org> 50822013-01-12 Eli Zaretskii <eliz@gnu.org>
4430 5083
4431 * autorevert.el (auto-revert-notify-handler): Fix filtering of 5084 * autorevert.el (auto-revert-notify-handler): Fix filtering of
4432 file notification by ACTION. For filtering by file name, compare 5085 file notification by ACTION. For filtering by file name, compare
4433 only the non-directory part of the file name. 5086 only the non-directory part of the file name.
4434 5087
44352013-01-12 Stefan Monnier <monnier@iro.umontreal.ca> 50882013-01-12 Stefan Monnier <monnier@iro.umontreal.ca>
@@ -4512,7 +5165,7 @@
45122013-01-11 Julien Danjou <julien@danjou.info> 51652013-01-11 Julien Danjou <julien@danjou.info>
4513 5166
4514 * color.el (color-rgb-to-hsv): Fix conversion computing in case min and 5167 * color.el (color-rgb-to-hsv): Fix conversion computing in case min and
4515 max are almost equal. Also return the correct value for V which is 5168 max are almost equal. Also return the correct value for V which is
4516 already between 0 and 1. 5169 already between 0 and 1.
4517 5170
45182013-01-11 Dmitry Antipov <dmantipov@yandex.ru> 51712013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
@@ -4966,7 +5619,7 @@
49662012-12-31 Jürgen Hötzel <juergen@archlinux.org> 56192012-12-31 Jürgen Hötzel <juergen@archlinux.org>
4967 5620
4968 * net/tramp-adb.el (tramp-adb-maybe-open-connection): Handle errors 5621 * net/tramp-adb.el (tramp-adb-maybe-open-connection): Handle errors
4969 (No device connected, invalid device name). (Bug #13299) 5622 (No device connected, invalid device name). (Bug #13299)
4970 5623
49712012-12-31 Martin Rudalics <rudalics@gmx.at> 56242012-12-31 Martin Rudalics <rudalics@gmx.at>
4972 5625
@@ -5351,7 +6004,7 @@
5351 6004
53522012-12-14 Paul Eggert <eggert@cs.ucla.edu> 60052012-12-14 Paul Eggert <eggert@cs.ucla.edu>
5353 6006
5354 Fix permissions bugs with setgid directories etc. (Bug#13125) 6007 Fix permissions bugs with setgid directories etc. (Bug#13125)
5355 * files.el (backup-buffer): Don't rely on 9th output of 6008 * files.el (backup-buffer): Don't rely on 9th output of
5356 file-attributes, as it's now a placeholder. Instead, use the new 6009 file-attributes, as it's now a placeholder. Instead, use the new
5357 optional arg of file-ownership-preserved-p. 6010 optional arg of file-ownership-preserved-p.
@@ -5809,7 +6462,7 @@
5809 * textmodes/ispell.el (ispell-init-process) 6462 * textmodes/ispell.el (ispell-init-process)
5810 (ispell-start-process, ispell-internal-change-dictionary): 6463 (ispell-start-process, ispell-internal-change-dictionary):
5811 Make sure personal dictionary name is expanded after initial 6464 Make sure personal dictionary name is expanded after initial
5812 `default-directory' value. Use expanded strings for 6465 `default-directory' value. Use expanded strings for
5813 keep/restart checks and for value (Bug#13019). 6466 keep/restart checks and for value (Bug#13019).
5814 6467
58152012-12-03 Jay Belanger <jay.p.belanger@gmail.com> 64682012-12-03 Jay Belanger <jay.p.belanger@gmail.com>
@@ -6491,7 +7144,7 @@
6491 7144
6492 * play/gamegrid.el (gamegrid-add-score-with-update-game-score-1): 7145 * play/gamegrid.el (gamegrid-add-score-with-update-game-score-1):
6493 Don't signal an error with a score that is too low to add to the 7146 Don't signal an error with a score that is too low to add to the
6494 list of top scores. (Bug#12779) 7147 list of top scores. (Bug#12779)
6495 7148
64962012-11-17 Chong Yidong <cyd@gnu.org> 71492012-11-17 Chong Yidong <cyd@gnu.org>
6497 7150
@@ -6560,7 +7213,7 @@
6560 7213
6561 * window.el (record-window-buffer) 7214 * window.el (record-window-buffer)
6562 (display-buffer-record-window): When copying the markers to 7215 (display-buffer-record-window): When copying the markers to
6563 window-point preserve window-point-insertion-type. (Bug#12588) 7216 window-point preserve window-point-insertion-type. (Bug#12588)
6564 7217
65652012-11-16 Glenn Morris <rgm@gnu.org> 72182012-11-16 Glenn Morris <rgm@gnu.org>
6566 7219
@@ -6648,8 +7301,8 @@
6648 (ad-advice-definition): Redefine as functions. 7301 (ad-advice-definition): Redefine as functions.
6649 (ad-advice-classes): Move before first use. 7302 (ad-advice-classes): Move before first use.
6650 (ad-make-origname, ad-set-orig-definition, ad-clear-orig-definition) 7303 (ad-make-origname, ad-set-orig-definition, ad-clear-orig-definition)
6651 (ad-make-mapped-call, ad-make-advised-docstring,ad-make-plain-docstring) 7304 (ad-make-mapped-call, ad-make-advised-docstring)
6652 (ad--defalias-fset): Remove functions. 7305 (ad-make-plain-docstring, ad--defalias-fset): Remove functions.
6653 (ad-make-advicefunname, ad-clear-advicefunname-definition): New funs. 7306 (ad-make-advicefunname, ad-clear-advicefunname-definition): New funs.
6654 (ad-get-orig-definition): Rewrite. 7307 (ad-get-orig-definition): Rewrite.
6655 (ad-make-advised-definition-docstring): Change base docstring. 7308 (ad-make-advised-definition-docstring): Change base docstring.
@@ -6901,7 +7554,7 @@
6901 7554
69022012-11-09 Vincent Belaïche <vincentb1@users.sourceforge.net> 75552012-11-09 Vincent Belaïche <vincentb1@users.sourceforge.net>
6903 7556
6904 * ses.el: symbol to coordinate mapping is made by symbol property 7557 * ses.el: Symbol to coordinate mapping is made by symbol property
6905 `ses-cell'. This means that the same mapping is done for all SES 7558 `ses-cell'. This means that the same mapping is done for all SES
6906 sheets. That is good enough for cells with standard A1 names, but 7559 sheets. That is good enough for cells with standard A1 names, but
6907 not for named cell. So a hash map is added for the latter. 7560 not for named cell. So a hash map is added for the latter.
@@ -6997,7 +7650,7 @@
6997 buffer and calls `ispell-buffer' with debugging enabled. 7650 buffer and calls `ispell-buffer' with debugging enabled.
6998 7651
6999 * textmodes/ispell.el (ispell-region): Do not prefix sent string by 7652 * textmodes/ispell.el (ispell-region): Do not prefix sent string by
7000 comment in autoconf mode. (Bug#12768) 7653 comment in autoconf mode. (Bug#12768)
7001 7654
70022012-11-06 Dmitry Antipov <dmantipov@yandex.ru> 76552012-11-06 Dmitry Antipov <dmantipov@yandex.ru>
7003 7656
@@ -8142,13 +8795,13 @@
8142 8795
8143 * textmodes/reftex-cite.el (reftex-create-bibtex-file): Make sure 8796 * textmodes/reftex-cite.el (reftex-create-bibtex-file): Make sure
8144 that entries with whitespace at various places are found. 8797 that entries with whitespace at various places are found.
8145 Doc fix. Include entries that are cross-referenced from cited entries. 8798 Doc fix. Include entries that are cross-referenced from cited entries.
8146 Include @String definitions in the resulting bib file. Add header 8799 Include @String definitions in the resulting bib file. Add header
8147 and footer defined in `reftex-create-bibtex-header' and 8800 and footer defined in `reftex-create-bibtex-header' and
8148 `reftex-create-bibtex-footer'. 8801 `reftex-create-bibtex-footer'.
8149 (reftex-do-citation): Make it possible again to insert 8802 (reftex-do-citation): Make it possible again to insert
8150 non-existent entries. Save match data when asking for optional 8803 non-existent entries. Save match data when asking for optional
8151 arguments. Return all keys, not just the first one. 8804 arguments. Return all keys, not just the first one.
8152 (reftex-all-used-citation-keys): Fix regexp to correctly extract 8805 (reftex-all-used-citation-keys): Fix regexp to correctly extract
8153 all citations in the same line. 8806 all citations in the same line.
8154 (reftex-parse-bibtex-entry): Accept additional optional argument 8807 (reftex-parse-bibtex-entry): Accept additional optional argument
@@ -8208,7 +8861,7 @@
8208 8861
8209 * textmodes/reftex-sel.el 8862 * textmodes/reftex-sel.el
8210 (reftex-select-cycle-ref-style-internal): Adapt to new structure 8863 (reftex-select-cycle-ref-style-internal): Adapt to new structure
8211 of `reftex-ref-style-alist'. Remove code for testing macro type. 8864 of `reftex-ref-style-alist'. Remove code for testing macro type.
8212 (reftex-select-toggle-varioref) 8865 (reftex-select-toggle-varioref)
8213 (reftex-select-toggle-fancyref): Remove. 8866 (reftex-select-toggle-fancyref): Remove.
8214 (reftex-select-cycle-ref-style-internal) 8867 (reftex-select-cycle-ref-style-internal)
@@ -8750,7 +9403,7 @@
8750 9403
8751 * textmodes/bibtex.el (bibtex-autokey-transcriptions): 9404 * textmodes/bibtex.el (bibtex-autokey-transcriptions):
8752 Transcribe also LaTeX hyphenation. 9405 Transcribe also LaTeX hyphenation.
8753 (bibtex-reformat): Bug fix. Do not quote twice the elements of 9406 (bibtex-reformat): Bug fix. Do not quote twice the elements of
8754 bibtex-reformat-previous-options. 9407 bibtex-reformat-previous-options.
8755 9408
87562012-09-23 Roland Winkler <winkler@gnu.org> 94092012-09-23 Roland Winkler <winkler@gnu.org>
@@ -10836,7 +11489,7 @@
10836 * progmodes/python.el (python-shell-send-setup-max-wait): Delete var. 11489 * progmodes/python.el (python-shell-send-setup-max-wait): Delete var.
10837 (python-shell-make-comint): accept-process-output at startup. 11490 (python-shell-make-comint): accept-process-output at startup.
10838 (run-python-internal): Set inferior-python-mode-hook to nil. 11491 (run-python-internal): Set inferior-python-mode-hook to nil.
10839 (python-shell-internal-get-or-create-process): call sit-for. 11492 (python-shell-internal-get-or-create-process): Call sit-for.
10840 (python-preoutput-result): Add obsolete alias. 11493 (python-preoutput-result): Add obsolete alias.
10841 (python-shell-internal-send-string): Use it. 11494 (python-shell-internal-send-string): Use it.
10842 (python-shell-send-setup-code): Remove call to 11495 (python-shell-send-setup-code): Remove call to
@@ -11028,7 +11681,7 @@
110282012-07-27 Fabián Ezequiel Gallina <fgallina@cuca> 116812012-07-27 Fabián Ezequiel Gallina <fgallina@cuca>
11029 11682
11030 Consistent completion in inferior python with emacs -nw. 11683 Consistent completion in inferior python with emacs -nw.
11031 * progmodes/python.el (inferior-python-mode): replace "<tab>" 11684 * progmodes/python.el (inferior-python-mode): Replace "<tab>"
11032 binding in inferior-python-mode-map with "\t". 11685 binding in inferior-python-mode-map with "\t".
11033 (python-shell-completion-complete-at-point) 11686 (python-shell-completion-complete-at-point)
11034 (python-completion-complete-at-point): Remove interactive spec. 11687 (python-completion-complete-at-point): Remove interactive spec.
@@ -11777,7 +12430,7 @@
11777 (xml-name-start-char-re, xml-name-char-re, xml-name-re) 12430 (xml-name-start-char-re, xml-name-char-re, xml-name-re)
11778 (xml-names-re, xml-nmtoken-re, xml-nmtokens-re, xml-char-ref-re) 12431 (xml-names-re, xml-nmtoken-re, xml-nmtokens-re, xml-char-ref-re)
11779 (xml-entity-ref, xml-pe-reference-re) 12432 (xml-entity-ref, xml-pe-reference-re)
11780 (xml-reference-re,xml-att-value-re, xml-tokenized-type-re) 12433 (xml-reference-re, xml-att-value-re, xml-tokenized-type-re)
11781 (xml-notation-type-re, xml-enumeration-re, xml-enumerated-type-re) 12434 (xml-notation-type-re, xml-enumeration-re, xml-enumerated-type-re)
11782 (xml-att-type-re, xml-default-decl-re, xml-att-def-re) 12435 (xml-att-type-re, xml-default-decl-re, xml-att-def-re)
11783 (xml-entity-value-re): Use syntax references in regexps where 12436 (xml-entity-value-re): Use syntax references in regexps where
@@ -18592,8 +19245,8 @@
18592 19245
18593 * progmodes/verilog-mode.el (verilog-read-defines): Fix reading 19246 * progmodes/verilog-mode.el (verilog-read-defines): Fix reading
18594 parameters with embedded comments. Reported by Ray Stevens. 19247 parameters with embedded comments. Reported by Ray Stevens.
18595 (verilog-calc-1, verilog-fork-wait-re) (verilog-forward-sexp, 19248 (verilog-calc-1, verilog-fork-wait-re, verilog-forward-sexp)
18596 verilog-wait-fork-re): Fix indentation of "wait fork", bug407. 19249 (verilog-wait-fork-re): Fix indentation of "wait fork", bug407.
18597 Reported by Tim Holt. 19250 Reported by Tim Holt.
18598 (verilog-auto): Fix AUTOing a upper module then AUTOing module 19251 (verilog-auto): Fix AUTOing a upper module then AUTOing module
18599 instantiated by upper module causing wrong expansion until AUTOed a 19252 instantiated by upper module causing wrong expansion until AUTOed a
@@ -20162,7 +20815,7 @@
20162 20815
201632011-10-07 Chong Yidong <cyd@stupidchicken.com> 208162011-10-07 Chong Yidong <cyd@stupidchicken.com>
20164 20817
20165 * bindings.el ([M-left],[M-right]): Bind to left-word and 20818 * bindings.el ([M-left], [M-right]): Bind to left-word and
20166 right-word respectively. 20819 right-word respectively.
20167 20820
201682011-10-07 Glenn Morris <rgm@gnu.org> 208212011-10-07 Glenn Morris <rgm@gnu.org>
@@ -25484,15 +26137,15 @@
254842011-05-10 Jim Meyering <meyering@redhat.com> 261372011-05-10 Jim Meyering <meyering@redhat.com>
25485 26138
25486 Fix doubled-word typos. 26139 Fix doubled-word typos.
25487 * international/quail.el (quail-insert-kbd-layout): and and -> and 26140 * international/quail.el (quail-insert-kbd-layout): and and -> and.
25488 * kermit.el: and and -> and 26141 * kermit.el: and and -> and.
25489 * net/ldap.el (ldap-search-internal): to to -> to 26142 * net/ldap.el (ldap-search-internal): to to -> to.
25490 * progmodes/vhdl-mode.el (vhdl-offsets-alist): Likewise. 26143 * progmodes/vhdl-mode.el (vhdl-offsets-alist): Likewise.
25491 * progmodes/js.el (js-mode): and and -> and 26144 * progmodes/js.el (js-mode): and and -> and.
25492 * textmodes/artist.el (artist-move-to-xy): at at -> at 26145 * textmodes/artist.el (artist-move-to-xy): at at -> at.
25493 (artist-draw-region-trim-line-endings): if if -> if 26146 (artist-draw-region-trim-line-endings): if if -> if.
25494 And Safetyc -> Safety. 26147 And Safetyc -> Safety.
25495 * textmodes/reftex-dcr.el (reftex-view-crossref): at at -> at a 26148 * textmodes/reftex-dcr.el (reftex-view-crossref): at at -> at a.
25496 26149
254972011-05-10 Glenn Morris <rgm@gnu.org> 261502011-05-10 Glenn Morris <rgm@gnu.org>
25498 Stefan Monnier <monnier@iro.umontreal.ca> 26151 Stefan Monnier <monnier@iro.umontreal.ca>
diff --git a/lisp/ChangeLog.2 b/lisp/ChangeLog.2
index 3832f342d6f..fddc98a612d 100644
--- a/lisp/ChangeLog.2
+++ b/lisp/ChangeLog.2
@@ -777,7 +777,7 @@
777 777
7781987-12-21 Richard Stallman (rms@frosted-flakes) 7781987-12-21 Richard Stallman (rms@frosted-flakes)
779 779
780 * window.el (split-widow-{vertically,horizontally}): 780 * window.el (split-window-{vertically,horizontally}):
781 Make the arg optional. 781 Make the arg optional.
782 782
7831987-12-09 Richard Stallman (rms@frosted-flakes) 7831987-12-09 Richard Stallman (rms@frosted-flakes)
@@ -1392,7 +1392,7 @@
1392 * shell.el: Minor doc fixes. 1392 * shell.el: Minor doc fixes.
1393 1393
1394 * rmail.el (rmail-get-new-mail): 1394 * rmail.el (rmail-get-new-mail):
1395 Handle errors competently. (Don't attempt to 1395 Handle errors competently. (Don't attempt to
1396 handle them, rather than botching the job) 1396 handle them, rather than botching the job)
1397 1397
1398 * rmail.el (rmail-insert-inbox-text): 1398 * rmail.el (rmail-insert-inbox-text):
@@ -3032,7 +3032,7 @@
3032 3032
3033 Rename "kill" -> "delete" for both function-names and documentation. 3033 Rename "kill" -> "delete" for both function-names and documentation.
3034 3034
3035 Define C-d as Buffer-menu-delete-backwards. (also in ebuff-menu) 3035 Define C-d as Buffer-menu-delete-backwards (also in ebuff-menu).
3036 3036
3037 Save space: Merge buffer-menu-{execute,do-saves,do-kills}. 3037 Save space: Merge buffer-menu-{execute,do-saves,do-kills}.
3038 3038
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 4884213daeb..61449b66c9b 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -209,8 +209,9 @@ update-authors:
209 $(emacs) -l authors -f batch-update-authors $(top_srcdir)/etc/AUTHORS $(top_srcdir) 209 $(emacs) -l authors -f batch-update-authors $(top_srcdir)/etc/AUTHORS $(top_srcdir)
210 210
211TAGS TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4) 211TAGS TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4)
212 els=`echo $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4) | sed -e "s,$(lisp)/[^ ]*loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \ 212 rm -f $@; touch $@; \
213 ${ETAGS} -o $@ $$els 213 echo $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4) | sed -e "s,$(lisp)/[^ ]*loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,," | \
214 xargs $(XARGS_LIMIT) ${ETAGS} -a -o $@
214 215
215# The src/Makefile.in has its own set of dependencies and when they decide 216# The src/Makefile.in has its own set of dependencies and when they decide
216# that one Lisp file needs to be re-compiled, we had better recompile it as 217# that one Lisp file needs to be re-compiled, we had better recompile it as
diff --git a/lisp/allout.el b/lisp/allout.el
index 5a9b03b7a0e..1e4134b3ccf 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -1561,7 +1561,7 @@ Each value can be a regexp or a list with a regexp followed by a
1561substitution string. If it's just a regexp, all its matches are removed 1561substitution string. If it's just a regexp, all its matches are removed
1562before the text is encrypted. If it's a regexp and a substitution, the 1562before the text is encrypted. If it's a regexp and a substitution, the
1563substitution is used against the regexp matches, a la `replace-match'.") 1563substitution is used against the regexp matches, a la `replace-match'.")
1564(make-variable-buffer-local 'allout-encryption-text-removal-regexps) 1564(make-variable-buffer-local 'allout-encryption-plaintext-sanitization-regexps)
1565;;;_ = allout-encryption-ciphertext-rejection-regexps 1565;;;_ = allout-encryption-ciphertext-rejection-regexps
1566(defvar allout-encryption-ciphertext-rejection-regexps nil 1566(defvar allout-encryption-ciphertext-rejection-regexps nil
1567 "Variable for regexps matching plaintext to remove before encryption. 1567 "Variable for regexps matching plaintext to remove before encryption.
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index a2ce6017b21..4a6d4cb4cc0 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -271,7 +271,7 @@ This variable becomes buffer local when set in any fashion.")
271 :version "24.4") 271 :version "24.4")
272 272
273(defconst auto-revert-notify-enabled 273(defconst auto-revert-notify-enabled
274 (or (featurep 'inotify) (featurep 'w32notify)) 274 (or (featurep 'gfilenotify) (featurep 'inotify) (featurep 'w32notify))
275 "Non-nil when Emacs has been compiled with file notification support.") 275 "Non-nil when Emacs has been compiled with file notification support.")
276 276
277(defcustom auto-revert-use-notify auto-revert-notify-enabled 277(defcustom auto-revert-use-notify auto-revert-notify-enabled
@@ -502,9 +502,12 @@ will use an up-to-date value of `auto-revert-interval'"
502 (puthash key value auto-revert-notify-watch-descriptor-hash-list) 502 (puthash key value auto-revert-notify-watch-descriptor-hash-list)
503 (remhash key auto-revert-notify-watch-descriptor-hash-list) 503 (remhash key auto-revert-notify-watch-descriptor-hash-list)
504 (ignore-errors 504 (ignore-errors
505 (funcall (if (fboundp 'inotify-rm-watch) 505 (funcall
506 'inotify-rm-watch 'w32notify-rm-watch) 506 (cond
507 auto-revert-notify-watch-descriptor))))) 507 ((fboundp 'gfile-rm-watch) 'gfile-rm-watch)
508 ((fboundp 'inotify-rm-watch) 'inotify-rm-watch)
509 ((fboundp 'w32notify-rm-watch) 'w32notify-rm-watch))
510 auto-revert-notify-watch-descriptor)))))
508 auto-revert-notify-watch-descriptor-hash-list) 511 auto-revert-notify-watch-descriptor-hash-list)
509 (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)) 512 (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch))
510 (setq auto-revert-notify-watch-descriptor nil 513 (setq auto-revert-notify-watch-descriptor nil
@@ -519,12 +522,18 @@ will use an up-to-date value of `auto-revert-interval'"
519 522
520 (when (and buffer-file-name auto-revert-use-notify 523 (when (and buffer-file-name auto-revert-use-notify
521 (not auto-revert-notify-watch-descriptor)) 524 (not auto-revert-notify-watch-descriptor))
522 (let ((func (if (fboundp 'inotify-add-watch) 525 (let ((func
523 'inotify-add-watch 'w32notify-add-watch)) 526 (cond
524 ;; `attrib' is needed for file modification time. 527 ((fboundp 'gfile-add-watch) 'gfile-add-watch)
525 (aspect (if (fboundp 'inotify-add-watch) 528 ((fboundp 'inotify-add-watch) 'inotify-add-watch)
526 '(attrib create modify moved-to) '(size last-write-time))) 529 ((fboundp 'w32notify-add-watch) 'w32notify-add-watch)))
527 (file (if (fboundp 'inotify-add-watch) 530 (aspect
531 (cond
532 ((fboundp 'gfile-add-watch) '(watch-mounts))
533 ;; `attrib' is needed for file modification time.
534 ((fboundp 'inotify-add-watch) '(attrib create modify moved-to))
535 ((fboundp 'w32notify-add-watch) '(size last-write-time))))
536 (file (if (or (fboundp 'gfile-add-watch) (fboundp 'inotify-add-watch))
528 (directory-file-name (expand-file-name default-directory)) 537 (directory-file-name (expand-file-name default-directory))
529 (buffer-file-name)))) 538 (buffer-file-name))))
530 (setq auto-revert-notify-watch-descriptor 539 (setq auto-revert-notify-watch-descriptor
@@ -545,10 +554,13 @@ will use an up-to-date value of `auto-revert-interval'"
545 554
546(defun auto-revert-notify-event-p (event) 555(defun auto-revert-notify-event-p (event)
547 "Check that event is a file notification event." 556 "Check that event is a file notification event."
548 (cond ((featurep 'inotify) 557 (and (listp event)
549 (and (listp event) (= (length event) 4))) 558 (cond ((featurep 'gfilenotify)
550 ((featurep 'w32notify) 559 (and (>= (length event) 3) (stringp (nth 2 event))))
551 (and (listp event) (= (length event) 3) (stringp (nth 2 event)))))) 560 ((featurep 'inotify)
561 (= (length event) 4))
562 ((featurep 'w32notify)
563 (and (= (length event) 3) (stringp (nth 2 event)))))))
552 564
553(defun auto-revert-notify-event-descriptor (event) 565(defun auto-revert-notify-event-descriptor (event)
554 "Return watch descriptor of file notification event, or nil." 566 "Return watch descriptor of file notification event, or nil."
@@ -561,11 +573,12 @@ will use an up-to-date value of `auto-revert-interval'"
561(defun auto-revert-notify-event-file-name (event) 573(defun auto-revert-notify-event-file-name (event)
562 "Return file name of file notification event, or nil." 574 "Return file name of file notification event, or nil."
563 (and (auto-revert-notify-event-p event) 575 (and (auto-revert-notify-event-p event)
564 (cond ((featurep 'inotify) (nth 3 event)) 576 (cond ((featurep 'gfilenotify) (nth 2 event))
577 ((featurep 'inotify) (nth 3 event))
565 ((featurep 'w32notify) (nth 2 event))))) 578 ((featurep 'w32notify) (nth 2 event)))))
566 579
567(defun auto-revert-notify-handler (event) 580(defun auto-revert-notify-handler (event)
568 "Handle an event returned from file notification." 581 "Handle an EVENT returned from file notification."
569 (when (auto-revert-notify-event-p event) 582 (when (auto-revert-notify-event-p event)
570 (let* ((descriptor (auto-revert-notify-event-descriptor event)) 583 (let* ((descriptor (auto-revert-notify-event-descriptor event))
571 (action (auto-revert-notify-event-action event)) 584 (action (auto-revert-notify-event-action event))
@@ -576,12 +589,20 @@ will use an up-to-date value of `auto-revert-interval'"
576 ;; Check, that event is meant for us. 589 ;; Check, that event is meant for us.
577 ;; TODO: Filter events which stop watching, like `move' or `removed'. 590 ;; TODO: Filter events which stop watching, like `move' or `removed'.
578 (cl-assert descriptor) 591 (cl-assert descriptor)
579 (when (featurep 'inotify) 592 (cond
593 ((featurep 'gfilenotify)
594 (cl-assert (memq action '(attribute-changed changed created deleted
595 ;; FIXME: I keep getting this action, so I
596 ;; added it here, but I have no idea what
597 ;; I'm doing. --Stef
598 changes-done-hint))
599 t))
600 ((featurep 'inotify)
580 (cl-assert (or (memq 'attrib action) 601 (cl-assert (or (memq 'attrib action)
581 (memq 'create action) 602 (memq 'create action)
582 (memq 'modify action) 603 (memq 'modify action)
583 (memq 'moved-to action)))) 604 (memq 'moved-to action))))
584 (when (featurep 'w32notify) (cl-assert (eq 'modified action))) 605 ((featurep 'w32notify) (cl-assert (eq 'modified action))))
585 ;; Since we watch a directory, a file name must be returned. 606 ;; Since we watch a directory, a file name must be returned.
586 (cl-assert (stringp file)) 607 (cl-assert (stringp file))
587 (dolist (buffer buffers) 608 (dolist (buffer buffers)
diff --git a/lisp/bindings.el b/lisp/bindings.el
index fe0eabb77af..2013c079820 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -894,6 +894,7 @@ if `inhibit-field-text-motion' is non-nil."
894(define-key search-map "hr" 'highlight-regexp) 894(define-key search-map "hr" 'highlight-regexp)
895(define-key search-map "hp" 'highlight-phrase) 895(define-key search-map "hp" 'highlight-phrase)
896(define-key search-map "hl" 'highlight-lines-matching-regexp) 896(define-key search-map "hl" 'highlight-lines-matching-regexp)
897(define-key search-map "h." 'highlight-symbol-at-point)
897(define-key search-map "hu" 'unhighlight-regexp) 898(define-key search-map "hu" 'unhighlight-regexp)
898(define-key search-map "hf" 'hi-lock-find-patterns) 899(define-key search-map "hf" 'hi-lock-find-patterns)
899(define-key search-map "hw" 'hi-lock-write-interactive-patterns) 900(define-key search-map "hw" 'hi-lock-write-interactive-patterns)
diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog
index 25f966362ce..98548a919d5 100644
--- a/lisp/cedet/ChangeLog
+++ b/lisp/cedet/ChangeLog
@@ -1,3 +1,96 @@
12013-06-02 Eric Ludlam <zappo@gnu.org>
2
3 * semantic/edit.el (semantic-change-function): Use
4 `save-match-data' around running hooks.
5
6 * semantic/decorate/mode.el
7 (semantic-decorate-style-predicate-default)
8 (semantic-decorate-style-highlighter-default): New.
9 (semantic-decoration-mode): Do not require
10 `semantic/decorate/include' anymore.
11 (semantic-toggle-decoration-style): Error if an unknown decoration
12 style is toggled.
13 (define-semantic-decoration-style): Add new :load option. When
14 :load is specified, add autoload tokens for the definition
15 functions so that code is loaded when the mode is used.
16 (semantic-decoration-on-includes): New autoload definition for
17 highlighting includes.
18
19 * semantic/bovine/c.el (semantic-lex-c-ifdef): Allow some misc
20 characters to appear after the tested variable.
21
22 * semantic/ede-grammar.el (project-compile-target): Calculate full
23 src name via ede-expand-filename instead of the crutch of the
24 current buffer. Enables this target to compile in batch mode.
25
26 * semantic/idle.el
27 (semantic-idle-symbol-maybe-highlight): Wrap highlighting of
28 remote symbol with `save-excursion'.
29 (semantic-idle-scheduler-work-parse-neighboring-files): Instead of
30 using directory-files on each found mode pattern, collect all the
31 patterns for the current mode, and then for each file, see if it
32 matches any of them. If it does, parse the file. (Patch
33 inspiration from Tomasz Gajewski.)
34
35 * semantic/ctxt.el (semantic-ctxt-end-of-symbol): New.
36 (semantic-ctxt-current-symbol-default): New.
37
38 * semantic/bovine/el.el (semantic-default-elisp-setup): Add
39 autoload cookie. Explain existence.
40 (footer): Add local variable for loaddefs.
41
42 * semantic/db.el (semanticdb-file-table-object): Add new filter,
43 only checking for regular files too.
44
45 * semantic/wisent/python.el
46 (semantic-format-tag-abbreviate): New override. Cuts back on size
47 of code tags.
48
49 * srecode/compile.el (srecode-compile-templates): Fix warning
50 punctuation. Remove status messages to clean up testing output
51
52 * ede/base.el (ede-project-placeholder-cache-file): Update doc to
53 mention 'nil' value.
54 (ede-save-cache): Disable cache save if file is nil.
55
56 * ede.el (ede-initialize-state-current-buffer): Flush deleted
57 projects.
58 (global-ede-mode): Always append our find-file-hook to the end.
59 (ede-flush-deleted-projects): New command.
60
61 * ede/cpp-root.el (ede-preprocessor-map): Protect against init
62 problems.
63
64 * ede/proj.el (ede-proj-target): Added a new "custom" option for
65 custom symbols representing a compiler or linker instead of
66 restricting things to only the predefined compilers and linkers.
67
682013-06-02 David Engster <dengste@eml.cc>
69
70 * semantic.el (semantic-mode-map): To avoid showing showing
71 Development menu twice, only disable menu item if menu-bar is
72 actually enabled, otherwise the popup 'global menu' might display
73 a disabled Development menu.
74
75 * srecode/srt-wy.el: Regenerate.
76
772013-06-02 Pete Beardmore <elbeardmorez@msn.com>
78
79 * semantic/complete.el
80 (semantic-displayor-show-request): Fix which slot in obj is set to
81 the max tags.
82
832013-06-01 Glenn Morris <rgm@gnu.org>
84
85 * semantic/grammar.el (semantic-grammar-complete):
86 Replace the obsolete function lisp-complete-symbol.
87
88 * semantic/analyze/fcn.el (semantic-tag-similar-p): Autoload.
89
90 * srecode/args.el, srecode/java.el: Require ede.
91
92 * semantic/lex.el (semantic-lex-make-type-table): Fix transposed args.
93
12013-05-24 Glenn Morris <rgm@gnu.org> 942013-05-24 Glenn Morris <rgm@gnu.org>
2 95
3 * semantic/bovine/grammar.el (bovine-make-parsers): 96 * semantic/bovine/grammar.el (bovine-make-parsers):
diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el
index 5fecd8b994f..3483d541122 100644
--- a/lisp/cedet/ede.el
+++ b/lisp/cedet/ede.el
@@ -494,6 +494,11 @@ provided `global-ede-mode' is enabled."
494(defun ede-initialize-state-current-buffer () 494(defun ede-initialize-state-current-buffer ()
495 "Initialize the current buffer's state for EDE. 495 "Initialize the current buffer's state for EDE.
496Sets buffer local variables for EDE." 496Sets buffer local variables for EDE."
497 ;; due to inode recycling, make sure we don't
498 ;; we flush projects deleted off the system.
499 (ede-flush-deleted-projects)
500
501 ;; Init the buffer.
497 (let* ((ROOT nil) 502 (let* ((ROOT nil)
498 (proj (ede-directory-get-open-project default-directory 503 (proj (ede-directory-get-open-project default-directory
499 'ROOT)) 504 'ROOT))
@@ -569,7 +574,9 @@ an EDE controlled project."
569 (add-hook 'semanticdb-project-predicate-functions 'ede-directory-project-p) 574 (add-hook 'semanticdb-project-predicate-functions 'ede-directory-project-p)
570 (add-hook 'semanticdb-project-root-functions 'ede-toplevel-project-or-nil) 575 (add-hook 'semanticdb-project-root-functions 'ede-toplevel-project-or-nil)
571 (add-hook 'ecb-source-path-functions 'ede-ecb-project-paths) 576 (add-hook 'ecb-source-path-functions 'ede-ecb-project-paths)
572 (add-hook 'find-file-hook 'ede-turn-on-hook) 577 ;; Append our hook to the end. This allows mode-local to finish
578 ;; it's stuff before we start doing misc file loads, etc.
579 (add-hook 'find-file-hook 'ede-turn-on-hook t)
573 (add-hook 'dired-mode-hook 'ede-turn-on-hook) 580 (add-hook 'dired-mode-hook 'ede-turn-on-hook)
574 (add-hook 'kill-emacs-hook 'ede-save-cache) 581 (add-hook 'kill-emacs-hook 'ede-save-cache)
575 (ede-load-cache) 582 (ede-load-cache)
@@ -1057,6 +1064,18 @@ On success, return the added project."
1057 (add-to-list 'ede-projects proj) 1064 (add-to-list 'ede-projects proj)
1058 proj) 1065 proj)
1059 1066
1067(defun ede-flush-deleted-projects ()
1068 "Scan the projects list for projects which no longer exist.
1069Flush the dead projects from the project cache."
1070 (interactive)
1071 (let ((dead nil))
1072 (dolist (P ede-projects)
1073 (when (not (file-exists-p (oref P :file)))
1074 (add-to-list 'dead P)))
1075 (dolist (D dead)
1076 (setq ede-projects (remove D ede-projects)))
1077 ))
1078
1060(defun ede-load-project-file (dir &optional rootreturn) 1079(defun ede-load-project-file (dir &optional rootreturn)
1061 "Project file independent way to read a project in from DIR. 1080 "Project file independent way to read a project in from DIR.
1062Optional ROOTRETURN will return the root project for DIR." 1081Optional ROOTRETURN will return the root project for DIR."
diff --git a/lisp/cedet/ede/base.el b/lisp/cedet/ede/base.el
index 5302ac3207a..a94ce8f1868 100644
--- a/lisp/cedet/ede/base.el
+++ b/lisp/cedet/ede/base.el
@@ -306,7 +306,8 @@ All specific project types must derive from this project."
306;; 306;;
307(defcustom ede-project-placeholder-cache-file 307(defcustom ede-project-placeholder-cache-file
308 (locate-user-emacs-file "ede-projects.el" ".projects.ede") 308 (locate-user-emacs-file "ede-projects.el" ".projects.ede")
309 "File containing the list of projects EDE has viewed." 309 "File containing the list of projects EDE has viewed.
310If set to nil, then the cache is not saved."
310 :group 'ede 311 :group 'ede
311 :type 'file) 312 :type 'file)
312 313
@@ -316,38 +317,39 @@ All specific project types must derive from this project."
316(defun ede-save-cache () 317(defun ede-save-cache ()
317 "Save a cache of EDE objects that Emacs has seen before." 318 "Save a cache of EDE objects that Emacs has seen before."
318 (interactive) 319 (interactive)
319 (let ((p ede-projects) 320 (when ede-project-placeholder-cache-file
320 (c ede-project-cache-files) 321 (let ((p ede-projects)
321 (recentf-exclude '( (lambda (f) t) )) 322 (c ede-project-cache-files)
322 ) 323 (recentf-exclude '( (lambda (f) t) ))
323 (condition-case nil
324 (progn
325 (set-buffer (find-file-noselect ede-project-placeholder-cache-file t))
326 (erase-buffer)
327 (insert ";; EDE project cache file.
328;; This contains a list of projects you have visited.\n(")
329 (while p
330 (when (and (car p) (ede-project-p p))
331 (let ((f (oref (car p) file)))
332 (when (file-exists-p f)
333 (insert "\n \"" f "\""))))
334 (setq p (cdr p)))
335 (while c
336 (insert "\n \"" (car c) "\"")
337 (setq c (cdr c)))
338 (insert "\n)\n")
339 (condition-case nil
340 (save-buffer 0)
341 (error
342 (message "File %s could not be saved."
343 ede-project-placeholder-cache-file)))
344 (kill-buffer (current-buffer))
345 ) 324 )
346 (error 325 (condition-case nil
347 (message "File %s could not be read." 326 (progn
348 ede-project-placeholder-cache-file)) 327 (set-buffer (find-file-noselect ede-project-placeholder-cache-file t))
349 328 (erase-buffer)
350 ))) 329 (insert ";; EDE project cache file.
330;; This contains a list of projects you have visited.\n(")
331 (while p
332 (when (and (car p) (ede-project-p p))
333 (let ((f (oref (car p) file)))
334 (when (file-exists-p f)
335 (insert "\n \"" f "\""))))
336 (setq p (cdr p)))
337 (while c
338 (insert "\n \"" (car c) "\"")
339 (setq c (cdr c)))
340 (insert "\n)\n")
341 (condition-case nil
342 (save-buffer 0)
343 (error
344 (message "File %s could not be saved."
345 ede-project-placeholder-cache-file)))
346 (kill-buffer (current-buffer))
347 )
348 (error
349 (message "File %s could not be read."
350 ede-project-placeholder-cache-file))
351
352 ))))
351 353
352(defun ede-load-cache () 354(defun ede-load-cache ()
353 "Load the cache of EDE projects." 355 "Load the cache of EDE projects."
diff --git a/lisp/cedet/ede/cpp-root.el b/lisp/cedet/ede/cpp-root.el
index 47ba16ade7f..719289765a3 100644
--- a/lisp/cedet/ede/cpp-root.el
+++ b/lisp/cedet/ede/cpp-root.el
@@ -507,7 +507,10 @@ This is for project include paths and spp source files."
507 (lambda (F) 507 (lambda (F)
508 (let* ((expfile (ede-expand-filename root F)) 508 (let* ((expfile (ede-expand-filename root F))
509 (table (when expfile 509 (table (when expfile
510 (semanticdb-file-table-object expfile))) 510 ;; Disable EDE init on preprocessor file load
511 ;; otherwise we recurse, cause errs, etc.
512 (let ((ede-constructing t))
513 (semanticdb-file-table-object expfile))))
511 ) 514 )
512 (cond 515 (cond
513 ((not (file-exists-p expfile)) 516 ((not (file-exists-p expfile))
diff --git a/lisp/cedet/ede/proj.el b/lisp/cedet/ede/proj.el
index 702e35f0b1f..99a5978b005 100644
--- a/lisp/cedet/ede/proj.el
+++ b/lisp/cedet/ede/proj.el
@@ -104,6 +104,7 @@ distributed, and each should have a corresponding rule to build it.")
104 :initform nil 104 :initform nil
105 :type (or null symbol) 105 :type (or null symbol)
106 :custom (choice (const :tag "None" nil) 106 :custom (choice (const :tag "None" nil)
107 (symbol :tag "Custom Compiler Symbol")
107 :slotofchoices availablecompilers) 108 :slotofchoices availablecompilers)
108 :label "Compiler for building sources" 109 :label "Compiler for building sources"
109 :group make 110 :group make
@@ -116,6 +117,7 @@ of these compiler resources, and global customization thereof.")
116 :initform nil 117 :initform nil
117 :type (or null symbol) 118 :type (or null symbol)
118 :custom (choice (const :tag "None" nil) 119 :custom (choice (const :tag "None" nil)
120 (symbol :tag "Custom Linker Symbol")
119 :slotofchoices availablelinkers) 121 :slotofchoices availablelinkers)
120 :label "Linker for combining intermediate object files." 122 :label "Linker for combining intermediate object files."
121 :group make 123 :group make
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index 3c93a8794b1..909902a71fe 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -899,7 +899,8 @@ Throw away all the old tags, and recreate the tag database."
899 ;; and Semantic are both enabled. Is there a better way? 899 ;; and Semantic are both enabled. Is there a better way?
900 (define-key map [menu-bar cedet-menu] 900 (define-key map [menu-bar cedet-menu]
901 (list 'menu-item "Development" cedet-menu-map 901 (list 'menu-item "Development" cedet-menu-map
902 :enable (quote (not (bound-and-true-p global-ede-mode))))) 902 :enable (quote (not (and menu-bar-mode
903 (bound-and-true-p global-ede-mode))))))
903 ;; (define-key km "-" 'senator-fold-tag) 904 ;; (define-key km "-" 'senator-fold-tag)
904 ;; (define-key km "+" 'senator-unfold-tag) 905 ;; (define-key km "+" 'senator-unfold-tag)
905 map)) 906 map))
diff --git a/lisp/cedet/semantic/analyze/fcn.el b/lisp/cedet/semantic/analyze/fcn.el
index 42bc482a1df..4300c89c9df 100644
--- a/lisp/cedet/semantic/analyze/fcn.el
+++ b/lisp/cedet/semantic/analyze/fcn.el
@@ -245,6 +245,8 @@ used by the analyzer debugger."
245 (semantic-scope-set-typecache scope nil) 245 (semantic-scope-set-typecache scope nil)
246 ))))) 246 )))))
247 247
248(autoload 'semantic-tag-similar-p "semantic/tag-ls")
249
248(defun semantic-analyze-dereference-metatype-stack (type scope &optional type-declaration) 250(defun semantic-analyze-dereference-metatype-stack (type scope &optional type-declaration)
249 "Dereference metatypes repeatedly until we hit a real TYPE. 251 "Dereference metatypes repeatedly until we hit a real TYPE.
250Uses `semantic-analyze-dereference-metatype'. 252Uses `semantic-analyze-dereference-metatype'.
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index 2f8cf08af3e..3c991ea8555 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -529,7 +529,7 @@ code to parse."
529(define-lex-regex-analyzer semantic-lex-c-ifdef 529(define-lex-regex-analyzer semantic-lex-c-ifdef
530 "Code blocks wrapped up in #ifdef. 530 "Code blocks wrapped up in #ifdef.
531Uses known macro tables in SPP to determine what block to skip." 531Uses known macro tables in SPP to determine what block to skip."
532 "^\\s-*#\\s-*\\(ifndef\\|ifdef\\)\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 532 "^\\s-*#\\s-*\\(ifndef\\|ifdef\\)\\s-+\\(\\(\\sw\\|\\s_\\)+\\)\\([ \t\C-m].*\\)?$"
533 (semantic-c-do-lex-ifdef)) 533 (semantic-c-do-lex-ifdef))
534 534
535(defun semantic-c-do-lex-ifdef () 535(defun semantic-c-do-lex-ifdef ()
diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el
index a8ddbe106f7..07e0e08bbaf 100644
--- a/lisp/cedet/semantic/bovine/el.el
+++ b/lisp/cedet/semantic/bovine/el.el
@@ -940,8 +940,11 @@ ELisp variables can be pretty long, so track this one too.")
940(define-child-mode lisp-mode emacs-lisp-mode 940(define-child-mode lisp-mode emacs-lisp-mode
941 "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'.") 941 "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'.")
942 942
943;;;###autoload
943(defun semantic-default-elisp-setup () 944(defun semantic-default-elisp-setup ()
944 "Setup hook function for Emacs Lisp files and Semantic." 945 "Setup hook function for Emacs Lisp files and Semantic."
946 ;; This is here mostly to get this file loaded when a .el file is
947 ;; loaded into Emacs.
945 ) 948 )
946 949
947(add-hook 'emacs-lisp-mode-hook 'semantic-default-elisp-setup) 950(add-hook 'emacs-lisp-mode-hook 'semantic-default-elisp-setup)
@@ -960,6 +963,12 @@ ELisp variables can be pretty long, so track this one too.")
960 '(require 'semantic/db-el) 963 '(require 'semantic/db-el)
961 ) 964 )
962 965
966
963(provide 'semantic/bovine/el) 967(provide 'semantic/bovine/el)
964 968
969;; Local variables:
970;; generated-autoload-file: "../loaddefs.el"
971;; generated-autoload-load-name: "semantic/bovine/el"
972;; End:
973
965;;; semantic/bovine/el.el ends here 974;;; semantic/bovine/el.el ends here
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index 6c2b97a677a..b42e24fb9c0 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -1667,7 +1667,7 @@ Display mechanism using tooltip for a list of possible completions.")
1667 (setq msg "..."))) 1667 (setq msg "...")))
1668 ((eq mode 'verbose) 1668 ((eq mode 'verbose)
1669 ;; Always show extended match set. 1669 ;; Always show extended match set.
1670 (oset obj max-tags semantic-displayor-tooltip-max-tags) 1670 (oset obj max-tags-initial semantic-displayor-tooltip-max-tags)
1671 (setq max-tags semantic-displayor-tooltip-max-tags))) 1671 (setq max-tags semantic-displayor-tooltip-max-tags)))
1672 (unless msg 1672 (unless msg
1673 (oset obj shown t) 1673 (oset obj shown t)
diff --git a/lisp/cedet/semantic/ctxt.el b/lisp/cedet/semantic/ctxt.el
index 2c0b428c195..629bbdee561 100644
--- a/lisp/cedet/semantic/ctxt.el
+++ b/lisp/cedet/semantic/ctxt.el
@@ -357,6 +357,87 @@ beginning and end of a command."
357 (def-edebug-spec semantic-with-buffer-narrowed-to-command 357 (def-edebug-spec semantic-with-buffer-narrowed-to-command
358 (def-body)))) 358 (def-body))))
359 359
360(define-overloadable-function semantic-ctxt-end-of-symbol (&optional point)
361 "Move point to the end of the current symbol under POINT.
362This skips forward over symbols in a complex reference.
363For example, in the C statement:
364 this.that().entry;
365
366If the cursor is on 'this', will move point to the ; after entry.")
367
368(defun semantic-ctxt-end-of-symbol-default (&optional point)
369 "Move point to the end of the current symbol under POINT.
370This will move past type/field names when applicable.
371Depends on `semantic-type-relation-separator-character', and will
372work on C like languages."
373 (if point (goto-char point))
374 (let* ((fieldsep1 (mapconcat (lambda (a) (regexp-quote a))
375 semantic-type-relation-separator-character
376 "\\|"))
377 ;; NOTE: The [ \n] expression below should used \\s-, but that
378 ;; doesn't work in C since \n means end-of-comment, and isn't
379 ;; really whitespace.
380 (fieldsep (concat "[ \t\n\r]*\\(" fieldsep1 "\\)[ \t\n\r]*\\(\\w\\|\\s_\\)"))
381 (case-fold-search semantic-case-fold)
382 (continuesearch t)
383 (end nil)
384 )
385 (with-syntax-table semantic-lex-syntax-table
386 (cond ((looking-at "\\w\\|\\s_")
387 ;; In the middle of a symbol, move to the end.
388 (forward-sexp 1))
389 ((looking-at fieldsep1)
390 ;; We are in a fine spot.. do nothing.
391 nil
392 )
393 ((save-excursion
394 (and (condition-case nil
395 (progn (forward-sexp -1)
396 (forward-sexp 1)
397 t)
398 (error nil))
399 (looking-at fieldsep1)))
400 (setq symlist (list ""))
401 (forward-sexp -1)
402 ;; Skip array expressions.
403 (while (looking-at "\\s(") (forward-sexp -1))
404 (forward-sexp 1))
405 )
406 ;; Set the current end marker.
407 (setq end (point))
408
409 ;; Cursor is at the safe end of some symbol. Look until we
410 ;; find the logical end of this current complex symbol.
411 (condition-case nil
412 (while continuesearch
413 ;; If there are functional arguments, arrays, etc, skip them.
414 (when (looking-at "\\s(")
415 (forward-sexp 1))
416
417 ;; If there is a field separator, then skip that, plus
418 ;; the next expected symbol.
419 (if (not (looking-at fieldsep1))
420 ;; We hit the end.
421 (error nil)
422
423 ;; Skip the separator and the symbol.
424 (goto-char (match-end 0))
425
426 (if (looking-at "\\w\\|\\s_")
427 ;; Skip symbols
428 (forward-sexp 1)
429 ;; No symbol, exit the search...
430 (setq continuesearch nil))
431
432 (setq end (point)))
433
434 ;; Cont...
435 )
436
437 ;; Restore position if we go to far....
438 (error (goto-char end)) )
439
440 )))
360 441
361(define-overloadable-function semantic-ctxt-current-symbol (&optional point) 442(define-overloadable-function semantic-ctxt-current-symbol (&optional point)
362 "Return the current symbol the cursor is on at POINT in a list. 443 "Return the current symbol the cursor is on at POINT in a list.
@@ -391,7 +472,7 @@ Depends on `semantic-type-relation-separator-character'."
391 ;; In the middle of a symbol, move to the end. 472 ;; In the middle of a symbol, move to the end.
392 (forward-sexp 1)) 473 (forward-sexp 1))
393 ((looking-at fieldsep1) 474 ((looking-at fieldsep1)
394 ;; We are in a find spot.. do nothing. 475 ;; We are in a fine spot.. do nothing.
395 nil 476 nil
396 ) 477 )
397 ((save-excursion 478 ((save-excursion
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index e8784c4f85c..8d9cfcccd7d 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -899,7 +899,7 @@ If file does not have tags available, and DONTLOAD is nil,
899then load the tags for FILE, and create a new table object for it. 899then load the tags for FILE, and create a new table object for it.
900DONTLOAD does not affect the creation of new database objects." 900DONTLOAD does not affect the creation of new database objects."
901 ;; (message "Object Translate: %s" file) 901 ;; (message "Object Translate: %s" file)
902 (when (and file (file-exists-p file)) 902 (when (and file (file-exists-p file) (file-regular-p file))
903 (let* ((default-directory (file-name-directory file)) 903 (let* ((default-directory (file-name-directory file))
904 (tab (semanticdb-file-table-object-from-hash file)) 904 (tab (semanticdb-file-table-object-from-hash file))
905 (fullfile nil)) 905 (fullfile nil))
diff --git a/lisp/cedet/semantic/decorate/mode.el b/lisp/cedet/semantic/decorate/mode.el
index fc791f52da1..a4aa535eb1a 100644
--- a/lisp/cedet/semantic/decorate/mode.el
+++ b/lisp/cedet/semantic/decorate/mode.el
@@ -64,6 +64,14 @@ add items to this list."
64 "Return the STYLE's highlighter function." 64 "Return the STYLE's highlighter function."
65 (intern (format "%s-highlight" style))) 65 (intern (format "%s-highlight" style)))
66 66
67(defsubst semantic-decorate-style-predicate-default (style)
68 "Return the STYLE's predicate function."
69 (intern (format "%s-p-default" style)))
70
71(defsubst semantic-decorate-style-highlighter-default (style)
72 "Return the STYLE's highlighter function."
73 (intern (format "%s-highlight-default" style)))
74
67;;; Base decoration API 75;;; Base decoration API
68;; 76;;
69(defsubst semantic-decoration-p (object) 77(defsubst semantic-decoration-p (object)
@@ -265,8 +273,6 @@ minor mode is enabled."
265 (semantic-make-local-hook 'semantic-after-toplevel-cache-change-hook) 273 (semantic-make-local-hook 'semantic-after-toplevel-cache-change-hook)
266 (add-hook 'semantic-after-toplevel-cache-change-hook 274 (add-hook 'semantic-after-toplevel-cache-change-hook
267 'semantic-decorate-tags-after-full-reparse nil t) 275 'semantic-decorate-tags-after-full-reparse nil t)
268 ;; Decorate includes by default
269 (require 'semantic/decorate/include)
270 ;; Add decorations to available tags. The above hooks ensure 276 ;; Add decorations to available tags. The above hooks ensure
271 ;; that new tags will be decorated when they become available. 277 ;; that new tags will be decorated when they become available.
272 (semantic-decorate-add-decorations (semantic-fetch-available-tags))) 278 (semantic-decorate-add-decorations (semantic-fetch-available-tags)))
@@ -325,6 +331,8 @@ Return non-nil if the decoration style is enabled."
325 (flag (if arg 331 (flag (if arg
326 (> (prefix-numeric-value arg) 0) 332 (> (prefix-numeric-value arg) 0)
327 (not (cdr style))))) 333 (not (cdr style)))))
334 (when (null style)
335 (error "Unknown decoration style %s" name))
328 (unless (eq (cdr style) flag) 336 (unless (eq (cdr style) flag)
329 ;; Store the new flag. 337 ;; Store the new flag.
330 (setcdr style flag) 338 (setcdr style flag)
@@ -368,7 +376,8 @@ DOC is a documentation string describing the decoration style NAME.
368It is appended to auto-generated doc strings. 376It is appended to auto-generated doc strings.
369An Optional list of FLAGS can also be specified. Flags are: 377An Optional list of FLAGS can also be specified. Flags are:
370 :enabled <value> - specify the default enabled value for NAME. 378 :enabled <value> - specify the default enabled value for NAME.
371 379 :load <value> - specify a feature (as a string) with the rest of
380 the definition for decoration mode NAME.
372 381
373This defines two new overload functions respectively called `NAME-p' 382This defines two new overload functions respectively called `NAME-p'
374and `NAME-highlight', for which you must provide a default 383and `NAME-highlight', for which you must provide a default
@@ -386,9 +395,14 @@ To add other kind of decorations on a tag, `NAME-highlight' must use
386decoration API found in this library." 395decoration API found in this library."
387 (let ((predicate (semantic-decorate-style-predicate name)) 396 (let ((predicate (semantic-decorate-style-predicate name))
388 (highlighter (semantic-decorate-style-highlighter name)) 397 (highlighter (semantic-decorate-style-highlighter name))
398 (predicatedef (semantic-decorate-style-predicate-default name))
399 (highlighterdef (semantic-decorate-style-highlighter-default name))
389 (defaultenable (if (plist-member flags :enabled) 400 (defaultenable (if (plist-member flags :enabled)
390 (plist-get flags :enabled) 401 (plist-get flags :enabled)
391 t)) 402 t))
403 (loadfile (if (plist-member flags :load)
404 (plist-get flags :load)
405 nil))
392 ) 406 )
393 `(progn 407 `(progn
394 ;; Clear the menu cache so that new items are added when 408 ;; Clear the menu cache so that new items are added when
@@ -408,7 +422,19 @@ decoration API found in this library."
408 (add-to-list 'semantic-decoration-styles 422 (add-to-list 'semantic-decoration-styles
409 (cons ',(symbol-name name) 423 (cons ',(symbol-name name)
410 ,defaultenable)) 424 ,defaultenable))
411 ))) 425 ;; If there is a load file, then create the autoload tokens for
426 ;; those functions to load the token, but only if the fsym
427 ;; doesn't exist yet.
428 (when (stringp ,loadfile)
429 (unless (fboundp ',predicatedef)
430 (autoload ',predicatedef ',loadfile "Return non-nil to decorate TAG."
431 nil 'function))
432
433 (unless (fboundp ',highlighterdef)
434 (autoload ',highlighterdef ',loadfile "Decorate TAG."
435 nil 'function))
436 ))
437 ))
412 438
413;;; Predefined decoration styles 439;;; Predefined decoration styles
414;; 440;;
@@ -514,6 +540,16 @@ Use a primary decoration."
514 (semantic-set-tag-face 540 (semantic-set-tag-face
515 tag 'semantic-decoration-on-protected-members-face)) 541 tag 'semantic-decoration-on-protected-members-face))
516 542
543;;; Decoration Modes in other files
544;;
545(define-semantic-decoration-style semantic-decoration-on-includes
546 "Highlight class members that are includes.
547This mode provides a nice context menu on the include statements."
548 :enabled t
549 :load "semantic/decorate/include")
550
551
552
517(provide 'semantic/decorate/mode) 553(provide 'semantic/decorate/mode)
518 554
519;; Local variables: 555;; Local variables:
diff --git a/lisp/cedet/semantic/ede-grammar.el b/lisp/cedet/semantic/ede-grammar.el
index cb2a1faaac0..17859e232a3 100644
--- a/lisp/cedet/semantic/ede-grammar.el
+++ b/lisp/cedet/semantic/ede-grammar.el
@@ -146,7 +146,7 @@ Lays claim to all -by.el, and -wy.el files."
146 (let* ((package (semantic-grammar-create-package)) 146 (let* ((package (semantic-grammar-create-package))
147 (fname (progn (string-match ".*/\\(.+\\.el\\)" package) 147 (fname (progn (string-match ".*/\\(.+\\.el\\)" package)
148 (match-string 1 package))) 148 (match-string 1 package)))
149 (src (with-current-buffer fname (buffer-file-name))) 149 (src (ede-expand-filename obj fname))
150 (csrc (concat (file-name-sans-extension src) ".elc"))) 150 (csrc (concat (file-name-sans-extension src) ".elc")))
151 (if (< emacs-major-version 24) 151 (if (< emacs-major-version 24)
152 ;; Does not have `byte-recompile-file' 152 ;; Does not have `byte-recompile-file'
diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el
index b0540af373d..a27eab5404c 100644
--- a/lisp/cedet/semantic/edit.el
+++ b/lisp/cedet/semantic/edit.el
@@ -141,8 +141,9 @@ Argument START, END, and LENGTH specify the bounds of the change."
141 (setq semantic-unmatched-syntax-cache-check t) 141 (setq semantic-unmatched-syntax-cache-check t)
142 (let ((inhibit-point-motion-hooks t) 142 (let ((inhibit-point-motion-hooks t)
143 ) 143 )
144 (run-hook-with-args 'semantic-change-functions start end length) 144 (save-match-data
145 )) 145 (run-hook-with-args 'semantic-change-functions start end length)
146 )))
146 147
147(defun semantic-changes-in-region (start end &optional buffer) 148(defun semantic-changes-in-region (start end &optional buffer)
148 "Find change overlays which exist in whole or in part between START and END. 149 "Find change overlays which exist in whole or in part between START and END.
diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el
index 2d53c857c1e..ce658cd5d54 100644
--- a/lisp/cedet/semantic/grammar.el
+++ b/lisp/cedet/semantic/grammar.el
@@ -1484,7 +1484,10 @@ expression then Lisp symbols are completed."
1484 (interactive) 1484 (interactive)
1485 (if (semantic-grammar-in-lisp-p) 1485 (if (semantic-grammar-in-lisp-p)
1486 ;; We are in lisp code. Do lisp completion. 1486 ;; We are in lisp code. Do lisp completion.
1487 (lisp-complete-symbol) 1487 (let ((completion-at-point-functions
1488 (append '(lisp-completion-at-point)
1489 completion-at-point-functions)))
1490 (completion-at-point))
1488 ;; We are not in lisp code. Do rule completion. 1491 ;; We are not in lisp code. Do rule completion.
1489 (let* ((nonterms (semantic-find-tags-by-class 'nonterminal (current-buffer))) 1492 (let* ((nonterms (semantic-find-tags-by-class 'nonterminal (current-buffer)))
1490 (sym (car (semantic-ctxt-current-symbol))) 1493 (sym (car (semantic-ctxt-current-symbol)))
diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el
index 9899ab974f7..6c223c2b9f2 100644
--- a/lisp/cedet/semantic/idle.el
+++ b/lisp/cedet/semantic/idle.el
@@ -434,16 +434,27 @@ datasets."
434 434
435(defun semantic-idle-scheduler-work-parse-neighboring-files () 435(defun semantic-idle-scheduler-work-parse-neighboring-files ()
436 "Parse all the files in similar directories to buffers being edited." 436 "Parse all the files in similar directories to buffers being edited."
437 ;; Let's check to see if EDE matters. 437 ;; Let's tell EDE to ignore all the files we're about to load
438 (let ((ede-auto-add-method 'never)) 438 (let ((ede-auto-add-method 'never)
439 (dolist (a auto-mode-alist) 439 (matching-auto-mode-patterns nil))
440 (when (eq (cdr a) major-mode) 440 ;; Collect all patterns matching files of the same mode we edit.
441 (dolist (file (directory-files default-directory t (car a) t)) 441 (mapc (lambda (pat) (and (eq (cdr pat) major-mode)
442 (semantic-throw-on-input 'parsing-mode-buffers) 442 (push (car pat) matching-auto-mode-patterns)))
443 (save-excursion 443 auto-mode-alist)
444 (semanticdb-file-table-object file) 444 ;; Loop over all files, and if one matches our mode, we force its
445 )))) 445 ;; table to load.
446 )) 446 (dolist (file (directory-files default-directory t ".*" t))
447 (catch 'found
448 (mapc (lambda (pat)
449 (semantic-throw-on-input 'parsing-mode-buffers)
450 ;; We use string-match instead of passing the pattern
451 ;; into directory files, because some patterns don't
452 ;; work with directory files.
453 (and (string-match pat file)
454 (save-excursion
455 (semanticdb-file-table-object file))
456 (throw 'found t)))
457 matching-auto-mode-patterns)))))
447 458
448 459
449;;; REPARSING 460;;; REPARSING
@@ -840,17 +851,18 @@ visible, then highlight it."
840 ) 851 )
841 (cond ((semantic-overlay-p region) 852 (cond ((semantic-overlay-p region)
842 (with-current-buffer (semantic-overlay-buffer region) 853 (with-current-buffer (semantic-overlay-buffer region)
843 (goto-char (semantic-overlay-start region)) 854 (save-excursion
844 (when (pos-visible-in-window-p 855 (goto-char (semantic-overlay-start region))
845 (point) (get-buffer-window (current-buffer) 'visible)) 856 (when (pos-visible-in-window-p
846 (if (< (semantic-overlay-end region) (point-at-eol)) 857 (point) (get-buffer-window (current-buffer) 'visible))
847 (pulse-momentary-highlight-overlay 858 (if (< (semantic-overlay-end region) (point-at-eol))
848 region semantic-idle-symbol-highlight-face) 859 (pulse-momentary-highlight-overlay
849 ;; Not the same 860 region semantic-idle-symbol-highlight-face)
850 (pulse-momentary-highlight-region 861 ;; Not the same
851 (semantic-overlay-start region) 862 (pulse-momentary-highlight-region
852 (point-at-eol) 863 (semantic-overlay-start region)
853 semantic-idle-symbol-highlight-face))) 864 (point-at-eol)
865 semantic-idle-symbol-highlight-face))))
854 )) 866 ))
855 ((vectorp region) 867 ((vectorp region)
856 (let ((start (aref region 0)) 868 (let ((start (aref region 0))
diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el
index ba862479be5..feead78985c 100644
--- a/lisp/cedet/semantic/lex.el
+++ b/lisp/cedet/semantic/lex.el
@@ -437,7 +437,7 @@ PROPSPECS must be a list of (TYPE PROPERTY VALUE)."
437 (if default 437 (if default
438 (message 438 (message
439 "*Warning* default value of <%s> tokens changed to %S, was %S" 439 "*Warning* default value of <%s> tokens changed to %S, was %S"
440 type default token)) 440 type token default))
441 (setq default token))) 441 (setq default token)))
442 ;; Ensure the default matching spec is the first one. 442 ;; Ensure the default matching spec is the first one.
443 (semantic-lex-type-set type (cons default (nreverse alist)))) 443 (semantic-lex-type-set type (cons default (nreverse alist))))
diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el
index 8ca398ef271..719868f7635 100644
--- a/lisp/cedet/semantic/wisent/python.el
+++ b/lisp/cedet/semantic/wisent/python.el
@@ -485,6 +485,20 @@ Return a list as per `semantic-ctxt-current-symbol'.
485Return nil if there is nothing relevant." 485Return nil if there is nothing relevant."
486 nil) 486 nil)
487 487
488;;; Tag Formatting
489;;
490(define-mode-local-override semantic-format-tag-abbreviate python-mode (tag &optional parent color)
491 "Format an abbreviated tag for python.
492Shortens 'code' tags, but passes through for others."
493 (cond ((semantic-tag-of-class-p tag 'code)
494 ;; Just take the first line.
495 (let ((name (semantic-tag-name tag)))
496 (when (string-match "\n" name)
497 (setq name (substring name 0 (match-beginning 0))))
498 name))
499 (t
500 (semantic-format-tag-abbreviate-default tag parent color))))
501
488;;; Enable Semantic in `python-mode'. 502;;; Enable Semantic in `python-mode'.
489;; 503;;
490 504
diff --git a/lisp/cedet/srecode/args.el b/lisp/cedet/srecode/args.el
index d6798f7523d..6bc78295fa7 100644
--- a/lisp/cedet/srecode/args.el
+++ b/lisp/cedet/srecode/args.el
@@ -26,6 +26,7 @@
26;; a set of simple arguments for srecode templates. 26;; a set of simple arguments for srecode templates.
27 27
28(require 'srecode/dictionary) 28(require 'srecode/dictionary)
29(require 'ede)
29 30
30;;; Code: 31;;; Code:
31 32
diff --git a/lisp/cedet/srecode/compile.el b/lisp/cedet/srecode/compile.el
index 0d68036c433..542fd49f8e5 100644
--- a/lisp/cedet/srecode/compile.el
+++ b/lisp/cedet/srecode/compile.el
@@ -200,10 +200,11 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
200 "Compile a semantic recode template file into a mode-local variable." 200 "Compile a semantic recode template file into a mode-local variable."
201 (interactive) 201 (interactive)
202 (unless (semantic-active-p) 202 (unless (semantic-active-p)
203 (error "You have to activate semantic-mode to compile SRecode templates.")) 203 (error "You have to activate semantic-mode to compile SRecode templates"))
204 (require 'srecode/insert) 204 (require 'srecode/insert)
205 (message "Compiling template %s..." 205 (when (called-interactively-p 'interactive)
206 (file-name-nondirectory (buffer-file-name))) 206 (message "Compiling template %s..."
207 (file-name-nondirectory (buffer-file-name))))
207 (let ((tags (semantic-fetch-tags)) 208 (let ((tags (semantic-fetch-tags))
208 (tag nil) 209 (tag nil)
209 (class nil) 210 (class nil)
@@ -288,10 +289,11 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
288 ) 289 )
289 ;; Continue 290 ;; Continue
290 (setq tags (cdr tags))) 291 (setq tags (cdr tags)))
291 292
292 ;; MSG - Before install since nreverse whacks our list. 293 ;; MSG - Before install since nreverse whacks our list.
293 (message "%d templates compiled for %s" 294 (when (called-interactively-p 'interactive)
294 (length table) mode) 295 (message "%d templates compiled for %s"
296 (length table) mode))
295 297
296 ;; 298 ;;
297 ;; APPLY TO MODE 299 ;; APPLY TO MODE
@@ -316,12 +318,14 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
316 (if (stringp project) 318 (if (stringp project)
317 (setq priority (+ 50 defaultdelta)) 319 (setq priority (+ 50 defaultdelta))
318 (setq priority (+ 80 defaultdelta)))) 320 (setq priority (+ 80 defaultdelta))))
319 (message "Templates %s has estimated priority of %d" 321 (when (called-interactively-p 'interactive)
320 (file-name-nondirectory (buffer-file-name)) 322 (message "Templates %s has estimated priority of %d"
321 priority)) 323 (file-name-nondirectory (buffer-file-name))
322 (message "Compiling templates %s priority %d... done!" 324 priority)))
323 (file-name-nondirectory (buffer-file-name)) 325 (when (called-interactively-p 'interactive)
324 priority)) 326 (message "Compiling templates %s priority %d... done!"
327 (file-name-nondirectory (buffer-file-name))
328 priority)))
325 329
326 ;; Save it up! 330 ;; Save it up!
327 (srecode-compile-template-table table mode priority application framework project vars) 331 (srecode-compile-template-table table mode priority application framework project vars)
diff --git a/lisp/cedet/srecode/java.el b/lisp/cedet/srecode/java.el
index 29a8465c45c..1b8922c2746 100644
--- a/lisp/cedet/srecode/java.el
+++ b/lisp/cedet/srecode/java.el
@@ -27,6 +27,7 @@
27 27
28(require 'srecode/dictionary) 28(require 'srecode/dictionary)
29(require 'semantic/find) 29(require 'semantic/find)
30(require 'ede)
30 31
31;;;###autoload 32;;;###autoload
32(defun srecode-semantic-handle-:java (dict) 33(defun srecode-semantic-handle-:java (dict)
diff --git a/lisp/cedet/srecode/srt-wy.el b/lisp/cedet/srecode/srt-wy.el
index 5560d35a70c..450f57d943c 100644
--- a/lisp/cedet/srecode/srt-wy.el
+++ b/lisp/cedet/srecode/srt-wy.el
@@ -131,6 +131,10 @@
131 ((SET symbol insertable-string-list newline) 131 ((SET symbol insertable-string-list newline)
132 (wisent-raw-tag 132 (wisent-raw-tag
133 (semantic-tag-new-variable $2 nil $3))) 133 (semantic-tag-new-variable $2 nil $3)))
134 ((SET symbol number newline)
135 (wisent-raw-tag
136 (semantic-tag-new-variable $2 nil
137 (list $3))))
134 ((SHOW symbol newline) 138 ((SHOW symbol newline)
135 (wisent-raw-tag 139 (wisent-raw-tag
136 (semantic-tag-new-variable $2 nil t)))) 140 (semantic-tag-new-variable $2 nil t))))
@@ -290,8 +294,8 @@ It ignores whitespace, newlines and comments."
290 srecode-template-separator-block 294 srecode-template-separator-block
291 srecode-template-wy--<keyword>-keyword-analyzer 295 srecode-template-wy--<keyword>-keyword-analyzer
292 srecode-template-property-analyzer 296 srecode-template-property-analyzer
293 srecode-template-wy--<symbol>-regexp-analyzer
294 srecode-template-wy--<number>-regexp-analyzer 297 srecode-template-wy--<number>-regexp-analyzer
298 srecode-template-wy--<symbol>-regexp-analyzer
295 srecode-template-wy--<string>-sexp-analyzer 299 srecode-template-wy--<string>-sexp-analyzer
296 srecode-template-wy--<punctuation>-string-analyzer 300 srecode-template-wy--<punctuation>-string-analyzer
297 semantic-lex-default-action 301 semantic-lex-default-action
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index c910acdbc14..e603f76f41d 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -411,6 +411,9 @@ specify different fields to sort on."
411(defvar byte-compile-bound-variables nil 411(defvar byte-compile-bound-variables nil
412 "List of dynamic variables bound in the context of the current form. 412 "List of dynamic variables bound in the context of the current form.
413This list lives partly on the stack.") 413This list lives partly on the stack.")
414(defvar byte-compile-lexical-variables nil
415 "List of variables that have been treated as lexical.
416Filled in `cconv-analyse-form' but initialized and consulted here.")
414(defvar byte-compile-const-variables nil 417(defvar byte-compile-const-variables nil
415 "List of variables declared as constants during compilation of this file.") 418 "List of variables declared as constants during compilation of this file.")
416(defvar byte-compile-free-references) 419(defvar byte-compile-free-references)
@@ -1489,6 +1492,7 @@ extra args."
1489 (byte-compile--outbuffer nil) 1492 (byte-compile--outbuffer nil)
1490 (byte-compile-function-environment nil) 1493 (byte-compile-function-environment nil)
1491 (byte-compile-bound-variables nil) 1494 (byte-compile-bound-variables nil)
1495 (byte-compile-lexical-variables nil)
1492 (byte-compile-const-variables nil) 1496 (byte-compile-const-variables nil)
1493 (byte-compile-free-references nil) 1497 (byte-compile-free-references nil)
1494 (byte-compile-free-assignments nil) 1498 (byte-compile-free-assignments nil)
@@ -2245,15 +2249,24 @@ list that represents a doc string reference.
2245 2249
2246(put 'defvar 'byte-hunk-handler 'byte-compile-file-form-defvar) 2250(put 'defvar 'byte-hunk-handler 'byte-compile-file-form-defvar)
2247(put 'defconst 'byte-hunk-handler 'byte-compile-file-form-defvar) 2251(put 'defconst 'byte-hunk-handler 'byte-compile-file-form-defvar)
2248(defun byte-compile-file-form-defvar (form) 2252
2249 (when (and (symbolp (nth 1 form)) 2253(defun byte-compile--declare-var (sym)
2250 (not (string-match "[-*/:$]" (symbol-name (nth 1 form)))) 2254 (when (and (symbolp sym)
2255 (not (string-match "[-*/:$]" (symbol-name sym)))
2251 (byte-compile-warning-enabled-p 'lexical)) 2256 (byte-compile-warning-enabled-p 'lexical))
2252 (byte-compile-warn "global/dynamic var `%s' lacks a prefix" 2257 (byte-compile-warn "global/dynamic var `%s' lacks a prefix"
2253 (nth 1 form))) 2258 sym))
2254 (push (nth 1 form) byte-compile-bound-variables) 2259 (when (memq sym byte-compile-lexical-variables)
2255 (if (eq (car form) 'defconst) 2260 (setq byte-compile-lexical-variables
2256 (push (nth 1 form) byte-compile-const-variables)) 2261 (delq sym byte-compile-lexical-variables))
2262 (byte-compile-warn "Variable `%S' declared after its first use" sym))
2263 (push sym byte-compile-bound-variables))
2264
2265(defun byte-compile-file-form-defvar (form)
2266 (let ((sym (nth 1 form)))
2267 (byte-compile--declare-var sym)
2268 (if (eq (car form) 'defconst)
2269 (push sym byte-compile-const-variables)))
2257 (if (and (null (cddr form)) ;No `value' provided. 2270 (if (and (null (cddr form)) ;No `value' provided.
2258 (eq (car form) 'defvar)) ;Just a declaration. 2271 (eq (car form) 'defvar)) ;Just a declaration.
2259 nil 2272 nil
@@ -2267,7 +2280,7 @@ list that represents a doc string reference.
2267 'byte-compile-file-form-define-abbrev-table) 2280 'byte-compile-file-form-define-abbrev-table)
2268(defun byte-compile-file-form-define-abbrev-table (form) 2281(defun byte-compile-file-form-define-abbrev-table (form)
2269 (if (eq 'quote (car-safe (car-safe (cdr form)))) 2282 (if (eq 'quote (car-safe (car-safe (cdr form))))
2270 (push (car-safe (cdr (cadr form))) byte-compile-bound-variables)) 2283 (byte-compile--declare-var (car-safe (cdr (cadr form)))))
2271 (byte-compile-keep-pending form)) 2284 (byte-compile-keep-pending form))
2272 2285
2273(put 'custom-declare-variable 'byte-hunk-handler 2286(put 'custom-declare-variable 'byte-hunk-handler
@@ -2275,7 +2288,7 @@ list that represents a doc string reference.
2275(defun byte-compile-file-form-custom-declare-variable (form) 2288(defun byte-compile-file-form-custom-declare-variable (form)
2276 (when (byte-compile-warning-enabled-p 'callargs) 2289 (when (byte-compile-warning-enabled-p 'callargs)
2277 (byte-compile-nogroup-warn form)) 2290 (byte-compile-nogroup-warn form))
2278 (push (nth 1 (nth 1 form)) byte-compile-bound-variables) 2291 (byte-compile--declare-var (nth 1 (nth 1 form)))
2279 (byte-compile-keep-pending form)) 2292 (byte-compile-keep-pending form))
2280 2293
2281(put 'require 'byte-hunk-handler 'byte-compile-file-form-require) 2294(put 'require 'byte-hunk-handler 'byte-compile-file-form-require)
@@ -2576,19 +2589,16 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2576 "Return a list of the variables in the lambda argument list ARGLIST." 2589 "Return a list of the variables in the lambda argument list ARGLIST."
2577 (remq '&rest (remq '&optional arglist))) 2590 (remq '&rest (remq '&optional arglist)))
2578 2591
2579(defun byte-compile-make-lambda-lexenv (form) 2592(defun byte-compile-make-lambda-lexenv (args)
2580 "Return a new lexical environment for a lambda expression FORM." 2593 "Return a new lexical environment for a lambda expression FORM."
2581 ;; See if this is a closure or not 2594 (let* ((lexenv nil)
2582 (let ((args (byte-compile-arglist-vars (cadr form)))) 2595 (stackpos 0))
2583 (let ((lexenv nil)) 2596 ;; Add entries for each argument.
2584 ;; Fill in the initial stack contents 2597 (dolist (arg args)
2585 (let ((stackpos 0)) 2598 (push (cons arg stackpos) lexenv)
2586 ;; Add entries for each argument 2599 (setq stackpos (1+ stackpos)))
2587 (dolist (arg args) 2600 ;; Return the new lexical environment.
2588 (push (cons arg stackpos) lexenv) 2601 lexenv))
2589 (setq stackpos (1+ stackpos)))
2590 ;; Return the new lexical environment
2591 lexenv))))
2592 2602
2593(defun byte-compile-make-args-desc (arglist) 2603(defun byte-compile-make-args-desc (arglist)
2594 (let ((mandatory 0) 2604 (let ((mandatory 0)
@@ -2626,9 +2636,9 @@ for symbols generated by the byte compiler itself."
2626 (byte-compile-set-symbol-position 'lambda)) 2636 (byte-compile-set-symbol-position 'lambda))
2627 (byte-compile-check-lambda-list (nth 1 fun)) 2637 (byte-compile-check-lambda-list (nth 1 fun))
2628 (let* ((arglist (nth 1 fun)) 2638 (let* ((arglist (nth 1 fun))
2639 (arglistvars (byte-compile-arglist-vars arglist))
2629 (byte-compile-bound-variables 2640 (byte-compile-bound-variables
2630 (append (and (not lexical-binding) 2641 (append (if (not lexical-binding) arglistvars)
2631 (byte-compile-arglist-vars arglist))
2632 byte-compile-bound-variables)) 2642 byte-compile-bound-variables))
2633 (body (cdr (cdr fun))) 2643 (body (cdr (cdr fun)))
2634 (doc (if (stringp (car body)) 2644 (doc (if (stringp (car body))
@@ -2676,7 +2686,8 @@ for symbols generated by the byte compiler itself."
2676 ;; args (since lambda expressions should be 2686 ;; args (since lambda expressions should be
2677 ;; closed by now). 2687 ;; closed by now).
2678 (and lexical-binding 2688 (and lexical-binding
2679 (byte-compile-make-lambda-lexenv fun)) 2689 (byte-compile-make-lambda-lexenv
2690 arglistvars))
2680 reserved-csts))) 2691 reserved-csts)))
2681 ;; Build the actual byte-coded function. 2692 ;; Build the actual byte-coded function.
2682 (cl-assert (eq 'byte-code (car-safe compiled))) 2693 (cl-assert (eq 'byte-code (car-safe compiled)))
@@ -3435,32 +3446,38 @@ discarding."
3435(byte-defop-compiler (/ byte-quo) byte-compile-quo) 3446(byte-defop-compiler (/ byte-quo) byte-compile-quo)
3436(byte-defop-compiler nconc) 3447(byte-defop-compiler nconc)
3437 3448
3449;; Is this worth it? Both -before and -after are written in C.
3438(defun byte-compile-char-before (form) 3450(defun byte-compile-char-before (form)
3439 (cond ((= 2 (length form)) 3451 (cond ((or (= 1 (length form))
3452 (and (= 2 (length form)) (not (nth 1 form))))
3453 (byte-compile-form '(char-after (1- (point)))))
3454 ((= 2 (length form))
3440 (byte-compile-form (list 'char-after (if (numberp (nth 1 form)) 3455 (byte-compile-form (list 'char-after (if (numberp (nth 1 form))
3441 (1- (nth 1 form)) 3456 (1- (nth 1 form))
3442 `(1- ,(nth 1 form)))))) 3457 `(1- (or ,(nth 1 form)
3443 ((= 1 (length form)) 3458 (point)))))))
3444 (byte-compile-form '(char-after (1- (point)))))
3445 (t (byte-compile-subr-wrong-args form "0-1")))) 3459 (t (byte-compile-subr-wrong-args form "0-1"))))
3446 3460
3447;; backward-... ==> forward-... with negated argument. 3461;; backward-... ==> forward-... with negated argument.
3462;; Is this worth it? Both -backward and -forward are written in C.
3448(defun byte-compile-backward-char (form) 3463(defun byte-compile-backward-char (form)
3449 (cond ((= 2 (length form)) 3464 (cond ((or (= 1 (length form))
3465 (and (= 2 (length form)) (not (nth 1 form))))
3466 (byte-compile-form '(forward-char -1)))
3467 ((= 2 (length form))
3450 (byte-compile-form (list 'forward-char (if (numberp (nth 1 form)) 3468 (byte-compile-form (list 'forward-char (if (numberp (nth 1 form))
3451 (- (nth 1 form)) 3469 (- (nth 1 form))
3452 `(- ,(nth 1 form)))))) 3470 `(- (or ,(nth 1 form) 1))))))
3453 ((= 1 (length form))
3454 (byte-compile-form '(forward-char -1)))
3455 (t (byte-compile-subr-wrong-args form "0-1")))) 3471 (t (byte-compile-subr-wrong-args form "0-1"))))
3456 3472
3457(defun byte-compile-backward-word (form) 3473(defun byte-compile-backward-word (form)
3458 (cond ((= 2 (length form)) 3474 (cond ((or (= 1 (length form))
3475 (and (= 2 (length form)) (not (nth 1 form))))
3476 (byte-compile-form '(forward-word -1)))
3477 ((= 2 (length form))
3459 (byte-compile-form (list 'forward-word (if (numberp (nth 1 form)) 3478 (byte-compile-form (list 'forward-word (if (numberp (nth 1 form))
3460 (- (nth 1 form)) 3479 (- (nth 1 form))
3461 `(- ,(nth 1 form)))))) 3480 `(- (or ,(nth 1 form) 1))))))
3462 ((= 1 (length form))
3463 (byte-compile-form '(forward-word -1)))
3464 (t (byte-compile-subr-wrong-args form "0-1")))) 3481 (t (byte-compile-subr-wrong-args form "0-1"))))
3465 3482
3466(defun byte-compile-list (form) 3483(defun byte-compile-list (form)
@@ -3862,9 +3879,8 @@ that suppresses all warnings during execution of BODY."
3862 "Emit byte-codes to push the initialization value for CLAUSE on the stack. 3879 "Emit byte-codes to push the initialization value for CLAUSE on the stack.
3863Return the offset in the form (VAR . OFFSET)." 3880Return the offset in the form (VAR . OFFSET)."
3864 (let* ((var (if (consp clause) (car clause) clause))) 3881 (let* ((var (if (consp clause) (car clause) clause)))
3865 ;; We record the stack position even of dynamic bindings and 3882 ;; We record the stack position even of dynamic bindings; we'll put
3866 ;; variables in non-stack lexical environments; we'll put 3883 ;; them in the proper place later.
3867 ;; them in the proper place below.
3868 (prog1 (cons var byte-compile-depth) 3884 (prog1 (cons var byte-compile-depth)
3869 (if (consp clause) 3885 (if (consp clause)
3870 (byte-compile-form (cadr clause)) 3886 (byte-compile-form (cadr clause))
@@ -3882,33 +3898,41 @@ Return the offset in the form (VAR . OFFSET)."
3882INIT-LEXENV should be a lexical-environment alist describing the 3898INIT-LEXENV should be a lexical-environment alist describing the
3883positions of the init value that have been pushed on the stack. 3899positions of the init value that have been pushed on the stack.
3884Return non-nil if the TOS value was popped." 3900Return non-nil if the TOS value was popped."
3885 ;; The presence of lexical bindings mean that we may have to 3901 ;; The mix of lexical and dynamic bindings mean that we may have to
3886 ;; juggle things on the stack, to move them to TOS for 3902 ;; juggle things on the stack, to move them to TOS for
3887 ;; dynamic binding. 3903 ;; dynamic binding.
3888 (cond ((not (byte-compile-not-lexical-var-p var)) 3904 (if (and lexical-binding (not (byte-compile-not-lexical-var-p var)))
3889 ;; VAR is a simple stack-allocated lexical variable 3905 ;; VAR is a simple stack-allocated lexical variable.
3890 (push (assq var init-lexenv) 3906 (progn (push (assq var init-lexenv)
3891 byte-compile--lexical-environment) 3907 byte-compile--lexical-environment)
3892 nil) 3908 nil)
3893 ((eq var (caar init-lexenv)) 3909 ;; VAR should be dynamically bound.
3894 ;; VAR is dynamic and is on the top of the 3910 (while (assq var byte-compile--lexical-environment)
3895 ;; stack, so we can just bind it like usual 3911 ;; This dynamic binding shadows a lexical binding.
3896 (byte-compile-dynamic-variable-bind var) 3912 (setq byte-compile--lexical-environment
3897 t) 3913 (remq (assq var byte-compile--lexical-environment)
3898 (t 3914 byte-compile--lexical-environment)))
3899 ;; VAR is dynamic, but we have to get its 3915 (cond
3900 ;; value out of the middle of the stack 3916 ((eq var (caar init-lexenv))
3901 (let ((stack-pos (cdr (assq var init-lexenv)))) 3917 ;; VAR is dynamic and is on the top of the
3902 (byte-compile-stack-ref stack-pos) 3918 ;; stack, so we can just bind it like usual.
3903 (byte-compile-dynamic-variable-bind var) 3919 (byte-compile-dynamic-variable-bind var)
3904 ;; Now we have to store nil into its temporary 3920 t)
3905 ;; stack position to avoid problems with GC 3921 (t
3906 (byte-compile-push-constant nil) 3922 ;; VAR is dynamic, but we have to get its
3907 (byte-compile-stack-set stack-pos)) 3923 ;; value out of the middle of the stack.
3908 nil))) 3924 (let ((stack-pos (cdr (assq var init-lexenv))))
3909 3925 (byte-compile-stack-ref stack-pos)
3910(defun byte-compile-unbind (clauses init-lexenv 3926 (byte-compile-dynamic-variable-bind var)
3911 &optional preserve-body-value) 3927 ;; Now we have to store nil into its temporary
3928 ;; stack position so it doesn't prevent the value from being GC'd.
3929 ;; FIXME: Not worth the trouble.
3930 ;; (byte-compile-push-constant nil)
3931 ;; (byte-compile-stack-set stack-pos)
3932 )
3933 nil))))
3934
3935(defun byte-compile-unbind (clauses init-lexenv preserve-body-value)
3912 "Emit byte-codes to unbind the variables bound by CLAUSES. 3936 "Emit byte-codes to unbind the variables bound by CLAUSES.
3913CLAUSES is a `let'-style variable binding list. INIT-LEXENV should be a 3937CLAUSES is a `let'-style variable binding list. INIT-LEXENV should be a
3914lexical-environment alist describing the positions of the init value that 3938lexical-environment alist describing the positions of the init value that
@@ -3916,7 +3940,7 @@ have been pushed on the stack. If PRESERVE-BODY-VALUE is true,
3916then an additional value on the top of the stack, above any lexical binding 3940then an additional value on the top of the stack, above any lexical binding
3917slots, is preserved, so it will be on the top of the stack after all 3941slots, is preserved, so it will be on the top of the stack after all
3918binding slots have been popped." 3942binding slots have been popped."
3919 ;; Unbind dynamic variables 3943 ;; Unbind dynamic variables.
3920 (let ((num-dynamic-bindings 0)) 3944 (let ((num-dynamic-bindings 0))
3921 (dolist (clause clauses) 3945 (dolist (clause clauses)
3922 (unless (assq (if (consp clause) (car clause) clause) 3946 (unless (assq (if (consp clause) (car clause) clause)
@@ -3927,14 +3951,15 @@ binding slots have been popped."
3927 ;; Pop lexical variables off the stack, possibly preserving the 3951 ;; Pop lexical variables off the stack, possibly preserving the
3928 ;; return value of the body. 3952 ;; return value of the body.
3929 (when init-lexenv 3953 (when init-lexenv
3930 ;; INIT-LEXENV contains all init values left on the stack 3954 ;; INIT-LEXENV contains all init values left on the stack.
3931 (byte-compile-discard (length init-lexenv) preserve-body-value))) 3955 (byte-compile-discard (length init-lexenv) preserve-body-value)))
3932 3956
3933(defun byte-compile-let (form) 3957(defun byte-compile-let (form)
3934 "Generate code for the `let' form FORM." 3958 "Generate code for the `let' or `let*' form FORM."
3935 (let ((clauses (cadr form)) 3959 (let ((clauses (cadr form))
3936 (init-lexenv nil)) 3960 (init-lexenv nil)
3937 (when (eq (car form) 'let) 3961 (is-let (eq (car form) 'let)))
3962 (when is-let
3938 ;; First compute the binding values in the old scope. 3963 ;; First compute the binding values in the old scope.
3939 (dolist (var clauses) 3964 (dolist (var clauses)
3940 (push (byte-compile-push-binding-init var) init-lexenv))) 3965 (push (byte-compile-push-binding-init var) init-lexenv)))
@@ -3946,28 +3971,20 @@ binding slots have been popped."
3946 ;; For `let', do it in reverse order, because it makes no 3971 ;; For `let', do it in reverse order, because it makes no
3947 ;; semantic difference, but it is a lot more efficient since the 3972 ;; semantic difference, but it is a lot more efficient since the
3948 ;; values are now in reverse order on the stack. 3973 ;; values are now in reverse order on the stack.
3949 (dolist (var (if (eq (car form) 'let) (reverse clauses) clauses)) 3974 (dolist (var (if is-let (reverse clauses) clauses))
3950 (unless (eq (car form) 'let) 3975 (unless is-let
3951 (push (byte-compile-push-binding-init var) init-lexenv)) 3976 (push (byte-compile-push-binding-init var) init-lexenv))
3952 (let ((var (if (consp var) (car var) var))) 3977 (let ((var (if (consp var) (car var) var)))
3953 (cond ((null lexical-binding) 3978 (if (byte-compile-bind var init-lexenv)
3954 ;; If there are no lexical bindings, we can do things simply. 3979 (pop init-lexenv))))
3955 (byte-compile-dynamic-variable-bind var))
3956 ((byte-compile-bind var init-lexenv)
3957 (pop init-lexenv)))))
3958 ;; Emit the body. 3980 ;; Emit the body.
3959 (let ((init-stack-depth byte-compile-depth)) 3981 (let ((init-stack-depth byte-compile-depth))
3960 (byte-compile-body-do-effect (cdr (cdr form))) 3982 (byte-compile-body-do-effect (cdr (cdr form)))
3961 ;; Unbind the variables. 3983 ;; Unbind both lexical and dynamic variables.
3962 (if lexical-binding 3984 (cl-assert (or (eq byte-compile-depth init-stack-depth)
3963 ;; Unbind both lexical and dynamic variables. 3985 (eq byte-compile-depth (1+ init-stack-depth))))
3964 (progn 3986 (byte-compile-unbind clauses init-lexenv
3965 (cl-assert (or (eq byte-compile-depth init-stack-depth) 3987 (> byte-compile-depth init-stack-depth))))))
3966 (eq byte-compile-depth (1+ init-stack-depth))))
3967 (byte-compile-unbind clauses init-lexenv (> byte-compile-depth
3968 init-stack-depth)))
3969 ;; Unbind dynamic variables.
3970 (byte-compile-out 'byte-unbind (length clauses)))))))
3971 3988
3972 3989
3973 3990
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index ee84a9f69ba..761e33c059d 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -81,7 +81,6 @@
81;; and other oddities. 81;; and other oddities.
82;; - new byte codes for unwind-protect, catch, and condition-case so that 82;; - new byte codes for unwind-protect, catch, and condition-case so that
83;; closures aren't needed at all. 83;; closures aren't needed at all.
84;; - inline source code of different binding mode by first compiling it.
85;; - a reference to a var that is known statically to always hold a constant 84;; - a reference to a var that is known statically to always hold a constant
86;; should be turned into a byte-constant rather than a byte-stack-ref. 85;; should be turned into a byte-constant rather than a byte-stack-ref.
87;; Hmm... right, that's called constant propagation and could be done here, 86;; Hmm... right, that's called constant propagation and could be done here,
@@ -95,6 +94,7 @@
95 94
96;; (defmacro dlet (binders &rest body) 95;; (defmacro dlet (binders &rest body)
97;; ;; Works in both lexical and non-lexical mode. 96;; ;; Works in both lexical and non-lexical mode.
97;; (declare (indent 1) (debug let))
98;; `(progn 98;; `(progn
99;; ,@(mapcar (lambda (binder) 99;; ,@(mapcar (lambda (binder)
100;; `(defvar ,(if (consp binder) (car binder) binder))) 100;; `(defvar ,(if (consp binder) (car binder) binder)))
@@ -489,6 +489,7 @@ places where they originally did not directly appear."
489(unless (fboundp 'byte-compile-not-lexical-var-p) 489(unless (fboundp 'byte-compile-not-lexical-var-p)
490 ;; Only used to test the code in non-lexbind Emacs. 490 ;; Only used to test the code in non-lexbind Emacs.
491 (defalias 'byte-compile-not-lexical-var-p 'boundp)) 491 (defalias 'byte-compile-not-lexical-var-p 'boundp))
492(defvar byte-compile-lexical-variables)
492 493
493(defun cconv--analyse-use (vardata form varkind) 494(defun cconv--analyse-use (vardata form varkind)
494 "Analyze the use of a variable. 495 "Analyze the use of a variable.
@@ -530,6 +531,7 @@ FORM is the parent form that binds this var."
530 ;; outside of it. 531 ;; outside of it.
531 (envcopy 532 (envcopy
532 (mapcar (lambda (vdata) (list (car vdata) nil nil nil nil)) env)) 533 (mapcar (lambda (vdata) (list (car vdata) nil nil nil nil)) env))
534 (byte-compile-bound-variables byte-compile-bound-variables)
533 (newenv envcopy)) 535 (newenv envcopy))
534 ;; Push it before recursing, so cconv-freevars-alist contains entries in 536 ;; Push it before recursing, so cconv-freevars-alist contains entries in
535 ;; the order they'll be used by closure-convert-rec. 537 ;; the order they'll be used by closure-convert-rec.
@@ -541,6 +543,7 @@ FORM is the parent form that binds this var."
541 (format "Argument %S is not a lexical variable" arg))) 543 (format "Argument %S is not a lexical variable" arg)))
542 ((eq ?& (aref (symbol-name arg) 0)) nil) ;Ignore &rest, &optional, ... 544 ((eq ?& (aref (symbol-name arg) 0)) nil) ;Ignore &rest, &optional, ...
543 (t (let ((varstruct (list arg nil nil nil nil))) 545 (t (let ((varstruct (list arg nil nil nil nil)))
546 (cl-pushnew arg byte-compile-lexical-variables)
544 (push (cons (list arg) (cdr varstruct)) newvars) 547 (push (cons (list arg) (cdr varstruct)) newvars)
545 (push varstruct newenv))))) 548 (push varstruct newenv)))))
546 (dolist (form body) ;Analyze body forms. 549 (dolist (form body) ;Analyze body forms.
@@ -579,6 +582,7 @@ and updates the data stored in ENV."
579 (let ((orig-env env) 582 (let ((orig-env env)
580 (newvars nil) 583 (newvars nil)
581 (var nil) 584 (var nil)
585 (byte-compile-bound-variables byte-compile-bound-variables)
582 (value nil)) 586 (value nil))
583 (dolist (binder binders) 587 (dolist (binder binders)
584 (if (not (consp binder)) 588 (if (not (consp binder))
@@ -592,6 +596,7 @@ and updates the data stored in ENV."
592 (cconv-analyse-form value (if (eq letsym 'let*) env orig-env))) 596 (cconv-analyse-form value (if (eq letsym 'let*) env orig-env)))
593 597
594 (unless (byte-compile-not-lexical-var-p var) 598 (unless (byte-compile-not-lexical-var-p var)
599 (cl-pushnew var byte-compile-lexical-variables)
595 (let ((varstruct (list var nil nil nil nil))) 600 (let ((varstruct (list var nil nil nil nil)))
596 (push (cons binder (cdr varstruct)) newvars) 601 (push (cons binder (cdr varstruct)) newvars)
597 (push varstruct env)))) 602 (push varstruct env))))
@@ -616,7 +621,8 @@ and updates the data stored in ENV."
616 621
617 (`((lambda . ,_) . ,_) ; First element is lambda expression. 622 (`((lambda . ,_) . ,_) ; First element is lambda expression.
618 (byte-compile-log-warning 623 (byte-compile-log-warning
619 "Use of deprecated ((lambda ...) ...) form" t :warning) 624 (format "Use of deprecated ((lambda %s ...) ...) form" (nth 1 (car form)))
625 t :warning)
620 (dolist (exp `((function ,(car form)) . ,(cdr form))) 626 (dolist (exp `((function ,(car form)) . ,(cdr form)))
621 (cconv-analyse-form exp env))) 627 (cconv-analyse-form exp env)))
622 628
@@ -645,6 +651,7 @@ and updates the data stored in ENV."
645 (`(track-mouse . ,body) 651 (`(track-mouse . ,body)
646 (cconv--analyse-function () body env form)) 652 (cconv--analyse-function () body env form))
647 653
654 (`(defvar ,var) (push var byte-compile-bound-variables))
648 (`(,(or `defconst `defvar) ,var ,value . ,_) 655 (`(,(or `defconst `defvar) ,var ,value . ,_)
649 (push var byte-compile-bound-variables) 656 (push var byte-compile-bound-variables)
650 (cconv-analyse-form value env)) 657 (cconv-analyse-form value env))
@@ -668,7 +675,9 @@ and updates the data stored in ENV."
668 ;; seem worth the trouble. 675 ;; seem worth the trouble.
669 (dolist (form forms) (cconv-analyse-form form nil))) 676 (dolist (form forms) (cconv-analyse-form form nil)))
670 677
671 (`(declare . ,_) nil) ;The args don't contain code. 678 ;; `declare' should now be macro-expanded away (and if they're not, we're
679 ;; in trouble because they *can* contain code nowadays).
680 ;; (`(declare . ,_) nil) ;The args don't contain code.
672 681
673 (`(,_ . ,body-forms) ; First element is a function or whatever. 682 (`(,_ . ,body-forms) ; First element is a function or whatever.
674 (dolist (form body-forms) (cconv-analyse-form form env))) 683 (dolist (form body-forms) (cconv-analyse-form form env)))
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index f3bf70b0190..52f123c83ec 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -156,8 +156,8 @@ an element already on the list.
156 ;; earlier and should have triggered them already. 156 ;; earlier and should have triggered them already.
157 (with-no-warnings ,place) 157 (with-no-warnings ,place)
158 (setq ,place (cons ,var ,place)))) 158 (setq ,place (cons ,var ,place))))
159 (list 'setq place (cl-list* 'cl-adjoin x place keys))) 159 `(setq ,place (cl-adjoin ,x ,place ,@keys)))
160 (cl-list* 'cl-callf2 'cl-adjoin x place keys))) 160 `(cl-callf2 cl-adjoin ,x ,place ,@keys)))
161 161
162(defun cl--set-elt (seq n val) 162(defun cl--set-elt (seq n val)
163 (if (listp seq) (setcar (nthcdr n seq) val) (aset seq n val))) 163 (if (listp seq) (setcar (nthcdr n seq) val) (aset seq n val)))
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el
index af19db63f30..a06abb03b95 100644
--- a/lisp/emacs-lisp/cl-loaddefs.el
+++ b/lisp/emacs-lisp/cl-loaddefs.el
@@ -267,7 +267,7 @@ including `cl-block' and `cl-eval-when'.
267;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when 267;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when
268;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp 268;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp
269;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*) 269;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*)
270;;;;;; "cl-macs" "cl-macs.el" "b839ad3781c4f2f849df0639b4eba166") 270;;;;;; "cl-macs" "cl-macs.el" "fd824d987086eafec0b1cb2efa8312f4")
271;;; Generated autoloads from cl-macs.el 271;;; Generated autoloads from cl-macs.el
272 272
273(autoload 'cl--compiler-macro-list* "cl-macs" "\ 273(autoload 'cl--compiler-macro-list* "cl-macs" "\
@@ -699,9 +699,10 @@ OPTION is either a single keyword or (KEYWORD VALUE) where
699KEYWORD can be one of :conc-name, :constructor, :copier, :predicate, 699KEYWORD can be one of :conc-name, :constructor, :copier, :predicate,
700:type, :named, :initial-offset, :print-function, or :include. 700:type, :named, :initial-offset, :print-function, or :include.
701 701
702Each SLOT may instead take the form (SLOT SLOT-OPTS...), where 702Each SLOT may instead take the form (SNAME SDEFAULT SOPTIONS...), where
703SLOT-OPTS are keyword-value pairs for that slot. Currently, only 703SDEFAULT is the default value of that slot and SOPTIONS are keyword-value
704one keyword is supported, `:read-only'. If this has a non-nil 704pairs for that slot.
705Currently, only one keyword is supported, `:read-only'. If this has a non-nil
705value, that slot cannot be set via `setf'. 706value, that slot cannot be set via `setf'.
706 707
707\(fn NAME SLOTS...)" nil t) 708\(fn NAME SLOTS...)" nil t)
@@ -724,6 +725,8 @@ TYPE is a Common Lisp-style type specifier.
724 725
725\(fn OBJECT TYPE)" nil nil) 726\(fn OBJECT TYPE)" nil nil)
726 727
728(eval-and-compile (put 'cl-typep 'compiler-macro #'cl--compiler-macro-typep))
729
727(autoload 'cl-check-type "cl-macs" "\ 730(autoload 'cl-check-type "cl-macs" "\
728Verify that FORM is of type TYPE; signal an error if not. 731Verify that FORM is of type TYPE; signal an error if not.
729STRING is an optional description of the desired type. 732STRING is an optional description of the desired type.
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 4aae2c6efe5..34957d86796 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -584,7 +584,7 @@ If `load' is in WHEN, BODY is evaluated when loaded after top-level compile.
584If `eval' is in WHEN, BODY is evaluated when interpreted or at non-top-level. 584If `eval' is in WHEN, BODY is evaluated when interpreted or at non-top-level.
585 585
586\(fn (WHEN...) BODY...)" 586\(fn (WHEN...) BODY...)"
587 (declare (indent 1) (debug ((&rest &or "compile" "load" "eval") body))) 587 (declare (indent 1) (debug (sexp body)))
588 (if (and (fboundp 'cl--compiling-file) (cl--compiling-file) 588 (if (and (fboundp 'cl--compiling-file) (cl--compiling-file)
589 (not cl--not-toplevel) (not (boundp 'for-effect))) ;Horrible kludge. 589 (not cl--not-toplevel) (not (boundp 'for-effect))) ;Horrible kludge.
590 (let ((comp (or (memq 'compile when) (memq :compile-toplevel when))) 590 (let ((comp (or (memq 'compile when) (memq :compile-toplevel when)))
@@ -2276,9 +2276,10 @@ OPTION is either a single keyword or (KEYWORD VALUE) where
2276KEYWORD can be one of :conc-name, :constructor, :copier, :predicate, 2276KEYWORD can be one of :conc-name, :constructor, :copier, :predicate,
2277:type, :named, :initial-offset, :print-function, or :include. 2277:type, :named, :initial-offset, :print-function, or :include.
2278 2278
2279Each SLOT may instead take the form (SLOT SLOT-OPTS...), where 2279Each SLOT may instead take the form (SNAME SDEFAULT SOPTIONS...), where
2280SLOT-OPTS are keyword-value pairs for that slot. Currently, only 2280SDEFAULT is the default value of that slot and SOPTIONS are keyword-value
2281one keyword is supported, `:read-only'. If this has a non-nil 2281pairs for that slot.
2282Currently, only one keyword is supported, `:read-only'. If this has a non-nil
2282value, that slot cannot be set via `setf'. 2283value, that slot cannot be set via `setf'.
2283 2284
2284\(fn NAME SLOTS...)" 2285\(fn NAME SLOTS...)"
@@ -2574,9 +2575,16 @@ The type name can then be used in `cl-typecase', `cl-check-type', etc."
2574(defun cl-typep (object type) ; See compiler macro below. 2575(defun cl-typep (object type) ; See compiler macro below.
2575 "Check that OBJECT is of type TYPE. 2576 "Check that OBJECT is of type TYPE.
2576TYPE is a Common Lisp-style type specifier." 2577TYPE is a Common Lisp-style type specifier."
2578 (declare (compiler-macro cl--compiler-macro-typep))
2577 (let ((cl--object object)) ;; Yuck!! 2579 (let ((cl--object object)) ;; Yuck!!
2578 (eval (cl--make-type-test 'cl--object type)))) 2580 (eval (cl--make-type-test 'cl--object type))))
2579 2581
2582(defun cl--compiler-macro-typep (form val type)
2583 (if (macroexp-const-p type)
2584 (macroexp-let2 macroexp-copyable-p temp val
2585 (cl--make-type-test temp (cl--const-expr-val type)))
2586 form))
2587
2580;;;###autoload 2588;;;###autoload
2581(defmacro cl-check-type (form type &optional string) 2589(defmacro cl-check-type (form type &optional string)
2582 "Verify that FORM is of type TYPE; signal an error if not. 2590 "Verify that FORM is of type TYPE; signal an error if not.
@@ -2635,19 +2643,13 @@ and then returning foo."
2635 (let ((p args) (res nil)) 2643 (let ((p args) (res nil))
2636 (while (consp p) (push (pop p) res)) 2644 (while (consp p) (push (pop p) res))
2637 (setq args (nconc (nreverse res) (and p (list '&rest p))))) 2645 (setq args (nconc (nreverse res) (and p (list '&rest p)))))
2638 `(cl-eval-when (compile load eval) 2646 (let ((fname (make-symbol (concat (symbol-name func) "--cmacro"))))
2639 (put ',func 'compiler-macro 2647 `(eval-and-compile
2640 (cl-function (lambda ,(if (memq '&whole args) (delq '&whole args) 2648 ;; Name the compiler-macro function, so that `symbol-file' can find it.
2641 (cons '_cl-whole-arg args)) 2649 (cl-defun ,fname ,(if (memq '&whole args) (delq '&whole args)
2642 ,@body))) 2650 (cons '_cl-whole-arg args))
2643 ;; This is so that describe-function can locate 2651 ,@body)
2644 ;; the macro definition. 2652 (put ',func 'compiler-macro #',fname))))
2645 (let ((file ,(or buffer-file-name
2646 (and (boundp 'byte-compile-current-file)
2647 (stringp byte-compile-current-file)
2648 byte-compile-current-file))))
2649 (if file (put ',func 'compiler-macro-file
2650 (purecopy (file-name-nondirectory file)))))))
2651 2653
2652;;;###autoload 2654;;;###autoload
2653(defun cl-compiler-macroexpand (form) 2655(defun cl-compiler-macroexpand (form)
@@ -2763,22 +2765,16 @@ surrounded by (cl-block NAME ...).
2763 2765
2764;;;###autoload 2766;;;###autoload
2765(defun cl--compiler-macro-adjoin (form a list &rest keys) 2767(defun cl--compiler-macro-adjoin (form a list &rest keys)
2766 (if (and (cl--simple-expr-p a) (cl--simple-expr-p list) 2768 (if (memq :key keys) form
2767 (not (memq :key keys))) 2769 (macroexp-let2 macroexp-copyable-p va a
2768 `(if (cl-member ,a ,list ,@keys) ,list (cons ,a ,list)) 2770 (macroexp-let2 macroexp-copyable-p vlist list
2769 form)) 2771 `(if (cl-member ,va ,vlist ,@keys) ,vlist (cons ,va ,vlist))))))
2770 2772
2771(defun cl--compiler-macro-get (_form sym prop &optional def) 2773(defun cl--compiler-macro-get (_form sym prop &optional def)
2772 (if def 2774 (if def
2773 `(cl-getf (symbol-plist ,sym) ,prop ,def) 2775 `(cl-getf (symbol-plist ,sym) ,prop ,def)
2774 `(get ,sym ,prop))) 2776 `(get ,sym ,prop)))
2775 2777
2776(cl-define-compiler-macro cl-typep (&whole form val type)
2777 (if (macroexp-const-p type)
2778 (macroexp-let2 macroexp-copyable-p temp val
2779 (cl--make-type-test temp (cl--const-expr-val type)))
2780 form))
2781
2782(dolist (y '(cl-first cl-second cl-third cl-fourth 2778(dolist (y '(cl-first cl-second cl-third cl-fourth
2783 cl-fifth cl-sixth cl-seventh 2779 cl-fifth cl-sixth cl-seventh
2784 cl-eighth cl-ninth cl-tenth 2780 cl-eighth cl-ninth cl-tenth
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 867f079ce5f..319af588eac 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -472,6 +472,8 @@ the option `edebug-all-forms'."
472(or (fboundp 'edebug-original-eval-defun) 472(or (fboundp 'edebug-original-eval-defun)
473 (defalias 'edebug-original-eval-defun (symbol-function 'eval-defun))) 473 (defalias 'edebug-original-eval-defun (symbol-function 'eval-defun)))
474 474
475(defvar edebug-result) ; The result of the function call returned by body.
476
475;; We should somehow arrange to be able to do this 477;; We should somehow arrange to be able to do this
476;; without actually replacing the eval-defun command. 478;; without actually replacing the eval-defun command.
477(defun edebug-eval-defun (edebug-it) 479(defun edebug-eval-defun (edebug-it)
@@ -487,7 +489,7 @@ With a prefix argument, instrument the code for Edebug.
487 489
488Setting option `edebug-all-defs' to a non-nil value reverses the meaning 490Setting option `edebug-all-defs' to a non-nil value reverses the meaning
489of the prefix argument. Code is then instrumented when this function is 491of the prefix argument. Code is then instrumented when this function is
490invoked without a prefix argument 492invoked without a prefix argument.
491 493
492If acting on a `defun' for FUNCTION, and the function was instrumented, 494If acting on a `defun' for FUNCTION, and the function was instrumented,
493`Edebug: FUNCTION' is printed in the minibuffer. If not instrumented, 495`Edebug: FUNCTION' is printed in the minibuffer. If not instrumented,
@@ -2106,7 +2108,6 @@ expressions; a `progn' form will be returned enclosing these forms."
2106(defvar edebug-coverage) ; the coverage results of each expression of function. 2108(defvar edebug-coverage) ; the coverage results of each expression of function.
2107 2109
2108(defvar edebug-buffer) ; which buffer the function is in. 2110(defvar edebug-buffer) ; which buffer the function is in.
2109(defvar edebug-result) ; the result of the function call returned by body
2110(defvar edebug-outside-executing-macro) 2111(defvar edebug-outside-executing-macro)
2111(defvar edebug-outside-defining-kbd-macro) 2112(defvar edebug-outside-defining-kbd-macro)
2112 2113
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index c8ae3f4bf1a..21190446624 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -31,6 +31,7 @@
31;;; Code: 31;;; Code:
32 32
33(require 'eieio) 33(require 'eieio)
34(eval-when-compile (require 'cl)) ;FIXME: Use cl-lib!
34 35
35;;; eieio-instance-inheritor 36;;; eieio-instance-inheritor
36;; 37;;
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
new file mode 100644
index 00000000000..da475638bb7
--- /dev/null
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -0,0 +1,2264 @@
1;;; eieio-core.el --- Core implementation for eieio
2
3;; Copyright (C) 1995-1996, 1998-2013 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6;; Version: 1.4
7;; Keywords: OO, lisp
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software: you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24;;; Commentary:
25;;
26;; The "core" part of EIEIO is the implementation for the object
27;; system (such as eieio-defclass, or eieio-defmethod) but not the
28;; base classes for the object system, which are defined in EIEIO.
29;;
30;; See the commentary for eieio.el for more about EIEIO itself.
31
32;;; Code:
33
34(eval-when-compile (require 'cl)) ;FIXME: Use cl-lib!
35
36;; Compatibility
37(if (fboundp 'compiled-function-arglist)
38
39 ;; XEmacs can only access a compiled functions arglist like this:
40 (defalias 'eieio-compiled-function-arglist 'compiled-function-arglist)
41
42 ;; Emacs doesn't have this function, but since FUNC is a vector, we can just
43 ;; grab the appropriate element.
44 (defun eieio-compiled-function-arglist (func)
45 "Return the argument list for the compiled function FUNC."
46 (aref func 0))
47
48 )
49
50(put 'eieio--defalias 'byte-hunk-handler
51 #'byte-compile-file-form-defalias) ;;(get 'defalias 'byte-hunk-handler)
52(defun eieio--defalias (name body)
53 "Like `defalias', but with less side-effects.
54More specifically, it has no side-effects at all when the new function
55definition is the same (`eq') as the old one."
56 (unless (and (fboundp name)
57 (eq (symbol-function name) body))
58 (defalias name body)))
59
60;;;
61;; A few functions that are better in the official EIEIO src, but
62;; used from the core.
63(declare-function slot-unbound "eieio")
64(declare-function slot-missing "eieio")
65(declare-function child-of-class-p "eieio")
66
67
68;;;
69;; Variable declarations.
70;;
71(defvar eieio-hook nil
72 "This hook is executed, then cleared each time `defclass' is called.")
73
74(defvar eieio-error-unsupported-class-tags nil
75 "Non-nil to throw an error if an encountered tag is unsupported.
76This may prevent classes from CLOS applications from being used with EIEIO
77since EIEIO does not support all CLOS tags.")
78
79(defvar eieio-skip-typecheck nil
80 "If non-nil, skip all slot typechecking.
81Set this to t permanently if a program is functioning well to get a
82small speed increase. This variable is also used internally to handle
83default setting for optimization purposes.")
84
85(defvar eieio-optimize-primary-methods-flag t
86 "Non-nil means to optimize the method dispatch on primary methods.")
87
88(defvar eieio-initializing-object nil
89 "Set to non-nil while initializing an object.")
90
91(defconst eieio-unbound
92 (if (and (boundp 'eieio-unbound) (symbolp eieio-unbound))
93 eieio-unbound
94 (make-symbol "unbound"))
95 "Uninterned symbol representing an unbound slot in an object.")
96
97;; This is a bootstrap for eieio-default-superclass so it has a value
98;; while it is being built itself.
99(defvar eieio-default-superclass nil)
100
101;;;
102;; Class currently in scope.
103;;
104;; When invoking methods, the running method needs to know which class
105;; is currently in scope. Generally this is the class of the method
106;; being called, but 'call-next-method' needs to query this state,
107;; and change it to be then next super class up.
108;;
109;; Thus, the scoped class is a stack that needs to be managed.
110
111(defvar eieio--scoped-class-stack nil
112 "A stack of the classes currently in scope during method invocation.")
113
114(defun eieio--scoped-class ()
115 "Return the class currently in scope, or nil."
116 (car-safe eieio--scoped-class-stack))
117
118(defmacro eieio--with-scoped-class (class &rest forms)
119 "Set CLASS as the currently scoped class while executing FORMS."
120 `(unwind-protect
121 (progn
122 (push ,class eieio--scoped-class-stack)
123 ,@forms)
124 (pop eieio--scoped-class-stack)))
125(put 'eieio--with-scoped-class 'lisp-indent-function 1)
126
127;;;
128;; Field Accessors
129;;
130(defmacro eieio--define-field-accessors (prefix fields)
131 (declare (indent 1))
132 (let ((index 0)
133 (defs '()))
134 (dolist (field fields)
135 (let ((doc (if (listp field)
136 (prog1 (cadr field) (setq field (car field))))))
137 (push `(defmacro ,(intern (format "eieio--%s-%s" prefix field)) (x)
138 ,@(if doc (list (format (if (string-match "\n" doc)
139 "Return %s" "Return %s of a %s.")
140 doc prefix)))
141 (list 'aref x ,index))
142 defs)
143 (setq index (1+ index))))
144 `(eval-and-compile
145 ,@(nreverse defs)
146 (defconst ,(intern (format "eieio--%s-num-slots" prefix)) ,index))))
147
148(eieio--define-field-accessors class
149 (-unused-0 ;;FIXME: not sure, but at least there was no accessor!
150 (symbol "symbol (self-referencing)")
151 parent children
152 (symbol-obarray "obarray permitting fast access to variable position indexes")
153 ;; @todo
154 ;; the word "public" here is leftovers from the very first version.
155 ;; Get rid of it!
156 (public-a "class attribute index")
157 (public-d "class attribute defaults index")
158 (public-doc "class documentation strings for attributes")
159 (public-type "class type for a slot")
160 (public-custom "class custom type for a slot")
161 (public-custom-label "class custom group for a slot")
162 (public-custom-group "class custom group for a slot")
163 (public-printer "printer for a slot")
164 (protection "protection for a slot")
165 (initarg-tuples "initarg tuples list")
166 (class-allocation-a "class allocated attributes")
167 (class-allocation-doc "class allocated documentation")
168 (class-allocation-type "class allocated value type")
169 (class-allocation-custom "class allocated custom descriptor")
170 (class-allocation-custom-label "class allocated custom descriptor")
171 (class-allocation-custom-group "class allocated custom group")
172 (class-allocation-printer "class allocated printer for a slot")
173 (class-allocation-protection "class allocated protection list")
174 (class-allocation-values "class allocated value vector")
175 (default-object-cache "what a newly created object would look like.
176This will speed up instantiation time as only a `copy-sequence' will
177be needed, instead of looping over all the values and setting them
178from the default.")
179 (options "storage location of tagged class options.
180Stored outright without modifications or stripping.")))
181
182(eieio--define-field-accessors object
183 (-unused-0 ;;FIXME: not sure, but at least there was no accessor!
184 (class "class struct defining OBJ")
185 name))
186
187;; FIXME: The constants below should have an `eieio-' prefix added!!
188
189(defconst method-static 0 "Index into :static tag on a method.")
190(defconst method-before 1 "Index into :before tag on a method.")
191(defconst method-primary 2 "Index into :primary tag on a method.")
192(defconst method-after 3 "Index into :after tag on a method.")
193(defconst method-num-lists 4 "Number of indexes into methods vector in which groups of functions are kept.")
194(defconst method-generic-before 4 "Index into generic :before tag on a method.")
195(defconst method-generic-primary 5 "Index into generic :primary tag on a method.")
196(defconst method-generic-after 6 "Index into generic :after tag on a method.")
197(defconst method-num-slots 7 "Number of indexes into a method's vector.")
198
199(defsubst eieio-specialized-key-to-generic-key (key)
200 "Convert a specialized KEY into a generic method key."
201 (cond ((eq key method-static) 0) ;; don't convert
202 ((< key method-num-lists) (+ key 3)) ;; The conversion
203 (t key) ;; already generic.. maybe.
204 ))
205
206
207;;; Important macros used internally in eieio.
208;;
209(defmacro eieio--check-type (type obj)
210 (unless (symbolp obj)
211 (error "eieio--check-type wants OBJ to be a variable"))
212 `(if (not ,(cond
213 ((eq 'or (car-safe type))
214 `(or ,@(mapcar (lambda (type) `(,type ,obj)) (cdr type))))
215 (t `(,type ,obj))))
216 (signal 'wrong-type-argument (list ',type ,obj))))
217
218(defmacro class-v (class)
219 "Internal: Return the class vector from the CLASS symbol."
220 ;; No check: If eieio gets this far, it has probably been checked already.
221 `(get ,class 'eieio-class-definition))
222
223(defmacro class-p (class)
224 "Return t if CLASS is a valid class vector.
225CLASS is a symbol."
226 ;; this new method is faster since it doesn't waste time checking lots of
227 ;; things.
228 `(condition-case nil
229 (eq (aref (class-v ,class) 0) 'defclass)
230 (error nil)))
231
232(defun eieio-class-name (class) "Return a Lisp like symbol name for CLASS."
233 (eieio--check-type class-p class)
234 ;; I think this is supposed to return a symbol, but to me CLASS is a symbol,
235 ;; and I wanted a string. Arg!
236 (format "#<class %s>" (symbol-name class)))
237(define-obsolete-function-alias 'class-name #'eieio-class-name "24.4")
238
239(defmacro eieio-class-parents-fast (class)
240 "Return parent classes to CLASS with no check."
241 `(eieio--class-parent (class-v ,class)))
242
243(defmacro eieio-class-children-fast (class) "Return child classes to CLASS with no check."
244 `(eieio--class-children (class-v ,class)))
245
246(defmacro same-class-fast-p (obj class)
247 "Return t if OBJ is of class-type CLASS with no error checking."
248 `(eq (eieio--object-class ,obj) ,class))
249
250(defmacro class-constructor (class)
251 "Return the symbol representing the constructor of CLASS."
252 `(eieio--class-symbol (class-v ,class)))
253
254(defmacro generic-p (method)
255 "Return t if symbol METHOD is a generic function.
256Only methods have the symbol `eieio-method-obarray' as a property
257\(which contains a list of all bindings to that method type.)"
258 `(and (fboundp ,method) (get ,method 'eieio-method-obarray)))
259
260(defun generic-primary-only-p (method)
261 "Return t if symbol METHOD is a generic function with only primary methods.
262Only methods have the symbol `eieio-method-obarray' as a property (which
263contains a list of all bindings to that method type.)
264Methods with only primary implementations are executed in an optimized way."
265 (and (generic-p method)
266 (let ((M (get method 'eieio-method-tree)))
267 (and (< 0 (length (aref M method-primary)))
268 (not (aref M method-static))
269 (not (aref M method-before))
270 (not (aref M method-after))
271 (not (aref M method-generic-before))
272 (not (aref M method-generic-primary))
273 (not (aref M method-generic-after))))
274 ))
275
276(defun generic-primary-only-one-p (method)
277 "Return t if symbol METHOD is a generic function with only primary methods.
278Only methods have the symbol `eieio-method-obarray' as a property (which
279contains a list of all bindings to that method type.)
280Methods with only primary implementations are executed in an optimized way."
281 (and (generic-p method)
282 (let ((M (get method 'eieio-method-tree)))
283 (and (= 1 (length (aref M method-primary)))
284 (not (aref M method-static))
285 (not (aref M method-before))
286 (not (aref M method-after))
287 (not (aref M method-generic-before))
288 (not (aref M method-generic-primary))
289 (not (aref M method-generic-after))))
290 ))
291
292(defmacro class-option-assoc (list option)
293 "Return from LIST the found OPTION, or nil if it doesn't exist."
294 `(car-safe (cdr (memq ,option ,list))))
295
296(defmacro class-option (class option)
297 "Return the value stored for CLASS' OPTION.
298Return nil if that option doesn't exist."
299 `(class-option-assoc (eieio--class-options (class-v ,class)) ',option))
300
301(defmacro eieio-object-p (obj)
302 "Return non-nil if OBJ is an EIEIO object."
303 `(condition-case nil
304 (let ((tobj ,obj))
305 (and (eq (aref tobj 0) 'object)
306 (class-p (eieio--object-class tobj))))
307 (error nil)))
308(defalias 'object-p 'eieio-object-p)
309
310(defmacro class-abstract-p (class)
311 "Return non-nil if CLASS is abstract.
312Abstract classes cannot be instantiated."
313 `(class-option ,class :abstract))
314
315(defmacro class-method-invocation-order (class)
316 "Return the invocation order of CLASS.
317Abstract classes cannot be instantiated."
318 `(or (class-option ,class :method-invocation-order)
319 :breadth-first))
320
321
322
323;;;
324;; Class Creation
325
326(defvar eieio-defclass-autoload-map (make-vector 7 nil)
327 "Symbol map of superclasses we find in autoloads.")
328
329;; We autoload this because it's used in `make-autoload'.
330;;;###autoload
331(defun eieio-defclass-autoload (cname superclasses filename doc)
332 "Create autoload symbols for the EIEIO class CNAME.
333SUPERCLASSES are the superclasses that CNAME inherits from.
334DOC is the docstring for CNAME.
335This function creates a mock-class for CNAME and adds it into
336SUPERCLASSES as children.
337It creates an autoload function for CNAME's constructor."
338 ;; Assume we've already debugged inputs.
339
340 (let* ((oldc (when (class-p cname) (class-v cname)))
341 (newc (make-vector eieio--class-num-slots nil))
342 )
343 (if oldc
344 nil ;; Do nothing if we already have this class.
345
346 ;; Create the class in NEWC, but don't fill anything else in.
347 (aset newc 0 'defclass)
348 (setf (eieio--class-symbol newc) cname)
349
350 (let ((clear-parent nil))
351 ;; No parents?
352 (when (not superclasses)
353 (setq superclasses '(eieio-default-superclass)
354 clear-parent t)
355 )
356
357 ;; Hook our new class into the existing structures so we can
358 ;; autoload it later.
359 (dolist (SC superclasses)
360
361
362 ;; TODO - If we create an autoload that is in the map, that
363 ;; map needs to be cleared!
364
365
366 ;; Does our parent exist?
367 (if (not (class-p SC))
368
369 ;; Create a symbol for this parent, and then store this
370 ;; parent on that symbol.
371 (let ((sym (intern (symbol-name SC) eieio-defclass-autoload-map)))
372 (if (not (boundp sym))
373 (set sym (list cname))
374 (add-to-list sym cname))
375 )
376
377 ;; We have a parent, save the child in there.
378 (when (not (member cname (eieio--class-children (class-v SC))))
379 (setf (eieio--class-children (class-v SC))
380 (cons cname (eieio--class-children (class-v SC))))))
381
382 ;; save parent in child
383 (setf (eieio--class-parent newc) (cons SC (eieio--class-parent newc)))
384 )
385
386 ;; turn this into a usable self-pointing symbol
387 (set cname cname)
388
389 ;; Store the new class vector definition into the symbol. We need to
390 ;; do this first so that we can call defmethod for the accessor.
391 ;; The vector will be updated by the following while loop and will not
392 ;; need to be stored a second time.
393 (put cname 'eieio-class-definition newc)
394
395 ;; Clear the parent
396 (if clear-parent (setf (eieio--class-parent newc) nil))
397
398 ;; Create an autoload on top of our constructor function.
399 (autoload cname filename doc nil nil)
400 (autoload (intern (concat (symbol-name cname) "-p")) filename "" nil nil)
401 (autoload (intern (concat (symbol-name cname) "-child-p")) filename "" nil nil)
402 (autoload (intern (concat (symbol-name cname) "-list-p")) filename "" nil nil)
403
404 ))))
405
406(defsubst eieio-class-un-autoload (cname)
407 "If class CNAME is in an autoload state, load its file."
408 (when (eq (car-safe (symbol-function cname)) 'autoload)
409 (load-library (car (cdr (symbol-function cname))))))
410
411(defun eieio-defclass (cname superclasses slots options-and-doc)
412 ;; FIXME: Most of this should be moved to the `defclass' macro.
413 "Define CNAME as a new subclass of SUPERCLASSES.
414SLOTS are the slots residing in that class definition, and options or
415documentation OPTIONS-AND-DOC is the toplevel documentation for this class.
416See `defclass' for more information."
417 ;; Run our eieio-hook each time, and clear it when we are done.
418 ;; This way people can add hooks safely if they want to modify eieio
419 ;; or add definitions when eieio is loaded or something like that.
420 (run-hooks 'eieio-hook)
421 (setq eieio-hook nil)
422
423 (eieio--check-type listp superclasses)
424
425 (let* ((pname superclasses)
426 (newc (make-vector eieio--class-num-slots nil))
427 (oldc (when (class-p cname) (class-v cname)))
428 (groups nil) ;; list of groups id'd from slots
429 (options nil)
430 (clearparent nil))
431
432 (aset newc 0 'defclass)
433 (setf (eieio--class-symbol newc) cname)
434
435 ;; If this class already existed, and we are updating its structure,
436 ;; make sure we keep the old child list. This can cause bugs, but
437 ;; if no new slots are created, it also saves time, and prevents
438 ;; method table breakage, particularly when the users is only
439 ;; byte compiling an EIEIO file.
440 (if oldc
441 (setf (eieio--class-children newc) (eieio--class-children oldc))
442 ;; If the old class did not exist, but did exist in the autoload map, then adopt those children.
443 ;; This is like the above, but deals with autoloads nicely.
444 (let ((sym (intern-soft (symbol-name cname) eieio-defclass-autoload-map)))
445 (when sym
446 (condition-case nil
447 (setf (eieio--class-children newc) (symbol-value sym))
448 (error nil))
449 (unintern (symbol-name cname) eieio-defclass-autoload-map)
450 ))
451 )
452
453 (cond ((and (stringp (car options-and-doc))
454 (/= 1 (% (length options-and-doc) 2)))
455 (error "Too many arguments to `defclass'"))
456 ((and (symbolp (car options-and-doc))
457 (/= 0 (% (length options-and-doc) 2)))
458 (error "Too many arguments to `defclass'"))
459 )
460
461 (setq options
462 (if (stringp (car options-and-doc))
463 (cons :documentation options-and-doc)
464 options-and-doc))
465
466 (if pname
467 (progn
468 (while pname
469 (if (and (car pname) (symbolp (car pname)))
470 (if (not (class-p (car pname)))
471 ;; bad class
472 (error "Given parent class %s is not a class" (car pname))
473 ;; good parent class...
474 ;; save new child in parent
475 (when (not (member cname (eieio--class-children (class-v (car pname)))))
476 (setf (eieio--class-children (class-v (car pname)))
477 (cons cname (eieio--class-children (class-v (car pname))))))
478 ;; Get custom groups, and store them into our local copy.
479 (mapc (lambda (g) (pushnew g groups :test #'equal))
480 (class-option (car pname) :custom-groups))
481 ;; save parent in child
482 (setf (eieio--class-parent newc) (cons (car pname) (eieio--class-parent newc))))
483 (error "Invalid parent class %s" pname))
484 (setq pname (cdr pname)))
485 ;; Reverse the list of our parents so that they are prioritized in
486 ;; the same order as specified in the code.
487 (setf (eieio--class-parent newc) (nreverse (eieio--class-parent newc))) )
488 ;; If there is nothing to loop over, then inherit from the
489 ;; default superclass.
490 (unless (eq cname 'eieio-default-superclass)
491 ;; adopt the default parent here, but clear it later...
492 (setq clearparent t)
493 ;; save new child in parent
494 (if (not (member cname (eieio--class-children (class-v 'eieio-default-superclass))))
495 (setf (eieio--class-children (class-v 'eieio-default-superclass))
496 (cons cname (eieio--class-children (class-v 'eieio-default-superclass)))))
497 ;; save parent in child
498 (setf (eieio--class-parent newc) (list eieio-default-superclass))))
499
500 ;; turn this into a usable self-pointing symbol
501 (set cname cname)
502
503 ;; These two tests must be created right away so we can have self-
504 ;; referencing classes. ei, a class whose slot can contain only
505 ;; pointers to itself.
506
507 ;; Create the test function
508 (let ((csym (intern (concat (symbol-name cname) "-p"))))
509 (fset csym
510 (list 'lambda (list 'obj)
511 (format "Test OBJ to see if it an object of type %s" cname)
512 (list 'and '(eieio-object-p obj)
513 (list 'same-class-p 'obj cname)))))
514
515 ;; Make sure the method invocation order is a valid value.
516 (let ((io (class-option-assoc options :method-invocation-order)))
517 (when (and io (not (member io '(:depth-first :breadth-first :c3))))
518 (error "Method invocation order %s is not allowed" io)
519 ))
520
521 ;; Create a handy child test too
522 (let ((csym (intern (concat (symbol-name cname) "-child-p"))))
523 (fset csym
524 `(lambda (obj)
525 ,(format
526 "Test OBJ to see if it an object is a child of type %s"
527 cname)
528 (and (eieio-object-p obj)
529 (object-of-class-p obj ,cname))))
530
531 ;; Create a handy list of the class test too
532 (let ((csym (intern (concat (symbol-name cname) "-list-p"))))
533 (fset csym
534 `(lambda (obj)
535 ,(format
536 "Test OBJ to see if it a list of objects which are a child of type %s"
537 cname)
538 (when (listp obj)
539 (let ((ans t)) ;; nil is valid
540 ;; Loop over all the elements of the input list, test
541 ;; each to make sure it is a child of the desired object class.
542 (while (and obj ans)
543 (setq ans (and (eieio-object-p (car obj))
544 (object-of-class-p (car obj) ,cname)))
545 (setq obj (cdr obj)))
546 ans)))))
547
548 ;; When using typep, (typep OBJ 'myclass) returns t for objects which
549 ;; are subclasses of myclass. For our predicates, however, it is
550 ;; important for EIEIO to be backwards compatible, where
551 ;; myobject-p, and myobject-child-p are different.
552 ;; "cl" uses this technique to specify symbols with specific typep
553 ;; test, so we can let typep have the CLOS documented behavior
554 ;; while keeping our above predicate clean.
555
556 ;; It would be cleaner to use `defsetf' here, but that requires cl
557 ;; at runtime.
558 (put cname 'cl-deftype-handler
559 (list 'lambda () `(list 'satisfies (quote ,csym)))))
560
561 ;; Before adding new slots, let's add all the methods and classes
562 ;; in from the parent class.
563 (eieio-copy-parents-into-subclass newc superclasses)
564
565 ;; Store the new class vector definition into the symbol. We need to
566 ;; do this first so that we can call defmethod for the accessor.
567 ;; The vector will be updated by the following while loop and will not
568 ;; need to be stored a second time.
569 (put cname 'eieio-class-definition newc)
570
571 ;; Query each slot in the declaration list and mangle into the
572 ;; class structure I have defined.
573 (while slots
574 (let* ((slot1 (car slots))
575 (name (car slot1))
576 (slot (cdr slot1))
577 (acces (plist-get slot ':accessor))
578 (init (or (plist-get slot ':initform)
579 (if (member ':initform slot) nil
580 eieio-unbound)))
581 (initarg (plist-get slot ':initarg))
582 (docstr (plist-get slot ':documentation))
583 (prot (plist-get slot ':protection))
584 (reader (plist-get slot ':reader))
585 (writer (plist-get slot ':writer))
586 (alloc (plist-get slot ':allocation))
587 (type (plist-get slot ':type))
588 (custom (plist-get slot ':custom))
589 (label (plist-get slot ':label))
590 (customg (plist-get slot ':group))
591 (printer (plist-get slot ':printer))
592
593 (skip-nil (class-option-assoc options :allow-nil-initform))
594 )
595
596 (if eieio-error-unsupported-class-tags
597 (let ((tmp slot))
598 (while tmp
599 (if (not (member (car tmp) '(:accessor
600 :initform
601 :initarg
602 :documentation
603 :protection
604 :reader
605 :writer
606 :allocation
607 :type
608 :custom
609 :label
610 :group
611 :printer
612 :allow-nil-initform
613 :custom-groups)))
614 (signal 'invalid-slot-type (list (car tmp))))
615 (setq tmp (cdr (cdr tmp))))))
616
617 ;; Clean up the meaning of protection.
618 (cond ((or (eq prot 'public) (eq prot :public)) (setq prot nil))
619 ((or (eq prot 'protected) (eq prot :protected)) (setq prot 'protected))
620 ((or (eq prot 'private) (eq prot :private)) (setq prot 'private))
621 ((eq prot nil) nil)
622 (t (signal 'invalid-slot-type (list ':protection prot))))
623
624 ;; Make sure the :allocation parameter has a valid value.
625 (if (not (or (not alloc) (eq alloc :class) (eq alloc :instance)))
626 (signal 'invalid-slot-type (list ':allocation alloc)))
627
628 ;; The default type specifier is supposed to be t, meaning anything.
629 (if (not type) (setq type t))
630
631 ;; Label is nil, or a string
632 (if (not (or (null label) (stringp label)))
633 (signal 'invalid-slot-type (list ':label label)))
634
635 ;; Is there an initarg, but allocation of class?
636 (if (and initarg (eq alloc :class))
637 (message "Class allocated slots do not need :initarg"))
638
639 ;; intern the symbol so we can use it blankly
640 (if initarg (set initarg initarg))
641
642 ;; The customgroup should be a list of symbols
643 (cond ((null customg)
644 (setq customg '(default)))
645 ((not (listp customg))
646 (setq customg (list customg))))
647 ;; The customgroup better be a symbol, or list of symbols.
648 (mapc (lambda (cg)
649 (if (not (symbolp cg))
650 (signal 'invalid-slot-type (list ':group cg))))
651 customg)
652
653 ;; First up, add this slot into our new class.
654 (eieio-add-new-slot newc name init docstr type custom label customg printer
655 prot initarg alloc 'defaultoverride skip-nil)
656
657 ;; We need to id the group, and store them in a group list attribute.
658 (mapc (lambda (cg) (pushnew cg groups :test 'equal)) customg)
659
660 ;; Anyone can have an accessor function. This creates a function
661 ;; of the specified name, and also performs a `defsetf' if applicable
662 ;; so that users can `setf' the space returned by this function.
663 (if acces
664 (progn
665 (eieio--defmethod
666 acces (if (eq alloc :class) :static :primary) cname
667 `(lambda (this)
668 ,(format
669 "Retrieves the slot `%s' from an object of class `%s'"
670 name cname)
671 (if (slot-boundp this ',name)
672 (eieio-oref this ',name)
673 ;; Else - Some error? nil?
674 nil)))
675
676 (if (fboundp 'gv-define-setter)
677 ;; FIXME: We should move more of eieio-defclass into the
678 ;; defclass macro so we don't have to use `eval' and require
679 ;; `gv' at run-time.
680 (eval `(gv-define-setter ,acces (eieio--store eieio--object)
681 (list 'eieio-oset eieio--object '',name
682 eieio--store)))
683 ;; Provide a setf method. It would be cleaner to use
684 ;; defsetf, but that would require CL at runtime.
685 (put acces 'setf-method
686 `(lambda (widget)
687 (let* ((--widget-sym-- (make-symbol "--widget--"))
688 (--store-sym-- (make-symbol "--store--")))
689 (list
690 (list --widget-sym--)
691 (list widget)
692 (list --store-sym--)
693 (list 'eieio-oset --widget-sym-- '',name
694 --store-sym--)
695 (list 'getfoo --widget-sym--))))))))
696
697 ;; If a writer is defined, then create a generic method of that
698 ;; name whose purpose is to set the value of the slot.
699 (if writer
700 (eieio--defmethod
701 writer nil cname
702 `(lambda (this value)
703 ,(format "Set the slot `%s' of an object of class `%s'"
704 name cname)
705 (setf (slot-value this ',name) value))))
706 ;; If a reader is defined, then create a generic method
707 ;; of that name whose purpose is to access this slot value.
708 (if reader
709 (eieio--defmethod
710 reader nil cname
711 `(lambda (this)
712 ,(format "Access the slot `%s' from object of class `%s'"
713 name cname)
714 (slot-value this ',name))))
715 )
716 (setq slots (cdr slots)))
717
718 ;; Now that everything has been loaded up, all our lists are backwards!
719 ;; Fix that up now.
720 (setf (eieio--class-public-a newc) (nreverse (eieio--class-public-a newc)))
721 (setf (eieio--class-public-d newc) (nreverse (eieio--class-public-d newc)))
722 (setf (eieio--class-public-doc newc) (nreverse (eieio--class-public-doc newc)))
723 (setf (eieio--class-public-type newc)
724 (apply 'vector (nreverse (eieio--class-public-type newc))))
725 (setf (eieio--class-public-custom newc) (nreverse (eieio--class-public-custom newc)))
726 (setf (eieio--class-public-custom-label newc) (nreverse (eieio--class-public-custom-label newc)))
727 (setf (eieio--class-public-custom-group newc) (nreverse (eieio--class-public-custom-group newc)))
728 (setf (eieio--class-public-printer newc) (nreverse (eieio--class-public-printer newc)))
729 (setf (eieio--class-protection newc) (nreverse (eieio--class-protection newc)))
730 (setf (eieio--class-initarg-tuples newc) (nreverse (eieio--class-initarg-tuples newc)))
731
732 ;; The storage for class-class-allocation-type needs to be turned into
733 ;; a vector now.
734 (setf (eieio--class-class-allocation-type newc)
735 (apply 'vector (eieio--class-class-allocation-type newc)))
736
737 ;; Also, take class allocated values, and vectorize them for speed.
738 (setf (eieio--class-class-allocation-values newc)
739 (apply 'vector (eieio--class-class-allocation-values newc)))
740
741 ;; Attach slot symbols into an obarray, and store the index of
742 ;; this slot as the variable slot in this new symbol. We need to
743 ;; know about primes, because obarrays are best set in vectors of
744 ;; prime number length, and we also need to make our vector small
745 ;; to save space, and also optimal for the number of items we have.
746 (let* ((cnt 0)
747 (pubsyms (eieio--class-public-a newc))
748 (prots (eieio--class-protection newc))
749 (l (length pubsyms))
750 (vl (let ((primes '( 3 5 7 11 13 17 19 23 29 31 37 41 43 47
751 53 59 61 67 71 73 79 83 89 97 101 )))
752 (while (and primes (< (car primes) l))
753 (setq primes (cdr primes)))
754 (car primes)))
755 (oa (make-vector vl 0))
756 (newsym))
757 (while pubsyms
758 (setq newsym (intern (symbol-name (car pubsyms)) oa))
759 (set newsym cnt)
760 (setq cnt (1+ cnt))
761 (if (car prots) (put newsym 'protection (car prots)))
762 (setq pubsyms (cdr pubsyms)
763 prots (cdr prots)))
764 (setf (eieio--class-symbol-obarray newc) oa)
765 )
766
767 ;; Create the constructor function
768 (if (class-option-assoc options :abstract)
769 ;; Abstract classes cannot be instantiated. Say so.
770 (let ((abs (class-option-assoc options :abstract)))
771 (if (not (stringp abs))
772 (setq abs (format "Class %s is abstract" cname)))
773 (fset cname
774 `(lambda (&rest stuff)
775 ,(format "You cannot create a new object of type %s" cname)
776 (error ,abs))))
777
778 ;; Non-abstract classes need a constructor.
779 (fset cname
780 `(lambda (newname &rest slots)
781 ,(format "Create a new object with name NAME of class type %s" cname)
782 (apply 'constructor ,cname newname slots)))
783 )
784
785 ;; Set up a specialized doc string.
786 ;; Use stored value since it is calculated in a non-trivial way
787 (put cname 'variable-documentation
788 (class-option-assoc options :documentation))
789
790 ;; Save the file location where this class is defined.
791 (let ((fname (if load-in-progress
792 load-file-name
793 buffer-file-name)))
794 (when fname
795 (when (string-match "\\.elc\\'" fname)
796 (setq fname (substring fname 0 (1- (length fname)))))
797 (put cname 'class-location fname)))
798
799 ;; We have a list of custom groups. Store them into the options.
800 (let ((g (class-option-assoc options :custom-groups)))
801 (mapc (lambda (cg) (pushnew cg g :test 'equal)) groups)
802 (if (memq :custom-groups options)
803 (setcar (cdr (memq :custom-groups options)) g)
804 (setq options (cons :custom-groups (cons g options)))))
805
806 ;; Set up the options we have collected.
807 (setf (eieio--class-options newc) options)
808
809 ;; if this is a superclass, clear out parent (which was set to the
810 ;; default superclass eieio-default-superclass)
811 (if clearparent (setf (eieio--class-parent newc) nil))
812
813 ;; Create the cached default object.
814 (let ((cache (make-vector (+ (length (eieio--class-public-a newc)) 3)
815 nil)))
816 (aset cache 0 'object)
817 (setf (eieio--object-class cache) cname)
818 (setf (eieio--object-name cache) 'default-cache-object)
819 (let ((eieio-skip-typecheck t))
820 ;; All type-checking has been done to our satisfaction
821 ;; before this call. Don't waste our time in this call..
822 (eieio-set-defaults cache t))
823 (setf (eieio--class-default-object-cache newc) cache))
824
825 ;; Return our new class object
826 ;; newc
827 cname
828 ))
829
830(defsubst eieio-eval-default-p (val)
831 "Whether the default value VAL should be evaluated for use."
832 (and (consp val) (symbolp (car val)) (fboundp (car val))))
833
834(defun eieio-perform-slot-validation-for-default (slot spec value skipnil)
835 "For SLOT, signal if SPEC does not match VALUE.
836If SKIPNIL is non-nil, then if VALUE is nil return t instead."
837 (if (and (not (eieio-eval-default-p value))
838 (not eieio-skip-typecheck)
839 (not (and skipnil (null value)))
840 (not (eieio-perform-slot-validation spec value)))
841 (signal 'invalid-slot-type (list slot spec value))))
842
843(defun eieio-add-new-slot (newc a d doc type cust label custg print prot init alloc
844 &optional defaultoverride skipnil)
845 "Add into NEWC attribute A.
846If A already exists in NEWC, then do nothing. If it doesn't exist,
847then also add in D (default), DOC, TYPE, CUST, LABEL, CUSTG, PRINT, PROT, and INIT arg.
848Argument ALLOC specifies if the slot is allocated per instance, or per class.
849If optional DEFAULTOVERRIDE is non-nil, then if A exists in NEWC,
850we must override its value for a default.
851Optional argument SKIPNIL indicates if type checking should be skipped
852if default value is nil."
853 ;; Make sure we duplicate those items that are sequences.
854 (condition-case nil
855 (if (sequencep d) (setq d (copy-sequence d)))
856 ;; This copy can fail on a cons cell with a non-cons in the cdr. Let's skip it if it doesn't work.
857 (error nil))
858 (if (sequencep type) (setq type (copy-sequence type)))
859 (if (sequencep cust) (setq cust (copy-sequence cust)))
860 (if (sequencep custg) (setq custg (copy-sequence custg)))
861
862 ;; To prevent override information w/out specification of storage,
863 ;; we need to do this little hack.
864 (if (member a (eieio--class-class-allocation-a newc)) (setq alloc ':class))
865
866 (if (or (not alloc) (and (symbolp alloc) (eq alloc ':instance)))
867 ;; In this case, we modify the INSTANCE version of a given slot.
868
869 (progn
870
871 ;; Only add this element if it is so-far unique
872 (if (not (member a (eieio--class-public-a newc)))
873 (progn
874 (eieio-perform-slot-validation-for-default a type d skipnil)
875 (setf (eieio--class-public-a newc) (cons a (eieio--class-public-a newc)))
876 (setf (eieio--class-public-d newc) (cons d (eieio--class-public-d newc)))
877 (setf (eieio--class-public-doc newc) (cons doc (eieio--class-public-doc newc)))
878 (setf (eieio--class-public-type newc) (cons type (eieio--class-public-type newc)))
879 (setf (eieio--class-public-custom newc) (cons cust (eieio--class-public-custom newc)))
880 (setf (eieio--class-public-custom-label newc) (cons label (eieio--class-public-custom-label newc)))
881 (setf (eieio--class-public-custom-group newc) (cons custg (eieio--class-public-custom-group newc)))
882 (setf (eieio--class-public-printer newc) (cons print (eieio--class-public-printer newc)))
883 (setf (eieio--class-protection newc) (cons prot (eieio--class-protection newc)))
884 (setf (eieio--class-initarg-tuples newc) (cons (cons init a) (eieio--class-initarg-tuples newc)))
885 )
886 ;; When defaultoverride is true, we are usually adding new local
887 ;; attributes which must override the default value of any slot
888 ;; passed in by one of the parent classes.
889 (when defaultoverride
890 ;; There is a match, and we must override the old value.
891 (let* ((ca (eieio--class-public-a newc))
892 (np (member a ca))
893 (num (- (length ca) (length np)))
894 (dp (if np (nthcdr num (eieio--class-public-d newc))
895 nil))
896 (tp (if np (nth num (eieio--class-public-type newc))))
897 )
898 (if (not np)
899 (error "EIEIO internal error overriding default value for %s"
900 a)
901 ;; If type is passed in, is it the same?
902 (if (not (eq type t))
903 (if (not (equal type tp))
904 (error
905 "Child slot type `%s' does not match inherited type `%s' for `%s'"
906 type tp a)))
907 ;; If we have a repeat, only update the initarg...
908 (unless (eq d eieio-unbound)
909 (eieio-perform-slot-validation-for-default a tp d skipnil)
910 (setcar dp d))
911 ;; If we have a new initarg, check for it.
912 (when init
913 (let* ((inits (eieio--class-initarg-tuples newc))
914 (inita (rassq a inits)))
915 ;; Replace the CAR of the associate INITA.
916 ;;(message "Initarg: %S replace %s" inita init)
917 (setcar inita init)
918 ))
919
920 ;; PLN Tue Jun 26 11:57:06 2007 : The protection is
921 ;; checked and SHOULD match the superclass
922 ;; protection. Otherwise an error is thrown. However
923 ;; I wonder if a more flexible schedule might be
924 ;; implemented.
925 ;;
926 ;; EML - We used to have (if prot... here,
927 ;; but a prot of 'nil means public.
928 ;;
929 (let ((super-prot (nth num (eieio--class-protection newc)))
930 )
931 (if (not (eq prot super-prot))
932 (error "Child slot protection `%s' does not match inherited protection `%s' for `%s'"
933 prot super-prot a)))
934 ;; End original PLN
935
936 ;; PLN Tue Jun 26 11:57:06 2007 :
937 ;; Do a non redundant combination of ancient custom
938 ;; groups and new ones.
939 (when custg
940 (let* ((groups
941 (nthcdr num (eieio--class-public-custom-group newc)))
942 (list1 (car groups))
943 (list2 (if (listp custg) custg (list custg))))
944 (if (< (length list1) (length list2))
945 (setq list1 (prog1 list2 (setq list2 list1))))
946 (dolist (elt list2)
947 (unless (memq elt list1)
948 (push elt list1)))
949 (setcar groups list1)))
950 ;; End PLN
951
952 ;; PLN Mon Jun 25 22:44:34 2007 : If a new cust is
953 ;; set, simply replaces the old one.
954 (when cust
955 ;; (message "Custom type redefined to %s" cust)
956 (setcar (nthcdr num (eieio--class-public-custom newc)) cust))
957
958 ;; If a new label is specified, it simply replaces
959 ;; the old one.
960 (when label
961 ;; (message "Custom label redefined to %s" label)
962 (setcar (nthcdr num (eieio--class-public-custom-label newc)) label))
963 ;; End PLN
964
965 ;; PLN Sat Jun 30 17:24:42 2007 : when a new
966 ;; doc is specified, simply replaces the old one.
967 (when doc
968 ;;(message "Documentation redefined to %s" doc)
969 (setcar (nthcdr num (eieio--class-public-doc newc))
970 doc))
971 ;; End PLN
972
973 ;; If a new printer is specified, it simply replaces
974 ;; the old one.
975 (when print
976 ;; (message "printer redefined to %s" print)
977 (setcar (nthcdr num (eieio--class-public-printer newc)) print))
978
979 )))
980 ))
981
982 ;; CLASS ALLOCATED SLOTS
983 (let ((value (eieio-default-eval-maybe d)))
984 (if (not (member a (eieio--class-class-allocation-a newc)))
985 (progn
986 (eieio-perform-slot-validation-for-default a type value skipnil)
987 ;; Here we have found a :class version of a slot. This
988 ;; requires a very different approach.
989 (setf (eieio--class-class-allocation-a newc) (cons a (eieio--class-class-allocation-a newc)))
990 (setf (eieio--class-class-allocation-doc newc) (cons doc (eieio--class-class-allocation-doc newc)))
991 (setf (eieio--class-class-allocation-type newc) (cons type (eieio--class-class-allocation-type newc)))
992 (setf (eieio--class-class-allocation-custom newc) (cons cust (eieio--class-class-allocation-custom newc)))
993 (setf (eieio--class-class-allocation-custom-label newc) (cons label (eieio--class-class-allocation-custom-label newc)))
994 (setf (eieio--class-class-allocation-custom-group newc) (cons custg (eieio--class-class-allocation-custom-group newc)))
995 (setf (eieio--class-class-allocation-protection newc) (cons prot (eieio--class-class-allocation-protection newc)))
996 ;; Default value is stored in the 'values section, since new objects
997 ;; can't initialize from this element.
998 (setf (eieio--class-class-allocation-values newc) (cons value (eieio--class-class-allocation-values newc))))
999 (when defaultoverride
1000 ;; There is a match, and we must override the old value.
1001 (let* ((ca (eieio--class-class-allocation-a newc))
1002 (np (member a ca))
1003 (num (- (length ca) (length np)))
1004 (dp (if np
1005 (nthcdr num
1006 (eieio--class-class-allocation-values newc))
1007 nil))
1008 (tp (if np (nth num (eieio--class-class-allocation-type newc))
1009 nil)))
1010 (if (not np)
1011 (error "EIEIO internal error overriding default value for %s"
1012 a)
1013 ;; If type is passed in, is it the same?
1014 (if (not (eq type t))
1015 (if (not (equal type tp))
1016 (error
1017 "Child slot type `%s' does not match inherited type `%s' for `%s'"
1018 type tp a)))
1019 ;; EML - Note: the only reason to override a class bound slot
1020 ;; is to change the default, so allow unbound in.
1021
1022 ;; If we have a repeat, only update the value...
1023 (eieio-perform-slot-validation-for-default a tp value skipnil)
1024 (setcar dp value))
1025
1026 ;; PLN Tue Jun 26 11:57:06 2007 : The protection is
1027 ;; checked and SHOULD match the superclass
1028 ;; protection. Otherwise an error is thrown. However
1029 ;; I wonder if a more flexible schedule might be
1030 ;; implemented.
1031 (let ((super-prot
1032 (car (nthcdr num (eieio--class-class-allocation-protection newc)))))
1033 (if (not (eq prot super-prot))
1034 (error "Child slot protection `%s' does not match inherited protection `%s' for `%s'"
1035 prot super-prot a)))
1036 ;; Do a non redundant combination of ancient custom groups
1037 ;; and new ones.
1038 (when custg
1039 (let* ((groups
1040 (nthcdr num (eieio--class-class-allocation-custom-group newc)))
1041 (list1 (car groups))
1042 (list2 (if (listp custg) custg (list custg))))
1043 (if (< (length list1) (length list2))
1044 (setq list1 (prog1 list2 (setq list2 list1))))
1045 (dolist (elt list2)
1046 (unless (memq elt list1)
1047 (push elt list1)))
1048 (setcar groups list1)))
1049
1050 ;; PLN Sat Jun 30 17:24:42 2007 : when a new
1051 ;; doc is specified, simply replaces the old one.
1052 (when doc
1053 ;;(message "Documentation redefined to %s" doc)
1054 (setcar (nthcdr num (eieio--class-class-allocation-doc newc))
1055 doc))
1056 ;; End PLN
1057
1058 ;; If a new printer is specified, it simply replaces
1059 ;; the old one.
1060 (when print
1061 ;; (message "printer redefined to %s" print)
1062 (setcar (nthcdr num (eieio--class-class-allocation-printer newc)) print))
1063
1064 ))
1065 ))
1066 ))
1067
1068(defun eieio-copy-parents-into-subclass (newc parents)
1069 "Copy into NEWC the slots of PARENTS.
1070Follow the rules of not overwriting early parents when applying to
1071the new child class."
1072 (let ((ps (eieio--class-parent newc))
1073 (sn (class-option-assoc (eieio--class-options newc)
1074 ':allow-nil-initform)))
1075 (while ps
1076 ;; First, duplicate all the slots of the parent.
1077 (let ((pcv (class-v (car ps))))
1078 (let ((pa (eieio--class-public-a pcv))
1079 (pd (eieio--class-public-d pcv))
1080 (pdoc (eieio--class-public-doc pcv))
1081 (ptype (eieio--class-public-type pcv))
1082 (pcust (eieio--class-public-custom pcv))
1083 (plabel (eieio--class-public-custom-label pcv))
1084 (pcustg (eieio--class-public-custom-group pcv))
1085 (printer (eieio--class-public-printer pcv))
1086 (pprot (eieio--class-protection pcv))
1087 (pinit (eieio--class-initarg-tuples pcv))
1088 (i 0))
1089 (while pa
1090 (eieio-add-new-slot newc
1091 (car pa) (car pd) (car pdoc) (aref ptype i)
1092 (car pcust) (car plabel) (car pcustg)
1093 (car printer)
1094 (car pprot) (car-safe (car pinit)) nil nil sn)
1095 ;; Increment each value.
1096 (setq pa (cdr pa)
1097 pd (cdr pd)
1098 pdoc (cdr pdoc)
1099 i (1+ i)
1100 pcust (cdr pcust)
1101 plabel (cdr plabel)
1102 pcustg (cdr pcustg)
1103 printer (cdr printer)
1104 pprot (cdr pprot)
1105 pinit (cdr pinit))
1106 )) ;; while/let
1107 ;; Now duplicate all the class alloc slots.
1108 (let ((pa (eieio--class-class-allocation-a pcv))
1109 (pdoc (eieio--class-class-allocation-doc pcv))
1110 (ptype (eieio--class-class-allocation-type pcv))
1111 (pcust (eieio--class-class-allocation-custom pcv))
1112 (plabel (eieio--class-class-allocation-custom-label pcv))
1113 (pcustg (eieio--class-class-allocation-custom-group pcv))
1114 (printer (eieio--class-class-allocation-printer pcv))
1115 (pprot (eieio--class-class-allocation-protection pcv))
1116 (pval (eieio--class-class-allocation-values pcv))
1117 (i 0))
1118 (while pa
1119 (eieio-add-new-slot newc
1120 (car pa) (aref pval i) (car pdoc) (aref ptype i)
1121 (car pcust) (car plabel) (car pcustg)
1122 (car printer)
1123 (car pprot) nil ':class sn)
1124 ;; Increment each value.
1125 (setq pa (cdr pa)
1126 pdoc (cdr pdoc)
1127 pcust (cdr pcust)
1128 plabel (cdr plabel)
1129 pcustg (cdr pcustg)
1130 printer (cdr printer)
1131 pprot (cdr pprot)
1132 i (1+ i))
1133 ))) ;; while/let
1134 ;; Loop over each parent class
1135 (setq ps (cdr ps)))
1136 ))
1137
1138
1139;;; CLOS methods and generics
1140;;
1141
1142(defun eieio--defgeneric-init-form (method doc-string)
1143 "Form to use for the initial definition of a generic."
1144 (cond
1145 ((or (not (fboundp method))
1146 (eq 'autoload (car-safe (symbol-function method))))
1147 ;; Make sure the method tables are installed.
1148 (eieiomt-install method)
1149 ;; Construct the actual body of this function.
1150 (eieio-defgeneric-form method doc-string))
1151 ((generic-p method) (symbol-function method)) ;Leave it as-is.
1152 (t (error "You cannot create a generic/method over an existing symbol: %s"
1153 method))))
1154
1155(defun eieio-defgeneric-form (method doc-string)
1156 "The lambda form that would be used as the function defined on METHOD.
1157All methods should call the same EIEIO function for dispatch.
1158DOC-STRING is the documentation attached to METHOD."
1159 `(lambda (&rest local-args)
1160 ,doc-string
1161 (eieio-generic-call (quote ,method) local-args)))
1162
1163(defsubst eieio-defgeneric-reset-generic-form (method)
1164 "Setup METHOD to call the generic form."
1165 (let ((doc-string (documentation method)))
1166 (fset method (eieio-defgeneric-form method doc-string))))
1167
1168(defun eieio-defgeneric-form-primary-only (method doc-string)
1169 "The lambda form that would be used as the function defined on METHOD.
1170All methods should call the same EIEIO function for dispatch.
1171DOC-STRING is the documentation attached to METHOD."
1172 `(lambda (&rest local-args)
1173 ,doc-string
1174 (eieio-generic-call-primary-only (quote ,method) local-args)))
1175
1176(defsubst eieio-defgeneric-reset-generic-form-primary-only (method)
1177 "Setup METHOD to call the generic form."
1178 (let ((doc-string (documentation method)))
1179 (fset method (eieio-defgeneric-form-primary-only method doc-string))))
1180
1181(defun eieio-defgeneric-form-primary-only-one (method doc-string
1182 class
1183 impl
1184 )
1185 "The lambda form that would be used as the function defined on METHOD.
1186All methods should call the same EIEIO function for dispatch.
1187DOC-STRING is the documentation attached to METHOD.
1188CLASS is the class symbol needed for private method access.
1189IMPL is the symbol holding the method implementation."
1190 ;; NOTE: I tried out byte compiling this little fcn. Turns out it
1191 ;; is faster to execute this for not byte-compiled. ie, install this,
1192 ;; then measure calls going through here. I wonder why.
1193 (require 'bytecomp)
1194 (let ((byte-compile-warnings nil))
1195 (byte-compile
1196 `(lambda (&rest local-args)
1197 ,doc-string
1198 ;; This is a cool cheat. Usually we need to look up in the
1199 ;; method table to find out if there is a method or not. We can
1200 ;; instead make that determination at load time when there is
1201 ;; only one method. If the first arg is not a child of the class
1202 ;; of that one implementation, then clearly, there is no method def.
1203 (if (not (eieio-object-p (car local-args)))
1204 ;; Not an object. Just signal.
1205 (signal 'no-method-definition
1206 (list ',method local-args))
1207
1208 ;; We do have an object. Make sure it is the right type.
1209 (if ,(if (eq class eieio-default-superclass)
1210 nil ; default superclass means just an obj. Already asked.
1211 `(not (child-of-class-p (eieio--object-class (car local-args))
1212 ',class)))
1213
1214 ;; If not the right kind of object, call no applicable
1215 (apply 'no-applicable-method (car local-args)
1216 ',method local-args)
1217
1218 ;; It is ok, do the call.
1219 ;; Fill in inter-call variables then evaluate the method.
1220 (let ((eieio-generic-call-next-method-list nil)
1221 (eieio-generic-call-key method-primary)
1222 (eieio-generic-call-methodname ',method)
1223 (eieio-generic-call-arglst local-args)
1224 )
1225 (eieio--with-scoped-class ',class
1226 ,(if (< emacs-major-version 24)
1227 `(apply ,(list 'quote impl) local-args)
1228 `(apply #',impl local-args)))
1229 ;(,impl local-args)
1230 )))))))
1231
1232(defsubst eieio-defgeneric-reset-generic-form-primary-only-one (method)
1233 "Setup METHOD to call the generic form."
1234 (let* ((doc-string (documentation method))
1235 (M (get method 'eieio-method-tree))
1236 (entry (car (aref M method-primary)))
1237 )
1238 (fset method (eieio-defgeneric-form-primary-only-one
1239 method doc-string
1240 (car entry)
1241 (cdr entry)
1242 ))))
1243
1244(defun eieio-unbind-method-implementations (method)
1245 "Make the generic method METHOD have no implementations.
1246It will leave the original generic function in place,
1247but remove reference to all implementations of METHOD."
1248 (put method 'eieio-method-tree nil)
1249 (put method 'eieio-method-obarray nil))
1250
1251(defun eieio--defmethod (method kind argclass code)
1252 "Work part of the `defmethod' macro defining METHOD with ARGS."
1253 (let ((key
1254 ;; Find optional keys.
1255 (cond ((memq kind '(:BEFORE :before)) method-before)
1256 ((memq kind '(:AFTER :after)) method-after)
1257 ((memq kind '(:STATIC :static)) method-static)
1258 ((memq kind '(:PRIMARY :primary nil)) method-primary)
1259 ;; Primary key.
1260 ;; (t method-primary)
1261 (t (error "Unknown method kind %S" kind)))))
1262 ;; Make sure there is a generic (when called from defclass).
1263 (eieio--defalias
1264 method (eieio--defgeneric-init-form
1265 method (or (documentation code)
1266 (format "Generically created method `%s'." method))))
1267 ;; Create symbol for property to bind to. If the first arg is of
1268 ;; the form (varname vartype) and `vartype' is a class, then
1269 ;; that class will be the type symbol. If not, then it will fall
1270 ;; under the type `primary' which is a non-specific calling of the
1271 ;; function.
1272 (if argclass
1273 (if (not (class-p argclass))
1274 (error "Unknown class type %s in method parameters"
1275 argclass))
1276 ;; Generics are higher.
1277 (setq key (eieio-specialized-key-to-generic-key key)))
1278 ;; Put this lambda into the symbol so we can find it.
1279 (eieiomt-add method code key argclass)
1280 )
1281
1282 (when eieio-optimize-primary-methods-flag
1283 ;; Optimizing step:
1284 ;;
1285 ;; If this method, after this setup, only has primary methods, then
1286 ;; we can setup the generic that way.
1287 (if (generic-primary-only-p method)
1288 ;; If there is only one primary method, then we can go one more
1289 ;; optimization step.
1290 (if (generic-primary-only-one-p method)
1291 (eieio-defgeneric-reset-generic-form-primary-only-one method)
1292 (eieio-defgeneric-reset-generic-form-primary-only method))
1293 (eieio-defgeneric-reset-generic-form method)))
1294
1295 method)
1296
1297;;; Slot type validation
1298
1299;; This is a hideous hack for replacing `typep' from cl-macs, to avoid
1300;; requiring the CL library at run-time. It can be eliminated if/when
1301;; `typep' is merged into Emacs core.
1302(defun eieio--typep (val type)
1303 (if (symbolp type)
1304 (cond ((get type 'cl-deftype-handler)
1305 (eieio--typep val (funcall (get type 'cl-deftype-handler))))
1306 ((eq type t) t)
1307 ((eq type 'null) (null val))
1308 ((eq type 'atom) (atom val))
1309 ((eq type 'float) (and (numberp val) (not (integerp val))))
1310 ((eq type 'real) (numberp val))
1311 ((eq type 'fixnum) (integerp val))
1312 ((memq type '(character string-char)) (characterp val))
1313 (t
1314 (let* ((name (symbol-name type))
1315 (namep (intern (concat name "p"))))
1316 (if (fboundp namep)
1317 (funcall `(lambda () (,namep val)))
1318 (funcall `(lambda ()
1319 (,(intern (concat name "-p")) val)))))))
1320 (cond ((get (car type) 'cl-deftype-handler)
1321 (eieio--typep val (apply (get (car type) 'cl-deftype-handler)
1322 (cdr type))))
1323 ((memq (car type) '(integer float real number))
1324 (and (eieio--typep val (car type))
1325 (or (memq (cadr type) '(* nil))
1326 (if (consp (cadr type))
1327 (> val (car (cadr type)))
1328 (>= val (cadr type))))
1329 (or (memq (caddr type) '(* nil))
1330 (if (consp (car (cddr type)))
1331 (< val (caar (cddr type)))
1332 (<= val (car (cddr type)))))))
1333 ((memq (car type) '(and or not))
1334 (eval (cons (car type)
1335 (mapcar (lambda (x)
1336 `(eieio--typep (quote ,val) (quote ,x)))
1337 (cdr type)))))
1338 ((memq (car type) '(member member*))
1339 (memql val (cdr type)))
1340 ((eq (car type) 'satisfies)
1341 (funcall `(lambda () (,(cadr type) val))))
1342 (t (error "Bad type spec: %s" type)))))
1343
1344(defun eieio-perform-slot-validation (spec value)
1345 "Return non-nil if SPEC does not match VALUE."
1346 (or (eq spec t) ; t always passes
1347 (eq value eieio-unbound) ; unbound always passes
1348 (eieio--typep value spec)))
1349
1350(defun eieio-validate-slot-value (class slot-idx value slot)
1351 "Make sure that for CLASS referencing SLOT-IDX, VALUE is valid.
1352Checks the :type specifier.
1353SLOT is the slot that is being checked, and is only used when throwing
1354an error."
1355 (if eieio-skip-typecheck
1356 nil
1357 ;; Trim off object IDX junk added in for the object index.
1358 (setq slot-idx (- slot-idx 3))
1359 (let ((st (aref (eieio--class-public-type (class-v class)) slot-idx)))
1360 (if (not (eieio-perform-slot-validation st value))
1361 (signal 'invalid-slot-type (list class slot st value))))))
1362
1363(defun eieio-validate-class-slot-value (class slot-idx value slot)
1364 "Make sure that for CLASS referencing SLOT-IDX, VALUE is valid.
1365Checks the :type specifier.
1366SLOT is the slot that is being checked, and is only used when throwing
1367an error."
1368 (if eieio-skip-typecheck
1369 nil
1370 (let ((st (aref (eieio--class-class-allocation-type (class-v class))
1371 slot-idx)))
1372 (if (not (eieio-perform-slot-validation st value))
1373 (signal 'invalid-slot-type (list class slot st value))))))
1374
1375(defun eieio-barf-if-slot-unbound (value instance slotname fn)
1376 "Throw a signal if VALUE is a representation of an UNBOUND slot.
1377INSTANCE is the object being referenced. SLOTNAME is the offending
1378slot. If the slot is ok, return VALUE.
1379Argument FN is the function calling this verifier."
1380 (if (and (eq value eieio-unbound) (not eieio-skip-typecheck))
1381 (slot-unbound instance (eieio--object-class instance) slotname fn)
1382 value))
1383
1384
1385;;; Get/Set slots in an object.
1386;;
1387(defun eieio-oref (obj slot)
1388 "Return the value in OBJ at SLOT in the object vector."
1389 (eieio--check-type (or eieio-object-p class-p) obj)
1390 (eieio--check-type symbolp slot)
1391 (if (class-p obj) (eieio-class-un-autoload obj))
1392 (let* ((class (if (class-p obj) obj (eieio--object-class obj)))
1393 (c (eieio-slot-name-index class obj slot)))
1394 (if (not c)
1395 ;; It might be missing because it is a :class allocated slot.
1396 ;; Let's check that info out.
1397 (if (setq c (eieio-class-slot-name-index class slot))
1398 ;; Oref that slot.
1399 (aref (eieio--class-class-allocation-values (class-v class)) c)
1400 ;; The slot-missing method is a cool way of allowing an object author
1401 ;; to intercept missing slot definitions. Since it is also the LAST
1402 ;; thing called in this fn, its return value would be retrieved.
1403 (slot-missing obj slot 'oref)
1404 ;;(signal 'invalid-slot-name (list (eieio-object-name obj) slot))
1405 )
1406 (eieio--check-type eieio-object-p obj)
1407 (eieio-barf-if-slot-unbound (aref obj c) obj slot 'oref))))
1408
1409
1410(defun eieio-oref-default (obj slot)
1411 "Do the work for the macro `oref-default' with similar parameters.
1412Fills in OBJ's SLOT with its default value."
1413 (eieio--check-type (or eieio-object-p class-p) obj)
1414 (eieio--check-type symbolp slot)
1415 (let* ((cl (if (eieio-object-p obj) (eieio--object-class obj) obj))
1416 (c (eieio-slot-name-index cl obj slot)))
1417 (if (not c)
1418 ;; It might be missing because it is a :class allocated slot.
1419 ;; Let's check that info out.
1420 (if (setq c
1421 (eieio-class-slot-name-index cl slot))
1422 ;; Oref that slot.
1423 (aref (eieio--class-class-allocation-values (class-v cl))
1424 c)
1425 (slot-missing obj slot 'oref-default)
1426 ;;(signal 'invalid-slot-name (list (class-name cl) slot))
1427 )
1428 (eieio-barf-if-slot-unbound
1429 (let ((val (nth (- c 3) (eieio--class-public-d (class-v cl)))))
1430 (eieio-default-eval-maybe val))
1431 obj cl 'oref-default))))
1432
1433(defun eieio-default-eval-maybe (val)
1434 "Check VAL, and return what `oref-default' would provide."
1435 (cond
1436 ;; Is it a function call? If so, evaluate it.
1437 ((eieio-eval-default-p val)
1438 (eval val))
1439 ;;;; check for quoted things, and unquote them
1440 ;;((and (consp val) (eq (car val) 'quote))
1441 ;; (car (cdr val)))
1442 ;; return it verbatim
1443 (t val)))
1444
1445(defun eieio-oset (obj slot value)
1446 "Do the work for the macro `oset'.
1447Fills in OBJ's SLOT with VALUE."
1448 (eieio--check-type eieio-object-p obj)
1449 (eieio--check-type symbolp slot)
1450 (let ((c (eieio-slot-name-index (eieio--object-class obj) obj slot)))
1451 (if (not c)
1452 ;; It might be missing because it is a :class allocated slot.
1453 ;; Let's check that info out.
1454 (if (setq c
1455 (eieio-class-slot-name-index (eieio--object-class obj) slot))
1456 ;; Oset that slot.
1457 (progn
1458 (eieio-validate-class-slot-value (eieio--object-class obj) c value slot)
1459 (aset (eieio--class-class-allocation-values (class-v (eieio--object-class obj)))
1460 c value))
1461 ;; See oref for comment on `slot-missing'
1462 (slot-missing obj slot 'oset value)
1463 ;;(signal 'invalid-slot-name (list (eieio-object-name obj) slot))
1464 )
1465 (eieio-validate-slot-value (eieio--object-class obj) c value slot)
1466 (aset obj c value))))
1467
1468(defun eieio-oset-default (class slot value)
1469 "Do the work for the macro `oset-default'.
1470Fills in the default value in CLASS' in SLOT with VALUE."
1471 (eieio--check-type class-p class)
1472 (eieio--check-type symbolp slot)
1473 (eieio--with-scoped-class class
1474 (let* ((c (eieio-slot-name-index class nil slot)))
1475 (if (not c)
1476 ;; It might be missing because it is a :class allocated slot.
1477 ;; Let's check that info out.
1478 (if (setq c (eieio-class-slot-name-index class slot))
1479 (progn
1480 ;; Oref that slot.
1481 (eieio-validate-class-slot-value class c value slot)
1482 (aset (eieio--class-class-allocation-values (class-v class)) c
1483 value))
1484 (signal 'invalid-slot-name (list (eieio-class-name class) slot)))
1485 (eieio-validate-slot-value class c value slot)
1486 ;; Set this into the storage for defaults.
1487 (setcar (nthcdr (- c 3) (eieio--class-public-d (class-v class)))
1488 value)
1489 ;; Take the value, and put it into our cache object.
1490 (eieio-oset (eieio--class-default-object-cache (class-v class))
1491 slot value)
1492 ))))
1493
1494
1495;;; EIEIO internal search functions
1496;;
1497(defun eieio-slot-originating-class-p (start-class slot)
1498 "Return non-nil if START-CLASS is the first class to define SLOT.
1499This is for testing if the class currently in scope is the class that defines SLOT
1500so that we can protect private slots."
1501 (let ((par (eieio-class-parents-fast start-class))
1502 (ret t))
1503 (if (not par)
1504 t
1505 (while (and par ret)
1506 (if (intern-soft (symbol-name slot)
1507 (eieio--class-symbol-obarray (class-v (car par))))
1508 (setq ret nil))
1509 (setq par (cdr par)))
1510 ret)))
1511
1512(defun eieio-slot-name-index (class obj slot)
1513 "In CLASS for OBJ find the index of the named SLOT.
1514The slot is a symbol which is installed in CLASS by the `defclass'
1515call. OBJ can be nil, but if it is an object, and the slot in question
1516is protected, access will be allowed if OBJ is a child of the currently
1517scoped class.
1518If SLOT is the value created with :initarg instead,
1519reverse-lookup that name, and recurse with the associated slot value."
1520 ;; Removed checks to outside this call
1521 (let* ((fsym (intern-soft (symbol-name slot)
1522 (eieio--class-symbol-obarray (class-v class))))
1523 (fsi (if (symbolp fsym) (symbol-value fsym) nil)))
1524 (if (integerp fsi)
1525 (cond
1526 ((not (get fsym 'protection))
1527 (+ 3 fsi))
1528 ((and (eq (get fsym 'protection) 'protected)
1529 (eieio--scoped-class)
1530 (or (child-of-class-p class (eieio--scoped-class))
1531 (and (eieio-object-p obj)
1532 (child-of-class-p class (eieio--object-class obj)))))
1533 (+ 3 fsi))
1534 ((and (eq (get fsym 'protection) 'private)
1535 (or (and (eieio--scoped-class)
1536 (eieio-slot-originating-class-p (eieio--scoped-class) slot))
1537 eieio-initializing-object))
1538 (+ 3 fsi))
1539 (t nil))
1540 (let ((fn (eieio-initarg-to-attribute class slot)))
1541 (if fn (eieio-slot-name-index class obj fn) nil)))))
1542
1543(defun eieio-class-slot-name-index (class slot)
1544 "In CLASS find the index of the named SLOT.
1545The slot is a symbol which is installed in CLASS by the `defclass'
1546call. If SLOT is the value created with :initarg instead,
1547reverse-lookup that name, and recurse with the associated slot value."
1548 ;; This will happen less often, and with fewer slots. Do this the
1549 ;; storage cheap way.
1550 (let* ((a (eieio--class-class-allocation-a (class-v class)))
1551 (l1 (length a))
1552 (af (memq slot a))
1553 (l2 (length af)))
1554 ;; Slot # is length of the total list, minus the remaining list of
1555 ;; the found slot.
1556 (if af (- l1 l2))))
1557
1558;;;
1559;; Way to assign slots based on a list. Used for constructors, or
1560;; even resetting an object at run-time
1561;;
1562(defun eieio-set-defaults (obj &optional set-all)
1563 "Take object OBJ, and reset all slots to their defaults.
1564If SET-ALL is non-nil, then when a default is nil, that value is
1565reset. If SET-ALL is nil, the slots are only reset if the default is
1566not nil."
1567 (eieio--with-scoped-class (eieio--object-class obj)
1568 (let ((eieio-initializing-object t)
1569 (pub (eieio--class-public-a (class-v (eieio--object-class obj)))))
1570 (while pub
1571 (let ((df (eieio-oref-default obj (car pub))))
1572 (if (or df set-all)
1573 (eieio-oset obj (car pub) df)))
1574 (setq pub (cdr pub))))))
1575
1576(defun eieio-initarg-to-attribute (class initarg)
1577 "For CLASS, convert INITARG to the actual attribute name.
1578If there is no translation, pass it in directly (so we can cheat if
1579need be... May remove that later...)"
1580 (let ((tuple (assoc initarg (eieio--class-initarg-tuples (class-v class)))))
1581 (if tuple
1582 (cdr tuple)
1583 nil)))
1584
1585(defun eieio-attribute-to-initarg (class attribute)
1586 "In CLASS, convert the ATTRIBUTE into the corresponding init argument tag.
1587This is usually a symbol that starts with `:'."
1588 (let ((tuple (rassoc attribute (eieio--class-initarg-tuples (class-v class)))))
1589 (if tuple
1590 (car tuple)
1591 nil)))
1592
1593;;;
1594;; Method Invocation order: C3
1595(defun eieio-c3-candidate (class remaining-inputs)
1596 "Return CLASS if it can go in the result now, otherwise nil"
1597 ;; Ensure CLASS is not in any position but the first in any of the
1598 ;; element lists of REMAINING-INPUTS.
1599 (and (not (let ((found nil))
1600 (while (and remaining-inputs (not found))
1601 (setq found (member class (cdr (car remaining-inputs)))
1602 remaining-inputs (cdr remaining-inputs)))
1603 found))
1604 class))
1605
1606(defun eieio-c3-merge-lists (reversed-partial-result remaining-inputs)
1607 "Merge REVERSED-PARTIAL-RESULT REMAINING-INPUTS in a consistent order, if possible.
1608If a consistent order does not exist, signal an error."
1609 (if (let ((tail remaining-inputs)
1610 (found nil))
1611 (while (and tail (not found))
1612 (setq found (car tail) tail (cdr tail)))
1613 (not found))
1614 ;; If all remaining inputs are empty lists, we are done.
1615 (nreverse reversed-partial-result)
1616 ;; Otherwise, we try to find the next element of the result. This
1617 ;; is achieved by considering the first element of each
1618 ;; (non-empty) input list and accepting a candidate if it is
1619 ;; consistent with the rests of the input lists.
1620 (let* ((found nil)
1621 (tail remaining-inputs)
1622 (next (progn
1623 (while (and tail (not found))
1624 (setq found (and (car tail)
1625 (eieio-c3-candidate (caar tail)
1626 remaining-inputs))
1627 tail (cdr tail)))
1628 found)))
1629 (if next
1630 ;; The graph is consistent so far, add NEXT to result and
1631 ;; merge input lists, dropping NEXT from their heads where
1632 ;; applicable.
1633 (eieio-c3-merge-lists
1634 (cons next reversed-partial-result)
1635 (mapcar (lambda (l) (if (eq (first l) next) (rest l) l))
1636 remaining-inputs))
1637 ;; The graph is inconsistent, give up
1638 (signal 'inconsistent-class-hierarchy (list remaining-inputs))))))
1639
1640(defun eieio-class-precedence-c3 (class)
1641 "Return all parents of CLASS in c3 order."
1642 (let ((parents (eieio-class-parents-fast class)))
1643 (eieio-c3-merge-lists
1644 (list class)
1645 (append
1646 (or
1647 (mapcar
1648 (lambda (x)
1649 (eieio-class-precedence-c3 x))
1650 parents)
1651 '((eieio-default-superclass)))
1652 (list parents))))
1653 )
1654;;;
1655;; Method Invocation Order: Depth First
1656
1657(defun eieio-class-precedence-dfs (class)
1658 "Return all parents of CLASS in depth-first order."
1659 (let* ((parents (eieio-class-parents-fast class))
1660 (classes (copy-sequence
1661 (apply #'append
1662 (list class)
1663 (or
1664 (mapcar
1665 (lambda (parent)
1666 (cons parent
1667 (eieio-class-precedence-dfs parent)))
1668 parents)
1669 '((eieio-default-superclass))))))
1670 (tail classes))
1671 ;; Remove duplicates.
1672 (while tail
1673 (setcdr tail (delq (car tail) (cdr tail)))
1674 (setq tail (cdr tail)))
1675 classes))
1676
1677;;;
1678;; Method Invocation Order: Breadth First
1679(defun eieio-class-precedence-bfs (class)
1680 "Return all parents of CLASS in breadth-first order."
1681 (let ((result)
1682 (queue (or (eieio-class-parents-fast class)
1683 '(eieio-default-superclass))))
1684 (while queue
1685 (let ((head (pop queue)))
1686 (unless (member head result)
1687 (push head result)
1688 (unless (eq head 'eieio-default-superclass)
1689 (setq queue (append queue (or (eieio-class-parents-fast head)
1690 '(eieio-default-superclass))))))))
1691 (cons class (nreverse result)))
1692 )
1693
1694;;;
1695;; Method Invocation Order
1696
1697(defun eieio-class-precedence-list (class)
1698 "Return (transitively closed) list of parents of CLASS.
1699The order, in which the parents are returned depends on the
1700method invocation orders of the involved classes."
1701 (if (or (null class) (eq class 'eieio-default-superclass))
1702 nil
1703 (case (class-method-invocation-order class)
1704 (:depth-first
1705 (eieio-class-precedence-dfs class))
1706 (:breadth-first
1707 (eieio-class-precedence-bfs class))
1708 (:c3
1709 (eieio-class-precedence-c3 class))))
1710 )
1711(define-obsolete-function-alias
1712 'class-precedence-list 'eieio-class-precedence-list "24.4")
1713
1714
1715;;; CLOS generics internal function handling
1716;;
1717(defvar eieio-generic-call-methodname nil
1718 "When using `call-next-method', provides a context on how to do it.")
1719(defvar eieio-generic-call-arglst nil
1720 "When using `call-next-method', provides a context for parameters.")
1721(defvar eieio-generic-call-key nil
1722 "When using `call-next-method', provides a context for the current key.
1723Keys are a number representing :before, :primary, and :after methods.")
1724(defvar eieio-generic-call-next-method-list nil
1725 "When executing a PRIMARY or STATIC method, track the 'next-method'.
1726During executions, the list is first generated, then as each next method
1727is called, the next method is popped off the stack.")
1728
1729(define-obsolete-variable-alias 'eieio-pre-method-execution-hooks
1730 'eieio-pre-method-execution-functions "24.3")
1731(defvar eieio-pre-method-execution-functions nil
1732 "Abnormal hook run just before an EIEIO method is executed.
1733The hook function must accept one argument, the list of forms
1734about to be executed.")
1735
1736(defun eieio-generic-call (method args)
1737 "Call METHOD with ARGS.
1738ARGS provides the context on which implementation to use.
1739This should only be called from a generic function."
1740 ;; We must expand our arguments first as they are always
1741 ;; passed in as quoted symbols
1742 (let ((newargs nil) (mclass nil) (lambdas nil) (tlambdas nil) (keys nil)
1743 (eieio-generic-call-methodname method)
1744 (eieio-generic-call-arglst args)
1745 (firstarg nil)
1746 (primarymethodlist nil))
1747 ;; get a copy
1748 (setq newargs args
1749 firstarg (car newargs))
1750 ;; Is the class passed in autoloaded?
1751 ;; Since class names are also constructors, they can be autoloaded
1752 ;; via the autoload command. Check for this, and load them in.
1753 ;; It is ok if it doesn't turn out to be a class. Probably want that
1754 ;; function loaded anyway.
1755 (if (and (symbolp firstarg)
1756 (fboundp firstarg)
1757 (listp (symbol-function firstarg))
1758 (eq 'autoload (car (symbol-function firstarg))))
1759 (load (nth 1 (symbol-function firstarg))))
1760 ;; Determine the class to use.
1761 (cond ((eieio-object-p firstarg)
1762 (setq mclass (eieio--object-class firstarg)))
1763 ((class-p firstarg)
1764 (setq mclass firstarg))
1765 )
1766 ;; Make sure the class is a valid class
1767 ;; mclass can be nil (meaning a generic for should be used.
1768 ;; mclass cannot have a value that is not a class, however.
1769 (when (and (not (null mclass)) (not (class-p mclass)))
1770 (error "Cannot dispatch method %S on class %S"
1771 method mclass)
1772 )
1773 ;; Now create a list in reverse order of all the calls we have
1774 ;; make in order to successfully do this right. Rules:
1775 ;; 1) Only call generics if scoped-class is not defined
1776 ;; This prevents multiple calls in the case of recursion
1777 ;; 2) Only call static if this is a static method.
1778 ;; 3) Only call specifics if the definition allows for them.
1779 ;; 4) Call in order based on :before, :primary, and :after
1780 (when (eieio-object-p firstarg)
1781 ;; Non-static calls do all this stuff.
1782
1783 ;; :after methods
1784 (setq tlambdas
1785 (if mclass
1786 (eieiomt-method-list method method-after mclass)
1787 (list (eieio-generic-form method method-after nil)))
1788 ;;(or (and mclass (eieio-generic-form method method-after mclass))
1789 ;; (eieio-generic-form method method-after nil))
1790 )
1791 (setq lambdas (append tlambdas lambdas)
1792 keys (append (make-list (length tlambdas) method-after) keys))
1793
1794 ;; :primary methods
1795 (setq tlambdas
1796 (or (and mclass (eieio-generic-form method method-primary mclass))
1797 (eieio-generic-form method method-primary nil)))
1798 (when tlambdas
1799 (setq lambdas (cons tlambdas lambdas)
1800 keys (cons method-primary keys)
1801 primarymethodlist
1802 (eieiomt-method-list method method-primary mclass)))
1803
1804 ;; :before methods
1805 (setq tlambdas
1806 (if mclass
1807 (eieiomt-method-list method method-before mclass)
1808 (list (eieio-generic-form method method-before nil)))
1809 ;;(or (and mclass (eieio-generic-form method method-before mclass))
1810 ;; (eieio-generic-form method method-before nil))
1811 )
1812 (setq lambdas (append tlambdas lambdas)
1813 keys (append (make-list (length tlambdas) method-before) keys))
1814 )
1815
1816 (if mclass
1817 ;; For the case of a class,
1818 ;; if there were no methods found, then there could be :static methods.
1819 (when (not lambdas)
1820 (setq tlambdas
1821 (eieio-generic-form method method-static mclass))
1822 (setq lambdas (cons tlambdas lambdas)
1823 keys (cons method-static keys)
1824 primarymethodlist ;; Re-use even with bad name here
1825 (eieiomt-method-list method method-static mclass)))
1826 ;; For the case of no class (ie - mclass == nil) then there may
1827 ;; be a primary method.
1828 (setq tlambdas
1829 (eieio-generic-form method method-primary nil))
1830 (when tlambdas
1831 (setq lambdas (cons tlambdas lambdas)
1832 keys (cons method-primary keys)
1833 primarymethodlist
1834 (eieiomt-method-list method method-primary nil)))
1835 )
1836
1837 (run-hook-with-args 'eieio-pre-method-execution-functions
1838 primarymethodlist)
1839
1840 ;; Now loop through all occurrences forms which we must execute
1841 ;; (which are happily sorted now) and execute them all!
1842 (let ((rval nil) (lastval nil) (rvalever nil) (found nil))
1843 (while lambdas
1844 (if (car lambdas)
1845 (eieio--with-scoped-class (cdr (car lambdas))
1846 (let* ((eieio-generic-call-key (car keys))
1847 (has-return-val
1848 (or (= eieio-generic-call-key method-primary)
1849 (= eieio-generic-call-key method-static)))
1850 (eieio-generic-call-next-method-list
1851 ;; Use the cdr, as the first element is the fcn
1852 ;; we are calling right now.
1853 (when has-return-val (cdr primarymethodlist)))
1854 )
1855 (setq found t)
1856 ;;(setq rval (apply (car (car lambdas)) newargs))
1857 (setq lastval (apply (car (car lambdas)) newargs))
1858 (when has-return-val
1859 (setq rval lastval
1860 rvalever t))
1861 )))
1862 (setq lambdas (cdr lambdas)
1863 keys (cdr keys)))
1864 (if (not found)
1865 (if (eieio-object-p (car args))
1866 (setq rval (apply 'no-applicable-method (car args) method args)
1867 rvalever t)
1868 (signal
1869 'no-method-definition
1870 (list method args))))
1871 ;; Right Here... it could be that lastval is returned when
1872 ;; rvalever is nil. Is that right?
1873 rval)))
1874
1875(defun eieio-generic-call-primary-only (method args)
1876 "Call METHOD with ARGS for methods with only :PRIMARY implementations.
1877ARGS provides the context on which implementation to use.
1878This should only be called from a generic function.
1879
1880This method is like `eieio-generic-call', but only
1881implementations in the :PRIMARY slot are queried. After many
1882years of use, it appears that over 90% of methods in use
1883have :PRIMARY implementations only. We can therefore optimize
1884for this common case to improve performance."
1885 ;; We must expand our arguments first as they are always
1886 ;; passed in as quoted symbols
1887 (let ((newargs nil) (mclass nil) (lambdas nil)
1888 (eieio-generic-call-methodname method)
1889 (eieio-generic-call-arglst args)
1890 (firstarg nil)
1891 (primarymethodlist nil)
1892 )
1893 ;; get a copy
1894 (setq newargs args
1895 firstarg (car newargs))
1896
1897 ;; Determine the class to use.
1898 (cond ((eieio-object-p firstarg)
1899 (setq mclass (eieio--object-class firstarg)))
1900 ((not firstarg)
1901 (error "Method %s called on nil" method))
1902 ((not (eieio-object-p firstarg))
1903 (error "Primary-only method %s called on something not an object" method))
1904 (t
1905 (error "EIEIO Error: Improperly classified method %s as primary only"
1906 method)
1907 ))
1908 ;; Make sure the class is a valid class
1909 ;; mclass can be nil (meaning a generic for should be used.
1910 ;; mclass cannot have a value that is not a class, however.
1911 (when (null mclass)
1912 (error "Cannot dispatch method %S on class %S" method mclass)
1913 )
1914
1915 ;; :primary methods
1916 (setq lambdas (eieio-generic-form method method-primary mclass))
1917 (setq primarymethodlist ;; Re-use even with bad name here
1918 (eieiomt-method-list method method-primary mclass))
1919
1920 ;; Now loop through all occurrences forms which we must execute
1921 ;; (which are happily sorted now) and execute them all!
1922 (eieio--with-scoped-class (cdr lambdas)
1923 (let* ((rval nil) (lastval nil) (rvalever nil)
1924 (eieio-generic-call-key method-primary)
1925 ;; Use the cdr, as the first element is the fcn
1926 ;; we are calling right now.
1927 (eieio-generic-call-next-method-list (cdr primarymethodlist))
1928 )
1929
1930 (if (or (not lambdas) (not (car lambdas)))
1931
1932 ;; No methods found for this impl...
1933 (if (eieio-object-p (car args))
1934 (setq rval (apply 'no-applicable-method (car args) method args)
1935 rvalever t)
1936 (signal
1937 'no-method-definition
1938 (list method args)))
1939
1940 ;; Do the regular implementation here.
1941
1942 (run-hook-with-args 'eieio-pre-method-execution-functions
1943 lambdas)
1944
1945 (setq lastval (apply (car lambdas) newargs))
1946 (setq rval lastval
1947 rvalever t)
1948 )
1949
1950 ;; Right Here... it could be that lastval is returned when
1951 ;; rvalever is nil. Is that right?
1952 rval))))
1953
1954(defun eieiomt-method-list (method key class)
1955 "Return an alist list of methods lambdas.
1956METHOD is the method name.
1957KEY represents either :before, or :after methods.
1958CLASS is the starting class to search from in the method tree.
1959If CLASS is nil, then an empty list of methods should be returned."
1960 ;; Note: eieiomt - the MT means MethodTree. See more comments below
1961 ;; for the rest of the eieiomt methods.
1962
1963 ;; Collect lambda expressions stored for the class and its parent
1964 ;; classes.
1965 (let (lambdas)
1966 (dolist (ancestor (eieio-class-precedence-list class))
1967 ;; Lookup the form to use for the PRIMARY object for the next level
1968 (let ((tmpl (eieio-generic-form method key ancestor)))
1969 (when (and tmpl
1970 (or (not lambdas)
1971 ;; This prevents duplicates coming out of the
1972 ;; class method optimizer. Perhaps we should
1973 ;; just not optimize before/afters?
1974 (not (member tmpl lambdas))))
1975 (push tmpl lambdas))))
1976
1977 ;; Return collected lambda. For :after methods, return in current
1978 ;; order (most general class last); Otherwise, reverse order.
1979 (if (eq key method-after)
1980 lambdas
1981 (nreverse lambdas))))
1982
1983
1984;;;
1985;; eieio-method-tree : eieiomt-
1986;;
1987;; Stored as eieio-method-tree in property list of a generic method
1988;;
1989;; (eieio-method-tree . [BEFORE PRIMARY AFTER
1990;; genericBEFORE genericPRIMARY genericAFTER])
1991;; and
1992;; (eieio-method-obarray . [BEFORE PRIMARY AFTER
1993;; genericBEFORE genericPRIMARY genericAFTER])
1994;; where the association is a vector.
1995;; (aref 0 -- all static methods.
1996;; (aref 1 -- all methods classified as :before
1997;; (aref 2 -- all methods classified as :primary
1998;; (aref 3 -- all methods classified as :after
1999;; (aref 4 -- a generic classified as :before
2000;; (aref 5 -- a generic classified as :primary
2001;; (aref 6 -- a generic classified as :after
2002;;
2003(defvar eieiomt-optimizing-obarray nil
2004 "While mapping atoms, this contain the obarray being optimized.")
2005
2006(defun eieiomt-install (method-name)
2007 "Install the method tree, and obarray onto METHOD-NAME.
2008Do not do the work if they already exist."
2009 (let ((emtv (get method-name 'eieio-method-tree))
2010 (emto (get method-name 'eieio-method-obarray)))
2011 (if (or (not emtv) (not emto))
2012 (progn
2013 (setq emtv (put method-name 'eieio-method-tree
2014 (make-vector method-num-slots nil))
2015 emto (put method-name 'eieio-method-obarray
2016 (make-vector method-num-slots nil)))
2017 (aset emto 0 (make-vector 11 0))
2018 (aset emto 1 (make-vector 11 0))
2019 (aset emto 2 (make-vector 41 0))
2020 (aset emto 3 (make-vector 11 0))
2021 ))))
2022
2023(defun eieiomt-add (method-name method key class)
2024 "Add to METHOD-NAME the forms METHOD in a call position KEY for CLASS.
2025METHOD-NAME is the name created by a call to `defgeneric'.
2026METHOD are the forms for a given implementation.
2027KEY is an integer (see comment in eieio.el near this function) which
2028is associated with the :static :before :primary and :after tags.
2029It also indicates if CLASS is defined or not.
2030CLASS is the class this method is associated with."
2031 (if (or (> key method-num-slots) (< key 0))
2032 (error "eieiomt-add: method key error!"))
2033 (let ((emtv (get method-name 'eieio-method-tree))
2034 (emto (get method-name 'eieio-method-obarray)))
2035 ;; Make sure the method tables are available.
2036 (if (or (not emtv) (not emto))
2037 (error "Programmer error: eieiomt-add"))
2038 ;; only add new cells on if it doesn't already exist!
2039 (if (assq class (aref emtv key))
2040 (setcdr (assq class (aref emtv key)) method)
2041 (aset emtv key (cons (cons class method) (aref emtv key))))
2042 ;; Add function definition into newly created symbol, and store
2043 ;; said symbol in the correct obarray, otherwise use the
2044 ;; other array to keep this stuff
2045 (if (< key method-num-lists)
2046 (let ((nsym (intern (symbol-name class) (aref emto key))))
2047 (fset nsym method)))
2048 ;; Save the defmethod file location in a symbol property.
2049 (let ((fname (if load-in-progress
2050 load-file-name
2051 buffer-file-name))
2052 loc)
2053 (when fname
2054 (when (string-match "\\.elc$" fname)
2055 (setq fname (substring fname 0 (1- (length fname)))))
2056 (setq loc (get method-name 'method-locations))
2057 (pushnew (list class fname) loc :test 'equal)
2058 (put method-name 'method-locations loc)))
2059 ;; Now optimize the entire obarray
2060 (if (< key method-num-lists)
2061 (let ((eieiomt-optimizing-obarray (aref emto key)))
2062 ;; @todo - Is this overkill? Should we just clear the symbol?
2063 (mapatoms 'eieiomt-sym-optimize eieiomt-optimizing-obarray)))
2064 ))
2065
2066(defun eieiomt-next (class)
2067 "Return the next parent class for CLASS.
2068If CLASS is a superclass, return variable `eieio-default-superclass'.
2069If CLASS is variable `eieio-default-superclass' then return nil.
2070This is different from function `class-parent' as class parent returns
2071nil for superclasses. This function performs no type checking!"
2072 ;; No type-checking because all calls are made from functions which
2073 ;; are safe and do checking for us.
2074 (or (eieio-class-parents-fast class)
2075 (if (eq class 'eieio-default-superclass)
2076 nil
2077 '(eieio-default-superclass))))
2078
2079(defun eieiomt-sym-optimize (s)
2080 "Find the next class above S which has a function body for the optimizer."
2081 ;; Set the value to nil in case there is no nearest cell.
2082 (set s nil)
2083 ;; Find the nearest cell that has a function body. If we find one,
2084 ;; we replace the nil from above.
2085 (let ((external-symbol (intern-soft (symbol-name s))))
2086 (catch 'done
2087 (dolist (ancestor (rest (eieio-class-precedence-list external-symbol)))
2088 (let ((ov (intern-soft (symbol-name ancestor)
2089 eieiomt-optimizing-obarray)))
2090 (when (fboundp ov)
2091 (set s ov) ;; store ov as our next symbol
2092 (throw 'done ancestor)))))))
2093
2094(defun eieio-generic-form (method key class)
2095 "Return the lambda form belonging to METHOD using KEY based upon CLASS.
2096If CLASS is not a class then use `generic' instead. If class has
2097no form, but has a parent class, then trace to that parent class.
2098The first time a form is requested from a symbol, an optimized path
2099is memorized for faster future use."
2100 (let ((emto (aref (get method 'eieio-method-obarray)
2101 (if class key (eieio-specialized-key-to-generic-key key)))))
2102 (if (class-p class)
2103 ;; 1) find our symbol
2104 (let ((cs (intern-soft (symbol-name class) emto)))
2105 (if (not cs)
2106 ;; 2) If there isn't one, then make one.
2107 ;; This can be slow since it only occurs once
2108 (progn
2109 (setq cs (intern (symbol-name class) emto))
2110 ;; 2.1) Cache its nearest neighbor with a quick optimize
2111 ;; which should only occur once for this call ever
2112 (let ((eieiomt-optimizing-obarray emto))
2113 (eieiomt-sym-optimize cs))))
2114 ;; 3) If it's bound return this one.
2115 (if (fboundp cs)
2116 (cons cs (eieio--class-symbol (class-v class)))
2117 ;; 4) If it's not bound then this variable knows something
2118 (if (symbol-value cs)
2119 (progn
2120 ;; 4.1) This symbol holds the next class in its value
2121 (setq class (symbol-value cs)
2122 cs (intern-soft (symbol-name class) emto))
2123 ;; 4.2) The optimizer should always have chosen a
2124 ;; function-symbol
2125 ;;(if (fboundp cs)
2126 (cons cs (eieio--class-symbol (class-v (intern (symbol-name class)))))
2127 ;;(error "EIEIO optimizer: erratic data loss!"))
2128 )
2129 ;; There never will be a funcall...
2130 nil)))
2131 ;; for a generic call, what is a list, is the function body we want.
2132 (let ((emtl (aref (get method 'eieio-method-tree)
2133 (if class key (eieio-specialized-key-to-generic-key key)))))
2134 (if emtl
2135 ;; The car of EMTL is supposed to be a class, which in this
2136 ;; case is nil, so skip it.
2137 (cons (cdr (car emtl)) nil)
2138 nil)))))
2139
2140
2141;;; Here are some special types of errors
2142;;
2143(intern "no-method-definition")
2144(put 'no-method-definition 'error-conditions '(no-method-definition error))
2145(put 'no-method-definition 'error-message "No method definition")
2146
2147(intern "no-next-method")
2148(put 'no-next-method 'error-conditions '(no-next-method error))
2149(put 'no-next-method 'error-message "No next method")
2150
2151(intern "invalid-slot-name")
2152(put 'invalid-slot-name 'error-conditions '(invalid-slot-name error))
2153(put 'invalid-slot-name 'error-message "Invalid slot name")
2154
2155(intern "invalid-slot-type")
2156(put 'invalid-slot-type 'error-conditions '(invalid-slot-type error nil))
2157(put 'invalid-slot-type 'error-message "Invalid slot type")
2158
2159(intern "unbound-slot")
2160(put 'unbound-slot 'error-conditions '(unbound-slot error nil))
2161(put 'unbound-slot 'error-message "Unbound slot")
2162
2163(intern "inconsistent-class-hierarchy")
2164(put 'inconsistent-class-hierarchy 'error-conditions
2165 '(inconsistent-class-hierarchy error nil))
2166(put 'inconsistent-class-hierarchy 'error-message "Inconsistent class hierarchy")
2167
2168;;; Obsolete backward compatibility functions.
2169;; Needed to run byte-code compiled with the EIEIO of Emacs-23.
2170
2171(defun eieio-defmethod (method args)
2172 "Obsolete work part of an old version of the `defmethod' macro."
2173 (let ((key nil) (body nil) (firstarg nil) (argfix nil) (argclass nil) loopa)
2174 ;; find optional keys
2175 (setq key
2176 (cond ((memq (car args) '(:BEFORE :before))
2177 (setq args (cdr args))
2178 method-before)
2179 ((memq (car args) '(:AFTER :after))
2180 (setq args (cdr args))
2181 method-after)
2182 ((memq (car args) '(:STATIC :static))
2183 (setq args (cdr args))
2184 method-static)
2185 ((memq (car args) '(:PRIMARY :primary))
2186 (setq args (cdr args))
2187 method-primary)
2188 ;; Primary key.
2189 (t method-primary)))
2190 ;; Get body, and fix contents of args to be the arguments of the fn.
2191 (setq body (cdr args)
2192 args (car args))
2193 (setq loopa args)
2194 ;; Create a fixed version of the arguments.
2195 (while loopa
2196 (setq argfix (cons (if (listp (car loopa)) (car (car loopa)) (car loopa))
2197 argfix))
2198 (setq loopa (cdr loopa)))
2199 ;; Make sure there is a generic.
2200 (eieio-defgeneric
2201 method
2202 (if (stringp (car body))
2203 (car body) (format "Generically created method `%s'." method)))
2204 ;; create symbol for property to bind to. If the first arg is of
2205 ;; the form (varname vartype) and `vartype' is a class, then
2206 ;; that class will be the type symbol. If not, then it will fall
2207 ;; under the type `primary' which is a non-specific calling of the
2208 ;; function.
2209 (setq firstarg (car args))
2210 (if (listp firstarg)
2211 (progn
2212 (setq argclass (nth 1 firstarg))
2213 (if (not (class-p argclass))
2214 (error "Unknown class type %s in method parameters"
2215 (nth 1 firstarg))))
2216 ;; Generics are higher.
2217 (setq key (eieio-specialized-key-to-generic-key key)))
2218 ;; Put this lambda into the symbol so we can find it.
2219 (if (byte-code-function-p (car-safe body))
2220 (eieiomt-add method (car-safe body) key argclass)
2221 (eieiomt-add method (append (list 'lambda (reverse argfix)) body)
2222 key argclass))
2223 )
2224
2225 (when eieio-optimize-primary-methods-flag
2226 ;; Optimizing step:
2227 ;;
2228 ;; If this method, after this setup, only has primary methods, then
2229 ;; we can setup the generic that way.
2230 (if (generic-primary-only-p method)
2231 ;; If there is only one primary method, then we can go one more
2232 ;; optimization step.
2233 (if (generic-primary-only-one-p method)
2234 (eieio-defgeneric-reset-generic-form-primary-only-one method)
2235 (eieio-defgeneric-reset-generic-form-primary-only method))
2236 (eieio-defgeneric-reset-generic-form method)))
2237
2238 method)
2239(make-obsolete 'eieio-defmethod 'eieio--defmethod "24.1")
2240
2241(defun eieio-defgeneric (method doc-string)
2242 "Obsolete work part of an old version of the `defgeneric' macro."
2243 (if (and (fboundp method) (not (generic-p method))
2244 (or (byte-code-function-p (symbol-function method))
2245 (not (eq 'autoload (car (symbol-function method)))))
2246 )
2247 (error "You cannot create a generic/method over an existing symbol: %s"
2248 method))
2249 ;; Don't do this over and over.
2250 (unless (fboundp 'method)
2251 ;; This defun tells emacs where the first definition of this
2252 ;; method is defined.
2253 `(defun ,method nil)
2254 ;; Make sure the method tables are installed.
2255 (eieiomt-install method)
2256 ;; Apply the actual body of this function.
2257 (fset method (eieio-defgeneric-form method doc-string))
2258 ;; Return the method
2259 'method))
2260(make-obsolete 'eieio-defgeneric nil "24.1")
2261
2262(provide 'eieio-core)
2263
2264;;; eieio-core.el ends here
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index 37b1ec5fa94..3cdf1f078bd 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -54,223 +54,7 @@
54 (interactive) 54 (interactive)
55 (message eieio-version)) 55 (message eieio-version))
56 56
57(eval-and-compile 57(require 'eieio-core)
58;; About the above. EIEIO must process its own code when it compiles
59;; itself, thus, by eval-and-compiling ourselves, we solve the problem.
60
61;; Compatibility
62(if (fboundp 'compiled-function-arglist)
63
64 ;; XEmacs can only access a compiled functions arglist like this:
65 (defalias 'eieio-compiled-function-arglist 'compiled-function-arglist)
66
67 ;; Emacs doesn't have this function, but since FUNC is a vector, we can just
68 ;; grab the appropriate element.
69 (defun eieio-compiled-function-arglist (func)
70 "Return the argument list for the compiled function FUNC."
71 (aref func 0))
72
73 )
74
75
76;;;
77;; Variable declarations.
78;;
79
80(defvar eieio-hook nil
81 "This hook is executed, then cleared each time `defclass' is called.")
82
83(defvar eieio-error-unsupported-class-tags nil
84 "Non-nil to throw an error if an encountered tag is unsupported.
85This may prevent classes from CLOS applications from being used with EIEIO
86since EIEIO does not support all CLOS tags.")
87
88(defvar eieio-skip-typecheck nil
89 "If non-nil, skip all slot typechecking.
90Set this to t permanently if a program is functioning well to get a
91small speed increase. This variable is also used internally to handle
92default setting for optimization purposes.")
93
94(defvar eieio-optimize-primary-methods-flag t
95 "Non-nil means to optimize the method dispatch on primary methods.")
96
97(defvar eieio-initializing-object nil
98 "Set to non-nil while initializing an object.")
99
100(defconst eieio-unbound
101 (if (and (boundp 'eieio-unbound) (symbolp eieio-unbound))
102 eieio-unbound
103 (make-symbol "unbound"))
104 "Uninterned symbol representing an unbound slot in an object.")
105
106;; This is a bootstrap for eieio-default-superclass so it has a value
107;; while it is being built itself.
108(defvar eieio-default-superclass nil))
109
110(defmacro eieio--define-field-accessors (prefix fields)
111 (declare (indent 1))
112 (let ((index 0)
113 (defs '()))
114 (dolist (field fields)
115 (let ((doc (if (listp field)
116 (prog1 (cadr field) (setq field (car field))))))
117 (push `(defmacro ,(intern (format "eieio--%s-%s" prefix field)) (x)
118 ,@(if doc (list (format (if (string-match "\n" doc)
119 "Return %s" "Return %s of a %s.")
120 doc prefix)))
121 (list 'aref x ,index))
122 defs)
123 (setq index (1+ index))))
124 `(eval-and-compile
125 ,@(nreverse defs)
126 (defconst ,(intern (format "eieio--%s-num-slots" prefix)) ,index))))
127
128(eieio--define-field-accessors class
129 (-unused-0 ;;FIXME: not sure, but at least there was no accessor!
130 (symbol "symbol (self-referencing)")
131 parent children
132 (symbol-obarray "obarray permitting fast access to variable position indexes")
133 ;; @todo
134 ;; the word "public" here is leftovers from the very first version.
135 ;; Get rid of it!
136 (public-a "class attribute index")
137 (public-d "class attribute defaults index")
138 (public-doc "class documentation strings for attributes")
139 (public-type "class type for a slot")
140 (public-custom "class custom type for a slot")
141 (public-custom-label "class custom group for a slot")
142 (public-custom-group "class custom group for a slot")
143 (public-printer "printer for a slot")
144 (protection "protection for a slot")
145 (initarg-tuples "initarg tuples list")
146 (class-allocation-a "class allocated attributes")
147 (class-allocation-doc "class allocated documentation")
148 (class-allocation-type "class allocated value type")
149 (class-allocation-custom "class allocated custom descriptor")
150 (class-allocation-custom-label "class allocated custom descriptor")
151 (class-allocation-custom-group "class allocated custom group")
152 (class-allocation-printer "class allocated printer for a slot")
153 (class-allocation-protection "class allocated protection list")
154 (class-allocation-values "class allocated value vector")
155 (default-object-cache "what a newly created object would look like.
156This will speed up instantiation time as only a `copy-sequence' will
157be needed, instead of looping over all the values and setting them
158from the default.")
159 (options "storage location of tagged class options.
160Stored outright without modifications or stripping.")))
161
162(eieio--define-field-accessors object
163 (-unused-0 ;;FIXME: not sure, but at least there was no accessor!
164 (class "class struct defining OBJ")
165 name))
166
167(eval-and-compile
168;; FIXME: The constants below should have an `eieio-' prefix added!!
169
170(defconst method-static 0 "Index into :static tag on a method.")
171(defconst method-before 1 "Index into :before tag on a method.")
172(defconst method-primary 2 "Index into :primary tag on a method.")
173(defconst method-after 3 "Index into :after tag on a method.")
174(defconst method-num-lists 4 "Number of indexes into methods vector in which groups of functions are kept.")
175(defconst method-generic-before 4 "Index into generic :before tag on a method.")
176(defconst method-generic-primary 5 "Index into generic :primary tag on a method.")
177(defconst method-generic-after 6 "Index into generic :after tag on a method.")
178(defconst method-num-slots 7 "Number of indexes into a method's vector.")
179
180(defsubst eieio-specialized-key-to-generic-key (key)
181 "Convert a specialized KEY into a generic method key."
182 (cond ((eq key method-static) 0) ;; don't convert
183 ((< key method-num-lists) (+ key 3)) ;; The conversion
184 (t key) ;; already generic.. maybe.
185 ))
186
187
188;;; Important macros used in eieio.
189;;
190(defmacro class-v (class)
191 "Internal: Return the class vector from the CLASS symbol."
192 ;; No check: If eieio gets this far, it's probably been checked already.
193 `(get ,class 'eieio-class-definition))
194
195(defmacro class-p (class)
196 "Return t if CLASS is a valid class vector.
197CLASS is a symbol."
198 ;; this new method is faster since it doesn't waste time checking lots of
199 ;; things.
200 `(condition-case nil
201 (eq (aref (class-v ,class) 0) 'defclass)
202 (error nil)))
203
204(defmacro eieio-object-p (obj)
205 "Return non-nil if OBJ is an EIEIO object."
206 `(condition-case nil
207 (let ((tobj ,obj))
208 (and (eq (aref tobj 0) 'object)
209 (class-p (eieio--object-class tobj))))
210 (error nil)))
211(defalias 'object-p 'eieio-object-p)
212
213(defmacro class-constructor (class)
214 "Return the symbol representing the constructor of CLASS."
215 `(eieio--class-symbol (class-v ,class)))
216
217(defmacro generic-p (method)
218 "Return t if symbol METHOD is a generic function.
219Only methods have the symbol `eieio-method-obarray' as a property
220\(which contains a list of all bindings to that method type.)"
221 `(and (fboundp ,method) (get ,method 'eieio-method-obarray)))
222
223(defun generic-primary-only-p (method)
224 "Return t if symbol METHOD is a generic function with only primary methods.
225Only methods have the symbol `eieio-method-obarray' as a property (which
226contains a list of all bindings to that method type.)
227Methods with only primary implementations are executed in an optimized way."
228 (and (generic-p method)
229 (let ((M (get method 'eieio-method-tree)))
230 (and (< 0 (length (aref M method-primary)))
231 (not (aref M method-static))
232 (not (aref M method-before))
233 (not (aref M method-after))
234 (not (aref M method-generic-before))
235 (not (aref M method-generic-primary))
236 (not (aref M method-generic-after))))
237 ))
238
239(defun generic-primary-only-one-p (method)
240 "Return t if symbol METHOD is a generic function with only primary methods.
241Only methods have the symbol `eieio-method-obarray' as a property (which
242contains a list of all bindings to that method type.)
243Methods with only primary implementations are executed in an optimized way."
244 (and (generic-p method)
245 (let ((M (get method 'eieio-method-tree)))
246 (and (= 1 (length (aref M method-primary)))
247 (not (aref M method-static))
248 (not (aref M method-before))
249 (not (aref M method-after))
250 (not (aref M method-generic-before))
251 (not (aref M method-generic-primary))
252 (not (aref M method-generic-after))))
253 ))
254
255(defmacro class-option-assoc (list option)
256 "Return from LIST the found OPTION, or nil if it doesn't exist."
257 `(car-safe (cdr (memq ,option ,list))))
258
259(defmacro class-option (class option)
260 "Return the value stored for CLASS' OPTION.
261Return nil if that option doesn't exist."
262 `(class-option-assoc (eieio--class-options (class-v ,class)) ',option))
263
264(defmacro class-abstract-p (class)
265 "Return non-nil if CLASS is abstract.
266Abstract classes cannot be instantiated."
267 `(class-option ,class :abstract))
268
269(defmacro class-method-invocation-order (class)
270 "Return the invocation order of CLASS.
271Abstract classes cannot be instantiated."
272 `(or (class-option ,class :method-invocation-order)
273 :breadth-first))
274 58
275 59
276;;; Defining a new class 60;;; Defining a new class
@@ -331,829 +115,8 @@ Options in CLOS not supported in EIEIO:
331 115
332Due to the way class options are set up, you can add any tags you wish, 116Due to the way class options are set up, you can add any tags you wish,
333and reference them using the function `class-option'." 117and reference them using the function `class-option'."
334 ;; We must `eval-and-compile' this so that when we byte compile 118 `(eieio-defclass ',name ',superclass ',slots ',options-and-doc))
335 ;; an eieio program, there is no need to load it ahead of time.
336 ;; It also provides lots of nice debugging errors at compile time.
337 `(eval-and-compile
338 (eieio-defclass ',name ',superclass ',slots ',options-and-doc)))
339
340(defvar eieio-defclass-autoload-map (make-vector 7 nil)
341 "Symbol map of superclasses we find in autoloads.")
342
343;; We autoload this because it's used in `make-autoload'.
344;;;###autoload
345(defun eieio-defclass-autoload (cname superclasses filename doc)
346 "Create autoload symbols for the EIEIO class CNAME.
347SUPERCLASSES are the superclasses that CNAME inherits from.
348DOC is the docstring for CNAME.
349This function creates a mock-class for CNAME and adds it into
350SUPERCLASSES as children.
351It creates an autoload function for CNAME's constructor."
352 ;; Assume we've already debugged inputs.
353
354 (let* ((oldc (when (class-p cname) (class-v cname)))
355 (newc (make-vector eieio--class-num-slots nil))
356 )
357 (if oldc
358 nil ;; Do nothing if we already have this class.
359
360 ;; Create the class in NEWC, but don't fill anything else in.
361 (aset newc 0 'defclass)
362 (setf (eieio--class-symbol newc) cname)
363
364 (let ((clear-parent nil))
365 ;; No parents?
366 (when (not superclasses)
367 (setq superclasses '(eieio-default-superclass)
368 clear-parent t)
369 )
370
371 ;; Hook our new class into the existing structures so we can
372 ;; autoload it later.
373 (dolist (SC superclasses)
374
375
376 ;; TODO - If we create an autoload that is in the map, that
377 ;; map needs to be cleared!
378
379
380 ;; Does our parent exist?
381 (if (not (class-p SC))
382
383 ;; Create a symbol for this parent, and then store this
384 ;; parent on that symbol.
385 (let ((sym (intern (symbol-name SC) eieio-defclass-autoload-map)))
386 (if (not (boundp sym))
387 (set sym (list cname))
388 (add-to-list sym cname))
389 )
390
391 ;; We have a parent, save the child in there.
392 (when (not (member cname (eieio--class-children (class-v SC))))
393 (setf (eieio--class-children (class-v SC))
394 (cons cname (eieio--class-children (class-v SC))))))
395
396 ;; save parent in child
397 (setf (eieio--class-parent newc) (cons SC (eieio--class-parent newc)))
398 )
399
400 ;; turn this into a usable self-pointing symbol
401 (set cname cname)
402
403 ;; Store the new class vector definition into the symbol. We need to
404 ;; do this first so that we can call defmethod for the accessor.
405 ;; The vector will be updated by the following while loop and will not
406 ;; need to be stored a second time.
407 (put cname 'eieio-class-definition newc)
408
409 ;; Clear the parent
410 (if clear-parent (setf (eieio--class-parent newc) nil))
411
412 ;; Create an autoload on top of our constructor function.
413 (autoload cname filename doc nil nil)
414 (autoload (intern (concat (symbol-name cname) "-p")) filename "" nil nil)
415 (autoload (intern (concat (symbol-name cname) "-child-p")) filename "" nil nil)
416 (autoload (intern (concat (symbol-name cname) "-list-p")) filename "" nil nil)
417
418 ))))
419
420(defsubst eieio-class-un-autoload (cname)
421 "If class CNAME is in an autoload state, load its file."
422 (when (eq (car-safe (symbol-function cname)) 'autoload)
423 (load-library (car (cdr (symbol-function cname))))))
424
425(defmacro eieio--check-type (type obj)
426 (unless (symbolp obj)
427 (error "eieio--check-type wants OBJ to be a variable"))
428 `(if (not ,(cond
429 ((eq 'or (car-safe type))
430 `(or ,@(mapcar (lambda (type) `(,type ,obj)) (cdr type))))
431 (t `(,type ,obj))))
432 (signal 'wrong-type-argument (list ',type ,obj))))
433
434(defun eieio-defclass (cname superclasses slots options-and-doc)
435 ;; FIXME: Most of this should be moved to the `defclass' macro.
436 "Define CNAME as a new subclass of SUPERCLASSES.
437SLOTS are the slots residing in that class definition, and options or
438documentation OPTIONS-AND-DOC is the toplevel documentation for this class.
439See `defclass' for more information."
440 ;; Run our eieio-hook each time, and clear it when we are done.
441 ;; This way people can add hooks safely if they want to modify eieio
442 ;; or add definitions when eieio is loaded or something like that.
443 (run-hooks 'eieio-hook)
444 (setq eieio-hook nil)
445
446 (eieio--check-type listp superclasses)
447
448 (let* ((pname superclasses)
449 (newc (make-vector eieio--class-num-slots nil))
450 (oldc (when (class-p cname) (class-v cname)))
451 (groups nil) ;; list of groups id'd from slots
452 (options nil)
453 (clearparent nil))
454
455 (aset newc 0 'defclass)
456 (setf (eieio--class-symbol newc) cname)
457
458 ;; If this class already existed, and we are updating its structure,
459 ;; make sure we keep the old child list. This can cause bugs, but
460 ;; if no new slots are created, it also saves time, and prevents
461 ;; method table breakage, particularly when the users is only
462 ;; byte compiling an EIEIO file.
463 (if oldc
464 (setf (eieio--class-children newc) (eieio--class-children oldc))
465 ;; If the old class did not exist, but did exist in the autoload map, then adopt those children.
466 ;; This is like the above, but deals with autoloads nicely.
467 (let ((sym (intern-soft (symbol-name cname) eieio-defclass-autoload-map)))
468 (when sym
469 (condition-case nil
470 (setf (eieio--class-children newc) (symbol-value sym))
471 (error nil))
472 (unintern (symbol-name cname) eieio-defclass-autoload-map)
473 ))
474 )
475
476 (cond ((and (stringp (car options-and-doc))
477 (/= 1 (% (length options-and-doc) 2)))
478 (error "Too many arguments to `defclass'"))
479 ((and (symbolp (car options-and-doc))
480 (/= 0 (% (length options-and-doc) 2)))
481 (error "Too many arguments to `defclass'"))
482 )
483
484 (setq options
485 (if (stringp (car options-and-doc))
486 (cons :documentation options-and-doc)
487 options-and-doc))
488
489 (if pname
490 (progn
491 (while pname
492 (if (and (car pname) (symbolp (car pname)))
493 (if (not (class-p (car pname)))
494 ;; bad class
495 (error "Given parent class %s is not a class" (car pname))
496 ;; good parent class...
497 ;; save new child in parent
498 (when (not (member cname (eieio--class-children (class-v (car pname)))))
499 (setf (eieio--class-children (class-v (car pname)))
500 (cons cname (eieio--class-children (class-v (car pname))))))
501 ;; Get custom groups, and store them into our local copy.
502 (mapc (lambda (g) (add-to-list 'groups g))
503 (class-option (car pname) :custom-groups))
504 ;; save parent in child
505 (setf (eieio--class-parent newc) (cons (car pname) (eieio--class-parent newc))))
506 (error "Invalid parent class %s" pname))
507 (setq pname (cdr pname)))
508 ;; Reverse the list of our parents so that they are prioritized in
509 ;; the same order as specified in the code.
510 (setf (eieio--class-parent newc) (nreverse (eieio--class-parent newc))) )
511 ;; If there is nothing to loop over, then inherit from the
512 ;; default superclass.
513 (unless (eq cname 'eieio-default-superclass)
514 ;; adopt the default parent here, but clear it later...
515 (setq clearparent t)
516 ;; save new child in parent
517 (if (not (member cname (eieio--class-children (class-v 'eieio-default-superclass))))
518 (setf (eieio--class-children (class-v 'eieio-default-superclass))
519 (cons cname (eieio--class-children (class-v 'eieio-default-superclass)))))
520 ;; save parent in child
521 (setf (eieio--class-parent newc) (list eieio-default-superclass))))
522
523 ;; turn this into a usable self-pointing symbol
524 (set cname cname)
525
526 ;; These two tests must be created right away so we can have self-
527 ;; referencing classes. ei, a class whose slot can contain only
528 ;; pointers to itself.
529
530 ;; Create the test function
531 (let ((csym (intern (concat (symbol-name cname) "-p"))))
532 (fset csym
533 (list 'lambda (list 'obj)
534 (format "Test OBJ to see if it an object of type %s" cname)
535 (list 'and '(eieio-object-p obj)
536 (list 'same-class-p 'obj cname)))))
537
538 ;; Make sure the method invocation order is a valid value.
539 (let ((io (class-option-assoc options :method-invocation-order)))
540 (when (and io (not (member io '(:depth-first :breadth-first :c3))))
541 (error "Method invocation order %s is not allowed" io)
542 ))
543
544 ;; Create a handy child test too
545 (let ((csym (intern (concat (symbol-name cname) "-child-p"))))
546 (fset csym
547 `(lambda (obj)
548 ,(format
549 "Test OBJ to see if it an object is a child of type %s"
550 cname)
551 (and (eieio-object-p obj)
552 (object-of-class-p obj ,cname))))
553
554 ;; Create a handy list of the class test too
555 (let ((csym (intern (concat (symbol-name cname) "-list-p"))))
556 (fset csym
557 `(lambda (obj)
558 ,(format
559 "Test OBJ to see if it a list of objects which are a child of type %s"
560 cname)
561 (when (listp obj)
562 (let ((ans t)) ;; nil is valid
563 ;; Loop over all the elements of the input list, test
564 ;; each to make sure it is a child of the desired object class.
565 (while (and obj ans)
566 (setq ans (and (eieio-object-p (car obj))
567 (object-of-class-p (car obj) ,cname)))
568 (setq obj (cdr obj)))
569 ans)))))
570
571 ;; When using typep, (typep OBJ 'myclass) returns t for objects which
572 ;; are subclasses of myclass. For our predicates, however, it is
573 ;; important for EIEIO to be backwards compatible, where
574 ;; myobject-p, and myobject-child-p are different.
575 ;; "cl" uses this technique to specify symbols with specific typep
576 ;; test, so we can let typep have the CLOS documented behavior
577 ;; while keeping our above predicate clean.
578
579 ;; It would be cleaner to use `defsetf' here, but that requires cl
580 ;; at runtime.
581 (put cname 'cl-deftype-handler
582 (list 'lambda () `(list 'satisfies (quote ,csym)))))
583
584 ;; Before adding new slots, let's add all the methods and classes
585 ;; in from the parent class.
586 (eieio-copy-parents-into-subclass newc superclasses)
587
588 ;; Store the new class vector definition into the symbol. We need to
589 ;; do this first so that we can call defmethod for the accessor.
590 ;; The vector will be updated by the following while loop and will not
591 ;; need to be stored a second time.
592 (put cname 'eieio-class-definition newc)
593
594 ;; Query each slot in the declaration list and mangle into the
595 ;; class structure I have defined.
596 (while slots
597 (let* ((slot1 (car slots))
598 (name (car slot1))
599 (slot (cdr slot1))
600 (acces (plist-get slot ':accessor))
601 (init (or (plist-get slot ':initform)
602 (if (member ':initform slot) nil
603 eieio-unbound)))
604 (initarg (plist-get slot ':initarg))
605 (docstr (plist-get slot ':documentation))
606 (prot (plist-get slot ':protection))
607 (reader (plist-get slot ':reader))
608 (writer (plist-get slot ':writer))
609 (alloc (plist-get slot ':allocation))
610 (type (plist-get slot ':type))
611 (custom (plist-get slot ':custom))
612 (label (plist-get slot ':label))
613 (customg (plist-get slot ':group))
614 (printer (plist-get slot ':printer))
615
616 (skip-nil (class-option-assoc options :allow-nil-initform))
617 )
618
619 (if eieio-error-unsupported-class-tags
620 (let ((tmp slot))
621 (while tmp
622 (if (not (member (car tmp) '(:accessor
623 :initform
624 :initarg
625 :documentation
626 :protection
627 :reader
628 :writer
629 :allocation
630 :type
631 :custom
632 :label
633 :group
634 :printer
635 :allow-nil-initform
636 :custom-groups)))
637 (signal 'invalid-slot-type (list (car tmp))))
638 (setq tmp (cdr (cdr tmp))))))
639
640 ;; Clean up the meaning of protection.
641 (cond ((or (eq prot 'public) (eq prot :public)) (setq prot nil))
642 ((or (eq prot 'protected) (eq prot :protected)) (setq prot 'protected))
643 ((or (eq prot 'private) (eq prot :private)) (setq prot 'private))
644 ((eq prot nil) nil)
645 (t (signal 'invalid-slot-type (list ':protection prot))))
646
647 ;; Make sure the :allocation parameter has a valid value.
648 (if (not (or (not alloc) (eq alloc :class) (eq alloc :instance)))
649 (signal 'invalid-slot-type (list ':allocation alloc)))
650
651 ;; The default type specifier is supposed to be t, meaning anything.
652 (if (not type) (setq type t))
653
654 ;; Label is nil, or a string
655 (if (not (or (null label) (stringp label)))
656 (signal 'invalid-slot-type (list ':label label)))
657
658 ;; Is there an initarg, but allocation of class?
659 (if (and initarg (eq alloc :class))
660 (message "Class allocated slots do not need :initarg"))
661
662 ;; intern the symbol so we can use it blankly
663 (if initarg (set initarg initarg))
664
665 ;; The customgroup should be a list of symbols
666 (cond ((null customg)
667 (setq customg '(default)))
668 ((not (listp customg))
669 (setq customg (list customg))))
670 ;; The customgroup better be a symbol, or list of symbols.
671 (mapc (lambda (cg)
672 (if (not (symbolp cg))
673 (signal 'invalid-slot-type (list ':group cg))))
674 customg)
675
676 ;; First up, add this slot into our new class.
677 (eieio-add-new-slot newc name init docstr type custom label customg printer
678 prot initarg alloc 'defaultoverride skip-nil)
679
680 ;; We need to id the group, and store them in a group list attribute.
681 (mapc (lambda (cg) (add-to-list 'groups cg)) customg)
682
683 ;; Anyone can have an accessor function. This creates a function
684 ;; of the specified name, and also performs a `defsetf' if applicable
685 ;; so that users can `setf' the space returned by this function.
686 (if acces
687 (progn
688 (eieio--defmethod
689 acces (if (eq alloc :class) :static :primary) cname
690 `(lambda (this)
691 ,(format
692 "Retrieves the slot `%s' from an object of class `%s'"
693 name cname)
694 (if (slot-boundp this ',name)
695 (eieio-oref this ',name)
696 ;; Else - Some error? nil?
697 nil)))
698
699 (if (fboundp 'gv-define-setter)
700 ;; FIXME: We should move more of eieio-defclass into the
701 ;; defclass macro so we don't have to use `eval' and require
702 ;; `gv' at run-time.
703 (eval `(gv-define-setter ,acces (eieio--store eieio--object)
704 (list 'eieio-oset eieio--object '',name
705 eieio--store)))
706 ;; Provide a setf method. It would be cleaner to use
707 ;; defsetf, but that would require CL at runtime.
708 (put acces 'setf-method
709 `(lambda (widget)
710 (let* ((--widget-sym-- (make-symbol "--widget--"))
711 (--store-sym-- (make-symbol "--store--")))
712 (list
713 (list --widget-sym--)
714 (list widget)
715 (list --store-sym--)
716 (list 'eieio-oset --widget-sym-- '',name
717 --store-sym--)
718 (list 'getfoo --widget-sym--))))))))
719
720 ;; If a writer is defined, then create a generic method of that
721 ;; name whose purpose is to set the value of the slot.
722 (if writer
723 (eieio--defmethod
724 writer nil cname
725 `(lambda (this value)
726 ,(format "Set the slot `%s' of an object of class `%s'"
727 name cname)
728 (setf (slot-value this ',name) value))))
729 ;; If a reader is defined, then create a generic method
730 ;; of that name whose purpose is to access this slot value.
731 (if reader
732 (eieio--defmethod
733 reader nil cname
734 `(lambda (this)
735 ,(format "Access the slot `%s' from object of class `%s'"
736 name cname)
737 (slot-value this ',name))))
738 )
739 (setq slots (cdr slots)))
740
741 ;; Now that everything has been loaded up, all our lists are backwards!
742 ;; Fix that up now.
743 (setf (eieio--class-public-a newc) (nreverse (eieio--class-public-a newc)))
744 (setf (eieio--class-public-d newc) (nreverse (eieio--class-public-d newc)))
745 (setf (eieio--class-public-doc newc) (nreverse (eieio--class-public-doc newc)))
746 (setf (eieio--class-public-type newc)
747 (apply 'vector (nreverse (eieio--class-public-type newc))))
748 (setf (eieio--class-public-custom newc) (nreverse (eieio--class-public-custom newc)))
749 (setf (eieio--class-public-custom-label newc) (nreverse (eieio--class-public-custom-label newc)))
750 (setf (eieio--class-public-custom-group newc) (nreverse (eieio--class-public-custom-group newc)))
751 (setf (eieio--class-public-printer newc) (nreverse (eieio--class-public-printer newc)))
752 (setf (eieio--class-protection newc) (nreverse (eieio--class-protection newc)))
753 (setf (eieio--class-initarg-tuples newc) (nreverse (eieio--class-initarg-tuples newc)))
754
755 ;; The storage for class-class-allocation-type needs to be turned into
756 ;; a vector now.
757 (setf (eieio--class-class-allocation-type newc)
758 (apply 'vector (eieio--class-class-allocation-type newc)))
759
760 ;; Also, take class allocated values, and vectorize them for speed.
761 (setf (eieio--class-class-allocation-values newc)
762 (apply 'vector (eieio--class-class-allocation-values newc)))
763
764 ;; Attach slot symbols into an obarray, and store the index of
765 ;; this slot as the variable slot in this new symbol. We need to
766 ;; know about primes, because obarrays are best set in vectors of
767 ;; prime number length, and we also need to make our vector small
768 ;; to save space, and also optimal for the number of items we have.
769 (let* ((cnt 0)
770 (pubsyms (eieio--class-public-a newc))
771 (prots (eieio--class-protection newc))
772 (l (length pubsyms))
773 (vl (let ((primes '( 3 5 7 11 13 17 19 23 29 31 37 41 43 47
774 53 59 61 67 71 73 79 83 89 97 101 )))
775 (while (and primes (< (car primes) l))
776 (setq primes (cdr primes)))
777 (car primes)))
778 (oa (make-vector vl 0))
779 (newsym))
780 (while pubsyms
781 (setq newsym (intern (symbol-name (car pubsyms)) oa))
782 (set newsym cnt)
783 (setq cnt (1+ cnt))
784 (if (car prots) (put newsym 'protection (car prots)))
785 (setq pubsyms (cdr pubsyms)
786 prots (cdr prots)))
787 (setf (eieio--class-symbol-obarray newc) oa)
788 )
789
790 ;; Create the constructor function
791 (if (class-option-assoc options :abstract)
792 ;; Abstract classes cannot be instantiated. Say so.
793 (let ((abs (class-option-assoc options :abstract)))
794 (if (not (stringp abs))
795 (setq abs (format "Class %s is abstract" cname)))
796 (fset cname
797 `(lambda (&rest stuff)
798 ,(format "You cannot create a new object of type %s" cname)
799 (error ,abs))))
800
801 ;; Non-abstract classes need a constructor.
802 (fset cname
803 `(lambda (newname &rest slots)
804 ,(format "Create a new object with name NAME of class type %s" cname)
805 (apply 'constructor ,cname newname slots)))
806 )
807
808 ;; Set up a specialized doc string.
809 ;; Use stored value since it is calculated in a non-trivial way
810 (put cname 'variable-documentation
811 (class-option-assoc options :documentation))
812
813 ;; Save the file location where this class is defined.
814 (let ((fname (if load-in-progress
815 load-file-name
816 buffer-file-name))
817 loc)
818 (when fname
819 (when (string-match "\\.elc\\'" fname)
820 (setq fname (substring fname 0 (1- (length fname)))))
821 (put cname 'class-location fname)))
822
823 ;; We have a list of custom groups. Store them into the options.
824 (let ((g (class-option-assoc options :custom-groups)))
825 (mapc (lambda (cg) (add-to-list 'g cg)) groups)
826 (if (memq :custom-groups options)
827 (setcar (cdr (memq :custom-groups options)) g)
828 (setq options (cons :custom-groups (cons g options)))))
829
830 ;; Set up the options we have collected.
831 (setf (eieio--class-options newc) options)
832
833 ;; if this is a superclass, clear out parent (which was set to the
834 ;; default superclass eieio-default-superclass)
835 (if clearparent (setf (eieio--class-parent newc) nil))
836
837 ;; Create the cached default object.
838 (let ((cache (make-vector (+ (length (eieio--class-public-a newc)) 3)
839 nil)))
840 (aset cache 0 'object)
841 (setf (eieio--object-class cache) cname)
842 (setf (eieio--object-name cache) 'default-cache-object)
843 (let ((eieio-skip-typecheck t))
844 ;; All type-checking has been done to our satisfaction
845 ;; before this call. Don't waste our time in this call..
846 (eieio-set-defaults cache t))
847 (setf (eieio--class-default-object-cache newc) cache))
848
849 ;; Return our new class object
850 ;; newc
851 cname
852 ))
853 119
854(defun eieio-perform-slot-validation-for-default (slot spec value skipnil)
855 "For SLOT, signal if SPEC does not match VALUE.
856If SKIPNIL is non-nil, then if VALUE is nil return t instead."
857 (if (and (not (eieio-eval-default-p value))
858 (not eieio-skip-typecheck)
859 (not (and skipnil (null value)))
860 (not (eieio-perform-slot-validation spec value)))
861 (signal 'invalid-slot-type (list slot spec value))))
862
863(defun eieio-add-new-slot (newc a d doc type cust label custg print prot init alloc
864 &optional defaultoverride skipnil)
865 "Add into NEWC attribute A.
866If A already exists in NEWC, then do nothing. If it doesn't exist,
867then also add in D (default), DOC, TYPE, CUST, LABEL, CUSTG, PRINT, PROT, and INIT arg.
868Argument ALLOC specifies if the slot is allocated per instance, or per class.
869If optional DEFAULTOVERRIDE is non-nil, then if A exists in NEWC,
870we must override its value for a default.
871Optional argument SKIPNIL indicates if type checking should be skipped
872if default value is nil."
873 ;; Make sure we duplicate those items that are sequences.
874 (condition-case nil
875 (if (sequencep d) (setq d (copy-sequence d)))
876 ;; This copy can fail on a cons cell with a non-cons in the cdr. Let's skip it if it doesn't work.
877 (error nil))
878 (if (sequencep type) (setq type (copy-sequence type)))
879 (if (sequencep cust) (setq cust (copy-sequence cust)))
880 (if (sequencep custg) (setq custg (copy-sequence custg)))
881
882 ;; To prevent override information w/out specification of storage,
883 ;; we need to do this little hack.
884 (if (member a (eieio--class-class-allocation-a newc)) (setq alloc ':class))
885
886 (if (or (not alloc) (and (symbolp alloc) (eq alloc ':instance)))
887 ;; In this case, we modify the INSTANCE version of a given slot.
888
889 (progn
890
891 ;; Only add this element if it is so-far unique
892 (if (not (member a (eieio--class-public-a newc)))
893 (progn
894 (eieio-perform-slot-validation-for-default a type d skipnil)
895 (setf (eieio--class-public-a newc) (cons a (eieio--class-public-a newc)))
896 (setf (eieio--class-public-d newc) (cons d (eieio--class-public-d newc)))
897 (setf (eieio--class-public-doc newc) (cons doc (eieio--class-public-doc newc)))
898 (setf (eieio--class-public-type newc) (cons type (eieio--class-public-type newc)))
899 (setf (eieio--class-public-custom newc) (cons cust (eieio--class-public-custom newc)))
900 (setf (eieio--class-public-custom-label newc) (cons label (eieio--class-public-custom-label newc)))
901 (setf (eieio--class-public-custom-group newc) (cons custg (eieio--class-public-custom-group newc)))
902 (setf (eieio--class-public-printer newc) (cons print (eieio--class-public-printer newc)))
903 (setf (eieio--class-protection newc) (cons prot (eieio--class-protection newc)))
904 (setf (eieio--class-initarg-tuples newc) (cons (cons init a) (eieio--class-initarg-tuples newc)))
905 )
906 ;; When defaultoverride is true, we are usually adding new local
907 ;; attributes which must override the default value of any slot
908 ;; passed in by one of the parent classes.
909 (when defaultoverride
910 ;; There is a match, and we must override the old value.
911 (let* ((ca (eieio--class-public-a newc))
912 (np (member a ca))
913 (num (- (length ca) (length np)))
914 (dp (if np (nthcdr num (eieio--class-public-d newc))
915 nil))
916 (tp (if np (nth num (eieio--class-public-type newc))))
917 )
918 (if (not np)
919 (error "EIEIO internal error overriding default value for %s"
920 a)
921 ;; If type is passed in, is it the same?
922 (if (not (eq type t))
923 (if (not (equal type tp))
924 (error
925 "Child slot type `%s' does not match inherited type `%s' for `%s'"
926 type tp a)))
927 ;; If we have a repeat, only update the initarg...
928 (unless (eq d eieio-unbound)
929 (eieio-perform-slot-validation-for-default a tp d skipnil)
930 (setcar dp d))
931 ;; If we have a new initarg, check for it.
932 (when init
933 (let* ((inits (eieio--class-initarg-tuples newc))
934 (inita (rassq a inits)))
935 ;; Replace the CAR of the associate INITA.
936 ;;(message "Initarg: %S replace %s" inita init)
937 (setcar inita init)
938 ))
939
940 ;; PLN Tue Jun 26 11:57:06 2007 : The protection is
941 ;; checked and SHOULD match the superclass
942 ;; protection. Otherwise an error is thrown. However
943 ;; I wonder if a more flexible schedule might be
944 ;; implemented.
945 ;;
946 ;; EML - We used to have (if prot... here,
947 ;; but a prot of 'nil means public.
948 ;;
949 (let ((super-prot (nth num (eieio--class-protection newc)))
950 )
951 (if (not (eq prot super-prot))
952 (error "Child slot protection `%s' does not match inherited protection `%s' for `%s'"
953 prot super-prot a)))
954 ;; End original PLN
955
956 ;; PLN Tue Jun 26 11:57:06 2007 :
957 ;; Do a non redundant combination of ancient custom
958 ;; groups and new ones.
959 (when custg
960 (let* ((groups
961 (nthcdr num (eieio--class-public-custom-group newc)))
962 (list1 (car groups))
963 (list2 (if (listp custg) custg (list custg))))
964 (if (< (length list1) (length list2))
965 (setq list1 (prog1 list2 (setq list2 list1))))
966 (dolist (elt list2)
967 (unless (memq elt list1)
968 (push elt list1)))
969 (setcar groups list1)))
970 ;; End PLN
971
972 ;; PLN Mon Jun 25 22:44:34 2007 : If a new cust is
973 ;; set, simply replaces the old one.
974 (when cust
975 ;; (message "Custom type redefined to %s" cust)
976 (setcar (nthcdr num (eieio--class-public-custom newc)) cust))
977
978 ;; If a new label is specified, it simply replaces
979 ;; the old one.
980 (when label
981 ;; (message "Custom label redefined to %s" label)
982 (setcar (nthcdr num (eieio--class-public-custom-label newc)) label))
983 ;; End PLN
984
985 ;; PLN Sat Jun 30 17:24:42 2007 : when a new
986 ;; doc is specified, simply replaces the old one.
987 (when doc
988 ;;(message "Documentation redefined to %s" doc)
989 (setcar (nthcdr num (eieio--class-public-doc newc))
990 doc))
991 ;; End PLN
992
993 ;; If a new printer is specified, it simply replaces
994 ;; the old one.
995 (when print
996 ;; (message "printer redefined to %s" print)
997 (setcar (nthcdr num (eieio--class-public-printer newc)) print))
998
999 )))
1000 ))
1001
1002 ;; CLASS ALLOCATED SLOTS
1003 (let ((value (eieio-default-eval-maybe d)))
1004 (if (not (member a (eieio--class-class-allocation-a newc)))
1005 (progn
1006 (eieio-perform-slot-validation-for-default a type value skipnil)
1007 ;; Here we have found a :class version of a slot. This
1008 ;; requires a very different approach.
1009 (setf (eieio--class-class-allocation-a newc) (cons a (eieio--class-class-allocation-a newc)))
1010 (setf (eieio--class-class-allocation-doc newc) (cons doc (eieio--class-class-allocation-doc newc)))
1011 (setf (eieio--class-class-allocation-type newc) (cons type (eieio--class-class-allocation-type newc)))
1012 (setf (eieio--class-class-allocation-custom newc) (cons cust (eieio--class-class-allocation-custom newc)))
1013 (setf (eieio--class-class-allocation-custom-label newc) (cons label (eieio--class-class-allocation-custom-label newc)))
1014 (setf (eieio--class-class-allocation-custom-group newc) (cons custg (eieio--class-class-allocation-custom-group newc)))
1015 (setf (eieio--class-class-allocation-protection newc) (cons prot (eieio--class-class-allocation-protection newc)))
1016 ;; Default value is stored in the 'values section, since new objects
1017 ;; can't initialize from this element.
1018 (setf (eieio--class-class-allocation-values newc) (cons value (eieio--class-class-allocation-values newc))))
1019 (when defaultoverride
1020 ;; There is a match, and we must override the old value.
1021 (let* ((ca (eieio--class-class-allocation-a newc))
1022 (np (member a ca))
1023 (num (- (length ca) (length np)))
1024 (dp (if np
1025 (nthcdr num
1026 (eieio--class-class-allocation-values newc))
1027 nil))
1028 (tp (if np (nth num (eieio--class-class-allocation-type newc))
1029 nil)))
1030 (if (not np)
1031 (error "EIEIO internal error overriding default value for %s"
1032 a)
1033 ;; If type is passed in, is it the same?
1034 (if (not (eq type t))
1035 (if (not (equal type tp))
1036 (error
1037 "Child slot type `%s' does not match inherited type `%s' for `%s'"
1038 type tp a)))
1039 ;; EML - Note: the only reason to override a class bound slot
1040 ;; is to change the default, so allow unbound in.
1041
1042 ;; If we have a repeat, only update the value...
1043 (eieio-perform-slot-validation-for-default a tp value skipnil)
1044 (setcar dp value))
1045
1046 ;; PLN Tue Jun 26 11:57:06 2007 : The protection is
1047 ;; checked and SHOULD match the superclass
1048 ;; protection. Otherwise an error is thrown. However
1049 ;; I wonder if a more flexible schedule might be
1050 ;; implemented.
1051 (let ((super-prot
1052 (car (nthcdr num (eieio--class-class-allocation-protection newc)))))
1053 (if (not (eq prot super-prot))
1054 (error "Child slot protection `%s' does not match inherited protection `%s' for `%s'"
1055 prot super-prot a)))
1056 ;; Do a non redundant combination of ancient custom groups
1057 ;; and new ones.
1058 (when custg
1059 (let* ((groups
1060 (nthcdr num (eieio--class-class-allocation-custom-group newc)))
1061 (list1 (car groups))
1062 (list2 (if (listp custg) custg (list custg))))
1063 (if (< (length list1) (length list2))
1064 (setq list1 (prog1 list2 (setq list2 list1))))
1065 (dolist (elt list2)
1066 (unless (memq elt list1)
1067 (push elt list1)))
1068 (setcar groups list1)))
1069
1070 ;; PLN Sat Jun 30 17:24:42 2007 : when a new
1071 ;; doc is specified, simply replaces the old one.
1072 (when doc
1073 ;;(message "Documentation redefined to %s" doc)
1074 (setcar (nthcdr num (eieio--class-class-allocation-doc newc))
1075 doc))
1076 ;; End PLN
1077
1078 ;; If a new printer is specified, it simply replaces
1079 ;; the old one.
1080 (when print
1081 ;; (message "printer redefined to %s" print)
1082 (setcar (nthcdr num (eieio--class-class-allocation-printer newc)) print))
1083
1084 ))
1085 ))
1086 ))
1087
1088(defun eieio-copy-parents-into-subclass (newc parents)
1089 "Copy into NEWC the slots of PARENTS.
1090Follow the rules of not overwriting early parents when applying to
1091the new child class."
1092 (let ((ps (eieio--class-parent newc))
1093 (sn (class-option-assoc (eieio--class-options newc)
1094 ':allow-nil-initform)))
1095 (while ps
1096 ;; First, duplicate all the slots of the parent.
1097 (let ((pcv (class-v (car ps))))
1098 (let ((pa (eieio--class-public-a pcv))
1099 (pd (eieio--class-public-d pcv))
1100 (pdoc (eieio--class-public-doc pcv))
1101 (ptype (eieio--class-public-type pcv))
1102 (pcust (eieio--class-public-custom pcv))
1103 (plabel (eieio--class-public-custom-label pcv))
1104 (pcustg (eieio--class-public-custom-group pcv))
1105 (printer (eieio--class-public-printer pcv))
1106 (pprot (eieio--class-protection pcv))
1107 (pinit (eieio--class-initarg-tuples pcv))
1108 (i 0))
1109 (while pa
1110 (eieio-add-new-slot newc
1111 (car pa) (car pd) (car pdoc) (aref ptype i)
1112 (car pcust) (car plabel) (car pcustg)
1113 (car printer)
1114 (car pprot) (car-safe (car pinit)) nil nil sn)
1115 ;; Increment each value.
1116 (setq pa (cdr pa)
1117 pd (cdr pd)
1118 pdoc (cdr pdoc)
1119 i (1+ i)
1120 pcust (cdr pcust)
1121 plabel (cdr plabel)
1122 pcustg (cdr pcustg)
1123 printer (cdr printer)
1124 pprot (cdr pprot)
1125 pinit (cdr pinit))
1126 )) ;; while/let
1127 ;; Now duplicate all the class alloc slots.
1128 (let ((pa (eieio--class-class-allocation-a pcv))
1129 (pdoc (eieio--class-class-allocation-doc pcv))
1130 (ptype (eieio--class-class-allocation-type pcv))
1131 (pcust (eieio--class-class-allocation-custom pcv))
1132 (plabel (eieio--class-class-allocation-custom-label pcv))
1133 (pcustg (eieio--class-class-allocation-custom-group pcv))
1134 (printer (eieio--class-class-allocation-printer pcv))
1135 (pprot (eieio--class-class-allocation-protection pcv))
1136 (pval (eieio--class-class-allocation-values pcv))
1137 (i 0))
1138 (while pa
1139 (eieio-add-new-slot newc
1140 (car pa) (aref pval i) (car pdoc) (aref ptype i)
1141 (car pcust) (car plabel) (car pcustg)
1142 (car printer)
1143 (car pprot) nil ':class sn)
1144 ;; Increment each value.
1145 (setq pa (cdr pa)
1146 pdoc (cdr pdoc)
1147 pcust (cdr pcust)
1148 plabel (cdr plabel)
1149 pcustg (cdr pcustg)
1150 printer (cdr printer)
1151 pprot (cdr pprot)
1152 i (1+ i))
1153 ))) ;; while/let
1154 ;; Loop over each parent class
1155 (setq ps (cdr ps)))
1156 ))
1157 120
1158;;; CLOS style implementation of object creators. 121;;; CLOS style implementation of object creators.
1159;; 122;;
@@ -1187,17 +150,6 @@ a string."
1187 150
1188;;; CLOS methods and generics 151;;; CLOS methods and generics
1189;; 152;;
1190
1191(put 'eieio--defalias 'byte-hunk-handler
1192 #'byte-compile-file-form-defalias) ;;(get 'defalias 'byte-hunk-handler)
1193(defun eieio--defalias (name body)
1194 "Like `defalias', but with less side-effects.
1195More specifically, it has no side-effects at all when the new function
1196definition is the same (`eq') as the old one."
1197 (unless (and (fboundp name)
1198 (eq (symbol-function name) body))
1199 (defalias name body)))
1200
1201(defmacro defgeneric (method args &optional doc-string) 153(defmacro defgeneric (method args &optional doc-string)
1202 "Create a generic function METHOD. 154 "Create a generic function METHOD.
1203DOC-STRING is the base documentation for this class. A generic 155DOC-STRING is the base documentation for this class. A generic
@@ -1209,115 +161,6 @@ top level documentation to a method."
1209 `(eieio--defalias ',method 161 `(eieio--defalias ',method
1210 (eieio--defgeneric-init-form ',method ,doc-string))) 162 (eieio--defgeneric-init-form ',method ,doc-string)))
1211 163
1212(defun eieio--defgeneric-init-form (method doc-string)
1213 "Form to use for the initial definition of a generic."
1214 (cond
1215 ((or (not (fboundp method))
1216 (eq 'autoload (car-safe (symbol-function method))))
1217 ;; Make sure the method tables are installed.
1218 (eieiomt-install method)
1219 ;; Construct the actual body of this function.
1220 (eieio-defgeneric-form method doc-string))
1221 ((generic-p method) (symbol-function method)) ;Leave it as-is.
1222 (t (error "You cannot create a generic/method over an existing symbol: %s"
1223 method))))
1224
1225(defun eieio-defgeneric-form (method doc-string)
1226 "The lambda form that would be used as the function defined on METHOD.
1227All methods should call the same EIEIO function for dispatch.
1228DOC-STRING is the documentation attached to METHOD."
1229 `(lambda (&rest local-args)
1230 ,doc-string
1231 (eieio-generic-call (quote ,method) local-args)))
1232
1233(defsubst eieio-defgeneric-reset-generic-form (method)
1234 "Setup METHOD to call the generic form."
1235 (let ((doc-string (documentation method)))
1236 (fset method (eieio-defgeneric-form method doc-string))))
1237
1238(defun eieio-defgeneric-form-primary-only (method doc-string)
1239 "The lambda form that would be used as the function defined on METHOD.
1240All methods should call the same EIEIO function for dispatch.
1241DOC-STRING is the documentation attached to METHOD."
1242 `(lambda (&rest local-args)
1243 ,doc-string
1244 (eieio-generic-call-primary-only (quote ,method) local-args)))
1245
1246(defsubst eieio-defgeneric-reset-generic-form-primary-only (method)
1247 "Setup METHOD to call the generic form."
1248 (let ((doc-string (documentation method)))
1249 (fset method (eieio-defgeneric-form-primary-only method doc-string))))
1250
1251(defun eieio-defgeneric-form-primary-only-one (method doc-string
1252 class
1253 impl
1254 )
1255 "The lambda form that would be used as the function defined on METHOD.
1256All methods should call the same EIEIO function for dispatch.
1257DOC-STRING is the documentation attached to METHOD.
1258CLASS is the class symbol needed for private method access.
1259IMPL is the symbol holding the method implementation."
1260 ;; NOTE: I tried out byte compiling this little fcn. Turns out it
1261 ;; is faster to execute this for not byte-compiled. ie, install this,
1262 ;; then measure calls going through here. I wonder why.
1263 (require 'bytecomp)
1264 (let ((byte-compile-warnings nil))
1265 (byte-compile
1266 `(lambda (&rest local-args)
1267 ,doc-string
1268 ;; This is a cool cheat. Usually we need to look up in the
1269 ;; method table to find out if there is a method or not. We can
1270 ;; instead make that determination at load time when there is
1271 ;; only one method. If the first arg is not a child of the class
1272 ;; of that one implementation, then clearly, there is no method def.
1273 (if (not (eieio-object-p (car local-args)))
1274 ;; Not an object. Just signal.
1275 (signal 'no-method-definition
1276 (list ',method local-args))
1277
1278 ;; We do have an object. Make sure it is the right type.
1279 (if ,(if (eq class eieio-default-superclass)
1280 nil ; default superclass means just an obj. Already asked.
1281 `(not (child-of-class-p (eieio--object-class (car local-args))
1282 ',class)))
1283
1284 ;; If not the right kind of object, call no applicable
1285 (apply 'no-applicable-method (car local-args)
1286 ',method local-args)
1287
1288 ;; It is ok, do the call.
1289 ;; Fill in inter-call variables then evaluate the method.
1290 (let ((scoped-class ',class)
1291 (eieio-generic-call-next-method-list nil)
1292 (eieio-generic-call-key method-primary)
1293 (eieio-generic-call-methodname ',method)
1294 (eieio-generic-call-arglst local-args)
1295 )
1296 ,(if (< emacs-major-version 24)
1297 `(apply ,(list 'quote impl) local-args)
1298 `(apply #',impl local-args))
1299 ;(,impl local-args)
1300 )))))))
1301
1302(defsubst eieio-defgeneric-reset-generic-form-primary-only-one (method)
1303 "Setup METHOD to call the generic form."
1304 (let* ((doc-string (documentation method))
1305 (M (get method 'eieio-method-tree))
1306 (entry (car (aref M method-primary)))
1307 )
1308 (fset method (eieio-defgeneric-form-primary-only-one
1309 method doc-string
1310 (car entry)
1311 (cdr entry)
1312 ))))
1313
1314(defun eieio-unbind-method-implementations (method)
1315 "Make the generic method METHOD have no implementations.
1316It will leave the original generic function in place,
1317but remove reference to all implementations of METHOD."
1318 (put method 'eieio-method-tree nil)
1319 (put method 'eieio-method-obarray nil))
1320
1321(defmacro defmethod (method &rest args) 164(defmacro defmethod (method &rest args)
1322 "Create a new METHOD through `defgeneric' with ARGS. 165 "Create a new METHOD through `defgeneric' with ARGS.
1323 166
@@ -1358,139 +201,6 @@ Summary:
1358 (format "Generically created method `%s'." method))) 201 (format "Generically created method `%s'." method)))
1359 (eieio--defmethod ',method ',key ',class #',code)))) 202 (eieio--defmethod ',method ',key ',class #',code))))
1360 203
1361(defun eieio--defmethod (method kind argclass code)
1362 "Work part of the `defmethod' macro defining METHOD with ARGS."
1363 (let ((key
1364 ;; Find optional keys.
1365 (cond ((memq kind '(:BEFORE :before)) method-before)
1366 ((memq kind '(:AFTER :after)) method-after)
1367 ((memq kind '(:STATIC :static)) method-static)
1368 ((memq kind '(:PRIMARY :primary nil)) method-primary)
1369 ;; Primary key.
1370 ;; (t method-primary)
1371 (t (error "Unknown method kind %S" kind)))))
1372 ;; Make sure there is a generic (when called from defclass).
1373 (eieio--defalias
1374 method (eieio--defgeneric-init-form
1375 method (or (documentation code)
1376 (format "Generically created method `%s'." method))))
1377 ;; Create symbol for property to bind to. If the first arg is of
1378 ;; the form (varname vartype) and `vartype' is a class, then
1379 ;; that class will be the type symbol. If not, then it will fall
1380 ;; under the type `primary' which is a non-specific calling of the
1381 ;; function.
1382 (if argclass
1383 (if (not (class-p argclass))
1384 (error "Unknown class type %s in method parameters"
1385 argclass))
1386 ;; Generics are higher.
1387 (setq key (eieio-specialized-key-to-generic-key key)))
1388 ;; Put this lambda into the symbol so we can find it.
1389 (eieiomt-add method code key argclass)
1390 )
1391
1392 (when eieio-optimize-primary-methods-flag
1393 ;; Optimizing step:
1394 ;;
1395 ;; If this method, after this setup, only has primary methods, then
1396 ;; we can setup the generic that way.
1397 (if (generic-primary-only-p method)
1398 ;; If there is only one primary method, then we can go one more
1399 ;; optimization step.
1400 (if (generic-primary-only-one-p method)
1401 (eieio-defgeneric-reset-generic-form-primary-only-one method)
1402 (eieio-defgeneric-reset-generic-form-primary-only method))
1403 (eieio-defgeneric-reset-generic-form method)))
1404
1405 method)
1406
1407;;; Slot type validation
1408
1409;; This is a hideous hack for replacing `typep' from cl-macs, to avoid
1410;; requiring the CL library at run-time. It can be eliminated if/when
1411;; `typep' is merged into Emacs core.
1412(defun eieio--typep (val type)
1413 (if (symbolp type)
1414 (cond ((get type 'cl-deftype-handler)
1415 (eieio--typep val (funcall (get type 'cl-deftype-handler))))
1416 ((eq type t) t)
1417 ((eq type 'null) (null val))
1418 ((eq type 'atom) (atom val))
1419 ((eq type 'float) (and (numberp val) (not (integerp val))))
1420 ((eq type 'real) (numberp val))
1421 ((eq type 'fixnum) (integerp val))
1422 ((memq type '(character string-char)) (characterp val))
1423 (t
1424 (let* ((name (symbol-name type))
1425 (namep (intern (concat name "p"))))
1426 (if (fboundp namep)
1427 (funcall `(lambda () (,namep val)))
1428 (funcall `(lambda ()
1429 (,(intern (concat name "-p")) val)))))))
1430 (cond ((get (car type) 'cl-deftype-handler)
1431 (eieio--typep val (apply (get (car type) 'cl-deftype-handler)
1432 (cdr type))))
1433 ((memq (car type) '(integer float real number))
1434 (and (eieio--typep val (car type))
1435 (or (memq (cadr type) '(* nil))
1436 (if (consp (cadr type))
1437 (> val (car (cadr type)))
1438 (>= val (cadr type))))
1439 (or (memq (caddr type) '(* nil))
1440 (if (consp (car (cddr type)))
1441 (< val (caar (cddr type)))
1442 (<= val (car (cddr type)))))))
1443 ((memq (car type) '(and or not))
1444 (eval (cons (car type)
1445 (mapcar (lambda (x)
1446 `(eieio--typep (quote ,val) (quote ,x)))
1447 (cdr type)))))
1448 ((memq (car type) '(member member*))
1449 (memql val (cdr type)))
1450 ((eq (car type) 'satisfies)
1451 (funcall `(lambda () (,(cadr type) val))))
1452 (t (error "Bad type spec: %s" type)))))
1453
1454(defun eieio-perform-slot-validation (spec value)
1455 "Return non-nil if SPEC does not match VALUE."
1456 (or (eq spec t) ; t always passes
1457 (eq value eieio-unbound) ; unbound always passes
1458 (eieio--typep value spec)))
1459
1460(defun eieio-validate-slot-value (class slot-idx value slot)
1461 "Make sure that for CLASS referencing SLOT-IDX, VALUE is valid.
1462Checks the :type specifier.
1463SLOT is the slot that is being checked, and is only used when throwing
1464an error."
1465 (if eieio-skip-typecheck
1466 nil
1467 ;; Trim off object IDX junk added in for the object index.
1468 (setq slot-idx (- slot-idx 3))
1469 (let ((st (aref (eieio--class-public-type (class-v class)) slot-idx)))
1470 (if (not (eieio-perform-slot-validation st value))
1471 (signal 'invalid-slot-type (list class slot st value))))))
1472
1473(defun eieio-validate-class-slot-value (class slot-idx value slot)
1474 "Make sure that for CLASS referencing SLOT-IDX, VALUE is valid.
1475Checks the :type specifier.
1476SLOT is the slot that is being checked, and is only used when throwing
1477an error."
1478 (if eieio-skip-typecheck
1479 nil
1480 (let ((st (aref (eieio--class-class-allocation-type (class-v class))
1481 slot-idx)))
1482 (if (not (eieio-perform-slot-validation st value))
1483 (signal 'invalid-slot-type (list class slot st value))))))
1484
1485(defun eieio-barf-if-slot-unbound (value instance slotname fn)
1486 "Throw a signal if VALUE is a representation of an UNBOUND slot.
1487INSTANCE is the object being referenced. SLOTNAME is the offending
1488slot. If the slot is ok, return VALUE.
1489Argument FN is the function calling this verifier."
1490 (if (and (eq value eieio-unbound) (not eieio-skip-typecheck))
1491 (slot-unbound instance (eieio-object-class instance) slotname fn)
1492 value))
1493
1494;;; Get/Set slots in an object. 204;;; Get/Set slots in an object.
1495;; 205;;
1496(defmacro oref (obj slot) 206(defmacro oref (obj slot)
@@ -1499,28 +209,6 @@ Slot is the name of the slot when created by `defclass' or the label
1499created by the :initarg tag." 209created by the :initarg tag."
1500 `(eieio-oref ,obj (quote ,slot))) 210 `(eieio-oref ,obj (quote ,slot)))
1501 211
1502(defun eieio-oref (obj slot)
1503 "Return the value in OBJ at SLOT in the object vector."
1504 (eieio--check-type (or eieio-object-p class-p) obj)
1505 (eieio--check-type symbolp slot)
1506 (if (class-p obj) (eieio-class-un-autoload obj))
1507 (let* ((class (if (class-p obj) obj (eieio--object-class obj)))
1508 (c (eieio-slot-name-index class obj slot)))
1509 (if (not c)
1510 ;; It might be missing because it is a :class allocated slot.
1511 ;; Let's check that info out.
1512 (if (setq c (eieio-class-slot-name-index class slot))
1513 ;; Oref that slot.
1514 (aref (eieio--class-class-allocation-values (class-v class)) c)
1515 ;; The slot-missing method is a cool way of allowing an object author
1516 ;; to intercept missing slot definitions. Since it is also the LAST
1517 ;; thing called in this fn, its return value would be retrieved.
1518 (slot-missing obj slot 'oref)
1519 ;;(signal 'invalid-slot-name (list (eieio-object-name obj) slot))
1520 )
1521 (eieio--check-type eieio-object-p obj)
1522 (eieio-barf-if-slot-unbound (aref obj c) obj slot 'oref))))
1523
1524(defalias 'slot-value 'eieio-oref) 212(defalias 'slot-value 'eieio-oref)
1525(defalias 'set-slot-value 'eieio-oset) 213(defalias 'set-slot-value 'eieio-oset)
1526 214
@@ -1531,45 +219,6 @@ tag. SLOT can be the slot name, or the tag specified by the :initarg
1531tag in the `defclass' call." 219tag in the `defclass' call."
1532 `(eieio-oref-default ,obj (quote ,slot))) 220 `(eieio-oref-default ,obj (quote ,slot)))
1533 221
1534(defun eieio-oref-default (obj slot)
1535 "Do the work for the macro `oref-default' with similar parameters.
1536Fills in OBJ's SLOT with its default value."
1537 (eieio--check-type (or eieio-object-p class-p) obj)
1538 (eieio--check-type symbolp slot)
1539 (let* ((cl (if (eieio-object-p obj) (eieio--object-class obj) obj))
1540 (c (eieio-slot-name-index cl obj slot)))
1541 (if (not c)
1542 ;; It might be missing because it is a :class allocated slot.
1543 ;; Let's check that info out.
1544 (if (setq c
1545 (eieio-class-slot-name-index cl slot))
1546 ;; Oref that slot.
1547 (aref (eieio--class-class-allocation-values (class-v cl))
1548 c)
1549 (slot-missing obj slot 'oref-default)
1550 ;;(signal 'invalid-slot-name (list (class-name cl) slot))
1551 )
1552 (eieio-barf-if-slot-unbound
1553 (let ((val (nth (- c 3) (eieio--class-public-d (class-v cl)))))
1554 (eieio-default-eval-maybe val))
1555 obj cl 'oref-default))))
1556
1557(defsubst eieio-eval-default-p (val)
1558 "Whether the default value VAL should be evaluated for use."
1559 (and (consp val) (symbolp (car val)) (fboundp (car val))))
1560
1561(defun eieio-default-eval-maybe (val)
1562 "Check VAL, and return what `oref-default' would provide."
1563 (cond
1564 ;; Is it a function call? If so, evaluate it.
1565 ((eieio-eval-default-p val)
1566 (eval val))
1567 ;;;; check for quoted things, and unquote them
1568 ;;((and (consp val) (eq (car val) 'quote))
1569 ;; (car (cdr val)))
1570 ;; return it verbatim
1571 (t val)))
1572
1573;;; Handy CLOS macros 222;;; Handy CLOS macros
1574;; 223;;
1575(defmacro with-slots (spec-list object &rest body) 224(defmacro with-slots (spec-list object &rest body)
@@ -1607,13 +256,6 @@ variable name of the same name as the slot."
1607(define-obsolete-function-alias 256(define-obsolete-function-alias
1608 'object-class-fast #'eieio--object-class "24.4") 257 'object-class-fast #'eieio--object-class "24.4")
1609 258
1610(defun eieio-class-name (class) "Return a Lisp like symbol name for CLASS."
1611 (eieio--check-type class-p class)
1612 ;; I think this is supposed to return a symbol, but to me CLASS is a symbol,
1613 ;; and I wanted a string. Arg!
1614 (format "#<class %s>" (symbol-name class)))
1615(define-obsolete-function-alias 'class-name #'eieio-class-name "24.4")
1616
1617(defun eieio-object-name (obj &optional extra) 259(defun eieio-object-name (obj &optional extra)
1618 "Return a Lisp like symbol string for object OBJ. 260 "Return a Lisp like symbol string for object OBJ.
1619If EXTRA, include that in the string returned to represent the symbol." 261If EXTRA, include that in the string returned to represent the symbol."
@@ -1650,10 +292,6 @@ If EXTRA, include that in the string returned to represent the symbol."
1650(define-obsolete-function-alias 292(define-obsolete-function-alias
1651 'object-class-name 'eieio-object-class-name "24.4") 293 'object-class-name 'eieio-object-class-name "24.4")
1652 294
1653(defmacro eieio-class-parents-fast (class)
1654 "Return parent classes to CLASS with no check."
1655 `(eieio--class-parent (class-v ,class)))
1656
1657(defun eieio-class-parents (class) 295(defun eieio-class-parents (class)
1658 "Return parent classes to CLASS. (overload of variable). 296 "Return parent classes to CLASS. (overload of variable).
1659 297
@@ -1662,130 +300,14 @@ The CLOS function `class-direct-superclasses' is aliased to this function."
1662 (eieio-class-parents-fast class)) 300 (eieio-class-parents-fast class))
1663(define-obsolete-function-alias 'class-parents #'eieio-class-parents "24.4") 301(define-obsolete-function-alias 'class-parents #'eieio-class-parents "24.4")
1664 302
1665(defmacro eieio-class-children-fast (class) "Return child classes to CLASS with no check."
1666 `(eieio--class-children (class-v ,class)))
1667
1668(defun eieio-class-children (class) 303(defun eieio-class-children (class)
1669 "Return child classes to CLASS. 304 "Return child classes to CLASS.
1670
1671The CLOS function `class-direct-subclasses' is aliased to this function." 305The CLOS function `class-direct-subclasses' is aliased to this function."
1672 (eieio--check-type class-p class) 306 (eieio--check-type class-p class)
1673 (eieio-class-children-fast class)) 307 (eieio-class-children-fast class))
1674(define-obsolete-function-alias 308(define-obsolete-function-alias
1675 'class-children #'eieio-class-children "24.4") 309 'class-children #'eieio-class-children "24.4")
1676 310
1677(defun eieio-c3-candidate (class remaining-inputs)
1678 "Return CLASS if it can go in the result now, otherwise nil"
1679 ;; Ensure CLASS is not in any position but the first in any of the
1680 ;; element lists of REMAINING-INPUTS.
1681 (and (not (let ((found nil))
1682 (while (and remaining-inputs (not found))
1683 (setq found (member class (cdr (car remaining-inputs)))
1684 remaining-inputs (cdr remaining-inputs)))
1685 found))
1686 class))
1687
1688(defun eieio-c3-merge-lists (reversed-partial-result remaining-inputs)
1689 "Merge REVERSED-PARTIAL-RESULT REMAINING-INPUTS in a consistent order, if possible.
1690If a consistent order does not exist, signal an error."
1691 (if (let ((tail remaining-inputs)
1692 (found nil))
1693 (while (and tail (not found))
1694 (setq found (car tail) tail (cdr tail)))
1695 (not found))
1696 ;; If all remaining inputs are empty lists, we are done.
1697 (nreverse reversed-partial-result)
1698 ;; Otherwise, we try to find the next element of the result. This
1699 ;; is achieved by considering the first element of each
1700 ;; (non-empty) input list and accepting a candidate if it is
1701 ;; consistent with the rests of the input lists.
1702 (let* ((found nil)
1703 (tail remaining-inputs)
1704 (next (progn
1705 (while (and tail (not found))
1706 (setq found (and (car tail)
1707 (eieio-c3-candidate (caar tail)
1708 remaining-inputs))
1709 tail (cdr tail)))
1710 found)))
1711 (if next
1712 ;; The graph is consistent so far, add NEXT to result and
1713 ;; merge input lists, dropping NEXT from their heads where
1714 ;; applicable.
1715 (eieio-c3-merge-lists
1716 (cons next reversed-partial-result)
1717 (mapcar (lambda (l) (if (eq (first l) next) (rest l) l))
1718 remaining-inputs))
1719 ;; The graph is inconsistent, give up
1720 (signal 'inconsistent-class-hierarchy (list remaining-inputs))))))
1721
1722(defun eieio-class-precedence-dfs (class)
1723 "Return all parents of CLASS in depth-first order."
1724 (let* ((parents (eieio-class-parents-fast class))
1725 (classes (copy-sequence
1726 (apply #'append
1727 (list class)
1728 (or
1729 (mapcar
1730 (lambda (parent)
1731 (cons parent
1732 (eieio-class-precedence-dfs parent)))
1733 parents)
1734 '((eieio-default-superclass))))))
1735 (tail classes))
1736 ;; Remove duplicates.
1737 (while tail
1738 (setcdr tail (delq (car tail) (cdr tail)))
1739 (setq tail (cdr tail)))
1740 classes))
1741
1742(defun eieio-class-precedence-bfs (class)
1743 "Return all parents of CLASS in breadth-first order."
1744 (let ((result)
1745 (queue (or (eieio-class-parents-fast class)
1746 '(eieio-default-superclass))))
1747 (while queue
1748 (let ((head (pop queue)))
1749 (unless (member head result)
1750 (push head result)
1751 (unless (eq head 'eieio-default-superclass)
1752 (setq queue (append queue (or (eieio-class-parents-fast head)
1753 '(eieio-default-superclass))))))))
1754 (cons class (nreverse result)))
1755 )
1756
1757(defun eieio-class-precedence-c3 (class)
1758 "Return all parents of CLASS in c3 order."
1759 (let ((parents (eieio-class-parents-fast class)))
1760 (eieio-c3-merge-lists
1761 (list class)
1762 (append
1763 (or
1764 (mapcar
1765 (lambda (x)
1766 (eieio-class-precedence-c3 x))
1767 parents)
1768 '((eieio-default-superclass)))
1769 (list parents))))
1770 )
1771
1772(defun eieio-class-precedence-list (class)
1773 "Return (transitively closed) list of parents of CLASS.
1774The order, in which the parents are returned depends on the
1775method invocation orders of the involved classes."
1776 (if (or (null class) (eq class 'eieio-default-superclass))
1777 nil
1778 (case (class-method-invocation-order class)
1779 (:depth-first
1780 (eieio-class-precedence-dfs class))
1781 (:breadth-first
1782 (eieio-class-precedence-bfs class))
1783 (:c3
1784 (eieio-class-precedence-c3 class))))
1785 )
1786(define-obsolete-function-alias
1787 'class-precedence-list 'eieio-class-precedence-list "24.4")
1788
1789;; Official CLOS functions. 311;; Official CLOS functions.
1790(define-obsolete-function-alias 312(define-obsolete-function-alias
1791 'class-direct-superclasses #'eieio-class-parents "24.4") 313 'class-direct-superclasses #'eieio-class-parents "24.4")
@@ -1797,10 +319,6 @@ method invocation orders of the involved classes."
1797 `(car (eieio-class-parents ,class))) 319 `(car (eieio-class-parents ,class)))
1798(define-obsolete-function-alias 'class-parent #'eieio-class-parent "24.4") 320(define-obsolete-function-alias 'class-parent #'eieio-class-parent "24.4")
1799 321
1800(defmacro same-class-fast-p (obj class)
1801 "Return t if OBJ is of class-type CLASS with no error checking."
1802 `(eq (eieio--object-class ,obj) ,class))
1803
1804(defun same-class-p (obj class) "Return t if OBJ is of class-type CLASS." 322(defun same-class-p (obj class) "Return t if OBJ is of class-type CLASS."
1805 (eieio--check-type class-p class) 323 (eieio--check-type class-p class)
1806 (eieio--check-type eieio-object-p obj) 324 (eieio--check-type eieio-object-p obj)
@@ -1848,29 +366,6 @@ SLOT is the slot name as specified in `defclass' or the tag created
1848with in the :initarg slot. VALUE can be any Lisp object." 366with in the :initarg slot. VALUE can be any Lisp object."
1849 `(eieio-oset ,obj (quote ,slot) ,value)) 367 `(eieio-oset ,obj (quote ,slot) ,value))
1850 368
1851(defun eieio-oset (obj slot value)
1852 "Do the work for the macro `oset'.
1853Fills in OBJ's SLOT with VALUE."
1854 (eieio--check-type eieio-object-p obj)
1855 (eieio--check-type symbolp slot)
1856 (let ((c (eieio-slot-name-index (eieio--object-class obj) obj slot)))
1857 (if (not c)
1858 ;; It might be missing because it is a :class allocated slot.
1859 ;; Let's check that info out.
1860 (if (setq c
1861 (eieio-class-slot-name-index (eieio--object-class obj) slot))
1862 ;; Oset that slot.
1863 (progn
1864 (eieio-validate-class-slot-value (eieio--object-class obj) c value slot)
1865 (aset (eieio--class-class-allocation-values (class-v (eieio--object-class obj)))
1866 c value))
1867 ;; See oref for comment on `slot-missing'
1868 (slot-missing obj slot 'oset value)
1869 ;;(signal 'invalid-slot-name (list (eieio-object-name obj) slot))
1870 )
1871 (eieio-validate-slot-value (eieio--object-class obj) c value slot)
1872 (aset obj c value))))
1873
1874(defmacro oset-default (class slot value) 369(defmacro oset-default (class slot value)
1875 "Set the default slot in CLASS for SLOT to VALUE. 370 "Set the default slot in CLASS for SLOT to VALUE.
1876The default value is usually set with the :initform tag during class 371The default value is usually set with the :initform tag during class
@@ -1878,32 +373,6 @@ creation. This allows users to change the default behavior of classes
1878after they are created." 373after they are created."
1879 `(eieio-oset-default ,class (quote ,slot) ,value)) 374 `(eieio-oset-default ,class (quote ,slot) ,value))
1880 375
1881(defun eieio-oset-default (class slot value)
1882 "Do the work for the macro `oset-default'.
1883Fills in the default value in CLASS' in SLOT with VALUE."
1884 (eieio--check-type class-p class)
1885 (eieio--check-type symbolp slot)
1886 (let* ((scoped-class class)
1887 (c (eieio-slot-name-index class nil slot)))
1888 (if (not c)
1889 ;; It might be missing because it is a :class allocated slot.
1890 ;; Let's check that info out.
1891 (if (setq c (eieio-class-slot-name-index class slot))
1892 (progn
1893 ;; Oref that slot.
1894 (eieio-validate-class-slot-value class c value slot)
1895 (aset (eieio--class-class-allocation-values (class-v class)) c
1896 value))
1897 (signal 'invalid-slot-name (list (eieio-class-name class) slot)))
1898 (eieio-validate-slot-value class c value slot)
1899 ;; Set this into the storage for defaults.
1900 (setcar (nthcdr (- c 3) (eieio--class-public-d (class-v class)))
1901 value)
1902 ;; Take the value, and put it into our cache object.
1903 (eieio-oset (eieio--class-default-object-cache (class-v class))
1904 slot value)
1905 )))
1906
1907;;; CLOS queries into classes and slots 376;;; CLOS queries into classes and slots
1908;; 377;;
1909(defun slot-boundp (object slot) 378(defun slot-boundp (object slot)
@@ -2019,337 +488,9 @@ If SLOT is unbound, do nothing."
2019 (if (not (slot-boundp object slot)) 488 (if (not (slot-boundp object slot))
2020 nil 489 nil
2021 (eieio-oset object slot (delete item (eieio-oref object slot))))) 490 (eieio-oset object slot (delete item (eieio-oref object slot)))))
2022
2023;;; EIEIO internal search functions
2024;;
2025(defun eieio-slot-originating-class-p (start-class slot)
2026 "Return non-nil if START-CLASS is the first class to define SLOT.
2027This is for testing if `scoped-class' is the class that defines SLOT
2028so that we can protect private slots."
2029 (let ((par (eieio-class-parents start-class))
2030 (ret t))
2031 (if (not par)
2032 t
2033 (while (and par ret)
2034 (if (intern-soft (symbol-name slot)
2035 (eieio--class-symbol-obarray (class-v (car par))))
2036 (setq ret nil))
2037 (setq par (cdr par)))
2038 ret)))
2039
2040(defun eieio-slot-name-index (class obj slot)
2041 "In CLASS for OBJ find the index of the named SLOT.
2042The slot is a symbol which is installed in CLASS by the `defclass'
2043call. OBJ can be nil, but if it is an object, and the slot in question
2044is protected, access will be allowed if OBJ is a child of the currently
2045`scoped-class'.
2046If SLOT is the value created with :initarg instead,
2047reverse-lookup that name, and recurse with the associated slot value."
2048 ;; Removed checks to outside this call
2049 (let* ((fsym (intern-soft (symbol-name slot)
2050 (eieio--class-symbol-obarray (class-v class))))
2051 (fsi (if (symbolp fsym) (symbol-value fsym) nil)))
2052 (if (integerp fsi)
2053 (cond
2054 ((not (get fsym 'protection))
2055 (+ 3 fsi))
2056 ((and (eq (get fsym 'protection) 'protected)
2057 (bound-and-true-p scoped-class)
2058 (or (child-of-class-p class scoped-class)
2059 (and (eieio-object-p obj)
2060 (child-of-class-p class (eieio-object-class obj)))))
2061 (+ 3 fsi))
2062 ((and (eq (get fsym 'protection) 'private)
2063 (or (and (bound-and-true-p scoped-class)
2064 (eieio-slot-originating-class-p scoped-class slot))
2065 eieio-initializing-object))
2066 (+ 3 fsi))
2067 (t nil))
2068 (let ((fn (eieio-initarg-to-attribute class slot)))
2069 (if fn (eieio-slot-name-index class obj fn) nil)))))
2070
2071(defun eieio-class-slot-name-index (class slot)
2072 "In CLASS find the index of the named SLOT.
2073The slot is a symbol which is installed in CLASS by the `defclass'
2074call. If SLOT is the value created with :initarg instead,
2075reverse-lookup that name, and recurse with the associated slot value."
2076 ;; This will happen less often, and with fewer slots. Do this the
2077 ;; storage cheap way.
2078 (let* ((a (eieio--class-class-allocation-a (class-v class)))
2079 (l1 (length a))
2080 (af (memq slot a))
2081 (l2 (length af)))
2082 ;; Slot # is length of the total list, minus the remaining list of
2083 ;; the found slot.
2084 (if af (- l1 l2))))
2085
2086;;; CLOS generics internal function handling
2087;;
2088(defvar eieio-generic-call-methodname nil
2089 "When using `call-next-method', provides a context on how to do it.")
2090(defvar eieio-generic-call-arglst nil
2091 "When using `call-next-method', provides a context for parameters.")
2092(defvar eieio-generic-call-key nil
2093 "When using `call-next-method', provides a context for the current key.
2094Keys are a number representing :before, :primary, and :after methods.")
2095(defvar eieio-generic-call-next-method-list nil
2096 "When executing a PRIMARY or STATIC method, track the 'next-method'.
2097During executions, the list is first generated, then as each next method
2098is called, the next method is popped off the stack.")
2099
2100(define-obsolete-variable-alias 'eieio-pre-method-execution-hooks
2101 'eieio-pre-method-execution-functions "24.3")
2102(defvar eieio-pre-method-execution-functions nil
2103 "Abnormal hook run just before an EIEIO method is executed.
2104The hook function must accept one argument, the list of forms
2105about to be executed.")
2106
2107(defun eieio-generic-call (method args)
2108 "Call METHOD with ARGS.
2109ARGS provides the context on which implementation to use.
2110This should only be called from a generic function."
2111 ;; We must expand our arguments first as they are always
2112 ;; passed in as quoted symbols
2113 (let ((newargs nil) (mclass nil) (lambdas nil) (tlambdas nil) (keys nil)
2114 (eieio-generic-call-methodname method)
2115 (eieio-generic-call-arglst args)
2116 (firstarg nil)
2117 (primarymethodlist nil))
2118 ;; get a copy
2119 (setq newargs args
2120 firstarg (car newargs))
2121 ;; Is the class passed in autoloaded?
2122 ;; Since class names are also constructors, they can be autoloaded
2123 ;; via the autoload command. Check for this, and load them in.
2124 ;; It's ok if it doesn't turn out to be a class. Probably want that
2125 ;; function loaded anyway.
2126 (if (and (symbolp firstarg)
2127 (fboundp firstarg)
2128 (listp (symbol-function firstarg))
2129 (eq 'autoload (car (symbol-function firstarg))))
2130 (load (nth 1 (symbol-function firstarg))))
2131 ;; Determine the class to use.
2132 (cond ((eieio-object-p firstarg)
2133 (setq mclass (eieio--object-class firstarg)))
2134 ((class-p firstarg)
2135 (setq mclass firstarg))
2136 )
2137 ;; Make sure the class is a valid class
2138 ;; mclass can be nil (meaning a generic for should be used.
2139 ;; mclass cannot have a value that is not a class, however.
2140 (when (and (not (null mclass)) (not (class-p mclass)))
2141 (error "Cannot dispatch method %S on class %S"
2142 method mclass)
2143 )
2144 ;; Now create a list in reverse order of all the calls we have
2145 ;; make in order to successfully do this right. Rules:
2146 ;; 1) Only call generics if scoped-class is not defined
2147 ;; This prevents multiple calls in the case of recursion
2148 ;; 2) Only call static if this is a static method.
2149 ;; 3) Only call specifics if the definition allows for them.
2150 ;; 4) Call in order based on :before, :primary, and :after
2151 (when (eieio-object-p firstarg)
2152 ;; Non-static calls do all this stuff.
2153
2154 ;; :after methods
2155 (setq tlambdas
2156 (if mclass
2157 (eieiomt-method-list method method-after mclass)
2158 (list (eieio-generic-form method method-after nil)))
2159 ;;(or (and mclass (eieio-generic-form method method-after mclass))
2160 ;; (eieio-generic-form method method-after nil))
2161 )
2162 (setq lambdas (append tlambdas lambdas)
2163 keys (append (make-list (length tlambdas) method-after) keys))
2164
2165 ;; :primary methods
2166 (setq tlambdas
2167 (or (and mclass (eieio-generic-form method method-primary mclass))
2168 (eieio-generic-form method method-primary nil)))
2169 (when tlambdas
2170 (setq lambdas (cons tlambdas lambdas)
2171 keys (cons method-primary keys)
2172 primarymethodlist
2173 (eieiomt-method-list method method-primary mclass)))
2174
2175 ;; :before methods
2176 (setq tlambdas
2177 (if mclass
2178 (eieiomt-method-list method method-before mclass)
2179 (list (eieio-generic-form method method-before nil)))
2180 ;;(or (and mclass (eieio-generic-form method method-before mclass))
2181 ;; (eieio-generic-form method method-before nil))
2182 )
2183 (setq lambdas (append tlambdas lambdas)
2184 keys (append (make-list (length tlambdas) method-before) keys))
2185 )
2186
2187 (if mclass
2188 ;; For the case of a class,
2189 ;; if there were no methods found, then there could be :static methods.
2190 (when (not lambdas)
2191 (setq tlambdas
2192 (eieio-generic-form method method-static mclass))
2193 (setq lambdas (cons tlambdas lambdas)
2194 keys (cons method-static keys)
2195 primarymethodlist ;; Re-use even with bad name here
2196 (eieiomt-method-list method method-static mclass)))
2197 ;; For the case of no class (ie - mclass == nil) then there may
2198 ;; be a primary method.
2199 (setq tlambdas
2200 (eieio-generic-form method method-primary nil))
2201 (when tlambdas
2202 (setq lambdas (cons tlambdas lambdas)
2203 keys (cons method-primary keys)
2204 primarymethodlist
2205 (eieiomt-method-list method method-primary nil)))
2206 )
2207
2208 (run-hook-with-args 'eieio-pre-method-execution-functions
2209 primarymethodlist)
2210
2211 ;; Now loop through all occurrences forms which we must execute
2212 ;; (which are happily sorted now) and execute them all!
2213 (let ((rval nil) (lastval nil) (rvalever nil) (found nil))
2214 (while lambdas
2215 (if (car lambdas)
2216 (let* ((scoped-class (cdr (car lambdas)))
2217 (eieio-generic-call-key (car keys))
2218 (has-return-val
2219 (or (= eieio-generic-call-key method-primary)
2220 (= eieio-generic-call-key method-static)))
2221 (eieio-generic-call-next-method-list
2222 ;; Use the cdr, as the first element is the fcn
2223 ;; we are calling right now.
2224 (when has-return-val (cdr primarymethodlist)))
2225 )
2226 (setq found t)
2227 ;;(setq rval (apply (car (car lambdas)) newargs))
2228 (setq lastval (apply (car (car lambdas)) newargs))
2229 (when has-return-val
2230 (setq rval lastval
2231 rvalever t))
2232 ))
2233 (setq lambdas (cdr lambdas)
2234 keys (cdr keys)))
2235 (if (not found)
2236 (if (eieio-object-p (car args))
2237 (setq rval (apply 'no-applicable-method (car args) method args)
2238 rvalever t)
2239 (signal
2240 'no-method-definition
2241 (list method args))))
2242 ;; Right Here... it could be that lastval is returned when
2243 ;; rvalever is nil. Is that right?
2244 rval)))
2245
2246(defun eieio-generic-call-primary-only (method args)
2247 "Call METHOD with ARGS for methods with only :PRIMARY implementations.
2248ARGS provides the context on which implementation to use.
2249This should only be called from a generic function.
2250
2251This method is like `eieio-generic-call', but only
2252implementations in the :PRIMARY slot are queried. After many
2253years of use, it appears that over 90% of methods in use
2254have :PRIMARY implementations only. We can therefore optimize
2255for this common case to improve performance."
2256 ;; We must expand our arguments first as they are always
2257 ;; passed in as quoted symbols
2258 (let ((newargs nil) (mclass nil) (lambdas nil)
2259 (eieio-generic-call-methodname method)
2260 (eieio-generic-call-arglst args)
2261 (firstarg nil)
2262 (primarymethodlist nil)
2263 )
2264 ;; get a copy
2265 (setq newargs args
2266 firstarg (car newargs))
2267
2268 ;; Determine the class to use.
2269 (cond ((eieio-object-p firstarg)
2270 (setq mclass (eieio--object-class firstarg)))
2271 ((not firstarg)
2272 (error "Method %s called on nil" method))
2273 ((not (eieio-object-p firstarg))
2274 (error "Primary-only method %s called on something not an object" method))
2275 (t
2276 (error "EIEIO Error: Improperly classified method %s as primary only"
2277 method)
2278 ))
2279 ;; Make sure the class is a valid class
2280 ;; mclass can be nil (meaning a generic for should be used.
2281 ;; mclass cannot have a value that is not a class, however.
2282 (when (null mclass)
2283 (error "Cannot dispatch method %S on class %S" method mclass)
2284 )
2285
2286 ;; :primary methods
2287 (setq lambdas (eieio-generic-form method method-primary mclass))
2288 (setq primarymethodlist ;; Re-use even with bad name here
2289 (eieiomt-method-list method method-primary mclass))
2290
2291 ;; Now loop through all occurrences forms which we must execute
2292 ;; (which are happily sorted now) and execute them all!
2293 (let* ((rval nil) (lastval nil) (rvalever nil)
2294 (scoped-class (cdr lambdas))
2295 (eieio-generic-call-key method-primary)
2296 ;; Use the cdr, as the first element is the fcn
2297 ;; we are calling right now.
2298 (eieio-generic-call-next-method-list (cdr primarymethodlist))
2299 )
2300
2301 (if (or (not lambdas) (not (car lambdas)))
2302
2303 ;; No methods found for this impl...
2304 (if (eieio-object-p (car args))
2305 (setq rval (apply 'no-applicable-method (car args) method args)
2306 rvalever t)
2307 (signal
2308 'no-method-definition
2309 (list method args)))
2310
2311 ;; Do the regular implementation here.
2312
2313 (run-hook-with-args 'eieio-pre-method-execution-functions
2314 lambdas)
2315
2316 (setq lastval (apply (car lambdas) newargs))
2317 (setq rval lastval
2318 rvalever t)
2319 )
2320 491
2321 ;; Right Here... it could be that lastval is returned when 492;;;
2322 ;; rvalever is nil. Is that right? 493;; Method Calling Functions
2323 rval)))
2324
2325(defun eieiomt-method-list (method key class)
2326 "Return an alist list of methods lambdas.
2327METHOD is the method name.
2328KEY represents either :before, or :after methods.
2329CLASS is the starting class to search from in the method tree.
2330If CLASS is nil, then an empty list of methods should be returned."
2331 ;; Note: eieiomt - the MT means MethodTree. See more comments below
2332 ;; for the rest of the eieiomt methods.
2333
2334 ;; Collect lambda expressions stored for the class and its parent
2335 ;; classes.
2336 (let (lambdas)
2337 (dolist (ancestor (eieio-class-precedence-list class))
2338 ;; Lookup the form to use for the PRIMARY object for the next level
2339 (let ((tmpl (eieio-generic-form method key ancestor)))
2340 (when (and tmpl
2341 (or (not lambdas)
2342 ;; This prevents duplicates coming out of the
2343 ;; class method optimizer. Perhaps we should
2344 ;; just not optimize before/afters?
2345 (not (member tmpl lambdas))))
2346 (push tmpl lambdas))))
2347
2348 ;; Return collected lambda. For :after methods, return in current
2349 ;; order (most general class last); Otherwise, reverse order.
2350 (if (eq key method-after)
2351 lambdas
2352 (nreverse lambdas))))
2353 494
2354(defun next-method-p () 495(defun next-method-p ()
2355 "Return non-nil if there is a next method. 496 "Return non-nil if there is a next method.
@@ -2367,7 +508,7 @@ If REPLACEMENT-ARGS is non-nil, then use them instead of
2367arguments passed in at the top level. 508arguments passed in at the top level.
2368 509
2369Use `next-method-p' to find out if there is a next method to call." 510Use `next-method-p' to find out if there is a next method to call."
2370 (if (not (bound-and-true-p scoped-class)) 511 (if (not (eieio--scoped-class))
2371 (error "`call-next-method' not called within a class specific method")) 512 (error "`call-next-method' not called within a class specific method"))
2372 (if (and (/= eieio-generic-call-key method-primary) 513 (if (and (/= eieio-generic-call-key method-primary)
2373 (/= eieio-generic-call-key method-static)) 514 (/= eieio-generic-call-key method-static))
@@ -2381,231 +522,10 @@ Use `next-method-p' to find out if there is a next method to call."
2381 (let* ((eieio-generic-call-next-method-list 522 (let* ((eieio-generic-call-next-method-list
2382 (cdr eieio-generic-call-next-method-list)) 523 (cdr eieio-generic-call-next-method-list))
2383 (eieio-generic-call-arglst newargs) 524 (eieio-generic-call-arglst newargs)
2384 (scoped-class (cdr next))
2385 (fcn (car next)) 525 (fcn (car next))
2386 ) 526 )
2387 (apply fcn newargs) 527 (eieio--with-scoped-class (cdr next)
2388 )))) 528 (apply fcn newargs)) ))))
2389
2390;;;
2391;; eieio-method-tree : eieiomt-
2392;;
2393;; Stored as eieio-method-tree in property list of a generic method
2394;;
2395;; (eieio-method-tree . [BEFORE PRIMARY AFTER
2396;; genericBEFORE genericPRIMARY genericAFTER])
2397;; and
2398;; (eieio-method-obarray . [BEFORE PRIMARY AFTER
2399;; genericBEFORE genericPRIMARY genericAFTER])
2400;; where the association is a vector.
2401;; (aref 0 -- all static methods.
2402;; (aref 1 -- all methods classified as :before
2403;; (aref 2 -- all methods classified as :primary
2404;; (aref 3 -- all methods classified as :after
2405;; (aref 4 -- a generic classified as :before
2406;; (aref 5 -- a generic classified as :primary
2407;; (aref 6 -- a generic classified as :after
2408;;
2409(defvar eieiomt-optimizing-obarray nil
2410 "While mapping atoms, this contain the obarray being optimized.")
2411
2412(defun eieiomt-install (method-name)
2413 "Install the method tree, and obarray onto METHOD-NAME.
2414Do not do the work if they already exist."
2415 (let ((emtv (get method-name 'eieio-method-tree))
2416 (emto (get method-name 'eieio-method-obarray)))
2417 (if (or (not emtv) (not emto))
2418 (progn
2419 (setq emtv (put method-name 'eieio-method-tree
2420 (make-vector method-num-slots nil))
2421 emto (put method-name 'eieio-method-obarray
2422 (make-vector method-num-slots nil)))
2423 (aset emto 0 (make-vector 11 0))
2424 (aset emto 1 (make-vector 11 0))
2425 (aset emto 2 (make-vector 41 0))
2426 (aset emto 3 (make-vector 11 0))
2427 ))))
2428
2429(defun eieiomt-add (method-name method key class)
2430 "Add to METHOD-NAME the forms METHOD in a call position KEY for CLASS.
2431METHOD-NAME is the name created by a call to `defgeneric'.
2432METHOD are the forms for a given implementation.
2433KEY is an integer (see comment in eieio.el near this function) which
2434is associated with the :static :before :primary and :after tags.
2435It also indicates if CLASS is defined or not.
2436CLASS is the class this method is associated with."
2437 (if (or (> key method-num-slots) (< key 0))
2438 (error "eieiomt-add: method key error!"))
2439 (let ((emtv (get method-name 'eieio-method-tree))
2440 (emto (get method-name 'eieio-method-obarray)))
2441 ;; Make sure the method tables are available.
2442 (if (or (not emtv) (not emto))
2443 (error "Programmer error: eieiomt-add"))
2444 ;; only add new cells on if it doesn't already exist!
2445 (if (assq class (aref emtv key))
2446 (setcdr (assq class (aref emtv key)) method)
2447 (aset emtv key (cons (cons class method) (aref emtv key))))
2448 ;; Add function definition into newly created symbol, and store
2449 ;; said symbol in the correct obarray, otherwise use the
2450 ;; other array to keep this stuff
2451 (if (< key method-num-lists)
2452 (let ((nsym (intern (symbol-name class) (aref emto key))))
2453 (fset nsym method)))
2454 ;; Save the defmethod file location in a symbol property.
2455 (let ((fname (if load-in-progress
2456 load-file-name
2457 buffer-file-name))
2458 loc)
2459 (when fname
2460 (when (string-match "\\.elc$" fname)
2461 (setq fname (substring fname 0 (1- (length fname)))))
2462 (setq loc (get method-name 'method-locations))
2463 (add-to-list 'loc
2464 (list class fname))
2465 (put method-name 'method-locations loc)))
2466 ;; Now optimize the entire obarray
2467 (if (< key method-num-lists)
2468 (let ((eieiomt-optimizing-obarray (aref emto key)))
2469 ;; @todo - Is this overkill? Should we just clear the symbol?
2470 (mapatoms 'eieiomt-sym-optimize eieiomt-optimizing-obarray)))
2471 ))
2472
2473(defun eieiomt-next (class)
2474 "Return the next parent class for CLASS.
2475If CLASS is a superclass, return variable `eieio-default-superclass'.
2476If CLASS is variable `eieio-default-superclass' then return nil.
2477This is different from function `class-parent' as class parent returns
2478nil for superclasses. This function performs no type checking!"
2479 ;; No type-checking because all calls are made from functions which
2480 ;; are safe and do checking for us.
2481 (or (eieio-class-parents-fast class)
2482 (if (eq class 'eieio-default-superclass)
2483 nil
2484 '(eieio-default-superclass))))
2485
2486(defun eieiomt-sym-optimize (s)
2487 "Find the next class above S which has a function body for the optimizer."
2488 ;; Set the value to nil in case there is no nearest cell.
2489 (set s nil)
2490 ;; Find the nearest cell that has a function body. If we find one,
2491 ;; we replace the nil from above.
2492 (let ((external-symbol (intern-soft (symbol-name s))))
2493 (catch 'done
2494 (dolist (ancestor (rest (eieio-class-precedence-list external-symbol)))
2495 (let ((ov (intern-soft (symbol-name ancestor)
2496 eieiomt-optimizing-obarray)))
2497 (when (fboundp ov)
2498 (set s ov) ;; store ov as our next symbol
2499 (throw 'done ancestor)))))))
2500
2501(defun eieio-generic-form (method key class)
2502 "Return the lambda form belonging to METHOD using KEY based upon CLASS.
2503If CLASS is not a class then use `generic' instead. If class has
2504no form, but has a parent class, then trace to that parent class.
2505The first time a form is requested from a symbol, an optimized path
2506is memorized for faster future use."
2507 (let ((emto (aref (get method 'eieio-method-obarray)
2508 (if class key (eieio-specialized-key-to-generic-key key)))))
2509 (if (class-p class)
2510 ;; 1) find our symbol
2511 (let ((cs (intern-soft (symbol-name class) emto)))
2512 (if (not cs)
2513 ;; 2) If there isn't one, then make one.
2514 ;; This can be slow since it only occurs once
2515 (progn
2516 (setq cs (intern (symbol-name class) emto))
2517 ;; 2.1) Cache its nearest neighbor with a quick optimize
2518 ;; which should only occur once for this call ever
2519 (let ((eieiomt-optimizing-obarray emto))
2520 (eieiomt-sym-optimize cs))))
2521 ;; 3) If it's bound return this one.
2522 (if (fboundp cs)
2523 (cons cs (eieio--class-symbol (class-v class)))
2524 ;; 4) If it's not bound then this variable knows something
2525 (if (symbol-value cs)
2526 (progn
2527 ;; 4.1) This symbol holds the next class in its value
2528 (setq class (symbol-value cs)
2529 cs (intern-soft (symbol-name class) emto))
2530 ;; 4.2) The optimizer should always have chosen a
2531 ;; function-symbol
2532 ;;(if (fboundp cs)
2533 (cons cs (eieio--class-symbol (class-v (intern (symbol-name class)))))
2534 ;;(error "EIEIO optimizer: erratic data loss!"))
2535 )
2536 ;; There never will be a funcall...
2537 nil)))
2538 ;; for a generic call, what is a list, is the function body we want.
2539 (let ((emtl (aref (get method 'eieio-method-tree)
2540 (if class key (eieio-specialized-key-to-generic-key key)))))
2541 (if emtl
2542 ;; The car of EMTL is supposed to be a class, which in this
2543 ;; case is nil, so skip it.
2544 (cons (cdr (car emtl)) nil)
2545 nil)))))
2546
2547;;;
2548;; Way to assign slots based on a list. Used for constructors, or
2549;; even resetting an object at run-time
2550;;
2551(defun eieio-set-defaults (obj &optional set-all)
2552 "Take object OBJ, and reset all slots to their defaults.
2553If SET-ALL is non-nil, then when a default is nil, that value is
2554reset. If SET-ALL is nil, the slots are only reset if the default is
2555not nil."
2556 (let ((scoped-class (eieio--object-class obj))
2557 (eieio-initializing-object t)
2558 (pub (eieio--class-public-a (class-v (eieio--object-class obj)))))
2559 (while pub
2560 (let ((df (eieio-oref-default obj (car pub))))
2561 (if (or df set-all)
2562 (eieio-oset obj (car pub) df)))
2563 (setq pub (cdr pub)))))
2564
2565(defun eieio-initarg-to-attribute (class initarg)
2566 "For CLASS, convert INITARG to the actual attribute name.
2567If there is no translation, pass it in directly (so we can cheat if
2568need be... May remove that later...)"
2569 (let ((tuple (assoc initarg (eieio--class-initarg-tuples (class-v class)))))
2570 (if tuple
2571 (cdr tuple)
2572 nil)))
2573
2574(defun eieio-attribute-to-initarg (class attribute)
2575 "In CLASS, convert the ATTRIBUTE into the corresponding init argument tag.
2576This is usually a symbol that starts with `:'."
2577 (let ((tuple (rassoc attribute (eieio--class-initarg-tuples (class-v class)))))
2578 (if tuple
2579 (car tuple)
2580 nil)))
2581
2582
2583;;; Here are some special types of errors
2584;;
2585(intern "no-method-definition")
2586(put 'no-method-definition 'error-conditions '(no-method-definition error))
2587(put 'no-method-definition 'error-message "No method definition")
2588
2589(intern "no-next-method")
2590(put 'no-next-method 'error-conditions '(no-next-method error))
2591(put 'no-next-method 'error-message "No next method")
2592
2593(intern "invalid-slot-name")
2594(put 'invalid-slot-name 'error-conditions '(invalid-slot-name error))
2595(put 'invalid-slot-name 'error-message "Invalid slot name")
2596
2597(intern "invalid-slot-type")
2598(put 'invalid-slot-type 'error-conditions '(invalid-slot-type error nil))
2599(put 'invalid-slot-type 'error-message "Invalid slot type")
2600
2601(intern "unbound-slot")
2602(put 'unbound-slot 'error-conditions '(unbound-slot error nil))
2603(put 'unbound-slot 'error-message "Unbound slot")
2604
2605(intern "inconsistent-class-hierarchy")
2606(put 'inconsistent-class-hierarchy 'error-conditions
2607 '(inconsistent-class-hierarchy error nil))
2608(put 'inconsistent-class-hierarchy 'error-message "Inconsistent class hierarchy")
2609 529
2610;;; Here are some CLOS items that need the CL package 530;;; Here are some CLOS items that need the CL package
2611;; 531;;
@@ -2678,7 +598,7 @@ Called from the constructor routine.")
2678(defmethod shared-initialize ((obj eieio-default-superclass) slots) 598(defmethod shared-initialize ((obj eieio-default-superclass) slots)
2679 "Set slots of OBJ with SLOTS which is a list of name/value pairs. 599 "Set slots of OBJ with SLOTS which is a list of name/value pairs.
2680Called from the constructor routine." 600Called from the constructor routine."
2681 (let ((scoped-class (eieio--object-class obj))) 601 (eieio--with-scoped-class (eieio--object-class obj)
2682 (while slots 602 (while slots
2683 (let ((rn (eieio-initarg-to-attribute (eieio--object-class obj) 603 (let ((rn (eieio-initarg-to-attribute (eieio--object-class obj)
2684 (car slots)))) 604 (car slots))))
@@ -2700,27 +620,27 @@ call `shared-initialize' yourself, or you can call `call-next-method'
2700to have this constructor called automatically. If these steps are 620to have this constructor called automatically. If these steps are
2701not taken, then new objects of your class will not have their values 621not taken, then new objects of your class will not have their values
2702dynamically set from SLOTS." 622dynamically set from SLOTS."
2703 ;; First, see if any of our defaults are `lambda', and 623 ;; First, see if any of our defaults are `lambda', and
2704 ;; re-evaluate them and apply the value to our slots. 624 ;; re-evaluate them and apply the value to our slots.
2705 (let* ((scoped-class (class-v (eieio--object-class this))) 625 (let* ((this-class (class-v (eieio--object-class this)))
2706 (slot (eieio--class-public-a scoped-class)) 626 (slot (eieio--class-public-a this-class))
2707 (defaults (eieio--class-public-d scoped-class))) 627 (defaults (eieio--class-public-d this-class)))
2708 (while slot 628 (while slot
2709 ;; For each slot, see if we need to evaluate it. 629 ;; For each slot, see if we need to evaluate it.
2710 ;; 630 ;;
2711 ;; Paul Landes said in an email: 631 ;; Paul Landes said in an email:
2712 ;; > CL evaluates it if it can, and otherwise, leaves it as 632 ;; > CL evaluates it if it can, and otherwise, leaves it as
2713 ;; > the quoted thing as you already have. This is by the 633 ;; > the quoted thing as you already have. This is by the
2714 ;; > Sonya E. Keene book and other things I've look at on the 634 ;; > Sonya E. Keene book and other things I've look at on the
2715 ;; > web. 635 ;; > web.
2716 (let ((dflt (eieio-default-eval-maybe (car defaults)))) 636 (let ((dflt (eieio-default-eval-maybe (car defaults))))
2717 (when (not (eq dflt (car defaults))) 637 (when (not (eq dflt (car defaults)))
2718 (eieio-oset this (car slot) dflt) )) 638 (eieio-oset this (car slot) dflt) ))
2719 ;; Next. 639 ;; Next.
2720 (setq slot (cdr slot) 640 (setq slot (cdr slot)
2721 defaults (cdr defaults)))) 641 defaults (cdr defaults))))
2722 ;; Shared initialize will parse our slots for us. 642 ;; Shared initialize will parse our slots for us.
2723 (shared-initialize this slots)) 643 (shared-initialize this slots))
2724 644
2725(defgeneric slot-missing (object slot-name operation &optional new-value) 645(defgeneric slot-missing (object slot-name operation &optional new-value)
2726 "Method invoked when an attempt to access a slot in OBJECT fails.") 646 "Method invoked when an attempt to access a slot in OBJECT fails.")
@@ -2940,102 +860,6 @@ This may create or delete slots, but does not affect the return value
2940of `eq'." 860of `eq'."
2941 (error "EIEIO: `change-class' is unimplemented")) 861 (error "EIEIO: `change-class' is unimplemented"))
2942 862
2943)
2944
2945;;; Obsolete backward compatibility functions.
2946;; Needed to run byte-code compiled with the EIEIO of Emacs-23.
2947
2948(defun eieio-defmethod (method args)
2949 "Obsolete work part of an old version of the `defmethod' macro."
2950 (let ((key nil) (body nil) (firstarg nil) (argfix nil) (argclass nil) loopa)
2951 ;; find optional keys
2952 (setq key
2953 (cond ((memq (car args) '(:BEFORE :before))
2954 (setq args (cdr args))
2955 method-before)
2956 ((memq (car args) '(:AFTER :after))
2957 (setq args (cdr args))
2958 method-after)
2959 ((memq (car args) '(:STATIC :static))
2960 (setq args (cdr args))
2961 method-static)
2962 ((memq (car args) '(:PRIMARY :primary))
2963 (setq args (cdr args))
2964 method-primary)
2965 ;; Primary key.
2966 (t method-primary)))
2967 ;; Get body, and fix contents of args to be the arguments of the fn.
2968 (setq body (cdr args)
2969 args (car args))
2970 (setq loopa args)
2971 ;; Create a fixed version of the arguments.
2972 (while loopa
2973 (setq argfix (cons (if (listp (car loopa)) (car (car loopa)) (car loopa))
2974 argfix))
2975 (setq loopa (cdr loopa)))
2976 ;; Make sure there is a generic.
2977 (eieio-defgeneric
2978 method
2979 (if (stringp (car body))
2980 (car body) (format "Generically created method `%s'." method)))
2981 ;; create symbol for property to bind to. If the first arg is of
2982 ;; the form (varname vartype) and `vartype' is a class, then
2983 ;; that class will be the type symbol. If not, then it will fall
2984 ;; under the type `primary' which is a non-specific calling of the
2985 ;; function.
2986 (setq firstarg (car args))
2987 (if (listp firstarg)
2988 (progn
2989 (setq argclass (nth 1 firstarg))
2990 (if (not (class-p argclass))
2991 (error "Unknown class type %s in method parameters"
2992 (nth 1 firstarg))))
2993 ;; Generics are higher.
2994 (setq key (eieio-specialized-key-to-generic-key key)))
2995 ;; Put this lambda into the symbol so we can find it.
2996 (if (byte-code-function-p (car-safe body))
2997 (eieiomt-add method (car-safe body) key argclass)
2998 (eieiomt-add method (append (list 'lambda (reverse argfix)) body)
2999 key argclass))
3000 )
3001
3002 (when eieio-optimize-primary-methods-flag
3003 ;; Optimizing step:
3004 ;;
3005 ;; If this method, after this setup, only has primary methods, then
3006 ;; we can setup the generic that way.
3007 (if (generic-primary-only-p method)
3008 ;; If there is only one primary method, then we can go one more
3009 ;; optimization step.
3010 (if (generic-primary-only-one-p method)
3011 (eieio-defgeneric-reset-generic-form-primary-only-one method)
3012 (eieio-defgeneric-reset-generic-form-primary-only method))
3013 (eieio-defgeneric-reset-generic-form method)))
3014
3015 method)
3016(make-obsolete 'eieio-defmethod 'eieio--defmethod "24.1")
3017
3018(defun eieio-defgeneric (method doc-string)
3019 "Obsolete work part of an old version of the `defgeneric' macro."
3020 (if (and (fboundp method) (not (generic-p method))
3021 (or (byte-code-function-p (symbol-function method))
3022 (not (eq 'autoload (car (symbol-function method)))))
3023 )
3024 (error "You cannot create a generic/method over an existing symbol: %s"
3025 method))
3026 ;; Don't do this over and over.
3027 (unless (fboundp 'method)
3028 ;; This defun tells emacs where the first definition of this
3029 ;; method is defined.
3030 `(defun ,method nil)
3031 ;; Make sure the method tables are installed.
3032 (eieiomt-install method)
3033 ;; Apply the actual body of this function.
3034 (fset method (eieio-defgeneric-form method doc-string))
3035 ;; Return the method
3036 'method))
3037(make-obsolete 'eieio-defgeneric nil "24.1")
3038
3039;;; Interfacing with edebug 863;;; Interfacing with edebug
3040;; 864;;
3041(defun eieio-edebug-prin1-to-string (object &optional noescape) 865(defun eieio-edebug-prin1-to-string (object &optional noescape)
diff --git a/lisp/emacs-lisp/generic.el b/lisp/emacs-lisp/generic.el
index dd5ff0ec694..cb86a554335 100644
--- a/lisp/emacs-lisp/generic.el
+++ b/lisp/emacs-lisp/generic.el
@@ -93,6 +93,8 @@
93 93
94;;; Code: 94;;; Code:
95 95
96(eval-when-compile (require 'pcase))
97
96;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 98;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
97;; Internal Variables 99;; Internal Variables
98;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 100;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -224,18 +226,11 @@ Some generic modes are defined in `generic-x.el'."
224 (funcall (intern mode))) 226 (funcall (intern mode)))
225 227
226;;; Comment Functionality 228;;; Comment Functionality
227(defun generic-mode-set-comments (comment-list)
228 "Set up comment functionality for generic mode."
229 (let ((st (make-syntax-table))
230 (chars nil)
231 (comstyles))
232 (make-local-variable 'comment-start)
233 (make-local-variable 'comment-start-skip)
234 (make-local-variable 'comment-end)
235 229
236 ;; Go through all the comments 230(defun generic--normalise-comments (comment-list)
231 (let ((normalized '()))
237 (dolist (start comment-list) 232 (dolist (start comment-list)
238 (let (end (comstyle "")) 233 (let (end)
239 ;; Normalize 234 ;; Normalize
240 (when (consp start) 235 (when (consp start)
241 (setq end (cdr start)) 236 (setq end (cdr start))
@@ -244,58 +239,79 @@ Some generic modes are defined in `generic-x.el'."
244 (cond 239 (cond
245 ((characterp end) (setq end (char-to-string end))) 240 ((characterp end) (setq end (char-to-string end)))
246 ((zerop (length end)) (setq end "\n"))) 241 ((zerop (length end)) (setq end "\n")))
242 (push (cons start end) normalized)))
243 (nreverse normalized)))
247 244
248 ;; Setup the vars for `comment-region' 245(defun generic-set-comment-syntax (st comment-list)
249 (if comment-start 246 "Set up comment functionality for generic mode."
250 ;; We have already setup a comment-style, so use style b 247 (let ((chars nil)
251 (progn 248 (comstyles)
252 (setq comstyle "b") 249 (comstyle "")
253 (setq comment-start-skip 250 (comment-start nil))
254 (concat comment-start-skip "\\|" (regexp-quote start) "+\\s-*"))) 251
255 ;; First comment-style 252 ;; Go through all the comments.
256 (setq comment-start start) 253 (pcase-dolist (`(,start . ,end) comment-list)
257 (setq comment-end (if (string-equal end "\n") "" end)) 254 (let ((comstyle
258 (setq comment-start-skip (concat (regexp-quote start) "+\\s-*"))) 255 ;; Reuse comstyles if necessary.
259
260 ;; Reuse comstyles if necessary
261 (setq comstyle
262 (or (cdr (assoc start comstyles)) 256 (or (cdr (assoc start comstyles))
263 (cdr (assoc end comstyles)) 257 (cdr (assoc end comstyles))
264 comstyle)) 258 ;; Otherwise, use a style not yet in use.
259 (if (not (rassoc "" comstyles)) "")
260 (if (not (rassoc "b" comstyles)) "b")
261 "c")))
265 (push (cons start comstyle) comstyles) 262 (push (cons start comstyle) comstyles)
266 (push (cons end comstyle) comstyles) 263 (push (cons end comstyle) comstyles)
267 264
268 ;; Setup the syntax table 265 ;; Setup the syntax table.
269 (if (= (length start) 1) 266 (if (= (length start) 1)
270 (modify-syntax-entry (string-to-char start) 267 (modify-syntax-entry (aref start 0)
271 (concat "< " comstyle) st) 268 (concat "< " comstyle) st)
272 (let ((c0 (elt start 0)) (c1 (elt start 1))) 269 (let ((c0 (aref start 0)) (c1 (aref start 1)))
273 ;; Store the relevant info but don't update yet 270 ;; Store the relevant info but don't update yet.
274 (push (cons c0 (concat (cdr (assoc c0 chars)) "1")) chars) 271 (push (cons c0 (concat (cdr (assoc c0 chars)) "1")) chars)
275 (push (cons c1 (concat (cdr (assoc c1 chars)) 272 (push (cons c1 (concat (cdr (assoc c1 chars))
276 (concat "2" comstyle))) chars))) 273 (concat "2" comstyle))) chars)))
277 (if (= (length end) 1) 274 (if (= (length end) 1)
278 (modify-syntax-entry (string-to-char end) 275 (modify-syntax-entry (aref end 0)
279 (concat ">" comstyle) st) 276 (concat ">" comstyle) st)
280 (let ((c0 (elt end 0)) (c1 (elt end 1))) 277 (let ((c0 (aref end 0)) (c1 (aref end 1)))
281 ;; Store the relevant info but don't update yet 278 ;; Store the relevant info but don't update yet.
282 (push (cons c0 (concat (cdr (assoc c0 chars)) 279 (push (cons c0 (concat (cdr (assoc c0 chars))
283 (concat "3" comstyle))) chars) 280 (concat "3" comstyle))) chars)
284 (push (cons c1 (concat (cdr (assoc c1 chars)) "4")) chars))))) 281 (push (cons c1 (concat (cdr (assoc c1 chars)) "4")) chars)))))
285 282
286 ;; Process the chars that were part of a 2-char comment marker 283 ;; Process the chars that were part of a 2-char comment marker
284 (with-syntax-table st ;For `char-syntax'.
287 (dolist (cs (nreverse chars)) 285 (dolist (cs (nreverse chars))
288 (modify-syntax-entry (car cs) 286 (modify-syntax-entry (car cs)
289 (concat (char-to-string (char-syntax (car cs))) 287 (concat (char-to-string (char-syntax (car cs)))
290 " " (cdr cs)) 288 " " (cdr cs))
291 st)) 289 st)))))
290
291(defun generic-set-comment-vars (comment-list)
292 (when comment-list
293 (setq-local comment-start (caar comment-list))
294 (setq-local comment-end
295 (let ((end (cdar comment-list)))
296 (if (string-equal end "\n") "" end)))
297 (setq-local comment-start-skip
298 (concat (regexp-opt (mapcar #'car comment-list))
299 "+[ \t]*"))
300 (setq-local comment-end-skip
301 (concat "[ \t]*" (regexp-opt (mapcar #'cdr comment-list))))))
302
303(defun generic-mode-set-comments (comment-list)
304 "Set up comment functionality for generic mode."
305 (let ((st (make-syntax-table))
306 (comment-list (generic--normalise-comments comment-list)))
307 (generic-set-comment-syntax st comment-list)
308 (generic-set-comment-vars comment-list)
292 (set-syntax-table st))) 309 (set-syntax-table st)))
293 310
294(defun generic-bracket-support () 311(defun generic-bracket-support ()
295 "Imenu support for [KEYWORD] constructs found in INF, INI and Samba files." 312 "Imenu support for [KEYWORD] constructs found in INF, INI and Samba files."
296 (setq imenu-generic-expression 313 (setq-local imenu-generic-expression '((nil "^\\[\\(.*\\)\\]" 1)))
297 '((nil "^\\[\\(.*\\)\\]" 1)) 314 (setq-local imenu-case-fold-search t))
298 imenu-case-fold-search t))
299 315
300;;;###autoload 316;;;###autoload
301(defun generic-make-keywords-list (keyword-list face &optional prefix suffix) 317(defun generic-make-keywords-list (keyword-list face &optional prefix suffix)
@@ -306,6 +322,7 @@ expression that matches these keywords and concatenates it with
306PREFIX and SUFFIX. Then it returns a construct based on this 322PREFIX and SUFFIX. Then it returns a construct based on this
307regular expression that can be used as an element of 323regular expression that can be used as an element of
308`font-lock-keywords'." 324`font-lock-keywords'."
325 (declare (obsolete regexp-opt "24.4"))
309 (unless (listp keyword-list) 326 (unless (listp keyword-list)
310 (error "Keywords argument must be a list of strings")) 327 (error "Keywords argument must be a list of strings"))
311 (list (concat prefix "\\_<" 328 (list (concat prefix "\\_<"
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 8d74afac285..cbd8854e7d6 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -225,11 +225,13 @@ font-lock keywords will not be case sensitive."
225 (setq-local syntax-begin-function 'beginning-of-defun) 225 (setq-local syntax-begin-function 'beginning-of-defun)
226 (setq font-lock-defaults 226 (setq font-lock-defaults
227 `((lisp-font-lock-keywords 227 `((lisp-font-lock-keywords
228 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) 228 lisp-font-lock-keywords-1
229 lisp-font-lock-keywords-2)
229 nil ,keywords-case-insensitive nil nil 230 nil ,keywords-case-insensitive nil nil
230 (font-lock-mark-block-function . mark-defun) 231 (font-lock-mark-block-function . mark-defun)
231 (font-lock-syntactic-face-function 232 (font-lock-syntactic-face-function
232 . lisp-font-lock-syntactic-face-function)))) 233 . lisp-font-lock-syntactic-face-function)))
234 (prog-prettify-install lisp--prettify-symbols-alist))
233 235
234(defun lisp-outline-level () 236(defun lisp-outline-level ()
235 "Lisp mode `outline-level' function." 237 "Lisp mode `outline-level' function."
@@ -266,6 +268,7 @@ font-lock keywords will not be case sensitive."
266 268
267(defvar lisp-mode-shared-map 269(defvar lisp-mode-shared-map
268 (let ((map (make-sparse-keymap))) 270 (let ((map (make-sparse-keymap)))
271 (set-keymap-parent map prog-mode-map)
269 (define-key map "\e\C-q" 'indent-sexp) 272 (define-key map "\e\C-q" 'indent-sexp)
270 (define-key map "\177" 'backward-delete-char-untabify) 273 (define-key map "\177" 'backward-delete-char-untabify)
271 ;; This gets in the way when viewing a Lisp file in view-mode. As 274 ;; This gets in the way when viewing a Lisp file in view-mode. As
@@ -447,6 +450,9 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
447 :type 'hook 450 :type 'hook
448 :group 'lisp) 451 :group 'lisp)
449 452
453(defconst lisp--prettify-symbols-alist
454 '(("lambda" . ?λ)))
455
450(define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp" 456(define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp"
451 "Major mode for editing Lisp code to run in Emacs. 457 "Major mode for editing Lisp code to run in Emacs.
452Commands: 458Commands:
@@ -808,6 +814,7 @@ With argument, print output into current buffer."
808(defun eval-sexp-add-defvars (exp &optional pos) 814(defun eval-sexp-add-defvars (exp &optional pos)
809 "Prepend EXP with all the `defvar's that precede it in the buffer. 815 "Prepend EXP with all the `defvar's that precede it in the buffer.
810POS specifies the starting position where EXP was found and defaults to point." 816POS specifies the starting position where EXP was found and defaults to point."
817 (setq exp (macroexpand-all exp)) ;Eager macro-expansion.
811 (if (not lexical-binding) 818 (if (not lexical-binding)
812 exp 819 exp
813 (save-excursion 820 (save-excursion
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index b221d2f823d..a31bef2391d 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -1,4 +1,4 @@
1;;; lisp.el --- Lisp editing commands for Emacs 1;;; lisp.el --- Lisp editing commands for Emacs -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1985-1986, 1994, 2000-2013 Free Software Foundation, 3;; Copyright (C) 1985-1986, 1994, 2000-2013 Free Software Foundation,
4;; Inc. 4;; Inc.
@@ -262,9 +262,9 @@ is called as a function to find the defun's beginning."
262 ;; convention, fallback on the old implementation. 262 ;; convention, fallback on the old implementation.
263 (wrong-number-of-arguments 263 (wrong-number-of-arguments
264 (if (> arg 0) 264 (if (> arg 0)
265 (dotimes (i arg) 265 (dotimes (_ arg)
266 (funcall beginning-of-defun-function)) 266 (funcall beginning-of-defun-function))
267 (dotimes (i (- arg)) 267 (dotimes (_ (- arg))
268 (funcall end-of-defun-function)))))) 268 (funcall end-of-defun-function))))))
269 269
270 ((or defun-prompt-regexp open-paren-in-column-0-is-defun-start) 270 ((or defun-prompt-regexp open-paren-in-column-0-is-defun-start)
@@ -442,7 +442,7 @@ it marks the next defun after the ones already marked."
442 (beginning-of-defun)) 442 (beginning-of-defun))
443 (re-search-backward "^\n" (- (point) 1) t))))) 443 (re-search-backward "^\n" (- (point) 1) t)))))
444 444
445(defun narrow-to-defun (&optional arg) 445(defun narrow-to-defun (&optional _arg)
446 "Make text outside current defun invisible. 446 "Make text outside current defun invisible.
447The defun visible is the one that contains point or follows point. 447The defun visible is the one that contains point or follows point.
448Optional ARG is ignored." 448Optional ARG is ignored."
@@ -662,10 +662,96 @@ considered."
662 (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data) 662 (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)
663 (plist-get plist :predicate)))))) 663 (plist-get plist :predicate))))))
664 664
665 665(defun lisp--local-variables-1 (vars sexp)
666(defun lisp-completion-at-point (&optional predicate) 666 "Return the vars locally bound around the witness, or nil if not found."
667 (let (res)
668 (while
669 (unless
670 (setq res
671 (pcase sexp
672 (`(,(or `let `let*) ,bindings)
673 (let ((vars vars))
674 (when (eq 'let* (car sexp))
675 (dolist (binding (cdr (reverse bindings)))
676 (push (or (car-safe binding) binding) vars)))
677 (lisp--local-variables-1
678 vars (car (cdr-safe (car (last bindings)))))))
679 (`(,(or `let `let*) ,bindings . ,body)
680 (let ((vars vars))
681 (dolist (binding bindings)
682 (push (or (car-safe binding) binding) vars))
683 (lisp--local-variables-1 vars (car (last body)))))
684 (`(lambda ,_) (setq sexp nil))
685 (`(lambda ,args . ,body)
686 (lisp--local-variables-1
687 (append args vars) (car (last body))))
688 (`(condition-case ,_ ,e) (lisp--local-variables-1 vars e))
689 (`(condition-case ,v ,_ . ,catches)
690 (lisp--local-variables-1
691 (cons v vars) (cdr (car (last catches)))))
692 (`(,_ . ,_)
693 (lisp--local-variables-1 vars (car (last sexp))))
694 (`lisp--witness--lisp (or vars '(nil)))
695 (_ nil)))
696 (setq sexp (ignore-errors (butlast sexp)))))
697 res))
698
699(defun lisp--local-variables ()
700 "Return a list of locally let-bound variables at point."
701 (save-excursion
702 (skip-syntax-backward "w_")
703 (let* ((ppss (syntax-ppss))
704 (txt (buffer-substring-no-properties (or (car (nth 9 ppss)) (point))
705 (or (nth 8 ppss) (point))))
706 (closer ()))
707 (dolist (p (nth 9 ppss))
708 (push (cdr (syntax-after p)) closer))
709 (setq closer (apply #'string closer))
710 (let* ((sexp (car (read-from-string
711 (concat txt "lisp--witness--lisp" closer))))
712 (macroexpand-advice (lambda (expander form &rest args)
713 (condition-case nil
714 (apply expander form args)
715 (error form))))
716 (sexp
717 (unwind-protect
718 (progn
719 (advice-add 'macroexpand :around macroexpand-advice)
720 (macroexpand-all sexp))
721 (advice-remove 'macroexpand macroexpand-advice)))
722 (vars (lisp--local-variables-1 nil sexp)))
723 (delq nil
724 (mapcar (lambda (var)
725 (and (symbolp var)
726 (not (string-match (symbol-name var) "\\`[&_]"))
727 ;; Eliminate uninterned vars.
728 (intern-soft var)
729 var))
730 vars))))))
731
732(defvar lisp--local-variables-completion-table
733 ;; Use `defvar' rather than `defconst' since defconst would purecopy this
734 ;; value, which would doubly fail: it would fail because purecopy can't
735 ;; handle the recursive bytecode object, and it would fail because it would
736 ;; move `lastpos' and `lastvars' to pure space where they'd be immutable!
737 (let ((lastpos nil) (lastvars nil))
738 (letrec ((hookfun (lambda ()
739 (setq lastpos nil)
740 (remove-hook 'post-command-hook hookfun))))
741 (completion-table-dynamic
742 (lambda (_string)
743 (save-excursion
744 (skip-syntax-backward "_w")
745 (let ((newpos (cons (point) (current-buffer))))
746 (unless (equal lastpos newpos)
747 (add-hook 'post-command-hook hookfun)
748 (setq lastpos newpos)
749 (setq lastvars
750 (mapcar #'symbol-name (lisp--local-variables))))))
751 lastvars)))))
752
753(defun lisp-completion-at-point (&optional _predicate)
667 "Function used for `completion-at-point-functions' in `emacs-lisp-mode'." 754 "Function used for `completion-at-point-functions' in `emacs-lisp-mode'."
668 ;; FIXME: the `end' could be after point?
669 (with-syntax-table emacs-lisp-mode-syntax-table 755 (with-syntax-table emacs-lisp-mode-syntax-table
670 (let* ((pos (point)) 756 (let* ((pos (point))
671 (beg (condition-case nil 757 (beg (condition-case nil
@@ -691,7 +777,9 @@ considered."
691 ;; use it to provide a more specific completion table in some 777 ;; use it to provide a more specific completion table in some
692 ;; cases. E.g. filter out keywords that are not understood by 778 ;; cases. E.g. filter out keywords that are not understood by
693 ;; the macro/function being called. 779 ;; the macro/function being called.
694 (list nil obarray ;Could be anything. 780 (list nil (completion-table-in-turn
781 lisp--local-variables-completion-table
782 obarray) ;Could be anything.
695 :annotation-function 783 :annotation-function
696 (lambda (str) (if (fboundp (intern-soft str)) " <f>"))) 784 (lambda (str) (if (fboundp (intern-soft str)) " <f>")))
697 ;; Looks like a funcall position. Let's double check. 785 ;; Looks like a funcall position. Let's double check.
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 6bb796434fd..e8b513fcd3e 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -111,15 +111,20 @@ and also to avoid outputting the warning during normal execution."
111 (funcall (eval (cadr form))) 111 (funcall (eval (cadr form)))
112 (byte-compile-constant nil))) 112 (byte-compile-constant nil)))
113 113
114(defun macroexp--compiling-p ()
115 "Return non-nil if we're macroexpanding for the compiler."
116 ;; FIXME: ¡¡Major Ugly Hack!! To determine whether the output of this
117 ;; macro-expansion will be processed by the byte-compiler, we check
118 ;; circumstantial evidence.
119 (member '(declare-function . byte-compile-macroexpand-declare-function)
120 macroexpand-all-environment))
121
122
114(defun macroexp--warn-and-return (msg form) 123(defun macroexp--warn-and-return (msg form)
115 (let ((when-compiled (lambda () (byte-compile-log-warning msg t)))) 124 (let ((when-compiled (lambda () (byte-compile-log-warning msg t))))
116 (cond 125 (cond
117 ((null msg) form) 126 ((null msg) form)
118 ;; FIXME: ¡¡Major Ugly Hack!! To determine whether the output of this 127 ((macroexp--compiling-p)
119 ;; macro-expansion will be processed by the byte-compiler, we check
120 ;; circumstantial evidence.
121 ((member '(declare-function . byte-compile-macroexpand-declare-function)
122 macroexpand-all-environment)
123 `(progn 128 `(progn
124 (macroexp--funcall-if-compiled ',when-compiled) 129 (macroexp--funcall-if-compiled ',when-compiled)
125 ,form)) 130 ,form))
diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el
index a3ce1672a63..17919d9bbeb 100644
--- a/lisp/emacs-lisp/package-x.el
+++ b/lisp/emacs-lisp/package-x.el
@@ -162,9 +162,11 @@ DESCRIPTION is the text of the news item."
162 description 162 description
163 archive-url)) 163 archive-url))
164 164
165(defun package-upload-buffer-internal (pkg-info extension &optional archive-url) 165(declare-function lm-commentary "lisp-mnt" (&optional file))
166
167(defun package-upload-buffer-internal (pkg-desc extension &optional archive-url)
166 "Upload a package whose contents are in the current buffer. 168 "Upload a package whose contents are in the current buffer.
167PKG-INFO is the package info, see `package-buffer-info'. 169PKG-DESC is the `package-desc'.
168EXTENSION is the file extension, a string. It can be either 170EXTENSION is the file extension, a string. It can be either
169\"el\" or \"tar\". 171\"el\" or \"tar\".
170 172
@@ -196,18 +198,18 @@ if it exists."
196 (error "Aborted"))) 198 (error "Aborted")))
197 (save-excursion 199 (save-excursion
198 (save-restriction 200 (save-restriction
199 (let* ((file-type (cond 201 (let* ((file-type (package-desc-kind pkg-desc))
200 ((equal extension "el") 'single) 202 (pkg-name (package-desc-name pkg-desc))
201 ((equal extension "tar") 'tar) 203 (requires (package-desc-reqs pkg-desc))
202 (t (error "Unknown extension `%s'" extension)))) 204 (desc (if (eq (package-desc-summary pkg-desc)
203 (file-name (aref pkg-info 0)) 205 package--default-summary)
204 (pkg-name (intern file-name))
205 (requires (aref pkg-info 1))
206 (desc (if (string= (aref pkg-info 2) "")
207 (read-string "Description of package: ") 206 (read-string "Description of package: ")
208 (aref pkg-info 2))) 207 (package-desc-summary pkg-desc)))
209 (pkg-version (aref pkg-info 3)) 208 (pkg-version (package-desc-version pkg-desc))
210 (commentary (aref pkg-info 4)) 209 (commentary
210 (pcase file-type
211 (`single (lm-commentary))
212 (`tar nil))) ;; FIXME: Get it from the README file.
211 (split-version (version-to-list pkg-version)) 213 (split-version (version-to-list pkg-version))
212 (pkg-buffer (current-buffer))) 214 (pkg-buffer (current-buffer)))
213 215
@@ -215,7 +217,8 @@ if it exists."
215 ;; from `package-archive-upload-base' otherwise. 217 ;; from `package-archive-upload-base' otherwise.
216 (let ((contents (or (package--archive-contents-from-url archive-url) 218 (let ((contents (or (package--archive-contents-from-url archive-url)
217 (package--archive-contents-from-file))) 219 (package--archive-contents-from-file)))
218 (new-desc (vector split-version requires desc file-type))) 220 (new-desc (package-make-ac-desc
221 split-version requires desc file-type)))
219 (if (> (car contents) package-archive-version) 222 (if (> (car contents) package-archive-version)
220 (error "Unrecognized archive version %d" (car contents))) 223 (error "Unrecognized archive version %d" (car contents)))
221 (let ((elt (assq pkg-name (cdr contents)))) 224 (let ((elt (assq pkg-name (cdr contents))))
@@ -232,6 +235,7 @@ if it exists."
232 ;; this and the package itself. For now we assume ELPA is 235 ;; this and the package itself. For now we assume ELPA is
233 ;; writable via file primitives. 236 ;; writable via file primitives.
234 (let ((print-level nil) 237 (let ((print-level nil)
238 (print-quoted t)
235 (print-length nil)) 239 (print-length nil))
236 (write-region (concat (pp-to-string contents) "\n") 240 (write-region (concat (pp-to-string contents) "\n")
237 nil 241 nil
@@ -241,29 +245,29 @@ if it exists."
241 ;; If there is a commentary section, write it. 245 ;; If there is a commentary section, write it.
242 (when commentary 246 (when commentary
243 (write-region commentary nil 247 (write-region commentary nil
244 (expand-file-name 248 (expand-file-name
245 (concat (symbol-name pkg-name) "-readme.txt") 249 (concat (symbol-name pkg-name) "-readme.txt")
246 package-archive-upload-base))) 250 package-archive-upload-base)))
247 251
248 (set-buffer pkg-buffer) 252 (set-buffer pkg-buffer)
249 (write-region (point-min) (point-max) 253 (write-region (point-min) (point-max)
250 (expand-file-name 254 (expand-file-name
251 (concat file-name "-" pkg-version "." extension) 255 (format "%s-%s.%s" pkg-name pkg-version extension)
252 package-archive-upload-base) 256 package-archive-upload-base)
253 nil nil nil 'excl) 257 nil nil nil 'excl)
254 258
255 ;; Write a news entry. 259 ;; Write a news entry.
256 (and package-update-news-on-upload 260 (and package-update-news-on-upload
257 archive-url 261 archive-url
258 (package--update-news (concat file-name "." extension) 262 (package--update-news (format "%s.%s" pkg-name extension)
259 pkg-version desc archive-url)) 263 pkg-version desc archive-url))
260 264
261 ;; special-case "package": write a second copy so that the 265 ;; special-case "package": write a second copy so that the
262 ;; installer can easily find the latest version. 266 ;; installer can easily find the latest version.
263 (if (string= file-name "package") 267 (if (eq pkg-name 'package)
264 (write-region (point-min) (point-max) 268 (write-region (point-min) (point-max)
265 (expand-file-name 269 (expand-file-name
266 (concat file-name "." extension) 270 (format "%s.%s" pkg-name extension)
267 package-archive-upload-base) 271 package-archive-upload-base)
268 nil nil nil 'ask)))))))) 272 nil nil nil 'ask))))))))
269 273
@@ -275,8 +279,8 @@ destination, prompt for one."
275 (save-excursion 279 (save-excursion
276 (save-restriction 280 (save-restriction
277 ;; Find the package in this buffer. 281 ;; Find the package in this buffer.
278 (let ((pkg-info (package-buffer-info))) 282 (let ((pkg-desc (package-buffer-info)))
279 (package-upload-buffer-internal pkg-info "el"))))) 283 (package-upload-buffer-internal pkg-desc "el")))))
280 284
281(defun package-upload-file (file) 285(defun package-upload-file (file)
282 "Upload the Emacs Lisp package FILE to the package archive. 286 "Upload the Emacs Lisp package FILE to the package archive.
@@ -288,12 +292,13 @@ destination, prompt for one."
288 (interactive "fPackage file name: ") 292 (interactive "fPackage file name: ")
289 (with-temp-buffer 293 (with-temp-buffer
290 (insert-file-contents-literally file) 294 (insert-file-contents-literally file)
291 (let ((info (cond 295 (let ((pkg-desc
292 ((string-match "\\.tar$" file) (package-tar-file-info file)) 296 (cond
293 ((string-match "\\.el$" file) (package-buffer-info)) 297 ((string-match "\\.tar\\'" file) (package-tar-file-info file))
294 (t (error "Unrecognized extension `%s'" 298 ((string-match "\\.el\\'" file) (package-buffer-info))
295 (file-name-extension file)))))) 299 (t (error "Unrecognized extension `%s'"
296 (package-upload-buffer-internal info (file-name-extension file))))) 300 (file-name-extension file))))))
301 (package-upload-buffer-internal pkg-desc (file-name-extension file)))))
297 302
298(defun package-gnus-summary-upload () 303(defun package-gnus-summary-upload ()
299 "Upload a package contained in the current *Article* buffer. 304 "Upload a package contained in the current *Article* buffer.
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 41b635bbe30..d5176abded0 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -170,6 +170,8 @@
170 170
171;;; Code: 171;;; Code:
172 172
173(eval-when-compile (require 'cl-lib))
174
173(require 'tabulated-list) 175(require 'tabulated-list)
174 176
175(defgroup package nil 177(defgroup package nil
@@ -262,11 +264,8 @@ Lower version numbers than this will probably be understood as well.")
262;; We don't prime the cache since it tends to get out of date. 264;; We don't prime the cache since it tends to get out of date.
263(defvar package-archive-contents nil 265(defvar package-archive-contents nil
264 "Cache of the contents of the Emacs Lisp Package Archive. 266 "Cache of the contents of the Emacs Lisp Package Archive.
265This is an alist mapping package names (symbols) to package 267This is an alist mapping package names (symbols) to
266descriptor vectors. These are like the vectors for `package-alist' 268`package--desc' structures.")
267but have extra entries: one which is 'tar for tar packages and
268'single for single-file packages, and one which is the name of
269the archive from which it came.")
270(put 'package-archive-contents 'risky-local-variable t) 269(put 'package-archive-contents 'risky-local-variable t)
271 270
272(defcustom package-user-dir (locate-user-emacs-file "elpa") 271(defcustom package-user-dir (locate-user-emacs-file "elpa")
@@ -297,6 +296,62 @@ contrast, `package-user-dir' contains packages for personal use."
297 :group 'package 296 :group 'package
298 :version "24.1") 297 :version "24.1")
299 298
299(defvar package--default-summary "No description available.")
300
301(cl-defstruct (package-desc
302 ;; Rename the default constructor from `make-package-desc'.
303 (:constructor package-desc-create)
304 ;; Has the same interface as the old `define-package',
305 ;; which is still used in the "foo-pkg.el" files. Extra
306 ;; options can be supported by adding additional keys.
307 (:constructor
308 package-desc-from-define
309 (name-string version-string &optional summary requirements
310 &key kind archive
311 &aux
312 (name (intern name-string))
313 (version (version-to-list version-string))
314 (reqs (mapcar #'(lambda (elt)
315 (list (car elt)
316 (version-to-list (cadr elt))))
317 (if (eq 'quote (car requirements))
318 (nth 1 requirements)
319 requirements))))))
320 "Structure containing information about an individual package.
321
322Slots:
323
324`name' Name of the package, as a symbol.
325
326`version' Version of the package, as a version list.
327
328`summary' Short description of the package, typically taken from
329the first line of the file.
330
331`reqs' Requirements of the package. A list of (PACKAGE
332VERSION-LIST) naming the dependent package and the minimum
333required version.
334
335`kind' The distribution format of the package. Currently, it is
336either `single' or `tar'.
337
338`archive' The name of the archive (as a string) whence this
339package came."
340 name
341 version
342 (summary package--default-summary)
343 reqs
344 kind
345 archive)
346
347;; Package descriptor format used in finder-inf.el and package--builtins.
348(cl-defstruct (package--bi-desc
349 (:constructor package-make-builtin (version summary))
350 (:type vector))
351 version
352 reqs
353 summary)
354
300;; The value is precomputed in finder-inf.el, but don't load that 355;; The value is precomputed in finder-inf.el, but don't load that
301;; until it's needed (i.e. when `package-initialize' is called). 356;; until it's needed (i.e. when `package-initialize' is called).
302(defvar package--builtins nil 357(defvar package--builtins nil
@@ -305,27 +360,14 @@ The actual value is initialized by loading the library
305`finder-inf'; this is not done until it is needed, e.g. by the 360`finder-inf'; this is not done until it is needed, e.g. by the
306function `package-built-in-p'. 361function `package-built-in-p'.
307 362
308Each element has the form (PKG . DESC), where PKG is a package 363Each element has the form (PKG . PACKAGE-BI-DESC), where PKG is a package
309name (a symbol) and DESC is a vector that describes the package. 364name (a symbol) and DESC is a `package--bi-desc' structure.")
310The vector DESC has the form [VERSION-LIST REQS DOCSTRING].
311 VERSION-LIST is a version list.
312 REQS is a list of packages required by the package, each
313 requirement having the form (NAME VL), where NAME is a string
314 and VL is a version list.
315 DOCSTRING is a brief description of the package.")
316(put 'package--builtins 'risky-local-variable t) 365(put 'package--builtins 'risky-local-variable t)
317 366
318(defvar package-alist nil 367(defvar package-alist nil
319 "Alist of all packages available for activation. 368 "Alist of all packages available for activation.
320Each element has the form (PKG . DESC), where PKG is a package 369Each element has the form (PKG . DESC), where PKG is a package
321name (a symbol) and DESC is a vector that describes the package. 370name (a symbol) and DESC is a `package-desc' structure.
322
323The vector DESC has the form [VERSION-LIST REQS DOCSTRING].
324 VERSION-LIST is a version list.
325 REQS is a list of packages required by the package, each
326 requirement having the form (NAME VL) where NAME is a string
327 and VL is a version list.
328 DOCSTRING is a brief description of the package.
329 371
330This variable is set automatically by `package-load-descriptor', 372This variable is set automatically by `package-load-descriptor',
331called via `package-initialize'. To change which packages are 373called via `package-initialize'. To change which packages are
@@ -339,7 +381,10 @@ loaded and/or activated, customize `package-load-list'.")
339(defvar package-obsolete-alist nil 381(defvar package-obsolete-alist nil
340 "Representation of obsolete packages. 382 "Representation of obsolete packages.
341Like `package-alist', but maps package name to a second alist. 383Like `package-alist', but maps package name to a second alist.
342The inner alist is keyed by version.") 384The inner alist is keyed by version.
385
386Each element of the list is (NAME . VERSION-ALIST), where each
387entry in VERSION-ALIST is (VERSION-LIST . PACKAGE-DESC).")
343(put 'package-obsolete-alist 'risky-local-variable t) 388(put 'package-obsolete-alist 'risky-local-variable t)
344 389
345(defun package-version-join (vlist) 390(defun package-version-join (vlist)
@@ -430,26 +475,16 @@ the package by calling `package-load-descriptor'."
430 ;; Actually load the descriptor: 475 ;; Actually load the descriptor:
431 (package-load-descriptor dir subdir)))) 476 (package-load-descriptor dir subdir))))
432 477
433(defsubst package-desc-vers (desc) 478(define-obsolete-function-alias 'package-desc-vers 'package-desc-version "24.4")
434 "Extract version from a package description vector."
435 (aref desc 0))
436 479
437(defsubst package-desc-reqs (desc) 480(define-obsolete-function-alias 'package-desc-doc 'package-desc-summary "24.4")
438 "Extract requirements from a package description vector."
439 (aref desc 1))
440 481
441(defsubst package-desc-doc (desc)
442 "Extract doc string from a package description vector."
443 (aref desc 2))
444
445(defsubst package-desc-kind (desc)
446 "Extract the kind of download from an archive package description vector."
447 (aref desc 3))
448 482
449(defun package--dir (name version) 483(defun package--dir (name version)
484 ;; FIXME: Keep this as a field in the package-desc.
450 "Return the directory where a package is installed, or nil if none. 485 "Return the directory where a package is installed, or nil if none.
451NAME and VERSION are both strings." 486NAME is a symbol and VERSION is a string."
452 (let* ((subdir (concat name "-" version)) 487 (let* ((subdir (format "%s-%s" name version))
453 (dir-list (cons package-user-dir package-directory-list)) 488 (dir-list (cons package-user-dir package-directory-list))
454 pkg-dir) 489 pkg-dir)
455 (while dir-list 490 (while dir-list
@@ -460,9 +495,9 @@ NAME and VERSION are both strings."
460 (setq dir-list (cdr dir-list))))) 495 (setq dir-list (cdr dir-list)))))
461 pkg-dir)) 496 pkg-dir))
462 497
463(defun package-activate-1 (package pkg-vec) 498(defun package-activate-1 (pkg-desc)
464 (let* ((name (symbol-name package)) 499 (let* ((name (package-desc-name pkg-desc))
465 (version-str (package-version-join (package-desc-vers pkg-vec))) 500 (version-str (package-version-join (package-desc-version pkg-desc)))
466 (pkg-dir (package--dir name version-str))) 501 (pkg-dir (package--dir name version-str)))
467 (unless pkg-dir 502 (unless pkg-dir
468 (error "Internal error: unable to find directory for `%s-%s'" 503 (error "Internal error: unable to find directory for `%s-%s'"
@@ -475,8 +510,8 @@ NAME and VERSION are both strings."
475 (push pkg-dir Info-directory-list)) 510 (push pkg-dir Info-directory-list))
476 ;; Add to load path, add autoloads, and activate the package. 511 ;; Add to load path, add autoloads, and activate the package.
477 (push pkg-dir load-path) 512 (push pkg-dir load-path)
478 (load (expand-file-name (concat name "-autoloads") pkg-dir) nil t) 513 (load (expand-file-name (format "%s-autoloads" name) pkg-dir) nil t)
479 (push package package-activated-list) 514 (push name package-activated-list)
480 ;; Don't return nil. 515 ;; Don't return nil.
481 t)) 516 t))
482 517
@@ -489,7 +524,12 @@ specifying the minimum acceptable version."
489 (version-list-<= min-version (version-to-list emacs-version)) 524 (version-list-<= min-version (version-to-list emacs-version))
490 (let ((elt (assq package package--builtins))) 525 (let ((elt (assq package package--builtins)))
491 (and elt (version-list-<= min-version 526 (and elt (version-list-<= min-version
492 (package-desc-vers (cdr elt))))))) 527 (package--bi-desc-version (cdr elt)))))))
528
529(defun package--from-builtin (bi-desc)
530 (package-desc-create :name (pop bi-desc)
531 :version (package--bi-desc-version bi-desc)
532 :summary (package--bi-desc-summary bi-desc)))
493 533
494;; This function goes ahead and activates a newer version of a package 534;; This function goes ahead and activates a newer version of a package
495;; if an older one was already activated. This is not ideal; we'd at 535;; if an older one was already activated. This is not ideal; we'd at
@@ -504,7 +544,7 @@ Return nil if the package could not be activated."
504 available-version found) 544 available-version found)
505 ;; Check if PACKAGE is available in `package-alist'. 545 ;; Check if PACKAGE is available in `package-alist'.
506 (when pkg-vec 546 (when pkg-vec
507 (setq available-version (package-desc-vers pkg-vec) 547 (setq available-version (package-desc-version pkg-vec)
508 found (version-list-<= min-version available-version))) 548 found (version-list-<= min-version available-version)))
509 (cond 549 (cond
510 ;; If no such package is found, maybe it's built-in. 550 ;; If no such package is found, maybe it's built-in.
@@ -525,7 +565,7 @@ Return nil if the package could not be activated."
525Required package `%s-%s' is unavailable" 565Required package `%s-%s' is unavailable"
526 package (car fail) (package-version-join (cadr fail))) 566 package (car fail) (package-version-join (cadr fail)))
527 ;; If all goes well, activate the package itself. 567 ;; If all goes well, activate the package itself.
528 (package-activate-1 package pkg-vec))))))) 568 (package-activate-1 pkg-vec)))))))
529 569
530(defun package-mark-obsolete (package pkg-vec) 570(defun package-mark-obsolete (package pkg-vec)
531 "Put package on the obsolete list, if not already there." 571 "Put package on the obsolete list, if not already there."
@@ -533,11 +573,11 @@ Required package `%s-%s' is unavailable"
533 (if elt 573 (if elt
534 ;; If this obsolete version does not exist in the list, update 574 ;; If this obsolete version does not exist in the list, update
535 ;; it the list. 575 ;; it the list.
536 (unless (assoc (package-desc-vers pkg-vec) (cdr elt)) 576 (unless (assoc (package-desc-version pkg-vec) (cdr elt))
537 (setcdr elt (cons (cons (package-desc-vers pkg-vec) pkg-vec) 577 (setcdr elt (cons (cons (package-desc-version pkg-vec) pkg-vec)
538 (cdr elt)))) 578 (cdr elt))))
539 ;; Make a new association. 579 ;; Make a new association.
540 (push (cons package (list (cons (package-desc-vers pkg-vec) 580 (push (cons package (list (cons (package-desc-version pkg-vec)
541 pkg-vec))) 581 pkg-vec)))
542 package-obsolete-alist)))) 582 package-obsolete-alist))))
543 583
@@ -555,21 +595,17 @@ REQUIREMENTS is a list of dependencies on other packages.
555EXTRA-PROPERTIES is currently unused." 595EXTRA-PROPERTIES is currently unused."
556 (let* ((name (intern name-string)) 596 (let* ((name (intern name-string))
557 (version (version-to-list version-string)) 597 (version (version-to-list version-string))
558 (new-pkg-desc 598 (new-pkg-desc (cons name
559 (cons name 599 (package-desc-from-define name-string
560 (vector version 600 version-string
561 (mapcar 601 docstring
562 (lambda (elt) 602 requirements)))
563 (list (car elt)
564 (version-to-list (car (cdr elt)))))
565 requirements)
566 docstring)))
567 (old-pkg (assq name package-alist))) 603 (old-pkg (assq name package-alist)))
568 (cond 604 (cond
569 ;; If there's no old package, just add this to `package-alist'. 605 ;; If there's no old package, just add this to `package-alist'.
570 ((null old-pkg) 606 ((null old-pkg)
571 (push new-pkg-desc package-alist)) 607 (push new-pkg-desc package-alist))
572 ((version-list-< (package-desc-vers (cdr old-pkg)) version) 608 ((version-list-< (package-desc-version (cdr old-pkg)) version)
573 ;; Remove the old package and declare it obsolete. 609 ;; Remove the old package and declare it obsolete.
574 (package-mark-obsolete name (cdr old-pkg)) 610 (package-mark-obsolete name (cdr old-pkg))
575 (setq package-alist (cons new-pkg-desc 611 (setq package-alist (cons new-pkg-desc
@@ -577,7 +613,7 @@ EXTRA-PROPERTIES is currently unused."
577 ;; You can have two packages with the same version, e.g. one in 613 ;; You can have two packages with the same version, e.g. one in
578 ;; the system package directory and one in your private 614 ;; the system package directory and one in your private
579 ;; directory. We just let the first one win. 615 ;; directory. We just let the first one win.
580 ((not (version-list-= (package-desc-vers (cdr old-pkg)) version)) 616 ((not (version-list-= (package-desc-version (cdr old-pkg)) version))
581 ;; The package is born obsolete. 617 ;; The package is born obsolete.
582 (package-mark-obsolete name (cdr new-pkg-desc)))))) 618 (package-mark-obsolete name (cdr new-pkg-desc))))))
583 619
@@ -603,14 +639,15 @@ EXTRA-PROPERTIES is currently unused."
603 639
604(defun package-generate-autoloads (name pkg-dir) 640(defun package-generate-autoloads (name pkg-dir)
605 (require 'autoload) ;Load before we let-bind generated-autoload-file! 641 (require 'autoload) ;Load before we let-bind generated-autoload-file!
606 (let* ((auto-name (concat name "-autoloads.el")) 642 (let* ((auto-name (format "%s-autoloads.el" name))
607 ;;(ignore-name (concat name "-pkg.el")) 643 ;;(ignore-name (concat name "-pkg.el"))
608 (generated-autoload-file (expand-file-name auto-name pkg-dir)) 644 (generated-autoload-file (expand-file-name auto-name pkg-dir))
609 (version-control 'never)) 645 (version-control 'never))
610 (package-autoload-ensure-default-file generated-autoload-file) 646 (package-autoload-ensure-default-file generated-autoload-file)
611 (update-directory-autoloads pkg-dir) 647 (update-directory-autoloads pkg-dir)
612 (let ((buf (find-buffer-visiting generated-autoload-file))) 648 (let ((buf (find-buffer-visiting generated-autoload-file)))
613 (when buf (kill-buffer buf))))) 649 (when buf (kill-buffer buf)))
650 auto-name))
614 651
615(defvar tar-parse-info) 652(defvar tar-parse-info)
616(declare-function tar-untar-buffer "tar-mode" ()) 653(declare-function tar-untar-buffer "tar-mode" ())
@@ -644,57 +681,62 @@ untar into a directory named DIR; otherwise, signal an error."
644 ;; FIXME: should we delete PKG-DIR if it exists? 681 ;; FIXME: should we delete PKG-DIR if it exists?
645 (let* ((default-directory (file-name-as-directory package-user-dir))) 682 (let* ((default-directory (file-name-as-directory package-user-dir)))
646 (package-untar-buffer dirname) 683 (package-untar-buffer dirname)
647 (package--make-autoloads-and-compile name pkg-dir)))) 684 (package--make-autoloads-and-compile package pkg-dir))))
648 685
649(defun package--make-autoloads-and-compile (name pkg-dir) 686(defun package--make-autoloads-and-compile (name pkg-dir)
650 "Generate autoloads and do byte-compilation for package named NAME. 687 "Generate autoloads and do byte-compilation for package named NAME.
651PKG-DIR is the name of the package directory." 688PKG-DIR is the name of the package directory."
652 (package-generate-autoloads name pkg-dir) 689 (let ((auto-name (package-generate-autoloads name pkg-dir))
653 (let ((load-path (cons pkg-dir load-path))) 690 (load-path (cons pkg-dir load-path)))
654 ;; We must load the autoloads file before byte compiling, in 691 ;; We must load the autoloads file before byte compiling, in
655 ;; case there are magic cookies to set up non-trivial paths. 692 ;; case there are magic cookies to set up non-trivial paths.
656 (load (expand-file-name (concat name "-autoloads") pkg-dir) nil t) 693 (load auto-name nil t)
694 ;; FIXME: Compilation should be done as a separate, optional, step.
695 ;; E.g. for multi-package installs, we should first install all packages
696 ;; and then compile them.
657 (byte-recompile-directory pkg-dir 0 t))) 697 (byte-recompile-directory pkg-dir 0 t)))
658 698
659(defun package--write-file-no-coding (file-name) 699(defun package--write-file-no-coding (file-name)
660 (let ((buffer-file-coding-system 'no-conversion)) 700 (let ((buffer-file-coding-system 'no-conversion))
661 (write-region (point-min) (point-max) file-name))) 701 (write-region (point-min) (point-max) file-name)))
662 702
663(defun package-unpack-single (file-name version desc requires) 703(defun package-unpack-single (name version desc requires)
664 "Install the contents of the current buffer as a package." 704 "Install the contents of the current buffer as a package."
665 ;; Special case "package". 705 ;; Special case "package". FIXME: Should this still be supported?
666 (if (string= file-name "package") 706 (if (eq name 'package)
667 (package--write-file-no-coding 707 (package--write-file-no-coding
668 (expand-file-name (concat file-name ".el") package-user-dir)) 708 (expand-file-name (format "%s.el" name) package-user-dir))
669 (let* ((pkg-dir (expand-file-name (concat file-name "-" 709 (let* ((pkg-dir (expand-file-name (format "%s-%s" name
670 (package-version-join 710 (package-version-join
671 (version-to-list version))) 711 (version-to-list version)))
672 package-user-dir)) 712 package-user-dir))
673 (el-file (expand-file-name (concat file-name ".el") pkg-dir)) 713 (el-file (expand-file-name (format "%s.el" name) pkg-dir))
674 (pkg-file (expand-file-name (concat file-name "-pkg.el") pkg-dir))) 714 (pkg-file (expand-file-name (format "%s-pkg.el" name) pkg-dir)))
675 (make-directory pkg-dir t) 715 (make-directory pkg-dir t)
676 (package--write-file-no-coding el-file) 716 (package--write-file-no-coding el-file)
677 (let ((print-level nil) 717 (let ((print-level nil)
718 (print-quoted t)
678 (print-length nil)) 719 (print-length nil))
679 (write-region 720 (write-region
680 (concat 721 (concat
681 (prin1-to-string 722 (prin1-to-string
682 (list 'define-package 723 (list 'define-package
683 file-name 724 (symbol-name name)
684 version 725 version
685 desc 726 desc
686 (list 'quote 727 (when requires ;Don't bother quoting nil.
687 ;; Turn version lists into string form. 728 (list 'quote
688 (mapcar 729 ;; Turn version lists into string form.
689 (lambda (elt) 730 (mapcar
690 (list (car elt) 731 (lambda (elt)
691 (package-version-join (cadr elt)))) 732 (list (car elt)
692 requires)))) 733 (package-version-join (cadr elt))))
734 requires)))))
693 "\n") 735 "\n")
694 nil 736 nil
695 pkg-file 737 pkg-file
696 nil nil nil 'excl)) 738 nil nil nil 'excl))
697 (package--make-autoloads-and-compile file-name pkg-dir)))) 739 (package--make-autoloads-and-compile name pkg-dir))))
698 740
699(defmacro package--with-work-buffer (location file &rest body) 741(defmacro package--with-work-buffer (location file &rest body)
700 "Run BODY in a buffer containing the contents of FILE at LOCATION. 742 "Run BODY in a buffer containing the contents of FILE at LOCATION.
@@ -744,7 +786,7 @@ It will move point to somewhere in the headers."
744 (let ((location (package-archive-base name)) 786 (let ((location (package-archive-base name))
745 (file (concat (symbol-name name) "-" version ".el"))) 787 (file (concat (symbol-name name) "-" version ".el")))
746 (package--with-work-buffer location file 788 (package--with-work-buffer location file
747 (package-unpack-single (symbol-name name) version desc requires)))) 789 (package-unpack-single name version desc requires))))
748 790
749(defun package-download-tar (name version) 791(defun package-download-tar (name version)
750 "Download and install a tar package." 792 "Download and install a tar package."
@@ -762,7 +804,7 @@ MIN-VERSION should be a version list."
762 (let ((pkg-desc (assq package package-alist))) 804 (let ((pkg-desc (assq package package-alist)))
763 (if pkg-desc 805 (if pkg-desc
764 (version-list-<= min-version 806 (version-list-<= min-version
765 (package-desc-vers (cdr pkg-desc))) 807 (package-desc-version (cdr pkg-desc)))
766 ;; Also check built-in packages. 808 ;; Also check built-in packages.
767 (package-built-in-p package min-version)))) 809 (package-built-in-p package min-version))))
768 810
@@ -785,7 +827,7 @@ not included in this list."
785 (unless (package-installed-p next-pkg next-version) 827 (unless (package-installed-p next-pkg next-version)
786 ;; A package is required, but not installed. It might also be 828 ;; A package is required, but not installed. It might also be
787 ;; blocked via `package-load-list'. 829 ;; blocked via `package-load-list'.
788 (let ((pkg-desc (assq next-pkg package-archive-contents)) 830 (let ((pkg-desc (cdr (assq next-pkg package-archive-contents)))
789 hold) 831 hold)
790 (when (setq hold (assq next-pkg package-load-list)) 832 (when (setq hold (assq next-pkg package-load-list))
791 (setq hold (cadr hold)) 833 (setq hold (cadr hold))
@@ -805,17 +847,17 @@ but version %s required"
805 (symbol-name next-pkg) 847 (symbol-name next-pkg)
806 (package-version-join next-version))) 848 (package-version-join next-version)))
807 (unless (version-list-<= next-version 849 (unless (version-list-<= next-version
808 (package-desc-vers (cdr pkg-desc))) 850 (package-desc-version pkg-desc))
809 (error 851 (error
810 "Need package `%s-%s', but only %s is available" 852 "Need package `%s-%s', but only %s is available"
811 (symbol-name next-pkg) (package-version-join next-version) 853 (symbol-name next-pkg) (package-version-join next-version)
812 (package-version-join (package-desc-vers (cdr pkg-desc))))) 854 (package-version-join (package-desc-version pkg-desc))))
813 ;; Move to front, so it gets installed early enough (bug#14082). 855 ;; Move to front, so it gets installed early enough (bug#14082).
814 (setq package-list (cons next-pkg (delq next-pkg package-list))) 856 (setq package-list (cons next-pkg (delq next-pkg package-list)))
815 (setq package-list 857 (setq package-list
816 (package-compute-transaction package-list 858 (package-compute-transaction package-list
817 (package-desc-reqs 859 (package-desc-reqs
818 (cdr pkg-desc)))))))) 860 pkg-desc)))))))
819 package-list) 861 package-list)
820 862
821(defun package-read-from-string (str) 863(defun package-read-from-string (str)
@@ -867,13 +909,29 @@ If the archive version is too new, signal an error."
867 (dolist (package contents) 909 (dolist (package contents)
868 (package--add-to-archive-contents package archive))))) 910 (package--add-to-archive-contents package archive)))))
869 911
912;; Package descriptor objects used inside the "archive-contents" file.
913;; Changing this defstruct implies changing the format of the
914;; "archive-contents" files.
915(cl-defstruct (package--ac-desc
916 (:constructor package-make-ac-desc (version reqs summary kind))
917 (:copier nil)
918 (:type vector))
919 version reqs summary kind)
920
870(defun package--add-to-archive-contents (package archive) 921(defun package--add-to-archive-contents (package archive)
871 "Add the PACKAGE from the given ARCHIVE if necessary. 922 "Add the PACKAGE from the given ARCHIVE if necessary.
872Also, add the originating archive to the end of the package vector." 923PACKAGE should have the form (NAME . PACKAGE--AC-DESC).
873 (let* ((name (car package)) 924Also, add the originating archive to the `package-desc' structure."
874 (version (package-desc-vers (cdr package))) 925 (let* ((name (car package))
875 (entry (cons name 926 (pkg-desc
876 (vconcat (cdr package) (vector archive)))) 927 (package-desc-create
928 :name name
929 :version (package--ac-desc-version (cdr package))
930 :reqs (package--ac-desc-reqs (cdr package))
931 :summary (package--ac-desc-summary (cdr package))
932 :kind (package--ac-desc-kind (cdr package))
933 :archive archive))
934 (entry (cons name pkg-desc))
877 (existing-package (assq name package-archive-contents)) 935 (existing-package (assq name package-archive-contents))
878 (pinned-to-archive (assoc name package-pinned-packages))) 936 (pinned-to-archive (assoc name package-pinned-packages)))
879 (cond ((and pinned-to-archive 937 (cond ((and pinned-to-archive
@@ -881,9 +939,9 @@ Also, add the originating archive to the end of the package vector."
881 (not (equal (cdr pinned-to-archive) archive))) 939 (not (equal (cdr pinned-to-archive) archive)))
882 nil) 940 nil)
883 ((not existing-package) 941 ((not existing-package)
884 (add-to-list 'package-archive-contents entry)) 942 (push entry package-archive-contents))
885 ((version-list-< (package-desc-vers (cdr existing-package)) 943 ((version-list-< (package-desc-version (cdr existing-package))
886 version) 944 (package-desc-version pkg-desc))
887 ;; Replace the entry with this one. 945 ;; Replace the entry with this one.
888 (setq package-archive-contents 946 (setq package-archive-contents
889 (cons entry 947 (cons entry
@@ -902,14 +960,14 @@ using `package-compute-transaction'."
902 ;; `package-load-list', download the held version. 960 ;; `package-load-list', download the held version.
903 (hold (cadr (assq elt package-load-list))) 961 (hold (cadr (assq elt package-load-list)))
904 (v-string (or (and (stringp hold) hold) 962 (v-string (or (and (stringp hold) hold)
905 (package-version-join (package-desc-vers desc)))) 963 (package-version-join (package-desc-version desc))))
906 (kind (package-desc-kind desc))) 964 (kind (package-desc-kind desc)))
907 (cond 965 (cond
908 ((eq kind 'tar) 966 ((eq kind 'tar)
909 (package-download-tar elt v-string)) 967 (package-download-tar elt v-string))
910 ((eq kind 'single) 968 ((eq kind 'single)
911 (package-download-single elt v-string 969 (package-download-single elt v-string
912 (package-desc-doc desc) 970 (package-desc-summary desc)
913 (package-desc-reqs desc))) 971 (package-desc-reqs desc)))
914 (t 972 (t
915 (error "Unknown package kind: %s" (symbol-name kind)))) 973 (error "Unknown package kind: %s" (symbol-name kind))))
@@ -961,17 +1019,7 @@ Otherwise return nil."
961 (error nil)))) 1019 (error nil))))
962 1020
963(defun package-buffer-info () 1021(defun package-buffer-info ()
964 "Return a vector describing the package in the current buffer. 1022 "Return a `package-desc' describing the package in the current buffer.
965The vector has the form
966
967 [FILENAME REQUIRES DESCRIPTION VERSION COMMENTARY]
968
969FILENAME is the file name, a string, sans the \".el\" extension.
970REQUIRES is a list of requirements, each requirement having the
971 form (NAME VER); NAME is a string and VER is a version list.
972DESCRIPTION is the package description, a string.
973VERSION is the version, a string.
974COMMENTARY is the commentary section, a string, or nil if none.
975 1023
976If the buffer does not contain a conforming package, signal an 1024If the buffer does not contain a conforming package, signal an
977error. If there is a package, narrow the buffer to the file's 1025error. If there is a package, narrow the buffer to the file's
@@ -990,25 +1038,18 @@ boundaries."
990 (require 'lisp-mnt) 1038 (require 'lisp-mnt)
991 ;; Use some headers we've invented to drive the process. 1039 ;; Use some headers we've invented to drive the process.
992 (let* ((requires-str (lm-header "package-requires")) 1040 (let* ((requires-str (lm-header "package-requires"))
993 (requires (if requires-str
994 (package-read-from-string requires-str)))
995 ;; Prefer Package-Version; if defined, the package author 1041 ;; Prefer Package-Version; if defined, the package author
996 ;; probably wants us to use it. Otherwise try Version. 1042 ;; probably wants us to use it. Otherwise try Version.
997 (pkg-version 1043 (pkg-version
998 (or (package-strip-rcs-id (lm-header "package-version")) 1044 (or (package-strip-rcs-id (lm-header "package-version"))
999 (package-strip-rcs-id (lm-header "version")))) 1045 (package-strip-rcs-id (lm-header "version")))))
1000 (commentary (lm-commentary)))
1001 (unless pkg-version 1046 (unless pkg-version
1002 (error 1047 (error
1003 "Package lacks a \"Version\" or \"Package-Version\" header")) 1048 "Package lacks a \"Version\" or \"Package-Version\" header"))
1004 ;; Turn string version numbers into list form. 1049 (package-desc-from-define
1005 (setq requires 1050 file-name pkg-version desc
1006 (mapcar 1051 (if requires-str (package-read-from-string requires-str))
1007 (lambda (elt) 1052 :kind 'single))))
1008 (list (car elt)
1009 (version-to-list (car (cdr elt)))))
1010 requires))
1011 (vector file-name requires desc pkg-version commentary))))
1012 1053
1013(defun package-tar-file-info (file) 1054(defun package-tar-file-info (file)
1014 "Find package information for a tar file. 1055 "Find package information for a tar file.
@@ -1025,67 +1066,46 @@ The return result is a vector like `package-buffer-info'."
1025 (pkg-def-contents (shell-command-to-string 1066 (pkg-def-contents (shell-command-to-string
1026 ;; Requires GNU tar. 1067 ;; Requires GNU tar.
1027 (concat "tar -xOf " file " " 1068 (concat "tar -xOf " file " "
1028
1029 pkg-name "-" pkg-version "/" 1069 pkg-name "-" pkg-version "/"
1030 pkg-name "-pkg.el"))) 1070 pkg-name "-pkg.el")))
1031 (pkg-def-parsed (package-read-from-string pkg-def-contents))) 1071 (pkg-def-parsed (package-read-from-string pkg-def-contents)))
1032 (unless (eq (car pkg-def-parsed) 'define-package) 1072 (unless (eq (car pkg-def-parsed) 'define-package)
1033 (error "No `define-package' sexp is present in `%s-pkg.el'" pkg-name)) 1073 (error "No `define-package' sexp is present in `%s-pkg.el'" pkg-name))
1034 (let ((name-str (nth 1 pkg-def-parsed)) 1074 (let ((pkg-desc
1035 (version-string (nth 2 pkg-def-parsed)) 1075 (apply #'package-desc-from-define (append (cdr pkg-def-parsed)
1036 (docstring (nth 3 pkg-def-parsed)) 1076 '(:kind tar)))))
1037 (requires (nth 4 pkg-def-parsed)) 1077 (unless (equal pkg-version
1038 (readme (shell-command-to-string 1078 (package-version-join (package-desc-version pkg-desc)))
1039 ;; Requires GNU tar.
1040 (concat "tar -xOf " file " "
1041 pkg-name "-" pkg-version "/README"))))
1042 (unless (equal pkg-version version-string)
1043 (error "Package has inconsistent versions")) 1079 (error "Package has inconsistent versions"))
1044 (unless (equal pkg-name name-str) 1080 (unless (equal pkg-name (symbol-name (package-desc-name pkg-desc)))
1045 (error "Package has inconsistent names")) 1081 (error "Package has inconsistent names"))
1046 ;; Kind of a hack. 1082 pkg-desc))))
1047 (if (string-match ": Not found in archive" readme) 1083
1048 (setq readme nil))
1049 ;; Turn string version numbers into list form.
1050 (if (eq (car requires) 'quote)
1051 (setq requires (car (cdr requires))))
1052 (setq requires
1053 (mapcar (lambda (elt)
1054 (list (car elt)
1055 (version-to-list (cadr elt))))
1056 requires))
1057 (vector pkg-name requires docstring version-string readme)))))
1058 1084
1059;;;###autoload 1085;;;###autoload
1060(defun package-install-from-buffer (pkg-info type) 1086(defun package-install-from-buffer (pkg-desc)
1061 "Install a package from the current buffer. 1087 "Install a package from the current buffer.
1062When called interactively, the current buffer is assumed to be a 1088When called interactively, the current buffer is assumed to be a
1063single .el file that follows the packaging guidelines; see info 1089single .el file that follows the packaging guidelines; see info
1064node `(elisp)Packaging'. 1090node `(elisp)Packaging'.
1065 1091
1066When called from Lisp, PKG-INFO is a vector describing the 1092When called from Lisp, PKG-DESC is a `package-desc' describing the
1067information, of the type returned by `package-buffer-info'; and 1093information)."
1068TYPE is the package type (either `single' or `tar')." 1094 (interactive (list (package-buffer-info)))
1069 (interactive (list (package-buffer-info) 'single))
1070 (save-excursion 1095 (save-excursion
1071 (save-restriction 1096 (save-restriction
1072 (let* ((file-name (aref pkg-info 0)) 1097 (let* ((name (package-desc-name pkg-desc))
1073 (requires (aref pkg-info 1)) 1098 (requires (package-desc-reqs pkg-desc))
1074 (desc (if (string= (aref pkg-info 2) "") 1099 (desc (package-desc-summary pkg-desc))
1075 "No description available." 1100 (pkg-version (package-desc-version pkg-desc)))
1076 (aref pkg-info 2)))
1077 (pkg-version (aref pkg-info 3)))
1078 ;; Download and install the dependencies. 1101 ;; Download and install the dependencies.
1079 (let ((transaction (package-compute-transaction nil requires))) 1102 (let ((transaction (package-compute-transaction nil requires)))
1080 (package-download-transaction transaction)) 1103 (package-download-transaction transaction))
1081 ;; Install the package itself. 1104 ;; Install the package itself.
1082 (cond 1105 (pcase (package-desc-kind pkg-desc)
1083 ((eq type 'single) 1106 (`single (package-unpack-single name pkg-version desc requires))
1084 (package-unpack-single file-name pkg-version desc requires)) 1107 (`tar (package-unpack name pkg-version))
1085 ((eq type 'tar) 1108 (type (error "Unknown type: %S" type)))
1086 (package-unpack (intern file-name) pkg-version))
1087 (t
1088 (error "Unknown type: %s" (symbol-name type))))
1089 ;; Try to activate it. 1109 ;; Try to activate it.
1090 (package-initialize))))) 1110 (package-initialize)))))
1091 1111
@@ -1097,10 +1117,10 @@ The file can either be a tar file or an Emacs Lisp file."
1097 (with-temp-buffer 1117 (with-temp-buffer
1098 (insert-file-contents-literally file) 1118 (insert-file-contents-literally file)
1099 (cond 1119 (cond
1100 ((string-match "\\.el$" file) 1120 ((string-match "\\.el\\'" file)
1101 (package-install-from-buffer (package-buffer-info) 'single)) 1121 (package-install-from-buffer (package-buffer-info)))
1102 ((string-match "\\.tar$" file) 1122 ((string-match "\\.tar\\'" file)
1103 (package-install-from-buffer (package-tar-file-info file) 'tar)) 1123 (package-install-from-buffer (package-tar-file-info file)))
1104 (t (error "Unrecognized extension `%s'" (file-name-extension file)))))) 1124 (t (error "Unrecognized extension `%s'" (file-name-extension file))))))
1105 1125
1106(defun package-delete (name version) 1126(defun package-delete (name version)
@@ -1118,7 +1138,7 @@ The file can either be a tar file or an Emacs Lisp file."
1118(defun package-archive-base (name) 1138(defun package-archive-base (name)
1119 "Return the archive containing the package NAME." 1139 "Return the archive containing the package NAME."
1120 (let ((desc (cdr (assq (intern-soft name) package-archive-contents)))) 1140 (let ((desc (cdr (assq (intern-soft name) package-archive-contents))))
1121 (cdr (assoc (aref desc (- (length desc) 1)) package-archives)))) 1141 (cdr (assoc (package-desc-archive desc) package-archives))))
1122 1142
1123(defun package--download-one-archive (archive file) 1143(defun package--download-one-archive (archive file)
1124 "Retrieve an archive file FILE from ARCHIVE, and cache it. 1144 "Retrieve an archive file FILE from ARCHIVE, and cache it.
@@ -1163,7 +1183,7 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
1163 (package-read-all-archive-contents) 1183 (package-read-all-archive-contents)
1164 (unless no-activate 1184 (unless no-activate
1165 (dolist (elt package-alist) 1185 (dolist (elt package-alist)
1166 (package-activate (car elt) (package-desc-vers (cdr elt))))) 1186 (package-activate (car elt) (package-desc-version (cdr elt)))))
1167 (setq package--initialized t)) 1187 (setq package--initialized t))
1168 1188
1169 1189
@@ -1210,22 +1230,22 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
1210 (cond 1230 (cond
1211 ;; Loaded packages are in `package-alist'. 1231 ;; Loaded packages are in `package-alist'.
1212 ((setq desc (cdr (assq package package-alist))) 1232 ((setq desc (cdr (assq package package-alist)))
1213 (setq version (package-version-join (package-desc-vers desc))) 1233 (setq version (package-version-join (package-desc-version desc)))
1214 (if (setq pkg-dir (package--dir package-name version)) 1234 (if (setq pkg-dir (package--dir package-name version))
1215 (insert "an installed package.\n\n") 1235 (insert "an installed package.\n\n")
1216 ;; This normally does not happen. 1236 ;; This normally does not happen.
1217 (insert "a deleted package.\n\n"))) 1237 (insert "a deleted package.\n\n")))
1218 ;; Available packages are in `package-archive-contents'. 1238 ;; Available packages are in `package-archive-contents'.
1219 ((setq desc (cdr (assq package package-archive-contents))) 1239 ((setq desc (cdr (assq package package-archive-contents)))
1220 (setq version (package-version-join (package-desc-vers desc)) 1240 (setq version (package-version-join (package-desc-version desc))
1221 archive (aref desc (- (length desc) 1)) 1241 archive (package-desc-archive desc)
1222 installable t) 1242 installable t)
1223 (if built-in 1243 (if built-in
1224 (insert "a built-in package.\n\n") 1244 (insert "a built-in package.\n\n")
1225 (insert "an uninstalled package.\n\n"))) 1245 (insert "an uninstalled package.\n\n")))
1226 (built-in 1246 (built-in
1227 (setq desc (cdr built-in) 1247 (setq desc (package--from-builtin built-in)
1228 version (package-version-join (package-desc-vers desc))) 1248 version (package-version-join (package-desc-version desc)))
1229 (insert "a built-in package.\n\n")) 1249 (insert "a built-in package.\n\n"))
1230 (t 1250 (t
1231 (insert "an orphan package.\n\n"))) 1251 (insert "an orphan package.\n\n")))
@@ -1246,7 +1266,8 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
1246 (insert "'."))) 1266 (insert "'.")))
1247 (installable 1267 (installable
1248 (if built-in 1268 (if built-in
1249 (insert (propertize "Built-in." 'font-lock-face 'font-lock-builtin-face) 1269 (insert (propertize "Built-in."
1270 'font-lock-face 'font-lock-builtin-face)
1250 " Alternate version available") 1271 " Alternate version available")
1251 (insert "Available")) 1272 (insert "Available"))
1252 (insert " from " archive) 1273 (insert " from " archive)
@@ -1261,7 +1282,8 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
1261 'package-symbol package 1282 'package-symbol package
1262 'action 'package-install-button-action))) 1283 'action 'package-install-button-action)))
1263 (built-in 1284 (built-in
1264 (insert (propertize "Built-in." 'font-lock-face 'font-lock-builtin-face))) 1285 (insert (propertize "Built-in."
1286 'font-lock-face 'font-lock-builtin-face)))
1265 (t (insert "Deleted."))) 1287 (t (insert "Deleted.")))
1266 (insert "\n") 1288 (insert "\n")
1267 (and version (> (length version) 0) 1289 (and version (> (length version) 0)
@@ -1286,7 +1308,7 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
1286 (help-insert-xref-button text 'help-package name)) 1308 (help-insert-xref-button text 'help-package name))
1287 (insert "\n"))) 1309 (insert "\n")))
1288 (insert " " (propertize "Summary" 'font-lock-face 'bold) 1310 (insert " " (propertize "Summary" 'font-lock-face 'bold)
1289 ": " (if desc (package-desc-doc desc)) "\n\n") 1311 ": " (if desc (package-desc-summary desc)) "\n\n")
1290 1312
1291 (if built-in 1313 (if built-in
1292 ;; For built-in packages, insert the commentary. 1314 ;; For built-in packages, insert the commentary.
@@ -1418,10 +1440,10 @@ If the alist stored in the symbol LISTNAME lacks an entry for a
1418package PACKAGE with descriptor DESC, add one. The alist is 1440package PACKAGE with descriptor DESC, add one. The alist is
1419keyed with cons cells (PACKAGE . VERSION-LIST), where PACKAGE is 1441keyed with cons cells (PACKAGE . VERSION-LIST), where PACKAGE is
1420a symbol and VERSION-LIST is a version list." 1442a symbol and VERSION-LIST is a version list."
1421 `(let* ((version (package-desc-vers ,desc)) 1443 `(let* ((version (package-desc-version ,desc))
1422 (key (cons ,package version))) 1444 (key (cons ,package version)))
1423 (unless (assoc key ,listname) 1445 (unless (assoc key ,listname)
1424 (push (list key ,status (package-desc-doc ,desc)) ,listname)))) 1446 (push (list key ,status (package-desc-summary ,desc)) ,listname))))
1425 1447
1426(defun package-menu--generate (remember-pos packages) 1448(defun package-menu--generate (remember-pos packages)
1427 "Populate the Package Menu. 1449 "Populate the Package Menu.
@@ -1444,7 +1466,7 @@ or a list of package names (symbols) to display."
1444 (setq name (car elt)) 1466 (setq name (car elt))
1445 (when (and (not (eq name 'emacs)) ; Hide the `emacs' package. 1467 (when (and (not (eq name 'emacs)) ; Hide the `emacs' package.
1446 (or (eq packages t) (memq name packages))) 1468 (or (eq packages t) (memq name packages)))
1447 (package--push name (cdr elt) "built-in" info-list))) 1469 (package--push name (package--from-builtin elt) "built-in" info-list)))
1448 1470
1449 ;; Available and disabled packages: 1471 ;; Available and disabled packages:
1450 (dolist (elt package-archive-contents) 1472 (dolist (elt package-archive-contents)
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index a88b9d70930..f9d0fd9366b 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -957,7 +957,7 @@ If non-nil, it will blink not only for \"begin..end\" but also for \"if...else\"
957 (let ((ender (funcall smie-backward-token-function))) 957 (let ((ender (funcall smie-backward-token-function)))
958 (cond 958 (cond
959 ((not (and ender (rassoc ender smie-closer-alist))) 959 ((not (and ender (rassoc ender smie-closer-alist)))
960 ;; This not is one of the begin..end we know how to check. 960 ;; This is not one of the begin..end we know how to check.
961 (blink-matching-check-mismatch start end)) 961 (blink-matching-check-mismatch start end))
962 ((not start) t) 962 ((not start) t)
963 ((eq t (car (rassoc ender smie-closer-alist))) nil) 963 ((eq t (car (rassoc ender smie-closer-alist))) nil)
@@ -1012,6 +1012,9 @@ This uses SMIE's tables and is expected to be placed on `post-self-insert-hook'.
1012 (or (eq (char-before) last-command-event) 1012 (or (eq (char-before) last-command-event)
1013 (not (memq (char-before) 1013 (not (memq (char-before)
1014 smie-blink-matching-triggers))) 1014 smie-blink-matching-triggers)))
1015 ;; FIXME: For octave's "switch ... case ... case" we flash
1016 ;; `switch' at the end of the first `case' and we burp
1017 ;; "mismatch" at the end of the second `case'.
1015 (or smie-blink-matching-inners 1018 (or smie-blink-matching-inners
1016 (not (numberp (nth 2 (assoc token smie-grammar)))))) 1019 (not (numberp (nth 2 (assoc token smie-grammar))))))
1017 ;; The major mode might set blink-matching-check-function 1020 ;; The major mode might set blink-matching-check-function
@@ -1021,87 +1024,90 @@ This uses SMIE's tables and is expected to be placed on `post-self-insert-hook'.
1021 (let ((blink-matching-check-function #'smie-blink-matching-check)) 1024 (let ((blink-matching-check-function #'smie-blink-matching-check))
1022 (blink-matching-open)))))))) 1025 (blink-matching-open))))))))
1023 1026
1024(defface smie-matching-block-highlight '((t (:inherit highlight))) 1027(defvar-local smie--matching-block-data-cache nil)
1025 "Face used to highlight matching block." 1028
1026 :group 'smie) 1029(defun smie--opener/closer-at-point ()
1027 1030 "Return (OPENER TOKEN START END) or nil.
1028(defvar smie--highlight-matching-block-overlay nil) 1031OPENER is non-nil if TOKEN is an opener and nil if it's a closer."
1029(defvar-local smie--highlight-matching-block-lastpos -1) 1032 (let* ((start (point))
1030 1033 ;; Move to a previous position outside of a token.
1031(defun smie-highlight-matching-block () 1034 (_ (funcall smie-backward-token-function))
1032 (when (and smie-closer-alist 1035 ;; Move to the end of the token before point.
1033 (/= (point) smie--highlight-matching-block-lastpos)) 1036 (btok (funcall smie-forward-token-function))
1034 (unless (overlayp smie--highlight-matching-block-overlay) 1037 (bend (point)))
1035 (setq smie--highlight-matching-block-overlay 1038 (cond
1036 (make-overlay (point) (point)))) 1039 ;; Token before point is a closer?
1037 (setq smie--highlight-matching-block-lastpos (point)) 1040 ((and (>= bend start) (rassoc btok smie-closer-alist))
1038 (let ((beg-of-tok 1041 (funcall smie-backward-token-function)
1039 (lambda (&optional start) 1042 (when (< (point) start)
1040 "Move to the beginning of current token at START." 1043 (prog1 (list nil btok (point) bend)
1041 (let* ((token) 1044 (goto-char bend))))
1042 (start (or start (point))) 1045 ;; Token around point is an opener?
1043 (beg (progn 1046 ((and (> bend start) (assoc btok smie-closer-alist))
1047 (funcall smie-backward-token-function)
1048 (when (<= (point) start) (list t btok (point) bend)))
1049 ((<= bend start)
1050 (let ((atok (funcall smie-forward-token-function))
1051 (aend (point)))
1052 (cond
1053 ((< aend start) nil) ;Hopefully shouldn't happen.
1054 ;; Token after point is a closer?
1055 ((assoc atok smie-closer-alist)
1056 (funcall smie-backward-token-function)
1057 (when (<= (point) start)
1058 (list t atok (point) aend)))))))))
1059
1060(defun smie--matching-block-data (orig &rest args)
1061 "A function suitable for `show-paren-data-function' (which see)."
1062 (if (or (null smie-closer-alist)
1063 (eq (point) (car smie--matching-block-data-cache)))
1064 (or (cdr smie--matching-block-data-cache)
1065 (apply orig args))
1066 (setq smie--matching-block-data-cache (list (point)))
1067 (unless (nth 8 (syntax-ppss))
1068 (condition-case nil
1069 (let ((here (smie--opener/closer-at-point)))
1070 (when (and here
1071 (or smie-blink-matching-inners
1072 (not (numberp
1073 (nth (if (nth 0 here) 1 2)
1074 (assoc (nth 1 here) smie-grammar))))))
1075 (let ((there
1076 (cond
1077 ((car here) ; Opener.
1078 (let ((data (smie-forward-sexp 'halfsexp))
1079 (tend (point)))
1080 (unless (car data)
1044 (funcall smie-backward-token-function) 1081 (funcall smie-backward-token-function)
1045 (forward-comment (point-max)) 1082 (list (member (cons (nth 1 here) (nth 2 data))
1046 (point))) 1083 smie-closer-alist)
1047 (end (progn 1084 (point) tend))))
1048 (setq token (funcall smie-forward-token-function)) 1085 (t ;Closer.
1049 (forward-comment (- (point))) 1086 (let ((data (smie-backward-sexp 'halfsexp))
1050 (point)))) 1087 (htok (nth 1 here)))
1051 (if (and (<= beg start) (<= start end) 1088 (if (car data)
1052 (or (assoc token smie-closer-alist) 1089 (let* ((hprec (nth 2 (assoc htok smie-grammar)))
1053 (rassoc token smie-closer-alist))) 1090 (ttok (nth 2 data))
1054 (progn (goto-char beg) token) 1091 (tprec (nth 1 (assoc ttok smie-grammar))))
1055 (goto-char start) 1092 (when (and (numberp hprec) ;Here is an inner.
1056 nil)))) 1093 (eq hprec tprec))
1057 (highlight 1094 (goto-char (nth 1 data))
1058 (lambda (beg end) 1095 (let ((tbeg (point)))
1059 (move-overlay smie--highlight-matching-block-overlay 1096 (funcall smie-forward-token-function)
1060 beg end (current-buffer)) 1097 (list t tbeg (point)))))
1061 (overlay-put smie--highlight-matching-block-overlay 1098 (let ((tbeg (point)))
1062 'face 'smie-matching-block-highlight)))) 1099 (funcall smie-forward-token-function)
1063 (overlay-put smie--highlight-matching-block-overlay 'face nil) 1100 (list (member (cons (nth 2 data) htok)
1064 (unless (nth 8 (syntax-ppss)) 1101 smie-closer-alist)
1065 (save-excursion 1102 tbeg (point)))))))))
1066 (condition-case nil 1103 ;; Update the cache.
1067 (let ((token 1104 (setcdr smie--matching-block-data-cache
1068 (or (funcall beg-of-tok) 1105 (list (nth 2 here) (nth 3 here)
1069 (funcall beg-of-tok 1106 (nth 1 there) (nth 2 there)
1070 (prog1 (point) 1107 (not (nth 0 there)))))))
1071 (funcall smie-forward-token-function)))))) 1108 (scan-error nil))
1072 (cond 1109 (goto-char (car smie--matching-block-data-cache)))
1073 ((assoc token smie-closer-alist) ; opener 1110 (apply #'smie--matching-block-data orig args)))
1074 (forward-sexp 1)
1075 (let ((end (point))
1076 (closer (funcall smie-backward-token-function)))
1077 (when (rassoc closer smie-closer-alist)
1078 (funcall highlight (point) end))))
1079 ((rassoc token smie-closer-alist) ; closer
1080 (funcall smie-forward-token-function)
1081 (forward-sexp -1)
1082 (let ((beg (point))
1083 (opener (funcall smie-forward-token-function)))
1084 (when (assoc opener smie-closer-alist)
1085 (funcall highlight beg (point)))))))
1086 (scan-error)))))))
1087
1088(defvar smie--highlight-matching-block-timer nil)
1089
1090;;;###autoload
1091(define-minor-mode smie-highlight-matching-block-mode nil
1092 :global t :group 'smie
1093 (when (timerp smie--highlight-matching-block-timer)
1094 (cancel-timer smie--highlight-matching-block-timer))
1095 (setq smie--highlight-matching-block-timer nil)
1096 (if smie-highlight-matching-block-mode
1097 (progn
1098 (remove-hook 'post-self-insert-hook #'smie-blink-matching-open 'local)
1099 (setq smie--highlight-matching-block-timer
1100 (run-with-idle-timer 0.2 t #'smie-highlight-matching-block)))
1101 (when smie--highlight-matching-block-overlay
1102 (delete-overlay smie--highlight-matching-block-overlay)
1103 (setq smie--highlight-matching-block-overlay nil))
1104 (kill-local-variable 'smie--highlight-matching-block-lastpos)))
1105 1111
1106;;; The indentation engine. 1112;;; The indentation engine.
1107 1113
@@ -1799,9 +1805,10 @@ KEYWORDS are additional arguments, which can use the following keywords:
1799 (setq-local smie-closer-alist ca) 1805 (setq-local smie-closer-alist ca)
1800 ;; Only needed for interactive calls to blink-matching-open. 1806 ;; Only needed for interactive calls to blink-matching-open.
1801 (setq-local blink-matching-check-function #'smie-blink-matching-check) 1807 (setq-local blink-matching-check-function #'smie-blink-matching-check)
1802 (unless smie-highlight-matching-block-mode 1808 (add-hook 'post-self-insert-hook
1803 (add-hook 'post-self-insert-hook 1809 #'smie-blink-matching-open 'append 'local)
1804 #'smie-blink-matching-open 'append 'local)) 1810 (add-function :around (local 'show-paren-data-function)
1811 #'smie--matching-block-data)
1805 ;; Setup smie-blink-matching-triggers. Rather than wait for SPC to 1812 ;; Setup smie-blink-matching-triggers. Rather than wait for SPC to
1806 ;; blink, try to blink as soon as we type the last char of a block ender. 1813 ;; blink, try to blink as soon as we type the last char of a block ender.
1807 (let ((closers (sort (mapcar #'cdr smie-closer-alist) #'string-lessp)) 1814 (let ((closers (sort (mapcar #'cdr smie-closer-alist) #'string-lessp))
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index 0a4758a9ccd..3e850320133 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -56,12 +56,13 @@
56 ;; syntax-ppss-flush-cache since that would not only flush the cache but also 56 ;; syntax-ppss-flush-cache since that would not only flush the cache but also
57 ;; reset syntax-propertize--done which should not be done in this case). 57 ;; reset syntax-propertize--done which should not be done in this case).
58 "Mode-specific function to apply `syntax-table' text properties. 58 "Mode-specific function to apply `syntax-table' text properties.
59The value of this variable is a function to be called by Font 59It is the work horse of `syntax-propertize', which is called by things like
60Lock mode, prior to performing syntactic fontification on a 60Font-Lock and indentation.
61stretch of text. It is given two arguments, START and END: the 61
62start and end of the text to be fontified. Major modes can 62It is given two arguments, START and END: the start and end of the text to
63specify a custom function to apply `syntax-table' properties to 63which `syntax-table' might need to be applied. Major modes can use this to
64override the default syntax table in special cases. 64override the buffer's syntax table for special syntactic constructs that
65cannot be handled just by the buffer's syntax-table.
65 66
66The specified function may call `syntax-ppss' on any position 67The specified function may call `syntax-ppss' on any position
67before END, but it should not call `syntax-ppss-flush-cache', 68before END, but it should not call `syntax-ppss-flush-cache',
diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el
index 42643bf2317..f605c2865c0 100644
--- a/lisp/emacs-lisp/trace.el
+++ b/lisp/emacs-lisp/trace.el
@@ -262,7 +262,17 @@ be printed along with the arguments in the trace."
262 262
263(defun trace--read-args (prompt) 263(defun trace--read-args (prompt)
264 (cons 264 (cons
265 (intern (completing-read prompt obarray 'fboundp t)) 265 (let ((default (function-called-at-point))
266 (beg (string-match ":[ \t]*\\'" prompt)))
267 (intern (completing-read (if default
268 (format
269 "%s (default %s)%s"
270 (substring prompt 0 beg)
271 default
272 (if beg (substring prompt beg) ": "))
273 prompt)
274 obarray 'fboundp t nil nil
275 (if default (symbol-name default)))))
266 (when current-prefix-arg 276 (when current-prefix-arg
267 (list 277 (list
268 (read-buffer "Output to buffer: " trace-buffer) 278 (read-buffer "Output to buffer: " trace-buffer)
diff --git a/lisp/epa.el b/lisp/epa.el
index b567df5f40b..14f8879c1c6 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -620,21 +620,24 @@ If SECRET is non-nil, list secret keys instead of public keys."
620 (floor (* (/ current (float total)) 100)))) 620 (floor (* (/ current (float total)) 100))))
621 (message "%s..." prompt)))) 621 (message "%s..." prompt))))
622 622
623(defun epa-read-file-name (input)
624 "Interactively read an output file name based on INPUT file name."
625 (setq input (file-name-sans-extension (expand-file-name input)))
626 (expand-file-name
627 (read-file-name
628 (concat "To file (default " (file-name-nondirectory input) ") ")
629 (file-name-directory input)
630 input)))
631
623;;;###autoload 632;;;###autoload
624(defun epa-decrypt-file (decrypt-file plain-file) 633(defun epa-decrypt-file (decrypt-file &optional plain-file)
625 "Decrypt DECRYPT-FILE into PLAIN-FILE." 634 "Decrypt DECRYPT-FILE into PLAIN-FILE.
635If you do not specify PLAIN-FILE, this functions prompts for the value to use."
626 (interactive 636 (interactive
627 (let (file default-name plain) 637 (let* ((file (read-file-name "File to decrypt: "))
628 (setq file (read-file-name "File to decrypt: ")) 638 (plain (epa-read-file-name file)))
629 (setq default-name (file-name-sans-extension (expand-file-name file)))
630 (setq plain (expand-file-name
631 (read-file-name
632 (concat "To file (default "
633 (file-name-nondirectory default-name)
634 ") ")
635 (file-name-directory default-name)
636 default-name)))
637 (list file plain))) 639 (list file plain)))
640 (or plain-file (setq plain-file (epa-read-file-name decrypt-file)))
638 (setq decrypt-file (expand-file-name decrypt-file)) 641 (setq decrypt-file (expand-file-name decrypt-file))
639 (let ((context (epg-make-context epa-protocol))) 642 (let ((context (epg-make-context epa-protocol)))
640 (epg-context-set-passphrase-callback context 643 (epg-context-set-passphrase-callback context
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 4f5be776b09..76766144c18 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,7 @@
12013-05-30 Glenn Morris <rgm@gnu.org>
2
3 * erc-backend.el: Require erc at run-time too.
4
12013-05-21 Glenn Morris <rgm@gnu.org> 52013-05-21 Glenn Morris <rgm@gnu.org>
2 6
3 * erc-log.el (erc-network-name): Declare. 7 * erc-log.el (erc-network-name): Declare.
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 3d3ac791f08..4200d4aff7f 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -102,7 +102,8 @@
102;; There's a fairly strong mutual dependency between erc.el and erc-backend.el. 102;; There's a fairly strong mutual dependency between erc.el and erc-backend.el.
103;; Luckily, erc.el does not need erc-backend.el for macroexpansion whereas the 103;; Luckily, erc.el does not need erc-backend.el for macroexpansion whereas the
104;; reverse is true: 104;; reverse is true:
105(eval-when-compile (provide 'erc-backend) (require 'erc)) 105(provide 'erc-backend)
106(require 'erc)
106 107
107;;;; Variables and options 108;;;; Variables and options
108 109
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index 426db3232ed..7120f639a70 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -243,6 +243,12 @@ to writing a completion function."
243 243
244;;; Functions: 244;;; Functions:
245 245
246(defun eshell-complete-lisp-symbol ()
247 "Try to complete the text around point as a Lisp symbol."
248 (interactive)
249 (let ((completion-at-point-functions '(lisp-completion-at-point)))
250 (completion-at-point)))
251
246(defun eshell-cmpl-initialize () 252(defun eshell-cmpl-initialize ()
247 "Initialize the completions module." 253 "Initialize the completions module."
248 (set (make-local-variable 'pcomplete-command-completion-function) 254 (set (make-local-variable 'pcomplete-command-completion-function)
@@ -279,17 +285,17 @@ to writing a completion function."
279 eshell-cmpl-restore-window-delay) 285 eshell-cmpl-restore-window-delay)
280 (set (make-local-variable 'pcomplete-use-paring) 286 (set (make-local-variable 'pcomplete-use-paring)
281 eshell-cmpl-use-paring) 287 eshell-cmpl-use-paring)
282 ;; `pcomplete-arg-quote-list' should only be set after all the 288 ;; `comint-file-name-quote-list' should only be set after all the
283 ;; load-hooks for any other extension modules have been run, which 289 ;; load-hooks for any other extension modules have been run, which
284 ;; is true at the time `eshell-mode-hook' is run 290 ;; is true at the time `eshell-mode-hook' is run
285 (add-hook 'eshell-mode-hook 291 (add-hook 'eshell-mode-hook
286 (function 292 (function
287 (lambda () 293 (lambda ()
288 (set (make-local-variable 'pcomplete-arg-quote-list) 294 (set (make-local-variable 'comint-file-name-quote-list)
289 eshell-special-chars-outside-quoting))) nil t) 295 eshell-special-chars-outside-quoting))) nil t)
290 (add-hook 'pcomplete-quote-arg-hook 'eshell-quote-backslash nil t) 296 (add-hook 'pcomplete-quote-arg-hook 'eshell-quote-backslash nil t)
291 (define-key eshell-mode-map [(meta tab)] 'lisp-complete-symbol) 297 (define-key eshell-mode-map [(meta tab)] 'eshell-complete-lisp-symbol)
292 (define-key eshell-mode-map [(meta control ?i)] 'lisp-complete-symbol) 298 (define-key eshell-mode-map [(meta control ?i)] 'eshell-complete-lisp-symbol)
293 (define-key eshell-command-map [(meta ?h)] 'eshell-completion-help) 299 (define-key eshell-command-map [(meta ?h)] 'eshell-completion-help)
294 (define-key eshell-command-map [tab] 'pcomplete-expand-and-complete) 300 (define-key eshell-command-map [tab] 'pcomplete-expand-and-complete)
295 (define-key eshell-command-map [(control ?i)] 301 (define-key eshell-command-map [(control ?i)]
@@ -347,7 +353,7 @@ to writing a completion function."
347 (setq begin (1+ (cadr delim)) 353 (setq begin (1+ (cadr delim))
348 args (eshell-parse-arguments begin end))) 354 args (eshell-parse-arguments begin end)))
349 ((eq (car delim) ?\() 355 ((eq (car delim) ?\()
350 (lisp-complete-symbol) 356 (eshell-complete-lisp-symbol)
351 (throw 'pcompleted t)) 357 (throw 'pcompleted t))
352 (t 358 (t
353 (insert-and-inherit "\t") 359 (insert-and-inherit "\t")
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index c93bbe9ecb1..e8fbe0518ac 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -207,7 +207,8 @@ Thus, this does not include the current directory.")
207 (when eshell-cd-on-directory 207 (when eshell-cd-on-directory
208 (make-local-variable 'eshell-interpreter-alist) 208 (make-local-variable 'eshell-interpreter-alist)
209 (setq eshell-interpreter-alist 209 (setq eshell-interpreter-alist
210 (cons (cons 'eshell-lone-directory-p 210 (cons (cons #'(lambda (file args)
211 (eshell-lone-directory-p file))
211 'eshell-dirs-substitute-cd) 212 'eshell-dirs-substitute-cd)
212 eshell-interpreter-alist))) 213 eshell-interpreter-alist)))
213 214
diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el
index 711b2e21468..b073928738f 100644
--- a/lisp/eshell/em-script.el
+++ b/lisp/eshell/em-script.el
@@ -61,9 +61,10 @@ This includes when running `eshell-command'."
61 "Initialize the script parsing code." 61 "Initialize the script parsing code."
62 (make-local-variable 'eshell-interpreter-alist) 62 (make-local-variable 'eshell-interpreter-alist)
63 (setq eshell-interpreter-alist 63 (setq eshell-interpreter-alist
64 (cons '((lambda (file) 64 (cons (cons #'(lambda (file args)
65 (string= (file-name-nondirectory file) 65 (string= (file-name-nondirectory file)
66 "eshell")) . eshell/source) 66 "eshell"))
67 'eshell/source)
67 eshell-interpreter-alist)) 68 eshell-interpreter-alist))
68 (make-local-variable 'eshell-complex-commands) 69 (make-local-variable 'eshell-complex-commands)
69 (setq eshell-complex-commands 70 (setq eshell-complex-commands
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el
index e5360f2deb4..2932f443e4f 100644
--- a/lisp/eshell/em-term.el
+++ b/lisp/eshell/em-term.el
@@ -31,6 +31,7 @@
31 31
32;;; Code: 32;;; Code:
33 33
34(require 'cl-lib)
34(require 'esh-util) 35(require 'esh-util)
35(require 'esh-ext) 36(require 'esh-ext)
36(eval-when-compile (require 'eshell)) 37(eval-when-compile (require 'eshell))
@@ -61,10 +62,57 @@ which commands are considered visual in nature."
61 "less" "more" ; M-x view-file 62 "less" "more" ; M-x view-file
62 "lynx" "ncftp" ; w3.el, ange-ftp 63 "lynx" "ncftp" ; w3.el, ange-ftp
63 "pine" "tin" "trn" "elm") ; GNUS!! 64 "pine" "tin" "trn" "elm") ; GNUS!!
64 "A list of commands that present their output in a visual fashion." 65 "A list of commands that present their output in a visual fashion.
66
67Commands listed here are run in a term buffer.
68
69See also `eshell-visual-subcommands' and `eshell-visual-options'."
65 :type '(repeat string) 70 :type '(repeat string)
66 :group 'eshell-term) 71 :group 'eshell-term)
67 72
73(defcustom eshell-visual-subcommands
74 nil
75 "An alist of subcommands that present their output in a visual fashion.
76
77An alist of the form
78
79 ((COMMAND1 SUBCOMMAND1 SUBCOMMAND2...)
80 (COMMAND2 SUBCOMMAND1 ...))
81
82of commands with subcommands that present their output in a
83visual fashion. A likely entry is
84
85 (\"git\" \"log\" \"diff\" \"show\")
86
87because git shows logs and diffs using a pager by default.
88
89See also `eshell-visual-commands' and `eshell-visual-options'."
90 :type '(repeat (cons (string :tag "Command")
91 (repeat (string :tag "Subcommand"))))
92 :version "24.4"
93 :group 'eshell-term)
94
95(defcustom eshell-visual-options
96 nil
97 "An alist of the form
98
99 ((COMMAND1 OPTION1 OPTION2...)
100 (COMMAND2 OPTION1 ...))
101
102of commands with options that present their output in a visual
103fashion. For example, a sensible entry would be
104
105 (\"git\" \"--help\")
106
107because \"git <command> --help\" shows the command's
108documentation with a pager.
109
110See also `eshell-visual-commands' and `eshell-visual-subcommands'."
111 :type '(repeat (cons (string :tag "Command")
112 (repeat (string :tag "Option"))))
113 :version "24.4"
114 :group 'eshell-term)
115
68;; If you change this from term-term-name, you need to ensure that the 116;; If you change this from term-term-name, you need to ensure that the
69;; value you choose exists in the system's terminfo database. (Bug#12485) 117;; value you choose exists in the system's terminfo database. (Bug#12485)
70(defcustom eshell-term-name term-term-name 118(defcustom eshell-term-name term-term-name
@@ -77,8 +125,10 @@ used."
77 125
78(defcustom eshell-escape-control-x t 126(defcustom eshell-escape-control-x t
79 "If non-nil, allow <C-x> to be handled by Emacs key in visual buffers. 127 "If non-nil, allow <C-x> to be handled by Emacs key in visual buffers.
80See the variable `eshell-visual-commands'. If this variable is set to 128See the variables `eshell-visual-commands',
81nil, <C-x> will send that control character to the invoked process." 129`eshell-visual-subcommands', and `eshell-visual-options'. If
130this variable is set to nil, <C-x> will send that control
131character to the invoked process."
82 :type 'boolean 132 :type 'boolean
83 :group 'eshell-term) 133 :group 'eshell-term)
84 134
@@ -92,19 +142,29 @@ nil, <C-x> will send that control character to the invoked process."
92 "Initialize the `term' interface code." 142 "Initialize the `term' interface code."
93 (make-local-variable 'eshell-interpreter-alist) 143 (make-local-variable 'eshell-interpreter-alist)
94 (setq eshell-interpreter-alist 144 (setq eshell-interpreter-alist
95 (cons (cons (function 145 (cons (cons #'eshell-visual-command-p
96 (lambda (command)
97 (member (file-name-nondirectory command)
98 eshell-visual-commands)))
99 'eshell-exec-visual) 146 'eshell-exec-visual)
100 eshell-interpreter-alist))) 147 eshell-interpreter-alist)))
101 148
149(defun eshell-visual-command-p (command args)
150 "Returns non-nil when given a visual command.
151If either COMMAND or a subcommand in ARGS (e.g. git log) is a
152visual command, returns non-nil."
153 (let ((command (file-name-nondirectory command)))
154 (and (eshell-interactive-output-p)
155 (or (member command eshell-visual-commands)
156 (member (car args)
157 (cdr (assoc command eshell-visual-subcommands)))
158 (cl-intersection args
159 (cdr (assoc command eshell-visual-options))
160 :test 'string=)))))
161
102(defun eshell-exec-visual (&rest args) 162(defun eshell-exec-visual (&rest args)
103 "Run the specified PROGRAM in a terminal emulation buffer. 163 "Run the specified PROGRAM in a terminal emulation buffer.
104ARGS are passed to the program. At the moment, no piping of input is 164ARGS are passed to the program. At the moment, no piping of input is
105allowed." 165allowed."
106 (let* (eshell-interpreter-alist 166 (let* (eshell-interpreter-alist
107 (interp (eshell-find-interpreter (car args))) 167 (interp (eshell-find-interpreter (car args) (cdr args)))
108 (program (car interp)) 168 (program (car interp))
109 (args (eshell-flatten-list 169 (args (eshell-flatten-list
110 (eshell-stringify-list (append (cdr interp) 170 (eshell-stringify-list (append (cdr interp)
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el
index c4e4c000bda..474e536de2e 100644
--- a/lisp/eshell/esh-ext.el
+++ b/lisp/eshell/esh-ext.el
@@ -125,9 +125,10 @@ Each member is a cons cell of the form:
125 125
126 (MATCH . INTERPRETER) 126 (MATCH . INTERPRETER)
127 127
128MATCH should be a regexp, which is matched against the command name, 128MATCH should be a regexp, which is matched against the command
129or a function. If either returns a non-nil value, then INTERPRETER 129name, or a function of arity 2 receiving the COMMAND and its
130will be used for that command. 130ARGS (a list). If either returns a non-nil value, then
131INTERPRETER will be used for that command.
131 132
132If INTERPRETER is a string, it will be called as the command name, 133If INTERPRETER is a string, it will be called as the command name,
133with the original command name passed as the first argument, with all 134with the original command name passed as the first argument, with all
@@ -215,6 +216,7 @@ causing the user to wonder if anything's really going on..."
215 (setq args (eshell-stringify-list (eshell-flatten-list args))) 216 (setq args (eshell-stringify-list (eshell-flatten-list args)))
216 (let ((interp (eshell-find-interpreter 217 (let ((interp (eshell-find-interpreter
217 command 218 command
219 args
218 ;; `eshell-find-interpreter' does not work correctly 220 ;; `eshell-find-interpreter' does not work correctly
219 ;; for Tramp file name syntax. But we don't need to 221 ;; for Tramp file name syntax. But we don't need to
220 ;; know the interpreter in that case, therefore the 222 ;; know the interpreter in that case, therefore the
@@ -267,7 +269,7 @@ Return nil, or a list of the form:
267 (list (match-string 1) 269 (list (match-string 1)
268 file))))))) 270 file)))))))
269 271
270(defun eshell-find-interpreter (file &optional no-examine-p) 272(defun eshell-find-interpreter (file args &optional no-examine-p)
271 "Find the command interpreter with which to execute FILE. 273 "Find the command interpreter with which to execute FILE.
272If NO-EXAMINE-P is non-nil, FILE will not be inspected for a script 274If NO-EXAMINE-P is non-nil, FILE will not be inspected for a script
273line of the form #!<interp>." 275line of the form #!<interp>."
@@ -277,8 +279,9 @@ line of the form #!<interp>."
277 (dolist (possible eshell-interpreter-alist) 279 (dolist (possible eshell-interpreter-alist)
278 (cond 280 (cond
279 ((functionp (car possible)) 281 ((functionp (car possible))
280 (and (funcall (car possible) file) 282 (let ((fn (car possible)))
281 (throw 'found (cdr possible)))) 283 (and (funcall fn file args)
284 (throw 'found (cdr possible)))))
282 ((stringp (car possible)) 285 ((stringp (car possible))
283 (and (string-match (car possible) file) 286 (and (string-match (car possible) file)
284 (throw 'found (cdr possible)))) 287 (throw 'found (cdr possible))))
@@ -312,7 +315,7 @@ line of the form #!<interp>."
312 (setq interp (eshell-script-interpreter fullname)) 315 (setq interp (eshell-script-interpreter fullname))
313 (if interp 316 (if interp
314 (setq interp 317 (setq interp
315 (cons (car (eshell-find-interpreter (car interp) t)) 318 (cons (car (eshell-find-interpreter (car interp) args t))
316 (cdr interp))))) 319 (cdr interp)))))
317 (or interp (list fullname))))))) 320 (or interp (list fullname)))))))
318 321
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index ee857cf20f3..5346bd16fd2 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -326,11 +326,8 @@ and the hook `eshell-exit-hook'."
326 (if mode-line-elt 326 (if mode-line-elt
327 (setcar mode-line-elt 'eshell-command-running-string)))) 327 (setcar mode-line-elt 'eshell-command-running-string))))
328 328
329 (define-key eshell-mode-map [return] 'eshell-send-input) 329 (define-key eshell-mode-map "\r" 'eshell-send-input)
330 (define-key eshell-mode-map [(control ?m)] 'eshell-send-input) 330 (define-key eshell-mode-map "\M-\r" 'eshell-queue-input)
331 (define-key eshell-mode-map [(control ?j)] 'eshell-send-input)
332 (define-key eshell-mode-map [(meta return)] 'eshell-queue-input)
333 (define-key eshell-mode-map [(meta control ?m)] 'eshell-queue-input)
334 (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output) 331 (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output)
335 (define-key eshell-mode-map [(control ?a)] 'eshell-bol) 332 (define-key eshell-mode-map [(control ?a)] 'eshell-bol)
336 333
diff --git a/lisp/finder.el b/lisp/finder.el
index 3d988b41bde..f6593c554eb 100644
--- a/lisp/finder.el
+++ b/lisp/finder.el
@@ -206,7 +206,8 @@ from; the default is `load-path'."
206 (setq version (ignore-errors (version-to-list version))) 206 (setq version (ignore-errors (version-to-list version)))
207 (setq entry (assq package package--builtins)) 207 (setq entry (assq package package--builtins))
208 (cond ((null entry) 208 (cond ((null entry)
209 (push (cons package (vector version nil summary)) 209 (push (cons package
210 (package-make-builtin version summary))
210 package--builtins)) 211 package--builtins))
211 ((eq base-name package) 212 ((eq base-name package)
212 (setq desc (cdr entry)) 213 (setq desc (cdr entry))
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index d18aea61236..8f4363b0bdf 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -2328,7 +2328,7 @@ in which C preprocessor directives are used. e.g. `asm-mode' and
2328 (1 font-lock-keyword-face) 2328 (1 font-lock-keyword-face)
2329 (2 font-lock-constant-face nil t)) 2329 (2 font-lock-constant-face nil t))
2330 ;; Erroneous structures. 2330 ;; Erroneous structures.
2331 ("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\_>" 1 font-lock-warning-face) 2331 ("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|\\(?:user-\\)?error\\|signal\\)\\_>" 1 font-lock-warning-face)
2332 ;; Words inside \\[] tend to be for `substitute-command-keys'. 2332 ;; Words inside \\[] tend to be for `substitute-command-keys'.
2333 ("\\\\\\\\\\[\\(\\(?:\\sw\\|\\s_\\)+\\)\\]" 2333 ("\\\\\\\\\\[\\(\\(?:\\sw\\|\\s_\\)+\\)\\]"
2334 (1 font-lock-constant-face prepend)) 2334 (1 font-lock-constant-face prepend))
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 3cfca4525f0..ac5cdfafca2 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,108 @@
12013-06-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * eww.el (eww-convert-widgets): Make widgets from non-tabular layouts
4 work, too.
5 (eww-tag-select): Implement <select>.
6
72013-06-10 Albert Krewinkel <krewinkel@moltkeplatz.de>
8
9 * sieve-manage.el (sieve-manage-open): work with STARTTLS: shorten
10 stream managing functions by using open-protocol-stream to do most of
11 the work. Has the nice benefit of enabling STARTTLS.
12 Wait for capabilities after STARTTLS: following RFC5804, the server
13 sends new capabilities after successfully establishing a TLS connection
14 with the client. The client should update the cached list of
15 capabilities, but we just ignore the answer for now.
16 (sieve-manage-network-p, sieve-manage-network-open)
17 (sieve-manage-starttls-p, sieve-manage-starttls-open)
18 (sieve-manage-forward, sieve-manage-streams)
19 (sieve-manage-stream-alist): Remove unneeded functions neither in the
20 API, nor called by any other function.
21 Enable Multibyte for SieveManage buffers: The parser won't properly
22 handle umlauts and line endings unless multibyte is turned on in the
23 process buffer.
24
252013-06-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
26
27 * eww.el (eww-tag-input): Support password fields.
28 (eww-submit): Support POST.
29
302013-06-10 Lars Magne Ingebrigtsen <larsi@gnus.org>
31
32 * eww.el (eww-tag-form): Protect against degenerate forms.
33
34 * shr.el (shr-expand-url): Expand URLs that start with a slash
35 correctly.
36
37 * eww.el (eww-submit): Get submit button logic right.
38
39 * shr.el (shr-final-table-render): New variable to signal when we're
40 doing the final table rendering so that we can collect more data at
41 that point.
42
43 * eww.el (eww-submit): Make form submission work.
44 (eww-tag-input): Implement submit buttons.
45 (eww-click-radio): Implement radio and checkboxes.
46 (eww-submit): Handle hidden elements.
47
48 * shr.el (shr-descend): Allow other packages to override (or provide)
49 rendering of elements.
50 (shr-expand-url): Strip query strings from URLs before expanding them.
51
52 * eww.el: Don't require cl-lib.
53 (eww-tag-form): Start form support.
54
55 * eww.el: Start writing a new, tiny web browser.
56 (eww-previous-url): New command.
57 (eww-quit): New command.
58
592013-06-10 Albert Krewinkel <krewinkel@moltkeplatz.de>
60
61 * sieve.el: Put point at beginning of buffer when viewing a script.
62 (sieve-open-server): respect the PORT parameter. Show the correct port
63 number in sieve-buffer's header. Fixed code to also work with a string
64 as port specifier. Properly close the connection on pressing 'q'. Make
65 sieve-manage-quit close the connection and process buffer. Also, remove
66 duplicate keybinding for 'q'.
67
682013-06-10 Roy Hashimoto <roy.hashimoto@gmail.com> (tiny change)
69
70 * mm-view.el (mm-pkcs7-signed-magic): Allow newline in the regexp and
71 make it easier to read.
72 (mm-pkcs7-enveloped-magic): Ditto.
73
742013-06-06 Teodor Zlatanov <tzz@lifelogs.com>
75
76 * gnus-ems.el (gnus-image-type-available-p): Test `display-images-p'
77 before `image-type-available-p' to avoid loading the image libraries
78 needlessly.
79
802013-06-04 Katsumi Yamaoka <yamaoka@jpl.org>
81
82 * gnus-art.el (article-date-ut, article-update-date-lapsed): Don't
83 assume Date header begins with "Date", that may be customized into
84 something like "X-Sent" using gnus-article-time-format.
85 (article-transform-date): Allow multi-line Date header.
86
872013-06-02 David Engster <deng@randomsample.de>
88
89 * registry.el (initialize-instance, registry-lookup)
90 (registry-lookup-breaks-before-lexbind, registry-lookup-secondary)
91 (registry-lookup-secondary-value, registry-search, registry-delete)
92 (registry-insert, registry-reindex, registry-size, registry-prune): Do
93 not wrap methods in `eval-and-compile'. This breaks due to latest
94 changes in EIEIO (introduction of eieio-core.el).
95
962013-05-30 Glenn Morris <rgm@gnu.org>
97
98 * nnmail.el (nnmail-fancy-expiry-target):
99 Also bind mail-dont-reply-to-names.
100
101 * spam-stat.el (spam-stat-save):
102 No need to tweak font-lock in temp buffers.
103
104 * shr.el (shr-put-image): Silence compiler.
105
12013-05-29 Glenn Morris <rgm@gnu.org> 1062013-05-29 Glenn Morris <rgm@gnu.org>
2 107
3 * gnus-ems.el (set-process-plist): Every supported Emacs has this. 108 * gnus-ems.el (set-process-plist): Every supported Emacs has this.
diff --git a/lisp/gnus/eww.el b/lisp/gnus/eww.el
new file mode 100644
index 00000000000..3e799732ecb
--- /dev/null
+++ b/lisp/gnus/eww.el
@@ -0,0 +1,349 @@
1;;; eww.el --- Emacs Web Wowser
2
3;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6;; Keywords: html
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;;; Code:
26
27(eval-when-compile (require 'cl))
28(require 'shr)
29(require 'url)
30(require 'mm-url)
31
32(defvar eww-current-url nil)
33(defvar eww-history nil)
34
35;;;###autoload
36(defun eww (url)
37 "Fetch URL and render the page."
38 (interactive "sUrl: ")
39 (url-retrieve url 'eww-render (list url)))
40
41(defun eww-render (status url &optional point)
42 (let* ((headers (eww-parse-headers))
43 (content-type
44 (mail-header-parse-content-type
45 (or (cdr (assoc "content-type" headers))
46 "text/plain")))
47 (charset (intern
48 (downcase
49 (or (cdr (assq 'charset (cdr content-type)))
50 "utf8"))))
51 (data-buffer (current-buffer)))
52 (unwind-protect
53 (progn
54 (cond
55 ((equal (car content-type) "text/html")
56 (eww-display-html charset url))
57 ((string-match "^image/" (car content-type))
58 (eww-display-image))
59 (t
60 (eww-display-raw charset)))
61 (when point
62 (goto-char point)))
63 (kill-buffer data-buffer))))
64
65(defun eww-parse-headers ()
66 (let ((headers nil))
67 (while (and (not (eobp))
68 (not (eolp)))
69 (when (looking-at "\\([^:]+\\): *\\(.*\\)")
70 (push (cons (downcase (match-string 1))
71 (match-string 2))
72 headers))
73 (forward-line 1))
74 (unless (eobp)
75 (forward-line 1))
76 headers))
77
78(defun eww-display-html (charset url)
79 (unless (eq charset 'utf8)
80 (decode-coding-region (point) (point-max) charset))
81 (let ((document
82 (list
83 'base (list (cons 'href url))
84 (libxml-parse-html-region (point) (point-max)))))
85 (eww-setup-buffer)
86 (setq eww-current-url url)
87 (let ((inhibit-read-only t)
88 (shr-external-rendering-functions
89 '((form . eww-tag-form)
90 (input . eww-tag-input)
91 (select . eww-tag-select))))
92 (shr-insert-document document)
93 (eww-convert-widgets))
94 (goto-char (point-min))))
95
96(defun eww-display-raw (charset)
97 (let ((data (buffer-substring (point) (point-max))))
98 (eww-setup-buffer)
99 (let ((inhibit-read-only t))
100 (insert data))
101 (goto-char (point-min))))
102
103(defun eww-display-image ()
104 (let ((data (buffer-substring (point) (point-max))))
105 (eww-setup-buffer)
106 (let ((inhibit-read-only t))
107 (shr-put-image data nil))
108 (goto-char (point-min))))
109
110(defun eww-setup-buffer ()
111 (pop-to-buffer (get-buffer-create "*eww*"))
112 (remove-overlays)
113 (setq widget-field-list nil)
114 (let ((inhibit-read-only t))
115 (erase-buffer))
116 (eww-mode))
117
118(defvar eww-mode-map
119 (let ((map (make-sparse-keymap)))
120 (suppress-keymap map)
121 (define-key map "q" 'eww-quit)
122 (define-key map "g" 'eww-reload)
123 (define-key map [tab] 'widget-forward)
124 (define-key map [backtab] 'widget-backward)
125 (define-key map [delete] 'scroll-down-command)
126 (define-key map "\177" 'scroll-down-command)
127 (define-key map " " 'scroll-up-command)
128 (define-key map "p" 'eww-previous-url)
129 ;;(define-key map "n" 'eww-next-url)
130 map))
131
132(defun eww-mode ()
133 "Mode for browsing the web.
134
135\\{eww-mode-map}"
136 (interactive)
137 (setq major-mode 'eww-mode
138 mode-name "eww")
139 (set (make-local-variable 'eww-current-url) 'author)
140 (set (make-local-variable 'browse-url-browser-function) 'eww-browse-url)
141 ;;(setq buffer-read-only t)
142 (use-local-map eww-mode-map))
143
144(defun eww-browse-url (url &optional new-window)
145 (push (list eww-current-url (point))
146 eww-history)
147 (eww url))
148
149(defun eww-quit ()
150 "Exit the Emacs Web Wowser."
151 (interactive)
152 (setq eww-history nil)
153 (kill-buffer (current-buffer)))
154
155(defun eww-previous-url ()
156 "Go to the previously displayed page."
157 (interactive)
158 (when (zerop (length eww-history))
159 (error "No previous page"))
160 (let ((prev (pop eww-history)))
161 (url-retrieve (car prev) 'eww-render (list (car prev) (cadr prev)))))
162
163(defun eww-reload ()
164 "Reload the current page."
165 (interactive)
166 (url-retrieve eww-current-url 'eww-render
167 (list eww-current-url (point))))
168
169;; Form support.
170
171(defvar eww-form nil)
172
173(defun eww-tag-form (cont)
174 (let ((eww-form
175 (list (assq :method cont)
176 (assq :action cont)))
177 (start (point)))
178 (shr-ensure-paragraph)
179 (shr-generic cont)
180 (shr-ensure-paragraph)
181 (when (> (point) start)
182 (put-text-property start (1+ start)
183 'eww-form eww-form))))
184
185(defun eww-tag-input (cont)
186 (let* ((start (point))
187 (type (downcase (or (cdr (assq :type cont))
188 "text")))
189 (widget
190 (cond
191 ((equal type "submit")
192 (list
193 'push-button
194 :notify 'eww-submit
195 :name (cdr (assq :name cont))
196 :eww-form eww-form
197 (or (cdr (assq :value cont)) "Submit")))
198 ((or (equal type "radio")
199 (equal type "checkbox"))
200 (list 'checkbox
201 :notify 'eww-click-radio
202 :name (cdr (assq :name cont))
203 :checkbox-value (cdr (assq :value cont))
204 :checkbox-type type
205 :eww-form eww-form
206 (cdr (assq :checked cont))))
207 ((equal type "hidden")
208 (list 'hidden
209 :name (cdr (assq :name cont))
210 :value (cdr (assq :value cont))))
211 (t
212 (list
213 'editable-field
214 :size (string-to-number
215 (or (cdr (assq :size cont))
216 "40"))
217 :value (or (cdr (assq :value cont)) "")
218 :secret (and (equal type "password") ?*)
219 :action 'eww-submit
220 :name (cdr (assq :name cont))
221 :eww-form eww-form)))))
222 (if (eq (car widget) 'hidden)
223 (when shr-final-table-render
224 (nconc eww-form (list widget)))
225 (apply 'widget-create widget))
226 (put-text-property start (point) 'eww-widget widget)
227 (insert " ")))
228
229(defun eww-tag-select (cont)
230 (shr-ensure-paragraph)
231 (let ((menu (list 'menu-choice
232 :name (cdr (assq :name cont))
233 :eww-form eww-form))
234 (options nil)
235 (start (point)))
236 (dolist (elem cont)
237 (when (eq (car elem) 'option)
238 (when (cdr (assq :selected (cdr elem)))
239 (nconc menu (list :value
240 (cdr (assq :value (cdr elem))))))
241 (push (list 'item
242 :value (cdr (assq :value (cdr elem)))
243 :tag (cdr (assq 'text (cdr elem))))
244 options)))
245 (nconc menu options)
246 (apply 'widget-create menu)
247 (put-text-property start (point) 'eww-widget menu)
248 (shr-ensure-paragraph)))
249
250(defun eww-click-radio (widget &rest ignore)
251 (let ((form (plist-get (cdr widget) :eww-form))
252 (name (plist-get (cdr widget) :name)))
253 (when (equal (plist-get (cdr widget) :type) "radio")
254 (if (widget-value widget)
255 ;; Switch all the other radio buttons off.
256 (dolist (overlay (overlays-in (point-min) (point-max)))
257 (let ((field (plist-get (overlay-properties overlay) 'button)))
258 (when (and (eq (plist-get (cdr field) :eww-form) form)
259 (equal name (plist-get (cdr field) :name)))
260 (unless (eq field widget)
261 (widget-value-set field nil)))))
262 (widget-value-set widget t)))
263 (eww-fix-widget-keymap)))
264
265(defun eww-submit (widget &rest ignore)
266 (let ((form (plist-get (cdr widget) :eww-form))
267 (first-button t)
268 values)
269 (dolist (overlay (sort (overlays-in (point-min) (point-max))
270 (lambda (o1 o2)
271 (< (overlay-start o1) (overlay-start o2)))))
272 (let ((field (or (plist-get (overlay-properties overlay) 'field)
273 (plist-get (overlay-properties overlay) 'button)
274 (plist-get (overlay-properties overlay) 'eww-hidden))))
275 (when (eq (plist-get (cdr field) :eww-form) form)
276 (let ((name (plist-get (cdr field) :name)))
277 (when name
278 (cond
279 ((eq (car field) 'checkbox)
280 (when (widget-value field)
281 (push (cons name (plist-get (cdr field) :checkbox-value))
282 values)))
283 ((eq (car field) 'eww-hidden)
284 (push (cons name (plist-get (cdr field) :value))
285 values))
286 ((eq (car field) 'push-button)
287 ;; We want the values from buttons if we hit a button,
288 ;; or we're submitting something and this is the first
289 ;; button displayed.
290 (when (or (and (eq (car widget) 'push-button)
291 (eq widget field))
292 (and (not (eq (car widget) 'push-button))
293 (eq (car field) 'push-button)
294 first-button))
295 (setq first-button nil)
296 (push (cons name (widget-value field))
297 values)))
298 (t
299 (push (cons name (widget-value field))
300 values))))))))
301 (dolist (elem form)
302 (when (and (consp elem)
303 (eq (car elem) 'hidden))
304 (push (cons (plist-get (cdr elem) :name)
305 (plist-get (cdr elem) :value))
306 values)))
307 (let ((shr-base eww-current-url))
308 (if (and (stringp (cdr (assq :method form)))
309 (equal (downcase (cdr (assq :method form))) "post"))
310 (let ((url-request-method "POST")
311 (url-request-extra-headers
312 '(("Content-Type" . "application/x-www-form-urlencoded")))
313 (url-request-data (mm-url-encode-www-form-urlencoded values)))
314 (eww-browse-url (shr-expand-url (cdr (assq :action form)))))
315 (eww-browse-url
316 (shr-expand-url
317 (concat
318 (cdr (assq :action form))
319 "?"
320 (mm-url-encode-www-form-urlencoded values))))))))
321
322(defun eww-convert-widgets ()
323 (let ((start (point-min))
324 widget)
325 ;; Some widgets come from different buffers (rendered for tables),
326 ;; so we need to nix out the list of widgets and recreate them.
327 (setq widget-field-list nil
328 widget-field-new nil)
329 (while (setq start (next-single-property-change start 'eww-widget))
330 (setq widget (get-text-property start 'eww-widget))
331 (goto-char start)
332 (let ((end (next-single-property-change start 'eww-widget)))
333 (dolist (overlay (overlays-in start end))
334 (when (or (plist-get (overlay-properties overlay) 'button)
335 (plist-get (overlay-properties overlay) 'field))
336 (delete-overlay overlay)))
337 (delete-region start end))
338 (apply 'widget-create widget))
339 (widget-setup)
340 (eww-fix-widget-keymap)))
341
342(defun eww-fix-widget-keymap ()
343 (dolist (overlay (overlays-in (point-min) (point-max)))
344 (when (plist-get (overlay-properties overlay) 'button)
345 (overlay-put overlay 'local-map widget-keymap))))
346
347(provide 'eww)
348
349;;; eww.el ends here
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 23603bc7722..65f4b76ad19 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -3430,15 +3430,13 @@ possible values."
3430 (visible-date (mail-fetch-field "Date")) 3430 (visible-date (mail-fetch-field "Date"))
3431 pos date bface eface) 3431 pos date bface eface)
3432 (save-excursion 3432 (save-excursion
3433 (goto-char (point-min))
3434 (when (re-search-forward "^Date:" nil t)
3435 (setq bface (get-text-property (point-at-bol) 'face)
3436 eface (get-text-property (1- (point-at-eol)) 'face)))
3437 ;; Delete any old Date headers.
3438 (if date-position 3433 (if date-position
3439 (progn 3434 (progn
3440 (goto-char date-position) 3435 (goto-char date-position)
3441 (setq date (get-text-property (point) 'original-date)) 3436 (setq date (get-text-property (point) 'original-date))
3437 (when (looking-at "[^:]+:[\t ]*")
3438 (setq bface (get-text-property (match-beginning 0) 'face)
3439 eface (get-text-property (match-end 0) 'face)))
3442 (delete-region (point) 3440 (delete-region (point)
3443 (progn 3441 (progn
3444 (gnus-article-forward-header) 3442 (gnus-article-forward-header)
@@ -3454,12 +3452,26 @@ possible values."
3454 (narrow-to-region pos (if (search-forward "\n\n" nil t) 3452 (narrow-to-region pos (if (search-forward "\n\n" nil t)
3455 (1+ (match-beginning 0)) 3453 (1+ (match-beginning 0))
3456 (point-max))) 3454 (point-max)))
3457 (goto-char (point-min)) 3455 (while (setq pos (text-property-not-all pos (point-max)
3458 (while (re-search-forward "^Date:" nil t) 3456 'gnus-date-type nil))
3459 (setq date (get-text-property (match-beginning 0) 'original-date)) 3457 (setq date (get-text-property pos 'original-date))
3460 (delete-region (point-at-bol) (progn 3458 (goto-char pos)
3461 (gnus-article-forward-header) 3459 (when (looking-at "[^:]+:[\t ]*")
3462 (point)))) 3460 (setq bface (get-text-property (match-beginning 0) 'face)
3461 eface (get-text-property (match-end 0) 'face)))
3462 (delete-region pos (or (text-property-any pos (point-max)
3463 'gnus-date-type nil)
3464 (point-max))))
3465 (unless date ;; the 1st time
3466 (goto-char (point-min))
3467 (while (re-search-forward "^Date:[\t ]*" nil t)
3468 (setq date (get-text-property (match-beginning 0)
3469 'original-date)
3470 bface (get-text-property (match-beginning 0) 'face)
3471 eface (get-text-property (match-end 0) 'face))
3472 (delete-region (point-at-bol) (progn
3473 (gnus-article-forward-header)
3474 (point)))))
3463 (when (and (not date) 3475 (when (and (not date)
3464 visible-date) 3476 visible-date)
3465 (setq date visible-date)) 3477 (setq date visible-date))
@@ -3476,20 +3488,25 @@ possible values."
3476 (list type)) 3488 (list type))
3477 (t 3489 (t
3478 type))) 3490 type)))
3479 (insert (article-make-date-line date (or this-type 'ut)) "\n") 3491 (goto-char
3480 (forward-line -1) 3492 (prog1
3481 (beginning-of-line) 3493 (point)
3482 (put-text-property (point) (1+ (point)) 3494 (add-text-properties
3483 'original-date date) 3495 (point)
3484 (put-text-property (point) (1+ (point)) 3496 (progn
3485 'gnus-date-type this-type) 3497 (insert (article-make-date-line date (or this-type 'ut)) "\n")
3498 (point))
3499 (list 'original-date date 'gnus-date-type this-type))))
3486 ;; Do highlighting. 3500 ;; Do highlighting.
3487 (when (looking-at "\\([^:]+\\): *\\(.*\\)$") 3501 (when (looking-at
3488 (put-text-property (match-beginning 1) (1+ (match-end 1)) 3502 "\\([^:]+:\\)[\t ]*\\(\\(?:[^\t\n ]+[\t ]+\\)*[^\t\n ]+\\)?")
3489 'face bface) 3503 (put-text-property (match-beginning 1) (match-end 1) 'face bface)
3490 (put-text-property (match-beginning 2) (match-end 2) 3504 (when (match-beginning 2)
3491 'face eface)) 3505 (put-text-property (match-beginning 2) (match-end 2) 'face eface))
3492 (forward-line 1))) 3506 (while (and (zerop (forward-line 1))
3507 (looking-at "[\t ]+\\(\\(?:[^\t\n ]+[\t ]+\\)*[^\t\n ]+\\)?"))
3508 (when (match-beginning 1)
3509 (put-text-property (match-beginning 1) (match-end 1) 'face eface))))))
3493 3510
3494(defun article-make-date-line (date type) 3511(defun article-make-date-line (date type)
3495 "Return a DATE line of TYPE." 3512 "Return a DATE line of TYPE."
@@ -3669,25 +3686,26 @@ function and want to see what the date was before converting."
3669 (when (eq major-mode 'gnus-article-mode) 3686 (when (eq major-mode 'gnus-article-mode)
3670 (let ((old-line (count-lines (point-min) (point))) 3687 (let ((old-line (count-lines (point-min) (point)))
3671 (old-column (- (point) (line-beginning-position))) 3688 (old-column (- (point) (line-beginning-position)))
3672 (window-start 3689 (window-start (window-start w))
3673 (window-start (get-buffer-window (current-buffer))))) 3690 (pos (point-min))
3674 (goto-char (point-min)) 3691 type next end)
3675 (while (re-search-forward "^Date:" nil t) 3692 (while (setq pos (text-property-not-all pos (point-max)
3676 (let ((type (get-text-property (match-beginning 0) 3693 'gnus-date-type nil))
3677 'gnus-date-type))) 3694 (setq next (or (next-single-property-change pos
3678 (when (memq type '(lapsed combined-lapsed user-format)) 3695 'gnus-date-type)
3679 (when (and window-start 3696 (point-max)))
3680 (not (= window-start 3697 (setq type (get-text-property pos 'gnus-date-type))
3681 (save-excursion 3698 (when (memq type '(lapsed combined-lapsed user-defined))
3682 (forward-line 1) 3699 (article-date-ut type t pos)
3683 (point))))) 3700 (setq end (or (next-single-property-change pos
3684 (setq window-start nil)) 3701 'gnus-date-type)
3685 (save-excursion 3702 (point-max)))
3686 (article-date-ut type t (match-beginning 0))) 3703 (when window-start
3687 (forward-line 1) 3704 (if (/= window-start next)
3688 (when window-start 3705 (setq window-start nil)
3689 (set-window-start (get-buffer-window (current-buffer)) 3706 (set-window-start w end)))
3690 (point)))))) 3707 (setq next end))
3708 (setq pos next))
3691 (goto-char (point-min)) 3709 (goto-char (point-min))
3692 (when (> old-column 0) 3710 (when (> old-column 0)
3693 (setq old-line (1- old-line))) 3711 (setq old-line (1- old-line)))
diff --git a/lisp/gnus/gnus-ems.el b/lisp/gnus/gnus-ems.el
index 4d9b5798247..f9ef70f9580 100644
--- a/lisp/gnus/gnus-ems.el
+++ b/lisp/gnus/gnus-ems.el
@@ -165,10 +165,10 @@
165 165
166(defun gnus-image-type-available-p (type) 166(defun gnus-image-type-available-p (type)
167 (and (fboundp 'image-type-available-p) 167 (and (fboundp 'image-type-available-p)
168 (image-type-available-p type)
169 (if (fboundp 'display-images-p) 168 (if (fboundp 'display-images-p)
170 (display-images-p) 169 (display-images-p)
171 t))) 170 t)
171 (image-type-available-p type)))
172 172
173(defun gnus-create-image (file &optional type data-p &rest props) 173(defun gnus-create-image (file &optional type data-p &rest props)
174 (let ((face (plist-get props :face))) 174 (let ((face (plist-get props :face)))
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index ac6170a3cdf..b1cba27c335 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -660,14 +660,26 @@ If MODE is not set, try to find mode automatically."
660;; id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 660;; id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
661;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } 661;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }
662(defvar mm-pkcs7-signed-magic 662(defvar mm-pkcs7-signed-magic
663 "\x30\x5c\x28\x80\x5c\x7c\x81\x2e\x5c\x7c\x82\x2e\x2e\x5c\x7c\x83\x2e\x2e\ 663 (concat
664\x2e\x5c\x29\x06\x09\x5c\x2a\x86\x48\x86\xf7\x0d\x01\x07\x02") 664 "0"
665 "\\(\\(\x80\\)"
666 "\\|\\(\x81\\(.\\|\n\\)\\{1\\}\\)"
667 "\\|\\(\x82\\(.\\|\n\\)\\{2\\}\\)"
668 "\\|\\(\x83\\(.\\|\n\\)\\{3\\}\\)"
669 "\\)"
670 "\x06\x09\\*\x86H\x86\xf7\x0d\x01\x07\x02"))
665 671
666;; id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 672;; id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
667;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 } 673;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }
668(defvar mm-pkcs7-enveloped-magic 674(defvar mm-pkcs7-enveloped-magic
669 "\x30\x5c\x28\x80\x5c\x7c\x81\x2e\x5c\x7c\x82\x2e\x2e\x5c\x7c\x83\x2e\x2e\ 675 (concat
670\x2e\x5c\x29\x06\x09\x5c\x2a\x86\x48\x86\xf7\x0d\x01\x07\x03") 676 "0"
677 "\\(\\(\x80\\)"
678 "\\|\\(\x81\\(.\\|\n\\)\\{1\\}\\)"
679 "\\|\\(\x82\\(.\\|\n\\)\\{2\\}\\)"
680 "\\|\\(\x83\\(.\\|\n\\)\\{3\\}\\)"
681 "\\)"
682 "\x06\x09\\*\x86H\x86\xf7\x0d\x01\x07\x03"))
671 683
672(defun mm-view-pkcs7-get-type (handle) 684(defun mm-view-pkcs7-get-type (handle)
673 (mm-with-unibyte-buffer 685 (mm-with-unibyte-buffer
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index 28b28369ae4..5be449e9a6b 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1952,8 +1952,10 @@ If TIME is nil, then return the cutoff time for oldness instead."
1952 ((and (equal header 'to-from) 1952 ((and (equal header 'to-from)
1953 (or (string-match (cadr regexp-target-pair) from) 1953 (or (string-match (cadr regexp-target-pair) from)
1954 (and (string-match (cadr regexp-target-pair) to) 1954 (and (string-match (cadr regexp-target-pair) to)
1955 (let ((rmail-dont-reply-to-names 1955 (let* ((mail-dont-reply-to-names
1956 (message-dont-reply-to-names))) 1956 (message-dont-reply-to-names))
1957 (rmail-dont-reply-to-names ; obsolete since 24.1
1958 mail-dont-reply-to-names))
1957 (equal (if (fboundp 'rmail-dont-reply-to) 1959 (equal (if (fboundp 'rmail-dont-reply-to)
1958 (rmail-dont-reply-to from) 1960 (rmail-dont-reply-to from)
1959 (mail-dont-reply-to from)) ""))))) 1961 (mail-dont-reply-to from)) "")))))
diff --git a/lisp/gnus/registry.el b/lisp/gnus/registry.el
index 79f07812b2d..37fe6440743 100644
--- a/lisp/gnus/registry.el
+++ b/lisp/gnus/registry.el
@@ -119,60 +119,59 @@
119 :type hash-table 119 :type hash-table
120 :documentation "The data hashtable."))) 120 :documentation "The data hashtable.")))
121 121
122(eval-and-compile 122(defmethod initialize-instance :AFTER ((this registry-db) slots)
123 (defmethod initialize-instance :AFTER ((this registry-db) slots) 123 "Set value of data slot of THIS after initialization."
124 "Set value of data slot of THIS after initialization." 124 (with-slots (data tracker) this
125 (with-slots (data tracker) this 125 (unless (member :data slots)
126 (unless (member :data slots) 126 (setq data
127 (setq data 127 (make-hash-table :size 10000 :rehash-size 2.0 :test 'equal)))
128 (make-hash-table :size 10000 :rehash-size 2.0 :test 'equal))) 128 (unless (member :tracker slots)
129 (unless (member :tracker slots) 129 (setq tracker (make-hash-table :size 100 :rehash-size 2.0)))))
130 (setq tracker (make-hash-table :size 100 :rehash-size 2.0))))) 130
131 131(defmethod registry-lookup ((db registry-db) keys)
132 (defmethod registry-lookup ((db registry-db) keys) 132 "Search for KEYS in the registry-db THIS.
133 "Search for KEYS in the registry-db THIS.
134Returns an alist of the key followed by the entry in a list, not a cons cell." 133Returns an alist of the key followed by the entry in a list, not a cons cell."
135 (let ((data (oref db :data))) 134 (let ((data (oref db :data)))
136 (delq nil 135 (delq nil
137 (mapcar 136 (mapcar
138 (lambda (k) 137 (lambda (k)
139 (when (gethash k data) 138 (when (gethash k data)
140 (list k (gethash k data)))) 139 (list k (gethash k data))))
141 keys)))) 140 keys))))
142 141
143 (defmethod registry-lookup-breaks-before-lexbind ((db registry-db) keys) 142(defmethod registry-lookup-breaks-before-lexbind ((db registry-db) keys)
144 "Search for KEYS in the registry-db THIS. 143 "Search for KEYS in the registry-db THIS.
145Returns an alist of the key followed by the entry in a list, not a cons cell." 144Returns an alist of the key followed by the entry in a list, not a cons cell."
146 (let ((data (oref db :data))) 145 (let ((data (oref db :data)))
147 (delq nil 146 (delq nil
148 (loop for key in keys 147 (loop for key in keys
149 when (gethash key data) 148 when (gethash key data)
150 collect (list key (gethash key data)))))) 149 collect (list key (gethash key data))))))
151 150
152 (defmethod registry-lookup-secondary ((db registry-db) tracksym 151(defmethod registry-lookup-secondary ((db registry-db) tracksym
153 &optional create) 152 &optional create)
154 "Search for TRACKSYM in the registry-db THIS. 153 "Search for TRACKSYM in the registry-db THIS.
155When CREATE is not nil, create the secondary index hashtable if needed." 154When CREATE is not nil, create the secondary index hashtable if needed."
156 (let ((h (gethash tracksym (oref db :tracker)))) 155 (let ((h (gethash tracksym (oref db :tracker))))
157 (if h 156 (if h
158 h 157 h
159 (when create 158 (when create
160 (puthash tracksym 159 (puthash tracksym
161 (make-hash-table :size 800 :rehash-size 2.0 :test 'equal) 160 (make-hash-table :size 800 :rehash-size 2.0 :test 'equal)
162 (oref db :tracker)) 161 (oref db :tracker))
163 (gethash tracksym (oref db :tracker)))))) 162 (gethash tracksym (oref db :tracker))))))
164 163
165 (defmethod registry-lookup-secondary-value ((db registry-db) tracksym val 164(defmethod registry-lookup-secondary-value ((db registry-db) tracksym val
166 &optional set) 165 &optional set)
167 "Search for TRACKSYM with value VAL in the registry-db THIS. 166 "Search for TRACKSYM with value VAL in the registry-db THIS.
168When SET is not nil, set it for VAL (use t for an empty list)." 167When SET is not nil, set it for VAL (use t for an empty list)."
169 ;; either we're asked for creation or there should be an existing index 168 ;; either we're asked for creation or there should be an existing index
170 (when (or set (registry-lookup-secondary db tracksym)) 169 (when (or set (registry-lookup-secondary db tracksym))
171 ;; set the entry if requested, 170 ;; set the entry if requested,
172 (when set 171 (when set
173 (puthash val (if (eq t set) '() set) 172 (puthash val (if (eq t set) '() set)
174 (registry-lookup-secondary db tracksym t))) 173 (registry-lookup-secondary db tracksym t)))
175 (gethash val (registry-lookup-secondary db tracksym))))) 174 (gethash val (registry-lookup-secondary db tracksym))))
176 175
177(defun registry--match (mode entry check-list) 176(defun registry--match (mode entry check-list)
178 ;; for all members 177 ;; for all members
@@ -194,166 +193,165 @@ When SET is not nil, set it for VAL (use t for an empty list)."
194 (or found 193 (or found
195 (registry--match mode entry (cdr-safe check-list)))))) 194 (registry--match mode entry (cdr-safe check-list))))))
196 195
197(eval-and-compile 196(defmethod registry-search ((db registry-db) &rest spec)
198 (defmethod registry-search ((db registry-db) &rest spec) 197 "Search for SPEC across the registry-db THIS.
199 "Search for SPEC across the registry-db THIS.
200For example calling with :member '(a 1 2) will match entry '((a 3 1)). 198For example calling with :member '(a 1 2) will match entry '((a 3 1)).
201Calling with :all t (any non-nil value) will match all. 199Calling with :all t (any non-nil value) will match all.
202Calling with :regex '\(a \"h.llo\") will match entry '((a \"hullo\" \"bye\"). 200Calling with :regex '\(a \"h.llo\") will match entry '((a \"hullo\" \"bye\").
203The test order is to check :all first, then :member, then :regex." 201The test order is to check :all first, then :member, then :regex."
204 (when db 202 (when db
205 (let ((all (plist-get spec :all)) 203 (let ((all (plist-get spec :all))
206 (member (plist-get spec :member)) 204 (member (plist-get spec :member))
207 (regex (plist-get spec :regex))) 205 (regex (plist-get spec :regex)))
208 (loop for k being the hash-keys of (oref db :data) 206 (loop for k being the hash-keys of (oref db :data)
209 using (hash-values v) 207 using (hash-values v)
210 when (or 208 when (or
211 ;; :all non-nil returns all 209 ;; :all non-nil returns all
212 all 210 all
213 ;; member matching 211 ;; member matching
214 (and member (registry--match :member v member)) 212 (and member (registry--match :member v member))
215 ;; regex matching 213 ;; regex matching
216 (and regex (registry--match :regex v regex))) 214 (and regex (registry--match :regex v regex)))
217 collect k)))) 215 collect k))))
218 216
219 (defmethod registry-delete ((db registry-db) keys assert &rest spec) 217(defmethod registry-delete ((db registry-db) keys assert &rest spec)
220 "Delete KEYS from the registry-db THIS. 218 "Delete KEYS from the registry-db THIS.
221If KEYS is nil, use SPEC to do a search. 219If KEYS is nil, use SPEC to do a search.
222Updates the secondary ('tracked') indices as well. 220Updates the secondary ('tracked') indices as well.
223With assert non-nil, errors out if the key does not exist already." 221With assert non-nil, errors out if the key does not exist already."
224 (let* ((data (oref db :data)) 222 (let* ((data (oref db :data))
225 (keys (or keys 223 (keys (or keys
226 (apply 'registry-search db spec))) 224 (apply 'registry-search db spec)))
227 (tracked (oref db :tracked))) 225 (tracked (oref db :tracked)))
228 226
229 (dolist (key keys) 227 (dolist (key keys)
230 (let ((entry (gethash key data))) 228 (let ((entry (gethash key data)))
231 (when assert 229 (when assert
232 (assert entry nil 230 (assert entry nil
233 "Key %s does not exists in database" key)) 231 "Key %s does not exists in database" key))
234 ;; clean entry from the secondary indices 232 ;; clean entry from the secondary indices
235 (dolist (tr tracked) 233 (dolist (tr tracked)
236 ;; is this tracked symbol indexed? 234 ;; is this tracked symbol indexed?
237 (when (registry-lookup-secondary db tr) 235 (when (registry-lookup-secondary db tr)
238 ;; for every value in the entry under that key... 236 ;; for every value in the entry under that key...
239 (dolist (val (cdr-safe (assq tr entry))) 237 (dolist (val (cdr-safe (assq tr entry)))
240 (let* ((value-keys (registry-lookup-secondary-value 238 (let* ((value-keys (registry-lookup-secondary-value
241 db tr val))) 239 db tr val)))
242 (when (member key value-keys) 240 (when (member key value-keys)
243 ;; override the previous value 241 ;; override the previous value
244 (registry-lookup-secondary-value 242 (registry-lookup-secondary-value
245 db tr val 243 db tr val
246 ;; with the indexed keys MINUS the current key 244 ;; with the indexed keys MINUS the current key
247 ;; (we pass t when the list is empty) 245 ;; (we pass t when the list is empty)
248 (or (delete key value-keys) t))))))) 246 (or (delete key value-keys) t)))))))
249 (remhash key data))) 247 (remhash key data)))
250 keys)) 248 keys))
251 249
252 (defmethod registry-size ((db registry-db)) 250(defmethod registry-size ((db registry-db))
253 "Returns the size of the registry-db object THIS. 251 "Returns the size of the registry-db object THIS.
254This is the key count of the :data slot." 252This is the key count of the :data slot."
255 (hash-table-count (oref db :data))) 253 (hash-table-count (oref db :data)))
256 254
257 (defmethod registry-full ((db registry-db)) 255(defmethod registry-full ((db registry-db))
258 "Checks if registry-db THIS is full." 256 "Checks if registry-db THIS is full."
259 (>= (registry-size db) 257 (>= (registry-size db)
260 (oref db :max-hard))) 258 (oref db :max-hard)))
261 259
262 (defmethod registry-insert ((db registry-db) key entry) 260(defmethod registry-insert ((db registry-db) key entry)
263 "Insert ENTRY under KEY into the registry-db THIS. 261 "Insert ENTRY under KEY into the registry-db THIS.
264Updates the secondary ('tracked') indices as well. 262Updates the secondary ('tracked') indices as well.
265Errors out if the key exists already." 263Errors out if the key exists already."
266 264
267 (assert (not (gethash key (oref db :data))) nil 265 (assert (not (gethash key (oref db :data))) nil
268 "Key already exists in database") 266 "Key already exists in database")
269 267
270 (assert (not (registry-full db)) 268 (assert (not (registry-full db))
271 nil 269 nil
272 "registry max-hard size limit reached") 270 "registry max-hard size limit reached")
273 271
274 ;; store the entry 272 ;; store the entry
275 (puthash key entry (oref db :data)) 273 (puthash key entry (oref db :data))
276 274
277 ;; store the secondary indices 275 ;; store the secondary indices
276 (dolist (tr (oref db :tracked))
277 ;; for every value in the entry under that key...
278 (dolist (val (cdr-safe (assq tr entry)))
279 (let* ((value-keys (registry-lookup-secondary-value db tr val)))
280 (pushnew key value-keys :test 'equal)
281 (registry-lookup-secondary-value db tr val value-keys))))
282 entry)
283
284(defmethod registry-reindex ((db registry-db))
285 "Rebuild the secondary indices of registry-db THIS."
286 (let ((count 0)
287 (expected (* (length (oref db :tracked)) (registry-size db))))
278 (dolist (tr (oref db :tracked)) 288 (dolist (tr (oref db :tracked))
279 ;; for every value in the entry under that key... 289 (let (values)
280 (dolist (val (cdr-safe (assq tr entry))) 290 (maphash
281 (let* ((value-keys (registry-lookup-secondary-value db tr val))) 291 (lambda (key v)
282 (pushnew key value-keys :test 'equal) 292 (incf count)
283 (registry-lookup-secondary-value db tr val value-keys)))) 293 (when (and (< 0 expected)
284 entry) 294 (= 0 (mod count 1000)))
285 295 (message "reindexing: %d of %d (%.2f%%)"
286 (defmethod registry-reindex ((db registry-db)) 296 count expected (/ (* 100 count) expected)))
287 "Rebuild the secondary indices of registry-db THIS." 297 (dolist (val (cdr-safe (assq tr v)))
288 (let ((count 0) 298 (let* ((value-keys (registry-lookup-secondary-value db tr val)))
289 (expected (* (length (oref db :tracked)) (registry-size db)))) 299 (push key value-keys)
290 (dolist (tr (oref db :tracked)) 300 (registry-lookup-secondary-value db tr val value-keys))))
291 (let (values) 301 (oref db :data))))))
292 (maphash 302
293 (lambda (key v) 303(defmethod registry-prune ((db registry-db) &optional sortfun)
294 (incf count) 304 "Prunes the registry-db object THIS.
295 (when (and (< 0 expected)
296 (= 0 (mod count 1000)))
297 (message "reindexing: %d of %d (%.2f%%)"
298 count expected (/ (* 100 count) expected)))
299 (dolist (val (cdr-safe (assq tr v)))
300 (let* ((value-keys (registry-lookup-secondary-value db tr val)))
301 (push key value-keys)
302 (registry-lookup-secondary-value db tr val value-keys))))
303 (oref db :data))))))
304
305 (defmethod registry-prune ((db registry-db) &optional sortfun)
306 "Prunes the registry-db object THIS.
307Removes only entries without the :precious keys if it can, 305Removes only entries without the :precious keys if it can,
308then removes oldest entries first. 306then removes oldest entries first.
309Returns the number of deleted entries. 307Returns the number of deleted entries.
310If SORTFUN is given, tries to keep entries that sort *higher*. 308If SORTFUN is given, tries to keep entries that sort *higher*.
311SORTFUN is passed only the two keys so it must look them up directly." 309SORTFUN is passed only the two keys so it must look them up directly."
312 (dolist (collector '(registry-prune-soft-candidates 310 (dolist (collector '(registry-prune-soft-candidates
313 registry-prune-hard-candidates)) 311 registry-prune-hard-candidates))
314 (let* ((size (registry-size db)) 312 (let* ((size (registry-size db))
315 (collected (funcall collector db)) 313 (collected (funcall collector db))
316 (limit (nth 0 collected)) 314 (limit (nth 0 collected))
317 (candidates (nth 1 collected)) 315 (candidates (nth 1 collected))
318 ;; sort the candidates if SORTFUN was given 316 ;; sort the candidates if SORTFUN was given
319 (candidates (if sortfun (sort candidates sortfun) candidates)) 317 (candidates (if sortfun (sort candidates sortfun) candidates))
320 (candidates-count (length candidates)) 318 (candidates-count (length candidates))
321 ;; are we over max-soft? 319 ;; are we over max-soft?
322 (prune-needed (> size limit))) 320 (prune-needed (> size limit)))
323 321
324 ;; while we have more candidates than we need to remove... 322 ;; while we have more candidates than we need to remove...
325 (while (and (> candidates-count (- size limit)) candidates) 323 (while (and (> candidates-count (- size limit)) candidates)
326 (decf candidates-count) 324 (decf candidates-count)
327 (setq candidates (cdr candidates))) 325 (setq candidates (cdr candidates)))
328 326
329 (registry-delete db candidates nil) 327 (registry-delete db candidates nil)
330 (length candidates)))) 328 (length candidates))))
331 329
332 (defmethod registry-prune-soft-candidates ((db registry-db)) 330(defmethod registry-prune-soft-candidates ((db registry-db))
333 "Collects pruning candidates from the registry-db object THIS. 331 "Collects pruning candidates from the registry-db object THIS.
334Proposes only entries without the :precious keys." 332Proposes only entries without the :precious keys."
335 (let* ((precious (oref db :precious)) 333 (let* ((precious (oref db :precious))
336 (precious-p (lambda (entry-key) 334 (precious-p (lambda (entry-key)
337 (cdr (memq (car entry-key) precious)))) 335 (cdr (memq (car entry-key) precious))))
338 (data (oref db :data)) 336 (data (oref db :data))
339 (limit (oref db :max-soft)) 337 (limit (oref db :max-soft))
340 (candidates (loop for k being the hash-keys of data 338 (candidates (loop for k being the hash-keys of data
341 using (hash-values v) 339 using (hash-values v)
342 when (notany precious-p v) 340 when (notany precious-p v)
343 collect k))) 341 collect k)))
344 (list limit candidates))) 342 (list limit candidates)))
345 343
346 (defmethod registry-prune-hard-candidates ((db registry-db)) 344(defmethod registry-prune-hard-candidates ((db registry-db))
347 "Collects pruning candidates from the registry-db object THIS. 345 "Collects pruning candidates from the registry-db object THIS.
348Proposes any entries over the max-hard limit minus size * prune-factor." 346Proposes any entries over the max-hard limit minus size * prune-factor."
349 (let* ((data (oref db :data)) 347 (let* ((data (oref db :data))
350 ;; prune to (size * prune-factor) below the max-hard limit so 348 ;; prune to (size * prune-factor) below the max-hard limit so
351 ;; we're not pruning all the time 349 ;; we're not pruning all the time
352 (limit (max 0 (- (oref db :max-hard) 350 (limit (max 0 (- (oref db :max-hard)
353 (* (registry-size db) (oref db :prune-factor))))) 351 (* (registry-size db) (oref db :prune-factor)))))
354 (candidates (loop for k being the hash-keys of data 352 (candidates (loop for k being the hash-keys of data
355 collect k))) 353 collect k)))
356 (list limit candidates)))) 354 (list limit candidates)))
357 355
358(provide 'registry) 356(provide 'registry)
359;;; registry.el ends here 357;;; registry.el ends here
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index 2d2272d6c11..d9e267e5288 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -114,6 +114,8 @@ cid: URL as the argument.")
114(defvar shr-stylesheet nil) 114(defvar shr-stylesheet nil)
115(defvar shr-base nil) 115(defvar shr-base nil)
116(defvar shr-ignore-cache nil) 116(defvar shr-ignore-cache nil)
117(defvar shr-external-rendering-functions nil)
118(defvar shr-final-table-render nil)
117 119
118(defvar shr-map 120(defvar shr-map
119 (let ((map (make-sparse-keymap))) 121 (let ((map (make-sparse-keymap)))
@@ -291,7 +293,12 @@ size, and full-buffer size."
291 (nreverse result))) 293 (nreverse result)))
292 294
293(defun shr-descend (dom) 295(defun shr-descend (dom)
294 (let ((function (intern (concat "shr-tag-" (symbol-name (car dom))) obarray)) 296 (let ((function
297 (or
298 ;; Allow other packages to override (or provide) rendering
299 ;; of elements.
300 (cdr (assq (car dom) shr-external-rendering-functions))
301 (intern (concat "shr-tag-" (symbol-name (car dom))) obarray)))
295 (style (cdr (assq :style (cdr dom)))) 302 (style (cdr (assq :style (cdr dom))))
296 (shr-stylesheet shr-stylesheet) 303 (shr-stylesheet shr-stylesheet)
297 (start (point))) 304 (start (point)))
@@ -478,20 +485,27 @@ size, and full-buffer size."
478 (not failed))) 485 (not failed)))
479 486
480(defun shr-expand-url (url) 487(defun shr-expand-url (url)
481 (cond 488 (if (or (not url)
482 ;; Absolute URL. 489 (string-match "\\`[a-z]*:" url)
483 ((or (not url) 490 (not shr-base))
484 (string-match "\\`[a-z]*:" url) 491 ;; Absolute URL.
485 (not shr-base)) 492 url
486 url) 493 (let ((base shr-base))
487 ((and (string-match "\\`//" url) 494 ;; Chop off query string.
488 (string-match "\\`[a-z]*:" shr-base)) 495 (when (string-match "^\\([^?]+\\)[?]" base)
489 (concat (match-string 0 shr-base) url)) 496 (setq base (match-string 1 base)))
490 ((and (not (string-match "/\\'" shr-base)) 497 (cond
491 (not (string-match "\\`/" url))) 498 ((and (string-match "\\`//" url)
492 (concat shr-base "/" url)) 499 (string-match "\\`[a-z]*:" base))
493 (t 500 (concat (match-string 0 base) url))
494 (concat shr-base url)))) 501 ((and (not (string-match "/\\'" base))
502 (not (string-match "\\`/" url)))
503 (concat base "/" url))
504 ((and (string-match "\\`/" url)
505 (string-match "\\(\\`[^:]*://[^/]+\\)/" base))
506 (concat (match-string 1 base) url))
507 (t
508 (concat base url))))))
495 509
496(defun shr-ensure-newline () 510(defun shr-ensure-newline ()
497 (unless (zerop (current-column)) 511 (unless (zerop (current-column))
@@ -631,12 +645,13 @@ size, and full-buffer size."
631 (overlay-put overlay 'face 'default))) 645 (overlay-put overlay 'face 'default)))
632 (insert-image image (or alt "*"))) 646 (insert-image image (or alt "*")))
633 (put-text-property start (point) 'image-size size) 647 (put-text-property start (point) 'image-size size)
634 (when (if (fboundp 'image-multi-frame-p) 648 (when (cond ((fboundp 'image-multi-frame-p)
635 ;; Only animate multi-frame things that specify a 649 ;; Only animate multi-frame things that specify a
636 ;; delay; eg animated gifs as opposed to 650 ;; delay; eg animated gifs as opposed to
637 ;; multi-page tiffs. FIXME? 651 ;; multi-page tiffs. FIXME?
638 (cdr (image-multi-frame-p image)) 652 (cdr (image-multi-frame-p image)))
639 (image-animated-p image)) 653 ((fboundp 'image-animated-p)
654 (image-animated-p image)))
640 (image-animate image nil 60))) 655 (image-animate image nil 60)))
641 image) 656 image)
642 (insert alt))) 657 (insert alt)))
@@ -944,7 +959,8 @@ ones, in case fg and bg are nil."
944 plist))) 959 plist)))
945 960
946(defun shr-tag-base (cont) 961(defun shr-tag-base (cont)
947 (setq shr-base (cdr (assq :href cont)))) 962 (setq shr-base (cdr (assq :href cont)))
963 (shr-generic cont))
948 964
949(defun shr-tag-a (cont) 965(defun shr-tag-a (cont)
950 (let ((url (cdr (assq :href cont))) 966 (let ((url (cdr (assq :href cont)))
@@ -1166,7 +1182,8 @@ ones, in case fg and bg are nil."
1166 (frame-width)) 1182 (frame-width))
1167 (setq truncate-lines t)) 1183 (setq truncate-lines t))
1168 ;; Then render the table again with these new "hard" widths. 1184 ;; Then render the table again with these new "hard" widths.
1169 (shr-insert-table (shr-make-table cont sketch-widths t) sketch-widths)) 1185 (let ((shr-final-table-render t))
1186 (shr-insert-table (shr-make-table cont sketch-widths t) sketch-widths)))
1170 ;; Finally, insert all the images after the table. The Emacs buffer 1187 ;; Finally, insert all the images after the table. The Emacs buffer
1171 ;; model isn't strong enough to allow us to put the images actually 1188 ;; model isn't strong enough to allow us to put the images actually
1172 ;; into the tables. 1189 ;; into the tables.
diff --git a/lisp/gnus/sieve-manage.el b/lisp/gnus/sieve-manage.el
index b96261764e5..23ab24152d9 100644
--- a/lisp/gnus/sieve-manage.el
+++ b/lisp/gnus/sieve-manage.el
@@ -3,6 +3,7 @@
3;; Copyright (C) 2001-2013 Free Software Foundation, Inc. 3;; Copyright (C) 2001-2013 Free Software Foundation, Inc.
4 4
5;; Author: Simon Josefsson <simon@josefsson.org> 5;; Author: Simon Josefsson <simon@josefsson.org>
6;; Albert Krewinkel <tarleb@moltkeplatz.de>
6 7
7;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
8 9
@@ -66,6 +67,7 @@
66;; 2001-10-31 Committed to Oort Gnus. 67;; 2001-10-31 Committed to Oort Gnus.
67;; 2002-07-27 Added DELETESCRIPT. Suggested by Ned Ludd. 68;; 2002-07-27 Added DELETESCRIPT. Suggested by Ned Ludd.
68;; 2002-08-03 Use SASL library. 69;; 2002-08-03 Use SASL library.
70;; 2013-06-05 Enabled STARTTLS support, fixed bit rot.
69 71
70;;; Code: 72;;; Code:
71 73
@@ -82,7 +84,6 @@
82 (require 'sasl) 84 (require 'sasl)
83 (require 'starttls)) 85 (require 'starttls))
84(autoload 'sasl-find-mechanism "sasl") 86(autoload 'sasl-find-mechanism "sasl")
85(autoload 'starttls-open-stream "starttls")
86(autoload 'auth-source-search "auth-source") 87(autoload 'auth-source-search "auth-source")
87 88
88;; User customizable variables: 89;; User customizable variables:
@@ -107,23 +108,6 @@
107 :type 'string 108 :type 'string
108 :group 'sieve-manage) 109 :group 'sieve-manage)
109 110
110(defcustom sieve-manage-streams '(network starttls shell)
111 "Priority of streams to consider when opening connection to server."
112 :group 'sieve-manage)
113
114(defcustom sieve-manage-stream-alist
115 '((network sieve-manage-network-p sieve-manage-network-open)
116 (shell sieve-manage-shell-p sieve-manage-shell-open)
117 (starttls sieve-manage-starttls-p sieve-manage-starttls-open))
118 "Definition of network streams.
119
120\(NAME CHECK OPEN)
121
122NAME names the stream, CHECK is a function returning non-nil if the
123server support the stream and OPEN is a function for opening the
124stream."
125 :group 'sieve-manage)
126
127(defcustom sieve-manage-authenticators '(digest-md5 111(defcustom sieve-manage-authenticators '(digest-md5
128 cram-md5 112 cram-md5
129 scram-md5 113 scram-md5
@@ -156,8 +140,7 @@ for doing the actual authentication."
156 :group 'sieve-manage) 140 :group 'sieve-manage)
157 141
158(defcustom sieve-manage-default-stream 'network 142(defcustom sieve-manage-default-stream 'network
159 "Default stream type to use for `sieve-manage'. 143 "Default stream type to use for `sieve-manage'."
160Must be a name of a stream in `sieve-manage-stream-alist'."
161 :version "24.1" 144 :version "24.1"
162 :type 'symbol 145 :type 'symbol
163 :group 'sieve-manage) 146 :group 'sieve-manage)
@@ -185,17 +168,21 @@ Valid states are `closed', `initial', `nonauth', and `auth'.")
185(defvar sieve-manage-capability nil) 168(defvar sieve-manage-capability nil)
186 169
187;; Internal utility functions 170;; Internal utility functions
188 171(defun sieve-manage-make-process-buffer ()
189(defmacro sieve-manage-disable-multibyte () 172 (with-current-buffer
190 "Enable multibyte in the current buffer." 173 (generate-new-buffer (format " *sieve %s:%s*"
191 (unless (featurep 'xemacs) 174 sieve-manage-server
192 '(set-buffer-multibyte nil))) 175 sieve-manage-port))
176 (mapc 'make-local-variable sieve-manage-local-variables)
177 (mm-enable-multibyte)
178 (buffer-disable-undo)
179 (current-buffer)))
193 180
194(defun sieve-manage-erase (&optional p buffer) 181(defun sieve-manage-erase (&optional p buffer)
195 (let ((buffer (or buffer (current-buffer)))) 182 (let ((buffer (or buffer (current-buffer))))
196 (and sieve-manage-log 183 (and sieve-manage-log
197 (with-current-buffer (get-buffer-create sieve-manage-log) 184 (with-current-buffer (get-buffer-create sieve-manage-log)
198 (sieve-manage-disable-multibyte) 185 (mm-enable-multibyte)
199 (buffer-disable-undo) 186 (buffer-disable-undo)
200 (goto-char (point-max)) 187 (goto-char (point-max))
201 (insert-buffer-substring buffer (with-current-buffer buffer 188 (insert-buffer-substring buffer (with-current-buffer buffer
@@ -204,71 +191,32 @@ Valid states are `closed', `initial', `nonauth', and `auth'.")
204 (point-max))))))) 191 (point-max)))))))
205 (delete-region (point-min) (or p (point-max)))) 192 (delete-region (point-min) (or p (point-max))))
206 193
207(defun sieve-manage-open-1 (buffer) 194(defun sieve-manage-open-server (server port &optional stream buffer)
195 "Open network connection to SERVER on PORT.
196Return the buffer associated with the connection."
208 (with-current-buffer buffer 197 (with-current-buffer buffer
209 (sieve-manage-erase) 198 (sieve-manage-erase)
210 (setq sieve-manage-state 'initial 199 (setq sieve-manage-state 'initial)
211 sieve-manage-process 200 (destructuring-bind (proc . props)
212 (condition-case () 201 (open-protocol-stream
213 (funcall (nth 2 (assq sieve-manage-stream 202 "SIEVE" buffer server port
214 sieve-manage-stream-alist)) 203 :type stream
215 "sieve" buffer sieve-manage-server sieve-manage-port) 204 :capability-command "CAPABILITY\r\n"
216 ((error quit) nil))) 205 :end-of-command "^\\(OK\\|NO\\).*\n"
217 (when sieve-manage-process 206 :success "^OK.*\n"
218 (while (and (eq sieve-manage-state 'initial) 207 :return-list t
219 (memq (process-status sieve-manage-process) '(open run))) 208 :starttls-function
220 (message "Waiting for response from %s..." sieve-manage-server) 209 '(lambda (capabilities)
221 (accept-process-output sieve-manage-process 1)) 210 (when (string-match "\\bSTARTTLS\\b" capabilities)
222 (message "Waiting for response from %s...done" sieve-manage-server) 211 "STARTTLS\r\n")))
223 (and (memq (process-status sieve-manage-process) '(open run)) 212 (setq sieve-manage-process proc)
224 sieve-manage-process)))) 213 (setq sieve-manage-capability
225 214 (sieve-manage-parse-capability (getf props :capabilities)))
226;; Streams 215 ;; Ignore new capabilities issues after successful STARTTLS
227 216 (when (and (memq stream '(nil network starttls))
228(defun sieve-manage-network-p (buffer) 217 (eq (getf props :type) 'tls))
229 t) 218 (sieve-manage-drop-next-answer))
230 219 (current-buffer))))
231(defun sieve-manage-network-open (name buffer server port)
232 (let* ((port (or port sieve-manage-default-port))
233 (coding-system-for-read sieve-manage-coding-system-for-read)
234 (coding-system-for-write sieve-manage-coding-system-for-write)
235 (process (open-network-stream name buffer server port)))
236 (when process
237 (while (and (memq (process-status process) '(open run))
238 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug
239 (goto-char (point-min))
240 (not (sieve-manage-parse-greeting-1)))
241 (accept-process-output process 1)
242 (sit-for 1))
243 (sieve-manage-erase nil buffer)
244 (when (memq (process-status process) '(open run))
245 process))))
246
247(defun sieve-manage-starttls-p (buffer)
248 (condition-case ()
249 (progn
250 (require 'starttls)
251 (call-process "starttls"))
252 (error nil)))
253
254(defun sieve-manage-starttls-open (name buffer server port)
255 (let* ((port (or port sieve-manage-default-port))
256 (coding-system-for-read sieve-manage-coding-system-for-read)
257 (coding-system-for-write sieve-manage-coding-system-for-write)
258 (process (starttls-open-stream name buffer server port))
259 done)
260 (when process
261 (while (and (memq (process-status process) '(open run))
262 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug
263 (goto-char (point-min))
264 (not (sieve-manage-parse-greeting-1)))
265 (accept-process-output process 1)
266 (sit-for 1))
267 (sieve-manage-erase nil buffer)
268 (sieve-manage-send "STARTTLS")
269 (starttls-negotiate process))
270 (when (memq (process-status process) '(open run))
271 process)))
272 220
273;; Authenticators 221;; Authenticators
274(defun sieve-sasl-auth (buffer mech) 222(defun sieve-sasl-auth (buffer mech)
@@ -396,63 +344,33 @@ Optional argument AUTH indicates authenticator to use, see
396If nil, chooses the best stream the server is capable of. 344If nil, chooses the best stream the server is capable of.
397Optional argument BUFFER is buffer (buffer, or string naming buffer) 345Optional argument BUFFER is buffer (buffer, or string naming buffer)
398to work in." 346to work in."
399 (or port (setq port sieve-manage-default-port)) 347 (setq sieve-manage-port (or port sieve-manage-default-port))
400 (setq buffer (or buffer (format " *sieve* %s:%s" server port))) 348 (with-current-buffer (or buffer (sieve-manage-make-process-buffer))
401 (with-current-buffer (get-buffer-create buffer) 349 (setq sieve-manage-server (or server
402 (mapc 'make-local-variable sieve-manage-local-variables) 350 sieve-manage-server)
403 (sieve-manage-disable-multibyte) 351 sieve-manage-stream (or stream
404 (buffer-disable-undo) 352 sieve-manage-stream
405 (setq sieve-manage-server (or server sieve-manage-server)) 353 sieve-manage-default-stream)
406 (setq sieve-manage-port port) 354 sieve-manage-auth (or auth
407 (setq sieve-manage-stream (or stream sieve-manage-stream)) 355 sieve-manage-auth))
408 (message "sieve: Connecting to %s..." sieve-manage-server) 356 (message "sieve: Connecting to %s..." sieve-manage-server)
409 (if (let ((sieve-manage-stream 357 (sieve-manage-open-server sieve-manage-server
410 (or sieve-manage-stream sieve-manage-default-stream))) 358 sieve-manage-port
411 (sieve-manage-open-1 buffer)) 359 sieve-manage-stream
412 ;; Choose stream. 360 (current-buffer))
413 (let (stream-changed) 361 (when (sieve-manage-opened (current-buffer))
414 (message "sieve: Connecting to %s...done" sieve-manage-server) 362 ;; Choose authenticator
415 (when (null sieve-manage-stream) 363 (when (and (null sieve-manage-auth)
416 (let ((streams sieve-manage-streams)) 364 (not (eq sieve-manage-state 'auth)))
417 (while (setq stream (pop streams)) 365 (dolist (auth sieve-manage-authenticators)
418 (if (funcall (nth 1 (assq stream 366 (when (funcall (nth 1 (assq auth sieve-manage-authenticator-alist))
419 sieve-manage-stream-alist)) buffer) 367 buffer)
420 (setq stream-changed 368 (setq sieve-manage-auth auth)
421 (not (eq (or sieve-manage-stream 369 (return)))
422 sieve-manage-default-stream) 370 (unless sieve-manage-auth
423 stream)) 371 (error "Couldn't figure out authenticator for server")))
424 sieve-manage-stream stream
425 streams nil)))
426 (unless sieve-manage-stream
427 (error "Couldn't figure out a stream for server"))))
428 (when stream-changed
429 (message "sieve: Reconnecting with stream `%s'..."
430 sieve-manage-stream)
431 (sieve-manage-close buffer)
432 (if (sieve-manage-open-1 buffer)
433 (message "sieve: Reconnecting with stream `%s'...done"
434 sieve-manage-stream)
435 (message "sieve: Reconnecting with stream `%s'...failed"
436 sieve-manage-stream))
437 (setq sieve-manage-capability nil))
438 (if (sieve-manage-opened buffer)
439 ;; Choose authenticator
440 (when (and (null sieve-manage-auth)
441 (not (eq sieve-manage-state 'auth)))
442 (let ((auths sieve-manage-authenticators))
443 (while (setq auth (pop auths))
444 (if (funcall (nth 1 (assq
445 auth
446 sieve-manage-authenticator-alist))
447 buffer)
448 (setq sieve-manage-auth auth
449 auths nil)))
450 (unless sieve-manage-auth
451 (error "Couldn't figure out authenticator for server"))))))
452 (message "sieve: Connecting to %s...failed" sieve-manage-server))
453 (when (sieve-manage-opened buffer)
454 (sieve-manage-erase) 372 (sieve-manage-erase)
455 buffer))) 373 (current-buffer))))
456 374
457(defun sieve-manage-authenticate (&optional buffer) 375(defun sieve-manage-authenticate (&optional buffer)
458 "Authenticate on server in BUFFER. 376 "Authenticate on server in BUFFER.
@@ -544,12 +462,22 @@ If NAME is nil, return the full server list of capabilities."
544 462
545;; Protocol parsing routines 463;; Protocol parsing routines
546 464
465(defun sieve-manage-wait-for-answer ()
466 (let ((pattern "^\\(OK\\|NO\\).*\n")
467 pos)
468 (while (not pos)
469 (setq pos (search-forward-regexp pattern nil t))
470 (goto-char (point-min))
471 (sleep-for 0 50))
472 pos))
473
474(defun sieve-manage-drop-next-answer ()
475 (sieve-manage-wait-for-answer)
476 (sieve-manage-erase))
477
547(defun sieve-manage-ok-p (rsp) 478(defun sieve-manage-ok-p (rsp)
548 (string= (downcase (or (car-safe rsp) "")) "ok")) 479 (string= (downcase (or (car-safe rsp) "")) "ok"))
549 480
550(defsubst sieve-manage-forward ()
551 (or (eobp) (forward-char)))
552
553(defun sieve-manage-is-okno () 481(defun sieve-manage-is-okno ()
554 (when (looking-at (concat 482 (when (looking-at (concat
555 "^\\(OK\\|NO\\)\\( (\\([^)]+\\))\\)?\\( \\(.*\\)\\)?" 483 "^\\(OK\\|NO\\)\\( (\\([^)]+\\))\\)?\\( \\(.*\\)\\)?"
@@ -571,21 +499,15 @@ If NAME is nil, return the full server list of capabilities."
571 (sieve-manage-erase) 499 (sieve-manage-erase)
572 rsp)) 500 rsp))
573 501
574(defun sieve-manage-parse-capability-1 () 502(defun sieve-manage-parse-capability (str)
575 "Accept a managesieve greeting." 503 "Parse managesieve capability string `STR'.
576 (let (str) 504Set variable `sieve-manage-capability' to "
577 (while (setq str (sieve-manage-is-string)) 505 (let ((capas (remove-if #'null
578 (if (eq (char-after) ? ) 506 (mapcar #'split-string-and-unquote
579 (progn 507 (split-string str "\n")))))
580 (sieve-manage-forward) 508 (when (string= "OK" (caar (last capas)))
581 (push (list str (sieve-manage-is-string)) 509 (setq sieve-manage-state 'nonauth))
582 sieve-manage-capability)) 510 capas))
583 (push (list str) sieve-manage-capability))
584 (forward-line)))
585 (when (re-search-forward (concat "^OK.*" sieve-manage-server-eol) nil t)
586 (setq sieve-manage-state 'nonauth)))
587
588(defalias 'sieve-manage-parse-greeting-1 'sieve-manage-parse-capability-1)
589 511
590(defun sieve-manage-is-string () 512(defun sieve-manage-is-string ()
591 (cond ((looking-at "\"\\([^\"]+\\)\"") 513 (cond ((looking-at "\"\\([^\"]+\\)\"")
@@ -639,7 +561,7 @@ If NAME is nil, return the full server list of capabilities."
639 (setq cmdstr (concat cmdstr sieve-manage-client-eol)) 561 (setq cmdstr (concat cmdstr sieve-manage-client-eol))
640 (and sieve-manage-log 562 (and sieve-manage-log
641 (with-current-buffer (get-buffer-create sieve-manage-log) 563 (with-current-buffer (get-buffer-create sieve-manage-log)
642 (sieve-manage-disable-multibyte) 564 (mm-enable-multibyte)
643 (buffer-disable-undo) 565 (buffer-disable-undo)
644 (goto-char (point-max)) 566 (goto-char (point-max))
645 (insert cmdstr))) 567 (insert cmdstr)))
diff --git a/lisp/gnus/sieve.el b/lisp/gnus/sieve.el
index 0e46cb66361..2c11c039d56 100644
--- a/lisp/gnus/sieve.el
+++ b/lisp/gnus/sieve.el
@@ -109,7 +109,6 @@ require \"fileinto\";
109 ;; various 109 ;; various
110 (define-key map "?" 'sieve-help) 110 (define-key map "?" 'sieve-help)
111 (define-key map "h" 'sieve-help) 111 (define-key map "h" 'sieve-help)
112 (define-key map "q" 'kill-buffer)
113 ;; activating 112 ;; activating
114 (define-key map "m" 'sieve-activate) 113 (define-key map "m" 'sieve-activate)
115 (define-key map "u" 'sieve-deactivate) 114 (define-key map "u" 'sieve-deactivate)
@@ -152,6 +151,8 @@ require \"fileinto\";
152(defun sieve-manage-quit () 151(defun sieve-manage-quit ()
153 "Quit." 152 "Quit."
154 (interactive) 153 (interactive)
154 (sieve-manage-close sieve-manage-buffer)
155 (kill-buffer sieve-manage-buffer)
155 (kill-buffer (current-buffer))) 156 (kill-buffer (current-buffer)))
156 157
157(defun sieve-activate (&optional pos) 158(defun sieve-activate (&optional pos)
@@ -206,6 +207,7 @@ require \"fileinto\";
206 (insert sieve-template)) 207 (insert sieve-template))
207 (sieve-mode) 208 (sieve-mode)
208 (setq sieve-buffer-script-name name) 209 (setq sieve-buffer-script-name name)
210 (beginning-of-buffer)
209 (message 211 (message
210 (substitute-command-keys 212 (substitute-command-keys
211 "Press \\[sieve-upload] to upload script to server.")))) 213 "Press \\[sieve-upload] to upload script to server."))))
@@ -256,10 +258,9 @@ Used to bracket operations which move point in the sieve-buffer."
256 (setq buffer-read-only nil) 258 (setq buffer-read-only nil)
257 (erase-buffer) 259 (erase-buffer)
258 (buffer-disable-undo) 260 (buffer-disable-undo)
259 (insert "\ 261 (let* ((port (or port sieve-manage-default-port))
260Server : " server ":" (or port sieve-manage-default-port) " 262 (header (format "Server : %s:%s\n\n" server port)))
261 263 (insert header))
262")
263 (set (make-local-variable 'sieve-buffer-header-end) 264 (set (make-local-variable 'sieve-buffer-header-end)
264 (point-max))) 265 (point-max)))
265 266
@@ -305,7 +306,7 @@ Server : " server ":" (or port sieve-manage-default-port) "
305 (with-current-buffer 306 (with-current-buffer
306 (or ;; open server 307 (or ;; open server
307 (set (make-local-variable 'sieve-manage-buffer) 308 (set (make-local-variable 'sieve-manage-buffer)
308 (sieve-manage-open server)) 309 (sieve-manage-open server port))
309 (error "Error opening server %s" server)) 310 (error "Error opening server %s" server))
310 (sieve-manage-authenticate))) 311 (sieve-manage-authenticate)))
311 312
diff --git a/lisp/gnus/spam-stat.el b/lisp/gnus/spam-stat.el
index d75e8198842..135bfd48e5f 100644
--- a/lisp/gnus/spam-stat.el
+++ b/lisp/gnus/spam-stat.el
@@ -412,8 +412,7 @@ With a prefix argument save unconditionally."
412 (when (or force spam-stat-dirty) 412 (when (or force spam-stat-dirty)
413 (let ((coding-system-for-write spam-stat-coding-system)) 413 (let ((coding-system-for-write spam-stat-coding-system))
414 (with-temp-file spam-stat-file 414 (with-temp-file spam-stat-file
415 (let ((standard-output (current-buffer)) 415 (let ((standard-output (current-buffer)))
416 (font-lock-maximum-size 0))
417 (insert (format ";-*- coding: %s; -*-\n" spam-stat-coding-system)) 416 (insert (format ";-*- coding: %s; -*-\n" spam-stat-coding-system))
418 (insert (format "(setq spam-stat-ngood %d spam-stat-nbad %d 417 (insert (format "(setq spam-stat-ngood %d spam-stat-nbad %d
419spam-stat (spam-stat-to-hash-table '(" spam-stat-ngood spam-stat-nbad)) 418spam-stat (spam-stat-to-hash-table '(" spam-stat-ngood spam-stat-nbad))
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index bdf86016844..86bb67e87c2 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -435,14 +435,19 @@ suitable file is found, return nil."
435 (let ((handler (function-get function 'compiler-macro))) 435 (let ((handler (function-get function 'compiler-macro)))
436 (when handler 436 (when handler
437 (insert "\nThis function has a compiler macro") 437 (insert "\nThis function has a compiler macro")
438 (let ((lib (get function 'compiler-macro-file))) 438 (if (symbolp handler)
439 ;; FIXME: rather than look at the compiler-macro-file property, 439 (progn
440 ;; just look at `handler' itself. 440 (insert (format " `%s'" handler))
441 (when (stringp lib) 441 (save-excursion
442 (insert (format " in `%s'" lib)) 442 (re-search-backward "`\\([^`']+\\)'" nil t)
443 (save-excursion 443 (help-xref-button 1 'help-function handler)))
444 (re-search-backward "`\\([^`']+\\)'" nil t) 444 ;; FIXME: Obsolete since 24.4.
445 (help-xref-button 1 'help-function-cmacro function lib)))) 445 (let ((lib (get function 'compiler-macro-file)))
446 (when (stringp lib)
447 (insert (format " in `%s'" lib))
448 (save-excursion
449 (re-search-backward "`\\([^`']+\\)'" nil t)
450 (help-xref-button 1 'help-function-cmacro function lib)))))
446 (insert ".\n")))) 451 (insert ".\n"))))
447 452
448(defun help-fns--signature (function doc real-def real-function) 453(defun help-fns--signature (function doc real-def real-function)
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index b5aca1a4445..b56adc2a4a9 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -204,7 +204,7 @@ The format is (FUNCTION ARGS...).")
204 (message "Unable to find location in file")))) 204 (message "Unable to find location in file"))))
205 'help-echo (purecopy "mouse-2, RET: find function's definition")) 205 'help-echo (purecopy "mouse-2, RET: find function's definition"))
206 206
207(define-button-type 'help-function-cmacro 207(define-button-type 'help-function-cmacro ; FIXME: Obsolete since 24.4.
208 :supertype 'help-xref 208 :supertype 'help-xref
209 'help-function (lambda (fun file) 209 'help-function (lambda (fun file)
210 (setq file (locate-library file t)) 210 (setq file (locate-library file t))
@@ -213,7 +213,7 @@ The format is (FUNCTION ARGS...).")
213 (pop-to-buffer (find-file-noselect file)) 213 (pop-to-buffer (find-file-noselect file))
214 (goto-char (point-min)) 214 (goto-char (point-min))
215 (if (re-search-forward 215 (if (re-search-forward
216 (format "^[ \t]*(define-compiler-macro[ \t]+%s" 216 (format "^[ \t]*(\\(cl-\\)?define-compiler-macro[ \t]+%s"
217 (regexp-quote (symbol-name fun))) nil t) 217 (regexp-quote (symbol-name fun))) nil t)
218 (forward-line 0) 218 (forward-line 0)
219 (message "Unable to find location in file"))) 219 (message "Unable to find location in file")))
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index e2dc4eac67b..d0a82cd97b0 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -37,18 +37,18 @@
37;; 37;;
38;; In program source code highlight a variable to quickly see all 38;; In program source code highlight a variable to quickly see all
39;; places it is modified or referenced: 39;; places it is modified or referenced:
40;; M-x highlight-regexp ground_contact_switches_closed RET RET 40;; M-x highlight-regexp RET ground_contact_switches_closed RET RET
41;; 41;;
42;; In a shell or other buffer that is showing lots of program 42;; In a shell or other buffer that is showing lots of program
43;; output, highlight the parts of the output you're interested in: 43;; output, highlight the parts of the output you're interested in:
44;; M-x highlight-regexp Total execution time [0-9]+ RET hi-blue-b RET 44;; M-x highlight-regexp RET Total execution time [0-9]+ RET hi-blue-b RET
45;; 45;;
46;; In buffers displaying tables, highlight the lines you're interested in: 46;; In buffers displaying tables, highlight the lines you're interested in:
47;; M-x highlight-lines-matching-regexp January 2000 RET hi-black-b RET 47;; M-x highlight-lines-matching-regexp RET January 2000 RET hi-black-b RET
48;; 48;;
49;; When writing text, highlight personal cliches. This can be 49;; When writing text, highlight personal cliches. This can be
50;; amusing. 50;; amusing.
51;; M-x highlight-phrase as can be seen RET RET 51;; M-x highlight-phrase RET as can be seen RET RET
52;; 52;;
53;; Setup: 53;; Setup:
54;; 54;;
@@ -252,6 +252,10 @@ a library is being loaded.")
252 '(menu-item "Highlight Lines..." highlight-lines-matching-regexp 252 '(menu-item "Highlight Lines..." highlight-lines-matching-regexp
253 :help "Highlight lines containing match of PATTERN (a regexp).")) 253 :help "Highlight lines containing match of PATTERN (a regexp)."))
254 254
255 (define-key-after map [highlight-symbol-at-point]
256 '(menu-item "Highlight Symbol at Point" highlight-symbol-at-point
257 :help "Highlight symbol found near point without prompting."))
258
255 (define-key-after map [unhighlight-regexp] 259 (define-key-after map [unhighlight-regexp]
256 '(menu-item "Remove Highlighting..." unhighlight-regexp 260 '(menu-item "Remove Highlighting..." unhighlight-regexp
257 :help "Remove previously entered highlighting pattern." 261 :help "Remove previously entered highlighting pattern."
@@ -274,6 +278,7 @@ a library is being loaded.")
274 (define-key map "\C-xwl" 'highlight-lines-matching-regexp) 278 (define-key map "\C-xwl" 'highlight-lines-matching-regexp)
275 (define-key map "\C-xwp" 'highlight-phrase) 279 (define-key map "\C-xwp" 'highlight-phrase)
276 (define-key map "\C-xwh" 'highlight-regexp) 280 (define-key map "\C-xwh" 'highlight-regexp)
281 (define-key map "\C-xw." 'highlight-symbol-at-point)
277 (define-key map "\C-xwr" 'unhighlight-regexp) 282 (define-key map "\C-xwr" 'unhighlight-regexp)
278 (define-key map "\C-xwb" 'hi-lock-write-interactive-patterns) 283 (define-key map "\C-xwb" 'hi-lock-write-interactive-patterns)
279 map) 284 map)
@@ -333,6 +338,10 @@ which can be called interactively, are:
333\\[highlight-lines-matching-regexp] REGEXP FACE 338\\[highlight-lines-matching-regexp] REGEXP FACE
334 Highlight lines containing matches of REGEXP in current buffer with FACE. 339 Highlight lines containing matches of REGEXP in current buffer with FACE.
335 340
341\\[highlight-symbol-at-point]
342 Highlight the symbol found near point without prompting, using the next
343 available face automatically.
344
336\\[unhighlight-regexp] REGEXP 345\\[unhighlight-regexp] REGEXP
337 Remove highlighting on matches of REGEXP in current buffer. 346 Remove highlighting on matches of REGEXP in current buffer.
338 347
@@ -490,6 +499,27 @@ highlighting will not update as you type."
490 (unless hi-lock-mode (hi-lock-mode 1)) 499 (unless hi-lock-mode (hi-lock-mode 1))
491 (hi-lock-set-pattern regexp face)) 500 (hi-lock-set-pattern regexp face))
492 501
502;;;###autoload
503(defalias 'highlight-symbol-at-point 'hi-lock-face-symbol-at-point)
504;;;###autoload
505(defun hi-lock-face-symbol-at-point ()
506 "Set face of each match of the symbol at point.
507Use `find-tag-default-as-regexp' to retrieve the symbol at point.
508Use non-nil `hi-lock-auto-select-face' to retrieve the next face
509from `hi-lock-face-defaults' automatically.
510
511Use Font lock mode, if enabled, to highlight symbol at point.
512Otherwise, use overlays for highlighting. If overlays are used,
513the highlighting will not update as you type."
514 (interactive)
515 (let* ((regexp (hi-lock-regexp-okay
516 (find-tag-default-as-regexp)))
517 (hi-lock-auto-select-face t)
518 (face (hi-lock-read-face-name)))
519 (or (facep face) (setq face 'hi-yellow))
520 (unless hi-lock-mode (hi-lock-mode 1))
521 (hi-lock-set-pattern regexp face)))
522
493(defun hi-lock-keyword->face (keyword) 523(defun hi-lock-keyword->face (keyword)
494 (cadr (cadr (cadr keyword)))) ; Keyword looks like (REGEXP (0 'FACE) ...). 524 (cadr (cadr (cadr keyword)))) ; Keyword looks like (REGEXP (0 'FACE) ...).
495 525
diff --git a/lisp/ido.el b/lisp/ido.el
index 8087124765c..47c05b080f7 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3276,14 +3276,18 @@ for first matching file."
3276(defun ido-wide-find-dirs-or-files (dir file &optional prefix finddir) 3276(defun ido-wide-find-dirs-or-files (dir file &optional prefix finddir)
3277 ;; As ido-run-find-command, but returns a list of cons pairs ("file" . "dir") 3277 ;; As ido-run-find-command, but returns a list of cons pairs ("file" . "dir")
3278 (let ((filenames 3278 (let ((filenames
3279 (split-string 3279 (delq nil
3280 (shell-command-to-string 3280 (mapcar (lambda (name)
3281 (concat "find " 3281 (unless (ido-ignore-item-p name ido-ignore-files t)
3282 (shell-quote-argument dir) 3282 name))
3283 " -name " 3283 (split-string
3284 (shell-quote-argument 3284 (shell-command-to-string
3285 (concat (if prefix "" "*") file "*")) 3285 (concat "find "
3286 " -type " (if finddir "d" "f") " -print")))) 3286 (shell-quote-argument dir)
3287 (if ido-case-fold " -iname " " -name ")
3288 (shell-quote-argument
3289 (concat (if prefix "" "*") file "*"))
3290 " -type " (if finddir "d" "f") " -print"))))))
3287 filename d f 3291 filename d f
3288 res) 3292 res)
3289 (while filenames 3293 (while filenames
@@ -3297,7 +3301,7 @@ for first matching file."
3297 res)) 3301 res))
3298 3302
3299(defun ido-flatten-merged-list (items) 3303(defun ido-flatten-merged-list (items)
3300 ;; Create a list of directory names based on a merged directory list. 3304 "Create a list of directory names based on a merged directory list."
3301 (let (res) 3305 (let (res)
3302 (while items 3306 (while items
3303 (let* ((item (car items)) 3307 (let* ((item (car items))
@@ -3400,7 +3404,7 @@ for first matching file."
3400 res)) 3404 res))
3401 3405
3402(defun ido-make-buffer-list-1 (&optional frame visible) 3406(defun ido-make-buffer-list-1 (&optional frame visible)
3403 ;; Return list of non-ignored buffer names 3407 "Return list of non-ignored buffer names."
3404 (delq nil 3408 (delq nil
3405 (mapcar 3409 (mapcar
3406 (lambda (x) 3410 (lambda (x)
@@ -3410,12 +3414,12 @@ for first matching file."
3410 (buffer-list frame)))) 3414 (buffer-list frame))))
3411 3415
3412(defun ido-make-buffer-list (default) 3416(defun ido-make-buffer-list (default)
3413 ;; Return the current list of buffers. 3417 "Return the current list of buffers.
3414 ;; Currently visible buffers are put at the end of the list. 3418Currently visible buffers are put at the end of the list.
3415 ;; The hook `ido-make-buffer-list-hook' is run after the list has been 3419The hook `ido-make-buffer-list-hook' is run after the list has been
3416 ;; created to allow the user to further modify the order of the buffer names 3420created to allow the user to further modify the order of the buffer names
3417 ;; in this list. If DEFAULT is non-nil, and corresponds to an existing buffer, 3421in this list. If DEFAULT is non-nil, and corresponds to an existing buffer,
3418 ;; it is put to the start of the list. 3422it is put to the start of the list."
3419 (let* ((ido-current-buffers (ido-get-buffers-in-frames 'current)) 3423 (let* ((ido-current-buffers (ido-get-buffers-in-frames 'current))
3420 (ido-temp-list (ido-make-buffer-list-1 (selected-frame) ido-current-buffers))) 3424 (ido-temp-list (ido-make-buffer-list-1 (selected-frame) ido-current-buffers)))
3421 (if ido-temp-list 3425 (if ido-temp-list
@@ -3457,9 +3461,9 @@ This is to make them appear as if they were \"virtual buffers\"."
3457 (nreverse (mapcar #'car ido-virtual-buffers)))))) 3461 (nreverse (mapcar #'car ido-virtual-buffers))))))
3458 3462
3459(defun ido-make-choice-list (default) 3463(defun ido-make-choice-list (default)
3460 ;; Return the current list of choices. 3464 "Return the current list of choices.
3461 ;; If DEFAULT is non-nil, and corresponds to an element of choices, 3465If DEFAULT is non-nil, and corresponds to an element of choices,
3462 ;; it is put to the start of the list. 3466it is put to the start of the list."
3463 (let ((ido-temp-list ido-choice-list)) 3467 (let ((ido-temp-list ido-choice-list))
3464 (if default 3468 (if default
3465 (progn 3469 (progn
@@ -3471,7 +3475,7 @@ This is to make them appear as if they were \"virtual buffers\"."
3471 ido-temp-list)) 3475 ido-temp-list))
3472 3476
3473(defun ido-to-end (items) 3477(defun ido-to-end (items)
3474 ;; Move the elements from ITEMS to the end of `ido-temp-list' 3478 "Move the elements from ITEMS to the end of `ido-temp-list'."
3475 (mapc 3479 (mapc
3476 (lambda (elem) 3480 (lambda (elem)
3477 (setq ido-temp-list (delq elem ido-temp-list))) 3481 (setq ido-temp-list (delq elem ido-temp-list)))
@@ -3515,8 +3519,8 @@ This is to make them appear as if they were \"virtual buffers\"."
3515 (file-name-all-completions "" dir)))) 3519 (file-name-all-completions "" dir))))
3516 3520
3517(defun ido-file-name-all-completions (dir) 3521(defun ido-file-name-all-completions (dir)
3518 ;; Return name of all files in DIR 3522 "Return name of all files in DIR.
3519 ;; Uses and updates ido-dir-file-cache 3523Uses and updates `ido-dir-file-cache'."
3520 (cond 3524 (cond
3521 ((ido-is-unc-root dir) 3525 ((ido-is-unc-root dir)
3522 (mapcar 3526 (mapcar
@@ -3565,7 +3569,7 @@ This is to make them appear as if they were \"virtual buffers\"."
3565 (ido-file-name-all-completions-1 dir)))) 3569 (ido-file-name-all-completions-1 dir))))
3566 3570
3567(defun ido-remove-cached-dir (dir) 3571(defun ido-remove-cached-dir (dir)
3568 ;; Remove dir from ido-dir-file-cache 3572 "Remove DIR from `ido-dir-file-cache'."
3569 (if (and ido-dir-file-cache 3573 (if (and ido-dir-file-cache
3570 (stringp dir) (> (length dir) 0)) 3574 (stringp dir) (> (length dir) 0))
3571 (let ((cached (assoc dir ido-dir-file-cache))) 3575 (let ((cached (assoc dir ido-dir-file-cache)))
@@ -3574,8 +3578,8 @@ This is to make them appear as if they were \"virtual buffers\"."
3574 3578
3575 3579
3576(defun ido-make-file-list-1 (dir &optional merged) 3580(defun ido-make-file-list-1 (dir &optional merged)
3577 ;; Return list of non-ignored files in DIR 3581 "Return list of non-ignored files in DIR
3578 ;; If MERGED is non-nil, each file is cons'ed with DIR 3582If MERGED is non-nil, each file is cons'ed with DIR."
3579 (and (or (ido-is-tramp-root dir) (ido-is-unc-root dir) 3583 (and (or (ido-is-tramp-root dir) (ido-is-unc-root dir)
3580 (file-directory-p dir)) 3584 (file-directory-p dir))
3581 (delq nil 3585 (delq nil
@@ -3586,11 +3590,11 @@ This is to make them appear as if they were \"virtual buffers\"."
3586 (ido-file-name-all-completions dir))))) 3590 (ido-file-name-all-completions dir)))))
3587 3591
3588(defun ido-make-file-list (default) 3592(defun ido-make-file-list (default)
3589 ;; Return the current list of files. 3593 "Return the current list of files.
3590 ;; Currently visible files are put at the end of the list. 3594Currently visible files are put at the end of the list.
3591 ;; The hook `ido-make-file-list-hook' is run after the list has been 3595The hook `ido-make-file-list-hook' is run after the list has been
3592 ;; created to allow the user to further modify the order of the file names 3596created to allow the user to further modify the order of the file names
3593 ;; in this list. 3597in this list."
3594 (let ((ido-temp-list (ido-make-file-list-1 ido-current-directory))) 3598 (let ((ido-temp-list (ido-make-file-list-1 ido-current-directory)))
3595 (setq ido-temp-list (sort ido-temp-list 3599 (setq ido-temp-list (sort ido-temp-list
3596 (if ido-file-extensions-order 3600 (if ido-file-extensions-order
@@ -3631,8 +3635,8 @@ This is to make them appear as if they were \"virtual buffers\"."
3631 ido-temp-list)) 3635 ido-temp-list))
3632 3636
3633(defun ido-make-dir-list-1 (dir &optional merged) 3637(defun ido-make-dir-list-1 (dir &optional merged)
3634 ;; Return list of non-ignored subdirs in DIR 3638 "Return list of non-ignored subdirs in DIR.
3635 ;; If MERGED is non-nil, each subdir is cons'ed with DIR 3639If MERGED is non-nil, each subdir is cons'ed with DIR."
3636 (and (or (ido-is-tramp-root dir) (file-directory-p dir)) 3640 (and (or (ido-is-tramp-root dir) (file-directory-p dir))
3637 (delq nil 3641 (delq nil
3638 (mapcar 3642 (mapcar
@@ -3642,10 +3646,10 @@ This is to make them appear as if they were \"virtual buffers\"."
3642 (ido-file-name-all-completions dir))))) 3646 (ido-file-name-all-completions dir)))))
3643 3647
3644(defun ido-make-dir-list (default) 3648(defun ido-make-dir-list (default)
3645 ;; Return the current list of directories. 3649 "Return the current list of directories.
3646 ;; The hook `ido-make-dir-list-hook' is run after the list has been 3650The hook `ido-make-dir-list-hook' is run after the list has been
3647 ;; created to allow the user to further modify the order of the 3651created to allow the user to further modify the order of the
3648 ;; directory names in this list. 3652directory names in this list."
3649 (let ((ido-temp-list (ido-make-dir-list-1 ido-current-directory))) 3653 (let ((ido-temp-list (ido-make-dir-list-1 ido-current-directory)))
3650 (setq ido-temp-list (sort ido-temp-list #'ido-file-lessp)) 3654 (setq ido-temp-list (sort ido-temp-list #'ido-file-lessp))
3651 (ido-to-end ;; move . files to end 3655 (ido-to-end ;; move . files to end
@@ -3676,10 +3680,9 @@ This is to make them appear as if they were \"virtual buffers\"."
3676(defvar ido-bufs-in-frame) 3680(defvar ido-bufs-in-frame)
3677 3681
3678(defun ido-get-buffers-in-frames (&optional current) 3682(defun ido-get-buffers-in-frames (&optional current)
3679 ;; Return the list of buffers that are visible in the current frame. 3683 "Return the list of buffers that are visible in the current frame.
3680 ;; If optional argument `current' is given, restrict searching to the 3684If optional argument CURRENT is given, restrict searching to the current
3681 ;; current frame, rather than all frames, regardless of value of 3685frame, rather than all frames, regardless of value of `ido-all-frames'."
3682 ;; `ido-all-frames'.
3683 (let ((ido-bufs-in-frame nil)) 3686 (let ((ido-bufs-in-frame nil))
3684 (walk-windows 'ido-get-bufname nil 3687 (walk-windows 'ido-get-bufname nil
3685 (if current 3688 (if current
@@ -3688,7 +3691,7 @@ This is to make them appear as if they were \"virtual buffers\"."
3688 ido-bufs-in-frame)) 3691 ido-bufs-in-frame))
3689 3692
3690(defun ido-get-bufname (win) 3693(defun ido-get-bufname (win)
3691 ;; Used by `ido-get-buffers-in-frames' to walk through all windows 3694 "Used by `ido-get-buffers-in-frames' to walk through all windows."
3692 (let ((buf (buffer-name (window-buffer win)))) 3695 (let ((buf (buffer-name (window-buffer win))))
3693 (unless (or (member buf ido-bufs-in-frame) 3696 (unless (or (member buf ido-bufs-in-frame)
3694 (member buf ido-ignore-item-temp-list)) 3697 (member buf ido-ignore-item-temp-list))
@@ -3701,7 +3704,7 @@ This is to make them appear as if they were \"virtual buffers\"."
3701;;; FIND MATCHING ITEMS 3704;;; FIND MATCHING ITEMS
3702 3705
3703(defun ido-set-matches-1 (items &optional do-full) 3706(defun ido-set-matches-1 (items &optional do-full)
3704 ;; Return list of matches in items 3707 "Return list of matches in ITEMS."
3705 (let* ((case-fold-search ido-case-fold) 3708 (let* ((case-fold-search ido-case-fold)
3706 (slash (and (not ido-enable-prefix) (ido-final-slash ido-text))) 3709 (slash (and (not ido-enable-prefix) (ido-final-slash ido-text)))
3707 (text (if slash (substring ido-text 0 -1) ido-text)) 3710 (text (if slash (substring ido-text 0 -1) ido-text))
@@ -3789,13 +3792,13 @@ This is to make them appear as if they were \"virtual buffers\"."
3789 3792
3790 3793
3791(defun ido-set-matches () 3794(defun ido-set-matches ()
3792 ;; Set `ido-matches' to the list of items matching prompt 3795 "Set `ido-matches' to the list of items matching prompt."
3793 (when ido-rescan 3796 (when ido-rescan
3794 (setq ido-matches (ido-set-matches-1 (reverse ido-cur-list) (not ido-rotate)) 3797 (setq ido-matches (ido-set-matches-1 (reverse ido-cur-list) (not ido-rotate))
3795 ido-rotate nil))) 3798 ido-rotate nil)))
3796 3799
3797(defun ido-ignore-item-p (name re-list &optional ignore-ext) 3800(defun ido-ignore-item-p (name re-list &optional ignore-ext)
3798 ;; Return t if the buffer or file NAME should be ignored. 3801 "Return t if the buffer or file NAME should be ignored."
3799 (or (member name ido-ignore-item-temp-list) 3802 (or (member name ido-ignore-item-temp-list)
3800 (and 3803 (and
3801 ido-process-ignore-lists re-list 3804 ido-process-ignore-lists re-list
@@ -3835,7 +3838,7 @@ This is to make them appear as if they were \"virtual buffers\"."
3835(defvar ido-change-word-sub) 3838(defvar ido-change-word-sub)
3836 3839
3837(defun ido-find-common-substring (items subs) 3840(defun ido-find-common-substring (items subs)
3838 ;; Return common string following SUBS in each element of ITEMS. 3841 "Return common string following SUBS in each element of ITEMS."
3839 (let (res 3842 (let (res
3840 alist 3843 alist
3841 ido-change-word-sub) 3844 ido-change-word-sub)
@@ -3855,8 +3858,8 @@ This is to make them appear as if they were \"virtual buffers\"."
3855 comp)))) 3858 comp))))
3856 3859
3857(defun ido-word-matching-substring (word) 3860(defun ido-word-matching-substring (word)
3858 ;; Return part of WORD before 1st match to `ido-change-word-sub'. 3861 "Return part of WORD before first match to `ido-change-word-sub'.
3859 ;; If `ido-change-word-sub' cannot be found in WORD, return nil. 3862If `ido-change-word-sub' cannot be found in WORD, return nil."
3860 (let ((case-fold-search ido-case-fold)) 3863 (let ((case-fold-search ido-case-fold))
3861 (let ((m (string-match ido-change-word-sub (ido-name word)))) 3864 (let ((m (string-match ido-change-word-sub (ido-name word))))
3862 (if m 3865 (if m
@@ -3865,7 +3868,7 @@ This is to make them appear as if they were \"virtual buffers\"."
3865 nil)))) 3868 nil))))
3866 3869
3867(defun ido-makealist (res) 3870(defun ido-makealist (res)
3868 ;; Return dotted pair (RES . 1). 3871 "Return dotted pair (RES . 1)."
3869 (cons res 1)) 3872 (cons res 1))
3870 3873
3871(defun ido-choose-completion-string (choice &rest ignored) 3874(defun ido-choose-completion-string (choice &rest ignored)
@@ -4048,8 +4051,8 @@ Record command in `command-history' if optional RECORD is non-nil."
4048 4051
4049 4052
4050(defun ido-buffer-window-other-frame (buffer) 4053(defun ido-buffer-window-other-frame (buffer)
4051 ;; Return window pointer if BUFFER is visible in another frame. 4054 "Return window pointer if BUFFER is visible in another frame.
4052 ;; If BUFFER is visible in the current frame, return nil. 4055If BUFFER is visible in the current frame, return nil."
4053 (let ((blist (ido-get-buffers-in-frames 'current))) 4056 (let ((blist (ido-get-buffers-in-frames 'current)))
4054 ;;If the buffer is visible in current frame, return nil 4057 ;;If the buffer is visible in current frame, return nil
4055 (if (member buffer blist) 4058 (if (member buffer blist)
@@ -4533,9 +4536,8 @@ For details of keybindings, see `ido-find-file'."
4533 )))) 4536 ))))
4534 4537
4535(defun ido-completions (name) 4538(defun ido-completions (name)
4536 ;; Return the string that is displayed after the user's text. 4539 "Return the string that is displayed after the user's text.
4537 ;; Modified from `icomplete-completions'. 4540Modified from `icomplete-completions'."
4538
4539 (let* ((comps ido-matches) 4541 (let* ((comps ido-matches)
4540 (ind (and (consp (car comps)) (> (length (cdr (car comps))) 1) 4542 (ind (and (consp (car comps)) (> (length (cdr (car comps))) 1)
4541 ido-merged-indicator)) 4543 ido-merged-indicator))
diff --git a/lisp/ielm.el b/lisp/ielm.el
index 610cc3ea364..4280a49af6e 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -167,7 +167,7 @@ This variable is buffer-local.")
167 167
168(defvar ielm-map 168(defvar ielm-map
169 (let ((map (make-sparse-keymap))) 169 (let ((map (make-sparse-keymap)))
170 (define-key map "\t" 'comint-dynamic-complete) 170 (define-key map "\t" 'completion-at-point)
171 (define-key map "\C-m" 'ielm-return) 171 (define-key map "\C-m" 'ielm-return)
172 (define-key map "\C-j" 'ielm-send-input) 172 (define-key map "\C-j" 'ielm-send-input)
173 (define-key map "\e\C-x" 'eval-defun) ; for consistency with 173 (define-key map "\e\C-x" 'eval-defun) ; for consistency with
@@ -209,12 +209,13 @@ This variable is buffer-local.")
209 209
210(defun ielm-complete-symbol nil 210(defun ielm-complete-symbol nil
211 "Complete the Lisp symbol before point." 211 "Complete the Lisp symbol before point."
212 ;; A wrapper for lisp-complete symbol that returns non-nil if 212 ;; A wrapper for completion-at-point that returns non-nil if
213 ;; completion has occurred 213 ;; completion has occurred
214 (let* ((btick (buffer-modified-tick)) 214 (let* ((btick (buffer-modified-tick))
215 (cbuffer (get-buffer "*Completions*")) 215 (cbuffer (get-buffer "*Completions*"))
216 (ctick (and cbuffer (buffer-modified-tick cbuffer)))) 216 (ctick (and cbuffer (buffer-modified-tick cbuffer)))
217 (lisp-complete-symbol) 217 (completion-at-point-functions '(lisp-completion-at-point)))
218 (completion-at-point)
218 ;; completion has occurred if: 219 ;; completion has occurred if:
219 (or 220 (or
220 ;; the buffer has been modified 221 ;; the buffer has been modified
@@ -461,7 +462,7 @@ Uses the interface provided by `comint-mode' (which see).
461 Inputs longer than one line are moved to the line following the 462 Inputs longer than one line are moved to the line following the
462 prompt (but see variable `ielm-dynamic-multiline-inputs'). 463 prompt (but see variable `ielm-dynamic-multiline-inputs').
463 464
464* \\[comint-dynamic-complete] completes Lisp symbols (or filenames, within strings), 465* \\[completion-at-point] completes Lisp symbols (or filenames, within strings),
465 or indents the line if there is nothing to complete. 466 or indents the line if there is nothing to complete.
466 467
467The current working buffer may be changed (with a call to `set-buffer', 468The current working buffer may be changed (with a call to `set-buffer',
@@ -498,7 +499,7 @@ Customized bindings may be defined in `ielm-map', which currently contains:
498 (set (make-local-variable 'paragraph-start) comint-prompt-regexp) 499 (set (make-local-variable 'paragraph-start) comint-prompt-regexp)
499 (setq comint-input-sender 'ielm-input-sender) 500 (setq comint-input-sender 'ielm-input-sender)
500 (setq comint-process-echoes nil) 501 (setq comint-process-echoes nil)
501 (set (make-local-variable 'comint-dynamic-complete-functions) 502 (set (make-local-variable 'completion-at-point-functions)
502 '(ielm-tab comint-replace-by-expanded-history 503 '(ielm-tab comint-replace-by-expanded-history
503 ielm-complete-filename ielm-complete-symbol)) 504 ielm-complete-filename ielm-complete-symbol))
504 (set (make-local-variable 'ielm-prompt-internal) ielm-prompt) 505 (set (make-local-variable 'ielm-prompt-internal) ielm-prompt)
@@ -513,8 +514,6 @@ Customized bindings may be defined in `ielm-map', which currently contains:
513 (set (make-local-variable 'indent-line-function) 'ielm-indent-line) 514 (set (make-local-variable 'indent-line-function) 'ielm-indent-line)
514 (set (make-local-variable 'ielm-working-buffer) (current-buffer)) 515 (set (make-local-variable 'ielm-working-buffer) (current-buffer))
515 (set (make-local-variable 'fill-paragraph-function) 'lisp-fill-paragraph) 516 (set (make-local-variable 'fill-paragraph-function) 'lisp-fill-paragraph)
516 (add-hook 'completion-at-point-functions
517 'lisp-completion-at-point nil 'local)
518 517
519 ;; Value holders 518 ;; Value holders
520 (set (make-local-variable '*) nil) 519 (set (make-local-variable '*) nil)
diff --git a/lisp/image.el b/lisp/image.el
index ec7b41bf126..804dc3af5ea 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -624,7 +624,12 @@ in which case you might want to use `image-default-frame-delay'."
624 (setq delay image-default-frame-delay)) 624 (setq delay image-default-frame-delay))
625 (cons images delay)))) 625 (cons images delay))))
626 626
627(define-obsolete-function-alias 'image-animated-p 'image-multi-frame-p "24.4") 627(defun image-animated-p (image)
628 "Like `image-multi-frame-p', but returns nil if no delay is specified."
629 (let ((multi (image-multi-frame-p image)))
630 (and (cdr multi) multi)))
631
632(make-obsolete 'image-animated-p 'image-multi-frame-p "24.4")
628 633
629;; "Destructively"? 634;; "Destructively"?
630(defun image-animate (image &optional index limit) 635(defun image-animate (image &optional index limit)
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index a31a90d9cfb..48487b850df 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -1508,6 +1508,7 @@ for decoding and encoding files, process I/O, etc."
1508(setq file-coding-system-alist 1508(setq file-coding-system-alist
1509 (mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg))) 1509 (mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg)))
1510 '(("\\.elc\\'" . utf-8-emacs) 1510 '(("\\.elc\\'" . utf-8-emacs)
1511 ("\\.el\\'" . utf-8)
1511 ("\\.utf\\(-8\\)?\\'" . utf-8) 1512 ("\\.utf\\(-8\\)?\\'" . utf-8)
1512 ("\\.xml\\'" . xml-find-file-coding-system) 1513 ("\\.xml\\'" . xml-find-file-coding-system)
1513 ;; We use raw-text for reading loaddefs.el so that if it 1514 ;; We use raw-text for reading loaddefs.el so that if it
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 5bf2818fadc..d9f8b0891e4 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -198,7 +198,7 @@ skips this match and continues searching for the next match.
198When the list of predicates is empty, `run-hook-with-args-until-failure' 198When the list of predicates is empty, `run-hook-with-args-until-failure'
199returns non-nil that means that the found match is accepted. 199returns non-nil that means that the found match is accepted.
200The property `isearch-message-prefix' put on the predicate's symbol 200The property `isearch-message-prefix' put on the predicate's symbol
201specifies the prefix string displyed in the search message.") 201specifies the prefix string displayed in the search message.")
202(define-obsolete-variable-alias 'isearch-filter-predicate 202(define-obsolete-variable-alias 'isearch-filter-predicate
203 'isearch-filter-predicates 203 'isearch-filter-predicates
204 "24.4") 204 "24.4")
@@ -514,6 +514,7 @@ This is like `describe-bindings', but displays only Isearch keys."
514 (define-key map "\M-e" 'isearch-edit-string) 514 (define-key map "\M-e" 'isearch-edit-string)
515 515
516 (define-key map "\M-sc" 'isearch-toggle-case-fold) 516 (define-key map "\M-sc" 'isearch-toggle-case-fold)
517 (define-key map "\M-si" 'isearch-toggle-invisible)
517 (define-key map "\M-sr" 'isearch-toggle-regexp) 518 (define-key map "\M-sr" 'isearch-toggle-regexp)
518 (define-key map "\M-sw" 'isearch-toggle-word) 519 (define-key map "\M-sw" 'isearch-toggle-word)
519 (define-key map "\M-s_" 'isearch-toggle-symbol) 520 (define-key map "\M-s_" 'isearch-toggle-symbol)
@@ -602,6 +603,11 @@ Each set is a vector of the form:
602;; case in the search string is ignored. 603;; case in the search string is ignored.
603(defvar isearch-case-fold-search nil) 604(defvar isearch-case-fold-search nil)
604 605
606;; search-invisible while searching.
607;; either nil, t, or 'open. 'open means the same as t except that
608;; opens hidden overlays.
609(defvar isearch-invisible search-invisible)
610
605(defvar isearch-last-case-fold-search nil) 611(defvar isearch-last-case-fold-search nil)
606 612
607;; Used to save default value while isearch is active 613;; Used to save default value while isearch is active
@@ -661,6 +667,7 @@ Each set is a vector of the form:
661(define-key esc-map "\C-r" 'isearch-backward-regexp) 667(define-key esc-map "\C-r" 'isearch-backward-regexp)
662(define-key search-map "w" 'isearch-forward-word) 668(define-key search-map "w" 'isearch-forward-word)
663(define-key search-map "_" 'isearch-forward-symbol) 669(define-key search-map "_" 'isearch-forward-symbol)
670(define-key search-map "." 'isearch-forward-symbol-at-point)
664 671
665;; Entry points to isearch-mode. 672;; Entry points to isearch-mode.
666 673
@@ -700,6 +707,7 @@ If you try to exit with the search string still empty, it invokes
700 nonincremental search. 707 nonincremental search.
701 708
702Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity. 709Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity.
710Type \\[isearch-toggle-invisible] to toggle search in invisible text.
703Type \\[isearch-toggle-regexp] to toggle regular-expression mode. 711Type \\[isearch-toggle-regexp] to toggle regular-expression mode.
704Type \\[isearch-toggle-word] to toggle word mode. 712Type \\[isearch-toggle-word] to toggle word mode.
705Type \\[isearch-toggle-symbol] to toggle symbol mode. 713Type \\[isearch-toggle-symbol] to toggle symbol mode.
@@ -799,6 +807,25 @@ as a regexp. See the command `isearch-forward' for more information."
799 (interactive "P\np") 807 (interactive "P\np")
800 (isearch-mode nil (null not-regexp) nil (not no-recursive-edit))) 808 (isearch-mode nil (null not-regexp) nil (not no-recursive-edit)))
801 809
810(defun isearch-forward-symbol-at-point ()
811 "Do incremental search forward for a symbol found near point.
812Like ordinary incremental search except that the symbol found at point
813is added to the search string initially as a regexp surrounded
814by symbol boundary constructs \\_< and \\_>.
815See the command `isearch-forward-symbol' for more information."
816 (interactive)
817 (isearch-forward-symbol nil 1)
818 (let ((bounds (find-tag-default-bounds)))
819 (cond
820 (bounds
821 (when (< (car bounds) (point))
822 (goto-char (car bounds)))
823 (isearch-yank-string
824 (buffer-substring-no-properties (car bounds) (cdr bounds))))
825 (t
826 (setq isearch-error "No symbol at point")
827 (isearch-update)))))
828
802 829
803;; isearch-mode only sets up incremental search for the minor mode. 830;; isearch-mode only sets up incremental search for the minor mode.
804;; All the work is done by the isearch-mode commands. 831;; All the work is done by the isearch-mode commands.
@@ -836,6 +863,7 @@ convert the search string to a regexp used by regexp search functions."
836 isearch-op-fun op-fun 863 isearch-op-fun op-fun
837 isearch-last-case-fold-search isearch-case-fold-search 864 isearch-last-case-fold-search isearch-case-fold-search
838 isearch-case-fold-search case-fold-search 865 isearch-case-fold-search case-fold-search
866 isearch-invisible search-invisible
839 isearch-string "" 867 isearch-string ""
840 isearch-message "" 868 isearch-message ""
841 isearch-cmds nil 869 isearch-cmds nil
@@ -1474,7 +1502,8 @@ value of the variable `isearch-regexp-lax-whitespace'."
1474 (isearch-update)) 1502 (isearch-update))
1475 1503
1476(defun isearch-toggle-case-fold () 1504(defun isearch-toggle-case-fold ()
1477 "Toggle case folding in searching on or off." 1505 "Toggle case folding in searching on or off.
1506Toggles the value of the variable `isearch-case-fold-search'."
1478 (interactive) 1507 (interactive)
1479 (setq isearch-case-fold-search 1508 (setq isearch-case-fold-search
1480 (if isearch-case-fold-search nil 'yes)) 1509 (if isearch-case-fold-search nil 'yes))
@@ -1487,6 +1516,23 @@ value of the variable `isearch-regexp-lax-whitespace'."
1487 (sit-for 1) 1516 (sit-for 1)
1488 (isearch-update)) 1517 (isearch-update))
1489 1518
1519(defun isearch-toggle-invisible ()
1520 "Toggle searching in invisible text on or off.
1521Toggles the variable `isearch-invisible' between values
1522nil and a non-nil value of the option `search-invisible'
1523\(or `open' if `search-invisible' is nil)."
1524 (interactive)
1525 (setq isearch-invisible
1526 (if isearch-invisible nil (or search-invisible 'open)))
1527 (let ((message-log-max nil))
1528 (message "%s%s [match %svisible text]"
1529 (isearch-message-prefix nil isearch-nonincremental)
1530 isearch-message
1531 (if isearch-invisible "in" "")))
1532 (setq isearch-success t isearch-adjusted t)
1533 (sit-for 1)
1534 (isearch-update))
1535
1490 1536
1491;; Word search 1537;; Word search
1492 1538
@@ -1622,6 +1668,7 @@ way to run word replacements from Isearch is `M-s w ... M-%'."
1622 ;; set `search-upper-case' to nil to not call 1668 ;; set `search-upper-case' to nil to not call
1623 ;; `isearch-no-upper-case-p' in `perform-replace' 1669 ;; `isearch-no-upper-case-p' in `perform-replace'
1624 (search-upper-case nil) 1670 (search-upper-case nil)
1671 (search-invisible isearch-invisible)
1625 (replace-lax-whitespace 1672 (replace-lax-whitespace
1626 isearch-lax-whitespace) 1673 isearch-lax-whitespace)
1627 (replace-regexp-lax-whitespace 1674 (replace-regexp-lax-whitespace
@@ -1725,7 +1772,10 @@ and reads its face argument using `hi-lock-read-face-name'."
1725 (isearch-done nil t) 1772 (isearch-done nil t)
1726 (isearch-clean-overlays)) 1773 (isearch-clean-overlays))
1727 (require 'hi-lock nil t) 1774 (require 'hi-lock nil t)
1728 (let ((string (cond (isearch-regexp isearch-string) 1775 (let ((regexp (cond ((functionp isearch-word)
1776 (funcall isearch-word isearch-string))
1777 (isearch-word (word-search-regexp isearch-string))
1778 (isearch-regexp isearch-string)
1729 ((if (and (eq isearch-case-fold-search t) 1779 ((if (and (eq isearch-case-fold-search t)
1730 search-upper-case) 1780 search-upper-case)
1731 (isearch-no-upper-case-p 1781 (isearch-no-upper-case-p
@@ -1741,7 +1791,7 @@ and reads its face argument using `hi-lock-read-face-name'."
1741 (regexp-quote s)))) 1791 (regexp-quote s))))
1742 isearch-string "")) 1792 isearch-string ""))
1743 (t (regexp-quote isearch-string))))) 1793 (t (regexp-quote isearch-string)))))
1744 (hi-lock-face-buffer string (hi-lock-read-face-name))) 1794 (hi-lock-face-buffer regexp (hi-lock-read-face-name)))
1745 (and isearch-recursive-edit (exit-recursive-edit))) 1795 (and isearch-recursive-edit (exit-recursive-edit)))
1746 1796
1747 1797
@@ -2102,6 +2152,15 @@ If nil, scrolling commands will first cancel Isearch mode."
2102 :type 'boolean 2152 :type 'boolean
2103 :group 'isearch) 2153 :group 'isearch)
2104 2154
2155(defcustom isearch-allow-prefix t
2156 "Whether prefix arguments are allowed during incremental search.
2157If non-nil, entering a prefix argument will not terminate the
2158search. This option is ignored \(presumed t) when
2159`isearch-allow-scroll' is set."
2160 :version "24.4"
2161 :type 'boolean
2162 :group 'isearch)
2163
2105(defun isearch-string-out-of-window (isearch-point) 2164(defun isearch-string-out-of-window (isearch-point)
2106 "Test whether the search string is currently outside of the window. 2165 "Test whether the search string is currently outside of the window.
2107Return nil if it's completely visible, or if point is visible, 2166Return nil if it's completely visible, or if point is visible,
@@ -2254,12 +2313,19 @@ Isearch mode."
2254 (setq prefix-arg arg) 2313 (setq prefix-arg arg)
2255 (apply 'isearch-unread keylist) 2314 (apply 'isearch-unread keylist)
2256 (isearch-edit-string)) 2315 (isearch-edit-string))
2257 ;; Handle a scrolling function. 2316 ;; Handle a scrolling function or prefix argument.
2258 ((and isearch-allow-scroll 2317 ((progn
2259 (progn (setq key (isearch-reread-key-sequence-naturally keylist)) 2318 (setq key (isearch-reread-key-sequence-naturally keylist)
2260 (setq keylist (listify-key-sequence key)) 2319 keylist (listify-key-sequence key)
2261 (setq main-event (aref key 0)) 2320 main-event (aref key 0))
2262 (setq scroll-command (isearch-lookup-scroll-key key)))) 2321 (or (and isearch-allow-scroll
2322 (setq scroll-command (isearch-lookup-scroll-key key)))
2323 (and isearch-allow-prefix
2324 (let (overriding-terminal-local-map)
2325 (setq scroll-command (key-binding key))
2326 (memq scroll-command
2327 '(universal-argument
2328 negative-argument digit-argument))))))
2263 ;; From this point onwards, KEY, KEYLIST and MAIN-EVENT hold a 2329 ;; From this point onwards, KEY, KEYLIST and MAIN-EVENT hold a
2264 ;; complete key sequence, possibly as modified by function-key-map, 2330 ;; complete key sequence, possibly as modified by function-key-map,
2265 ;; not merely the one or two event fragment which invoked 2331 ;; not merely the one or two event fragment which invoked
@@ -2638,9 +2704,10 @@ update the match data, and return point."
2638 (setq isearch-case-fold-search 2704 (setq isearch-case-fold-search
2639 (isearch-no-upper-case-p isearch-string isearch-regexp))) 2705 (isearch-no-upper-case-p isearch-string isearch-regexp)))
2640 (condition-case lossage 2706 (condition-case lossage
2641 (let ((inhibit-point-motion-hooks search-invisible) 2707 (let ((inhibit-point-motion-hooks isearch-invisible)
2642 (inhibit-quit nil) 2708 (inhibit-quit nil)
2643 (case-fold-search isearch-case-fold-search) 2709 (case-fold-search isearch-case-fold-search)
2710 (search-invisible isearch-invisible)
2644 (retry t)) 2711 (retry t))
2645 (setq isearch-error nil) 2712 (setq isearch-error nil)
2646 (while retry 2713 (while retry
@@ -2836,7 +2903,7 @@ determined by `isearch-range-invisible' unless invisible text can be
2836searched too when `search-invisible' is t." 2903searched too when `search-invisible' is t."
2837 (or (eq search-invisible t) 2904 (or (eq search-invisible t)
2838 (not (isearch-range-invisible beg end)))) 2905 (not (isearch-range-invisible beg end))))
2839(make-obsolete 'isearch-filter-visible 'search-invisible "24.4") 2906(make-obsolete 'isearch-filter-visible 'isearch-invisible "24.4")
2840 2907
2841 2908
2842;; General utilities 2909;; General utilities
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index d2b97986581..6cd20f9c8ca 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -68,7 +68,7 @@ should return a grid vector array that is the new solution.
68;;;*** 68;;;***
69 69
70;;;### (autoloads (ada-mode ada-add-extensions) "ada-mode" "progmodes/ada-mode.el" 70;;;### (autoloads (ada-mode ada-add-extensions) "ada-mode" "progmodes/ada-mode.el"
71;;;;;; (20709 26818 907104 0)) 71;;;;;; (20874 62962 290468 0))
72;;; Generated autoloads from progmodes/ada-mode.el 72;;; Generated autoloads from progmodes/ada-mode.el
73 73
74(autoload 'ada-add-extensions "ada-mode" "\ 74(autoload 'ada-add-extensions "ada-mode" "\
@@ -474,7 +474,7 @@ A replacement function for `newline-and-indent', aligning as it goes.
474 474
475;;;### (autoloads (outlineify-sticky allout-mode allout-mode-p allout-auto-activation 475;;;### (autoloads (outlineify-sticky allout-mode allout-mode-p allout-auto-activation
476;;;;;; allout-setup allout-auto-activation-helper) "allout" "allout.el" 476;;;;;; allout-setup allout-auto-activation-helper) "allout" "allout.el"
477;;;;;; (20709 26818 907104 0)) 477;;;;;; (20892 39729 858825 0))
478;;; Generated autoloads from allout.el 478;;; Generated autoloads from allout.el
479 479
480(autoload 'allout-auto-activation-helper "allout" "\ 480(autoload 'allout-auto-activation-helper "allout" "\
@@ -1245,8 +1245,8 @@ Entering array mode calls the function `array-mode-hook'.
1245 1245
1246;;;*** 1246;;;***
1247 1247
1248;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (20777 1248;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (20891
1249;;;;;; 63161 848428 0)) 1249;;;;;; 18859 893295 0))
1250;;; Generated autoloads from textmodes/artist.el 1250;;; Generated autoloads from textmodes/artist.el
1251 1251
1252(autoload 'artist-mode "artist" "\ 1252(autoload 'artist-mode "artist" "\
@@ -1554,7 +1554,7 @@ This is similar to `autoarg-mode' but rebinds the keypad keys
1554;;;*** 1554;;;***
1555 1555
1556;;;### (autoloads (autoconf-mode) "autoconf" "progmodes/autoconf.el" 1556;;;### (autoloads (autoconf-mode) "autoconf" "progmodes/autoconf.el"
1557;;;;;; (20709 26818 907104 0)) 1557;;;;;; (20874 62962 290468 0))
1558;;; Generated autoloads from progmodes/autoconf.el 1558;;; Generated autoloads from progmodes/autoconf.el
1559 1559
1560(autoload 'autoconf-mode "autoconf" "\ 1560(autoload 'autoconf-mode "autoconf" "\
@@ -1605,7 +1605,7 @@ insert a template for the file depending on the mode of the buffer.
1605 1605
1606;;;### (autoloads (batch-update-autoloads update-directory-autoloads 1606;;;### (autoloads (batch-update-autoloads update-directory-autoloads
1607;;;;;; update-file-autoloads) "autoload" "emacs-lisp/autoload.el" 1607;;;;;; update-file-autoloads) "autoload" "emacs-lisp/autoload.el"
1608;;;;;; (20709 26818 907104 0)) 1608;;;;;; (20879 27694 495748 0))
1609;;; Generated autoloads from emacs-lisp/autoload.el 1609;;; Generated autoloads from emacs-lisp/autoload.el
1610 1610
1611(put 'generated-autoload-file 'safe-local-variable 'stringp) 1611(put 'generated-autoload-file 'safe-local-variable 'stringp)
@@ -1656,7 +1656,7 @@ should be non-nil).
1656 1656
1657;;;### (autoloads (global-auto-revert-mode turn-on-auto-revert-tail-mode 1657;;;### (autoloads (global-auto-revert-mode turn-on-auto-revert-tail-mode
1658;;;;;; auto-revert-tail-mode turn-on-auto-revert-mode auto-revert-mode) 1658;;;;;; auto-revert-tail-mode turn-on-auto-revert-mode auto-revert-mode)
1659;;;;;; "autorevert" "autorevert.el" (20831 63016 738579 0)) 1659;;;;;; "autorevert" "autorevert.el" (20893 60586 188550 0))
1660;;; Generated autoloads from autorevert.el 1660;;; Generated autoloads from autorevert.el
1661 1661
1662(autoload 'auto-revert-mode "autorevert" "\ 1662(autoload 'auto-revert-mode "autorevert" "\
@@ -2112,7 +2112,7 @@ a reflection.
2112;;;;;; bookmark-save bookmark-write bookmark-delete bookmark-insert 2112;;;;;; bookmark-save bookmark-write bookmark-delete bookmark-insert
2113;;;;;; bookmark-rename bookmark-insert-location bookmark-relocate 2113;;;;;; bookmark-rename bookmark-insert-location bookmark-relocate
2114;;;;;; bookmark-jump-other-window bookmark-jump bookmark-set) "bookmark" 2114;;;;;; bookmark-jump-other-window bookmark-jump bookmark-set) "bookmark"
2115;;;;;; "bookmark.el" (20849 6570 598687 0)) 2115;;;;;; "bookmark.el" (20874 65006 176325 548000))
2116;;; Generated autoloads from bookmark.el 2116;;; Generated autoloads from bookmark.el
2117 (define-key ctl-x-r-map "b" 'bookmark-jump) 2117 (define-key ctl-x-r-map "b" 'bookmark-jump)
2118 (define-key ctl-x-r-map "m" 'bookmark-set) 2118 (define-key ctl-x-r-map "m" 'bookmark-set)
@@ -2313,7 +2313,7 @@ Incremental search of bookmarks, hiding the non-matches as we go.
2313;;;;;; browse-url-xdg-open browse-url-at-mouse browse-url-at-point 2313;;;;;; browse-url-xdg-open browse-url-at-mouse browse-url-at-point
2314;;;;;; browse-url browse-url-of-region browse-url-of-dired-file 2314;;;;;; browse-url browse-url-of-region browse-url-of-dired-file
2315;;;;;; browse-url-of-buffer browse-url-of-file browse-url-browser-function) 2315;;;;;; browse-url-of-buffer browse-url-of-file browse-url-browser-function)
2316;;;;;; "browse-url" "net/browse-url.el" (20709 26818 907104 0)) 2316;;;;;; "browse-url" "net/browse-url.el" (20874 62962 290468 0))
2317;;; Generated autoloads from net/browse-url.el 2317;;; Generated autoloads from net/browse-url.el
2318 2318
2319(defvar browse-url-browser-function 'browse-url-default-browser "\ 2319(defvar browse-url-browser-function 'browse-url-default-browser "\
@@ -2716,7 +2716,7 @@ Like `bug-reference-mode', but only buttonize in comments and strings.
2716;;;;;; batch-byte-compile-if-not-done display-call-tree byte-compile 2716;;;;;; batch-byte-compile-if-not-done display-call-tree byte-compile
2717;;;;;; compile-defun byte-compile-file byte-recompile-directory 2717;;;;;; compile-defun byte-compile-file byte-recompile-directory
2718;;;;;; byte-force-recompile byte-compile-enable-warning byte-compile-disable-warning) 2718;;;;;; byte-force-recompile byte-compile-enable-warning byte-compile-disable-warning)
2719;;;;;; "bytecomp" "emacs-lisp/bytecomp.el" (20851 48294 960738 0)) 2719;;;;;; "bytecomp" "emacs-lisp/bytecomp.el" (20900 33838 319219 0))
2720;;; Generated autoloads from emacs-lisp/bytecomp.el 2720;;; Generated autoloads from emacs-lisp/bytecomp.el
2721(put 'byte-compile-dynamic 'safe-local-variable 'booleanp) 2721(put 'byte-compile-dynamic 'safe-local-variable 'booleanp)
2722(put 'byte-compile-disable-print-circle 'safe-local-variable 'booleanp) 2722(put 'byte-compile-disable-print-circle 'safe-local-variable 'booleanp)
@@ -2971,8 +2971,8 @@ See Info node `(calc)Defining Functions'.
2971 2971
2972;;;*** 2972;;;***
2973 2973
2974;;;### (autoloads (calculator) "calculator" "calculator.el" (20709 2974;;;### (autoloads (calculator) "calculator" "calculator.el" (20891
2975;;;;;; 26818 907104 0)) 2975;;;;;; 18859 893295 0))
2976;;; Generated autoloads from calculator.el 2976;;; Generated autoloads from calculator.el
2977 2977
2978(autoload 'calculator "calculator" "\ 2978(autoload 'calculator "calculator" "\
@@ -3206,7 +3206,7 @@ the absolute file name of the file if STYLE-NAME is nil.
3206 3206
3207;;;### (autoloads (awk-mode pike-mode idl-mode java-mode objc-mode 3207;;;### (autoloads (awk-mode pike-mode idl-mode java-mode objc-mode
3208;;;;;; c++-mode c-mode c-initialize-cc-mode) "cc-mode" "progmodes/cc-mode.el" 3208;;;;;; c++-mode c-mode c-initialize-cc-mode) "cc-mode" "progmodes/cc-mode.el"
3209;;;;;; (20845 9511 656701 0)) 3209;;;;;; (20903 56820 471502 429000))
3210;;; Generated autoloads from progmodes/cc-mode.el 3210;;; Generated autoloads from progmodes/cc-mode.el
3211 3211
3212(autoload 'c-initialize-cc-mode "cc-mode" "\ 3212(autoload 'c-initialize-cc-mode "cc-mode" "\
@@ -3434,8 +3434,8 @@ and exists only for compatibility reasons.
3434 3434
3435;;;*** 3435;;;***
3436 3436
3437;;;### (autoloads nil "cc-vars" "progmodes/cc-vars.el" (20709 26818 3437;;;### (autoloads nil "cc-vars" "progmodes/cc-vars.el" (20904 30886
3438;;;;;; 907104 0)) 3438;;;;;; 391458 0))
3439;;; Generated autoloads from progmodes/cc-vars.el 3439;;; Generated autoloads from progmodes/cc-vars.el
3440(put 'c-basic-offset 'safe-local-variable 'integerp) 3440(put 'c-basic-offset 'safe-local-variable 'integerp)
3441(put 'c-backslash-column 'safe-local-variable 'integerp) 3441(put 'c-backslash-column 'safe-local-variable 'integerp)
@@ -3445,7 +3445,7 @@ and exists only for compatibility reasons.
3445 3445
3446;;;### (autoloads (ccl-execute-with-args check-ccl-program define-ccl-program 3446;;;### (autoloads (ccl-execute-with-args check-ccl-program define-ccl-program
3447;;;;;; declare-ccl-program ccl-dump ccl-compile) "ccl" "international/ccl.el" 3447;;;;;; declare-ccl-program ccl-dump ccl-compile) "ccl" "international/ccl.el"
3448;;;;;; (20709 26818 907104 0)) 3448;;;;;; (20884 7264 412929 442000))
3449;;; Generated autoloads from international/ccl.el 3449;;; Generated autoloads from international/ccl.el
3450 3450
3451(autoload 'ccl-compile "ccl" "\ 3451(autoload 'ccl-compile "ccl" "\
@@ -3776,7 +3776,7 @@ Returns non-nil if any false statements are found.
3776;;;;;; checkdoc-comments checkdoc-continue checkdoc-start checkdoc-current-buffer 3776;;;;;; checkdoc-comments checkdoc-continue checkdoc-start checkdoc-current-buffer
3777;;;;;; checkdoc-eval-current-buffer checkdoc-message-interactive 3777;;;;;; checkdoc-eval-current-buffer checkdoc-message-interactive
3778;;;;;; checkdoc-interactive checkdoc checkdoc-list-of-strings-p) 3778;;;;;; checkdoc-interactive checkdoc checkdoc-list-of-strings-p)
3779;;;;;; "checkdoc" "emacs-lisp/checkdoc.el" (20709 26818 907104 0)) 3779;;;;;; "checkdoc" "emacs-lisp/checkdoc.el" (20893 60586 188550 0))
3780;;; Generated autoloads from emacs-lisp/checkdoc.el 3780;;; Generated autoloads from emacs-lisp/checkdoc.el
3781(put 'checkdoc-force-docstrings-flag 'safe-local-variable 'booleanp) 3781(put 'checkdoc-force-docstrings-flag 'safe-local-variable 'booleanp)
3782(put 'checkdoc-force-history-flag 'safe-local-variable 'booleanp) 3782(put 'checkdoc-force-history-flag 'safe-local-variable 'booleanp)
@@ -4050,7 +4050,7 @@ and runs the normal hook `command-history-hook'.
4050;;;*** 4050;;;***
4051 4051
4052;;;### (autoloads (common-lisp-indent-function) "cl-indent" "emacs-lisp/cl-indent.el" 4052;;;### (autoloads (common-lisp-indent-function) "cl-indent" "emacs-lisp/cl-indent.el"
4053;;;;;; (20709 26818 907104 0)) 4053;;;;;; (20879 27694 495748 0))
4054;;; Generated autoloads from emacs-lisp/cl-indent.el 4054;;; Generated autoloads from emacs-lisp/cl-indent.el
4055 4055
4056(autoload 'common-lisp-indent-function "cl-indent" "\ 4056(autoload 'common-lisp-indent-function "cl-indent" "\
@@ -4221,7 +4221,7 @@ If FRAME cannot display COLOR, return nil.
4221;;;### (autoloads (comint-redirect-results-list-from-process comint-redirect-results-list 4221;;;### (autoloads (comint-redirect-results-list-from-process comint-redirect-results-list
4222;;;;;; comint-redirect-send-command-to-process comint-redirect-send-command 4222;;;;;; comint-redirect-send-command-to-process comint-redirect-send-command
4223;;;;;; comint-run make-comint make-comint-in-buffer) "comint" "comint.el" 4223;;;;;; comint-run make-comint make-comint-in-buffer) "comint" "comint.el"
4224;;;;;; (20864 60326 774861 0)) 4224;;;;;; (20896 36774 886399 0))
4225;;; Generated autoloads from comint.el 4225;;; Generated autoloads from comint.el
4226 4226
4227(defvar comint-output-filter-functions '(ansi-color-process-output comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt) "\ 4227(defvar comint-output-filter-functions '(ansi-color-process-output comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt) "\
@@ -4321,7 +4321,7 @@ REGEXP-GROUP is the regular expression group in REGEXP to use.
4321;;;*** 4321;;;***
4322 4322
4323;;;### (autoloads (compare-windows) "compare-w" "vc/compare-w.el" 4323;;;### (autoloads (compare-windows) "compare-w" "vc/compare-w.el"
4324;;;;;; (20721 17977 14204 0)) 4324;;;;;; (20871 33574 214287 0))
4325;;; Generated autoloads from vc/compare-w.el 4325;;; Generated autoloads from vc/compare-w.el
4326 4326
4327(autoload 'compare-windows "compare-w" "\ 4327(autoload 'compare-windows "compare-w" "\
@@ -4539,7 +4539,7 @@ This is the value of `next-error-function' in Compilation buffers.
4539;;;*** 4539;;;***
4540 4540
4541;;;### (autoloads (dynamic-completion-mode) "completion" "completion.el" 4541;;;### (autoloads (dynamic-completion-mode) "completion" "completion.el"
4542;;;;;; (20709 26818 907104 0)) 4542;;;;;; (20884 7264 412929 442000))
4543;;; Generated autoloads from completion.el 4543;;; Generated autoloads from completion.el
4544 4544
4545(defvar dynamic-completion-mode nil "\ 4545(defvar dynamic-completion-mode nil "\
@@ -4792,7 +4792,7 @@ If FIX is non-nil, run `copyright-fix-years' instead.
4792;;;*** 4792;;;***
4793 4793
4794;;;### (autoloads (cperl-perldoc-at-point cperl-perldoc cperl-mode) 4794;;;### (autoloads (cperl-perldoc-at-point cperl-perldoc cperl-mode)
4795;;;;;; "cperl-mode" "progmodes/cperl-mode.el" (20763 30266 231060 4795;;;;;; "cperl-mode" "progmodes/cperl-mode.el" (20901 54695 989166
4796;;;;;; 0)) 4796;;;;;; 0))
4797;;; Generated autoloads from progmodes/cperl-mode.el 4797;;; Generated autoloads from progmodes/cperl-mode.el
4798(put 'cperl-indent-level 'safe-local-variable 'integerp) 4798(put 'cperl-indent-level 'safe-local-variable 'integerp)
@@ -4992,7 +4992,7 @@ Run a `perldoc' on the word around point.
4992;;;*** 4992;;;***
4993 4993
4994;;;### (autoloads (cpp-parse-edit cpp-highlight-buffer) "cpp" "progmodes/cpp.el" 4994;;;### (autoloads (cpp-parse-edit cpp-highlight-buffer) "cpp" "progmodes/cpp.el"
4995;;;;;; (20762 9398 526093 0)) 4995;;;;;; (20874 65006 672942 217000))
4996;;; Generated autoloads from progmodes/cpp.el 4996;;; Generated autoloads from progmodes/cpp.el
4997 4997
4998(autoload 'cpp-highlight-buffer "cpp" "\ 4998(autoload 'cpp-highlight-buffer "cpp" "\
@@ -5145,7 +5145,7 @@ Enable CUA selection mode without the C-z/C-x/C-c/C-v bindings.
5145;;;;;; customize-mode customize customize-push-and-save customize-save-variable 5145;;;;;; customize-mode customize customize-push-and-save customize-save-variable
5146;;;;;; customize-set-variable customize-set-value custom-menu-sort-alphabetically 5146;;;;;; customize-set-variable customize-set-value custom-menu-sort-alphabetically
5147;;;;;; custom-buffer-sort-alphabetically custom-browse-sort-alphabetically) 5147;;;;;; custom-buffer-sort-alphabetically custom-browse-sort-alphabetically)
5148;;;;;; "cus-edit" "cus-edit.el" (20841 12463 538770 0)) 5148;;;;;; "cus-edit" "cus-edit.el" (20874 9766 437572 0))
5149;;; Generated autoloads from cus-edit.el 5149;;; Generated autoloads from cus-edit.el
5150 5150
5151(defvar custom-browse-sort-alphabetically nil "\ 5151(defvar custom-browse-sort-alphabetically nil "\
@@ -5634,8 +5634,8 @@ Create a new data-debug buffer with NAME.
5634 5634
5635;;;*** 5635;;;***
5636 5636
5637;;;### (autoloads (dbus-handle-event) "dbus" "net/dbus.el" (20709 5637;;;### (autoloads (dbus-handle-event) "dbus" "net/dbus.el" (20900
5638;;;;;; 26818 907104 0)) 5638;;;;;; 33838 319219 0))
5639;;; Generated autoloads from net/dbus.el 5639;;; Generated autoloads from net/dbus.el
5640 5640
5641(autoload 'dbus-handle-event "dbus" "\ 5641(autoload 'dbus-handle-event "dbus" "\
@@ -5905,7 +5905,7 @@ any selection.
5905;;;*** 5905;;;***
5906 5906
5907;;;### (autoloads (derived-mode-init-mode-variables define-derived-mode) 5907;;;### (autoloads (derived-mode-init-mode-variables define-derived-mode)
5908;;;;;; "derived" "emacs-lisp/derived.el" (20709 26818 907104 0)) 5908;;;;;; "derived" "emacs-lisp/derived.el" (20900 33838 319219 0))
5909;;; Generated autoloads from emacs-lisp/derived.el 5909;;; Generated autoloads from emacs-lisp/derived.el
5910 5910
5911(autoload 'define-derived-mode "derived" "\ 5911(autoload 'define-derived-mode "derived" "\
@@ -5972,7 +5972,7 @@ the first time the mode is used.
5972;;;*** 5972;;;***
5973 5973
5974;;;### (autoloads (describe-char describe-text-properties) "descr-text" 5974;;;### (autoloads (describe-char describe-text-properties) "descr-text"
5975;;;;;; "descr-text.el" (20764 51137 83502 0)) 5975;;;;;; "descr-text.el" (20875 30633 412173 0))
5976;;; Generated autoloads from descr-text.el 5976;;; Generated autoloads from descr-text.el
5977 5977
5978(autoload 'describe-text-properties "descr-text" "\ 5978(autoload 'describe-text-properties "descr-text" "\
@@ -6009,7 +6009,7 @@ relevant to POS.
6009;;;### (autoloads (desktop-revert desktop-save-in-desktop-dir desktop-change-dir 6009;;;### (autoloads (desktop-revert desktop-save-in-desktop-dir desktop-change-dir
6010;;;;;; desktop-load-default desktop-read desktop-remove desktop-save 6010;;;;;; desktop-load-default desktop-read desktop-remove desktop-save
6011;;;;;; desktop-clear desktop-locals-to-save desktop-save-mode) "desktop" 6011;;;;;; desktop-clear desktop-locals-to-save desktop-save-mode) "desktop"
6012;;;;;; "desktop.el" (20860 63270 684173 0)) 6012;;;;;; "desktop.el" (20866 42607 417304 513000))
6013;;; Generated autoloads from desktop.el 6013;;; Generated autoloads from desktop.el
6014 6014
6015(defvar desktop-save-mode nil "\ 6015(defvar desktop-save-mode nil "\
@@ -6232,7 +6232,7 @@ Deuglify broken Outlook (Express) articles and redisplay.
6232;;;*** 6232;;;***
6233 6233
6234;;;### (autoloads (diary-mode diary-mail-entries diary) "diary-lib" 6234;;;### (autoloads (diary-mode diary-mail-entries diary) "diary-lib"
6235;;;;;; "calendar/diary-lib.el" (20709 26818 907104 0)) 6235;;;;;; "calendar/diary-lib.el" (20879 27694 495748 0))
6236;;; Generated autoloads from calendar/diary-lib.el 6236;;; Generated autoloads from calendar/diary-lib.el
6237 6237
6238(autoload 'diary "diary-lib" "\ 6238(autoload 'diary "diary-lib" "\
@@ -6370,7 +6370,7 @@ Optional arguments are passed to `dig-invoke'.
6370 6370
6371;;;### (autoloads (dired-hide-details-mode dired-mode dired-noselect 6371;;;### (autoloads (dired-hide-details-mode dired-mode dired-noselect
6372;;;;;; dired-other-frame dired-other-window dired dired-listing-switches) 6372;;;;;; dired-other-frame dired-other-window dired dired-listing-switches)
6373;;;;;; "dired" "dired.el" (20784 36406 653593 0)) 6373;;;;;; "dired" "dired.el" (20900 33838 319219 0))
6374;;; Generated autoloads from dired.el 6374;;; Generated autoloads from dired.el
6375 6375
6376(defvar dired-listing-switches (purecopy "-al") "\ 6376(defvar dired-listing-switches (purecopy "-al") "\
@@ -6730,8 +6730,8 @@ Locate SOA record and increment the serial field.
6730;;;*** 6730;;;***
6731 6731
6732;;;### (autoloads (doc-view-bookmark-jump doc-view-minor-mode doc-view-mode-maybe 6732;;;### (autoloads (doc-view-bookmark-jump doc-view-minor-mode doc-view-mode-maybe
6733;;;;;; doc-view-mode doc-view-mode-p) "doc-view" "doc-view.el" (20845 6733;;;;;; doc-view-mode doc-view-mode-p) "doc-view" "doc-view.el" (20899
6734;;;;;; 9511 656701 0)) 6734;;;;;; 12965 791908 0))
6735;;; Generated autoloads from doc-view.el 6735;;; Generated autoloads from doc-view.el
6736 6736
6737(autoload 'doc-view-mode-p "doc-view" "\ 6737(autoload 'doc-view-mode-p "doc-view" "\
@@ -6805,8 +6805,8 @@ strings when pressed twice. See `double-map' for details.
6805 6805
6806;;;*** 6806;;;***
6807 6807
6808;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (20709 26818 6808;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (20900 33838
6809;;;;;; 907104 0)) 6809;;;;;; 319219 0))
6810;;; Generated autoloads from play/dunnet.el 6810;;; Generated autoloads from play/dunnet.el
6811 6811
6812(autoload 'dunnet "dunnet" "\ 6812(autoload 'dunnet "dunnet" "\
@@ -6818,7 +6818,7 @@ Switch to *dungeon* buffer and start game.
6818 6818
6819;;;### (autoloads (easy-mmode-defsyntax easy-mmode-defmap easy-mmode-define-keymap 6819;;;### (autoloads (easy-mmode-defsyntax easy-mmode-defmap easy-mmode-define-keymap
6820;;;;;; define-globalized-minor-mode define-minor-mode) "easy-mmode" 6820;;;;;; define-globalized-minor-mode define-minor-mode) "easy-mmode"
6821;;;;;; "emacs-lisp/easy-mmode.el" (20780 39352 990623 0)) 6821;;;;;; "emacs-lisp/easy-mmode.el" (20900 33838 319219 0))
6822;;; Generated autoloads from emacs-lisp/easy-mmode.el 6822;;; Generated autoloads from emacs-lisp/easy-mmode.el
6823 6823
6824(defalias 'easy-mmode-define-minor-mode 'define-minor-mode) 6824(defalias 'easy-mmode-define-minor-mode 'define-minor-mode)
@@ -7684,8 +7684,8 @@ Toggle edebugging of all forms.
7684;;;;;; ediff-merge-directories-with-ancestor ediff-merge-directories 7684;;;;;; ediff-merge-directories-with-ancestor ediff-merge-directories
7685;;;;;; ediff-directories3 ediff-directory-revisions ediff-directories 7685;;;;;; ediff-directories3 ediff-directory-revisions ediff-directories
7686;;;;;; ediff-buffers3 ediff-buffers ediff-backup ediff-current-file 7686;;;;;; ediff-buffers3 ediff-buffers ediff-backup ediff-current-file
7687;;;;;; ediff-files3 ediff-files) "ediff" "vc/ediff.el" (20709 26818 7687;;;;;; ediff-files3 ediff-files) "ediff" "vc/ediff.el" (20893 60586
7688;;;;;; 907104 0)) 7688;;;;;; 188550 0))
7689;;; Generated autoloads from vc/ediff.el 7689;;; Generated autoloads from vc/ediff.el
7690 7690
7691(autoload 'ediff-files "ediff" "\ 7691(autoload 'ediff-files "ediff" "\
@@ -7928,7 +7928,7 @@ With optional NODE, goes to that node.
7928;;;*** 7928;;;***
7929 7929
7930;;;### (autoloads (ediff-show-registry) "ediff-mult" "vc/ediff-mult.el" 7930;;;### (autoloads (ediff-show-registry) "ediff-mult" "vc/ediff-mult.el"
7931;;;;;; (20709 26818 907104 0)) 7931;;;;;; (20893 60586 188550 0))
7932;;; Generated autoloads from vc/ediff-mult.el 7932;;; Generated autoloads from vc/ediff-mult.el
7933 7933
7934(autoload 'ediff-show-registry "ediff-mult" "\ 7934(autoload 'ediff-show-registry "ediff-mult" "\
@@ -7941,7 +7941,7 @@ Display Ediff's registry.
7941;;;*** 7941;;;***
7942 7942
7943;;;### (autoloads (ediff-toggle-use-toolbar ediff-toggle-multiframe) 7943;;;### (autoloads (ediff-toggle-use-toolbar ediff-toggle-multiframe)
7944;;;;;; "ediff-util" "vc/ediff-util.el" (20777 63161 848428 0)) 7944;;;;;; "ediff-util" "vc/ediff-util.el" (20893 60586 188550 0))
7945;;; Generated autoloads from vc/ediff-util.el 7945;;; Generated autoloads from vc/ediff-util.el
7946 7946
7947(autoload 'ediff-toggle-multiframe "ediff-util" "\ 7947(autoload 'ediff-toggle-multiframe "ediff-util" "\
@@ -8079,7 +8079,7 @@ Optional argument GROUP is the sub-group of slots to display.
8079 8079
8080;;;### (autoloads (eieio-describe-generic eieio-describe-constructor 8080;;;### (autoloads (eieio-describe-generic eieio-describe-constructor
8081;;;;;; eieio-describe-class eieio-browse) "eieio-opt" "emacs-lisp/eieio-opt.el" 8081;;;;;; eieio-describe-class eieio-browse) "eieio-opt" "emacs-lisp/eieio-opt.el"
8082;;;;;; (20771 24374 643644 0)) 8082;;;;;; (20892 39729 858825 0))
8083;;; Generated autoloads from emacs-lisp/eieio-opt.el 8083;;; Generated autoloads from emacs-lisp/eieio-opt.el
8084 8084
8085(autoload 'eieio-browse "eieio-opt" "\ 8085(autoload 'eieio-browse "eieio-opt" "\
@@ -8474,8 +8474,8 @@ Commands:
8474;;;;;; epa-sign-region epa-verify-cleartext-in-region epa-verify-region 8474;;;;;; epa-sign-region epa-verify-cleartext-in-region epa-verify-region
8475;;;;;; epa-decrypt-armor-in-region epa-decrypt-region epa-encrypt-file 8475;;;;;; epa-decrypt-armor-in-region epa-decrypt-region epa-encrypt-file
8476;;;;;; epa-sign-file epa-verify-file epa-decrypt-file epa-select-keys 8476;;;;;; epa-sign-file epa-verify-file epa-decrypt-file epa-select-keys
8477;;;;;; epa-list-secret-keys epa-list-keys) "epa" "epa.el" (20762 8477;;;;;; epa-list-secret-keys epa-list-keys) "epa" "epa.el" (20879
8478;;;;;; 9398 526093 0)) 8478;;;;;; 27694 495748 0))
8479;;; Generated autoloads from epa.el 8479;;; Generated autoloads from epa.el
8480 8480
8481(autoload 'epa-list-keys "epa" "\ 8481(autoload 'epa-list-keys "epa" "\
@@ -8499,9 +8499,9 @@ If SECRET is non-nil, list secret keys instead of public keys.
8499\(fn CONTEXT PROMPT &optional NAMES SECRET)" nil nil) 8499\(fn CONTEXT PROMPT &optional NAMES SECRET)" nil nil)
8500 8500
8501(autoload 'epa-decrypt-file "epa" "\ 8501(autoload 'epa-decrypt-file "epa" "\
8502Decrypt FILE. 8502Decrypt DECRYPT-FILE into PLAIN-FILE.
8503 8503
8504\(fn FILE)" t nil) 8504\(fn DECRYPT-FILE PLAIN-FILE)" t nil)
8505 8505
8506(autoload 'epa-verify-file "epa" "\ 8506(autoload 'epa-verify-file "epa" "\
8507Verify FILE. 8507Verify FILE.
@@ -8805,7 +8805,7 @@ Look at CONFIG and try to expand GROUP.
8805;;;*** 8805;;;***
8806 8806
8807;;;### (autoloads (erc-handle-irc-url erc-tls erc erc-select-read-args) 8807;;;### (autoloads (erc-handle-irc-url erc-tls erc erc-select-read-args)
8808;;;;;; "erc" "erc/erc.el" (20709 26818 907104 0)) 8808;;;;;; "erc" "erc/erc.el" (20891 18859 893295 0))
8809;;; Generated autoloads from erc/erc.el 8809;;; Generated autoloads from erc/erc.el
8810 8810
8811(autoload 'erc-select-read-args "erc" "\ 8811(autoload 'erc-select-read-args "erc" "\
@@ -8912,7 +8912,7 @@ that subcommand.
8912;;;*** 8912;;;***
8913 8913
8914;;;### (autoloads nil "erc-desktop-notifications" "erc/erc-desktop-notifications.el" 8914;;;### (autoloads nil "erc-desktop-notifications" "erc/erc-desktop-notifications.el"
8915;;;;;; (20709 26818 907104 0)) 8915;;;;;; (20874 65006 176325 548000))
8916;;; Generated autoloads from erc/erc-desktop-notifications.el 8916;;; Generated autoloads from erc/erc-desktop-notifications.el
8917(autoload 'erc-notifications-mode "erc-desktop-notifications" "" t) 8917(autoload 'erc-notifications-mode "erc-desktop-notifications" "" t)
8918 8918
@@ -9037,15 +9037,15 @@ system.
9037 9037
9038;;;*** 9038;;;***
9039 9039
9040;;;### (autoloads nil "erc-list" "erc/erc-list.el" (20709 26818 907104 9040;;;### (autoloads nil "erc-list" "erc/erc-list.el" (20884 7264 412929
9041;;;;;; 0)) 9041;;;;;; 442000))
9042;;; Generated autoloads from erc/erc-list.el 9042;;; Generated autoloads from erc/erc-list.el
9043 (autoload 'erc-list-mode "erc-list") 9043 (autoload 'erc-list-mode "erc-list")
9044 9044
9045;;;*** 9045;;;***
9046 9046
9047;;;### (autoloads (erc-save-buffer-in-logs erc-logging-enabled) "erc-log" 9047;;;### (autoloads (erc-save-buffer-in-logs erc-logging-enabled) "erc-log"
9048;;;;;; "erc/erc-log.el" (20709 26818 907104 0)) 9048;;;;;; "erc/erc-log.el" (20891 18859 893295 0))
9049;;; Generated autoloads from erc/erc-log.el 9049;;; Generated autoloads from erc/erc-log.el
9050 (autoload 'erc-log-mode "erc-log" nil t) 9050 (autoload 'erc-log-mode "erc-log" nil t)
9051 9051
@@ -9123,8 +9123,8 @@ Delete dangerous-host interactively to `erc-dangerous-hosts'.
9123 9123
9124;;;*** 9124;;;***
9125 9125
9126;;;### (autoloads nil "erc-menu" "erc/erc-menu.el" (20709 26818 907104 9126;;;### (autoloads nil "erc-menu" "erc/erc-menu.el" (20884 7264 412929
9127;;;;;; 0)) 9127;;;;;; 442000))
9128;;; Generated autoloads from erc/erc-menu.el 9128;;; Generated autoloads from erc/erc-menu.el
9129 (autoload 'erc-menu-mode "erc-menu" nil t) 9129 (autoload 'erc-menu-mode "erc-menu" nil t)
9130 9130
@@ -9161,7 +9161,7 @@ Interactively select a server to connect to using `erc-server-alist'.
9161;;;*** 9161;;;***
9162 9162
9163;;;### (autoloads (pcomplete/erc-mode/NOTIFY erc-cmd-NOTIFY) "erc-notify" 9163;;;### (autoloads (pcomplete/erc-mode/NOTIFY erc-cmd-NOTIFY) "erc-notify"
9164;;;;;; "erc/erc-notify.el" (20709 26818 907104 0)) 9164;;;;;; "erc/erc-notify.el" (20891 18859 893295 0))
9165;;; Generated autoloads from erc/erc-notify.el 9165;;; Generated autoloads from erc/erc-notify.el
9166 (autoload 'erc-notify-mode "erc-notify" nil t) 9166 (autoload 'erc-notify-mode "erc-notify" nil t)
9167 9167
@@ -9200,8 +9200,8 @@ with args, toggle notify status of people.
9200 9200
9201;;;*** 9201;;;***
9202 9202
9203;;;### (autoloads nil "erc-ring" "erc/erc-ring.el" (20709 26818 907104 9203;;;### (autoloads nil "erc-ring" "erc/erc-ring.el" (20884 7264 412929
9204;;;;;; 0)) 9204;;;;;; 442000))
9205;;; Generated autoloads from erc/erc-ring.el 9205;;; Generated autoloads from erc/erc-ring.el
9206 (autoload 'erc-ring-mode "erc-ring" nil t) 9206 (autoload 'erc-ring-mode "erc-ring" nil t)
9207 9207
@@ -9398,8 +9398,8 @@ Kill all test buffers that are still live.
9398 9398
9399;;;*** 9399;;;***
9400 9400
9401;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (20709 9401;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (20893
9402;;;;;; 26818 907104 0)) 9402;;;;;; 60586 188550 0))
9403;;; Generated autoloads from eshell/esh-mode.el 9403;;; Generated autoloads from eshell/esh-mode.el
9404 9404
9405(autoload 'eshell-mode "esh-mode" "\ 9405(autoload 'eshell-mode "esh-mode" "\
@@ -9412,7 +9412,7 @@ Emacs shell interactive mode.
9412;;;*** 9412;;;***
9413 9413
9414;;;### (autoloads (eshell-command-result eshell-command eshell) "eshell" 9414;;;### (autoloads (eshell-command-result eshell-command eshell) "eshell"
9415;;;;;; "eshell/eshell.el" (20709 26818 907104 0)) 9415;;;;;; "eshell/eshell.el" (20893 60586 188550 0))
9416;;; Generated autoloads from eshell/eshell.el 9416;;; Generated autoloads from eshell/eshell.el
9417 9417
9418(autoload 'eshell "eshell" "\ 9418(autoload 'eshell "eshell" "\
@@ -10030,7 +10030,7 @@ Display a button for the JPEG DATA.
10030;;;*** 10030;;;***
10031 10031
10032;;;### (autoloads (eudc-try-bbdb-insert eudc-insert-record-at-point-into-bbdb) 10032;;;### (autoloads (eudc-try-bbdb-insert eudc-insert-record-at-point-into-bbdb)
10033;;;;;; "eudc-export" "net/eudc-export.el" (20791 9657 561026 0)) 10033;;;;;; "eudc-export" "net/eudc-export.el" (20871 33574 214287 0))
10034;;; Generated autoloads from net/eudc-export.el 10034;;; Generated autoloads from net/eudc-export.el
10035 10035
10036(autoload 'eudc-insert-record-at-point-into-bbdb "eudc-export" "\ 10036(autoload 'eudc-insert-record-at-point-into-bbdb "eudc-export" "\
@@ -10179,8 +10179,8 @@ This is used only in conjunction with `expand-add-abbrevs'.
10179 10179
10180;;;*** 10180;;;***
10181 10181
10182;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (20709 26818 10182;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (20886 939
10183;;;;;; 907104 0)) 10183;;;;;; 575794 0))
10184;;; Generated autoloads from progmodes/f90.el 10184;;; Generated autoloads from progmodes/f90.el
10185 10185
10186(autoload 'f90-mode "f90" "\ 10186(autoload 'f90-mode "f90" "\
@@ -10232,11 +10232,11 @@ Variables controlling indentation style and extra features:
10232 Automatic insertion of & at beginning of continuation lines (default t). 10232 Automatic insertion of & at beginning of continuation lines (default t).
10233`f90-smart-end' 10233`f90-smart-end'
10234 From an END statement, check and fill the end using matching block start. 10234 From an END statement, check and fill the end using matching block start.
10235 Allowed values are 'blink, 'no-blink, and nil, which determine 10235 Allowed values are `blink', `no-blink', and nil, which determine
10236 whether to blink the matching beginning (default 'blink). 10236 whether to blink the matching beginning (default `blink').
10237`f90-auto-keyword-case' 10237`f90-auto-keyword-case'
10238 Automatic change of case of keywords (default nil). 10238 Automatic change of case of keywords (default nil).
10239 The possibilities are 'downcase-word, 'upcase-word, 'capitalize-word. 10239 The possibilities are `downcase-word', `upcase-word', `capitalize-word'.
10240`f90-leave-line-no' 10240`f90-leave-line-no'
10241 Do not left-justify line numbers (default nil). 10241 Do not left-justify line numbers (default nil).
10242 10242
@@ -10414,8 +10414,8 @@ Besides the choice of face, it is the same as `buffer-face-mode'.
10414 10414
10415;;;### (autoloads (feedmail-queue-reminder feedmail-run-the-queue 10415;;;### (autoloads (feedmail-queue-reminder feedmail-run-the-queue
10416;;;;;; feedmail-run-the-queue-global-prompt feedmail-run-the-queue-no-prompts 10416;;;;;; feedmail-run-the-queue-global-prompt feedmail-run-the-queue-no-prompts
10417;;;;;; feedmail-send-it) "feedmail" "mail/feedmail.el" (20759 33211 10417;;;;;; feedmail-send-it) "feedmail" "mail/feedmail.el" (20891 18859
10418;;;;;; 414988 0)) 10418;;;;;; 893295 0))
10419;;; Generated autoloads from mail/feedmail.el 10419;;; Generated autoloads from mail/feedmail.el
10420 10420
10421(autoload 'feedmail-send-it "feedmail" "\ 10421(autoload 'feedmail-send-it "feedmail" "\
@@ -10736,7 +10736,7 @@ use in place of \"-ls\" as the final argument.
10736 10736
10737;;;### (autoloads (ff-mouse-find-other-file-other-window ff-mouse-find-other-file 10737;;;### (autoloads (ff-mouse-find-other-file-other-window ff-mouse-find-other-file
10738;;;;;; ff-find-other-file ff-get-other-file ff-special-constructs) 10738;;;;;; ff-find-other-file ff-get-other-file ff-special-constructs)
10739;;;;;; "find-file" "find-file.el" (20709 26818 907104 0)) 10739;;;;;; "find-file" "find-file.el" (20872 54440 171355 0))
10740;;; Generated autoloads from find-file.el 10740;;; Generated autoloads from find-file.el
10741 10741
10742(defvar ff-special-constructs `((,(purecopy "^#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]") lambda nil (buffer-substring (match-beginning 2) (match-end 2)))) "\ 10742(defvar ff-special-constructs `((,(purecopy "^#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]") lambda nil (buffer-substring (match-beginning 2) (match-end 2)))) "\
@@ -11073,8 +11073,8 @@ to get the effect of a C-q.
11073;;;*** 11073;;;***
11074 11074
11075;;;### (autoloads (flymake-find-file-hook flymake-mode-off flymake-mode-on 11075;;;### (autoloads (flymake-find-file-hook flymake-mode-off flymake-mode-on
11076;;;;;; flymake-mode) "flymake" "progmodes/flymake.el" (20717 20920 11076;;;;;; flymake-mode) "flymake" "progmodes/flymake.el" (20896 36774
11077;;;;;; 410005 0)) 11077;;;;;; 886399 0))
11078;;; Generated autoloads from progmodes/flymake.el 11078;;; Generated autoloads from progmodes/flymake.el
11079 11079
11080(autoload 'flymake-mode "flymake" "\ 11080(autoload 'flymake-mode "flymake" "\
@@ -11429,7 +11429,7 @@ and choose the directory as the fortune-file.
11429;;;*** 11429;;;***
11430 11430
11431;;;### (autoloads (gdb gdb-enable-debug) "gdb-mi" "progmodes/gdb-mi.el" 11431;;;### (autoloads (gdb gdb-enable-debug) "gdb-mi" "progmodes/gdb-mi.el"
11432;;;;;; (20851 48294 960738 0)) 11432;;;;;; (20903 57728 956434 133000))
11433;;; Generated autoloads from progmodes/gdb-mi.el 11433;;; Generated autoloads from progmodes/gdb-mi.el
11434 11434
11435(defvar gdb-enable-debug nil "\ 11435(defvar gdb-enable-debug nil "\
@@ -11658,8 +11658,8 @@ DEFAULT-MAP specifies the default key map for ICON-LIST.
11658;;;*** 11658;;;***
11659 11659
11660;;;### (autoloads (gnus gnus-other-frame gnus-slave gnus-no-server 11660;;;### (autoloads (gnus gnus-other-frame gnus-slave gnus-no-server
11661;;;;;; gnus-slave-no-server) "gnus" "gnus/gnus.el" (20860 63270 11661;;;;;; gnus-slave-no-server) "gnus" "gnus/gnus.el" (20901 54695
11662;;;;;; 684173 0)) 11662;;;;;; 989166 0))
11663;;; Generated autoloads from gnus/gnus.el 11663;;; Generated autoloads from gnus/gnus.el
11664(when (fboundp 'custom-autoload) 11664(when (fboundp 'custom-autoload)
11665 (custom-autoload 'gnus-select-method "gnus")) 11665 (custom-autoload 'gnus-select-method "gnus"))
@@ -11804,7 +11804,7 @@ If CLEAN, obsolete (ignore).
11804;;;*** 11804;;;***
11805 11805
11806;;;### (autoloads (gnus-article-prepare-display) "gnus-art" "gnus/gnus-art.el" 11806;;;### (autoloads (gnus-article-prepare-display) "gnus-art" "gnus/gnus-art.el"
11807;;;;;; (20763 30266 231060 0)) 11807;;;;;; (20874 65006 176325 548000))
11808;;; Generated autoloads from gnus/gnus-art.el 11808;;; Generated autoloads from gnus/gnus-art.el
11809 11809
11810(autoload 'gnus-article-prepare-display "gnus-art" "\ 11810(autoload 'gnus-article-prepare-display "gnus-art" "\
@@ -12005,8 +12005,8 @@ FILE should be a PNG file that's 48x48 and smaller than or equal to
12005;;;*** 12005;;;***
12006 12006
12007;;;### (autoloads (gnus-treat-mail-gravatar gnus-treat-from-gravatar) 12007;;;### (autoloads (gnus-treat-mail-gravatar gnus-treat-from-gravatar)
12008;;;;;; "gnus-gravatar" "gnus/gnus-gravatar.el" (20709 26818 907104 12008;;;;;; "gnus-gravatar" "gnus/gnus-gravatar.el" (20874 65006 176325
12009;;;;;; 0)) 12009;;;;;; 548000))
12010;;; Generated autoloads from gnus/gnus-gravatar.el 12010;;; Generated autoloads from gnus/gnus-gravatar.el
12011 12011
12012(autoload 'gnus-treat-from-gravatar "gnus-gravatar" "\ 12012(autoload 'gnus-treat-from-gravatar "gnus-gravatar" "\
@@ -12024,7 +12024,7 @@ If gravatars are already displayed, remove them.
12024;;;*** 12024;;;***
12025 12025
12026;;;### (autoloads (gnus-fetch-group-other-frame gnus-fetch-group) 12026;;;### (autoloads (gnus-fetch-group-other-frame gnus-fetch-group)
12027;;;;;; "gnus-group" "gnus/gnus-group.el" (20763 30266 231060 0)) 12027;;;;;; "gnus-group" "gnus/gnus-group.el" (20901 54695 989166 0))
12028;;; Generated autoloads from gnus/gnus-group.el 12028;;; Generated autoloads from gnus/gnus-group.el
12029 12029
12030(autoload 'gnus-fetch-group "gnus-group" "\ 12030(autoload 'gnus-fetch-group "gnus-group" "\
@@ -12042,7 +12042,7 @@ Pop up a frame and enter GROUP.
12042;;;*** 12042;;;***
12043 12043
12044;;;### (autoloads (gnus-html-prefetch-images gnus-article-html) "gnus-html" 12044;;;### (autoloads (gnus-html-prefetch-images gnus-article-html) "gnus-html"
12045;;;;;; "gnus/gnus-html.el" (20709 26818 907104 0)) 12045;;;;;; "gnus/gnus-html.el" (20874 65006 672942 217000))
12046;;; Generated autoloads from gnus/gnus-html.el 12046;;; Generated autoloads from gnus/gnus-html.el
12047 12047
12048(autoload 'gnus-article-html "gnus-html" "\ 12048(autoload 'gnus-article-html "gnus-html" "\
@@ -12226,7 +12226,7 @@ Like `message-reply'.
12226;;;*** 12226;;;***
12227 12227
12228;;;### (autoloads (gnus-notifications) "gnus-notifications" "gnus/gnus-notifications.el" 12228;;;### (autoloads (gnus-notifications) "gnus-notifications" "gnus/gnus-notifications.el"
12229;;;;;; (20709 26818 907104 0)) 12229;;;;;; (20886 939 575794 0))
12230;;; Generated autoloads from gnus/gnus-notifications.el 12230;;; Generated autoloads from gnus/gnus-notifications.el
12231 12231
12232(autoload 'gnus-notifications "gnus-notifications" "\ 12232(autoload 'gnus-notifications "gnus-notifications" "\
@@ -12244,7 +12244,7 @@ This is typically a function to add in
12244 12244
12245;;;### (autoloads (gnus-treat-newsgroups-picon gnus-treat-mail-picon 12245;;;### (autoloads (gnus-treat-newsgroups-picon gnus-treat-mail-picon
12246;;;;;; gnus-treat-from-picon) "gnus-picon" "gnus/gnus-picon.el" 12246;;;;;; gnus-treat-from-picon) "gnus-picon" "gnus/gnus-picon.el"
12247;;;;;; (20709 26818 907104 0)) 12247;;;;;; (20874 65006 672942 217000))
12248;;; Generated autoloads from gnus/gnus-picon.el 12248;;; Generated autoloads from gnus/gnus-picon.el
12249 12249
12250(autoload 'gnus-treat-from-picon "gnus-picon" "\ 12250(autoload 'gnus-treat-from-picon "gnus-picon" "\
@@ -12385,7 +12385,7 @@ See the documentation for these variables and functions for details.
12385;;;*** 12385;;;***
12386 12386
12387;;;### (autoloads (gnus-update-format) "gnus-spec" "gnus/gnus-spec.el" 12387;;;### (autoloads (gnus-update-format) "gnus-spec" "gnus/gnus-spec.el"
12388;;;;;; (20791 9657 561026 0)) 12388;;;;;; (20893 60586 188550 0))
12389;;; Generated autoloads from gnus/gnus-spec.el 12389;;; Generated autoloads from gnus/gnus-spec.el
12390 12390
12391(autoload 'gnus-update-format "gnus-spec" "\ 12391(autoload 'gnus-update-format "gnus-spec" "\
@@ -12407,7 +12407,7 @@ Declare back end NAME with ABILITIES as a Gnus back end.
12407;;;*** 12407;;;***
12408 12408
12409;;;### (autoloads (gnus-summary-bookmark-jump) "gnus-sum" "gnus/gnus-sum.el" 12409;;;### (autoloads (gnus-summary-bookmark-jump) "gnus-sum" "gnus/gnus-sum.el"
12410;;;;;; (20856 32301 830403 0)) 12410;;;;;; (20901 54695 989166 0))
12411;;; Generated autoloads from gnus/gnus-sum.el 12411;;; Generated autoloads from gnus/gnus-sum.el
12412 12412
12413(autoload 'gnus-summary-bookmark-jump "gnus-sum" "\ 12413(autoload 'gnus-summary-bookmark-jump "gnus-sum" "\
@@ -12533,7 +12533,7 @@ Like `goto-address-mode', but only for comments and strings.
12533;;;*** 12533;;;***
12534 12534
12535;;;### (autoloads (gravatar-retrieve-synchronously gravatar-retrieve) 12535;;;### (autoloads (gravatar-retrieve-synchronously gravatar-retrieve)
12536;;;;;; "gravatar" "gnus/gravatar.el" (20709 26818 907104 0)) 12536;;;;;; "gravatar" "gnus/gravatar.el" (20901 54695 989166 0))
12537;;; Generated autoloads from gnus/gravatar.el 12537;;; Generated autoloads from gnus/gravatar.el
12538 12538
12539(autoload 'gravatar-retrieve "gravatar" "\ 12539(autoload 'gravatar-retrieve "gravatar" "\
@@ -12551,8 +12551,8 @@ Retrieve MAIL-ADDRESS gravatar and returns it.
12551 12551
12552;;;### (autoloads (zrgrep rgrep lgrep grep-find grep grep-mode grep-compute-defaults 12552;;;### (autoloads (zrgrep rgrep lgrep grep-find grep grep-mode grep-compute-defaults
12553;;;;;; grep-process-setup grep-setup-hook grep-find-command grep-command 12553;;;;;; grep-process-setup grep-setup-hook grep-find-command grep-command
12554;;;;;; grep-window-height) "grep" "progmodes/grep.el" (20762 9398 12554;;;;;; grep-window-height) "grep" "progmodes/grep.el" (20896 36774
12555;;;;;; 526093 0)) 12555;;;;;; 886399 0))
12556;;; Generated autoloads from progmodes/grep.el 12556;;; Generated autoloads from progmodes/grep.el
12557 12557
12558(defvar grep-window-height nil "\ 12558(defvar grep-window-height nil "\
@@ -12730,8 +12730,8 @@ the form \"WINDOW-ID PIXMAP-ID\". Value is non-nil if successful.
12730;;;*** 12730;;;***
12731 12731
12732;;;### (autoloads (gud-tooltip-mode gdb-script-mode jdb pdb perldb 12732;;;### (autoloads (gud-tooltip-mode gdb-script-mode jdb pdb perldb
12733;;;;;; xdb dbx sdb gud-gdb) "gud" "progmodes/gud.el" (20851 48294 12733;;;;;; xdb dbx sdb gud-gdb) "gud" "progmodes/gud.el" (20895 15912
12734;;;;;; 960738 0)) 12734;;;;;; 444844 0))
12735;;; Generated autoloads from progmodes/gud.el 12735;;; Generated autoloads from progmodes/gud.el
12736 12736
12737(autoload 'gud-gdb "gud" "\ 12737(autoload 'gud-gdb "gud" "\
@@ -14402,7 +14402,7 @@ See also the variable `idlwave-shell-prompt-pattern'.
14402;;;*** 14402;;;***
14403 14403
14404;;;### (autoloads (idlwave-mode) "idlwave" "progmodes/idlwave.el" 14404;;;### (autoloads (idlwave-mode) "idlwave" "progmodes/idlwave.el"
14405;;;;;; (20799 169 640767 0)) 14405;;;;;; (20901 54695 989166 0))
14406;;; Generated autoloads from progmodes/idlwave.el 14406;;; Generated autoloads from progmodes/idlwave.el
14407 14407
14408(autoload 'idlwave-mode "idlwave" "\ 14408(autoload 'idlwave-mode "idlwave" "\
@@ -14536,8 +14536,8 @@ The main features of this mode are
14536;;;;;; ido-find-alternate-file ido-find-file-other-window ido-find-file 14536;;;;;; ido-find-alternate-file ido-find-file-other-window ido-find-file
14537;;;;;; ido-find-file-in-dir ido-switch-buffer-other-frame ido-insert-buffer 14537;;;;;; ido-find-file-in-dir ido-switch-buffer-other-frame ido-insert-buffer
14538;;;;;; ido-kill-buffer ido-display-buffer ido-switch-buffer-other-window 14538;;;;;; ido-kill-buffer ido-display-buffer ido-switch-buffer-other-window
14539;;;;;; ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (20831 14539;;;;;; ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (20886
14540;;;;;; 63016 738579 0)) 14540;;;;;; 939 575794 0))
14541;;; Generated autoloads from ido.el 14541;;; Generated autoloads from ido.el
14542 14542
14543(defvar ido-mode nil "\ 14543(defvar ido-mode nil "\
@@ -14796,7 +14796,7 @@ DEF, if non-nil, is the default value.
14796 14796
14797;;;*** 14797;;;***
14798 14798
14799;;;### (autoloads (ielm) "ielm" "ielm.el" (20709 26818 907104 0)) 14799;;;### (autoloads (ielm) "ielm" "ielm.el" (20903 10024 645978 0))
14800;;; Generated autoloads from ielm.el 14800;;; Generated autoloads from ielm.el
14801 14801
14802(autoload 'ielm "ielm" "\ 14802(autoload 'ielm "ielm" "\
@@ -14829,7 +14829,7 @@ the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
14829;;;;;; create-image image-type-auto-detected-p image-type-available-p 14829;;;;;; create-image image-type-auto-detected-p image-type-available-p
14830;;;;;; image-type image-type-from-file-name image-type-from-file-header 14830;;;;;; image-type image-type-from-file-name image-type-from-file-header
14831;;;;;; image-type-from-buffer image-type-from-data) "image" "image.el" 14831;;;;;; image-type-from-buffer image-type-from-data) "image" "image.el"
14832;;;;;; (20772 45239 494620 0)) 14832;;;;;; (20903 10024 645978 0))
14833;;; Generated autoloads from image.el 14833;;; Generated autoloads from image.el
14834 14834
14835(autoload 'image-type-from-data "image" "\ 14835(autoload 'image-type-from-data "image" "\
@@ -15230,8 +15230,8 @@ An image file is one whose name has an extension in
15230;;;*** 15230;;;***
15231 15231
15232;;;### (autoloads (image-bookmark-jump image-mode-as-text image-minor-mode 15232;;;### (autoloads (image-bookmark-jump image-mode-as-text image-minor-mode
15233;;;;;; image-mode) "image-mode" "image-mode.el" (20774 51931 214714 15233;;;;;; image-mode) "image-mode" "image-mode.el" (20899 12965 791908
15234;;;;;; 829000)) 15234;;;;;; 0))
15235;;; Generated autoloads from image-mode.el 15235;;; Generated autoloads from image-mode.el
15236 15236
15237(autoload 'image-mode "image-mode" "\ 15237(autoload 'image-mode "image-mode" "\
@@ -15470,7 +15470,7 @@ of `inferior-lisp-program'). Runs the hooks from
15470;;;;;; Info-goto-emacs-key-command-node Info-goto-emacs-command-node 15470;;;;;; Info-goto-emacs-key-command-node Info-goto-emacs-command-node
15471;;;;;; Info-mode info-finder info-apropos Info-index Info-directory 15471;;;;;; Info-mode info-finder info-apropos Info-index Info-directory
15472;;;;;; Info-on-current-buffer info-standalone info-emacs-bug info-emacs-manual 15472;;;;;; Info-on-current-buffer info-standalone info-emacs-bug info-emacs-manual
15473;;;;;; info info-other-window) "info" "info.el" (20841 12463 538770 15473;;;;;; info info-other-window) "info" "info.el" (20900 33838 319219
15474;;;;;; 0)) 15474;;;;;; 0))
15475;;; Generated autoloads from info.el 15475;;; Generated autoloads from info.el
15476 15476
@@ -16379,7 +16379,7 @@ by `jka-compr-installed'.
16379 16379
16380;;;*** 16380;;;***
16381 16381
16382;;;### (autoloads (js-mode) "js" "progmodes/js.el" (20793 51383 764318 16382;;;### (autoloads (js-mode) "js" "progmodes/js.el" (20895 15912 444844
16383;;;;;; 0)) 16383;;;;;; 0))
16384;;; Generated autoloads from progmodes/js.el 16384;;; Generated autoloads from progmodes/js.el
16385 16385
@@ -16770,7 +16770,7 @@ use either \\[customize] or the function `latin1-display'.")
16770;;;*** 16770;;;***
16771 16771
16772;;;### (autoloads (ld-script-mode) "ld-script" "progmodes/ld-script.el" 16772;;;### (autoloads (ld-script-mode) "ld-script" "progmodes/ld-script.el"
16773;;;;;; (20709 26818 907104 0)) 16773;;;;;; (20874 62962 290468 0))
16774;;; Generated autoloads from progmodes/ld-script.el 16774;;; Generated autoloads from progmodes/ld-script.el
16775 16775
16776(autoload 'ld-script-mode "ld-script" "\ 16776(autoload 'ld-script-mode "ld-script" "\
@@ -16960,8 +16960,8 @@ Major mode for browsing CVS log output.
16960;;;*** 16960;;;***
16961 16961
16962;;;### (autoloads (print-region lpr-region print-buffer lpr-buffer 16962;;;### (autoloads (print-region lpr-region print-buffer lpr-buffer
16963;;;;;; lpr-command lpr-switches printer-name) "lpr" "lpr.el" (20709 16963;;;;;; lpr-command lpr-switches printer-name) "lpr" "lpr.el" (20878
16964;;;;;; 26818 907104 0)) 16964;;;;;; 6823 881439 0))
16965;;; Generated autoloads from lpr.el 16965;;; Generated autoloads from lpr.el
16966 16966
16967(defvar lpr-windows-system (memq system-type '(ms-dos windows-nt)) "\ 16967(defvar lpr-windows-system (memq system-type '(ms-dos windows-nt)) "\
@@ -17057,7 +17057,7 @@ for further customization of the printer command.
17057;;;*** 17057;;;***
17058 17058
17059;;;### (autoloads (ls-lisp-support-shell-wildcards) "ls-lisp" "ls-lisp.el" 17059;;;### (autoloads (ls-lisp-support-shell-wildcards) "ls-lisp" "ls-lisp.el"
17060;;;;;; (20860 63270 684173 0)) 17060;;;;;; (20870 12718 549931 0))
17061;;; Generated autoloads from ls-lisp.el 17061;;; Generated autoloads from ls-lisp.el
17062 17062
17063(defvar ls-lisp-support-shell-wildcards t "\ 17063(defvar ls-lisp-support-shell-wildcards t "\
@@ -17083,8 +17083,8 @@ This function is suitable for execution in an init file.
17083 17083
17084;;;*** 17084;;;***
17085 17085
17086;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (20709 17086;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (20874
17087;;;;;; 26818 907104 0)) 17087;;;;;; 62962 290468 0))
17088;;; Generated autoloads from progmodes/m4-mode.el 17088;;; Generated autoloads from progmodes/m4-mode.el
17089 17089
17090(autoload 'm4-mode "m4-mode" "\ 17090(autoload 'm4-mode "m4-mode" "\
@@ -17249,7 +17249,7 @@ This function normally would be called when the message is sent.
17249;;;### (autoloads (mail-fetch-field mail-unquote-printable-region 17249;;;### (autoloads (mail-fetch-field mail-unquote-printable-region
17250;;;;;; mail-unquote-printable mail-quote-printable-region mail-quote-printable 17250;;;;;; mail-unquote-printable mail-quote-printable-region mail-quote-printable
17251;;;;;; mail-file-babyl-p mail-dont-reply-to-names mail-use-rfc822) 17251;;;;;; mail-file-babyl-p mail-dont-reply-to-names mail-use-rfc822)
17252;;;;;; "mail-utils" "mail/mail-utils.el" (20709 26818 907104 0)) 17252;;;;;; "mail-utils" "mail/mail-utils.el" (20891 18859 893295 0))
17253;;; Generated autoloads from mail/mail-utils.el 17253;;; Generated autoloads from mail/mail-utils.el
17254 17254
17255(defvar mail-use-rfc822 nil "\ 17255(defvar mail-use-rfc822 nil "\
@@ -17444,8 +17444,8 @@ The mail client is taken to be the handler of mailto URLs.
17444 17444
17445;;;### (autoloads (makefile-imake-mode makefile-bsdmake-mode makefile-makepp-mode 17445;;;### (autoloads (makefile-imake-mode makefile-bsdmake-mode makefile-makepp-mode
17446;;;;;; makefile-gmake-mode makefile-automake-mode makefile-mode) 17446;;;;;; makefile-gmake-mode makefile-automake-mode makefile-mode)
17447;;;;;; "make-mode" "progmodes/make-mode.el" (20748 62911 684442 17447;;;;;; "make-mode" "progmodes/make-mode.el" (20874 65006 672942
17448;;;;;; 0)) 17448;;;;;; 217000))
17449;;; Generated autoloads from progmodes/make-mode.el 17449;;; Generated autoloads from progmodes/make-mode.el
17450 17450
17451(autoload 'makefile-mode "make-mode" "\ 17451(autoload 'makefile-mode "make-mode" "\
@@ -17575,7 +17575,7 @@ Previous contents of that buffer are killed first.
17575;;;*** 17575;;;***
17576 17576
17577;;;### (autoloads (Man-bookmark-jump man-follow man) "man" "man.el" 17577;;;### (autoloads (Man-bookmark-jump man-follow man) "man" "man.el"
17578;;;;;; (20762 9398 526093 0)) 17578;;;;;; (20888 42662 256824 0))
17579;;; Generated autoloads from man.el 17579;;; Generated autoloads from man.el
17580 17580
17581(defalias 'manual-entry 'man) 17581(defalias 'manual-entry 'man)
@@ -17629,8 +17629,8 @@ Default bookmark handler for Man buffers.
17629 17629
17630;;;*** 17630;;;***
17631 17631
17632;;;### (autoloads (master-mode) "master" "master.el" (20709 26818 17632;;;### (autoloads (master-mode) "master" "master.el" (20884 7264
17633;;;;;; 907104 0)) 17633;;;;;; 912957 506000))
17634;;; Generated autoloads from master.el 17634;;; Generated autoloads from master.el
17635 17635
17636(autoload 'master-mode "master" "\ 17636(autoload 'master-mode "master" "\
@@ -17686,7 +17686,7 @@ recursion depth in the minibuffer prompt. This is only useful if
17686;;;;;; message-forward-make-body message-forward message-recover 17686;;;;;; message-forward-make-body message-forward message-recover
17687;;;;;; message-supersede message-cancel-news message-followup message-wide-reply 17687;;;;;; message-supersede message-cancel-news message-followup message-wide-reply
17688;;;;;; message-reply message-news message-mail message-mode) "message" 17688;;;;;; message-reply message-news message-mail message-mode) "message"
17689;;;;;; "gnus/message.el" (20858 21542 723007 0)) 17689;;;;;; "gnus/message.el" (20889 63525 775294 0))
17690;;; Generated autoloads from gnus/message.el 17690;;; Generated autoloads from gnus/message.el
17691 17691
17692(define-mail-user-agent 'message-user-agent 'message-mail 'message-send-and-exit 'message-kill-buffer 'message-send-hook) 17692(define-mail-user-agent 'message-user-agent 'message-mail 'message-send-and-exit 'message-kill-buffer 'message-send-hook)
@@ -17852,7 +17852,7 @@ which specify the range to operate on.
17852;;;*** 17852;;;***
17853 17853
17854;;;### (autoloads (metapost-mode metafont-mode) "meta-mode" "progmodes/meta-mode.el" 17854;;;### (autoloads (metapost-mode metafont-mode) "meta-mode" "progmodes/meta-mode.el"
17855;;;;;; (20709 26818 907104 0)) 17855;;;;;; (20874 62962 290468 0))
17856;;; Generated autoloads from progmodes/meta-mode.el 17856;;; Generated autoloads from progmodes/meta-mode.el
17857 17857
17858(autoload 'metafont-mode "meta-mode" "\ 17858(autoload 'metafont-mode "meta-mode" "\
@@ -17914,7 +17914,7 @@ redisplayed as output is inserted.
17914 17914
17915;;;### (autoloads (mh-fully-kill-draft mh-send-letter mh-user-agent-compose 17915;;;### (autoloads (mh-fully-kill-draft mh-send-letter mh-user-agent-compose
17916;;;;;; mh-smail-batch mh-smail-other-window mh-smail) "mh-comp" 17916;;;;;; mh-smail-batch mh-smail-other-window mh-smail) "mh-comp"
17917;;;;;; "mh-e/mh-comp.el" (20787 12616 976036 0)) 17917;;;;;; "mh-e/mh-comp.el" (20890 54503 125088 852000))
17918;;; Generated autoloads from mh-e/mh-comp.el 17918;;; Generated autoloads from mh-e/mh-comp.el
17919 17919
17920(autoload 'mh-smail "mh-comp" "\ 17920(autoload 'mh-smail "mh-comp" "\
@@ -18004,8 +18004,8 @@ delete the draft message.
18004 18004
18005;;;*** 18005;;;***
18006 18006
18007;;;### (autoloads (mh-version) "mh-e" "mh-e/mh-e.el" (20787 12616 18007;;;### (autoloads (mh-version) "mh-e" "mh-e/mh-e.el" (20874 65006
18008;;;;;; 976036 0)) 18008;;;;;; 672942 217000))
18009;;; Generated autoloads from mh-e/mh-e.el 18009;;; Generated autoloads from mh-e/mh-e.el
18010 18010
18011(put 'mh-progs 'risky-local-variable t) 18011(put 'mh-progs 'risky-local-variable t)
@@ -18391,7 +18391,7 @@ body) or \"attachment\" (separate from the body).
18391;;;*** 18391;;;***
18392 18392
18393;;;### (autoloads (mml1991-sign mml1991-encrypt) "mml1991" "gnus/mml1991.el" 18393;;;### (autoloads (mml1991-sign mml1991-encrypt) "mml1991" "gnus/mml1991.el"
18394;;;;;; (20791 9657 561026 0)) 18394;;;;;; (20875 30633 412173 0))
18395;;; Generated autoloads from gnus/mml1991.el 18395;;; Generated autoloads from gnus/mml1991.el
18396 18396
18397(autoload 'mml1991-encrypt "mml1991" "\ 18397(autoload 'mml1991-encrypt "mml1991" "\
@@ -18408,7 +18408,7 @@ body) or \"attachment\" (separate from the body).
18408 18408
18409;;;### (autoloads (mml2015-self-encrypt mml2015-sign mml2015-encrypt 18409;;;### (autoloads (mml2015-self-encrypt mml2015-sign mml2015-encrypt
18410;;;;;; mml2015-verify-test mml2015-verify mml2015-decrypt-test mml2015-decrypt) 18410;;;;;; mml2015-verify-test mml2015-verify mml2015-decrypt-test mml2015-decrypt)
18411;;;;;; "mml2015" "gnus/mml2015.el" (20780 39352 990623 0)) 18411;;;;;; "mml2015" "gnus/mml2015.el" (20893 60586 188550 0))
18412;;; Generated autoloads from gnus/mml2015.el 18412;;; Generated autoloads from gnus/mml2015.el
18413 18413
18414(autoload 'mml2015-decrypt "mml2015" "\ 18414(autoload 'mml2015-decrypt "mml2015" "\
@@ -18615,7 +18615,7 @@ different buffer menu using the function `msb'.
18615;;;;;; describe-current-coding-system describe-current-coding-system-briefly 18615;;;;;; describe-current-coding-system describe-current-coding-system-briefly
18616;;;;;; describe-coding-system describe-character-set list-charset-chars 18616;;;;;; describe-coding-system describe-character-set list-charset-chars
18617;;;;;; read-charset list-character-sets) "mule-diag" "international/mule-diag.el" 18617;;;;;; read-charset list-character-sets) "mule-diag" "international/mule-diag.el"
18618;;;;;; (20709 26818 907104 0)) 18618;;;;;; (20891 18859 893295 0))
18619;;; Generated autoloads from international/mule-diag.el 18619;;; Generated autoloads from international/mule-diag.el
18620 18620
18621(autoload 'list-character-sets "mule-diag" "\ 18621(autoload 'list-character-sets "mule-diag" "\
@@ -18885,7 +18885,7 @@ per-character basis, this may not be accurate.
18885 18885
18886;;;### (autoloads (advice-member-p advice-remove advice-add remove-function 18886;;;### (autoloads (advice-member-p advice-remove advice-add remove-function
18887;;;;;; advice--add-function add-function advice--buffer-local advice--remove-function) 18887;;;;;; advice--add-function add-function advice--buffer-local advice--remove-function)
18888;;;;;; "nadvice" "emacs-lisp/nadvice.el" (20851 48294 960738 0)) 18888;;;;;; "nadvice" "emacs-lisp/nadvice.el" (20872 54440 171355 0))
18889;;; Generated autoloads from emacs-lisp/nadvice.el 18889;;; Generated autoloads from emacs-lisp/nadvice.el
18890 18890
18891(autoload 'advice--remove-function "nadvice" "\ 18891(autoload 'advice--remove-function "nadvice" "\
@@ -18973,8 +18973,8 @@ of the piece of advice.
18973;;;### (autoloads (network-connection network-connection-to-service 18973;;;### (autoloads (network-connection network-connection-to-service
18974;;;;;; whois-reverse-lookup whois finger ftp run-dig dns-lookup-host 18974;;;;;; whois-reverse-lookup whois finger ftp run-dig dns-lookup-host
18975;;;;;; nslookup nslookup-host ping traceroute route arp netstat 18975;;;;;; nslookup nslookup-host ping traceroute route arp netstat
18976;;;;;; iwconfig ifconfig) "net-utils" "net/net-utils.el" (20799 18976;;;;;; iwconfig ifconfig) "net-utils" "net/net-utils.el" (20903
18977;;;;;; 169 640767 0)) 18977;;;;;; 10024 645978 0))
18978;;; Generated autoloads from net/net-utils.el 18978;;; Generated autoloads from net/net-utils.el
18979 18979
18980(autoload 'ifconfig "net-utils" "\ 18980(autoload 'ifconfig "net-utils" "\
@@ -19359,8 +19359,8 @@ Return nil if the face cannot display a glyph for N.
19359 19359
19360;;;*** 19360;;;***
19361 19361
19362;;;### (autoloads (nxml-mode) "nxml-mode" "nxml/nxml-mode.el" (20813 19362;;;### (autoloads (nxml-mode) "nxml-mode" "nxml/nxml-mode.el" (20884
19363;;;;;; 33065 721081 0)) 19363;;;;;; 6711 386198 0))
19364;;; Generated autoloads from nxml/nxml-mode.el 19364;;; Generated autoloads from nxml/nxml-mode.el
19365 19365
19366(autoload 'nxml-mode "nxml-mode" "\ 19366(autoload 'nxml-mode "nxml-mode" "\
@@ -19435,7 +19435,7 @@ the variable `nxml-enabled-unicode-blocks'.
19435;;;*** 19435;;;***
19436 19436
19437;;;### (autoloads (inferior-octave octave-mode) "octave" "progmodes/octave.el" 19437;;;### (autoloads (inferior-octave octave-mode) "octave" "progmodes/octave.el"
19438;;;;;; (20864 60326 774861 0)) 19438;;;;;; (20905 51752 865679 0))
19439;;; Generated autoloads from progmodes/octave.el 19439;;; Generated autoloads from progmodes/octave.el
19440 19440
19441(autoload 'octave-mode "octave" "\ 19441(autoload 'octave-mode "octave" "\
@@ -20203,7 +20203,7 @@ See the command `outline-mode' for more information on this mode.
20203;;;### (autoloads (list-packages describe-package package-initialize 20203;;;### (autoloads (list-packages describe-package package-initialize
20204;;;;;; package-refresh-contents package-install-file package-install-from-buffer 20204;;;;;; package-refresh-contents package-install-file package-install-from-buffer
20205;;;;;; package-install package-enable-at-startup) "package" "emacs-lisp/package.el" 20205;;;;;; package-install package-enable-at-startup) "package" "emacs-lisp/package.el"
20206;;;;;; (20860 63270 684173 0)) 20206;;;;;; (20882 3877 904124 0))
20207;;; Generated autoloads from emacs-lisp/package.el 20207;;; Generated autoloads from emacs-lisp/package.el
20208 20208
20209(defvar package-enable-at-startup t "\ 20209(defvar package-enable-at-startup t "\
@@ -20273,8 +20273,8 @@ The list is displayed in a buffer named `*Packages*'.
20273 20273
20274;;;*** 20274;;;***
20275 20275
20276;;;### (autoloads (show-paren-mode) "paren" "paren.el" (20738 27061 20276;;;### (autoloads (show-paren-mode) "paren" "paren.el" (20903 56815
20277;;;;;; 124069 0)) 20277;;;;;; 695483 0))
20278;;; Generated autoloads from paren.el 20278;;; Generated autoloads from paren.el
20279 20279
20280(defvar show-paren-mode nil "\ 20280(defvar show-paren-mode nil "\
@@ -20314,8 +20314,8 @@ unknown are returned as nil.
20314 20314
20315;;;*** 20315;;;***
20316 20316
20317;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (20746 20317;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (20870
20318;;;;;; 21181 635406 0)) 20318;;;;;; 12718 549931 0))
20319;;; Generated autoloads from progmodes/pascal.el 20319;;; Generated autoloads from progmodes/pascal.el
20320 20320
20321(autoload 'pascal-mode "pascal" "\ 20321(autoload 'pascal-mode "pascal" "\
@@ -20492,7 +20492,7 @@ Completion for the GNU tar utility.
20492;;;*** 20492;;;***
20493 20493
20494;;;### (autoloads (pcomplete/mount pcomplete/umount pcomplete/kill) 20494;;;### (autoloads (pcomplete/mount pcomplete/umount pcomplete/kill)
20495;;;;;; "pcmpl-linux" "pcmpl-linux.el" (20709 26818 907104 0)) 20495;;;;;; "pcmpl-linux" "pcmpl-linux.el" (20884 7264 912957 506000))
20496;;; Generated autoloads from pcmpl-linux.el 20496;;; Generated autoloads from pcmpl-linux.el
20497 20497
20498(autoload 'pcomplete/kill "pcmpl-linux" "\ 20498(autoload 'pcomplete/kill "pcmpl-linux" "\
@@ -20748,7 +20748,7 @@ Global menu used by PCL-CVS.")
20748;;;*** 20748;;;***
20749 20749
20750;;;### (autoloads (perl-mode) "perl-mode" "progmodes/perl-mode.el" 20750;;;### (autoloads (perl-mode) "perl-mode" "progmodes/perl-mode.el"
20751;;;;;; (20709 26818 907104 0)) 20751;;;;;; (20873 17019 382960 343000))
20752;;; Generated autoloads from progmodes/perl-mode.el 20752;;; Generated autoloads from progmodes/perl-mode.el
20753(put 'perl-indent-level 'safe-local-variable 'integerp) 20753(put 'perl-indent-level 'safe-local-variable 'integerp)
20754(put 'perl-continued-statement-offset 'safe-local-variable 'integerp) 20754(put 'perl-continued-statement-offset 'safe-local-variable 'integerp)
@@ -21017,7 +21017,7 @@ Ignores leading comment characters.
21017;;;;;; pr-ps-buffer-print pr-ps-buffer-using-ghostscript pr-ps-buffer-preview 21017;;;;;; pr-ps-buffer-print pr-ps-buffer-using-ghostscript pr-ps-buffer-preview
21018;;;;;; pr-ps-directory-ps-print pr-ps-directory-print pr-ps-directory-using-ghostscript 21018;;;;;; pr-ps-directory-ps-print pr-ps-directory-print pr-ps-directory-using-ghostscript
21019;;;;;; pr-ps-directory-preview pr-interface) "printing" "printing.el" 21019;;;;;; pr-ps-directory-preview pr-interface) "printing" "printing.el"
21020;;;;;; (20721 17977 14204 0)) 21020;;;;;; (20891 44219 680764 0))
21021;;; Generated autoloads from printing.el 21021;;; Generated autoloads from printing.el
21022 21022
21023(autoload 'pr-interface "printing" "\ 21023(autoload 'pr-interface "printing" "\
@@ -21654,7 +21654,7 @@ Open profile FILENAME.
21654;;;*** 21654;;;***
21655 21655
21656;;;### (autoloads (run-prolog mercury-mode prolog-mode) "prolog" 21656;;;### (autoloads (run-prolog mercury-mode prolog-mode) "prolog"
21657;;;;;; "progmodes/prolog.el" (20851 48294 960738 0)) 21657;;;;;; "progmodes/prolog.el" (20891 18859 893295 0))
21658;;; Generated autoloads from progmodes/prolog.el 21658;;; Generated autoloads from progmodes/prolog.el
21659 21659
21660(autoload 'prolog-mode "prolog" "\ 21660(autoload 'prolog-mode "prolog" "\
@@ -21753,8 +21753,8 @@ Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number
21753;;;;;; ps-spool-region ps-spool-buffer-with-faces ps-spool-buffer 21753;;;;;; ps-spool-region ps-spool-buffer-with-faces ps-spool-buffer
21754;;;;;; ps-print-region-with-faces ps-print-region ps-print-buffer-with-faces 21754;;;;;; ps-print-region-with-faces ps-print-region ps-print-buffer-with-faces
21755;;;;;; ps-print-buffer ps-print-customize ps-print-color-p ps-paper-type 21755;;;;;; ps-print-buffer ps-print-customize ps-print-color-p ps-paper-type
21756;;;;;; ps-page-dimensions-database) "ps-print" "ps-print.el" (20721 21756;;;;;; ps-page-dimensions-database) "ps-print" "ps-print.el" (20874
21757;;;;;; 17977 14204 0)) 21757;;;;;; 65006 672942 217000))
21758;;; Generated autoloads from ps-print.el 21758;;; Generated autoloads from ps-print.el
21759 21759
21760(defvar ps-page-dimensions-database (purecopy (list (list 'a4 (/ (* 72 21.0) 2.54) (/ (* 72 29.7) 2.54) "A4") (list 'a3 (/ (* 72 29.7) 2.54) (/ (* 72 42.0) 2.54) "A3") (list 'letter (* 72 8.5) (* 72 11.0) "Letter") (list 'legal (* 72 8.5) (* 72 14.0) "Legal") (list 'letter-small (* 72 7.68) (* 72 10.16) "LetterSmall") (list 'tabloid (* 72 11.0) (* 72 17.0) "Tabloid") (list 'ledger (* 72 17.0) (* 72 11.0) "Ledger") (list 'statement (* 72 5.5) (* 72 8.5) "Statement") (list 'executive (* 72 7.5) (* 72 10.0) "Executive") (list 'a4small (* 72 7.47) (* 72 10.85) "A4Small") (list 'b4 (* 72 10.125) (* 72 14.33) "B4") (list 'b5 (* 72 7.16) (* 72 10.125) "B5") '(addresslarge 236.0 99.0 "AddressLarge") '(addresssmall 236.0 68.0 "AddressSmall") '(cuthanging13 90.0 222.0 "CutHanging13") '(cuthanging15 90.0 114.0 "CutHanging15") '(diskette 181.0 136.0 "Diskette") '(eurofilefolder 139.0 112.0 "EuropeanFilefolder") '(eurofoldernarrow 526.0 107.0 "EuroFolderNarrow") '(eurofolderwide 526.0 136.0 "EuroFolderWide") '(euronamebadge 189.0 108.0 "EuroNameBadge") '(euronamebadgelarge 223.0 136.0 "EuroNameBadgeLarge") '(filefolder 230.0 37.0 "FileFolder") '(jewelry 76.0 136.0 "Jewelry") '(mediabadge 180.0 136.0 "MediaBadge") '(multipurpose 126.0 68.0 "MultiPurpose") '(retaillabel 90.0 104.0 "RetailLabel") '(shipping 271.0 136.0 "Shipping") '(slide35mm 26.0 104.0 "Slide35mm") '(spine8mm 187.0 26.0 "Spine8mm") '(topcoated 425.19685 136.0 "TopCoatedPaper") '(topcoatedpaper 396.0 136.0 "TopcoatedPaper150") '(vhsface 205.0 127.0 "VHSFace") '(vhsspine 400.0 50.0 "VHSSpine") '(zipdisk 156.0 136.0 "ZipDisk"))) "\ 21760(defvar ps-page-dimensions-database (purecopy (list (list 'a4 (/ (* 72 21.0) 2.54) (/ (* 72 29.7) 2.54) "A4") (list 'a3 (/ (* 72 29.7) 2.54) (/ (* 72 42.0) 2.54) "A3") (list 'letter (* 72 8.5) (* 72 11.0) "Letter") (list 'legal (* 72 8.5) (* 72 14.0) "Legal") (list 'letter-small (* 72 7.68) (* 72 10.16) "LetterSmall") (list 'tabloid (* 72 11.0) (* 72 17.0) "Tabloid") (list 'ledger (* 72 17.0) (* 72 11.0) "Ledger") (list 'statement (* 72 5.5) (* 72 8.5) "Statement") (list 'executive (* 72 7.5) (* 72 10.0) "Executive") (list 'a4small (* 72 7.47) (* 72 10.85) "A4Small") (list 'b4 (* 72 10.125) (* 72 14.33) "B4") (list 'b5 (* 72 7.16) (* 72 10.125) "B5") '(addresslarge 236.0 99.0 "AddressLarge") '(addresssmall 236.0 68.0 "AddressSmall") '(cuthanging13 90.0 222.0 "CutHanging13") '(cuthanging15 90.0 114.0 "CutHanging15") '(diskette 181.0 136.0 "Diskette") '(eurofilefolder 139.0 112.0 "EuropeanFilefolder") '(eurofoldernarrow 526.0 107.0 "EuroFolderNarrow") '(eurofolderwide 526.0 136.0 "EuroFolderWide") '(euronamebadge 189.0 108.0 "EuroNameBadge") '(euronamebadgelarge 223.0 136.0 "EuroNameBadgeLarge") '(filefolder 230.0 37.0 "FileFolder") '(jewelry 76.0 136.0 "Jewelry") '(mediabadge 180.0 136.0 "MediaBadge") '(multipurpose 126.0 68.0 "MultiPurpose") '(retaillabel 90.0 104.0 "RetailLabel") '(shipping 271.0 136.0 "Shipping") '(slide35mm 26.0 104.0 "Slide35mm") '(spine8mm 187.0 26.0 "Spine8mm") '(topcoated 425.19685 136.0 "TopCoatedPaper") '(topcoatedpaper 396.0 136.0 "TopcoatedPaper150") '(vhsface 205.0 127.0 "VHSFace") '(vhsspine 400.0 50.0 "VHSSpine") '(zipdisk 156.0 136.0 "ZipDisk"))) "\
@@ -21951,7 +21951,7 @@ If EXTENSION is any other symbol, it is ignored.
21951;;;*** 21951;;;***
21952 21952
21953;;;### (autoloads (python-mode run-python) "python" "progmodes/python.el" 21953;;;### (autoloads (python-mode run-python) "python" "progmodes/python.el"
21954;;;;;; (20850 27430 515630 0)) 21954;;;;;; (20874 65006 672942 217000))
21955;;; Generated autoloads from progmodes/python.el 21955;;; Generated autoloads from progmodes/python.el
21956 21956
21957(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) 21957(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode))
@@ -22383,8 +22383,8 @@ matching parts of the target buffer will be highlighted.
22383 22383
22384;;;*** 22384;;;***
22385 22385
22386;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (20799 169 22386;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (20871 33574
22387;;;;;; 640767 0)) 22387;;;;;; 214287 0))
22388;;; Generated autoloads from recentf.el 22388;;; Generated autoloads from recentf.el
22389 22389
22390(defvar recentf-mode nil "\ 22390(defvar recentf-mode nil "\
@@ -22548,8 +22548,8 @@ with a prefix argument, prompt for START-AT and FORMAT.
22548 22548
22549;;;*** 22549;;;***
22550 22550
22551;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (20709 22551;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (20884
22552;;;;;; 26818 907104 0)) 22552;;;;;; 7264 912957 506000))
22553;;; Generated autoloads from textmodes/refill.el 22553;;; Generated autoloads from textmodes/refill.el
22554 22554
22555(autoload 'refill-mode "refill" "\ 22555(autoload 'refill-mode "refill" "\
@@ -22570,8 +22570,8 @@ For true \"word wrap\" behavior, use `visual-line-mode' instead.
22570;;;*** 22570;;;***
22571 22571
22572;;;### (autoloads (reftex-reset-scanning-information reftex-mode 22572;;;### (autoloads (reftex-reset-scanning-information reftex-mode
22573;;;;;; turn-on-reftex) "reftex" "textmodes/reftex.el" (20843 54187 22573;;;;;; turn-on-reftex) "reftex" "textmodes/reftex.el" (20895 15912
22574;;;;;; 671468 0)) 22574;;;;;; 444844 0))
22575;;; Generated autoloads from textmodes/reftex.el 22575;;; Generated autoloads from textmodes/reftex.el
22576 22576
22577(autoload 'turn-on-reftex "reftex" "\ 22577(autoload 'turn-on-reftex "reftex" "\
@@ -22701,7 +22701,7 @@ Here are all local bindings.
22701;;;*** 22701;;;***
22702 22702
22703;;;### (autoloads (reftex-all-document-files) "reftex-parse" "textmodes/reftex-parse.el" 22703;;;### (autoloads (reftex-all-document-files) "reftex-parse" "textmodes/reftex-parse.el"
22704;;;;;; (20858 21542 723007 0)) 22704;;;;;; (20895 15912 444844 0))
22705;;; Generated autoloads from textmodes/reftex-parse.el 22705;;; Generated autoloads from textmodes/reftex-parse.el
22706 22706
22707(autoload 'reftex-all-document-files "reftex-parse" "\ 22707(autoload 'reftex-all-document-files "reftex-parse" "\
@@ -22713,8 +22713,8 @@ of master file.
22713 22713
22714;;;*** 22714;;;***
22715 22715
22716;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (20858 22716;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (20895
22717;;;;;; 21542 723007 0)) 22717;;;;;; 15912 444844 0))
22718;;; Generated autoloads from textmodes/reftex-vars.el 22718;;; Generated autoloads from textmodes/reftex-vars.el
22719(put 'reftex-vref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x)))) 22719(put 'reftex-vref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
22720(put 'reftex-fref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x)))) 22720(put 'reftex-fref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
@@ -22755,7 +22755,7 @@ This means the number of non-shy regexp grouping constructs
22755 22755
22756;;;### (autoloads (remember-diary-extract-entries remember-clipboard 22756;;;### (autoloads (remember-diary-extract-entries remember-clipboard
22757;;;;;; remember-other-frame remember) "remember" "textmodes/remember.el" 22757;;;;;; remember-other-frame remember) "remember" "textmodes/remember.el"
22758;;;;;; (20859 42406 744769 0)) 22758;;;;;; (20874 65006 672942 217000))
22759;;; Generated autoloads from textmodes/remember.el 22759;;; Generated autoloads from textmodes/remember.el
22760 22760
22761(autoload 'remember "remember" "\ 22761(autoload 'remember "remember" "\
@@ -22919,8 +22919,8 @@ Make a ring that can contain SIZE elements.
22919 22919
22920;;;*** 22920;;;***
22921 22921
22922;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (20709 26818 22922;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (20903 10024
22923;;;;;; 907104 0)) 22923;;;;;; 645978 0))
22924;;; Generated autoloads from net/rlogin.el 22924;;; Generated autoloads from net/rlogin.el
22925 22925
22926(autoload 'rlogin "rlogin" "\ 22926(autoload 'rlogin "rlogin" "\
@@ -22969,7 +22969,7 @@ variable.
22969;;;;;; rmail-secondary-file-directory rmail-primary-inbox-list rmail-highlighted-headers 22969;;;;;; rmail-secondary-file-directory rmail-primary-inbox-list rmail-highlighted-headers
22970;;;;;; rmail-retry-ignored-headers rmail-displayed-headers rmail-ignored-headers 22970;;;;;; rmail-retry-ignored-headers rmail-displayed-headers rmail-ignored-headers
22971;;;;;; rmail-user-mail-address-regexp rmail-movemail-variant-p rmail-spool-directory 22971;;;;;; rmail-user-mail-address-regexp rmail-movemail-variant-p rmail-spool-directory
22972;;;;;; rmail-file-name) "rmail" "mail/rmail.el" (20762 9398 526093 22972;;;;;; rmail-file-name) "rmail" "mail/rmail.el" (20892 39729 858825
22973;;;;;; 0)) 22973;;;;;; 0))
22974;;; Generated autoloads from mail/rmail.el 22974;;; Generated autoloads from mail/rmail.el
22975 22975
@@ -23259,7 +23259,7 @@ Validation will be enabled if `rng-nxml-auto-validate-flag' is non-nil.
23259;;;*** 23259;;;***
23260 23260
23261;;;### (autoloads (rng-validate-mode) "rng-valid" "nxml/rng-valid.el" 23261;;;### (autoloads (rng-validate-mode) "rng-valid" "nxml/rng-valid.el"
23262;;;;;; (20814 53928 50501 0)) 23262;;;;;; (20884 6711 386198 0))
23263;;; Generated autoloads from nxml/rng-valid.el 23263;;; Generated autoloads from nxml/rng-valid.el
23264 23264
23265(autoload 'rng-validate-mode "rng-valid" "\ 23265(autoload 'rng-validate-mode "rng-valid" "\
@@ -23390,7 +23390,7 @@ Toggle the use of ROT13 encoding for the current window.
23390;;;*** 23390;;;***
23391 23391
23392;;;### (autoloads (rst-minor-mode rst-mode) "rst" "textmodes/rst.el" 23392;;;### (autoloads (rst-minor-mode rst-mode) "rst" "textmodes/rst.el"
23393;;;;;; (20709 26818 907104 0)) 23393;;;;;; (20884 7264 912957 506000))
23394;;; Generated autoloads from textmodes/rst.el 23394;;; Generated autoloads from textmodes/rst.el
23395 (add-to-list 'auto-mode-alist (purecopy '("\\.re?st\\'" . rst-mode))) 23395 (add-to-list 'auto-mode-alist (purecopy '("\\.re?st\\'" . rst-mode)))
23396 23396
@@ -23421,7 +23421,7 @@ for modes derived from Text mode, like Mail mode.
23421;;;*** 23421;;;***
23422 23422
23423;;;### (autoloads (ruby-mode) "ruby-mode" "progmodes/ruby-mode.el" 23423;;;### (autoloads (ruby-mode) "ruby-mode" "progmodes/ruby-mode.el"
23424;;;;;; (20845 9511 656701 0)) 23424;;;;;; (20905 51752 865679 0))
23425;;; Generated autoloads from progmodes/ruby-mode.el 23425;;; Generated autoloads from progmodes/ruby-mode.el
23426 23426
23427(autoload 'ruby-mode "ruby-mode" "\ 23427(autoload 'ruby-mode "ruby-mode" "\
@@ -23973,7 +23973,7 @@ Semantic mode.
23973;;;*** 23973;;;***
23974 23974
23975;;;### (autoloads (bovine-grammar-mode) "semantic/bovine/grammar" 23975;;;### (autoloads (bovine-grammar-mode) "semantic/bovine/grammar"
23976;;;;;; "cedet/semantic/bovine/grammar.el" (20709 26818 907104 0)) 23976;;;;;; "cedet/semantic/bovine/grammar.el" (20895 15912 444844 0))
23977;;; Generated autoloads from cedet/semantic/bovine/grammar.el 23977;;; Generated autoloads from cedet/semantic/bovine/grammar.el
23978 23978
23979(autoload 'bovine-grammar-mode "semantic/bovine/grammar" "\ 23979(autoload 'bovine-grammar-mode "semantic/bovine/grammar" "\
@@ -23984,7 +23984,7 @@ Major mode for editing Bovine grammars.
23984;;;*** 23984;;;***
23985 23985
23986;;;### (autoloads (wisent-grammar-mode) "semantic/wisent/grammar" 23986;;;### (autoloads (wisent-grammar-mode) "semantic/wisent/grammar"
23987;;;;;; "cedet/semantic/wisent/grammar.el" (20709 26818 907104 0)) 23987;;;;;; "cedet/semantic/wisent/grammar.el" (20879 27694 495748 0))
23988;;; Generated autoloads from cedet/semantic/wisent/grammar.el 23988;;; Generated autoloads from cedet/semantic/wisent/grammar.el
23989 23989
23990(autoload 'wisent-grammar-mode "semantic/wisent/grammar" "\ 23990(autoload 'wisent-grammar-mode "semantic/wisent/grammar" "\
@@ -24591,7 +24591,7 @@ Set up file shadowing.
24591;;;*** 24591;;;***
24592 24592
24593;;;### (autoloads (shell shell-dumb-shell-regexp) "shell" "shell.el" 24593;;;### (autoloads (shell shell-dumb-shell-regexp) "shell" "shell.el"
24594;;;;;; (20709 26818 907104 0)) 24594;;;;;; (20884 7264 912957 506000))
24595;;; Generated autoloads from shell.el 24595;;; Generated autoloads from shell.el
24596 24596
24597(defvar shell-dumb-shell-regexp (purecopy "cmd\\(proxy\\)?\\.exe") "\ 24597(defvar shell-dumb-shell-regexp (purecopy "cmd\\(proxy\\)?\\.exe") "\
@@ -24639,8 +24639,8 @@ Otherwise, one argument `-i' is passed to the shell.
24639 24639
24640;;;*** 24640;;;***
24641 24641
24642;;;### (autoloads (shr-insert-document) "shr" "gnus/shr.el" (20845 24642;;;### (autoloads (shr-insert-document) "shr" "gnus/shr.el" (20903
24643;;;;;; 9511 656701 0)) 24643;;;;;; 10024 645978 0))
24644;;; Generated autoloads from gnus/shr.el 24644;;; Generated autoloads from gnus/shr.el
24645 24645
24646(autoload 'shr-insert-document "shr" "\ 24646(autoload 'shr-insert-document "shr" "\
@@ -24653,7 +24653,7 @@ DOM should be a parse tree as generated by
24653;;;*** 24653;;;***
24654 24654
24655;;;### (autoloads (sieve-upload-and-kill sieve-upload-and-bury sieve-upload 24655;;;### (autoloads (sieve-upload-and-kill sieve-upload-and-bury sieve-upload
24656;;;;;; sieve-manage) "sieve" "gnus/sieve.el" (20709 26818 907104 24656;;;;;; sieve-manage) "sieve" "gnus/sieve.el" (20896 36774 886399
24657;;;;;; 0)) 24657;;;;;; 0))
24658;;; Generated autoloads from gnus/sieve.el 24658;;; Generated autoloads from gnus/sieve.el
24659 24659
@@ -24885,6 +24885,30 @@ If no conflict maker is found, turn off `smerge-mode'.
24885 24885
24886;;;*** 24886;;;***
24887 24887
24888;;;### (autoloads (smie-highlight-matching-block-mode) "smie" "emacs-lisp/smie.el"
24889;;;;;; (20901 54695 989166 0))
24890;;; Generated autoloads from emacs-lisp/smie.el
24891
24892(defvar smie-highlight-matching-block-mode nil "\
24893Non-nil if Smie-Highlight-Matching-Block mode is enabled.
24894See the command `smie-highlight-matching-block-mode' for a description of this minor mode.
24895Setting this variable directly does not take effect;
24896either customize it (see the info node `Easy Customization')
24897or call the function `smie-highlight-matching-block-mode'.")
24898
24899(custom-autoload 'smie-highlight-matching-block-mode "smie" nil)
24900
24901(autoload 'smie-highlight-matching-block-mode "smie" "\
24902Toggle Smie-Highlight-Matching-Block mode on or off.
24903With a prefix argument ARG, enable Smie-Highlight-Matching-Block mode if ARG is
24904positive, and disable it otherwise. If called from Lisp, enable
24905the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
24906\\{smie-highlight-matching-block-mode-map}
24907
24908\(fn &optional ARG)" t nil)
24909
24910;;;***
24911
24888;;;### (autoloads (smiley-buffer smiley-region) "smiley" "gnus/smiley.el" 24912;;;### (autoloads (smiley-buffer smiley-region) "smiley" "gnus/smiley.el"
24889;;;;;; (20726 5184 974741 509000)) 24913;;;;;; (20726 5184 974741 509000))
24890;;; Generated autoloads from gnus/smiley.el 24914;;; Generated autoloads from gnus/smiley.el
@@ -24944,7 +24968,7 @@ Snake mode keybindings:
24944;;;*** 24968;;;***
24945 24969
24946;;;### (autoloads (snmpv2-mode snmp-mode) "snmp-mode" "net/snmp-mode.el" 24970;;;### (autoloads (snmpv2-mode snmp-mode) "snmp-mode" "net/snmp-mode.el"
24947;;;;;; (20709 26818 907104 0)) 24971;;;;;; (20891 18859 893295 0))
24948;;; Generated autoloads from net/snmp-mode.el 24972;;; Generated autoloads from net/snmp-mode.el
24949 24973
24950(autoload 'snmp-mode "snmp-mode" "\ 24974(autoload 'snmp-mode "snmp-mode" "\
@@ -25067,8 +25091,8 @@ Pick your favorite shortcuts:
25067 25091
25068;;;### (autoloads (delete-duplicate-lines reverse-region sort-columns 25092;;;### (autoloads (delete-duplicate-lines reverse-region sort-columns
25069;;;;;; sort-regexp-fields sort-fields sort-numeric-fields sort-pages 25093;;;;;; sort-regexp-fields sort-fields sort-numeric-fields sort-pages
25070;;;;;; sort-paragraphs sort-lines sort-subr) "sort" "sort.el" (20709 25094;;;;;; sort-paragraphs sort-lines sort-subr) "sort" "sort.el" (20896
25071;;;;;; 26818 907104 0)) 25095;;;;;; 36774 886399 0))
25072;;; Generated autoloads from sort.el 25096;;; Generated autoloads from sort.el
25073(put 'sort-fold-case 'safe-local-variable 'booleanp) 25097(put 'sort-fold-case 'safe-local-variable 'booleanp)
25074 25098
@@ -25234,16 +25258,19 @@ delete repeated lines only if they are adjacent. It works like the utility
25234this is more efficient in performance and memory usage than when ADJACENT 25258this is more efficient in performance and memory usage than when ADJACENT
25235is nil that uses additional memory to remember previous lines. 25259is nil that uses additional memory to remember previous lines.
25236 25260
25261If KEEP-BLANKS is non-nil (when called interactively with three C-u prefixes),
25262duplicate blank lines are preserved.
25263
25237When called from Lisp and INTERACTIVE is omitted or nil, return the number 25264When called from Lisp and INTERACTIVE is omitted or nil, return the number
25238of deleted duplicate lines, do not print it; if INTERACTIVE is t, the 25265of deleted duplicate lines, do not print it; if INTERACTIVE is t, the
25239function behaves in all respects as if it had been called interactively. 25266function behaves in all respects as if it had been called interactively.
25240 25267
25241\(fn BEG END &optional REVERSE ADJACENT INTERACTIVE)" t nil) 25268\(fn BEG END &optional REVERSE ADJACENT KEEP-BLANKS INTERACTIVE)" t nil)
25242 25269
25243;;;*** 25270;;;***
25244 25271
25245;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (20709 25272;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (20901
25246;;;;;; 26818 907104 0)) 25273;;;;;; 54695 989166 0))
25247;;; Generated autoloads from gnus/spam.el 25274;;; Generated autoloads from gnus/spam.el
25248 25275
25249(autoload 'spam-initialize "spam" "\ 25276(autoload 'spam-initialize "spam" "\
@@ -25259,7 +25286,7 @@ installed through `spam-necessary-extra-headers'.
25259 25286
25260;;;### (autoloads (spam-report-deagentize spam-report-agentize spam-report-url-to-file 25287;;;### (autoloads (spam-report-deagentize spam-report-agentize spam-report-url-to-file
25261;;;;;; spam-report-url-ping-mm-url spam-report-process-queue) "spam-report" 25288;;;;;; spam-report-url-ping-mm-url spam-report-process-queue) "spam-report"
25262;;;;;; "gnus/spam-report.el" (20709 26818 907104 0)) 25289;;;;;; "gnus/spam-report.el" (20874 65006 672942 217000))
25263;;; Generated autoloads from gnus/spam-report.el 25290;;; Generated autoloads from gnus/spam-report.el
25264 25291
25265(autoload 'spam-report-process-queue "spam-report" "\ 25292(autoload 'spam-report-process-queue "spam-report" "\
@@ -25302,7 +25329,7 @@ Spam reports will be queued with the method used when
25302;;;*** 25329;;;***
25303 25330
25304;;;### (autoloads (speedbar-get-focus speedbar-frame-mode) "speedbar" 25331;;;### (autoloads (speedbar-get-focus speedbar-frame-mode) "speedbar"
25305;;;;;; "speedbar.el" (20709 26818 907104 0)) 25332;;;;;; "speedbar.el" (20892 39729 858825 0))
25306;;; Generated autoloads from speedbar.el 25333;;; Generated autoloads from speedbar.el
25307 25334
25308(defalias 'speedbar 'speedbar-frame-mode) 25335(defalias 'speedbar 'speedbar-frame-mode)
@@ -25346,7 +25373,7 @@ Return a vector containing the lines from `spook-phrases-file'.
25346;;;;;; sql-ms sql-ingres sql-solid sql-mysql sql-sqlite sql-informix 25373;;;;;; sql-ms sql-ingres sql-solid sql-mysql sql-sqlite sql-informix
25347;;;;;; sql-sybase sql-oracle sql-product-interactive sql-connect 25374;;;;;; sql-sybase sql-oracle sql-product-interactive sql-connect
25348;;;;;; sql-mode sql-add-product-keywords) "sql" "progmodes/sql.el" 25375;;;;;; sql-mode sql-add-product-keywords) "sql" "progmodes/sql.el"
25349;;;;;; (20797 44848 327754 0)) 25376;;;;;; (20878 6823 881439 0))
25350;;; Generated autoloads from progmodes/sql.el 25377;;; Generated autoloads from progmodes/sql.el
25351 25378
25352(autoload 'sql-add-product-keywords "sql" "\ 25379(autoload 'sql-add-product-keywords "sql" "\
@@ -25985,8 +26012,8 @@ Studlify-case the current buffer.
25985;;;*** 26012;;;***
25986 26013
25987;;;### (autoloads (global-superword-mode superword-mode global-subword-mode 26014;;;### (autoloads (global-superword-mode superword-mode global-subword-mode
25988;;;;;; subword-mode) "subword" "progmodes/subword.el" (20822 48073 26015;;;;;; subword-mode) "subword" "progmodes/subword.el" (20886 47777
25989;;;;;; 524485 0)) 26016;;;;;; 83668 440000))
25990;;; Generated autoloads from progmodes/subword.el 26017;;; Generated autoloads from progmodes/subword.el
25991 26018
25992(autoload 'subword-mode "subword" "\ 26019(autoload 'subword-mode "subword" "\
@@ -26786,8 +26813,8 @@ Connect to the Emacs talk group from the current X display or tty frame.
26786 26813
26787;;;*** 26814;;;***
26788 26815
26789;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (20709 26818 26816;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (20874 65222
26790;;;;;; 907104 0)) 26817;;;;;; 672942 464000))
26791;;; Generated autoloads from tar-mode.el 26818;;; Generated autoloads from tar-mode.el
26792 26819
26793(autoload 'tar-mode "tar-mode" "\ 26820(autoload 'tar-mode "tar-mode" "\
@@ -26811,7 +26838,7 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
26811;;;*** 26838;;;***
26812 26839
26813;;;### (autoloads (tcl-help-on-word inferior-tcl tcl-mode) "tcl" 26840;;;### (autoloads (tcl-help-on-word inferior-tcl tcl-mode) "tcl"
26814;;;;;; "progmodes/tcl.el" (20774 53405 704746 172000)) 26841;;;;;; "progmodes/tcl.el" (20903 10024 645978 0))
26815;;; Generated autoloads from progmodes/tcl.el 26842;;; Generated autoloads from progmodes/tcl.el
26816 26843
26817(autoload 'tcl-mode "tcl" "\ 26844(autoload 'tcl-mode "tcl" "\
@@ -26886,7 +26913,7 @@ Normally input is edited in Emacs and sent a line at a time.
26886;;;*** 26913;;;***
26887 26914
26888;;;### (autoloads (serial-term ansi-term term make-term) "term" "term.el" 26915;;;### (autoloads (serial-term ansi-term term make-term) "term" "term.el"
26889;;;;;; (20712 3008 596088 0)) 26916;;;;;; (20878 6823 881439 0))
26890;;; Generated autoloads from term.el 26917;;; Generated autoloads from term.el
26891 26918
26892(autoload 'make-term "term" "\ 26919(autoload 'make-term "term" "\
@@ -26929,7 +26956,7 @@ use in that buffer.
26929;;;*** 26956;;;***
26930 26957
26931;;;### (autoloads (testcover-this-defun) "testcover" "emacs-lisp/testcover.el" 26958;;;### (autoloads (testcover-this-defun) "testcover" "emacs-lisp/testcover.el"
26932;;;;;; (20709 26818 907104 0)) 26959;;;;;; (20878 6823 881439 0))
26933;;; Generated autoloads from emacs-lisp/testcover.el 26960;;; Generated autoloads from emacs-lisp/testcover.el
26934 26961
26935(autoload 'testcover-this-defun "testcover" "\ 26962(autoload 'testcover-this-defun "testcover" "\
@@ -26939,8 +26966,8 @@ Start coverage on function under point.
26939 26966
26940;;;*** 26967;;;***
26941 26968
26942;;;### (autoloads (tetris) "tetris" "play/tetris.el" (20709 26818 26969;;;### (autoloads (tetris) "tetris" "play/tetris.el" (20874 65006
26943;;;;;; 907104 0)) 26970;;;;;; 672942 217000))
26944;;; Generated autoloads from play/tetris.el 26971;;; Generated autoloads from play/tetris.el
26945 26972
26946(autoload 'tetris "tetris" "\ 26973(autoload 'tetris "tetris" "\
@@ -27428,7 +27455,7 @@ Compose Thai characters in the current buffer.
27428 27455
27429;;;### (autoloads (list-at-point number-at-point symbol-at-point 27456;;;### (autoloads (list-at-point number-at-point symbol-at-point
27430;;;;;; sexp-at-point thing-at-point bounds-of-thing-at-point forward-thing) 27457;;;;;; sexp-at-point thing-at-point bounds-of-thing-at-point forward-thing)
27431;;;;;; "thingatpt" "thingatpt.el" (20822 48073 524485 0)) 27458;;;;;; "thingatpt" "thingatpt.el" (20874 62962 290468 0))
27432;;; Generated autoloads from thingatpt.el 27459;;; Generated autoloads from thingatpt.el
27433 27460
27434(autoload 'forward-thing "thingatpt" "\ 27461(autoload 'forward-thing "thingatpt" "\
@@ -27462,10 +27489,13 @@ Possibilities include `symbol', `list', `sexp', `defun',
27462`filename', `url', `email', `word', `sentence', `whitespace', 27489`filename', `url', `email', `word', `sentence', `whitespace',
27463`line', `number', and `page'. 27490`line', `number', and `page'.
27464 27491
27492When the optional argument NO-PROPERTIES is non-nil,
27493strip text properties from the return value.
27494
27465See the file `thingatpt.el' for documentation on how to define 27495See the file `thingatpt.el' for documentation on how to define
27466a symbol as a valid THING. 27496a symbol as a valid THING.
27467 27497
27468\(fn THING)" nil nil) 27498\(fn THING &optional NO-PROPERTIES)" nil nil)
27469 27499
27470(autoload 'sexp-at-point "thingatpt" "\ 27500(autoload 'sexp-at-point "thingatpt" "\
27471Return the sexp at point, or nil if none is found. 27501Return the sexp at point, or nil if none is found.
@@ -28145,7 +28175,7 @@ holds a keymap.
28145;;;*** 28175;;;***
28146 28176
28147;;;### (autoloads (tpu-edt-on tpu-edt-mode) "tpu-edt" "emulation/tpu-edt.el" 28177;;;### (autoloads (tpu-edt-on tpu-edt-mode) "tpu-edt" "emulation/tpu-edt.el"
28148;;;;;; (20709 26818 907104 0)) 28178;;;;;; (20884 7264 412929 442000))
28149;;; Generated autoloads from emulation/tpu-edt.el 28179;;; Generated autoloads from emulation/tpu-edt.el
28150 28180
28151(defvar tpu-edt-mode nil "\ 28181(defvar tpu-edt-mode nil "\
@@ -28225,7 +28255,7 @@ to a tcp server on another machine.
28225 28255
28226;;;### (autoloads (trace-function-background trace-function-foreground 28256;;;### (autoloads (trace-function-background trace-function-foreground
28227;;;;;; trace-values trace-buffer) "trace" "emacs-lisp/trace.el" 28257;;;;;; trace-values trace-buffer) "trace" "emacs-lisp/trace.el"
28228;;;;;; (20842 33318 816618 0)) 28258;;;;;; (20903 10024 645978 0))
28229;;; Generated autoloads from emacs-lisp/trace.el 28259;;; Generated autoloads from emacs-lisp/trace.el
28230 28260
28231(defvar trace-buffer "*trace-output*" "\ 28261(defvar trace-buffer "*trace-output*" "\
@@ -28495,7 +28525,7 @@ First column's text sSs Second column's text
28495 28525
28496;;;### (autoloads (type-break-guesstimate-keystroke-threshold type-break-statistics 28526;;;### (autoloads (type-break-guesstimate-keystroke-threshold type-break-statistics
28497;;;;;; type-break type-break-mode) "type-break" "type-break.el" 28527;;;;;; type-break type-break-mode) "type-break" "type-break.el"
28498;;;;;; (20799 169 640767 0)) 28528;;;;;; (20884 7264 912957 506000))
28499;;; Generated autoloads from type-break.el 28529;;; Generated autoloads from type-break.el
28500 28530
28501(defvar type-break-mode nil "\ 28531(defvar type-break-mode nil "\
@@ -28733,7 +28763,7 @@ which specify the range to operate on.
28733;;;*** 28763;;;***
28734 28764
28735;;;### (autoloads (unrmail batch-unrmail) "unrmail" "mail/unrmail.el" 28765;;;### (autoloads (unrmail batch-unrmail) "unrmail" "mail/unrmail.el"
28736;;;;;; (20731 53823 676680 0)) 28766;;;;;; (20895 15912 444844 0))
28737;;; Generated autoloads from mail/unrmail.el 28767;;; Generated autoloads from mail/unrmail.el
28738 28768
28739(autoload 'batch-unrmail "unrmail" "\ 28769(autoload 'batch-unrmail "unrmail" "\
@@ -28767,7 +28797,7 @@ UNSAFEP-VARS is a list of symbols with local bindings.
28767;;;*** 28797;;;***
28768 28798
28769;;;### (autoloads (url-retrieve-synchronously url-retrieve) "url" 28799;;;### (autoloads (url-retrieve-synchronously url-retrieve) "url"
28770;;;;;; "url/url.el" (20709 26818 907104 0)) 28800;;;;;; "url/url.el" (20893 60586 188550 0))
28771;;; Generated autoloads from url/url.el 28801;;; Generated autoloads from url/url.el
28772 28802
28773(autoload 'url-retrieve "url" "\ 28803(autoload 'url-retrieve "url" "\
@@ -28890,7 +28920,7 @@ Extract FNAM from the local disk cache.
28890;;;*** 28920;;;***
28891 28921
28892;;;### (autoloads (url-dav-vc-registered url-dav-request url-dav-supported-p) 28922;;;### (autoloads (url-dav-vc-registered url-dav-request url-dav-supported-p)
28893;;;;;; "url-dav" "url/url-dav.el" (20709 26818 907104 0)) 28923;;;;;; "url-dav" "url/url-dav.el" (20891 18859 893295 0))
28894;;; Generated autoloads from url/url-dav.el 28924;;; Generated autoloads from url/url-dav.el
28895 28925
28896(autoload 'url-dav-supported-p "url-dav" "\ 28926(autoload 'url-dav-supported-p "url-dav" "\
@@ -28956,7 +28986,7 @@ Might do a non-blocking connection; use `process-status' to check.
28956 28986
28957;;;### (autoloads (url-insert-file-contents url-file-local-copy url-copy-file 28987;;;### (autoloads (url-insert-file-contents url-file-local-copy url-copy-file
28958;;;;;; url-file-handler url-handler-mode) "url-handlers" "url/url-handlers.el" 28988;;;;;; url-file-handler url-handler-mode) "url-handlers" "url/url-handlers.el"
28959;;;;;; (20709 26818 907104 0)) 28989;;;;;; (20892 39729 858825 0))
28960;;; Generated autoloads from url/url-handlers.el 28990;;; Generated autoloads from url/url-handlers.el
28961 28991
28962(defvar url-handler-mode nil "\ 28992(defvar url-handler-mode nil "\
@@ -29098,7 +29128,7 @@ Fetch a data URL (RFC 2397).
29098;;;*** 29128;;;***
29099 29129
29100;;;### (autoloads (url-snews url-news) "url-news" "url/url-news.el" 29130;;;### (autoloads (url-snews url-news) "url-news" "url/url-news.el"
29101;;;;;; (20709 26818 907104 0)) 29131;;;;;; (20884 7264 912957 506000))
29102;;; Generated autoloads from url/url-news.el 29132;;; Generated autoloads from url/url-news.el
29103 29133
29104(autoload 'url-news "url-news" "\ 29134(autoload 'url-news "url-news" "\
@@ -29832,7 +29862,7 @@ mode-specific menu. `vc-annotate-color-map' and
29832 29862
29833;;;*** 29863;;;***
29834 29864
29835;;;### (autoloads nil "vc-arch" "vc/vc-arch.el" (20748 62911 684442 29865;;;### (autoloads nil "vc-arch" "vc/vc-arch.el" (20900 33838 319219
29836;;;;;; 0)) 29866;;;;;; 0))
29837;;; Generated autoloads from vc/vc-arch.el 29867;;; Generated autoloads from vc/vc-arch.el
29838 (defun vc-arch-registered (file) 29868 (defun vc-arch-registered (file)
@@ -29843,8 +29873,8 @@ mode-specific menu. `vc-annotate-color-map' and
29843 29873
29844;;;*** 29874;;;***
29845 29875
29846;;;### (autoloads nil "vc-bzr" "vc/vc-bzr.el" (20856 32310 242920 29876;;;### (autoloads nil "vc-bzr" "vc/vc-bzr.el" (20900 33838 319219
29847;;;;;; 705000)) 29877;;;;;; 0))
29848;;; Generated autoloads from vc/vc-bzr.el 29878;;; Generated autoloads from vc/vc-bzr.el
29849 29879
29850(defconst vc-bzr-admin-dirname ".bzr" "\ 29880(defconst vc-bzr-admin-dirname ".bzr" "\
@@ -29860,7 +29890,7 @@ Name of the format file in a .bzr directory.")
29860 29890
29861;;;*** 29891;;;***
29862 29892
29863;;;### (autoloads nil "vc-cvs" "vc/vc-cvs.el" (20855 45357 683214 29893;;;### (autoloads nil "vc-cvs" "vc/vc-cvs.el" (20900 33838 319219
29864;;;;;; 0)) 29894;;;;;; 0))
29865;;; Generated autoloads from vc/vc-cvs.el 29895;;; Generated autoloads from vc/vc-cvs.el
29866(defun vc-cvs-registered (f) 29896(defun vc-cvs-registered (f)
@@ -29872,49 +29902,10 @@ Name of the format file in a .bzr directory.")
29872 29902
29873;;;*** 29903;;;***
29874 29904
29875;;;### (autoloads (vc-dir vc-dir-mode) "vc-dir" "vc/vc-dir.el" (20709 29905;;;### (autoloads (vc-dir) "vc-dir" "vc/vc-dir.el" (20900 33838 319219
29876;;;;;; 26818 907104 0)) 29906;;;;;; 0))
29877;;; Generated autoloads from vc/vc-dir.el 29907;;; Generated autoloads from vc/vc-dir.el
29878 29908
29879(autoload 'vc-dir-mode "vc-dir" "\
29880Major mode for VC directory buffers.
29881Marking/Unmarking key bindings and actions:
29882m - mark a file/directory
29883 - if the region is active, mark all the files in region.
29884 Restrictions: - a file cannot be marked if any parent directory is marked
29885 - a directory cannot be marked if any child file or
29886 directory is marked
29887u - unmark a file/directory
29888 - if the region is active, unmark all the files in region.
29889M - if the cursor is on a file: mark all the files with the same state as
29890 the current file
29891 - if the cursor is on a directory: mark all child files
29892 - with a prefix argument: mark all files
29893U - if the cursor is on a file: unmark all the files with the same state
29894 as the current file
29895 - if the cursor is on a directory: unmark all child files
29896 - with a prefix argument: unmark all files
29897mouse-2 - toggles the mark state
29898
29899VC commands
29900VC commands in the `C-x v' prefix can be used.
29901VC commands act on the marked entries. If nothing is marked, VC
29902commands act on the current entry.
29903
29904Search & Replace
29905S - searches the marked files
29906Q - does a query replace on the marked files
29907M-s a C-s - does an isearch on the marked files
29908M-s a C-M-s - does a regexp isearch on the marked files
29909If nothing is marked, these commands act on the current entry.
29910When a directory is current or marked, the Search & Replace
29911commands act on the child files of that directory that are displayed in
29912the *vc-dir* buffer.
29913
29914\\{vc-dir-mode-map}
29915
29916\(fn)" t nil)
29917
29918(autoload 'vc-dir "vc-dir" "\ 29909(autoload 'vc-dir "vc-dir" "\
29919Show the VC status for \"interesting\" files in and below DIR. 29910Show the VC status for \"interesting\" files in and below DIR.
29920This allows you to mark files and perform VC operations on them. 29911This allows you to mark files and perform VC operations on them.
@@ -29960,7 +29951,7 @@ case, and the process object in the asynchronous case.
29960 29951
29961;;;*** 29952;;;***
29962 29953
29963;;;### (autoloads nil "vc-git" "vc/vc-git.el" (20855 45357 683214 29954;;;### (autoloads nil "vc-git" "vc/vc-git.el" (20900 33838 319219
29964;;;;;; 0)) 29955;;;;;; 0))
29965;;; Generated autoloads from vc/vc-git.el 29956;;; Generated autoloads from vc/vc-git.el
29966 (defun vc-git-registered (file) 29957 (defun vc-git-registered (file)
@@ -29972,7 +29963,7 @@ case, and the process object in the asynchronous case.
29972 29963
29973;;;*** 29964;;;***
29974 29965
29975;;;### (autoloads nil "vc-hg" "vc/vc-hg.el" (20855 45357 683214 0)) 29966;;;### (autoloads nil "vc-hg" "vc/vc-hg.el" (20900 33838 319219 0))
29976;;; Generated autoloads from vc/vc-hg.el 29967;;; Generated autoloads from vc/vc-hg.el
29977 (defun vc-hg-registered (file) 29968 (defun vc-hg-registered (file)
29978 "Return non-nil if FILE is registered with hg." 29969 "Return non-nil if FILE is registered with hg."
@@ -29983,7 +29974,7 @@ case, and the process object in the asynchronous case.
29983 29974
29984;;;*** 29975;;;***
29985 29976
29986;;;### (autoloads nil "vc-mtn" "vc/vc-mtn.el" (20855 45357 683214 29977;;;### (autoloads nil "vc-mtn" "vc/vc-mtn.el" (20900 33838 319219
29987;;;;;; 0)) 29978;;;;;; 0))
29988;;; Generated autoloads from vc/vc-mtn.el 29979;;; Generated autoloads from vc/vc-mtn.el
29989 29980
@@ -30001,7 +29992,7 @@ Name of the monotone directory's format file.")
30001;;;*** 29992;;;***
30002 29993
30003;;;### (autoloads (vc-rcs-master-templates) "vc-rcs" "vc/vc-rcs.el" 29994;;;### (autoloads (vc-rcs-master-templates) "vc-rcs" "vc/vc-rcs.el"
30004;;;;;; (20855 45357 683214 0)) 29995;;;;;; (20900 33838 319219 0))
30005;;; Generated autoloads from vc/vc-rcs.el 29996;;; Generated autoloads from vc/vc-rcs.el
30006 29997
30007(defvar vc-rcs-master-templates (purecopy '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) "\ 29998(defvar vc-rcs-master-templates (purecopy '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) "\
@@ -30015,7 +30006,7 @@ For a description of possible values, see `vc-check-master-templates'.")
30015;;;*** 30006;;;***
30016 30007
30017;;;### (autoloads (vc-sccs-master-templates) "vc-sccs" "vc/vc-sccs.el" 30008;;;### (autoloads (vc-sccs-master-templates) "vc-sccs" "vc/vc-sccs.el"
30018;;;;;; (20855 45357 683214 0)) 30009;;;;;; (20900 33838 319219 0))
30019;;; Generated autoloads from vc/vc-sccs.el 30010;;; Generated autoloads from vc/vc-sccs.el
30020 30011
30021(defvar vc-sccs-master-templates (purecopy '("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) "\ 30012(defvar vc-sccs-master-templates (purecopy '("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) "\
@@ -30033,7 +30024,7 @@ find any project directory." (let ((project-dir (getenv "PROJECTDIR")) dirs dir)
30033 30024
30034;;;*** 30025;;;***
30035 30026
30036;;;### (autoloads nil "vc-svn" "vc/vc-svn.el" (20855 45357 683214 30027;;;### (autoloads nil "vc-svn" "vc/vc-svn.el" (20900 33838 319219
30037;;;;;; 0)) 30028;;;;;; 0))
30038;;; Generated autoloads from vc/vc-svn.el 30029;;; Generated autoloads from vc/vc-svn.el
30039 (defun vc-svn-registered (f) 30030 (defun vc-svn-registered (f)
@@ -30048,7 +30039,7 @@ find any project directory." (let ((project-dir (getenv "PROJECTDIR")) dirs dir)
30048;;;*** 30039;;;***
30049 30040
30050;;;### (autoloads (vera-mode) "vera-mode" "progmodes/vera-mode.el" 30041;;;### (autoloads (vera-mode) "vera-mode" "progmodes/vera-mode.el"
30051;;;;;; (20777 63161 848428 0)) 30042;;;;;; (20893 60586 188550 0))
30052;;; Generated autoloads from progmodes/vera-mode.el 30043;;; Generated autoloads from progmodes/vera-mode.el
30053 (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'") 'vera-mode)) 30044 (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'") 'vera-mode))
30054 30045
@@ -30106,7 +30097,7 @@ Key bindings:
30106;;;*** 30097;;;***
30107 30098
30108;;;### (autoloads (verilog-mode) "verilog-mode" "progmodes/verilog-mode.el" 30099;;;### (autoloads (verilog-mode) "verilog-mode" "progmodes/verilog-mode.el"
30109;;;;;; (20763 30266 231060 0)) 30100;;;;;; (20885 2819 449152 0))
30110;;; Generated autoloads from progmodes/verilog-mode.el 30101;;; Generated autoloads from progmodes/verilog-mode.el
30111 30102
30112(autoload 'verilog-mode "verilog-mode" "\ 30103(autoload 'verilog-mode "verilog-mode" "\
@@ -30245,7 +30236,7 @@ Key bindings specific to `verilog-mode-map' are:
30245;;;*** 30236;;;***
30246 30237
30247;;;### (autoloads (vhdl-mode) "vhdl-mode" "progmodes/vhdl-mode.el" 30238;;;### (autoloads (vhdl-mode) "vhdl-mode" "progmodes/vhdl-mode.el"
30248;;;;;; (20709 26818 907104 0)) 30239;;;;;; (20892 39729 858825 0))
30249;;; Generated autoloads from progmodes/vhdl-mode.el 30240;;; Generated autoloads from progmodes/vhdl-mode.el
30250 30241
30251(autoload 'vhdl-mode "vhdl-mode" "\ 30242(autoload 'vhdl-mode "vhdl-mode" "\
@@ -30615,7 +30606,7 @@ Usage:
30615 option `vhdl-index-menu' to non-nil) or made accessible as a mouse menu 30606 option `vhdl-index-menu' to non-nil) or made accessible as a mouse menu
30616 (e.g. add \"(global-set-key '[S-down-mouse-3] 'imenu)\" to your start-up 30607 (e.g. add \"(global-set-key '[S-down-mouse-3] 'imenu)\" to your start-up
30617 file) for browsing the file contents (is not populated if buffer is 30608 file) for browsing the file contents (is not populated if buffer is
30618 larger than `font-lock-maximum-size'). Also, a source file menu can be 30609 larger than 256000). Also, a source file menu can be
30619 added (set option `vhdl-source-file-menu' to non-nil) for browsing the 30610 added (set option `vhdl-source-file-menu' to non-nil) for browsing the
30620 current directory for VHDL source files. 30611 current directory for VHDL source files.
30621 30612
@@ -30742,7 +30733,7 @@ Usage:
30742 automatically recognized as VHDL source files. To add an extension 30733 automatically recognized as VHDL source files. To add an extension
30743 \".xxx\", add the following line to your Emacs start-up file (`.emacs'): 30734 \".xxx\", add the following line to your Emacs start-up file (`.emacs'):
30744 30735
30745 (setq auto-mode-alist (cons '(\"\\\\.xxx\\\\'\" . vhdl-mode) auto-mode-alist)) 30736 (push '(\"\\\\.xxx\\\\'\" . vhdl-mode) auto-mode-alist)
30746 30737
30747 30738
30748 HINTS: 30739 HINTS:
@@ -31283,7 +31274,7 @@ this is equivalent to `display-warning', using
31283;;;*** 31274;;;***
31284 31275
31285;;;### (autoloads (wdired-change-to-wdired-mode) "wdired" "wdired.el" 31276;;;### (autoloads (wdired-change-to-wdired-mode) "wdired" "wdired.el"
31286;;;;;; (20791 9657 561026 0)) 31277;;;;;; (20900 33838 319219 0))
31287;;; Generated autoloads from wdired.el 31278;;; Generated autoloads from wdired.el
31288 31279
31289(autoload 'wdired-change-to-wdired-mode "wdired" "\ 31280(autoload 'wdired-change-to-wdired-mode "wdired" "\
@@ -31318,7 +31309,7 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke
31318;;;*** 31309;;;***
31319 31310
31320;;;### (autoloads (which-function-mode) "which-func" "progmodes/which-func.el" 31311;;;### (autoloads (which-function-mode) "which-func" "progmodes/which-func.el"
31321;;;;;; (20725 15032 264919 0)) 31312;;;;;; (20895 15912 444844 0))
31322;;; Generated autoloads from progmodes/which-func.el 31313;;; Generated autoloads from progmodes/which-func.el
31323 (put 'which-func-format 'risky-local-variable t) 31314 (put 'which-func-format 'risky-local-variable t)
31324 (put 'which-func-current 'risky-local-variable t) 31315 (put 'which-func-current 'risky-local-variable t)
@@ -31351,8 +31342,8 @@ in certain major modes.
31351;;;### (autoloads (whitespace-report-region whitespace-report whitespace-cleanup-region 31342;;;### (autoloads (whitespace-report-region whitespace-report whitespace-cleanup-region
31352;;;;;; whitespace-cleanup global-whitespace-toggle-options whitespace-toggle-options 31343;;;;;; whitespace-cleanup global-whitespace-toggle-options whitespace-toggle-options
31353;;;;;; global-whitespace-newline-mode global-whitespace-mode whitespace-newline-mode 31344;;;;;; global-whitespace-newline-mode global-whitespace-mode whitespace-newline-mode
31354;;;;;; whitespace-mode) "whitespace" "whitespace.el" (20831 63016 31345;;;;;; whitespace-mode) "whitespace" "whitespace.el" (20874 65007
31355;;;;;; 738579 0)) 31346;;;;;; 172950 7000))
31356;;; Generated autoloads from whitespace.el 31347;;; Generated autoloads from whitespace.el
31357 31348
31358(autoload 'whitespace-mode "whitespace" "\ 31349(autoload 'whitespace-mode "whitespace" "\
@@ -32065,26 +32056,6 @@ The key bindings are:
32065 32056
32066;;;*** 32057;;;***
32067 32058
32068;;;### (autoloads (xesam-search) "xesam" "net/xesam.el" (20709 26818
32069;;;;;; 907104 0))
32070;;; Generated autoloads from net/xesam.el
32071
32072(autoload 'xesam-search "xesam" "\
32073Perform an interactive search.
32074ENGINE is the Xesam search engine to be applied, it must be one of the
32075entries of `xesam-search-engines'. QUERY is the search string in the
32076Xesam user query language. If the search engine does not support
32077the Xesam user query language, a Xesam fulltext search is applied.
32078
32079The default search engine is the first entry in `xesam-search-engines'.
32080Example:
32081
32082 (xesam-search (car (xesam-search-engines)) \"emacs\")
32083
32084\(fn ENGINE QUERY)" t nil)
32085
32086;;;***
32087
32088;;;### (autoloads (xml-parse-region xml-parse-file) "xml" "xml.el" 32059;;;### (autoloads (xml-parse-region xml-parse-file) "xml" "xml.el"
32089;;;;;; (20766 6456 368550 0)) 32060;;;;;; (20766 6456 368550 0))
32090;;; Generated autoloads from xml.el 32061;;; Generated autoloads from xml.el
@@ -32143,7 +32114,7 @@ Both features can be combined by providing a cons cell
32143;;;*** 32114;;;***
32144 32115
32145;;;### (autoloads (xmltok-get-declared-encoding-position) "xmltok" 32116;;;### (autoloads (xmltok-get-declared-encoding-position) "xmltok"
32146;;;;;; "nxml/xmltok.el" (20709 26818 907104 0)) 32117;;;;;; "nxml/xmltok.el" (20884 6711 386198 0))
32147;;; Generated autoloads from nxml/xmltok.el 32118;;; Generated autoloads from nxml/xmltok.el
32148 32119
32149(autoload 'xmltok-get-declared-encoding-position "xmltok" "\ 32120(autoload 'xmltok-get-declared-encoding-position "xmltok" "\
@@ -32300,46 +32271,46 @@ Zone out, completely.
32300;;;;;; "emacs-lisp/eieio-base.el" "emacs-lisp/eieio-datadebug.el" 32271;;;;;; "emacs-lisp/eieio-base.el" "emacs-lisp/eieio-datadebug.el"
32301;;;;;; "emacs-lisp/eieio-speedbar.el" "emacs-lisp/eieio.el" "emacs-lisp/find-gc.el" 32272;;;;;; "emacs-lisp/eieio-speedbar.el" "emacs-lisp/eieio.el" "emacs-lisp/find-gc.el"
32302;;;;;; "emacs-lisp/gulp.el" "emacs-lisp/lisp-mnt.el" "emacs-lisp/package-x.el" 32273;;;;;; "emacs-lisp/gulp.el" "emacs-lisp/lisp-mnt.el" "emacs-lisp/package-x.el"
32303;;;;;; "emacs-lisp/regi.el" "emacs-lisp/smie.el" "emacs-lisp/tcover-ses.el" 32274;;;;;; "emacs-lisp/regi.el" "emacs-lisp/tcover-ses.el" "emacs-lisp/tcover-unsafep.el"
32304;;;;;; "emacs-lisp/tcover-unsafep.el" "emulation/cua-gmrk.el" "emulation/cua-rect.el" 32275;;;;;; "emulation/cua-gmrk.el" "emulation/cua-rect.el" "emulation/edt-lk201.el"
32305;;;;;; "emulation/edt-lk201.el" "emulation/edt-mapper.el" "emulation/edt-pc.el" 32276;;;;;; "emulation/edt-mapper.el" "emulation/edt-pc.el" "emulation/edt-vt100.el"
32306;;;;;; "emulation/edt-vt100.el" "emulation/tpu-extras.el" "emulation/viper-cmd.el" 32277;;;;;; "emulation/tpu-extras.el" "emulation/viper-cmd.el" "emulation/viper-ex.el"
32307;;;;;; "emulation/viper-ex.el" "emulation/viper-init.el" "emulation/viper-keym.el" 32278;;;;;; "emulation/viper-init.el" "emulation/viper-keym.el" "emulation/viper-macs.el"
32308;;;;;; "emulation/viper-macs.el" "emulation/viper-mous.el" "emulation/viper-util.el" 32279;;;;;; "emulation/viper-mous.el" "emulation/viper-util.el" "erc/erc-backend.el"
32309;;;;;; "erc/erc-backend.el" "erc/erc-goodies.el" "erc/erc-ibuffer.el" 32280;;;;;; "erc/erc-goodies.el" "erc/erc-ibuffer.el" "erc/erc-lang.el"
32310;;;;;; "erc/erc-lang.el" "eshell/em-alias.el" "eshell/em-banner.el" 32281;;;;;; "eshell/em-alias.el" "eshell/em-banner.el" "eshell/em-basic.el"
32311;;;;;; "eshell/em-basic.el" "eshell/em-cmpl.el" "eshell/em-dirs.el" 32282;;;;;; "eshell/em-cmpl.el" "eshell/em-dirs.el" "eshell/em-glob.el"
32312;;;;;; "eshell/em-glob.el" "eshell/em-hist.el" "eshell/em-ls.el" 32283;;;;;; "eshell/em-hist.el" "eshell/em-ls.el" "eshell/em-pred.el"
32313;;;;;; "eshell/em-pred.el" "eshell/em-prompt.el" "eshell/em-rebind.el" 32284;;;;;; "eshell/em-prompt.el" "eshell/em-rebind.el" "eshell/em-script.el"
32314;;;;;; "eshell/em-script.el" "eshell/em-smart.el" "eshell/em-term.el" 32285;;;;;; "eshell/em-smart.el" "eshell/em-term.el" "eshell/em-tramp.el"
32315;;;;;; "eshell/em-tramp.el" "eshell/em-unix.el" "eshell/em-xtra.el" 32286;;;;;; "eshell/em-unix.el" "eshell/em-xtra.el" "eshell/esh-arg.el"
32316;;;;;; "eshell/esh-arg.el" "eshell/esh-cmd.el" "eshell/esh-ext.el" 32287;;;;;; "eshell/esh-cmd.el" "eshell/esh-ext.el" "eshell/esh-groups.el"
32317;;;;;; "eshell/esh-groups.el" "eshell/esh-io.el" "eshell/esh-module.el" 32288;;;;;; "eshell/esh-io.el" "eshell/esh-module.el" "eshell/esh-opt.el"
32318;;;;;; "eshell/esh-opt.el" "eshell/esh-proc.el" "eshell/esh-util.el" 32289;;;;;; "eshell/esh-proc.el" "eshell/esh-util.el" "eshell/esh-var.el"
32319;;;;;; "eshell/esh-var.el" "ezimage.el" "foldout.el" "format-spec.el" 32290;;;;;; "ezimage.el" "foldout.el" "format-spec.el" "fringe.el" "generic-x.el"
32320;;;;;; "fringe.el" "generic-x.el" "gnus/compface.el" "gnus/gnus-async.el" 32291;;;;;; "gnus/compface.el" "gnus/gnus-async.el" "gnus/gnus-bcklg.el"
32321;;;;;; "gnus/gnus-bcklg.el" "gnus/gnus-cite.el" "gnus/gnus-cus.el" 32292;;;;;; "gnus/gnus-cite.el" "gnus/gnus-cus.el" "gnus/gnus-demon.el"
32322;;;;;; "gnus/gnus-demon.el" "gnus/gnus-dup.el" "gnus/gnus-eform.el" 32293;;;;;; "gnus/gnus-dup.el" "gnus/gnus-eform.el" "gnus/gnus-ems.el"
32323;;;;;; "gnus/gnus-ems.el" "gnus/gnus-int.el" "gnus/gnus-logic.el" 32294;;;;;; "gnus/gnus-int.el" "gnus/gnus-logic.el" "gnus/gnus-mh.el"
32324;;;;;; "gnus/gnus-mh.el" "gnus/gnus-salt.el" "gnus/gnus-score.el" 32295;;;;;; "gnus/gnus-salt.el" "gnus/gnus-score.el" "gnus/gnus-setup.el"
32325;;;;;; "gnus/gnus-setup.el" "gnus/gnus-srvr.el" "gnus/gnus-topic.el" 32296;;;;;; "gnus/gnus-srvr.el" "gnus/gnus-topic.el" "gnus/gnus-undo.el"
32326;;;;;; "gnus/gnus-undo.el" "gnus/gnus-util.el" "gnus/gnus-uu.el" 32297;;;;;; "gnus/gnus-util.el" "gnus/gnus-uu.el" "gnus/gnus-vm.el" "gnus/gssapi.el"
32327;;;;;; "gnus/gnus-vm.el" "gnus/gssapi.el" "gnus/ietf-drums.el" "gnus/legacy-gnus-agent.el" 32298;;;;;; "gnus/ietf-drums.el" "gnus/legacy-gnus-agent.el" "gnus/mail-parse.el"
32328;;;;;; "gnus/mail-parse.el" "gnus/mail-prsvr.el" "gnus/mail-source.el" 32299;;;;;; "gnus/mail-prsvr.el" "gnus/mail-source.el" "gnus/mailcap.el"
32329;;;;;; "gnus/mailcap.el" "gnus/messcompat.el" "gnus/mm-archive.el" 32300;;;;;; "gnus/messcompat.el" "gnus/mm-archive.el" "gnus/mm-bodies.el"
32330;;;;;; "gnus/mm-bodies.el" "gnus/mm-decode.el" "gnus/mm-util.el" 32301;;;;;; "gnus/mm-decode.el" "gnus/mm-util.el" "gnus/mm-view.el" "gnus/mml-sec.el"
32331;;;;;; "gnus/mm-view.el" "gnus/mml-sec.el" "gnus/mml-smime.el" "gnus/nnagent.el" 32302;;;;;; "gnus/mml-smime.el" "gnus/nnagent.el" "gnus/nnbabyl.el" "gnus/nndir.el"
32332;;;;;; "gnus/nnbabyl.el" "gnus/nndir.el" "gnus/nndraft.el" "gnus/nneething.el" 32303;;;;;; "gnus/nndraft.el" "gnus/nneething.el" "gnus/nngateway.el"
32333;;;;;; "gnus/nngateway.el" "gnus/nnheader.el" "gnus/nnimap.el" "gnus/nnir.el" 32304;;;;;; "gnus/nnheader.el" "gnus/nnimap.el" "gnus/nnir.el" "gnus/nnmail.el"
32334;;;;;; "gnus/nnmail.el" "gnus/nnmaildir.el" "gnus/nnmairix.el" "gnus/nnmbox.el" 32305;;;;;; "gnus/nnmaildir.el" "gnus/nnmairix.el" "gnus/nnmbox.el" "gnus/nnmh.el"
32335;;;;;; "gnus/nnmh.el" "gnus/nnnil.el" "gnus/nnoo.el" "gnus/nnregistry.el" 32306;;;;;; "gnus/nnnil.el" "gnus/nnoo.el" "gnus/nnregistry.el" "gnus/nnrss.el"
32336;;;;;; "gnus/nnrss.el" "gnus/nnspool.el" "gnus/nntp.el" "gnus/nnvirtual.el" 32307;;;;;; "gnus/nnspool.el" "gnus/nntp.el" "gnus/nnvirtual.el" "gnus/nnweb.el"
32337;;;;;; "gnus/nnweb.el" "gnus/registry.el" "gnus/rfc1843.el" "gnus/rfc2045.el" 32308;;;;;; "gnus/registry.el" "gnus/rfc1843.el" "gnus/rfc2045.el" "gnus/rfc2047.el"
32338;;;;;; "gnus/rfc2047.el" "gnus/rfc2104.el" "gnus/rfc2231.el" "gnus/rtree.el" 32309;;;;;; "gnus/rfc2104.el" "gnus/rfc2231.el" "gnus/rtree.el" "gnus/shr-color.el"
32339;;;;;; "gnus/shr-color.el" "gnus/sieve-manage.el" "gnus/smime.el" 32310;;;;;; "gnus/sieve-manage.el" "gnus/smime.el" "gnus/spam-stat.el"
32340;;;;;; "gnus/spam-stat.el" "gnus/spam-wash.el" "hex-util.el" "hfy-cmap.el" 32311;;;;;; "gnus/spam-wash.el" "hex-util.el" "hfy-cmap.el" "ibuf-ext.el"
32341;;;;;; "ibuf-ext.el" "international/cp51932.el" "international/eucjp-ms.el" 32312;;;;;; "international/cp51932.el" "international/eucjp-ms.el" "international/fontset.el"
32342;;;;;; "international/fontset.el" "international/iso-ascii.el" "international/ja-dic-cnv.el" 32313;;;;;; "international/iso-ascii.el" "international/ja-dic-cnv.el"
32343;;;;;; "international/ja-dic-utl.el" "international/ogonek.el" "international/uni-bidi.el" 32314;;;;;; "international/ja-dic-utl.el" "international/ogonek.el" "international/uni-bidi.el"
32344;;;;;; "international/uni-category.el" "international/uni-combining.el" 32315;;;;;; "international/uni-category.el" "international/uni-combining.el"
32345;;;;;; "international/uni-comment.el" "international/uni-decimal.el" 32316;;;;;; "international/uni-comment.el" "international/uni-decimal.el"
@@ -32427,8 +32398,8 @@ Zone out, completely.
32427;;;;;; "vc/ediff-ptch.el" "vc/ediff-vers.el" "vc/ediff-wind.el" 32398;;;;;; "vc/ediff-ptch.el" "vc/ediff-vers.el" "vc/ediff-wind.el"
32428;;;;;; "vc/pcvs-info.el" "vc/pcvs-parse.el" "vc/pcvs-util.el" "vc/vc-dav.el" 32399;;;;;; "vc/pcvs-info.el" "vc/pcvs-parse.el" "vc/pcvs-util.el" "vc/vc-dav.el"
32429;;;;;; "vcursor.el" "vt-control.el" "vt100-led.el" "w32-common-fns.el" 32400;;;;;; "vcursor.el" "vt-control.el" "vt100-led.el" "w32-common-fns.el"
32430;;;;;; "w32-fns.el" "w32-vars.el" "x-dnd.el") (20864 60345 274595 32401;;;;;; "w32-fns.el" "w32-vars.el" "x-dnd.el") (20905 51795 339257
32431;;;;;; 113000)) 32402;;;;;; 114000))
32432 32403
32433;;;*** 32404;;;***
32434 32405
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 5764cdec7eb..7fb9526b360 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -210,6 +210,7 @@
210(load "textmodes/page") 210(load "textmodes/page")
211(load "register") 211(load "register")
212(load "textmodes/paragraphs") 212(load "textmodes/paragraphs")
213(load "progmodes/prog-mode")
213(load "emacs-lisp/lisp-mode") 214(load "emacs-lisp/lisp-mode")
214(load "textmodes/text-mode") 215(load "textmodes/text-mode")
215(load "textmodes/fill") 216(load "textmodes/fill")
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a5d79a415f6..8bcf3afae05 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1796,6 +1796,14 @@ exit."
1796 (cl-assert (<= start (point)) (<= (point) end)) 1796 (cl-assert (<= start (point)) (<= (point) end))
1797 (funcall completion-in-region-function start end collection predicate)) 1797 (funcall completion-in-region-function start end collection predicate))
1798 1798
1799(defcustom read-file-name-completion-ignore-case
1800 (if (memq system-type '(ms-dos windows-nt darwin cygwin))
1801 t nil)
1802 "Non-nil means when reading a file name completion ignores case."
1803 :group 'minibuffer
1804 :type 'boolean
1805 :version "22.1")
1806
1799(defun completion--in-region (start end collection &optional predicate) 1807(defun completion--in-region (start end collection &optional predicate)
1800 (with-wrapper-hook 1808 (with-wrapper-hook
1801 ;; FIXME: Maybe we should use this hook to provide a "display 1809 ;; FIXME: Maybe we should use this hook to provide a "display
@@ -2268,14 +2276,6 @@ except that it passes the file name through `substitute-in-file-name'.")
2268 "The function called by `read-file-name' to do its work. 2276 "The function called by `read-file-name' to do its work.
2269It should accept the same arguments as `read-file-name'.") 2277It should accept the same arguments as `read-file-name'.")
2270 2278
2271(defcustom read-file-name-completion-ignore-case
2272 (if (memq system-type '(ms-dos windows-nt darwin cygwin))
2273 t nil)
2274 "Non-nil means when reading a file name completion ignores case."
2275 :group 'minibuffer
2276 :type 'boolean
2277 :version "22.1")
2278
2279(defcustom insert-default-directory t 2279(defcustom insert-default-directory t
2280 "Non-nil means when reading a filename start with default dir in minibuffer. 2280 "Non-nil means when reading a filename start with default dir in minibuffer.
2281 2281
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index 9a6c7b124c7..810d8963ce2 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -497,7 +497,7 @@ If your system's ping continues until interrupted, you can try setting
497 497
498(defvar nslookup-mode-map 498(defvar nslookup-mode-map
499 (let ((map (make-sparse-keymap))) 499 (let ((map (make-sparse-keymap)))
500 (define-key map "\t" 'comint-dynamic-complete) 500 (define-key map "\t" 'completion-at-point)
501 map)) 501 map))
502 502
503;; Using a derived mode gives us keymaps, hooks, etc. 503;; Using a derived mode gives us keymaps, hooks, etc.
@@ -567,7 +567,7 @@ If your system's ping continues until interrupted, you can try setting
567(defvar ftp-mode-map 567(defvar ftp-mode-map
568 (let ((map (make-sparse-keymap))) 568 (let ((map (make-sparse-keymap)))
569 ;; Occasionally useful 569 ;; Occasionally useful
570 (define-key map "\t" 'comint-dynamic-complete) 570 (define-key map "\t" 'completion-at-point)
571 map)) 571 map))
572 572
573(define-derived-mode ftp-mode comint-mode "FTP" 573(define-derived-mode ftp-mode comint-mode "FTP"
diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el
index 9ad79d694f8..e8d13254557 100644
--- a/lisp/net/rlogin.el
+++ b/lisp/net/rlogin.el
@@ -36,6 +36,11 @@
36 36
37;;; Code: 37;;; Code:
38 38
39;; FIXME?
40;; Maybe this file should be obsolete.
41;; http://lists.gnu.org/archive/html/emacs-devel/2013-02/msg00517.html
42;; It only adds rlogin-directory-tracking-mode. Is that useful?
43
39(require 'comint) 44(require 'comint)
40(require 'shell) 45(require 'shell)
41 46
@@ -44,13 +49,15 @@
44 :group 'processes 49 :group 'processes
45 :group 'unix) 50 :group 'unix)
46 51
47(defcustom rlogin-program "rlogin" 52(defcustom rlogin-program "ssh"
48 "Name of program to invoke rlogin" 53 "Name of program to invoke remote login."
54 :version "24.4" ; rlogin -> ssh
49 :type 'string 55 :type 'string
50 :group 'rlogin) 56 :group 'rlogin)
51 57
52(defcustom rlogin-explicit-args nil 58(defcustom rlogin-explicit-args '("-t" "-t")
53 "List of arguments to pass to rlogin on the command line." 59 "List of arguments to pass to `rlogin-program' on the command line."
60 :version "24.4" ; nil -> -t -t
54 :type '(repeat (string :tag "Argument")) 61 :type '(repeat (string :tag "Argument"))
55 :group 'rlogin) 62 :group 'rlogin)
56 63
@@ -62,13 +69,15 @@
62(defcustom rlogin-process-connection-type 69(defcustom rlogin-process-connection-type
63 ;; Solaris 2.x `rlogin' will spew a bunch of ioctl error messages if 70 ;; Solaris 2.x `rlogin' will spew a bunch of ioctl error messages if
64 ;; stdin isn't a tty. 71 ;; stdin isn't a tty.
65 (and (string-match-p "-solaris2" system-configuration) t) 72 (and (string-match "rlogin" rlogin-program)
73 (string-match-p "-solaris2" system-configuration) t)
66 "If non-nil, use a pty for the local rlogin process. 74 "If non-nil, use a pty for the local rlogin process.
67If nil, use a pipe (if pipes are supported on the local system). 75If nil, use a pipe (if pipes are supported on the local system).
68 76
69Generally it is better not to waste ptys on systems which have a static 77Generally it is better not to waste ptys on systems which have a static
70number of them. On the other hand, some implementations of `rlogin' assume 78number of them. On the other hand, some implementations of `rlogin' assume
71a pty is being used, and errors will result from using a pipe instead." 79a pty is being used, and errors will result from using a pipe instead."
80 :set-after '(rlogin-program)
72 :type '(choice (const :tag "pipes" nil) 81 :type '(choice (const :tag "pipes" nil)
73 (other :tag "ptys" t)) 82 (other :tag "ptys" t))
74 :group 'rlogin) 83 :group 'rlogin)
@@ -98,7 +107,7 @@ re-synching of directories."
98(make-variable-buffer-local 'rlogin-directory-tracking-mode) 107(make-variable-buffer-local 'rlogin-directory-tracking-mode)
99 108
100(defcustom rlogin-host nil 109(defcustom rlogin-host nil
101 "The name of the remote host. This variable is buffer-local." 110 "The name of the default remote host. This variable is buffer-local."
102 :type '(choice (const nil) string) 111 :type '(choice (const nil) string)
103 :group 'rlogin) 112 :group 'rlogin)
104 113
@@ -165,7 +174,9 @@ If you wish to change directory tracking styles during a session, use the
165function `rlogin-directory-tracking-mode' rather than simply setting the 174function `rlogin-directory-tracking-mode' rather than simply setting the
166variable." 175variable."
167 (interactive (list 176 (interactive (list
168 (read-from-minibuffer "rlogin arguments (hostname first): " 177 (read-from-minibuffer (format
178 "Arguments for `%s' (hostname first): "
179 (file-name-nondirectory rlogin-program))
169 nil nil nil 'rlogin-history) 180 nil nil nil 'rlogin-history)
170 current-prefix-arg)) 181 current-prefix-arg))
171 (let* ((process-connection-type rlogin-process-connection-type) 182 (let* ((process-connection-type rlogin-process-connection-type)
@@ -297,7 +308,7 @@ local one share the same directories (e.g. through NFS)."
297 "Complete file name if doing directory tracking, or just insert TAB." 308 "Complete file name if doing directory tracking, or just insert TAB."
298 (interactive) 309 (interactive)
299 (if rlogin-directory-tracking-mode 310 (if rlogin-directory-tracking-mode
300 (comint-dynamic-complete) 311 (completion-at-point)
301 (insert "\C-i"))) 312 (insert "\C-i")))
302 313
303(provide 'rlogin) 314(provide 'rlogin)
diff --git a/lisp/net/tls.el b/lisp/net/tls.el
index 7fc314ef088..3d8d8decf47 100644
--- a/lisp/net/tls.el
+++ b/lisp/net/tls.el
@@ -286,7 +286,10 @@ NOT trusted. Accept anyway? " host)))))
286 (format "Host name in certificate doesn't \ 286 (format "Host name in certificate doesn't \
287match `%s'. Connect anyway? " host)))))) 287match `%s'. Connect anyway? " host))))))
288 (setq done nil) 288 (setq done nil)
289 (delete-process process))) 289 (delete-process process))
290 ;; Delete all the informational messages that could confuse
291 ;; future uses of `buffer'.
292 (delete-region (point-min) (point)))
290 (message "Opening TLS connection to `%s'...%s" 293 (message "Opening TLS connection to `%s'...%s"
291 host (if done "done" "failed")) 294 host (if done "done" "failed"))
292 (when use-temp-buffer 295 (when use-temp-buffer
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index e10b96f97f9..bcb5f721ae8 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -485,29 +485,27 @@ and raises an error or returns nil if NOERROR is non-nil."
485Moves point to inside the comment and returns the position of the 485Moves point to inside the comment and returns the position of the
486comment-starter. If no comment is found, moves point to LIMIT 486comment-starter. If no comment is found, moves point to LIMIT
487and raises an error or returns nil if NOERROR is non-nil." 487and raises an error or returns nil if NOERROR is non-nil."
488 (let (found end) 488 ;; FIXME: If a comment-start appears inside a comment, we may erroneously
489 (while (and (not found) 489 ;; stop there. This can be rather bad in general, but since
490 (re-search-backward comment-start-skip limit t)) 490 ;; comment-search-backward is only used to find the comment-column (in
491 (setq end (match-end 0)) 491 ;; comment-set-column) and to find the comment-start string (via
492 (unless (and comment-use-syntax 492 ;; comment-beginning) in indent-new-comment-line, it should be harmless.
493 (nth 8 (syntax-ppss (or (match-end 1) 493 (if (not (re-search-backward comment-start-skip limit t))
494 (match-beginning 0))))) 494 (unless noerror (error "No comment"))
495 (setq found t))) 495 (beginning-of-line)
496 (if (not found) 496 (let* ((end (match-end 0))
497 (unless noerror (error "No comment")) 497 (cs (comment-search-forward end t))
498 (beginning-of-line) 498 (pt (point)))
499 (let ((cs (comment-search-forward end t)) 499 (if (not cs)
500 (pt (point))) 500 (progn (beginning-of-line)
501 (if (not cs) 501 (comment-search-backward limit noerror))
502 (progn (beginning-of-line) 502 (while (progn (goto-char cs)
503 (comment-search-backward limit noerror)) 503 (comment-forward)
504 (while (progn (goto-char cs) 504 (and (< (point) end)
505 (comment-forward) 505 (setq cs (comment-search-forward end t))))
506 (and (< (point) end) 506 (setq pt (point)))
507 (setq cs (comment-search-forward end t)))) 507 (goto-char pt)
508 (setq pt (point))) 508 cs))))
509 (goto-char pt)
510 cs)))))
511 509
512(defun comment-beginning () 510(defun comment-beginning ()
513 "Find the beginning of the enclosing comment. 511 "Find the beginning of the enclosing comment.
diff --git a/lisp/obsolete/sym-comp.el b/lisp/obsolete/sym-comp.el
index 4641ca68544..bd049b85aa2 100644
--- a/lisp/obsolete/sym-comp.el
+++ b/lisp/obsolete/sym-comp.el
@@ -139,12 +139,13 @@ to be set buffer-locally. Variables `symbol-completion-symbol-function',
139 pattern)) 139 pattern))
140 ;; In case the transform needs to access it. 140 ;; In case the transform needs to access it.
141 (symbol-completion-predicate predicate) 141 (symbol-completion-predicate predicate)
142 (completion-annotate-function 142 (completion-extra-properties
143 (if (functionp symbol-completion-transform-function) 143 (if (functionp symbol-completion-transform-function)
144 (lambda (str) 144 '(:annotation-function
145 (car-safe (cdr-safe 145 (lambda (str)
146 (funcall symbol-completion-transform-function 146 (car-safe (cdr-safe
147 str))))))) 147 (funcall symbol-completion-transform-function
148 str))))))))
148 (completion-in-region (- (point) (length pattern)) (point) 149 (completion-in-region (- (point) (length pattern)) (point)
149 completions predicate))) 150 completions predicate)))
150 151
diff --git a/lisp/paren.el b/lisp/paren.el
index a9d3be60622..6f386573b01 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -37,11 +37,6 @@
37 :prefix "show-paren-" 37 :prefix "show-paren-"
38 :group 'paren-matching) 38 :group 'paren-matching)
39 39
40;; This is the overlay used to highlight the matching paren.
41(defvar show-paren-overlay nil)
42;; This is the overlay used to highlight the closeparen right before point.
43(defvar show-paren-overlay-1 nil)
44
45(defcustom show-paren-style 'parenthesis 40(defcustom show-paren-style 'parenthesis
46 "Style used when showing a matching paren. 41 "Style used when showing a matching paren.
47Valid styles are `parenthesis' (meaning show the matching paren), 42Valid styles are `parenthesis' (meaning show the matching paren),
@@ -107,7 +102,14 @@ active, you must toggle the mode off and on again for this to take effect."
107(defvar show-paren-highlight-openparen t 102(defvar show-paren-highlight-openparen t
108 "Non-nil turns on openparen highlighting when matching forward.") 103 "Non-nil turns on openparen highlighting when matching forward.")
109 104
110(defvar show-paren-idle-timer nil) 105(defvar show-paren--idle-timer nil)
106(defvar show-paren--overlay
107 (let ((ol (make-overlay (point) (point) nil t))) (delete-overlay ol) ol)
108 "Overlay used to highlight the matching paren.")
109(defvar show-paren--overlay-1
110 (let ((ol (make-overlay (point) (point) nil t))) (delete-overlay ol) ol)
111 "Overlay used to highlight the paren at point.")
112
111 113
112;;;###autoload 114;;;###autoload
113(define-minor-mode show-paren-mode 115(define-minor-mode show-paren-mode
@@ -120,154 +122,148 @@ Show Paren mode is a global minor mode. When enabled, any
120matching parenthesis is highlighted in `show-paren-style' after 122matching parenthesis is highlighted in `show-paren-style' after
121`show-paren-delay' seconds of Emacs idle time." 123`show-paren-delay' seconds of Emacs idle time."
122 :global t :group 'paren-showing 124 :global t :group 'paren-showing
123 ;; Enable or disable the mechanism. 125 ;; Enable or disable the mechanism.
124 ;; First get rid of the old idle timer. 126 ;; First get rid of the old idle timer.
125 (if show-paren-idle-timer 127 (when show-paren--idle-timer
126 (cancel-timer show-paren-idle-timer)) 128 (cancel-timer show-paren--idle-timer)
127 (setq show-paren-idle-timer nil) 129 (setq show-paren--idle-timer nil))
128 ;; If show-paren-mode is enabled in some buffer now, 130 (setq show-paren--idle-timer (run-with-idle-timer
129 ;; set up a new timer. 131 show-paren-delay t
130 (when (memq t (mapcar (lambda (buffer) 132 #'show-paren-function))
131 (with-current-buffer buffer 133 (unless show-paren-mode
132 show-paren-mode)) 134 (delete-overlay show-paren--overlay)
133 (buffer-list))) 135 (delete-overlay show-paren--overlay-1)))
134 (setq show-paren-idle-timer (run-with-idle-timer 136
135 show-paren-delay t 137(defvar show-paren-data-function #'show-paren--default
136 'show-paren-function))) 138 "Function to find the opener/closer at point and its match.
137 (unless show-paren-mode 139The function is called with no argument and should return either nil
138 (and show-paren-overlay 140if there's no opener/closer at point, or a list of the form
139 (eq (overlay-buffer show-paren-overlay) (current-buffer)) 141\(HERE-BEG HERE-END THERE-BEG THERE-END MISMATCH)
140 (delete-overlay show-paren-overlay)) 142Where HERE-BEG..HERE-END is expected to be around point.")
141 (and show-paren-overlay-1 143
142 (eq (overlay-buffer show-paren-overlay-1) (current-buffer)) 144(defun show-paren--default ()
143 (delete-overlay show-paren-overlay-1)))) 145 (let* ((oldpos (point))
146 (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1)
147 ((eq (syntax-class (syntax-after (point))) 4) 1)))
148 (unescaped
149 (when dir
150 ;; Verify an even number of quoting characters precede the paren.
151 ;; Follow the same logic as in `blink-matching-open'.
152 (= (if (= dir -1) 1 0)
153 (logand 1 (- (point)
154 (save-excursion
155 (if (= dir -1) (forward-char -1))
156 (skip-syntax-backward "/\\")
157 (point)))))))
158 (here-beg (if (eq dir 1) (point) (1- (point))))
159 (here-end (if (eq dir 1) (1+ (point)) (point)))
160 pos mismatch)
161 ;;
162 ;; Find the other end of the sexp.
163 (when unescaped
164 (save-excursion
165 (save-restriction
166 ;; Determine the range within which to look for a match.
167 (when blink-matching-paren-distance
168 (narrow-to-region
169 (max (point-min) (- (point) blink-matching-paren-distance))
170 (min (point-max) (+ (point) blink-matching-paren-distance))))
171 ;; Scan across one sexp within that range.
172 ;; Errors or nil mean there is a mismatch.
173 (condition-case ()
174 (setq pos (scan-sexps (point) dir))
175 (error (setq pos t mismatch t)))
176 ;; Move back the other way and verify we get back to the
177 ;; starting point. If not, these two parens don't really match.
178 ;; Maybe the one at point is escaped and doesn't really count,
179 ;; or one is inside a comment.
180 (when (integerp pos)
181 (unless (condition-case ()
182 (eq (point) (scan-sexps pos (- dir)))
183 (error nil))
184 (setq pos nil)))
185 ;; If found a "matching" paren, see if it is the right
186 ;; kind of paren to match the one we started at.
187 (if (not (integerp pos))
188 (if mismatch (list here-beg here-end nil nil t))
189 (let ((beg (min pos oldpos)) (end (max pos oldpos)))
190 (unless (eq (syntax-class (syntax-after beg)) 8)
191 (setq mismatch
192 (not (or (eq (char-before end)
193 ;; This can give nil.
194 (cdr (syntax-after beg)))
195 (eq (char-after beg)
196 ;; This can give nil.
197 (cdr (syntax-after (1- end))))
198 ;; The cdr might hold a new paren-class
199 ;; info rather than a matching-char info,
200 ;; in which case the two CDRs should match.
201 (eq (cdr (syntax-after (1- end)))
202 (cdr (syntax-after beg)))))))
203 (list here-beg here-end
204 (if (= dir 1) (1- pos) pos)
205 (if (= dir 1) pos (1+ pos))
206 mismatch))))))))
144 207
145;; Find the place to show, if there is one, 208;; Find the place to show, if there is one,
146;; and show it until input arrives. 209;; and show it until input arrives.
147(defun show-paren-function () 210(defun show-paren-function ()
148 (if show-paren-mode 211 (let ((data (and show-paren-mode (funcall show-paren-data-function))))
149 (let* ((oldpos (point)) 212 (if (not data)
150 (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1) 213 (progn
151 ((eq (syntax-class (syntax-after (point))) 4) 1))) 214 ;; If show-paren-mode is nil in this buffer or if not at a paren that
152 (unescaped 215 ;; has a match, turn off any previous paren highlighting.
153 (when dir 216 (delete-overlay show-paren--overlay)
154 ;; Verify an even number of quoting characters precede the paren. 217 (delete-overlay show-paren--overlay-1))
155 ;; Follow the same logic as in `blink-matching-open'. 218
156 (= (if (= dir -1) 1 0) 219 ;; Found something to highlight.
157 (logand 1 (- (point) 220 (let* ((here-beg (nth 0 data))
158 (save-excursion 221 (here-end (nth 1 data))
159 (if (= dir -1) (forward-char -1)) 222 (there-beg (nth 2 data))
160 (skip-syntax-backward "/\\") 223 (there-end (nth 3 data))
161 (point))))))) 224 (mismatch (nth 4 data))
162 pos mismatch face) 225 (face
163 ;; 226 (if mismatch
164 ;; Find the other end of the sexp. 227 (progn
165 (when unescaped 228 (if show-paren-ring-bell-on-mismatch
166 (save-excursion 229 (beep))
167 (save-restriction 230 'show-paren-mismatch)
168 ;; Determine the range within which to look for a match. 231 'show-paren-match)))
169 (when blink-matching-paren-distance 232 ;;
170 (narrow-to-region 233 ;; If matching backwards, highlight the closeparen
171 (max (point-min) (- (point) blink-matching-paren-distance)) 234 ;; before point as well as its matching open.
172 (min (point-max) (+ (point) blink-matching-paren-distance)))) 235 ;; If matching forward, and the openparen is unbalanced,
173 ;; Scan across one sexp within that range. 236 ;; highlight the paren at point to indicate misbalance.
174 ;; Errors or nil mean there is a mismatch. 237 ;; Otherwise, turn off any such highlighting.
175 (condition-case () 238 (if (or (not here-beg)
176 (setq pos (scan-sexps (point) dir)) 239 (and (not show-paren-highlight-openparen)
177 (error (setq pos t mismatch t))) 240 (> here-end (point))
178 ;; Move back the other way and verify we get back to the 241 (integerp there-beg)))
179 ;; starting point. If not, these two parens don't really match. 242 (delete-overlay show-paren--overlay-1)
180 ;; Maybe the one at point is escaped and doesn't really count. 243 (move-overlay show-paren--overlay-1
181 (when (integerp pos) 244 here-beg here-end (current-buffer))
182 (unless (condition-case () 245 ;; Always set the overlay face, since it varies.
183 (eq (point) (scan-sexps pos (- dir))) 246 (overlay-put show-paren--overlay-1 'priority show-paren-priority)
184 (error nil)) 247 (overlay-put show-paren--overlay-1 'face face))
185 (setq pos nil))) 248 ;;
186 ;; If found a "matching" paren, see if it is the right 249 ;; Turn on highlighting for the matching paren, if found.
187 ;; kind of paren to match the one we started at. 250 ;; If it's an unmatched paren, turn off any such highlighting.
188 (when (integerp pos) 251 (if (not there-beg)
189 (let ((beg (min pos oldpos)) (end (max pos oldpos))) 252 (delete-overlay show-paren--overlay)
190 (unless (eq (syntax-class (syntax-after beg)) 8) 253 (if (or (eq show-paren-style 'expression)
191 (setq mismatch 254 (and (eq show-paren-style 'mixed)
192 (not (or (eq (char-before end) 255 (let ((closest (if (< there-beg here-beg)
193 ;; This can give nil. 256 (1- there-end) (1+ there-beg))))
194 (cdr (syntax-after beg))) 257 (not (pos-visible-in-window-p closest)))))
195 (eq (char-after beg) 258 (move-overlay show-paren--overlay
196 ;; This can give nil. 259 (point)
197 (cdr (syntax-after (1- end)))) 260 (if (< there-beg here-beg) there-beg there-end)
198 ;; The cdr might hold a new paren-class 261 (current-buffer))
199 ;; info rather than a matching-char info, 262 (move-overlay show-paren--overlay
200 ;; in which case the two CDRs should match. 263 there-beg there-end (current-buffer)))
201 (eq (cdr (syntax-after (1- end))) 264 ;; Always set the overlay face, since it varies.
202 (cdr (syntax-after beg)))))))))))) 265 (overlay-put show-paren--overlay 'priority show-paren-priority)
203 ;; 266 (overlay-put show-paren--overlay 'face face))))))
204 ;; Highlight the other end of the sexp, or unhighlight if none.
205 (if (not pos)
206 (progn
207 ;; If not at a paren that has a match,
208 ;; turn off any previous paren highlighting.
209 (and show-paren-overlay (overlay-buffer show-paren-overlay)
210 (delete-overlay show-paren-overlay))
211 (and show-paren-overlay-1 (overlay-buffer show-paren-overlay-1)
212 (delete-overlay show-paren-overlay-1)))
213 ;;
214 ;; Use the correct face.
215 (if mismatch
216 (progn
217 (if show-paren-ring-bell-on-mismatch
218 (beep))
219 (setq face 'show-paren-mismatch))
220 (setq face 'show-paren-match))
221 ;;
222 ;; If matching backwards, highlight the closeparen
223 ;; before point as well as its matching open.
224 ;; If matching forward, and the openparen is unbalanced,
225 ;; highlight the paren at point to indicate misbalance.
226 ;; Otherwise, turn off any such highlighting.
227 (if (and (not show-paren-highlight-openparen) (= dir 1) (integerp pos))
228 (when (and show-paren-overlay-1
229 (overlay-buffer show-paren-overlay-1))
230 (delete-overlay show-paren-overlay-1))
231 (let ((from (if (= dir 1)
232 (point)
233 (- (point) 1)))
234 (to (if (= dir 1)
235 (+ (point) 1)
236 (point))))
237 (if show-paren-overlay-1
238 (move-overlay show-paren-overlay-1 from to (current-buffer))
239 (setq show-paren-overlay-1 (make-overlay from to nil t)))
240 ;; Always set the overlay face, since it varies.
241 (overlay-put show-paren-overlay-1 'priority show-paren-priority)
242 (overlay-put show-paren-overlay-1 'face face)))
243 ;;
244 ;; Turn on highlighting for the matching paren, if found.
245 ;; If it's an unmatched paren, turn off any such highlighting.
246 (if (not (integerp pos))
247 (when show-paren-overlay (delete-overlay show-paren-overlay))
248 (let ((to (if (or (eq show-paren-style 'expression)
249 (and (eq show-paren-style 'mixed)
250 (not (pos-visible-in-window-p pos))))
251 (point)
252 pos))
253 (from (if (or (eq show-paren-style 'expression)
254 (and (eq show-paren-style 'mixed)
255 (not (pos-visible-in-window-p pos))))
256 pos
257 (save-excursion
258 (goto-char pos)
259 (- (point) dir)))))
260 (if show-paren-overlay
261 (move-overlay show-paren-overlay from to (current-buffer))
262 (setq show-paren-overlay (make-overlay from to nil t))))
263 ;; Always set the overlay face, since it varies.
264 (overlay-put show-paren-overlay 'priority show-paren-priority)
265 (overlay-put show-paren-overlay 'face face))))
266 ;; show-paren-mode is nil in this buffer.
267 (and show-paren-overlay
268 (delete-overlay show-paren-overlay))
269 (and show-paren-overlay-1
270 (delete-overlay show-paren-overlay-1))))
271 267
272(provide 'paren) 268(provide 'paren)
273 269
diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el
index 91b146fdc78..fb31984facc 100644
--- a/lisp/pcmpl-gnu.el
+++ b/lisp/pcmpl-gnu.el
@@ -158,7 +158,8 @@
158 "Completion for the GNU tar utility." 158 "Completion for the GNU tar utility."
159 ;; options that end in an equal sign will want further completion... 159 ;; options that end in an equal sign will want further completion...
160 (let (saw-option complete-within) 160 (let (saw-option complete-within)
161 (let ((pcomplete-suffix-list (cons ?= pcomplete-suffix-list))) 161 (let ((pcomplete-suffix-list (if (boundp 'pcomplete-suffix-list)
162 (cons ?= pcomplete-suffix-list))))
162 (while (pcomplete-match "^-" 0) 163 (while (pcomplete-match "^-" 0)
163 (setq saw-option t) 164 (setq saw-option t)
164 (if (pcomplete-match "^--" 0) 165 (if (pcomplete-match "^--" 0)
diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el
index e41455f7883..337a5292417 100644
--- a/lisp/progmodes/cc-bytecomp.el
+++ b/lisp/progmodes/cc-bytecomp.el
@@ -232,6 +232,9 @@ perhaps a `cc-bytecomp-restore-environment' is forgotten somewhere"))
232 (cc-bytecomp-setup-environment) 232 (cc-bytecomp-setup-environment)
233 t)))) 233 t))))
234 234
235(defvar cc-bytecomp-noruntime-functions nil
236 "Saved value of `byte-compile-noruntime-functions'.")
237
235(defmacro cc-require (cc-part) 238(defmacro cc-require (cc-part)
236 "Force loading of the corresponding .el file in the current directory 239 "Force loading of the corresponding .el file in the current directory
237during compilation, but compile in a `require'. Don't use within 240during compilation, but compile in a `require'. Don't use within
@@ -240,7 +243,16 @@ during compilation, but compile in a `require'. Don't use within
240Having cyclic cc-require's will result in infinite recursion. That's 243Having cyclic cc-require's will result in infinite recursion. That's
241somewhat intentional." 244somewhat intentional."
242 `(progn 245 `(progn
243 (eval-when-compile (cc-bytecomp-load (symbol-name ,cc-part))) 246 (eval-when-compile
247 (setq cc-bytecomp-noruntime-functions byte-compile-noruntime-functions)
248 (cc-bytecomp-load (symbol-name ,cc-part)))
249 ;; Hack to suppress spurious "might not be defined at runtime" warnings.
250 ;; The basic issue is that
251 ;; (eval-when-compile (require 'foo))
252 ;; (require 'foo)
253 ;; produces bogus noruntime warnings about functions from foo.
254 (eval-when-compile
255 (setq byte-compile-noruntime-functions cc-bytecomp-noruntime-functions))
244 (require ,cc-part))) 256 (require ,cc-part)))
245 257
246(defmacro cc-provide (feature) 258(defmacro cc-provide (feature)
@@ -266,7 +278,7 @@ somewhat intentional."
266during compilation, but do a compile time `require' otherwise. Don't 278during compilation, but do a compile time `require' otherwise. Don't
267use within `eval-when-compile'." 279use within `eval-when-compile'."
268 `(eval-when-compile 280 `(eval-when-compile
269 (if (and (featurep 'cc-bytecomp) 281 (if (and (fboundp 'cc-bytecomp-is-compiling)
270 (cc-bytecomp-is-compiling)) 282 (cc-bytecomp-is-compiling))
271 (if (or (not load-in-progress) 283 (if (or (not load-in-progress)
272 (not (featurep ,cc-part))) 284 (not (featurep ,cc-part)))
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 0bb804799dc..dc6ed1348d1 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -45,7 +45,6 @@
45(cc-require 'cc-engine) 45(cc-require 'cc-engine)
46 46
47;; Silence the compiler. 47;; Silence the compiler.
48(cc-bytecomp-defun delete-forward-p) ; XEmacs
49(cc-bytecomp-defvar filladapt-mode) ; c-fill-paragraph contains a kludge 48(cc-bytecomp-defvar filladapt-mode) ; c-fill-paragraph contains a kludge
50 ; which looks at this. 49 ; which looks at this.
51 50
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index e7f96767675..b90a01dcb3b 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -48,16 +48,12 @@
48 48
49;; Silence the compiler. 49;; Silence the compiler.
50(cc-bytecomp-defvar c-enable-xemacs-performance-kludge-p) ; In cc-vars.el 50(cc-bytecomp-defvar c-enable-xemacs-performance-kludge-p) ; In cc-vars.el
51(cc-bytecomp-defun buffer-syntactic-context-depth) ; XEmacs
52(cc-bytecomp-defun region-active-p) ; XEmacs 51(cc-bytecomp-defun region-active-p) ; XEmacs
53(cc-bytecomp-defvar zmacs-region-stays) ; XEmacs
54(cc-bytecomp-defvar zmacs-regions) ; XEmacs
55(cc-bytecomp-defvar mark-active) ; Emacs 52(cc-bytecomp-defvar mark-active) ; Emacs
56(cc-bytecomp-defvar deactivate-mark) ; Emacs 53(cc-bytecomp-defvar deactivate-mark) ; Emacs
57(cc-bytecomp-defvar inhibit-point-motion-hooks) ; Emacs 54(cc-bytecomp-defvar inhibit-point-motion-hooks) ; Emacs
58(cc-bytecomp-defvar parse-sexp-lookup-properties) ; Emacs 55(cc-bytecomp-defvar parse-sexp-lookup-properties) ; Emacs
59(cc-bytecomp-defvar text-property-default-nonsticky) ; Emacs 21 56(cc-bytecomp-defvar text-property-default-nonsticky) ; Emacs 21
60(cc-bytecomp-defvar lookup-syntax-properties) ; XEmacs
61(cc-bytecomp-defun string-to-syntax) ; Emacs 21 57(cc-bytecomp-defun string-to-syntax) ; Emacs 21
62 58
63 59
@@ -334,6 +330,8 @@ to it is returned. This function does not modify the point or the mark."
334(defmacro c-region-is-active-p () 330(defmacro c-region-is-active-p ()
335 ;; Return t when the region is active. The determination of region 331 ;; Return t when the region is active. The determination of region
336 ;; activeness is different in both Emacs and XEmacs. 332 ;; activeness is different in both Emacs and XEmacs.
333 ;; FIXME? Emacs has region-active-p since 23.1, so maybe this test
334 ;; should be updated.
337 (if (cc-bytecomp-boundp 'mark-active) 335 (if (cc-bytecomp-boundp 'mark-active)
338 ;; Emacs. 336 ;; Emacs.
339 'mark-active 337 'mark-active
@@ -343,7 +341,7 @@ to it is returned. This function does not modify the point or the mark."
343(defmacro c-set-region-active (activate) 341(defmacro c-set-region-active (activate)
344 ;; Activate the region if ACTIVE is non-nil, deactivate it 342 ;; Activate the region if ACTIVE is non-nil, deactivate it
345 ;; otherwise. Covers the differences between Emacs and XEmacs. 343 ;; otherwise. Covers the differences between Emacs and XEmacs.
346 (if (cc-bytecomp-fboundp 'zmacs-activate-region) 344 (if (fboundp 'zmacs-activate-region)
347 ;; XEmacs. 345 ;; XEmacs.
348 `(if ,activate 346 `(if ,activate
349 (zmacs-activate-region) 347 (zmacs-activate-region)
@@ -707,9 +705,9 @@ be after it."
707 ;; `c-parse-state'. 705 ;; `c-parse-state'.
708 706
709 `(progn 707 `(progn
710 (if (and ,(cc-bytecomp-fboundp 'buffer-syntactic-context-depth) 708 (if (and ,(fboundp 'buffer-syntactic-context-depth)
711 c-enable-xemacs-performance-kludge-p) 709 c-enable-xemacs-performance-kludge-p)
712 ,(when (cc-bytecomp-fboundp 'buffer-syntactic-context-depth) 710 ,(when (fboundp 'buffer-syntactic-context-depth)
713 ;; XEmacs only. This can improve the performance of 711 ;; XEmacs only. This can improve the performance of
714 ;; c-parse-state to between 3 and 60 times faster when 712 ;; c-parse-state to between 3 and 60 times faster when
715 ;; braces are hung. It can also degrade performance by 713 ;; braces are hung. It can also degrade performance by
@@ -1606,7 +1604,7 @@ non-nil, a caret is prepended to invert the set."
1606 (let ((buf (generate-new-buffer " test")) 1604 (let ((buf (generate-new-buffer " test"))
1607 parse-sexp-lookup-properties 1605 parse-sexp-lookup-properties
1608 parse-sexp-ignore-comments 1606 parse-sexp-ignore-comments
1609 lookup-syntax-properties) 1607 lookup-syntax-properties) ; XEmacs
1610 (with-current-buffer buf 1608 (with-current-buffer buf
1611 (set-syntax-table (make-syntax-table)) 1609 (set-syntax-table (make-syntax-table))
1612 1610
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 6a23da1f2cd..9077bdbb513 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -147,9 +147,6 @@
147(cc-require-when-compile 'cc-langs) 147(cc-require-when-compile 'cc-langs)
148(cc-require 'cc-vars) 148(cc-require 'cc-vars)
149 149
150;; Silence the compiler.
151(cc-bytecomp-defun buffer-syntactic-context) ; XEmacs
152
153 150
154;; Make declarations for all the `c-lang-defvar' variables in cc-langs. 151;; Make declarations for all the `c-lang-defvar' variables in cc-langs.
155 152
@@ -9358,10 +9355,6 @@ comment at the start of cc-engine.el for more info."
9358 containing-sexp nil))) 9355 containing-sexp nil)))
9359 (setq lim (1+ containing-sexp)))) 9356 (setq lim (1+ containing-sexp))))
9360 (setq lim (point-min))) 9357 (setq lim (point-min)))
9361 (when (c-beginning-of-macro)
9362 (goto-char indent-point)
9363 (let ((lim1 (c-determine-limit 2000)))
9364 (setq lim (max lim lim1))))
9365 9358
9366 ;; If we're in a parenthesis list then ',' delimits the 9359 ;; If we're in a parenthesis list then ',' delimits the
9367 ;; "statements" rather than being an operator (with the 9360 ;; "statements" rather than being an operator (with the
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 83343b23014..6a4bfd9e875 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -176,7 +176,6 @@
176 'font-lock-negation-char-face)) 176 'font-lock-negation-char-face))
177 177
178(cc-bytecomp-defun face-inverse-video-p) ; Only in Emacs. 178(cc-bytecomp-defun face-inverse-video-p) ; Only in Emacs.
179(cc-bytecomp-defun face-property-instance) ; Only in XEmacs.
180 179
181(defun c-make-inverse-face (oldface newface) 180(defun c-make-inverse-face (oldface newface)
182 ;; Emacs and XEmacs have completely different face manipulation 181 ;; Emacs and XEmacs have completely different face manipulation
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 746b75d962b..74818b7e1ea 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -86,8 +86,8 @@
86 (load "cc-bytecomp" nil t))) 86 (load "cc-bytecomp" nil t)))
87 87
88(cc-require 'cc-defs) 88(cc-require 'cc-defs)
89(cc-require-when-compile 'cc-langs)
90(cc-require 'cc-vars) 89(cc-require 'cc-vars)
90(cc-require-when-compile 'cc-langs)
91(cc-require 'cc-engine) 91(cc-require 'cc-engine)
92(cc-require 'cc-styles) 92(cc-require 'cc-styles)
93(cc-require 'cc-cmds) 93(cc-require 'cc-cmds)
@@ -97,7 +97,6 @@
97 97
98;; Silence the compiler. 98;; Silence the compiler.
99(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs 99(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
100(cc-bytecomp-defun set-keymap-parents) ; XEmacs
101(cc-bytecomp-defun run-mode-hooks) ; Emacs 21.1 100(cc-bytecomp-defun run-mode-hooks) ; Emacs 21.1
102 101
103;; We set these variables during mode init, yet we don't require 102;; We set these variables during mode init, yet we don't require
@@ -212,7 +211,7 @@ control). See \"cc-mode.el\" for more info."
212 ((cc-bytecomp-fboundp 'set-keymap-parent) 211 ((cc-bytecomp-fboundp 'set-keymap-parent)
213 (set-keymap-parent map c-mode-base-map)) 212 (set-keymap-parent map c-mode-base-map))
214 ;; XEmacs 213 ;; XEmacs
215 ((cc-bytecomp-fboundp 'set-keymap-parents) 214 ((fboundp 'set-keymap-parents)
216 (set-keymap-parents map c-mode-base-map)) 215 (set-keymap-parents map c-mode-base-map))
217 ;; incompatible 216 ;; incompatible
218 (t (error "CC Mode is incompatible with this version of Emacs"))) 217 (t (error "CC Mode is incompatible with this version of Emacs")))
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index f830cc7edc1..c89402c63a3 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -42,23 +42,25 @@
42 42
43(cc-require 'cc-defs) 43(cc-require 'cc-defs)
44 44
45;; Silence the compiler.
46(cc-bytecomp-defun get-char-table) ; XEmacs
47
48(cc-eval-when-compile 45(cc-eval-when-compile
49 (require 'custom) 46 (require 'custom)
50 (require 'widget)) 47 (require 'widget))
51 48
52;;; Helpers 49;;; Helpers
53 50
54;; This widget exists in newer versions of the Custom library 51
55(or (get 'other 'widget-type) 52;; Emacs has 'other since at least version 21.1.
56 (define-widget 'other 'sexp 53;; FIXME this is probably broken, since the widget is defined
57 "Matches everything, but doesn't let the user edit the value. 54;; in wid-edit, which this file does not load. So we will always
55;; define the widget, even when we don't need to.
56(when (featurep 'xemacs)
57 (or (get 'other 'widget-type)
58 (define-widget 'other 'sexp
59 "Matches everything, but doesn't let the user edit the value.
58Useful as last item in a `choice' widget." 60Useful as last item in a `choice' widget."
59 :tag "Other" 61 :tag "Other"
60 :format "%t%n" 62 :format "%t%n"
61 :value 'other)) 63 :value 'other)))
62 64
63;; The next defun will supersede c-const-symbol. 65;; The next defun will supersede c-const-symbol.
64(eval-and-compile 66(eval-and-compile
@@ -1645,6 +1647,7 @@ and is likely to disappear or change its form soon.")
1645 ;; `c-macro-with-semi-re' (or just copy it if it's already a re). 1647 ;; `c-macro-with-semi-re' (or just copy it if it's already a re).
1646 (setq c-macro-with-semi-re 1648 (setq c-macro-with-semi-re
1647 (and 1649 (and
1650 (boundp 'c-opt-cpp-macro-define)
1648 c-opt-cpp-macro-define 1651 c-opt-cpp-macro-define
1649 (cond 1652 (cond
1650 ((stringp c-macro-names-with-semicolon) 1653 ((stringp c-macro-names-with-semicolon)
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el
index 11eb0eeaf49..01b5faef5b3 100644
--- a/lisp/progmodes/cfengine.el
+++ b/lisp/progmodes/cfengine.el
@@ -527,6 +527,11 @@ Intended as the value of `indent-line-function'."
527 ;; Doze path separators. 527 ;; Doze path separators.
528 (modify-syntax-entry ?\\ "." table)) 528 (modify-syntax-entry ?\\ "." table))
529 529
530(defconst cfengine3--prettify-symbols-alist
531 '(("->" . ?→)
532 ("=>" . ?⇒)
533 ("::" . ?∷)))
534
530;;;###autoload 535;;;###autoload
531(define-derived-mode cfengine3-mode prog-mode "CFE3" 536(define-derived-mode cfengine3-mode prog-mode "CFE3"
532 "Major mode for editing CFEngine3 input. 537 "Major mode for editing CFEngine3 input.
@@ -538,8 +543,11 @@ to the action header."
538 (cfengine-common-syntax cfengine3-mode-syntax-table) 543 (cfengine-common-syntax cfengine3-mode-syntax-table)
539 544
540 (set (make-local-variable 'indent-line-function) #'cfengine3-indent-line) 545 (set (make-local-variable 'indent-line-function) #'cfengine3-indent-line)
546
541 (setq font-lock-defaults 547 (setq font-lock-defaults
542 '(cfengine3-font-lock-keywords nil nil nil beginning-of-defun)) 548 '(cfengine3-font-lock-keywords
549 nil nil nil beginning-of-defun))
550 (prog-prettify-install cfengine3--prettify-symbols-alist)
543 551
544 ;; Use defuns as the essential syntax block. 552 ;; Use defuns as the essential syntax block.
545 (set (make-local-variable 'beginning-of-defun-function) 553 (set (make-local-variable 'beginning-of-defun-function)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index d6f136ec92d..d9c482330cc 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1002,7 +1002,7 @@ POS and RES.")
1002 (let ((win (get-buffer-window buffer 0))) 1002 (let ((win (get-buffer-window buffer 0)))
1003 (if win (set-window-point win pos))) 1003 (if win (set-window-point win pos)))
1004 (if compilation-auto-jump-to-first-error 1004 (if compilation-auto-jump-to-first-error
1005 (compile-goto-error)))) 1005 (compile-goto-error nil t))))
1006 1006
1007;; This function is the central driver, called when font-locking to gather 1007;; This function is the central driver, called when font-locking to gather
1008;; all information needed to later jump to corresponding source code. 1008;; all information needed to later jump to corresponding source code.
@@ -2317,7 +2317,7 @@ Prefix arg N says how many files to move backwards (or forwards, if negative)."
2317 2317
2318(defalias 'compile-mouse-goto-error 'compile-goto-error) 2318(defalias 'compile-mouse-goto-error 'compile-goto-error)
2319 2319
2320(defun compile-goto-error (&optional event) 2320(defun compile-goto-error (&optional event nomsg)
2321 "Visit the source for the error message at point. 2321 "Visit the source for the error message at point.
2322Use this command in a compilation log buffer. Sets the mark at point there." 2322Use this command in a compilation log buffer. Sets the mark at point there."
2323 (interactive (list last-input-event)) 2323 (interactive (list last-input-event))
@@ -2328,7 +2328,7 @@ Use this command in a compilation log buffer. Sets the mark at point there."
2328 (if (get-text-property (point) 'compilation-directory) 2328 (if (get-text-property (point) 'compilation-directory)
2329 (dired-other-window 2329 (dired-other-window
2330 (car (get-text-property (point) 'compilation-directory))) 2330 (car (get-text-property (point) 'compilation-directory)))
2331 (push-mark) 2331 (push-mark nil nomsg)
2332 (setq compilation-current-error (point)) 2332 (setq compilation-current-error (point))
2333 (next-error-internal))) 2333 (next-error-internal)))
2334 2334
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index a6ad5736576..0b52302a98d 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -345,7 +345,7 @@ triggers in `gdb-handler-list'."
345 `(run-with-timer 345 `(run-with-timer
346 0.5 nil 346 0.5 nil
347 '(lambda () 347 '(lambda ()
348 (if (not (gdb-find-if (lambda (handler) 348 (if (not (cl-find-if (lambda (handler)
349 (gdb-handler-pending-trigger handler)) 349 (gdb-handler-pending-trigger handler))
350 gdb-handler-list)) 350 gdb-handler-list))
351 (progn ,@body) 351 (progn ,@body)
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index bacd37b3d3c..b1936467274 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -89,7 +89,7 @@ Used in `octave-mode' and `inferior-octave-mode' buffers.")
89 89
90(defvar octave-function-header-regexp 90(defvar octave-function-header-regexp
91 (concat "^\\s-*\\_<\\(function\\)\\_>" 91 (concat "^\\s-*\\_<\\(function\\)\\_>"
92 "\\([^=;\n]*=[ \t]*\\|[ \t]*\\)\\(\\(?:\\w\\|\\s_\\)+\\)\\_>") 92 "\\([^=;(\n]*=[ \t]*\\|[ \t]*\\)\\(\\(?:\\w\\|\\s_\\)+\\)\\_>")
93 "Regexp to match an Octave function header. 93 "Regexp to match an Octave function header.
94The string `function' and its name are given by the first and third 94The string `function' and its name are given by the first and third
95parenthetical grouping.") 95parenthetical grouping.")
@@ -153,10 +153,10 @@ parenthetical grouping.")
153 'eldoc-mode)) 153 'eldoc-mode))
154 :style toggle :selected (or eldoc-post-insert-mode eldoc-mode) 154 :style toggle :selected (or eldoc-post-insert-mode eldoc-mode)
155 :help "Display function signatures after typing `SPC' or `('"] 155 :help "Display function signatures after typing `SPC' or `('"]
156 ["Delimiter Matching" smie-highlight-matching-block-mode 156 ["Delimiter Matching" show-paren-mode
157 :style toggle :selected smie-highlight-matching-block-mode 157 :style toggle :selected show-paren-mode
158 :help "Highlight matched pairs such as `if ... end'" 158 :help "Highlight matched pairs such as `if ... end'"
159 :visible (fboundp 'smie-highlight-matching-block-mode)] 159 :visible (fboundp 'smie--matching-block-data)]
160 ["Auto Fill" auto-fill-mode 160 ["Auto Fill" auto-fill-mode
161 :style toggle :selected auto-fill-function 161 :style toggle :selected auto-fill-function
162 :help "Automatic line breaking"] 162 :help "Automatic line breaking"]
@@ -191,10 +191,9 @@ parenthetical grouping.")
191 (modify-syntax-entry ?! "." table) 191 (modify-syntax-entry ?! "." table)
192 (modify-syntax-entry ?\\ "." table) 192 (modify-syntax-entry ?\\ "." table)
193 (modify-syntax-entry ?\' "." table) 193 (modify-syntax-entry ?\' "." table)
194 ;; Was "w" for abbrevs, but now that it's not necessary any more,
195 (modify-syntax-entry ?\` "." table) 194 (modify-syntax-entry ?\` "." table)
195 (modify-syntax-entry ?. "." table)
196 (modify-syntax-entry ?\" "\"" table) 196 (modify-syntax-entry ?\" "\"" table)
197 (modify-syntax-entry ?. "_" table)
198 (modify-syntax-entry ?_ "_" table) 197 (modify-syntax-entry ?_ "_" table)
199 ;; The "b" flag only applies to the second letter of the comstart 198 ;; The "b" flag only applies to the second letter of the comstart
200 ;; and the first letter of the comend, i.e. the "4b" below is ineffective. 199 ;; and the first letter of the comend, i.e. the "4b" below is ineffective.
@@ -541,6 +540,7 @@ definitions can also be stored in files and used in batch mode."
541 ;; a ";" at those places where it's correct (i.e. outside of parens). 540 ;; a ";" at those places where it's correct (i.e. outside of parens).
542 (setq-local electric-layout-rules '((?\; . after))) 541 (setq-local electric-layout-rules '((?\; . after)))
543 542
543 (setq-local comment-use-global-state t)
544 (setq-local comment-start octave-comment-start) 544 (setq-local comment-start octave-comment-start)
545 (setq-local comment-end "") 545 (setq-local comment-end "")
546 (setq-local comment-start-skip octave-comment-start-skip) 546 (setq-local comment-start-skip octave-comment-start-skip)
@@ -564,6 +564,8 @@ definitions can also be stored in files and used in batch mode."
564 (setq-local imenu-generic-expression octave-mode-imenu-generic-expression) 564 (setq-local imenu-generic-expression octave-mode-imenu-generic-expression)
565 (setq-local imenu-case-fold-search nil) 565 (setq-local imenu-case-fold-search nil)
566 566
567 (setq-local add-log-current-defun-function #'octave-add-log-current-defun)
568
567 (add-hook 'completion-at-point-functions 'octave-completion-at-point nil t) 569 (add-hook 'completion-at-point-functions 'octave-completion-at-point nil t)
568 (add-hook 'before-save-hook 'octave-sync-function-file-names nil t) 570 (add-hook 'before-save-hook 'octave-sync-function-file-names nil t)
569 (setq-local beginning-of-defun-function 'octave-beginning-of-defun) 571 (setq-local beginning-of-defun-function 'octave-beginning-of-defun)
@@ -606,12 +608,13 @@ startup."
606 :group 'octave 608 :group 'octave
607 :version "24.4") 609 :version "24.4")
608 610
609(defcustom inferior-octave-startup-args nil 611(defcustom inferior-octave-startup-args '("-i" "--no-line-editing")
610 "List of command line arguments for the inferior Octave process. 612 "List of command line arguments for the inferior Octave process.
611For example, for suppressing the startup message and using `traditional' 613For example, for suppressing the startup message and using `traditional'
612mode, set this to (\"-q\" \"--traditional\")." 614mode, include \"-q\" and \"--traditional\"."
613 :type '(repeat string) 615 :type '(repeat string)
614 :group 'octave) 616 :group 'octave
617 :version "24.4")
615 618
616(defcustom inferior-octave-mode-hook nil 619(defcustom inferior-octave-mode-hook nil
617 "Hook to be run when Inferior Octave mode is started." 620 "Hook to be run when Inferior Octave mode is started."
@@ -665,6 +668,7 @@ in the Inferior Octave buffer.")
665 :abbrev-table octave-abbrev-table 668 :abbrev-table octave-abbrev-table
666 (setq comint-prompt-regexp inferior-octave-prompt) 669 (setq comint-prompt-regexp inferior-octave-prompt)
667 670
671 (setq-local comment-use-global-state t)
668 (setq-local comment-start octave-comment-start) 672 (setq-local comment-start octave-comment-start)
669 (setq-local comment-end "") 673 (setq-local comment-end "")
670 (setq comment-column 32) 674 (setq comment-column 32)
@@ -676,13 +680,16 @@ in the Inferior Octave buffer.")
676 (setq-local eldoc-documentation-function 'octave-eldoc-function) 680 (setq-local eldoc-documentation-function 'octave-eldoc-function)
677 681
678 (setq comint-input-ring-file-name 682 (setq comint-input-ring-file-name
679 (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") 683 (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")
680 comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)) 684 comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024))
681 (setq-local comint-dynamic-complete-functions 685 (setq-local comint-dynamic-complete-functions
682 inferior-octave-dynamic-complete-functions) 686 inferior-octave-dynamic-complete-functions)
683 (setq-local comint-prompt-read-only inferior-octave-prompt-read-only) 687 (setq-local comint-prompt-read-only inferior-octave-prompt-read-only)
684 (add-hook 'comint-input-filter-functions 688 (add-hook 'comint-input-filter-functions
685 'inferior-octave-directory-tracker nil t) 689 'inferior-octave-directory-tracker nil t)
690 ;; http://thread.gmane.org/gmane.comp.gnu.octave.general/48572
691 (add-hook 'window-configuration-change-hook
692 'inferior-octave-track-window-width-change nil t)
686 (comint-read-input-ring t)) 693 (comint-read-input-ring t))
687 694
688;;;###autoload 695;;;###autoload
@@ -717,13 +724,13 @@ startup file, `~/.emacs-octave'."
717 (substring inferior-octave-buffer 1 -1) 724 (substring inferior-octave-buffer 1 -1)
718 inferior-octave-buffer 725 inferior-octave-buffer
719 inferior-octave-program 726 inferior-octave-program
720 (append (list "-i" "--no-line-editing") 727 (append
721 ;; --no-gui is introduced in Octave > 3.7 728 inferior-octave-startup-args
722 (when (zerop (process-file inferior-octave-program 729 ;; --no-gui is introduced in Octave > 3.7
723 nil nil nil 730 (and (not (member "--no-gui" inferior-octave-startup-args))
724 "--no-gui" "--help")) 731 (zerop (process-file inferior-octave-program
725 (list "--no-gui")) 732 nil nil nil "--no-gui" "--help"))
726 inferior-octave-startup-args)))) 733 '("--no-gui"))))))
727 (set-process-filter proc 'inferior-octave-output-digest) 734 (set-process-filter proc 'inferior-octave-output-digest)
728 (setq inferior-octave-process proc 735 (setq inferior-octave-process proc
729 inferior-octave-output-list nil 736 inferior-octave-output-list nil
@@ -753,10 +760,10 @@ startup file, `~/.emacs-octave'."
753 (inferior-octave-send-list-and-digest (list "PS2\n")) 760 (inferior-octave-send-list-and-digest (list "PS2\n"))
754 (when (string-match "\\(PS2\\|ans\\) = *$" 761 (when (string-match "\\(PS2\\|ans\\) = *$"
755 (car inferior-octave-output-list)) 762 (car inferior-octave-output-list))
756 (inferior-octave-send-list-and-digest (list "PS2 (\"> \");\n"))) 763 (inferior-octave-send-list-and-digest (list "PS2 ('> ');\n")))
757 764
758 (inferior-octave-send-list-and-digest 765 (inferior-octave-send-list-and-digest
759 (list "disp(getenv(\"OCTAVE_SRCDIR\"))\n")) 766 (list "disp (getenv ('OCTAVE_SRCDIR'))\n"))
760 (process-put proc 'octave-srcdir 767 (process-put proc 'octave-srcdir
761 (unless (equal (car inferior-octave-output-list) "") 768 (unless (equal (car inferior-octave-output-list) "")
762 (car inferior-octave-output-list))) 769 (car inferior-octave-output-list)))
@@ -765,19 +772,19 @@ startup file, `~/.emacs-octave'."
765 (inferior-octave-send-list-and-digest 772 (inferior-octave-send-list-and-digest
766 (list "more off;\n" 773 (list "more off;\n"
767 (unless (equal inferior-octave-output-string ">> ") 774 (unless (equal inferior-octave-output-string ">> ")
768 "PS1 (\"\\\\s> \");\n") 775 "PS1 ('\\s> ');\n")
769 (when (and inferior-octave-startup-file 776 (when (and inferior-octave-startup-file
770 (file-exists-p inferior-octave-startup-file)) 777 (file-exists-p inferior-octave-startup-file))
771 (format "source (\"%s\");\n" inferior-octave-startup-file)))) 778 (format "source ('%s');\n" inferior-octave-startup-file))))
772 (when inferior-octave-output-list 779 (when inferior-octave-output-list
773 (insert-before-markers 780 (insert-before-markers
774 (mapconcat 'identity inferior-octave-output-list "\n"))) 781 (mapconcat 'identity inferior-octave-output-list "\n")))
775 782
776 ;; And finally, everything is back to normal. 783 ;; And finally, everything is back to normal.
777 (set-process-filter proc 'comint-output-filter) 784 (set-process-filter proc 'comint-output-filter)
778 ;; Just in case, to be sure a cd in the startup file 785 ;; Just in case, to be sure a cd in the startup file won't have
779 ;; won't have detrimental effects. 786 ;; detrimental effects.
780 (inferior-octave-resync-dirs) 787 (with-demoted-errors (inferior-octave-resync-dirs))
781 ;; Generate a proper prompt, which is critical to 788 ;; Generate a proper prompt, which is critical to
782 ;; `comint-history-isearch-backward-regexp'. Bug#14433. 789 ;; `comint-history-isearch-backward-regexp'. Bug#14433.
783 (comint-send-string proc "\n"))) 790 (comint-send-string proc "\n")))
@@ -793,7 +800,7 @@ startup file, `~/.emacs-octave'."
793 (unless (and (equal (car cache) command) 800 (unless (and (equal (car cache) command)
794 (< (float-time) (+ 5 (cadr cache)))) 801 (< (float-time) (+ 5 (cadr cache))))
795 (inferior-octave-send-list-and-digest 802 (inferior-octave-send-list-and-digest
796 (list (concat "completion_matches (\"" command "\");\n"))) 803 (list (format "completion_matches ('%s');\n" command)))
797 (setq cache (list command (float-time) 804 (setq cache (list command (float-time)
798 (delete-consecutive-dups 805 (delete-consecutive-dups
799 (sort inferior-octave-output-list 'string-lessp))))) 806 (sort inferior-octave-output-list 'string-lessp)))))
@@ -892,8 +899,8 @@ output is passed to the filter `inferior-octave-output-digest'."
892 "Tracks `cd' commands issued to the inferior Octave process. 899 "Tracks `cd' commands issued to the inferior Octave process.
893Use \\[inferior-octave-resync-dirs] to resync if Emacs gets confused." 900Use \\[inferior-octave-resync-dirs] to resync if Emacs gets confused."
894 (when inferior-octave-directory-tracker-resync 901 (when inferior-octave-directory-tracker-resync
895 (setq inferior-octave-directory-tracker-resync nil) 902 (or (inferior-octave-resync-dirs 'noerror)
896 (inferior-octave-resync-dirs)) 903 (setq inferior-octave-directory-tracker-resync nil)))
897 (cond 904 (cond
898 ((string-match "^[ \t]*cd[ \t;]*$" string) 905 ((string-match "^[ \t]*cd[ \t;]*$" string)
899 (cd "~")) 906 (cd "~"))
@@ -905,13 +912,35 @@ Use \\[inferior-octave-resync-dirs] to resync if Emacs gets confused."
905 (error-message-string err) 912 (error-message-string err)
906 (match-string 1 string))))))) 913 (match-string 1 string)))))))
907 914
908(defun inferior-octave-resync-dirs () 915(defun inferior-octave-resync-dirs (&optional noerror)
909 "Resync the buffer's idea of the current directory. 916 "Resync the buffer's idea of the current directory.
910This command queries the inferior Octave process about its current 917This command queries the inferior Octave process about its current
911directory and makes this the current buffer's default directory." 918directory and makes this the current buffer's default directory."
912 (interactive) 919 (interactive)
913 (inferior-octave-send-list-and-digest '("disp (pwd ())\n")) 920 (inferior-octave-send-list-and-digest '("disp (pwd ())\n"))
914 (cd (car inferior-octave-output-list))) 921 (condition-case err
922 (progn
923 (cd (car inferior-octave-output-list))
924 t)
925 (error (unless noerror (signal (car err) (cdr err))))))
926
927(defcustom inferior-octave-minimal-columns 80
928 "The minimal column width for the inferior Octave process."
929 :type 'integer
930 :group 'octave
931 :version "24.4")
932
933(defvar inferior-octave-last-column-width nil)
934
935(defun inferior-octave-track-window-width-change ()
936 ;; http://thread.gmane.org/gmane.comp.gnu.octave.general/48572
937 (let ((width (max inferior-octave-minimal-columns (window-width))))
938 (unless (eq inferior-octave-last-column-width width)
939 (setq-local inferior-octave-last-column-width width)
940 (when (and inferior-octave-process
941 (process-live-p inferior-octave-process))
942 (inferior-octave-send-list-and-digest
943 (list (format "putenv ('COLUMNS', '%s');\n" width)))))))
915 944
916 945
917;;; Miscellaneous useful functions 946;;; Miscellaneous useful functions
@@ -955,16 +984,17 @@ directory and makes this the current buffer's default directory."
955 984
956(defun octave-goto-function-definition (fn) 985(defun octave-goto-function-definition (fn)
957 "Go to the function definition of FN in current buffer." 986 "Go to the function definition of FN in current buffer."
958 (goto-char (point-min))
959 (let ((search 987 (let ((search
960 (lambda (re sub) 988 (lambda (re sub)
961 (let (done) 989 (let ((orig (point)) found)
962 (while (and (not done) (re-search-forward re nil t)) 990 (goto-char (point-min))
991 (while (and (not found) (re-search-forward re nil t))
963 (when (and (equal (match-string sub) fn) 992 (when (and (equal (match-string sub) fn)
964 (not (nth 8 (syntax-ppss)))) 993 (not (nth 8 (syntax-ppss))))
965 (setq done t))) 994 (setq found t)))
966 (or done (goto-char (point-min))))))) 995 (unless found (goto-char orig))
967 (pcase (file-name-extension (buffer-file-name)) 996 found))))
997 (pcase (and buffer-file-name (file-name-extension buffer-file-name))
968 (`"cc" (funcall search 998 (`"cc" (funcall search
969 "\\_<DEFUN\\(?:_DLD\\)?\\s-*(\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)" 1)) 999 "\\_<DEFUN\\(?:_DLD\\)?\\s-*(\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)" 1))
970 (t (funcall search octave-function-header-regexp 3))))) 1000 (t (funcall search octave-function-header-regexp 3)))))
@@ -1325,8 +1355,6 @@ The block marked is the one that contains point or follows point."
1325 (forward-line 1)))) 1355 (forward-line 1))))
1326 t))) 1356 t)))
1327 1357
1328;;; Completions
1329
1330(defun octave-completion-at-point () 1358(defun octave-completion-at-point ()
1331 "Find the text to complete and the corresponding table." 1359 "Find the text to complete and the corresponding table."
1332 (let* ((beg (save-excursion (skip-syntax-backward "w_") (point))) 1360 (let* ((beg (save-excursion (skip-syntax-backward "w_") (point)))
@@ -1343,6 +1371,16 @@ The block marked is the one that contains point or follows point."
1343 1371
1344(define-obsolete-function-alias 'octave-complete-symbol 1372(define-obsolete-function-alias 'octave-complete-symbol
1345 'completion-at-point "24.1") 1373 'completion-at-point "24.1")
1374
1375(defun octave-add-log-current-defun ()
1376 "A function for `add-log-current-defun-function' (which see)."
1377 (save-excursion
1378 (end-of-line)
1379 (and (beginning-of-defun)
1380 (re-search-forward octave-function-header-regexp
1381 (line-end-position) t)
1382 (match-string 3))))
1383
1346 1384
1347;;; Electric characters && friends 1385;;; Electric characters && friends
1348(define-skeleton octave-insert-defun 1386(define-skeleton octave-insert-defun
@@ -1367,7 +1405,7 @@ entered without parens)."
1367 "function " > str \n 1405 "function " > str \n
1368 _ \n 1406 _ \n
1369 "endfunction" > \n) 1407 "endfunction" > \n)
1370 1408
1371;;; Communication with the inferior Octave process 1409;;; Communication with the inferior Octave process
1372(defun octave-kill-process () 1410(defun octave-kill-process ()
1373 "Kill inferior Octave process and its buffer." 1411 "Kill inferior Octave process and its buffer."
@@ -1486,9 +1524,7 @@ code line."
1486(defun octave-eldoc-function-signatures (fn) 1524(defun octave-eldoc-function-signatures (fn)
1487 (unless (equal fn (car octave-eldoc-cache)) 1525 (unless (equal fn (car octave-eldoc-cache))
1488 (inferior-octave-send-list-and-digest 1526 (inferior-octave-send-list-and-digest
1489 (list (format "\ 1527 (list (format "print_usage ('%s');\n" fn)))
1490if ismember(exist(\"%s\"), [2 3 5 103]) print_usage(\"%s\") endif\n"
1491 fn fn)))
1492 (let (result) 1528 (let (result)
1493 (dolist (line inferior-octave-output-list) 1529 (dolist (line inferior-octave-output-list)
1494 (when (string-match 1530 (when (string-match
@@ -1585,20 +1621,11 @@ if ismember(exist(\"%s\"), [2 3 5 103]) print_usage(\"%s\") endif\n"
1585 (when (or help-xref-stack help-xref-forward-stack) 1621 (when (or help-xref-stack help-xref-forward-stack)
1586 (insert "\n")))) 1622 (insert "\n"))))
1587 1623
1588(defvar octave-help-mode-finish-hook nil
1589 "Octave specific hook for `temp-buffer-show-hook'.")
1590
1591(defun octave-help-mode-finish ()
1592 (when (eq major-mode 'octave-help-mode)
1593 (run-hooks 'octave-help-mode-finish-hook)))
1594
1595(add-hook 'temp-buffer-show-hook 'octave-help-mode-finish)
1596
1597(defun octave-help (fn) 1624(defun octave-help (fn)
1598 "Display the documentation of FN." 1625 "Display the documentation of FN."
1599 (interactive (list (octave-completing-read))) 1626 (interactive (list (octave-completing-read)))
1600 (inferior-octave-send-list-and-digest 1627 (inferior-octave-send-list-and-digest
1601 (list (format "help \"%s\"\n" fn))) 1628 (list (format "help ('%s');\n" fn)))
1602 (let ((lines inferior-octave-output-list) 1629 (let ((lines inferior-octave-output-list)
1603 (inhibit-read-only t)) 1630 (inhibit-read-only t))
1604 (when (string-match "error: \\(.*\\)$" (car lines)) 1631 (when (string-match "error: \\(.*\\)$" (car lines))
@@ -1634,16 +1661,15 @@ if ismember(exist(\"%s\"), [2 3 5 103]) print_usage(\"%s\") endif\n"
1634 (help-insert-xref-button (file-relative-name file dir) 1661 (help-insert-xref-button (file-relative-name file dir)
1635 'octave-help-file fn) 1662 'octave-help-file fn)
1636 (insert "'"))) 1663 (insert "'")))
1637 ;; Make 'See also' clickable 1664 ;; Make 'See also' clickable.
1638 (with-syntax-table octave-mode-syntax-table 1665 (with-syntax-table octave-mode-syntax-table
1639 (when (re-search-forward "^\\s-*See also:" nil t) 1666 (when (re-search-forward "^\\s-*See also:" nil t)
1640 (let ((end (save-excursion (re-search-forward "^\\s-*$" nil t)))) 1667 (let ((end (save-excursion (re-search-forward "^\\s-*$" nil t))))
1641 (while (re-search-forward "\\_<\\(?:\\sw\\|\\s_\\)+\\_>" end t) 1668 (while (re-search-forward
1642 (make-text-button (match-beginning 0) 1669 ;; Match operators and symbols.
1643 ;; If the match ends with . exclude it. 1670 "\\(?1:\\s.+?\\)\\(?:$\\|[,;]\\|\\s-\\)\\|\\_<\\(?1:\\(?:\\sw\\|\\s_\\)+\\)\\_>"
1644 (if (eq (char-before (match-end 0)) ?.) 1671 end t)
1645 (1- (match-end 0)) 1672 (make-text-button (match-beginning 1) (match-end 1)
1646 (match-end 0))
1647 :type 'octave-help-function))))) 1673 :type 'octave-help-function)))))
1648 (octave-help-mode))))) 1674 (octave-help-mode)))))
1649 1675
@@ -1694,23 +1720,30 @@ If the environment variable OCTAVE_SRCDIR is set, it is searched first."
1694Functions implemented in C++ can be found if 1720Functions implemented in C++ can be found if
1695`octave-source-directories' is set correctly." 1721`octave-source-directories' is set correctly."
1696 (interactive (list (octave-completing-read))) 1722 (interactive (list (octave-completing-read)))
1697 (inferior-octave-send-list-and-digest 1723 (require 'etags)
1698 ;; help NAME is more verbose 1724 (let ((orig (point)))
1699 (list (format "\ 1725 (if (and (derived-mode-p 'octave-mode)
1700if iskeyword(\"%s\") disp(\"`%s' is a keyword\") else which(\"%s\") endif\n" 1726 (octave-goto-function-definition fn))
1701 fn fn fn))) 1727 (ring-insert find-tag-marker-ring (copy-marker orig))
1702 (let* ((line (car inferior-octave-output-list)) 1728 (inferior-octave-send-list-and-digest
1703 (file (when (and line (string-match "from the file \\(.*\\)$" line)) 1729 ;; help NAME is more verbose
1704 (match-string 1 line)))) 1730 (list (format "\
1705 (if (not file) 1731if iskeyword('%s') disp('`%s'' is a keyword') else which('%s') endif\n"
1706 (user-error "%s" (or line (format "`%s' not found" fn))) 1732 fn fn fn)))
1707 (require 'etags) 1733 (let (line file)
1708 (ring-insert find-tag-marker-ring (point-marker)) 1734 ;; Skip garbage lines such as
1709 (setq file (funcall octave-find-definition-filename-function file)) 1735 ;; warning: fmincg.m: possible Matlab-style ....
1710 (when file 1736 (while (and (not file) (consp inferior-octave-output-list))
1711 (find-file file) 1737 (setq line (pop inferior-octave-output-list))
1712 (octave-goto-function-definition fn))))) 1738 (when (string-match "from the file \\(.*\\)$" line)
1713 1739 (setq file (match-string 1 line))))
1740 (if (not file)
1741 (user-error "%s" (or line (format "`%s' not found" fn)))
1742 (ring-insert find-tag-marker-ring (point-marker))
1743 (setq file (funcall octave-find-definition-filename-function file))
1744 (when file
1745 (find-file file)
1746 (octave-goto-function-definition fn)))))))
1714 1747
1715(provide 'octave) 1748(provide 'octave)
1716;;; octave.el ends here 1749;;; octave.el ends here
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 01ac8584e19..1d5052bede4 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -158,44 +158,10 @@
158;; Regexps updated with help from Tom Tromey <tromey@cambric.colorado.edu> and 158;; Regexps updated with help from Tom Tromey <tromey@cambric.colorado.edu> and
159;; Jim Campbell <jec@murzim.ca.boeing.com>. 159;; Jim Campbell <jec@murzim.ca.boeing.com>.
160 160
161(defcustom perl-prettify-symbols t
162 "If non-nil, some symbols will be displayed using Unicode chars."
163 :version "24.4"
164 :type 'boolean)
165
166(defconst perl--prettify-symbols-alist 161(defconst perl--prettify-symbols-alist
167 '(;;("andalso" . ?∧) ("orelse" . ?∨) ("as" . ?≡)("not" . ?¬) 162 '(("->" . ?→)
168 ;;("div" . ?÷) ("*" . ?×) ("o" . ?○)
169 ("->" . ?→)
170 ("=>" . ?⇒) 163 ("=>" . ?⇒)
171 ;;("<-" . ?←) ("<>" . ?≠) (">=" . ?≥) ("<=" . ?≤) ("..." . ?⋯) 164 ("::" . ?∷)))
172 ("::" . ?∷)
173 ))
174
175(defun perl--font-lock-compose-symbol ()
176 "Compose a sequence of ascii chars into a symbol.
177Regexp match data 0 points to the chars."
178 ;; Check that the chars should really be composed into a symbol.
179 (let* ((start (match-beginning 0))
180 (end (match-end 0))
181 (syntaxes (if (eq (char-syntax (char-after start)) ?w)
182 '(?w) '(?. ?\\))))
183 (if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes)
184 (memq (char-syntax (or (char-after end) ?\ )) syntaxes)
185 (nth 8 (syntax-ppss)))
186 ;; No composition for you. Let's actually remove any composition
187 ;; we may have added earlier and which is now incorrect.
188 (remove-text-properties start end '(composition))
189 ;; That's a symbol alright, so add the composition.
190 (compose-region start end (cdr (assoc (match-string 0)
191 perl--prettify-symbols-alist)))))
192 ;; Return nil because we're not adding any face property.
193 nil)
194
195(defun perl--font-lock-symbols-keywords ()
196 (when perl-prettify-symbols
197 `((,(regexp-opt (mapcar 'car perl--prettify-symbols-alist) t)
198 (0 (perl--font-lock-compose-symbol))))))
199 165
200(defconst perl-font-lock-keywords-1 166(defconst perl-font-lock-keywords-1
201 '(;; What is this for? 167 '(;; What is this for?
@@ -243,8 +209,7 @@ Regexp match data 0 points to the chars."
243 ;; Fontify keywords with/and labels as we do in `c++-font-lock-keywords'. 209 ;; Fontify keywords with/and labels as we do in `c++-font-lock-keywords'.
244 ("\\<\\(continue\\|goto\\|last\\|next\\|redo\\)\\>[ \t]*\\(\\sw+\\)?" 210 ("\\<\\(continue\\|goto\\|last\\|next\\|redo\\)\\>[ \t]*\\(\\sw+\\)?"
245 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) 211 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
246 ("^[ \t]*\\(\\sw+\\)[ \t]*:[^:]" 1 font-lock-constant-face) 212 ("^[ \t]*\\(\\sw+\\)[ \t]*:[^:]" 1 font-lock-constant-face)))
247 ,@(perl--font-lock-symbols-keywords)))
248 "Gaudy level highlighting for Perl mode.") 213 "Gaudy level highlighting for Perl mode.")
249 214
250(defvar perl-font-lock-keywords perl-font-lock-keywords-1 215(defvar perl-font-lock-keywords perl-font-lock-keywords-1
@@ -685,13 +650,15 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'."
685 (setq-local comment-start-skip "\\(^\\|\\s-\\);?#+ *") 650 (setq-local comment-start-skip "\\(^\\|\\s-\\);?#+ *")
686 (setq-local comment-indent-function #'perl-comment-indent) 651 (setq-local comment-indent-function #'perl-comment-indent)
687 (setq-local parse-sexp-ignore-comments t) 652 (setq-local parse-sexp-ignore-comments t)
653
688 ;; Tell font-lock.el how to handle Perl. 654 ;; Tell font-lock.el how to handle Perl.
689 (setq font-lock-defaults '((perl-font-lock-keywords 655 (setq font-lock-defaults '((perl-font-lock-keywords
690 perl-font-lock-keywords-1 656 perl-font-lock-keywords-1
691 perl-font-lock-keywords-2) 657 perl-font-lock-keywords-2)
692 nil nil ((?\_ . "w")) nil 658 nil nil ((?\_ . "w")) nil
693 (font-lock-syntactic-face-function 659 (font-lock-syntactic-face-function
694 . perl-font-lock-syntactic-face-function))) 660 . perl-font-lock-syntactic-face-function)))
661 (prog-prettify-install perl--prettify-symbols-alist)
695 (setq-local syntax-propertize-function #'perl-syntax-propertize-function) 662 (setq-local syntax-propertize-function #'perl-syntax-propertize-function)
696 (add-hook 'syntax-propertize-extend-region-functions 663 (add-hook 'syntax-propertize-extend-region-functions
697 #'syntax-propertize-multiline 'append 'local) 664 #'syntax-propertize-multiline 'append 'local)
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
new file mode 100644
index 00000000000..e2700414636
--- /dev/null
+++ b/lisp/progmodes/prog-mode.el
@@ -0,0 +1,119 @@
1;;; prog-mode.el --- Generic major mode for programming -*- lexical-binding: t -*-
2
3;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5;; Maintainer: FSF
6;; Keywords: internal
7;; Package: emacs
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software: you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24;;; Commentary:
25
26;; This major mode is mostly intended as a parent of other programming
27;; modes. All major modes for programming languages should derive from this
28;; mode so that users can put generic customization on prog-mode-hook.
29
30;;; Code:
31
32(eval-when-compile (require 'cl-lib))
33
34(defgroup prog-mode nil
35 "Generic programming mode, from which others derive."
36 :group 'languages)
37
38(defvar prog-mode-map
39 (let ((map (make-sparse-keymap)))
40 (define-key map [?\C-\M-q] 'prog-indent-sexp)
41 map)
42 "Keymap used for programming modes.")
43
44(defun prog-indent-sexp (&optional defun)
45 "Indent the expression after point.
46When interactively called with prefix, indent the enclosing defun
47instead."
48 (interactive "P")
49 (save-excursion
50 (when defun
51 (end-of-line)
52 (beginning-of-defun))
53 (let ((start (point))
54 (end (progn (forward-sexp 1) (point))))
55 (indent-region start end nil))))
56
57(defvar prog-prettify-symbols-alist nil)
58
59(defcustom prog-prettify-symbols nil
60 "Whether symbols should be prettified.
61When set to an alist in the form `((STRING . CHARACTER)...)' it
62will augment the mode's native prettify alist."
63 :type '(choice
64 (const :tag "No thanks" nil)
65 (const :tag "Mode defaults" t)
66 (alist :tag "Mode defaults augmented with your own list"
67 :key-type string :value-type character))
68 :version "24.4")
69
70(defun prog--prettify-font-lock-compose-symbol (alist)
71 "Compose a sequence of ascii chars into a symbol.
72Regexp match data 0 points to the chars."
73 ;; Check that the chars should really be composed into a symbol.
74 (let* ((start (match-beginning 0))
75 (end (match-end 0))
76 (syntaxes (if (eq (char-syntax (char-after start)) ?w)
77 '(?w) '(?. ?\\))))
78 (if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes)
79 (memq (char-syntax (or (char-after end) ?\ )) syntaxes)
80 (nth 8 (syntax-ppss)))
81 ;; No composition for you. Let's actually remove any composition
82 ;; we may have added earlier and which is now incorrect.
83 (remove-text-properties start end '(composition))
84 ;; That's a symbol alright, so add the composition.
85 (compose-region start end (cdr (assoc (match-string 0) alist)))))
86 ;; Return nil because we're not adding any face property.
87 nil)
88
89(defun prog-prettify-font-lock-symbols-keywords ()
90 (when prog-prettify-symbols
91 (let ((alist (append prog-prettify-symbols-alist
92 (if (listp prog-prettify-symbols)
93 prog-prettify-symbols
94 nil))))
95 `((,(regexp-opt (mapcar 'car alist) t)
96 (0 (prog--prettify-font-lock-compose-symbol ',alist)))))))
97
98(defun prog-prettify-install (alist)
99"Install prog-mode support to prettify symbols according to ALIST.
100
101ALIST is in the format `((STRING . CHARACTER)...)' like
102`prog-prettify-symbols'.
103
104Internally, `font-lock-add-keywords' is called."
105 (setq-local prog-prettify-symbols-alist alist)
106 (let ((keywords (prog-prettify-font-lock-symbols-keywords)))
107 (if keywords (font-lock-add-keywords nil keywords))))
108
109;;;###autoload
110(define-derived-mode prog-mode fundamental-mode "Prog"
111 "Major mode for editing programming language source code."
112 (set (make-local-variable 'require-final-newline) mode-require-final-newline)
113 (set (make-local-variable 'parse-sexp-ignore-comments) t)
114 ;; Any programming language is always written left to right.
115 (setq bidi-paragraph-direction 'left-to-right))
116
117(provide 'prog-mode)
118
119;;; prog-mode.el ends here
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 63bd9258d69..0f3c1504ee9 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -1149,11 +1149,7 @@ VERSION is of the format (Major . Minor)"
1149 (set (make-local-variable 'comment-start) "%") 1149 (set (make-local-variable 'comment-start) "%")
1150 (set (make-local-variable 'comment-end) "") 1150 (set (make-local-variable 'comment-end) "")
1151 (set (make-local-variable 'comment-add) 1) 1151 (set (make-local-variable 'comment-add) 1)
1152 (set (make-local-variable 'comment-start-skip) 1152 (set (make-local-variable 'comment-start-skip) "\\(?:/\\*+ *\\|%%+ *\\)")
1153 ;; This complex regexp makes sure that comments cannot start
1154 ;; inside quoted atoms or strings
1155 (format "^\\(\\(%s\\|%s\\|[^\n\'\"%%]\\)*\\)\\(/\\*+ *\\|%%+ *\\)"
1156 prolog-quoted-atom-regexp prolog-string-regexp))
1157 (set (make-local-variable 'parens-require-spaces) nil) 1153 (set (make-local-variable 'parens-require-spaces) nil)
1158 ;; Initialize Prolog system specific variables 1154 ;; Initialize Prolog system specific variables
1159 (dolist (var '(prolog-keywords prolog-types prolog-mode-specificators 1155 (dolist (var '(prolog-keywords prolog-types prolog-mode-specificators
@@ -1739,8 +1735,7 @@ This function must be called from the source code buffer."
1739 (real-file buffer-file-name) 1735 (real-file buffer-file-name)
1740 (command-string (prolog-build-prolog-command compilep file 1736 (command-string (prolog-build-prolog-command compilep file
1741 real-file first-line)) 1737 real-file first-line))
1742 (process (get-process "prolog")) 1738 (process (get-process "prolog")))
1743 (old-filter (process-filter process)))
1744 (with-current-buffer buffer 1739 (with-current-buffer buffer
1745 (delete-region (point-min) (point-max)) 1740 (delete-region (point-min) (point-max))
1746 ;; FIXME: Wasn't this supposed to use prolog-inferior-mode? 1741 ;; FIXME: Wasn't this supposed to use prolog-inferior-mode?
@@ -1759,8 +1754,7 @@ This function must be called from the source code buffer."
1759 'prolog-parse-sicstus-compilation-errors)) 1754 'prolog-parse-sicstus-compilation-errors))
1760 (setq buffer-read-only nil) 1755 (setq buffer-read-only nil)
1761 (insert command-string "\n")) 1756 (insert command-string "\n"))
1762 (save-selected-window 1757 (display-buffer buffer)
1763 (pop-to-buffer buffer))
1764 (setq prolog-process-flag t 1758 (setq prolog-process-flag t
1765 prolog-consult-compile-output "" 1759 prolog-consult-compile-output ""
1766 prolog-consult-compile-first-line (if first-line (1- first-line) 0) 1760 prolog-consult-compile-first-line (if first-line (1- first-line) 0)
@@ -1954,20 +1948,6 @@ If COMPILEP is non-nil, compile, otherwise consult."
1954;;------------------------------------------------------------------- 1948;;-------------------------------------------------------------------
1955 1949
1956;; Auxiliary functions 1950;; Auxiliary functions
1957(defun prolog-make-keywords-regexp (keywords &optional protect)
1958 "Create regexp from the list of strings KEYWORDS.
1959If PROTECT is non-nil, surround the result regexp by word breaks."
1960 (let ((regexp
1961 (if (fboundp 'regexp-opt)
1962 ;; Emacs 20
1963 ;; Avoid compile warnings under earlier versions by using eval
1964 (eval '(regexp-opt keywords))
1965 ;; Older Emacsen
1966 (concat (mapconcat 'regexp-quote keywords "\\|")))
1967 ))
1968 (if protect
1969 (concat "\\<\\(" regexp "\\)\\>")
1970 regexp)))
1971 1951
1972(defun prolog-font-lock-object-matcher (bound) 1952(defun prolog-font-lock-object-matcher (bound)
1973 "Find SICStus objects method name for font lock. 1953 "Find SICStus objects method name for font lock.
@@ -2084,20 +2064,16 @@ Argument BOUND is a buffer position limiting searching."
2084 (if (eq prolog-system 'mercury) 2064 (if (eq prolog-system 'mercury)
2085 (concat 2065 (concat
2086 "\\<\\(" 2066 "\\<\\("
2087 (prolog-make-keywords-regexp prolog-keywords-i) 2067 (regexp-opt prolog-keywords-i)
2088 "\\|" 2068 "\\|"
2089 (prolog-make-keywords-regexp 2069 (regexp-opt
2090 prolog-determinism-specificators-i) 2070 prolog-determinism-specificators-i)
2091 "\\)\\>") 2071 "\\)\\>")
2092 (concat 2072 (concat
2093 "^[?:]- *\\(" 2073 "^[?:]- *\\("
2094 (prolog-make-keywords-regexp prolog-keywords-i) 2074 (regexp-opt prolog-keywords-i)
2095 "\\)\\>")) 2075 "\\)\\>"))
2096 1 prolog-builtin-face)) 2076 1 prolog-builtin-face))
2097 (quoted_atom (list prolog-quoted-atom-regexp
2098 2 'font-lock-string-face 'append))
2099 (string (list prolog-string-regexp
2100 1 'font-lock-string-face 'append))
2101 ;; SICStus specific patterns 2077 ;; SICStus specific patterns
2102 (sicstus-object-methods 2078 (sicstus-object-methods
2103 (if (eq prolog-system 'sicstus) 2079 (if (eq prolog-system 'sicstus)
@@ -2107,17 +2083,17 @@ Argument BOUND is a buffer position limiting searching."
2107 (types 2083 (types
2108 (if (eq prolog-system 'mercury) 2084 (if (eq prolog-system 'mercury)
2109 (list 2085 (list
2110 (prolog-make-keywords-regexp prolog-types-i t) 2086 (regexp-opt prolog-types-i 'words)
2111 0 'font-lock-type-face))) 2087 0 'font-lock-type-face)))
2112 (modes 2088 (modes
2113 (if (eq prolog-system 'mercury) 2089 (if (eq prolog-system 'mercury)
2114 (list 2090 (list
2115 (prolog-make-keywords-regexp prolog-mode-specificators-i t) 2091 (regexp-opt prolog-mode-specificators-i 'words)
2116 0 'font-lock-constant-face))) 2092 0 'font-lock-constant-face)))
2117 (directives 2093 (directives
2118 (if (eq prolog-system 'mercury) 2094 (if (eq prolog-system 'mercury)
2119 (list 2095 (list
2120 (prolog-make-keywords-regexp prolog-directives-i t) 2096 (regexp-opt prolog-directives-i 'words)
2121 0 'prolog-warning-face))) 2097 0 'prolog-warning-face)))
2122 ;; Inferior mode specific patterns 2098 ;; Inferior mode specific patterns
2123 (prompt 2099 (prompt
@@ -2211,8 +2187,6 @@ Argument BOUND is a buffer position limiting searching."
2211 (list 2187 (list
2212 head-predicates 2188 head-predicates
2213 head-predicates-1 2189 head-predicates-1
2214 quoted_atom
2215 string
2216 variables 2190 variables
2217 important-elements 2191 important-elements
2218 important-elements-1 2192 important-elements-1
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 641563ae0ab..ccb2dcba42e 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -157,7 +157,7 @@
157 157
158;; Skeletons: 6 skeletons are provided for simple inserting of class, 158;; Skeletons: 6 skeletons are provided for simple inserting of class,
159;; def, for, if, try and while. These skeletons are integrated with 159;; def, for, if, try and while. These skeletons are integrated with
160;; dabbrev. If you have `dabbrev-mode' activated and 160;; abbrev. If you have `abbrev-mode' activated and
161;; `python-skeleton-autoinsert' is set to t, then whenever you type 161;; `python-skeleton-autoinsert' is set to t, then whenever you type
162;; the name of any of those defined and hit SPC, they will be 162;; the name of any of those defined and hit SPC, they will be
163;; automatically expanded. As an alternative you can use the defined 163;; automatically expanded. As an alternative you can use the defined
@@ -642,7 +642,8 @@ It makes underscores and dots word constituent chars.")
642These make `python-indent-calculate-indentation' subtract the value of 642These make `python-indent-calculate-indentation' subtract the value of
643`python-indent-offset'.") 643`python-indent-offset'.")
644 644
645(defvar python-indent-block-enders '("return" "pass") 645(defvar python-indent-block-enders
646 '("break" "continue" "pass" "raise" "return")
646 "List of words that mark the end of a block. 647 "List of words that mark the end of a block.
647These make `python-indent-calculate-indentation' subtract the 648These make `python-indent-calculate-indentation' subtract the
648value of `python-indent-offset' when `python-indent-context' is 649value of `python-indent-offset' when `python-indent-context' is
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index a96ee64a229..fa4efe49b7b 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1349,6 +1349,7 @@ If the result is do-end block, it will always be multiline."
1349(declare-function ruby-syntax-propertize-percent-literal "ruby-mode" (limit)) 1349(declare-function ruby-syntax-propertize-percent-literal "ruby-mode" (limit))
1350;; Unusual code layout confuses the byte-compiler. 1350;; Unusual code layout confuses the byte-compiler.
1351(declare-function ruby-syntax-propertize-expansion "ruby-mode" ()) 1351(declare-function ruby-syntax-propertize-expansion "ruby-mode" ())
1352(declare-function ruby-syntax-expansion-allowed-p "ruby-mode" (parse-state))
1352 1353
1353(if (eval-when-compile (fboundp #'syntax-propertize-rules)) 1354(if (eval-when-compile (fboundp #'syntax-propertize-rules))
1354 ;; New code that works independently from font-lock. 1355 ;; New code that works independently from font-lock.
@@ -1380,51 +1381,52 @@ It will be properly highlighted even when the call omits parens.")
1380 1381
1381 (defun ruby-syntax-propertize-function (start end) 1382 (defun ruby-syntax-propertize-function (start end)
1382 "Syntactic keywords for Ruby mode. See `syntax-propertize-function'." 1383 "Syntactic keywords for Ruby mode. See `syntax-propertize-function'."
1383 (goto-char start) 1384 (let (case-fold-search)
1384 (remove-text-properties start end '(ruby-expansion-match-data)) 1385 (goto-char start)
1385 (ruby-syntax-propertize-heredoc end) 1386 (remove-text-properties start end '(ruby-expansion-match-data))
1386 (ruby-syntax-enclosing-percent-literal end) 1387 (ruby-syntax-propertize-heredoc end)
1387 (funcall 1388 (ruby-syntax-enclosing-percent-literal end)
1388 (syntax-propertize-rules 1389 (funcall
1389 ;; $' $" $` .... are variables. 1390 (syntax-propertize-rules
1390 ;; ?' ?" ?` are ascii codes. 1391 ;; $' $" $` .... are variables.
1391 ("\\([?$]\\)[#\"'`]" 1392 ;; ?' ?" ?` are ascii codes.
1392 (1 (unless (save-excursion 1393 ("\\([?$]\\)[#\"'`]"
1393 ;; Not within a string. 1394 (1 (unless (save-excursion
1394 (nth 3 (syntax-ppss (match-beginning 0)))) 1395 ;; Not within a string.
1395 (string-to-syntax "\\")))) 1396 (nth 3 (syntax-ppss (match-beginning 0))))
1396 ;; Regular expressions. Start with matching unescaped slash. 1397 (string-to-syntax "\\"))))
1397 ("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)" 1398 ;; Regular expressions. Start with matching unescaped slash.
1398 (1 (let ((state (save-excursion (syntax-ppss (match-beginning 1))))) 1399 ("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)"
1399 (when (or 1400 (1 (let ((state (save-excursion (syntax-ppss (match-beginning 1)))))
1400 ;; Beginning of a regexp. 1401 (when (or
1401 (and (null (nth 8 state)) 1402 ;; Beginning of a regexp.
1402 (save-excursion 1403 (and (null (nth 8 state))
1403 (forward-char -1) 1404 (save-excursion
1404 (looking-back ruby-syntax-before-regexp-re 1405 (forward-char -1)
1405 (point-at-bol)))) 1406 (looking-back ruby-syntax-before-regexp-re
1406 ;; End of regexp. We don't match the whole 1407 (point-at-bol))))
1407 ;; regexp at once because it can have 1408 ;; End of regexp. We don't match the whole
1408 ;; string interpolation inside, or span 1409 ;; regexp at once because it can have
1409 ;; several lines. 1410 ;; string interpolation inside, or span
1410 (eq ?/ (nth 3 state))) 1411 ;; several lines.
1411 (string-to-syntax "\"/"))))) 1412 (eq ?/ (nth 3 state)))
1412 ;; Expression expansions in strings. We're handling them 1413 (string-to-syntax "\"/")))))
1413 ;; here, so that the regexp rule never matches inside them. 1414 ;; Expression expansions in strings. We're handling them
1414 (ruby-expression-expansion-re 1415 ;; here, so that the regexp rule never matches inside them.
1415 (0 (ignore (ruby-syntax-propertize-expansion)))) 1416 (ruby-expression-expansion-re
1416 ("^=en\\(d\\)\\_>" (1 "!")) 1417 (0 (ignore (ruby-syntax-propertize-expansion))))
1417 ("^\\(=\\)begin\\_>" (1 "!")) 1418 ("^=en\\(d\\)\\_>" (1 "!"))
1418 ;; Handle here documents. 1419 ("^\\(=\\)begin\\_>" (1 "!"))
1419 ((concat ruby-here-doc-beg-re ".*\\(\n\\)") 1420 ;; Handle here documents.
1420 (7 (unless (ruby-singleton-class-p (match-beginning 0)) 1421 ((concat ruby-here-doc-beg-re ".*\\(\n\\)")
1421 (put-text-property (match-beginning 7) (match-end 7) 1422 (7 (unless (ruby-singleton-class-p (match-beginning 0))
1422 'syntax-table (string-to-syntax "\"")) 1423 (put-text-property (match-beginning 7) (match-end 7)
1423 (ruby-syntax-propertize-heredoc end)))) 1424 'syntax-table (string-to-syntax "\""))
1424 ;; Handle percent literals: %w(), %q{}, etc. 1425 (ruby-syntax-propertize-heredoc end))))
1425 ((concat "\\(?:^\\|[[ \t\n<+(,=]\\)" ruby-percent-literal-beg-re) 1426 ;; Handle percent literals: %w(), %q{}, etc.
1426 (1 (prog1 "|" (ruby-syntax-propertize-percent-literal end))))) 1427 ((concat "\\(?:^\\|[[ \t\n<+(,=]\\)" ruby-percent-literal-beg-re)
1427 (point) end)) 1428 (1 (prog1 "|" (ruby-syntax-propertize-percent-literal end)))))
1429 (point) end)))
1428 1430
1429 (defun ruby-syntax-propertize-heredoc (limit) 1431 (defun ruby-syntax-propertize-heredoc (limit)
1430 (let ((ppss (syntax-ppss)) 1432 (let ((ppss (syntax-ppss))
@@ -1496,9 +1498,10 @@ It will be properly highlighted even when the call omits parens.")
1496 (defun ruby-syntax-propertize-expansion () 1498 (defun ruby-syntax-propertize-expansion ()
1497 ;; Save the match data to a text property, for font-locking later. 1499 ;; Save the match data to a text property, for font-locking later.
1498 ;; Set the syntax of all double quotes and backticks to punctuation. 1500 ;; Set the syntax of all double quotes and backticks to punctuation.
1499 (let ((beg (match-beginning 2)) 1501 (let* ((beg (match-beginning 2))
1500 (end (match-end 2))) 1502 (end (match-end 2))
1501 (when (and beg (save-excursion (nth 3 (syntax-ppss beg)))) 1503 (state (and beg (save-excursion (syntax-ppss beg)))))
1504 (when (ruby-syntax-expansion-allowed-p state)
1502 (put-text-property beg (1+ beg) 'ruby-expansion-match-data 1505 (put-text-property beg (1+ beg) 'ruby-expansion-match-data
1503 (match-data)) 1506 (match-data))
1504 (goto-char beg) 1507 (goto-char beg)
@@ -1506,6 +1509,17 @@ It will be properly highlighted even when the call omits parens.")
1506 (put-text-property (match-beginning 0) (match-end 0) 1509 (put-text-property (match-beginning 0) (match-end 0)
1507 'syntax-table (string-to-syntax ".")))))) 1510 'syntax-table (string-to-syntax "."))))))
1508 1511
1512 (defun ruby-syntax-expansion-allowed-p (parse-state)
1513 "Return non-nil if expression expansion is allowed."
1514 (let ((term (nth 3 parse-state)))
1515 (cond
1516 ((memq term '(?\" ?` ?\n ?/)))
1517 ((eq term t)
1518 (save-match-data
1519 (save-excursion
1520 (goto-char (nth 8 parse-state))
1521 (looking-at "%\\(?:[QWrx]\\|\\W\\)")))))))
1522
1509 (defun ruby-syntax-propertize-expansions (start end) 1523 (defun ruby-syntax-propertize-expansions (start end)
1510 (save-excursion 1524 (save-excursion
1511 (goto-char start) 1525 (goto-char start)
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 9169a433015..3e91aeba9a1 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -266,7 +266,7 @@ quoted for Tcl."
266 ;; Maybe someone has a better set? 266 ;; Maybe someone has a better set?
267 (let ((map (make-sparse-keymap))) 267 (let ((map (make-sparse-keymap)))
268 ;; Will inherit from `comint-mode-map' thanks to define-derived-mode. 268 ;; Will inherit from `comint-mode-map' thanks to define-derived-mode.
269 (define-key map "\t" 'comint-dynamic-complete) 269 (define-key map "\t" 'completion-at-point)
270 (define-key map "\M-?" 'comint-dynamic-list-filename-completions) 270 (define-key map "\M-?" 'comint-dynamic-list-filename-completions)
271 (define-key map "\177" 'backward-delete-char-untabify) 271 (define-key map "\177" 'backward-delete-char-untabify)
272 (define-key map "\M-\C-x" 'tcl-eval-defun) 272 (define-key map "\M-\C-x" 'tcl-eval-defun)
diff --git a/lisp/replace.el b/lisp/replace.el
index 86956a614cd..24cfccf60fd 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -246,10 +246,14 @@ Matching is independent of case if `case-fold-search' is non-nil and
246FROM-STRING has no uppercase letters. Replacement transfers the case 246FROM-STRING has no uppercase letters. Replacement transfers the case
247pattern of the old text to the new text, if `case-replace' and 247pattern of the old text to the new text, if `case-replace' and
248`case-fold-search' are non-nil and FROM-STRING has no uppercase 248`case-fold-search' are non-nil and FROM-STRING has no uppercase
249letters. \(Transferring the case pattern means that if the old text 249letters. (Transferring the case pattern means that if the old text
250matched is all caps, or capitalized, then its replacement is upcased 250matched is all caps, or capitalized, then its replacement is upcased
251or capitalized.) 251or capitalized.)
252 252
253Ignore read-only matches if `query-replace-skip-read-only' is non-nil,
254ignore hidden matches if `search-invisible' is nil, and ignore more
255matches using a non-nil `isearch-filter-predicates'.
256
253If `replace-lax-whitespace' is non-nil, a space or spaces in the string 257If `replace-lax-whitespace' is non-nil, a space or spaces in the string
254to be replaced will match a sequence of whitespace chars defined by the 258to be replaced will match a sequence of whitespace chars defined by the
255regexp in `search-whitespace-regexp'. 259regexp in `search-whitespace-regexp'.
@@ -300,6 +304,10 @@ pattern of the old text to the new text, if `case-replace' and
300all caps, or capitalized, then its replacement is upcased or 304all caps, or capitalized, then its replacement is upcased or
301capitalized.) 305capitalized.)
302 306
307Ignore read-only matches if `query-replace-skip-read-only' is non-nil,
308ignore hidden matches if `search-invisible' is nil, and ignore more
309matches using a non-nil `isearch-filter-predicates'.
310
303If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp 311If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp
304to be replaced will match a sequence of whitespace chars defined by the 312to be replaced will match a sequence of whitespace chars defined by the
305regexp in `search-whitespace-regexp'. 313regexp in `search-whitespace-regexp'.
@@ -380,6 +388,10 @@ that reads REGEXP.
380Preserves case in each replacement if `case-replace' and `case-fold-search' 388Preserves case in each replacement if `case-replace' and `case-fold-search'
381are non-nil and REGEXP has no uppercase letters. 389are non-nil and REGEXP has no uppercase letters.
382 390
391Ignore read-only matches if `query-replace-skip-read-only' is non-nil,
392ignore hidden matches if `search-invisible' is nil, and ignore more
393matches using a non-nil `isearch-filter-predicates'.
394
383If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp 395If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp
384to be replaced will match a sequence of whitespace chars defined by the 396to be replaced will match a sequence of whitespace chars defined by the
385regexp in `search-whitespace-regexp'. 397regexp in `search-whitespace-regexp'.
@@ -470,6 +482,10 @@ are non-nil and FROM-STRING has no uppercase letters.
470\(Preserving case means that if the string matched is all caps, or capitalized, 482\(Preserving case means that if the string matched is all caps, or capitalized,
471then its replacement is upcased or capitalized.) 483then its replacement is upcased or capitalized.)
472 484
485Ignore read-only matches if `query-replace-skip-read-only' is non-nil,
486ignore hidden matches if `search-invisible' is nil, and ignore more
487matches using a non-nil `isearch-filter-predicates'.
488
473If `replace-lax-whitespace' is non-nil, a space or spaces in the string 489If `replace-lax-whitespace' is non-nil, a space or spaces in the string
474to be replaced will match a sequence of whitespace chars defined by the 490to be replaced will match a sequence of whitespace chars defined by the
475regexp in `search-whitespace-regexp'. 491regexp in `search-whitespace-regexp'.
@@ -512,6 +528,10 @@ and TO-STRING is also null.)"
512Preserve case in each match if `case-replace' and `case-fold-search' 528Preserve case in each match if `case-replace' and `case-fold-search'
513are non-nil and REGEXP has no uppercase letters. 529are non-nil and REGEXP has no uppercase letters.
514 530
531Ignore read-only matches if `query-replace-skip-read-only' is non-nil,
532ignore hidden matches if `search-invisible' is nil, and ignore more
533matches using a non-nil `isearch-filter-predicates'.
534
515If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp 535If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp
516to be replaced will match a sequence of whitespace chars defined by the 536to be replaced will match a sequence of whitespace chars defined by the
517regexp in `search-whitespace-regexp'. 537regexp in `search-whitespace-regexp'.
@@ -1155,8 +1175,8 @@ is called only during interactive use.
1155 1175
1156For example, to check for occurrence of symbol at point use 1176For example, to check for occurrence of symbol at point use
1157 1177
1158 \(setq occur-read-regexp-defaults-function 1178 (setq occur-read-regexp-defaults-function
1159 'find-tag-default-as-regexp\).") 1179 'find-tag-default-as-regexp).")
1160 1180
1161(defun occur-read-regexp-defaults () 1181(defun occur-read-regexp-defaults ()
1162 "Return the latest regexp from `regexp-history'. 1182 "Return the latest regexp from `regexp-history'.
@@ -1369,16 +1389,18 @@ See also `multi-occur'."
1369(defun occur-engine (regexp buffers out-buf nlines case-fold 1389(defun occur-engine (regexp buffers out-buf nlines case-fold
1370 title-face prefix-face match-face keep-props) 1390 title-face prefix-face match-face keep-props)
1371 (with-current-buffer out-buf 1391 (with-current-buffer out-buf
1372 (let ((globalcount 0) 1392 (let ((global-lines 0) ;; total count of matching lines
1393 (global-matches 0) ;; total count of matches
1373 (coding nil) 1394 (coding nil)
1374 (case-fold-search case-fold)) 1395 (case-fold-search case-fold))
1375 ;; Map over all the buffers 1396 ;; Map over all the buffers
1376 (dolist (buf buffers) 1397 (dolist (buf buffers)
1377 (when (buffer-live-p buf) 1398 (when (buffer-live-p buf)
1378 (let ((matches 0) ;; count of matched lines 1399 (let ((lines 0) ;; count of matching lines
1379 (lines 1) ;; line count 1400 (matches 0) ;; count of matches
1380 (prev-after-lines nil) ;; context lines of prev match 1401 (curr-line 1) ;; line count
1381 (prev-lines nil) ;; line number of prev match endpt 1402 (prev-line nil) ;; line number of prev match endpt
1403 (prev-after-lines nil) ;; context lines of prev match
1382 (matchbeg 0) 1404 (matchbeg 0)
1383 (origpt nil) 1405 (origpt nil)
1384 (begpt nil) 1406 (begpt nil)
@@ -1399,7 +1421,7 @@ See also `multi-occur'."
1399 (while (not (eobp)) 1421 (while (not (eobp))
1400 (setq origpt (point)) 1422 (setq origpt (point))
1401 (when (setq endpt (re-search-forward regexp nil t)) 1423 (when (setq endpt (re-search-forward regexp nil t))
1402 (setq matches (1+ matches)) ;; increment match count 1424 (setq lines (1+ lines)) ;; increment matching lines count
1403 (setq matchbeg (match-beginning 0)) 1425 (setq matchbeg (match-beginning 0))
1404 ;; Get beginning of first match line and end of the last. 1426 ;; Get beginning of first match line and end of the last.
1405 (save-excursion 1427 (save-excursion
@@ -1408,7 +1430,7 @@ See also `multi-occur'."
1408 (goto-char endpt) 1430 (goto-char endpt)
1409 (setq endpt (line-end-position))) 1431 (setq endpt (line-end-position)))
1410 ;; Sum line numbers up to the first match line. 1432 ;; Sum line numbers up to the first match line.
1411 (setq lines (+ lines (count-lines origpt begpt))) 1433 (setq curr-line (+ curr-line (count-lines origpt begpt)))
1412 (setq marker (make-marker)) 1434 (setq marker (make-marker))
1413 (set-marker marker matchbeg) 1435 (set-marker marker matchbeg)
1414 (setq curstring (occur-engine-line begpt endpt keep-props)) 1436 (setq curstring (occur-engine-line begpt endpt keep-props))
@@ -1417,6 +1439,7 @@ See also `multi-occur'."
1417 (start 0)) 1439 (start 0))
1418 (while (and (< start len) 1440 (while (and (< start len)
1419 (string-match regexp curstring start)) 1441 (string-match regexp curstring start))
1442 (setq matches (1+ matches))
1420 (add-text-properties 1443 (add-text-properties
1421 (match-beginning 0) (match-end 0) 1444 (match-beginning 0) (match-end 0)
1422 (append 1445 (append
@@ -1430,7 +1453,7 @@ See also `multi-occur'."
1430 ;; Generate the string to insert for this match 1453 ;; Generate the string to insert for this match
1431 (let* ((match-prefix 1454 (let* ((match-prefix
1432 ;; Using 7 digits aligns tabs properly. 1455 ;; Using 7 digits aligns tabs properly.
1433 (apply #'propertize (format "%7d:" lines) 1456 (apply #'propertize (format "%7d:" curr-line)
1434 (append 1457 (append
1435 (when prefix-face 1458 (when prefix-face
1436 `(font-lock-face ,prefix-face)) 1459 `(font-lock-face ,prefix-face))
@@ -1470,7 +1493,7 @@ See also `multi-occur'."
1470 ;; The complex multi-line display style. 1493 ;; The complex multi-line display style.
1471 (setq ret (occur-context-lines 1494 (setq ret (occur-context-lines
1472 out-line nlines keep-props begpt endpt 1495 out-line nlines keep-props begpt endpt
1473 lines prev-lines prev-after-lines 1496 curr-line prev-line prev-after-lines
1474 prefix-face)) 1497 prefix-face))
1475 ;; Set first elem of the returned list to `data', 1498 ;; Set first elem of the returned list to `data',
1476 ;; and the second elem to `prev-after-lines'. 1499 ;; and the second elem to `prev-after-lines'.
@@ -1483,28 +1506,34 @@ See also `multi-occur'."
1483 (if endpt 1506 (if endpt
1484 (progn 1507 (progn
1485 ;; Sum line numbers between first and last match lines. 1508 ;; Sum line numbers between first and last match lines.
1486 (setq lines (+ lines (count-lines begpt endpt) 1509 (setq curr-line (+ curr-line (count-lines begpt endpt)
1487 ;; Add 1 for empty last match line since 1510 ;; Add 1 for empty last match line since
1488 ;; count-lines returns 1 line less. 1511 ;; count-lines returns 1 line less.
1489 (if (and (bolp) (eolp)) 1 0))) 1512 (if (and (bolp) (eolp)) 1 0)))
1490 ;; On to the next match... 1513 ;; On to the next match...
1491 (forward-line 1)) 1514 (forward-line 1))
1492 (goto-char (point-max))) 1515 (goto-char (point-max)))
1493 (setq prev-lines (1- lines))) 1516 (setq prev-line (1- curr-line)))
1494 ;; Flush remaining context after-lines. 1517 ;; Flush remaining context after-lines.
1495 (when prev-after-lines 1518 (when prev-after-lines
1496 (with-current-buffer out-buf 1519 (with-current-buffer out-buf
1497 (insert (apply #'concat (occur-engine-add-prefix 1520 (insert (apply #'concat (occur-engine-add-prefix
1498 prev-after-lines prefix-face))))))) 1521 prev-after-lines prefix-face)))))))
1499 (when (not (zerop matches)) ;; is the count zero? 1522 (when (not (zerop lines)) ;; is the count zero?
1500 (setq globalcount (+ globalcount matches)) 1523 (setq global-lines (+ global-lines lines)
1524 global-matches (+ global-matches matches))
1501 (with-current-buffer out-buf 1525 (with-current-buffer out-buf
1502 (goto-char headerpt) 1526 (goto-char headerpt)
1503 (let ((beg (point)) 1527 (let ((beg (point))
1504 end) 1528 end)
1505 (insert (propertize 1529 (insert (propertize
1506 (format "%d match%s%s in buffer: %s\n" 1530 (format "%d match%s%s%s in buffer: %s\n"
1507 matches (if (= matches 1) "" "es") 1531 matches (if (= matches 1) "" "es")
1532 ;; Don't display the same number of lines
1533 ;; and matches in case of 1 match per line.
1534 (if (= lines matches)
1535 "" (format " in %d line%s"
1536 lines (if (= lines 1) "" "s")))
1508 ;; Don't display regexp for multi-buffer. 1537 ;; Don't display regexp for multi-buffer.
1509 (if (> (length buffers) 1) 1538 (if (> (length buffers) 1)
1510 "" (format " for \"%s\"" 1539 "" (format " for \"%s\""
@@ -1519,12 +1548,17 @@ See also `multi-occur'."
1519 `(occur-title ,buf)))) 1548 `(occur-title ,buf))))
1520 (goto-char (point-min))))))) 1549 (goto-char (point-min)))))))
1521 ;; Display total match count and regexp for multi-buffer. 1550 ;; Display total match count and regexp for multi-buffer.
1522 (when (and (not (zerop globalcount)) (> (length buffers) 1)) 1551 (when (and (not (zerop global-lines)) (> (length buffers) 1))
1523 (goto-char (point-min)) 1552 (goto-char (point-min))
1524 (let ((beg (point)) 1553 (let ((beg (point))
1525 end) 1554 end)
1526 (insert (format "%d match%s total for \"%s\":\n" 1555 (insert (format "%d match%s%s total for \"%s\":\n"
1527 globalcount (if (= globalcount 1) "" "es") 1556 global-matches (if (= global-matches 1) "" "es")
1557 ;; Don't display the same number of lines
1558 ;; and matches in case of 1 match per line.
1559 (if (= global-lines global-matches)
1560 "" (format " in %d line%s"
1561 global-lines (if (= global-lines 1) "" "s")))
1528 (query-replace-descr regexp))) 1562 (query-replace-descr regexp)))
1529 (setq end (point)) 1563 (setq end (point))
1530 (add-text-properties beg end (when title-face 1564 (add-text-properties beg end (when title-face
@@ -1536,7 +1570,7 @@ See also `multi-occur'."
1536 ;; buffer. 1570 ;; buffer.
1537 (set-buffer-file-coding-system coding)) 1571 (set-buffer-file-coding-system coding))
1538 ;; Return the number of matches 1572 ;; Return the number of matches
1539 globalcount))) 1573 global-matches)))
1540 1574
1541(defun occur-engine-line (beg end &optional keep-props) 1575(defun occur-engine-line (beg end &optional keep-props)
1542 (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode) 1576 (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode)
@@ -1579,13 +1613,13 @@ See also `multi-occur'."
1579;; Generate context display for occur. 1613;; Generate context display for occur.
1580;; OUT-LINE is the line where the match is. 1614;; OUT-LINE is the line where the match is.
1581;; NLINES and KEEP-PROPS are args to occur-engine. 1615;; NLINES and KEEP-PROPS are args to occur-engine.
1582;; LINES is line count of the current match, 1616;; CURR-LINE is line count of the current match,
1583;; PREV-LINES is line count of the previous match, 1617;; PREV-LINE is line count of the previous match,
1584;; PREV-AFTER-LINES is a list of after-context lines of the previous match. 1618;; PREV-AFTER-LINES is a list of after-context lines of the previous match.
1585;; Generate a list of lines, add prefixes to all but OUT-LINE, 1619;; Generate a list of lines, add prefixes to all but OUT-LINE,
1586;; then concatenate them all together. 1620;; then concatenate them all together.
1587(defun occur-context-lines (out-line nlines keep-props begpt endpt 1621(defun occur-context-lines (out-line nlines keep-props begpt endpt
1588 lines prev-lines prev-after-lines 1622 curr-line prev-line prev-after-lines
1589 &optional prefix-face) 1623 &optional prefix-face)
1590 ;; Find after- and before-context lines of the current match. 1624 ;; Find after- and before-context lines of the current match.
1591 (let ((before-lines 1625 (let ((before-lines
@@ -1601,22 +1635,22 @@ See also `multi-occur'."
1601 1635
1602 (when prev-after-lines 1636 (when prev-after-lines
1603 ;; Don't overlap prev after-lines with current before-lines. 1637 ;; Don't overlap prev after-lines with current before-lines.
1604 (if (>= (+ prev-lines (length prev-after-lines)) 1638 (if (>= (+ prev-line (length prev-after-lines))
1605 (- lines (length before-lines))) 1639 (- curr-line (length before-lines)))
1606 (setq prev-after-lines 1640 (setq prev-after-lines
1607 (butlast prev-after-lines 1641 (butlast prev-after-lines
1608 (- (length prev-after-lines) 1642 (- (length prev-after-lines)
1609 (- lines prev-lines (length before-lines) 1)))) 1643 (- curr-line prev-line (length before-lines) 1))))
1610 ;; Separate non-overlapping context lines with a dashed line. 1644 ;; Separate non-overlapping context lines with a dashed line.
1611 (setq separator "-------\n"))) 1645 (setq separator "-------\n")))
1612 1646
1613 (when prev-lines 1647 (when prev-line
1614 ;; Don't overlap current before-lines with previous match line. 1648 ;; Don't overlap current before-lines with previous match line.
1615 (if (<= (- lines (length before-lines)) 1649 (if (<= (- curr-line (length before-lines))
1616 prev-lines) 1650 prev-line)
1617 (setq before-lines 1651 (setq before-lines
1618 (nthcdr (- (length before-lines) 1652 (nthcdr (- (length before-lines)
1619 (- lines prev-lines 1)) 1653 (- curr-line prev-line 1))
1620 before-lines)) 1654 before-lines))
1621 ;; Separate non-overlapping before-context lines. 1655 ;; Separate non-overlapping before-context lines.
1622 (unless (> nlines 0) 1656 (unless (> nlines 0)
@@ -1840,7 +1874,7 @@ It is called with three arguments, as if it were
1840 1874
1841(defun replace-search (search-string limit regexp-flag delimited-flag 1875(defun replace-search (search-string limit regexp-flag delimited-flag
1842 case-fold-search) 1876 case-fold-search)
1843 "Search for the next occurence of SEARCH-STRING to replace." 1877 "Search for the next occurrence of SEARCH-STRING to replace."
1844 ;; Let-bind global isearch-* variables to values used 1878 ;; Let-bind global isearch-* variables to values used
1845 ;; to search the next replacement. These let-bindings 1879 ;; to search the next replacement. These let-bindings
1846 ;; should be effective both at the time of calling 1880 ;; should be effective both at the time of calling
@@ -1934,6 +1968,9 @@ make, or the user didn't cancel the call."
1934 (keep-going t) 1968 (keep-going t)
1935 (stack nil) 1969 (stack nil)
1936 (replace-count 0) 1970 (replace-count 0)
1971 (skip-read-only-count 0)
1972 (skip-filtered-count 0)
1973 (skip-invisible-count 0)
1937 (nonempty-match nil) 1974 (nonempty-match nil)
1938 (multi-buffer nil) 1975 (multi-buffer nil)
1939 (recenter-last-op nil) ; Start cycling order with initial position. 1976 (recenter-last-op nil) ; Start cycling order with initial position.
@@ -2042,20 +2079,27 @@ make, or the user didn't cancel the call."
2042 (and (/= (nth 0 match) (nth 1 match)) 2079 (and (/= (nth 0 match) (nth 1 match))
2043 match)))))) 2080 match))))))
2044 2081
2045 ;; Optionally ignore matches that have a read-only property. 2082 (cond
2046 (when (and (or (not query-replace-skip-read-only) 2083 ;; Optionally ignore matches that have a read-only property.
2047 (not (text-property-not-all 2084 ((not (or (not query-replace-skip-read-only)
2048 (nth 0 real-match-data) (nth 1 real-match-data) 2085 (not (text-property-not-all
2049 'read-only nil))) 2086 (nth 0 real-match-data) (nth 1 real-match-data)
2050 ;; Optionally filter out matches. 2087 'read-only nil))))
2051 (run-hook-with-args-until-failure 2088 (setq skip-read-only-count (1+ skip-read-only-count)))
2052 'isearch-filter-predicates 2089 ;; Optionally filter out matches.
2053 (nth 0 real-match-data) (nth 1 real-match-data)) 2090 ((not (run-hook-with-args-until-failure
2054 ;; Optionally ignore invisible matches. 2091 'isearch-filter-predicates
2055 (or (eq search-invisible t) 2092 (nth 0 real-match-data) (nth 1 real-match-data)))
2056 (not (isearch-range-invisible 2093 (setq skip-filtered-count (1+ skip-filtered-count)))
2057 (nth 0 real-match-data) (nth 1 real-match-data))))) 2094 ;; Optionally ignore invisible matches.
2058 2095 ((not (or (eq search-invisible t)
2096 ;; Don't open overlays for automatic replacements.
2097 (and (not query-flag) search-invisible)
2098 ;; Open hidden overlays for interactive replacements.
2099 (not (isearch-range-invisible
2100 (nth 0 real-match-data) (nth 1 real-match-data)))))
2101 (setq skip-invisible-count (1+ skip-invisible-count)))
2102 (t
2059 ;; Calculate the replacement string, if necessary. 2103 ;; Calculate the replacement string, if necessary.
2060 (when replacements 2104 (when replacements
2061 (set-match-data real-match-data) 2105 (set-match-data real-match-data)
@@ -2260,13 +2304,31 @@ make, or the user didn't cancel the call."
2260 (match-end 0) 2304 (match-end 0)
2261 (current-buffer)) 2305 (current-buffer))
2262 (match-data t))) 2306 (match-data t)))
2263 stack))))) 2307 stack))))))
2264 2308
2265 (replace-dehighlight)) 2309 (replace-dehighlight))
2266 (or unread-command-events 2310 (or unread-command-events
2267 (message "Replaced %d occurrence%s" 2311 (message "Replaced %d occurrence%s%s"
2268 replace-count 2312 replace-count
2269 (if (= replace-count 1) "" "s"))) 2313 (if (= replace-count 1) "" "s")
2314 (if (> (+ skip-read-only-count
2315 skip-filtered-count
2316 skip-invisible-count) 0)
2317 (format " (skipped %s)"
2318 (mapconcat
2319 'identity
2320 (delq nil (list
2321 (if (> skip-read-only-count 0)
2322 (format "%s read-only"
2323 skip-read-only-count))
2324 (if (> skip-invisible-count 0)
2325 (format "%s invisible"
2326 skip-invisible-count))
2327 (if (> skip-filtered-count 0)
2328 (format "%s filtered out"
2329 skip-filtered-count))))
2330 ", "))
2331 "")))
2270 (or (and keep-going stack) multi-buffer))) 2332 (or (and keep-going stack) multi-buffer)))
2271 2333
2272;;; replace.el ends here 2334;;; replace.el ends here
diff --git a/lisp/simple.el b/lisp/simple.el
index 18a360faa61..15bf8779f56 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -372,34 +372,6 @@ Other major modes are defined by comparison with this one."
372 "Parent major mode from which special major modes should inherit." 372 "Parent major mode from which special major modes should inherit."
373 (setq buffer-read-only t)) 373 (setq buffer-read-only t))
374 374
375;; Major mode meant to be the parent of programming modes.
376
377(defvar prog-mode-map
378 (let ((map (make-sparse-keymap)))
379 (define-key map [?\C-\M-q] 'prog-indent-sexp)
380 map)
381 "Keymap used for programming modes.")
382
383(defun prog-indent-sexp (&optional defun)
384 "Indent the expression after point.
385When interactively called with prefix, indent the enclosing defun
386instead."
387 (interactive "P")
388 (save-excursion
389 (when defun
390 (end-of-line)
391 (beginning-of-defun))
392 (let ((start (point))
393 (end (progn (forward-sexp 1) (point))))
394 (indent-region start end nil))))
395
396(define-derived-mode prog-mode fundamental-mode "Prog"
397 "Major mode for editing programming language source code."
398 (set (make-local-variable 'require-final-newline) mode-require-final-newline)
399 (set (make-local-variable 'parse-sexp-ignore-comments) t)
400 ;; Any programming language is always written left to right.
401 (setq bidi-paragraph-direction 'left-to-right))
402
403;; Making and deleting lines. 375;; Making and deleting lines.
404 376
405(defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard)) 377(defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard))
diff --git a/lisp/skeleton.el b/lisp/skeleton.el
index 01288b89132..a7eae7464e2 100644
--- a/lisp/skeleton.el
+++ b/lisp/skeleton.el
@@ -31,6 +31,8 @@
31 31
32;;; Code: 32;;; Code:
33 33
34(eval-when-compile (require 'cl-lib))
35
34;; page 1: statement skeleton language definition & interpreter 36;; page 1: statement skeleton language definition & interpreter
35;; page 2: paired insertion 37;; page 2: paired insertion
36;; page 3: mirror-mode, an example for setting up paired insertion 38;; page 3: mirror-mode, an example for setting up paired insertion
@@ -84,13 +86,11 @@ The variables `v1' and `v2' are still set when calling this.")
84 "When non-nil, indent rigidly under current line for element `\\n'. 86 "When non-nil, indent rigidly under current line for element `\\n'.
85Else use mode's `indent-line-function'.") 87Else use mode's `indent-line-function'.")
86 88
87(defvar skeleton-further-elements () 89(defvar-local skeleton-further-elements ()
88 "A buffer-local varlist (see `let') of mode specific skeleton elements. 90 "A buffer-local varlist (see `let') of mode specific skeleton elements.
89These variables are bound while interpreting a skeleton. Their value may 91These variables are bound while interpreting a skeleton. Their value may
90in turn be any valid skeleton element if they are themselves to be used as 92in turn be any valid skeleton element if they are themselves to be used as
91skeleton elements.") 93skeleton elements.")
92(make-variable-buffer-local 'skeleton-further-elements)
93
94 94
95(defvar skeleton-subprompt 95(defvar skeleton-subprompt
96 (substitute-command-keys 96 (substitute-command-keys
@@ -260,8 +260,10 @@ When done with skeleton, but before going back to `_'-point call
260 skeleton-modified skeleton-point resume: help input v1 v2) 260 skeleton-modified skeleton-point resume: help input v1 v2)
261 (setq skeleton-positions nil) 261 (setq skeleton-positions nil)
262 (unwind-protect 262 (unwind-protect
263 (eval `(let ,skeleton-further-elements 263 (cl-progv
264 (skeleton-internal-list skeleton str))) 264 (mapcar #'car skeleton-further-elements)
265 (mapcar (lambda (x) (eval (cadr x))) skeleton-further-elements)
266 (skeleton-internal-list skeleton str))
265 (run-hooks 'skeleton-end-hook) 267 (run-hooks 'skeleton-end-hook)
266 (sit-for 0) 268 (sit-for 0)
267 (or (pos-visible-in-window-p beg) 269 (or (pos-visible-in-window-p beg)
diff --git a/lisp/subr.el b/lisp/subr.el
index 23684f02b87..8f290f356da 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1,4 +1,4 @@
1;;; subr.el --- basic lisp subroutines for Emacs -*- coding: utf-8 -*- 1;;; subr.el --- basic lisp subroutines for Emacs -*- coding: utf-8; lexical-binding:t -*-
2 2
3;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2013 Free Software 3;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2013 Free Software
4;; Foundation, Inc. 4;; Foundation, Inc.
@@ -39,13 +39,13 @@ Each element of this list holds the arguments to one call to `defcustom'.")
39 (setq custom-declare-variable-list 39 (setq custom-declare-variable-list
40 (cons arguments custom-declare-variable-list))) 40 (cons arguments custom-declare-variable-list)))
41 41
42(defmacro declare-function (fn file &optional arglist fileonly) 42(defmacro declare-function (_fn _file &optional _arglist _fileonly)
43 "Tell the byte-compiler that function FN is defined, in FILE. 43 "Tell the byte-compiler that function FN is defined, in FILE.
44Optional ARGLIST is the argument list used by the function. The 44Optional ARGLIST is the argument list used by the function.
45FILE argument is not used by the byte-compiler, but by the 45The FILE argument is not used by the byte-compiler, but by the
46`check-declare' package, which checks that FILE contains a 46`check-declare' package, which checks that FILE contains a
47definition for FN. ARGLIST is used by both the byte-compiler and 47definition for FN. ARGLIST is used by both the byte-compiler
48`check-declare' to check for consistency. 48and `check-declare' to check for consistency.
49 49
50FILE can be either a Lisp file (in which case the \".el\" 50FILE can be either a Lisp file (in which case the \".el\"
51extension is optional), or a C file. C files are expanded 51extension is optional), or a C file. C files are expanded
@@ -396,9 +396,9 @@ non-nil."
396(defun number-sequence (from &optional to inc) 396(defun number-sequence (from &optional to inc)
397 "Return a sequence of numbers from FROM to TO (both inclusive) as a list. 397 "Return a sequence of numbers from FROM to TO (both inclusive) as a list.
398INC is the increment used between numbers in the sequence and defaults to 1. 398INC is the increment used between numbers in the sequence and defaults to 1.
399So, the Nth element of the list is \(+ FROM \(* N INC)) where N counts from 399So, the Nth element of the list is (+ FROM (* N INC)) where N counts from
400zero. TO is only included if there is an N for which TO = FROM + N * INC. 400zero. TO is only included if there is an N for which TO = FROM + N * INC.
401If TO is nil or numerically equal to FROM, return \(FROM). 401If TO is nil or numerically equal to FROM, return (FROM).
402If INC is positive and TO is less than FROM, or INC is negative 402If INC is positive and TO is less than FROM, or INC is negative
403and TO is larger than FROM, return nil. 403and TO is larger than FROM, return nil.
404If INC is zero and TO is neither nil nor numerically equal to 404If INC is zero and TO is neither nil nor numerically equal to
@@ -408,11 +408,11 @@ This function is primarily designed for integer arguments.
408Nevertheless, FROM, TO and INC can be integer or float. However, 408Nevertheless, FROM, TO and INC can be integer or float. However,
409floating point arithmetic is inexact. For instance, depending on 409floating point arithmetic is inexact. For instance, depending on
410the machine, it may quite well happen that 410the machine, it may quite well happen that
411\(number-sequence 0.4 0.6 0.2) returns the one element list \(0.4), 411\(number-sequence 0.4 0.6 0.2) returns the one element list (0.4),
412whereas \(number-sequence 0.4 0.8 0.2) returns a list with three 412whereas (number-sequence 0.4 0.8 0.2) returns a list with three
413elements. Thus, if some of the arguments are floats and one wants 413elements. Thus, if some of the arguments are floats and one wants
414to make sure that TO is included, one may have to explicitly write 414to make sure that TO is included, one may have to explicitly write
415TO as \(+ FROM \(* N INC)) or use a variable whose value was 415TO as (+ FROM (* N INC)) or use a variable whose value was
416computed with this exact expression. Alternatively, you can, 416computed with this exact expression. Alternatively, you can,
417of course, also replace TO with a slightly larger value 417of course, also replace TO with a slightly larger value
418\(or a slightly more negative value if INC is negative)." 418\(or a slightly more negative value if INC is negative)."
@@ -784,8 +784,8 @@ KEY is a key sequence; noninteractively, it is a string or vector
784of characters or event types, and non-ASCII characters with codes 784of characters or event types, and non-ASCII characters with codes
785above 127 (such as ISO Latin-1) can be included if you use a vector. 785above 127 (such as ISO Latin-1) can be included if you use a vector.
786 786
787The binding goes in the current buffer's local map, 787The binding goes in the current buffer's local map, which in most
788which in most cases is shared with all other buffers in the same major mode." 788cases is shared with all other buffers in the same major mode."
789 (interactive "KSet key locally: \nCSet key %s locally to command: ") 789 (interactive "KSet key locally: \nCSet key %s locally to command: ")
790 (let ((map (current-local-map))) 790 (let ((map (current-local-map)))
791 (or map 791 (or map
@@ -821,7 +821,7 @@ in KEYMAP as NEWDEF those keys which are defined as OLDDEF in OLDMAP.
821 821
822If you don't specify OLDMAP, you can usually get the same results 822If you don't specify OLDMAP, you can usually get the same results
823in a cleaner way with command remapping, like this: 823in a cleaner way with command remapping, like this:
824 \(define-key KEYMAP [remap OLDDEF] NEWDEF) 824 (define-key KEYMAP [remap OLDDEF] NEWDEF)
825\n(fn OLDDEF NEWDEF KEYMAP &optional OLDMAP)" 825\n(fn OLDDEF NEWDEF KEYMAP &optional OLDMAP)"
826 ;; Don't document PREFIX in the doc string because we don't want to 826 ;; Don't document PREFIX in the doc string because we don't want to
827 ;; advertise it. It's meant for recursive calls only. Here's its 827 ;; advertise it. It's meant for recursive calls only. Here's its
@@ -1478,11 +1478,48 @@ ELEMENT is added at the end.
1478 1478
1479The return value is the new value of LIST-VAR. 1479The return value is the new value of LIST-VAR.
1480 1480
1481This is handy to add some elements to configuration variables,
1482but please do not abuse it in Elisp code, where you are usually better off
1483using `push' or `cl-pushnew'.
1484
1481If you want to use `add-to-list' on a variable that is not defined 1485If you want to use `add-to-list' on a variable that is not defined
1482until a certain package is loaded, you should put the call to `add-to-list' 1486until a certain package is loaded, you should put the call to `add-to-list'
1483into a hook function that will be run only after loading the package. 1487into a hook function that will be run only after loading the package.
1484`eval-after-load' provides one way to do this. In some cases 1488`eval-after-load' provides one way to do this. In some cases
1485other hooks, such as major mode hooks, can do the job." 1489other hooks, such as major mode hooks, can do the job."
1490 (declare
1491 (compiler-macro
1492 (lambda (exp)
1493 ;; FIXME: Something like this could be used for `set' as well.
1494 (if (or (not (eq 'quote (car-safe list-var)))
1495 (special-variable-p (cadr list-var))
1496 (and append compare-fn))
1497 exp
1498 (let* ((sym (cadr list-var))
1499 (msg (format "`add-to-list' can't use lexical var `%s'; use `push' or `cl-pushnew'"
1500 sym))
1501 ;; Big ugly hack so we only output a warning during
1502 ;; byte-compilation, and so we can use
1503 ;; byte-compile-not-lexical-var-p to silence the warning
1504 ;; when a defvar has been seen but not yet executed.
1505 (warnfun (lambda ()
1506 ;; FIXME: We should also emit a warning for let-bound
1507 ;; variables with dynamic binding.
1508 (when (assq sym byte-compile--lexical-environment)
1509 (byte-compile-log-warning msg t :error))))
1510 (code
1511 (if append
1512 (macroexp-let2 macroexp-copyable-p x element
1513 `(unless (member ,x ,sym)
1514 (setq ,sym (append ,sym (list ,x)))))
1515 (require 'cl-lib)
1516 `(cl-pushnew ,element ,sym
1517 :test ,(or compare-fn '#'equal)))))
1518 (if (not (macroexp--compiling-p))
1519 code
1520 `(progn
1521 (macroexp--funcall-if-compiled ',warnfun)
1522 ,code)))))))
1486 (if (cond 1523 (if (cond
1487 ((null compare-fn) 1524 ((null compare-fn)
1488 (member element (symbol-value list-var))) 1525 (member element (symbol-value list-var)))
@@ -1710,7 +1747,7 @@ If TOGGLE has a `:menu-tag', that is used for the menu item's label."
1710 (nconc found (list (cons toggle keymap)) rest)) 1747 (nconc found (list (cons toggle keymap)) rest))
1711 (push (cons toggle keymap) minor-mode-map-alist))))))) 1748 (push (cons toggle keymap) minor-mode-map-alist)))))))
1712 1749
1713;;; Load history 1750;;;; Load history
1714 1751
1715(defsubst autoloadp (object) 1752(defsubst autoloadp (object)
1716 "Non-nil if OBJECT is an autoload." 1753 "Non-nil if OBJECT is an autoload."
@@ -1793,173 +1830,6 @@ and the file name is displayed in the echo area."
1793 file)) 1830 file))
1794 1831
1795 1832
1796;;;; Specifying things to do later.
1797
1798(defun load-history-regexp (file)
1799 "Form a regexp to find FILE in `load-history'.
1800FILE, a string, is described in the function `eval-after-load'."
1801 (if (file-name-absolute-p file)
1802 (setq file (file-truename file)))
1803 (concat (if (file-name-absolute-p file) "\\`" "\\(\\`\\|/\\)")
1804 (regexp-quote file)
1805 (if (file-name-extension file)
1806 ""
1807 ;; Note: regexp-opt can't be used here, since we need to call
1808 ;; this before Emacs has been fully started. 2006-05-21
1809 (concat "\\(" (mapconcat 'regexp-quote load-suffixes "\\|") "\\)?"))
1810 "\\(" (mapconcat 'regexp-quote jka-compr-load-suffixes "\\|")
1811 "\\)?\\'"))
1812
1813(defun load-history-filename-element (file-regexp)
1814 "Get the first elt of `load-history' whose car matches FILE-REGEXP.
1815Return nil if there isn't one."
1816 (let* ((loads load-history)
1817 (load-elt (and loads (car loads))))
1818 (save-match-data
1819 (while (and loads
1820 (or (null (car load-elt))
1821 (not (string-match file-regexp (car load-elt)))))
1822 (setq loads (cdr loads)
1823 load-elt (and loads (car loads)))))
1824 load-elt))
1825
1826(put 'eval-after-load 'lisp-indent-function 1)
1827(defun eval-after-load (file form)
1828 "Arrange that if FILE is loaded, FORM will be run immediately afterwards.
1829If FILE is already loaded, evaluate FORM right now.
1830
1831If a matching file is loaded again, FORM will be evaluated again.
1832
1833If FILE is a string, it may be either an absolute or a relative file
1834name, and may have an extension \(e.g. \".el\") or may lack one, and
1835additionally may or may not have an extension denoting a compressed
1836format \(e.g. \".gz\").
1837
1838When FILE is absolute, this first converts it to a true name by chasing
1839symbolic links. Only a file of this name \(see next paragraph regarding
1840extensions) will trigger the evaluation of FORM. When FILE is relative,
1841a file whose absolute true name ends in FILE will trigger evaluation.
1842
1843When FILE lacks an extension, a file name with any extension will trigger
1844evaluation. Otherwise, its extension must match FILE's. A further
1845extension for a compressed format \(e.g. \".gz\") on FILE will not affect
1846this name matching.
1847
1848Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM
1849is evaluated at the end of any file that `provide's this feature.
1850If the feature is provided when evaluating code not associated with a
1851file, FORM is evaluated immediately after the provide statement.
1852
1853Usually FILE is just a library name like \"font-lock\" or a feature name
1854like 'font-lock.
1855
1856This function makes or adds to an entry on `after-load-alist'."
1857 ;; Add this FORM into after-load-alist (regardless of whether we'll be
1858 ;; evaluating it now).
1859 (let* ((regexp-or-feature
1860 (if (stringp file)
1861 (setq file (purecopy (load-history-regexp file)))
1862 file))
1863 (elt (assoc regexp-or-feature after-load-alist)))
1864 (unless elt
1865 (setq elt (list regexp-or-feature))
1866 (push elt after-load-alist))
1867 ;; Make sure `form' is evalled in the current lexical/dynamic code.
1868 (setq form `(funcall ',(eval `(lambda () ,form) lexical-binding)))
1869 ;; Is there an already loaded file whose name (or `provide' name)
1870 ;; matches FILE?
1871 (prog1 (if (if (stringp file)
1872 (load-history-filename-element regexp-or-feature)
1873 (featurep file))
1874 (eval form))
1875 (when (symbolp regexp-or-feature)
1876 ;; For features, the after-load-alist elements get run when `provide' is
1877 ;; called rather than at the end of the file. So add an indirection to
1878 ;; make sure that `form' is really run "after-load" in case the provide
1879 ;; call happens early.
1880 (setq form
1881 `(if load-file-name
1882 (let ((fun (make-symbol "eval-after-load-helper")))
1883 (fset fun `(lambda (file)
1884 (if (not (equal file ',load-file-name))
1885 nil
1886 (remove-hook 'after-load-functions ',fun)
1887 ,',form)))
1888 (add-hook 'after-load-functions fun))
1889 ;; Not being provided from a file, run form right now.
1890 ,form)))
1891 ;; Add FORM to the element unless it's already there.
1892 (unless (member form (cdr elt))
1893 (nconc elt (list form))))))
1894
1895(defvar after-load-functions nil
1896 "Special hook run after loading a file.
1897Each function there is called with a single argument, the absolute
1898name of the file just loaded.")
1899
1900(defun do-after-load-evaluation (abs-file)
1901 "Evaluate all `eval-after-load' forms, if any, for ABS-FILE.
1902ABS-FILE, a string, should be the absolute true name of a file just loaded.
1903This function is called directly from the C code."
1904 ;; Run the relevant eval-after-load forms.
1905 (mapc #'(lambda (a-l-element)
1906 (when (and (stringp (car a-l-element))
1907 (string-match-p (car a-l-element) abs-file))
1908 ;; discard the file name regexp
1909 (mapc #'eval (cdr a-l-element))))
1910 after-load-alist)
1911 ;; Complain when the user uses obsolete files.
1912 (when (string-match-p "/obsolete/[^/]*\\'" abs-file)
1913 (run-with-timer 0 nil
1914 (lambda (file)
1915 (message "Package %s is obsolete!"
1916 (substring file 0
1917 (string-match "\\.elc?\\>" file))))
1918 (file-name-nondirectory abs-file)))
1919 ;; Finally, run any other hook.
1920 (run-hook-with-args 'after-load-functions abs-file))
1921
1922(defun eval-next-after-load (file)
1923 "Read the following input sexp, and run it whenever FILE is loaded.
1924This makes or adds to an entry on `after-load-alist'.
1925FILE should be the name of a library, with no directory name."
1926 (declare (obsolete eval-after-load "23.2"))
1927 (eval-after-load file (read)))
1928
1929(defun display-delayed-warnings ()
1930 "Display delayed warnings from `delayed-warnings-list'.
1931Used from `delayed-warnings-hook' (which see)."
1932 (dolist (warning (nreverse delayed-warnings-list))
1933 (apply 'display-warning warning))
1934 (setq delayed-warnings-list nil))
1935
1936(defun collapse-delayed-warnings ()
1937 "Remove duplicates from `delayed-warnings-list'.
1938Collapse identical adjacent warnings into one (plus count).
1939Used from `delayed-warnings-hook' (which see)."
1940 (let ((count 1)
1941 collapsed warning)
1942 (while delayed-warnings-list
1943 (setq warning (pop delayed-warnings-list))
1944 (if (equal warning (car delayed-warnings-list))
1945 (setq count (1+ count))
1946 (when (> count 1)
1947 (setcdr warning (cons (format "%s [%d times]" (cadr warning) count)
1948 (cddr warning)))
1949 (setq count 1))
1950 (push warning collapsed)))
1951 (setq delayed-warnings-list (nreverse collapsed))))
1952
1953;; At present this is only used for Emacs internals.
1954;; Ref http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00085.html
1955(defvar delayed-warnings-hook '(collapse-delayed-warnings
1956 display-delayed-warnings)
1957 "Normal hook run to process and display delayed warnings.
1958By default, this hook contains functions to consolidate the
1959warnings listed in `delayed-warnings-list', display them, and set
1960`delayed-warnings-list' back to nil.")
1961
1962
1963;;;; Process stuff. 1833;;;; Process stuff.
1964 1834
1965(defun process-lines (program &rest args) 1835(defun process-lines (program &rest args)
@@ -2054,8 +1924,8 @@ some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
2054 ;; disable quail's input methods, so although read-key-sequence 1924 ;; disable quail's input methods, so although read-key-sequence
2055 ;; always inherits the input method, in practice read-key does not 1925 ;; always inherits the input method, in practice read-key does not
2056 ;; inherit the input method (at least not if it's based on quail). 1926 ;; inherit the input method (at least not if it's based on quail).
2057 (let ((overriding-terminal-local-map read-key-empty-map) 1927 (let ((overriding-terminal-local-map nil)
2058 (overriding-local-map nil) 1928 (overriding-local-map read-key-empty-map)
2059 (echo-keystrokes 0) 1929 (echo-keystrokes 0)
2060 (old-global-map (current-global-map)) 1930 (old-global-map (current-global-map))
2061 (timer (run-with-idle-timer 1931 (timer (run-with-idle-timer
@@ -2670,7 +2540,7 @@ Set this to nil at your own risk..."
2670(defun locate-user-emacs-file (new-name &optional old-name) 2540(defun locate-user-emacs-file (new-name &optional old-name)
2671 "Return an absolute per-user Emacs-specific file name. 2541 "Return an absolute per-user Emacs-specific file name.
2672If NEW-NAME exists in `user-emacs-directory', return it. 2542If NEW-NAME exists in `user-emacs-directory', return it.
2673Else If OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME. 2543Else if OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME.
2674Else return NEW-NAME in `user-emacs-directory', creating the 2544Else return NEW-NAME in `user-emacs-directory', creating the
2675directory if it does not exist." 2545directory if it does not exist."
2676 (convert-standard-filename 2546 (convert-standard-filename
@@ -2717,8 +2587,9 @@ customize the variable `user-emacs-directory-warning'."
2717 "Return non-nil if the current buffer is narrowed." 2587 "Return non-nil if the current buffer is narrowed."
2718 (/= (- (point-max) (point-min)) (buffer-size))) 2588 (/= (- (point-max) (point-min)) (buffer-size)))
2719 2589
2720(defun find-tag-default () 2590(defun find-tag-default-bounds ()
2721 "Determine default tag to search for, based on text at point. 2591 "Determine the boundaries of the default tag, based on text at point.
2592Return a cons cell with the beginning and end of the found tag.
2722If there is no plausible default, return nil." 2593If there is no plausible default, return nil."
2723 (let (from to bound) 2594 (let (from to bound)
2724 (when (or (progn 2595 (when (or (progn
@@ -2742,7 +2613,14 @@ If there is no plausible default, return nil."
2742 (< (setq from (point)) bound) 2613 (< (setq from (point)) bound)
2743 (skip-syntax-forward "w_") 2614 (skip-syntax-forward "w_")
2744 (setq to (point))))) 2615 (setq to (point)))))
2745 (buffer-substring-no-properties from to)))) 2616 (cons from to))))
2617
2618(defun find-tag-default ()
2619 "Determine default tag to search for, based on text at point.
2620If there is no plausible default, return nil."
2621 (let ((bounds (find-tag-default-bounds)))
2622 (when bounds
2623 (buffer-substring-no-properties (car bounds) (cdr bounds)))))
2746 2624
2747(defun find-tag-default-as-regexp () 2625(defun find-tag-default-as-regexp ()
2748 "Return regexp that matches the default tag at point. 2626 "Return regexp that matches the default tag at point.
@@ -3353,7 +3231,7 @@ than cosmetic ones, undo data may become corrupted.
3353 3231
3354This macro will run BODY normally, but doesn't count its buffer 3232This macro will run BODY normally, but doesn't count its buffer
3355modifications as being buffer modifications. This affects things 3233modifications as being buffer modifications. This affects things
3356like buffer-modified-p, checking whether the file is locked by 3234like `buffer-modified-p', checking whether the file is locked by
3357someone else, running buffer modification hooks, and other things 3235someone else, running buffer modification hooks, and other things
3358of that nature. 3236of that nature.
3359 3237
@@ -3658,7 +3536,7 @@ which separates, but is not part of, the substrings. If nil it defaults to
3658`split-string-default-separators', normally \"[ \\f\\t\\n\\r\\v]+\", and 3536`split-string-default-separators', normally \"[ \\f\\t\\n\\r\\v]+\", and
3659OMIT-NULLS is forced to t. 3537OMIT-NULLS is forced to t.
3660 3538
3661If OMIT-NULLS is t, zero-length substrings are omitted from the list \(so 3539If OMIT-NULLS is t, zero-length substrings are omitted from the list (so
3662that for the default value of SEPARATORS leading and trailing whitespace 3540that for the default value of SEPARATORS leading and trailing whitespace
3663are effectively trimmed). If nil, all zero-length substrings are retained, 3541are effectively trimmed). If nil, all zero-length substrings are retained,
3664which correctly parses CSV format, for example. 3542which correctly parses CSV format, for example.
@@ -3817,6 +3695,173 @@ consisting of STR followed by an invisible left-to-right mark
3817 (concat str (propertize (string ?\x200e) 'invisible t)) 3695 (concat str (propertize (string ?\x200e) 'invisible t))
3818 str)) 3696 str))
3819 3697
3698;;;; Specifying things to do later.
3699
3700(defun load-history-regexp (file)
3701 "Form a regexp to find FILE in `load-history'.
3702FILE, a string, is described in the function `eval-after-load'."
3703 (if (file-name-absolute-p file)
3704 (setq file (file-truename file)))
3705 (concat (if (file-name-absolute-p file) "\\`" "\\(\\`\\|/\\)")
3706 (regexp-quote file)
3707 (if (file-name-extension file)
3708 ""
3709 ;; Note: regexp-opt can't be used here, since we need to call
3710 ;; this before Emacs has been fully started. 2006-05-21
3711 (concat "\\(" (mapconcat 'regexp-quote load-suffixes "\\|") "\\)?"))
3712 "\\(" (mapconcat 'regexp-quote jka-compr-load-suffixes "\\|")
3713 "\\)?\\'"))
3714
3715(defun load-history-filename-element (file-regexp)
3716 "Get the first elt of `load-history' whose car matches FILE-REGEXP.
3717Return nil if there isn't one."
3718 (let* ((loads load-history)
3719 (load-elt (and loads (car loads))))
3720 (save-match-data
3721 (while (and loads
3722 (or (null (car load-elt))
3723 (not (string-match file-regexp (car load-elt)))))
3724 (setq loads (cdr loads)
3725 load-elt (and loads (car loads)))))
3726 load-elt))
3727
3728(put 'eval-after-load 'lisp-indent-function 1)
3729(defun eval-after-load (file form)
3730 "Arrange that if FILE is loaded, FORM will be run immediately afterwards.
3731If FILE is already loaded, evaluate FORM right now.
3732
3733If a matching file is loaded again, FORM will be evaluated again.
3734
3735If FILE is a string, it may be either an absolute or a relative file
3736name, and may have an extension (e.g. \".el\") or may lack one, and
3737additionally may or may not have an extension denoting a compressed
3738format (e.g. \".gz\").
3739
3740When FILE is absolute, this first converts it to a true name by chasing
3741symbolic links. Only a file of this name (see next paragraph regarding
3742extensions) will trigger the evaluation of FORM. When FILE is relative,
3743a file whose absolute true name ends in FILE will trigger evaluation.
3744
3745When FILE lacks an extension, a file name with any extension will trigger
3746evaluation. Otherwise, its extension must match FILE's. A further
3747extension for a compressed format (e.g. \".gz\") on FILE will not affect
3748this name matching.
3749
3750Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM
3751is evaluated at the end of any file that `provide's this feature.
3752If the feature is provided when evaluating code not associated with a
3753file, FORM is evaluated immediately after the provide statement.
3754
3755Usually FILE is just a library name like \"font-lock\" or a feature name
3756like 'font-lock.
3757
3758This function makes or adds to an entry on `after-load-alist'."
3759 ;; Add this FORM into after-load-alist (regardless of whether we'll be
3760 ;; evaluating it now).
3761 (let* ((regexp-or-feature
3762 (if (stringp file)
3763 (setq file (purecopy (load-history-regexp file)))
3764 file))
3765 (elt (assoc regexp-or-feature after-load-alist)))
3766 (unless elt
3767 (setq elt (list regexp-or-feature))
3768 (push elt after-load-alist))
3769 ;; Make sure `form' is evalled in the current lexical/dynamic code.
3770 (setq form `(funcall ',(eval `(lambda () ,form) lexical-binding)))
3771 ;; Is there an already loaded file whose name (or `provide' name)
3772 ;; matches FILE?
3773 (prog1 (if (if (stringp file)
3774 (load-history-filename-element regexp-or-feature)
3775 (featurep file))
3776 (eval form))
3777 (when (symbolp regexp-or-feature)
3778 ;; For features, the after-load-alist elements get run when `provide' is
3779 ;; called rather than at the end of the file. So add an indirection to
3780 ;; make sure that `form' is really run "after-load" in case the provide
3781 ;; call happens early.
3782 (setq form
3783 `(if load-file-name
3784 (let ((fun (make-symbol "eval-after-load-helper")))
3785 (fset fun `(lambda (file)
3786 (if (not (equal file ',load-file-name))
3787 nil
3788 (remove-hook 'after-load-functions ',fun)
3789 ,',form)))
3790 (add-hook 'after-load-functions fun))
3791 ;; Not being provided from a file, run form right now.
3792 ,form)))
3793 ;; Add FORM to the element unless it's already there.
3794 (unless (member form (cdr elt))
3795 (nconc elt (list form))))))
3796
3797(defvar after-load-functions nil
3798 "Special hook run after loading a file.
3799Each function there is called with a single argument, the absolute
3800name of the file just loaded.")
3801
3802(defun do-after-load-evaluation (abs-file)
3803 "Evaluate all `eval-after-load' forms, if any, for ABS-FILE.
3804ABS-FILE, a string, should be the absolute true name of a file just loaded.
3805This function is called directly from the C code."
3806 ;; Run the relevant eval-after-load forms.
3807 (mapc #'(lambda (a-l-element)
3808 (when (and (stringp (car a-l-element))
3809 (string-match-p (car a-l-element) abs-file))
3810 ;; discard the file name regexp
3811 (mapc #'eval (cdr a-l-element))))
3812 after-load-alist)
3813 ;; Complain when the user uses obsolete files.
3814 (when (string-match-p "/obsolete/[^/]*\\'" abs-file)
3815 (run-with-timer 0 nil
3816 (lambda (file)
3817 (message "Package %s is obsolete!"
3818 (substring file 0
3819 (string-match "\\.elc?\\>" file))))
3820 (file-name-nondirectory abs-file)))
3821 ;; Finally, run any other hook.
3822 (run-hook-with-args 'after-load-functions abs-file))
3823
3824(defun eval-next-after-load (file)
3825 "Read the following input sexp, and run it whenever FILE is loaded.
3826This makes or adds to an entry on `after-load-alist'.
3827FILE should be the name of a library, with no directory name."
3828 (declare (obsolete eval-after-load "23.2"))
3829 (eval-after-load file (read)))
3830
3831(defun display-delayed-warnings ()
3832 "Display delayed warnings from `delayed-warnings-list'.
3833Used from `delayed-warnings-hook' (which see)."
3834 (dolist (warning (nreverse delayed-warnings-list))
3835 (apply 'display-warning warning))
3836 (setq delayed-warnings-list nil))
3837
3838(defun collapse-delayed-warnings ()
3839 "Remove duplicates from `delayed-warnings-list'.
3840Collapse identical adjacent warnings into one (plus count).
3841Used from `delayed-warnings-hook' (which see)."
3842 (let ((count 1)
3843 collapsed warning)
3844 (while delayed-warnings-list
3845 (setq warning (pop delayed-warnings-list))
3846 (if (equal warning (car delayed-warnings-list))
3847 (setq count (1+ count))
3848 (when (> count 1)
3849 (setcdr warning (cons (format "%s [%d times]" (cadr warning) count)
3850 (cddr warning)))
3851 (setq count 1))
3852 (push warning collapsed)))
3853 (setq delayed-warnings-list (nreverse collapsed))))
3854
3855;; At present this is only used for Emacs internals.
3856;; Ref http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00085.html
3857(defvar delayed-warnings-hook '(collapse-delayed-warnings
3858 display-delayed-warnings)
3859 "Normal hook run to process and display delayed warnings.
3860By default, this hook contains functions to consolidate the
3861warnings listed in `delayed-warnings-list', display them, and set
3862`delayed-warnings-list' back to nil.")
3863
3864
3820;;;; invisibility specs 3865;;;; invisibility specs
3821 3866
3822(defun add-to-invisibility-spec (element) 3867(defun add-to-invisibility-spec (element)
@@ -4189,32 +4234,6 @@ use `called-interactively-p'."
4189 (declare (obsolete called-interactively-p "23.2")) 4234 (declare (obsolete called-interactively-p "23.2"))
4190 (called-interactively-p 'interactive)) 4235 (called-interactively-p 'interactive))
4191 4236
4192(defun function-arity (f &optional num)
4193 "Return the (MIN . MAX) arity of F.
4194If the maximum arity is infinite, MAX is `many'.
4195F can be a function or a macro.
4196If NUM is non-nil, return non-nil iff F can be called with NUM args."
4197 (if (symbolp f) (setq f (indirect-function f)))
4198 (if (eq (car-safe f) 'macro) (setq f (cdr f)))
4199 (let ((res
4200 (if (subrp f)
4201 (let ((x (subr-arity f)))
4202 (if (eq (cdr x) 'unevalled) (cons (car x) 'many)))
4203 (let* ((args (if (consp f) (cadr f) (aref f 0)))
4204 (max (length args))
4205 (opt (memq '&optional args))
4206 (rest (memq '&rest args))
4207 (min (- max (length opt))))
4208 (if opt
4209 (cons min (if rest 'many (1- max)))
4210 (if rest
4211 (cons (- max (length rest)) 'many)
4212 (cons min max)))))))
4213 (if (not num)
4214 res
4215 (and (>= num (car res))
4216 (or (eq 'many (cdr res)) (<= num (cdr res)))))))
4217
4218(defun set-temporary-overlay-map (map &optional keep-pred) 4237(defun set-temporary-overlay-map (map &optional keep-pred)
4219 "Set MAP as a temporary keymap taking precedence over most other keymaps. 4238 "Set MAP as a temporary keymap taking precedence over most other keymaps.
4220Note that this does NOT take precedence over the \"overriding\" maps 4239Note that this does NOT take precedence over the \"overriding\" maps
@@ -4432,32 +4451,16 @@ convenience wrapper around `make-progress-reporter' and friends.
4432 4451
4433;;;; Support for watching filesystem events. 4452;;;; Support for watching filesystem events.
4434 4453
4435(defun inotify-event-p (event) 4454(defun file-notify-handle-event (event)
4436 "Check if EVENT is an inotify event." 4455 "Handle file system monitoring event.
4437 (and (listp event) 4456If EVENT is a filewatch event, call its callback.
4438 (>= (length event) 3)
4439 (eq (car event) 'file-inotify)))
4440
4441;;;###autoload
4442(defun inotify-handle-event (event)
4443 "Handle inotify file system monitoring event.
4444If EVENT is an inotify filewatch event, call its callback.
4445Otherwise, signal a `filewatch-error'."
4446 (interactive "e")
4447 (unless (inotify-event-p event)
4448 (signal 'filewatch-error (cons "Not a valid inotify event" event)))
4449 (funcall (nth 2 event) (nth 1 event)))
4450
4451(defun w32notify-handle-event (event)
4452 "Handle MS-Windows file system monitoring event.
4453If EVENT is an MS-Windows filewatch event, call its callback.
4454Otherwise, signal a `filewatch-error'." 4457Otherwise, signal a `filewatch-error'."
4455 (interactive "e") 4458 (interactive "e")
4456 (if (and (eq (car event) 'file-w32notify) 4459 (if (and (eq (car event) 'file-notify)
4457 (= (length event) 3)) 4460 (>= (length event) 3))
4458 (funcall (nth 2 event) (nth 1 event)) 4461 (funcall (nth 2 event) (nth 1 event))
4459 (signal 'filewatch-error 4462 (signal 'filewatch-error
4460 (cons "Not a valid MS-Windows file-notify event" event)))) 4463 (cons "Not a valid file-notify event" event))))
4461 4464
4462 4465
4463;;;; Comparing version strings. 4466;;;; Comparing version strings.
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 0d4d3aaa26b..0298ad81a34 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -558,6 +558,11 @@ unless the current buffer is a scratch buffer."
558 (other-frame -1)) 558 (other-frame -1))
559 559
560;; If no position specified, make new frame offset by 25 from current. 560;; If no position specified, make new frame offset by 25 from current.
561;; You'd think this was a window manager's job, but apparently without
562;; this, new frames open exactly on top of old ones (?).
563;; http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00988.html
564;; Note that AFAICS it is not documented that functions on
565;; before-make-frame-hook can access PARAMETERS.
561(defvar parameters) ; dynamically bound in make-frame 566(defvar parameters) ; dynamically bound in make-frame
562(add-hook 'before-make-frame-hook 567(add-hook 'before-make-frame-hook
563 (lambda () 568 (lambda ()
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index b633b7be403..de103c0cdb6 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -1,9 +1,9 @@
1;;; log-view.el --- Major mode for browsing RCS/CVS/SCCS log output -*- lexical-binding: t -*- 1;;; log-view.el --- Major mode for browsing revision log histories -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1999-2013 Free Software Foundation, Inc. 3;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
4 4
5;; Author: Stefan Monnier <monnier@iro.umontreal.ca> 5;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
6;; Keywords: rcs, sccs, cvs, log, vc, tools 6;; Keywords: tools, vc
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
@@ -24,10 +24,12 @@
24 24
25;; Major mode to browse revision log histories. 25;; Major mode to browse revision log histories.
26;; Currently supports the format output by: 26;; Currently supports the format output by:
27;; RCS, SCCS, CVS, Subversion, and DaRCS. 27;; SCCS, RCS, CVS, Subversion, DaRCS, and Mercurial.
28 28
29;; Examples of log output: 29;; Examples of log output:
30 30
31;;;; SCCS:
32
31;;;; RCS/CVS: 33;;;; RCS/CVS:
32 34
33;; ---------------------------- 35;; ----------------------------
@@ -43,8 +45,6 @@
43;; Change release version from 21.4 to 22.1 throughout. 45;; Change release version from 21.4 to 22.1 throughout.
44;; Change development version from 21.3.50 to 22.0.50. 46;; Change development version from 21.3.50 to 22.0.50.
45 47
46;;;; SCCS:
47
48;;;; Subversion: 48;;;; Subversion:
49 49
50;; ------------------------------------------------------------------------ 50;; ------------------------------------------------------------------------
@@ -117,18 +117,25 @@
117(defvar cvs-force-command) 117(defvar cvs-force-command)
118 118
119(defgroup log-view nil 119(defgroup log-view nil
120 "Major mode for browsing log output of RCS/CVS/SCCS." 120 "Major mode for browsing log output of revision log histories."
121 :group 'pcl-cvs 121 :group 'pcl-cvs
122 :prefix "log-view-") 122 :prefix "log-view-")
123 123
124(easy-mmode-defmap log-view-mode-map 124(easy-mmode-defmap log-view-mode-map
125 '( 125 '(
126 ;; FIXME: (copy-keymap special-mode-map) instead 126 ("-" . negative-argument)
127 ("z" . kill-this-buffer) 127 ("0" . digit-argument)
128 ("q" . quit-window) 128 ("1" . digit-argument)
129 ("g" . revert-buffer) 129 ("2" . digit-argument)
130 ("\C-m" . log-view-toggle-entry-display) 130 ("3" . digit-argument)
131 ("4" . digit-argument)
132 ("5" . digit-argument)
133 ("6" . digit-argument)
134 ("7" . digit-argument)
135 ("8" . digit-argument)
136 ("9" . digit-argument)
131 137
138 ("\C-m" . log-view-toggle-entry-display)
132 ("m" . log-view-toggle-mark-entry) 139 ("m" . log-view-toggle-mark-entry)
133 ("e" . log-view-modify-change-comment) 140 ("e" . log-view-modify-change-comment)
134 ("d" . log-view-diff) 141 ("d" . log-view-diff)
@@ -145,6 +152,7 @@
145 ("\M-n" . log-view-file-next) 152 ("\M-n" . log-view-file-next)
146 ("\M-p" . log-view-file-prev)) 153 ("\M-p" . log-view-file-prev))
147 "Log-View's keymap." 154 "Log-View's keymap."
155 :inherit special-mode-map
148 :group 'log-view) 156 :group 'log-view)
149 157
150(easy-menu-define log-view-mode-menu log-view-mode-map 158(easy-menu-define log-view-mode-menu log-view-mode-map
@@ -275,6 +283,7 @@ The match group number 1 should match the revision number itself.")
275(easy-mmode-define-navigation log-view-file log-view-file-re "file") 283(easy-mmode-define-navigation log-view-file log-view-file-re "file")
276 284
277(defun log-view-goto-rev (rev) 285(defun log-view-goto-rev (rev)
286 "Go to revision REV."
278 (goto-char (point-min)) 287 (goto-char (point-min))
279 (ignore-errors 288 (ignore-errors
280 (while (not (equal rev (log-view-current-tag))) 289 (while (not (equal rev (log-view-current-tag)))
@@ -288,6 +297,7 @@ The match group number 1 should match the revision number itself.")
288(defconst log-view-dir-re "^cvs[.ex]* [a-z]+: Logging \\(.+\\)$") 297(defconst log-view-dir-re "^cvs[.ex]* [a-z]+: Logging \\(.+\\)$")
289 298
290(defun log-view-current-file () 299(defun log-view-current-file ()
300 "Return the current file."
291 (save-excursion 301 (save-excursion
292 (forward-line 1) 302 (forward-line 1)
293 (or (re-search-backward log-view-file-re nil t) 303 (or (re-search-backward log-view-file-re nil t)
@@ -340,7 +350,7 @@ if POS is omitted or nil, it defaults to point."
340 350
341(defun log-view-toggle-mark-entry () 351(defun log-view-toggle-mark-entry ()
342 "Toggle the marked state for the log entry at point. 352 "Toggle the marked state for the log entry at point.
343Individual log entries can be marked and unmarked. The marked 353Individual log entries can be marked and unmarked. The marked
344entries are denoted by changing their background color. 354entries are denoted by changing their background color.
345`log-view-get-marked' returns the list of tags for the marked 355`log-view-get-marked' returns the list of tags for the marked
346log entries." 356log entries."
@@ -479,7 +489,8 @@ It assumes that a log entry starts with a line matching
479 (funcall f)))) 489 (funcall f))))
480 490
481(defun log-view-find-revision (pos) 491(defun log-view-find-revision (pos)
482 "Visit the version at point." 492 "Visit the version at POS.
493If called interactively, visit the version at point."
483 (interactive "d") 494 (interactive "d")
484 (unless log-view-per-file-logs 495 (unless log-view-per-file-logs
485 (when (> (length log-view-vc-fileset) 1) 496 (when (> (length log-view-vc-fileset) 1)
@@ -521,7 +532,8 @@ It assumes that a log entry starts with a line matching
521 (log-view-extract-comment))) 532 (log-view-extract-comment)))
522 533
523(defun log-view-annotate-version (pos) 534(defun log-view-annotate-version (pos)
524 "Annotate the version at point." 535 "Annotate the version at POS.
536If called interactively, annotate the version at point."
525 (interactive "d") 537 (interactive "d")
526 (unless log-view-per-file-logs 538 (unless log-view-per-file-logs
527 (when (> (length log-view-vc-fileset) 1) 539 (when (> (length log-view-vc-fileset) 1)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 5e1d27c0ea3..0308dd1ebd4 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -115,10 +115,10 @@
115;; Return non-nil if FILE is registered in this backend. Both this 115;; Return non-nil if FILE is registered in this backend. Both this
116;; function as well as `state' should be careful to fail gracefully 116;; function as well as `state' should be careful to fail gracefully
117;; in the event that the backend executable is absent. It is 117;; in the event that the backend executable is absent. It is
118;; preferable that this function's body is autoloaded, that way only 118;; preferable that this function's *body* is autoloaded, that way only
119;; calling vc-registered does not cause the backend to be loaded 119;; calling vc-registered does not cause the backend to be loaded
120;; (all the vc-FOO-registered functions are called to try to find 120;; (all the vc-FOO-registered functions are called to try to find
121;; the controlling backend for FILE. 121;; the controlling backend for FILE).
122;; 122;;
123;; * state (file) 123;; * state (file)
124;; 124;;
@@ -233,6 +233,7 @@
233;; The implementation should pass the value of vc-register-switches 233;; The implementation should pass the value of vc-register-switches
234;; to the backend command. (Note: in older versions of VC, this 234;; to the backend command. (Note: in older versions of VC, this
235;; command took a single file argument and not a list.) 235;; command took a single file argument and not a list.)
236;; The REV argument is a historical leftover and is never used.
236;; 237;;
237;; - init-revision (file) 238;; - init-revision (file)
238;; 239;;
@@ -999,7 +1000,7 @@ current buffer."
999 nil) 1000 nil)
1000 (list (vc-backend-for-registration (buffer-file-name)) 1001 (list (vc-backend-for-registration (buffer-file-name))
1001 (list buffer-file-name)))) 1002 (list buffer-file-name))))
1002 (t (error "No fileset is available here"))))) 1003 (t (error "File is not under version control")))))
1003 1004
1004(defun vc-dired-deduce-fileset () 1005(defun vc-dired-deduce-fileset ()
1005 (let ((backend (vc-responsible-backend default-directory))) 1006 (let ((backend (vc-responsible-backend default-directory)))
@@ -1041,6 +1042,11 @@ current buffer."
1041 (eq p q) 1042 (eq p q)
1042 (and (member p '(edited added removed)) (member q '(edited added removed))))) 1043 (and (member p '(edited added removed)) (member q '(edited added removed)))))
1043 1044
1045(defun vc-read-backend (prompt)
1046 (intern
1047 (completing-read prompt (mapcar 'symbol-name vc-handled-backends)
1048 nil 'require-match)))
1049
1044;; Here's the major entry point. 1050;; Here's the major entry point.
1045 1051
1046;;;###autoload 1052;;;###autoload
@@ -1099,8 +1105,9 @@ For old-style locking-based version control systems, like RCS:
1099 ((or (eq state 'up-to-date) (and verbose (eq state 'needs-update))) 1105 ((or (eq state 'up-to-date) (and verbose (eq state 'needs-update)))
1100 (cond 1106 (cond
1101 (verbose 1107 (verbose
1102 ;; go to a different revision 1108 ;; Go to a different revision.
1103 (let* ((revision 1109 (let* ((revision
1110 ;; FIXME: Provide completion.
1104 (read-string "Branch, revision, or backend to move to: ")) 1111 (read-string "Branch, revision, or backend to move to: "))
1105 (revision-downcase (downcase revision))) 1112 (revision-downcase (downcase revision)))
1106 (if (member 1113 (if (member
@@ -1161,15 +1168,10 @@ For old-style locking-based version control systems, like RCS:
1161 (message "No files remain to be committed") 1168 (message "No files remain to be committed")
1162 (if (not verbose) 1169 (if (not verbose)
1163 (vc-checkin ready-for-commit backend) 1170 (vc-checkin ready-for-commit backend)
1164 (let* ((revision (read-string "New revision or backend: ")) 1171 (let ((new-backend (vc-read-backend "New backend: ")))
1165 (revision-downcase (downcase revision))) 1172 (if new-backend
1166 (if (member 1173 (dolist (file files)
1167 revision-downcase 1174 (vc-transfer-file file new-backend))))))))
1168 (mapcar (lambda (arg) (downcase (symbol-name arg)))
1169 vc-handled-backends))
1170 (let ((vsym (intern revision-downcase)))
1171 (dolist (file files) (vc-transfer-file file vsym)))
1172 (vc-checkin ready-for-commit backend revision)))))))
1173 ;; locked by somebody else (locking VCSes only) 1175 ;; locked by somebody else (locking VCSes only)
1174 ((stringp state) 1176 ((stringp state)
1175 ;; In the old days, we computed the revision once and used it on 1177 ;; In the old days, we computed the revision once and used it on