aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2004-11-12 02:53:04 +0000
committerMiles Bader2004-11-12 02:53:04 +0000
commit8b7e837d9c3266e775142a4865845b3d2a8b60aa (patch)
treed1468612ab319b665728b9ebf94dbc0c0d4c20fc
parentd1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26 (diff)
parente22c7647c7ff33c846132f3d2877ac436b8b47e6 (diff)
downloademacs-8b7e837d9c3266e775142a4865845b3d2a8b60aa.tar.gz
emacs-8b7e837d9c3266e775142a4865845b3d2a8b60aa.zip
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-70
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-669 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-678 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-679 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-680 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-688 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-689 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-690 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-691 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-69 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-70 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71 Update from CVS
-rw-r--r--ChangeLog12
-rw-r--r--Makefile.in24
-rw-r--r--admin/FOR-RELEASE83
-rwxr-xr-xconfigure3
-rw-r--r--configure.in2
-rw-r--r--etc/NEWS40
-rw-r--r--lib-src/ChangeLog15
-rw-r--r--lib-src/etags.c38
-rw-r--r--lib-src/hexl.c4
-rw-r--r--lib-src/make-docfile.c1
-rw-r--r--lib-src/makefile.w32-in25
-rw-r--r--lisp/ChangeLog451
-rw-r--r--lisp/ChangeLog.101
-rw-r--r--lisp/ChangeLog.721
-rw-r--r--lisp/Makefile.in5
-rw-r--r--lisp/align.el8
-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-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.el24
-rw-r--r--lisp/dired.el10
-rw-r--r--lisp/ebuff-menu.el21
-rw-r--r--lisp/emacs-lisp/bytecomp.el58
-rw-r--r--lisp/emacs-lisp/easymenu.el108
-rw-r--r--lisp/emacs-lisp/edebug.el6
-rw-r--r--lisp/emacs-lisp/elp.el1
-rw-r--r--lisp/eshell/esh-mode.el11
-rw-r--r--lisp/files.el78
-rw-r--r--lisp/filesets.el10
-rw-r--r--lisp/font-lock.el12
-rw-r--r--lisp/gnus/ChangeLog20
-rw-r--r--lisp/gnus/gnus-art.el98
-rw-r--r--lisp/gnus/gnus-msg.el12
-rw-r--r--lisp/gnus/pgg-def.el3
-rw-r--r--lisp/gnus/spam.el3
-rw-r--r--lisp/help-fns.el7
-rw-r--r--lisp/imenu.el4
-rw-r--r--lisp/info-look.el64
-rw-r--r--lisp/info.el52
-rw-r--r--lisp/international/iso-cvt.el121
-rw-r--r--lisp/international/mule-cmds.el197
-rw-r--r--lisp/international/mule.el2
-rw-r--r--lisp/macros.el9
-rw-r--r--lisp/mail/supercite.el24
-rw-r--r--lisp/menu-bar.el56
-rw-r--r--lisp/mouse.el3
-rw-r--r--lisp/mwheel.el8
-rw-r--r--lisp/net/browse-url.el24
-rw-r--r--lisp/net/tramp.el10
-rw-r--r--lisp/outline.el5
-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/f90.el8
-rw-r--r--lisp/progmodes/gdb-ui.el17
-rw-r--r--lisp/progmodes/idlw-shell.el31
-rw-r--r--lisp/recentf.el2
-rw-r--r--lisp/simple.el201
-rw-r--r--lisp/subr.el18
-rw-r--r--lisp/tempo.el6
-rw-r--r--lisp/textmodes/conf-mode.el531
-rw-r--r--lisp/textmodes/flyspell.el6
-rw-r--r--lisp/textmodes/ispell.el5
-rw-r--r--lisp/textmodes/sgml-mode.el117
-rw-r--r--lisp/textmodes/table.el3
-rw-r--r--lisp/tooltip.el10
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-mailto.el2
-rw-r--r--lispref/ChangeLog21
-rw-r--r--lispref/Makefile.in6
-rw-r--r--lispref/commands.texi9
-rw-r--r--lispref/os.texi23
-rw-r--r--lispref/syntax.texi12
-rw-r--r--man/ChangeLog7
-rw-r--r--man/files.texi80
-rw-r--r--msdos/ChangeLog26
-rw-r--r--msdos/mainmake.v299
-rw-r--r--msdos/sed1v2.inp1
-rw-r--r--msdos/sed2v2.inp8
-rw-r--r--msdos/sedlisp.inp3
-rw-r--r--src/.gitignore1
-rw-r--r--src/ChangeLog252
-rw-r--r--src/Makefile.in14
-rw-r--r--src/callint.c15
-rw-r--r--src/config.in3
-rw-r--r--src/data.c4
-rw-r--r--src/doc.c78
-rw-r--r--src/dosfns.c6
-rw-r--r--src/editfns.c56
-rw-r--r--src/emacs.c23
-rw-r--r--src/eval.c2
-rw-r--r--src/fileio.c48
-rw-r--r--src/fns.c9
-rw-r--r--src/fontset.c38
-rw-r--r--src/frame.c2
-rw-r--r--src/fringe.c7
-rw-r--r--src/gtkutil.c30
-rw-r--r--src/gtkutil.h4
-rw-r--r--src/intervals.h6
-rw-r--r--src/keyboard.c110
-rw-r--r--src/keyboard.h1
-rw-r--r--src/keymap.c6
-rw-r--r--src/lisp.h7
-rw-r--r--src/lread.c8
-rw-r--r--src/macros.c4
-rw-r--r--src/makefile.w32-in3
-rw-r--r--src/msdos.c2
-rw-r--r--src/print.c9
-rw-r--r--src/process.c20
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c71
-rw-r--r--src/xfaces.c26
-rw-r--r--src/xfns.c8
-rw-r--r--src/xmenu.c19
-rw-r--r--src/xselect.c189
-rw-r--r--src/xterm.c81
-rw-r--r--src/xterm.h7
130 files changed, 3815 insertions, 1616 deletions
diff --git a/ChangeLog b/ChangeLog
index fea2ce35e64..9bd823ee5e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
12004-11-08 Kim F. Storm <storm@cua.dk>
2
3 * Makefile.in (bootstrap, bootstrap-clean-before): Remove .elc
4 files before building.
5 (bootfast, bootstrap-clean-before-fast): New targets, like
6 bootstrap but don't remove .elc files.
7
82004-11-06 Lars Brinkhoff <lars@nocrew.org>
9
10 * configure.in: Add check for getrusage.
11 * configure: Regenerate.
12
12004-11-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 132004-11-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2 14
3 * configure.in (HAVE_GTK_FILE_CHOOSER, $HAVE_GTK_FILE_SELECTION): New 15 * configure.in (HAVE_GTK_FILE_CHOOSER, $HAVE_GTK_FILE_SELECTION): New
diff --git a/Makefile.in b/Makefile.in
index 34b9965b60e..ce476a95cf0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -51,6 +51,15 @@
51# 51#
52# make extraclean 52# make extraclean
53# Still more severe - delete backup and autosave files, too. 53# Still more severe - delete backup and autosave files, too.
54#
55# make bootstrap
56# Recompiles all the Emacs Lisp files using the latest source,
57# then rebuilds Emacs.
58#
59# make bootfast
60# Recompiles changed Emacs Lisp files using the latest C source,
61# then rebuilds Emacs. This is faster than `make bootstrap'
62# but once in a while an old .elc file can cause trouble.
54 63
55SHELL = /bin/sh 64SHELL = /bin/sh
56 65
@@ -726,6 +735,8 @@ dvi:
726### used to compile Lisp files. The last step is a "normal" make. 735### used to compile Lisp files. The last step is a "normal" make.
727 736
728.PHONY: bootstrap 737.PHONY: bootstrap
738.PHONY: bootstrap-build
739.PHONY: bootfast
729.PHONY: maybe_bootstrap 740.PHONY: maybe_bootstrap
730 741
731maybe_bootstrap: 742maybe_bootstrap:
@@ -737,7 +748,11 @@ maybe_bootstrap:
737 exit 1;\ 748 exit 1;\
738 fi 749 fi
739 750
740bootstrap: bootstrap-clean-before info FRC 751bootstrap: bootstrap-clean-before info bootstrap-build FRC
752
753bootfast: bootstrap-clean-before-fast info bootstrap-build FRC
754
755bootstrap-build: FRC
741 (cd lisp; $(MAKE) $(MFLAGS) bootstrap-prepare) 756 (cd lisp; $(MAKE) $(MFLAGS) bootstrap-prepare)
742 (cd src; $(MAKE) $(MFLAGS) bootstrap) 757 (cd src; $(MAKE) $(MFLAGS) bootstrap)
743 (cd lisp; $(MAKE) $(MFLAGS) bootstrap EMACS=../src/bootstrap-emacs${EXEEXT}) 758 (cd lisp; $(MAKE) $(MFLAGS) bootstrap EMACS=../src/bootstrap-emacs${EXEEXT})
@@ -746,7 +761,12 @@ bootstrap: bootstrap-clean-before info FRC
746 (cd lisp; $(MAKE) $(MFLAGS) bootstrap-after) 761 (cd lisp; $(MAKE) $(MFLAGS) bootstrap-after)
747 762
748### Used for `bootstrap' to avoid deleting existing dumped Emacs executables. 763### Used for `bootstrap' to avoid deleting existing dumped Emacs executables.
749bootstrap-clean-before: FRC 764bootstrap-clean-before: bootstrap-clean-before-fast FRC
765 (cd lisp; $(MAKE) $(MFLAGS) bootstrap-clean)
766
767### Used for `bootfast' to avoid deleting existing dumped Emacs executables
768### and compiled .elc files.
769bootstrap-clean-before-fast: FRC
750 (cd src; $(MAKE) $(MFLAGS) mostlyclean) 770 (cd src; $(MAKE) $(MFLAGS) mostlyclean)
751 (cd oldXMenu; $(MAKE) $(MFLAGS) clean) 771 (cd oldXMenu; $(MAKE) $(MFLAGS) clean)
752 (cd lwlib; $(MAKE) $(MFLAGS) clean) 772 (cd lwlib; $(MAKE) $(MFLAGS) clean)
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE
index e5e719f9037..a410f784b07 100644
--- a/admin/FOR-RELEASE
+++ b/admin/FOR-RELEASE
@@ -10,6 +10,12 @@ Tasks needed before the next release.
10 10
11** Let mouse-1 follow links. 11** Let mouse-1 follow links.
12 12
13** Make Rmail find the best version of movemail.
14To be done by Sergey Poznyakoff <gray@Mirddin.farlep.net>.
15
16** Make VC-over-Tramp work where possible, or at least fail
17gracefully if something isn't supported over Tramp.
18To be done by Andre Spiegel <spiegel@gnu.org>.
13 19
14* FATAL ERRORS 20* FATAL ERRORS
15 21
@@ -30,7 +36,6 @@ invalid pointer from string_free_list.
30 36
31** Clean up flymake.el to follow Emacs Lisp conventions. 37** Clean up flymake.el to follow Emacs Lisp conventions.
32 38
33
34* GTK RELATED BUGS 39* GTK RELATED BUGS
35 40
36** Make GTK scrollbars behave like others w.r.t. overscrolling. 41** Make GTK scrollbars behave like others w.r.t. overscrolling.
@@ -103,50 +108,6 @@ interrupting I can get a backtrace, here's an example:
103Update: Maybe only reveals itself when compiled with GTK+ 108Update: Maybe only reveals itself when compiled with GTK+
104 109
105 110
106** Mouse-face overlay bleeds into header line
107
108From: Stephen Berman <Stephen.Berman@gmx.net>
109Date: Thu, 21 Oct 2004 18:11:01 +0200
110
111Mouse-face overlays bleed into the header line when the beginning of
112the overlay is above (point-min). To reproduce:
113
1141. Start Emacs with -q -no-site-file.
115
1162. In *scratch* eval (setq ov (make-overlay 66 92)), (overlay-put ov
117'mouse-face 'highlight), and (setq header-line-format "test").
118
1193. Drag the mouse over the string "evaluation.\n;; If you want" and
120notice the highlighting of only this string.
121
1224. Now click on the down arrow in the scroll bar until the line
123beginning ";; If you want" is directly below the header line.
124
1255. Drag the mouse over ";; If you want" and notice that not only it
126but also the header line are highlighted.
127
128
129** scroll-preserve-screen-position doesn't work with a header-line-format
130
131From: jbyler+emacs-lists@anon41.eml.cc
132Date: Tue, 17 Aug 2004 17:10:14 -0400
133
134There seems to be an off-by-one error triggered by using a header line
135together with scroll-preserve-screen-position. The symptom: instead of
136staying in the same position on the screen when scrolling, the cursor
137moves one screen line down each time the buffer is scrolled. Put
138another way: repeatedly typing C-v M-v or using a mouse scroll wheel to
139scroll up and down causes the cursor to migrate slowly down the screen
140instead of staying put as it should.
141
142To reproduce:
143
144emacs -q --no-site-file
145(setq scroll-preserve-screen-position t)
146(setq header-line-format "")
147C-v M-v C-v M-v C-v M-v etc.
148
149
150** Clicking on partially visible lines fails 111** Clicking on partially visible lines fails
151 112
152From: David Kastrup <dak@gnu.org> 113From: David Kastrup <dak@gnu.org>
@@ -200,32 +161,6 @@ Then, point is displayed at the center of the window.
200But point should be displayed at the bottom of the window like Emacs-21.3. 161But point should be displayed at the bottom of the window like Emacs-21.3.
201 162
202 163
203** line-spacing and garbage in fringe
204
205From: SAITO Takuya <tabmore@rivo.mediatti.net>
206Date: Mon, 31 May 2004 02:08:05 +0900 (JST)
207
208Start emacs -Q and evaluate below with C-xC-e:
209
210(let ((lines 2)
211 (spacing 1))
212 (setq line-spacing spacing
213 indicate-buffer-boundaries t)
214 (insert (make-string (window-height) ?\n))
215 (goto-char (point-min))
216 (message (make-string (* (window-width) lines) ?.))
217 (scroll-up 1))
218
219then, garbage is displayed in right fringe.
220
221Above code reproduces this bug with
222(frame-parameter nil 'font)
223=> "-Adobe-Courier-Medium-R-Normal--12-120-75-75-M-70-ISO8859-1"
224
225If you use different font, you may need different value of
226`lines' and/or `spacing'.
227
228
229** line-spacing and Electric-pop-up-window 164** line-spacing and Electric-pop-up-window
230 165
231From: SAITO Takuya <tabmore@rivo.mediatti.net> 166From: SAITO Takuya <tabmore@rivo.mediatti.net>
@@ -244,6 +179,8 @@ Electric-pop-up-window can use it.
244 179
245* DOCUMENTATION 180* DOCUMENTATION
246 181
182** Document Custom Themes.
183
247** Finish updating the Emacs Lisp manual. 184** Finish updating the Emacs Lisp manual.
248 185
249** Update the Emacs manual. 186** Update the Emacs manual.
@@ -318,11 +255,11 @@ names of the people who have checked it.
318SECTION READERS 255SECTION READERS
319---------------------------------- 256----------------------------------
320lispref/abbrevs.texi "Luc Teirlinck" 257lispref/abbrevs.texi "Luc Teirlinck"
321lispref/advice.texi 258lispref/advice.texi Joakim Verona <joakim@verona.se>
322lispref/anti.texi 259lispref/anti.texi
323lispref/backups.texi "Luc Teirlinck" 260lispref/backups.texi "Luc Teirlinck"
324lispref/buffers.texi "Luc Teirlinck" 261lispref/buffers.texi "Luc Teirlinck"
325lispref/calendar.texi 262lispref/calendar.texi Joakim Verona <joakim@verona.se>
326lispref/commands.texi "Luc Teirlinck" 263lispref/commands.texi "Luc Teirlinck"
327lispref/compile.texi "Luc Teirlinck" 264lispref/compile.texi "Luc Teirlinck"
328lispref/control.texi "Luc Teirlinck" 265lispref/control.texi "Luc Teirlinck"
diff --git a/configure b/configure
index c776e1fd633..d4c7ae27f4c 100755
--- a/configure
+++ b/configure
@@ -13704,8 +13704,9 @@ done
13704 13704
13705 13705
13706 13706
13707
13707for ac_func in gethostname getdomainname dup2 \ 13708for ac_func in gethostname getdomainname dup2 \
13708rename closedir mkdir rmdir sysinfo \ 13709rename closedir mkdir rmdir sysinfo getrusage \
13709random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime res_init setsid \ 13710random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime res_init setsid \
13710strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \ 13711strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
13711utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \ 13712utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \
diff --git a/configure.in b/configure.in
index 1478d4d4b5d..5a02beda097 100644
--- a/configure.in
+++ b/configure.in
@@ -2370,7 +2370,7 @@ AC_CHECK_FUNCS(touchlock)
2370AC_CHECK_HEADERS(maillock.h) 2370AC_CHECK_HEADERS(maillock.h)
2371 2371
2372AC_CHECK_FUNCS(gethostname getdomainname dup2 \ 2372AC_CHECK_FUNCS(gethostname getdomainname dup2 \
2373rename closedir mkdir rmdir sysinfo \ 2373rename closedir mkdir rmdir sysinfo getrusage \
2374random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime res_init setsid \ 2374random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime res_init setsid \
2375strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \ 2375strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
2376utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \ 2376utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \
diff --git a/etc/NEWS b/etc/NEWS
index ab810850722..0907c37ea7f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -173,11 +173,16 @@ types any more. Add -DUSE_LISP_UNION_TYPE if you want union types.
173 173
174* Changes in Emacs 21.4 174* Changes in Emacs 21.4
175 175
176** line-move-ignore-invisible now defaults to t.
177
178** In Outline mode, hide-body no longer hides lines at the top
179of the file that precede the first header line.
180
176+++ 181+++
177** `set-auto-mode' now gives the interpreter magic line (if present) 182** `set-auto-mode' now gives the interpreter magic line (if present)
178precedence over the file name. Likewise an <?xml or <!DOCTYPE declaration 183precedence over the file name. Likewise an <?xml or <!DOCTYPE declaration
179will give the buffer XML or SGML mode, unless the file name leads to a mode in 184will give the buffer XML or SGML mode, based on the new var
180`xml-based-modes'. 185`magic-mode-alist'.
181 186
182+++ 187+++
183** New function `looking-back' checks whether a regular expression matches 188** New function `looking-back' checks whether a regular expression matches
@@ -1006,13 +1011,19 @@ amount of text shown any more (only a crude approximation of it).
1006 1011
1007--- 1012---
1008** The pop up menus for Lucid now stay up if you do a fast click and can 1013** The pop up menus for Lucid now stay up if you do a fast click and can
1009be navigated with the arrow keys (like Gtk+ and W32). 1014be navigated with the arrow keys (like Gtk+, Mac and W32).
1010 1015
1011--- 1016---
1012** Dialogs for Lucid/Athena and Lesstif/Motif pops down when pressing ESC. 1017** Dialogs for Lucid/Athena and Lesstif/Motif now pops down when pressing
1018ESC, like they do for Gtk+, Mac and W32.
1019
1020---
1021** The menu item "Open File..." has been split into two items, "New File..."
1022and "Open File...". "Open File..." now opens only existing files. This is
1023to support existing GUI file selection dialogs better.
1013 1024
1014+++ 1025+++
1015** The file selection dialog for Gtk+, W32 and Motif/Lesstif can be 1026** The file selection dialog for Gtk+, Mac, W32 and Motif/Lesstif can be
1016disabled by customizing the variable `use-file-dialog'. 1027disabled by customizing the variable `use-file-dialog'.
1017 1028
1018+++ 1029+++
@@ -2155,6 +2166,13 @@ anyone has committed to the repository since you last executed
2155 2166
2156* New modes and packages in Emacs 21.4 2167* New modes and packages in Emacs 21.4
2157 2168
2169** The new package conf-mode.el handles thousands of configuration files, with
2170varying syntaxes for comments (;, #, //, /* */ or !), assignment (var = value,
2171var : value, var value or keyword var value) and sections ([section] or
2172section { }). Many files under /etc/, or with suffixes like .cf through
2173.config, .properties (Java), .desktop (KDE/Gnome), .ini and many others are
2174recognized.
2175
2158** The new package password.el provide a password cache and expiring mechanism. 2176** The new package password.el provide a password cache and expiring mechanism.
2159 2177
2160** The new package dns-mode.el add syntax highlight of DNS master files. 2178** The new package dns-mode.el add syntax highlight of DNS master files.
@@ -2393,6 +2411,18 @@ configuration files.
2393* Lisp Changes in Emacs 21.4 2411* Lisp Changes in Emacs 21.4
2394 2412
2395+++ 2413+++
2414** The new function syntax-after returns the syntax code
2415of the character after a specified buffer position, taking account
2416of text properties as well as the character code.
2417It returns the value compatibly with char-syntax, except
2418that the value can be a list (SYNTAX . MATCHER) which says
2419what the matching character is.
2420
2421+++
2422** The new primitive `get-internal-run-time' returns the processor
2423run time used by Emacs since start-up.
2424
2425+++
2396** The new function `called-interactively-p' does what many people 2426** The new function `called-interactively-p' does what many people
2397have mistakenly believed `interactively-p' did: it returns t if the 2427have mistakenly believed `interactively-p' did: it returns t if the
2398calling function was called through `call-interactively'. 2428calling function was called through `call-interactively'.
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index c04bdf2f094..8d6e7f2b734 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,18 @@
12004-11-09 Kim F. Storm <storm@cua.dk>
2
3 * make-docfile.c (scan_c_file): Set defvarperbufferflag to
4 silence compiler.
5
6 * hexl.c (main): Init local var c to silence compiler.
7
8 * etags.c (main, consider_token, C_entries): Add misc switch
9 default targets to silence compiler.
10
112004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
12
13 * makefile.w32-in (obj): Add all files (X and Mac) to doc so the
14 resulting DOC file can be used on Unix/Mac also.
15
12004-09-13 Francesco Potort,Al(B <pot@gnu.org> 162004-09-13 Francesco Potort,Al(B <pot@gnu.org>
2 17
3 * etags.c (main): When relative file names are given as argument, 18 * etags.c (main): When relative file names are given as argument,
diff --git a/lib-src/etags.c b/lib-src/etags.c
index a6004a048a9..e435c4d3926 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1400,6 +1400,8 @@ main (argc, argv)
1400 this_file = argbuffer[i].what; 1400 this_file = argbuffer[i].what;
1401 process_file (stdin, this_file, lang); 1401 process_file (stdin, this_file, lang);
1402 break; 1402 break;
1403 case at_end:
1404 break;
1403 } 1405 }
1404 } 1406 }
1405 1407
@@ -2900,6 +2902,8 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
2900 case tkeyseen: 2902 case tkeyseen:
2901 switch (toktype) 2903 switch (toktype)
2902 { 2904 {
2905 default:
2906 break;
2903 case st_none: 2907 case st_none:
2904 case st_C_class: 2908 case st_C_class:
2905 case st_C_struct: 2909 case st_C_struct:
@@ -2917,12 +2921,16 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
2917 case tend: 2921 case tend:
2918 switch (toktype) 2922 switch (toktype)
2919 { 2923 {
2924 default:
2925 break;
2920 case st_C_class: 2926 case st_C_class:
2921 case st_C_struct: 2927 case st_C_struct:
2922 case st_C_enum: 2928 case st_C_enum:
2923 return FALSE; 2929 return FALSE;
2924 } 2930 }
2925 return TRUE; 2931 return TRUE;
2932 default:
2933 break;
2926 } 2934 }
2927 2935
2928 /* 2936 /*
@@ -2960,6 +2968,8 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
2960 fvdef = fvnone; 2968 fvdef = fvnone;
2961 } 2969 }
2962 return FALSE; 2970 return FALSE;
2971 default:
2972 break;
2963 } 2973 }
2964 2974
2965 if (structdef == skeyseen) 2975 if (structdef == skeyseen)
@@ -2983,6 +2993,8 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
2983 case st_C_objimpl: 2993 case st_C_objimpl:
2984 objdef = oimplementation; 2994 objdef = oimplementation;
2985 return FALSE; 2995 return FALSE;
2996 default:
2997 break;
2986 } 2998 }
2987 break; 2999 break;
2988 case oimplementation: 3000 case oimplementation:
@@ -3039,6 +3051,8 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
3039 objdef = onone; 3051 objdef = onone;
3040 } 3052 }
3041 return FALSE; 3053 return FALSE;
3054 default:
3055 break;
3042 } 3056 }
3043 3057
3044 /* A function, variable or enum constant? */ 3058 /* A function, variable or enum constant? */
@@ -3091,6 +3105,8 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
3091 return FALSE; 3105 return FALSE;
3092 } 3106 }
3093 break; 3107 break;
3108 default:
3109 break;
3094 } 3110 }
3095 /* FALLTHRU */ 3111 /* FALLTHRU */
3096 case fvnameseen: 3112 case fvnameseen:
@@ -3107,8 +3123,12 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
3107 fvdef = fvnameseen; /* function or variable */ 3123 fvdef = fvnameseen; /* function or variable */
3108 *is_func_or_var = TRUE; 3124 *is_func_or_var = TRUE;
3109 return TRUE; 3125 return TRUE;
3126 default:
3127 break;
3110 } 3128 }
3111 break; 3129 break;
3130 default:
3131 break;
3112 } 3132 }
3113 3133
3114 return FALSE; 3134 return FALSE;
@@ -3584,6 +3604,8 @@ C_entries (c_ext, inf)
3584 fvdef = fignore; 3604 fvdef = fignore;
3585 } 3605 }
3586 break; 3606 break;
3607 default:
3608 break;
3587 } 3609 }
3588 if (structdef == stagseen && !cjava) 3610 if (structdef == stagseen && !cjava)
3589 { 3611 {
@@ -3594,6 +3616,8 @@ C_entries (c_ext, inf)
3594 case dsharpseen: 3616 case dsharpseen:
3595 savetoken = token; 3617 savetoken = token;
3596 break; 3618 break;
3619 default:
3620 break;
3597 } 3621 }
3598 if (!yacc_rules || lp == newlb.buffer + 1) 3622 if (!yacc_rules || lp == newlb.buffer + 1)
3599 { 3623 {
@@ -3632,6 +3656,8 @@ C_entries (c_ext, inf)
3632 linebuffer_setlen (&token_name, token_name.len + 1); 3656 linebuffer_setlen (&token_name, token_name.len + 1);
3633 strcat (token_name.buffer, ":"); 3657 strcat (token_name.buffer, ":");
3634 break; 3658 break;
3659 default:
3660 break;
3635 } 3661 }
3636 if (structdef == stagseen) 3662 if (structdef == stagseen)
3637 { 3663 {
@@ -3709,6 +3735,8 @@ C_entries (c_ext, inf)
3709 make_C_tag (TRUE); /* an Objective C method */ 3735 make_C_tag (TRUE); /* an Objective C method */
3710 objdef = oinbody; 3736 objdef = oinbody;
3711 break; 3737 break;
3738 default:
3739 break;
3712 } 3740 }
3713 switch (fvdef) 3741 switch (fvdef)
3714 { 3742 {
@@ -3779,6 +3807,8 @@ C_entries (c_ext, inf)
3779 fvdef = fvnone; 3807 fvdef = fvnone;
3780 } 3808 }
3781 break; 3809 break;
3810 default:
3811 break;
3782 } 3812 }
3783 break; 3813 break;
3784 case '(': 3814 case '(':
@@ -3812,6 +3842,8 @@ C_entries (c_ext, inf)
3812 case flistseen: 3842 case flistseen:
3813 fvdef = finlist; 3843 fvdef = finlist;
3814 break; 3844 break;
3845 default:
3846 break;
3815 } 3847 }
3816 parlev++; 3848 parlev++;
3817 break; 3849 break;
@@ -3837,6 +3869,8 @@ C_entries (c_ext, inf)
3837 case finlist: 3869 case finlist:
3838 fvdef = flistseen; 3870 fvdef = flistseen;
3839 break; 3871 break;
3872 default:
3873 break;
3840 } 3874 }
3841 if (!instruct 3875 if (!instruct
3842 && (typdef == tend 3876 && (typdef == tend
@@ -3886,6 +3920,8 @@ C_entries (c_ext, inf)
3886 bracelev = -1; 3920 bracelev = -1;
3887 } 3921 }
3888 break; 3922 break;
3923 default:
3924 break;
3889 } 3925 }
3890 switch (structdef) 3926 switch (structdef)
3891 { 3927 {
@@ -3899,6 +3935,8 @@ C_entries (c_ext, inf)
3899 structdef = snone; 3935 structdef = snone;
3900 make_C_tag (FALSE); /* a struct or enum */ 3936 make_C_tag (FALSE); /* a struct or enum */
3901 break; 3937 break;
3938 default:
3939 break;
3902 } 3940 }
3903 bracelev++; 3941 bracelev++;
3904 break; 3942 break;
diff --git a/lib-src/hexl.c b/lib-src/hexl.c
index 5ca7c2a5b8a..7a2f127ae61 100644
--- a/lib-src/hexl.c
+++ b/lib-src/hexl.c
@@ -173,7 +173,7 @@ main (argc, argv)
173#endif 173#endif
174 for (;;) 174 for (;;)
175 { 175 {
176 register int i, c, d; 176 register int i, c = 0, d;
177 177
178#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10) 178#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10)
179 179
@@ -225,7 +225,7 @@ main (argc, argv)
225 string[17] = '\0'; 225 string[17] = '\0';
226 for (;;) 226 for (;;)
227 { 227 {
228 register int i, c; 228 register int i, c = 0;
229 229
230 for (i=0; i < 16; ++i) 230 for (i=0; i < 16; ++i)
231 { 231 {
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 802b4e09e67..e502061b759 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -617,6 +617,7 @@ scan_c_file (filename, mode)
617 c = getc (infile); 617 c = getc (infile);
618 defunflag = c == 'U'; 618 defunflag = c == 'U';
619 defvarflag = 0; 619 defvarflag = 0;
620 defvarperbufferflag = 0;
620 } 621 }
621 else continue; 622 else continue;
622 623
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index 663d08e6f13..0f806912be5 100644
--- a/lib-src/makefile.w32-in
+++ b/lib-src/makefile.w32-in
@@ -124,9 +124,30 @@ $(BLD)/ctags.$(O): ctags.c
124# $(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O) 124# $(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O)
125 125
126# 126#
127# From ..\src\makefile.nt. 127# From ..\src\Makefile.in
128# It doesn't matter if the real name is *.obj for the files in this list,
129# make-docfile blindly replaces .o with .c anyway. Keep .o in this list
130# as it is required by code in doc.c.
128# 131#
129obj = abbrev.c alloc.c alloca.c buffer.c bytecode.c callint.c callproc.c casefiddle.c casetab.c category.c ccl.c charset.c cm.c cmds.c coding.c data.c dired.c dispnew.c doc.c doprnt.c editfns.c emacs.c eval.c fileio.c filelock.c filemode.c floatfns.c fns.c fontset.c frame.c fringe.c gmalloc.c image.c indent.c insdel.c intervals.c keyboard.c keymap.c lastfile.c lread.c macros.c marker.c minibuf.c print.c process.c ralloc.c regex.c region-cache.c scroll.c search.c sound.c strftime.c syntax.c sysdep.c term.c termcap.c textprop.c tparam.c undo.c unexw32.c vm-limit.c w32.c w32console.c w32fns.c w32heap.c w32inevt.c w32menu.c w32proc.c w32reg.c w32select.c w32term.c w32xfns.c window.c xdisp.c xfaces.c xfaces.c 132obj= sunfns.o dosfns.o msdos.o \
133 xterm.o xfns.o xmenu.o xselect.o xrdb.o fringe.o image.o \
134 mac.o macterm.o macfns.o macmenu.o fontset.o \
135 w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
136 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
137 dispnew.o frame.o scroll.o xdisp.o window.o \
138 charset.o coding.o category.o ccl.o \
139 cm.o term.o xfaces.o \
140 emacs.o keyboard.o macros.o keymap.o sysdep.o \
141 buffer.o filelock.o insdel.o marker.o \
142 minibuf.o fileio.o dired.o filemode.o \
143 cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
144 alloc.o data.o doc.o editfns.o callint.o \
145 eval.o floatfns.o fns.o print.o lread.o \
146 abbrev.o syntax.o bytecode.o \
147 process.o callproc.o \
148 region-cache.o sound.o atimer.o \
149 doprnt.o strftime.o intervals.o textprop.o composite.o md5.o
150
130# 151#
131# These are the lisp files that are loaded up in loadup.el 152# These are the lisp files that are loaded up in loadup.el
132# 153#
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3b3579e3908..d1826a7fade 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,437 @@
12004-11-12 Nick Roberts <nickrob@snap.net.nz>
2
3 * tooltip.el (require): Explain why CL is needed.
4
52004-11-11 Vinicius Jose Latorre <viniciusjl@ig.com.br>
6
7 * printing.el: Insert :version into defgroup (printing). All reference
8 to Files option in menubar were changed to File.
9 (pr-version): New version number (6.8.2).
10 (pr-get-symbol): Call easy-menu-intern.
11 (pr-region-active-p): Now is a fun (it was defsubst). To avoid
12 compilation gripes.
13
142004-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
15
16 * international/iso-cvt.el (iso-cvt-define-menu): Fix typo.
17
18 * tooltip.el: Require CL.
19
20 * emacs-lisp/bytecomp.el: Use push.
21 (byte-compile-file-form-defalias): Rename from byte-compile-defalias.
22 (defalias): Remove the `byte-compile' property and add
23 a `byte-hunk-handler'.
24
252004-11-11 Juri Linkov <juri@jurta.org>
26
27 * info.el (Info-search): Save match data for isearch.
28 Skip Tag Table node.
29
30 * descr-text.el (describe-char): Replace syntax-after with code
31 from its previous version.
32
33 * files.el (magic-mode-alist): Use optimization for SGML mode too.
34 (set-auto-mode): Doc fix. Remove unused variable `xml'.
35
36 * international/mule.el (sgml-html-meta-auto-coding-function):
37 Remove > after <html to allow HTML attributes.
38
392004-11-11 Jay Belanger <belanger@truman.edu>
40
41 * calc/calc-comb.el (math-prime-factors-finished): Declare it as
42 a variable.
43 (calcFunc-dfac): Replace unbound max by n.
44 (math-stirling-local-cache): New variable.
45 (math-stirling-number, math-stirling-1, math-stirling-2):
46 Replace the variable `cache' by the declared variable
47 math-stirling-local-cache.
48 (var-RandSeed): Declare it as a variable.
49 (math-init-random-base, math-random-digit): Don't check to see if
50 var-RandSeed is bound.
51 (math-random-cache, math-gaussian-cache, calc-verbose-nextprime):
52 Declare them instead of just setting them.
53 (math-init-random-base): Made i a local variable.
54 (math-random-digit): Made math-random-last a local variable.
55 (math-prime-test-cache): Move declaration to before it is used.
56 (math-prime-test-cache-k, math-prime-test-cache-q)
57 (math-prime-test-cache-nm1, math-prime-factors-finished):
58 Declare them as variables.
59
602004-11-11 Jay Belanger <belanger@truman.edu>
61
62 * calc/calc-ext.el (math-defcache): Use defvar for the new
63 variables it creates.
64
652004-11-11 Lars Hansen <larsh@math.ku.dk>
66
67 * desktop.el (desktop-buffer-mode-handlers, desktop-after-read-hook)
68 (desktop-clear-preserve-buffers-regexp, desktop-file-name-format)
69 (desktop-globals-to-clear, desktop-no-desktop-file-hook, desktop-path)
70 (desktop-save): Add :version.
71
722004-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
73
74 * printing.el (pr-get-symbol): Don't downcase.
75
762004-11-10 Jay Belanger <belanger@truman.edu>
77
78 * calc/calc-aent.el (calc-do-quick-calc): Use kill-new to append
79 string to kill-ring.
80
81 * calc/calc-aent.el (calc-alg-exp, math-toks)
82 (math-exp-pos,math-exp-old-pos, math-exp-token)
83 (math-exp-keep-spaces, math-exp-str): New variables.
84 (calc-do-alg-entry, calcAlg-equals, calcAlg-edit)
85 (calcAlg-enter): Use declared variable calc-alg-exp.
86 (math-build-parse-table, math-find-user-token): Use declared
87 variable math-toks.
88 (math-read-exprs, math-read-token, calc-check-user-syntax)
89 (calc-match-user-syntax, match-factor-after, math-read-factor):
90 Use declared variables math-exp-pos math-exp-old-pos.
91 (math-read-exprs, math-read-token, math-read-expr-level)
92 (calc-check-user-syntax, calc-match-user-syntax)
93 (match-factor-after, math-read-factor): Use declared variable
94 math-exp-token.
95 (math-read-exprs, math-read-expr-list, math-read-token)
96 (math-read-factor): Use declared variable math-exp-keep-spaces.
97 (math-read-exprs, math-read-token): Use declared variable
98 math-exp-str.
99 (calc-match-user-syntax): Made m a local variable.
100
101 * calc/calc-ext.el (math-read-expr): Use declared variables
102 math-exp-pos, math-exp-old-pos, math-exp-str, math-exp-token,
103 math-exp-keep-spaces.
104
105 * calc/calc-forms.el (math-read-angle-bracket): Use declared
106 variables math-exp-pos, math-exp-str.
107
108 * calc/calc-lang.el (math-parse-tex-sum): Use declared variable
109 math-exp-old-pos.
110 (math-parse-fortran-vector, math-parse-fortran-vector-end)
111 (math-parse-eqn-prime): Use declared variable math-exp-token.
112
113 * calc/calc-vec.el (math-read-brackets, math-check-for-commas):
114 Use declared variable math-exp-pos.
115 (math-check-for-commas): Use declared variable math-exp-str.
116 (math-read-brackets): Use declared variables math-exp-old-pos,
117 math-exp-keep-spaces.
118 (math-read-brackets, math-read-vector, math-read-matrix):
119 Use declared variable math-exp-token.
120
1212004-11-10 Stefan Monnier <monnier@iro.umontreal.ca>
122
123 * files.el (magic-mode-alist): Reduce backtracking in the HTML regexp.
124
125 * textmodes/sgml-mode.el (sgml-tag-text-p): New fun.
126 (sgml-parse-tag-backward): Use it to skip spurious < or >.
127
1282004-11-10 Thien-Thi Nguyen <ttn@gnu.org>
129
130 * ebuff-menu.el: Doc fixes throughout.
131 (electric-buffer-menu-mode-hook): New defvar.
132
1332004-11-10 Nick Roberts <nickrob@snap.net.nz>
134
135 * tooltip.el: Don't require cl, comint, gud, gdb-ui for
136 compilation. The resulting compiler warnings appear to be harmless.
137
1382004-11-10 Daniel Pfeiffer <occitan@esperanto.org>
139
140 * textmodes/conf-mode.el: New file.
141
142 * files.el (auto-mode-alist, magic-mode-alist): Use it.
143
1442004-11-09 Stefan Monnier <monnier@iro.umontreal.ca>
145
146 * international/iso-cvt.el (iso-cvt-define-menu): Clean up namespace.
147
1482004-11-09 Jay Belanger <belanger@truman.edu>
149
150 * calc/calc-ext.el (calc-init-extensions): Remove old code.
151
152 * calc/calc-ext.el (math-expr-data, math-mt-many, math-mt-func)
153 (calc-z-prefix-buf, calc-z-prefix-msgs): New variables.
154 (calc-z-prefix-help, calc-user-function-list): Use declared
155 variables calc-z-prefix-buf, calc-z-prefix-msgs.
156 (math-map-tree, math-map-tree-rec): Use declared variables
157 math-mt-many, math-mt-func.
158 (math-read-expression, math-read-string): Use declared variable
159 math-expr-data.
160
161 * calc/calc-ext.el (math-normalize-nonstandard): Use declared
162 variable math-normalize-a.
163
164 * calc/calc.el (math-normalize-a): New variable.
165 (math-normalize): Use declared variable math-normalize-a.
166
167 * calc/calc-poly.el (math-expand-form): Use declared variable
168 math-mt-many.
169
170 * calc/calc-rewr.el (math-rewrite, math-rewrite-phase):
171 Use declared variable math-mt-many.
172 (math-rewrite): Use declared variable math-mt-func.
173
174 * calc/calc-vec.el (math-read-brackets, math-read-vector)
175 (math-read-matrix): Use declared variable math-expr-data.
176
177 * calc/calc-lang.el (math-parse-fortran-vector)
178 (math-parse-fortran-vector-end, math-parse-tex-sum)
179 (math-parse-eqn-matrix, math-parse-eqn-prime)
180 (math-read-math-subscr): Use declared variable math-expr-data.
181
182 * calc/calc-aent.el (math-read-exprs, math-read-expr-list)
183 (math-read-expr-level, math-read-token, calc-check-user-syntax)
184 (calc-match-user-syntax, math-read-if, math-factor-after)
185 (math-read-factor): Use declared variable math-expr-data.
186
1872004-11-09 Glenn Morris <gmorris@ast.cam.ac.uk>
188
189 * calendar/diary-lib.el (diary-from-outlook)
190 (diary-from-outlook-gnus, diary-from-outlook-rmail): Do not use
191 interactive-p; but rather new optional argument NOCONFIRM.
192
1932004-11-09 Stefan Monnier <monnier@iro.umontreal.ca>
194
195 * emacs-lisp/easymenu.el (easy-menu-intern): Revert to no-downcasing.
196 (easy-menu-name-match): Revert correspondingly.
197
1982004-11-09 Richard M. Stallman <rms@gnu.org>
199
200 * emacs-lisp/bytecomp.el (byte-compile-defalias):
201 Turn off warnings for the new function even if definition not constant.
202 If the definition isn't a quoted symbol, record (FUNCTION . t).
203 (byte-compile-function-environment): Now allow (FUNCTION . t) as elt.
204 (byte-compile-callargs-warn): Handle (FUNCTION . t).
205 (display-call-tree, byte-compile-arglist-warn):
206 Handle t returned by byte-compile-fdefinition.
207
2082004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
209
210 * Makefile.in (maintainer-clean): Depend on distclean.
211
212 * help-fns.el (help-C-file-name): File name must be in build-files
213 to be returned.
214
2152004-11-09 Jay Belanger <belanger@truman.edu>
216
217 * calc/calc.el (calc-mode-hook, calc-trail-mode-hook)
218 (calc-start-hook, calc-end-hook, calc-load-hook): New variables.
219
220 * calc/calc.el (calc, calc-trail-display, calc-mode):
221 Remove obsolete sections.
222
223 * calc/calc.el (calc-x-paste-text): Remove.
224
225 * calc/calc-ext.el (calc-init-extensions): Bind calc-yank to
226 mouse-2.
227
2282004-11-09 Nick Roberts <nickrob@snap.net.nz>
229
230 * progmodes/gdb-ui.el (gdb-current-stack-level): New variable.
231 (gdb-info-frames-custom, gdb-frame-handler): Use it to find
232 current frame (in case of recursive calls).
233 (gdb-show-changed-values): Add :version keyword.
234
2352004-11-08 Stefan Monnier <monnier@iro.umontreal.ca>
236
237 * international/mule-cmds.el: Change coding-system to utf-8.
238 (select-safe-coding-system-interactively):
239 New function extracted from select-safe-coding-system.
240 (select-safe-coding-system): Use it.
241
2422004-11-08 Richard M. Stallman <rms@gnu.org>
243
244 * subr.el (syntax-after): Doc fix.
245
246 * paren.el (show-paren-function): Change calls to syntax-after
247 for new way of returning the value.
248
249 * menu-bar.el (menu-bar-file-menu): Make this the real name
250 and menu-bar-files-menu the alias. Use the former.
251 (global-map): Use `file', not `files', as the symbol.
252
253 * info.el (Info-revert-find-node): Don't use beginning-of-buffer.
254
255 * filesets.el (filesets-spawn-external-viewer, filesets-run-cmd):
256 Don't use beginning-of-buffer.
257 (filesets-cmd-show-result): Use with-no-warnings.
258
2592004-11-08 Juri Linkov <juri@jurta.org>
260
261 * progmodes/compile.el (compile): Don't overwrite last command in
262 minibuffer history with default command if they are not equal.
263
2642004-11-08 Jay Belanger <belanger@truman.edu>
265
266 * calc/calcalg2.el (math-do-integral-methods): Try linear then
267 non-linear substitutions.
268
2692004-11-08 Jay Belanger <belanger@truman.edu>
270
271 * calc/calcalg2.el (math-linear-subst-tried): New variable.
272 (math-do-integral): Set `math-linear-subst-tried' to nil.
273 (math-do-integral-methods): Use `math-linear-subst-tried' to
274 determine what type of substitution to try.
275 (math-integ-try-linear-substituion):
276 Set `math-linear-subst-tried' to t.
277
2782004-11-08 Kim F. Storm <storm@cua.dk>
279
280 * Makefile.in (bootstrap-clean): New target for 'make bootstrap'.
281
2822004-11-07 Juri Linkov <juri@jurta.org>
283
284 * info-look.el (info-lookup): Allow reusing in the current buffer
285 not only *info* buffer, but all (even renamed) Info buffers
286 by checking for major-mode instead of *info* buffer name.
287 (c-mode, autoconf-mode, emacs-lisp-mode, scheme-mode)
288 (octave-mode, maxima-mode) <doc-spec>:
289 Allow long dashes generated by Texinfo 4.7 before definitions.
290 (texinfo-mode) <doc-spec>: Add space to suffix to find command
291 definitions with argument separated by space.
292
2932004-11-06 Richard M. Stallman <rms@gnu.org>
294
295 * simple.el (next-error group, face): Move before first use.
296 (next-error-highlight, next-error-highlight-no-select): Likewise.
297
298 * simple.el (line-move-invisible-p): Rename from line-move-invisible.
299 (line-move): New args NOERROR and TO-END.
300 Return t if if succeed in moving specified number of lines.
301 (move-end-of-line): New function.
302
303 * simple.el (beginning-of-buffer-other-window): Use with-no-warnings.
304 (end-of-buffer-other-window): Likewise.
305
306 * simple.el (line-move-ignore-invisible): Default to t.
307
308 * subr.el (syntax-after): Return the syntax letter, not the raw code.
309
310 * emacs-lisp/elp.el (elp-results): Delete wasteful beginning-of-buffer.
311
312 * international/iso-cvt.el (iso-cvt-define-menu):
313 Rename menu-bar-files-menu to menu-bar-file-menu.
314
315 * net/browse-url.el (browse-url-gnome-moz-program)
316 (browse-url-gnome-moz-arguments): Move up before first use.
317
318 * net/tramp.el (tramp group): Add :version.
319
320 * progmodes/ada-xref.el (ada-gdb-application):
321 Use goto-char instead of beginning-of-buffer.
322
323 * progmodes/cperl-mode.el (cperl-info-on-command):
324 Use goto-char instead of beginning-of-buffer.
325
326 * progmodes/idlw-shell.el (idlwave-shell-examine-map):
327 Move up before first use.
328 (idlwave-shell-temp-pro-file): Likewise.
329 (idlwave-shell-temp-rinfo-save-file): Likewise.
330 (idlwave-shell-temp-file): Minor doc fix.
331
332 * textmodes/flyspell.el (flyspell-external-point-words):
333 Use goto-char instead of beginning-of-buffer.
334
3352004-11-06 Kai Grossjohann <kai.grossjohann@gmx.net>
336
337 * net/tramp.el (tramp-coding-commands): Additionally try "uudecode -o
338 /dev/stdout" before trying "uudecode -o -". Suggested by Han Boetes.
339 (tramp-uudecode): Mention `uudecode -o /dev/stdout'.
340
3412004-11-06 David Ponce <david@dponce.com>
342
343 * recentf.el (recentf-menu-path): Use menu item name.
344
3452004-11-06 Eli Zaretskii <eliz@gnu.org>
346
347 * progmodes/gdb-ui.el: Don't call define-fringe-bitmap if the
348 display doesn't support images.
349
3502004-11-06 Andreas Schwab <schwab@suse.de>
351
352 * tempo.el (tempo-match-finder): Doc fix.
353
354 * emacs-lisp/easymenu.el (easy-menu-get-map): Fix last change.
355
3562004-11-06 Stefan Monnier <monnier@iro.umontreal.ca>
357
358 * emacs-lisp/easymenu.el (easy-menu-get-map-look-for-name): Remove.
359 (easy-menu-lookup-name): New fun to replace it.
360 (easy-menu-get-map): Use it to obey menu item names (rather than just
361 keys) when looking up `path'.
362 (easy-menu-always-true-p): Rename from easy-menu-always-true.
363 (easy-menu-convert-item-1): Adjust to new name.
364
3652004-11-06 Peter Heslin <pj@heslin.eclipse.co.uk> (tiny change)
366
367 * outline.el (hide-body): Don't hide lines at the top of the file
368 that precede the first header line.
369
3702004-11-06 Paul Pogonyshev <pogonyshev@gmx.net>
371
372 * align.el (align-areas): Delete whitespace before reindenting, so
373 that tabs are never placed after spaces.
374
3752004-11-06 Alan Shutko <ats@acm.org>
376
377 * macros.el (insert-kbd-macro): Do completions based on macros,
378 rather than all commands.
379
3802004-11-06 David Hansen <david.hansen@gmx.net> (tiny change)
381
382 * tempo.el (tempo-match-finder): Use [:word:] instead of "^\\b",
383 to solve a bug whereby tags with 'b' don't match.
384
3852004-11-05 Juri Linkov <juri@jurta.org>
386
387 * info.el (Info-search): Don't search in node header lines
388 and file headers.
389
390 * emacs-lisp/edebug.el (edebug-next-token-class): Allow all
391 symbol-constituent characters after dot, not only digits.
392
3932004-11-04 Daniel Pfeiffer <occitan@esperanto.org>
394
395 * files.el (set-auto-mode): Don't get error after setting -*-mode-*-.
396
3972004-11-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
398
399 * dired.el (dired-read-dir-and-switches): Call read-directory-name
400 if a dialog will be used, read-file-name otherwise.
401
4022004-11-04 Richard M. Stallman <rms@gnu.org>
403
404 * textmodes/table.el (table group): Add :version.
405
406 * textmodes/ispell.el (ispell-word):
407 Don't alter args; set them only thru `interactive' spec.
408
409 * textmodes/flyspell.el (flyspell-word):
410 Don't alter FOLLOWING; set it only thru `interactive' spec.
411
412 * progmodes/f90.el (f90-end-of-block): Don't use interactive-p.
413
414 * net/browse-url.el (browse-url-maybe-new-window):
415 Use called-interactively-p.
416
417 * mail/supercite.el (sc-cite-region):
418 Don't use interactive-p. Add arg INTERACTIVE.
419 (sc-version): Don't use interactive-p. Rename arg to MESSAGE.
420
421 * international/mule-cmds.el (set-input-method, toggle-input-method):
422 Don't use interactive-p. Add arg INTERACTIVE.
423
424 * eshell/esh-mode.el (eshell-show-maximum-output):
425 Don't use interactive-p.
426 (eshell-truncate-buffer): Just message, no error, if buffer is short.
427
428 * mouse.el (mouse-show-mark): Get positions to delete from mark
429 and point, not from mouse-drag-overlay.
430
431 * imenu.el (imenu-eager-completion-buffer): Add :version.
432
433 * filesets.el (filesets group): Add :version.
434
12004-11-03 Daniel Pfeiffer <occitan@esperanto.org> 4352004-11-03 Daniel Pfeiffer <occitan@esperanto.org>
2 436
3 * files.el (xml-based-modes): Delete var. 437 * files.el (xml-based-modes): Delete var.
@@ -28,6 +462,12 @@
28 462
292004-11-02 Richard M. Stallman <rms@gnu.org> 4632004-11-02 Richard M. Stallman <rms@gnu.org>
30 464
465 * cus-edit.el (customize-group-other-window):
466 Select the window that displays the custom buffer.
467 (custom-buffer-create-other-window): Likewise.
468
469 * comint.el (comint-insert-input): Fix previous change.
470
31 * emacs-lisp/elp.el (elp-instrument-function): 471 * emacs-lisp/elp.el (elp-instrument-function):
32 Use called-interactively-p. 472 Use called-interactively-p.
33 473
@@ -74,8 +514,7 @@
74 (icalendar-convert-diary-to-ical) 514 (icalendar-convert-diary-to-ical)
75 (icalendar-extract-ical-from-buffer): Use only two args for 515 (icalendar-extract-ical-from-buffer): Use only two args for
76 make-obsolete (XEmacs compatibility). 516 make-obsolete (XEmacs compatibility).
77 (icalendar-export-file, icalendar-import-file): Blank at end of 517 (icalendar-export-file, icalendar-import-file): Blank at end of prompt.
78 prompt.
79 (icalendar-export-region): Doc fix. 518 (icalendar-export-region): Doc fix.
80 If error, return non-nil and write errors to a buffer. 519 If error, return non-nil and write errors to a buffer.
81 Use correct weekday for weekly recurring events. 520 Use correct weekday for weekly recurring events.
@@ -115,16 +554,16 @@
115 554
1162004-11-02 Pavel Kobiakov <pk_at_work@yahoo.com> 5552004-11-02 Pavel Kobiakov <pk_at_work@yahoo.com>
117 556
118 * progmodes/flymake.el (flymake-err-line-patterns): Use 557 * progmodes/flymake.el (flymake-err-line-patterns):
119 `flymake-reformat-err-line-patterns-from-compile-el' to convert 558 Use `flymake-reformat-err-line-patterns-from-compile-el' to convert
120 `compilation-error-regexp-alist-alist' to internal Flymake format. 559 `compilation-error-regexp-alist-alist' to internal Flymake format.
121 560
122 * progmodes/flymake.el: eliminated byte-compiler warnings. 561 * progmodes/flymake.el: eliminated byte-compiler warnings.
123 562
1242004-11-01 Jay Belanger <belanger@truman.edu> 5632004-11-01 Jay Belanger <belanger@truman.edu>
125 564
126 * calc/calc-frac.el (calc-over-notation): Replaced 565 * calc/calc-frac.el (calc-over-notation): Replace `completing-read'
127 `completing-read' with `interactive "s"'. 566 with `interactive "s"'.
128 567
1292004-11-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 5682004-11-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
130 569
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 d43f47871c2..8a4659fcc1c 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -309,9 +309,12 @@ bootstrap-prepare:
309 fi \ 309 fi \
310 fi 310 fi
311 311
312maintainer-clean: 312maintainer-clean: distclean
313 cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL) 313 cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL)
314 314
315bootstrap-clean:
316 cd $(lisp); rm -f *.elc */*.elc
317
315# Generate/update files for the bootstrap process. 318# Generate/update files for the bootstrap process.
316 319
317bootstrap: update-subdirs autoloads compile 320bootstrap: update-subdirs autoloads compile
diff --git a/lisp/align.el b/lisp/align.el
index bae09d749db..5e739c8f7c0 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -1212,6 +1212,14 @@ have been aligned. No changes will be made to the buffer."
1212 (cond ((< gocol 0) t) ; don't do anything 1212 (cond ((< gocol 0) t) ; don't do anything
1213 ((= cur gocol) t) ; don't need to 1213 ((= cur gocol) t) ; don't need to
1214 ((< cur gocol) ; just add space 1214 ((< cur gocol) ; just add space
1215 ;; FIXME: It is stated above that "...the
1216 ;; whitespace to be modified was already
1217 ;; deleted by `align-region', all we have
1218 ;; to do here is indent." However, this
1219 ;; doesn't seem to be true, so we first
1220 ;; delete the whitespace to avoid tabs
1221 ;; after spaces.
1222 (delete-horizontal-space t)
1215 (indent-to gocol)) 1223 (indent-to gocol))
1216 (t 1224 (t
1217 ;; This code works around an oddity in the 1225 ;; This code works around an oddity in the
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-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 2693575f4e2..0c84245b6c1 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -499,7 +499,10 @@ as well as widgets, buttons, overlays, and text properties."
499 (format (if (< code 256) "0x%02X" "0x%04X") code) 499 (format (if (< code 256) "0x%02X" "0x%04X") code)
500 (format "0x%04X%04X" (car code) (cdr code)))) 500 (format "0x%04X%04X" (car code) (cdr code))))
501 ("syntax" 501 ("syntax"
502 ,(let ((syntax (syntax-after pos))) 502 ,(let* ((st (if parse-sexp-lookup-properties
503 (get-char-property pos 'syntax-table)))
504 (syntax (if (consp st) st
505 (aref (or st (syntax-table)) (char-after pos)))))
503 (with-temp-buffer 506 (with-temp-buffer
504 (internal-describe-syntax-value syntax) 507 (internal-describe-syntax-value syntax)
505 (buffer-string)))) 508 (buffer-string))))
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 28521a0d7c4..779532fbca0 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
diff --git a/lisp/dired.el b/lisp/dired.el
index c0fc33729c2..4553683b181 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -546,8 +546,14 @@ Optional third argument FILTER, if non-nil, is a function to select
546 (if current-prefix-arg 546 (if current-prefix-arg
547 (read-string "Dired listing switches: " 547 (read-string "Dired listing switches: "
548 dired-listing-switches)) 548 dired-listing-switches))
549 (read-directory-name (format "Dired %s(directory): " str) 549 ;; If a dialog is about to be used, call read-directory-name so
550 nil default-directory nil)))) 550 ;; the dialog code knows we want directories. Some dialogs can
551 ;; only select directories or files when popped up, not both.
552 (if (next-read-file-uses-dialog-p)
553 (read-directory-name (format "Dired %s(directory): " str)
554 nil default-directory nil)
555 (read-file-name (format "Dired %s(directory): " str)
556 nil default-directory nil)))))
551 557
552;;;###autoload (define-key ctl-x-map "d" 'dired) 558;;;###autoload (define-key ctl-x-map "d" 'dired)
553;;;###autoload 559;;;###autoload
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/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index da1e5fba8b2..11d1b112736 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.
@@ -3610,7 +3615,6 @@ being undefined will be suppressed."
3610(byte-defop-compiler-1 defconst byte-compile-defvar) 3615(byte-defop-compiler-1 defconst byte-compile-defvar)
3611(byte-defop-compiler-1 autoload) 3616(byte-defop-compiler-1 autoload)
3612(byte-defop-compiler-1 lambda byte-compile-lambda-form) 3617(byte-defop-compiler-1 lambda byte-compile-lambda-form)
3613(byte-defop-compiler-1 defalias)
3614 3618
3615(defun byte-compile-defun (form) 3619(defun byte-compile-defun (form)
3616 ;; This is not used for file-level defuns with doc strings. 3620 ;; This is not used for file-level defuns with doc strings.
@@ -3712,22 +3716,22 @@ being undefined will be suppressed."
3712 (error "`lambda' used as function name is invalid")) 3716 (error "`lambda' used as function name is invalid"))
3713 3717
3714;; Compile normally, but deal with warnings for the function being defined. 3718;; Compile normally, but deal with warnings for the function being defined.
3715(defun byte-compile-defalias (form) 3719(put 'defalias 'byte-hunk-handler 'byte-compile-file-form-defalias)
3720(defun byte-compile-file-form-defalias (form)
3716 (if (and (consp (cdr form)) (consp (nth 1 form)) 3721 (if (and (consp (cdr form)) (consp (nth 1 form))
3717 (eq (car (nth 1 form)) 'quote) 3722 (eq (car (nth 1 form)) 'quote)
3718 (consp (cdr (nth 1 form))) 3723 (consp (cdr (nth 1 form)))
3719 (symbolp (nth 1 (nth 1 form))) 3724 (symbolp (nth 1 (nth 1 form))))
3720 (consp (nthcdr 2 form)) 3725 (let ((constant
3721 (consp (nth 2 form)) 3726 (and (consp (nthcdr 2 form))
3722 (eq (car (nth 2 form)) 'quote) 3727 (consp (nth 2 form))
3723 (consp (cdr (nth 2 form))) 3728 (eq (car (nth 2 form)) 'quote)
3724 (symbolp (nth 1 (nth 2 form)))) 3729 (consp (cdr (nth 2 form)))
3725 (progn 3730 (symbolp (nth 1 (nth 2 form))))))
3726 (byte-compile-defalias-warn (nth 1 (nth 1 form))) 3731 (byte-compile-defalias-warn (nth 1 (nth 1 form)))
3727 (setq byte-compile-function-environment 3732 (push (cons (nth 1 (nth 1 form))
3728 (cons (cons (nth 1 (nth 1 form)) 3733 (if constant (nth 1 (nth 2 form)) t))
3729 (nth 1 (nth 2 form))) 3734 byte-compile-function-environment)))
3730 byte-compile-function-environment))))
3731 (byte-compile-normal-call form)) 3735 (byte-compile-normal-call form))
3732 3736
3733;; Turn off warnings about prior calls to the function being defalias'd. 3737;; Turn off warnings about prior calls to the function being defalias'd.
@@ -3930,7 +3934,7 @@ invoked interactively."
3930 (while rest 3934 (while rest
3931 (or (nth 1 (car rest)) 3935 (or (nth 1 (car rest))
3932 (null (setq f (car (car rest)))) 3936 (null (setq f (car (car rest))))
3933 (byte-compile-fdefinition f t) 3937 (functionp (byte-compile-fdefinition f t))
3934 (commandp (byte-compile-fdefinition f nil)) 3938 (commandp (byte-compile-fdefinition f nil))
3935 (setq uncalled (cons f uncalled))) 3939 (setq uncalled (cons f uncalled)))
3936 (setq rest (cdr rest))) 3940 (setq rest (cdr rest)))
@@ -4112,5 +4116,5 @@ For example, invoke `emacs -batch -f batch-byte-recompile-directory .'."
4112 4116
4113(run-hooks 'bytecomp-load-hook) 4117(run-hooks 'bytecomp-load-hook)
4114 4118
4115;;; arch-tag: 9c97b0f0-8745-4571-bfc3-8dceb677292a 4119;; arch-tag: 9c97b0f0-8745-4571-bfc3-8dceb677292a
4116;;; bytecomp.el ends here 4120;;; bytecomp.el ends here
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index e039b80aee5..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)
@@ -242,9 +224,9 @@ possibly preceded by keyword pairs as described in `easy-menu-define'."
242 (setq visible (or arg ''nil))))) 224 (setq visible (or arg ''nil)))))
243 (if (equal visible ''nil) 225 (if (equal visible ''nil)
244 nil ; Invisible menu entry, return nil. 226 nil ; Invisible menu entry, return nil.
245 (if (and visible (not (easy-menu-always-true visible))) 227 (if (and visible (not (easy-menu-always-true-p visible)))
246 (setq prop (cons :visible (cons visible prop)))) 228 (setq prop (cons :visible (cons visible prop))))
247 (if (and enable (not (easy-menu-always-true enable))) 229 (if (and enable (not (easy-menu-always-true-p enable)))
248 (setq prop (cons :enable (cons enable prop)))) 230 (setq prop (cons :enable (cons enable prop))))
249 (if filter (setq prop (cons :filter (cons filter prop)))) 231 (if filter (setq prop (cons :filter (cons filter prop))))
250 (if help (setq prop (cons :help (cons help prop)))) 232 (if help (setq prop (cons :help (cons help prop))))
@@ -363,12 +345,12 @@ ITEM defines an item as in `easy-menu-define'."
363 (cons cmd keys)))) 345 (cons cmd keys))))
364 (setq cache-specified nil)) 346 (setq cache-specified nil))
365 (if keys (setq prop (cons :keys (cons keys prop))))) 347 (if keys (setq prop (cons :keys (cons keys prop)))))
366 (if (and visible (not (easy-menu-always-true visible))) 348 (if (and visible (not (easy-menu-always-true-p visible)))
367 (if (equal visible ''nil) 349 (if (equal visible ''nil)
368 ;; Invisible menu item. Don't insert into keymap. 350 ;; Invisible menu item. Don't insert into keymap.
369 (setq remove t) 351 (setq remove t)
370 (setq prop (cons :visible (cons visible prop))))))) 352 (setq prop (cons :visible (cons visible prop)))))))
371 (if (and active (not (easy-menu-always-true active))) 353 (if (and active (not (easy-menu-always-true-p active)))
372 (setq prop (cons :enable (cons active prop)))) 354 (setq prop (cons :enable (cons active prop))))
373 (if (and (or no-name cache-specified) 355 (if (and (or no-name cache-specified)
374 (or (null cache) (stringp cache) (vectorp cache))) 356 (or (null cache) (stringp cache) (vectorp cache)))
@@ -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)
@@ -426,7 +409,8 @@ KEY does not have to be a symbol, and comparison is done with equal."
426 409
427(defun easy-menu-name-match (name item) 410(defun easy-menu-name-match (name item)
428 "Return t if NAME is the name of menu item ITEM. 411 "Return t if NAME is the name of menu item ITEM.
429NAME can be either a string, or a symbol." 412NAME can be either a string, or a symbol.
413ITEM should be a keymap binding of the form (KEY . MENU-ITEM)."
430 (if (consp item) 414 (if (consp item)
431 (if (symbolp name) 415 (if (symbolp name)
432 (eq (car-safe item) name) 416 (eq (car-safe item) name)
@@ -436,10 +420,9 @@ NAME can be either a string, or a symbol."
436 (error nil)) ;`item' might not be a proper list. 420 (error nil)) ;`item' might not be a proper list.
437 ;; Also check the string version of the symbol name, 421 ;; Also check the string version of the symbol name,
438 ;; for backwards compatibility. 422 ;; for backwards compatibility.
439 (eq (car-safe item) (intern name)) 423 (eq (car-safe item) (intern name)))))))
440 (eq (car-safe item) (easy-menu-intern name)))))))
441 424
442(defun easy-menu-always-true (x) 425(defun easy-menu-always-true-p (x)
443 "Return true if form X never evaluates to nil." 426 "Return true if form X never evaluates to nil."
444 (if (consp x) (and (eq (car x) 'quote) (cadr x)) 427 (if (consp x) (and (eq (car x) 'quote) (cadr x))
445 (or (eq x t) (not (symbolp x))))) 428 (or (eq x t) (not (symbolp x)))))
@@ -540,15 +523,10 @@ earlier by `easy-menu-define' or `easy-menu-create-menu'."
540 (easy-menu-define-key map (easy-menu-intern (car item)) 523 (easy-menu-define-key map (easy-menu-intern (car item))
541 (cdr item) before) 524 (cdr item) before)
542 (if (or (keymapp item) 525 (if (or (keymapp item)
543 (and (symbolp item) (keymapp (symbol-value item)))) 526 (and (symbolp item) (keymapp (symbol-value item))
527 (setq item (symbol-value item))))
544 ;; 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.
545 (let ((tail (easy-menu-get-map item nil)) name) 529 (setq item (cons (keymap-prompt item) item)))
546 (if (not (keymapp item)) (setq item tail))
547 (while (and (null name) (consp (setq tail (cdr tail)))
548 (not (keymapp tail)))
549 (if (stringp (car tail)) (setq name (car tail)) ; Got a name.
550 (setq tail (cdr tail))))
551 (setq item (cons name item))))
552 (easy-menu-do-add-item map item before))) 530 (easy-menu-do-add-item map item before)))
553 531
554(defun easy-menu-item-present-p (map path name) 532(defun easy-menu-item-present-p (map path name)
@@ -591,10 +569,24 @@ If item is an old format item, a new format item is returned."
591 (cons name item)) ; Keymap or new menu format 569 (cons name item)) ; Keymap or new menu format
592 ))) 570 )))
593 571
594(defun easy-menu-get-map-look-for-name (name submap) 572(defun easy-menu-lookup-name (map name)
595 (while (and submap (not (easy-menu-name-match name (car submap)))) 573 "Lookup menu item NAME in keymap MAP.
596 (setq submap (cdr submap))) 574Like `lookup-key' except that NAME is not an array but just a single key
597 submap) 575and that NAME can be a string representing the menu item's name."
576 (or (lookup-key map (vector (easy-menu-intern name)))
577 (when (stringp name)
578 ;; `lookup-key' failed and we have a menu item name: look at the
579 ;; actual menu entries's names.
580 (catch 'found
581 (map-keymap (lambda (key item)
582 (if (condition-case nil (member name item)
583 (error nil))
584 ;; Found it!! Look for it again with
585 ;; `lookup-key' so as to handle inheritance and
586 ;; to extract the actual command/keymap bound to
587 ;; `name' from the item (via get_keyelt).
588 (throw 'found (lookup-key map (vector key)))))
589 map)))))
598 590
599(defun easy-menu-get-map (map path &optional to-modify) 591(defun easy-menu-get-map (map path &optional to-modify)
600 "Return a sparse keymap in which to add or remove an item. 592 "Return a sparse keymap in which to add or remove an item.
@@ -605,34 +597,34 @@ wants to modify in the map that we return.
605In some cases we use that to select between the local and global maps." 597In some cases we use that to select between the local and global maps."
606 (setq map 598 (setq map
607 (catch 'found 599 (catch 'found
608 (let* ((key (vconcat (unless map '(menu-bar)) 600 (if (and map (symbolp map) (not (keymapp map)))
609 (mapcar 'easy-menu-intern path))) 601 (setq map (symbol-value map)))
610 (maps (mapcar (lambda (map) 602 (let ((maps (if map (list map) (current-active-maps))))
611 (setq map (lookup-key map key)) 603 ;; Look for PATH in each map.
612 (while (and (symbolp map) (keymapp map)) 604 (unless map (push 'menu-bar path))
613 (setq map (symbol-function map))) 605 (dolist (name path)
614 map) 606 (setq maps
615 (if map 607 (delq nil (mapcar (lambda (map)
616 (list (if (and (symbolp map) 608 (setq map (easy-menu-lookup-name
617 (not (keymapp map))) 609 map name))
618 (symbol-value map) map)) 610 (and (keymapp map) map))
619 (current-active-maps))))) 611 maps))))
612
620 ;; Prefer a map that already contains the to-be-modified entry. 613 ;; Prefer a map that already contains the to-be-modified entry.
621 (when to-modify 614 (when to-modify
622 (dolist (map maps) 615 (dolist (map maps)
623 (when (and (keymapp map) 616 (when (easy-menu-lookup-name map to-modify)
624 (easy-menu-get-map-look-for-name to-modify map))
625 (throw 'found map)))) 617 (throw 'found map))))
626 ;; Use the first valid map. 618 ;; Use the first valid map.
627 (dolist (map maps) 619 (when maps (throw 'found (car maps)))
628 (when (keymapp map) 620
629 (throw 'found map)))
630 ;; Otherwise, make one up. 621 ;; Otherwise, make one up.
631 ;; Hardcoding current-local-map is lame, but it's difficult 622 ;; Hardcoding current-local-map is lame, but it's difficult
632 ;; to know what the caller intended for us to do ;-( 623 ;; to know what the caller intended for us to do ;-(
633 (let* ((name (if path (format "%s" (car (reverse path))))) 624 (let* ((name (if path (format "%s" (car (reverse path)))))
634 (newmap (make-sparse-keymap name))) 625 (newmap (make-sparse-keymap name)))
635 (define-key (or map (current-local-map)) key 626 (define-key (or map (current-local-map))
627 (apply 'vector (mapcar 'easy-menu-intern path))
636 (if name (cons name newmap) newmap)) 628 (if name (cons name newmap) newmap))
637 newmap)))) 629 newmap))))
638 (or (keymapp map) (error "Malformed menu in easy-menu: (%s)" map)) 630 (or (keymapp map) (error "Malformed menu in easy-menu: (%s)" map))
@@ -640,5 +632,5 @@ In some cases we use that to select between the local and global maps."
640 632
641(provide 'easymenu) 633(provide 'easymenu)
642 634
643;;; arch-tag: 2a04020d-90d2-476d-a7c6-71e072007a4a 635;; arch-tag: 2a04020d-90d2-476d-a7c6-71e072007a4a
644;;; easymenu.el ends here 636;;; easymenu.el ends here
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 9a7b9efc333..0a6e3fed349 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -714,8 +714,10 @@ already is one.)"
714 (if (and (eq (following-char) ?.) 714 (if (and (eq (following-char) ?.)
715 (save-excursion 715 (save-excursion
716 (forward-char 1) 716 (forward-char 1)
717 (and (>= (following-char) ?0) 717 (or (and (eq (aref edebug-read-syntax-table (following-char))
718 (<= (following-char) ?9)))) 718 'symbol)
719 (not (= (following-char) ?\;)))
720 (memq (following-char) '(?\, ?\.)))))
719 'symbol 721 'symbol
720 (aref edebug-read-syntax-table (following-char)))) 722 (aref edebug-read-syntax-table (following-char))))
721 723
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/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index fefa340f2b3..cbee9fd626e 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -946,10 +946,11 @@ With a prefix argument, narrows region to last command output."
946 (eshell-bol) 946 (eshell-bol)
947 (kill-region (point) here)))) 947 (kill-region (point) here))))
948 948
949(defun eshell-show-maximum-output () 949(defun eshell-show-maximum-output (&optional interactive)
950 "Put the end of the buffer at the bottom of the window." 950 "Put the end of the buffer at the bottom of the window.
951 (interactive) 951When run interactively, widen the buffer first."
952 (if (interactive-p) 952 (interactive "p")
953 (if interactive
953 (widen)) 954 (widen))
954 (goto-char (point-max)) 955 (goto-char (point-max))
955 (recenter -1)) 956 (recenter -1))
@@ -1005,7 +1006,7 @@ a key."
1005 (let ((pos (point))) 1006 (let ((pos (point)))
1006 (if (bobp) 1007 (if (bobp)
1007 (if (interactive-p) 1008 (if (interactive-p)
1008 (error "Buffer too short to truncate")) 1009 (message "Buffer too short to truncate"))
1009 (delete-region (point-min) (point)) 1010 (delete-region (point-min) (point))
1010 (if (interactive-p) 1011 (if (interactive-p)
1011 (message "Truncated buffer from %d to %d lines (%.1fk freed)" 1012 (message "Truncated buffer from %d to %d lines (%.1fk freed)"
diff --git a/lisp/files.el b/lisp/files.el
index 523a5a12f7b..f0203082c73 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -676,7 +676,7 @@ The truename of a file name is found by chasing symbolic links
676both at the level of the file and at the level of the directories 676both at the level of the file and at the level of the directories
677containing it, until no links are left at any level. 677containing it, until no links are left at any level.
678 678
679\(fn FILENAME)" 679\(fn FILENAME)" ;; Don't document the optional arguments.
680 ;; COUNTER and PREV-DIRS are only used in recursive calls. 680 ;; COUNTER and PREV-DIRS are only used in recursive calls.
681 ;; COUNTER can be a cons cell whose car is the count of how many 681 ;; COUNTER can be a cons cell whose car is the count of how many
682 ;; more links to chase before getting an error. 682 ;; more links to chase before getting an error.
@@ -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))
@@ -1912,6 +1936,7 @@ only set the major mode, if that would change it."
1912 (message "Ignoring unknown mode `%s'" mode) 1936 (message "Ignoring unknown mode `%s'" mode)
1913 (setq done t) 1937 (setq done t)
1914 (or (set-auto-mode-0 mode keep-mode-if-same) 1938 (or (set-auto-mode-0 mode keep-mode-if-same)
1939 ;; continuing would call minor modes again, toggling them off
1915 (throw 'nop nil))))) 1940 (throw 'nop nil)))))
1916 ;; If we didn't, look for an interpreter specified in the first line. 1941 ;; If we didn't, look for an interpreter specified in the first line.
1917 ;; As a special case, allow for things like "#!/bin/env perl", which 1942 ;; As a special case, allow for things like "#!/bin/env perl", which
@@ -1924,16 +1949,19 @@ only set the major mode, if that would change it."
1924 ;; Map interpreter name to a mode, signalling we're done at the 1949 ;; Map interpreter name to a mode, signalling we're done at the
1925 ;; same time. 1950 ;; same time.
1926 done (assoc (file-name-nondirectory mode) 1951 done (assoc (file-name-nondirectory mode)
1927 interpreter-mode-alist))) 1952 interpreter-mode-alist))
1928 ;; If we found an interpreter mode to use, invoke it now. 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)))
1956 ;; If we didn't, match the buffer beginning against magic-mode-alist.
1957 (unless done
1931 (if (setq done (save-excursion 1958 (if (setq done (save-excursion
1932 (goto-char (point-min)) 1959 (goto-char (point-min))
1933 (assoc-default nil magic-mode-alist 1960 (assoc-default nil magic-mode-alist
1934 (lambda (re dummy) 1961 (lambda (re dummy)
1935 (looking-at re))))) 1962 (looking-at re)))))
1936 (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.
1937 (if buffer-file-name 1965 (if buffer-file-name
1938 (let ((name buffer-file-name)) 1966 (let ((name buffer-file-name))
1939 ;; Remove backup-suffixes from file name. 1967 ;; Remove backup-suffixes from file name.
@@ -1943,7 +1971,7 @@ only set the major mode, if that would change it."
1943 (let ((case-fold-search 1971 (let ((case-fold-search
1944 (memq system-type '(vax-vms windows-nt cygwin)))) 1972 (memq system-type '(vax-vms windows-nt cygwin))))
1945 (if (and (setq mode (assoc-default name auto-mode-alist 1973 (if (and (setq mode (assoc-default name auto-mode-alist
1946 'string-match)) 1974 'string-match))
1947 (consp mode) 1975 (consp mode)
1948 (cadr mode)) 1976 (cadr mode))
1949 (setq mode (car mode) 1977 (setq mode (car mode)
@@ -1952,7 +1980,6 @@ only set the major mode, if that would change it."
1952 (when mode 1980 (when mode
1953 (set-auto-mode-0 mode keep-mode-if-same))))))))) 1981 (set-auto-mode-0 mode keep-mode-if-same)))))))))
1954 1982
1955
1956;; 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
1957;; 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
1958;; 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
@@ -1971,7 +1998,6 @@ same, do nothing and return nil."
1971 (funcall mode) 1998 (funcall mode)
1972 mode)) 1999 mode))
1973 2000
1974
1975(defun set-auto-mode-1 () 2001(defun set-auto-mode-1 ()
1976 "Find the -*- spec in the buffer. 2002 "Find the -*- spec in the buffer.
1977Call 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 cd42be63738..8599cb01d93 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -295,7 +295,8 @@ key is supported."
295(defgroup filesets nil 295(defgroup filesets nil
296 "The fileset swapper." 296 "The fileset swapper."
297 :prefix "filesets-" 297 :prefix "filesets-"
298 :group 'convenience) 298 :group 'convenience
299 :version "21.4")
299 300
300(defcustom filesets-menu-name "Filesets" 301(defcustom filesets-menu-name "Filesets"
301 "*Filesets' menu name." 302 "*Filesets' menu name."
@@ -1355,7 +1356,7 @@ Use the viewer defined in EV-ENTRY (a valid element of
1355 (run-hooks 'oh)) 1356 (run-hooks 'oh))
1356 (set-buffer-modified-p nil) 1357 (set-buffer-modified-p nil)
1357 (setq buffer-read-only t) 1358 (setq buffer-read-only t)
1358 (beginning-of-buffer)) 1359 (goto-char (point-min)))
1359 (when oh 1360 (when oh
1360 (run-hooks 'oh)))) 1361 (run-hooks 'oh))))
1361 (filesets-error 'error 1362 (filesets-error 'error
@@ -1592,7 +1593,8 @@ SAVE-FUNCTION takes no argument, but works on the current buffer."
1592(defun filesets-cmd-show-result (cmd output) 1593(defun filesets-cmd-show-result (cmd output)
1593 "Show OUTPUT of CMD (a shell command)." 1594 "Show OUTPUT of CMD (a shell command)."
1594 (pop-to-buffer "*Filesets: Shell Command Output*") 1595 (pop-to-buffer "*Filesets: Shell Command Output*")
1595 (end-of-buffer) 1596 (with-no-warnings
1597 (end-of-buffer))
1596 (insert "*** ") 1598 (insert "*** ")
1597 (insert cmd) 1599 (insert cmd)
1598 (newline) 1600 (newline)
@@ -1637,7 +1639,7 @@ Replace <file-name> or <<file-name>> with filename."
1637 (save-restriction 1639 (save-restriction
1638 (let ((buffer (filesets-find-file this))) 1640 (let ((buffer (filesets-find-file this)))
1639 (when buffer 1641 (when buffer
1640 (beginning-of-buffer) 1642 (goto-char (point-min))
1641 (let () 1643 (let ()
1642 (cond 1644 (cond
1643 ((stringp fn) 1645 ((stringp fn)
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 2a2777d102b..3dae3fa686a 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.
@@ -2004,5 +2004,5 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
2004 2004
2005(provide 'font-lock) 2005(provide 'font-lock)
2006 2006
2007;;; arch-tag: 682327e4-64d8-4057-b20b-1fbb9f1fc54c 2007;; arch-tag: 682327e4-64d8-4057-b20b-1fbb9f1fc54c
2008;;; font-lock.el ends here 2008;;; font-lock.el ends here
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 0b93724e9e5..b605875da89 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,23 @@
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
152004-11-04 Richard M. Stallman <rms@gnu.org>
16
17 * spam.el (spam group): Add :version.
18
19 * pgg-def.el (pgg group): Add :version.
20
12004-11-04 Katsumi Yamaoka <yamaoka@jpl.org> 212004-11-04 Katsumi Yamaoka <yamaoka@jpl.org>
2 22
3 * gnus-art. (gnus-article-edit-article): Don't associate the 23 * gnus-art. (gnus-article-edit-article): Don't associate the
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/gnus/pgg-def.el b/lisp/gnus/pgg-def.el
index b8d9cbec807..046f57dbbfe 100644
--- a/lisp/gnus/pgg-def.el
+++ b/lisp/gnus/pgg-def.el
@@ -29,7 +29,8 @@
29 29
30(defgroup pgg () 30(defgroup pgg ()
31 "Glue for the various PGP implementations." 31 "Glue for the various PGP implementations."
32 :group 'mime) 32 :group 'mime
33 :version "21.4")
33 34
34(defcustom pgg-default-scheme 'gpg 35(defcustom pgg-default-scheme 'gpg
35 "Default PGP scheme." 36 "Default PGP scheme."
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el
index 1dc9058dd1f..075408b8fc7 100644
--- a/lisp/gnus/spam.el
+++ b/lisp/gnus/spam.el
@@ -76,7 +76,8 @@
76;;; Main parameters. 76;;; Main parameters.
77 77
78(defgroup spam nil 78(defgroup spam nil
79 "Spam configuration.") 79 "Spam configuration."
80 :version "21.4")
80 81
81(defcustom spam-directory (nnheader-concat gnus-directory "spam/") 82(defcustom spam-directory (nnheader-concat gnus-directory "spam/")
82 "Directory for spam whitelists and blacklists." 83 "Directory for spam whitelists and blacklists."
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/imenu.el b/lisp/imenu.el
index 7c775dc6337..16116025fb8 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -126,7 +126,9 @@ If `on-mouse' use a popup menu when `imenu' was invoked with the mouse."
126(defcustom imenu-eager-completion-buffer 126(defcustom imenu-eager-completion-buffer
127 (not (eq imenu-always-use-completion-buffer-p 'never)) 127 (not (eq imenu-always-use-completion-buffer-p 'never))
128 "If non-nil, eagerly popup the completion buffer." 128 "If non-nil, eagerly popup the completion buffer."
129 :type 'boolean) 129 :type 'boolean
130 :group 'imenu
131 :version "21.4")
130 132
131(defcustom imenu-after-jump-hook nil 133(defcustom imenu-after-jump-hook nil
132 "*Hooks called after jumping to a place in the buffer. 134 "*Hooks called after jumping to a place in the buffer.
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 2e0ddd0fb02..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
@@ -1476,11 +1476,26 @@ If DIRECTION is `backward', search in the reverse direction."
1476 (save-excursion 1476 (save-excursion
1477 (save-restriction 1477 (save-restriction
1478 (widen) 1478 (widen)
1479 (when backward
1480 ;; Hide Info file header for backward search
1481 (narrow-to-region (save-excursion
1482 (goto-char (point-min))
1483 (search-forward "\n\^_")
1484 (1- (point)))
1485 (point-max)))
1479 (while (and (not give-up) 1486 (while (and (not give-up)
1480 (or (null found) 1487 (save-match-data
1481 (if backward 1488 (or (null found)
1482 (isearch-range-invisible found beg-found) 1489 (if backward
1483 (isearch-range-invisible beg-found found)))) 1490 (isearch-range-invisible found beg-found)
1491 (isearch-range-invisible beg-found found))
1492 ;; Skip node header line
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"))))))
1484 (if (if backward 1499 (if (if backward
1485 (re-search-backward regexp bound t) 1500 (re-search-backward regexp bound t)
1486 (re-search-forward regexp bound t)) 1501 (re-search-forward regexp bound t))
@@ -1531,14 +1546,29 @@ If DIRECTION is `backward', search in the reverse direction."
1531 (while list 1546 (while list
1532 (message "Searching subfile %s..." (cdr (car list))) 1547 (message "Searching subfile %s..." (cdr (car list)))
1533 (Info-read-subfile (car (car list))) 1548 (Info-read-subfile (car (car list)))
1534 (if backward (goto-char (point-max))) 1549 (when backward
1550 ;; Hide Info file header for backward search
1551 (narrow-to-region (save-excursion
1552 (goto-char (point-min))
1553 (search-forward "\n\^_")
1554 (1- (point)))
1555 (point-max))
1556 (goto-char (point-max)))
1535 (setq list (cdr list)) 1557 (setq list (cdr list))
1536 (setq give-up nil found nil) 1558 (setq give-up nil found nil)
1537 (while (and (not give-up) 1559 (while (and (not give-up)
1538 (or (null found) 1560 (save-match-data
1539 (if backward 1561 (or (null found)
1540 (isearch-range-invisible found beg-found) 1562 (if backward
1541 (isearch-range-invisible beg-found found)))) 1563 (isearch-range-invisible found beg-found)
1564 (isearch-range-invisible beg-found found))
1565 ;; Skip node header line
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"))))))
1542 (if (if backward 1572 (if (if backward
1543 (re-search-backward regexp nil t) 1573 (re-search-backward regexp nil t)
1544 (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 97fd8bc56e5..fca6c6a18ab 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;; Copyright (C) 2003 6;; Copyright (C) 2003
6;; National Institute of Advanced Industrial Science and Technology (AIST) 7;; National Institute of Advanced Industrial Science and Technology (AIST)
7;; Registration Number H13PRO009 8;; Registration Number H13PRO009
@@ -611,6 +612,175 @@ The meaning is the same as the argument ACCEPT-DEFAULT-P of the
611function `select-safe-coding-system' (which see). This variable 612function `select-safe-coding-system' (which see). This variable
612overrides that argument.") 613overrides that argument.")
613 614
615(defun select-safe-coding-system-interactively (from to codings unsafe
616 &optional rejected default)
617 "Select interactively a coding system for the region FROM ... TO.
618FROM can be a string, as in `write-region'.
619CODINGS is the list of base coding systems known to be safe for this region,
620 typically obtained with `find-coding-systems-region'.
621UNSAFE is a list of coding systems known to be unsafe for this region.
622REJECTED is a list of coding systems which were safe but for some reason
623 were not recommended in the particular context.
624DEFAULT is the coding system to use by default in the query."
625 ;; At first, if some defaults are unsafe, record at most 11
626 ;; problematic characters and their positions for them by turning
627 ;; (CODING ...)
628 ;; into
629 ;; ((CODING (POS . CHAR) (POS . CHAR) ...) ...)
630 (if unsafe
631 (setq unsafe
632 (mapcar #'(lambda (coding)
633 (cons coding
634 (if (stringp from)
635 (mapcar #'(lambda (pos)
636 (cons pos (aref from pos)))
637 (unencodable-char-position
638 0 (length from) coding
639 11 from))
640 (mapcar #'(lambda (pos)
641 (cons pos (char-after pos)))
642 (unencodable-char-position
643 from to coding 11)))))
644 unsafe)))
645
646 ;; Change each safe coding system to the corresponding
647 ;; mime-charset name if it is also a coding system. Such a name
648 ;; is more friendly to users.
649 (let ((l codings)
650 mime-charset)
651 (while l
652 (setq mime-charset (coding-system-get (car l) 'mime-charset))
653 (if (and mime-charset (coding-system-p mime-charset))
654 (setcar l mime-charset))
655 (setq l (cdr l))))
656
657 ;; Don't offer variations with locking shift, which you
658 ;; basically never want.
659 (let (l)
660 (dolist (elt codings (setq codings (nreverse l)))
661 (unless (or (eq 'coding-category-iso-7-else
662 (coding-system-category elt))
663 (eq 'coding-category-iso-8-else
664 (coding-system-category elt)))
665 (push elt l))))
666
667 ;; Remove raw-text, emacs-mule and no-conversion unless nothing
668 ;; else is available.
669 (setq codings
670 (or (delq 'raw-text
671 (delq 'emacs-mule
672 (delq 'no-conversion codings)))
673 '(raw-text emacs-mule no-conversion)))
674
675 (let ((window-configuration (current-window-configuration))
676 (bufname (buffer-name))
677 coding-system)
678 (save-excursion
679 ;; If some defaults are unsafe, make sure the offending
680 ;; buffer is displayed.
681 (when (and unsafe (not (stringp from)))
682 (pop-to-buffer bufname)
683 (goto-char (apply 'min (mapcar #'(lambda (x) (car (cadr x)))
684 unsafe))))
685 ;; Then ask users to select one from CODINGS while showing
686 ;; the reason why none of the defaults are not used.
687 (with-output-to-temp-buffer "*Warning*"
688 (with-current-buffer standard-output
689 (if (and (null rejected) (null unsafe))
690 (insert "No default coding systems to try for "
691 (if (stringp from)
692 (format "string \"%s\"." from)
693 (format "buffer `%s'." bufname)))
694 (insert
695 "These default coding systems were tried to encode"
696 (if (stringp from)
697 (concat " \"" (if (> (length from) 10)
698 (concat (substring from 0 10) "...\"")
699 (concat from "\"")))
700 (format " text\nin the buffer `%s'" bufname))
701 ":\n")
702 (let ((pos (point))
703 (fill-prefix " "))
704 (dolist (x (append rejected unsafe))
705 (princ " ") (princ (car x)))
706 (insert "\n")
707 (fill-region-as-paragraph pos (point)))
708 (when rejected
709 (insert "These safely encodes the target text,
710but it is not recommended for encoding text in this context,
711e.g., for sending an email message.\n ")
712 (dolist (x rejected)
713 (princ " ") (princ x))
714 (insert "\n"))
715 (when unsafe
716 (insert (if rejected "And the others"
717 "However, each of them")
718 " encountered these problematic characters:\n")
719 (dolist (coding unsafe)
720 (insert (format " %s:" (car coding)))
721 (let ((i 0)
722 (func1
723 #'(lambda (bufname pos)
724 (when (buffer-live-p (get-buffer bufname))
725 (pop-to-buffer bufname)
726 (goto-char pos))))
727 (func2
728 #'(lambda (bufname pos coding)
729 (when (buffer-live-p (get-buffer bufname))
730 (pop-to-buffer bufname)
731 (if (< (point) pos)
732 (goto-char pos)
733 (forward-char 1)
734 (search-unencodable-char coding)
735 (forward-char -1))))))
736 (dolist (elt (cdr coding))
737 (insert " ")
738 (if (stringp from)
739 (insert (if (< i 10) (cdr elt) "..."))
740 (if (< i 10)
741 (insert-text-button
742 (cdr elt)
743 :type 'help-xref
744 'help-echo
745 "mouse-2, RET: jump to this character"
746 'help-function func1
747 'help-args (list bufname (car elt)))
748 (insert-text-button
749 "..."
750 :type 'help-xref
751 'help-echo
752 "mouse-2, RET: next unencodable character"
753 'help-function func2
754 'help-args (list bufname (car elt)
755 (car coding)))))
756 (setq i (1+ i))))
757 (insert "\n"))
758 (insert "\
759The first problematic character is at point in the displayed buffer,\n"
760 (substitute-command-keys "\
761and \\[universal-argument] \\[what-cursor-position] will give information about it.\n"))))
762 (insert "\nSelect \
763one of the following safe coding systems, or edit the buffer:\n")
764 (let ((pos (point))
765 (fill-prefix " "))
766 (dolist (x codings)
767 (princ " ") (princ x))
768 (insert "\n")
769 (fill-region-as-paragraph pos (point)))
770 (insert "Or specify any other coding system
771at the risk of losing the problematic characters.\n")))
772
773 ;; Read a coding system.
774 (setq coding-system
775 (read-coding-system
776 (format "Select coding system (default %s): " default)
777 default))
778 (setq last-coding-system-specified coding-system))
779
780 (kill-buffer "*Warning*")
781 (set-window-configuration window-configuration)
782 coding-system))
783
614(defun select-safe-coding-system (from to &optional default-coding-system 784(defun select-safe-coding-system (from to &optional default-coding-system
615 accept-default-p file) 785 accept-default-p file)
616 "Ask a user to select a safe coding system from candidates. 786 "Ask a user to select a safe coding system from candidates.
@@ -705,7 +875,6 @@ and TO is ignored."
705 875
706 (let ((codings (find-coding-systems-region from to)) 876 (let ((codings (find-coding-systems-region from to))
707 (coding-system nil) 877 (coding-system nil)
708 (bufname (buffer-name))
709 safe rejected unsafe) 878 safe rejected unsafe)
710 ;; Classify the defaults into safe, rejected, and unsafe. 879 ;; Classify the defaults into safe, rejected, and unsafe.
711 (dolist (elt default-coding-system) 880 (dolist (elt default-coding-system)
@@ -1344,12 +1513,14 @@ If INPUT-METHOD is nil, deactivate any current input method."
1344 current-input-method-title nil) 1513 current-input-method-title nil)
1345 (force-mode-line-update))))) 1514 (force-mode-line-update)))))
1346 1515
1347(defun set-input-method (input-method) 1516(defun set-input-method (input-method &optional interactive)
1348 "Select and activate input method INPUT-METHOD for the current buffer. 1517 "Select and activate input method INPUT-METHOD for the current buffer.
1349This also sets the default input method to the one you specify. 1518This also sets the default input method to the one you specify.
1350If INPUT-METHOD is nil, this function turns off the input method, and 1519If INPUT-METHOD is nil, this function turns off the input method, and
1351also causes you to be prompted for a name of an input method the next 1520also causes you to be prompted for a name of an input method the next
1352time you invoke \\[toggle-input-method]. 1521time you invoke \\[toggle-input-method].
1522When called interactively, the optional arg INTERACTIVE is non-nil,
1523which marks the variable `default-input-method' as set for Custom buffers.
1353 1524
1354To deactivate the input method interactively, use \\[toggle-input-method]. 1525To deactivate the input method interactively, use \\[toggle-input-method].
1355To deactivate it programmatically, use \\[inactivate-input-method]." 1526To deactivate it programmatically, use \\[inactivate-input-method]."
@@ -1357,14 +1528,15 @@ To deactivate it programmatically, use \\[inactivate-input-method]."
1357 (let* ((default (or (car input-method-history) default-input-method))) 1528 (let* ((default (or (car input-method-history) default-input-method)))
1358 (list (read-input-method-name 1529 (list (read-input-method-name
1359 (if default "Select input method (default %s): " "Select input method: ") 1530 (if default "Select input method (default %s): " "Select input method: ")
1360 default t)))) 1531 default t)
1532 t)))
1361 (activate-input-method input-method) 1533 (activate-input-method input-method)
1362 (setq default-input-method input-method) 1534 (setq default-input-method input-method)
1363 (when (interactive-p) 1535 (when interactive
1364 (customize-mark-as-set 'default-input-method)) 1536 (customize-mark-as-set 'default-input-method))
1365 default-input-method) 1537 default-input-method)
1366 1538
1367(defun toggle-input-method (&optional arg) 1539(defun toggle-input-method (&optional arg interactive)
1368 "Enable or disable multilingual text input method for the current buffer. 1540 "Enable or disable multilingual text input method for the current buffer.
1369Only one input method can be enabled at any time in a given buffer. 1541Only one input method can be enabled at any time in a given buffer.
1370 1542
@@ -1377,9 +1549,12 @@ minibuffer.
1377 1549
1378With a prefix argument, read an input method name with the minibuffer 1550With a prefix argument, read an input method name with the minibuffer
1379and enable that one. The default is the most recent input method specified 1551and enable that one. The default is the most recent input method specified
1380\(not including the currently active input method, if any)." 1552\(not including the currently active input method, if any).
1381 1553
1382 (interactive "P") 1554When called interactively, the optional arg INTERACTIVE is non-nil,
1555which marks the variable `default-input-method' as set for Custom buffers."
1556
1557 (interactive "P\np")
1383 (if (and current-input-method (not arg)) 1558 (if (and current-input-method (not arg))
1384 (inactivate-input-method) 1559 (inactivate-input-method)
1385 (let ((default (or (car input-method-history) default-input-method))) 1560 (let ((default (or (car input-method-history) default-input-method)))
@@ -1396,7 +1571,7 @@ and enable that one. The default is the most recent input method specified
1396 (unless default-input-method 1571 (unless default-input-method
1397 (prog1 1572 (prog1
1398 (setq default-input-method current-input-method) 1573 (setq default-input-method current-input-method)
1399 (when (interactive-p) 1574 (when interactive
1400 (customize-mark-as-set 'default-input-method))))))) 1575 (customize-mark-as-set 'default-input-method)))))))
1401 1576
1402(eval-when-compile (autoload 'help-buffer "help-mode")) 1577(eval-when-compile (autoload 'help-buffer "help-mode"))
@@ -2545,5 +2720,5 @@ If CODING-SYSTEM can't safely encode CHAR, return nil."
2545(defvar nonascii-translation-table nil "This variable is obsolete.") 2720(defvar nonascii-translation-table nil "This variable is obsolete.")
2546 2721
2547 2722
2548;;; arch-tag: b382c432-4b36-460e-bf4c-05efd0bb18dc 2723;; arch-tag: b382c432-4b36-460e-bf4c-05efd0bb18dc
2549;;; mule-cmds.el ends here 2724;;; mule-cmds.el ends here
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 5b55c4ff025..f29e19a2fcb 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -2101,7 +2101,7 @@ This function is intended to be added to `auto-coding-functions'."
2101 (save-excursion 2101 (save-excursion
2102 (forward-line 10) 2102 (forward-line 10)
2103 (point)))) 2103 (point))))
2104 (when (and (search-forward "<html>" size t) 2104 (when (and (search-forward "<html" size t)
2105 (re-search-forward "<meta\\s-+http-equiv=\"content-type\"\\s-+content=\"text/\\sw+;\\s-*charset=\\(.+?\\)\"" size t)) 2105 (re-search-forward "<meta\\s-+http-equiv=\"content-type\"\\s-+content=\"text/\\sw+;\\s-*charset=\\(.+?\\)\"" size t))
2106 (let* ((match (match-string 1)) 2106 (let* ((match (match-string 1))
2107 (sym (intern (downcase match)))) 2107 (sym (intern (downcase match))))
diff --git a/lisp/macros.el b/lisp/macros.el
index 0de5d223ee0..bb9fda41a45 100644
--- a/lisp/macros.el
+++ b/lisp/macros.el
@@ -63,7 +63,14 @@ bindings.
63 63
64To save a kbd macro, visit a file of Lisp code such as your `~/.emacs', 64To save a kbd macro, visit a file of Lisp code such as your `~/.emacs',
65use this command, and then save the file." 65use this command, and then save the file."
66 (interactive "CInsert kbd macro (name): \nP") 66 (interactive (list (intern (completing-read "Insert kbd macro (name): "
67 obarray
68 (lambda (elt)
69 (and (fboundp elt)
70 (or (stringp (symbol-function elt))
71 (vectorp (symbol-function elt)))))
72 t))
73 current-prefix-arg))
67 (let (definition) 74 (let (definition)
68 (if (string= (symbol-name macroname) "") 75 (if (string= (symbol-name macroname) "")
69 (progn 76 (progn
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el
index af7f8b62e03..0f5925021e8 100644
--- a/lisp/mail/supercite.el
+++ b/lisp/mail/supercite.el
@@ -1424,18 +1424,21 @@ Optional CITATION overrides any citation automatically selected."
1424 nil) 1424 nil)
1425 1425
1426;; interactive functions 1426;; interactive functions
1427(defun sc-cite-region (start end &optional confirm-p) 1427(defun sc-cite-region (start end &optional confirm-p interactive)
1428 "Cite a region delineated by START and END. 1428 "Cite a region delineated by START and END.
1429If optional CONFIRM-P is non-nil, the attribution is confirmed before 1429If optional CONFIRM-P is non-nil, the attribution is confirmed before
1430its use in the citation string. This function first runs 1430its use in the citation string. This function first runs
1431`sc-pre-cite-hook'." 1431`sc-pre-cite-hook'.
1432 (interactive "r\nP") 1432
1433When called interactively, the optional arg INTERACTIVE is non-nil,
1434and that means call `sc-select-attribution' too."
1435 (interactive "r\nP\np")
1433 (undo-boundary) 1436 (undo-boundary)
1434 (let ((frame (or (sc-scan-info-alist sc-cite-frame-alist) 1437 (let ((frame (or (sc-scan-info-alist sc-cite-frame-alist)
1435 sc-default-cite-frame)) 1438 sc-default-cite-frame))
1436 (sc-confirm-always-p (if confirm-p t sc-confirm-always-p))) 1439 (sc-confirm-always-p (if confirm-p t sc-confirm-always-p)))
1437 (run-hooks 'sc-pre-cite-hook) 1440 (run-hooks 'sc-pre-cite-hook)
1438 (if (interactive-p) 1441 (if interactive
1439 (sc-select-attribution)) 1442 (sc-select-attribution))
1440 (regi-interpret frame start end))) 1443 (regi-interpret frame start end)))
1441 1444
@@ -1978,16 +1981,15 @@ cited."
1978 (insert (sc-mail-field "sc-citation")) 1981 (insert (sc-mail-field "sc-citation"))
1979 (error "Line is already cited")))) 1982 (error "Line is already cited"))))
1980 1983
1981(defun sc-version (arg) 1984(defun sc-version (message)
1982 "Echo the current version of Supercite in the minibuffer. 1985 "Echo the current version of Supercite in the minibuffer.
1983With \\[universal-argument] (universal-argument), or if run non-interactively, 1986If MESSAGE is non-nil (interactively, with no prefix argument),
1984inserts the version string in the current buffer instead." 1987inserts the version string in the current buffer instead."
1985 (interactive "P") 1988 (interactive (not current-prefix-arg))
1986 (let ((verstr (format "Using Supercite.el %s" sc-version))) 1989 (let ((verstr (format "Using Supercite.el %s" sc-version)))
1987 (if (or (consp arg) 1990 (if message
1988 (not (interactive-p))) 1991 (message verstr)
1989 (insert "`sc-version' says: " verstr) 1992 (insert "`sc-version' says: " verstr))))
1990 (message verstr))))
1991 1993
1992(defun sc-describe () 1994(defun sc-describe ()
1993 " 1995 "
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/mouse.el b/lisp/mouse.el
index 2a467aa8069..865b5e96297 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1068,8 +1068,7 @@ If MODE is 2 then do the same for lines."
1068 (unless ignore 1068 (unless ignore
1069 ;; For certain special keys, delete the region. 1069 ;; For certain special keys, delete the region.
1070 (if (member key mouse-region-delete-keys) 1070 (if (member key mouse-region-delete-keys)
1071 (delete-region (overlay-start mouse-drag-overlay) 1071 (delete-region (mark t) (point))
1072 (overlay-end mouse-drag-overlay))
1073 ;; Otherwise, unread the key so it gets executed normally. 1072 ;; Otherwise, unread the key so it gets executed normally.
1074 (setq unread-command-events 1073 (setq unread-command-events
1075 (nconc events unread-command-events)))) 1074 (nconc events unread-command-events))))
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 1dbd97f0073..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
@@ -596,10 +605,11 @@ for use in `interactive'."
596 (not (eq (null browse-url-new-window-flag) 605 (not (eq (null browse-url-new-window-flag)
597 (null current-prefix-arg))))) 606 (null current-prefix-arg)))))
598 607
599;; interactive-p needs to be called at a function's top-level, hence 608;; called-interactive-p needs to be called at a function's top-level, hence
600;; the macro. 609;; this macro. We use that rather than interactive-p because
610;; use in a keyboard macro should not change this behavior.
601(defmacro browse-url-maybe-new-window (arg) 611(defmacro browse-url-maybe-new-window (arg)
602 `(if (not (interactive-p)) 612 `(if (or noninteractive (not (called-interactively-p)))
603 ,arg 613 ,arg
604 browse-url-new-window-flag)) 614 browse-url-new-window-flag))
605 615
@@ -1031,14 +1041,6 @@ used instead of `browse-url-new-window-flag'."
1031 browse-url-epiphany-program 1041 browse-url-epiphany-program
1032 (append browse-url-epiphany-startup-arguments (list url)))))) 1042 (append browse-url-epiphany-startup-arguments (list url))))))
1033 1043
1034;; GNOME means of invoking either Mozilla or Netrape.
1035(defvar browse-url-gnome-moz-program "gnome-moz-remote")
1036(defcustom browse-url-gnome-moz-arguments '()
1037 "*A list of strings passed to the GNOME mozilla viewer as arguments."
1038 :version "21.1"
1039 :type '(repeat (string :tag "Argument"))
1040 :group 'browse-url)
1041
1042;;;###autoload 1044;;;###autoload
1043(defun browse-url-gnome-moz (url &optional new-window) 1045(defun browse-url-gnome-moz (url &optional new-window)
1044 "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 5a71a50c5db..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."
@@ -1535,8 +1536,9 @@ cat /tmp/tramp.$$
1535rm -f /tmp/tramp.$$ 1536rm -f /tmp/tramp.$$
1536}" 1537}"
1537 "Shell function to implement `uudecode' to standard output. 1538 "Shell function to implement `uudecode' to standard output.
1538Many systems support `uudecode -o -' for this or `uudecode -p', but 1539Many systems support `uudecode -o /dev/stdout' for this or
1539some systems don't, and for them we have this shell function.") 1540`uudecode -o -' or `uudecode -p', but some systems don't, and for
1541them we have this shell function.")
1540 1542
1541;; Perl script to implement `file-attributes' in a Lisp `read'able 1543;; Perl script to implement `file-attributes' in a Lisp `read'able
1542;; output. If you are hacking on this, note that you get *no* output 1544;; output. If you are hacking on this, note that you get *no* output
@@ -5970,6 +5972,8 @@ locale to C and sets up the remote shell search path."
5970 base64-encode-region base64-decode-region) 5972 base64-encode-region base64-decode-region)
5971 ("recode data..base64" "recode base64..data" 5973 ("recode data..base64" "recode base64..data"
5972 base64-encode-region base64-decode-region) 5974 base64-encode-region base64-decode-region)
5975 ("uuencode xxx" "uudecode -o /dev/stdout"
5976 tramp-uuencode-region uudecode-decode-region)
5973 ("uuencode xxx" "uudecode -o -" 5977 ("uuencode xxx" "uudecode -o -"
5974 tramp-uuencode-region uudecode-decode-region) 5978 tramp-uuencode-region uudecode-decode-region)
5975 ("uuencode xxx" "uudecode -p" 5979 ("uuencode xxx" "uudecode -p"
diff --git a/lisp/outline.el b/lisp/outline.el
index 2d2663b12f2..89e9e193e9c 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -723,7 +723,7 @@ Show the heading too, if it is currently invisible."
723 (progn (outline-next-preface) (point)) nil))) 723 (progn (outline-next-preface) (point)) nil)))
724 724
725(defun hide-body () 725(defun hide-body ()
726 "Hide all of buffer except headings." 726 "Hide all body lines in buffer, leaving all headings visible."
727 (interactive) 727 (interactive)
728 (hide-region-body (point-min) (point-max))) 728 (hide-region-body (point-min) (point-max)))
729 729
@@ -738,7 +738,8 @@ Show the heading too, if it is currently invisible."
738 (narrow-to-region start end) 738 (narrow-to-region start end)
739 (goto-char (point-min)) 739 (goto-char (point-min))
740 (if (outline-on-heading-p) 740 (if (outline-on-heading-p)
741 (outline-end-of-heading)) 741 (outline-end-of-heading)
742 (outline-next-preface))
742 (while (not (eobp)) 743 (while (not (eobp))
743 (outline-flag-region (point) 744 (outline-flag-region (point)
744 (progn (outline-next-preface) (point)) t) 745 (progn (outline-next-preface) (point)) t)
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/f90.el b/lisp/progmodes/f90.el
index 53165fbecb7..a1c4d539dd7 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1223,14 +1223,16 @@ Return (TYPE NAME), or nil if not found."
1223With optional argument NUM, go forward that many balanced blocks. 1223With optional argument NUM, go forward that many balanced blocks.
1224If NUM is negative, go backward to the start of a block. 1224If NUM is negative, go backward to the start of a block.
1225Checks for consistency of block types and labels (if present), 1225Checks for consistency of block types and labels (if present),
1226and completes outermost block if necessary." 1226and completes outermost block if necessary.
1227Some of these things (which?) are not done if NUM is nil,
1228which only happens in a noninteractive call."
1227 (interactive "p") 1229 (interactive "p")
1228 (if (and num (< num 0)) (f90-beginning-of-block (- num))) 1230 (if (and num (< num 0)) (f90-beginning-of-block (- num)))
1229 (let ((f90-smart-end nil) ; for the final `f90-match-end' 1231 (let ((f90-smart-end nil) ; for the final `f90-match-end'
1230 (case-fold-search t) 1232 (case-fold-search t)
1231 (count (or num 1)) 1233 (count (or num 1))
1232 start-list start-this start-type start-label end-type end-label) 1234 start-list start-this start-type start-label end-type end-label)
1233 (if (interactive-p) (push-mark (point) t)) 1235 (if num (push-mark (point) t))
1234 (end-of-line) ; probably want this 1236 (end-of-line) ; probably want this
1235 (while (and (> count 0) (re-search-forward f90-blocks-re nil 'move)) 1237 (while (and (> count 0) (re-search-forward f90-blocks-re nil 'move))
1236 (beginning-of-line) 1238 (beginning-of-line)
@@ -1266,7 +1268,7 @@ and completes outermost block if necessary."
1266 (end-of-line)) 1268 (end-of-line))
1267 (if (> count 0) (error "Missing block end")) 1269 (if (> count 0) (error "Missing block end"))
1268 ;; Check outermost block. 1270 ;; Check outermost block.
1269 (if (interactive-p) 1271 (if num
1270 (save-excursion 1272 (save-excursion
1271 (beginning-of-line) 1273 (beginning-of-line)
1272 (skip-chars-forward " \t0-9") 1274 (skip-chars-forward " \t0-9")
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 90c0a50c7dc..7086e3b0b01 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.
@@ -1077,8 +1080,9 @@ static char *magick[] = {
1077 "Icon for disabled breakpoint in display margin.") 1080 "Icon for disabled breakpoint in display margin.")
1078 1081
1079;; Bitmap for breakpoint in fringe 1082;; Bitmap for breakpoint in fringe
1080(define-fringe-bitmap 'breakpoint 1083(and (display-images-p)
1081 "\x3c\x7e\xff\xff\xff\xff\x7e\x3c") 1084 (define-fringe-bitmap 'breakpoint
1085 "\x3c\x7e\xff\xff\xff\xff\x7e\x3c"))
1082 1086
1083(defface breakpoint-enabled-bitmap-face 1087(defface breakpoint-enabled-bitmap-face
1084 '((t 1088 '((t
@@ -1290,9 +1294,8 @@ static char *magick[] = {
1290 '(mouse-face highlight 1294 '(mouse-face highlight
1291 help-echo "mouse-2, RET: Select frame")) 1295 help-echo "mouse-2, RET: Select frame"))
1292 (beginning-of-line) 1296 (beginning-of-line)
1293 (when (and (or (looking-at "^#[0-9]*\\s-*\\S-* in \\(\\S-*\\)") 1297 (when (and (looking-at "^#\\([0-9]+\\)")
1294 (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)")) 1298 (equal (match-string 1) gdb-current-stack-level))
1295 (equal (match-string 1) gdb-current-frame))
1296 (put-text-property (point-at-bol) (point-at-eol) 1299 (put-text-property (point-at-bol) (point-at-eol)
1297 'face '(:inverse-video t))) 1300 'face '(:inverse-video t)))
1298 (forward-line 1)))))) 1301 (forward-line 1))))))
@@ -2046,6 +2049,8 @@ BUFFER nil or omitted means use the current buffer."
2046 (delq 'gdb-get-current-frame gdb-pending-triggers)) 2049 (delq 'gdb-get-current-frame gdb-pending-triggers))
2047 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) 2050 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
2048 (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)))
2049 (forward-line) 2054 (forward-line)
2050 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ") 2055 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ")
2051 (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/recentf.el b/lisp/recentf.el
index 4ef55d4e1bf..2fee8e637a8 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -98,7 +98,7 @@ Set VARIABLE with VALUE, and force a rebuild of the recentf menu."
98 :type 'string 98 :type 'string
99 :set 'recentf-menu-customization-changed) 99 :set 'recentf-menu-customization-changed)
100 100
101(defcustom recentf-menu-path '("files") 101(defcustom recentf-menu-path '("File")
102 "*Path where to add the recentf menu. 102 "*Path where to add the recentf menu.
103If nil add it at top level (see also `easy-menu-add-item')." 103If nil add it at top level (see also `easy-menu-add-item')."
104 :group 'recentf 104 :group 'recentf
diff --git a/lisp/simple.el b/lisp/simple.el
index cde0e75f030..69f51659751 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
@@ -2280,6 +2281,8 @@ This command is similar to `copy-region-as-kill', except that it gives
2280visual feedback indicating the extent of the region being copied." 2281visual feedback indicating the extent of the region being copied."
2281 (interactive "r") 2282 (interactive "r")
2282 (copy-region-as-kill beg end) 2283 (copy-region-as-kill beg end)
2284 ;; This use of interactive-p is correct
2285 ;; because the code it controls just gives the user visual feedback.
2283 (if (interactive-p) 2286 (if (interactive-p)
2284 (let ((other-end (if (= (point) beg) end beg)) 2287 (let ((other-end (if (= (point) beg) end beg))
2285 (opoint (point)) 2288 (opoint (point))
@@ -3081,13 +3084,13 @@ It is the column where point was
3081at the start of current run of vertical motion commands. 3084at the start of current run of vertical motion commands.
3082When the `track-eol' feature is doing its job, the value is 9999.") 3085When the `track-eol' feature is doing its job, the value is 9999.")
3083 3086
3084(defcustom line-move-ignore-invisible nil 3087(defcustom line-move-ignore-invisible t
3085 "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines. 3088 "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
3086Outline mode sets this." 3089Outline mode sets this."
3087 :type 'boolean 3090 :type 'boolean
3088 :group 'editing-basics) 3091 :group 'editing-basics)
3089 3092
3090(defun line-move-invisible (pos) 3093(defun line-move-invisible-p (pos)
3091 "Return non-nil if the character after POS is currently invisible." 3094 "Return non-nil if the character after POS is currently invisible."
3092 (let ((prop 3095 (let ((prop
3093 (get-char-property pos 'invisible))) 3096 (get-char-property pos 'invisible)))
@@ -3098,7 +3101,8 @@ Outline mode sets this."
3098 3101
3099;; This is the guts of next-line and previous-line. 3102;; This is the guts of next-line and previous-line.
3100;; Arg says how many lines to move. 3103;; Arg says how many lines to move.
3101(defun line-move (arg) 3104;; The value is t if we can move the specified number of lines.
3105(defun line-move (arg &optional noerror to-end)
3102 ;; Don't run any point-motion hooks, and disregard intangibility, 3106 ;; Don't run any point-motion hooks, and disregard intangibility,
3103 ;; for intermediate positions. 3107 ;; for intermediate positions.
3104 (let ((inhibit-point-motion-hooks t) 3108 (let ((inhibit-point-motion-hooks t)
@@ -3114,6 +3118,7 @@ Outline mode sets this."
3114 (or (not (bolp)) (eq last-command 'end-of-line))) 3118 (or (not (bolp)) (eq last-command 'end-of-line)))
3115 9999 3119 9999
3116 (current-column)))) 3120 (current-column))))
3121
3117 (if (and (not (integerp selective-display)) 3122 (if (and (not (integerp selective-display))
3118 (not line-move-ignore-invisible)) 3123 (not line-move-ignore-invisible))
3119 ;; Use just newline characters. 3124 ;; Use just newline characters.
@@ -3129,28 +3134,43 @@ Outline mode sets this."
3129 (and (zerop (forward-line arg)) 3134 (and (zerop (forward-line arg))
3130 (bolp) 3135 (bolp)
3131 (setq arg 0))) 3136 (setq arg 0)))
3132 (signal (if (< arg 0) 3137 (unless noerror
3133 'beginning-of-buffer 3138 (signal (if (< arg 0)
3134 'end-of-buffer) 3139 'beginning-of-buffer
3135 nil)) 3140 'end-of-buffer)
3141 nil)))
3136 ;; Move by arg lines, but ignore invisible ones. 3142 ;; Move by arg lines, but ignore invisible ones.
3137 (while (> arg 0) 3143 (let (done)
3138 ;; If the following character is currently invisible, 3144 (while (and (> arg 0) (not done))
3139 ;; skip all characters with that same `invisible' property value. 3145 ;; If the following character is currently invisible,
3140 (while (and (not (eobp)) (line-move-invisible (point))) 3146 ;; skip all characters with that same `invisible' property value.
3141 (goto-char (next-char-property-change (point)))) 3147 (while (and (not (eobp)) (line-move-invisible-p (point)))
3142 ;; Now move a line. 3148 (goto-char (next-char-property-change (point))))
3143 (end-of-line) 3149 ;; Now move a line.
3144 (and (zerop (vertical-motion 1)) 3150 (end-of-line)
3145 (signal 'end-of-buffer nil)) 3151 (and (zerop (vertical-motion 1))
3146 (setq arg (1- arg))) 3152 (if (not noerror)
3147 (while (< arg 0) 3153 (signal 'end-of-buffer nil)
3148 (beginning-of-line) 3154 (setq done t)))
3149 (and (zerop (vertical-motion -1)) 3155 (unless done
3150 (signal 'beginning-of-buffer nil)) 3156 (setq arg (1- arg))))
3151 (setq arg (1+ arg)) 3157 (while (and (< arg 0) (not done))
3152 (while (and (not (bobp)) (line-move-invisible (1- (point)))) 3158 (beginning-of-line)
3153 (goto-char (previous-char-property-change (point))))))) 3159
3160 (if (zerop (vertical-motion -1))
3161 (if (not noerror)
3162 (signal 'beginning-of-buffer nil)
3163 (setq done t)))
3164 (unless done
3165 (setq arg (1+ arg))
3166 (while (and ;; Don't move over previous invis lines
3167 ;; if our target is the middle of this line.
3168 (or (zerop (or goal-column temporary-goal-column))
3169 (< arg 0))
3170 (not (bobp)) (line-move-invisible-p (1- (point))))
3171 (goto-char (previous-char-property-change (point))))))))
3172 ;; This is the value the function returns.
3173 (= arg 0))
3154 3174
3155 (cond ((> arg 0) 3175 (cond ((> arg 0)
3156 ;; If we did not move down as far as desired, 3176 ;; If we did not move down as far as desired,
@@ -3161,8 +3181,7 @@ Outline mode sets this."
3161 ;; at least go to end of line. 3181 ;; at least go to end of line.
3162 (beginning-of-line)) 3182 (beginning-of-line))
3163 (t 3183 (t
3164 (line-move-finish (or goal-column temporary-goal-column) opoint))))) 3184 (line-move-finish (or goal-column temporary-goal-column) opoint))))))
3165 nil)
3166 3185
3167(defun line-move-finish (column opoint) 3186(defun line-move-finish (column opoint)
3168 (let ((repeat t)) 3187 (let ((repeat t))
@@ -3175,9 +3194,11 @@ Outline mode sets this."
3175 (line-end 3194 (line-end
3176 ;; Compute the end of the line 3195 ;; Compute the end of the line
3177 ;; ignoring effectively intangible newlines. 3196 ;; ignoring effectively intangible newlines.
3178 (let ((inhibit-point-motion-hooks nil) 3197 (save-excursion
3179 (inhibit-field-text-motion t)) 3198 (let ((inhibit-point-motion-hooks nil)
3180 (save-excursion (end-of-line) (point))))) 3199 (inhibit-field-text-motion t))
3200 (end-of-line))
3201 (point))))
3181 3202
3182 ;; Move to the desired column. 3203 ;; Move to the desired column.
3183 (line-move-to-column column) 3204 (line-move-to-column column)
@@ -3228,13 +3249,13 @@ and `current-column' to be able to ignore invisible text."
3228 (move-to-column col)) 3249 (move-to-column col))
3229 3250
3230 (when (and line-move-ignore-invisible 3251 (when (and line-move-ignore-invisible
3231 (not (bolp)) (line-move-invisible (1- (point)))) 3252 (not (bolp)) (line-move-invisible-p (1- (point))))
3232 (let ((normal-location (point)) 3253 (let ((normal-location (point))
3233 (normal-column (current-column))) 3254 (normal-column (current-column)))
3234 ;; If the following character is currently invisible, 3255 ;; If the following character is currently invisible,
3235 ;; skip all characters with that same `invisible' property value. 3256 ;; skip all characters with that same `invisible' property value.
3236 (while (and (not (eobp)) 3257 (while (and (not (eobp))
3237 (line-move-invisible (point))) 3258 (line-move-invisible-p (point)))
3238 (goto-char (next-char-property-change (point)))) 3259 (goto-char (next-char-property-change (point))))
3239 ;; Have we advanced to a larger column position? 3260 ;; Have we advanced to a larger column position?
3240 (if (> (current-column) normal-column) 3261 (if (> (current-column) normal-column)
@@ -3247,9 +3268,45 @@ and `current-column' to be able to ignore invisible text."
3247 ;; but with a more reasonable buffer position. 3268 ;; but with a more reasonable buffer position.
3248 (goto-char normal-location) 3269 (goto-char normal-location)
3249 (let ((line-beg (save-excursion (beginning-of-line) (point)))) 3270 (let ((line-beg (save-excursion (beginning-of-line) (point))))
3250 (while (and (not (bolp)) (line-move-invisible (1- (point)))) 3271 (while (and (not (bolp)) (line-move-invisible-p (1- (point))))
3251 (goto-char (previous-char-property-change (point) line-beg)))))))) 3272 (goto-char (previous-char-property-change (point) line-beg))))))))
3252 3273
3274(defun move-end-of-line (arg)
3275 "Move point to end of current line.
3276With argument ARG not nil or 1, move forward ARG - 1 lines first.
3277If point reaches the beginning or end of buffer, it stops there.
3278To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
3279
3280This command does not move point across a field boundary unless doing so
3281would move beyond there to a different line; if ARG is nil or 1, and
3282point starts at a field boundary, point does not move. To ignore field
3283boundaries bind `inhibit-field-text-motion' to t."
3284 (interactive "p")
3285 (or arg (setq arg 1))
3286 (let (done)
3287 (while (not done)
3288 (let ((newpos
3289 (save-excursion
3290 (let ((goal-column 0))
3291 (and (line-move arg t)
3292 (not (bobp))
3293 (progn
3294 (while (and (not (bobp)) (line-move-invisible-p (1- (point))))
3295 (goto-char (previous-char-property-change (point))))
3296 (backward-char 1)))
3297 (point)))))
3298 (goto-char newpos)
3299 (if (and (> (point) newpos)
3300 (eq (preceding-char) ?\n))
3301 (backward-char 1)
3302 (if (and (> (point) newpos) (not (eobp))
3303 (not (eq (following-char) ?\n)))
3304 ;; If we skipped something intangible
3305 ;; and now we're not really at eol,
3306 ;; keep going.
3307 (setq arg 1)
3308 (setq done t)))))))
3309
3253;;; Many people have said they rarely use this feature, and often type 3310;;; Many people have said they rarely use this feature, and often type
3254;;; it by accident. Maybe it shouldn't even be on a key. 3311;;; it by accident. Maybe it shouldn't even be on a key.
3255(put 'set-goal-column 'disabled t) 3312(put 'set-goal-column 'disabled t)
@@ -3298,7 +3355,8 @@ With arg N, put point N/10 of the way from the true beginning."
3298 (progn 3355 (progn
3299 (select-window window) 3356 (select-window window)
3300 ;; Set point and mark in that window's buffer. 3357 ;; Set point and mark in that window's buffer.
3301 (beginning-of-buffer arg) 3358 (with-no-warnings
3359 (beginning-of-buffer arg))
3302 ;; Set point accordingly. 3360 ;; Set point accordingly.
3303 (recenter '(t))) 3361 (recenter '(t)))
3304 (select-window orig-window)))) 3362 (select-window orig-window))))
@@ -3314,7 +3372,8 @@ With arg N, put point N/10 of the way from the true end."
3314 (unwind-protect 3372 (unwind-protect
3315 (progn 3373 (progn
3316 (select-window window) 3374 (select-window window)
3317 (end-of-buffer arg) 3375 (with-no-warnings
3376 (end-of-buffer arg))
3318 (recenter '(t))) 3377 (recenter '(t)))
3319 (select-window orig-window)))) 3378 (select-window orig-window))))
3320 3379
diff --git a/lisp/subr.el b/lisp/subr.el
index 54d382dea61..74614720227 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2209,12 +2209,20 @@ from `standard-syntax-table' otherwise."
2209 table)) 2209 table))
2210 2210
2211(defun syntax-after (pos) 2211(defun syntax-after (pos)
2212 "Return the syntax of the char after POS." 2212 "Return the syntax of the char after POS.
2213The value is either a syntax class character (a character that designates
2214a syntax in `modify-syntax-entry'), or a cons cell
2215of the form (CLASS . MATCH), where CLASS is the syntax class character
2216and MATCH is the matching parenthesis."
2213 (unless (or (< pos (point-min)) (>= pos (point-max))) 2217 (unless (or (< pos (point-min)) (>= pos (point-max)))
2214 (let ((st (if parse-sexp-lookup-properties 2218 (let* ((st (if parse-sexp-lookup-properties
2215 (get-char-property pos 'syntax-table)))) 2219 (get-char-property pos 'syntax-table)))
2216 (if (consp st) st 2220 (value
2217 (aref (or st (syntax-table)) (char-after pos)))))) 2221 (if (consp st) st
2222 (aref (or st (syntax-table)) (char-after pos))))
2223 (code (if (consp value) (car value) value)))
2224 (setq code (aref "-.w_()'\"$\\/<>@!|" code))
2225 (if (consp value) (cons code (cdr value)) code))))
2218 2226
2219(defun add-to-invisibility-spec (arg) 2227(defun add-to-invisibility-spec (arg)
2220 "Add elements to `buffer-invisibility-spec'. 2228 "Add elements to `buffer-invisibility-spec'.
diff --git a/lisp/tempo.el b/lisp/tempo.el
index 3ceb3e271f4..43f90b64766 100644
--- a/lisp/tempo.el
+++ b/lisp/tempo.el
@@ -1,6 +1,6 @@
1;;; tempo.el --- Flexible template insertion 1;;; tempo.el --- Flexible template insertion
2 2
3;; Copyright (C) 1994, 1995 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1995, 2004 Free Software Foundation, Inc.
4 4
5;; Author: David K}gedal <davidk@lysator.liu.se> 5;; Author: David K}gedal <davidk@lysator.liu.se>
6;; Created: 16 Feb 1994 6;; Created: 16 Feb 1994
@@ -172,7 +172,7 @@ documentation for the function `tempo-complete-tag' for more info.
172(defvar tempo-marks nil 172(defvar tempo-marks nil
173 "A list of marks to jump to with `\\[tempo-forward-mark]' and `\\[tempo-backward-mark]'.") 173 "A list of marks to jump to with `\\[tempo-forward-mark]' and `\\[tempo-backward-mark]'.")
174 174
175(defvar tempo-match-finder "\\b\\([^\\b]+\\)\\=" 175(defvar tempo-match-finder "\\b\\([[:word:]]+\\)\\="
176 "The regexp or function used to find the string to match against tags. 176 "The regexp or function used to find the string to match against tags.
177 177
178If `tempo-match-finder is a string, it should contain a regular 178If `tempo-match-finder is a string, it should contain a regular
@@ -182,7 +182,7 @@ the string between the first \\( and \\) is used for matching against
182each string in the tag list. If one is found, the whole text between 182each string in the tag list. If one is found, the whole text between
183the first \\( and the point is replaced with the inserted template. 183the first \\( and the point is replaced with the inserted template.
184 184
185You will probably want to include \\ \= at the end of the regexp to 185You will probably want to include \\=\\= at the end of the regexp to
186make sure that the string is matched only against text adjacent to the 186make sure that the string is matched only against text adjacent to the
187point. 187point.
188 188
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 93a7ebd52e4..441d9972173 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -956,9 +956,7 @@ Mostly we check word delimiters."
956;*---------------------------------------------------------------------*/ 956;*---------------------------------------------------------------------*/
957(defun flyspell-word (&optional following) 957(defun flyspell-word (&optional following)
958 "Spell check a word." 958 "Spell check a word."
959 (interactive (list current-prefix-arg)) 959 (interactive (list ispell-following-word))
960 (if (interactive-p)
961 (setq following ispell-following-word))
962 (save-excursion 960 (save-excursion
963 ;; use the correct dictionary 961 ;; use the correct dictionary
964 (flyspell-accept-buffer-local-defs) 962 (flyspell-accept-buffer-local-defs)
@@ -1283,7 +1281,7 @@ Word syntax described by `ispell-dictionary-alist' (which see)."
1283(defun flyspell-external-point-words () 1281(defun flyspell-external-point-words ()
1284 (let ((buffer flyspell-external-ispell-buffer)) 1282 (let ((buffer flyspell-external-ispell-buffer))
1285 (set-buffer buffer) 1283 (set-buffer buffer)
1286 (beginning-of-buffer) 1284 (goto-char (point-min))
1287 (let ((size (- flyspell-large-region-end flyspell-large-region-beg)) 1285 (let ((size (- flyspell-large-region-end flyspell-large-region-beg))
1288 (start flyspell-large-region-beg)) 1286 (start flyspell-large-region-beg))
1289 ;; 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/ispell.el b/lisp/textmodes/ispell.el
index f0547d6d596..d221d39180f 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1410,12 +1410,9 @@ nil word is correct or spelling is accepted.
1410\(\"word\" arg\) word is hand entered. 1410\(\"word\" arg\) word is hand entered.
1411quit spell session exited." 1411quit spell session exited."
1412 1412
1413 (interactive (list nil nil current-prefix-arg)) 1413 (interactive (list ispell-following-word ispell-quietly current-prefix-arg))
1414 (if continue 1414 (if continue
1415 (ispell-continue) 1415 (ispell-continue)
1416 (if (interactive-p)
1417 (setq following ispell-following-word
1418 quietly ispell-quietly))
1419 (ispell-accept-buffer-local-defs) ; use the correct dictionary 1416 (ispell-accept-buffer-local-defs) ; use the correct dictionary
1420 (let ((cursor-location (point)) ; retain cursor location 1417 (let ((cursor-location (point)) ; retain cursor location
1421 (word (ispell-get-word following)) 1418 (word (ispell-get-word following))
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 28f3d7c3b27..6da9cc23aaa 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
@@ -1051,53 +1052,79 @@ You might want to turn on `auto-fill-mode' to get better results."
1051 (and (>= start (point-min)) 1052 (and (>= start (point-min))
1052 (equal str (buffer-substring-no-properties start (point)))))) 1053 (equal str (buffer-substring-no-properties start (point))))))
1053 1054
1055(defun sgml-tag-text-p (start end)
1056 "Return non-nil if text between START and END is a tag.
1057Checks among other things that the tag does not contain spurious
1058unquoted < or > chars inside, which would indicate that it
1059really isn't a tag after all."
1060 (save-excursion
1061 (with-syntax-table sgml-tag-syntax-table
1062 (let ((pps (parse-partial-sexp start end 2)))
1063 (and (= (nth 0 pps) 0))))))
1064
1054(defun sgml-parse-tag-backward (&optional limit) 1065(defun sgml-parse-tag-backward (&optional limit)
1055 "Parse an SGML tag backward, and return information about the tag. 1066 "Parse an SGML tag backward, and return information about the tag.
1056Assume that parsing starts from within a textual context. 1067Assume that parsing starts from within a textual context.
1057Leave point at the beginning of the tag." 1068Leave point at the beginning of the tag."
1058 (let (tag-type tag-start tag-end name) 1069 (catch 'found
1059 (or (re-search-backward "[<>]" limit 'move) 1070 (let (tag-type tag-start tag-end name)
1060 (error "No tag found")) 1071 (or (re-search-backward "[<>]" limit 'move)
1061 (when (eq (char-after) ?<) 1072 (error "No tag found"))
1062 ;; Oops!! Looks like we were not in a textual context after all!. 1073 (when (eq (char-after) ?<)
1063 ;; Let's try to recover. 1074 ;; Oops!! Looks like we were not in a textual context after all!.
1064 (with-syntax-table sgml-tag-syntax-table 1075 ;; Let's try to recover.
1065 (forward-sexp) 1076 (with-syntax-table sgml-tag-syntax-table
1066 (forward-char -1))) 1077 (let ((pos (point)))
1067 (setq tag-end (1+ (point))) 1078 (condition-case nil
1068 (cond 1079 (forward-sexp)
1069 ((sgml-looking-back-at "--") ; comment 1080 (scan-error
1070 (setq tag-type 'comment 1081 ;; This < seems to be just a spurious one, let's ignore it.
1071 tag-start (search-backward "<!--" nil t))) 1082 (goto-char pos)
1072 ((sgml-looking-back-at "]]") ; cdata 1083 (throw 'found (sgml-parse-tag-backward limit))))
1073 (setq tag-type 'cdata 1084 ;; Check it is really a tag, without any extra < or > inside.
1074 tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t))) 1085 (unless (sgml-tag-text-p pos (point))
1075 (t 1086 (goto-char pos)
1076 (setq tag-start 1087 (throw 'found (sgml-parse-tag-backward limit)))
1077 (with-syntax-table sgml-tag-syntax-table 1088 (forward-char -1))))
1078 (goto-char tag-end) 1089 (setq tag-end (1+ (point)))
1079 (backward-sexp) 1090 (cond
1080 (point))) 1091 ((sgml-looking-back-at "--") ; comment
1081 (goto-char (1+ tag-start)) 1092 (setq tag-type 'comment
1082 (case (char-after) 1093 tag-start (search-backward "<!--" nil t)))
1083 (?! ; declaration 1094 ((sgml-looking-back-at "]]") ; cdata
1084 (setq tag-type 'decl)) 1095 (setq tag-type 'cdata
1085 (?? ; processing-instruction 1096 tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t)))
1086 (setq tag-type 'pi)) 1097 (t
1087 (?/ ; close-tag 1098 (setq tag-start
1088 (forward-char 1) 1099 (with-syntax-table sgml-tag-syntax-table
1089 (setq tag-type 'close 1100 (goto-char tag-end)
1090 name (sgml-parse-tag-name))) 1101 (condition-case nil
1091 (?% ; JSP tags 1102 (backward-sexp)
1092 (setq tag-type 'jsp)) 1103 (scan-error
1093 (t ; open or empty tag 1104 ;; This > isn't really the end of a tag. Skip it.
1094 (setq tag-type 'open 1105 (goto-char (1- tag-end))
1095 name (sgml-parse-tag-name)) 1106 (throw 'found (sgml-parse-tag-backward limit))))
1096 (if (or (eq ?/ (char-before (- tag-end 1))) 1107 (point)))
1097 (sgml-empty-tag-p name)) 1108 (goto-char (1+ tag-start))
1098 (setq tag-type 'empty)))))) 1109 (case (char-after)
1099 (goto-char tag-start) 1110 (?! ; declaration
1100 (sgml-make-tag tag-type tag-start tag-end name))) 1111 (setq tag-type 'decl))
1112 (?? ; processing-instruction
1113 (setq tag-type 'pi))
1114 (?/ ; close-tag
1115 (forward-char 1)
1116 (setq tag-type 'close
1117 name (sgml-parse-tag-name)))
1118 (?% ; JSP tags
1119 (setq tag-type 'jsp))
1120 (t ; open or empty tag
1121 (setq tag-type 'open
1122 name (sgml-parse-tag-name))
1123 (if (or (eq ?/ (char-before (- tag-end 1)))
1124 (sgml-empty-tag-p name))
1125 (setq tag-type 'empty))))))
1126 (goto-char tag-start)
1127 (sgml-make-tag tag-type tag-start tag-end name))))
1101 1128
1102(defun sgml-get-context (&optional until) 1129(defun sgml-get-context (&optional until)
1103 "Determine the context of the current position. 1130 "Determine the context of the current position.
@@ -1964,5 +1991,5 @@ Can be used as a value for `html-mode-hook'."
1964 1991
1965(provide 'sgml-mode) 1992(provide 'sgml-mode)
1966 1993
1967;;; arch-tag: 9675da94-b7f9-4bda-ad19-73ed7b4fb401 1994;; arch-tag: 9675da94-b7f9-4bda-ad19-73ed7b4fb401
1968;;; sgml-mode.el ends here 1995;;; sgml-mode.el ends here
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 7b13d498b2e..f064dd4dee0 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -645,7 +645,8 @@ See `table-insert' for examples about how to use."
645 :group 'editing 645 :group 'editing
646 :group 'wp 646 :group 'wp
647 :group 'paragraphs 647 :group 'paragraphs
648 :group 'fill) 648 :group 'fill
649 :version "21.4")
649 650
650(defgroup table-hooks nil 651(defgroup table-hooks nil
651 "Hooks for table manipulation utilities" 652 "Hooks for table manipulation utilities"
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))
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index d1bb65d3358..4491956f06f 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,24 @@
12004-11-08 Richard M. Stallman <rms@gnu.org>
2
3 * syntax.texi (Syntax Table Functions): Add syntax-after.
4
52004-11-06 Lars Brinkhoff <lars@nocrew.org>
6
7 * os.texi (Processor Run Time): New section documenting
8 get-internal-run-time.
9
102004-11-06 Eli Zaretskii <eliz@gnu.org>
11
12 * Makefile.in (install, maintainer-clean): Don't use "elisp-*" as
13 it nukes elisp-cover.texi.
14 (dist): Change elisp-[0-9] to elisp-[1-9], as there could be no
15 elisp-0 etc.
16
172004-11-05 Luc Teirlinck <teirllm@auburn.edu>
18
19 * commands.texi (Keyboard Macros): Document `append' return value
20 of `defining-kbd-macro'.
21
12004-11-01 Richard M. Stallman <rms@gnu.org> 222004-11-01 Richard M. Stallman <rms@gnu.org>
2 23
3 * commands.texi (Interactive Call): Add called-interactively-p. 24 * commands.texi (Interactive Call): Add called-interactively-p.
diff --git a/lispref/Makefile.in b/lispref/Makefile.in
index e9d99de7d6a..252ab1aaaed 100644
--- a/lispref/Makefile.in
+++ b/lispref/Makefile.in
@@ -108,7 +108,7 @@ elisp.dvi: $(srcs)
108 108
109install: elisp 109install: elisp
110 $(srcdir)/mkinstalldirs $(infodir) 110 $(srcdir)/mkinstalldirs $(infodir)
111 cp elisp elisp-* $(infodir) 111 cp elisp elisp-[1-9] elisp-[1-9][0-9] $(infodir)
112 ${INSTALL_INFO} --info-dir=${infodir} ${infodir}/elisp 112 ${INSTALL_INFO} --info-dir=${infodir} ${infodir}/elisp
113 113
114clean: 114clean:
@@ -119,7 +119,7 @@ clean:
119distclean: clean 119distclean: clean
120 120
121maintainer-clean: clean 121maintainer-clean: clean
122 rm -f elisp elisp-* elisp.dvi elisp.oaux 122 rm -f elisp elisp-[1-9] elisp-[1-9][0-9] elisp.dvi elisp.oaux
123 123
124dist: elisp elisp.dvi 124dist: elisp elisp.dvi
125 -rm -rf temp 125 -rm -rf temp
@@ -128,7 +128,7 @@ dist: elisp elisp.dvi
128 -ln $(srcdir)/README $(srcdir)/configure.in $(srcdir)/configure \ 128 -ln $(srcdir)/README $(srcdir)/configure.in $(srcdir)/configure \
129 $(srcdir)/Makefile.in $(srcs) \ 129 $(srcdir)/Makefile.in $(srcs) \
130 $(srcdir)/../man/texinfo.tex \ 130 $(srcdir)/../man/texinfo.tex \
131 elisp.dvi elisp.aux elisp.??s elisp elisp-[0-9] elisp-[0-9][0-9] \ 131 elisp.dvi elisp.aux elisp.??s elisp elisp-[1-9] elisp-[1-9][0-9] \
132 temp/$(manual) 132 temp/$(manual)
133 -(cd temp/$(manual); rm -f mkinstalldirs) 133 -(cd temp/$(manual); rm -f mkinstalldirs)
134 cp $(srcdir)/mkinstalldirs temp/$(manual) 134 cp $(srcdir)/mkinstalldirs temp/$(manual)
diff --git a/lispref/commands.texi b/lispref/commands.texi
index 3c9612e5186..0144123ecb5 100644
--- a/lispref/commands.texi
+++ b/lispref/commands.texi
@@ -420,7 +420,7 @@ the string.) Other characters that normally terminate a symbol (e.g.,
420parentheses and brackets) do not do so here. Prompt. 420parentheses and brackets) do not do so here. Prompt.
421 421
422@item U 422@item U
423A key sequence or nil. May be used after a @code{k} or @code{K} 423A key sequence or @code{nil}. May be used after a @code{k} or @code{K}
424argument to get the up-event that was discarded in case the key 424argument to get the up-event that was discarded in case the key
425sequence read for that argument was a down-event. No I/O. 425sequence read for that argument was a down-event. No I/O.
426 426
@@ -3023,9 +3023,10 @@ yourself.
3023@defvar defining-kbd-macro 3023@defvar defining-kbd-macro
3024This variable is non-@code{nil} if and only if a keyboard macro is 3024This variable is non-@code{nil} if and only if a keyboard macro is
3025being defined. A command can test this variable so as to behave 3025being defined. A command can test this variable so as to behave
3026differently while a macro is being defined. The commands 3026differently while a macro is being defined. The value is
3027@code{start-kbd-macro} and @code{end-kbd-macro} set this variable---do 3027@code{append} while appending to the definition of an existing macro.
3028not set it yourself. 3028The commands @code{start-kbd-macro}, @code{kmacro-start-macro} and
3029@code{end-kbd-macro} set this variable---do not set it yourself.
3029 3030
3030The variable is always local to the current terminal and cannot be 3031The variable is always local to the current terminal and cannot be
3031buffer-local. @xref{Multiple Displays}. 3032buffer-local. @xref{Multiple Displays}.
diff --git a/lispref/os.texi b/lispref/os.texi
index 42a0613bfec..90fba8975e2 100644
--- a/lispref/os.texi
+++ b/lispref/os.texi
@@ -23,6 +23,7 @@ pertaining to the terminal and the screen.
23* Time of Day:: Getting the current time. 23* Time of Day:: Getting the current time.
24* Time Conversion:: Converting a time from numeric form to a string, or 24* Time Conversion:: Converting a time from numeric form to a string, or
25 to calendrical data (or vice versa). 25 to calendrical data (or vice versa).
26* Processor Run Time:: Getting the run time used by Emacs.
26* Time Calculations:: Adding, subtracting, comparing times, etc. 27* Time Calculations:: Adding, subtracting, comparing times, etc.
27* Timers:: Setting a timer to call a function at a certain time. 28* Timers:: Setting a timer to call a function at a certain time.
28* Terminal Input:: Recording terminal input for debugging. 29* Terminal Input:: Recording terminal input for debugging.
@@ -1285,6 +1286,28 @@ For instance, years before 1970 do not work on some systems;
1285on others, years as early as 1901 do work. 1286on others, years as early as 1901 do work.
1286@end defun 1287@end defun
1287 1288
1289@node Processor Run Time
1290@section Processor Run time
1291
1292@defun get-internal-run-time
1293This function returns the processor run time used by Emacs as a list
1294of three integers: @code{(@var{high} @var{low} @var{microsec})}. The
1295integers @var{high} and @var{low} combine to give the number of
1296seconds, which is
1297@ifnottex
1298@var{high} * 2**16 + @var{low}.
1299@end ifnottex
1300@tex
1301$high*2^{16}+low$.
1302@end tex
1303
1304The third element, @var{microsec}, gives the microseconds (or 0 for
1305systems that return time with the resolution of only one second).
1306
1307If the system doesn't provide a way to determine the processor run
1308time, get-internal-run-time returns the same time as current-time.
1309@end defun
1310
1288@node Time Calculations 1311@node Time Calculations
1289@section Time Calculations 1312@section Time Calculations
1290 1313
diff --git a/lispref/syntax.texi b/lispref/syntax.texi
index 8c95e78d00c..57b0590d239 100644
--- a/lispref/syntax.texi
+++ b/lispref/syntax.texi
@@ -501,6 +501,18 @@ We use @code{string} to make it easier to see the character returned by
501@code{char-syntax}. 501@code{char-syntax}.
502@end defun 502@end defun
503 503
504@defun syntax-after pos
505This function returns a description of the syntax of the character in
506the buffer after position @var{pos}, taking account of syntax
507properties as well as the syntax table.
508
509The value is usually a syntax class character; however, if the buffer
510character has parenthesis syntax, the value is a cons cell of the form
511@code{(@var{class} . @var{match})}, where @var{class} is the syntax
512class character and @var{match} is the buffer character's matching
513parenthesis.
514@end defun
515
504@defun set-syntax-table table 516@defun set-syntax-table table
505This function makes @var{table} the syntax table for the current buffer. 517This function makes @var{table} the syntax table for the current buffer.
506It returns @var{table}. 518It returns @var{table}.
diff --git a/man/ChangeLog b/man/ChangeLog
index 22ac03e8677..6aa29b26aee 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,10 @@
12004-11-10 Andre Spiegel <spiegel@gnu.org>
2
3 * files.texi (Version Control): Rewrite the introduction about
4 version systems, mentioning the new ones that we support. Thanks
5 to Alex Ott, Karl Fogel, Stefan Monnier, and David Kastrup for
6 suggestions.
7
12004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> 82004-11-02 Katsumi Yamaoka <yamaoka@jpl.org>
2 9
3 * emacs-mime.texi (Encoding Customization): Fix 10 * emacs-mime.texi (Encoding Customization): Fix
diff --git a/man/files.texi b/man/files.texi
index 4e36c2ab2fa..6a0d2c662b5 100644
--- a/man/files.texi
+++ b/man/files.texi
@@ -1119,11 +1119,13 @@ such as the creation time of each version, who created it, and a
1119description of what was changed in that version. 1119description of what was changed in that version.
1120 1120
1121 The Emacs version control interface is called VC. Its commands work 1121 The Emacs version control interface is called VC. Its commands work
1122with three version control systems---RCS, CVS, and SCCS. The GNU 1122with different version control systems---currently, it supports CVS,
1123project recommends RCS and CVS, which are free software and available 1123GNU Arch, RCS, Meta-CVS, Subversion, and SCCS. Of these, the GNU
1124from the Free Software Foundation. We also have free software to 1124project distributes CVS, GNU Arch, and RCS; we recommend that you use
1125replace SCCS, known as CSSC; if you are using SCCS and don't want to 1125either CVS or GNU Arch for your projects, and RCS for individual
1126make the incompatible change to RCS or CVS, you can switch to CSSC. 1126files. We also have free software to replace SCCS, known as CSSC; if
1127you are using SCCS and don't want to make the incompatible change to
1128RCS or CVS, you can switch to CSSC.
1127 1129
1128 VC is enabled by default in Emacs. To disable it, set the 1130 VC is enabled by default in Emacs. To disable it, set the
1129customizable variable @code{vc-handled-backends} to @code{nil} 1131customizable variable @code{vc-handled-backends} to @code{nil}
@@ -1164,31 +1166,61 @@ you want to use.
1164@node Version Systems 1166@node Version Systems
1165@subsubsection Supported Version Control Systems 1167@subsubsection Supported Version Control Systems
1166 1168
1167@cindex RCS
1168@cindex back end (version control) 1169@cindex back end (version control)
1169 VC currently works with three different version control systems or 1170 VC currently works with six different version control systems or
1170``back ends'': RCS, CVS, and SCCS. 1171``back ends'': CVS, GNU Arch, RCS, Meta-CVS, Subversion, and SCCS.
1171
1172 RCS is a free version control system that is available from the Free
1173Software Foundation. It is perhaps the most mature of the supported
1174back ends, and the VC commands are conceptually closest to RCS. Almost
1175everything you can do with RCS can be done through VC.
1176 1172
1177@cindex CVS 1173@cindex CVS
1178 CVS is built on top of RCS, and extends the features of RCS, allowing 1174 CVS is a free version control system that is used for the majority
1179for more sophisticated release management, and concurrent multi-user 1175of free software projects today. It allows concurrent multi-user
1180development. VC supports basic editing operations under CVS, but for 1176development either locally or over the network. Some of its
1181some less common tasks you still need to call CVS from the command line. 1177shortcomings, corrected by newer systems such as GNU Arch, are that it
1182Note also that before using CVS you must set up a repository, which is a 1178lacks atomic commits or support for renaming files. VC supports all
1183subject too complex to treat here. 1179basic editing operations under CVS, but for some less common tasks you
1180still need to call CVS from the command line. Note also that before
1181using CVS you must set up a repository, which is a subject too complex
1182to treat here.
1183
1184@cindex GNU Arch
1185@cindex Arch
1186 GNU Arch is a new version control system that is designed for
1187distributed work. It differs in many ways from old well-known
1188systems, such as CVS and RCS. It supports different transports for
1189interoperating between users, offline operations, and it has good
1190branching and merging features. It also supports atomic commits, and
1191history of file renaming and moving. VC does not support all
1192operations provided by GNU Arch, so you must sometimes invoke it from
1193the command line, or use a specialized module.
1194
1195@cindex RCS
1196 RCS is the free version control system around which VC was initially
1197built. The VC commands are therefore conceptually closest to RCS.
1198Almost everything you can do with RCS can be done through VC. You
1199cannot use RCS over the network though, and it only works at the level
1200of individual files, rather than projects. You should use it if you
1201want a simple, yet reliable tool for handling individual files.
1202
1203@cindex SVN
1204@cindex Subversion
1205 Subversion is a free version control system designed to be similar
1206to CVS but without CVS's problems. Subversion supports atomic commits,
1207and versions directories, symbolic links, meta-data, renames, copies,
1208and deletes. It can be used via http or via its own protocol.
1209
1210@cindex MCVS
1211@cindex Meta-CVS
1212 Meta-CVS is another attempt to solve problems, arising in CVS. It
1213supports directory structure versioning, improved branching and
1214merging, and use of symbolic links and meta-data in repositories.
1184 1215
1185@cindex SCCS 1216@cindex SCCS
1186 SCCS is a proprietary but widely used version control system. In 1217 SCCS is a proprietary but widely used version control system. In
1187terms of capabilities, it is the weakest of the three that VC 1218terms of capabilities, it is the weakest of the six that VC supports.
1188supports. VC compensates for certain features missing in SCCS 1219VC compensates for certain features missing in SCCS (snapshots, for
1189(snapshots, for example) by implementing them itself, but some other VC 1220example) by implementing them itself, but some other VC features, such
1190features, such as multiple branches, are not available with SCCS. You 1221as multiple branches, are not available with SCCS. You should use
1191should use SCCS only if for some reason you cannot use RCS. 1222SCCS only if for some reason you cannot use RCS, or one of the
1223higher-level systems such as CVS or GNU Arch.
1192 1224
1193@node VC Concepts 1225@node VC Concepts
1194@subsubsection Concepts of Version Control 1226@subsubsection Concepts of Version Control
diff --git a/msdos/ChangeLog b/msdos/ChangeLog
index e906a8f4954..c52f73e640c 100644
--- a/msdos/ChangeLog
+++ b/msdos/ChangeLog
@@ -1,3 +1,29 @@
12004-11-10 Eli Zaretskii <eliz@gnu.org>
2
3 * sed1.inp: Revert last change.
4
52004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
6
7 * sed1v2.inp: Use djecho for buildobj.lst.
8
9 * sed1.inp: Ditto.
10
112004-11-08 Eli Zaretskii <eliz@gnu.org>
12
13 * sedlisp.inp (bootstrap-clean): Copy ldefs-boot.el onto
14 loaddefs.el, unless the latter exists and is newer.
15
16 * mainmake.v2 (mostlyclean, distclean, maintainer-clean)
17 (extraclean, bootfast): New targets.
18 (top_distclean): New macro, used by distclean, maintainer-clean,
19 and extraclean.
20 (.PHONY): Add bootfast.
21 (bootstrap): Make bootstrap-after in lisp.
22 (bootstrap-clean-before): Clean in man, lispref, and lispintro as
23 well.
24
25 * sed2v2.inp (HAVE_BZERO): Define for GCC v3.x and later.
26
12004-10-06 Eli Zaretskii <eliz@gnu.org> 272004-10-06 Eli Zaretskii <eliz@gnu.org>
2 28
3 * sed1v2.inp (LC_ALL=C): Fix src/Makefile breakage caused by 29 * sed1v2.inp (LC_ALL=C): Fix src/Makefile breakage caused by
diff --git a/msdos/mainmake.v2 b/msdos/mainmake.v2
index 0952380a202..f2291cf2989 100644
--- a/msdos/mainmake.v2
+++ b/msdos/mainmake.v2
@@ -21,7 +21,7 @@
21# Boston, MA 02111-1307, USA. 21# Boston, MA 02111-1307, USA.
22 22
23# make all to compile and build Emacs. 23# make all to compile and build Emacs.
24# make install to install it. 24# make install to install it (installs in-place, in `bin' subdir of top dir).
25# make TAGS to update tags tables. 25# make TAGS to update tags tables.
26# 26#
27# make clean or make mostlyclean 27# make clean or make mostlyclean
@@ -40,11 +40,12 @@
40# `make distclean' should leave only the files that were in the 40# `make distclean' should leave only the files that were in the
41# distribution. 41# distribution.
42# 42#
43# make realclean 43# make maintainer-clean
44# Delete everything from the current directory that can be 44# Delete everything from the current directory that can be
45# reconstructed with this Makefile. This typically includes 45# reconstructed with this Makefile. This typically includes
46# everything deleted by distclean, plus more: C source files 46# everything deleted by distclean, plus more: *.elc files,
47# produced by Bison, tags tables, info files, and so on. 47# C source files produced by Bison, tags tables, info files,
48# and so on.
48# 49#
49# make extraclean 50# make extraclean
50# Still more severe - delete backup and autosave files, too. 51# Still more severe - delete backup and autosave files, too.
@@ -135,22 +136,89 @@ TAGS tags: lib-src FRC
135check: 136check:
136 @echo "We don't have any tests for GNU Emacs yet." 137 @echo "We don't have any tests for GNU Emacs yet."
137 138
138clean: 139clean mostlyclean:
139 cd lib-src 140 cd lib-src
140 $(MAKE) clean 141 $(MAKE) $(MFLAGS) $@
141 cd .. 142 cd ..
142 cd src 143 cd src
143 $(MAKE) clean 144 $(MAKE) $(MFLAGS) $@
144 cd .. 145 cd ..
145 cd oldxmenu 146 cd oldxmenu
146 -$(MAKE) clean 147 -$(MAKE) $(MFLAGS) $@
148 cd ..
149 cd man
150 -$(MAKE) $(MFLAGS) $@
151 cd ..
152 cd lispref
153 -$(MAKE) $(MFLAGS) $@
154 cd ..
155 cd lispintro
156 -$(MAKE) $(MFLAGS) $@
147 cd .. 157 cd ..
148 cd leim 158 cd leim
149 if exist Makefile redir $(MAKE) clean 159 if exist Makefile redir $(MAKE) $(MFLAGS) $@
150 cd .. 160 cd ..
161 -$(MAKE) $(MFLAGS) $@
151 162
152.PHONY: bootstrap bootstrap-lisp-1 boostrap-src bootstrap-lisp bootstrap-clean 163top_distclean=rm -f Makefile */Makefile src/_gdbinit
153.PHONY: maybe_bootstrap 164
165distclean maintainer-clean: FRC
166 cd src
167 $(MAKE) $(MFLAGS) $@
168 cd ..
169 cd oldxmenu
170 -$(MAKE) $(MFLAGS) $@
171 cd ..
172 cd lib-src
173 $(MAKE) $(MFLAGS) $@
174 cd ..
175 cd man
176 -$(MAKE) $(MFLAGS) $@
177 cd ..
178 cd lispref
179 -$(MAKE) $(MFLAGS) $@
180 cd ..
181 cd lispintro
182 -$(MAKE) $(MFLAGS) $@
183 cd ..
184 cd leim
185 if exist Makefile redir $(MAKE) $(MFLAGS) $@
186 cd ..
187 cd lisp
188 $(MAKE) $(MFLAGS) $@
189 cd ..
190 ${top_distclean}
191
192extraclean:
193 cd src
194 $(MAKE) $(MFLAGS) $@
195 cd ..
196 cd oldxmenu
197 -$(MAKE) $(MFLAGS) $@
198 cd ..
199 cd lib-src
200 $(MAKE) $(MFLAGS) $@
201 cd ..
202 cd man
203 -$(MAKE) $(MFLAGS) $@
204 cd ..
205 cd lispref
206 -$(MAKE) $(MFLAGS) $@
207 cd ..
208 cd lispintro
209 -$(MAKE) $(MFLAGS) $@
210 cd ..
211 cd leim
212 if exist Makefile redir $(MAKE) $(MFLAGS) $@
213 cd ..
214 cd lisp
215 $(MAKE) $(MFLAGS) $@
216 cd ..
217 ${top_distclean}
218 -rm -f *~ #*
219
220.PHONY: bootstrap bootstrap-lisp-1 bootstrap-src bootstrap-lisp bootstrap-clean
221.PHONY: maybe_bootstrap bootfast
154 222
155maybe_bootstrap: 223maybe_bootstrap:
156 @if not exist lisp\abbrev.elc djecho \ 224 @if not exist lisp\abbrev.elc djecho \
@@ -158,6 +226,10 @@ maybe_bootstrap:
158 @if not exist lisp\abbrev.elc redir -e /dev/null -oe redir fail-this-make.exe 226 @if not exist lisp\abbrev.elc redir -e /dev/null -oe redir fail-this-make.exe
159 227
160bootstrap: bootstrap-clean-before bootstrap-lisp-1 bootstrap-src bootstrap-lisp bootstrap-clean-after all info 228bootstrap: bootstrap-clean-before bootstrap-lisp-1 bootstrap-src bootstrap-lisp bootstrap-clean-after all info
229 cd lisp; $(MAKE) $(MFLAGS) bootstrap-after; cd ..
230
231bootfast: bootstrap-clean-before bootstrap-src bootstrap-lisp bootstrap-clean-after all info
232 cd lisp; $(MAKE) $(MFLAGS) bootstrap-after; cd ..
161 233
162bootstrap-lisp-1: 234bootstrap-lisp-1:
163 cd lisp; $(MAKE) $(MFLAGS) bootstrap-clean; cd .. 235 cd lisp; $(MAKE) $(MFLAGS) bootstrap-clean; cd ..
@@ -172,7 +244,10 @@ bootstrap-src:
172bootstrap-clean-before: FRC 244bootstrap-clean-before: FRC
173 cd src; $(MAKE) $(MFLAGS) mostlyclean; cd .. 245 cd src; $(MAKE) $(MFLAGS) mostlyclean; cd ..
174 cd lib-src; $(MAKE) $(MFLAGS) clean; cd .. 246 cd lib-src; $(MAKE) $(MFLAGS) clean; cd ..
175 cd leim; $(MAKE) $(MFLAGS) clean; cd .. 247 -cd man; $(MAKE) $(MFLAGS) clean; cd ..
248 -cd lispref; $(MAKE) $(MFLAGS) clean; cd ..
249 -cd lispintro; $(MAKE) $(MFLAGS) clean; cd ..
250 cd leim; if exist Makefile redir $(MAKE) $(MFLAGS) clean; cd ..
176 251
177bootstrap-clean-after: 252bootstrap-clean-after:
178 cd src; $(MAKE) $(MFLAGS) mostlyclean; cd .. 253 cd src; $(MAKE) $(MFLAGS) mostlyclean; cd ..
diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp
index 8edc1616f23..93b4f7d5d89 100644
--- a/msdos/sed1v2.inp
+++ b/msdos/sed1v2.inp
@@ -58,6 +58,7 @@ s/bootstrap-doc/b-doc/
58/rm -f bootstrap-emacs/s/b-emacs/b-emacs b-emacs.exe/ 58/rm -f bootstrap-emacs/s/b-emacs/b-emacs b-emacs.exe/
59/^ els=/c\ 59/^ els=/c\
60 ${libsrc}make-docfile -o ${etc}DOC -d ${srcdir} ${SOME_MACHINE_LISP:.elc=.el} ${shortlisp:.elc=.el} ${SOME_MACHINE_OBJECTS} ${obj} 60 ${libsrc}make-docfile -o ${etc}DOC -d ${srcdir} ${SOME_MACHINE_LISP:.elc=.el} ${shortlisp:.elc=.el} ${SOME_MACHINE_OBJECTS} ${obj}
61s/echo.*buildobj.lst/dj&/
61/^ mv -f emacs/a\ 62/^ mv -f emacs/a\
62 stubify b-emacs\ 63 stubify b-emacs\
63 stubedit b-emacs.exe minstack=1024k\ 64 stubedit b-emacs.exe minstack=1024k\
diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp
index 4d77194cff0..31687bf0086 100644
--- a/msdos/sed2v2.inp
+++ b/msdos/sed2v2.inp
@@ -84,6 +84,14 @@ s/^#undef POINTER_TYPE *$/#define POINTER_TYPE void/
84#else\ 84#else\
85#undef HAVE_STDINT_H\ 85#undef HAVE_STDINT_H\
86#endif 86#endif
87# GCC 3.x has a built-in bzero, which conflicts with the define at
88# the end of config.in
89/^#undef HAVE_BZERO/c\
90#if __GNUC__ >= 3\
91#define HAVE_BZERO 1\
92#else\
93#undef HAVE_BZERO\
94#endif
87 95
88# Comment out any remaining undef directives, because some of them 96# Comment out any remaining undef directives, because some of them
89# might be defined in sys/config.h we include at the top of config.h. 97# might be defined in sys/config.h we include at the top of config.h.
diff --git a/msdos/sedlisp.inp b/msdos/sedlisp.inp
index 26ce2082399..9cff732a445 100644
--- a/msdos/sedlisp.inp
+++ b/msdos/sedlisp.inp
@@ -24,6 +24,7 @@ export FNCASE=y
24/^VPATH=/s|@srcdir@|.| 24/^VPATH=/s|@srcdir@|.|
25/^srcdir=/s|@srcdir@|.| 25/^srcdir=/s|@srcdir@|.|
26/^bootstrap-clean:/a\ 26/^bootstrap-clean:/a\
27 command.com /c dtou .../*.el 27 command.com /c dtou .../*.el\
28 command.com /c update $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
28 29
29# arch-tag: da7a3cff-4839-4ad7-bbe3-e2b61c84c38e 30# arch-tag: da7a3cff-4839-4ad7-bbe3-e2b61c84c38e
diff --git a/src/.gitignore b/src/.gitignore
index 406ff7cd5e2..48c78a4f3a6 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -17,3 +17,4 @@ obj
17prefix-args 17prefix-args
18stamp-oldxmenu 18stamp-oldxmenu
19temacs 19temacs
20buildobj.lst
diff --git a/src/ChangeLog b/src/ChangeLog
index e0ae2429fcd..5895b4b6564 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,233 @@
12004-11-10 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * keymap.c (Fkeymap_prompt): Accept symbol keymaps.
4
52004-11-09 Kim F. Storm <storm@cua.dk>
6
7 * xselect.c: Include <sys/types.h> and <unistd.h> (for getpid).
8 Fix various comments referring to XEvents instead of input events.
9 (x_queue_event): Fix format strings.
10 (x_stop_queuing_selection_requests): Likewise.
11
12 * xdisp.c (produce_image_glyph): Remove unused variable 'face_ascent'.
13 (pint2hrstr): Add extra braces to silence compiler.
14
15 * print.c (print_object): Fix format string.
16
17 * lread.c (read1): Fix next_char matching.
18
19 * lisp.h (Fdelete): Add EXFUN.
20 (replace_range_2): Add prototype.
21
22 * keyboard.c (read_avail_input): Remove unused variable 'discard'.
23
24 * intervals.h (NULL_INTERVAL_P): Add separate version when
25 ENABLE_CHECKING is not defined to silence compiler.
26 (compare_string_intervals): Add prototype.
27
28 * fringe.c (destroy_fringe_bitmap): Fix return type.
29 (Ffringe_bitmaps_at_pos): Remove unused var 'old_buffer'.
30
31 * emacs.c (Fdump_emacs): Fix format string.
32
33 * doc.c: Include <ctype.h>.
34 (Fsubstitute_command_keys): Remove unused variable 'firstkey'.
35
36 * data.c (store_symval_forwarding): Remove unused variables.
37
38 * callint.c (Fcall_interactively): Remove unused variable 'funcar'.
39
402004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
41
42 * Makefile.in (stamp-oldxmenu): If HAVE_GTK, don't add dependencies
43 to ${OLDXMENU}.
44
452004-11-09 Kim F. Storm <storm@cua.dk>
46
47 * process.c (Fmake_network_process): Remove kludge for interrupted
48 connects on BSD. If connect is interrupted, just close socket and
49 start over rather than sleeping and retry with same socket.
50
512004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
52
53 * .cvsignore: Add buildobj.lst.
54
55 * doc.c: New variable Vbuild_files.
56 (Fsnarf_documentation): If Vbuild_files is nil, populate it with
57 file names from buildobh.lst. Only attach docstrings from files
58 that are in Vbuild_files.
59 (syms_of_doc): Defvar Vbuild_files.
60
61 * Makefile.in (SOME_MACHINE_OBJECTS): Add fringe.o, image.o
62 and w32*.o.
63 (temacs${EXEEXT}): Generate buildobj.lst when temacs is linked.
64 (mostlyclean): rm buildobj.lst
65
66 * makefile.w32-in ($(TEMACS)): Generate buildobj.lst when temacs
67 is linked.
68
692004-11-09 Kim F. Storm <storm@cua.dk>
70
71 * fringe.c (update_window_fringes): Update fringe bitmaps if
72 cur and row ends_at_zv_p differs. If bitmaps of a row is updated,
73 also update previous row to get rid of misc. artifacts.
74
752004-11-08 Kim F. Storm <storm@cua.dk>
76
77 * xdisp.c (fast_find_position): Fix start pos if header line present.
78 (note_mouse_highlight): Clear mouse face if we move out of text area.
79
802004-11-08 Eli Zaretskii <eliz@gnu.org>
81
82 * editfns.c: Move #include "systime.h" before <sys/resource.h>.
83 Don't include <sys/time.h> explicitly.
84 Include <stdio.h> unconditionally, not just on MacOS.
85
862004-11-08 Kenichi Handa <handa@m17n.org>
87
88 * fontset.c (fontset_pattern_regexp): Cancel my previous change;
89 don't pay attention to '\' before '*'.
90 (fontset_pattern_regexp): Change the meaning of the second arg.
91 (Fnew_fontset): Call fs_query_fontset, not Fquery_fontset.
92 (check_fontset_name): Try NAME as literal at first, and if it
93 failes, try NAME as pattern.
94
952004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
96
97 * emacs.c (Fdump_emacs): Only output warning on GNU/Linux.
98
992004-11-07 Andreas Schwab <schwab@suse.de>
100
101 * lisp.h: Declare Fmsdos_downcase_filename.
102 * dired.c: Don't declare Fmsdos_downcase_filename.
103 * fileio.c: Likewise.
104
1052004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
106
107 * dosfns.c (Fdos_memget, Fdos_memput): Use integer variable offs in
108 comparisons with integers instead of Lisp_Object address.
109 (Fmsdos_set_keyboard): Declare argument allkeys.
110
111 * msdos.c (IT_set_frame_parameters): Use EQ, not ==, for Lisp_Object:s.
112
113 * dired.c: extern declare Fmsdos_downcase_filename on MSDOS to avoid
114 int/Lisp_Object mixup.
115
116 * fileio.c: Ditto.
117
1182004-11-06 Steven Tamm <steventamm@mac.com>
119
120 * editfns.c: Need to include sys/time.h before resource.h on darwin.
121
1222004-11-06 Richard M. Stallman <rms@gnu.org>
123
124 * callint.c (Fcall_interactively): Avoid reusing EVENT for other data.
125
126 * xfaces.c (merge_named_face): GCPRO the face_name in the
127 named_merge_point struct that we make.
128 (merge_face_heights): Eliminate GCPRO arg. All callers changed.
129
130 * keyboard.c (command_loop_1): Change Vtransient_mark_mode
131 before deciding whether to inactivate mark.
132
1332004-11-06 Lars Brinkhoff <lars@nocrew.org>
134
135 * config.in: Regenerate (add HAVE_GETRUSAGE).
136 * editfns.c (Fget_internal_run_time): New function.
137 (syms_of_data): Defsubr it.
138 * fns.c (sxhash): As far as possible, merge calculation of
139 hash code for symbols and strings.
140
1412004-11-06 Eli Zaretskii <eliz@gnu.org>
142
143 * frame.c (syms_of_frame): Fix the example in the doc string.
144
1452004-11-06 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
146
147 * eval.c (Feval): Remove check for INPUT_BLOCKED_P.
148
149 * xmenu.c (popup_get_selection, create_and_show_popup_menu)
150 (create_and_show_dialog): Revert change from 2004-10-31.
151
1522004-11-05 Luc Teirlinck <teirllm@auburn.edu>
153
154 * macros.c (syms_of_macros) <defining-kbd-macro>: Doc fix.
155
1562004-11-05 Kim F. Storm <storm@cua.dk>
157
158 * print.c (print_object): Print Lisp_Misc_Save_Value objects.
159
160 * fileio.c (Ffile_modes): Doc fix.
161 (auto_save_1): Check for Ffile_modes nil value.
162
1632004-11-05 Kim F. Storm <storm@cua.dk>
164
165 * xselect.c (struct selection_event_queue, selection_queue)
166 (x_queue_selection_requests, x_queue_event)
167 (x_start_queuing_selection_requests)
168 (x_stop_queuing_selection_requests): Add new queue for selection
169 input events to replace previous XEvent queue in xterm.c.
170 (queue_selection_requests_unwind): Adapt to new queue.
171 (x_reply_selection_request): Adapt to new queue.
172 Unexpect wait_object in case of x errors (memory leak).
173 (x_handle_selection_request, x_handle_selection_clear): Make static.
174 (x_handle_selection_event): New function. May queue selection events.
175 (wait_for_property_change_unwind): Use save_value instead of cons.
176 Clear property_change_reply_object.
177 (wait_for_property_change): Abort if already waiting.
178 Use save_value instead of cons for unwind data.
179 (x_handle_property_notify): Skip events already arrived, but don't
180 free them, as "arrived" field is checked by wait_for_property_change,
181 and it will be freed by unwind or explicit unexpect_property_change.
182 (x_get_foreign_selection): Add to new queue.
183 (receive_incremental_selection): Don't unexpect wait_object when done
184 as it has already been freed by previous wait_for_property_change.
185
186 * xterm.h (x_start_queuing_selection_requests)
187 (x_stop_queuing_selection_requests, x_handle_selection_request)
188 (x_handle_selection_clear): Remove prototypes.
189 (x_handle_selection_event): Add prototype.
190
191 * xterm.c (handle_one_xevent): Don't queue X selection events
192 here, it may be too late if we start queuing after we have already
193 stored some selection events into the kbd buffer.
194 (struct selection_event_queue, queue, x_queue_selection_requests)
195 (x_queue_event, x_unqueue_events, x_start_queuing_selection_requests)
196 (x_stop_queuing_selection_requests): Remove/move to xselect.c.
197 (x_catch_errors_unwind): Block input around final XSync.
198
199 * keyboard.h (kbd_buffer_unget_event): Add prototype.
200
201 * keyboard.c (kbd_buffer_store_event_hold): Remove obsolete code.
202 (kbd_buffer_unget_event): New function.
203 (kbd_buffer_get_event, swallow_events): Combine SELECTION events
204 and use x_handle_selection_event.
205 (mark_kboards): Don't mark x and y of SELECTION_CLEAR_EVENT.
206
2072004-11-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
208
209 * xselect.c (TRACE3): New debug macro.
210 (x_reply_selection_request): Use it.
211 (receive_incremental_selection): In call to TRACE0, the name of
212 a symbol is in xname.
213
2142004-11-05 Kim F. Storm <storm@cua.dk>
215
216 * fontset.c (fontset_pattern_regexp): Use unsigned char.
217
2182004-11-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
219
220 * fileio.c (Fnext_read_file_uses_dialog_p): New function.
221
222 * gtkutil.h: Declare use_old_gtk_file_dialog.
223
224 * gtkutil.c: Make use_old_gtk_file_dialog non-static.
225 (xg_initialize): Move DEFVAR_BOOL for use_old_gtk_file_dialog ...
226 * xfns.c (syms_of_xfns): ... to here.
227
228 * gtkutil.c (xg_get_file_with_chooser): Expand DEFAULT_FILENAME if
229 it doesn't start with /.
230
12004-11-04 Kenichi Handa <handa@m17n.org> 2312004-11-04 Kenichi Handa <handa@m17n.org>
2 232
3 * fontset.c (fontset_pattern_regexp): If '*' is preceded by '\', 233 * fontset.c (fontset_pattern_regexp): If '*' is preceded by '\',
@@ -67,20 +297,20 @@
67 297
68 * lisp.h: Fx_file_dialog takes 5 parameters. 298 * lisp.h: Fx_file_dialog takes 5 parameters.
69 299
70 * xfns.c (Fx_file_dialog): Both Motif and GTK version: Add 300 * xfns.c (Fx_file_dialog): Both Motif and GTK version:
71 parameter only_dir_p. 301 Add parameter only_dir_p.
72 In Motif version, don't put DEFAULT_FILENAME in filter part of the 302 In Motif version, don't put DEFAULT_FILENAME in filter part of the
73 dialog, just text field part. Do not add DEFAULT_FILENAME 303 dialog, just text field part. Do not add DEFAULT_FILENAME
74 to list of files if it isn't there. 304 to list of files if it isn't there.
75 In GTK version, pass only_dir_p parameter to xg_get_file_name. 305 In GTK version, pass only_dir_p parameter to xg_get_file_name.
76 306
77 * macfns.c (Fx_file_dialog): Add parameter only_dir_p. Check 307 * macfns.c (Fx_file_dialog): Add parameter only_dir_p.
78 only_dir_p instead of comparing prompt to "Dired". When using 308 Check only_dir_p instead of comparing prompt to "Dired". When using
79 a save dialog, add option kNavDontConfirmReplacement, change title 309 a save dialog, add option kNavDontConfirmReplacement, change title
80 to "Enter name", change text for save button to "Ok". 310 to "Enter name", change text for save button to "Ok".
81 311
82 * w32fns.c (Fx_file_dialog): Add parameter only_dir_p. Check 312 * w32fns.c (Fx_file_dialog): Add parameter only_dir_p.
83 only_dir_p instead of comparing prompt to "Dired". 313 Check only_dir_p instead of comparing prompt to "Dired".
84 314
85 * gtkutil.c (xg_get_file_with_chooser) 315 * gtkutil.c (xg_get_file_with_chooser)
86 (xg_get_file_with_selection): New functions, only defined ifdef 316 (xg_get_file_with_selection): New functions, only defined ifdef
@@ -97,8 +327,8 @@
97 327
982004-11-01 Kim F. Storm <storm@cua.dk> 3282004-11-01 Kim F. Storm <storm@cua.dk>
99 329
100 * process.c (connect_wait_mask, num_pending_connects): Only 330 * process.c (connect_wait_mask, num_pending_connects):
101 declare and use them if NON_BLOCKING_CONNECT is defined. 331 Only declare and use them if NON_BLOCKING_CONNECT is defined.
102 (init_process): Initialize them if NON_BLOCKING_CONNECT defined. 332 (init_process): Initialize them if NON_BLOCKING_CONNECT defined.
103 (IF_NON_BLOCKING_CONNECT): New helper macro. 333 (IF_NON_BLOCKING_CONNECT): New helper macro.
104 (wait_reading_process_output): Only declare and use local vars 334 (wait_reading_process_output): Only declare and use local vars
@@ -113,8 +343,8 @@
113 * xmenu.c: Add prototypes for forward function declarations. 343 * xmenu.c: Add prototypes for forward function declarations.
114 (popup_get_selection): Remove parameter do_timers, remove call to 344 (popup_get_selection): Remove parameter do_timers, remove call to
115 timer_check. 345 timer_check.
116 (create_and_show_popup_menu, create_and_show_dialog): Remove 346 (create_and_show_popup_menu, create_and_show_dialog):
117 parameter do_timers from call to popup_get_selection. 347 Remove parameter do_timers from call to popup_get_selection.
118 348
119 * xdisp.c (update_tool_bar): Pass a copy of f->tool_bar_items to 349 * xdisp.c (update_tool_bar): Pass a copy of f->tool_bar_items to
120 tool_bar_items and assign the result to f->tool_bar_items if 350 tool_bar_items and assign the result to f->tool_bar_items if
@@ -133,7 +363,7 @@
133 * macterm.c: allow user to assign key modifiers to the Mac Option 363 * macterm.c: allow user to assign key modifiers to the Mac Option
134 key via a 'mac-option-modifier' variable. 364 key via a 'mac-option-modifier' variable.
135 365
1362004-10-28 Stefan <monnier@iro.umontreal.ca> 3662004-10-28 Stefan Monnier <monnier@iro.umontreal.ca>
137 367
138 * xselect.c (Vx_lost_selection_functions, Vx_sent_selection_functions): 368 * xselect.c (Vx_lost_selection_functions, Vx_sent_selection_functions):
139 Rename from Vx_lost_selection_hooks and Vx_sent_selection_hooks. 369 Rename from Vx_lost_selection_hooks and Vx_sent_selection_hooks.
diff --git a/src/Makefile.in b/src/Makefile.in
index 5d6112c8fec..40d7e2df53c 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -596,8 +596,10 @@ obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
596 These go in the DOC file on all machines 596 These go in the DOC file on all machines
597 in case they are needed there. */ 597 in case they are needed there. */
598SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \ 598SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \
599 xterm.o xfns.o xmenu.o xselect.o xrdb.o \ 599 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
600 mac.o macterm.o macfns.o macmenu.o fontset.o 600 mac.o macterm.o macfns.o macmenu.o fontset.o \
601 w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
602 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o
601 603
602 604
603#ifdef TERMINFO 605#ifdef TERMINFO
@@ -926,6 +928,7 @@ ${libsrc}make-docfile${EXEEXT}:
926#endif 928#endif
927 929
928temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT} 930temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
931 echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
929 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \ 932 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
930 -o temacs ${STARTFILES} ${obj} ${otherobj} \ 933 -o temacs ${STARTFILES} ${obj} ${otherobj} \
931 OBJECTS_MACHINE ${LIBES} 934 OBJECTS_MACHINE ${LIBES}
@@ -941,7 +944,7 @@ prefix-args${EXEEXT}: prefix-args.c $(config_h)
941#define OLDXMENU_OPTIONS 944#define OLDXMENU_OPTIONS
942#endif 945#endif
943 946
944#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) 947#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (HAVE_GTK)
945 948
946/* We use stamp-xmenu with these two deps 949/* We use stamp-xmenu with these two deps
947 to both ensure that lwlib gets remade based on its dependencies 950 to both ensure that lwlib gets remade based on its dependencies
@@ -997,12 +1000,12 @@ really-oldXMenu:
997 @true /* make -t should not create really-oldXMenu. */ 1000 @true /* make -t should not create really-oldXMenu. */
998.PHONY: really-oldXMenu 1001.PHONY: really-oldXMenu
999#endif /* not USE_X_TOOLKIT */ 1002#endif /* not USE_X_TOOLKIT */
1000#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS) */ 1003#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
1001 1004
1002/* We don\'t really need this, but satisfy the dependency. */ 1005/* We don\'t really need this, but satisfy the dependency. */
1003stamp-oldxmenu: 1006stamp-oldxmenu:
1004 touch stamp-oldxmenu 1007 touch stamp-oldxmenu
1005#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS) */ 1008#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
1006 1009
1007../config.status:: epaths.in 1010../config.status:: epaths.in
1008 @echo "The file epaths.h needs to be set up from epaths.in." 1011 @echo "The file epaths.h needs to be set up from epaths.in."
@@ -1266,6 +1269,7 @@ mostlyclean:
1266 rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a 1269 rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
1267 rm -f ../etc/DOC 1270 rm -f ../etc/DOC
1268 rm -f bootstrap-emacs${EXEEXT} 1271 rm -f bootstrap-emacs${EXEEXT}
1272 rm -f buildobj.lst
1269clean: mostlyclean 1273clean: mostlyclean
1270 rm -f emacs-*${EXEEXT} emacs${EXEEXT} 1274 rm -f emacs-*${EXEEXT} emacs${EXEEXT}
1271/**/# This is used in making a distribution. 1275/**/# This is used in making a distribution.
diff --git a/src/callint.c b/src/callint.c
index da88693cd78..bb71ad50f44 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -265,7 +265,6 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
265 Lisp_Object *args, *visargs; 265 Lisp_Object *args, *visargs;
266 unsigned char **argstrings; 266 unsigned char **argstrings;
267 Lisp_Object fun; 267 Lisp_Object fun;
268 Lisp_Object funcar;
269 Lisp_Object specs; 268 Lisp_Object specs;
270 Lisp_Object filter_specs; 269 Lisp_Object filter_specs;
271 Lisp_Object teml; 270 Lisp_Object teml;
@@ -451,25 +450,25 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
451 string++; 450 string++;
452 else if (*string == '@') 451 else if (*string == '@')
453 { 452 {
454 Lisp_Object event; 453 Lisp_Object event, tem;
455 454
456 event = (next_event < key_count 455 event = (next_event < key_count
457 ? XVECTOR (keys)->contents[next_event] 456 ? XVECTOR (keys)->contents[next_event]
458 : Qnil); 457 : Qnil);
459 if (EVENT_HAS_PARAMETERS (event) 458 if (EVENT_HAS_PARAMETERS (event)
460 && (event = XCDR (event), CONSP (event)) 459 && (tem = XCDR (event), CONSP (tem))
461 && (event = XCAR (event), CONSP (event)) 460 && (tem = XCAR (tem), CONSP (tem))
462 && (event = XCAR (event), WINDOWP (event))) 461 && (tem = XCAR (tem), WINDOWP (tem)))
463 { 462 {
464 if (MINI_WINDOW_P (XWINDOW (event)) 463 if (MINI_WINDOW_P (XWINDOW (tem))
465 && ! (minibuf_level > 0 && EQ (event, minibuf_window))) 464 && ! (minibuf_level > 0 && EQ (tem, minibuf_window)))
466 error ("Attempt to select inactive minibuffer window"); 465 error ("Attempt to select inactive minibuffer window");
467 466
468 /* If the current buffer wants to clean up, let it. */ 467 /* If the current buffer wants to clean up, let it. */
469 if (!NILP (Vmouse_leave_buffer_hook)) 468 if (!NILP (Vmouse_leave_buffer_hook))
470 call1 (Vrun_hooks, Qmouse_leave_buffer_hook); 469 call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
471 470
472 Fselect_window (event, Qnil); 471 Fselect_window (tem, Qnil);
473 } 472 }
474 string++; 473 string++;
475 } 474 }
diff --git a/src/config.in b/src/config.in
index 0fb9126b470..fe1adc39f9d 100644
--- a/src/config.in
+++ b/src/config.in
@@ -196,6 +196,9 @@ Boston, MA 02111-1307, USA. */
196/* Define to 1 if you have the `getpt' function. */ 196/* Define to 1 if you have the `getpt' function. */
197#undef HAVE_GETPT 197#undef HAVE_GETPT
198 198
199/* Define to 1 if you have the `getrusage' function. */
200#undef HAVE_GETRUSAGE
201
199/* Define to 1 if you have the `getsockname' function. */ 202/* Define to 1 if you have the `getsockname' function. */
200#undef HAVE_GETSOCKNAME 203#undef HAVE_GETSOCKNAME
201 204
diff --git a/src/data.c b/src/data.c
index 561a034b8fd..7f68cc864df 100644
--- a/src/data.c
+++ b/src/data.c
@@ -908,8 +908,6 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
908 register Lisp_Object valcontents, newval; 908 register Lisp_Object valcontents, newval;
909 struct buffer *buf; 909 struct buffer *buf;
910{ 910{
911 int offset;
912
913 switch (SWITCH_ENUM_CAST (XTYPE (valcontents))) 911 switch (SWITCH_ENUM_CAST (XTYPE (valcontents)))
914 { 912 {
915 case Lisp_Misc: 913 case Lisp_Misc:
@@ -941,7 +939,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
941 - (char *) &buffer_defaults); 939 - (char *) &buffer_defaults);
942 int idx = PER_BUFFER_IDX (offset); 940 int idx = PER_BUFFER_IDX (offset);
943 941
944 Lisp_Object tail, buf; 942 Lisp_Object tail;
945 943
946 if (idx <= 0) 944 if (idx <= 0)
947 break; 945 break;
diff --git a/src/doc.c b/src/doc.c
index f722dd49b76..1bb78c0c376 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */
24 24
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/file.h> /* Must be after sys/types.h for USG and BSD4_1*/ 26#include <sys/file.h> /* Must be after sys/types.h for USG and BSD4_1*/
27#include <ctype.h>
27 28
28#ifdef HAVE_FCNTL_H 29#ifdef HAVE_FCNTL_H
29#include <fcntl.h> 30#include <fcntl.h>
@@ -51,6 +52,9 @@ Lisp_Object Vdoc_file_name;
51 52
52Lisp_Object Qfunction_documentation; 53Lisp_Object Qfunction_documentation;
53 54
55/* A list of files used to build this Emacs binary. */
56static Lisp_Object Vbuild_files;
57
54extern Lisp_Object Voverriding_local_map; 58extern Lisp_Object Voverriding_local_map;
55 59
56/* For VMS versions with limited file name syntax, 60/* For VMS versions with limited file name syntax,
@@ -581,6 +585,7 @@ the same file name is found in the `doc-directory'. */)
581 register char *p, *end; 585 register char *p, *end;
582 Lisp_Object sym; 586 Lisp_Object sym;
583 char *name; 587 char *name;
588 int skip_file = 0;
584 589
585 CHECK_STRING (filename); 590 CHECK_STRING (filename);
586 591
@@ -618,6 +623,54 @@ the same file name is found in the `doc-directory'. */)
618#endif /* VMS4_4 */ 623#endif /* VMS4_4 */
619#endif /* VMS */ 624#endif /* VMS */
620 625
626 /* Vbuild_files is nil when temacs is run, and non-nil after that. */
627 if (NILP (Vbuild_files))
628 {
629 size_t cp_size = 0;
630 size_t to_read;
631 int nr_read;
632 char *cp = NULL;
633 char *beg, *end;
634
635 fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
636 if (fd < 0)
637 report_file_error ("Opening file buildobj.lst", Qnil);
638
639 filled = 0;
640 for (;;)
641 {
642 cp_size += 1024;
643 to_read = cp_size - 1 - filled;
644 cp = xrealloc (cp, cp_size);
645 nr_read = emacs_read (fd, &cp[filled], to_read);
646 filled += nr_read;
647 if (nr_read < to_read)
648 break;
649 }
650
651 emacs_close (fd);
652 cp[filled] = 0;
653
654 for (beg = cp; *beg; beg = end)
655 {
656 int len;
657
658 while (*beg && isspace (*beg)) ++beg;
659
660 for (end = beg; *end && ! isspace (*end); ++end)
661 if (*end == '/') beg = end+1; /* skip directory part */
662
663 len = end - beg;
664 if (len > 4 && end[-4] == '.' && end[-3] == 'o')
665 len -= 2; /* Just take .o if it ends in .obj */
666
667 if (len > 0)
668 Vbuild_files = Fcons (make_string (beg, len), Vbuild_files);
669 }
670
671 xfree (cp);
672 }
673
621 fd = emacs_open (name, O_RDONLY, 0); 674 fd = emacs_open (name, O_RDONLY, 0);
622 if (fd < 0) 675 if (fd < 0)
623 report_file_error ("Opening doc string file", 676 report_file_error ("Opening doc string file",
@@ -640,10 +693,28 @@ the same file name is found in the `doc-directory'. */)
640 if (p != end) 693 if (p != end)
641 { 694 {
642 end = (char *) index (p, '\n'); 695 end = (char *) index (p, '\n');
696
697 /* See if this is a file name, and if it is a file in build-files. */
698 if (p[1] == 'S' && end - p > 4 && end[-2] == '.'
699 && (end[-1] == 'o' || end[-1] == 'c'))
700 {
701 int len = end - p - 2;
702 char *fromfile = alloca (len + 1);
703 strncpy (fromfile, &p[2], len);
704 fromfile[len] = 0;
705 if (fromfile[len-1] == 'c')
706 fromfile[len-1] = 'o';
707
708 if (EQ (Fmember (build_string (fromfile), Vbuild_files), Qnil))
709 skip_file = 1;
710 else
711 skip_file = 0;
712 }
713
643 sym = oblookup (Vobarray, p + 2, 714 sym = oblookup (Vobarray, p + 2,
644 multibyte_chars_in_text (p + 2, end - p - 2), 715 multibyte_chars_in_text (p + 2, end - p - 2),
645 end - p - 2); 716 end - p - 2);
646 if (SYMBOLP (sym)) 717 if (! skip_file && SYMBOLP (sym))
647 { 718 {
648 /* Attach a docstring to a variable? */ 719 /* Attach a docstring to a variable? */
649 if (p[1] == 'V') 720 if (p[1] == 'V')
@@ -756,7 +827,6 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
756 } 827 }
757 else if (strp[0] == '\\' && strp[1] == '[') 828 else if (strp[0] == '\\' && strp[1] == '[')
758 { 829 {
759 Lisp_Object firstkey;
760 int start_idx; 830 int start_idx;
761 831
762 changed = 1; 832 changed = 1;
@@ -919,6 +989,10 @@ syms_of_doc ()
919 doc: /* Name of file containing documentation strings of built-in symbols. */); 989 doc: /* Name of file containing documentation strings of built-in symbols. */);
920 Vdoc_file_name = Qnil; 990 Vdoc_file_name = Qnil;
921 991
992 DEFVAR_LISP ("build-files", &Vbuild_files,
993 doc: /* A list of files used to build this Emacs binary. */);
994 Vbuild_files = Qnil;
995
922 defsubr (&Sdocumentation); 996 defsubr (&Sdocumentation);
923 defsubr (&Sdocumentation_property); 997 defsubr (&Sdocumentation_property);
924 defsubr (&Ssnarf_documentation); 998 defsubr (&Ssnarf_documentation);
diff --git a/src/dosfns.c b/src/dosfns.c
index a64dc31b234..3b3aac0efad 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -110,7 +110,7 @@ Return the updated VECTOR. */)
110 offs = (unsigned long) XINT (address); 110 offs = (unsigned long) XINT (address);
111 CHECK_VECTOR (vector); 111 CHECK_VECTOR (vector);
112 len = XVECTOR (vector)-> size; 112 len = XVECTOR (vector)-> size;
113 if (len < 1 || len > 2048 || address < 0 || address > 0xfffff - len) 113 if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len)
114 return Qnil; 114 return Qnil;
115 buf = alloca (len); 115 buf = alloca (len);
116 dosmemget (offs, len, buf); 116 dosmemget (offs, len, buf);
@@ -135,7 +135,7 @@ DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
135 offs = (unsigned long) XINT (address); 135 offs = (unsigned long) XINT (address);
136 CHECK_VECTOR (vector); 136 CHECK_VECTOR (vector);
137 len = XVECTOR (vector)-> size; 137 len = XVECTOR (vector)-> size;
138 if (len < 1 || len > 2048 || address < 0 || address > 0xfffff - len) 138 if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len)
139 return Qnil; 139 return Qnil;
140 buf = alloca (len); 140 buf = alloca (len);
141 141
@@ -155,7 +155,7 @@ If the optional argument ALLKEYS is non-nil, the keyboard is mapped for
155all keys; otherwise it is only used when the ALT key is pressed. 155all keys; otherwise it is only used when the ALT key is pressed.
156The current keyboard layout is available in dos-keyboard-code. */) 156The current keyboard layout is available in dos-keyboard-code. */)
157 (country_code, allkeys) 157 (country_code, allkeys)
158 Lisp_Object country_code; 158 Lisp_Object country_code, allkeys;
159{ 159{
160 CHECK_NUMBER (country_code); 160 CHECK_NUMBER (country_code);
161 if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys))) 161 if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys)))
diff --git a/src/editfns.c b/src/editfns.c
index f6e3a4bb357..0917fadb500 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */
22 22
23#include <config.h> 23#include <config.h>
24#include <sys/types.h> 24#include <sys/types.h>
25#include <stdio.h>
25 26
26#ifdef VMS 27#ifdef VMS
27#include "vms-pwd.h" 28#include "vms-pwd.h"
@@ -33,10 +34,13 @@ Boston, MA 02111-1307, USA. */
33#include <unistd.h> 34#include <unistd.h>
34#endif 35#endif
35 36
36/* Without this, sprintf on Mac OS Classic will produce wrong 37/* systime.h includes <sys/time.h> which, on some systems, is required
37 result. */ 38 for <sys/resource.h>; thus systime.h must be included before
38#ifdef MAC_OS8 39 <sys/resource.h> */
39#include <stdio.h> 40#include "systime.h"
41
42#if defined HAVE_SYS_RESOURCE_H
43#include <sys/resource.h>
40#endif 44#endif
41 45
42#include <ctype.h> 46#include <ctype.h>
@@ -49,8 +53,6 @@ Boston, MA 02111-1307, USA. */
49#include "frame.h" 53#include "frame.h"
50#include "window.h" 54#include "window.h"
51 55
52#include "systime.h"
53
54#ifdef STDC_HEADERS 56#ifdef STDC_HEADERS
55#include <float.h> 57#include <float.h>
56#define MAX_10_EXP DBL_MAX_10_EXP 58#define MAX_10_EXP DBL_MAX_10_EXP
@@ -1370,6 +1372,47 @@ resolution finer than a second. */)
1370 1372
1371 return Flist (3, result); 1373 return Flist (3, result);
1372} 1374}
1375
1376DEFUN ("get-internal-run-time", Fget_internal_run_time, Sget_internal_run_time,
1377 0, 0, 0,
1378 doc: /* Return the current run time used by Emacs.
1379The time is returned as a list of three integers. The first has the
1380most significant 16 bits of the seconds, while the second has the
1381least significant 16 bits. The third integer gives the microsecond
1382count.
1383
1384On systems that can't determine the run time, get-internal-run-time
1385does the same thing as current-time. The microsecond count is zero on
1386systems that do not provide resolution finer than a second. */)
1387 ()
1388{
1389#ifdef HAVE_GETRUSAGE
1390 struct rusage usage;
1391 Lisp_Object result[3];
1392 int secs, usecs;
1393
1394 if (getrusage (RUSAGE_SELF, &usage) < 0)
1395 /* This shouldn't happen. What action is appropriate? */
1396 Fsignal (Qerror, Qnil);
1397
1398 /* Sum up user time and system time. */
1399 secs = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec;
1400 usecs = usage.ru_utime.tv_usec + usage.ru_stime.tv_usec;
1401 if (usecs >= 1000000)
1402 {
1403 usecs -= 1000000;
1404 secs++;
1405 }
1406
1407 XSETINT (result[0], (secs >> 16) & 0xffff);
1408 XSETINT (result[1], (secs >> 0) & 0xffff);
1409 XSETINT (result[2], usecs);
1410
1411 return Flist (3, result);
1412#else
1413 return Fcurrent_time ();
1414#endif
1415}
1373 1416
1374 1417
1375int 1418int
@@ -4447,6 +4490,7 @@ functions if all the text being accessed has this property. */);
4447 defsubr (&Suser_full_name); 4490 defsubr (&Suser_full_name);
4448 defsubr (&Semacs_pid); 4491 defsubr (&Semacs_pid);
4449 defsubr (&Scurrent_time); 4492 defsubr (&Scurrent_time);
4493 defsubr (&Sget_internal_run_time);
4450 defsubr (&Sformat_time_string); 4494 defsubr (&Sformat_time_string);
4451 defsubr (&Sfloat_time); 4495 defsubr (&Sfloat_time);
4452 defsubr (&Sdecode_time); 4496 defsubr (&Sdecode_time);
diff --git a/src/emacs.c b/src/emacs.c
index 5e583137dae..16ae1129840 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1626,16 +1626,14 @@ main (argc, argv
1626 keys_of_minibuf (); 1626 keys_of_minibuf ();
1627 keys_of_window (); 1627 keys_of_window ();
1628 } 1628 }
1629 else 1629 else
1630 { 1630 {
1631 /* 1631 /* Initialization that must be done even if the global variable
1632 Initialization that must be done even if the global variable 1632 initialized is non zero. */
1633 initialized is non zero
1634 */
1635#ifdef HAVE_NTGUI 1633#ifdef HAVE_NTGUI
1636 globals_of_w32fns (); 1634 globals_of_w32fns ();
1637 globals_of_w32menu (); 1635 globals_of_w32menu ();
1638#endif /* end #ifdef HAVE_NTGUI */ 1636#endif /* HAVE_NTGUI */
1639 } 1637 }
1640 1638
1641 init_charset (); 1639 init_charset ();
@@ -2189,16 +2187,19 @@ You must run Emacs in batch mode in order to dump it. */)
2189 if (! noninteractive) 2187 if (! noninteractive)
2190 error ("Dumping Emacs works only in batch mode"); 2188 error ("Dumping Emacs works only in batch mode");
2191 2189
2190#ifdef __linux__
2192 if (heap_bss_diff > MAX_HEAP_BSS_DIFF) 2191 if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
2193 { 2192 {
2194 fprintf (stderr, "**************************************************\n"); 2193 fprintf (stderr, "**************************************************\n");
2195 fprintf (stderr, "Warning: Your system has a gap between BSS and the\n"); 2194 fprintf (stderr, "Warning: Your system has a gap between BSS and the\n");
2196 fprintf (stderr, "heap. This usually means that exec-shield or\n"); 2195 fprintf (stderr, "heap (%lu byte). This usually means that exec-shield\n",
2197 fprintf (stderr, "something similar is in effect. The dump may fail\n"); 2196 heap_bss_diff);
2198 fprintf (stderr, "because of this. See the section about exec-shield\n"); 2197 fprintf (stderr, "or something similar is in effect. The dump may\n");
2199 fprintf (stderr, "in etc/PROBLEMS for more information.\n"); 2198 fprintf (stderr, "fail because of this. See the section about \n");
2199 fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n");
2200 fprintf (stderr, "**************************************************\n"); 2200 fprintf (stderr, "**************************************************\n");
2201 } 2201 }
2202#endif /* __linux__ */
2202 2203
2203 /* Bind `command-line-processed' to nil before dumping, 2204 /* Bind `command-line-processed' to nil before dumping,
2204 so that the dumped Emacs will process its command line 2205 so that the dumped Emacs will process its command line
@@ -2287,7 +2288,7 @@ synchronize_locale (category, plocale, desired_locale)
2287 { 2288 {
2288 *plocale = desired_locale; 2289 *plocale = desired_locale;
2289 setlocale (category, (STRINGP (desired_locale) 2290 setlocale (category, (STRINGP (desired_locale)
2290 ? (char *)(SDATA (desired_locale)) 2291 ? (char *) SDATA (desired_locale)
2291 : "")); 2292 : ""));
2292 } 2293 }
2293} 2294}
diff --git a/src/eval.c b/src/eval.c
index 5fb35cee58b..d1d5d195762 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1996,7 +1996,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
1996 struct backtrace backtrace; 1996 struct backtrace backtrace;
1997 struct gcpro gcpro1, gcpro2, gcpro3; 1997 struct gcpro gcpro1, gcpro2, gcpro3;
1998 1998
1999 if (handling_signal || INPUT_BLOCKED_P) 1999 if (handling_signal)
2000 abort (); 2000 abort ();
2001 2001
2002 if (SYMBOLP (form)) 2002 if (SYMBOLP (form))
diff --git a/src/fileio.c b/src/fileio.c
index 83c0866cf06..6f52f792a5b 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3371,7 +3371,8 @@ This is the sort of file that holds an ordinary stream of data bytes. */)
3371} 3371}
3372 3372
3373DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, 3373DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
3374 doc: /* Return mode bits of file named FILENAME, as an integer. */) 3374 doc: /* Return mode bits of file named FILENAME, as an integer.
3375Return nil, if file does not exist or is not accessible. */)
3375 (filename) 3376 (filename)
3376 Lisp_Object filename; 3377 Lisp_Object filename;
3377{ 3378{
@@ -5628,17 +5629,21 @@ Lisp_Object
5628auto_save_1 () 5629auto_save_1 ()
5629{ 5630{
5630 struct stat st; 5631 struct stat st;
5632 Lisp_Object modes;
5633
5634 auto_save_mode_bits = 0666;
5631 5635
5632 /* Get visited file's mode to become the auto save file's mode. */ 5636 /* Get visited file's mode to become the auto save file's mode. */
5633 if (! NILP (current_buffer->filename) 5637 if (! NILP (current_buffer->filename))
5634 && stat (SDATA (current_buffer->filename), &st) >= 0) 5638 {
5635 /* But make sure we can overwrite it later! */ 5639 if (stat (SDATA (current_buffer->filename), &st) >= 0)
5636 auto_save_mode_bits = st.st_mode | 0600; 5640 /* But make sure we can overwrite it later! */
5637 else if (! NILP (current_buffer->filename)) 5641 auto_save_mode_bits = st.st_mode | 0600;
5638 /* Remote files don't cooperate with stat. */ 5642 else if ((modes = Ffile_modes (current_buffer->filename),
5639 auto_save_mode_bits = XINT (Ffile_modes (current_buffer->filename)) | 0600; 5643 INTEGERP (modes)))
5640 else 5644 /* Remote files don't cooperate with stat. */
5641 auto_save_mode_bits = 0666; 5645 auto_save_mode_bits = XINT (modes) | 0600;
5646 }
5642 5647
5643 return 5648 return
5644 Fwrite_region (Qnil, Qnil, 5649 Fwrite_region (Qnil, Qnil,
@@ -6090,6 +6095,23 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte
6090 return Ffile_exists_p (string); 6095 return Ffile_exists_p (string);
6091} 6096}
6092 6097
6098DEFUN ("next-read-file-uses-dialog-p", Fnext_read_file_uses_dialog_p,
6099 Snext_read_file_uses_dialog_p, 0, 0, 0,
6100 doc: /* Return t if a call to `read-file-name' will use a dialog.
6101The return value is only relevant for a call to `read-file-name' that happens
6102before any other event (mouse or keypress) is handeled. */)
6103 ()
6104{
6105#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON)
6106 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
6107 && use_dialog_box
6108 && use_file_dialog
6109 && have_menus_p ())
6110 return Qt;
6111#endif
6112 return Qnil;
6113}
6114
6093DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0, 6115DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0,
6094 doc: /* Read file name, prompting with PROMPT and completing in directory DIR. 6116 doc: /* Read file name, prompting with PROMPT and completing in directory DIR.
6095Value is not expanded---you must call `expand-file-name' yourself. 6117Value is not expanded---you must call `expand-file-name' yourself.
@@ -6222,10 +6244,7 @@ and `read-file-name-function'. */)
6222 GCPRO2 (insdef, default_filename); 6244 GCPRO2 (insdef, default_filename);
6223 6245
6224#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON) 6246#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON)
6225 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) 6247 if (! NILP (Fnext_read_file_uses_dialog_p ()))
6226 && use_dialog_box
6227 && use_file_dialog
6228 && have_menus_p ())
6229 { 6248 {
6230 /* If DIR contains a file name, split it. */ 6249 /* If DIR contains a file name, split it. */
6231 Lisp_Object file; 6250 Lisp_Object file;
@@ -6610,6 +6629,7 @@ a non-nil value. */);
6610 6629
6611 defsubr (&Sread_file_name_internal); 6630 defsubr (&Sread_file_name_internal);
6612 defsubr (&Sread_file_name); 6631 defsubr (&Sread_file_name);
6632 defsubr (&Snext_read_file_uses_dialog_p);
6613 6633
6614#ifdef unix 6634#ifdef unix
6615 defsubr (&Sunix_sync); 6635 defsubr (&Sunix_sync);
diff --git a/src/fns.c b/src/fns.c
index cfbcc83fe8d..442eb120b82 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4476,15 +4476,14 @@ sxhash (obj, depth)
4476 hash = XUINT (obj); 4476 hash = XUINT (obj);
4477 break; 4477 break;
4478 4478
4479 case Lisp_Symbol:
4480 hash = sxhash_string (SDATA (SYMBOL_NAME (obj)),
4481 SCHARS (SYMBOL_NAME (obj)));
4482 break;
4483
4484 case Lisp_Misc: 4479 case Lisp_Misc:
4485 hash = XUINT (obj); 4480 hash = XUINT (obj);
4486 break; 4481 break;
4487 4482
4483 case Lisp_Symbol:
4484 obj = SYMBOL_NAME (obj);
4485 /* Fall through. */
4486
4488 case Lisp_String: 4487 case Lisp_String:
4489 hash = sxhash_string (SDATA (obj), SCHARS (obj)); 4488 hash = sxhash_string (SDATA (obj), SCHARS (obj));
4490 break; 4489 break;
diff --git a/src/fontset.c b/src/fontset.c
index 52d3cc555c5..baa56ad3a6f 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1069,14 +1069,14 @@ fontset_pattern_regexp (pattern)
1069 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) 1069 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
1070 { 1070 {
1071 /* We must at first update the cached data. */ 1071 /* We must at first update the cached data. */
1072 char *regex, *p0, *p1; 1072 unsigned char *regex, *p0, *p1;
1073 int ndashes = 0, nstars = 0; 1073 int ndashes = 0, nstars = 0;
1074 1074
1075 for (p0 = SDATA (pattern); *p0; p0++) 1075 for (p0 = SDATA (pattern); *p0; p0++)
1076 { 1076 {
1077 if (*p0 == '-') 1077 if (*p0 == '-')
1078 ndashes++; 1078 ndashes++;
1079 else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 1079 else if (*p0 == '*')
1080 nstars++; 1080 nstars++;
1081 } 1081 }
1082 1082
@@ -1084,14 +1084,14 @@ fontset_pattern_regexp (pattern)
1084 we convert "*" to "[^-]*" which is much faster in regular 1084 we convert "*" to "[^-]*" which is much faster in regular
1085 expression matching. */ 1085 expression matching. */
1086 if (ndashes < 14) 1086 if (ndashes < 14)
1087 p1 = regex = (char *) alloca (SBYTES (pattern) + 2 * nstars + 1); 1087 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 1);
1088 else 1088 else
1089 p1 = regex = (char *) alloca (SBYTES (pattern) + 5 * nstars + 1); 1089 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 1);
1090 1090
1091 *p1++ = '^'; 1091 *p1++ = '^';
1092 for (p0 = (char *) SDATA (pattern); *p0; p0++) 1092 for (p0 = SDATA (pattern); *p0; p0++)
1093 { 1093 {
1094 if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 1094 if (*p0 == '*')
1095 { 1095 {
1096 if (ndashes < 14) 1096 if (ndashes < 14)
1097 *p1++ = '.'; 1097 *p1++ = '.';
@@ -1115,31 +1115,35 @@ fontset_pattern_regexp (pattern)
1115} 1115}
1116 1116
1117/* Return ID of the base fontset named NAME. If there's no such 1117/* Return ID of the base fontset named NAME. If there's no such
1118 fontset, return -1. */ 1118 fontset, return -1. NAME_PATTERN specifies how to treat NAME as this:
1119 0: pattern containing '*' and '?' as wildcards
1120 1: regular expression
1121 2: literal fontset name
1122*/
1119 1123
1120int 1124int
1121fs_query_fontset (name, regexpp) 1125fs_query_fontset (name, name_pattern)
1122 Lisp_Object name; 1126 Lisp_Object name;
1123 int regexpp; 1127 int name_pattern;
1124{ 1128{
1125 Lisp_Object tem; 1129 Lisp_Object tem;
1126 int i; 1130 int i;
1127 1131
1128 name = Fdowncase (name); 1132 name = Fdowncase (name);
1129 if (!regexpp) 1133 if (name_pattern != 1)
1130 { 1134 {
1131 tem = Frassoc (name, Vfontset_alias_alist); 1135 tem = Frassoc (name, Vfontset_alias_alist);
1132 if (NILP (tem)) 1136 if (NILP (tem))
1133 tem = Fassoc (name, Vfontset_alias_alist); 1137 tem = Fassoc (name, Vfontset_alias_alist);
1134 if (CONSP (tem) && STRINGP (XCAR (tem))) 1138 if (CONSP (tem) && STRINGP (XCAR (tem)))
1135 name = XCAR (tem); 1139 name = XCAR (tem);
1136 else 1140 else if (name_pattern == 0)
1137 { 1141 {
1138 tem = fontset_pattern_regexp (name); 1142 tem = fontset_pattern_regexp (name);
1139 if (STRINGP (tem)) 1143 if (STRINGP (tem))
1140 { 1144 {
1141 name = tem; 1145 name = tem;
1142 regexpp = 1; 1146 name_pattern = 1;
1143 } 1147 }
1144 } 1148 }
1145 } 1149 }
@@ -1154,7 +1158,7 @@ fs_query_fontset (name, regexpp)
1154 continue; 1158 continue;
1155 1159
1156 this_name = FONTSET_NAME (fontset); 1160 this_name = FONTSET_NAME (fontset);
1157 if (regexpp 1161 if (name_pattern == 1
1158 ? fast_string_match (name, this_name) >= 0 1162 ? fast_string_match (name, this_name) >= 0
1159 : !strcmp (SDATA (name), SDATA (this_name))) 1163 : !strcmp (SDATA (name), SDATA (this_name)))
1160 return i; 1164 return i;
@@ -1284,7 +1288,11 @@ check_fontset_name (name)
1284 return Vdefault_fontset; 1288 return Vdefault_fontset;
1285 1289
1286 CHECK_STRING (name); 1290 CHECK_STRING (name);
1287 id = fs_query_fontset (name, 0); 1291 /* First try NAME as literal. */
1292 id = fs_query_fontset (name, 2);
1293 if (id < 0)
1294 /* For backward compatibility, try again NAME as pattern. */
1295 id = fs_query_fontset (name, 0);
1288 if (id < 0) 1296 if (id < 0)
1289 error ("Fontset `%s' does not exist", SDATA (name)); 1297 error ("Fontset `%s' does not exist", SDATA (name));
1290 return FONTSET_FROM_ID (id); 1298 return FONTSET_FROM_ID (id);
diff --git a/src/frame.c b/src/frame.c
index d7da02db278..ea60297a282 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4037,7 +4037,7 @@ is a reasonable practice. See also the variable `x-resource-name'. */);
4037 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist, 4037 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist,
4038 doc: /* Alist of default values for frame creation. 4038 doc: /* Alist of default values for frame creation.
4039These may be set in your init file, like this: 4039These may be set in your init file, like this:
4040 (setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1)) 4040 (setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1)))
4041These override values given in window system configuration data, 4041These override values given in window system configuration data,
4042 including X Windows' defaults database. 4042 including X Windows' defaults database.
4043For values specific to the first Emacs frame, see `initial-frame-alist'. 4043For values specific to the first Emacs frame, see `initial-frame-alist'.
diff --git a/src/fringe.c b/src/fringe.c
index ef4c7631e05..3de55b405cc 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -930,6 +930,7 @@ update_window_fringes (w, force_p)
930 if (force_p 930 if (force_p
931 || row->y != cur->y 931 || row->y != cur->y
932 || row->visible_height != cur->visible_height 932 || row->visible_height != cur->visible_height
933 || row->ends_at_zv_p != cur->ends_at_zv_p
933 || left != cur->left_fringe_bitmap 934 || left != cur->left_fringe_bitmap
934 || right != cur->right_fringe_bitmap 935 || right != cur->right_fringe_bitmap
935 || left_face_id != cur->left_fringe_face_id 936 || left_face_id != cur->left_fringe_face_id
@@ -953,6 +954,9 @@ update_window_fringes (w, force_p)
953 row->right_fringe_bitmap = right; 954 row->right_fringe_bitmap = right;
954 row->left_fringe_face_id = left_face_id; 955 row->left_fringe_face_id = left_face_id;
955 row->right_fringe_face_id = right_face_id; 956 row->right_fringe_face_id = right_face_id;
957
958 if (rn > 0 && row->redraw_fringe_bitmaps_p)
959 row[-1].redraw_fringe_bitmaps_p = cur[-1].redraw_fringe_bitmaps_p = 1;
956 } 960 }
957 961
958 return redraw_p; 962 return redraw_p;
@@ -1056,7 +1060,7 @@ compute_fringe_widths (f, redraw)
1056 1060
1057/* Free resources used by a user-defined bitmap. */ 1061/* Free resources used by a user-defined bitmap. */
1058 1062
1059int 1063void
1060destroy_fringe_bitmap (n) 1064destroy_fringe_bitmap (n)
1061 int n; 1065 int n;
1062{ 1066{
@@ -1367,7 +1371,6 @@ Return nil if POS is not visible in WINDOW. */)
1367 Lisp_Object pos, window; 1371 Lisp_Object pos, window;
1368{ 1372{
1369 struct window *w; 1373 struct window *w;
1370 struct buffer *old_buffer = NULL;
1371 struct glyph_row *row; 1374 struct glyph_row *row;
1372 int textpos; 1375 int textpos;
1373 1376
diff --git a/src/gtkutil.c b/src/gtkutil.c
index e1331891140..f5f05709e48 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1131,7 +1131,7 @@ enum
1131}; 1131};
1132 1132
1133#ifdef HAVE_GTK_FILE_BOTH 1133#ifdef HAVE_GTK_FILE_BOTH
1134static int use_old_gtk_file_dialog; 1134int use_old_gtk_file_dialog;
1135#endif 1135#endif
1136 1136
1137 1137
@@ -1178,8 +1178,24 @@ xg_get_file_with_chooser (f, prompt, default_filename, mustmatch_p, only_dir_p)
1178 1178
1179 1179
1180 if (default_filename) 1180 if (default_filename)
1181 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin), 1181 {
1182 default_filename); 1182 Lisp_Object file;
1183 struct gcpro gcpro1;
1184 GCPRO1 (file);
1185
1186 /* File chooser does not understand ~/... in the file name. It must be
1187 an absolute name starting with /. */
1188 if (default_filename[0] != '/')
1189 {
1190 file = Fexpand_file_name (build_string (default_filename), Qnil);
1191 default_filename = SDATA (file);
1192 }
1193
1194 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
1195 default_filename);
1196
1197 UNGCPRO;
1198 }
1183 1199
1184 gtk_widget_show (filewin); 1200 gtk_widget_show (filewin);
1185 1201
@@ -3538,14 +3554,6 @@ xg_initialize ()
3538 "gtk-key-theme-name", 3554 "gtk-key-theme-name",
3539 "Emacs", 3555 "Emacs",
3540 EMACS_CLASS); 3556 EMACS_CLASS);
3541
3542#ifdef HAVE_GTK_FILE_BOTH
3543 DEFVAR_BOOL ("use-old-gtk-file-dialog", &use_old_gtk_file_dialog,
3544 doc: /* *Non-nil means that the old GTK file selection dialog is used.
3545 If nil the new GTK file chooser is used instead. To turn off
3546 all file dialogs set the variable `use-file-dialog'. */);
3547 use_old_gtk_file_dialog = 0;
3548#endif
3549} 3557}
3550 3558
3551#endif /* USE_GTK */ 3559#endif /* USE_GTK */
diff --git a/src/gtkutil.h b/src/gtkutil.h
index b2e2c5f2fff..44e82885d7f 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -126,6 +126,10 @@ typedef struct _widget_value
126 struct _widget_value *free_list; 126 struct _widget_value *free_list;
127} widget_value; 127} widget_value;
128 128
129#ifdef HAVE_GTK_FILE_BOTH
130extern int use_old_gtk_file_dialog;
131#endif
132
129extern widget_value *malloc_widget_value P_ ((void)); 133extern widget_value *malloc_widget_value P_ ((void));
130extern void free_widget_value P_ ((widget_value *)); 134extern void free_widget_value P_ ((widget_value *));
131 135
diff --git a/src/intervals.h b/src/intervals.h
index a8b011f4d92..f55a68667f3 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -84,9 +84,14 @@ struct interval
84#define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \ 84#define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \
85 || STRINGP ((Lisp_Object){(EMACS_INT)(i)})) 85 || STRINGP ((Lisp_Object){(EMACS_INT)(i)}))
86#endif 86#endif
87
88#ifdef ENABLE_CHECKING
87#define NULL_INTERVAL_P(i) \ 89#define NULL_INTERVAL_P(i) \
88 (CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL) 90 (CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL)
89/* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */ 91/* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */
92#else
93#define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL)
94#endif
90 95
91/* True if this interval has no right child. */ 96/* True if this interval has no right child. */
92#define NULL_RIGHT_CHILD(i) ((i)->right == NULL_INTERVAL) 97#define NULL_RIGHT_CHILD(i) ((i)->right == NULL_INTERVAL)
@@ -289,6 +294,7 @@ extern INTERVAL balance_intervals P_ ((INTERVAL));
289extern INLINE void copy_intervals_to_string P_ ((Lisp_Object, struct buffer *, 294extern INLINE void copy_intervals_to_string P_ ((Lisp_Object, struct buffer *,
290 int, int)); 295 int, int));
291extern INTERVAL copy_intervals P_ ((INTERVAL, int, int)); 296extern INTERVAL copy_intervals P_ ((INTERVAL, int, int));
297extern int compare_string_intervals P_ ((Lisp_Object, Lisp_Object));
292extern Lisp_Object textget P_ ((Lisp_Object, Lisp_Object)); 298extern Lisp_Object textget P_ ((Lisp_Object, Lisp_Object));
293extern Lisp_Object lookup_char_property P_ ((Lisp_Object, Lisp_Object, int)); 299extern Lisp_Object lookup_char_property P_ ((Lisp_Object, Lisp_Object, int));
294extern void move_if_not_intangible P_ ((int)); 300extern void move_if_not_intangible P_ ((int));
diff --git a/src/keyboard.c b/src/keyboard.c
index 3360b11850e..c89a86eb80f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1840,6 +1840,14 @@ command_loop_1 ()
1840 1840
1841 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) 1841 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
1842 { 1842 {
1843 /* Setting transient-mark-mode to `only' is a way of
1844 turning it on for just one command. */
1845
1846 if (EQ (Vtransient_mark_mode, Qidentity))
1847 Vtransient_mark_mode = Qnil;
1848 if (EQ (Vtransient_mark_mode, Qonly))
1849 Vtransient_mark_mode = Qidentity;
1850
1843 if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode)) 1851 if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
1844 { 1852 {
1845 /* We could also call `deactivate'mark'. */ 1853 /* We could also call `deactivate'mark'. */
@@ -1855,16 +1863,6 @@ command_loop_1 ()
1855 call1 (Vrun_hooks, intern ("activate-mark-hook")); 1863 call1 (Vrun_hooks, intern ("activate-mark-hook"));
1856 } 1864 }
1857 1865
1858 /* Setting transient-mark-mode to `only' is a way of
1859 turning it on for just one command. */
1860 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
1861 {
1862 if (EQ (Vtransient_mark_mode, Qidentity))
1863 Vtransient_mark_mode = Qnil;
1864 if (EQ (Vtransient_mark_mode, Qonly))
1865 Vtransient_mark_mode = Qidentity;
1866 }
1867
1868 finalize: 1866 finalize:
1869 1867
1870 if (current_buffer == prev_buffer 1868 if (current_buffer == prev_buffer
@@ -3697,36 +3695,26 @@ kbd_buffer_store_event_hold (event, hold_quit)
3697 Discard the event if it would fill the last slot. */ 3695 Discard the event if it would fill the last slot. */
3698 if (kbd_fetch_ptr - 1 != kbd_store_ptr) 3696 if (kbd_fetch_ptr - 1 != kbd_store_ptr)
3699 { 3697 {
3698 *kbd_store_ptr = *event;
3699 ++kbd_store_ptr;
3700 }
3701}
3700 3702
3701#if 0 /* The SELECTION_REQUEST_EVENT case looks bogus, and it's error
3702 prone to assign individual members for other events, in case
3703 the input_event structure is changed. --2000-07-13, gerd. */
3704 struct input_event *sp = kbd_store_ptr;
3705 sp->kind = event->kind;
3706 if (event->kind == SELECTION_REQUEST_EVENT)
3707 {
3708 /* We must not use the ordinary copying code for this case,
3709 since `part' is an enum and copying it might not copy enough
3710 in this case. */
3711 bcopy (event, (char *) sp, sizeof (*event));
3712 }
3713 else
3714 3703
3715 { 3704/* Put an input event back in the head of the event queue. */
3716 sp->code = event->code;
3717 sp->part = event->part;
3718 sp->frame_or_window = event->frame_or_window;
3719 sp->arg = event->arg;
3720 sp->modifiers = event->modifiers;
3721 sp->x = event->x;
3722 sp->y = event->y;
3723 sp->timestamp = event->timestamp;
3724 }
3725#else
3726 *kbd_store_ptr = *event;
3727#endif
3728 3705
3729 ++kbd_store_ptr; 3706void
3707kbd_buffer_unget_event (event)
3708 register struct input_event *event;
3709{
3710 if (kbd_fetch_ptr == kbd_buffer)
3711 kbd_fetch_ptr = kbd_buffer + KBD_BUFFER_SIZE;
3712
3713 /* Don't let the very last slot in the buffer become full, */
3714 if (kbd_fetch_ptr - 1 != kbd_store_ptr)
3715 {
3716 --kbd_fetch_ptr;
3717 *kbd_fetch_ptr = *event;
3730 } 3718 }
3731} 3719}
3732 3720
@@ -3941,7 +3929,8 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
3941 /* These two kinds of events get special handling 3929 /* These two kinds of events get special handling
3942 and don't actually appear to the command loop. 3930 and don't actually appear to the command loop.
3943 We return nil for them. */ 3931 We return nil for them. */
3944 if (event->kind == SELECTION_REQUEST_EVENT) 3932 if (event->kind == SELECTION_REQUEST_EVENT
3933 || event->kind == SELECTION_CLEAR_EVENT)
3945 { 3934 {
3946#ifdef HAVE_X11 3935#ifdef HAVE_X11
3947 struct input_event copy; 3936 struct input_event copy;
@@ -3952,7 +3941,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
3952 copy = *event; 3941 copy = *event;
3953 kbd_fetch_ptr = event + 1; 3942 kbd_fetch_ptr = event + 1;
3954 input_pending = readable_events (0); 3943 input_pending = readable_events (0);
3955 x_handle_selection_request (&copy); 3944 x_handle_selection_event (&copy);
3956#else 3945#else
3957 /* We're getting selection request events, but we don't have 3946 /* We're getting selection request events, but we don't have
3958 a window system. */ 3947 a window system. */
@@ -3960,22 +3949,6 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
3960#endif 3949#endif
3961 } 3950 }
3962 3951
3963 else if (event->kind == SELECTION_CLEAR_EVENT)
3964 {
3965#ifdef HAVE_X11
3966 struct input_event copy;
3967
3968 /* Remove it from the buffer before processing it. */
3969 copy = *event;
3970 kbd_fetch_ptr = event + 1;
3971 input_pending = readable_events (0);
3972 x_handle_selection_clear (&copy);
3973#else
3974 /* We're getting selection request events, but we don't have
3975 a window system. */
3976 abort ();
3977#endif
3978 }
3979#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) 3952#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS)
3980 else if (event->kind == DELETE_WINDOW_EVENT) 3953 else if (event->kind == DELETE_WINDOW_EVENT)
3981 { 3954 {
@@ -4200,7 +4173,8 @@ swallow_events (do_display)
4200 4173
4201 /* These two kinds of events get special handling 4174 /* These two kinds of events get special handling
4202 and don't actually appear to the command loop. */ 4175 and don't actually appear to the command loop. */
4203 if (event->kind == SELECTION_REQUEST_EVENT) 4176 if (event->kind == SELECTION_REQUEST_EVENT
4177 || event->kind == SELECTION_CLEAR_EVENT)
4204 { 4178 {
4205#ifdef HAVE_X11 4179#ifdef HAVE_X11
4206 struct input_event copy; 4180 struct input_event copy;
@@ -4211,25 +4185,7 @@ swallow_events (do_display)
4211 copy = *event; 4185 copy = *event;
4212 kbd_fetch_ptr = event + 1; 4186 kbd_fetch_ptr = event + 1;
4213 input_pending = readable_events (0); 4187 input_pending = readable_events (0);
4214 x_handle_selection_request (&copy); 4188 x_handle_selection_event (&copy);
4215#else
4216 /* We're getting selection request events, but we don't have
4217 a window system. */
4218 abort ();
4219#endif
4220 }
4221
4222 else if (event->kind == SELECTION_CLEAR_EVENT)
4223 {
4224#ifdef HAVE_X11
4225 struct input_event copy;
4226
4227 /* Remove it from the buffer before processing it, */
4228 copy = *event;
4229
4230 kbd_fetch_ptr = event + 1;
4231 input_pending = readable_events (0);
4232 x_handle_selection_clear (&copy);
4233#else 4189#else
4234 /* We're getting selection request events, but we don't have 4190 /* We're getting selection request events, but we don't have
4235 a window system. */ 4191 a window system. */
@@ -6670,7 +6626,6 @@ read_avail_input (expected)
6670 6626
6671 if (read_socket_hook) 6627 if (read_socket_hook)
6672 { 6628 {
6673 int discard = 0;
6674 int nr; 6629 int nr;
6675 struct input_event hold_quit; 6630 struct input_event hold_quit;
6676 6631
@@ -11454,7 +11409,8 @@ mark_kboards ()
11454 { 11409 {
11455 if (event == kbd_buffer + KBD_BUFFER_SIZE) 11410 if (event == kbd_buffer + KBD_BUFFER_SIZE)
11456 event = kbd_buffer; 11411 event = kbd_buffer;
11457 if (event->kind != SELECTION_REQUEST_EVENT) 11412 if (event->kind != SELECTION_REQUEST_EVENT
11413 && event->kind != SELECTION_CLEAR_EVENT)
11458 { 11414 {
11459 mark_object (event->x); 11415 mark_object (event->x);
11460 mark_object (event->y); 11416 mark_object (event->y);
diff --git a/src/keyboard.h b/src/keyboard.h
index 08cb934d3fe..8df3a2452a7 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -330,6 +330,7 @@ extern int lucid_event_type_list_p P_ ((Lisp_Object));
330extern void kbd_buffer_store_event P_ ((struct input_event *)); 330extern void kbd_buffer_store_event P_ ((struct input_event *));
331extern void kbd_buffer_store_event_hold P_ ((struct input_event *, 331extern void kbd_buffer_store_event_hold P_ ((struct input_event *,
332 struct input_event *)); 332 struct input_event *));
333extern void kbd_buffer_unget_event P_ ((struct input_event *));
333#ifdef POLL_FOR_INPUT 334#ifdef POLL_FOR_INPUT
334extern void poll_for_input_1 P_ ((void)); 335extern void poll_for_input_1 P_ ((void));
335#endif 336#endif
diff --git a/src/keymap.c b/src/keymap.c
index 1711e7fbc36..1a86caff4c4 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -214,13 +214,13 @@ when reading a key-sequence to be looked-up in this keymap. */)
214 (map) 214 (map)
215 Lisp_Object map; 215 Lisp_Object map;
216{ 216{
217 map = get_keymap (map, 0, 0);
217 while (CONSP (map)) 218 while (CONSP (map))
218 { 219 {
219 register Lisp_Object tem; 220 Lisp_Object tem = XCAR (map);
220 tem = Fcar (map);
221 if (STRINGP (tem)) 221 if (STRINGP (tem))
222 return tem; 222 return tem;
223 map = Fcdr (map); 223 map = XCDR (map);
224 } 224 }
225 return Qnil; 225 return Qnil;
226} 226}
diff --git a/src/lisp.h b/src/lisp.h
index 19995c58f54..b49602c1303 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2302,6 +2302,7 @@ EXFUN (Felt, 2);
2302EXFUN (Fmember, 2); 2302EXFUN (Fmember, 2);
2303EXFUN (Frassq, 2); 2303EXFUN (Frassq, 2);
2304EXFUN (Fdelq, 2); 2304EXFUN (Fdelq, 2);
2305EXFUN (Fdelete, 2);
2305EXFUN (Fsort, 2); 2306EXFUN (Fsort, 2);
2306EXFUN (Freverse, 1); 2307EXFUN (Freverse, 1);
2307EXFUN (Fnreverse, 1); 2308EXFUN (Fnreverse, 1);
@@ -2386,6 +2387,7 @@ extern void adjust_after_replace P_ ((int, int, Lisp_Object, int, int));
2386extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int)); 2387extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int));
2387extern void adjust_after_insert P_ ((int, int, int, int, int)); 2388extern void adjust_after_insert P_ ((int, int, int, int, int));
2388extern void replace_range P_ ((int, int, Lisp_Object, int, int, int)); 2389extern void replace_range P_ ((int, int, Lisp_Object, int, int, int));
2390extern void replace_range_2 P_ ((int, int, int, int, char *, int, int, int));
2389extern void syms_of_insdel P_ ((void)); 2391extern void syms_of_insdel P_ ((void));
2390 2392
2391/* Defined in dispnew.c */ 2393/* Defined in dispnew.c */
@@ -3179,6 +3181,11 @@ extern void syms_of_xterm P_ ((void));
3179 3181
3180/* Defined in getloadavg.c */ 3182/* Defined in getloadavg.c */
3181extern int getloadavg P_ ((double [], int)); 3183extern int getloadavg P_ ((double [], int));
3184
3185#ifdef MSDOS
3186/* Defined in msdos.c */
3187EXFUN (Fmsdos_downcase_filename, 1);
3188#endif
3182 3189
3183/* Nonzero means Emacs has already been initialized. 3190/* Nonzero means Emacs has already been initialized.
3184 Used during startup to detect startup of dumped Emacs. */ 3191 Used during startup to detect startup of dumped Emacs. */
diff --git a/src/lread.c b/src/lread.c
index 0634a4c7c30..5e733f22a6d 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2581,9 +2581,9 @@ read1 (readcharfun, pch, first_in_list)
2581 2581
2582 if (next_char <= 040 2582 if (next_char <= 040
2583 || (next_char < 0200 2583 || (next_char < 0200
2584 && index ("\"';([#?", next_char) 2584 && (index ("\"';([#?", next_char)
2585 || (!first_in_list && next_char == '`') 2585 || (!first_in_list && next_char == '`')
2586 || (new_backquote_flag && next_char == ','))) 2586 || (new_backquote_flag && next_char == ','))))
2587 { 2587 {
2588 *pch = c; 2588 *pch = c;
2589 return Qnil; 2589 return Qnil;
@@ -3819,7 +3819,7 @@ init_lread ()
3819 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is 3819 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is
3820 almost never correct, thereby causing a warning to be printed out that 3820 almost never correct, thereby causing a warning to be printed out that
3821 confuses users. Since PATH_LOADSEARCH is always overridden by the 3821 confuses users. Since PATH_LOADSEARCH is always overridden by the
3822 EMACSLOADPATH environment variable below, disable the warning on NT. 3822 EMACSLOADPATH environment variable below, disable the warning on NT.
3823 Also, when using the "self-contained" option for Carbon Emacs for MacOSX, 3823 Also, when using the "self-contained" option for Carbon Emacs for MacOSX,
3824 the "standard" paths may not exist and would be overridden by 3824 the "standard" paths may not exist and would be overridden by
3825 EMACSLOADPATH as on NT. Since this depends on how the executable 3825 EMACSLOADPATH as on NT. Since this depends on how the executable
diff --git a/src/macros.c b/src/macros.c
index d0219a3be04..09ae87b0a59 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -392,7 +392,9 @@ syms_of_macros ()
392 defsubr (&Sstore_kbd_macro_event); 392 defsubr (&Sstore_kbd_macro_event);
393 393
394 DEFVAR_KBOARD ("defining-kbd-macro", defining_kbd_macro, 394 DEFVAR_KBOARD ("defining-kbd-macro", defining_kbd_macro,
395 doc: /* Non-nil while a keyboard macro is being defined. Don't set this! */); 395 doc: /* Non-nil while a keyboard macro is being defined. Don't set this!
396The value is the symbol `append' while appending to the definition of
397an existing macro. */);
396 398
397 DEFVAR_LISP ("executing-macro", &Vexecuting_macro, 399 DEFVAR_LISP ("executing-macro", &Vexecuting_macro,
398 doc: /* Currently executing keyboard macro (string or vector); nil if none executing. */); 400 doc: /* Currently executing keyboard macro (string or vector); nil if none executing. */);
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 5918e771399..bd8b3ba1e36 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -171,6 +171,9 @@ temacs: $(BLD) $(TEMACS)
171$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) 171$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES)
172 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS) 172 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
173 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 20 173 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 20
174 echo $(OBJ0) > $(BLD)/buildobj.lst
175 echo $(OBJ1) >> $(BLD)/buildobj.lst
176 echo $(WIN32OBJ) >> $(BLD)/buildobj.lst
174 177
175bootstrap: bootstrap-emacs 178bootstrap: bootstrap-emacs
176 179
diff --git a/src/msdos.c b/src/msdos.c
index 0020be310a6..f863984fac3 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -2320,7 +2320,7 @@ IT_set_frame_parameters (f, alist)
2320 2320
2321 /* If we are creating a new frame, begin with the original screen colors 2321 /* If we are creating a new frame, begin with the original screen colors
2322 used for the initial frame. */ 2322 used for the initial frame. */
2323 if (alist == Vdefault_frame_alist 2323 if (EQ (alist, Vdefault_frame_alist)
2324 && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1) 2324 && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1)
2325 { 2325 {
2326 FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0]; 2326 FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0];
diff --git a/src/print.c b/src/print.c
index 84625a89edd..3a21ef29560 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2183,6 +2183,15 @@ print_object (obj, printcharfun, escapeflag)
2183 PRINTCHAR ('>'); 2183 PRINTCHAR ('>');
2184 break; 2184 break;
2185 2185
2186 case Lisp_Misc_Save_Value:
2187 strout ("#<save_value ", -1, -1, printcharfun, 0);
2188 sprintf(buf, "ptr=0x%08lx int=%d",
2189 (unsigned long) XSAVE_VALUE (obj)->pointer,
2190 XSAVE_VALUE (obj)->integer);
2191 strout (buf, -1, -1, printcharfun, 0);
2192 PRINTCHAR ('>');
2193 break;
2194
2186 default: 2195 default:
2187 goto badtype; 2196 goto badtype;
2188 } 2197 }
diff --git a/src/process.c b/src/process.c
index 76967cd7ac2..699c99cdcb8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2723,7 +2723,6 @@ usage: (make-network-process &rest ARGS) */)
2723 int xerrno = 0; 2723 int xerrno = 0;
2724 int s = -1, outch, inch; 2724 int s = -1, outch, inch;
2725 struct gcpro gcpro1; 2725 struct gcpro gcpro1;
2726 int retry = 0;
2727 int count = SPECPDL_INDEX (); 2726 int count = SPECPDL_INDEX ();
2728 int count1; 2727 int count1;
2729 Lisp_Object QCaddress; /* one of QClocal or QCremote */ 2728 Lisp_Object QCaddress; /* one of QClocal or QCremote */
@@ -3024,6 +3023,8 @@ usage: (make-network-process &rest ARGS) */)
3024 { 3023 {
3025 int optn, optbits; 3024 int optn, optbits;
3026 3025
3026 retry_connect:
3027
3027 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); 3028 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol);
3028 if (s < 0) 3029 if (s < 0)
3029 { 3030 {
@@ -3102,8 +3103,6 @@ usage: (make-network-process &rest ARGS) */)
3102 break; 3103 break;
3103 } 3104 }
3104 3105
3105 retry_connect:
3106
3107 immediate_quit = 1; 3106 immediate_quit = 1;
3108 QUIT; 3107 QUIT;
3109 3108
@@ -3145,22 +3144,13 @@ usage: (make-network-process &rest ARGS) */)
3145 3144
3146 immediate_quit = 0; 3145 immediate_quit = 0;
3147 3146
3148 if (xerrno == EINTR)
3149 goto retry_connect;
3150 if (xerrno == EADDRINUSE && retry < 20)
3151 {
3152 /* A delay here is needed on some FreeBSD systems,
3153 and it is harmless, since this retrying takes time anyway
3154 and should be infrequent. */
3155 Fsleep_for (make_number (1), Qnil);
3156 retry++;
3157 goto retry_connect;
3158 }
3159
3160 /* Discard the unwind protect closing S. */ 3147 /* Discard the unwind protect closing S. */
3161 specpdl_ptr = specpdl + count1; 3148 specpdl_ptr = specpdl + count1;
3162 emacs_close (s); 3149 emacs_close (s);
3163 s = -1; 3150 s = -1;
3151
3152 if (xerrno == EINTR)
3153 goto retry_connect;
3164 } 3154 }
3165 3155
3166 if (s >= 0) 3156 if (s >= 0)
diff --git a/src/window.c b/src/window.c
index b6738457de4..976e2b505cf 100644
--- a/src/window.c
+++ b/src/window.c
@@ -204,7 +204,7 @@ static int window_initialized;
204Lisp_Object Qwindow_configuration_change_hook; 204Lisp_Object Qwindow_configuration_change_hook;
205Lisp_Object Vwindow_configuration_change_hook; 205Lisp_Object Vwindow_configuration_change_hook;
206 206
207/* Nonzero means scroll commands try to put point 207/* Non-nil means scroll commands try to put point
208 at the same screen height as previously. */ 208 at the same screen height as previously. */
209 209
210Lisp_Object Vscroll_preserve_screen_position; 210Lisp_Object Vscroll_preserve_screen_position;
@@ -4523,7 +4523,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4523 start = it.current.pos; 4523 start = it.current.pos;
4524 } 4524 }
4525 4525
4526 /* If scroll_preserve_screen_position is non-zero, we try to set 4526 /* If scroll_preserve_screen_position is non-nil, we try to set
4527 point in the same window line as it is now, so get that line. */ 4527 point in the same window line as it is now, so get that line. */
4528 if (!NILP (Vscroll_preserve_screen_position)) 4528 if (!NILP (Vscroll_preserve_screen_position))
4529 { 4529 {
diff --git a/src/xdisp.c b/src/xdisp.c
index 22f870d16ef..5498bbcde00 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16142,27 +16142,31 @@ pint2hrstr (buf, width, d)
16142 { 16142 {
16143 tenths = remainder / 100; 16143 tenths = remainder / 100;
16144 if (50 <= remainder % 100) 16144 if (50 <= remainder % 100)
16145 if (tenths < 9) 16145 {
16146 tenths++; 16146 if (tenths < 9)
16147 else 16147 tenths++;
16148 { 16148 else
16149 quotient++; 16149 {
16150 if (quotient == 10) 16150 quotient++;
16151 tenths = -1; 16151 if (quotient == 10)
16152 else 16152 tenths = -1;
16153 tenths = 0; 16153 else
16154 } 16154 tenths = 0;
16155 }
16156 }
16155 } 16157 }
16156 else 16158 else
16157 if (500 <= remainder) 16159 if (500 <= remainder)
16158 if (quotient < 999) 16160 {
16159 quotient++; 16161 if (quotient < 999)
16160 else 16162 quotient++;
16161 { 16163 else
16162 quotient = 1; 16164 {
16163 exponent++; 16165 quotient = 1;
16164 tenths = 0; 16166 exponent++;
16165 } 16167 tenths = 0;
16168 }
16169 }
16166 } 16170 }
16167 16171
16168 /* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */ 16172 /* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */
@@ -18455,7 +18459,7 @@ produce_image_glyph (it)
18455{ 18459{
18456 struct image *img; 18460 struct image *img;
18457 struct face *face; 18461 struct face *face;
18458 int face_ascent, glyph_ascent; 18462 int glyph_ascent;
18459 struct glyph_slice slice; 18463 struct glyph_slice slice;
18460 18464
18461 xassert (it->what == IT_IMAGE); 18465 xassert (it->what == IT_IMAGE);
@@ -18538,7 +18542,7 @@ produce_image_glyph (it)
18538 18542
18539#if 0 /* this breaks image tiling */ 18543#if 0 /* this breaks image tiling */
18540 /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */ 18544 /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */
18541 face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f); 18545 int face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f);
18542 if (face_ascent > it->ascent) 18546 if (face_ascent > it->ascent)
18543 it->ascent = it->phys_ascent = face_ascent; 18547 it->ascent = it->phys_ascent = face_ascent;
18544#endif 18548#endif
@@ -20558,19 +20562,20 @@ fast_find_position (w, charpos, hpos, vpos, x, y, stop)
20558 int past_end = 0; 20562 int past_end = 0;
20559 20563
20560 first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 20564 first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
20565 if (charpos < MATRIX_ROW_START_CHARPOS (first))
20566 {
20567 *x = first->x;
20568 *y = first->y;
20569 *hpos = 0;
20570 *vpos = MATRIX_ROW_VPOS (first, w->current_matrix);
20571 return 1;
20572 }
20573
20561 row = row_containing_pos (w, charpos, first, NULL, 0); 20574 row = row_containing_pos (w, charpos, first, NULL, 0);
20562 if (row == NULL) 20575 if (row == NULL)
20563 { 20576 {
20564 if (charpos < MATRIX_ROW_START_CHARPOS (first)) 20577 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
20565 { 20578 past_end = 1;
20566 *x = *y = *hpos = *vpos = 0;
20567 return 1;
20568 }
20569 else
20570 {
20571 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
20572 past_end = 1;
20573 }
20574 } 20579 }
20575 20580
20576 *x = row->x; 20581 *x = row->x;
@@ -21116,8 +21121,10 @@ note_mouse_highlight (f, x, y)
21116 /* Which window is that in? */ 21121 /* Which window is that in? */
21117 window = window_from_coordinates (f, x, y, &part, 0, 0, 1); 21122 window = window_from_coordinates (f, x, y, &part, 0, 0, 1);
21118 21123
21119 /* If we were displaying active text in another window, clear that. */ 21124 /* If we were displaying active text in another window, clear that.
21120 if (! EQ (window, dpyinfo->mouse_face_window)) 21125 Also clear if we move out of text area in same window. */
21126 if (! EQ (window, dpyinfo->mouse_face_window)
21127 || (part != ON_TEXT && !NILP (dpyinfo->mouse_face_window)))
21121 clear_mouse_face (dpyinfo); 21128 clear_mouse_face (dpyinfo);
21122 21129
21123 /* Not on a window -> return. */ 21130 /* Not on a window -> return. */
diff --git a/src/xfaces.c b/src/xfaces.c
index 19369353f5e..fc2cd6b0af4 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3511,8 +3511,8 @@ set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p)
3511 call into lisp. */ 3511 call into lisp. */
3512 3512
3513Lisp_Object 3513Lisp_Object
3514merge_face_heights (from, to, invalid, gcpro) 3514merge_face_heights (from, to, invalid)
3515 Lisp_Object from, to, invalid, gcpro; 3515 Lisp_Object from, to, invalid;
3516{ 3516{
3517 Lisp_Object result = invalid; 3517 Lisp_Object result = invalid;
3518 3518
@@ -3537,16 +3537,11 @@ merge_face_heights (from, to, invalid, gcpro)
3537 /* Call function with current height as argument. 3537 /* Call function with current height as argument.
3538 From is the new height. */ 3538 From is the new height. */
3539 Lisp_Object args[2]; 3539 Lisp_Object args[2];
3540 struct gcpro gcpro1;
3541
3542 GCPRO1 (gcpro);
3543 3540
3544 args[0] = from; 3541 args[0] = from;
3545 args[1] = to; 3542 args[1] = to;
3546 result = safe_call (2, args); 3543 result = safe_call (2, args);
3547 3544
3548 UNGCPRO;
3549
3550 /* Ensure that if TO was absolute, so is the result. */ 3545 /* Ensure that if TO was absolute, so is the result. */
3551 if (INTEGERP (to) && !INTEGERP (result)) 3546 if (INTEGERP (to) && !INTEGERP (result))
3552 result = invalid; 3547 result = invalid;
@@ -3599,8 +3594,7 @@ merge_face_vectors (f, from, to, named_merge_points)
3599 if (!UNSPECIFIEDP (from[i])) 3594 if (!UNSPECIFIEDP (from[i]))
3600 { 3595 {
3601 if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i])) 3596 if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i]))
3602 to[i] = merge_face_heights (from[i], to[i], to[i], 3597 to[i] = merge_face_heights (from[i], to[i], to[i]);
3603 named_merge_points);
3604 else 3598 else
3605 to[i] = from[i]; 3599 to[i] = from[i];
3606 } 3600 }
@@ -3627,11 +3621,16 @@ merge_named_face (f, face_name, to, named_merge_points)
3627 if (push_named_merge_point (&named_merge_point, 3621 if (push_named_merge_point (&named_merge_point,
3628 face_name, &named_merge_points)) 3622 face_name, &named_merge_points))
3629 { 3623 {
3624 struct gcpro gcpro1;
3630 Lisp_Object from[LFACE_VECTOR_SIZE]; 3625 Lisp_Object from[LFACE_VECTOR_SIZE];
3631 int ok = get_lface_attributes (f, face_name, from, 0); 3626 int ok = get_lface_attributes (f, face_name, from, 0);
3632 3627
3633 if (ok) 3628 if (ok)
3634 merge_face_vectors (f, from, to, named_merge_points); 3629 {
3630 GCPRO1 (named_merge_point.face_name);
3631 merge_face_vectors (f, from, to, named_merge_points);
3632 UNGCPRO;
3633 }
3635 3634
3636 return ok; 3635 return ok;
3637 } 3636 }
@@ -3722,8 +3721,7 @@ merge_face_ref (f, face_ref, to, err_msgs, named_merge_points)
3722 else if (EQ (keyword, QCheight)) 3721 else if (EQ (keyword, QCheight))
3723 { 3722 {
3724 Lisp_Object new_height = 3723 Lisp_Object new_height =
3725 merge_face_heights (value, to[LFACE_HEIGHT_INDEX], 3724 merge_face_heights (value, to[LFACE_HEIGHT_INDEX], Qnil);
3726 Qnil, Qnil);
3727 3725
3728 if (! NILP (new_height)) 3726 if (! NILP (new_height))
3729 to[LFACE_HEIGHT_INDEX] = new_height; 3727 to[LFACE_HEIGHT_INDEX] = new_height;
@@ -4110,7 +4108,7 @@ FRAME 0 means change the face on all frames, and change the default
4110 /* The default face must have an absolute size, 4108 /* The default face must have an absolute size,
4111 otherwise, we do a test merge with a random 4109 otherwise, we do a test merge with a random
4112 height to see if VALUE's ok. */ 4110 height to see if VALUE's ok. */
4113 : merge_face_heights (value, make_number (10), Qnil, Qnil)); 4111 : merge_face_heights (value, make_number (10), Qnil));
4114 4112
4115 if (!INTEGERP (test) || XINT (test) <= 0) 4113 if (!INTEGERP (test) || XINT (test) <= 0)
4116 signal_error ("Invalid face height", value); 4114 signal_error ("Invalid face height", value);
@@ -4824,7 +4822,7 @@ the result will be absolute, otherwise it will be relative. */)
4824 if (EQ (value1, Qunspecified)) 4822 if (EQ (value1, Qunspecified))
4825 return value2; 4823 return value2;
4826 else if (EQ (attribute, QCheight)) 4824 else if (EQ (attribute, QCheight))
4827 return merge_face_heights (value1, value2, value1, Qnil); 4825 return merge_face_heights (value1, value2, value1);
4828 else 4826 else
4829 return value1; 4827 return value1;
4830} 4828}
diff --git a/src/xfns.c b/src/xfns.c
index 8ddb29310df..46bce6536c8 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5541,6 +5541,14 @@ Chinese, Japanese, and Korean. */);
5541 Fprovide (intern ("x-toolkit"), Qnil); 5541 Fprovide (intern ("x-toolkit"), Qnil);
5542 Fprovide (intern ("gtk"), Qnil); 5542 Fprovide (intern ("gtk"), Qnil);
5543 5543
5544#ifdef HAVE_GTK_FILE_BOTH
5545 DEFVAR_BOOL ("use-old-gtk-file-dialog", &use_old_gtk_file_dialog,
5546 doc: /* *Non-nil means that the old GTK file selection dialog is used.
5547If nil the new GTK file chooser is used instead. To turn off
5548all file dialogs set the variable `use-file-dialog'. */);
5549 use_old_gtk_file_dialog = 0;
5550#endif
5551
5544 DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string, 5552 DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
5545 doc: /* Version info for GTK+. */); 5553 doc: /* Version info for GTK+. */);
5546 { 5554 {
diff --git a/src/xmenu.c b/src/xmenu.c
index 0da826e4cb0..f7e24e66838 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -115,7 +115,7 @@ extern XtAppContext Xt_app_con;
115 115
116static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); 116static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **));
117static void popup_get_selection P_ ((XEvent *, struct x_display_info *, 117static void popup_get_selection P_ ((XEvent *, struct x_display_info *,
118 LWLIB_ID, int)); 118 LWLIB_ID, int, int));
119 119
120/* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ 120/* Define HAVE_BOXES if menus can handle radio and toggle buttons. */
121 121
@@ -157,6 +157,8 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
157static void list_of_panes P_ ((Lisp_Object)); 157static void list_of_panes P_ ((Lisp_Object));
158static void list_of_items P_ ((Lisp_Object)); 158static void list_of_items P_ ((Lisp_Object));
159 159
160extern EMACS_TIME timer_check P_ ((int));
161
160 162
161/* This holds a Lisp vector that holds the results of decoding 163/* This holds a Lisp vector that holds the results of decoding
162 the keymaps or alist-of-alists that specify a menu. 164 the keymaps or alist-of-alists that specify a menu.
@@ -1120,7 +1122,6 @@ on the left of the dialog box and all following items on the right.
1120 popped down (deactivated). This is used for x-popup-menu 1122 popped down (deactivated). This is used for x-popup-menu
1121 and x-popup-dialog; it is not used for the menu bar. 1123 and x-popup-dialog; it is not used for the menu bar.
1122 1124
1123 If DO_TIMERS is nonzero, run timers.
1124 If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed. 1125 If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed.
1125 1126
1126 NOTE: All calls to popup_get_selection should be protected 1127 NOTE: All calls to popup_get_selection should be protected
@@ -1128,17 +1129,22 @@ on the left of the dialog box and all following items on the right.
1128 1129
1129#ifdef USE_X_TOOLKIT 1130#ifdef USE_X_TOOLKIT
1130static void 1131static void
1131popup_get_selection (initial_event, dpyinfo, id, down_on_keypress) 1132popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress)
1132 XEvent *initial_event; 1133 XEvent *initial_event;
1133 struct x_display_info *dpyinfo; 1134 struct x_display_info *dpyinfo;
1134 LWLIB_ID id; 1135 LWLIB_ID id;
1136 int do_timers;
1135 int down_on_keypress; 1137 int down_on_keypress;
1136{ 1138{
1137 XEvent event; 1139 XEvent event;
1138 1140
1139 while (popup_activated_flag) 1141 while (popup_activated_flag)
1140 { 1142 {
1141 if (initial_event) 1143 /* If we have no events to run, consider timers. */
1144 if (do_timers && !XtAppPending (Xt_app_con))
1145 timer_check (1);
1146
1147 if (initial_event)
1142 { 1148 {
1143 event = *initial_event; 1149 event = *initial_event;
1144 initial_event = 0; 1150 initial_event = 0;
@@ -2484,7 +2490,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
2484 popup_activated_flag = 1; 2490 popup_activated_flag = 1;
2485 2491
2486 /* Process events that apply to the menu. */ 2492 /* Process events that apply to the menu. */
2487 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0); 2493 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0, 0);
2488 2494
2489 /* fp turned off the following statement and wrote a comment 2495 /* fp turned off the following statement and wrote a comment
2490 that it is unnecessary--that the menu has already disappeared. 2496 that it is unnecessary--that the menu has already disappeared.
@@ -2878,7 +2884,8 @@ create_and_show_dialog (f, first_wv)
2878 Fcons (make_number (dialog_id >> (fact)), 2884 Fcons (make_number (dialog_id >> (fact)),
2879 make_number (dialog_id & ~(-1 << (fact))))); 2885 make_number (dialog_id & ~(-1 << (fact)))));
2880 2886
2881 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id, 1); 2887 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f),
2888 dialog_id, 1, 1);
2882 2889
2883 unbind_to (count, Qnil); 2890 unbind_to (count, Qnil);
2884 } 2891 }
diff --git a/src/xselect.c b/src/xselect.c
index 35f4586b754..c89347be2cd 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -24,6 +24,14 @@ Boston, MA 02111-1307, USA. */
24 24
25#include <config.h> 25#include <config.h>
26#include <stdio.h> /* termhooks.h needs this */ 26#include <stdio.h> /* termhooks.h needs this */
27
28#ifdef HAVE_SYS_TYPES_H
29#include <sys/types.h>
30#endif
31#ifdef HAVE_UNISTD_H
32#include <unistd.h>
33#endif
34
27#include "lisp.h" 35#include "lisp.h"
28#include "xterm.h" /* for all of the X includes */ 36#include "xterm.h" /* for all of the X includes */
29#include "dispextern.h" /* frame.h seems to want this */ 37#include "dispextern.h" /* frame.h seems to want this */
@@ -32,6 +40,7 @@ Boston, MA 02111-1307, USA. */
32#include "buffer.h" 40#include "buffer.h"
33#include "process.h" 41#include "process.h"
34#include "termhooks.h" 42#include "termhooks.h"
43#include "keyboard.h"
35 44
36#include <X11/Xproto.h> 45#include <X11/Xproto.h>
37 46
@@ -85,10 +94,13 @@ static void initialize_cut_buffers P_ ((Display *, Window));
85 fprintf (stderr, "%d: " fmt "\n", getpid (), a0) 94 fprintf (stderr, "%d: " fmt "\n", getpid (), a0)
86#define TRACE2(fmt, a0, a1) \ 95#define TRACE2(fmt, a0, a1) \
87 fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1) 96 fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1)
97#define TRACE3(fmt, a0, a1, a2) \
98 fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1, a2)
88#else 99#else
89#define TRACE0(fmt) (void) 0 100#define TRACE0(fmt) (void) 0
90#define TRACE1(fmt, a0) (void) 0 101#define TRACE1(fmt, a0) (void) 0
91#define TRACE2(fmt, a0, a1) (void) 0 102#define TRACE2(fmt, a0, a1) (void) 0
103#define TRACE3(fmt, a0, a1) (void) 0
92#endif 104#endif
93 105
94 106
@@ -168,6 +180,89 @@ static void lisp_data_to_selection_data ();
168static Lisp_Object selection_data_to_lisp_data (); 180static Lisp_Object selection_data_to_lisp_data ();
169static Lisp_Object x_get_window_property_as_lisp_data (); 181static Lisp_Object x_get_window_property_as_lisp_data ();
170 182
183
184
185/* Define a queue to save up SELECTION_REQUEST_EVENT events for later
186 handling. */
187
188struct selection_event_queue
189 {
190 struct input_event event;
191 struct selection_event_queue *next;
192 };
193
194static struct selection_event_queue *selection_queue;
195
196/* Nonzero means queue up SELECTION_REQUEST_EVENT events. */
197
198static int x_queue_selection_requests;
199
200/* Queue up an SELECTION_REQUEST_EVENT *EVENT, to be processed later. */
201
202static void
203x_queue_event (event)
204 struct input_event *event;
205{
206 struct selection_event_queue *queue_tmp;
207
208 /* Don't queue repeated requests.
209 This only happens for large requests which uses the incremental protocol. */
210 for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next)
211 {
212 if (!bcmp (&queue_tmp->event, event, sizeof (*event)))
213 {
214 TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp);
215 x_decline_selection_request (event);
216 return;
217 }
218 }
219
220 queue_tmp
221 = (struct selection_event_queue *) xmalloc (sizeof (struct selection_event_queue));
222
223 if (queue_tmp != NULL)
224 {
225 TRACE1 ("QUEUE SELECTION EVENT %08lx", (unsigned long)queue_tmp);
226 queue_tmp->event = *event;
227 queue_tmp->next = selection_queue;
228 selection_queue = queue_tmp;
229 }
230}
231
232/* Start queuing SELECTION_REQUEST_EVENT events. */
233
234static void
235x_start_queuing_selection_requests ()
236{
237 if (x_queue_selection_requests)
238 abort ();
239
240 x_queue_selection_requests++;
241 TRACE1 ("x_start_queuing_selection_requests %d", x_queue_selection_requests);
242}
243
244/* Stop queuing SELECTION_REQUEST_EVENT events. */
245
246static void
247x_stop_queuing_selection_requests ()
248{
249 TRACE1 ("x_stop_queuing_selection_requests %d", x_queue_selection_requests);
250 --x_queue_selection_requests;
251
252 /* Take all the queued events and put them back
253 so that they get processed afresh. */
254
255 while (selection_queue != NULL)
256 {
257 struct selection_event_queue *queue_tmp = selection_queue;
258 TRACE1 ("RESTORE SELECTION EVENT %08lx", (unsigned long)queue_tmp);
259 kbd_buffer_unget_event (&queue_tmp->event);
260 selection_queue = queue_tmp->next;
261 xfree ((char *)queue_tmp);
262 }
263}
264
265
171/* This converts a Lisp symbol to a server Atom, avoiding a server 266/* This converts a Lisp symbol to a server Atom, avoiding a server
172 roundtrip whenever possible. */ 267 roundtrip whenever possible. */
173 268
@@ -557,13 +652,10 @@ static struct prop_location *property_change_reply_object;
557static struct prop_location *property_change_wait_list; 652static struct prop_location *property_change_wait_list;
558 653
559static Lisp_Object 654static Lisp_Object
560queue_selection_requests_unwind (frame) 655queue_selection_requests_unwind (tem)
561 Lisp_Object frame; 656 Lisp_Object tem;
562{ 657{
563 FRAME_PTR f = XFRAME (frame); 658 x_stop_queuing_selection_requests ();
564
565 if (! NILP (frame))
566 x_stop_queuing_selection_requests (FRAME_X_DISPLAY (f));
567 return Qnil; 659 return Qnil;
568} 660}
569 661
@@ -623,6 +715,17 @@ x_reply_selection_request (event, format, data, size, type)
623 BLOCK_INPUT; 715 BLOCK_INPUT;
624 count = x_catch_errors (display); 716 count = x_catch_errors (display);
625 717
718#ifdef TRACE_SELECTION
719 {
720 static int cnt;
721 char *sel = XGetAtomName (display, reply.selection);
722 char *tgt = XGetAtomName (display, reply.target);
723 TRACE3 ("%s, target %s (%d)", sel, tgt, ++cnt);
724 if (sel) XFree (sel);
725 if (tgt) XFree (tgt);
726 }
727#endif /* TRACE_SELECTION */
728
626 /* Store the data on the requested property. 729 /* Store the data on the requested property.
627 If the selection is large, only store the first N bytes of it. 730 If the selection is large, only store the first N bytes of it.
628 */ 731 */
@@ -650,10 +753,10 @@ x_reply_selection_request (event, format, data, size, type)
650 bother trying to queue them. */ 753 bother trying to queue them. */
651 if (!NILP (frame)) 754 if (!NILP (frame))
652 { 755 {
653 x_start_queuing_selection_requests (display); 756 x_start_queuing_selection_requests ();
654 757
655 record_unwind_protect (queue_selection_requests_unwind, 758 record_unwind_protect (queue_selection_requests_unwind,
656 frame); 759 Qnil);
657 } 760 }
658 761
659 if (x_window_to_frame (dpyinfo, window)) /* #### debug */ 762 if (x_window_to_frame (dpyinfo, window)) /* #### debug */
@@ -687,6 +790,8 @@ x_reply_selection_request (event, format, data, size, type)
687 XGetAtomName (display, reply.property)); 790 XGetAtomName (display, reply.property));
688 wait_for_property_change (wait_object); 791 wait_for_property_change (wait_object);
689 } 792 }
793 else
794 unexpect_property_change (wait_object);
690 795
691 TRACE0 ("Got ACK"); 796 TRACE0 ("Got ACK");
692 while (bytes_remaining) 797 while (bytes_remaining)
@@ -760,7 +865,7 @@ x_reply_selection_request (event, format, data, size, type)
760/* Handle a SelectionRequest event EVENT. 865/* Handle a SelectionRequest event EVENT.
761 This is called from keyboard.c when such an event is found in the queue. */ 866 This is called from keyboard.c when such an event is found in the queue. */
762 867
763void 868static void
764x_handle_selection_request (event) 869x_handle_selection_request (event)
765 struct input_event *event; 870 struct input_event *event;
766{ 871{
@@ -775,6 +880,10 @@ x_handle_selection_request (event)
775 struct x_display_info *dpyinfo 880 struct x_display_info *dpyinfo
776 = x_display_info_for_display (SELECTION_EVENT_DISPLAY (event)); 881 = x_display_info_for_display (SELECTION_EVENT_DISPLAY (event));
777 882
883 TRACE2 ("x_handle_selection_request, from=0x%08lx time=%lu",
884 (unsigned long) SELECTION_EVENT_REQUESTOR (event),
885 (unsigned long) SELECTION_EVENT_TIME (event));
886
778 local_selection_data = Qnil; 887 local_selection_data = Qnil;
779 target_symbol = Qnil; 888 target_symbol = Qnil;
780 converted_selection = Qnil; 889 converted_selection = Qnil;
@@ -869,7 +978,7 @@ x_handle_selection_request (event)
869 client cleared out our previously asserted selection. 978 client cleared out our previously asserted selection.
870 This is called from keyboard.c when such an event is found in the queue. */ 979 This is called from keyboard.c when such an event is found in the queue. */
871 980
872void 981static void
873x_handle_selection_clear (event) 982x_handle_selection_clear (event)
874 struct input_event *event; 983 struct input_event *event;
875{ 984{
@@ -882,6 +991,8 @@ x_handle_selection_clear (event)
882 struct x_display_info *dpyinfo = x_display_info_for_display (display); 991 struct x_display_info *dpyinfo = x_display_info_for_display (display);
883 struct x_display_info *t_dpyinfo; 992 struct x_display_info *t_dpyinfo;
884 993
994 TRACE0 ("x_handle_selection_clear");
995
885 /* If the new selection owner is also Emacs, 996 /* If the new selection owner is also Emacs,
886 don't clear the new selection. */ 997 don't clear the new selection. */
887 BLOCK_INPUT; 998 BLOCK_INPUT;
@@ -950,6 +1061,24 @@ x_handle_selection_clear (event)
950 } 1061 }
951} 1062}
952 1063
1064void
1065x_handle_selection_event (event)
1066 struct input_event *event;
1067{
1068 TRACE0 ("x_handle_selection_event");
1069
1070 if (event->kind == SELECTION_REQUEST_EVENT)
1071 {
1072 if (x_queue_selection_requests)
1073 x_queue_event (event);
1074 else
1075 x_handle_selection_request (event);
1076 }
1077 else
1078 x_handle_selection_clear (event);
1079}
1080
1081
953/* Clear all selections that were made from frame F. 1082/* Clear all selections that were made from frame F.
954 We do this when about to delete a frame. */ 1083 We do this when about to delete a frame. */
955 1084
@@ -1080,12 +1209,14 @@ unexpect_property_change (location)
1080/* Remove the property change expectation element for IDENTIFIER. */ 1209/* Remove the property change expectation element for IDENTIFIER. */
1081 1210
1082static Lisp_Object 1211static Lisp_Object
1083wait_for_property_change_unwind (identifierval) 1212wait_for_property_change_unwind (loc)
1084 Lisp_Object identifierval; 1213 Lisp_Object loc;
1085{ 1214{
1086 unexpect_property_change ((struct prop_location *) 1215 struct prop_location *location = XSAVE_VALUE (loc)->pointer;
1087 (XFASTINT (XCAR (identifierval)) << 16 1216
1088 | XFASTINT (XCDR (identifierval)))); 1217 unexpect_property_change (location);
1218 if (location == property_change_reply_object)
1219 property_change_reply_object = 0;
1089 return Qnil; 1220 return Qnil;
1090} 1221}
1091 1222
@@ -1098,18 +1229,17 @@ wait_for_property_change (location)
1098{ 1229{
1099 int secs, usecs; 1230 int secs, usecs;
1100 int count = SPECPDL_INDEX (); 1231 int count = SPECPDL_INDEX ();
1101 Lisp_Object tem;
1102 1232
1103 tem = Fcons (Qnil, Qnil); 1233 if (property_change_reply_object)
1104 XSETCARFASTINT (tem, (EMACS_UINT)location >> 16); 1234 abort ();
1105 XSETCDRFASTINT (tem, (EMACS_UINT)location & 0xffff);
1106 1235
1107 /* Make sure to do unexpect_property_change if we quit or err. */ 1236 /* Make sure to do unexpect_property_change if we quit or err. */
1108 record_unwind_protect (wait_for_property_change_unwind, tem); 1237 record_unwind_protect (wait_for_property_change_unwind,
1238 make_save_value (location, 0));
1109 1239
1110 XSETCAR (property_change_reply, Qnil); 1240 XSETCAR (property_change_reply, Qnil);
1111
1112 property_change_reply_object = location; 1241 property_change_reply_object = location;
1242
1113 /* If the event we are waiting for arrives beyond here, it will set 1243 /* If the event we are waiting for arrives beyond here, it will set
1114 property_change_reply, because property_change_reply_object says so. */ 1244 property_change_reply, because property_change_reply_object says so. */
1115 if (! location->arrived) 1245 if (! location->arrived)
@@ -1140,7 +1270,8 @@ x_handle_property_notify (event)
1140 1270
1141 while (rest) 1271 while (rest)
1142 { 1272 {
1143 if (rest->property == event->atom 1273 if (!rest->arrived
1274 && rest->property == event->atom
1144 && rest->window == event->window 1275 && rest->window == event->window
1145 && rest->display == event->display 1276 && rest->display == event->display
1146 && rest->desired_state == event->state) 1277 && rest->desired_state == event->state)
@@ -1156,11 +1287,6 @@ x_handle_property_notify (event)
1156 if (rest == property_change_reply_object) 1287 if (rest == property_change_reply_object)
1157 XSETCAR (property_change_reply, Qt); 1288 XSETCAR (property_change_reply, Qt);
1158 1289
1159 if (prev)
1160 prev->next = rest->next;
1161 else
1162 property_change_wait_list = rest->next;
1163 xfree (rest);
1164 return; 1290 return;
1165 } 1291 }
1166 1292
@@ -1286,10 +1412,10 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1286 bother trying to queue them. */ 1412 bother trying to queue them. */
1287 if (!NILP (frame)) 1413 if (!NILP (frame))
1288 { 1414 {
1289 x_start_queuing_selection_requests (display); 1415 x_start_queuing_selection_requests ();
1290 1416
1291 record_unwind_protect (queue_selection_requests_unwind, 1417 record_unwind_protect (queue_selection_requests_unwind,
1292 frame); 1418 Qnil);
1293 } 1419 }
1294 UNBLOCK_INPUT; 1420 UNBLOCK_INPUT;
1295 1421
@@ -1445,10 +1571,10 @@ receive_incremental_selection (display, window, property, target_type,
1445 BLOCK_INPUT; 1571 BLOCK_INPUT;
1446 XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask); 1572 XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask);
1447 TRACE1 (" Delete property %s", 1573 TRACE1 (" Delete property %s",
1448 XSYMBOL (x_atom_to_symbol (display, property))->name->data); 1574 SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property))));
1449 XDeleteProperty (display, window, property); 1575 XDeleteProperty (display, window, property);
1450 TRACE1 (" Expect new value of property %s", 1576 TRACE1 (" Expect new value of property %s",
1451 XSYMBOL (x_atom_to_symbol (display, property))->name->data); 1577 SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property))));
1452 wait_object = expect_property_change (display, window, property, 1578 wait_object = expect_property_change (display, window, property,
1453 PropertyNewValue); 1579 PropertyNewValue);
1454 XFlush (display); 1580 XFlush (display);
@@ -1478,7 +1604,6 @@ receive_incremental_selection (display, window, property, target_type,
1478 1604
1479 if (! waiting_for_other_props_on_window (display, window)) 1605 if (! waiting_for_other_props_on_window (display, window))
1480 XSelectInput (display, window, STANDARD_EVENT_SET); 1606 XSelectInput (display, window, STANDARD_EVENT_SET);
1481 unexpect_property_change (wait_object);
1482 /* Use xfree, not XFree, because x_get_window_property 1607 /* Use xfree, not XFree, because x_get_window_property
1483 calls xmalloc itself. */ 1608 calls xmalloc itself. */
1484 if (tmp_data) xfree (tmp_data); 1609 if (tmp_data) xfree (tmp_data);
diff --git a/src/xterm.c b/src/xterm.c
index 9b5d768b2af..c8c5d6e95c4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5581,73 +5581,6 @@ x_scroll_bar_clear (f)
5581} 5581}
5582 5582
5583 5583
5584/* Define a queue to save up SelectionRequest events for later handling. */
5585
5586struct selection_event_queue
5587 {
5588 XEvent event;
5589 struct selection_event_queue *next;
5590 };
5591
5592static struct selection_event_queue *queue;
5593
5594/* Nonzero means queue up certain events--don't process them yet. */
5595
5596static int x_queue_selection_requests;
5597
5598/* Queue up an X event *EVENT, to be processed later. */
5599
5600static void
5601x_queue_event (f, event)
5602 FRAME_PTR f;
5603 XEvent *event;
5604{
5605 struct selection_event_queue *queue_tmp
5606 = (struct selection_event_queue *) xmalloc (sizeof (struct selection_event_queue));
5607
5608 if (queue_tmp != NULL)
5609 {
5610 queue_tmp->event = *event;
5611 queue_tmp->next = queue;
5612 queue = queue_tmp;
5613 }
5614}
5615
5616/* Take all the queued events and put them back
5617 so that they get processed afresh. */
5618
5619static void
5620x_unqueue_events (display)
5621 Display *display;
5622{
5623 while (queue != NULL)
5624 {
5625 struct selection_event_queue *queue_tmp = queue;
5626 XPutBackEvent (display, &queue_tmp->event);
5627 queue = queue_tmp->next;
5628 xfree ((char *)queue_tmp);
5629 }
5630}
5631
5632/* Start queuing SelectionRequest events. */
5633
5634void
5635x_start_queuing_selection_requests (display)
5636 Display *display;
5637{
5638 x_queue_selection_requests++;
5639}
5640
5641/* Stop queuing SelectionRequest events. */
5642
5643void
5644x_stop_queuing_selection_requests (display)
5645 Display *display;
5646{
5647 x_queue_selection_requests--;
5648 x_unqueue_events (display);
5649}
5650
5651/* The main X event-reading loop - XTread_socket. */ 5584/* The main X event-reading loop - XTread_socket. */
5652 5585
5653#if 0 5586#if 0
@@ -6025,11 +5958,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6025 if (!x_window_to_frame (dpyinfo, event.xselectionrequest.owner)) 5958 if (!x_window_to_frame (dpyinfo, event.xselectionrequest.owner))
6026 goto OTHER; 5959 goto OTHER;
6027#endif /* USE_X_TOOLKIT */ 5960#endif /* USE_X_TOOLKIT */
6028 if (x_queue_selection_requests) 5961 {
6029 x_queue_event (x_window_to_frame (dpyinfo, event.xselectionrequest.owner),
6030 &event);
6031 else
6032 {
6033 XSelectionRequestEvent *eventp 5962 XSelectionRequestEvent *eventp
6034 = (XSelectionRequestEvent *) &event; 5963 = (XSelectionRequestEvent *) &event;
6035 5964
@@ -6041,7 +5970,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6041 SELECTION_EVENT_PROPERTY (&inev) = eventp->property; 5970 SELECTION_EVENT_PROPERTY (&inev) = eventp->property;
6042 SELECTION_EVENT_TIME (&inev) = eventp->time; 5971 SELECTION_EVENT_TIME (&inev) = eventp->time;
6043 inev.frame_or_window = Qnil; 5972 inev.frame_or_window = Qnil;
6044 } 5973 }
6045 break; 5974 break;
6046 5975
6047 case PropertyNotify: 5976 case PropertyNotify:
@@ -7626,7 +7555,11 @@ x_catch_errors_unwind (old_val)
7626 /* The display may have been closed before this function is called. 7555 /* The display may have been closed before this function is called.
7627 Check if it is still open before calling XSync. */ 7556 Check if it is still open before calling XSync. */
7628 if (x_display_info_for_display (dpy) != 0) 7557 if (x_display_info_for_display (dpy) != 0)
7629 XSync (dpy, False); 7558 {
7559 BLOCK_INPUT;
7560 XSync (dpy, False);
7561 UNBLOCK_INPUT;
7562 }
7630 7563
7631 x_error_message_string = XCDR (old_val); 7564 x_error_message_string = XCDR (old_val);
7632 return Qnil; 7565 return Qnil;
diff --git a/src/xterm.h b/src/xterm.h
index 4e38ac18e3d..ffd7e31f297 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -52,7 +52,7 @@ typedef GtkWidget *xt_or_gtk_widget;
52#undef XSync 52#undef XSync
53#define XSync(d, b) do { gdk_window_process_all_updates (); \ 53#define XSync(d, b) do { gdk_window_process_all_updates (); \
54 XSync (d, b); } while (0) 54 XSync (d, b); } while (0)
55 55
56 56
57#endif /* USE_GTK */ 57#endif /* USE_GTK */
58 58
@@ -976,8 +976,6 @@ int x_alloc_nearest_color P_ ((struct frame *, Colormap, XColor *));
976 976
977extern void cancel_mouse_face P_ ((struct frame *)); 977extern void cancel_mouse_face P_ ((struct frame *));
978extern void x_scroll_bar_clear P_ ((struct frame *)); 978extern void x_scroll_bar_clear P_ ((struct frame *));
979extern void x_start_queuing_selection_requests P_ ((Display *));
980extern void x_stop_queuing_selection_requests P_ ((Display *));
981extern int x_text_icon P_ ((struct frame *, char *)); 979extern int x_text_icon P_ ((struct frame *, char *));
982extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); 980extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
983extern int x_catch_errors P_ ((Display *)); 981extern int x_catch_errors P_ ((Display *));
@@ -1013,8 +1011,7 @@ extern int x_dispatch_event P_ ((XEvent *, Display *));
1013 1011
1014extern void x_handle_property_notify P_ ((XPropertyEvent *)); 1012extern void x_handle_property_notify P_ ((XPropertyEvent *));
1015extern void x_handle_selection_notify P_ ((XSelectionEvent *)); 1013extern void x_handle_selection_notify P_ ((XSelectionEvent *));
1016extern void x_handle_selection_request P_ ((struct input_event *)); 1014extern void x_handle_selection_event P_ ((struct input_event *));
1017extern void x_handle_selection_clear P_ ((struct input_event *));
1018extern void x_clear_frame_selections P_ ((struct frame *)); 1015extern void x_clear_frame_selections P_ ((struct frame *));
1019 1016
1020extern int x_handle_dnd_message P_ ((struct frame *, 1017extern int x_handle_dnd_message P_ ((struct frame *,