aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog422
-rw-r--r--lisp/ChangeLog.101
-rw-r--r--lisp/ChangeLog.721
-rw-r--r--lisp/Makefile.in5
-rw-r--r--lisp/calc/calc-aent.el475
-rw-r--r--lisp/calc/calc-comb.el68
-rw-r--r--lisp/calc/calc-ext.el114
-rw-r--r--lisp/calc/calc-forms.el6
-rw-r--r--lisp/calc/calc-graph.el688
-rw-r--r--lisp/calc/calc-lang.el40
-rw-r--r--lisp/calc/calc-poly.el2
-rw-r--r--lisp/calc/calc-rewr.el40
-rw-r--r--lisp/calc/calc-vec.el104
-rw-r--r--lisp/calc/calc.el201
-rw-r--r--lisp/calc/calcalg2.el12
-rw-r--r--lisp/calendar/diary-lib.el37
-rw-r--r--lisp/cvs-status.el32
-rw-r--r--lisp/descr-text.el5
-rw-r--r--lisp/desktop.el50
-rw-r--r--lisp/ebuff-menu.el21
-rw-r--r--lisp/emacs-lisp/byte-opt.el7
-rw-r--r--lisp/emacs-lisp/bytecomp.el58
-rw-r--r--lisp/emacs-lisp/easymenu.el35
-rw-r--r--lisp/emacs-lisp/elp.el1
-rw-r--r--lisp/files.el68
-rw-r--r--lisp/filesets.el7
-rw-r--r--lisp/font-lock.el12
-rw-r--r--lisp/gnus/ChangeLog14
-rw-r--r--lisp/gnus/gnus-art.el98
-rw-r--r--lisp/gnus/gnus-msg.el12
-rw-r--r--lisp/help-fns.el7
-rw-r--r--lisp/info-look.el64
-rw-r--r--lisp/info.el42
-rw-r--r--lisp/international/iso-cvt.el121
-rw-r--r--lisp/international/mule-cmds.el343
-rw-r--r--lisp/international/mule.el2
-rw-r--r--lisp/mail/rmail-spam-filter.el15
-rw-r--r--lisp/mail/rmail.el4
-rw-r--r--lisp/menu-bar.el56
-rw-r--r--lisp/mwheel.el8
-rw-r--r--lisp/net/browse-url.el17
-rw-r--r--lisp/net/tramp.el3
-rw-r--r--lisp/paren.el4
-rw-r--r--lisp/pcvs.el21
-rw-r--r--lisp/printing.el29
-rw-r--r--lisp/progmodes/ada-xref.el2
-rw-r--r--lisp/progmodes/compile.el13
-rw-r--r--lisp/progmodes/cperl-mode.el2
-rw-r--r--lisp/progmodes/gdb-ui.el12
-rw-r--r--lisp/progmodes/idlw-shell.el31
-rw-r--r--lisp/simple.el201
-rw-r--r--lisp/subr.el18
-rw-r--r--lisp/textmodes/conf-mode.el531
-rw-r--r--lisp/textmodes/flyspell.el2
-rw-r--r--lisp/textmodes/sgml-mode.el117
-rw-r--r--lisp/tooltip.el10
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-mailto.el2
58 files changed, 2783 insertions, 1555 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6fc7796f339..b443f53ebba 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,8 +1,410 @@
12004-11-12 Jay Belanger <belanger@truman.edu>
2
3 * calc/calc-graph.el (calc-dumb-map): Declared it.
4 (calc-graph-show-dumb): Check if calc-dumb-map is non-nil rather
5 than unbound.
6
7 (calc-graph-name): Made `end' a local variable.
8 (calc-graph-lookup): Made `varname' a local variable.
9
10 (var-DUMMY, var-DUMMY2, var-PlotRejects, calc-gnuplot-trail-mark):
11 Declared them.
12
13 (calc-graph-format-data): Don't check if var-PlotRejects is
14 bound.
15
16 (calc-graph-plot, calc-graph-compute-3d): Removed references to
17 the unused variable y3vec.
18
19 (calc-graph-show-dumb): Removed reference to unused variable
20 found-pt.
21
22 (calc-graph-kill-hook, calc-graph-plot): Removed reference to
23 calc-graph-prev-kill-hook.
24
25 (calc-graph-yvalue, calc-graph-yvec, calc-graph-numsteps)
26 (calc-graph-numsteps3, calc-graph-xvalue, calc-graph-xvec)
27 (calc-graph-xname, calc-graph-yname, calc-graph-xstep)
28 (calc-graph-ycache, calc-graph-ycacheptr, calc-graph-refine)
29 (calc-graph-keep-file, calc-graph-xval, calc-graph-xlow)
30 (calc-graph-xhigh, calc-graph-yval, calc-graph-yp, calc-graph-xp)
31 (calc-graph-zp, calc-graph-yvector, calc-graph-resolution)
32 (calc-graph-y3value, calc-graph-y3name)
33 (calc-graph-y3step, calc-graph-y3step, calc-graph-zval)
34 (calc-graph-stepcount, calc-graph-is-splot)
35 (calc-graph-surprise-splot, calc-graph-blank)
36 (calc-graph-non-blank, calc-graph-curve-num): New variables.
37 (calc-graph-plot, calc-graph-compute-2d, calc-graph-refine-2d)
38 (calc-graph-recompute-2d, calc-graph-compute-3d)
39 (calc-graph-format-data): Replaced undeclared variables with the
40 above newly declared variables.
41
422004-11-12 Diane Murray <dsm@muenster.de> (tiny change)
43
44 * mail/rmail.el (rmail-get-new-mail): Use the renamed variables
45 `rsf-beep' and `rsf-sleep-after-message'.
46
47 * mail/rmail-spam-filter.el (rmail-spam-filter): Only check white
48 list if `message-sender' is non-nil.
49
502004-11-12 Kevin Rodgers <ihs_4664@yahoo.com> (tiny change)
51
52 * desktop.el (desktop-create-buffer, desktop-save): Avoid some
53 consing by using mapc instead of mapcar.
54
552004-11-12 Nick Roberts <nickrob@snap.net.nz>
56
57 * tooltip.el (require): Explain why CL is needed.
58
592004-11-11 Vinicius Jose Latorre <viniciusjl@ig.com.br>
60
61 * printing.el: Insert :version into defgroup (printing). All reference
62 to Files option in menubar were changed to File.
63 (pr-version): New version number (6.8.2).
64 (pr-get-symbol): Call easy-menu-intern.
65 (pr-region-active-p): Now is a fun (it was defsubst). To avoid
66 compilation gripes.
67
682004-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
69
70 * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Understand the
71 new byte-compile-function-environment binding to t.
72
73 * font-lock.el (font-lock-fontify-syntactically-region):
74 Don't forget to highlight the last char when we hit `end'.
75
76 * mwheel.el (mouse-wheel-progressive-speed): Fix typo in name.
77 (mwheel-scroll): Adjust accordingly.
78
79 * cvs-status.el: Reduce spurious warnings.
80 (cvs-status-checkout): Remove.
81 (cvs-status-mode-map): Use cvs-mode-checkout instead.
82
83 * pcvs.el (cvs-mode-checkout): New command.
84
85 * international/iso-cvt.el (iso-cvt-define-menu): Fix typo.
86
87 * tooltip.el: Require CL.
88
89 * emacs-lisp/bytecomp.el: Use push.
90 (byte-compile-file-form-defalias): Rename from byte-compile-defalias.
91 (defalias): Remove the `byte-compile' property and add
92 a `byte-hunk-handler'.
93
942004-11-11 Juri Linkov <juri@jurta.org>
95
96 * info.el (Info-search): Save match data for isearch.
97 Skip Tag Table node.
98
99 * descr-text.el (describe-char): Replace syntax-after with code
100 from its previous version.
101
102 * files.el (magic-mode-alist): Use optimization for SGML mode too.
103 (set-auto-mode): Doc fix. Remove unused variable `xml'.
104
105 * international/mule.el (sgml-html-meta-auto-coding-function):
106 Remove > after <html to allow HTML attributes.
107
1082004-11-11 Jay Belanger <belanger@truman.edu>
109
110 * calc/calc-comb.el (math-prime-factors-finished): Declare it as
111 a variable.
112 (calcFunc-dfac): Replace unbound max by n.
113 (math-stirling-local-cache): New variable.
114 (math-stirling-number, math-stirling-1, math-stirling-2):
115 Replace the variable `cache' by the declared variable
116 math-stirling-local-cache.
117 (var-RandSeed): Declare it as a variable.
118 (math-init-random-base, math-random-digit): Don't check to see if
119 var-RandSeed is bound.
120 (math-random-cache, math-gaussian-cache, calc-verbose-nextprime):
121 Declare them instead of just setting them.
122 (math-init-random-base): Made i a local variable.
123 (math-random-digit): Made math-random-last a local variable.
124 (math-prime-test-cache): Move declaration to before it is used.
125 (math-prime-test-cache-k, math-prime-test-cache-q)
126 (math-prime-test-cache-nm1, math-prime-factors-finished):
127 Declare them as variables.
128
1292004-11-11 Jay Belanger <belanger@truman.edu>
130
131 * calc/calc-ext.el (math-defcache): Use defvar for the new
132 variables it creates.
133
1342004-11-11 Lars Hansen <larsh@math.ku.dk>
135
136 * desktop.el (desktop-buffer-mode-handlers, desktop-after-read-hook)
137 (desktop-clear-preserve-buffers-regexp, desktop-file-name-format)
138 (desktop-globals-to-clear, desktop-no-desktop-file-hook, desktop-path)
139 (desktop-save): Add :version.
140
1412004-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
142
143 * printing.el (pr-get-symbol): Don't downcase.
144
1452004-11-10 Jay Belanger <belanger@truman.edu>
146
147 * calc/calc-aent.el (calc-do-quick-calc): Use kill-new to append
148 string to kill-ring.
149
150 * calc/calc-aent.el (calc-alg-exp, math-toks)
151 (math-exp-pos,math-exp-old-pos, math-exp-token)
152 (math-exp-keep-spaces, math-exp-str): New variables.
153 (calc-do-alg-entry, calcAlg-equals, calcAlg-edit)
154 (calcAlg-enter): Use declared variable calc-alg-exp.
155 (math-build-parse-table, math-find-user-token): Use declared
156 variable math-toks.
157 (math-read-exprs, math-read-token, calc-check-user-syntax)
158 (calc-match-user-syntax, match-factor-after, math-read-factor):
159 Use declared variables math-exp-pos math-exp-old-pos.
160 (math-read-exprs, math-read-token, math-read-expr-level)
161 (calc-check-user-syntax, calc-match-user-syntax)
162 (match-factor-after, math-read-factor): Use declared variable
163 math-exp-token.
164 (math-read-exprs, math-read-expr-list, math-read-token)
165 (math-read-factor): Use declared variable math-exp-keep-spaces.
166 (math-read-exprs, math-read-token): Use declared variable
167 math-exp-str.
168 (calc-match-user-syntax): Made m a local variable.
169
170 * calc/calc-ext.el (math-read-expr): Use declared variables
171 math-exp-pos, math-exp-old-pos, math-exp-str, math-exp-token,
172 math-exp-keep-spaces.
173
174 * calc/calc-forms.el (math-read-angle-bracket): Use declared
175 variables math-exp-pos, math-exp-str.
176
177 * calc/calc-lang.el (math-parse-tex-sum): Use declared variable
178 math-exp-old-pos.
179 (math-parse-fortran-vector, math-parse-fortran-vector-end)
180 (math-parse-eqn-prime): Use declared variable math-exp-token.
181
182 * calc/calc-vec.el (math-read-brackets, math-check-for-commas):
183 Use declared variable math-exp-pos.
184 (math-check-for-commas): Use declared variable math-exp-str.
185 (math-read-brackets): Use declared variables math-exp-old-pos,
186 math-exp-keep-spaces.
187 (math-read-brackets, math-read-vector, math-read-matrix):
188 Use declared variable math-exp-token.
189
1902004-11-10 Stefan Monnier <monnier@iro.umontreal.ca>
191
192 * files.el (magic-mode-alist): Reduce backtracking in the HTML regexp.
193
194 * textmodes/sgml-mode.el (sgml-tag-text-p): New fun.
195 (sgml-parse-tag-backward): Use it to skip spurious < or >.
196
1972004-11-10 Thien-Thi Nguyen <ttn@gnu.org>
198
199 * ebuff-menu.el: Doc fixes throughout.
200 (electric-buffer-menu-mode-hook): New defvar.
201
2022004-11-10 Nick Roberts <nickrob@snap.net.nz>
203
204 * tooltip.el: Don't require cl, comint, gud, gdb-ui for
205 compilation. The resulting compiler warnings appear to be harmless.
206
2072004-11-10 Daniel Pfeiffer <occitan@esperanto.org>
208
209 * textmodes/conf-mode.el: New file.
210
211 * files.el (auto-mode-alist, magic-mode-alist): Use it.
212
2132004-11-09 Stefan Monnier <monnier@iro.umontreal.ca>
214
215 * international/iso-cvt.el (iso-cvt-define-menu): Clean up namespace.
216
2172004-11-09 Jay Belanger <belanger@truman.edu>
218
219 * calc/calc-ext.el (calc-init-extensions): Remove old code.
220
221 * calc/calc-ext.el (math-expr-data, math-mt-many, math-mt-func)
222 (calc-z-prefix-buf, calc-z-prefix-msgs): New variables.
223 (calc-z-prefix-help, calc-user-function-list): Use declared
224 variables calc-z-prefix-buf, calc-z-prefix-msgs.
225 (math-map-tree, math-map-tree-rec): Use declared variables
226 math-mt-many, math-mt-func.
227 (math-read-expression, math-read-string): Use declared variable
228 math-expr-data.
229
230 * calc/calc-ext.el (math-normalize-nonstandard): Use declared
231 variable math-normalize-a.
232
233 * calc/calc.el (math-normalize-a): New variable.
234 (math-normalize): Use declared variable math-normalize-a.
235
236 * calc/calc-poly.el (math-expand-form): Use declared variable
237 math-mt-many.
238
239 * calc/calc-rewr.el (math-rewrite, math-rewrite-phase):
240 Use declared variable math-mt-many.
241 (math-rewrite): Use declared variable math-mt-func.
242
243 * calc/calc-vec.el (math-read-brackets, math-read-vector)
244 (math-read-matrix): Use declared variable math-expr-data.
245
246 * calc/calc-lang.el (math-parse-fortran-vector)
247 (math-parse-fortran-vector-end, math-parse-tex-sum)
248 (math-parse-eqn-matrix, math-parse-eqn-prime)
249 (math-read-math-subscr): Use declared variable math-expr-data.
250
251 * calc/calc-aent.el (math-read-exprs, math-read-expr-list)
252 (math-read-expr-level, math-read-token, calc-check-user-syntax)
253 (calc-match-user-syntax, math-read-if, math-factor-after)
254 (math-read-factor): Use declared variable math-expr-data.
255
2562004-11-09 Glenn Morris <gmorris@ast.cam.ac.uk>
257
258 * calendar/diary-lib.el (diary-from-outlook)
259 (diary-from-outlook-gnus, diary-from-outlook-rmail): Do not use
260 interactive-p; but rather new optional argument NOCONFIRM.
261
2622004-11-09 Stefan Monnier <monnier@iro.umontreal.ca>
263
264 * emacs-lisp/easymenu.el (easy-menu-intern): Revert to no-downcasing.
265 (easy-menu-name-match): Revert correspondingly.
266
2672004-11-09 Richard M. Stallman <rms@gnu.org>
268
269 * emacs-lisp/bytecomp.el (byte-compile-defalias):
270 Turn off warnings for the new function even if definition not constant.
271 If the definition isn't a quoted symbol, record (FUNCTION . t).
272 (byte-compile-function-environment): Now allow (FUNCTION . t) as elt.
273 (byte-compile-callargs-warn): Handle (FUNCTION . t).
274 (display-call-tree, byte-compile-arglist-warn):
275 Handle t returned by byte-compile-fdefinition.
276
2772004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
278
279 * Makefile.in (maintainer-clean): Depend on distclean.
280
281 * help-fns.el (help-C-file-name): File name must be in build-files
282 to be returned.
283
2842004-11-09 Jay Belanger <belanger@truman.edu>
285
286 * calc/calc.el (calc-mode-hook, calc-trail-mode-hook)
287 (calc-start-hook, calc-end-hook, calc-load-hook): New variables.
288
289 * calc/calc.el (calc, calc-trail-display, calc-mode):
290 Remove obsolete sections.
291
292 * calc/calc.el (calc-x-paste-text): Remove.
293
294 * calc/calc-ext.el (calc-init-extensions): Bind calc-yank to
295 mouse-2.
296
2972004-11-09 Nick Roberts <nickrob@snap.net.nz>
298
299 * progmodes/gdb-ui.el (gdb-current-stack-level): New variable.
300 (gdb-info-frames-custom, gdb-frame-handler): Use it to find
301 current frame (in case of recursive calls).
302 (gdb-show-changed-values): Add :version keyword.
303
3042004-11-08 Stefan Monnier <monnier@iro.umontreal.ca>
305
306 * international/mule-cmds.el: Change coding-system to utf-8.
307 (select-safe-coding-system-interactively):
308 New function extracted from select-safe-coding-system.
309 (select-safe-coding-system): Use it.
310
3112004-11-08 Richard M. Stallman <rms@gnu.org>
312
313 * subr.el (syntax-after): Doc fix.
314
315 * paren.el (show-paren-function): Change calls to syntax-after
316 for new way of returning the value.
317
318 * menu-bar.el (menu-bar-file-menu): Make this the real name
319 and menu-bar-files-menu the alias. Use the former.
320 (global-map): Use `file', not `files', as the symbol.
321
322 * info.el (Info-revert-find-node): Don't use beginning-of-buffer.
323
324 * filesets.el (filesets-spawn-external-viewer, filesets-run-cmd):
325 Don't use beginning-of-buffer.
326 (filesets-cmd-show-result): Use with-no-warnings.
327
3282004-11-08 Juri Linkov <juri@jurta.org>
329
330 * progmodes/compile.el (compile): Don't overwrite last command in
331 minibuffer history with default command if they are not equal.
332
3332004-11-08 Jay Belanger <belanger@truman.edu>
334
335 * calc/calcalg2.el (math-do-integral-methods): Try linear then
336 non-linear substitutions.
337
3382004-11-08 Jay Belanger <belanger@truman.edu>
339
340 * calc/calcalg2.el (math-linear-subst-tried): New variable.
341 (math-do-integral): Set `math-linear-subst-tried' to nil.
342 (math-do-integral-methods): Use `math-linear-subst-tried' to
343 determine what type of substitution to try.
344 (math-integ-try-linear-substituion):
345 Set `math-linear-subst-tried' to t.
346
3472004-11-08 Kim F. Storm <storm@cua.dk>
348
349 * Makefile.in (bootstrap-clean): New target for 'make bootstrap'.
350
3512004-11-07 Juri Linkov <juri@jurta.org>
352
353 * info-look.el (info-lookup): Allow reusing in the current buffer
354 not only *info* buffer, but all (even renamed) Info buffers
355 by checking for major-mode instead of *info* buffer name.
356 (c-mode, autoconf-mode, emacs-lisp-mode, scheme-mode)
357 (octave-mode, maxima-mode) <doc-spec>:
358 Allow long dashes generated by Texinfo 4.7 before definitions.
359 (texinfo-mode) <doc-spec>: Add space to suffix to find command
360 definitions with argument separated by space.
361
3622004-11-06 Richard M. Stallman <rms@gnu.org>
363
364 * simple.el (next-error group, face): Move before first use.
365 (next-error-highlight, next-error-highlight-no-select): Likewise.
366
367 * simple.el (line-move-invisible-p): Rename from line-move-invisible.
368 (line-move): New args NOERROR and TO-END.
369 Return t if if succeed in moving specified number of lines.
370 (move-end-of-line): New function.
371
372 * simple.el (beginning-of-buffer-other-window): Use with-no-warnings.
373 (end-of-buffer-other-window): Likewise.
374
375 * simple.el (line-move-ignore-invisible): Default to t.
376
377 * subr.el (syntax-after): Return the syntax letter, not the raw code.
378
379 * emacs-lisp/elp.el (elp-results): Delete wasteful beginning-of-buffer.
380
381 * international/iso-cvt.el (iso-cvt-define-menu):
382 Rename menu-bar-files-menu to menu-bar-file-menu.
383
384 * net/browse-url.el (browse-url-gnome-moz-program)
385 (browse-url-gnome-moz-arguments): Move up before first use.
386
387 * net/tramp.el (tramp group): Add :version.
388
389 * progmodes/ada-xref.el (ada-gdb-application):
390 Use goto-char instead of beginning-of-buffer.
391
392 * progmodes/cperl-mode.el (cperl-info-on-command):
393 Use goto-char instead of beginning-of-buffer.
394
395 * progmodes/idlw-shell.el (idlwave-shell-examine-map):
396 Move up before first use.
397 (idlwave-shell-temp-pro-file): Likewise.
398 (idlwave-shell-temp-rinfo-save-file): Likewise.
399 (idlwave-shell-temp-file): Minor doc fix.
400
401 * textmodes/flyspell.el (flyspell-external-point-words):
402 Use goto-char instead of beginning-of-buffer.
403
12004-11-06 Kai Grossjohann <kai.grossjohann@gmx.net> 4042004-11-06 Kai Grossjohann <kai.grossjohann@gmx.net>
2 405
3 * net/tramp.el (tramp-coding-commands): Additionally try "uudecode 406 * net/tramp.el (tramp-coding-commands): Additionally try "uudecode -o
4 -o /dev/stdout" before trying "uudecode -o -". Suggested by Han 407 /dev/stdout" before trying "uudecode -o -". Suggested by Han Boetes.
5 Boetes.
6 (tramp-uudecode): Mention `uudecode -o /dev/stdout'. 408 (tramp-uudecode): Mention `uudecode -o /dev/stdout'.
7 409
82004-11-06 David Ponce <david@dponce.com> 4102004-11-06 David Ponce <david@dponce.com>
@@ -59,8 +461,7 @@
59 461
602004-11-04 Daniel Pfeiffer <occitan@esperanto.org> 4622004-11-04 Daniel Pfeiffer <occitan@esperanto.org>
61 463
62 * files.el (set-auto-mode): Don't get error after setting 464 * files.el (set-auto-mode): Don't get error after setting -*-mode-*-.
63 -*-mode-*-.
64 465
652004-11-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 4662004-11-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
66 467
@@ -182,8 +583,7 @@
182 (icalendar-convert-diary-to-ical) 583 (icalendar-convert-diary-to-ical)
183 (icalendar-extract-ical-from-buffer): Use only two args for 584 (icalendar-extract-ical-from-buffer): Use only two args for
184 make-obsolete (XEmacs compatibility). 585 make-obsolete (XEmacs compatibility).
185 (icalendar-export-file, icalendar-import-file): Blank at end of 586 (icalendar-export-file, icalendar-import-file): Blank at end of prompt.
186 prompt.
187 (icalendar-export-region): Doc fix. 587 (icalendar-export-region): Doc fix.
188 If error, return non-nil and write errors to a buffer. 588 If error, return non-nil and write errors to a buffer.
189 Use correct weekday for weekly recurring events. 589 Use correct weekday for weekly recurring events.
@@ -223,16 +623,16 @@
223 623
2242004-11-02 Pavel Kobiakov <pk_at_work@yahoo.com> 6242004-11-02 Pavel Kobiakov <pk_at_work@yahoo.com>
225 625
226 * progmodes/flymake.el (flymake-err-line-patterns): Use 626 * progmodes/flymake.el (flymake-err-line-patterns):
227 `flymake-reformat-err-line-patterns-from-compile-el' to convert 627 Use `flymake-reformat-err-line-patterns-from-compile-el' to convert
228 `compilation-error-regexp-alist-alist' to internal Flymake format. 628 `compilation-error-regexp-alist-alist' to internal Flymake format.
229 629
230 * progmodes/flymake.el: eliminated byte-compiler warnings. 630 * progmodes/flymake.el: eliminated byte-compiler warnings.
231 631
2322004-11-01 Jay Belanger <belanger@truman.edu> 6322004-11-01 Jay Belanger <belanger@truman.edu>
233 633
234 * calc/calc-frac.el (calc-over-notation): Replaced 634 * calc/calc-frac.el (calc-over-notation): Replace `completing-read'
235 `completing-read' with `interactive "s"'. 635 with `interactive "s"'.
236 636
2372004-11-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 6372004-11-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
238 638
diff --git a/lisp/ChangeLog.10 b/lisp/ChangeLog.10
index 486f0f38964..a702e56fdf3 100644
--- a/lisp/ChangeLog.10
+++ b/lisp/ChangeLog.10
@@ -4150,6 +4150,7 @@
4150 (desktop-path): New customizable variable. List of directories in 4150 (desktop-path): New customizable variable. List of directories in
4151 which to lookup the desktop file. Replaces hardcoded list. 4151 which to lookup the desktop file. Replaces hardcoded list.
4152 (desktop-globals-to-clear): New variable replaces hardcoded list. 4152 (desktop-globals-to-clear): New variable replaces hardcoded list.
4153 (desktop-globals-to-save): Variable made customizable.
4153 (desktop-clear-preserve-buffers-regexp): New customizable variable. 4154 (desktop-clear-preserve-buffers-regexp): New customizable variable.
4154 (desktop-after-read-hook): New hook run after a desktop is read. 4155 (desktop-after-read-hook): New hook run after a desktop is read.
4155 (desktop-no-desktop-file-hook): New hook when no desktop file found. 4156 (desktop-no-desktop-file-hook): New hook when no desktop file found.
diff --git a/lisp/ChangeLog.7 b/lisp/ChangeLog.7
index 85dfaeaf35f..f89cb7b0d47 100644
--- a/lisp/ChangeLog.7
+++ b/lisp/ChangeLog.7
@@ -23104,8 +23104,8 @@
23104 * message.el (message-mode): Delete abbrev mode initialization. 23104 * message.el (message-mode): Delete abbrev mode initialization.
23105 (message-mode-hook): Move it here, instead, so the user can 23105 (message-mode-hook): Move it here, instead, so the user can
23106 override it. 23106 override it.
23107 (message-y-or-n-p, message-talkative-question, 23107 (message-y-or-n-p, message-talkative-question)
23108 message-flatten-list, message-flatten-list-1): Move utility 23108 (message-flatten-list, message-flatten-list-1): Move utility
23109 functions up so macro is defined before first invocation. 23109 functions up so macro is defined before first invocation.
23110 23110
23111 * f90.el (f90-auto-fill-mode): Function deleted, all references 23111 * f90.el (f90-auto-fill-mode): Function deleted, all references
@@ -23115,24 +23115,23 @@
23115 23115
231161996-08-13 Torbjorn Einarsson <etxeina@etxdn.ericsson.se> 231161996-08-13 Torbjorn Einarsson <etxeina@etxdn.ericsson.se>
23117 23117
23118 * f90.el: (f90-do-auto-fill): Fixed bug which made program hang for 23118 * f90.el: (f90-do-auto-fill): Fix bug which made program hang for
23119 space in fill-column. 23119 space in fill-column.
23120 (f90-font-lock-keywords-1): Now we have common font-lock 23120 (f90-font-lock-keywords-1): Now we have common font-lock
23121 exps for Emacs and XEmacs 23121 exps for Emacs and XEmacs
23122 (f90-font-lock-keywords-2): Changed reg-exp for line number. A 23122 (f90-font-lock-keywords-2): Change reg-exp for line number.
23123 number must be followed by a letter to be highlighted. Fixed 23123 A number must be followed by a letter to be highlighted.
23124 highlighting of declarations with trailing comments. 23124 Fix highlighting of declarations with trailing comments.
23125 (f90-match-end): Fixed bug due to new message syntax. 23125 (f90-match-end): Fix bug due to new message syntax.
23126 (f90-mode): Fixed setup of variable font-lock-defaults. 23126 (f90-mode): Fix setup of variable font-lock-defaults.
23127 (f90-looking-at-program-block-start): Small error in detecting of 23127 (f90-looking-at-program-block-start): Small error in detecting of
23128 function start. Made the detection of subroutine start more flexible. 23128 function start. Made the detection of subroutine start more flexible.
23129 (f90-mode-map): Much nicer menu with sections and added submenus 23129 (f90-mode-map): Much nicer menu with sections and added submenus
23130 for highlighting and keyword case change. 23130 for highlighting and keyword case change.
23131 Also added 'menu-enable' properties for region-based commands. 23131 Also added 'menu-enable' properties for region-based commands.
23132 (f90-imenu-generic-expression): Fixed expression to find 23132 (f90-imenu-generic-expression): Fix expression to find
23133 procedures, modules and types. 23133 procedures, modules and types.
23134 (f90-add-imenu-menu): New function for adding imenu menu to the 23134 (f90-add-imenu-menu): New function for adding imenu menu to the menubar.
23135 menubar.
23136 23135
231371996-08-13 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> 231361996-08-13 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
23138 23137
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 5085d3b5b91..e87ffa6f265 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -311,9 +311,12 @@ bootstrap-prepare:
311 fi \ 311 fi \
312 fi 312 fi
313 313
314maintainer-clean: 314maintainer-clean: distclean
315 cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL) 315 cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL)
316 316
317bootstrap-clean:
318 cd $(lisp); rm -f *.elc */*.elc
319
317# Generate/update files for the bootstrap process. 320# Generate/update files for the bootstrap process.
318 321
319bootstrap: update-subdirs autoloads compile 322bootstrap: update-subdirs autoloads compile
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index 2db722ccb2d..182b3b0635c 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -101,10 +101,7 @@
101 (message "Result: %s" buf))) 101 (message "Result: %s" buf)))
102 (if (eq last-command-char 10) 102 (if (eq last-command-char 10)
103 (insert shortbuf) 103 (insert shortbuf)
104 (setq kill-ring (cons shortbuf kill-ring)) 104 (kill-new shortbuf)))))
105 (when (> (length kill-ring) kill-ring-max)
106 (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))
107 (setq kill-ring-yank-pointer kill-ring)))))
108 105
109(defun calc-do-calc-eval (str separator args) 106(defun calc-do-calc-eval (str separator args)
110 (calc-check-defines) 107 (calc-check-defines)
@@ -301,10 +298,12 @@
301(defvar calc-alg-ent-esc-map nil 298(defvar calc-alg-ent-esc-map nil
302 "The keymap used for escapes in algebraic entry.") 299 "The keymap used for escapes in algebraic entry.")
303 300
301(defvar calc-alg-exp)
302
304(defun calc-do-alg-entry (&optional initial prompt no-normalize) 303(defun calc-do-alg-entry (&optional initial prompt no-normalize)
305 (let* ((calc-buffer (current-buffer)) 304 (let* ((calc-buffer (current-buffer))
306 (blink-paren-function 'calcAlg-blink-matching-open) 305 (blink-paren-function 'calcAlg-blink-matching-open)
307 (alg-exp 'error)) 306 (calc-alg-exp 'error))
308 (unless calc-alg-ent-map 307 (unless calc-alg-ent-map
309 (setq calc-alg-ent-map (copy-keymap minibuffer-local-map)) 308 (setq calc-alg-ent-map (copy-keymap minibuffer-local-map))
310 (define-key calc-alg-ent-map "'" 'calcAlg-previous) 309 (define-key calc-alg-ent-map "'" 'calcAlg-previous)
@@ -328,13 +327,13 @@
328 (let ((buf (read-from-minibuffer (or prompt "Algebraic: ") 327 (let ((buf (read-from-minibuffer (or prompt "Algebraic: ")
329 (or initial "") 328 (or initial "")
330 calc-alg-ent-map nil))) 329 calc-alg-ent-map nil)))
331 (when (eq alg-exp 'error) 330 (when (eq calc-alg-exp 'error)
332 (when (eq (car-safe (setq alg-exp (math-read-exprs buf))) 'error) 331 (when (eq (car-safe (setq calc-alg-exp (math-read-exprs buf))) 'error)
333 (setq alg-exp nil))) 332 (setq calc-alg-exp nil)))
334 (setq calc-aborted-prefix "alg'") 333 (setq calc-aborted-prefix "alg'")
335 (or no-normalize 334 (or no-normalize
336 (and alg-exp (setq alg-exp (mapcar 'calc-normalize alg-exp)))) 335 (and calc-alg-exp (setq calc-alg-exp (mapcar 'calc-normalize calc-alg-exp))))
337 alg-exp))) 336 calc-alg-exp)))
338 337
339(defun calcAlg-plus-minus () 338(defun calcAlg-plus-minus ()
340 (interactive) 339 (interactive)
@@ -364,8 +363,8 @@
364 (interactive) 363 (interactive)
365 (unwind-protect 364 (unwind-protect
366 (calcAlg-enter) 365 (calcAlg-enter)
367 (if (consp alg-exp) 366 (if (consp calc-alg-exp)
368 (progn (setq prefix-arg (length alg-exp)) 367 (progn (setq prefix-arg (length calc-alg-exp))
369 (calc-unread-command ?=))))) 368 (calc-unread-command ?=)))))
370 369
371(defun calcAlg-escape () 370(defun calcAlg-escape ()
@@ -383,8 +382,8 @@
383 (calc-minibuffer-contains 382 (calc-minibuffer-contains
384 "\\`\\([^\"]*\"[^\"]*\"\\)*[^\"]*\"[^\"]*\\'")) 383 "\\`\\([^\"]*\"[^\"]*\"\\)*[^\"]*\"[^\"]*\\'"))
385 (insert "`") 384 (insert "`")
386 (setq alg-exp (minibuffer-contents)) 385 (setq calc-alg-exp (minibuffer-contents))
387 (and (> (length alg-exp) 0) (setq calc-previous-alg-entry alg-exp)) 386 (and (> (length calc-alg-exp) 0) (setq calc-previous-alg-entry calc-alg-exp))
388 (exit-minibuffer))) 387 (exit-minibuffer)))
389 388
390(defun calcAlg-enter () 389(defun calcAlg-enter ()
@@ -402,7 +401,7 @@
402 (calc-temp-minibuffer-message 401 (calc-temp-minibuffer-message
403 (concat " [" (or (nth 2 exp) "Error") "]")) 402 (concat " [" (or (nth 2 exp) "Error") "]"))
404 (calc-clear-unread-commands)) 403 (calc-clear-unread-commands))
405 (setq alg-exp (if (calc-minibuffer-contains "\\` *\\[ *\\'") 404 (setq calc-alg-exp (if (calc-minibuffer-contains "\\` *\\[ *\\'")
406 '((incomplete vec)) 405 '((incomplete vec))
407 exp)) 406 exp))
408 (and (> (length str) 0) (setq calc-previous-alg-entry str)) 407 (and (> (length str) 0) (setq calc-previous-alg-entry str))
@@ -460,30 +459,39 @@
460 459
461;;; Algebraic expression parsing. [Public] 460;;; Algebraic expression parsing. [Public]
462 461
463(defun math-read-exprs (exp-str) 462;;; The next few variables are local to math-read-exprs (and math-read-expr)
464 (let ((exp-pos 0) 463;;; but are set in functions they call.
465 (exp-old-pos 0) 464
466 (exp-keep-spaces nil) 465(defvar math-exp-pos)
467 exp-token exp-data) 466(defvar math-exp-str)
467(defvar math-exp-old-pos)
468(defvar math-exp-token)
469(defvar math-exp-keep-spaces)
470
471(defun math-read-exprs (math-exp-str)
472 (let ((math-exp-pos 0)
473 (math-exp-old-pos 0)
474 (math-exp-keep-spaces nil)
475 math-exp-token math-expr-data)
468 (if calc-language-input-filter 476 (if calc-language-input-filter
469 (setq exp-str (funcall calc-language-input-filter exp-str))) 477 (setq math-exp-str (funcall calc-language-input-filter math-exp-str)))
470 (while (setq exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" exp-str)) 478 (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str))
471 (setq exp-str (concat (substring exp-str 0 exp-token) "\\dots" 479 (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots"
472 (substring exp-str (+ exp-token 2))))) 480 (substring math-exp-str (+ math-exp-token 2)))))
473 (math-build-parse-table) 481 (math-build-parse-table)
474 (math-read-token) 482 (math-read-token)
475 (let ((val (catch 'syntax (math-read-expr-list)))) 483 (let ((val (catch 'syntax (math-read-expr-list))))
476 (if (stringp val) 484 (if (stringp val)
477 (list 'error exp-old-pos val) 485 (list 'error math-exp-old-pos val)
478 (if (equal exp-token 'end) 486 (if (equal math-exp-token 'end)
479 val 487 val
480 (list 'error exp-old-pos "Syntax error")))))) 488 (list 'error math-exp-old-pos "Syntax error"))))))
481 489
482(defun math-read-expr-list () 490(defun math-read-expr-list ()
483 (let* ((exp-keep-spaces nil) 491 (let* ((math-exp-keep-spaces nil)
484 (val (list (math-read-expr-level 0))) 492 (val (list (math-read-expr-level 0)))
485 (last val)) 493 (last val))
486 (while (equal exp-data ",") 494 (while (equal math-expr-data ",")
487 (math-read-token) 495 (math-read-token)
488 (let ((rest (list (math-read-expr-level 0)))) 496 (let ((rest (list (math-read-expr-level 0))))
489 (setcdr last rest) 497 (setcdr last rest)
@@ -496,20 +504,23 @@
496(defvar calc-user-tokens nil) 504(defvar calc-user-tokens nil)
497(defvar calc-user-token-chars nil) 505(defvar calc-user-token-chars nil)
498 506
507(defvar math-toks nil
508 "Tokens to pass between math-build-parse-table and math-find-user-tokens.")
509
499(defun math-build-parse-table () 510(defun math-build-parse-table ()
500 (let ((mtab (cdr (assq nil calc-user-parse-tables))) 511 (let ((mtab (cdr (assq nil calc-user-parse-tables)))
501 (ltab (cdr (assq calc-language calc-user-parse-tables)))) 512 (ltab (cdr (assq calc-language calc-user-parse-tables))))
502 (or (and (eq mtab calc-last-main-parse-table) 513 (or (and (eq mtab calc-last-main-parse-table)
503 (eq ltab calc-last-lang-parse-table)) 514 (eq ltab calc-last-lang-parse-table))
504 (let ((p (append mtab ltab)) 515 (let ((p (append mtab ltab))
505 (toks nil)) 516 (math-toks nil))
506 (setq calc-user-parse-table p) 517 (setq calc-user-parse-table p)
507 (setq calc-user-token-chars nil) 518 (setq calc-user-token-chars nil)
508 (while p 519 (while p
509 (math-find-user-tokens (car (car p))) 520 (math-find-user-tokens (car (car p)))
510 (setq p (cdr p))) 521 (setq p (cdr p)))
511 (setq calc-user-tokens (mapconcat 'identity 522 (setq calc-user-tokens (mapconcat 'identity
512 (sort (mapcar 'car toks) 523 (sort (mapcar 'car math-toks)
513 (function (lambda (x y) 524 (function (lambda (x y)
514 (> (length x) 525 (> (length x)
515 (length y))))) 526 (length y)))))
@@ -517,7 +528,7 @@
517 calc-last-main-parse-table mtab 528 calc-last-main-parse-table mtab
518 calc-last-lang-parse-table ltab))))) 529 calc-last-lang-parse-table ltab)))))
519 530
520(defun math-find-user-tokens (p) ; uses "toks" 531(defun math-find-user-tokens (p)
521 (while p 532 (while p
522 (cond ((and (stringp (car p)) 533 (cond ((and (stringp (car p))
523 (or (> (length (car p)) 1) (equal (car p) "$") 534 (or (> (length (car p)) 1) (equal (car p) "$")
@@ -528,9 +539,9 @@
528 (setq s (concat "\\<" s))) 539 (setq s (concat "\\<" s)))
529 (if (string-match "[a-zA-Z0-9]\\'" s) 540 (if (string-match "[a-zA-Z0-9]\\'" s)
530 (setq s (concat s "\\>"))) 541 (setq s (concat s "\\>")))
531 (or (assoc s toks) 542 (or (assoc s math-toks)
532 (progn 543 (progn
533 (setq toks (cons (list s) toks)) 544 (setq math-toks (cons (list s) math-toks))
534 (or (memq (aref (car p) 0) calc-user-token-chars) 545 (or (memq (aref (car p) 0) calc-user-token-chars)
535 (setq calc-user-token-chars 546 (setq calc-user-token-chars
536 (cons (aref (car p) 0) 547 (cons (aref (car p) 0)
@@ -542,161 +553,168 @@
542 (setq p (cdr p)))) 553 (setq p (cdr p))))
543 554
544(defun math-read-token () 555(defun math-read-token ()
545 (if (>= exp-pos (length exp-str)) 556 (if (>= math-exp-pos (length math-exp-str))
546 (setq exp-old-pos exp-pos 557 (setq math-exp-old-pos math-exp-pos
547 exp-token 'end 558 math-exp-token 'end
548 exp-data "\000") 559 math-expr-data "\000")
549 (let ((ch (aref exp-str exp-pos))) 560 (let ((ch (aref math-exp-str math-exp-pos)))
550 (setq exp-old-pos exp-pos) 561 (setq math-exp-old-pos math-exp-pos)
551 (cond ((memq ch '(32 10 9)) 562 (cond ((memq ch '(32 10 9))
552 (setq exp-pos (1+ exp-pos)) 563 (setq math-exp-pos (1+ math-exp-pos))
553 (if exp-keep-spaces 564 (if math-exp-keep-spaces
554 (setq exp-token 'space 565 (setq math-exp-token 'space
555 exp-data " ") 566 math-expr-data " ")
556 (math-read-token))) 567 (math-read-token)))
557 ((and (memq ch calc-user-token-chars) 568 ((and (memq ch calc-user-token-chars)
558 (let ((case-fold-search nil)) 569 (let ((case-fold-search nil))
559 (eq (string-match calc-user-tokens exp-str exp-pos) 570 (eq (string-match calc-user-tokens math-exp-str math-exp-pos)
560 exp-pos))) 571 math-exp-pos)))
561 (setq exp-token 'punc 572 (setq math-exp-token 'punc
562 exp-data (math-match-substring exp-str 0) 573 math-expr-data (math-match-substring math-exp-str 0)
563 exp-pos (match-end 0))) 574 math-exp-pos (match-end 0)))
564 ((or (and (>= ch ?a) (<= ch ?z)) 575 ((or (and (>= ch ?a) (<= ch ?z))
565 (and (>= ch ?A) (<= ch ?Z))) 576 (and (>= ch ?A) (<= ch ?Z)))
566 (string-match (if (memq calc-language '(c fortran pascal maple)) 577 (string-match (if (memq calc-language '(c fortran pascal maple))
567 "[a-zA-Z0-9_#]*" 578 "[a-zA-Z0-9_#]*"
568 "[a-zA-Z0-9'#]*") 579 "[a-zA-Z0-9'#]*")
569 exp-str exp-pos) 580 math-exp-str math-exp-pos)
570 (setq exp-token 'symbol 581 (setq math-exp-token 'symbol
571 exp-pos (match-end 0) 582 math-exp-pos (match-end 0)
572 exp-data (math-restore-dashes 583 math-expr-data (math-restore-dashes
573 (math-match-substring exp-str 0))) 584 (math-match-substring math-exp-str 0)))
574 (if (eq calc-language 'eqn) 585 (if (eq calc-language 'eqn)
575 (let ((code (assoc exp-data math-eqn-ignore-words))) 586 (let ((code (assoc math-expr-data math-eqn-ignore-words)))
576 (cond ((null code)) 587 (cond ((null code))
577 ((null (cdr code)) 588 ((null (cdr code))
578 (math-read-token)) 589 (math-read-token))
579 ((consp (nth 1 code)) 590 ((consp (nth 1 code))
580 (math-read-token) 591 (math-read-token)
581 (if (assoc exp-data (cdr code)) 592 (if (assoc math-expr-data (cdr code))
582 (setq exp-data (format "%s %s" 593 (setq math-expr-data (format "%s %s"
583 (car code) exp-data)))) 594 (car code) math-expr-data))))
584 ((eq (nth 1 code) 'punc) 595 ((eq (nth 1 code) 'punc)
585 (setq exp-token 'punc 596 (setq math-exp-token 'punc
586 exp-data (nth 2 code))) 597 math-expr-data (nth 2 code)))
587 (t 598 (t
588 (math-read-token) 599 (math-read-token)
589 (math-read-token)))))) 600 (math-read-token))))))
590 ((or (and (>= ch ?0) (<= ch ?9)) 601 ((or (and (>= ch ?0) (<= ch ?9))
591 (and (eq ch '?\.) 602 (and (eq ch '?\.)
592 (eq (string-match "\\.[0-9]" exp-str exp-pos) exp-pos)) 603 (eq (string-match "\\.[0-9]" math-exp-str math-exp-pos)
604 math-exp-pos))
593 (and (eq ch '?_) 605 (and (eq ch '?_)
594 (eq (string-match "_\\.?[0-9]" exp-str exp-pos) exp-pos) 606 (eq (string-match "_\\.?[0-9]" math-exp-str math-exp-pos)
595 (or (eq exp-pos 0) 607 math-exp-pos)
608 (or (eq math-exp-pos 0)
596 (and (memq calc-language '(nil flat big unform 609 (and (memq calc-language '(nil flat big unform
597 tex eqn)) 610 tex eqn))
598 (eq (string-match "[^])}\"a-zA-Z0-9'$]_" 611 (eq (string-match "[^])}\"a-zA-Z0-9'$]_"
599 exp-str (1- exp-pos)) 612 math-exp-str (1- math-exp-pos))
600 (1- exp-pos)))))) 613 (1- math-exp-pos))))))
601 (or (and (eq calc-language 'c) 614 (or (and (eq calc-language 'c)
602 (string-match "0[xX][0-9a-fA-F]+" exp-str exp-pos)) 615 (string-match "0[xX][0-9a-fA-F]+" math-exp-str math-exp-pos))
603 (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" exp-str exp-pos)) 616 (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?"
604 (setq exp-token 'number 617 math-exp-str math-exp-pos))
605 exp-data (math-match-substring exp-str 0) 618 (setq math-exp-token 'number
606 exp-pos (match-end 0))) 619 math-expr-data (math-match-substring math-exp-str 0)
620 math-exp-pos (match-end 0)))
607 ((eq ch ?\$) 621 ((eq ch ?\$)
608 (if (and (eq calc-language 'pascal) 622 (if (and (eq calc-language 'pascal)
609 (eq (string-match 623 (eq (string-match
610 "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Z]\\)" 624 "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Z]\\)"
611 exp-str exp-pos) 625 math-exp-str math-exp-pos)
612 exp-pos)) 626 math-exp-pos))
613 (setq exp-token 'number 627 (setq math-exp-token 'number
614 exp-data (math-match-substring exp-str 1) 628 math-expr-data (math-match-substring math-exp-str 1)
615 exp-pos (match-end 1)) 629 math-exp-pos (match-end 1))
616 (if (eq (string-match "\\$\\([1-9][0-9]*\\)" exp-str exp-pos) 630 (if (eq (string-match "\\$\\([1-9][0-9]*\\)" math-exp-str math-exp-pos)
617 exp-pos) 631 math-exp-pos)
618 (setq exp-data (- (string-to-int (math-match-substring 632 (setq math-expr-data (- (string-to-int (math-match-substring
619 exp-str 1)))) 633 math-exp-str 1))))
620 (string-match "\\$+" exp-str exp-pos) 634 (string-match "\\$+" math-exp-str math-exp-pos)
621 (setq exp-data (- (match-end 0) (match-beginning 0)))) 635 (setq math-expr-data (- (match-end 0) (match-beginning 0))))
622 (setq exp-token 'dollar 636 (setq math-exp-token 'dollar
623 exp-pos (match-end 0)))) 637 math-exp-pos (match-end 0))))
624 ((eq ch ?\#) 638 ((eq ch ?\#)
625 (if (eq (string-match "#\\([1-9][0-9]*\\)" exp-str exp-pos) 639 (if (eq (string-match "#\\([1-9][0-9]*\\)" math-exp-str math-exp-pos)
626 exp-pos) 640 math-exp-pos)
627 (setq exp-data (string-to-int 641 (setq math-expr-data (string-to-int
628 (math-match-substring exp-str 1)) 642 (math-match-substring math-exp-str 1))
629 exp-pos (match-end 0)) 643 math-exp-pos (match-end 0))
630 (setq exp-data 1 644 (setq math-expr-data 1
631 exp-pos (1+ exp-pos))) 645 math-exp-pos (1+ math-exp-pos)))
632 (setq exp-token 'hash)) 646 (setq math-exp-token 'hash))
633 ((eq (string-match "~=\\|<=\\|>=\\|<>\\|/=\\|\\+/-\\|\\\\dots\\|\\\\ldots\\|\\*\\*\\|<<\\|>>\\|==\\|!=\\|&&&\\||||\\|!!!\\|&&\\|||\\|!!\\|:=\\|::\\|=>" 647 ((eq (string-match "~=\\|<=\\|>=\\|<>\\|/=\\|\\+/-\\|\\\\dots\\|\\\\ldots\\|\\*\\*\\|<<\\|>>\\|==\\|!=\\|&&&\\||||\\|!!!\\|&&\\|||\\|!!\\|:=\\|::\\|=>"
634 exp-str exp-pos) 648 math-exp-str math-exp-pos)
635 exp-pos) 649 math-exp-pos)
636 (setq exp-token 'punc 650 (setq math-exp-token 'punc
637 exp-data (math-match-substring exp-str 0) 651 math-expr-data (math-match-substring math-exp-str 0)
638 exp-pos (match-end 0))) 652 math-exp-pos (match-end 0)))
639 ((and (eq ch ?\") 653 ((and (eq ch ?\")
640 (string-match "\\(\"\\([^\"\\]\\|\\\\.\\)*\\)\\(\"\\|\\'\\)" exp-str exp-pos)) 654 (string-match "\\(\"\\([^\"\\]\\|\\\\.\\)*\\)\\(\"\\|\\'\\)"
655 math-exp-str math-exp-pos))
641 (if (eq calc-language 'eqn) 656 (if (eq calc-language 'eqn)
642 (progn 657 (progn
643 (setq exp-str (copy-sequence exp-str)) 658 (setq math-exp-str (copy-sequence math-exp-str))
644 (aset exp-str (match-beginning 1) ?\{) 659 (aset math-exp-str (match-beginning 1) ?\{)
645 (if (< (match-end 1) (length exp-str)) 660 (if (< (match-end 1) (length math-exp-str))
646 (aset exp-str (match-end 1) ?\})) 661 (aset math-exp-str (match-end 1) ?\}))
647 (math-read-token)) 662 (math-read-token))
648 (setq exp-token 'string 663 (setq math-exp-token 'string
649 exp-data (math-match-substring exp-str 1) 664 math-expr-data (math-match-substring math-exp-str 1)
650 exp-pos (match-end 0)))) 665 math-exp-pos (match-end 0))))
651 ((and (= ch ?\\) (eq calc-language 'tex) 666 ((and (= ch ?\\) (eq calc-language 'tex)
652 (< exp-pos (1- (length exp-str)))) 667 (< math-exp-pos (1- (length math-exp-str))))
653 (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}" exp-str exp-pos) 668 (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}"
654 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)" exp-str exp-pos)) 669 math-exp-str math-exp-pos)
655 (setq exp-token 'symbol 670 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)"
656 exp-pos (match-end 0) 671 math-exp-str math-exp-pos))
657 exp-data (math-restore-dashes 672 (setq math-exp-token 'symbol
658 (math-match-substring exp-str 1))) 673 math-exp-pos (match-end 0)
659 (let ((code (assoc exp-data math-tex-ignore-words))) 674 math-expr-data (math-restore-dashes
675 (math-match-substring math-exp-str 1)))
676 (let ((code (assoc math-expr-data math-tex-ignore-words)))
660 (cond ((null code)) 677 (cond ((null code))
661 ((null (cdr code)) 678 ((null (cdr code))
662 (math-read-token)) 679 (math-read-token))
663 ((eq (nth 1 code) 'punc) 680 ((eq (nth 1 code) 'punc)
664 (setq exp-token 'punc 681 (setq math-exp-token 'punc
665 exp-data (nth 2 code))) 682 math-expr-data (nth 2 code)))
666 ((and (eq (nth 1 code) 'mat) 683 ((and (eq (nth 1 code) 'mat)
667 (string-match " *{" exp-str exp-pos)) 684 (string-match " *{" math-exp-str math-exp-pos))
668 (setq exp-pos (match-end 0) 685 (setq math-exp-pos (match-end 0)
669 exp-token 'punc 686 math-exp-token 'punc
670 exp-data "[") 687 math-expr-data "[")
671 (let ((right (string-match "}" exp-str exp-pos))) 688 (let ((right (string-match "}" math-exp-str math-exp-pos)))
672 (and right 689 (and right
673 (setq exp-str (copy-sequence exp-str)) 690 (setq math-exp-str (copy-sequence math-exp-str))
674 (aset exp-str right ?\]))))))) 691 (aset math-exp-str right ?\])))))))
675 ((and (= ch ?\.) (eq calc-language 'fortran) 692 ((and (= ch ?\.) (eq calc-language 'fortran)
676 (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\." 693 (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\."
677 exp-str exp-pos) exp-pos)) 694 math-exp-str math-exp-pos) math-exp-pos))
678 (setq exp-token 'punc 695 (setq math-exp-token 'punc
679 exp-data (upcase (math-match-substring exp-str 0)) 696 math-expr-data (upcase (math-match-substring math-exp-str 0))
680 exp-pos (match-end 0))) 697 math-exp-pos (match-end 0)))
681 ((and (eq calc-language 'math) 698 ((and (eq calc-language 'math)
682 (eq (string-match "\\[\\[\\|->\\|:>" exp-str exp-pos) 699 (eq (string-match "\\[\\[\\|->\\|:>" math-exp-str math-exp-pos)
683 exp-pos)) 700 math-exp-pos))
684 (setq exp-token 'punc 701 (setq math-exp-token 'punc
685 exp-data (math-match-substring exp-str 0) 702 math-expr-data (math-match-substring math-exp-str 0)
686 exp-pos (match-end 0))) 703 math-exp-pos (match-end 0)))
687 ((and (eq calc-language 'eqn) 704 ((and (eq calc-language 'eqn)
688 (eq (string-match "->\\|<-\\|+-\\|\\\\dots\\|~\\|\\^" 705 (eq (string-match "->\\|<-\\|+-\\|\\\\dots\\|~\\|\\^"
689 exp-str exp-pos) 706 math-exp-str math-exp-pos)
690 exp-pos)) 707 math-exp-pos))
691 (setq exp-token 'punc 708 (setq math-exp-token 'punc
692 exp-data (math-match-substring exp-str 0) 709 math-expr-data (math-match-substring math-exp-str 0)
693 exp-pos (match-end 0)) 710 math-exp-pos (match-end 0))
694 (and (eq (string-match "\\\\dots\\." exp-str exp-pos) exp-pos) 711 (and (eq (string-match "\\\\dots\\." math-exp-str math-exp-pos)
695 (setq exp-pos (match-end 0))) 712 math-exp-pos)
696 (if (memq (aref exp-data 0) '(?~ ?^)) 713 (setq math-exp-pos (match-end 0)))
714 (if (memq (aref math-expr-data 0) '(?~ ?^))
697 (math-read-token))) 715 (math-read-token)))
698 ((eq (string-match "%%.*$" exp-str exp-pos) exp-pos) 716 ((eq (string-match "%%.*$" math-exp-str math-exp-pos) math-exp-pos)
699 (setq exp-pos (match-end 0)) 717 (setq math-exp-pos (match-end 0))
700 (math-read-token)) 718 (math-read-token))
701 (t 719 (t
702 (if (and (eq ch ?\{) (memq calc-language '(tex eqn))) 720 (if (and (eq ch ?\{) (memq calc-language '(tex eqn)))
@@ -705,9 +723,9 @@
705 (setq ch ?\))) 723 (setq ch ?\)))
706 (if (and (eq ch ?\&) (eq calc-language 'tex)) 724 (if (and (eq ch ?\&) (eq calc-language 'tex))
707 (setq ch ?\,)) 725 (setq ch ?\,))
708 (setq exp-token 'punc 726 (setq math-exp-token 'punc
709 exp-data (char-to-string ch) 727 math-expr-data (char-to-string ch)
710 exp-pos (1+ exp-pos))))))) 728 math-exp-pos (1+ math-exp-pos)))))))
711 729
712 730
713(defun math-read-expr-level (exp-prec &optional exp-term) 731(defun math-read-expr-level (exp-prec &optional exp-term)
@@ -716,10 +734,10 @@
716 (setq op (calc-check-user-syntax x exp-prec)) 734 (setq op (calc-check-user-syntax x exp-prec))
717 (setq x op 735 (setq x op
718 op '("2x" ident 999999 -1))) 736 op '("2x" ident 999999 -1)))
719 (and (setq op (assoc exp-data math-expr-opers)) 737 (and (setq op (assoc math-expr-data math-expr-opers))
720 (/= (nth 2 op) -1) 738 (/= (nth 2 op) -1)
721 (or (and (setq op2 (assoc 739 (or (and (setq op2 (assoc
722 exp-data 740 math-expr-data
723 (cdr (memq op math-expr-opers)))) 741 (cdr (memq op math-expr-opers))))
724 (eq (= (nth 3 op) -1) 742 (eq (= (nth 3 op) -1)
725 (/= (nth 3 op2) -1)) 743 (/= (nth 3 op2) -1))
@@ -728,27 +746,27 @@
728 (setq op op2)) 746 (setq op op2))
729 t)) 747 t))
730 (and (or (eq (nth 2 op) -1) 748 (and (or (eq (nth 2 op) -1)
731 (memq exp-token '(symbol number dollar hash)) 749 (memq math-exp-token '(symbol number dollar hash))
732 (equal exp-data "(") 750 (equal math-expr-data "(")
733 (and (equal exp-data "[") 751 (and (equal math-expr-data "[")
734 (not (eq calc-language 'math)) 752 (not (eq calc-language 'math))
735 (not (and exp-keep-spaces 753 (not (and math-exp-keep-spaces
736 (eq (car-safe x) 'vec))))) 754 (eq (car-safe x) 'vec)))))
737 (or (not (setq op (assoc exp-data math-expr-opers))) 755 (or (not (setq op (assoc math-expr-data math-expr-opers)))
738 (/= (nth 2 op) -1)) 756 (/= (nth 2 op) -1))
739 (or (not calc-user-parse-table) 757 (or (not calc-user-parse-table)
740 (not (eq exp-token 'symbol)) 758 (not (eq math-exp-token 'symbol))
741 (let ((p calc-user-parse-table)) 759 (let ((p calc-user-parse-table))
742 (while (and p 760 (while (and p
743 (or (not (integerp 761 (or (not (integerp
744 (car (car (car p))))) 762 (car (car (car p)))))
745 (not (equal 763 (not (equal
746 (nth 1 (car (car p))) 764 (nth 1 (car (car p)))
747 exp-data)))) 765 math-expr-data))))
748 (setq p (cdr p))) 766 (setq p (cdr p)))
749 (not p))) 767 (not p)))
750 (setq op (assoc "2x" math-expr-opers)))) 768 (setq op (assoc "2x" math-expr-opers))))
751 (not (and exp-term (equal exp-data exp-term))) 769 (not (and exp-term (equal math-expr-data exp-term)))
752 (>= (nth 2 op) exp-prec)) 770 (>= (nth 2 op) exp-prec))
753 (if (not (equal (car op) "2x")) 771 (if (not (equal (car op) "2x"))
754 (math-read-token)) 772 (math-read-token))
@@ -787,13 +805,13 @@
787 (if x 805 (if x
788 (and (integerp (car rule)) 806 (and (integerp (car rule))
789 (>= (car rule) prec) 807 (>= (car rule) prec)
790 (equal exp-data 808 (equal math-expr-data
791 (car (setq rule (cdr rule))))) 809 (car (setq rule (cdr rule)))))
792 (equal exp-data (car rule))))) 810 (equal math-expr-data (car rule)))))
793 (let ((save-exp-pos exp-pos) 811 (let ((save-exp-pos math-exp-pos)
794 (save-exp-old-pos exp-old-pos) 812 (save-exp-old-pos math-exp-old-pos)
795 (save-exp-token exp-token) 813 (save-exp-token math-exp-token)
796 (save-exp-data exp-data)) 814 (save-exp-data math-expr-data))
797 (or (not (listp 815 (or (not (listp
798 (setq matches (calc-match-user-syntax rule)))) 816 (setq matches (calc-match-user-syntax rule))))
799 (let ((args (progn 817 (let ((args (progn
@@ -856,22 +874,23 @@
856 (if match 874 (if match
857 (not (setq match (math-multi-subst 875 (not (setq match (math-multi-subst
858 match args matches))) 876 match args matches)))
859 (setq exp-old-pos save-exp-old-pos 877 (setq math-exp-old-pos save-exp-old-pos
860 exp-token save-exp-token 878 math-exp-token save-exp-token
861 exp-data save-exp-data 879 math-expr-data save-exp-data
862 exp-pos save-exp-pos))))))) 880 math-exp-pos save-exp-pos)))))))
863 (setq p (cdr p))) 881 (setq p (cdr p)))
864 (and p match))) 882 (and p match)))
865 883
866(defun calc-match-user-syntax (p &optional term) 884(defun calc-match-user-syntax (p &optional term)
867 (let ((matches nil) 885 (let ((matches nil)
868 (save-exp-pos exp-pos) 886 (save-exp-pos math-exp-pos)
869 (save-exp-old-pos exp-old-pos) 887 (save-exp-old-pos math-exp-old-pos)
870 (save-exp-token exp-token) 888 (save-exp-token math-exp-token)
871 (save-exp-data exp-data)) 889 (save-exp-data math-expr-data)
890 m)
872 (while (and p 891 (while (and p
873 (cond ((stringp (car p)) 892 (cond ((stringp (car p))
874 (and (equal exp-data (car p)) 893 (and (equal math-expr-data (car p))
875 (progn 894 (progn
876 (math-read-token) 895 (math-read-token)
877 t))) 896 t)))
@@ -895,7 +914,7 @@
895 (cons 'vec (and (listp m) m)))))) 914 (cons 'vec (and (listp m) m))))))
896 (or (listp m) (not (nth 2 (car p))) 915 (or (listp m) (not (nth 2 (car p)))
897 (not (eq (aref (car (nth 2 (car p))) 0) ?\$)) 916 (not (eq (aref (car (nth 2 (car p))) 0) ?\$))
898 (eq exp-token 'end))) 917 (eq math-exp-token 'end)))
899 (t 918 (t
900 (setq m (calc-match-user-syntax (nth 1 (car p)) 919 (setq m (calc-match-user-syntax (nth 1 (car p))
901 (car (nth 2 (car p))))) 920 (car (nth 2 (car p)))))
@@ -903,22 +922,22 @@
903 (let ((vec (cons 'vec m)) 922 (let ((vec (cons 'vec m))
904 opos mm) 923 opos mm)
905 (while (and (listp 924 (while (and (listp
906 (setq opos exp-pos 925 (setq opos math-exp-pos
907 mm (calc-match-user-syntax 926 mm (calc-match-user-syntax
908 (or (nth 2 (car p)) 927 (or (nth 2 (car p))
909 (nth 1 (car p))) 928 (nth 1 (car p)))
910 (car (nth 2 (car p)))))) 929 (car (nth 2 (car p))))))
911 (> exp-pos opos)) 930 (> math-exp-pos opos))
912 (setq vec (nconc vec mm))) 931 (setq vec (nconc vec mm)))
913 (setq matches (nconc matches (list vec)))) 932 (setq matches (nconc matches (list vec))))
914 (and (eq (car (car p)) '*) 933 (and (eq (car (car p)) '*)
915 (setq matches (nconc matches (list '(vec))))))))) 934 (setq matches (nconc matches (list '(vec)))))))))
916 (setq p (cdr p))) 935 (setq p (cdr p)))
917 (if p 936 (if p
918 (setq exp-pos save-exp-pos 937 (setq math-exp-pos save-exp-pos
919 exp-old-pos save-exp-old-pos 938 math-exp-old-pos save-exp-old-pos
920 exp-token save-exp-token 939 math-exp-token save-exp-token
921 exp-data save-exp-data 940 math-expr-data save-exp-data
922 matches "Failed")) 941 matches "Failed"))
923 matches)) 942 matches))
924 943
@@ -940,28 +959,28 @@
940 959
941(defun math-read-if (cond op) 960(defun math-read-if (cond op)
942 (let ((then (math-read-expr-level 0))) 961 (let ((then (math-read-expr-level 0)))
943 (or (equal exp-data ":") 962 (or (equal math-expr-data ":")
944 (throw 'syntax "Expected ':'")) 963 (throw 'syntax "Expected ':'"))
945 (math-read-token) 964 (math-read-token)
946 (list 'calcFunc-if cond then (math-read-expr-level (nth 3 op))))) 965 (list 'calcFunc-if cond then (math-read-expr-level (nth 3 op)))))
947 966
948(defun math-factor-after () 967(defun math-factor-after ()
949 (let ((exp-pos exp-pos) 968 (let ((math-exp-pos math-exp-pos)
950 exp-old-pos exp-token exp-data) 969 math-exp-old-pos math-exp-token math-expr-data)
951 (math-read-token) 970 (math-read-token)
952 (or (memq exp-token '(number symbol dollar hash string)) 971 (or (memq math-exp-token '(number symbol dollar hash string))
953 (and (assoc exp-data '(("-") ("+") ("!") ("|") ("/"))) 972 (and (assoc math-expr-data '(("-") ("+") ("!") ("|") ("/")))
954 (assoc (concat "u" exp-data) math-expr-opers)) 973 (assoc (concat "u" math-expr-data) math-expr-opers))
955 (eq (nth 2 (assoc exp-data math-expr-opers)) -1) 974 (eq (nth 2 (assoc math-expr-data math-expr-opers)) -1)
956 (assoc exp-data '(("(") ("[") ("{")))))) 975 (assoc math-expr-data '(("(") ("[") ("{"))))))
957 976
958(defun math-read-factor () 977(defun math-read-factor ()
959 (let (op) 978 (let (op)
960 (cond ((eq exp-token 'number) 979 (cond ((eq math-exp-token 'number)
961 (let ((num (math-read-number exp-data))) 980 (let ((num (math-read-number math-expr-data)))
962 (if (not num) 981 (if (not num)
963 (progn 982 (progn
964 (setq exp-old-pos exp-pos) 983 (setq math-exp-old-pos math-exp-pos)
965 (throw 'syntax "Bad format"))) 984 (throw 'syntax "Bad format")))
966 (math-read-token) 985 (math-read-token)
967 (if (and math-read-expr-quotes 986 (if (and math-read-expr-quotes
@@ -971,14 +990,14 @@
971 ((and calc-user-parse-table 990 ((and calc-user-parse-table
972 (setq op (calc-check-user-syntax))) 991 (setq op (calc-check-user-syntax)))
973 op) 992 op)
974 ((or (equal exp-data "-") 993 ((or (equal math-expr-data "-")
975 (equal exp-data "+") 994 (equal math-expr-data "+")
976 (equal exp-data "!") 995 (equal math-expr-data "!")
977 (equal exp-data "|") 996 (equal math-expr-data "|")
978 (equal exp-data "/")) 997 (equal math-expr-data "/"))
979 (setq exp-data (concat "u" exp-data)) 998 (setq math-expr-data (concat "u" math-expr-data))
980 (math-read-factor)) 999 (math-read-factor))
981 ((and (setq op (assoc exp-data math-expr-opers)) 1000 ((and (setq op (assoc math-expr-data math-expr-opers))
982 (eq (nth 2 op) -1)) 1001 (eq (nth 2 op) -1))
983 (if (consp (nth 1 op)) 1002 (if (consp (nth 1 op))
984 (funcall (car (nth 1 op)) op) 1003 (funcall (car (nth 1 op)) op)
@@ -990,20 +1009,20 @@
990 (equal (car op) "u-")) 1009 (equal (car op) "u-"))
991 (math-neg val)) 1010 (math-neg val))
992 (t (list (nth 1 op) val)))))) 1011 (t (list (nth 1 op) val))))))
993 ((eq exp-token 'symbol) 1012 ((eq math-exp-token 'symbol)
994 (let ((sym (intern exp-data))) 1013 (let ((sym (intern math-expr-data)))
995 (math-read-token) 1014 (math-read-token)
996 (if (equal exp-data calc-function-open) 1015 (if (equal math-expr-data calc-function-open)
997 (let ((f (assq sym math-expr-function-mapping))) 1016 (let ((f (assq sym math-expr-function-mapping)))
998 (math-read-token) 1017 (math-read-token)
999 (if (consp (cdr f)) 1018 (if (consp (cdr f))
1000 (funcall (car (cdr f)) f sym) 1019 (funcall (car (cdr f)) f sym)
1001 (let ((args (if (or (equal exp-data calc-function-close) 1020 (let ((args (if (or (equal math-expr-data calc-function-close)
1002 (eq exp-token 'end)) 1021 (eq math-exp-token 'end))
1003 nil 1022 nil
1004 (math-read-expr-list)))) 1023 (math-read-expr-list))))
1005 (if (not (or (equal exp-data calc-function-close) 1024 (if (not (or (equal math-expr-data calc-function-close)
1006 (eq exp-token 'end))) 1025 (eq math-exp-token 'end)))
1007 (throw 'syntax "Expected `)'")) 1026 (throw 'syntax "Expected `)'"))
1008 (math-read-token) 1027 (math-read-token)
1009 (if (and (eq calc-language 'fortran) args 1028 (if (and (eq calc-language 'fortran) args
@@ -1045,44 +1064,44 @@
1045 4)) 1064 4))
1046 (cdr v)))))) 1065 (cdr v))))))
1047 (while (and (memq calc-language '(c pascal maple)) 1066 (while (and (memq calc-language '(c pascal maple))
1048 (equal exp-data "[")) 1067 (equal math-expr-data "["))
1049 (math-read-token) 1068 (math-read-token)
1050 (setq val (append (list 'calcFunc-subscr val) 1069 (setq val (append (list 'calcFunc-subscr val)
1051 (math-read-expr-list))) 1070 (math-read-expr-list)))
1052 (if (equal exp-data "]") 1071 (if (equal math-expr-data "]")
1053 (math-read-token) 1072 (math-read-token)
1054 (throw 'syntax "Expected ']'"))) 1073 (throw 'syntax "Expected ']'")))
1055 val))))) 1074 val)))))
1056 ((eq exp-token 'dollar) 1075 ((eq math-exp-token 'dollar)
1057 (let ((abs (if (> exp-data 0) exp-data (- exp-data)))) 1076 (let ((abs (if (> math-expr-data 0) math-expr-data (- math-expr-data))))
1058 (if (>= (length calc-dollar-values) abs) 1077 (if (>= (length calc-dollar-values) abs)
1059 (let ((num exp-data)) 1078 (let ((num math-expr-data))
1060 (math-read-token) 1079 (math-read-token)
1061 (setq calc-dollar-used (max calc-dollar-used num)) 1080 (setq calc-dollar-used (max calc-dollar-used num))
1062 (math-check-complete (nth (1- abs) calc-dollar-values))) 1081 (math-check-complete (nth (1- abs) calc-dollar-values)))
1063 (throw 'syntax (if calc-dollar-values 1082 (throw 'syntax (if calc-dollar-values
1064 "Too many $'s" 1083 "Too many $'s"
1065 "$'s not allowed in this context"))))) 1084 "$'s not allowed in this context")))))
1066 ((eq exp-token 'hash) 1085 ((eq math-exp-token 'hash)
1067 (or calc-hashes-used 1086 (or calc-hashes-used
1068 (throw 'syntax "#'s not allowed in this context")) 1087 (throw 'syntax "#'s not allowed in this context"))
1069 (calc-extensions) 1088 (calc-extensions)
1070 (if (<= exp-data (length calc-arg-values)) 1089 (if (<= math-expr-data (length calc-arg-values))
1071 (let ((num exp-data)) 1090 (let ((num math-expr-data))
1072 (math-read-token) 1091 (math-read-token)
1073 (setq calc-hashes-used (max calc-hashes-used num)) 1092 (setq calc-hashes-used (max calc-hashes-used num))
1074 (nth (1- num) calc-arg-values)) 1093 (nth (1- num) calc-arg-values))
1075 (throw 'syntax "Too many # arguments"))) 1094 (throw 'syntax "Too many # arguments")))
1076 ((equal exp-data "(") 1095 ((equal math-expr-data "(")
1077 (let* ((exp (let ((exp-keep-spaces nil)) 1096 (let* ((exp (let ((math-exp-keep-spaces nil))
1078 (math-read-token) 1097 (math-read-token)
1079 (if (or (equal exp-data "\\dots") 1098 (if (or (equal math-expr-data "\\dots")
1080 (equal exp-data "\\ldots")) 1099 (equal math-expr-data "\\ldots"))
1081 '(neg (var inf var-inf)) 1100 '(neg (var inf var-inf))
1082 (math-read-expr-level 0))))) 1101 (math-read-expr-level 0)))))
1083 (let ((exp-keep-spaces nil)) 1102 (let ((math-exp-keep-spaces nil))
1084 (cond 1103 (cond
1085 ((equal exp-data ",") 1104 ((equal math-expr-data ",")
1086 (progn 1105 (progn
1087 (math-read-token) 1106 (math-read-token)
1088 (let ((exp2 (math-read-expr-level 0))) 1107 (let ((exp2 (math-read-expr-level 0)))
@@ -1090,7 +1109,7 @@
1090 (if (and exp2 (Math-realp exp) (Math-realp exp2)) 1109 (if (and exp2 (Math-realp exp) (Math-realp exp2))
1091 (math-normalize (list 'cplx exp exp2)) 1110 (math-normalize (list 'cplx exp exp2))
1092 (list '+ exp (list '* exp2 '(var i var-i)))))))) 1111 (list '+ exp (list '* exp2 '(var i var-i))))))))
1093 ((equal exp-data ";") 1112 ((equal math-expr-data ";")
1094 (progn 1113 (progn
1095 (math-read-token) 1114 (math-read-token)
1096 (let ((exp2 (math-read-expr-level 0))) 1115 (let ((exp2 (math-read-expr-level 0)))
@@ -1103,36 +1122,36 @@
1103 (list '* 1122 (list '*
1104 (math-to-radians-2 exp2) 1123 (math-to-radians-2 exp2)
1105 '(var i var-i))))))))) 1124 '(var i var-i)))))))))
1106 ((or (equal exp-data "\\dots") 1125 ((or (equal math-expr-data "\\dots")
1107 (equal exp-data "\\ldots")) 1126 (equal math-expr-data "\\ldots"))
1108 (progn 1127 (progn
1109 (math-read-token) 1128 (math-read-token)
1110 (let ((exp2 (if (or (equal exp-data ")") 1129 (let ((exp2 (if (or (equal math-expr-data ")")
1111 (equal exp-data "]") 1130 (equal math-expr-data "]")
1112 (eq exp-token 'end)) 1131 (eq math-exp-token 'end))
1113 '(var inf var-inf) 1132 '(var inf var-inf)
1114 (math-read-expr-level 0)))) 1133 (math-read-expr-level 0))))
1115 (setq exp 1134 (setq exp
1116 (list 'intv 1135 (list 'intv
1117 (if (equal exp-data ")") 0 1) 1136 (if (equal math-expr-data ")") 0 1)
1118 exp 1137 exp
1119 exp2))))))) 1138 exp2)))))))
1120 (if (not (or (equal exp-data ")") 1139 (if (not (or (equal math-expr-data ")")
1121 (and (equal exp-data "]") (eq (car-safe exp) 'intv)) 1140 (and (equal math-expr-data "]") (eq (car-safe exp) 'intv))
1122 (eq exp-token 'end))) 1141 (eq math-exp-token 'end)))
1123 (throw 'syntax "Expected `)'")) 1142 (throw 'syntax "Expected `)'"))
1124 (math-read-token) 1143 (math-read-token)
1125 exp)) 1144 exp))
1126 ((eq exp-token 'string) 1145 ((eq math-exp-token 'string)
1127 (calc-extensions) 1146 (calc-extensions)
1128 (math-read-string)) 1147 (math-read-string))
1129 ((equal exp-data "[") 1148 ((equal math-expr-data "[")
1130 (calc-extensions) 1149 (calc-extensions)
1131 (math-read-brackets t "]")) 1150 (math-read-brackets t "]"))
1132 ((equal exp-data "{") 1151 ((equal math-expr-data "{")
1133 (calc-extensions) 1152 (calc-extensions)
1134 (math-read-brackets nil "}")) 1153 (math-read-brackets nil "}"))
1135 ((equal exp-data "<") 1154 ((equal math-expr-data "<")
1136 (calc-extensions) 1155 (calc-extensions)
1137 (math-read-angle-brackets)) 1156 (math-read-angle-brackets))
1138 (t (throw 'syntax "Expected a number"))))) 1157 (t (throw 'syntax "Expected a number")))))
diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el
index c7ecbecc80b..8b0dffe3f15 100644
--- a/lisp/calc/calc-comb.el
+++ b/lisp/calc/calc-comb.el
@@ -82,6 +82,11 @@
82 4877 4889 4903 4909 4919 4931 4933 4937 4943 4951 4957 4967 4969 4973 82 4877 4889 4903 4909 4919 4931 4933 4937 4943 4951 4957 4967 4969 4973
83 4987 4993 4999 5003]) 83 4987 4993 4999 5003])
84 84
85;; The variable math-prime-factors-finished is set by calcFunc-prfac to
86;; indicate whether factoring is complete, and used by calcFunc-factors,
87;; calcFunc-totient and calcFunc-moebius.
88(defvar math-prime-factors-finished)
89
85;;; Combinatorics 90;;; Combinatorics
86 91
87(defun calc-gcd (arg) 92(defun calc-gcd (arg)
@@ -195,6 +200,8 @@
195 (res (math-prime-test n iters))) 200 (res (math-prime-test n iters)))
196 (calc-report-prime-test res)))) 201 (calc-report-prime-test res))))
197 202
203(defvar calc-verbose-nextprime nil)
204
198(defun calc-next-prime (iters) 205(defun calc-next-prime (iters)
199 (interactive "p") 206 (interactive "p")
200 (calc-slow-wrapper 207 (calc-slow-wrapper
@@ -386,7 +393,7 @@
386 (if (math-evenp temp) 393 (if (math-evenp temp)
387 even 394 even
388 (math-div (calcFunc-fact n) even)))) 395 (math-div (calcFunc-fact n) even))))
389 (list 'calcFunc-dfact max)))) 396 (list 'calcFunc-dfact n))))
390 ((equal n '(var inf var-inf)) n) 397 ((equal n '(var inf var-inf)) n)
391 (t (calc-record-why 'natnump n) 398 (t (calc-record-why 'natnump n)
392 (list 'calcFunc-dfact n)))) 399 (list 'calcFunc-dfact n))))
@@ -484,6 +491,12 @@
484 (math-stirling-number n m 0)) 491 (math-stirling-number n m 0))
485 492
486(defvar math-stirling-cache (vector [[1]] [[1]])) 493(defvar math-stirling-cache (vector [[1]] [[1]]))
494
495;; The variable math-stirling-local-cache is local to
496;; math-stirling-number, but is used by math-stirling-1
497;; and math-stirling-2, which are called by math-stirling-number.
498(defvar math-stirling-local-cache)
499
487(defun math-stirling-number (n m k) 500(defun math-stirling-number (n m k)
488 (or (math-num-natnump n) (math-reject-arg n 'natnump)) 501 (or (math-num-natnump n) (math-reject-arg n 'natnump))
489 (or (math-num-natnump m) (math-reject-arg m 'natnump)) 502 (or (math-num-natnump m) (math-reject-arg m 'natnump))
@@ -493,14 +506,16 @@
493 (or (integerp m) (math-reject-arg m 'fixnump)) 506 (or (integerp m) (math-reject-arg m 'fixnump))
494 (if (< n m) 507 (if (< n m)
495 0 508 0
496 (let ((cache (aref math-stirling-cache k))) 509 (let ((math-stirling-local-cache (aref math-stirling-cache k)))
497 (while (<= (length cache) n) 510 (while (<= (length math-stirling-local-cache) n)
498 (let ((i (1- (length cache))) 511 (let ((i (1- (length math-stirling-local-cache)))
499 row) 512 row)
500 (setq cache (vconcat cache (make-vector (length cache) nil))) 513 (setq math-stirling-local-cache
501 (aset math-stirling-cache k cache) 514 (vconcat math-stirling-local-cache
502 (while (< (setq i (1+ i)) (length cache)) 515 (make-vector (length math-stirling-local-cache) nil)))
503 (aset cache i (setq row (make-vector (1+ i) nil))) 516 (aset math-stirling-cache k math-stirling-local-cache)
517 (while (< (setq i (1+ i)) (length math-stirling-local-cache))
518 (aset math-stirling-local-cache i (setq row (make-vector (1+ i) nil)))
504 (aset row 0 0) 519 (aset row 0 0)
505 (aset row i 1)))) 520 (aset row i 1))))
506 (if (= k 1) 521 (if (= k 1)
@@ -508,14 +523,14 @@
508 (math-stirling-2 n m))))) 523 (math-stirling-2 n m)))))
509 524
510(defun math-stirling-1 (n m) 525(defun math-stirling-1 (n m)
511 (or (aref (aref cache n) m) 526 (or (aref (aref math-stirling-local-cache n) m)
512 (aset (aref cache n) m 527 (aset (aref math-stirling-local-cache n) m
513 (math-add (math-stirling-1 (1- n) (1- m)) 528 (math-add (math-stirling-1 (1- n) (1- m))
514 (math-mul (- 1 n) (math-stirling-1 (1- n) m)))))) 529 (math-mul (- 1 n) (math-stirling-1 (1- n) m))))))
515 530
516(defun math-stirling-2 (n m) 531(defun math-stirling-2 (n m)
517 (or (aref (aref cache n) m) 532 (or (aref (aref math-stirling-local-cache n) m)
518 (aset (aref cache n) m 533 (aset (aref math-stirling-local-cache n) m
519 (math-add (math-stirling-2 (1- n) (1- m)) 534 (math-add (math-stirling-2 (1- n) (1- m))
520 (math-mul m (math-stirling-2 (1- n) m)))))) 535 (math-mul m (math-stirling-2 (1- n) m))))))
521 536
@@ -527,8 +542,13 @@
527 542
528;;; Produce a random 10-bit integer, with (random) if no seed provided, 543;;; Produce a random 10-bit integer, with (random) if no seed provided,
529;;; or else with Numerical Recipes algorithm ran3 / Knuth 3.2.2-A. 544;;; or else with Numerical Recipes algorithm ran3 / Knuth 3.2.2-A.
545
546(defvar var-RandSeed nil)
547(defvar math-random-cache nil)
548(defvar math-gaussian-cache nil)
549
530(defun math-init-random-base () 550(defun math-init-random-base ()
531 (if (and (boundp 'var-RandSeed) var-RandSeed) 551 (if var-RandSeed
532 (if (eq (car-safe var-RandSeed) 'vec) 552 (if (eq (car-safe var-RandSeed) 'vec)
533 nil 553 nil
534 (if (Math-integerp var-RandSeed) 554 (if (Math-integerp var-RandSeed)
@@ -555,13 +575,13 @@
555 (random t) 575 (random t)
556 (setq var-RandSeed nil 576 (setq var-RandSeed nil
557 math-random-cache nil 577 math-random-cache nil
558 i 0
559 math-random-shift -4) ; assume RAND_MAX >= 16383 578 math-random-shift -4) ; assume RAND_MAX >= 16383
560 ;; This exercises the random number generator and also helps 579 ;; This exercises the random number generator and also helps
561 ;; deduce a better value for RAND_MAX. 580 ;; deduce a better value for RAND_MAX.
562 (while (< (setq i (1+ i)) 30) 581 (let ((i 0))
563 (if (> (lsh (math-abs (random)) math-random-shift) 4095) 582 (while (< (setq i (1+ i)) 30)
564 (setq math-random-shift (1- math-random-shift))))) 583 (if (> (lsh (math-abs (random)) math-random-shift) 4095)
584 (setq math-random-shift (1- math-random-shift))))))
565 (setq math-last-RandSeed var-RandSeed 585 (setq math-last-RandSeed var-RandSeed
566 math-gaussian-cache nil)) 586 math-gaussian-cache nil))
567 587
@@ -583,8 +603,8 @@
583;;; Avoid various pitfalls that may lurk in the built-in (random) function! 603;;; Avoid various pitfalls that may lurk in the built-in (random) function!
584;;; Shuffling algorithm from Numerical Recipes, section 7.1. 604;;; Shuffling algorithm from Numerical Recipes, section 7.1.
585(defun math-random-digit () 605(defun math-random-digit ()
586 (let (i) 606 (let (i math-random-last)
587 (or (and (boundp 'var-RandSeed) (eq var-RandSeed math-last-RandSeed)) 607 (or (eq var-RandSeed math-last-RandSeed)
588 (math-init-random-base)) 608 (math-init-random-base))
589 (or math-random-cache 609 (or math-random-cache
590 (progn 610 (progn
@@ -599,7 +619,6 @@
599 (aset math-random-cache i (math-random-base)) 619 (aset math-random-cache i (math-random-base))
600 (>= math-random-last 1000))) 620 (>= math-random-last 1000)))
601 math-random-last)) 621 math-random-last))
602(setq math-random-cache nil)
603 622
604;;; Produce an N-digit random integer. 623;;; Produce an N-digit random integer.
605(defun math-random-digits (n) 624(defun math-random-digits (n)
@@ -639,7 +658,6 @@
639 (setq math-gaussian-cache (cons calc-internal-prec 658 (setq math-gaussian-cache (cons calc-internal-prec
640 (math-mul v1 fac))) 659 (math-mul v1 fac)))
641 (math-mul v2 fac)))))) 660 (math-mul v2 fac))))))
642(setq math-gaussian-cache nil)
643 661
644;;; Produce a random integer or real 0 <= N < MAX. 662;;; Produce a random integer or real 0 <= N < MAX.
645(defun calcFunc-random (max) 663(defun calcFunc-random (max)
@@ -765,6 +783,12 @@
765;;; (nil unknown) if non-prime with no known factors, 783;;; (nil unknown) if non-prime with no known factors,
766;;; (t) if prime, 784;;; (t) if prime,
767;;; (maybe N P) if probably prime (after N iters with probability P%) 785;;; (maybe N P) if probably prime (after N iters with probability P%)
786(defvar math-prime-test-cache '(-1))
787
788(defvar math-prime-test-cache-k)
789(defvar math-prime-test-cache-q)
790(defvar math-prime-test-cache-nm1)
791
768(defun math-prime-test (n iters) 792(defun math-prime-test (n iters)
769 (if (and (Math-vectorp n) (cdr n)) 793 (if (and (Math-vectorp n) (cdr n))
770 (setq n (nth (1- (length n)) n))) 794 (setq n (nth (1- (length n)) n)))
@@ -849,7 +873,6 @@
849 (1- iters) 873 (1- iters)
850 0))) 874 0)))
851 res)) 875 res))
852(defvar math-prime-test-cache '(-1))
853 876
854(defun calcFunc-prime (n &optional iters) 877(defun calcFunc-prime (n &optional iters)
855 (or (math-num-integerp n) (math-reject-arg n 'integerp)) 878 (or (math-num-integerp n) (math-reject-arg n 'integerp))
@@ -965,7 +988,6 @@
965 (if (Math-realp n) 988 (if (Math-realp n)
966 (calcFunc-nextprime (math-trunc n) iters) 989 (calcFunc-nextprime (math-trunc n) iters)
967 (math-reject-arg n 'integerp)))) 990 (math-reject-arg n 'integerp))))
968(setq calc-verbose-nextprime nil)
969 991
970(defun calcFunc-prevprime (n &optional iters) 992(defun calcFunc-prevprime (n &optional iters)
971 (if (Math-integerp n) 993 (if (Math-integerp n)
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 4679cf8abaa..77057fd4a7a 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -108,6 +108,7 @@
108 (define-key calc-mode-map "\C-w" 'calc-kill-region) 108 (define-key calc-mode-map "\C-w" 'calc-kill-region)
109 (define-key calc-mode-map "\M-w" 'calc-copy-region-as-kill) 109 (define-key calc-mode-map "\M-w" 'calc-copy-region-as-kill)
110 (define-key calc-mode-map "\C-y" 'calc-yank) 110 (define-key calc-mode-map "\C-y" 'calc-yank)
111 (define-key calc-mode-map [mouse-2] 'calc-yank)
111 (define-key calc-mode-map "\C-_" 'calc-undo) 112 (define-key calc-mode-map "\C-_" 'calc-undo)
112 (define-key calc-mode-map "\C-xu" 'calc-undo) 113 (define-key calc-mode-map "\C-xu" 'calc-undo)
113 (define-key calc-mode-map "\M-\C-m" 'calc-last-args) 114 (define-key calc-mode-map "\M-\C-m" 'calc-last-args)
@@ -662,16 +663,6 @@
662 (define-key calc-alg-map "\e\C-m" 'calc-last-args-stub) 663 (define-key calc-alg-map "\e\C-m" 'calc-last-args-stub)
663 (define-key calc-alg-map "\e\177" 'calc-pop-above) 664 (define-key calc-alg-map "\e\177" 'calc-pop-above)
664 665
665 ;; The following is a relic for backward compatability only.
666 ;; The calc-define property list is now the recommended method.
667 (if (and (boundp 'calc-ext-defs)
668 calc-ext-defs)
669 (progn
670 (calc-need-macros)
671 (message "Evaluating calc-ext-defs...")
672 (eval (cons 'progn calc-ext-defs))
673 (setq calc-ext-defs nil)))
674
675;;;; (Autoloads here) 666;;;; (Autoloads here)
676 (mapcar (function (lambda (x) 667 (mapcar (function (lambda (x)
677 (mapcar (function (lambda (func) 668 (mapcar (function (lambda (func)
@@ -1769,10 +1760,13 @@ calc-kill calc-kill-region calc-yank))))
1769 (cdr res) 1760 (cdr res)
1770 res))) 1761 res)))
1771 1762
1763(defvar calc-z-prefix-buf nil)
1764(defvar calc-z-prefix-msgs nil)
1765
1772(defun calc-z-prefix-help () 1766(defun calc-z-prefix-help ()
1773 (interactive) 1767 (interactive)
1774 (let* ((msgs nil) 1768 (let* ((calc-z-prefix-msgs nil)
1775 (buf "") 1769 (calc-z-prefix-buf "")
1776 (kmap (sort (copy-sequence (calc-user-key-map)) 1770 (kmap (sort (copy-sequence (calc-user-key-map))
1777 (function (lambda (x y) (< (car x) (car y)))))) 1771 (function (lambda (x y) (< (car x) (car y))))))
1778 (flags (apply 'logior 1772 (flags (apply 'logior
@@ -1783,12 +1777,12 @@ calc-kill calc-kill-region calc-yank))))
1783 (if (= (logand flags 8) 0) 1777 (if (= (logand flags 8) 0)
1784 (calc-user-function-list kmap 7) 1778 (calc-user-function-list kmap 7)
1785 (calc-user-function-list kmap 1) 1779 (calc-user-function-list kmap 1)
1786 (setq msgs (cons buf msgs) 1780 (setq calc-z-prefix-msgs (cons calc-z-prefix-buf calc-z-prefix-msgs)
1787 buf "") 1781 calc-z-prefix-buf "")
1788 (calc-user-function-list kmap 6)) 1782 (calc-user-function-list kmap 6))
1789 (if (/= flags 0) 1783 (if (/= flags 0)
1790 (setq msgs (cons buf msgs))) 1784 (setq calc-z-prefix-msgs (cons calc-z-prefix-buf calc-z-prefix-msgs)))
1791 (calc-do-prefix-help (nreverse msgs) "user" ?z))) 1785 (calc-do-prefix-help (nreverse calc-z-prefix-msgs) "user" ?z)))
1792 1786
1793(defun calc-user-function-classify (key) 1787(defun calc-user-function-classify (key)
1794 (cond ((/= key (downcase key)) ; upper-case 1788 (cond ((/= key (downcase key)) ; upper-case
@@ -1822,14 +1816,15 @@ calc-kill calc-kill-region calc-yank))))
1822 (upcase key) 1816 (upcase key)
1823 (downcase name)))) 1817 (downcase name))))
1824 (char-to-string (upcase key))))) 1818 (char-to-string (upcase key)))))
1825 (if (= (length buf) 0) 1819 (if (= (length calc-z-prefix-buf) 0)
1826 (setq buf (concat (if (= flags 1) "SHIFT + " "") 1820 (setq calc-z-prefix-buf (concat (if (= flags 1) "SHIFT + " "")
1827 desc)) 1821 desc))
1828 (if (> (+ (length buf) (length desc)) 58) 1822 (if (> (+ (length calc-z-prefix-buf) (length desc)) 58)
1829 (setq msgs (cons buf msgs) 1823 (setq calc-z-prefix-msgs
1830 buf (concat (if (= flags 1) "SHIFT + " "") 1824 (cons calc-z-prefix-buf calc-z-prefix-msgs)
1825 calc-z-prefix-buf (concat (if (= flags 1) "SHIFT + " "")
1831 desc)) 1826 desc))
1832 (setq buf (concat buf ", " desc)))))) 1827 (setq calc-z-prefix-buf (concat calc-z-prefix-buf ", " desc))))))
1833 (calc-user-function-list (cdr map) flags)))) 1828 (calc-user-function-list (cdr map) flags))))
1834 1829
1835 1830
@@ -1854,10 +1849,10 @@ calc-kill calc-kill-region calc-yank))))
1854 (last-prec (intern (concat (symbol-name name) "-last-prec"))) 1849 (last-prec (intern (concat (symbol-name name) "-last-prec")))
1855 (last-val (intern (concat (symbol-name name) "-last")))) 1850 (last-val (intern (concat (symbol-name name) "-last"))))
1856 (list 'progn 1851 (list 'progn
1857 (list 'setq cache-prec (if init (math-numdigs (nth 1 init)) -100)) 1852 (list 'defvar cache-prec (if init (math-numdigs (nth 1 init)) -100))
1858 (list 'setq cache-val (list 'quote init)) 1853 (list 'defvar cache-val (list 'quote init))
1859 (list 'setq last-prec -100) 1854 (list 'defvar last-prec -100)
1860 (list 'setq last-val nil) 1855 (list 'defvar last-val nil)
1861 (list 'setq 'math-cache-list 1856 (list 'setq 'math-cache-list
1862 (list 'cons 1857 (list 'cons
1863 (list 'quote cache-prec) 1858 (list 'quote cache-prec)
@@ -2223,25 +2218,25 @@ calc-kill calc-kill-region calc-yank))))
2223 (math-normalize (car a)) 2218 (math-normalize (car a))
2224 (error "Can't use multi-valued function in an expression"))))) 2219 (error "Can't use multi-valued function in an expression")))))
2225 2220
2226(defun math-normalize-nonstandard () ; uses "a" 2221(defun math-normalize-nonstandard ()
2227 (if (consp calc-simplify-mode) 2222 (if (consp calc-simplify-mode)
2228 (progn 2223 (progn
2229 (setq calc-simplify-mode 'none 2224 (setq calc-simplify-mode 'none
2230 math-simplify-only (car-safe (cdr-safe a))) 2225 math-simplify-only (car-safe (cdr-safe math-normalize-a)))
2231 nil) 2226 nil)
2232 (and (symbolp (car a)) 2227 (and (symbolp (car math-normalize-a))
2233 (or (eq calc-simplify-mode 'none) 2228 (or (eq calc-simplify-mode 'none)
2234 (and (eq calc-simplify-mode 'num) 2229 (and (eq calc-simplify-mode 'num)
2235 (let ((aptr (setq a (cons 2230 (let ((aptr (setq math-normalize-a
2236 (car a) 2231 (cons
2237 (mapcar 'math-normalize (cdr a)))))) 2232 (car math-normalize-a)
2233 (mapcar 'math-normalize
2234 (cdr math-normalize-a))))))
2238 (while (and aptr (math-constp (car aptr))) 2235 (while (and aptr (math-constp (car aptr)))
2239 (setq aptr (cdr aptr))) 2236 (setq aptr (cdr aptr)))
2240 aptr))) 2237 aptr)))
2241 (cons (car a) (mapcar 'math-normalize (cdr a)))))) 2238 (cons (car math-normalize-a)
2242 2239 (mapcar 'math-normalize (cdr math-normalize-a))))))
2243
2244
2245 2240
2246 2241
2247;;; Normalize a bignum digit list by trimming high-end zeros. [L l] 2242;;; Normalize a bignum digit list by trimming high-end zeros. [L l]
@@ -2619,22 +2614,27 @@ calc-kill calc-kill-region calc-yank))))
2619 2614
2620(defvar var-FactorRules 'calc-FactorRules) 2615(defvar var-FactorRules 'calc-FactorRules)
2621 2616
2622(defun math-map-tree (mmt-func mmt-expr &optional mmt-many) 2617(defvar math-mt-many nil)
2623 (or mmt-many (setq mmt-many 1000000)) 2618(defvar math-mt-func nil)
2619
2620(defun math-map-tree (math-mt-func mmt-expr &optional math-mt-many)
2621 (or math-mt-many (setq math-mt-many 1000000))
2624 (math-map-tree-rec mmt-expr)) 2622 (math-map-tree-rec mmt-expr))
2625 2623
2626(defun math-map-tree-rec (mmt-expr) 2624(defun math-map-tree-rec (mmt-expr)
2627 (or (= mmt-many 0) 2625 (or (= math-mt-many 0)
2628 (let ((mmt-done nil) 2626 (let ((mmt-done nil)
2629 mmt-nextval) 2627 mmt-nextval)
2630 (while (not mmt-done) 2628 (while (not mmt-done)
2631 (while (and (/= mmt-many 0) 2629 (while (and (/= math-mt-many 0)
2632 (setq mmt-nextval (funcall mmt-func mmt-expr)) 2630 (setq mmt-nextval (funcall math-mt-func mmt-expr))
2633 (not (equal mmt-expr mmt-nextval))) 2631 (not (equal mmt-expr mmt-nextval)))
2634 (setq mmt-expr mmt-nextval 2632 (setq mmt-expr mmt-nextval
2635 mmt-many (if (> mmt-many 0) (1- mmt-many) (1+ mmt-many)))) 2633 math-mt-many (if (> math-mt-many 0)
2634 (1- math-mt-many)
2635 (1+ math-mt-many))))
2636 (if (or (Math-primp mmt-expr) 2636 (if (or (Math-primp mmt-expr)
2637 (<= mmt-many 0)) 2637 (<= math-mt-many 0))
2638 (setq mmt-done t) 2638 (setq mmt-done t)
2639 (setq mmt-nextval (cons (car mmt-expr) 2639 (setq mmt-nextval (cons (car mmt-expr)
2640 (mapcar 'math-map-tree-rec 2640 (mapcar 'math-map-tree-rec
@@ -2885,22 +2885,24 @@ calc-kill calc-kill-region calc-yank))))
2885 2885
2886;;; Expression parsing. 2886;;; Expression parsing.
2887 2887
2888(defun math-read-expr (exp-str) 2888(defvar math-expr-data)
2889 (let ((exp-pos 0) 2889
2890 (exp-old-pos 0) 2890(defun math-read-expr (math-exp-str)
2891 (exp-keep-spaces nil) 2891 (let ((math-exp-pos 0)
2892 exp-token exp-data) 2892 (math-exp-old-pos 0)
2893 (while (setq exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" exp-str)) 2893 (math-exp-keep-spaces nil)
2894 (setq exp-str (concat (substring exp-str 0 exp-token) "\\dots" 2894 math-exp-token math-expr-data)
2895 (substring exp-str (+ exp-token 2))))) 2895 (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str))
2896 (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots"
2897 (substring math-exp-str (+ math-exp-token 2)))))
2896 (math-build-parse-table) 2898 (math-build-parse-table)
2897 (math-read-token) 2899 (math-read-token)
2898 (let ((val (catch 'syntax (math-read-expr-level 0)))) 2900 (let ((val (catch 'syntax (math-read-expr-level 0))))
2899 (if (stringp val) 2901 (if (stringp val)
2900 (list 'error exp-old-pos val) 2902 (list 'error math-exp-old-pos val)
2901 (if (equal exp-token 'end) 2903 (if (equal math-exp-token 'end)
2902 val 2904 val
2903 (list 'error exp-old-pos "Syntax error")))))) 2905 (list 'error math-exp-old-pos "Syntax error"))))))
2904 2906
2905(defun math-read-plain-expr (exp-str &optional error-check) 2907(defun math-read-plain-expr (exp-str &optional error-check)
2906 (let* ((calc-language nil) 2908 (let* ((calc-language nil)
@@ -2913,8 +2915,8 @@ calc-kill calc-kill-region calc-yank))))
2913 2915
2914 2916
2915(defun math-read-string () 2917(defun math-read-string ()
2916 (let ((str (read-from-string (concat exp-data "\"")))) 2918 (let ((str (read-from-string (concat math-expr-data "\""))))
2917 (or (and (= (cdr str) (1+ (length exp-data))) 2919 (or (and (= (cdr str) (1+ (length math-expr-data)))
2918 (stringp (car str))) 2920 (stringp (car str)))
2919 (throw 'syntax "Error in string constant")) 2921 (throw 'syntax "Error in string constant"))
2920 (math-read-token) 2922 (math-read-token)
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index 31f9e776a0c..e64983ad33d 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -1791,8 +1791,8 @@ and ends on the last Sunday of October at 2 a.m."
1791 1791
1792 1792
1793(defun math-read-angle-brackets () 1793(defun math-read-angle-brackets ()
1794 (let* ((last (or (math-check-for-commas t) (length exp-str))) 1794 (let* ((last (or (math-check-for-commas t) (length math-exp-str)))
1795 (str (substring exp-str exp-pos last)) 1795 (str (substring math-exp-str math-exp-pos last))
1796 (res 1796 (res
1797 (if (string-match "\\` *\\([a-zA-Z#][a-zA-Z0-9#]* *,? *\\)*:" str) 1797 (if (string-match "\\` *\\([a-zA-Z#][a-zA-Z0-9#]* *,? *\\)*:" str)
1798 (let ((str1 (substring str 0 (1- (match-end 0)))) 1798 (let ((str1 (substring str 0 (1- (match-end 0))))
@@ -1818,7 +1818,7 @@ and ends on the last Sunday of October at 2 a.m."
1818 (throw 'syntax res)) 1818 (throw 'syntax res))
1819 (if (eq (car-safe res) 'error) 1819 (if (eq (car-safe res) 'error)
1820 (throw 'syntax (nth 2 res))) 1820 (throw 'syntax (nth 2 res)))
1821 (setq exp-pos (1+ last)) 1821 (setq math-exp-pos (1+ last))
1822 (math-read-token) 1822 (math-read-token)
1823 res)) 1823 res))
1824 1824
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el
index cec7a5d2136..ff537109816 100644
--- a/lisp/calc/calc-graph.el
+++ b/lisp/calc/calc-graph.el
@@ -66,6 +66,7 @@
66(defvar calc-graph-data-cache-limit 10) 66(defvar calc-graph-data-cache-limit 10)
67(defvar calc-graph-no-auto-view nil) 67(defvar calc-graph-no-auto-view nil)
68(defvar calc-graph-no-wait nil) 68(defvar calc-graph-no-wait nil)
69(defvar calc-gnuplot-trail-mark)
69 70
70(defun calc-graph-fast (many) 71(defun calc-graph-fast (many)
71 (interactive "P") 72 (interactive "P")
@@ -224,11 +225,10 @@
224 thing 225 thing
225 (let ((found (assoc thing calc-graph-var-cache))) 226 (let ((found (assoc thing calc-graph-var-cache)))
226 (or found 227 (or found
227 (progn 228 (let ((varname (concat "PlotData"
228 (setq varname (concat "PlotData" 229 (int-to-string
229 (int-to-string 230 (1+ (length calc-graph-var-cache))))))
230 (1+ (length calc-graph-var-cache)))) 231 (setq var (list 'var (intern varname)
231 var (list 'var (intern varname)
232 (intern (concat "var-" varname))) 232 (intern (concat "var-" varname)))
233 found (cons thing var) 233 found (cons thing var)
234 calc-graph-var-cache (cons found calc-graph-var-cache)) 234 calc-graph-var-cache (cons found calc-graph-var-cache))
@@ -275,6 +275,47 @@
275 (interactive "P") 275 (interactive "P")
276 (calc-graph-plot flag t)) 276 (calc-graph-plot flag t))
277 277
278(defvar var-DUMMY)
279(defvar var-DUMMY2)
280(defvar var-PlotRejects)
281
282;; The following variables are local to calc-graph-plot, but are
283;; used in the functions calc-graph-compute-2d, calc-graph-refine-2d,
284;; calc-graph-recompute-2d, calc-graph-compute-3d and
285;; calc-graph-format-data, which are called by calc-graph-plot.
286(defvar calc-graph-yvalue)
287(defvar calc-graph-yvec)
288(defvar calc-graph-numsteps)
289(defvar calc-graph-numsteps3)
290(defvar calc-graph-xvalue)
291(defvar calc-graph-xvec)
292(defvar calc-graph-xname)
293(defvar calc-graph-yname)
294(defvar calc-graph-xstep)
295(defvar calc-graph-ycache)
296(defvar calc-graph-ycacheptr)
297(defvar calc-graph-refine)
298(defvar calc-graph-keep-file)
299(defvar calc-graph-xval)
300(defvar calc-graph-xlow)
301(defvar calc-graph-xhigh)
302(defvar calc-graph-yval)
303(defvar calc-graph-yp)
304(defvar calc-graph-xp)
305(defvar calc-graph-zp)
306(defvar calc-graph-yvector)
307(defvar calc-graph-resolution)
308(defvar calc-graph-y3value)
309(defvar calc-graph-y3name)
310(defvar calc-graph-y3step)
311(defvar calc-graph-zval)
312(defvar calc-graph-stepcount)
313(defvar calc-graph-is-splot)
314(defvar calc-graph-surprise-splot)
315(defvar calc-graph-blank)
316(defvar calc-graph-non-blank)
317(defvar calc-graph-curve-num)
318
278(defun calc-graph-plot (flag &optional printing) 319(defun calc-graph-plot (flag &optional printing)
279 (interactive "P") 320 (interactive "P")
280 (calc-slow-wrapper 321 (calc-slow-wrapper
@@ -282,22 +323,20 @@
282 (tempbuf (get-buffer-create "*Gnuplot Temp-2*")) 323 (tempbuf (get-buffer-create "*Gnuplot Temp-2*"))
283 (tempbuftop 1) 324 (tempbuftop 1)
284 (tempoutfile nil) 325 (tempoutfile nil)
285 (curve-num 0) 326 (calc-graph-curve-num 0)
286 (refine (and flag (> (prefix-numeric-value flag) 0))) 327 (calc-graph-refine (and flag (> (prefix-numeric-value flag) 0)))
287 (recompute (and flag (< (prefix-numeric-value flag) 0))) 328 (recompute (and flag (< (prefix-numeric-value flag) 0)))
288 (surprise-splot nil) 329 (calc-graph-surprise-splot nil)
289 (tty-output nil) 330 (tty-output nil)
290 cache-env is-splot device output resolution precision samples-pos) 331 cache-env calc-graph-is-splot device output calc-graph-resolution precision samples-pos)
291 (or (boundp 'calc-graph-prev-kill-hook) 332 (add-hook 'kill-emacs-hook 'calc-graph-kill-hook)
292 (setq calc-graph-prev-kill-hook nil)
293 (add-hook 'kill-emacs-hook 'calc-graph-kill-hook))
294 (save-excursion 333 (save-excursion
295 (calc-graph-init) 334 (calc-graph-init)
296 (set-buffer tempbuf) 335 (set-buffer tempbuf)
297 (erase-buffer) 336 (erase-buffer)
298 (set-buffer calc-gnuplot-input) 337 (set-buffer calc-gnuplot-input)
299 (goto-char (point-min)) 338 (goto-char (point-min))
300 (setq is-splot (re-search-forward "^splot[ \t]" nil t)) 339 (setq calc-graph-is-splot (re-search-forward "^splot[ \t]" nil t))
301 (let ((str (buffer-string)) 340 (let ((str (buffer-string))
302 (ver calc-gnuplot-version)) 341 (ver calc-gnuplot-version))
303 (set-buffer (get-buffer-create "*Gnuplot Temp*")) 342 (set-buffer (get-buffer-create "*Gnuplot Temp*"))
@@ -313,14 +352,14 @@
313 "set nogrid\nset nokey\nset nopolar\n")) 352 "set nogrid\nset nokey\nset nopolar\n"))
314 (if (>= ver 3) 353 (if (>= ver 3)
315 (insert "set surface\nset nocontour\n" 354 (insert "set surface\nset nocontour\n"
316 "set " (if is-splot "" "no") "parametric\n" 355 "set " (if calc-graph-is-splot "" "no") "parametric\n"
317 "set notime\nset border\nset ztics\nset zeroaxis\n" 356 "set notime\nset border\nset ztics\nset zeroaxis\n"
318 "set view 60,30,1,1\nset offsets 0,0,0,0\n")) 357 "set view 60,30,1,1\nset offsets 0,0,0,0\n"))
319 (setq samples-pos (point)) 358 (setq samples-pos (point))
320 (insert "\n\n" str)) 359 (insert "\n\n" str))
321 (goto-char (point-min)) 360 (goto-char (point-min))
322 (if is-splot 361 (if calc-graph-is-splot
323 (if refine 362 (if calc-graph-refine
324 (error "This option works only for 2d plots") 363 (error "This option works only for 2d plots")
325 (setq recompute t))) 364 (setq recompute t)))
326 (let ((calc-gnuplot-input (current-buffer)) 365 (let ((calc-gnuplot-input (current-buffer))
@@ -366,10 +405,10 @@
366 (if (equal output "STDOUT") 405 (if (equal output "STDOUT")
367 "" 406 ""
368 (prin1-to-string output))))) 407 (prin1-to-string output)))))
369 (setq resolution (calc-graph-find-command "samples")) 408 (setq calc-graph-resolution (calc-graph-find-command "samples"))
370 (if resolution 409 (if calc-graph-resolution
371 (setq resolution (string-to-int resolution)) 410 (setq calc-graph-resolution (string-to-int calc-graph-resolution))
372 (setq resolution (if is-splot 411 (setq calc-graph-resolution (if calc-graph-is-splot
373 calc-graph-default-resolution-3d 412 calc-graph-default-resolution-3d
374 calc-graph-default-resolution))) 413 calc-graph-default-resolution)))
375 (setq precision (calc-graph-find-command "precision")) 414 (setq precision (calc-graph-find-command "precision"))
@@ -381,8 +420,8 @@
381 (calc-graph-set-command "samples") 420 (calc-graph-set-command "samples")
382 (calc-graph-set-command "precision")) 421 (calc-graph-set-command "precision"))
383 (goto-char samples-pos) 422 (goto-char samples-pos)
384 (insert "set samples " (int-to-string (max (if is-splot 20 200) 423 (insert "set samples " (int-to-string (max (if calc-graph-is-splot 20 200)
385 (+ 5 resolution))) "\n") 424 (+ 5 calc-graph-resolution))) "\n")
386 (while (re-search-forward "{\\*[^}]+}[^,\n]*" nil t) 425 (while (re-search-forward "{\\*[^}]+}[^,\n]*" nil t)
387 (delete-region (match-beginning 0) (match-end 0)) 426 (delete-region (match-beginning 0) (match-end 0))
388 (if (looking-at ",") 427 (if (looking-at ",")
@@ -398,7 +437,7 @@
398 calc-simplify-mode 437 calc-simplify-mode
399 calc-infinite-mode 438 calc-infinite-mode
400 calc-word-size 439 calc-word-size
401 precision is-splot)) 440 precision calc-graph-is-splot))
402 (if (and (not recompute) 441 (if (and (not recompute)
403 (equal (cdr (car calc-graph-data-cache)) cache-env)) 442 (equal (cdr (car calc-graph-data-cache)) cache-env))
404 (while (> (length calc-graph-data-cache) 443 (while (> (length calc-graph-data-cache)
@@ -408,88 +447,88 @@
408 (setq calc-graph-data-cache (list (cons nil cache-env))))) 447 (setq calc-graph-data-cache (list (cons nil cache-env)))))
409 (calc-graph-find-plot t t) 448 (calc-graph-find-plot t t)
410 (while (re-search-forward 449 (while (re-search-forward
411 (if is-splot 450 (if calc-graph-is-splot
412 "{\\([^{}:\n]+\\):\\([^{}:\n]+\\):\\([^{}:\n]+\\)}" 451 "{\\([^{}:\n]+\\):\\([^{}:\n]+\\):\\([^{}:\n]+\\)}"
413 "{\\([^{}:\n]+\\)\\(:\\)\\([^{}:\n]+\\)}") 452 "{\\([^{}:\n]+\\)\\(:\\)\\([^{}:\n]+\\)}")
414 nil t) 453 nil t)
415 (setq curve-num (1+ curve-num)) 454 (setq calc-graph-curve-num (1+ calc-graph-curve-num))
416 (let* ((xname (buffer-substring (match-beginning 1) (match-end 1))) 455 (let* ((calc-graph-xname (buffer-substring (match-beginning 1) (match-end 1)))
417 (xvar (intern (concat "var-" xname))) 456 (xvar (intern (concat "var-" calc-graph-xname)))
418 (xvalue (math-evaluate-expr (calc-var-value xvar))) 457 (calc-graph-xvalue (math-evaluate-expr (calc-var-value xvar)))
419 (y3name (and is-splot 458 (calc-graph-y3name (and calc-graph-is-splot
420 (buffer-substring (match-beginning 2) 459 (buffer-substring (match-beginning 2)
421 (match-end 2)))) 460 (match-end 2))))
422 (y3var (and is-splot (intern (concat "var-" y3name)))) 461 (y3var (and calc-graph-is-splot (intern (concat "var-" calc-graph-y3name))))
423 (y3value (and is-splot (calc-var-value y3var))) 462 (calc-graph-y3value (and calc-graph-is-splot (calc-var-value y3var)))
424 (yname (buffer-substring (match-beginning 3) (match-end 3))) 463 (calc-graph-yname (buffer-substring (match-beginning 3) (match-end 3)))
425 (yvar (intern (concat "var-" yname))) 464 (yvar (intern (concat "var-" calc-graph-yname)))
426 (yvalue (calc-var-value yvar)) 465 (calc-graph-yvalue (calc-var-value yvar))
427 filename) 466 filename)
428 (delete-region (match-beginning 0) (match-end 0)) 467 (delete-region (match-beginning 0) (match-end 0))
429 (setq filename (calc-temp-file-name curve-num)) 468 (setq filename (calc-temp-file-name calc-graph-curve-num))
430 (save-excursion 469 (save-excursion
431 (set-buffer calcbuf) 470 (set-buffer calcbuf)
432 (let (tempbuftop 471 (let (tempbuftop
433 (xp xvalue) 472 (calc-graph-xp calc-graph-xvalue)
434 (yp yvalue) 473 (calc-graph-yp calc-graph-yvalue)
435 (zp nil) 474 (calc-graph-zp nil)
436 (xlow nil) (xhigh nil) (y3low nil) (y3high nil) 475 (calc-graph-xlow nil) (calc-graph-xhigh nil) (y3low nil) (y3high nil)
437 xvec xval xstep var-DUMMY 476 calc-graph-xvec calc-graph-xval calc-graph-xstep var-DUMMY
438 y3vec y3val y3step var-DUMMY2 (zval nil) 477 y3val calc-graph-y3step var-DUMMY2 (calc-graph-zval nil)
439 yvec yval ycache ycacheptr yvector 478 calc-graph-yvec calc-graph-yval calc-graph-ycache calc-graph-ycacheptr calc-graph-yvector
440 numsteps numsteps3 479 calc-graph-numsteps calc-graph-numsteps3
441 (keep-file (and (not is-splot) (file-exists-p filename))) 480 (calc-graph-keep-file (and (not calc-graph-is-splot) (file-exists-p filename)))
442 (stepcount 0) 481 (calc-graph-stepcount 0)
443 (calc-symbolic-mode nil) 482 (calc-symbolic-mode nil)
444 (calc-prefer-frac nil) 483 (calc-prefer-frac nil)
445 (calc-internal-prec (max 3 precision)) 484 (calc-internal-prec (max 3 precision))
446 (calc-simplify-mode (and (not (memq calc-simplify-mode 485 (calc-simplify-mode (and (not (memq calc-simplify-mode
447 '(none num))) 486 '(none num)))
448 calc-simplify-mode)) 487 calc-simplify-mode))
449 (blank t) 488 (calc-graph-blank t)
450 (non-blank nil) 489 (calc-graph-non-blank nil)
451 (math-working-step 0) 490 (math-working-step 0)
452 (math-working-step-2 nil)) 491 (math-working-step-2 nil))
453 (save-excursion 492 (save-excursion
454 (if is-splot 493 (if calc-graph-is-splot
455 (calc-graph-compute-3d) 494 (calc-graph-compute-3d)
456 (calc-graph-compute-2d)) 495 (calc-graph-compute-2d))
457 (set-buffer tempbuf) 496 (set-buffer tempbuf)
458 (goto-char (point-max)) 497 (goto-char (point-max))
459 (insert "\n" xname) 498 (insert "\n" calc-graph-xname)
460 (if is-splot 499 (if calc-graph-is-splot
461 (insert ":" y3name)) 500 (insert ":" calc-graph-y3name))
462 (insert ":" yname "\n\n") 501 (insert ":" calc-graph-yname "\n\n")
463 (setq tempbuftop (point)) 502 (setq tempbuftop (point))
464 (let ((calc-group-digits nil) 503 (let ((calc-group-digits nil)
465 (calc-leading-zeros nil) 504 (calc-leading-zeros nil)
466 (calc-number-radix 10) 505 (calc-number-radix 10)
467 (entry (and (not is-splot) 506 (entry (and (not calc-graph-is-splot)
468 (list xp yp xhigh numsteps)))) 507 (list calc-graph-xp calc-graph-yp calc-graph-xhigh calc-graph-numsteps))))
469 (or (equal entry 508 (or (equal entry
470 (nth 1 (nth (1+ curve-num) 509 (nth 1 (nth (1+ calc-graph-curve-num)
471 calc-graph-file-cache))) 510 calc-graph-file-cache)))
472 (setq keep-file nil)) 511 (setq calc-graph-keep-file nil))
473 (setcar (cdr (nth (1+ curve-num) calc-graph-file-cache)) 512 (setcar (cdr (nth (1+ calc-graph-curve-num) calc-graph-file-cache))
474 entry) 513 entry)
475 (or keep-file 514 (or calc-graph-keep-file
476 (calc-graph-format-data))) 515 (calc-graph-format-data)))
477 (or keep-file 516 (or calc-graph-keep-file
478 (progn 517 (progn
479 (or non-blank 518 (or calc-graph-non-blank
480 (error "No valid data points for %s:%s" 519 (error "No valid data points for %s:%s"
481 xname yname)) 520 calc-graph-xname calc-graph-yname))
482 (write-region tempbuftop (point-max) filename 521 (write-region tempbuftop (point-max) filename
483 nil 'quiet)))))) 522 nil 'quiet))))))
484 (insert (prin1-to-string filename)))) 523 (insert (prin1-to-string filename))))
485 (if surprise-splot 524 (if calc-graph-surprise-splot
486 (setcdr cache-env nil)) 525 (setcdr cache-env nil))
487 (if (= curve-num 0) 526 (if (= calc-graph-curve-num 0)
488 (progn 527 (progn
489 (calc-gnuplot-command "clear") 528 (calc-gnuplot-command "clear")
490 (calc-clear-command-flag 'clear-message) 529 (calc-clear-command-flag 'clear-message)
491 (message "No data to plot!")) 530 (message "No data to plot!"))
492 (setq calc-graph-data-cache-limit (max curve-num 531 (setq calc-graph-data-cache-limit (max calc-graph-curve-num
493 calc-graph-data-cache-limit) 532 calc-graph-data-cache-limit)
494 filename (calc-temp-file-name 0)) 533 filename (calc-temp-file-name 0))
495 (write-region (point-min) (point-max) filename nil 'quiet) 534 (write-region (point-min) (point-max) filename nil 'quiet)
@@ -517,325 +556,325 @@
517 (eval command)))))))))) 556 (eval command))))))))))
518 557
519(defun calc-graph-compute-2d () 558(defun calc-graph-compute-2d ()
520 (if (setq yvec (eq (car-safe yvalue) 'vec)) 559 (if (setq calc-graph-yvec (eq (car-safe calc-graph-yvalue) 'vec))
521 (if (= (setq numsteps (1- (length yvalue))) 0) 560 (if (= (setq calc-graph-numsteps (1- (length calc-graph-yvalue))) 0)
522 (error "Can't plot an empty vector") 561 (error "Can't plot an empty vector")
523 (if (setq xvec (eq (car-safe xvalue) 'vec)) 562 (if (setq calc-graph-xvec (eq (car-safe calc-graph-xvalue) 'vec))
524 (or (= (1- (length xvalue)) numsteps) 563 (or (= (1- (length calc-graph-xvalue)) calc-graph-numsteps)
525 (error "%s and %s have different lengths" xname yname)) 564 (error "%s and %s have different lengths" calc-graph-xname calc-graph-yname))
526 (if (and (eq (car-safe xvalue) 'intv) 565 (if (and (eq (car-safe calc-graph-xvalue) 'intv)
527 (math-constp xvalue)) 566 (math-constp calc-graph-xvalue))
528 (setq xstep (math-div (math-sub (nth 3 xvalue) 567 (setq calc-graph-xstep (math-div (math-sub (nth 3 calc-graph-xvalue)
529 (nth 2 xvalue)) 568 (nth 2 calc-graph-xvalue))
530 (1- numsteps)) 569 (1- calc-graph-numsteps))
531 xvalue (nth 2 xvalue)) 570 calc-graph-xvalue (nth 2 calc-graph-xvalue))
532 (if (math-realp xvalue) 571 (if (math-realp calc-graph-xvalue)
533 (setq xstep 1) 572 (setq calc-graph-xstep 1)
534 (error "%s is not a suitable basis for %s" xname yname))))) 573 (error "%s is not a suitable basis for %s" calc-graph-xname calc-graph-yname)))))
535 (or (math-realp yvalue) 574 (or (math-realp calc-graph-yvalue)
536 (let ((arglist nil)) 575 (let ((arglist nil))
537 (setq yvalue (math-evaluate-expr yvalue)) 576 (setq calc-graph-yvalue (math-evaluate-expr calc-graph-yvalue))
538 (calc-default-formula-arglist yvalue) 577 (calc-default-formula-arglist calc-graph-yvalue)
539 (or arglist 578 (or arglist
540 (error "%s does not contain any unassigned variables" yname)) 579 (error "%s does not contain any unassigned variables" calc-graph-yname))
541 (and (cdr arglist) 580 (and (cdr arglist)
542 (error "%s contains more than one variable: %s" 581 (error "%s contains more than one variable: %s"
543 yname arglist)) 582 calc-graph-yname arglist))
544 (setq yvalue (math-expr-subst yvalue 583 (setq calc-graph-yvalue (math-expr-subst calc-graph-yvalue
545 (math-build-var-name (car arglist)) 584 (math-build-var-name (car arglist))
546 '(var DUMMY var-DUMMY))))) 585 '(var DUMMY var-DUMMY)))))
547 (setq ycache (assoc yvalue calc-graph-data-cache)) 586 (setq calc-graph-ycache (assoc calc-graph-yvalue calc-graph-data-cache))
548 (delq ycache calc-graph-data-cache) 587 (delq calc-graph-ycache calc-graph-data-cache)
549 (nconc calc-graph-data-cache 588 (nconc calc-graph-data-cache
550 (list (or ycache (setq ycache (list yvalue))))) 589 (list (or calc-graph-ycache (setq calc-graph-ycache (list calc-graph-yvalue)))))
551 (if (and (not (setq xvec (eq (car-safe xvalue) 'vec))) 590 (if (and (not (setq calc-graph-xvec (eq (car-safe calc-graph-xvalue) 'vec)))
552 refine (cdr (cdr ycache))) 591 calc-graph-refine (cdr (cdr calc-graph-ycache)))
553 (calc-graph-refine-2d) 592 (calc-graph-refine-2d)
554 (calc-graph-recompute-2d)))) 593 (calc-graph-recompute-2d))))
555 594
556(defun calc-graph-refine-2d () 595(defun calc-graph-refine-2d ()
557 (setq keep-file nil 596 (setq calc-graph-keep-file nil
558 ycacheptr (cdr ycache)) 597 calc-graph-ycacheptr (cdr calc-graph-ycache))
559 (if (and (setq xval (calc-graph-find-command "xrange")) 598 (if (and (setq calc-graph-xval (calc-graph-find-command "xrange"))
560 (string-match "\\`\\[\\([0-9.eE+-]*\\):\\([0-9.eE+-]*\\)\\]\\'" 599 (string-match "\\`\\[\\([0-9.eE+-]*\\):\\([0-9.eE+-]*\\)\\]\\'"
561 xval)) 600 calc-graph-xval))
562 (let ((b2 (match-beginning 2)) 601 (let ((b2 (match-beginning 2))
563 (e2 (match-end 2))) 602 (e2 (match-end 2)))
564 (setq xlow (math-read-number (substring xval 603 (setq calc-graph-xlow (math-read-number (substring calc-graph-xval
565 (match-beginning 1) 604 (match-beginning 1)
566 (match-end 1))) 605 (match-end 1)))
567 xhigh (math-read-number (substring xval b2 e2)))) 606 calc-graph-xhigh (math-read-number (substring calc-graph-xval b2 e2))))
568 (if xlow 607 (if calc-graph-xlow
569 (while (and (cdr ycacheptr) 608 (while (and (cdr calc-graph-ycacheptr)
570 (Math-lessp (car (nth 1 ycacheptr)) xlow)) 609 (Math-lessp (car (nth 1 calc-graph-ycacheptr)) calc-graph-xlow))
571 (setq ycacheptr (cdr ycacheptr))))) 610 (setq calc-graph-ycacheptr (cdr calc-graph-ycacheptr)))))
572 (setq math-working-step-2 (1- (length ycacheptr))) 611 (setq math-working-step-2 (1- (length calc-graph-ycacheptr)))
573 (while (and (cdr ycacheptr) 612 (while (and (cdr calc-graph-ycacheptr)
574 (or (not xhigh) 613 (or (not calc-graph-xhigh)
575 (Math-lessp (car (car ycacheptr)) xhigh))) 614 (Math-lessp (car (car calc-graph-ycacheptr)) calc-graph-xhigh)))
576 (setq var-DUMMY (math-div (math-add (car (car ycacheptr)) 615 (setq var-DUMMY (math-div (math-add (car (car calc-graph-ycacheptr))
577 (car (nth 1 ycacheptr))) 616 (car (nth 1 calc-graph-ycacheptr)))
578 2) 617 2)
579 math-working-step (1+ math-working-step) 618 math-working-step (1+ math-working-step)
580 yval (math-evaluate-expr yvalue)) 619 calc-graph-yval (math-evaluate-expr calc-graph-yvalue))
581 (setcdr ycacheptr (cons (cons var-DUMMY yval) 620 (setcdr calc-graph-ycacheptr (cons (cons var-DUMMY calc-graph-yval)
582 (cdr ycacheptr))) 621 (cdr calc-graph-ycacheptr)))
583 (setq ycacheptr (cdr (cdr ycacheptr)))) 622 (setq calc-graph-ycacheptr (cdr (cdr calc-graph-ycacheptr))))
584 (setq yp ycache 623 (setq calc-graph-yp calc-graph-ycache
585 numsteps 1000000)) 624 calc-graph-numsteps 1000000))
586 625
587(defun calc-graph-recompute-2d () 626(defun calc-graph-recompute-2d ()
588 (setq ycacheptr ycache) 627 (setq calc-graph-ycacheptr calc-graph-ycache)
589 (if xvec 628 (if calc-graph-xvec
590 (setq numsteps (1- (length xvalue)) 629 (setq calc-graph-numsteps (1- (length calc-graph-xvalue))
591 yvector nil) 630 calc-graph-yvector nil)
592 (if (and (eq (car-safe xvalue) 'intv) 631 (if (and (eq (car-safe calc-graph-xvalue) 'intv)
593 (math-constp xvalue)) 632 (math-constp calc-graph-xvalue))
594 (setq numsteps resolution 633 (setq calc-graph-numsteps calc-graph-resolution
595 yp nil 634 calc-graph-yp nil
596 xlow (nth 2 xvalue) 635 calc-graph-xlow (nth 2 calc-graph-xvalue)
597 xhigh (nth 3 xvalue) 636 calc-graph-xhigh (nth 3 calc-graph-xvalue)
598 xstep (math-div (math-sub xhigh xlow) 637 calc-graph-xstep (math-div (math-sub calc-graph-xhigh calc-graph-xlow)
599 (1- numsteps)) 638 (1- calc-graph-numsteps))
600 xvalue (nth 2 xvalue)) 639 calc-graph-xvalue (nth 2 calc-graph-xvalue))
601 (error "%s is not a suitable basis for %s" 640 (error "%s is not a suitable basis for %s"
602 xname yname))) 641 calc-graph-xname calc-graph-yname)))
603 (setq math-working-step-2 numsteps) 642 (setq math-working-step-2 calc-graph-numsteps)
604 (while (>= (setq numsteps (1- numsteps)) 0) 643 (while (>= (setq calc-graph-numsteps (1- calc-graph-numsteps)) 0)
605 (setq math-working-step (1+ math-working-step)) 644 (setq math-working-step (1+ math-working-step))
606 (if xvec 645 (if calc-graph-xvec
607 (progn 646 (progn
608 (setq xp (cdr xp) 647 (setq calc-graph-xp (cdr calc-graph-xp)
609 xval (car xp)) 648 calc-graph-xval (car calc-graph-xp))
610 (and (not (eq ycacheptr ycache)) 649 (and (not (eq calc-graph-ycacheptr calc-graph-ycache))
611 (consp (car ycacheptr)) 650 (consp (car calc-graph-ycacheptr))
612 (not (Math-lessp (car (car ycacheptr)) xval)) 651 (not (Math-lessp (car (car calc-graph-ycacheptr)) calc-graph-xval))
613 (setq ycacheptr ycache))) 652 (setq calc-graph-ycacheptr calc-graph-ycache)))
614 (if (= numsteps 0) 653 (if (= calc-graph-numsteps 0)
615 (setq xval xhigh) ; avoid cumulative roundoff 654 (setq calc-graph-xval calc-graph-xhigh) ; avoid cumulative roundoff
616 (setq xval xvalue 655 (setq calc-graph-xval calc-graph-xvalue
617 xvalue (math-add xvalue xstep)))) 656 calc-graph-xvalue (math-add calc-graph-xvalue calc-graph-xstep))))
618 (while (and (cdr ycacheptr) 657 (while (and (cdr calc-graph-ycacheptr)
619 (Math-lessp (car (nth 1 ycacheptr)) xval)) 658 (Math-lessp (car (nth 1 calc-graph-ycacheptr)) calc-graph-xval))
620 (setq ycacheptr (cdr ycacheptr))) 659 (setq calc-graph-ycacheptr (cdr calc-graph-ycacheptr)))
621 (or (and (cdr ycacheptr) 660 (or (and (cdr calc-graph-ycacheptr)
622 (Math-equal (car (nth 1 ycacheptr)) xval)) 661 (Math-equal (car (nth 1 calc-graph-ycacheptr)) calc-graph-xval))
623 (progn 662 (progn
624 (setq keep-file nil 663 (setq calc-graph-keep-file nil
625 var-DUMMY xval) 664 var-DUMMY calc-graph-xval)
626 (setcdr ycacheptr (cons (cons xval (math-evaluate-expr yvalue)) 665 (setcdr calc-graph-ycacheptr (cons (cons calc-graph-xval (math-evaluate-expr calc-graph-yvalue))
627 (cdr ycacheptr))))) 666 (cdr calc-graph-ycacheptr)))))
628 (setq ycacheptr (cdr ycacheptr)) 667 (setq calc-graph-ycacheptr (cdr calc-graph-ycacheptr))
629 (if xvec 668 (if calc-graph-xvec
630 (setq yvector (cons (cdr (car ycacheptr)) yvector)) 669 (setq calc-graph-yvector (cons (cdr (car calc-graph-ycacheptr)) calc-graph-yvector))
631 (or yp (setq yp ycacheptr)))) 670 (or calc-graph-yp (setq calc-graph-yp calc-graph-ycacheptr))))
632 (if xvec 671 (if calc-graph-xvec
633 (setq xp xvalue 672 (setq calc-graph-xp calc-graph-xvalue
634 yvec t 673 calc-graph-yvec t
635 yp (cons 'vec (nreverse yvector)) 674 calc-graph-yp (cons 'vec (nreverse calc-graph-yvector))
636 numsteps (1- (length xp))) 675 calc-graph-numsteps (1- (length calc-graph-xp)))
637 (setq numsteps 1000000))) 676 (setq calc-graph-numsteps 1000000)))
638 677
639(defun calc-graph-compute-3d () 678(defun calc-graph-compute-3d ()
640 (if (setq yvec (eq (car-safe yvalue) 'vec)) 679 (if (setq calc-graph-yvec (eq (car-safe calc-graph-yvalue) 'vec))
641 (if (math-matrixp yvalue) 680 (if (math-matrixp calc-graph-yvalue)
642 (progn 681 (progn
643 (setq numsteps (1- (length yvalue)) 682 (setq calc-graph-numsteps (1- (length calc-graph-yvalue))
644 numsteps3 (1- (length (nth 1 yvalue)))) 683 calc-graph-numsteps3 (1- (length (nth 1 calc-graph-yvalue))))
645 (if (eq (car-safe xvalue) 'vec) 684 (if (eq (car-safe calc-graph-xvalue) 'vec)
646 (or (= (1- (length xvalue)) numsteps) 685 (or (= (1- (length calc-graph-xvalue)) calc-graph-numsteps)
647 (error "%s has wrong length" xname)) 686 (error "%s has wrong length" calc-graph-xname))
648 (if (and (eq (car-safe xvalue) 'intv) 687 (if (and (eq (car-safe calc-graph-xvalue) 'intv)
649 (math-constp xvalue)) 688 (math-constp calc-graph-xvalue))
650 (setq xvalue (calcFunc-index numsteps 689 (setq calc-graph-xvalue (calcFunc-index calc-graph-numsteps
651 (nth 2 xvalue) 690 (nth 2 calc-graph-xvalue)
652 (math-div 691 (math-div
653 (math-sub (nth 3 xvalue) 692 (math-sub (nth 3 calc-graph-xvalue)
654 (nth 2 xvalue)) 693 (nth 2 calc-graph-xvalue))
655 (1- numsteps)))) 694 (1- calc-graph-numsteps))))
656 (if (math-realp xvalue) 695 (if (math-realp calc-graph-xvalue)
657 (setq xvalue (calcFunc-index numsteps xvalue 1)) 696 (setq calc-graph-xvalue (calcFunc-index calc-graph-numsteps calc-graph-xvalue 1))
658 (error "%s is not a suitable basis for %s" xname yname)))) 697 (error "%s is not a suitable basis for %s" calc-graph-xname calc-graph-yname))))
659 (if (eq (car-safe y3value) 'vec) 698 (if (eq (car-safe calc-graph-y3value) 'vec)
660 (or (= (1- (length y3value)) numsteps3) 699 (or (= (1- (length calc-graph-y3value)) calc-graph-numsteps3)
661 (error "%s has wrong length" y3name)) 700 (error "%s has wrong length" calc-graph-y3name))
662 (if (and (eq (car-safe y3value) 'intv) 701 (if (and (eq (car-safe calc-graph-y3value) 'intv)
663 (math-constp y3value)) 702 (math-constp calc-graph-y3value))
664 (setq y3value (calcFunc-index numsteps3 703 (setq calc-graph-y3value (calcFunc-index calc-graph-numsteps3
665 (nth 2 y3value) 704 (nth 2 calc-graph-y3value)
666 (math-div 705 (math-div
667 (math-sub (nth 3 y3value) 706 (math-sub (nth 3 calc-graph-y3value)
668 (nth 2 y3value)) 707 (nth 2 calc-graph-y3value))
669 (1- numsteps3)))) 708 (1- calc-graph-numsteps3))))
670 (if (math-realp y3value) 709 (if (math-realp calc-graph-y3value)
671 (setq y3value (calcFunc-index numsteps3 y3value 1)) 710 (setq calc-graph-y3value (calcFunc-index calc-graph-numsteps3 calc-graph-y3value 1))
672 (error "%s is not a suitable basis for %s" y3name yname)))) 711 (error "%s is not a suitable basis for %s" calc-graph-y3name calc-graph-yname))))
673 (setq xp nil 712 (setq calc-graph-xp nil
674 yp nil 713 calc-graph-yp nil
675 zp nil 714 calc-graph-zp nil
676 xvec t) 715 calc-graph-xvec t)
677 (while (setq xvalue (cdr xvalue) yvalue (cdr yvalue)) 716 (while (setq calc-graph-xvalue (cdr calc-graph-xvalue) calc-graph-yvalue (cdr calc-graph-yvalue))
678 (setq xp (nconc xp (make-list (1+ numsteps3) (car xvalue))) 717 (setq calc-graph-xp (nconc calc-graph-xp (make-list (1+ calc-graph-numsteps3) (car calc-graph-xvalue)))
679 yp (nconc yp (cons 0 (copy-sequence (cdr y3value)))) 718 calc-graph-yp (nconc calc-graph-yp (cons 0 (copy-sequence (cdr calc-graph-y3value))))
680 zp (nconc zp (cons '(skip) 719 calc-graph-zp (nconc calc-graph-zp (cons '(skip)
681 (copy-sequence (cdr (car yvalue))))))) 720 (copy-sequence (cdr (car calc-graph-yvalue)))))))
682 (setq numsteps (1- (* numsteps (1+ numsteps3))))) 721 (setq calc-graph-numsteps (1- (* calc-graph-numsteps
683 (if (= (setq numsteps (1- (length yvalue))) 0) 722 (1+ calc-graph-numsteps3)))))
723 (if (= (setq calc-graph-numsteps (1- (length calc-graph-yvalue))) 0)
684 (error "Can't plot an empty vector")) 724 (error "Can't plot an empty vector"))
685 (or (and (eq (car-safe xvalue) 'vec) 725 (or (and (eq (car-safe calc-graph-xvalue) 'vec)
686 (= (1- (length xvalue)) numsteps)) 726 (= (1- (length calc-graph-xvalue)) calc-graph-numsteps))
687 (error "%s is not a suitable basis for %s" xname yname)) 727 (error "%s is not a suitable basis for %s" calc-graph-xname calc-graph-yname))
688 (or (and (eq (car-safe y3value) 'vec) 728 (or (and (eq (car-safe calc-graph-y3value) 'vec)
689 (= (1- (length y3value)) numsteps)) 729 (= (1- (length calc-graph-y3value)) calc-graph-numsteps))
690 (error "%s is not a suitable basis for %s" y3name yname)) 730 (error "%s is not a suitable basis for %s" calc-graph-y3name calc-graph-yname))
691 (setq xp xvalue 731 (setq calc-graph-xp calc-graph-xvalue
692 yp y3value 732 calc-graph-yp calc-graph-y3value
693 zp yvalue 733 calc-graph-zp calc-graph-yvalue
694 xvec t)) 734 calc-graph-xvec t))
695 (or (math-realp yvalue) 735 (or (math-realp calc-graph-yvalue)
696 (let ((arglist nil)) 736 (let ((arglist nil))
697 (setq yvalue (math-evaluate-expr yvalue)) 737 (setq calc-graph-yvalue (math-evaluate-expr calc-graph-yvalue))
698 (calc-default-formula-arglist yvalue) 738 (calc-default-formula-arglist calc-graph-yvalue)
699 (setq arglist (sort arglist 'string-lessp)) 739 (setq arglist (sort arglist 'string-lessp))
700 (or (cdr arglist) 740 (or (cdr arglist)
701 (error "%s does not contain enough unassigned variables" yname)) 741 (error "%s does not contain enough unassigned variables" calc-graph-yname))
702 (and (cdr (cdr arglist)) 742 (and (cdr (cdr arglist))
703 (error "%s contains too many variables: %s" yname arglist)) 743 (error "%s contains too many variables: %s" calc-graph-yname arglist))
704 (setq yvalue (math-multi-subst yvalue 744 (setq calc-graph-yvalue (math-multi-subst calc-graph-yvalue
705 (mapcar 'math-build-var-name 745 (mapcar 'math-build-var-name
706 arglist) 746 arglist)
707 '((var DUMMY var-DUMMY) 747 '((var DUMMY var-DUMMY)
708 (var DUMMY2 var-DUMMY2)))))) 748 (var DUMMY2 var-DUMMY2))))))
709 (if (setq xvec (eq (car-safe xvalue) 'vec)) 749 (if (setq calc-graph-xvec (eq (car-safe calc-graph-xvalue) 'vec))
710 (setq numsteps (1- (length xvalue))) 750 (setq calc-graph-numsteps (1- (length calc-graph-xvalue)))
711 (if (and (eq (car-safe xvalue) 'intv) 751 (if (and (eq (car-safe calc-graph-xvalue) 'intv)
712 (math-constp xvalue)) 752 (math-constp calc-graph-xvalue))
713 (setq numsteps resolution 753 (setq calc-graph-numsteps calc-graph-resolution
714 xvalue (calcFunc-index numsteps 754 calc-graph-xvalue (calcFunc-index calc-graph-numsteps
715 (nth 2 xvalue) 755 (nth 2 calc-graph-xvalue)
716 (math-div (math-sub (nth 3 xvalue) 756 (math-div (math-sub (nth 3 calc-graph-xvalue)
717 (nth 2 xvalue)) 757 (nth 2 calc-graph-xvalue))
718 (1- numsteps)))) 758 (1- calc-graph-numsteps))))
719 (error "%s is not a suitable basis for %s" 759 (error "%s is not a suitable basis for %s"
720 xname yname))) 760 calc-graph-xname calc-graph-yname)))
721 (if (setq y3vec (eq (car-safe y3value) 'vec)) 761 (if (eq (car-safe calc-graph-y3value) 'vec)
722 (setq numsteps3 (1- (length y3value))) 762 (setq calc-graph-numsteps3 (1- (length calc-graph-y3value)))
723 (if (and (eq (car-safe y3value) 'intv) 763 (if (and (eq (car-safe calc-graph-y3value) 'intv)
724 (math-constp y3value)) 764 (math-constp calc-graph-y3value))
725 (setq numsteps3 resolution 765 (setq calc-graph-numsteps3 calc-graph-resolution
726 y3value (calcFunc-index numsteps3 766 calc-graph-y3value (calcFunc-index calc-graph-numsteps3
727 (nth 2 y3value) 767 (nth 2 calc-graph-y3value)
728 (math-div (math-sub (nth 3 y3value) 768 (math-div (math-sub (nth 3 calc-graph-y3value)
729 (nth 2 y3value)) 769 (nth 2 calc-graph-y3value))
730 (1- numsteps3)))) 770 (1- calc-graph-numsteps3))))
731 (error "%s is not a suitable basis for %s" 771 (error "%s is not a suitable basis for %s"
732 y3name yname))) 772 calc-graph-y3name calc-graph-yname)))
733 (setq xp nil 773 (setq calc-graph-xp nil
734 yp nil 774 calc-graph-yp nil
735 zp nil 775 calc-graph-zp nil
736 xvec t) 776 calc-graph-xvec t)
737 (setq math-working-step 0) 777 (setq math-working-step 0)
738 (while (setq xvalue (cdr xvalue)) 778 (while (setq calc-graph-xvalue (cdr calc-graph-xvalue))
739 (setq xp (nconc xp (make-list (1+ numsteps3) (car xvalue))) 779 (setq calc-graph-xp (nconc calc-graph-xp (make-list (1+ calc-graph-numsteps3) (car calc-graph-xvalue)))
740 yp (nconc yp (cons 0 (copy-sequence (cdr y3value)))) 780 calc-graph-yp (nconc calc-graph-yp (cons 0 (copy-sequence (cdr calc-graph-y3value))))
741 zp (cons '(skip) zp) 781 calc-graph-zp (cons '(skip) calc-graph-zp)
742 y3step y3value 782 calc-graph-y3step calc-graph-y3value
743 var-DUMMY (car xvalue) 783 var-DUMMY (car calc-graph-xvalue)
744 math-working-step-2 0 784 math-working-step-2 0
745 math-working-step (1+ math-working-step)) 785 math-working-step (1+ math-working-step))
746 (while (setq y3step (cdr y3step)) 786 (while (setq calc-graph-y3step (cdr calc-graph-y3step))
747 (setq math-working-step-2 (1+ math-working-step-2) 787 (setq math-working-step-2 (1+ math-working-step-2)
748 var-DUMMY2 (car y3step) 788 var-DUMMY2 (car calc-graph-y3step)
749 zp (cons (math-evaluate-expr yvalue) zp)))) 789 calc-graph-zp (cons (math-evaluate-expr calc-graph-yvalue) calc-graph-zp))))
750 (setq zp (nreverse zp) 790 (setq calc-graph-zp (nreverse calc-graph-zp)
751 numsteps (1- (* numsteps (1+ numsteps3)))))) 791 calc-graph-numsteps (1- (* calc-graph-numsteps (1+ calc-graph-numsteps3))))))
752 792
753(defun calc-graph-format-data () 793(defun calc-graph-format-data ()
754 (while (<= (setq stepcount (1+ stepcount)) numsteps) 794 (while (<= (setq calc-graph-stepcount (1+ calc-graph-stepcount)) calc-graph-numsteps)
755 (if xvec 795 (if calc-graph-xvec
756 (setq xp (cdr xp) 796 (setq calc-graph-xp (cdr calc-graph-xp)
757 xval (car xp) 797 calc-graph-xval (car calc-graph-xp)
758 yp (cdr yp) 798 calc-graph-yp (cdr calc-graph-yp)
759 yval (car yp) 799 calc-graph-yval (car calc-graph-yp)
760 zp (cdr zp) 800 calc-graph-zp (cdr calc-graph-zp)
761 zval (car zp)) 801 calc-graph-zval (car calc-graph-zp))
762 (if yvec 802 (if calc-graph-yvec
763 (setq xval xvalue 803 (setq calc-graph-xval calc-graph-xvalue
764 xvalue (math-add xvalue xstep) 804 calc-graph-xvalue (math-add calc-graph-xvalue calc-graph-xstep)
765 yp (cdr yp) 805 calc-graph-yp (cdr calc-graph-yp)
766 yval (car yp)) 806 calc-graph-yval (car calc-graph-yp))
767 (setq xval (car (car yp)) 807 (setq calc-graph-xval (car (car calc-graph-yp))
768 yval (cdr (car yp)) 808 calc-graph-yval (cdr (car calc-graph-yp))
769 yp (cdr yp)) 809 calc-graph-yp (cdr calc-graph-yp))
770 (if (or (not yp) 810 (if (or (not calc-graph-yp)
771 (and xhigh (equal xval xhigh))) 811 (and calc-graph-xhigh (equal calc-graph-xval calc-graph-xhigh)))
772 (setq numsteps 0)))) 812 (setq calc-graph-numsteps 0))))
773 (if is-splot 813 (if calc-graph-is-splot
774 (if (and (eq (car-safe zval) 'calcFunc-xyz) 814 (if (and (eq (car-safe calc-graph-zval) 'calcFunc-xyz)
775 (= (length zval) 4)) 815 (= (length calc-graph-zval) 4))
776 (setq xval (nth 1 zval) 816 (setq calc-graph-xval (nth 1 calc-graph-zval)
777 yval (nth 2 zval) 817 calc-graph-yval (nth 2 calc-graph-zval)
778 zval (nth 3 zval))) 818 calc-graph-zval (nth 3 calc-graph-zval)))
779 (if (and (eq (car-safe yval) 'calcFunc-xyz) 819 (if (and (eq (car-safe calc-graph-yval) 'calcFunc-xyz)
780 (= (length yval) 4)) 820 (= (length calc-graph-yval) 4))
781 (progn 821 (progn
782 (or surprise-splot 822 (or calc-graph-surprise-splot
783 (save-excursion 823 (save-excursion
784 (set-buffer (get-buffer-create "*Gnuplot Temp*")) 824 (set-buffer (get-buffer-create "*Gnuplot Temp*"))
785 (save-excursion 825 (save-excursion
786 (goto-char (point-max)) 826 (goto-char (point-max))
787 (re-search-backward "^plot[ \t]") 827 (re-search-backward "^plot[ \t]")
788 (insert "set parametric\ns") 828 (insert "set parametric\ns")
789 (setq surprise-splot t)))) 829 (setq calc-graph-surprise-splot t))))
790 (setq xval (nth 1 yval) 830 (setq calc-graph-xval (nth 1 calc-graph-yval)
791 zval (nth 3 yval) 831 calc-graph-zval (nth 3 calc-graph-yval)
792 yval (nth 2 yval))) 832 calc-graph-yval (nth 2 calc-graph-yval)))
793 (if (and (eq (car-safe yval) 'calcFunc-xy) 833 (if (and (eq (car-safe calc-graph-yval) 'calcFunc-xy)
794 (= (length yval) 3)) 834 (= (length calc-graph-yval) 3))
795 (setq xval (nth 1 yval) 835 (setq calc-graph-xval (nth 1 calc-graph-yval)
796 yval (nth 2 yval))))) 836 calc-graph-yval (nth 2 calc-graph-yval)))))
797 (if (and (Math-realp xval) 837 (if (and (Math-realp calc-graph-xval)
798 (Math-realp yval) 838 (Math-realp calc-graph-yval)
799 (or (not zval) (Math-realp zval))) 839 (or (not calc-graph-zval) (Math-realp calc-graph-zval)))
800 (progn 840 (progn
801 (setq blank nil 841 (setq calc-graph-blank nil
802 non-blank t) 842 calc-graph-non-blank t)
803 (if (Math-integerp xval) 843 (if (Math-integerp calc-graph-xval)
804 (insert (math-format-number xval)) 844 (insert (math-format-number calc-graph-xval))
805 (if (eq (car xval) 'frac) 845 (if (eq (car calc-graph-xval) 'frac)
806 (setq xval (math-float xval))) 846 (setq calc-graph-xval (math-float calc-graph-xval)))
807 (insert (math-format-number (nth 1 xval)) 847 (insert (math-format-number (nth 1 calc-graph-xval))
808 "e" (int-to-string (nth 2 xval)))) 848 "e" (int-to-string (nth 2 calc-graph-xval))))
809 (insert " ") 849 (insert " ")
810 (if (Math-integerp yval) 850 (if (Math-integerp calc-graph-yval)
811 (insert (math-format-number yval)) 851 (insert (math-format-number calc-graph-yval))
812 (if (eq (car yval) 'frac) 852 (if (eq (car calc-graph-yval) 'frac)
813 (setq yval (math-float yval))) 853 (setq calc-graph-yval (math-float calc-graph-yval)))
814 (insert (math-format-number (nth 1 yval)) 854 (insert (math-format-number (nth 1 calc-graph-yval))
815 "e" (int-to-string (nth 2 yval)))) 855 "e" (int-to-string (nth 2 calc-graph-yval))))
816 (if zval 856 (if calc-graph-zval
817 (progn 857 (progn
818 (insert " ") 858 (insert " ")
819 (if (Math-integerp zval) 859 (if (Math-integerp calc-graph-zval)
820 (insert (math-format-number zval)) 860 (insert (math-format-number calc-graph-zval))
821 (if (eq (car zval) 'frac) 861 (if (eq (car calc-graph-zval) 'frac)
822 (setq zval (math-float zval))) 862 (setq calc-graph-zval (math-float calc-graph-zval)))
823 (insert (math-format-number (nth 1 zval)) 863 (insert (math-format-number (nth 1 calc-graph-zval))
824 "e" (int-to-string (nth 2 zval)))))) 864 "e" (int-to-string (nth 2 calc-graph-zval))))))
825 (insert "\n")) 865 (insert "\n"))
826 (and (not (equal zval '(skip))) 866 (and (not (equal calc-graph-zval '(skip)))
827 (boundp 'var-PlotRejects)
828 (eq (car-safe var-PlotRejects) 'vec) 867 (eq (car-safe var-PlotRejects) 'vec)
829 (nconc var-PlotRejects 868 (nconc var-PlotRejects
830 (list (list 'vec 869 (list (list 'vec
831 curve-num 870 calc-graph-curve-num
832 stepcount 871 calc-graph-stepcount
833 xval yval))) 872 calc-graph-xval calc-graph-yval)))
834 (calc-refresh-evaltos 'var-PlotRejects)) 873 (calc-refresh-evaltos 'var-PlotRejects))
835 (or blank 874 (or calc-graph-blank
836 (progn 875 (progn
837 (insert "\n") 876 (insert "\n")
838 (setq blank t)))))) 877 (setq calc-graph-blank t))))))
839 878
840(defun calc-temp-file-name (num) 879(defun calc-temp-file-name (num)
841 (while (<= (length calc-graph-file-cache) (1+ num)) 880 (while (<= (length calc-graph-file-cache) (1+ num))
@@ -859,9 +898,7 @@
859 (setq calc-graph-file-cache (cdr calc-graph-file-cache)))) 898 (setq calc-graph-file-cache (cdr calc-graph-file-cache))))
860 899
861(defun calc-graph-kill-hook () 900(defun calc-graph-kill-hook ()
862 (calc-graph-delete-temps) 901 (calc-graph-delete-temps))
863 (if calc-graph-prev-kill-hook
864 (funcall calc-graph-prev-kill-hook)))
865 902
866(defun calc-graph-show-tty (output) 903(defun calc-graph-show-tty (output)
867 "Default calc-gnuplot-plot-command for \"tty\" output mode. 904 "Default calc-gnuplot-plot-command for \"tty\" output mode.
@@ -870,6 +907,9 @@ This is useful for tek40xx and other graphics-terminal types."
870 nil calc-gnuplot-buffer nil 907 nil calc-gnuplot-buffer nil
871 "-c" (format "cat %s >/dev/tty; rm %s" output output))) 908 "-c" (format "cat %s >/dev/tty; rm %s" output output)))
872 909
910(defvar calc-dumb-map nil
911 "The keymap for the \"dumb\" terminal plot.")
912
873(defun calc-graph-show-dumb (&optional output) 913(defun calc-graph-show-dumb (&optional output)
874 "Default calc-gnuplot-plot-command for Pinard's \"dumb\" terminal type. 914 "Default calc-gnuplot-plot-command for Pinard's \"dumb\" terminal type.
875This \"dumb\" driver will be present in Gnuplot 3.0." 915This \"dumb\" driver will be present in Gnuplot 3.0."
@@ -882,7 +922,6 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
882 (sleep-for 1)) 922 (sleep-for 1))
883 (goto-char (point-max)) 923 (goto-char (point-max))
884 (re-search-backward "\f\\|^[ \t]+\\^$\\|G N U P L O T") 924 (re-search-backward "\f\\|^[ \t]+\\^$\\|G N U P L O T")
885 (setq found-pt (point))
886 (if (looking-at "\f") 925 (if (looking-at "\f")
887 (progn 926 (progn
888 (forward-char 1) 927 (forward-char 1)
@@ -898,7 +937,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
898 (end-of-line) 937 (end-of-line)
899 (backward-char 1) 938 (backward-char 1)
900 (recenter '(4))) 939 (recenter '(4)))
901 (or (boundp 'calc-dumb-map) 940 (or calc-dumb-map
902 (progn 941 (progn
903 (setq calc-dumb-map (make-sparse-keymap)) 942 (setq calc-dumb-map (make-sparse-keymap))
904 (define-key calc-dumb-map "\n" 'scroll-up) 943 (define-key calc-dumb-map "\n" 'scroll-up)
@@ -1097,7 +1136,8 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
1097 (or (calc-graph-find-plot nil nil) 1136 (or (calc-graph-find-plot nil nil)
1098 (error "No data points have been set!")) 1137 (error "No data points have been set!"))
1099 (let ((base (point)) 1138 (let ((base (point))
1100 start) 1139 start
1140 end)
1101 (re-search-forward "[,\n]\\|[ \t]+with") 1141 (re-search-forward "[,\n]\\|[ \t]+with")
1102 (setq end (match-beginning 0)) 1142 (setq end (match-beginning 0))
1103 (goto-char base) 1143 (goto-char base)
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index bb6699a4ac9..ee00e022553 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -263,15 +263,15 @@
263 (let ((math-parsing-fortran-vector '(end . "\000"))) 263 (let ((math-parsing-fortran-vector '(end . "\000")))
264 (prog1 264 (prog1
265 (math-read-brackets t "]") 265 (math-read-brackets t "]")
266 (setq exp-token (car math-parsing-fortran-vector) 266 (setq math-exp-token (car math-parsing-fortran-vector)
267 exp-data (cdr math-parsing-fortran-vector))))) 267 math-expr-data (cdr math-parsing-fortran-vector)))))
268 268
269(defun math-parse-fortran-vector-end (x op) 269(defun math-parse-fortran-vector-end (x op)
270 (if math-parsing-fortran-vector 270 (if math-parsing-fortran-vector
271 (progn 271 (progn
272 (setq math-parsing-fortran-vector (cons exp-token exp-data) 272 (setq math-parsing-fortran-vector (cons math-exp-token math-expr-data)
273 exp-token 'end 273 math-exp-token 'end
274 exp-data "\000") 274 math-expr-data "\000")
275 x) 275 x)
276 (throw 'syntax "Unmatched closing `/'"))) 276 (throw 'syntax "Unmatched closing `/'")))
277 277
@@ -384,15 +384,15 @@
384 384
385(defun math-parse-tex-sum (f val) 385(defun math-parse-tex-sum (f val)
386 (let (low high save) 386 (let (low high save)
387 (or (equal exp-data "_") (throw 'syntax "Expected `_'")) 387 (or (equal math-expr-data "_") (throw 'syntax "Expected `_'"))
388 (math-read-token) 388 (math-read-token)
389 (setq save exp-old-pos) 389 (setq save math-exp-old-pos)
390 (setq low (math-read-factor)) 390 (setq low (math-read-factor))
391 (or (eq (car-safe low) 'calcFunc-eq) 391 (or (eq (car-safe low) 'calcFunc-eq)
392 (progn 392 (progn
393 (setq exp-old-pos (1+ save)) 393 (setq math-exp-old-pos (1+ save))
394 (throw 'syntax "Expected equation"))) 394 (throw 'syntax "Expected equation")))
395 (or (equal exp-data "^") (throw 'syntax "Expected `^'")) 395 (or (equal math-expr-data "^") (throw 'syntax "Expected `^'"))
396 (math-read-token) 396 (math-read-token)
397 (setq high (math-read-factor)) 397 (setq high (math-read-factor))
398 (list (nth 2 f) (math-read-factor) (nth 1 low) (nth 2 low) high))) 398 (list (nth 2 f) (math-read-factor) (nth 1 low) (nth 2 low) high)))
@@ -484,31 +484,31 @@
484 484
485(defun math-parse-eqn-matrix (f sym) 485(defun math-parse-eqn-matrix (f sym)
486 (let ((vec nil)) 486 (let ((vec nil))
487 (while (assoc exp-data '(("ccol") ("lcol") ("rcol"))) 487 (while (assoc math-expr-data '(("ccol") ("lcol") ("rcol")))
488 (math-read-token) 488 (math-read-token)
489 (or (equal exp-data calc-function-open) 489 (or (equal math-expr-data calc-function-open)
490 (throw 'syntax "Expected `{'")) 490 (throw 'syntax "Expected `{'"))
491 (math-read-token) 491 (math-read-token)
492 (setq vec (cons (cons 'vec (math-read-expr-list)) vec)) 492 (setq vec (cons (cons 'vec (math-read-expr-list)) vec))
493 (or (equal exp-data calc-function-close) 493 (or (equal math-expr-data calc-function-close)
494 (throw 'syntax "Expected `}'")) 494 (throw 'syntax "Expected `}'"))
495 (math-read-token)) 495 (math-read-token))
496 (or (equal exp-data calc-function-close) 496 (or (equal math-expr-data calc-function-close)
497 (throw 'syntax "Expected `}'")) 497 (throw 'syntax "Expected `}'"))
498 (math-read-token) 498 (math-read-token)
499 (math-transpose (cons 'vec (nreverse vec))))) 499 (math-transpose (cons 'vec (nreverse vec)))))
500 500
501(defun math-parse-eqn-prime (x sym) 501(defun math-parse-eqn-prime (x sym)
502 (if (eq (car-safe x) 'var) 502 (if (eq (car-safe x) 'var)
503 (if (equal exp-data calc-function-open) 503 (if (equal math-expr-data calc-function-open)
504 (progn 504 (progn
505 (math-read-token) 505 (math-read-token)
506 (let ((args (if (or (equal exp-data calc-function-close) 506 (let ((args (if (or (equal math-expr-data calc-function-close)
507 (eq exp-token 'end)) 507 (eq math-exp-token 'end))
508 nil 508 nil
509 (math-read-expr-list)))) 509 (math-read-expr-list))))
510 (if (not (or (equal exp-data calc-function-close) 510 (if (not (or (equal math-expr-data calc-function-close)
511 (eq exp-token 'end))) 511 (eq math-exp-token 'end)))
512 (throw 'syntax "Expected `)'")) 512 (throw 'syntax "Expected `)'"))
513 (math-read-token) 513 (math-read-token)
514 (cons (intern (format "calcFunc-%s'" (nth 1 x))) args))) 514 (cons (intern (format "calcFunc-%s'" (nth 1 x))) args)))
@@ -622,10 +622,10 @@
622 622
623(defun math-read-math-subscr (x op) 623(defun math-read-math-subscr (x op)
624 (let ((idx (math-read-expr-level 0))) 624 (let ((idx (math-read-expr-level 0)))
625 (or (and (equal exp-data "]") 625 (or (and (equal math-expr-data "]")
626 (progn 626 (progn
627 (math-read-token) 627 (math-read-token)
628 (equal exp-data "]"))) 628 (equal math-expr-data "]")))
629 (throw 'syntax "Expected ']]'")) 629 (throw 'syntax "Expected ']]'"))
630 (math-read-token) 630 (math-read-token)
631 (list 'calcFunc-subscr x idx))) 631 (list 'calcFunc-subscr x idx)))
diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el
index 213b7dc4474..6ede0888319 100644
--- a/lisp/calc/calc-poly.el
+++ b/lisp/calc/calc-poly.el
@@ -1040,7 +1040,7 @@
1040 (memq (car-safe (nth 1 expr)) '(+ -)) 1040 (memq (car-safe (nth 1 expr)) '(+ -))
1041 (integerp (nth 2 expr)) 1041 (integerp (nth 2 expr))
1042 (if (> (nth 2 expr) 0) 1042 (if (> (nth 2 expr) 0)
1043 (or (and (or (> mmt-many 500000) (< mmt-many -500000)) 1043 (or (and (or (> math-mt-many 500000) (< math-mt-many -500000))
1044 (math-expand-power (nth 1 expr) (nth 2 expr) 1044 (math-expand-power (nth 1 expr) (nth 2 expr)
1045 nil t)) 1045 nil t))
1046 (list '* 1046 (list '*
diff --git a/lisp/calc/calc-rewr.el b/lisp/calc/calc-rewr.el
index 47b48bd88d8..fd361bd3eee 100644
--- a/lisp/calc/calc-rewr.el
+++ b/lisp/calc/calc-rewr.el
@@ -166,7 +166,7 @@
166 166
167 167
168 168
169(defun math-rewrite (whole-expr rules &optional mmt-many) 169(defun math-rewrite (whole-expr rules &optional math-mt-many)
170 (let ((crules (math-compile-rewrites rules)) 170 (let ((crules (math-compile-rewrites rules))
171 (heads (math-rewrite-heads whole-expr)) 171 (heads (math-rewrite-heads whole-expr))
172 (trace-buffer (get-buffer "*Trace*")) 172 (trace-buffer (get-buffer "*Trace*"))
@@ -176,20 +176,20 @@
176 (calc-line-numbering nil) 176 (calc-line-numbering nil)
177 (calc-show-selections t) 177 (calc-show-selections t)
178 (calc-why nil) 178 (calc-why nil)
179 (mmt-func (function 179 (math-mt-func (function
180 (lambda (x) 180 (lambda (x)
181 (let ((result (math-apply-rewrites x (cdr crules) 181 (let ((result (math-apply-rewrites x (cdr crules)
182 heads crules))) 182 heads crules)))
183 (if result 183 (if result
184 (progn 184 (progn
185 (if trace-buffer 185 (if trace-buffer
186 (let ((fmt (math-format-stack-value 186 (let ((fmt (math-format-stack-value
187 (list result nil nil)))) 187 (list result nil nil))))
188 (save-excursion 188 (save-excursion
189 (set-buffer trace-buffer) 189 (set-buffer trace-buffer)
190 (insert "\nrewrite to\n" fmt "\n")))) 190 (insert "\nrewrite to\n" fmt "\n"))))
191 (setq heads (math-rewrite-heads result heads t)))) 191 (setq heads (math-rewrite-heads result heads t))))
192 result))))) 192 result)))))
193 (if trace-buffer 193 (if trace-buffer
194 (let ((fmt (math-format-stack-value (list whole-expr nil nil)))) 194 (let ((fmt (math-format-stack-value (list whole-expr nil nil))))
195 (save-excursion 195 (save-excursion
@@ -197,22 +197,22 @@
197 (setq truncate-lines t) 197 (setq truncate-lines t)
198 (goto-char (point-max)) 198 (goto-char (point-max))
199 (insert "\n\nBegin rewriting\n" fmt "\n")))) 199 (insert "\n\nBegin rewriting\n" fmt "\n"))))
200 (or mmt-many (setq mmt-many (or (nth 1 (car crules)) 200 (or math-mt-many (setq math-mt-many (or (nth 1 (car crules))
201 math-rewrite-default-iters))) 201 math-rewrite-default-iters)))
202 (if (equal mmt-many '(var inf var-inf)) (setq mmt-many 1000000)) 202 (if (equal math-mt-many '(var inf var-inf)) (setq math-mt-many 1000000))
203 (if (equal mmt-many '(neg (var inf var-inf))) (setq mmt-many -1000000)) 203 (if (equal math-mt-many '(neg (var inf var-inf))) (setq math-mt-many -1000000))
204 (math-rewrite-phase (nth 3 (car crules))) 204 (math-rewrite-phase (nth 3 (car crules)))
205 (if trace-buffer 205 (if trace-buffer
206 (let ((fmt (math-format-stack-value (list whole-expr nil nil)))) 206 (let ((fmt (math-format-stack-value (list whole-expr nil nil))))
207 (save-excursion 207 (save-excursion
208 (set-buffer trace-buffer) 208 (set-buffer trace-buffer)
209 (insert "\nDone rewriting" 209 (insert "\nDone rewriting"
210 (if (= mmt-many 0) " (reached iteration limit)" "") 210 (if (= math-mt-many 0) " (reached iteration limit)" "")
211 ":\n" fmt "\n")))) 211 ":\n" fmt "\n"))))
212 whole-expr)) 212 whole-expr))
213 213
214(defun math-rewrite-phase (sched) 214(defun math-rewrite-phase (sched)
215 (while (and sched (/= mmt-many 0)) 215 (while (and sched (/= math-mt-many 0))
216 (if (listp (car sched)) 216 (if (listp (car sched))
217 (while (let ((save-expr whole-expr)) 217 (while (let ((save-expr whole-expr))
218 (math-rewrite-phase (car sched)) 218 (math-rewrite-phase (car sched))
diff --git a/lisp/calc/calc-vec.el b/lisp/calc/calc-vec.el
index 51d7450278e..a78f98ec3cc 100644
--- a/lisp/calc/calc-vec.el
+++ b/lisp/calc/calc-vec.el
@@ -1466,103 +1466,103 @@
1466(defun math-read-brackets (space-sep close) 1466(defun math-read-brackets (space-sep close)
1467 (and space-sep (setq space-sep (not (math-check-for-commas)))) 1467 (and space-sep (setq space-sep (not (math-check-for-commas))))
1468 (math-read-token) 1468 (math-read-token)
1469 (while (eq exp-token 'space) 1469 (while (eq math-exp-token 'space)
1470 (math-read-token)) 1470 (math-read-token))
1471 (if (or (equal exp-data close) 1471 (if (or (equal math-expr-data close)
1472 (eq exp-token 'end)) 1472 (eq math-exp-token 'end))
1473 (progn 1473 (progn
1474 (math-read-token) 1474 (math-read-token)
1475 '(vec)) 1475 '(vec))
1476 (let ((save-exp-pos exp-pos) 1476 (let ((save-exp-pos math-exp-pos)
1477 (save-exp-old-pos exp-old-pos) 1477 (save-exp-old-pos math-exp-old-pos)
1478 (save-exp-token exp-token) 1478 (save-exp-token math-exp-token)
1479 (save-exp-data exp-data) 1479 (save-exp-data math-expr-data)
1480 (vals (let ((exp-keep-spaces space-sep)) 1480 (vals (let ((math-exp-keep-spaces space-sep))
1481 (if (or (equal exp-data "\\dots") 1481 (if (or (equal math-expr-data "\\dots")
1482 (equal exp-data "\\ldots")) 1482 (equal math-expr-data "\\ldots"))
1483 '(vec (neg (var inf var-inf))) 1483 '(vec (neg (var inf var-inf)))
1484 (catch 'syntax (math-read-vector)))))) 1484 (catch 'syntax (math-read-vector))))))
1485 (if (stringp vals) 1485 (if (stringp vals)
1486 (if space-sep 1486 (if space-sep
1487 (let ((error-exp-pos exp-pos) 1487 (let ((error-exp-pos math-exp-pos)
1488 (error-exp-old-pos exp-old-pos) 1488 (error-exp-old-pos math-exp-old-pos)
1489 vals2) 1489 vals2)
1490 (setq exp-pos save-exp-pos 1490 (setq math-exp-pos save-exp-pos
1491 exp-old-pos save-exp-old-pos 1491 math-exp-old-pos save-exp-old-pos
1492 exp-token save-exp-token 1492 math-exp-token save-exp-token
1493 exp-data save-exp-data) 1493 math-expr-data save-exp-data)
1494 (let ((exp-keep-spaces nil)) 1494 (let ((math-exp-keep-spaces nil))
1495 (setq vals2 (catch 'syntax (math-read-vector)))) 1495 (setq vals2 (catch 'syntax (math-read-vector))))
1496 (if (and (not (stringp vals2)) 1496 (if (and (not (stringp vals2))
1497 (or (assoc exp-data '(("\\ldots") ("\\dots") (";"))) 1497 (or (assoc math-expr-data '(("\\ldots") ("\\dots") (";")))
1498 (equal exp-data close) 1498 (equal math-expr-data close)
1499 (eq exp-token 'end))) 1499 (eq math-exp-token 'end)))
1500 (setq space-sep nil 1500 (setq space-sep nil
1501 vals vals2) 1501 vals vals2)
1502 (setq exp-pos error-exp-pos 1502 (setq math-exp-pos error-exp-pos
1503 exp-old-pos error-exp-old-pos) 1503 math-exp-old-pos error-exp-old-pos)
1504 (throw 'syntax vals))) 1504 (throw 'syntax vals)))
1505 (throw 'syntax vals))) 1505 (throw 'syntax vals)))
1506 (if (or (equal exp-data "\\dots") 1506 (if (or (equal math-expr-data "\\dots")
1507 (equal exp-data "\\ldots")) 1507 (equal math-expr-data "\\ldots"))
1508 (progn 1508 (progn
1509 (math-read-token) 1509 (math-read-token)
1510 (setq vals (if (> (length vals) 2) 1510 (setq vals (if (> (length vals) 2)
1511 (cons 'calcFunc-mul (cdr vals)) (nth 1 vals))) 1511 (cons 'calcFunc-mul (cdr vals)) (nth 1 vals)))
1512 (let ((exp2 (if (or (equal exp-data close) 1512 (let ((exp2 (if (or (equal math-expr-data close)
1513 (equal exp-data ")") 1513 (equal math-expr-data ")")
1514 (eq exp-token 'end)) 1514 (eq math-exp-token 'end))
1515 '(var inf var-inf) 1515 '(var inf var-inf)
1516 (math-read-expr-level 0)))) 1516 (math-read-expr-level 0))))
1517 (setq vals 1517 (setq vals
1518 (list 'intv 1518 (list 'intv
1519 (if (equal exp-data ")") 2 3) 1519 (if (equal math-expr-data ")") 2 3)
1520 vals 1520 vals
1521 exp2))) 1521 exp2)))
1522 (if (not (or (equal exp-data close) 1522 (if (not (or (equal math-expr-data close)
1523 (equal exp-data ")") 1523 (equal math-expr-data ")")
1524 (eq exp-token 'end))) 1524 (eq math-exp-token 'end)))
1525 (throw 'syntax "Expected `]'"))) 1525 (throw 'syntax "Expected `]'")))
1526 (if (equal exp-data ";") 1526 (if (equal math-expr-data ";")
1527 (let ((exp-keep-spaces space-sep)) 1527 (let ((math-exp-keep-spaces space-sep))
1528 (setq vals (cons 'vec (math-read-matrix (list vals)))))) 1528 (setq vals (cons 'vec (math-read-matrix (list vals))))))
1529 (if (not (or (equal exp-data close) 1529 (if (not (or (equal math-expr-data close)
1530 (eq exp-token 'end))) 1530 (eq math-exp-token 'end)))
1531 (throw 'syntax "Expected `]'"))) 1531 (throw 'syntax "Expected `]'")))
1532 (or (eq exp-token 'end) 1532 (or (eq math-exp-token 'end)
1533 (math-read-token)) 1533 (math-read-token))
1534 vals))) 1534 vals)))
1535 1535
1536(defun math-check-for-commas (&optional balancing) 1536(defun math-check-for-commas (&optional balancing)
1537 (let ((count 0) 1537 (let ((count 0)
1538 (pos (1- exp-pos))) 1538 (pos (1- math-exp-pos)))
1539 (while (and (>= count 0) 1539 (while (and (>= count 0)
1540 (setq pos (string-match 1540 (setq pos (string-match
1541 (if balancing "[],[{}()<>]" "[],[{}()]") 1541 (if balancing "[],[{}()<>]" "[],[{}()]")
1542 exp-str (1+ pos))) 1542 math-exp-str (1+ pos)))
1543 (or (/= (aref exp-str pos) ?,) (> count 0) balancing)) 1543 (or (/= (aref math-exp-str pos) ?,) (> count 0) balancing))
1544 (cond ((memq (aref exp-str pos) '(?\[ ?\{ ?\( ?\<)) 1544 (cond ((memq (aref math-exp-str pos) '(?\[ ?\{ ?\( ?\<))
1545 (setq count (1+ count))) 1545 (setq count (1+ count)))
1546 ((memq (aref exp-str pos) '(?\] ?\} ?\) ?\>)) 1546 ((memq (aref math-exp-str pos) '(?\] ?\} ?\) ?\>))
1547 (setq count (1- count))))) 1547 (setq count (1- count)))))
1548 (if balancing 1548 (if balancing
1549 pos 1549 pos
1550 (and pos (= (aref exp-str pos) ?,))))) 1550 (and pos (= (aref math-exp-str pos) ?,)))))
1551 1551
1552(defun math-read-vector () 1552(defun math-read-vector ()
1553 (let* ((val (list (math-read-expr-level 0))) 1553 (let* ((val (list (math-read-expr-level 0)))
1554 (last val)) 1554 (last val))
1555 (while (progn 1555 (while (progn
1556 (while (eq exp-token 'space) 1556 (while (eq math-exp-token 'space)
1557 (math-read-token)) 1557 (math-read-token))
1558 (and (not (eq exp-token 'end)) 1558 (and (not (eq math-exp-token 'end))
1559 (not (equal exp-data ";")) 1559 (not (equal math-expr-data ";"))
1560 (not (equal exp-data close)) 1560 (not (equal math-expr-data close))
1561 (not (equal exp-data "\\dots")) 1561 (not (equal math-expr-data "\\dots"))
1562 (not (equal exp-data "\\ldots")))) 1562 (not (equal math-expr-data "\\ldots"))))
1563 (if (equal exp-data ",") 1563 (if (equal math-expr-data ",")
1564 (math-read-token)) 1564 (math-read-token))
1565 (while (eq exp-token 'space) 1565 (while (eq math-exp-token 'space)
1566 (math-read-token)) 1566 (math-read-token))
1567 (let ((rest (list (math-read-expr-level 0)))) 1567 (let ((rest (list (math-read-expr-level 0))))
1568 (setcdr last rest) 1568 (setcdr last rest)
@@ -1570,9 +1570,9 @@
1570 (cons 'vec val))) 1570 (cons 'vec val)))
1571 1571
1572(defun math-read-matrix (mat) 1572(defun math-read-matrix (mat)
1573 (while (equal exp-data ";") 1573 (while (equal math-expr-data ";")
1574 (math-read-token) 1574 (math-read-token)
1575 (while (eq exp-token 'space) 1575 (while (eq math-exp-token 'space)
1576 (math-read-token)) 1576 (math-read-token))
1577 (setq mat (nconc mat (list (math-read-vector))))) 1577 (setq mat (nconc mat (list (math-read-vector)))))
1578 mat) 1578 mat)
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 4ace5fb6780..6480b1960a5 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -654,6 +654,20 @@ If nil, selections displayed but ignored.")
654 calc-word-size 654 calc-word-size
655 calc-internal-prec)) 655 calc-internal-prec))
656 656
657(defvar calc-mode-hook nil
658 "Hook run when entering calc-mode.")
659
660(defvar calc-trail-mode-hook nil
661 "Hook run when entering calc-trail-mode.")
662
663(defvar calc-start-hook nil
664 "Hook run when calc is started.")
665
666(defvar calc-end-hook nil
667 "Hook run when calc is quit.")
668
669(defvar calc-load-hook nil
670 "Hook run when calc.el is loaded.")
657 671
658;; Verify that Calc is running on the right kind of system. 672;; Verify that Calc is running on the right kind of system.
659(defvar calc-emacs-type-lucid (not (not (string-match "Lucid" emacs-version)))) 673(defvar calc-emacs-type-lucid (not (not (string-match "Lucid" emacs-version))))
@@ -1056,9 +1070,6 @@ Notations: 3.14e6 3.14 * 10^6
1056 (progn 1070 (progn
1057 (setq calc-loaded-settings-file t) 1071 (setq calc-loaded-settings-file t)
1058 (load calc-settings-file t))) ; t = missing-ok 1072 (load calc-settings-file t))) ; t = missing-ok
1059 (if (and (eq window-system 'x) (boundp 'mouse-map))
1060 (substitute-key-definition 'x-paste-text 'calc-x-paste-text
1061 mouse-map))
1062 (let ((p command-line-args)) 1073 (let ((p command-line-args))
1063 (while p 1074 (while p
1064 (and (equal (car p) "-f") 1075 (and (equal (car p) "-f")
@@ -1069,14 +1080,6 @@ Notations: 3.14e6 3.14 * 10^6
1069 (run-hooks 'calc-mode-hook) 1080 (run-hooks 'calc-mode-hook)
1070 (calc-refresh t) 1081 (calc-refresh t)
1071 (calc-set-mode-line) 1082 (calc-set-mode-line)
1072 ;; The calc-defs variable is a relic. Use calc-define properties instead.
1073 (when (and (boundp 'calc-defs)
1074 calc-defs)
1075 (message "Evaluating calc-defs...")
1076 (calc-need-macros)
1077 (eval (cons 'progn calc-defs))
1078 (setq calc-defs nil)
1079 (calc-set-mode-line))
1080 (calc-check-defines)) 1083 (calc-check-defines))
1081 1084
1082(defvar calc-check-defines 'calc-check-defines) ; suitable for run-hooks 1085(defvar calc-check-defines 'calc-check-defines) ; suitable for run-hooks
@@ -1163,20 +1166,18 @@ commands given here will actually operate on the *Calculator* stack."
1163 (switch-to-buffer (current-buffer) t) 1166 (switch-to-buffer (current-buffer) t)
1164 (if (get-buffer-window (current-buffer)) 1167 (if (get-buffer-window (current-buffer))
1165 (select-window (get-buffer-window (current-buffer))) 1168 (select-window (get-buffer-window (current-buffer)))
1166 (if (and (boundp 'calc-window-hook) calc-window-hook) 1169 (let ((w (get-largest-window)))
1167 (run-hooks 'calc-window-hook) 1170 (if (and pop-up-windows
1168 (let ((w (get-largest-window))) 1171 (> (window-height w)
1169 (if (and pop-up-windows 1172 (+ window-min-height calc-window-height 2)))
1170 (> (window-height w) 1173 (progn
1171 (+ window-min-height calc-window-height 2))) 1174 (setq w (split-window w
1172 (progn 1175 (- (window-height w)
1173 (setq w (split-window w 1176 calc-window-height 2)
1174 (- (window-height w) 1177 nil))
1175 calc-window-height 2) 1178 (set-window-buffer w (current-buffer))
1176 nil)) 1179 (select-window w))
1177 (set-window-buffer w (current-buffer)) 1180 (pop-to-buffer (current-buffer))))))
1178 (select-window w))
1179 (pop-to-buffer (current-buffer)))))))
1180 (save-excursion 1181 (save-excursion
1181 (set-buffer (calc-trail-buffer)) 1182 (set-buffer (calc-trail-buffer))
1182 (and calc-display-trail 1183 (and calc-display-trail
@@ -1722,27 +1723,6 @@ See calc-keypad for details."
1722 (calc-refresh align))) 1723 (calc-refresh align)))
1723 (setq calc-refresh-count (1+ calc-refresh-count))) 1724 (setq calc-refresh-count (1+ calc-refresh-count)))
1724 1725
1725
1726(defun calc-x-paste-text (arg)
1727 "Move point to mouse position and insert window system cut buffer contents.
1728If mouse is pressed in Calc window, push cut buffer contents onto the stack."
1729 (x-mouse-select arg)
1730 (if (memq major-mode '(calc-mode calc-trail-mode))
1731 (progn
1732 (calc-wrapper
1733 (calc-extensions)
1734 (let* ((buf (x-get-cut-buffer))
1735 (val (math-read-exprs (calc-clean-newlines buf))))
1736 (if (eq (car-safe val) 'error)
1737 (progn
1738 (setq val (math-read-exprs buf))
1739 (if (eq (car-safe val) 'error)
1740 (error "%s in yanked data" (nth 2 val)))))
1741 (calc-enter-result 0 "Xynk" val))))
1742 (x-paste-text arg)))
1743
1744
1745
1746;;;; The Calc Trail buffer. 1726;;;; The Calc Trail buffer.
1747 1727
1748(defun calc-check-trail-aligned () 1728(defun calc-check-trail-aligned ()
@@ -1808,10 +1788,8 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
1808 (not (if flag (memq flag '(nil 0)) win))) 1788 (not (if flag (memq flag '(nil 0)) win)))
1809 (if (null win) 1789 (if (null win)
1810 (progn 1790 (progn
1811 (if (and (boundp 'calc-trail-window-hook) calc-trail-window-hook) 1791 (let ((w (split-window nil (/ (* (window-width) 2) 3) t)))
1812 (run-hooks 'calc-trail-window-hook) 1792 (set-window-buffer w calc-trail-buffer))
1813 (let ((w (split-window nil (/ (* (window-width) 2) 3) t)))
1814 (set-window-buffer w calc-trail-buffer)))
1815 (calc-wrapper 1793 (calc-wrapper
1816 (setq overlay-arrow-string calc-trail-overlay 1794 (setq overlay-arrow-string calc-trail-overlay
1817 overlay-arrow-position calc-trail-pointer) 1795 overlay-arrow-position calc-trail-pointer)
@@ -2254,62 +2232,72 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
2254(defvar math-eval-rules-cache) 2232(defvar math-eval-rules-cache)
2255(defvar math-eval-rules-cache-other) 2233(defvar math-eval-rules-cache-other)
2256;;; Reduce an object to canonical (normalized) form. [O o; Z Z] [Public] 2234;;; Reduce an object to canonical (normalized) form. [O o; Z Z] [Public]
2257(defun math-normalize (a) 2235
2236(defvar math-normalize-a)
2237(defun math-normalize (math-normalize-a)
2258 (cond 2238 (cond
2259 ((not (consp a)) 2239 ((not (consp math-normalize-a))
2260 (if (integerp a) 2240 (if (integerp math-normalize-a)
2261 (if (or (>= a 1000000) (<= a -1000000)) 2241 (if (or (>= math-normalize-a 1000000) (<= math-normalize-a -1000000))
2262 (math-bignum a) 2242 (math-bignum math-normalize-a)
2263 a) 2243 math-normalize-a)
2264 a)) 2244 math-normalize-a))
2265 ((eq (car a) 'bigpos) 2245 ((eq (car math-normalize-a) 'bigpos)
2266 (if (eq (nth (1- (length a)) a) 0) 2246 (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0)
2267 (let* ((last (setq a (copy-sequence a))) (digs a)) 2247 (let* ((last (setq math-normalize-a
2248 (copy-sequence math-normalize-a))) (digs math-normalize-a))
2268 (while (setq digs (cdr digs)) 2249 (while (setq digs (cdr digs))
2269 (or (eq (car digs) 0) (setq last digs))) 2250 (or (eq (car digs) 0) (setq last digs)))
2270 (setcdr last nil))) 2251 (setcdr last nil)))
2271 (if (cdr (cdr (cdr a))) 2252 (if (cdr (cdr (cdr math-normalize-a)))
2272 a 2253 math-normalize-a
2273 (cond 2254 (cond
2274 ((cdr (cdr a)) (+ (nth 1 a) (* (nth 2 a) 1000))) 2255 ((cdr (cdr math-normalize-a)) (+ (nth 1 math-normalize-a)
2275 ((cdr a) (nth 1 a)) 2256 (* (nth 2 math-normalize-a) 1000)))
2257 ((cdr math-normalize-a) (nth 1 math-normalize-a))
2276 (t 0)))) 2258 (t 0))))
2277 ((eq (car a) 'bigneg) 2259 ((eq (car math-normalize-a) 'bigneg)
2278 (if (eq (nth (1- (length a)) a) 0) 2260 (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0)
2279 (let* ((last (setq a (copy-sequence a))) (digs a)) 2261 (let* ((last (setq math-normalize-a (copy-sequence math-normalize-a)))
2262 (digs math-normalize-a))
2280 (while (setq digs (cdr digs)) 2263 (while (setq digs (cdr digs))
2281 (or (eq (car digs) 0) (setq last digs))) 2264 (or (eq (car digs) 0) (setq last digs)))
2282 (setcdr last nil))) 2265 (setcdr last nil)))
2283 (if (cdr (cdr (cdr a))) 2266 (if (cdr (cdr (cdr math-normalize-a)))
2284 a 2267 math-normalize-a
2285 (cond 2268 (cond
2286 ((cdr (cdr a)) (- (+ (nth 1 a) (* (nth 2 a) 1000)))) 2269 ((cdr (cdr math-normalize-a)) (- (+ (nth 1 math-normalize-a)
2287 ((cdr a) (- (nth 1 a))) 2270 (* (nth 2 math-normalize-a) 1000))))
2271 ((cdr math-normalize-a) (- (nth 1 math-normalize-a)))
2288 (t 0)))) 2272 (t 0))))
2289 ((eq (car a) 'float) 2273 ((eq (car math-normalize-a) 'float)
2290 (math-make-float (math-normalize (nth 1 a)) (nth 2 a))) 2274 (math-make-float (math-normalize (nth 1 math-normalize-a))
2291 ((or (memq (car a) '(frac cplx polar hms date mod sdev intv vec var quote 2275 (nth 2 math-normalize-a)))
2292 special-const calcFunc-if calcFunc-lambda 2276 ((or (memq (car math-normalize-a)
2293 calcFunc-quote calcFunc-condition 2277 '(frac cplx polar hms date mod sdev intv vec var quote
2294 calcFunc-evalto)) 2278 special-const calcFunc-if calcFunc-lambda
2295 (integerp (car a)) 2279 calcFunc-quote calcFunc-condition
2296 (and (consp (car a)) (not (eq (car (car a)) 'lambda)))) 2280 calcFunc-evalto))
2281 (integerp (car math-normalize-a))
2282 (and (consp (car math-normalize-a))
2283 (not (eq (car (car math-normalize-a)) 'lambda))))
2297 (calc-extensions) 2284 (calc-extensions)
2298 (math-normalize-fancy a)) 2285 (math-normalize-fancy math-normalize-a))
2299 (t 2286 (t
2300 (or (and calc-simplify-mode 2287 (or (and calc-simplify-mode
2301 (calc-extensions) 2288 (calc-extensions)
2302 (math-normalize-nonstandard)) 2289 (math-normalize-nonstandard))
2303 (let ((args (mapcar 'math-normalize (cdr a)))) 2290 (let ((args (mapcar 'math-normalize (cdr math-normalize-a))))
2304 (or (condition-case err 2291 (or (condition-case err
2305 (let ((func (assq (car a) '( ( + . math-add ) 2292 (let ((func
2306 ( - . math-sub ) 2293 (assq (car math-normalize-a) '( ( + . math-add )
2307 ( * . math-mul ) 2294 ( - . math-sub )
2308 ( / . math-div ) 2295 ( * . math-mul )
2309 ( % . math-mod ) 2296 ( / . math-div )
2310 ( ^ . math-pow ) 2297 ( % . math-mod )
2311 ( neg . math-neg ) 2298 ( ^ . math-pow )
2312 ( | . math-concat ) )))) 2299 ( neg . math-neg )
2300 ( | . math-concat ) ))))
2313 (or (and var-EvalRules 2301 (or (and var-EvalRules
2314 (progn 2302 (progn
2315 (or (eq var-EvalRules math-eval-rules-cache-tag) 2303 (or (eq var-EvalRules math-eval-rules-cache-tag)
@@ -2317,51 +2305,54 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
2317 (calc-extensions) 2305 (calc-extensions)
2318 (math-recompile-eval-rules))) 2306 (math-recompile-eval-rules)))
2319 (and (or math-eval-rules-cache-other 2307 (and (or math-eval-rules-cache-other
2320 (assq (car a) math-eval-rules-cache)) 2308 (assq (car math-normalize-a)
2309 math-eval-rules-cache))
2321 (math-apply-rewrites 2310 (math-apply-rewrites
2322 (cons (car a) args) 2311 (cons (car math-normalize-a) args)
2323 (cdr math-eval-rules-cache) 2312 (cdr math-eval-rules-cache)
2324 nil math-eval-rules-cache)))) 2313 nil math-eval-rules-cache))))
2325 (if func 2314 (if func
2326 (apply (cdr func) args) 2315 (apply (cdr func) args)
2327 (and (or (consp (car a)) 2316 (and (or (consp (car math-normalize-a))
2328 (fboundp (car a)) 2317 (fboundp (car math-normalize-a))
2329 (and (not calc-extensions-loaded) 2318 (and (not calc-extensions-loaded)
2330 (calc-extensions) 2319 (calc-extensions)
2331 (fboundp (car a)))) 2320 (fboundp (car math-normalize-a))))
2332 (apply (car a) args))))) 2321 (apply (car math-normalize-a) args)))))
2333 (wrong-number-of-arguments 2322 (wrong-number-of-arguments
2334 (calc-record-why "*Wrong number of arguments" 2323 (calc-record-why "*Wrong number of arguments"
2335 (cons (car a) args)) 2324 (cons (car math-normalize-a) args))
2336 nil) 2325 nil)
2337 (wrong-type-argument 2326 (wrong-type-argument
2338 (or calc-next-why (calc-record-why "Wrong type of argument" 2327 (or calc-next-why
2339 (cons (car a) args))) 2328 (calc-record-why "Wrong type of argument"
2329 (cons (car math-normalize-a) args)))
2340 nil) 2330 nil)
2341 (args-out-of-range 2331 (args-out-of-range
2342 (calc-record-why "*Argument out of range" (cons (car a) args)) 2332 (calc-record-why "*Argument out of range"
2333 (cons (car math-normalize-a) args))
2343 nil) 2334 nil)
2344 (inexact-result 2335 (inexact-result
2345 (calc-record-why "No exact representation for result" 2336 (calc-record-why "No exact representation for result"
2346 (cons (car a) args)) 2337 (cons (car math-normalize-a) args))
2347 nil) 2338 nil)
2348 (math-overflow 2339 (math-overflow
2349 (calc-record-why "*Floating-point overflow occurred" 2340 (calc-record-why "*Floating-point overflow occurred"
2350 (cons (car a) args)) 2341 (cons (car math-normalize-a) args))
2351 nil) 2342 nil)
2352 (math-underflow 2343 (math-underflow
2353 (calc-record-why "*Floating-point underflow occurred" 2344 (calc-record-why "*Floating-point underflow occurred"
2354 (cons (car a) args)) 2345 (cons (car math-normalize-a) args))
2355 nil) 2346 nil)
2356 (void-variable 2347 (void-variable
2357 (if (eq (nth 1 err) 'var-EvalRules) 2348 (if (eq (nth 1 err) 'var-EvalRules)
2358 (progn 2349 (progn
2359 (setq var-EvalRules nil) 2350 (setq var-EvalRules nil)
2360 (math-normalize (cons (car a) args))) 2351 (math-normalize (cons (car math-normalize-a) args)))
2361 (calc-record-why "*Variable is void" (nth 1 err))))) 2352 (calc-record-why "*Variable is void" (nth 1 err)))))
2362 (if (consp (car a)) 2353 (if (consp (car math-normalize-a))
2363 (math-dimension-error) 2354 (math-dimension-error)
2364 (cons (car a) args)))))))) 2355 (cons (car math-normalize-a) args))))))))
2365 2356
2366 2357
2367 2358
diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el
index 2a463009e58..ff23c3e5421 100644
--- a/lisp/calc/calcalg2.el
+++ b/lisp/calc/calcalg2.el
@@ -738,8 +738,12 @@
738 (setcar (cdr cur-record) 'cancelled))) 738 (setcar (cdr cur-record) 'cancelled)))
739 (math-replace-integral-parts (car expr))))))) 739 (math-replace-integral-parts (car expr)))))))
740 740
741(defvar math-linear-subst-tried t
742 "Non-nil means that a linear substitution has been tried.")
743
741(defun math-do-integral (expr) 744(defun math-do-integral (expr)
742 (let (t1 t2) 745 (let ((math-linear-subst-tried nil)
746 t1 t2)
743 (or (cond ((not (math-expr-contains expr math-integ-var)) 747 (or (cond ((not (math-expr-contains expr math-integ-var))
744 (math-mul expr math-integ-var)) 748 (math-mul expr math-integ-var))
745 ((equal expr math-integ-var) 749 ((equal expr math-integ-var)
@@ -977,9 +981,8 @@
977 981
978 ;; Integration by substitution, for various likely sub-expressions. 982 ;; Integration by substitution, for various likely sub-expressions.
979 ;; (In first pass, we look only for sub-exprs that are linear in X.) 983 ;; (In first pass, we look only for sub-exprs that are linear in X.)
980 (or (if math-enable-subst 984 (or (math-integ-try-linear-substitutions expr)
981 (math-integ-try-substitutions expr) 985 (math-integ-try-substitutions expr)
982 (math-integ-try-linear-substitutions expr))
983 986
984 ;; If function has sines and cosines, try tan(x/2) substitution. 987 ;; If function has sines and cosines, try tan(x/2) substitution.
985 (and (let ((p (setq rat-in (math-expr-rational-in expr)))) 988 (and (let ((p (setq rat-in (math-expr-rational-in expr))))
@@ -1189,6 +1192,7 @@
1189 1192
1190;;; Look for substitutions of the form u = a x + b. 1193;;; Look for substitutions of the form u = a x + b.
1191(defun math-integ-try-linear-substitutions (sub-expr) 1194(defun math-integ-try-linear-substitutions (sub-expr)
1195 (setq math-linear-subst-tried t)
1192 (and (not (Math-primp sub-expr)) 1196 (and (not (Math-primp sub-expr))
1193 (or (and (not (memq (car sub-expr) '(+ - * / neg))) 1197 (or (and (not (memq (car sub-expr) '(+ - * / neg)))
1194 (not (and (eq (car sub-expr) '^) 1198 (not (and (eq (car sub-expr) '^)
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 945119f06df..679c4b991b6 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -1974,19 +1974,20 @@ message contains an appointment, don't make a diary entry."
1974 (throw 'finished t)))) 1974 (throw 'finished t))))
1975 nil)) 1975 nil))
1976 1976
1977(defun diary-from-outlook () 1977(defun diary-from-outlook (&optional noconfirm)
1978 "Maybe snarf diary entry from current Outlook-generated message. 1978 "Maybe snarf diary entry from current Outlook-generated message.
1979Currently knows about Gnus and Rmail modes." 1979Currently knows about Gnus and Rmail modes. Unless the optional
1980 (interactive) 1980argument NOCONFIRM is non-nil (which is the case when this
1981function is called interactively), then if an entry is found the
1982user is asked to confirm its addition."
1983 (interactive "p")
1981 (let ((func (cond 1984 (let ((func (cond
1982 ((eq major-mode 'rmail-mode) 1985 ((eq major-mode 'rmail-mode)
1983 #'diary-from-outlook-rmail) 1986 #'diary-from-outlook-rmail)
1984 ((memq major-mode '(gnus-summary-mode gnus-article-mode)) 1987 ((memq major-mode '(gnus-summary-mode gnus-article-mode))
1985 #'diary-from-outlook-gnus) 1988 #'diary-from-outlook-gnus)
1986 (t (error "Don't know how to snarf in `%s'" major-mode))))) 1989 (t (error "Don't know how to snarf in `%s'" major-mode)))))
1987 (if (interactive-p) 1990 (funcall func noconfirm)))
1988 (call-interactively func)
1989 (funcall func))))
1990 1991
1991 1992
1992(defvar gnus-article-mime-handles) 1993(defvar gnus-article-mime-handles)
@@ -1996,11 +1997,14 @@ Currently knows about Gnus and Rmail modes."
1996(autoload 'gnus-narrow-to-body "gnus") 1997(autoload 'gnus-narrow-to-body "gnus")
1997(autoload 'mm-get-part "mm-decode") 1998(autoload 'mm-get-part "mm-decode")
1998 1999
1999(defun diary-from-outlook-gnus () 2000(defun diary-from-outlook-gnus (&optional noconfirm)
2000 "Maybe snarf diary entry from Outlook-generated message in Gnus. 2001 "Maybe snarf diary entry from Outlook-generated message in Gnus.
2001Add this to `gnus-article-prepare-hook' to notice appointments 2002Unless the optional argument NOCONFIRM is non-nil (which is the case when
2003this function is called interactively), then if an entry is found the
2004user is asked to confirm its addition.
2005Add this function to `gnus-article-prepare-hook' to notice appointments
2002automatically." 2006automatically."
2003 (interactive) 2007 (interactive "p")
2004 (with-current-buffer gnus-article-buffer 2008 (with-current-buffer gnus-article-buffer
2005 (let ((subject (gnus-fetch-field "subject")) 2009 (let ((subject (gnus-fetch-field "subject"))
2006 (body (if gnus-article-mime-handles 2010 (body (if gnus-article-mime-handles
@@ -2011,8 +2015,7 @@ automatically."
2011 (gnus-narrow-to-body) 2015 (gnus-narrow-to-body)
2012 (buffer-string))))) 2016 (buffer-string)))))
2013 (when (diary-from-outlook-internal t) 2017 (when (diary-from-outlook-internal t)
2014 (when (or (interactive-p) 2018 (when (or noconfirm (y-or-n-p "Snarf diary entry? "))
2015 (y-or-n-p "Snarf diary entry? "))
2016 (diary-from-outlook-internal) 2019 (diary-from-outlook-internal)
2017 (message "Diary entry added")))))) 2020 (message "Diary entry added"))))))
2018 2021
@@ -2021,9 +2024,12 @@ automatically."
2021 2024
2022(defvar rmail-buffer) 2025(defvar rmail-buffer)
2023 2026
2024(defun diary-from-outlook-rmail () 2027(defun diary-from-outlook-rmail (&optional noconfirm)
2025 "Maybe snarf diary entry from Outlook-generated message in Rmail." 2028 "Maybe snarf diary entry from Outlook-generated message in Rmail.
2026 (interactive) 2029Unless the optional argument NOCONFIRM is non-nil (which is the case when
2030this function is called interactively), then if an entry is found the
2031user is asked to confirm its addition."
2032 (interactive "p")
2027 (with-current-buffer rmail-buffer 2033 (with-current-buffer rmail-buffer
2028 (let ((subject (mail-fetch-field "subject")) 2034 (let ((subject (mail-fetch-field "subject"))
2029 (body (buffer-substring (save-excursion 2035 (body (buffer-substring (save-excursion
@@ -2031,8 +2037,7 @@ automatically."
2031 (point)) 2037 (point))
2032 (point-max)))) 2038 (point-max))))
2033 (when (diary-from-outlook-internal t) 2039 (when (diary-from-outlook-internal t)
2034 (when (or (interactive-p) 2040 (when (or noconfirm (y-or-n-p "Snarf diary entry? "))
2035 (y-or-n-p "Snarf diary entry? "))
2036 (diary-from-outlook-internal) 2041 (diary-from-outlook-internal)
2037 (message "Diary entry added")))))) 2042 (message "Diary entry added"))))))
2038 2043
diff --git a/lisp/cvs-status.el b/lisp/cvs-status.el
index 419f8567a90..324da8d3ce1 100644
--- a/lisp/cvs-status.el
+++ b/lisp/cvs-status.el
@@ -1,6 +1,6 @@
1;;; cvs-status.el --- major mode for browsing `cvs status' output -*- coding: utf-8 -*- 1;;; cvs-status.el --- major mode for browsing `cvs status' output -*- coding: utf-8 -*-
2 2
3;; Copyright (C) 1999, 2000, 03, 2004 Free Software Foundation, Inc. 3;; Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
4 4
5;; Author: Stefan Monnier <monnier@cs.yale.edu> 5;; Author: Stefan Monnier <monnier@cs.yale.edu>
6;; Keywords: pcl-cvs cvs status tree tools 6;; Keywords: pcl-cvs cvs status tree tools
@@ -31,8 +31,8 @@
31;;; Code: 31;;; Code:
32 32
33(eval-when-compile (require 'cl)) 33(eval-when-compile (require 'cl))
34(eval-when-compile (require 'pcvs))
35(require 'pcvs-util) 34(require 'pcvs-util)
35(eval-when-compile (require 'pcvs))
36 36
37;;; 37;;;
38 38
@@ -50,7 +50,7 @@
50 ("\M-p" . cvs-status-prev) 50 ("\M-p" . cvs-status-prev)
51 ("t" . cvs-status-cvstrees) 51 ("t" . cvs-status-cvstrees)
52 ("T" . cvs-status-trees) 52 ("T" . cvs-status-trees)
53 (">" . cvs-status-checkout)) 53 (">" . cvs-mode-checkout))
54 "CVS-Status' keymap." 54 "CVS-Status' keymap."
55 :group 'cvs-status 55 :group 'cvs-status
56 :inherit 'cvs-mode-map) 56 :inherit 'cvs-mode-map)
@@ -89,7 +89,7 @@
89(defconst cvs-status-font-lock-defaults 89(defconst cvs-status-font-lock-defaults
90 '(cvs-status-font-lock-keywords t nil nil nil (font-lock-multiline . t))) 90 '(cvs-status-font-lock-keywords t nil nil nil (font-lock-multiline . t)))
91 91
92 92(defvar cvs-minor-wrap-function)
93(put 'cvs-status-mode 'mode-class 'special) 93(put 'cvs-status-mode 'mode-class 'special)
94;;;###autoload 94;;;###autoload
95(define-derived-mode cvs-status-mode fundamental-mode "CVS-Status" 95(define-derived-mode cvs-status-mode fundamental-mode "CVS-Status"
@@ -108,7 +108,8 @@
108 (let* ((file (match-string 1)) 108 (let* ((file (match-string 1))
109 (cvsdir (and (re-search-backward cvs-status-dir-re nil t) 109 (cvsdir (and (re-search-backward cvs-status-dir-re nil t)
110 (match-string 1))) 110 (match-string 1)))
111 (pcldir (and (re-search-backward cvs-pcl-cvs-dirchange-re nil t) 111 (pcldir (and (if (boundp 'cvs-pcl-cvs-dirchange-re)
112 (re-search-backward cvs-pcl-cvs-dirchange-re nil t))
112 (match-string 1))) 113 (match-string 1)))
113 (dir "")) 114 (dir ""))
114 (let ((default-directory "")) 115 (let ((default-directory ""))
@@ -466,25 +467,6 @@ Optional prefix ARG chooses between two representations."
466 ;;(sit-for 0) 467 ;;(sit-for 0)
467 )))))) 468 ))))))
468 469
469(defun-cvs-mode (cvs-status-checkout . NOARGS) (dir)
470 "Run cvs-checkout against the tag under the point.
471The files are stored to DIR."
472 (interactive
473 (let* ((module (cvs-get-module))
474 (branch (cvs-prefix-get 'cvs-branch-prefix))
475 (prompt (format "CVS Checkout Directory for `%s%s': "
476 module
477 (if branch (format "(branch: %s)" branch)
478 ""))))
479 (list
480 (read-directory-name prompt
481 nil default-directory nil))))
482 (let ((modules (cvs-string->strings (cvs-get-module)))
483 (flags (cvs-add-branch-prefix
484 (cvs-flags-query 'cvs-checkout-flags "cvs checkout flags")))
485 (cvs-cvsroot (cvs-get-cvsroot)))
486 (cvs-checkout modules dir flags)))
487
488(defun cvs-tree-tags-insert (tags prev) 470(defun cvs-tree-tags-insert (tags prev)
489 (when tags 471 (when tags
490 (let* ((tag (car tags)) 472 (let* ((tag (car tags))
@@ -556,5 +538,5 @@ The files are stored to DIR."
556 538
557(provide 'cvs-status) 539(provide 'cvs-status)
558 540
559;;; arch-tag: db8b5094-d02a-473e-a476-544e89ff5ad0 541;; arch-tag: db8b5094-d02a-473e-a476-544e89ff5ad0
560;;; cvs-status.el ends here 542;;; cvs-status.el ends here
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 72ddde7c8cb..7dd6966a486 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -507,7 +507,10 @@ as well as widgets, buttons, overlays, and text properties."
507 (format "%d" (nth 1 split)) 507 (format "%d" (nth 1 split))
508 (format "%d %d" (nth 1 split) (nth 2 split))))) 508 (format "%d %d" (nth 1 split) (nth 2 split)))))
509 ("syntax" 509 ("syntax"
510 ,(let ((syntax (syntax-after pos))) 510 ,(let* ((st (if parse-sexp-lookup-properties
511 (get-char-property pos 'syntax-table)))
512 (syntax (if (consp st) st
513 (aref (or st (syntax-table)) (char-after pos)))))
511 (with-temp-buffer 514 (with-temp-buffer
512 (internal-describe-syntax-value syntax) 515 (internal-describe-syntax-value syntax)
513 (buffer-string)))) 516 (buffer-string))))
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 64e8770ffd0..55ebd662df6 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -129,7 +129,8 @@ determine where the desktop is saved."
129 (const :tag "Ask if desktop file exists, else don't save" ask-if-exists) 129 (const :tag "Ask if desktop file exists, else don't save" ask-if-exists)
130 (const :tag "Save if desktop file exists, else don't" if-exists) 130 (const :tag "Save if desktop file exists, else don't" if-exists)
131 (const :tag "Never save" nil)) 131 (const :tag "Never save" nil))
132 :group 'desktop) 132 :group 'desktop
133 :version "21.4")
133 134
134(defcustom desktop-base-file-name 135(defcustom desktop-base-file-name
135 (convert-standard-filename ".emacs.desktop") 136 (convert-standard-filename ".emacs.desktop")
@@ -142,7 +143,8 @@ determine where the desktop is saved."
142 "List of directories to search for the desktop file. 143 "List of directories to search for the desktop file.
143The base name of the file is specified in `desktop-base-file-name'." 144The base name of the file is specified in `desktop-base-file-name'."
144 :type '(repeat directory) 145 :type '(repeat directory)
145 :group 'desktop) 146 :group 'desktop
147 :version "21.4")
146 148
147(defcustom desktop-missing-file-warning nil 149(defcustom desktop-missing-file-warning nil
148 "*If non-nil then `desktop-read' asks if a non-existent file should be recreated. 150 "*If non-nil then `desktop-read' asks if a non-existent file should be recreated.
@@ -151,19 +153,22 @@ Also pause for a moment to display message about errors signaled in
151 153
152If nil, just print error messages in the message buffer." 154If nil, just print error messages in the message buffer."
153 :type 'boolean 155 :type 'boolean
154 :group 'desktop) 156 :group 'desktop
157 :version "21.4")
155 158
156(defcustom desktop-no-desktop-file-hook nil 159(defcustom desktop-no-desktop-file-hook nil
157 "Normal hook run when `desktop-read' can't find a desktop file. 160 "Normal hook run when `desktop-read' can't find a desktop file.
158May e.g. be used to show a dired buffer." 161May e.g. be used to show a dired buffer."
159 :type 'hook 162 :type 'hook
160 :group 'desktop) 163 :group 'desktop
164 :version "21.4")
161 165
162(defcustom desktop-after-read-hook nil 166(defcustom desktop-after-read-hook nil
163 "Normal hook run after a successful `desktop-read'. 167 "Normal hook run after a successful `desktop-read'.
164May e.g. be used to show a buffer list." 168May e.g. be used to show a buffer list."
165 :type 'hook 169 :type 'hook
166 :group 'desktop) 170 :group 'desktop
171 :version "21.4")
167 172
168(defcustom desktop-save-hook nil 173(defcustom desktop-save-hook nil
169 "Normal hook run before the desktop is saved in a desktop file. 174 "Normal hook run before the desktop is saved in a desktop file.
@@ -198,14 +203,16 @@ An element may be variable name (a symbol) or a cons cell of the form
198\(VAR . FORM). Symbols are set to nil and for cons cells VAR is set 203\(VAR . FORM). Symbols are set to nil and for cons cells VAR is set
199to the value obtained by evaluateing FORM." 204to the value obtained by evaluateing FORM."
200 :type '(repeat (restricted-sexp :match-alternatives (symbolp consp))) 205 :type '(repeat (restricted-sexp :match-alternatives (symbolp consp)))
201 :group 'desktop) 206 :group 'desktop
207 :version "21.4")
202 208
203(defcustom desktop-clear-preserve-buffers-regexp 209(defcustom desktop-clear-preserve-buffers-regexp
204 "^\\(\\*scratch\\*\\|\\*Messages\\*\\|\\*tramp/.+\\*\\)$" 210 "^\\(\\*scratch\\*\\|\\*Messages\\*\\|\\*tramp/.+\\*\\)$"
205 "Regexp identifying buffers that `desktop-clear' should not delete. 211 "Regexp identifying buffers that `desktop-clear' should not delete.
206See also `desktop-clear-preserve-buffers'." 212See also `desktop-clear-preserve-buffers'."
207 :type 'regexp 213 :type 'regexp
208 :group 'desktop) 214 :group 'desktop
215 :version "21.4")
209 216
210(defcustom desktop-clear-preserve-buffers nil 217(defcustom desktop-clear-preserve-buffers nil
211 "*List of buffer names that `desktop-clear' should not delete. 218 "*List of buffer names that `desktop-clear' should not delete.
@@ -257,7 +264,8 @@ Possible values are:
257 tilde -- Relative to ~. 264 tilde -- Relative to ~.
258 local -- Relative to directory of desktop file." 265 local -- Relative to directory of desktop file."
259 :type '(choice (const absolute) (const tilde) (const local)) 266 :type '(choice (const absolute) (const tilde) (const local))
260 :group 'desktop) 267 :group 'desktop
268 :version "21.4")
261 269
262;;;###autoload 270;;;###autoload
263(defvar desktop-save-buffer nil 271(defvar desktop-save-buffer nil
@@ -628,7 +636,7 @@ See also `desktop-base-file-name'."
628 ";; Desktop file format version " desktop-file-version "\n" 636 ";; Desktop file format version " desktop-file-version "\n"
629 ";; Emacs version " emacs-version "\n\n" 637 ";; Emacs version " emacs-version "\n\n"
630 ";; Global section:\n") 638 ";; Global section:\n")
631 (mapcar (function desktop-outvar) desktop-globals-to-save) 639 (mapc (function desktop-outvar) desktop-globals-to-save)
632 (if (memq 'kill-ring desktop-globals-to-save) 640 (if (memq 'kill-ring desktop-globals-to-save)
633 (insert 641 (insert
634 "(setq kill-ring-yank-pointer (nthcdr " 642 "(setq kill-ring-yank-pointer (nthcdr "
@@ -636,15 +644,15 @@ See also `desktop-base-file-name'."
636 " kill-ring))\n")) 644 " kill-ring))\n"))
637 645
638 (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n") 646 (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n")
639 (mapcar #'(lambda (l) 647 (mapc #'(lambda (l)
640 (if (apply 'desktop-save-buffer-p l) 648 (if (apply 'desktop-save-buffer-p l)
641 (progn 649 (progn
642 (insert "(desktop-create-buffer " desktop-file-version) 650 (insert "(desktop-create-buffer " desktop-file-version)
643 (mapcar #'(lambda (e) 651 (mapc #'(lambda (e)
644 (insert "\n " (desktop-value-to-string e))) 652 (insert "\n " (desktop-value-to-string e)))
645 l) 653 l)
646 (insert ")\n\n")))) 654 (insert ")\n\n"))))
647 info) 655 info)
648 (setq default-directory dirname) 656 (setq default-directory dirname)
649 (when (file-exists-p filename) (delete-file filename)) 657 (when (file-exists-p filename) (delete-file filename))
650 (let ((coding-system-for-write 'emacs-mule)) 658 (let ((coding-system-for-write 'emacs-mule))
@@ -865,9 +873,9 @@ directory DIRNAME."
865 ((equal '(nil) desktop-buffer-minor-modes) ; backwards compatible 873 ((equal '(nil) desktop-buffer-minor-modes) ; backwards compatible
866 (auto-fill-mode 0)) 874 (auto-fill-mode 0))
867 (t 875 (t
868 (mapcar #'(lambda (minor-mode) 876 (mapc #'(lambda (minor-mode)
869 (when (functionp minor-mode) (funcall minor-mode 1))) 877 (when (functionp minor-mode) (funcall minor-mode 1)))
870 desktop-buffer-minor-modes))) 878 desktop-buffer-minor-modes)))
871 ;; Even though point and mark are non-nil when written by `desktop-save' 879 ;; Even though point and mark are non-nil when written by `desktop-save'
872 ;; they may be modified by handlers wanting to set point or mark themselves. 880 ;; they may be modified by handlers wanting to set point or mark themselves.
873 (when desktop-buffer-point 881 (when desktop-buffer-point
diff --git a/lisp/ebuff-menu.el b/lisp/ebuff-menu.el
index bed46c71618..2bfbace4c4b 100644
--- a/lisp/ebuff-menu.el
+++ b/lisp/ebuff-menu.el
@@ -38,9 +38,12 @@
38 38
39(defvar electric-buffer-menu-mode-map nil) 39(defvar electric-buffer-menu-mode-map nil)
40 40
41(defvar electric-buffer-menu-mode-hook nil
42 "Normal hook run by `electric-buffer-list'.")
43
41;;;###autoload 44;;;###autoload
42(defun electric-buffer-list (arg) 45(defun electric-buffer-list (arg)
43 "Pops up a buffer describing the set of Emacs buffers. 46 "Pop up a buffer describing the set of Emacs buffers.
44Vaguely like ITS lunar select buffer; combining typeoutoid buffer 47Vaguely like ITS lunar select buffer; combining typeoutoid buffer
45listing with menuoid buffer selection. 48listing with menuoid buffer selection.
46 49
@@ -50,9 +53,9 @@ window, marking buffers to be selected, saved or deleted.
50 53
51To exit and select a new buffer, type a space when the cursor is on 54To exit and select a new buffer, type a space when the cursor is on
52the appropriate line of the buffer-list window. Other commands are 55the appropriate line of the buffer-list window. Other commands are
53much like those of buffer-menu-mode. 56much like those of `Buffer-menu-mode'.
54 57
55Calls value of `electric-buffer-menu-mode-hook' on entry if non-nil. 58Run hooks in `electric-buffer-menu-mode-hook' on entry.
56 59
57\\{electric-buffer-menu-mode-map}" 60\\{electric-buffer-menu-mode-map}"
58 (interactive "P") 61 (interactive "P")
@@ -144,8 +147,8 @@ Letters do not insert themselves; instead, they are commands.
144 147
145\\{electric-buffer-menu-mode-map} 148\\{electric-buffer-menu-mode-map}
146 149
147Entry to this mode via command electric-buffer-list calls the value of 150Entry to this mode via command `electric-buffer-list' calls the value of
148electric-buffer-menu-mode-hook if it is non-nil." 151`electric-buffer-menu-mode-hook'."
149 (kill-all-local-variables) 152 (kill-all-local-variables)
150 (use-local-map electric-buffer-menu-mode-map) 153 (use-local-map electric-buffer-menu-mode-map)
151 (setq mode-name "Electric Buffer Menu") 154 (setq mode-name "Electric Buffer Menu")
@@ -223,8 +226,8 @@ electric-buffer-menu-mode-hook if it is non-nil."
223 226
224(defun Electric-buffer-menu-select () 227(defun Electric-buffer-menu-select ()
225 "Leave Electric Buffer Menu, selecting buffers and executing changes. 228 "Leave Electric Buffer Menu, selecting buffers and executing changes.
226Saves buffers marked \"S\". Deletes buffers marked \"K\". 229Save buffers marked \"S\". Delete buffers marked \"K\".
227Selects buffer at point and displays buffers marked \">\" in other windows." 230Select buffer at point and display buffers marked \">\" in other windows."
228 (interactive) 231 (interactive)
229 (throw 'electric-buffer-menu-select (point))) 232 (throw 'electric-buffer-menu-select (point)))
230 233
@@ -237,7 +240,7 @@ Selects buffer at point and displays buffers marked \">\" in other windows."
237 240
238(defun Electric-buffer-menu-quit () 241(defun Electric-buffer-menu-quit ()
239 "Leave Electric Buffer Menu, restoring previous window configuration. 242 "Leave Electric Buffer Menu, restoring previous window configuration.
240Does not execute select, save, or delete commands." 243Skip execution of select, save, and delete commands."
241 (interactive) 244 (interactive)
242 (throw 'electric-buffer-menu-select nil)) 245 (throw 'electric-buffer-menu-select nil))
243 246
@@ -258,7 +261,7 @@ Type \\[Electric-buffer-menu-quit] to exit, \
258 261
259(defun Electric-buffer-menu-mode-view-buffer () 262(defun Electric-buffer-menu-mode-view-buffer ()
260 "View buffer on current line in Electric Buffer Menu. 263 "View buffer on current line in Electric Buffer Menu.
261Returns to Electric Buffer Menu when done." 264Return to Electric Buffer Menu when done."
262 (interactive) 265 (interactive)
263 (let ((bufnam (Buffer-menu-buffer nil))) 266 (let ((bufnam (Buffer-menu-buffer nil)))
264 (if bufnam 267 (if bufnam
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index e00bebc91d5..856a31551df 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1,6 +1,7 @@
1;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler 1;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler
2 2
3;; Copyright (c) 1991,1994,2000,01,02,2004 Free Software Foundation, Inc. 3;; Copyright (c) 1991, 1994, 2000, 2001, 2002, 2004
4;; Free Software Foundation, Inc.
4 5
5;; Author: Jamie Zawinski <jwz@lucid.com> 6;; Author: Jamie Zawinski <jwz@lucid.com>
6;; Hallvard Furuseth <hbf@ulrik.uio.no> 7;; Hallvard Furuseth <hbf@ulrik.uio.no>
@@ -266,7 +267,7 @@
266 (cdr (assq name byte-compile-function-environment))))) 267 (cdr (assq name byte-compile-function-environment)))))
267 (if (and (consp fn) (eq (car fn) 'autoload)) 268 (if (and (consp fn) (eq (car fn) 'autoload))
268 (error "File `%s' didn't define `%s'" (nth 1 fn) name)) 269 (error "File `%s' didn't define `%s'" (nth 1 fn) name))
269 (if (symbolp fn) 270 (if (and (symbolp fn) (not (eq fn t)))
270 (byte-compile-inline-expand (cons fn (cdr form))) 271 (byte-compile-inline-expand (cons fn (cdr form)))
271 (if (byte-code-function-p fn) 272 (if (byte-code-function-p fn)
272 (let (string) 273 (let (string)
@@ -2032,5 +2033,5 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
2032 byte-optimize-lapcode)))) 2033 byte-optimize-lapcode))))
2033 nil) 2034 nil)
2034 2035
2035;;; arch-tag: 0f14076b-737e-4bef-aae6-908826ec1ff1 2036;; arch-tag: 0f14076b-737e-4bef-aae6-908826ec1ff1
2036;;; byte-opt.el ends here 2037;;; byte-opt.el ends here
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2116cc33b34..ee29039e05e 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1,7 +1,7 @@
1;;; bytecomp.el --- compilation of Lisp code into byte code 1;;; bytecomp.el --- compilation of Lisp code into byte code
2 2
3;; Copyright (C) 1985,86,87,92,94,1998,2000,01,02,03,2004 3;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1998, 2000, 2001, 2002,
4;; Free Software Foundation, Inc. 4;; 2003, 2004 Free Software Foundation, Inc.
5 5
6;; Author: Jamie Zawinski <jwz@lucid.com> 6;; Author: Jamie Zawinski <jwz@lucid.com>
7;; Hallvard Furuseth <hbf@ulrik.uio.no> 7;; Hallvard Furuseth <hbf@ulrik.uio.no>
@@ -447,7 +447,9 @@ Each element looks like (MACRONAME . DEFINITION). It is
447 "Alist of functions defined in the file being compiled. 447 "Alist of functions defined in the file being compiled.
448This is so we can inline them when necessary. 448This is so we can inline them when necessary.
449Each element looks like (FUNCTIONNAME . DEFINITION). It is 449Each element looks like (FUNCTIONNAME . DEFINITION). It is
450\(FUNCTIONNAME . nil) when a function is redefined as a macro.") 450\(FUNCTIONNAME . nil) when a function is redefined as a macro.
451It is \(FUNCTIONNAME . t) when all we know is that it was defined,
452and we don't know the definition.")
451 453
452(defvar byte-compile-unresolved-functions nil 454(defvar byte-compile-unresolved-functions nil
453 "Alist of undefined functions to which calls have been compiled. 455 "Alist of undefined functions to which calls have been compiled.
@@ -1103,6 +1105,10 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1103 1105
1104;;; sanity-checking arglists 1106;;; sanity-checking arglists
1105 1107
1108;; If a function has an entry saying (FUNCTION . t).
1109;; that means we know it is defined but we don't know how.
1110;; If a function has an entry saying (FUNCTION . nil),
1111;; that means treat it as not defined.
1106(defun byte-compile-fdefinition (name macro-p) 1112(defun byte-compile-fdefinition (name macro-p)
1107 (let* ((list (if macro-p 1113 (let* ((list (if macro-p
1108 byte-compile-macro-environment 1114 byte-compile-macro-environment
@@ -1168,7 +1174,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1168(defun byte-compile-callargs-warn (form) 1174(defun byte-compile-callargs-warn (form)
1169 (let* ((def (or (byte-compile-fdefinition (car form) nil) 1175 (let* ((def (or (byte-compile-fdefinition (car form) nil)
1170 (byte-compile-fdefinition (car form) t))) 1176 (byte-compile-fdefinition (car form) t)))
1171 (sig (if def 1177 (sig (if (and def (not (eq def t)))
1172 (byte-compile-arglist-signature 1178 (byte-compile-arglist-signature
1173 (if (eq 'lambda (car-safe def)) 1179 (if (eq 'lambda (car-safe def))
1174 (nth 1 def) 1180 (nth 1 def)
@@ -1198,7 +1204,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1198 (byte-compile-format-warn form) 1204 (byte-compile-format-warn form)
1199 ;; Check to see if the function will be available at runtime 1205 ;; Check to see if the function will be available at runtime
1200 ;; and/or remember its arity if it's unknown. 1206 ;; and/or remember its arity if it's unknown.
1201 (or (and (or sig (fboundp (car form))) ; might be a subr or autoload. 1207 (or (and (or def (fboundp (car form))) ; might be a subr or autoload.
1202 (not (memq (car form) byte-compile-noruntime-functions))) 1208 (not (memq (car form) byte-compile-noruntime-functions)))
1203 (eq (car form) byte-compile-current-form) ; ## this doesn't work 1209 (eq (car form) byte-compile-current-form) ; ## this doesn't work
1204 ; with recursion. 1210 ; with recursion.
@@ -1209,9 +1215,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1209 (if cons 1215 (if cons
1210 (or (memq n (cdr cons)) 1216 (or (memq n (cdr cons))
1211 (setcdr cons (cons n (cdr cons)))) 1217 (setcdr cons (cons n (cdr cons))))
1212 (setq byte-compile-unresolved-functions 1218 (push (list (car form) n)
1213 (cons (list (car form) n) 1219 byte-compile-unresolved-functions))))))
1214 byte-compile-unresolved-functions)))))))
1215 1220
1216(defun byte-compile-format-warn (form) 1221(defun byte-compile-format-warn (form)
1217 "Warn if FORM is `format'-like with inconsistent args. 1222 "Warn if FORM is `format'-like with inconsistent args.
@@ -1243,7 +1248,7 @@ extra args."
1243;; number of arguments. 1248;; number of arguments.
1244(defun byte-compile-arglist-warn (form macrop) 1249(defun byte-compile-arglist-warn (form macrop)
1245 (let ((old (byte-compile-fdefinition (nth 1 form) macrop))) 1250 (let ((old (byte-compile-fdefinition (nth 1 form) macrop)))
1246 (if old 1251 (if (and old (not (eq old t)))
1247 (let ((sig1 (byte-compile-arglist-signature 1252 (let ((sig1 (byte-compile-arglist-signature
1248 (if (eq 'lambda (car-safe old)) 1253 (if (eq 'lambda (car-safe old))
1249 (nth 1 old) 1254 (nth 1 old)
@@ -2123,9 +2128,9 @@ list that represents a doc string reference.
2123 (eq (car (nth 1 form)) 'quote) 2128 (eq (car (nth 1 form)) 'quote)
2124 (consp (cdr (nth 1 form))) 2129 (consp (cdr (nth 1 form)))
2125 (symbolp (nth 1 (nth 1 form)))) 2130 (symbolp (nth 1 (nth 1 form))))
2126 (add-to-list 'byte-compile-function-environment 2131 (push (cons (nth 1 (nth 1 form))
2127 (cons (nth 1 (nth 1 form)) 2132 (cons 'autoload (cdr (cdr form))))
2128 (cons 'autoload (cdr (cdr form)))))) 2133 byte-compile-function-environment))
2129 (if (stringp (nth 3 form)) 2134 (if (stringp (nth 3 form))
2130 form 2135 form
2131 ;; No doc string, so we can compile this as a normal form. 2136 ;; No doc string, so we can compile this as a normal form.
@@ -3608,7 +3613,6 @@ being undefined will be suppressed."
3608(byte-defop-compiler-1 defconst byte-compile-defvar) 3613(byte-defop-compiler-1 defconst byte-compile-defvar)
3609(byte-defop-compiler-1 autoload) 3614(byte-defop-compiler-1 autoload)
3610(byte-defop-compiler-1 lambda byte-compile-lambda-form) 3615(byte-defop-compiler-1 lambda byte-compile-lambda-form)
3611(byte-defop-compiler-1 defalias)
3612 3616
3613(defun byte-compile-defun (form) 3617(defun byte-compile-defun (form)
3614 ;; This is not used for file-level defuns with doc strings. 3618 ;; This is not used for file-level defuns with doc strings.
@@ -3710,22 +3714,22 @@ being undefined will be suppressed."
3710 (error "`lambda' used as function name is invalid")) 3714 (error "`lambda' used as function name is invalid"))
3711 3715
3712;; Compile normally, but deal with warnings for the function being defined. 3716;; Compile normally, but deal with warnings for the function being defined.
3713(defun byte-compile-defalias (form) 3717(put 'defalias 'byte-hunk-handler 'byte-compile-file-form-defalias)
3718(defun byte-compile-file-form-defalias (form)
3714 (if (and (consp (cdr form)) (consp (nth 1 form)) 3719 (if (and (consp (cdr form)) (consp (nth 1 form))
3715 (eq (car (nth 1 form)) 'quote) 3720 (eq (car (nth 1 form)) 'quote)
3716 (consp (cdr (nth 1 form))) 3721 (consp (cdr (nth 1 form)))
3717 (symbolp (nth 1 (nth 1 form))) 3722 (symbolp (nth 1 (nth 1 form))))
3718 (consp (nthcdr 2 form)) 3723 (let ((constant
3719 (consp (nth 2 form)) 3724 (and (consp (nthcdr 2 form))
3720 (eq (car (nth 2 form)) 'quote) 3725 (consp (nth 2 form))
3721 (consp (cdr (nth 2 form))) 3726 (eq (car (nth 2 form)) 'quote)
3722 (symbolp (nth 1 (nth 2 form)))) 3727 (consp (cdr (nth 2 form)))
3723 (progn 3728 (symbolp (nth 1 (nth 2 form))))))
3724 (byte-compile-defalias-warn (nth 1 (nth 1 form))) 3729 (byte-compile-defalias-warn (nth 1 (nth 1 form)))
3725 (setq byte-compile-function-environment 3730 (push (cons (nth 1 (nth 1 form))
3726 (cons (cons (nth 1 (nth 1 form)) 3731 (if constant (nth 1 (nth 2 form)) t))
3727 (nth 1 (nth 2 form))) 3732 byte-compile-function-environment)))
3728 byte-compile-function-environment))))
3729 (byte-compile-normal-call form)) 3733 (byte-compile-normal-call form))
3730 3734
3731;; Turn off warnings about prior calls to the function being defalias'd. 3735;; Turn off warnings about prior calls to the function being defalias'd.
@@ -3928,7 +3932,7 @@ invoked interactively."
3928 (while rest 3932 (while rest
3929 (or (nth 1 (car rest)) 3933 (or (nth 1 (car rest))
3930 (null (setq f (car (car rest)))) 3934 (null (setq f (car (car rest))))
3931 (byte-compile-fdefinition f t) 3935 (functionp (byte-compile-fdefinition f t))
3932 (commandp (byte-compile-fdefinition f nil)) 3936 (commandp (byte-compile-fdefinition f nil))
3933 (setq uncalled (cons f uncalled))) 3937 (setq uncalled (cons f uncalled)))
3934 (setq rest (cdr rest))) 3938 (setq rest (cdr rest)))
@@ -4110,5 +4114,5 @@ For example, invoke `emacs -batch -f batch-byte-recompile-directory .'."
4110 4114
4111(run-hooks 'bytecomp-load-hook) 4115(run-hooks 'bytecomp-load-hook)
4112 4116
4113;;; arch-tag: 9c97b0f0-8745-4571-bfc3-8dceb677292a 4117;; arch-tag: 9c97b0f0-8745-4571-bfc3-8dceb677292a
4114;;; bytecomp.el ends here 4118;;; bytecomp.el ends here
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 7b18756fd7e..b0f3b9b9d3e 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -42,25 +42,7 @@ menus, turn this variable off, otherwise it is probably better to keep it on."
42 :version "20.3") 42 :version "20.3")
43 43
44(defsubst easy-menu-intern (s) 44(defsubst easy-menu-intern (s)
45 (if (stringp s) 45 (if (stringp s) (intern s) s))
46 (let ((copy (copy-sequence s))
47 (pos 0)
48 found)
49 ;; For each letter that starts a word, flip its case.
50 ;; This way, the usual convention for menu strings (capitalized)
51 ;; corresponds to the usual convention for menu item event types
52 ;; (all lower case). It's a 1-1 mapping so causes no conflicts.
53 (while (setq found (string-match "\\<\\sw" copy pos))
54 (setq pos (match-end 0))
55 (unless (= (upcase (aref copy found))
56 (downcase (aref copy found)))
57 (aset copy found
58 (if (= (upcase (aref copy found))
59 (aref copy found))
60 (downcase (aref copy found))
61 (upcase (aref copy found))))))
62 (intern copy))
63 s))
64 46
65;;;###autoload 47;;;###autoload
66(put 'easy-menu-define 'lisp-indent-function 'defun) 48(put 'easy-menu-define 'lisp-indent-function 'defun)
@@ -396,6 +378,7 @@ otherwise put the new binding last in MENU.
396BEFORE can be either a string (menu item name) or a symbol 378BEFORE can be either a string (menu item name) or a symbol
397\(the fake function key for the menu item). 379\(the fake function key for the menu item).
398KEY does not have to be a symbol, and comparison is done with equal." 380KEY does not have to be a symbol, and comparison is done with equal."
381 (if (symbolp menu) (setq menu (indirect-function menu)))
399 (let ((inserted (null item)) ; Fake already inserted. 382 (let ((inserted (null item)) ; Fake already inserted.
400 tail done) 383 tail done)
401 (while (not done) 384 (while (not done)
@@ -437,8 +420,7 @@ ITEM should be a keymap binding of the form (KEY . MENU-ITEM)."
437 (error nil)) ;`item' might not be a proper list. 420 (error nil)) ;`item' might not be a proper list.
438 ;; Also check the string version of the symbol name, 421 ;; Also check the string version of the symbol name,
439 ;; for backwards compatibility. 422 ;; for backwards compatibility.
440 (eq (car-safe item) (intern name)) 423 (eq (car-safe item) (intern name)))))))
441 (eq (car-safe item) (easy-menu-intern name)))))))
442 424
443(defun easy-menu-always-true-p (x) 425(defun easy-menu-always-true-p (x)
444 "Return true if form X never evaluates to nil." 426 "Return true if form X never evaluates to nil."
@@ -541,15 +523,10 @@ earlier by `easy-menu-define' or `easy-menu-create-menu'."
541 (easy-menu-define-key map (easy-menu-intern (car item)) 523 (easy-menu-define-key map (easy-menu-intern (car item))
542 (cdr item) before) 524 (cdr item) before)
543 (if (or (keymapp item) 525 (if (or (keymapp item)
544 (and (symbolp item) (keymapp (symbol-value item)))) 526 (and (symbolp item) (keymapp (symbol-value item))
527 (setq item (symbol-value item))))
545 ;; Item is a keymap, find the prompt string and use as item name. 528 ;; Item is a keymap, find the prompt string and use as item name.
546 (let ((tail (easy-menu-get-map item nil)) name) 529 (setq item (cons (keymap-prompt item) item)))
547 (if (not (keymapp item)) (setq item tail))
548 (while (and (null name) (consp (setq tail (cdr tail)))
549 (not (keymapp tail)))
550 (if (stringp (car tail)) (setq name (car tail)) ; Got a name.
551 (setq tail (cdr tail))))
552 (setq item (cons name item))))
553 (easy-menu-do-add-item map item before))) 530 (easy-menu-do-add-item map item before)))
554 531
555(defun easy-menu-item-present-p (map path name) 532(defun easy-menu-item-present-p (map path name)
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index d701db9e9b6..82ce6f404f7 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -564,7 +564,6 @@ displayed."
564 (generate-new-buffer elp-results-buffer)))) 564 (generate-new-buffer elp-results-buffer))))
565 (set-buffer resultsbuf) 565 (set-buffer resultsbuf)
566 (erase-buffer) 566 (erase-buffer)
567 (beginning-of-buffer)
568 ;; get the length of the longest function name being profiled 567 ;; get the length of the longest function name being profiled
569 (let* ((longest 0) 568 (let* ((longest 0)
570 (title "Function Name") 569 (title "Function Name")
diff --git a/lisp/files.el b/lisp/files.el
index 75d9965133c..d0f3b47f2b5 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1751,6 +1751,30 @@ in that case, this function acts as if `enable-local-variables' were t."
1751 ("BROWSE\\'" . ebrowse-tree-mode) 1751 ("BROWSE\\'" . ebrowse-tree-mode)
1752 ("\\.ebrowse\\'" . ebrowse-tree-mode) 1752 ("\\.ebrowse\\'" . ebrowse-tree-mode)
1753 ("#\\*mail\\*" . mail-mode) 1753 ("#\\*mail\\*" . mail-mode)
1754 ("\\.g\\'" . antlr-mode)
1755 ("\\.ses\\'" . ses-mode)
1756 ("\\.\\(soa\\|zone\\)\\'" . dns-mode)
1757 ("\\.docbook\\'" . sgml-mode)
1758 ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode)
1759 ;; Windows candidates may be opened case sensitively on Unix
1760 ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . conf-mode)
1761 ("\\.\\(?:desktop\\|la\\)\\'" . conf-unix-mode)
1762 ("java.+\\.conf\\'" . conf-javaprop-mode)
1763 ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode)
1764 ;; *.cf, *.cfg, *.conf, *.config[.local|.de_DE.UTF8|...], */config
1765 ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-mode)
1766 ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|permissions\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
1767 ("\\`/etc/\\(?:aliases\\|hosts\\..+\\|ksysguarddrc\\|opera6rc\\)\\'" . conf-mode)
1768 ;; either user's dot-files or under /etc or some such
1769 ("/\\.?\\(?:gnokiirc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-mode)
1770 ;; alas not all ~/.*rc files are like this
1771 ("/\\.\\(?:enigma\\|gltron\\|hxplayer\\|net\\|neverball\\|qt/.+\\|realplayer\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-mode)
1772 ("/\\.\\(?:gdbtkinit\\|grip\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-mode)
1773 ("/\\.?X\\(?:default\\|resource\\|re\\)s\\>" . conf-xdefaults-mode)
1774 ("/X11.+app-defaults/" . conf-xdefaults-mode)
1775 ("/X11.+locale/.+/Compose\\'" . conf-colon-mode)
1776 ;; this contains everything twice, with space and with colon :-(
1777 ("/X11.+locale/compose\\.dir\\'" . conf-javaprop-mode)
1754 ;; Get rid of any trailing .n.m and try again. 1778 ;; Get rid of any trailing .n.m and try again.
1755 ;; This is for files saved by cvs-merge that look like .#<file>.<rev> 1779 ;; This is for files saved by cvs-merge that look like .#<file>.<rev>
1756 ;; or .#<file>.<rev>-<rev> or VC's <file>.~<rev>~. 1780 ;; or .#<file>.<rev>-<rev> or VC's <file>.~<rev>~.
@@ -1761,11 +1785,7 @@ in that case, this function acts as if `enable-local-variables' were t."
1761 ;; for the sake of ChangeLog.1, etc. 1785 ;; for the sake of ChangeLog.1, etc.
1762 ;; and after the .scm.[0-9] and CVS' <file>.<rev> patterns too. 1786 ;; and after the .scm.[0-9] and CVS' <file>.<rev> patterns too.
1763 ("\\.[1-9]\\'" . nroff-mode) 1787 ("\\.[1-9]\\'" . nroff-mode)
1764 ("\\.g\\'" . antlr-mode) 1788 ("\\.\\(?:orig\\|in\\|[bB][aA][kK]\\)\\'" nil t)))
1765 ("\\.ses\\'" . ses-mode)
1766 ("\\.orig\\'" nil t) ; from patch
1767 ("\\.\\(soa\\|zone\\)\\'" . dns-mode)
1768 ("\\.in\\'" nil t)))
1769 "Alist of filename patterns vs corresponding major mode functions. 1789 "Alist of filename patterns vs corresponding major mode functions.
1770Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL). 1790Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
1771\(NON-NIL stands for anything that is not nil; the value does not matter.) 1791\(NON-NIL stands for anything that is not nil; the value does not matter.)
@@ -1846,26 +1866,32 @@ regular expression. The mode is then determined as the mode associated
1846with that interpreter in `interpreter-mode-alist'.") 1866with that interpreter in `interpreter-mode-alist'.")
1847 1867
1848(defvar magic-mode-alist 1868(defvar magic-mode-alist
1849 '(;; The < comes before the groups (but the first) to reduce backtracking. 1869 `(;; The < comes before the groups (but the first) to reduce backtracking.
1850 ;; Is there a nicer way of getting . including \n?
1851 ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff. 1870 ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff.
1852 ("\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\)?\\s *\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*[Hh][Tt][Mm][Ll]" . html-mode) 1871 (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
1872 (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)")))
1873 (concat "\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<"
1874 comment-re "*"
1875 "\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\s *" comment-re "*\\)?"
1876 "[Hh][Tt][Mm][Ll]")) . html-mode)
1853 ;; These two must come after html, because they are more general: 1877 ;; These two must come after html, because they are more general:
1854 ("<\\?xml " . xml-mode) 1878 ("<\\?xml " . xml-mode)
1855 ("\\s *<\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*!DOCTYPE " . sgml-mode) 1879 (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
1856 ("%![^V]" . ps-mode)) 1880 (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)")))
1857 "Alist of buffer beginnings vs corresponding major mode functions. 1881 (concat "\\s *<" comment-re "*!DOCTYPE ")) . sgml-mode)
1882 ("%![^V]" . ps-mode)
1883 ("# xmcd " . conf-unix-mode))
1884 "Alist of buffer beginnings vs. corresponding major mode functions.
1858Each element looks like (REGEXP . FUNCTION). FUNCTION will be 1885Each element looks like (REGEXP . FUNCTION). FUNCTION will be
1859called, unless it is nil.") 1886called, unless it is nil (to allow `auto-mode-alist' to override).")
1860 1887
1861(defun set-auto-mode (&optional keep-mode-if-same) 1888(defun set-auto-mode (&optional keep-mode-if-same)
1862 "Select major mode appropriate for current buffer. 1889 "Select major mode appropriate for current buffer.
1863 1890
1864This checks for a -*- mode tag in the buffer's text, checks the 1891This checks for a -*- mode tag in the buffer's text, checks the
1865interpreter that runs this file against `interpreter-mode-alist', 1892interpreter that runs this file against `interpreter-mode-alist',
1866compares the buffer beginning against `magic-mode-alist', 1893compares the buffer beginning against `magic-mode-alist', or
1867or compares the filename against the entries in 1894compares the filename against the entries in `auto-mode-alist'.
1868`auto-mode-alist'.
1869 1895
1870It does not check for the `mode:' local variable in the 1896It does not check for the `mode:' local variable in the
1871Local Variables section of the file; for that, use `hack-local-variables'. 1897Local Variables section of the file; for that, use `hack-local-variables'.
@@ -1876,13 +1902,11 @@ If `enable-local-variables' is nil, this function does not check for a
1876If the optional argument KEEP-MODE-IF-SAME is non-nil, then we 1902If the optional argument KEEP-MODE-IF-SAME is non-nil, then we
1877only set the major mode, if that would change it." 1903only set the major mode, if that would change it."
1878 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- 1904 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*-
1879 (let (end done mode modes xml) 1905 (let (end done mode modes)
1880 ;; Find a -*- mode tag 1906 ;; Find a -*- mode tag
1881 (save-excursion 1907 (save-excursion
1882 (goto-char (point-min)) 1908 (goto-char (point-min))
1883 (skip-chars-forward " \t\n") 1909 (skip-chars-forward " \t\n")
1884 ;; While we're at this point, check xml for later.
1885 (setq xml (looking-at "<\\?xml \\|<!DOCTYPE"))
1886 (and enable-local-variables 1910 (and enable-local-variables
1887 (setq end (set-auto-mode-1)) 1911 (setq end (set-auto-mode-1))
1888 (if (save-excursion (search-forward ":" end t)) 1912 (if (save-excursion (search-forward ":" end t))
@@ -1926,9 +1950,10 @@ only set the major mode, if that would change it."
1926 ;; same time. 1950 ;; same time.
1927 done (assoc (file-name-nondirectory mode) 1951 done (assoc (file-name-nondirectory mode)
1928 interpreter-mode-alist)) 1952 interpreter-mode-alist))
1953 ;; If we found an interpreter mode to use, invoke it now.
1929 (if done 1954 (if done
1930 (set-auto-mode-0 (cdr done) keep-mode-if-same))) 1955 (set-auto-mode-0 (cdr done) keep-mode-if-same)))
1931 ;; If we found an interpreter mode to use, invoke it now. 1956 ;; If we didn't, match the buffer beginning against magic-mode-alist.
1932 (unless done 1957 (unless done
1933 (if (setq done (save-excursion 1958 (if (setq done (save-excursion
1934 (goto-char (point-min)) 1959 (goto-char (point-min))
@@ -1936,6 +1961,7 @@ only set the major mode, if that would change it."
1936 (lambda (re dummy) 1961 (lambda (re dummy)
1937 (looking-at re))))) 1962 (looking-at re)))))
1938 (set-auto-mode-0 done keep-mode-if-same) 1963 (set-auto-mode-0 done keep-mode-if-same)
1964 ;; Compare the filename against the entries in auto-mode-alist.
1939 (if buffer-file-name 1965 (if buffer-file-name
1940 (let ((name buffer-file-name)) 1966 (let ((name buffer-file-name))
1941 ;; Remove backup-suffixes from file name. 1967 ;; Remove backup-suffixes from file name.
@@ -1945,7 +1971,7 @@ only set the major mode, if that would change it."
1945 (let ((case-fold-search 1971 (let ((case-fold-search
1946 (memq system-type '(vax-vms windows-nt cygwin)))) 1972 (memq system-type '(vax-vms windows-nt cygwin))))
1947 (if (and (setq mode (assoc-default name auto-mode-alist 1973 (if (and (setq mode (assoc-default name auto-mode-alist
1948 'string-match)) 1974 'string-match))
1949 (consp mode) 1975 (consp mode)
1950 (cadr mode)) 1976 (cadr mode))
1951 (setq mode (car mode) 1977 (setq mode (car mode)
@@ -1954,7 +1980,6 @@ only set the major mode, if that would change it."
1954 (when mode 1980 (when mode
1955 (set-auto-mode-0 mode keep-mode-if-same))))))))) 1981 (set-auto-mode-0 mode keep-mode-if-same)))))))))
1956 1982
1957
1958;; When `keep-mode-if-same' is set, we are working on behalf of 1983;; When `keep-mode-if-same' is set, we are working on behalf of
1959;; set-visited-file-name. In that case, if the major mode specified is the 1984;; set-visited-file-name. In that case, if the major mode specified is the
1960;; same one we already have, don't actually reset it. We don't want to lose 1985;; same one we already have, don't actually reset it. We don't want to lose
@@ -1973,7 +1998,6 @@ same, do nothing and return nil."
1973 (funcall mode) 1998 (funcall mode)
1974 mode)) 1999 mode))
1975 2000
1976
1977(defun set-auto-mode-1 () 2001(defun set-auto-mode-1 ()
1978 "Find the -*- spec in the buffer. 2002 "Find the -*- spec in the buffer.
1979Call with point at the place to start searching from. 2003Call with point at the place to start searching from.
diff --git a/lisp/filesets.el b/lisp/filesets.el
index 74a2a72bb34..8599cb01d93 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -1356,7 +1356,7 @@ Use the viewer defined in EV-ENTRY (a valid element of
1356 (run-hooks 'oh)) 1356 (run-hooks 'oh))
1357 (set-buffer-modified-p nil) 1357 (set-buffer-modified-p nil)
1358 (setq buffer-read-only t) 1358 (setq buffer-read-only t)
1359 (beginning-of-buffer)) 1359 (goto-char (point-min)))
1360 (when oh 1360 (when oh
1361 (run-hooks 'oh)))) 1361 (run-hooks 'oh))))
1362 (filesets-error 'error 1362 (filesets-error 'error
@@ -1593,7 +1593,8 @@ SAVE-FUNCTION takes no argument, but works on the current buffer."
1593(defun filesets-cmd-show-result (cmd output) 1593(defun filesets-cmd-show-result (cmd output)
1594 "Show OUTPUT of CMD (a shell command)." 1594 "Show OUTPUT of CMD (a shell command)."
1595 (pop-to-buffer "*Filesets: Shell Command Output*") 1595 (pop-to-buffer "*Filesets: Shell Command Output*")
1596 (end-of-buffer) 1596 (with-no-warnings
1597 (end-of-buffer))
1597 (insert "*** ") 1598 (insert "*** ")
1598 (insert cmd) 1599 (insert cmd)
1599 (newline) 1600 (newline)
@@ -1638,7 +1639,7 @@ Replace <file-name> or <<file-name>> with filename."
1638 (save-restriction 1639 (save-restriction
1639 (let ((buffer (filesets-find-file this))) 1640 (let ((buffer (filesets-find-file this)))
1640 (when buffer 1641 (when buffer
1641 (beginning-of-buffer) 1642 (goto-char (point-min))
1642 (let () 1643 (let ()
1643 (cond 1644 (cond
1644 ((stringp fn) 1645 ((stringp fn)
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index d0c749bf385..8a7e1c28cf4 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1,7 +1,7 @@
1;;; font-lock.el --- Electric font lock mode 1;;; font-lock.el --- Electric font lock mode
2 2
3;; Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001, 02, 2003, 2004 3;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4;; Free Software Foundation, Inc. 4;; 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5 5
6;; Author: jwz, then rms, then sm 6;; Author: jwz, then rms, then sm
7;; Maintainer: FSF 7;; Maintainer: FSF
@@ -1289,20 +1289,20 @@ START should be at the beginning of a line."
1289 (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) 1289 (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name)))
1290 (goto-char start) 1290 (goto-char start)
1291 ;; 1291 ;;
1292 ;; Find the state at the `beginning-of-line' before `start'. 1292 ;; Find the `start' state.
1293 (setq state (or ppss (syntax-ppss start))) 1293 (setq state (or ppss (syntax-ppss start)))
1294 ;; 1294 ;;
1295 ;; Find each interesting place between here and `end'. 1295 ;; Find each interesting place between here and `end'.
1296 (while 1296 (while
1297 (progn 1297 (progn
1298 (setq state (parse-partial-sexp (point) end nil nil state
1299 'syntax-table))
1298 (when (or (nth 3 state) (nth 4 state)) 1300 (when (or (nth 3 state) (nth 4 state))
1299 (setq face (funcall font-lock-syntactic-face-function state)) 1301 (setq face (funcall font-lock-syntactic-face-function state))
1300 (setq beg (max (nth 8 state) start)) 1302 (setq beg (max (nth 8 state) start))
1301 (setq state (parse-partial-sexp (point) end nil nil state 1303 (setq state (parse-partial-sexp (point) end nil nil state
1302 'syntax-table)) 1304 'syntax-table))
1303 (when face (put-text-property beg (point) 'face face))) 1305 (when face (put-text-property beg (point) 'face face)))
1304 (setq state (parse-partial-sexp (point) end nil nil state
1305 'syntax-table))
1306 (< (point) end))))) 1306 (< (point) end)))))
1307 1307
1308;;; End of Syntactic fontification functions. 1308;;; End of Syntactic fontification functions.
@@ -2003,5 +2003,5 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
2003 2003
2004(provide 'font-lock) 2004(provide 'font-lock)
2005 2005
2006;;; arch-tag: 682327e4-64d8-4057-b20b-1fbb9f1fc54c 2006;; arch-tag: 682327e4-64d8-4057-b20b-1fbb9f1fc54c
2007;;; font-lock.el ends here 2007;;; font-lock.el ends here
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index d7ebedc53f8..b605875da89 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,17 @@
12004-11-10 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * gnus-art.el (gnus-emphasis-alist): Don't hide asterisks by
4 default; improve customization type.
5 (gnus-emphasis-custom-with-format): New macro.
6 (gnus-emphasis-custom-value-to-external): New function.
7 (gnus-emphasis-custom-value-to-internal): New function.
8
92004-11-07 Katsumi Yamaoka <yamaoka@jpl.org>
10
11 * gnus-msg.el (gnus-configure-posting-styles): Don't cause the
12 "Args out of range" error. Reported by Arnaud Giersch
13 <arnaud.giersch@free.fr>.
14
12004-11-04 Richard M. Stallman <rms@gnu.org> 152004-11-04 Richard M. Stallman <rms@gnu.org>
2 16
3 * spam.el (spam group): Add :version. 17 * spam.el (spam group): Add :version.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index c0266300983..a87348188f9 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -321,27 +321,55 @@ advertisements. For example:
321 :version "21.4" 321 :version "21.4"
322 :group 'gnus-article-washing) 322 :group 'gnus-article-washing)
323 323
324(defmacro gnus-emphasis-custom-with-format (&rest body)
325 `(let ((format "\
326\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\
327\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)"))
328 ,@body))
329
330(defun gnus-emphasis-custom-value-to-external (value)
331 (gnus-emphasis-custom-with-format
332 (if (consp (car value))
333 (list (format format (car (car value)) (cdr (car value)))
334 2
335 (if (nth 1 value) 2 3)
336 (nth 2 value))
337 value)))
338
339(defun gnus-emphasis-custom-value-to-internal (value)
340 (gnus-emphasis-custom-with-format
341 (let ((regexp (concat "\\`"
342 (format (regexp-quote format)
343 "\\([^()]+\\)" "\\([^()]+\\)")
344 "\\'"))
345 pattern)
346 (if (string-match regexp (setq pattern (car value)))
347 (list (cons (match-string 1 pattern) (match-string 2 pattern))
348 (= (nth 2 value) 2)
349 (nth 3 value))
350 value))))
351
324(defcustom gnus-emphasis-alist 352(defcustom gnus-emphasis-alist
325 (let ((format 353 (let ((types
326 "\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)") 354 '(("\\*" "\\*" bold nil 2)
327 (types
328 '(("\\*" "\\*" bold)
329 ("_" "_" underline) 355 ("_" "_" underline)
330 ("/" "/" italic) 356 ("/" "/" italic)
331 ("_/" "/_" underline-italic) 357 ("_/" "/_" underline-italic)
332 ("_\\*" "\\*_" underline-bold) 358 ("_\\*" "\\*_" underline-bold)
333 ("\\*/" "/\\*" bold-italic) 359 ("\\*/" "/\\*" bold-italic)
334 ("_\\*/" "/\\*_" underline-bold-italic)))) 360 ("_\\*/" "/\\*_" underline-bold-italic))))
335 `(,@(mapcar 361 (nconc
336 (lambda (spec) 362 (gnus-emphasis-custom-with-format
337 (list 363 (mapcar (lambda (spec)
338 (format format (car spec) (cadr spec)) 364 (list (format format (car spec) (cadr spec))
339 2 3 (intern (format "gnus-emphasis-%s" (nth 2 spec))))) 365 (or (nth 3 spec) 2)
340 types) 366 (or (nth 4 spec) 3)
341 ("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)" 367 (intern (format "gnus-emphasis-%s" (nth 2 spec)))))
342 2 3 gnus-emphasis-strikethru) 368 types))
343 ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)" 369 '(("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)"
344 2 3 gnus-emphasis-underline))) 370 2 3 gnus-emphasis-strikethru)
371 ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
372 2 3 gnus-emphasis-underline))))
345 "*Alist that says how to fontify certain phrases. 373 "*Alist that says how to fontify certain phrases.
346Each item looks like this: 374Each item looks like this:
347 375
@@ -352,11 +380,43 @@ is a number that says what regular expression grouping used to find
352the entire emphasized word. The third is a number that says what 380the entire emphasized word. The third is a number that says what
353regexp grouping should be displayed and highlighted. The fourth 381regexp grouping should be displayed and highlighted. The fourth
354is the face used for highlighting." 382is the face used for highlighting."
355 :type '(repeat (list :value ("" 0 0 default) 383 :type
356 regexp 384 '(repeat
357 (integer :tag "Match group") 385 (menu-choice
358 (integer :tag "Emphasize group") 386 :format "%[Customizing Style%]\n%v"
359 face)) 387 :indent 2
388 (group :tag "Default"
389 :value ("" 0 0 default)
390 :value-create
391 (lambda (widget)
392 (let ((value (widget-get
393 (cadr (widget-get (widget-get widget :parent)
394 :args))
395 :value)))
396 (if (not (eq (nth 2 value) 'default))
397 (widget-put
398 widget
399 :value
400 (gnus-emphasis-custom-value-to-external value))))
401 (widget-group-value-create widget))
402 (regexp :format "%t: %v\n" :size 1)
403 (integer :format "Match group: %v\n" :size 0)
404 (integer :format "Emphasize group: %v\n" :size 0)
405 face)
406 (group :tag "Simple"
407 :value (("_" . "_") nil default)
408 (cons :format "%v"
409 (regexp :format "Start regexp: %v\n" :size 0)
410 (regexp :format "End regexp: %v\n" :size 0))
411 (boolean :format "Show start and end patterns: %[%v%]\n"
412 :on " On " :off " Off ")
413 face)))
414 :get (lambda (symbol)
415 (mapcar 'gnus-emphasis-custom-value-to-internal
416 (default-value symbol)))
417 :set (lambda (symbol value)
418 (set-default symbol (mapcar 'gnus-emphasis-custom-value-to-external
419 value)))
360 :group 'gnus-article-emphasis) 420 :group 'gnus-article-emphasis)
361 421
362(defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n" 422(defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index 6b093480940..7948efc2572 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -1871,11 +1871,13 @@ this is a reply."
1871 (when (and filep v) 1871 (when (and filep v)
1872 (setq v (with-temp-buffer 1872 (setq v (with-temp-buffer
1873 (insert-file-contents v) 1873 (insert-file-contents v)
1874 (goto-char (point-max)) 1874 (buffer-substring
1875 (skip-chars-backward "\n") 1875 (point-min)
1876 (delete-region (+ (point) (if (bolp) 0 1)) 1876 (progn
1877 (point-max)) 1877 (goto-char (point-max))
1878 (buffer-string)))) 1878 (if (zerop (skip-chars-backward "\n"))
1879 (point)
1880 (1+ (point))))))))
1879 (setq results (delq (assoc element results) results)) 1881 (setq results (delq (assoc element results) results))
1880 (push (cons element v) results)))) 1882 (push (cons element v) results))))
1881 ;; Now we have all the styles, so we insert them. 1883 ;; Now we have all the styles, so we insert them.
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 8f2a1b7fa6e..c06a7b1ee73 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -228,9 +228,14 @@ KIND should be `var' for a variable or `subr' for a subroutine."
228 (if (eobp) 228 (if (eobp)
229 (insert-file-contents-literally 229 (insert-file-contents-literally
230 (expand-file-name internal-doc-file-name doc-directory))) 230 (expand-file-name internal-doc-file-name doc-directory)))
231 (search-forward (concat "" name "\n")) 231 (let ((file (catch 'loop
232 (while t
233 (let ((pnt (search-forward (concat "" name "\n"))))
232 (re-search-backward "S\\(.*\\)") 234 (re-search-backward "S\\(.*\\)")
233 (let ((file (match-string 1))) 235 (let ((file (match-string 1)))
236 (if (member file build-files)
237 (throw 'loop file)
238 (goto-char pnt))))))))
234 (if (string-match "\\.\\(o\\|obj\\)\\'" file) 239 (if (string-match "\\.\\(o\\|obj\\)\\'" file)
235 (setq file (replace-match ".c" t t file))) 240 (setq file (replace-match ".c" t t file)))
236 (if (string-match "\\.c\\'" file) 241 (if (string-match "\\.c\\'" file)
diff --git a/lisp/info-look.el b/lisp/info-look.el
index 3f3ea7c2fd4..4bc90c7e5aa 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -328,22 +328,22 @@ If optional argument QUERY is non-nil, query for the help mode."
328 (modes (info-lookup->all-modes topic mode)) 328 (modes (info-lookup->all-modes topic mode))
329 (window (selected-window)) 329 (window (selected-window))
330 found doc-spec node prefix suffix doc-found) 330 found doc-spec node prefix suffix doc-found)
331 (if (or (not info-lookup-other-window-flag) 331 (if (not (eq major-mode 'Info-mode))
332 (eq (current-buffer) (get-buffer "*info*"))) 332 (if (not info-lookup-other-window-flag)
333 (info) 333 (info)
334 (progn 334 (progn
335 (save-window-excursion (info)) 335 (save-window-excursion (info))
336 ;; Determine whether or not the Info buffer is visible in 336 ;; Determine whether or not the Info buffer is visible in
337 ;; another frame on the same display. If it is, simply raise 337 ;; another frame on the same display. If it is, simply raise
338 ;; that frame. Otherwise, display it in another window. 338 ;; that frame. Otherwise, display it in another window.
339 (let* ((window (get-buffer-window "*info*" t)) 339 (let* ((window (get-buffer-window "*info*" t))
340 (info-frame (and window (window-frame window)))) 340 (info-frame (and window (window-frame window))))
341 (if (and info-frame 341 (if (and info-frame
342 (display-multi-frame-p) 342 (display-multi-frame-p)
343 (memq info-frame (frames-on-display-list)) 343 (memq info-frame (frames-on-display-list))
344 (not (eq info-frame (selected-frame)))) 344 (not (eq info-frame (selected-frame))))
345 (select-frame info-frame) 345 (select-frame info-frame)
346 (switch-to-buffer-other-window "*info*"))))) 346 (switch-to-buffer-other-window "*info*"))))))
347 (while (and (not found) modes) 347 (while (and (not found) modes)
348 (setq doc-spec (info-lookup->doc-spec topic (car modes))) 348 (setq doc-spec (info-lookup->doc-spec topic (car modes)))
349 (while (and (not found) doc-spec) 349 (while (and (not found) doc-spec)
@@ -633,11 +633,11 @@ Return nil if there is nothing appropriate in the buffer near point."
633 :mode 'c-mode :topic 'symbol 633 :mode 'c-mode :topic 'symbol
634 :regexp "\\(struct \\|union \\|enum \\)?[_a-zA-Z][_a-zA-Z0-9]*" 634 :regexp "\\(struct \\|union \\|enum \\)?[_a-zA-Z][_a-zA-Z0-9]*"
635 :doc-spec '(("(libc)Function Index" nil 635 :doc-spec '(("(libc)Function Index" nil
636 "^[ \t]+- \\(Function\\|Macro\\): .*\\<" "\\>") 636 "^[ \t]+-+ \\(Function\\|Macro\\): .*\\<" "\\>")
637 ("(libc)Variable Index" nil 637 ("(libc)Variable Index" nil
638 "^[ \t]+- \\(Variable\\|Macro\\): .*\\<" "\\>") 638 "^[ \t]+-+ \\(Variable\\|Macro\\): .*\\<" "\\>")
639 ("(libc)Type Index" nil 639 ("(libc)Type Index" nil
640 "^[ \t]+- Data Type: \\<" "\\>") 640 "^[ \t]+-+ Data Type: \\<" "\\>")
641 ("(termcap)Var Index" nil 641 ("(termcap)Var Index" nil
642 "^[ \t]*`" "'")) 642 "^[ \t]*`" "'"))
643 :parse-rule 'info-lookup-guess-c-symbol) 643 :parse-rule 'info-lookup-guess-c-symbol)
@@ -673,7 +673,7 @@ Return nil if there is nothing appropriate in the buffer near point."
673 (lambda (item) 673 (lambda (item)
674 (if (string-match "^\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\( .*\\)?$" item) 674 (if (string-match "^\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\( .*\\)?$" item)
675 (concat "@" (match-string 1 item)))) 675 (concat "@" (match-string 1 item))))
676 "`" "'"))) 676 "`" "[' ]")))
677 677
678(info-lookup-maybe-add-help 678(info-lookup-maybe-add-help
679 :mode 'm4-mode 679 :mode 'm4-mode
@@ -690,7 +690,7 @@ Return nil if there is nothing appropriate in the buffer near point."
690 ("(autoconf)Autoconf Macro Index" 690 ("(autoconf)Autoconf Macro Index"
691 (lambda (item) 691 (lambda (item)
692 (if (string-match "^A._" item) item (concat "AC_" item))) 692 (if (string-match "^A._" item) item (concat "AC_" item)))
693 "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>") 693 "^[ \t]+-+ \\(Macro\\|Variable\\): .*\\<" "\\>")
694 ;; M4 Macro Index entries are without "AS_" prefixes, and 694 ;; M4 Macro Index entries are without "AS_" prefixes, and
695 ;; mostly without "m4_" prefixes. "dnl" is an exception, not 695 ;; mostly without "m4_" prefixes. "dnl" is an exception, not
696 ;; wanting any prefix. So AS_ is added back to upper-case 696 ;; wanting any prefix. So AS_ is added back to upper-case
@@ -705,13 +705,13 @@ Return nil if there is nothing appropriate in the buffer near point."
705 (concat "AS_" item)) 705 (concat "AS_" item))
706 (t 706 (t
707 (concat "m4_" item))))) 707 (concat "m4_" item)))))
708 "^[ \t]+- Macro: .*\\<" "\\>") 708 "^[ \t]+-+ Macro: .*\\<" "\\>")
709 ;; Autotest Macro Index entries are without "AT_". 709 ;; Autotest Macro Index entries are without "AT_".
710 ("(autoconf)Autotest Macro Index" "AT_" 710 ("(autoconf)Autotest Macro Index" "AT_"
711 "^[ \t]+- Macro: .*\\<" "\\>") 711 "^[ \t]+-+ Macro: .*\\<" "\\>")
712 ;; This is for older versions (probably pre autoconf 2.5x): 712 ;; This is for older versions (probably pre autoconf 2.5x):
713 ("(autoconf)Macro Index" "AC_" 713 ("(autoconf)Macro Index" "AC_"
714 "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>") 714 "^[ \t]+-+ \\(Macro\\|Variable\\): .*\\<" "\\>")
715 ;; Automake has index entries for its notes on various autoconf 715 ;; Automake has index entries for its notes on various autoconf
716 ;; macros (eg. AC_PROG_CC). Ensure this is after the autoconf 716 ;; macros (eg. AC_PROG_CC). Ensure this is after the autoconf
717 ;; index, so as to prefer the autoconf docs. 717 ;; index, so as to prefer the autoconf docs.
@@ -788,13 +788,13 @@ Return nil if there is nothing appropriate in the buffer near point."
788 ;; Variables normally appear in nodes as just `foo'. 788 ;; Variables normally appear in nodes as just `foo'.
789 ("(emacs)Variable Index" nil "`" "'") 789 ("(emacs)Variable Index" nil "`" "'")
790 ;; Almost all functions, variables, etc appear in nodes as 790 ;; Almost all functions, variables, etc appear in nodes as
791 ;; " - Function: foo" etc. A small number of aliases and 791 ;; " -- Function: foo" etc. A small number of aliases and
792 ;; symbols appear only as `foo', and will miss out on exact 792 ;; symbols appear only as `foo', and will miss out on exact
793 ;; positions. Allowing `foo' would hit too many false matches 793 ;; positions. Allowing `foo' would hit too many false matches
794 ;; for things that should go to Function: etc, and those latter 794 ;; for things that should go to Function: etc, and those latter
795 ;; are much more important. Perhaps this could change if some 795 ;; are much more important. Perhaps this could change if some
796 ;; sort of fallback match scheme existed. 796 ;; sort of fallback match scheme existed.
797 ("(elisp)Index" nil "^ - .*: " "\\( \\|$\\)"))) 797 ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)")))
798 798
799(info-lookup-maybe-add-help 799(info-lookup-maybe-add-help
800 :mode 'lisp-interaction-mode 800 :mode 'lisp-interaction-mode
@@ -814,14 +814,14 @@ Return nil if there is nothing appropriate in the buffer near point."
814 :ignore-case t 814 :ignore-case t
815 ;; Aubrey Jaffer's rendition from <URL:ftp://ftp-swiss.ai.mit.edu/pub/scm> 815 ;; Aubrey Jaffer's rendition from <URL:ftp://ftp-swiss.ai.mit.edu/pub/scm>
816 :doc-spec '(("(r5rs)Index" nil 816 :doc-spec '(("(r5rs)Index" nil
817 "^[ \t]+- [^:]+:[ \t]*" "\\b"))) 817 "^[ \t]+-+ [^:]+:[ \t]*" "\\b")))
818 818
819(info-lookup-maybe-add-help 819(info-lookup-maybe-add-help
820 :mode 'octave-mode 820 :mode 'octave-mode
821 :regexp "[_a-zA-Z0-9]+" 821 :regexp "[_a-zA-Z0-9]+"
822 :doc-spec '(("(octave)Function Index" nil 822 :doc-spec '(("(octave)Function Index" nil
823 "^ - [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil) 823 "^ -+ [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil)
824 ("(octave)Variable Index" nil "^ - [^:]+:[ ]+" nil) 824 ("(octave)Variable Index" nil "^ -+ [^:]+:[ ]+" nil)
825 ;; Catch lines of the form "xyz statement" 825 ;; Catch lines of the form "xyz statement"
826 ("(octave)Concept Index" 826 ("(octave)Concept Index"
827 (lambda (item) 827 (lambda (item)
@@ -829,15 +829,15 @@ Return nil if there is nothing appropriate in the buffer near point."
829 ((string-match "^\\([A-Z]+\\) statement\\b" item) 829 ((string-match "^\\([A-Z]+\\) statement\\b" item)
830 (match-string 1 item)) 830 (match-string 1 item))
831 (t nil))) 831 (t nil)))
832 nil; "^ - [^:]+:[ ]+" don't think this prefix is useful here. 832 nil; "^ -+ [^:]+:[ ]+" don't think this prefix is useful here.
833 nil))) 833 nil)))
834 834
835(info-lookup-maybe-add-help 835(info-lookup-maybe-add-help
836 :mode 'maxima-mode 836 :mode 'maxima-mode
837 :ignore-case t 837 :ignore-case t
838 :regexp "[a-zA-Z_%]+" 838 :regexp "[a-zA-Z_%]+"
839 :doc-spec '( ("(maxima)Function and Variable Index" nil 839 :doc-spec '( ("(maxima)Function and Variable Index" nil
840 "^ - [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil))) 840 "^ -+ [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil)))
841 841
842(info-lookup-maybe-add-help 842(info-lookup-maybe-add-help
843 :mode 'inferior-maxima-mode 843 :mode 'inferior-maxima-mode
diff --git a/lisp/info.el b/lisp/info.el
index 8aaf7755df2..cc7ed2ae59b 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -657,10 +657,10 @@ is preserved, if possible."
657 (equal old-nodename Info-current-node)) 657 (equal old-nodename Info-current-node))
658 (progn 658 (progn
659 ;; note goto-line is no good, we want to measure from point-min 659 ;; note goto-line is no good, we want to measure from point-min
660 (beginning-of-buffer) 660 (goto-char (point-min))
661 (forward-line wline) 661 (forward-line wline)
662 (set-window-start (selected-window) (point)) 662 (set-window-start (selected-window) (point))
663 (beginning-of-buffer) 663 (goto-char (point-min))
664 (forward-line pline) 664 (forward-line pline)
665 (move-to-column pcolumn)) 665 (move-to-column pcolumn))
666 ;; only add to the history when coming from a different file+node 666 ;; only add to the history when coming from a different file+node
@@ -1484,13 +1484,18 @@ If DIRECTION is `backward', search in the reverse direction."
1484 (1- (point))) 1484 (1- (point)))
1485 (point-max))) 1485 (point-max)))
1486 (while (and (not give-up) 1486 (while (and (not give-up)
1487 (or (null found) 1487 (save-match-data
1488 (if backward 1488 (or (null found)
1489 (isearch-range-invisible found beg-found) 1489 (if backward
1490 (isearch-range-invisible beg-found found)) 1490 (isearch-range-invisible found beg-found)
1491 ;; Skip node header line 1491 (isearch-range-invisible beg-found found))
1492 (save-excursion (forward-line -1) 1492 ;; Skip node header line
1493 (looking-at "\^_")))) 1493 (save-excursion (forward-line -1)
1494 (looking-at "\^_"))
1495 ;; Skip Tag Table node
1496 (save-excursion
1497 (and (search-backward "\^_" nil t)
1498 (looking-at "\^_\nTag Table"))))))
1494 (if (if backward 1499 (if (if backward
1495 (re-search-backward regexp bound t) 1500 (re-search-backward regexp bound t)
1496 (re-search-forward regexp bound t)) 1501 (re-search-forward regexp bound t))
@@ -1552,13 +1557,18 @@ If DIRECTION is `backward', search in the reverse direction."
1552 (setq list (cdr list)) 1557 (setq list (cdr list))
1553 (setq give-up nil found nil) 1558 (setq give-up nil found nil)
1554 (while (and (not give-up) 1559 (while (and (not give-up)
1555 (or (null found) 1560 (save-match-data
1556 (if backward 1561 (or (null found)
1557 (isearch-range-invisible found beg-found) 1562 (if backward
1558 (isearch-range-invisible beg-found found)) 1563 (isearch-range-invisible found beg-found)
1559 ;; Skip node header line 1564 (isearch-range-invisible beg-found found))
1560 (save-excursion (forward-line -1) 1565 ;; Skip node header line
1561 (looking-at "\^_")))) 1566 (save-excursion (forward-line -1)
1567 (looking-at "\^_"))
1568 ;; Skip Tag Table node
1569 (save-excursion
1570 (and (search-backward "\^_" nil t)
1571 (looking-at "\^_\nTag Table"))))))
1562 (if (if backward 1572 (if (if backward
1563 (re-search-backward regexp nil t) 1573 (re-search-backward regexp nil t)
1564 (re-search-forward regexp nil t)) 1574 (re-search-forward regexp nil t))
diff --git a/lisp/international/iso-cvt.el b/lisp/international/iso-cvt.el
index b0dffc40f50..d7baabb29c8 100644
--- a/lisp/international/iso-cvt.el
+++ b/lisp/international/iso-cvt.el
@@ -1,7 +1,8 @@
1;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: iso-latin-1 -*- 1;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: iso-latin-1 -*-
2;; This file was formerly called gm-lingo.el. 2;; This file was formerly called gm-lingo.el.
3 3
4;; Copyright (C) 1993, 1994, 1995, 1996, 1998, 2000 Free Software Foundation, Inc. 4;; Copyright (C) 1993, 1994, 1995, 1996, 1998, 2000, 2003, 2004
5;; Free Software Foundation, Inc.
5 6
6;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at> 7;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
7;; Keywords: tex, iso, latin, i18n 8;; Keywords: tex, iso, latin, i18n
@@ -828,69 +829,67 @@ Optional arg BUFFER is ignored (for use in `format-alist')."
828 829
829;;;###autoload 830;;;###autoload
830(defun iso-cvt-define-menu () 831(defun iso-cvt-define-menu ()
831 "Add submenus to the Files menu, to convert to and from various formats." 832 "Add submenus to the File menu, to convert to and from various formats."
832 (interactive) 833 (interactive)
833 834
834 (define-key menu-bar-files-menu [load-as-separator] '("--")) 835 (let ((load-as-menu-map (make-sparse-keymap "Load As..."))
835 836 (insert-as-menu-map (make-sparse-keymap "Insert As..."))
836 (define-key menu-bar-files-menu [load-as] '("Load As..." . load-as)) 837 (write-as-menu-map (make-sparse-keymap "Write As..."))
837 (defvar load-as-menu-map (make-sparse-keymap "Load As...")) 838 (translate-to-menu-map (make-sparse-keymap "Translate to..."))
838 (fset 'load-as load-as-menu-map) 839 (translate-from-menu-map (make-sparse-keymap "Translate from..."))
839 840 (menu menu-bar-file-menu))
840 ;;(define-key menu-bar-files-menu [insert-as] '("Insert As..." . insert-as)) 841
841 (defvar insert-as-menu-map (make-sparse-keymap "Insert As...")) 842 (define-key menu [load-as-separator] '("--"))
842 (fset 'insert-as insert-as-menu-map) 843
843 844 (define-key menu [load-as] '("Load As..." . iso-cvt-load-as))
844 (define-key menu-bar-files-menu [write-as] '("Write As..." . write-as)) 845 (fset 'iso-cvt-load-as load-as-menu-map)
845 (defvar write-as-menu-map (make-sparse-keymap "Write As...")) 846
846 (fset 'write-as write-as-menu-map) 847 ;;(define-key menu [insert-as] '("Insert As..." . iso-cvt-insert-as))
847 848 (fset 'iso-cvt-insert-as insert-as-menu-map)
848 (define-key menu-bar-files-menu [translate-separator] '("--")) 849
849 850 (define-key menu [write-as] '("Write As..." . iso-cvt-write-as))
850 (define-key menu-bar-files-menu [translate-to] '("Translate to..." . translate-to)) 851 (fset 'iso-cvt-write-as write-as-menu-map)
851 (defvar translate-to-menu-map (make-sparse-keymap "Translate to...")) 852
852 (fset 'translate-to translate-to-menu-map) 853 (define-key menu [translate-separator] '("--"))
853 854
854 (define-key menu-bar-files-menu [translate-from] '("Translate from..." . translate-from)) 855 (define-key menu [translate-to] '("Translate to..." . iso-cvt-translate-to))
855 (defvar translate-from-menu-map (make-sparse-keymap "Translate from...")) 856 (fset 'iso-cvt-translate-to translate-to-menu-map)
856 (fset 'translate-from translate-from-menu-map) 857
857 858 (define-key menu [translate-from] '("Translate from..." . iso-cvt-translate-from))
858 (let ((file-types (reverse format-alist)) 859 (fset 'iso-cvt-translate-from translate-from-menu-map)
859 name 860
860 str-name) 861 (dolist (file-type (reverse format-alist))
861 (while file-types 862 (let ((name (car file-type))
862 (setq name (car (car file-types)) 863 (str-name (cadr file-type)))
863 str-name (car (cdr (car file-types))) 864 (if (stringp str-name)
864 file-types (cdr file-types)) 865 (progn
865 (if (stringp str-name) 866 (define-key load-as-menu-map (vector name)
866 (progn 867 (cons str-name
867 (define-key load-as-menu-map (vector name) 868 `(lambda (file)
868 (cons str-name 869 (interactive ,(format "FFind file (as %s): " name))
869 `(lambda (file) 870 (format-find-file file ',name))))
870 (interactive (format "FFind file (as %s): " ,name)) 871 (define-key insert-as-menu-map (vector name)
871 (format-find-file file ',name)))) 872 (cons str-name
872 (define-key insert-as-menu-map (vector name) 873 `(lambda (file)
873 (cons str-name 874 (interactive (format "FInsert file (as %s): " ,name))
874 `(lambda (file) 875 (format-insert-file file ',name))))
875 (interactive (format "FInsert file (as %s): " ,name)) 876 (define-key write-as-menu-map (vector name)
876 (format-insert-file file ',name)))) 877 (cons str-name
877 (define-key write-as-menu-map (vector name) 878 `(lambda (file)
878 (cons str-name 879 (interactive (format "FWrite file (as %s): " ,name))
879 `(lambda (file) 880 (format-write-file file ',name))))
880 (interactive (format "FWrite file (as %s): " ,name)) 881 (define-key translate-to-menu-map (vector name)
881 (format-write-file file ',name)))) 882 (cons str-name
882 (define-key translate-to-menu-map (vector name) 883 `(lambda ()
883 (cons str-name 884 (interactive)
884 `(lambda () 885 (format-encode-buffer ',name))))
885 (interactive) 886 (define-key translate-from-menu-map (vector name)
886 (format-encode-buffer ',name)))) 887 (cons str-name
887 (define-key translate-from-menu-map (vector name) 888 `(lambda ()
888 (cons str-name 889 (interactive)
889 `(lambda () 890 (format-decode-buffer ',name))))))))))
890 (interactive)
891 (format-decode-buffer ',name)))))))))
892 891
893(provide 'iso-cvt) 892(provide 'iso-cvt)
894 893
895;;; arch-tag: 64ae843f-ed0e-43e1-ba50-ffd581b90840 894;; arch-tag: 64ae843f-ed0e-43e1-ba50-ffd581b90840
896;;; iso-cvt.el ends here 895;;; iso-cvt.el ends here
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 510a3c9358d..404ee5529f8 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1,7 +1,8 @@
1;;; mule-cmds.el --- commands for mulitilingual environment -*-coding: iso-2022-7bit -*- 1;;; mule-cmds.el --- commands for mulitilingual environment -*-coding: iso-2022-7bit -*-
2
3;; Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2;; Copyright (C) 1995, 2003 Electrotechnical Laboratory, JAPAN. 4;; Copyright (C) 1995, 2003 Electrotechnical Laboratory, JAPAN.
3;; Licensed to the Free Software Foundation. 5;; Licensed to the Free Software Foundation.
4;; Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5 6
6;; Keywords: mule, multilingual 7;; Keywords: mule, multilingual
7 8
@@ -625,6 +626,175 @@ The meaning is the same as the argument ACCEPT-DEFAULT-P of the
625function `select-safe-coding-system' (which see). This variable 626function `select-safe-coding-system' (which see). This variable
626overrides that argument.") 627overrides that argument.")
627 628
629(defun select-safe-coding-system-interactively (from to codings unsafe
630 &optional rejected default)
631 "Select interactively a coding system for the region FROM ... TO.
632FROM can be a string, as in `write-region'.
633CODINGS is the list of base coding systems known to be safe for this region,
634 typically obtained with `find-coding-systems-region'.
635UNSAFE is a list of coding systems known to be unsafe for this region.
636REJECTED is a list of coding systems which were safe but for some reason
637 were not recommended in the particular context.
638DEFAULT is the coding system to use by default in the query."
639 ;; At first, if some defaults are unsafe, record at most 11
640 ;; problematic characters and their positions for them by turning
641 ;; (CODING ...)
642 ;; into
643 ;; ((CODING (POS . CHAR) (POS . CHAR) ...) ...)
644 (if unsafe
645 (setq unsafe
646 (mapcar #'(lambda (coding)
647 (cons coding
648 (if (stringp from)
649 (mapcar #'(lambda (pos)
650 (cons pos (aref from pos)))
651 (unencodable-char-position
652 0 (length from) coding
653 11 from))
654 (mapcar #'(lambda (pos)
655 (cons pos (char-after pos)))
656 (unencodable-char-position
657 from to coding 11)))))
658 unsafe)))
659
660 ;; Change each safe coding system to the corresponding
661 ;; mime-charset name if it is also a coding system. Such a name
662 ;; is more friendly to users.
663 (let ((l codings)
664 mime-charset)
665 (while l
666 (setq mime-charset (coding-system-get (car l) 'mime-charset))
667 (if (and mime-charset (coding-system-p mime-charset))
668 (setcar l mime-charset))
669 (setq l (cdr l))))
670
671 ;; Don't offer variations with locking shift, which you
672 ;; basically never want.
673 (let (l)
674 (dolist (elt codings (setq codings (nreverse l)))
675 (unless (or (eq 'coding-category-iso-7-else
676 (coding-system-category elt))
677 (eq 'coding-category-iso-8-else
678 (coding-system-category elt)))
679 (push elt l))))
680
681 ;; Remove raw-text, emacs-mule and no-conversion unless nothing
682 ;; else is available.
683 (setq codings
684 (or (delq 'raw-text
685 (delq 'emacs-mule
686 (delq 'no-conversion codings)))
687 '(raw-text emacs-mule no-conversion)))
688
689 (let ((window-configuration (current-window-configuration))
690 (bufname (buffer-name))
691 coding-system)
692 (save-excursion
693 ;; If some defaults are unsafe, make sure the offending
694 ;; buffer is displayed.
695 (when (and unsafe (not (stringp from)))
696 (pop-to-buffer bufname)
697 (goto-char (apply 'min (mapcar #'(lambda (x) (car (cadr x)))
698 unsafe))))
699 ;; Then ask users to select one from CODINGS while showing
700 ;; the reason why none of the defaults are not used.
701 (with-output-to-temp-buffer "*Warning*"
702 (with-current-buffer standard-output
703 (if (and (null rejected) (null unsafe))
704 (insert "No default coding systems to try for "
705 (if (stringp from)
706 (format "string \"%s\"." from)
707 (format "buffer `%s'." bufname)))
708 (insert
709 "These default coding systems were tried to encode"
710 (if (stringp from)
711 (concat " \"" (if (> (length from) 10)
712 (concat (substring from 0 10) "...\"")
713 (concat from "\"")))
714 (format " text\nin the buffer `%s'" bufname))
715 ":\n")
716 (let ((pos (point))
717 (fill-prefix " "))
718 (dolist (x (append rejected unsafe))
719 (princ " ") (princ (car x)))
720 (insert "\n")
721 (fill-region-as-paragraph pos (point)))
722 (when rejected
723 (insert "These safely encodes the target text,
724but it is not recommended for encoding text in this context,
725e.g., for sending an email message.\n ")
726 (dolist (x rejected)
727 (princ " ") (princ x))
728 (insert "\n"))
729 (when unsafe
730 (insert (if rejected "And the others"
731 "However, each of them")
732 " encountered these problematic characters:\n")
733 (dolist (coding unsafe)
734 (insert (format " %s:" (car coding)))
735 (let ((i 0)
736 (func1
737 #'(lambda (bufname pos)
738 (when (buffer-live-p (get-buffer bufname))
739 (pop-to-buffer bufname)
740 (goto-char pos))))
741 (func2
742 #'(lambda (bufname pos coding)
743 (when (buffer-live-p (get-buffer bufname))
744 (pop-to-buffer bufname)
745 (if (< (point) pos)
746 (goto-char pos)
747 (forward-char 1)
748 (search-unencodable-char coding)
749 (forward-char -1))))))
750 (dolist (elt (cdr coding))
751 (insert " ")
752 (if (stringp from)
753 (insert (if (< i 10) (cdr elt) "..."))
754 (if (< i 10)
755 (insert-text-button
756 (cdr elt)
757 :type 'help-xref
758 'help-echo
759 "mouse-2, RET: jump to this character"
760 'help-function func1
761 'help-args (list bufname (car elt)))
762 (insert-text-button
763 "..."
764 :type 'help-xref
765 'help-echo
766 "mouse-2, RET: next unencodable character"
767 'help-function func2
768 'help-args (list bufname (car elt)
769 (car coding)))))
770 (setq i (1+ i))))
771 (insert "\n"))
772 (insert "\
773The first problematic character is at point in the displayed buffer,\n"
774 (substitute-command-keys "\
775and \\[universal-argument] \\[what-cursor-position] will give information about it.\n"))))
776 (insert "\nSelect \
777one of the following safe coding systems, or edit the buffer:\n")
778 (let ((pos (point))
779 (fill-prefix " "))
780 (dolist (x codings)
781 (princ " ") (princ x))
782 (insert "\n")
783 (fill-region-as-paragraph pos (point)))
784 (insert "Or specify any other coding system
785at the risk of losing the problematic characters.\n")))
786
787 ;; Read a coding system.
788 (setq coding-system
789 (read-coding-system
790 (format "Select coding system (default %s): " default)
791 default))
792 (setq last-coding-system-specified coding-system))
793
794 (kill-buffer "*Warning*")
795 (set-window-configuration window-configuration)
796 coding-system))
797
628(defun select-safe-coding-system (from to &optional default-coding-system 798(defun select-safe-coding-system (from to &optional default-coding-system
629 accept-default-p file) 799 accept-default-p file)
630 "Ask a user to select a safe coding system from candidates. 800 "Ask a user to select a safe coding system from candidates.
@@ -721,7 +891,6 @@ and TO is ignored."
721 891
722 (let ((codings (find-coding-systems-region from to)) 892 (let ((codings (find-coding-systems-region from to))
723 (coding-system nil) 893 (coding-system nil)
724 (bufname (buffer-name))
725 safe rejected unsafe) 894 safe rejected unsafe)
726 (if (eq (car codings) 'undecided) 895 (if (eq (car codings) 'undecided)
727 ;; Any coding system is ok. 896 ;; Any coding system is ok.
@@ -739,172 +908,8 @@ and TO is ignored."
739 908
740 ;; If all the defaults failed, ask a user. 909 ;; If all the defaults failed, ask a user.
741 (when (not coding-system) 910 (when (not coding-system)
742 ;; At first, if some defaults are unsafe, record at most 11 911 (setq coding-system (select-safe-coding-system-interactively
743 ;; problematic characters and their positions for them by turning 912 from to codings unsafe rejected (car codings))))
744 ;; (CODING ...)
745 ;; into
746 ;; ((CODING (POS . CHAR) (POS . CHAR) ...) ...)
747 (if unsafe
748 (if (stringp from)
749 (setq unsafe
750 (mapcar #'(lambda (coding)
751 (cons coding
752 (mapcar #'(lambda (pos)
753 (cons pos (aref from pos)))
754 (unencodable-char-position
755 0 (length from) coding
756 11 from))))
757 unsafe))
758 (setq unsafe
759 (mapcar #'(lambda (coding)
760 (cons coding
761 (mapcar #'(lambda (pos)
762 (cons pos (char-after pos)))
763 (unencodable-char-position
764 from to coding 11))))
765 unsafe))))
766
767 ;; Change each safe coding system to the corresponding
768 ;; mime-charset name if it is also a coding system. Such a name
769 ;; is more friendly to users.
770 (let ((l codings)
771 mime-charset)
772 (while l
773 (setq mime-charset (coding-system-get (car l) 'mime-charset))
774 (if (and mime-charset (coding-system-p mime-charset))
775 (setcar l mime-charset))
776 (setq l (cdr l))))
777
778 ;; Don't offer variations with locking shift, which you
779 ;; basically never want.
780 (let (l)
781 (dolist (elt codings (setq codings (nreverse l)))
782 (unless (or (eq 'coding-category-iso-7-else
783 (coding-system-category elt))
784 (eq 'coding-category-iso-8-else
785 (coding-system-category elt)))
786 (push elt l))))
787
788 ;; Remove raw-text, emacs-mule and no-conversion unless nothing
789 ;; else is available.
790 (setq codings
791 (or (delq 'raw-text
792 (delq 'emacs-mule
793 (delq 'no-conversion codings)))
794 '(raw-text emacs-mule no-conversion)))
795
796 (let ((window-configuration (current-window-configuration)))
797 (save-excursion
798 ;; If some defaults are unsafe, make sure the offending
799 ;; buffer is displayed.
800 (when (and unsafe (not (stringp from)))
801 (pop-to-buffer bufname)
802 (goto-char (apply 'min (mapcar #'(lambda (x) (car (cadr x)))
803 unsafe))))
804 ;; Then ask users to select one from CODINGS while showing
805 ;; the reason why none of the defaults are not used.
806 (with-output-to-temp-buffer "*Warning*"
807 (save-excursion
808 (set-buffer standard-output)
809 (if (not default-coding-system)
810 (insert "No default coding systems to try for "
811 (if (stringp from)
812 (format "string \"%s\"." from)
813 (format "buffer `%s'." bufname)))
814 (insert
815 "These default coding systems were tried to encode"
816 (if (stringp from)
817 (concat " \"" (if (> (length from) 10)
818 (concat (substring from 0 10) "...\"")
819 (concat from "\"")))
820 (format " text\nin the buffer `%s'" bufname))
821 ":\n")
822 (let ((pos (point))
823 (fill-prefix " "))
824 (mapc #'(lambda (x) (princ " ") (princ (car x)))
825 default-coding-system)
826 (insert "\n")
827 (fill-region-as-paragraph pos (point)))
828 (when rejected
829 (insert "These safely encodes the target text,
830but it is not recommended for encoding text in this context,
831e.g., for sending an email message.\n ")
832 (mapc #'(lambda (x) (princ " ") (princ x)) rejected)
833 (insert "\n"))
834 (when unsafe
835 (insert (if rejected "And the others"
836 "However, each of them")
837 " encountered these problematic characters:\n")
838 (mapc
839 #'(lambda (coding)
840 (insert (format " %s:" (car coding)))
841 (let ((i 0)
842 (func1
843 #'(lambda (bufname pos)
844 (when (buffer-live-p (get-buffer bufname))
845 (pop-to-buffer bufname)
846 (goto-char pos))))
847 (func2
848 #'(lambda (bufname pos coding)
849 (when (buffer-live-p (get-buffer bufname))
850 (pop-to-buffer bufname)
851 (if (< (point) pos)
852 (goto-char pos)
853 (forward-char 1)
854 (search-unencodable-char coding)
855 (forward-char -1))))))
856 (dolist (elt (cdr coding))
857 (insert " ")
858 (if (stringp from)
859 (insert (if (< i 10) (cdr elt) "..."))
860 (if (< i 10)
861 (insert-text-button
862 (cdr elt)
863 :type 'help-xref
864 'help-echo
865 "mouse-2, RET: jump to this character"
866 'help-function func1
867 'help-args (list bufname (car elt)))
868 (insert-text-button
869 "..."
870 :type 'help-xref
871 'help-echo
872 "mouse-2, RET: next unencodable character"
873 'help-function func2
874 'help-args (list bufname (car elt)
875 (car coding)))))
876 (setq i (1+ i))))
877 (insert "\n"))
878 unsafe)
879 (insert "\
880The first problematic character is at point in the displayed buffer,\n"
881 (substitute-command-keys "\
882and \\[universal-argument] \\[what-cursor-position] will give information about it.\n"))))
883 (insert (if safe
884 "\nSelect the above, or "
885 "\nSelect ")
886 "\
887one of the following safe coding systems, or edit the buffer:\n")
888 (let ((pos (point))
889 (fill-prefix " "))
890 (mapcar (function (lambda (x) (princ " ") (princ x)))
891 codings)
892 (insert "\n")
893 (fill-region-as-paragraph pos (point)))
894 (insert "Or specify any other coding system
895at the risk of losing the problematic characters.\n")))
896
897 ;; Read a coding system.
898 (setq default-coding-system (or (car safe) (car codings)))
899 (setq coding-system
900 (read-coding-system
901 (format "Select coding system (default %s): "
902 default-coding-system)
903 default-coding-system))
904 (setq last-coding-system-specified coding-system))
905
906 (kill-buffer "*Warning*")
907 (set-window-configuration window-configuration)))
908 913
909 (if (vectorp (coding-system-eol-type coding-system)) 914 (if (vectorp (coding-system-eol-type coding-system))
910 (let ((eol (coding-system-eol-type buffer-file-coding-system))) 915 (let ((eol (coding-system-eol-type buffer-file-coding-system)))
@@ -2627,5 +2632,5 @@ If CODING-SYSTEM can't safely encode CHAR, return nil."
2627 (substring enc2 0 i2)))) 2632 (substring enc2 0 i2))))
2628 2633
2629 2634
2630;;; arch-tag: b382c432-4b36-460e-bf4c-05efd0bb18dc 2635;; arch-tag: b382c432-4b36-460e-bf4c-05efd0bb18dc
2631;;; mule-cmds.el ends here 2636;;; mule-cmds.el ends here
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index f5294fea92f..9136a257ee1 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -2126,7 +2126,7 @@ This function is intended to be added to `auto-coding-functions'."
2126 (save-excursion 2126 (save-excursion
2127 (forward-line 10) 2127 (forward-line 10)
2128 (point)))) 2128 (point))))
2129 (when (and (search-forward "<html>" size t) 2129 (when (and (search-forward "<html" size t)
2130 (re-search-forward "<meta\\s-+http-equiv=\"content-type\"\\s-+content=\"text/\\sw+;\\s-*charset=\\(.+?\\)\"" size t)) 2130 (re-search-forward "<meta\\s-+http-equiv=\"content-type\"\\s-+content=\"text/\\sw+;\\s-*charset=\\(.+?\\)\"" size t))
2131 (let* ((match (match-string 1)) 2131 (let* ((match (match-string 1))
2132 (sym (intern (downcase match)))) 2132 (sym (intern (downcase match))))
diff --git a/lisp/mail/rmail-spam-filter.el b/lisp/mail/rmail-spam-filter.el
index 43177b7c99b..c7fc8a0da03 100644
--- a/lisp/mail/rmail-spam-filter.el
+++ b/lisp/mail/rmail-spam-filter.el
@@ -302,13 +302,14 @@ it from rmail file. Called for each new message retrieved by
302 302
303 ;; Check white list, and likewise cause while loop 303 ;; Check white list, and likewise cause while loop
304 ;; bypass. 304 ;; bypass.
305 (if (let ((white-list rsf-white-list) 305 (if (and message-sender
306 (found nil)) 306 (let ((white-list rsf-white-list)
307 (while (and (not found) white-list) 307 (found nil))
308 (if (string-match (car white-list) message-sender) 308 (while (and (not found) white-list)
309 (setq found t) 309 (if (string-match (car white-list) message-sender)
310 (setq white-list (cdr white-list)))) 310 (setq found t)
311 found) 311 (setq white-list (cdr white-list))))
312 found))
312 (setq exit-while-loop t 313 (setq exit-while-loop t
313 maybe-spam nil 314 maybe-spam nil
314 this-is-a-spam-email nil)) 315 this-is-a-spam-email nil))
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index f8e31dfda04..a7524cc8246 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1504,8 +1504,8 @@ It returns t if it got any new messages."
1504 (if (and (featurep 'rmail-spam-filter) 1504 (if (and (featurep 'rmail-spam-filter)
1505 rmail-use-spam-filter 1505 rmail-use-spam-filter
1506 (> rsf-number-of-spam 0)) 1506 (> rsf-number-of-spam 0))
1507 (progn (if rmail-spam-filter-beep (beep t)) 1507 (progn (if rsf-beep (beep t))
1508 (sleep-for rmail-spam-sleep-after-message))) 1508 (sleep-for rsf-sleep-after-message)))
1509 1509
1510 ;; Move to the first new message 1510 ;; Move to the first new message
1511 ;; unless we have other unseen messages before it. 1511 ;; unless we have other unseen messages before it.
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 2c1d37c80e2..597e77b6165 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -63,78 +63,78 @@ A large number or nil slows down menu responsiveness."
63 (cons "Options" menu-bar-options-menu)) 63 (cons "Options" menu-bar-options-menu))
64(defvar menu-bar-edit-menu (make-sparse-keymap "Edit")) 64(defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
65(define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu)) 65(define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu))
66(defvar menu-bar-files-menu (make-sparse-keymap "File")) 66(defvar menu-bar-file-menu (make-sparse-keymap "File"))
67(define-key global-map [menu-bar files] (cons "File" menu-bar-files-menu)) 67(define-key global-map [menu-bar file] (cons "File" menu-bar-file-menu))
68 68
69;; This alias is for compatibility with 19.28 and before. 69;; This alias is for compatibility with 19.28 and before.
70(defvar menu-bar-file-menu menu-bar-files-menu) 70(defvar menu-bar-files-menu menu-bar-file-menu)
71 71
72;; This is referenced by some code below; it is defined in uniquify.el 72;; This is referenced by some code below; it is defined in uniquify.el
73(defvar uniquify-buffer-name-style) 73(defvar uniquify-buffer-name-style)
74 74
75 75
76;; The "File" menu items 76;; The "File" menu items
77(define-key menu-bar-files-menu [exit-emacs] 77(define-key menu-bar-file-menu [exit-emacs]
78 '(menu-item "Exit Emacs" save-buffers-kill-emacs 78 '(menu-item "Exit Emacs" save-buffers-kill-emacs
79 :help "Save unsaved buffers, then exit")) 79 :help "Save unsaved buffers, then exit"))
80 80
81(define-key menu-bar-files-menu [separator-exit] 81(define-key menu-bar-file-menu [separator-exit]
82 '("--")) 82 '("--"))
83 83
84;; Don't use delete-frame as event name because that is a special 84;; Don't use delete-frame as event name because that is a special
85;; event. 85;; event.
86(define-key menu-bar-files-menu [delete-this-frame] 86(define-key menu-bar-file-menu [delete-this-frame]
87 '(menu-item "Delete Frame" delete-frame 87 '(menu-item "Delete Frame" delete-frame
88 :visible (fboundp 'delete-frame) 88 :visible (fboundp 'delete-frame)
89 :enable (delete-frame-enabled-p) 89 :enable (delete-frame-enabled-p)
90 :help "Delete currently selected frame")) 90 :help "Delete currently selected frame"))
91(define-key menu-bar-files-menu [make-frame-on-display] 91(define-key menu-bar-file-menu [make-frame-on-display]
92 '(menu-item "New Frame on Display..." make-frame-on-display 92 '(menu-item "New Frame on Display..." make-frame-on-display
93 :visible (fboundp 'make-frame-on-display) 93 :visible (fboundp 'make-frame-on-display)
94 :help "Open a new frame on another display")) 94 :help "Open a new frame on another display"))
95(define-key menu-bar-files-menu [make-frame] 95(define-key menu-bar-file-menu [make-frame]
96 '(menu-item "New Frame" make-frame-command 96 '(menu-item "New Frame" make-frame-command
97 :visible (fboundp 'make-frame-command) 97 :visible (fboundp 'make-frame-command)
98 :help "Open a new frame")) 98 :help "Open a new frame"))
99 99
100(define-key menu-bar-files-menu [one-window] 100(define-key menu-bar-file-menu [one-window]
101 '(menu-item "Unsplit Windows" delete-other-windows 101 '(menu-item "Unsplit Windows" delete-other-windows
102 :enable (not (one-window-p t nil)) 102 :enable (not (one-window-p t nil))
103 :help "Make selected window fill its frame")) 103 :help "Make selected window fill its frame"))
104 104
105(define-key menu-bar-files-menu [split-window] 105(define-key menu-bar-file-menu [split-window]
106 '(menu-item "Split Window" split-window-vertically 106 '(menu-item "Split Window" split-window-vertically
107 :help "Split selected window in two")) 107 :help "Split selected window in two"))
108 108
109(define-key menu-bar-files-menu [separator-window] 109(define-key menu-bar-file-menu [separator-window]
110 '(menu-item "--")) 110 '(menu-item "--"))
111 111
112(define-key menu-bar-files-menu [ps-print-region] 112(define-key menu-bar-file-menu [ps-print-region]
113 '(menu-item "Postscript Print Region (B+W)" ps-print-region 113 '(menu-item "Postscript Print Region (B+W)" ps-print-region
114 :enable mark-active 114 :enable mark-active
115 :help "Pretty-print marked region in black and white to PostScript printer")) 115 :help "Pretty-print marked region in black and white to PostScript printer"))
116(define-key menu-bar-files-menu [ps-print-buffer] 116(define-key menu-bar-file-menu [ps-print-buffer]
117 '(menu-item "Postscript Print Buffer (B+W)" ps-print-buffer 117 '(menu-item "Postscript Print Buffer (B+W)" ps-print-buffer
118 :help "Pretty-print current buffer in black and white to PostScript printer")) 118 :help "Pretty-print current buffer in black and white to PostScript printer"))
119(define-key menu-bar-files-menu [ps-print-region-faces] 119(define-key menu-bar-file-menu [ps-print-region-faces]
120 '(menu-item "Postscript Print Region" ps-print-region-with-faces 120 '(menu-item "Postscript Print Region" ps-print-region-with-faces
121 :enable mark-active 121 :enable mark-active
122 :help "Pretty-print marked region to PostScript printer")) 122 :help "Pretty-print marked region to PostScript printer"))
123(define-key menu-bar-files-menu [ps-print-buffer-faces] 123(define-key menu-bar-file-menu [ps-print-buffer-faces]
124 '(menu-item "Postscript Print Buffer" ps-print-buffer-with-faces 124 '(menu-item "Postscript Print Buffer" ps-print-buffer-with-faces
125 :help "Pretty-print current buffer to PostScript printer")) 125 :help "Pretty-print current buffer to PostScript printer"))
126(define-key menu-bar-files-menu [print-region] 126(define-key menu-bar-file-menu [print-region]
127 '(menu-item "Print Region" print-region 127 '(menu-item "Print Region" print-region
128 :enable mark-active 128 :enable mark-active
129 :help "Print region between mark and current position")) 129 :help "Print region between mark and current position"))
130(define-key menu-bar-files-menu [print-buffer] 130(define-key menu-bar-file-menu [print-buffer]
131 '(menu-item "Print Buffer" print-buffer 131 '(menu-item "Print Buffer" print-buffer
132 :help "Print current buffer with page headings")) 132 :help "Print current buffer with page headings"))
133 133
134(define-key menu-bar-files-menu [separator-print] 134(define-key menu-bar-file-menu [separator-print]
135 '(menu-item "--")) 135 '(menu-item "--"))
136 136
137(define-key menu-bar-files-menu [recover-session] 137(define-key menu-bar-file-menu [recover-session]
138 '(menu-item "Recover Crashed Session..." recover-session 138 '(menu-item "Recover Crashed Session..." recover-session
139 :enable (and auto-save-list-file-prefix 139 :enable (and auto-save-list-file-prefix
140 (file-directory-p 140 (file-directory-p
@@ -148,7 +148,7 @@ A large number or nil slows down menu responsiveness."
148 auto-save-list-file-prefix))) 148 auto-save-list-file-prefix)))
149 t)) 149 t))
150 :help "Recover edits from a crashed session")) 150 :help "Recover edits from a crashed session"))
151(define-key menu-bar-files-menu [revert-buffer] 151(define-key menu-bar-file-menu [revert-buffer]
152 '(menu-item "Revert Buffer" revert-buffer 152 '(menu-item "Revert Buffer" revert-buffer
153 :enable (or revert-buffer-function 153 :enable (or revert-buffer-function
154 revert-buffer-insert-file-contents-function 154 revert-buffer-insert-file-contents-function
@@ -157,12 +157,12 @@ A large number or nil slows down menu responsiveness."
157 (not (verify-visited-file-modtime 157 (not (verify-visited-file-modtime
158 (current-buffer)))))) 158 (current-buffer))))))
159 :help "Re-read current buffer from its file")) 159 :help "Re-read current buffer from its file"))
160(define-key menu-bar-files-menu [write-file] 160(define-key menu-bar-file-menu [write-file]
161 '(menu-item "Save Buffer As..." write-file 161 '(menu-item "Save Buffer As..." write-file
162 :enable (not (window-minibuffer-p 162 :enable (not (window-minibuffer-p
163 (frame-selected-window menu-updating-frame))) 163 (frame-selected-window menu-updating-frame)))
164 :help "Write current buffer to another file")) 164 :help "Write current buffer to another file"))
165(define-key menu-bar-files-menu [save-buffer] 165(define-key menu-bar-file-menu [save-buffer]
166 '(menu-item "Save (current buffer)" save-buffer 166 '(menu-item "Save (current buffer)" save-buffer
167 :enable (and (buffer-modified-p) 167 :enable (and (buffer-modified-p)
168 (buffer-file-name) 168 (buffer-file-name)
@@ -170,27 +170,27 @@ A large number or nil slows down menu responsiveness."
170 (frame-selected-window menu-updating-frame)))) 170 (frame-selected-window menu-updating-frame))))
171 :help "Save current buffer to its file")) 171 :help "Save current buffer to its file"))
172 172
173(define-key menu-bar-files-menu [separator-save] 173(define-key menu-bar-file-menu [separator-save]
174 '(menu-item "--")) 174 '(menu-item "--"))
175 175
176(define-key menu-bar-files-menu [kill-buffer] 176(define-key menu-bar-file-menu [kill-buffer]
177 '(menu-item "Close (current buffer)" kill-this-buffer 177 '(menu-item "Close (current buffer)" kill-this-buffer
178 :enable (kill-this-buffer-enabled-p) 178 :enable (kill-this-buffer-enabled-p)
179 :help "Discard current buffer")) 179 :help "Discard current buffer"))
180(define-key menu-bar-files-menu [insert-file] 180(define-key menu-bar-file-menu [insert-file]
181 '(menu-item "Insert File..." insert-file 181 '(menu-item "Insert File..." insert-file
182 :enable (not (window-minibuffer-p 182 :enable (not (window-minibuffer-p
183 (frame-selected-window menu-updating-frame))) 183 (frame-selected-window menu-updating-frame)))
184 :help "Insert another file into current buffer")) 184 :help "Insert another file into current buffer"))
185(define-key menu-bar-files-menu [dired] 185(define-key menu-bar-file-menu [dired]
186 '(menu-item "Open Directory..." dired 186 '(menu-item "Open Directory..." dired
187 :help "Read a directory, operate on its files")) 187 :help "Read a directory, operate on its files"))
188(define-key menu-bar-files-menu [open-file] 188(define-key menu-bar-file-menu [open-file]
189 '(menu-item "Open File..." find-file-existing 189 '(menu-item "Open File..." find-file-existing
190 :enable (not (window-minibuffer-p 190 :enable (not (window-minibuffer-p
191 (frame-selected-window menu-updating-frame))) 191 (frame-selected-window menu-updating-frame)))
192 :help "Read an existing file into an Emacs buffer")) 192 :help "Read an existing file into an Emacs buffer"))
193(define-key menu-bar-files-menu [new-file] 193(define-key menu-bar-file-menu [new-file]
194 '(menu-item "New File..." find-file 194 '(menu-item "New File..." find-file
195 :enable (not (window-minibuffer-p 195 :enable (not (window-minibuffer-p
196 (frame-selected-window menu-updating-frame))) 196 (frame-selected-window menu-updating-frame)))
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 0194160bcf4..231b7c3d6e3 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -1,6 +1,6 @@
1;;; mwheel.el --- Wheel mouse support 1;;; mwheel.el --- Wheel mouse support
2 2
3;; Copyright (C) 1998,2000,2001,2002 Free Software Foundation, Inc. 3;; Copyright (C) 1998, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
4;; Maintainer: William M. Perry <wmperry@gnu.org> 4;; Maintainer: William M. Perry <wmperry@gnu.org>
5;; Keywords: mouse 5;; Keywords: mouse
6 6
@@ -137,7 +137,7 @@ less than a full screen."
137 (integer :tag "Specific # of lines") 137 (integer :tag "Specific # of lines")
138 (float :tag "Fraction of window")))))) 138 (float :tag "Fraction of window"))))))
139 139
140(defcustom mouse-wheel-progessive-speed t 140(defcustom mouse-wheel-progressive-speed t
141 "If non-nil, the faster the user moves the wheel, the faster the scrolling. 141 "If non-nil, the faster the user moves the wheel, the faster the scrolling.
142Note that this has no effect when `mouse-wheel-scroll-amount' specifies 142Note that this has no effect when `mouse-wheel-scroll-amount' specifies
143a \"near full screen\" scroll or when the mouse wheel sends key instead 143a \"near full screen\" scroll or when the mouse wheel sends key instead
@@ -197,7 +197,7 @@ This should only be bound to mouse buttons 4 and 5."
197 (let ((list-elt mouse-wheel-scroll-amount)) 197 (let ((list-elt mouse-wheel-scroll-amount))
198 (while (consp (setq amt (pop list-elt)))))) 198 (while (consp (setq amt (pop list-elt))))))
199 (if (floatp amt) (setq amt (1+ (truncate (* amt (window-height)))))) 199 (if (floatp amt) (setq amt (1+ (truncate (* amt (window-height))))))
200 (when (and mouse-wheel-progessive-speed (numberp amt)) 200 (when (and mouse-wheel-progressive-speed (numberp amt))
201 ;; When the double-mouse-N comes in, a mouse-N has been executed already, 201 ;; When the double-mouse-N comes in, a mouse-N has been executed already,
202 ;; So by adding things up we get a squaring up (1, 3, 6, 10, 15, ...). 202 ;; So by adding things up we get a squaring up (1, 3, 6, 10, 15, ...).
203 (setq amt (* amt (event-click-count event)))) 203 (setq amt (* amt (event-click-count event))))
@@ -250,5 +250,5 @@ Returns non-nil if the new state is enabled."
250 250
251(provide 'mwheel) 251(provide 'mwheel)
252 252
253;;; arch-tag: 50ed00e7-3686-4b7a-8037-fb31aa5c237f 253;; arch-tag: 50ed00e7-3686-4b7a-8037-fb31aa5c237f
254;;; mwheel.el ends here 254;;; mwheel.el ends here
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index c5a2218e36e..098f2988f1b 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -357,6 +357,15 @@ Defaults to the value of `browse-url-epiphany-arguments' at the time
357 :type '(repeat (string :tag "Argument")) 357 :type '(repeat (string :tag "Argument"))
358 :group 'browse-url) 358 :group 'browse-url)
359 359
360;; GNOME means of invoking either Mozilla or Netrape.
361(defvar browse-url-gnome-moz-program "gnome-moz-remote")
362
363(defcustom browse-url-gnome-moz-arguments '()
364 "*A list of strings passed to the GNOME mozilla viewer as arguments."
365 :version "21.1"
366 :type '(repeat (string :tag "Argument"))
367 :group 'browse-url)
368
360(defcustom browse-url-mozilla-new-window-is-tab nil 369(defcustom browse-url-mozilla-new-window-is-tab nil
361 "*Whether to open up new windows in a tab or a new window. 370 "*Whether to open up new windows in a tab or a new window.
362If non-nil, then open the URL in a new tab rather than a new window if 371If non-nil, then open the URL in a new tab rather than a new window if
@@ -1032,14 +1041,6 @@ used instead of `browse-url-new-window-flag'."
1032 browse-url-epiphany-program 1041 browse-url-epiphany-program
1033 (append browse-url-epiphany-startup-arguments (list url)))))) 1042 (append browse-url-epiphany-startup-arguments (list url))))))
1034 1043
1035;; GNOME means of invoking either Mozilla or Netrape.
1036(defvar browse-url-gnome-moz-program "gnome-moz-remote")
1037(defcustom browse-url-gnome-moz-arguments '()
1038 "*A list of strings passed to the GNOME mozilla viewer as arguments."
1039 :version "21.1"
1040 :type '(repeat (string :tag "Argument"))
1041 :group 'browse-url)
1042
1043;;;###autoload 1044;;;###autoload
1044(defun browse-url-gnome-moz (url &optional new-window) 1045(defun browse-url-gnome-moz (url &optional new-window)
1045 "Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'. 1046 "Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e153ab3341f..502dc5e5115 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -159,7 +159,8 @@ Nil means to use a separate filename syntax for Tramp.")
159 159
160(defgroup tramp nil 160(defgroup tramp nil
161 "Edit remote files with a combination of rsh and rcp or similar programs." 161 "Edit remote files with a combination of rsh and rcp or similar programs."
162 :group 'files) 162 :group 'files
163 :version "21.4")
163 164
164(defcustom tramp-verbose 9 165(defcustom tramp-verbose 9
165 "*Verbosity level for tramp.el. 0 means be silent, 10 is most verbose." 166 "*Verbosity level for tramp.el. 0 means be silent, 10 is most verbose."
diff --git a/lisp/paren.el b/lisp/paren.el
index 6c5f9dece99..10695a41098 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -139,8 +139,8 @@ in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time."
139(defun show-paren-function () 139(defun show-paren-function ()
140 (if show-paren-mode 140 (if show-paren-mode
141 (let ((oldpos (point)) 141 (let ((oldpos (point))
142 (dir (cond ((eq (car (syntax-after (1- (point)))) 5) -1) 142 (dir (cond ((eq (car (syntax-after (1- (point)))) ?\)) -1)
143 ((eq (car (syntax-after (point))) 4) 1))) 143 ((eq (car (syntax-after (point))) ?\() 1)))
144 pos mismatch face) 144 pos mismatch face)
145 ;; 145 ;;
146 ;; Find the other end of the sexp. 146 ;; Find the other end of the sexp.
diff --git a/lisp/pcvs.el b/lisp/pcvs.el
index 0a666927c52..0c8fe92f2d6 100644
--- a/lisp/pcvs.el
+++ b/lisp/pcvs.el
@@ -1,7 +1,7 @@
1;;; pcvs.el --- a front-end to CVS 1;;; pcvs.el --- a front-end to CVS
2 2
3;; Copyright (C) 1991,92,93,94,95,95,97,98,99,2000,02,03,2004 3;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4;; Free Software Foundation, Inc. 4;; 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
5 5
6;; Author: (The PCL-CVS Trust) pcl-cvs@cyclic.com 6;; Author: (The PCL-CVS Trust) pcl-cvs@cyclic.com
7;; (Per Cederqvist) ceder@lysator.liu.se 7;; (Per Cederqvist) ceder@lysator.liu.se
@@ -923,6 +923,21 @@ With a prefix argument, prompt for cvs FLAGS to use."
923 (append flags modules) nil 'new 923 (append flags modules) nil 'new
924 :noexist t)) 924 :noexist t))
925 925
926(defun-cvs-mode (cvs-mode-checkout . NOARGS) (dir)
927 "Run cvs checkout against the current branch.
928The files are stored to DIR."
929 (interactive
930 (let* ((branch (cvs-prefix-get 'cvs-branch-prefix))
931 (prompt (format "CVS Checkout Directory for `%s%s': "
932 (cvs-get-module)
933 (if branch (format " (branch: %s)" branch)
934 ""))))
935 (list (read-directory-name prompt nil default-directory nil))))
936 (let ((modules (cvs-string->strings (cvs-get-module)))
937 (flags (cvs-add-branch-prefix
938 (cvs-flags-query 'cvs-checkout-flags "cvs checkout flags")))
939 (cvs-cvsroot (cvs-get-cvsroot)))
940 (cvs-checkout modules dir flags)))
926 941
927;;;; 942;;;;
928;;;; The code for running a "cvs update" and friends in various ways. 943;;;; The code for running a "cvs update" and friends in various ways.
@@ -2353,5 +2368,5 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
2353 2368
2354(provide 'pcvs) 2369(provide 'pcvs)
2355 2370
2356;;; arch-tag: 8e3a7494-0453-4389-9ab3-a557ce9fab61 2371;; arch-tag: 8e3a7494-0453-4389-9ab3-a557ce9fab61
2357;;; pcvs.el ends here 2372;;; pcvs.el ends here
diff --git a/lisp/printing.el b/lisp/printing.el
index 3efb53111fd..003e6893428 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -5,13 +5,13 @@
5 5
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Time-stamp: <2004/09/26 22:11:24 vinicius> 8;; Time-stamp: <2004/11/11 23:54:13 vinicius>
9;; Keywords: wp, print, PostScript 9;; Keywords: wp, print, PostScript
10;; Version: 6.8.1 10;; Version: 6.8.2
11;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ 11;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
12 12
13(defconst pr-version "6.8.1" 13(defconst pr-version "6.8.2"
14 "printing.el, v 6.8.1 <2004/09/26 vinicius> 14 "printing.el, v 6.8.2 <2004/11/11 vinicius>
15 15
16Please send all bug fixes and enhancements to 16Please send all bug fixes and enhancements to
17 Vinicius Jose Latorre <viniciusjl@ig.com.br> 17 Vinicius Jose Latorre <viniciusjl@ig.com.br>
@@ -1099,6 +1099,7 @@ Unless optional argument INPLACE is non-nil, return a new string."
1099 :tag "Printing Utilities" 1099 :tag "Printing Utilities"
1100 :link '(emacs-library-link :tag "Source Lisp File" "printing.el") 1100 :link '(emacs-library-link :tag "Source Lisp File" "printing.el")
1101 :prefix "pr-" 1101 :prefix "pr-"
1102 :version "20"
1102 :group 'wp 1103 :group 'wp
1103 :group 'postscript) 1104 :group 'postscript)
1104 1105
@@ -2474,20 +2475,16 @@ See `pr-ps-printer-alist'.")
2474 2475
2475(eval-and-compile 2476(eval-and-compile
2476 (defun pr-get-symbol (name) 2477 (defun pr-get-symbol (name)
2477 ;; Recent versions of easy-menu downcase names before interning them. 2478 (easy-menu-intern name))
2478 (and (fboundp 'easy-menu-name-match)
2479 (setq name (downcase name)))
2480 (or (intern-soft name)
2481 (make-symbol name)))
2482 2479
2483 (cond 2480 (cond
2484 ((eq ps-print-emacs-type 'emacs) ; GNU Emacs 2481 ((eq ps-print-emacs-type 'emacs) ; GNU Emacs
2485 (defsubst pr-region-active-p () 2482 (defun pr-region-active-p ()
2486 (and pr-auto-region transient-mark-mode mark-active))) 2483 (and pr-auto-region transient-mark-mode mark-active)))
2487 2484
2488 ((eq ps-print-emacs-type 'xemacs) ; XEmacs 2485 ((eq ps-print-emacs-type 'xemacs) ; XEmacs
2489 (defvar zmacs-region-stays nil) ; to avoid compilation gripes 2486 (defvar zmacs-region-stays nil) ; to avoid compilation gripes
2490 (defsubst pr-region-active-p () 2487 (defun pr-region-active-p ()
2491 (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p))))) 2488 (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p)))))
2492 2489
2493 2490
@@ -2907,18 +2904,18 @@ See `pr-ps-printer-alist'.")
2907 (pr-get-symbol "Printing"))))) 2904 (pr-get-symbol "Printing")))))
2908 ;; Emacs 21 2905 ;; Emacs 21
2909 (pr-menu-print-item 2906 (pr-menu-print-item
2910 (easy-menu-change '("files") "Print" pr-menu-spec "print-buffer") 2907 (easy-menu-change '("file") "Print" pr-menu-spec "print-buffer")
2911 (let ((items '("print-buffer" "print-region" 2908 (let ((items '("print-buffer" "print-region"
2912 "ps-print-buffer-faces" "ps-print-region-faces" 2909 "ps-print-buffer-faces" "ps-print-region-faces"
2913 "ps-print-buffer" "ps-print-region"))) 2910 "ps-print-buffer" "ps-print-region")))
2914 (while items 2911 (while items
2915 (easy-menu-remove-item nil '("files") (car items)) 2912 (easy-menu-remove-item nil '("file") (car items))
2916 (setq items (cdr items))) 2913 (setq items (cdr items)))
2917 (setq pr-menu-print-item nil 2914 (setq pr-menu-print-item nil
2918 pr-menu-bar (vector 'menu-bar 'files 2915 pr-menu-bar (vector 'menu-bar 'file
2919 (pr-get-symbol "Print"))))) 2916 (pr-get-symbol "Print")))))
2920 (t 2917 (t
2921 (easy-menu-change '("files") "Print" pr-menu-spec))) 2918 (easy-menu-change '("file") "Print" pr-menu-spec)))
2922 2919
2923 ;; Key binding 2920 ;; Key binding
2924 (global-set-key [print] 'pr-ps-fast-fire) 2921 (global-set-key [print] 'pr-ps-fast-fire)
@@ -6385,5 +6382,5 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
6385(provide 'printing) 6382(provide 'printing)
6386 6383
6387 6384
6388;;; arch-tag: 9ce9ac3f-0f60-4370-900b-1943215d9d18 6385;; arch-tag: 9ce9ac3f-0f60-4370-900b-1943215d9d18
6389;;; printing.el ends here 6386;;; printing.el ends here
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 472cfc3053e..e7eb0657eac 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -1292,7 +1292,7 @@ If ARG is non-nil, ask the user to confirm the command."
1292 1292
1293 ;; Move to the end of the debugger buffer, so that it is automatically 1293 ;; Move to the end of the debugger buffer, so that it is automatically
1294 ;; scrolled from then on. 1294 ;; scrolled from then on.
1295 (end-of-buffer) 1295 (goto-char (point-max))
1296 1296
1297 ;; Display both the source window and the debugger window (the former 1297 ;; Display both the source window and the debugger window (the former
1298 ;; above the latter). No need to show the debugger window unless it 1298 ;; above the latter). No need to show the debugger window unless it
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 223455e9872..034cdaf5fdd 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -785,11 +785,14 @@ the function in `compilation-buffer-name-function', so you can set that
785to a function that generates a unique name." 785to a function that generates a unique name."
786 (interactive 786 (interactive
787 (list 787 (list
788 (if (or compilation-read-command current-prefix-arg) 788 (let ((command (eval compile-command)))
789 (read-from-minibuffer "Compile command: " 789 (if (or compilation-read-command current-prefix-arg)
790 (eval compile-command) nil nil 790 (read-from-minibuffer "Compile command: "
791 '(compile-history . 1)) 791 command nil nil
792 (eval compile-command)) 792 (if (equal (car compile-history) command)
793 '(compile-history . 1)
794 'compile-history))
795 command))
793 (consp current-prefix-arg))) 796 (consp current-prefix-arg)))
794 (unless (equal command (eval compile-command)) 797 (unless (equal command (eval compile-command))
795 (setq compile-command command)) 798 (setq compile-command command))
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 94458df56e8..38cc167d942 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -5292,7 +5292,7 @@ Customized by setting variables `cperl-shrink-wrap-info-frame',
5292 iniwin (selected-window) 5292 iniwin (selected-window)
5293 fr1 (window-frame iniwin)) 5293 fr1 (window-frame iniwin))
5294 (set-buffer buf) 5294 (set-buffer buf)
5295 (beginning-of-buffer) 5295 (goto-char (point-min))
5296 (or isvar 5296 (or isvar
5297 (progn (re-search-forward "^-X[ \t\n]") 5297 (progn (re-search-forward "^-X[ \t\n]")
5298 (forward-line -1))) 5298 (forward-line -1)))
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 74368661d3e..cf2b0797e82 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -60,6 +60,7 @@
60(defvar gdb-previous-address nil) 60(defvar gdb-previous-address nil)
61(defvar gdb-previous-frame nil) 61(defvar gdb-previous-frame nil)
62(defvar gdb-current-frame nil) 62(defvar gdb-current-frame nil)
63(defvar gdb-current-stack-level nil)
63(defvar gdb-current-language nil) 64(defvar gdb-current-language nil)
64(defvar gdb-view-source t "Non-nil means that source code can be viewed.") 65(defvar gdb-view-source t "Non-nil means that source code can be viewed.")
65(defvar gdb-selected-view 'source "Code type that user wishes to view.") 66(defvar gdb-selected-view 'source "Code type that user wishes to view.")
@@ -183,6 +184,7 @@ detailed description of this mode.
183 (setq gdb-previous-address nil) 184 (setq gdb-previous-address nil)
184 (setq gdb-previous-frame nil) 185 (setq gdb-previous-frame nil)
185 (setq gdb-current-frame nil) 186 (setq gdb-current-frame nil)
187 (setq gdb-current-stack-level nil)
186 (setq gdb-view-source t) 188 (setq gdb-view-source t)
187 (setq gdb-selected-view 'source) 189 (setq gdb-selected-view 'source)
188 (setq gdb-var-list nil) 190 (setq gdb-var-list nil)
@@ -393,7 +395,8 @@ detailed description of this mode.
393 "If non-nil highlight values that have recently changed in the speedbar. 395 "If non-nil highlight values that have recently changed in the speedbar.
394The highlighting is done with `font-lock-warning-face'." 396The highlighting is done with `font-lock-warning-face'."
395 :type 'boolean 397 :type 'boolean
396 :group 'gud) 398 :group 'gud
399 :version "21.4")
397 400
398(defun gdb-speedbar-expand-node (text token indent) 401(defun gdb-speedbar-expand-node (text token indent)
399 "Expand the node the user clicked on. 402 "Expand the node the user clicked on.
@@ -1291,9 +1294,8 @@ static char *magick[] = {
1291 '(mouse-face highlight 1294 '(mouse-face highlight
1292 help-echo "mouse-2, RET: Select frame")) 1295 help-echo "mouse-2, RET: Select frame"))
1293 (beginning-of-line) 1296 (beginning-of-line)
1294 (when (and (or (looking-at "^#[0-9]*\\s-*\\S-* in \\(\\S-*\\)") 1297 (when (and (looking-at "^#\\([0-9]+\\)")
1295 (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)")) 1298 (equal (match-string 1) gdb-current-stack-level))
1296 (equal (match-string 1) gdb-current-frame))
1297 (put-text-property (point-at-bol) (point-at-eol) 1299 (put-text-property (point-at-bol) (point-at-eol)
1298 'face '(:inverse-video t))) 1300 'face '(:inverse-video t)))
1299 (forward-line 1)))))) 1301 (forward-line 1))))))
@@ -2047,6 +2049,8 @@ BUFFER nil or omitted means use the current buffer."
2047 (delq 'gdb-get-current-frame gdb-pending-triggers)) 2049 (delq 'gdb-get-current-frame gdb-pending-triggers))
2048 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) 2050 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
2049 (goto-char (point-min)) 2051 (goto-char (point-min))
2052 (if (looking-at "Stack level \\([0-9]+\\)")
2053 (setq gdb-current-stack-level (match-string 1)))
2050 (forward-line) 2054 (forward-line)
2051 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ") 2055 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ")
2052 (progn 2056 (progn
diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el
index 692fce0234e..6720014ed31 100644
--- a/lisp/progmodes/idlw-shell.el
+++ b/lisp/progmodes/idlw-shell.el
@@ -508,11 +508,19 @@ the expression output by IDL."
508(defvar comint-last-input-start) 508(defvar comint-last-input-start)
509(defvar comint-last-input-end) 509(defvar comint-last-input-end)
510 510
511(defvar idlwave-shell-temp-pro-file nil
512 "Absolute pathname for temporary IDL file for compiling regions")
513
514(defvar idlwave-shell-temp-rinfo-save-file nil
515 "Absolute pathname for temporary IDL file save file for routine_info.
516This is used to speed up the reloading of the routine info procedure
517before use by the shell.")
518
511(defun idlwave-shell-temp-file (type) 519(defun idlwave-shell-temp-file (type)
512 "Return a temp file, creating it if necessary. 520 "Return a temp file, creating it if necessary.
513 521
514TYPE is either 'pro or 'rinfo, and idlwave-shell-temp-pro-file or 522TYPE is either `pro' or `rinfo', and `idlwave-shell-temp-pro-file' or
515idlwave-shell-temp-rinfo-save-file is set (respectively)." 523`idlwave-shell-temp-rinfo-save-file' is set (respectively)."
516 (cond 524 (cond
517 ((eq type 'rinfo) 525 ((eq type 'rinfo)
518 (or idlwave-shell-temp-rinfo-save-file 526 (or idlwave-shell-temp-rinfo-save-file
@@ -550,17 +558,6 @@ idlwave-shell-temp-rinfo-save-file is set (respectively)."
550 nil) 558 nil)
551 file))) 559 file)))
552 560
553;; Other variables
554(defvar idlwave-shell-temp-pro-file
555 nil
556 "Absolute pathname for temporary IDL file for compiling regions")
557
558(defvar idlwave-shell-temp-rinfo-save-file
559 nil
560 "Absolute pathname for temporary IDL file save file for routine_info.
561This is used to speed up the reloading of the routine info procedure
562before use by the shell.")
563
564(defvar idlwave-shell-dirstack-query "cd,current=___cur & print,___cur" 561(defvar idlwave-shell-dirstack-query "cd,current=___cur & print,___cur"
565 "Command used by `idlwave-shell-resync-dirs' to query IDL for 562 "Command used by `idlwave-shell-resync-dirs' to query IDL for
566the directory stack.") 563the directory stack.")
@@ -2523,6 +2520,10 @@ idlw-shell-examine-alist from which to select the help command text."
2523(defvar idlwave-shell-examine-window-alist nil 2520(defvar idlwave-shell-examine-window-alist nil
2524 "Variable to hold the win/height pairs for all *Examine* windows.") 2521 "Variable to hold the win/height pairs for all *Examine* windows.")
2525 2522
2523(defvar idlwave-shell-examine-map (make-sparse-keymap))
2524(define-key idlwave-shell-examine-map "q" 'idlwave-shell-examine-display-quit)
2525(define-key idlwave-shell-examine-map "c" 'idlwave-shell-examine-display-clear)
2526
2526(defun idlwave-shell-examine-display () 2527(defun idlwave-shell-examine-display ()
2527 "View the examine command output in a separate buffer." 2528 "View the examine command output in a separate buffer."
2528 (let (win cur-beg cur-end) 2529 (let (win cur-beg cur-end)
@@ -2603,10 +2604,6 @@ idlw-shell-examine-alist from which to select the help command text."
2603 (skip-chars-backward "\n") 2604 (skip-chars-backward "\n")
2604 (recenter -1))))) 2605 (recenter -1)))))
2605 2606
2606(defvar idlwave-shell-examine-map (make-sparse-keymap))
2607(define-key idlwave-shell-examine-map "q" 'idlwave-shell-examine-display-quit)
2608(define-key idlwave-shell-examine-map "c" 'idlwave-shell-examine-display-clear)
2609
2610(defun idlwave-shell-examine-display-quit () 2607(defun idlwave-shell-examine-display-quit ()
2611 (interactive) 2608 (interactive)
2612 (let ((win (selected-window))) 2609 (let ((win (selected-window)))
diff --git a/lisp/simple.el b/lisp/simple.el
index b45d9eee348..8f38dfde2ec 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -67,6 +67,44 @@
67 (switch-to-buffer found))) 67 (switch-to-buffer found)))
68 68
69;;; next-error support framework 69;;; next-error support framework
70
71(defgroup next-error nil
72 "next-error support framework."
73 :group 'compilation
74 :version "21.4")
75
76(defface next-error
77 '((t (:inherit region)))
78 "Face used to highlight next error locus."
79 :group 'next-error
80 :version "21.4")
81
82(defcustom next-error-highlight 0.1
83 "*Highlighting of locations in selected source buffers.
84If number, highlight the locus in next-error face for given time in seconds.
85If t, use persistent overlays fontified in next-error face.
86If nil, don't highlight the locus in the source buffer.
87If `fringe-arrow', indicate the locus by the fringe arrow."
88 :type '(choice (number :tag "Delay")
89 (const :tag "Persistent overlay" t)
90 (const :tag "No highlighting" nil)
91 (const :tag "Fringe arrow" 'fringe-arrow))
92 :group 'next-error
93 :version "21.4")
94
95(defcustom next-error-highlight-no-select 0.1
96 "*Highlighting of locations in non-selected source buffers.
97If number, highlight the locus in next-error face for given time in seconds.
98If t, use persistent overlays fontified in next-error face.
99If nil, don't highlight the locus in the source buffer.
100If `fringe-arrow', indicate the locus by the fringe arrow."
101 :type '(choice (number :tag "Delay")
102 (const :tag "Persistent overlay" t)
103 (const :tag "No highlighting" nil)
104 (const :tag "Fringe arrow" 'fringe-arrow))
105 :group 'next-error
106 :version "21.4")
107
70(defvar next-error-last-buffer nil 108(defvar next-error-last-buffer nil
71 "The most recent next-error buffer. 109 "The most recent next-error buffer.
72A buffer becomes most recent when its compilation, grep, or 110A buffer becomes most recent when its compilation, grep, or
@@ -213,43 +251,6 @@ select the source buffer."
213 (interactive "p") 251 (interactive "p")
214 (next-error-no-select (- (or n 1)))) 252 (next-error-no-select (- (or n 1))))
215 253
216(defgroup next-error nil
217 "next-error support framework."
218 :group 'compilation
219 :version "21.4")
220
221(defface next-error
222 '((t (:inherit region)))
223 "Face used to highlight next error locus."
224 :group 'next-error
225 :version "21.4")
226
227(defcustom next-error-highlight 0.1
228 "*Highlighting of locations in selected source buffers.
229If number, highlight the locus in next-error face for given time in seconds.
230If t, use persistent overlays fontified in next-error face.
231If nil, don't highlight the locus in the source buffer.
232If `fringe-arrow', indicate the locus by the fringe arrow."
233 :type '(choice (number :tag "Delay")
234 (const :tag "Persistent overlay" t)
235 (const :tag "No highlighting" nil)
236 (const :tag "Fringe arrow" 'fringe-arrow))
237 :group 'next-error
238 :version "21.4")
239
240(defcustom next-error-highlight-no-select 0.1
241 "*Highlighting of locations in non-selected source buffers.
242If number, highlight the locus in next-error face for given time in seconds.
243If t, use persistent overlays fontified in next-error face.
244If nil, don't highlight the locus in the source buffer.
245If `fringe-arrow', indicate the locus by the fringe arrow."
246 :type '(choice (number :tag "Delay")
247 (const :tag "Persistent overlay" t)
248 (const :tag "No highlighting" nil)
249 (const :tag "Fringe arrow" 'fringe-arrow))
250 :group 'next-error
251 :version "21.4")
252
253;;; Internal variable for `next-error-follow-mode-post-command-hook'. 254;;; Internal variable for `next-error-follow-mode-post-command-hook'.
254(defvar next-error-follow-last-line nil) 255(defvar next-error-follow-last-line nil)
255 256
@@ -2284,6 +2285,8 @@ This command is similar to `copy-region-as-kill', except that it gives
2284visual feedback indicating the extent of the region being copied." 2285visual feedback indicating the extent of the region being copied."
2285 (interactive "r") 2286 (interactive "r")
2286 (copy-region-as-kill beg end) 2287 (copy-region-as-kill beg end)
2288 ;; This use of interactive-p is correct
2289 ;; because the code it controls just gives the user visual feedback.
2287 (if (interactive-p) 2290 (if (interactive-p)
2288 (let ((other-end (if (= (point) beg) end beg)) 2291 (let ((other-end (if (= (point) beg) end beg))
2289 (opoint (point)) 2292 (opoint (point))
@@ -3085,13 +3088,13 @@ It is the column where point was
3085at the start of current run of vertical motion commands. 3088at the start of current run of vertical motion commands.
3086When the `track-eol' feature is doing its job, the value is 9999.") 3089When the `track-eol' feature is doing its job, the value is 9999.")
3087 3090
3088(defcustom line-move-ignore-invisible nil 3091(defcustom line-move-ignore-invisible t
3089 "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines. 3092 "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
3090Outline mode sets this." 3093Outline mode sets this."
3091 :type 'boolean 3094 :type 'boolean
3092 :group 'editing-basics) 3095 :group 'editing-basics)
3093 3096
3094(defun line-move-invisible (pos) 3097(defun line-move-invisible-p (pos)
3095 "Return non-nil if the character after POS is currently invisible." 3098 "Return non-nil if the character after POS is currently invisible."
3096 (let ((prop 3099 (let ((prop
3097 (get-char-property pos 'invisible))) 3100 (get-char-property pos 'invisible)))
@@ -3102,7 +3105,8 @@ Outline mode sets this."
3102 3105
3103;; This is the guts of next-line and previous-line. 3106;; This is the guts of next-line and previous-line.
3104;; Arg says how many lines to move. 3107;; Arg says how many lines to move.
3105(defun line-move (arg) 3108;; The value is t if we can move the specified number of lines.
3109(defun line-move (arg &optional noerror to-end)
3106 ;; Don't run any point-motion hooks, and disregard intangibility, 3110 ;; Don't run any point-motion hooks, and disregard intangibility,
3107 ;; for intermediate positions. 3111 ;; for intermediate positions.
3108 (let ((inhibit-point-motion-hooks t) 3112 (let ((inhibit-point-motion-hooks t)
@@ -3118,6 +3122,7 @@ Outline mode sets this."
3118 (or (not (bolp)) (eq last-command 'end-of-line))) 3122 (or (not (bolp)) (eq last-command 'end-of-line)))
3119 9999 3123 9999
3120 (current-column)))) 3124 (current-column))))
3125
3121 (if (and (not (integerp selective-display)) 3126 (if (and (not (integerp selective-display))
3122 (not line-move-ignore-invisible)) 3127 (not line-move-ignore-invisible))
3123 ;; Use just newline characters. 3128 ;; Use just newline characters.
@@ -3133,28 +3138,43 @@ Outline mode sets this."
3133 (and (zerop (forward-line arg)) 3138 (and (zerop (forward-line arg))
3134 (bolp) 3139 (bolp)
3135 (setq arg 0))) 3140 (setq arg 0)))
3136 (signal (if (< arg 0) 3141 (unless noerror
3137 'beginning-of-buffer 3142 (signal (if (< arg 0)
3138 'end-of-buffer) 3143 'beginning-of-buffer
3139 nil)) 3144 'end-of-buffer)
3145 nil)))
3140 ;; Move by arg lines, but ignore invisible ones. 3146 ;; Move by arg lines, but ignore invisible ones.
3141 (while (> arg 0) 3147 (let (done)
3142 ;; If the following character is currently invisible, 3148 (while (and (> arg 0) (not done))
3143 ;; skip all characters with that same `invisible' property value. 3149 ;; If the following character is currently invisible,
3144 (while (and (not (eobp)) (line-move-invisible (point))) 3150 ;; skip all characters with that same `invisible' property value.
3145 (goto-char (next-char-property-change (point)))) 3151 (while (and (not (eobp)) (line-move-invisible-p (point)))
3146 ;; Now move a line. 3152 (goto-char (next-char-property-change (point))))
3147 (end-of-line) 3153 ;; Now move a line.
3148 (and (zerop (vertical-motion 1)) 3154 (end-of-line)
3149 (signal 'end-of-buffer nil)) 3155 (and (zerop (vertical-motion 1))
3150 (setq arg (1- arg))) 3156 (if (not noerror)
3151 (while (< arg 0) 3157 (signal 'end-of-buffer nil)
3152 (beginning-of-line) 3158 (setq done t)))
3153 (and (zerop (vertical-motion -1)) 3159 (unless done
3154 (signal 'beginning-of-buffer nil)) 3160 (setq arg (1- arg))))
3155 (setq arg (1+ arg)) 3161 (while (and (< arg 0) (not done))
3156 (while (and (not (bobp)) (line-move-invisible (1- (point)))) 3162 (beginning-of-line)
3157 (goto-char (previous-char-property-change (point))))))) 3163
3164 (if (zerop (vertical-motion -1))
3165 (if (not noerror)
3166 (signal 'beginning-of-buffer nil)
3167 (setq done t)))
3168 (unless done
3169 (setq arg (1+ arg))
3170 (while (and ;; Don't move over previous invis lines
3171 ;; if our target is the middle of this line.
3172 (or (zerop (or goal-column temporary-goal-column))
3173 (< arg 0))
3174 (not (bobp)) (line-move-invisible-p (1- (point))))
3175 (goto-char (previous-char-property-change (point))))))))
3176 ;; This is the value the function returns.
3177 (= arg 0))
3158 3178
3159 (cond ((> arg 0) 3179 (cond ((> arg 0)
3160 ;; If we did not move down as far as desired, 3180 ;; If we did not move down as far as desired,
@@ -3165,8 +3185,7 @@ Outline mode sets this."
3165 ;; at least go to end of line. 3185 ;; at least go to end of line.
3166 (beginning-of-line)) 3186 (beginning-of-line))
3167 (t 3187 (t
3168 (line-move-finish (or goal-column temporary-goal-column) opoint))))) 3188 (line-move-finish (or goal-column temporary-goal-column) opoint))))))
3169 nil)
3170 3189
3171(defun line-move-finish (column opoint) 3190(defun line-move-finish (column opoint)
3172 (let ((repeat t)) 3191 (let ((repeat t))
@@ -3179,9 +3198,11 @@ Outline mode sets this."
3179 (line-end 3198 (line-end
3180 ;; Compute the end of the line 3199 ;; Compute the end of the line
3181 ;; ignoring effectively intangible newlines. 3200 ;; ignoring effectively intangible newlines.
3182 (let ((inhibit-point-motion-hooks nil) 3201 (save-excursion
3183 (inhibit-field-text-motion t)) 3202 (let ((inhibit-point-motion-hooks nil)
3184 (save-excursion (end-of-line) (point))))) 3203 (inhibit-field-text-motion t))
3204 (end-of-line))
3205 (point))))
3185 3206
3186 ;; Move to the desired column. 3207 ;; Move to the desired column.
3187 (line-move-to-column column) 3208 (line-move-to-column column)
@@ -3232,13 +3253,13 @@ and `current-column' to be able to ignore invisible text."
3232 (move-to-column col)) 3253 (move-to-column col))
3233 3254
3234 (when (and line-move-ignore-invisible 3255 (when (and line-move-ignore-invisible
3235 (not (bolp)) (line-move-invisible (1- (point)))) 3256 (not (bolp)) (line-move-invisible-p (1- (point))))
3236 (let ((normal-location (point)) 3257 (let ((normal-location (point))
3237 (normal-column (current-column))) 3258 (normal-column (current-column)))
3238 ;; If the following character is currently invisible, 3259 ;; If the following character is currently invisible,
3239 ;; skip all characters with that same `invisible' property value. 3260 ;; skip all characters with that same `invisible' property value.
3240 (while (and (not (eobp)) 3261 (while (and (not (eobp))
3241 (line-move-invisible (point))) 3262 (line-move-invisible-p (point)))
3242 (goto-char (next-char-property-change (point)))) 3263 (goto-char (next-char-property-change (point))))
3243 ;; Have we advanced to a larger column position? 3264 ;; Have we advanced to a larger column position?
3244 (if (> (current-column) normal-column) 3265 (if (> (current-column) normal-column)
@@ -3251,9 +3272,45 @@ and `current-column' to be able to ignore invisible text."
3251 ;; but with a more reasonable buffer position. 3272 ;; but with a more reasonable buffer position.
3252 (goto-char normal-location) 3273 (goto-char normal-location)
3253 (let ((line-beg (save-excursion (beginning-of-line) (point)))) 3274 (let ((line-beg (save-excursion (beginning-of-line) (point))))
3254 (while (and (not (bolp)) (line-move-invisible (1- (point)))) 3275 (while (and (not (bolp)) (line-move-invisible-p (1- (point))))
3255 (goto-char (previous-char-property-change (point) line-beg)))))))) 3276 (goto-char (previous-char-property-change (point) line-beg))))))))
3256 3277
3278(defun move-end-of-line (arg)
3279 "Move point to end of current line.
3280With argument ARG not nil or 1, move forward ARG - 1 lines first.
3281If point reaches the beginning or end of buffer, it stops there.
3282To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
3283
3284This command does not move point across a field boundary unless doing so
3285would move beyond there to a different line; if ARG is nil or 1, and
3286point starts at a field boundary, point does not move. To ignore field
3287boundaries bind `inhibit-field-text-motion' to t."
3288 (interactive "p")
3289 (or arg (setq arg 1))
3290 (let (done)
3291 (while (not done)
3292 (let ((newpos
3293 (save-excursion
3294 (let ((goal-column 0))
3295 (and (line-move arg t)
3296 (not (bobp))
3297 (progn
3298 (while (and (not (bobp)) (line-move-invisible-p (1- (point))))
3299 (goto-char (previous-char-property-change (point))))
3300 (backward-char 1)))
3301 (point)))))
3302 (goto-char newpos)
3303 (if (and (> (point) newpos)
3304 (eq (preceding-char) ?\n))
3305 (backward-char 1)
3306 (if (and (> (point) newpos) (not (eobp))
3307 (not (eq (following-char) ?\n)))
3308 ;; If we skipped something intangible
3309 ;; and now we're not really at eol,
3310 ;; keep going.
3311 (setq arg 1)
3312 (setq done t)))))))
3313
3257;;; Many people have said they rarely use this feature, and often type 3314;;; Many people have said they rarely use this feature, and often type
3258;;; it by accident. Maybe it shouldn't even be on a key. 3315;;; it by accident. Maybe it shouldn't even be on a key.
3259(put 'set-goal-column 'disabled t) 3316(put 'set-goal-column 'disabled t)
@@ -3302,7 +3359,8 @@ With arg N, put point N/10 of the way from the true beginning."
3302 (progn 3359 (progn
3303 (select-window window) 3360 (select-window window)
3304 ;; Set point and mark in that window's buffer. 3361 ;; Set point and mark in that window's buffer.
3305 (beginning-of-buffer arg) 3362 (with-no-warnings
3363 (beginning-of-buffer arg))
3306 ;; Set point accordingly. 3364 ;; Set point accordingly.
3307 (recenter '(t))) 3365 (recenter '(t)))
3308 (select-window orig-window)))) 3366 (select-window orig-window))))
@@ -3318,7 +3376,8 @@ With arg N, put point N/10 of the way from the true end."
3318 (unwind-protect 3376 (unwind-protect
3319 (progn 3377 (progn
3320 (select-window window) 3378 (select-window window)
3321 (end-of-buffer arg) 3379 (with-no-warnings
3380 (end-of-buffer arg))
3322 (recenter '(t))) 3381 (recenter '(t)))
3323 (select-window orig-window)))) 3382 (select-window orig-window))))
3324 3383
diff --git a/lisp/subr.el b/lisp/subr.el
index 621aec8d571..bb13298d6fe 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2221,12 +2221,20 @@ from `standard-syntax-table' otherwise."
2221 table)) 2221 table))
2222 2222
2223(defun syntax-after (pos) 2223(defun syntax-after (pos)
2224 "Return the syntax of the char after POS." 2224 "Return the syntax of the char after POS.
2225The value is either a syntax class character (a character that designates
2226a syntax in `modify-syntax-entry'), or a cons cell
2227of the form (CLASS . MATCH), where CLASS is the syntax class character
2228and MATCH is the matching parenthesis."
2225 (unless (or (< pos (point-min)) (>= pos (point-max))) 2229 (unless (or (< pos (point-min)) (>= pos (point-max)))
2226 (let ((st (if parse-sexp-lookup-properties 2230 (let* ((st (if parse-sexp-lookup-properties
2227 (get-char-property pos 'syntax-table)))) 2231 (get-char-property pos 'syntax-table)))
2228 (if (consp st) st 2232 (value
2229 (aref (or st (syntax-table)) (char-after pos)))))) 2233 (if (consp st) st
2234 (aref (or st (syntax-table)) (char-after pos))))
2235 (code (if (consp value) (car value) value)))
2236 (setq code (aref "-.w_()'\"$\\/<>@!|" code))
2237 (if (consp value) (cons code (cdr value)) code))))
2230 2238
2231(defun add-to-invisibility-spec (arg) 2239(defun add-to-invisibility-spec (arg)
2232 "Add elements to `buffer-invisibility-spec'. 2240 "Add elements to `buffer-invisibility-spec'.
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
new file mode 100644
index 00000000000..cb692616947
--- /dev/null
+++ b/lisp/textmodes/conf-mode.el
@@ -0,0 +1,531 @@
1;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files
2
3;; Copyright (C) 2004 by Daniel Pfeiffer <occitan@esperanto.org>
4;; Keywords: conf ini windows java
5
6;; This file is part of GNU Emacs.
7
8;; GNU Emacs is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation; either version 2, or (at your option)
11;; any later version.
12
13;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with GNU Emacs; see the file COPYING. If not, write to the
20;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21;; Boston, MA 02111-1307, USA.
22
23;;; Commentary:
24;;
25;; This mode is designed to edit many similar varieties of Conf/Ini files and
26;; Java properties. It started out from Aurélien Tisné's ini-mode.
27;; `conf-space-keywords' were inspired by Robert Fitzgerald's any-ini-mode.
28
29
30;;; Code:
31
32(require 'newcomment)
33
34;; Variables:
35
36(defgroup conf nil
37 "Configuration files."
38 :group 'data
39 :version "21.4")
40
41(defcustom conf-assignment-column 24
42 "Align assignments to this column by default with \\[conf-align-assignments].
43If this number is negative, the `=' comes before the whitespace. Use 0 to
44not align (only setting space according to `conf-assignment-space')."
45 :type 'integer
46 :group 'conf)
47
48(defcustom conf-javaprop-assignment-column 32
49 "Value for `conf-assignment-column' in Java properties buffers."
50 :type 'integer
51 :group 'conf)
52
53(defcustom conf-colon-assignment-column (- (abs conf-assignment-column))
54 "Value for `conf-assignment-column' in Java properties buffers."
55 :type 'integer
56 :group 'conf)
57
58(defcustom conf-assignment-space t
59 "Put at least one space around assignments when aligning."
60 :type 'boolean
61 :group 'conf)
62
63(defcustom conf-colon-assignment-space nil
64 "Value for `conf-assignment-space' in colon style Conf mode buffers."
65 :type 'boolean
66 :group 'conf)
67
68
69(defvar conf-mode-map
70 (let ((map (make-sparse-keymap)))
71 (define-key map "\C-c\C-u" 'conf-unix-mode)
72 (define-key map "\C-c\C-w" 'conf-windows-mode)
73 (define-key map "\C-c\C-j" 'conf-javaprop-mode)
74 (define-key map "\C-c\C-s" 'conf-space-mode)
75 (define-key map "\C-c " 'conf-space-mode)
76 (define-key map "\C-c\C-c" 'conf-colon-mode)
77 (define-key map "\C-c:" 'conf-colon-mode)
78 (define-key map "\C-c\C-x" 'conf-xdefaults-mode)
79 (define-key map "\C-c\C-q" 'conf-quote-normal)
80 (define-key map "\C-c\"" 'conf-quote-normal)
81 (define-key map "\C-c'" 'conf-quote-normal)
82 (define-key map "\C-c\C-a" 'conf-align-assignments)
83 map)
84 "Local keymap for conf-mode buffers.")
85
86(defvar conf-mode-syntax-table
87 (let ((table (make-syntax-table)))
88 (modify-syntax-entry ?= "." table)
89 (modify-syntax-entry ?_ "_" table)
90 (modify-syntax-entry ?- "_" table)
91 (modify-syntax-entry ?. "_" table)
92 (modify-syntax-entry ?\' "\"" table)
93; (modify-syntax-entry ?: "_" table)
94 (modify-syntax-entry ?\; "<" table)
95 (modify-syntax-entry ?\n ">" table)
96 (modify-syntax-entry ?\r ">" table)
97 table)
98 "Syntax table in use in Windows style conf-mode buffers.")
99
100(defvar conf-unix-mode-syntax-table
101 (let ((table (make-syntax-table conf-mode-syntax-table)))
102 (modify-syntax-entry ?\# "<" table)
103 ;; override
104 (modify-syntax-entry ?\; "." table)
105 table)
106 "Syntax table in use in Unix style conf-mode buffers.")
107
108(defvar conf-javaprop-mode-syntax-table
109 (let ((table (make-syntax-table conf-unix-mode-syntax-table)))
110 (modify-syntax-entry ?/ ". 124" table)
111 (modify-syntax-entry ?* ". 23b" table)
112 table)
113 "Syntax table in use in Java prperties buffers.")
114
115(defvar conf-xdefaults-mode-syntax-table
116 (let ((table (make-syntax-table conf-mode-syntax-table)))
117 (modify-syntax-entry ?! "<" table)
118 ;; override
119 (modify-syntax-entry ?\; "." table)
120 table)
121 "Syntax table in use in Xdefaults style conf-mode buffers.")
122
123
124(defvar conf-font-lock-keywords
125 `(;; [section] (do this first because it may look like a parameter)
126 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
127 ;; var=val or var[index]=val
128 ("^[ \t]*\\(.+?\\)\\(?:\\[\\(.*?\\)\\]\\)?[ \t]*="
129 (1 'font-lock-variable-name-face)
130 (2 'font-lock-constant-face nil t))
131 ;; section { ... } (do this last because some assign ...{...)
132 ("^[ \t]*\\([^=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
133 "Keywords to hilight in Conf mode")
134
135(defvar conf-javaprop-font-lock-keywords
136 '(;; var=val
137 ("^[ \t]*\\(.+?\\)\\(?:\\.\\([0-9]+\\)\\(?:\\.\\(.+?\\)\\(?:\\.\\([0-9]+\\)\\(?:\\.\\(.+?\\)\\(?:\\.\\([0-9]+\\)\\(\\..+?\\)?\\)?\\)?\\)?\\)?\\)?\\([:= \t]\\|$\\)"
138 (1 'font-lock-variable-name-face)
139 (2 'font-lock-constant-face nil t)
140 (3 'font-lock-variable-name-face nil t)
141 (4 'font-lock-constant-face nil t)
142 (5 'font-lock-variable-name-face nil t)
143 (6 'font-lock-constant-face nil t)
144 (7 'font-lock-variable-name-face nil t)))
145 "Keywords to hilight in Conf Java Properties mode")
146
147(defvar conf-space-keywords-alist
148 '(("\\`/etc/gpm/" . "key\\|name\\|foreground\\|background\\|border\\|head")
149 ("\\`/etc/magic\\'" . "[^ \t]+[ \t]+\\(?:[bl]?e?\\(?:short\\|long\\)\\|byte\\|string\\)[^ \t]*")
150 ("/mod\\(?:ules\\|probe\\)\\.conf" . "alias\\|in\\(?:clude\\|stall\\)\\|options\\|remove")
151 ("/manpath\\.config" . "MAN\\(?:DATORY_MANPATH\\|PATH_MAP\\|DB_MAP\\)")
152 ("/sensors\\.conf" . "chip\\|bus\\|label\\|compute\\|set\\|ignore")
153 ("/sane\\(\\.d\\)?/" . "option\\|device\\|port\\|usb\\|sc\\(?:si\\|anner\\)")
154 ("/resmgr\\.conf" . "class\\|add\\|allow\\|deny")
155 ("/dictionary\\.lst\\'" . "DICT\\|HYPH\\|THES")
156 ("/tuxracer/options" . "set"))
157 "File name based settings for `conf-space-keywords'.")
158
159(defvar conf-space-keywords nil
160 "Regexps for functions that may come before a space assignment.
161This allows constructs such as
162keyword var value
163This variable is best set in the file local variables, or through
164`conf-space-keywords-alist'.")
165
166(defvar conf-space-font-lock-keywords
167 `(;; [section] (do this first because it may look like a parameter)
168 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
169 ;; section { ... } (do this first because it looks like a parameter)
170 ("^[ \t]*\\(.+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face)
171 ;; var val
172 (eval if conf-space-keywords
173 (list (concat "^[ \t]*\\(" conf-space-keywords "\\)[ \t]+\\([^\000- ]+\\)")
174 '(1 'font-lock-keyword-face)
175 '(2 'font-lock-variable-name-face))
176 '("^[ \t]*\\([^\000- ]+\\)" 1 'font-lock-variable-name-face)))
177 "Keywords to hilight in Conf Space mode")
178
179(defvar conf-colon-font-lock-keywords
180 `(;; [section] (do this first because it may look like a parameter)
181 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
182 ;; var: val
183 ("^[ \t]*\\(.+?\\)[ \t]*:"
184 (1 'font-lock-variable-name-face))
185 ;; section { ... } (do this last because some assign ...{...)
186 ("^[ \t]*\\([^:\n]+\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
187 "Keywords to hilight in Conf Colon mode")
188
189(defvar conf-assignment-sign ?=
190 "What sign is used for assignments.")
191
192(defvar conf-assignment-regexp ".+?\\([ \t]*=[ \t]*\\)"
193 "Regexp to recognize assignments.
194It is anchored after the first sexp on a line. There must a
195grouping for the assignment sign, including leading and trailing
196whitespace.")
197
198
199;; If anybody can figure out how to get the same effect by configuring
200;; `align', I'd be glad to hear.
201(defun conf-align-assignments (&optional arg)
202 (interactive "P")
203 (setq arg (if arg
204 (prefix-numeric-value arg)
205 conf-assignment-column))
206 (save-excursion
207 (goto-char (point-min))
208 (while (not (eobp))
209 (let ((cs (comment-beginning))) ; go before comment if within
210 (if cs (goto-char cs)))
211 (while (forward-comment 9)) ; max-int?
212 (when (and (not (eobp))
213 (looking-at conf-assignment-regexp))
214 (goto-char (match-beginning 1))
215 (delete-region (point) (match-end 1))
216 (if conf-assignment-sign
217 (if (>= arg 0)
218 (progn
219 (indent-to-column arg)
220 (or (not conf-assignment-space) (memq (char-before (point)) '(? ?\t)) (insert ? ))
221 (insert conf-assignment-sign (if (and conf-assignment-space (not (eolp))) ?\ "")))
222 (insert (if conf-assignment-space ?\ "") conf-assignment-sign)
223 (unless (eolp)
224 (indent-to-column (- arg))
225 (or (not conf-assignment-space) (memq (char-before (point)) '(? ?\t)) (insert ? ))))
226 (unless (eolp)
227 (if (>= (current-column) (abs arg))
228 (insert ? )
229 (indent-to-column (abs arg))))))
230 (forward-line))))
231
232
233(defun conf-quote-normal ()
234 "Set the syntax of \" and ' to punctuation.
235This only affects the current buffer. Some conf files use quotes
236to delimit strings, while others allow quotes as simple parts of
237the assigned value. In those files font locking will be wrong,
238and you can correct it with this command. (Some files even do
239both, i.e. quotes delimit strings, except when they are
240unbalanced, but hey...)"
241 (interactive)
242 (let ((table (copy-syntax-table (syntax-table))))
243 (modify-syntax-entry ?\" "." table)
244 (modify-syntax-entry ?\' "." table)
245 (set-syntax-table table)
246 (and (boundp 'font-lock-mode)
247 font-lock-mode
248 (font-lock-fontify-buffer))))
249
250
251(defun conf-outline-level ()
252 (let ((depth 0)
253 (pt (match-end 0)))
254 (condition-case nil
255 (while (setq pt (scan-lists pt -1 1)
256 depth (1+ depth)))
257 (scan-error depth))))
258
259
260
261;;;###autoload
262(defun conf-mode (&optional comment syntax-table name)
263 "Mode for Unix and Windows Conf files and Java properties.
264Most conf files know only three kinds of constructs: parameter
265assignments optionally grouped into sections and comments. Yet
266there is a great range of variation in the exact syntax of conf
267files. See below for various wrapper commands that set up the
268details for some of the most widespread variants.
269
270This mode sets up font locking, outline, imenu and it provides
271alignment support through `conf-align-assignments'. If strings
272come out wrong, try `conf-quote-normal'.
273
274Some files allow continuation lines, either with a backslash at
275the end of line, or by indenting the next line (further). These
276constructs cannot currently be recognized.
277
278Because of this great variety of nuances, which are often not
279even clearly specified, please don't expect it to get every file
280quite right. Patches that clearly identify some special case,
281without breaking the general ones, are welcome.
282
283If instead you start this mode with the generic `conf-mode'
284command, it will parse the buffer. It will generally well
285identify the first four cases listed below. If the buffer
286doesn't have enough contents to decide, this is identical to
287`conf-windows-mode' on Windows, elsewhere to `conf-unix-mode'. See
288also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode' and
289`conf-xdefaults-mode'.
290
291\\{conf-mode-map}"
292
293 (interactive)
294 (if (not comment)
295 (let ((unix 0) (win 0) (equal 0) (colon 0) (space 0) (jp 0))
296 (save-excursion
297 (goto-char (point-min))
298 (while (not (eobp))
299 (skip-chars-forward " \t\f")
300 (cond ((eq (char-after) ?\#) (setq unix (1+ unix)))
301 ((eq (char-after) ?\;) (setq win (1+ win)))
302 ((eq (char-after) ?\[)) ; nop
303 ((eolp)) ; nop
304 ((eq (char-after) ?})) ; nop
305 ;; recognize at most double spaces within names
306 ((looking-at "[^ \t\n=:]+\\(?: ?[^ \t\n=:]+\\)*[ \t]*[=:]")
307 (if (eq (char-before (match-end 0)) ?=)
308 (setq equal (1+ equal))
309 (setq colon (1+ colon))))
310 ((looking-at "/[/*]") (setq jp (1+ jp)))
311 ((looking-at ".*{")) ; nop
312 ((setq space (1+ space))))
313 (forward-line)))
314 (if (> jp (max unix win 3))
315 (conf-javaprop-mode)
316 (if (> colon (max equal space))
317 (conf-colon-mode)
318 (if (> space (max equal colon))
319 (conf-space-mode)
320 (if (or (> win unix)
321 (and (= win unix) (eq system-type 'windows-nt)))
322 (conf-windows-mode)
323 (conf-unix-mode))))))
324 (kill-all-local-variables)
325 (use-local-map conf-mode-map)
326
327 (setq major-mode 'conf-mode
328 mode-name name)
329 (set (make-local-variable 'comment-start) comment)
330 (set (make-local-variable 'comment-start-skip)
331 (concat comment-start "+\\s *"))
332 (set (make-local-variable 'comment-use-syntax) t)
333 (set (make-local-variable 'parse-sexp-ignore-comments) t)
334 (set (make-local-variable 'outline-regexp)
335 "[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)")
336 (set (make-local-variable 'outline-heading-end-regexp)
337 "[\n}]")
338 (set (make-local-variable 'outline-level)
339 'conf-outline-level)
340 (set-syntax-table syntax-table)
341 (setq imenu-generic-expression
342 '(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*=" 1)
343 ;; [section]
344 (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1)
345 ;; section { ... }
346 (nil "^[ \t]*\\([^=:\n]+\\)[ \t\n]*{" 1)))
347
348 (run-mode-hooks 'conf-mode-hook)))
349
350;;;###autoload
351(defun conf-unix-mode ()
352 "Conf Mode starter for Unix style Conf files.
353Comments start with `#'.
354For details see `conf-mode'. Example:
355
356# Conf mode font-locks this right on Unix and with C-c C-u
357
358\[Desktop Entry]
359 Encoding=UTF-8
360 Name=The GIMP
361 Name[ca]=El GIMP
362 Name[cs]=GIMP"
363 (interactive)
364 (conf-mode "#" conf-unix-mode-syntax-table "Conf[Unix]"))
365
366;;;###autoload
367(defun conf-windows-mode ()
368 "Conf Mode starter for Windows style Conf files.
369Comments start with `;'.
370For details see `conf-mode'. Example:
371
372; Conf mode font-locks this right on Windows and with C-c C-w
373
374\[ExtShellFolderViews]
375Default={5984FFE0-28D4-11CF-AE66-08002B2E1262}
376{5984FFE0-28D4-11CF-AE66-08002B2E1262}={5984FFE0-28D4-11CF-AE66-08002B2E1262}
377
378\[{5984FFE0-28D4-11CF-AE66-08002B2E1262}]
379PersistMoniker=file://Folder.htt"
380 (interactive)
381 (conf-mode ";" conf-mode-syntax-table "Conf[WinIni]"))
382
383;; Here are a few more or less widespread styles. There are others, so
384;; obscure, they are not covered. E.g. RFC 2614 allows both Unix and Windows
385;; comments. Or the donkey has (* Pascal comments *) -- roll your own starter
386;; if you need it.
387
388;;;###autoload
389(defun conf-javaprop-mode ()
390 "Conf Mode starter for Java properties files.
391Comments start with `#' but are also recognized with `//' or
392between `/*' and `*/'.
393For details see `conf-mode'. Example:
394
395# Conf mode font-locks this right with C-c C-j (Java properties)
396// another kind of comment
397/* yet another */
398
399name:value
400name=value
401name value
402x.1 =
403x.2.y.1.z.1 =
404x.2.y.1.z.2.zz ="
405 (interactive)
406 (conf-mode "#" conf-javaprop-mode-syntax-table "Conf[JavaProp]")
407 (set (make-local-variable 'conf-assignment-column)
408 conf-javaprop-assignment-column)
409 (set (make-local-variable 'conf-assignment-regexp)
410 ".+?\\([ \t]*[=: \t][ \t]*\\|$\\)")
411 (set (make-local-variable 'conf-font-lock-keywords)
412 conf-javaprop-font-lock-keywords)
413 (setq comment-start-skip "\\(?:#+\\|/[/*]+\\)\\s *")
414 (setq imenu-generic-expression
415 '(("Parameters" "^[ \t]*\\(.+?\\)[=: \t]" 1))))
416
417;;;###autoload
418(defun conf-space-mode (&optional keywords)
419 "Conf Mode starter for space separated conf files.
420\"Assignments\" are with ` '. Keywords before the parameters are
421recognized according to `conf-space-keywords'. Interactively
422with a prefix ARG of `0' no keywords will be recognized. With
423any other prefix arg you will be prompted for a regexp to match
424the keywords. Programmatically you can pass such a regexp as
425KEYWORDS, or any non-nil non-string for no keywords.
426
427For details see `conf-mode'. Example:
428
429# Conf mode font-locks this right with C-c C-s (space separated)
430
431image/jpeg jpeg jpg jpe
432image/png png
433image/tiff tiff tif
434
435# Or with keywords (from a recognized file name):
436class desktop
437# Standard multimedia devices
438add /dev/audio desktop
439add /dev/mixer desktop"
440 (interactive
441 (list (if current-prefix-arg
442 (if (> (prefix-numeric-value current-prefix-arg) 0)
443 (read-string "Regexp to match keywords: ")
444 t))))
445 (conf-unix-mode)
446 (setq mode-name "Conf[Space]")
447 (set (make-local-variable 'conf-assignment-sign)
448 nil)
449 (set (make-local-variable 'conf-font-lock-keywords)
450 conf-space-font-lock-keywords)
451 ;; This doesn't seem right, but the next two depend on conf-space-keywords
452 ;; being set, while after-change-major-mode-hook might set up imenu, needing
453 ;; the following result:
454 (hack-local-variables-prop-line)
455 (hack-local-variables)
456 (if keywords
457 (set (make-local-variable 'conf-space-keywords)
458 (if (stringp keywords) keywords))
459 (or conf-space-keywords
460 (not buffer-file-name)
461 (set (make-local-variable 'conf-space-keywords)
462 (assoc-default buffer-file-name conf-space-keywords-alist
463 'string-match))))
464 (set (make-local-variable 'conf-assignment-regexp)
465 (if conf-space-keywords
466 (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)")
467 ".+?\\([ \t]+\\|$\\)"))
468 (setq imenu-generic-expression
469 `(,@(cdr imenu-generic-expression)
470 ("Parameters"
471 ,(if conf-space-keywords
472 (concat "^[ \t]*\\(?:" conf-space-keywords
473 "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)")
474 "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)")
475 1))))
476
477;;;###autoload
478(defun conf-colon-mode (&optional comment syntax-table name)
479 "Conf Mode starter for Colon files.
480\"Assignments\" are with `:'.
481For details see `conf-mode'. Example:
482
483# Conf mode font-locks this right with C-c C-c (colon)
484
485<Multi_key> <exclam> <exclam> : \"\\241\" exclamdown
486<Multi_key> <c> <slash> : \"\\242\" cent"
487 (interactive)
488 (if comment
489 (conf-mode comment syntax-table name)
490 (conf-unix-mode)
491 (setq mode-name "Conf[Colon]"))
492 (set (make-local-variable 'conf-assignment-space)
493 conf-colon-assignment-space)
494 (set (make-local-variable 'conf-assignment-column)
495 conf-colon-assignment-column)
496 (set (make-local-variable 'conf-assignment-sign)
497 ?:)
498 (set (make-local-variable 'conf-assignment-regexp)
499 ".+?\\([ \t]*:[ \t]*\\)")
500 (set (make-local-variable 'conf-font-lock-keywords)
501 conf-colon-font-lock-keywords)
502 (setq imenu-generic-expression
503 `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)
504 ,@(cdr imenu-generic-expression))))
505
506;;;###autoload
507(defun conf-xdefaults-mode ()
508 "Conf Mode starter for Xdefaults files.
509Comments start with `!' and \"assignments\" are with `:'.
510For details see `conf-mode'. Example:
511
512! Conf mode font-locks this right with C-c C-x (.Xdefaults)
513
514*background: gray99
515*foreground: black"
516 (interactive)
517 (conf-colon-mode "!" conf-xdefaults-mode-syntax-table "Conf[Xdefaults]"))
518
519
520;; font lock support
521(if (boundp 'font-lock-defaults-alist)
522 (add-to-list
523 'font-lock-defaults-alist
524 (cons 'conf-mode
525 (list 'conf-font-lock-keywords nil t nil nil))))
526
527
528(provide 'conf-mode)
529
530;; arch-tag: 0a3805b2-0371-4d3a-8498-8897116b2356
531;;; conf-mode.el ends here
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 556369077d8..441d9972173 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1281,7 +1281,7 @@ Word syntax described by `ispell-dictionary-alist' (which see)."
1281(defun flyspell-external-point-words () 1281(defun flyspell-external-point-words ()
1282 (let ((buffer flyspell-external-ispell-buffer)) 1282 (let ((buffer flyspell-external-ispell-buffer))
1283 (set-buffer buffer) 1283 (set-buffer buffer)
1284 (beginning-of-buffer) 1284 (goto-char (point-min))
1285 (let ((size (- flyspell-large-region-end flyspell-large-region-beg)) 1285 (let ((size (- flyspell-large-region-end flyspell-large-region-beg))
1286 (start flyspell-large-region-beg)) 1286 (start flyspell-large-region-beg))
1287 ;; now we are done with ispell, we have to find the word in 1287 ;; now we are done with ispell, we have to find the word in
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 4ac96b2e4b0..dd606a53434 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1,6 +1,7 @@
1;;; sgml-mode.el --- SGML- and HTML-editing modes 1;;; sgml-mode.el --- SGML- and HTML-editing modes
2 2
3;; Copyright (C) 1992,95,96,98,2001,2002, 2003 Free Software Foundation, Inc. 3;; Copyright (C) 1992, 1995, 1996, 1998, 2001, 2002, 2003, 2004
4;; Free Software Foundation, Inc.
4 5
5;; Author: James Clark <jjc@jclark.com> 6;; Author: James Clark <jjc@jclark.com>
6;; Maintainer: FSF 7;; Maintainer: FSF
@@ -1053,53 +1054,79 @@ You might want to turn on `auto-fill-mode' to get better results."
1053 (and (>= start (point-min)) 1054 (and (>= start (point-min))
1054 (equal str (buffer-substring-no-properties start (point)))))) 1055 (equal str (buffer-substring-no-properties start (point))))))
1055 1056
1057(defun sgml-tag-text-p (start end)
1058 "Return non-nil if text between START and END is a tag.
1059Checks among other things that the tag does not contain spurious
1060unquoted < or > chars inside, which would indicate that it
1061really isn't a tag after all."
1062 (save-excursion
1063 (with-syntax-table sgml-tag-syntax-table
1064 (let ((pps (parse-partial-sexp start end 2)))
1065 (and (= (nth 0 pps) 0))))))
1066
1056(defun sgml-parse-tag-backward (&optional limit) 1067(defun sgml-parse-tag-backward (&optional limit)
1057 "Parse an SGML tag backward, and return information about the tag. 1068 "Parse an SGML tag backward, and return information about the tag.
1058Assume that parsing starts from within a textual context. 1069Assume that parsing starts from within a textual context.
1059Leave point at the beginning of the tag." 1070Leave point at the beginning of the tag."
1060 (let (tag-type tag-start tag-end name) 1071 (catch 'found
1061 (or (re-search-backward "[<>]" limit 'move) 1072 (let (tag-type tag-start tag-end name)
1062 (error "No tag found")) 1073 (or (re-search-backward "[<>]" limit 'move)
1063 (when (eq (char-after) ?<) 1074 (error "No tag found"))
1064 ;; Oops!! Looks like we were not in a textual context after all!. 1075 (when (eq (char-after) ?<)
1065 ;; Let's try to recover. 1076 ;; Oops!! Looks like we were not in a textual context after all!.
1066 (with-syntax-table sgml-tag-syntax-table 1077 ;; Let's try to recover.
1067 (forward-sexp) 1078 (with-syntax-table sgml-tag-syntax-table
1068 (forward-char -1))) 1079 (let ((pos (point)))
1069 (setq tag-end (1+ (point))) 1080 (condition-case nil
1070 (cond 1081 (forward-sexp)
1071 ((sgml-looking-back-at "--") ; comment 1082 (scan-error
1072 (setq tag-type 'comment 1083 ;; This < seems to be just a spurious one, let's ignore it.
1073 tag-start (search-backward "<!--" nil t))) 1084 (goto-char pos)
1074 ((sgml-looking-back-at "]]") ; cdata 1085 (throw 'found (sgml-parse-tag-backward limit))))
1075 (setq tag-type 'cdata 1086 ;; Check it is really a tag, without any extra < or > inside.
1076 tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t))) 1087 (unless (sgml-tag-text-p pos (point))
1077 (t 1088 (goto-char pos)
1078 (setq tag-start 1089 (throw 'found (sgml-parse-tag-backward limit)))
1079 (with-syntax-table sgml-tag-syntax-table 1090 (forward-char -1))))
1080 (goto-char tag-end) 1091 (setq tag-end (1+ (point)))
1081 (backward-sexp) 1092 (cond
1082 (point))) 1093 ((sgml-looking-back-at "--") ; comment
1083 (goto-char (1+ tag-start)) 1094 (setq tag-type 'comment
1084 (case (char-after) 1095 tag-start (search-backward "<!--" nil t)))
1085 (?! ; declaration 1096 ((sgml-looking-back-at "]]") ; cdata
1086 (setq tag-type 'decl)) 1097 (setq tag-type 'cdata
1087 (?? ; processing-instruction 1098 tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t)))
1088 (setq tag-type 'pi)) 1099 (t
1089 (?/ ; close-tag 1100 (setq tag-start
1090 (forward-char 1) 1101 (with-syntax-table sgml-tag-syntax-table
1091 (setq tag-type 'close 1102 (goto-char tag-end)
1092 name (sgml-parse-tag-name))) 1103 (condition-case nil
1093 (?% ; JSP tags 1104 (backward-sexp)
1094 (setq tag-type 'jsp)) 1105 (scan-error
1095 (t ; open or empty tag 1106 ;; This > isn't really the end of a tag. Skip it.
1096 (setq tag-type 'open 1107 (goto-char (1- tag-end))
1097 name (sgml-parse-tag-name)) 1108 (throw 'found (sgml-parse-tag-backward limit))))
1098 (if (or (eq ?/ (char-before (- tag-end 1))) 1109 (point)))
1099 (sgml-empty-tag-p name)) 1110 (goto-char (1+ tag-start))
1100 (setq tag-type 'empty)))))) 1111 (case (char-after)
1101 (goto-char tag-start) 1112 (?! ; declaration
1102 (sgml-make-tag tag-type tag-start tag-end name))) 1113 (setq tag-type 'decl))
1114 (?? ; processing-instruction
1115 (setq tag-type 'pi))
1116 (?/ ; close-tag
1117 (forward-char 1)
1118 (setq tag-type 'close
1119 name (sgml-parse-tag-name)))
1120 (?% ; JSP tags
1121 (setq tag-type 'jsp))
1122 (t ; open or empty tag
1123 (setq tag-type 'open
1124 name (sgml-parse-tag-name))
1125 (if (or (eq ?/ (char-before (- tag-end 1)))
1126 (sgml-empty-tag-p name))
1127 (setq tag-type 'empty))))))
1128 (goto-char tag-start)
1129 (sgml-make-tag tag-type tag-start tag-end name))))
1103 1130
1104(defun sgml-get-context (&optional until) 1131(defun sgml-get-context (&optional until)
1105 "Determine the context of the current position. 1132 "Determine the context of the current position.
@@ -1966,5 +1993,5 @@ Can be used as a value for `html-mode-hook'."
1966 1993
1967(provide 'sgml-mode) 1994(provide 'sgml-mode)
1968 1995
1969;;; arch-tag: 9675da94-b7f9-4bda-ad19-73ed7b4fb401 1996;; arch-tag: 9675da94-b7f9-4bda-ad19-73ed7b4fb401
1970;;; sgml-mode.el ends here 1997;;; sgml-mode.el ends here
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 6ff86b4cf0b..f8243f4a0ac 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -1,6 +1,6 @@
1;;; tooltip.el --- show tooltip windows 1;;; tooltip.el --- show tooltip windows
2 2
3;; Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc. 3;; Copyright (C) 1997, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
4 4
5;; Author: Gerd Moellmann <gerd@acm.org> 5;; Author: Gerd Moellmann <gerd@acm.org>
6;; Keywords: help c mouse tools 6;; Keywords: help c mouse tools
@@ -26,11 +26,7 @@
26 26
27;;; Code: 27;;; Code:
28 28
29(eval-when-compile 29(eval-when-compile (require 'cl)) ; for case macro
30 (require 'cl)
31 (require 'comint)
32 (require 'gud)
33 (require 'gdb-ui))
34 30
35 31
36;;; Customizable settings 32;;; Customizable settings
@@ -524,5 +520,5 @@ use either \\[customize] or the function `tooltip-mode'."
524 520
525(provide 'tooltip) 521(provide 'tooltip)
526 522
527;;; arch-tag: 3d61135e-4618-4a78-af28-183f6df5636f 523;; arch-tag: 3d61135e-4618-4a78-af28-183f6df5636f
528;;; tooltip.el ends here 524;;; tooltip.el ends here
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 261635d51e2..eb10dd2a933 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
12004-11-12 Masatake YAMATO <jet@gyve.org>
2
3 * url-mailto.el (url-mailto): Fix a typo in the
4 comment.
5
12004-11-02 Masatake YAMATO <jet@gyve.org> 62004-11-02 Masatake YAMATO <jet@gyve.org>
2 7
3 * url-imap.el (url-imap-open-host): Don't use 8 * url-imap.el (url-imap-open-host): Don't use
diff --git a/lisp/url/url-mailto.el b/lisp/url/url-mailto.el
index f5192bcb03f..42793093117 100644
--- a/lisp/url/url-mailto.el
+++ b/lisp/url/url-mailto.el
@@ -63,7 +63,7 @@
63(defun url-mailto (url) 63(defun url-mailto (url)
64 "Handle the mailto: URL syntax." 64 "Handle the mailto: URL syntax."
65 (if (url-user url) 65 (if (url-user url)
66 ;; malformed mailto URL (mailto://wmperry@gnu.org instead of 66 ;; malformed mailto URL (mailto://wmperry@gnu.org) instead of
67 ;; mailto:wmperry@gnu.org 67 ;; mailto:wmperry@gnu.org
68 (url-set-filename url (concat (url-user url) "@" (url-filename url)))) 68 (url-set-filename url (concat (url-user url) "@" (url-filename url))))
69 (setq url (url-filename url)) 69 (setq url (url-filename url))