aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--Makefile.in24
-rw-r--r--admin/FOR-RELEASE103
-rw-r--r--config.bat20
-rw-r--r--etc/NEWS21
-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/ChangeLog422
-rw-r--r--lisp/ChangeLog.101
-rw-r--r--lisp/ChangeLog.721
-rw-r--r--lisp/Makefile.in5
-rw-r--r--lisp/calc/calc-aent.el475
-rw-r--r--lisp/calc/calc-comb.el68
-rw-r--r--lisp/calc/calc-ext.el114
-rw-r--r--lisp/calc/calc-forms.el6
-rw-r--r--lisp/calc/calc-graph.el688
-rw-r--r--lisp/calc/calc-lang.el40
-rw-r--r--lisp/calc/calc-poly.el2
-rw-r--r--lisp/calc/calc-rewr.el40
-rw-r--r--lisp/calc/calc-vec.el104
-rw-r--r--lisp/calc/calc.el201
-rw-r--r--lisp/calc/calcalg2.el12
-rw-r--r--lisp/calendar/diary-lib.el37
-rw-r--r--lisp/cvs-status.el32
-rw-r--r--lisp/descr-text.el5
-rw-r--r--lisp/desktop.el50
-rw-r--r--lisp/ebuff-menu.el21
-rw-r--r--lisp/emacs-lisp/byte-opt.el7
-rw-r--r--lisp/emacs-lisp/bytecomp.el58
-rw-r--r--lisp/emacs-lisp/easymenu.el35
-rw-r--r--lisp/emacs-lisp/elp.el1
-rw-r--r--lisp/files.el68
-rw-r--r--lisp/filesets.el7
-rw-r--r--lisp/font-lock.el12
-rw-r--r--lisp/gnus/ChangeLog14
-rw-r--r--lisp/gnus/gnus-art.el98
-rw-r--r--lisp/gnus/gnus-msg.el12
-rw-r--r--lisp/help-fns.el7
-rw-r--r--lisp/info-look.el64
-rw-r--r--lisp/info.el42
-rw-r--r--lisp/international/iso-cvt.el121
-rw-r--r--lisp/international/mule-cmds.el343
-rw-r--r--lisp/international/mule.el2
-rw-r--r--lisp/mail/rmail-spam-filter.el15
-rw-r--r--lisp/mail/rmail.el4
-rw-r--r--lisp/menu-bar.el56
-rw-r--r--lisp/mwheel.el8
-rw-r--r--lisp/net/browse-url.el17
-rw-r--r--lisp/net/tramp.el3
-rw-r--r--lisp/paren.el4
-rw-r--r--lisp/pcvs.el21
-rw-r--r--lisp/printing.el29
-rw-r--r--lisp/progmodes/ada-xref.el2
-rw-r--r--lisp/progmodes/compile.el13
-rw-r--r--lisp/progmodes/cperl-mode.el2
-rw-r--r--lisp/progmodes/gdb-ui.el12
-rw-r--r--lisp/progmodes/idlw-shell.el31
-rw-r--r--lisp/simple.el201
-rw-r--r--lisp/subr.el18
-rw-r--r--lisp/textmodes/conf-mode.el531
-rw-r--r--lisp/textmodes/flyspell.el2
-rw-r--r--lisp/textmodes/sgml-mode.el117
-rw-r--r--lisp/tooltip.el10
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-mailto.el2
-rw-r--r--lispref/ChangeLog4
-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--oldXMenu/Activate.c17
-rw-r--r--oldXMenu/ChangeLog7
-rw-r--r--oldXMenu/XMenu.h1
-rw-r--r--src/.gitignore1
-rw-r--r--src/ChangeLog215
-rw-r--r--src/Makefile.in14
-rw-r--r--src/callint.c15
-rw-r--r--src/data.c4
-rw-r--r--src/dispextern.h42
-rw-r--r--src/doc.c78
-rw-r--r--src/dosfns.c6
-rw-r--r--src/editfns.c12
-rw-r--r--src/emacs.c23
-rw-r--r--src/fontset.c41
-rw-r--r--src/fringe.c6
-rw-r--r--src/intervals.h7
-rw-r--r--src/keyboard.c19
-rw-r--r--src/keymap.c6
-rw-r--r--src/lisp.h7
-rw-r--r--src/lread.c10
-rw-r--r--src/makefile.w32-in3
-rw-r--r--src/msdos.c2
-rw-r--r--src/print.c2
-rw-r--r--src/process.c20
-rw-r--r--src/window.c59
-rw-r--r--src/xdisp.c122
-rw-r--r--src/xfaces.c26
-rw-r--r--src/xmenu.c124
-rw-r--r--src/xselect.c33
106 files changed, 3857 insertions, 1907 deletions
diff --git a/ChangeLog b/ChangeLog
index 8fbd47889c3..696d2b16f9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
12004-11-12 Eli Zaretskii <eliz@gnu.org>
2
3 * config.bat: Don't require djecho.exe for the v1.x build.
4 Add a test for DECL_ALIGN support, and add a trivial definition to
5 src/config.h if 8-byte alignment is not supported.
6
72004-11-08 Kim F. Storm <storm@cua.dk>
8
9 * Makefile.in (bootstrap, bootstrap-clean-before): Remove .elc
10 files before building.
11 (bootfast, bootstrap-clean-before-fast): New targets, like
12 bootstrap but don't remove .elc files.
13
12004-11-06 Lars Brinkhoff <lars@nocrew.org> 142004-11-06 Lars Brinkhoff <lars@nocrew.org>
2 15
3 * configure.in: Add check for getrusage. 16 * configure.in: Add check for getrusage.
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..8e660744370 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>
@@ -180,52 +141,6 @@ Date: Mon, 11 Oct 2004 11:14:49 +0200
180now I can drag the modeline only upwards but not downwards 141now I can drag the modeline only upwards but not downwards
181 142
182 143
183** line-spacing and (recenter -1)
184
185From: SAITO Takuya <tabmore@rivo.mediatti.net>
186Date: Mon, 31 May 2004 02:07:57 +0900 (JST)
187
188(recenter -1) does not show point at the bottom of the window
189if line-spacing is set to positive integer.
190
191Start emacs -Q, and evaluate below:
192
193(progn
194 (setq line-spacing 1)
195 (dotimes (i (window-height))
196 (insert "\n" (int-to-string i)))
197 (recenter -1))
198
199Then, point is displayed at the center of the window.
200But point should be displayed at the bottom of the window like Emacs-21.3.
201
202
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 144** line-spacing and Electric-pop-up-window
230 145
231From: SAITO Takuya <tabmore@rivo.mediatti.net> 146From: SAITO Takuya <tabmore@rivo.mediatti.net>
@@ -244,6 +159,8 @@ Electric-pop-up-window can use it.
244 159
245* DOCUMENTATION 160* DOCUMENTATION
246 161
162** Document Custom Themes.
163
247** Finish updating the Emacs Lisp manual. 164** Finish updating the Emacs Lisp manual.
248 165
249** Update the Emacs manual. 166** Update the Emacs manual.
@@ -318,11 +235,11 @@ names of the people who have checked it.
318SECTION READERS 235SECTION READERS
319---------------------------------- 236----------------------------------
320lispref/abbrevs.texi "Luc Teirlinck" 237lispref/abbrevs.texi "Luc Teirlinck"
321lispref/advice.texi 238lispref/advice.texi Joakim Verona <joakim@verona.se>
322lispref/anti.texi 239lispref/anti.texi
323lispref/backups.texi "Luc Teirlinck" 240lispref/backups.texi "Luc Teirlinck"
324lispref/buffers.texi "Luc Teirlinck" 241lispref/buffers.texi "Luc Teirlinck"
325lispref/calendar.texi 242lispref/calendar.texi Joakim Verona <joakim@verona.se>
326lispref/commands.texi "Luc Teirlinck" 243lispref/commands.texi "Luc Teirlinck"
327lispref/compile.texi "Luc Teirlinck" 244lispref/compile.texi "Luc Teirlinck"
328lispref/control.texi "Luc Teirlinck" 245lispref/control.texi "Luc Teirlinck"
diff --git a/config.bat b/config.bat
index c3e36975dec..64775244391 100644
--- a/config.bat
+++ b/config.bat
@@ -121,7 +121,9 @@ Goto End
121set djgpp_ver=1 121set djgpp_ver=1
122If ErrorLevel 20 set djgpp_ver=2 122If ErrorLevel 20 set djgpp_ver=2
123rm -f junk.c junk junk.exe 123rm -f junk.c junk junk.exe
124rem DJECHO is used by the top-level Makefile 124rem The v1.x build does not need djecho
125if "%DJGPP_VER%" == "1" Goto djechoOk
126rem DJECHO is used by the top-level Makefile in the v2.x build
125Echo Checking whether 'djecho' is available... 127Echo Checking whether 'djecho' is available...
126redir -o Nul -eo djecho -o junk.$$$ foo 128redir -o Nul -eo djecho -o junk.$$$ foo
127If Exist junk.$$$ Goto djechoOk 129If Exist junk.$$$ Goto djechoOk
@@ -156,6 +158,22 @@ goto src42
156:src41 158:src41
157sed -f ../msdos/sed2v2.inp <config.tmp >config.h2 159sed -f ../msdos/sed2v2.inp <config.tmp >config.h2
158:src42 160:src42
161Rem See if DECL_ALIGN can be supported with this GCC
162rm -f junk.c junk.o junk junk.exe
163echo struct { int i; char *p; } __attribute__((__aligned__(8))) foo; >junk.c
164rem Two percent signs because it is a special character for COMMAND.COM
165echo int main(void) { return (unsigned long)&foo %% 8; } >>junk.c
166gcc -o junk junk.c
167if not exist junk.exe coff2exe junk
168junk
169If Not ErrorLevel 1 Goto alignOk
170Echo WARNING: Your GCC does not support 8-byte aligned variables.
171Echo WARNING: Therefore Emacs cannot support buffers larger than 128MB.
172rem The following line disables DECL_ALIGN which in turn disables USE_LSB_TAG
173rem For details see lisp.h where it defines USE_LSB_TAG
174echo #define DECL_ALIGN(type, var) type var >>config.h2
175:alignOk
176rm -f junk.c junk junk.exe
159update config.h2 config.h >nul 177update config.h2 config.h >nul
160rm -f config.tmp config.h2 178rm -f config.tmp config.h2
161 179
diff --git a/etc/NEWS b/etc/NEWS
index 726eac5afdb..c96eb114727 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -98,14 +98,16 @@ types any more. Add -DUSE_LISP_UNION_TYPE if you want union types.
98 98
99* Changes in Emacs 21.4 99* Changes in Emacs 21.4
100 100
101** line-move-ignore-invisible now defaults to t.
102
101** In Outline mode, hide-body no longer hides lines at the top 103** In Outline mode, hide-body no longer hides lines at the top
102of the file that precede the first header line. 104of the file that precede the first header line.
103 105
104+++ 106+++
105** `set-auto-mode' now gives the interpreter magic line (if present) 107** `set-auto-mode' now gives the interpreter magic line (if present)
106precedence over the file name. Likewise an <?xml or <!DOCTYPE declaration 108precedence over the file name. Likewise an <?xml or <!DOCTYPE declaration
107will give the buffer XML or SGML mode, unless the file name leads to a mode in 109will give the buffer XML or SGML mode, based on the new var
108`xml-based-modes'. 110`magic-mode-alist'.
109 111
110+++ 112+++
111** New function `looking-back' checks whether a regular expression matches 113** New function `looking-back' checks whether a regular expression matches
@@ -2089,6 +2091,13 @@ anyone has committed to the repository since you last executed
2089 2091
2090* New modes and packages in Emacs 21.4 2092* New modes and packages in Emacs 21.4
2091 2093
2094** The new package conf-mode.el handles thousands of configuration files, with
2095varying syntaxes for comments (;, #, //, /* */ or !), assignment (var = value,
2096var : value, var value or keyword var value) and sections ([section] or
2097section { }). Many files under /etc/, or with suffixes like .cf through
2098.config, .properties (Java), .desktop (KDE/Gnome), .ini and many others are
2099recognized.
2100
2092** The new package password.el provide a password cache and expiring mechanism. 2101** The new package password.el provide a password cache and expiring mechanism.
2093 2102
2094** The new package dns-mode.el add syntax highlight of DNS master files. 2103** The new package dns-mode.el add syntax highlight of DNS master files.
@@ -2327,6 +2336,14 @@ configuration files.
2327* Lisp Changes in Emacs 21.4 2336* Lisp Changes in Emacs 21.4
2328 2337
2329+++ 2338+++
2339** The new function syntax-after returns the syntax code
2340of the character after a specified buffer position, taking account
2341of text properties as well as the character code.
2342It returns the value compatibly with char-syntax, except
2343that the value can be a list (SYNTAX . MATCHER) which says
2344what the matching character is.
2345
2346+++
2330** The new primitive `get-internal-run-time' returns the processor 2347** The new primitive `get-internal-run-time' returns the processor
2331run time used by Emacs since start-up. 2348run time used by Emacs since start-up.
2332 2349
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 6fc7796f339..b443f53ebba 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,8 +1,410 @@
12004-11-12 Jay Belanger <belanger@truman.edu>
2
3 * calc/calc-graph.el (calc-dumb-map): Declared it.
4 (calc-graph-show-dumb): Check if calc-dumb-map is non-nil rather
5 than unbound.
6
7 (calc-graph-name): Made `end' a local variable.
8 (calc-graph-lookup): Made `varname' a local variable.
9
10 (var-DUMMY, var-DUMMY2, var-PlotRejects, calc-gnuplot-trail-mark):
11 Declared them.
12
13 (calc-graph-format-data): Don't check if var-PlotRejects is
14 bound.
15
16 (calc-graph-plot, calc-graph-compute-3d): Removed references to
17 the unused variable y3vec.
18
19 (calc-graph-show-dumb): Removed reference to unused variable
20 found-pt.
21
22 (calc-graph-kill-hook, calc-graph-plot): Removed reference to
23 calc-graph-prev-kill-hook.
24
25 (calc-graph-yvalue, calc-graph-yvec, calc-graph-numsteps)
26 (calc-graph-numsteps3, calc-graph-xvalue, calc-graph-xvec)
27 (calc-graph-xname, calc-graph-yname, calc-graph-xstep)
28 (calc-graph-ycache, calc-graph-ycacheptr, calc-graph-refine)
29 (calc-graph-keep-file, calc-graph-xval, calc-graph-xlow)
30 (calc-graph-xhigh, calc-graph-yval, calc-graph-yp, calc-graph-xp)
31 (calc-graph-zp, calc-graph-yvector, calc-graph-resolution)
32 (calc-graph-y3value, calc-graph-y3name)
33 (calc-graph-y3step, calc-graph-y3step, calc-graph-zval)
34 (calc-graph-stepcount, calc-graph-is-splot)
35 (calc-graph-surprise-splot, calc-graph-blank)
36 (calc-graph-non-blank, calc-graph-curve-num): New variables.
37 (calc-graph-plot, calc-graph-compute-2d, calc-graph-refine-2d)
38 (calc-graph-recompute-2d, calc-graph-compute-3d)
39 (calc-graph-format-data): Replaced undeclared variables with the
40 above newly declared variables.
41
422004-11-12 Diane Murray <dsm@muenster.de> (tiny change)
43
44 * mail/rmail.el (rmail-get-new-mail): Use the renamed variables
45 `rsf-beep' and `rsf-sleep-after-message'.
46
47 * mail/rmail-spam-filter.el (rmail-spam-filter): Only check white
48 list if `message-sender' is non-nil.
49
502004-11-12 Kevin Rodgers <ihs_4664@yahoo.com> (tiny change)
51
52 * desktop.el (desktop-create-buffer, desktop-save): Avoid some
53 consing by using mapc instead of mapcar.
54
552004-11-12 Nick Roberts <nickrob@snap.net.nz>
56
57 * tooltip.el (require): Explain why CL is needed.
58
592004-11-11 Vinicius Jose Latorre <viniciusjl@ig.com.br>
60
61 * printing.el: Insert :version into defgroup (printing). All reference
62 to Files option in menubar were changed to File.
63 (pr-version): New version number (6.8.2).
64 (pr-get-symbol): Call easy-menu-intern.
65 (pr-region-active-p): Now is a fun (it was defsubst). To avoid
66 compilation gripes.
67
682004-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
69
70 * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Understand the
71 new byte-compile-function-environment binding to t.
72
73 * font-lock.el (font-lock-fontify-syntactically-region):
74 Don't forget to highlight the last char when we hit `end'.
75
76 * mwheel.el (mouse-wheel-progressive-speed): Fix typo in name.
77 (mwheel-scroll): Adjust accordingly.
78
79 * cvs-status.el: Reduce spurious warnings.
80 (cvs-status-checkout): Remove.
81 (cvs-status-mode-map): Use cvs-mode-checkout instead.
82
83 * pcvs.el (cvs-mode-checkout): New command.
84
85 * international/iso-cvt.el (iso-cvt-define-menu): Fix typo.
86
87 * tooltip.el: Require CL.
88
89 * emacs-lisp/bytecomp.el: Use push.
90 (byte-compile-file-form-defalias): Rename from byte-compile-defalias.
91 (defalias): Remove the `byte-compile' property and add
92 a `byte-hunk-handler'.
93
942004-11-11 Juri Linkov <juri@jurta.org>
95
96 * info.el (Info-search): Save match data for isearch.
97 Skip Tag Table node.
98
99 * descr-text.el (describe-char): Replace syntax-after with code
100 from its previous version.
101
102 * files.el (magic-mode-alist): Use optimization for SGML mode too.
103 (set-auto-mode): Doc fix. Remove unused variable `xml'.
104
105 * international/mule.el (sgml-html-meta-auto-coding-function):
106 Remove > after <html to allow HTML attributes.
107
1082004-11-11 Jay Belanger <belanger@truman.edu>
109
110 * calc/calc-comb.el (math-prime-factors-finished): Declare it as
111 a variable.
112 (calcFunc-dfac): Replace unbound max by n.
113 (math-stirling-local-cache): New variable.
114 (math-stirling-number, math-stirling-1, math-stirling-2):
115 Replace the variable `cache' by the declared variable
116 math-stirling-local-cache.
117 (var-RandSeed): Declare it as a variable.
118 (math-init-random-base, math-random-digit): Don't check to see if
119 var-RandSeed is bound.
120 (math-random-cache, math-gaussian-cache, calc-verbose-nextprime):
121 Declare them instead of just setting them.
122 (math-init-random-base): Made i a local variable.
123 (math-random-digit): Made math-random-last a local variable.
124 (math-prime-test-cache): Move declaration to before it is used.
125 (math-prime-test-cache-k, math-prime-test-cache-q)
126 (math-prime-test-cache-nm1, math-prime-factors-finished):
127 Declare them as variables.
128
1292004-11-11 Jay Belanger <belanger@truman.edu>
130
131 * calc/calc-ext.el (math-defcache): Use defvar for the new
132 variables it creates.
133
1342004-11-11 Lars Hansen <larsh@math.ku.dk>
135
136 * desktop.el (desktop-buffer-mode-handlers, desktop-after-read-hook)
137 (desktop-clear-preserve-buffers-regexp, desktop-file-name-format)
138 (desktop-globals-to-clear, desktop-no-desktop-file-hook, desktop-path)
139 (desktop-save): Add :version.
140
1412004-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
142
143 * printing.el (pr-get-symbol): Don't downcase.
144
1452004-11-10 Jay Belanger <belanger@truman.edu>
146
147 * calc/calc-aent.el (calc-do-quick-calc): Use kill-new to append
148 string to kill-ring.
149
150 * calc/calc-aent.el (calc-alg-exp, math-toks)
151 (math-exp-pos,math-exp-old-pos, math-exp-token)
152 (math-exp-keep-spaces, math-exp-str): New variables.
153 (calc-do-alg-entry, calcAlg-equals, calcAlg-edit)
154 (calcAlg-enter): Use declared variable calc-alg-exp.
155 (math-build-parse-table, math-find-user-token): Use declared
156 variable math-toks.
157 (math-read-exprs, math-read-token, calc-check-user-syntax)
158 (calc-match-user-syntax, match-factor-after, math-read-factor):
159 Use declared variables math-exp-pos math-exp-old-pos.
160 (math-read-exprs, math-read-token, math-read-expr-level)
161 (calc-check-user-syntax, calc-match-user-syntax)
162 (match-factor-after, math-read-factor): Use declared variable
163 math-exp-token.
164 (math-read-exprs, math-read-expr-list, math-read-token)
165 (math-read-factor): Use declared variable math-exp-keep-spaces.
166 (math-read-exprs, math-read-token): Use declared variable
167 math-exp-str.
168 (calc-match-user-syntax): Made m a local variable.
169
170 * calc/calc-ext.el (math-read-expr): Use declared variables
171 math-exp-pos, math-exp-old-pos, math-exp-str, math-exp-token,
172 math-exp-keep-spaces.
173
174 * calc/calc-forms.el (math-read-angle-bracket): Use declared
175 variables math-exp-pos, math-exp-str.
176
177 * calc/calc-lang.el (math-parse-tex-sum): Use declared variable
178 math-exp-old-pos.
179 (math-parse-fortran-vector, math-parse-fortran-vector-end)
180 (math-parse-eqn-prime): Use declared variable math-exp-token.
181
182 * calc/calc-vec.el (math-read-brackets, math-check-for-commas):
183 Use declared variable math-exp-pos.
184 (math-check-for-commas): Use declared variable math-exp-str.
185 (math-read-brackets): Use declared variables math-exp-old-pos,
186 math-exp-keep-spaces.
187 (math-read-brackets, math-read-vector, math-read-matrix):
188 Use declared variable math-exp-token.
189
1902004-11-10 Stefan Monnier <monnier@iro.umontreal.ca>
191
192 * files.el (magic-mode-alist): Reduce backtracking in the HTML regexp.
193
194 * textmodes/sgml-mode.el (sgml-tag-text-p): New fun.
195 (sgml-parse-tag-backward): Use it to skip spurious < or >.
196
1972004-11-10 Thien-Thi Nguyen <ttn@gnu.org>
198
199 * ebuff-menu.el: Doc fixes throughout.
200 (electric-buffer-menu-mode-hook): New defvar.
201
2022004-11-10 Nick Roberts <nickrob@snap.net.nz>
203
204 * tooltip.el: Don't require cl, comint, gud, gdb-ui for
205 compilation. The resulting compiler warnings appear to be harmless.
206
2072004-11-10 Daniel Pfeiffer <occitan@esperanto.org>
208
209 * textmodes/conf-mode.el: New file.
210
211 * files.el (auto-mode-alist, magic-mode-alist): Use it.
212
2132004-11-09 Stefan Monnier <monnier@iro.umontreal.ca>
214
215 * international/iso-cvt.el (iso-cvt-define-menu): Clean up namespace.
216
2172004-11-09 Jay Belanger <belanger@truman.edu>
218
219 * calc/calc-ext.el (calc-init-extensions): Remove old code.
220
221 * calc/calc-ext.el (math-expr-data, math-mt-many, math-mt-func)
222 (calc-z-prefix-buf, calc-z-prefix-msgs): New variables.
223 (calc-z-prefix-help, calc-user-function-list): Use declared
224 variables calc-z-prefix-buf, calc-z-prefix-msgs.
225 (math-map-tree, math-map-tree-rec): Use declared variables
226 math-mt-many, math-mt-func.
227 (math-read-expression, math-read-string): Use declared variable
228 math-expr-data.
229
230 * calc/calc-ext.el (math-normalize-nonstandard): Use declared
231 variable math-normalize-a.
232
233 * calc/calc.el (math-normalize-a): New variable.
234 (math-normalize): Use declared variable math-normalize-a.
235
236 * calc/calc-poly.el (math-expand-form): Use declared variable
237 math-mt-many.
238
239 * calc/calc-rewr.el (math-rewrite, math-rewrite-phase):
240 Use declared variable math-mt-many.
241 (math-rewrite): Use declared variable math-mt-func.
242
243 * calc/calc-vec.el (math-read-brackets, math-read-vector)
244 (math-read-matrix): Use declared variable math-expr-data.
245
246 * calc/calc-lang.el (math-parse-fortran-vector)
247 (math-parse-fortran-vector-end, math-parse-tex-sum)
248 (math-parse-eqn-matrix, math-parse-eqn-prime)
249 (math-read-math-subscr): Use declared variable math-expr-data.
250
251 * calc/calc-aent.el (math-read-exprs, math-read-expr-list)
252 (math-read-expr-level, math-read-token, calc-check-user-syntax)
253 (calc-match-user-syntax, math-read-if, math-factor-after)
254 (math-read-factor): Use declared variable math-expr-data.
255
2562004-11-09 Glenn Morris <gmorris@ast.cam.ac.uk>
257
258 * calendar/diary-lib.el (diary-from-outlook)
259 (diary-from-outlook-gnus, diary-from-outlook-rmail): Do not use
260 interactive-p; but rather new optional argument NOCONFIRM.
261
2622004-11-09 Stefan Monnier <monnier@iro.umontreal.ca>
263
264 * emacs-lisp/easymenu.el (easy-menu-intern): Revert to no-downcasing.
265 (easy-menu-name-match): Revert correspondingly.
266
2672004-11-09 Richard M. Stallman <rms@gnu.org>
268
269 * emacs-lisp/bytecomp.el (byte-compile-defalias):
270 Turn off warnings for the new function even if definition not constant.
271 If the definition isn't a quoted symbol, record (FUNCTION . t).
272 (byte-compile-function-environment): Now allow (FUNCTION . t) as elt.
273 (byte-compile-callargs-warn): Handle (FUNCTION . t).
274 (display-call-tree, byte-compile-arglist-warn):
275 Handle t returned by byte-compile-fdefinition.
276
2772004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
278
279 * Makefile.in (maintainer-clean): Depend on distclean.
280
281 * help-fns.el (help-C-file-name): File name must be in build-files
282 to be returned.
283
2842004-11-09 Jay Belanger <belanger@truman.edu>
285
286 * calc/calc.el (calc-mode-hook, calc-trail-mode-hook)
287 (calc-start-hook, calc-end-hook, calc-load-hook): New variables.
288
289 * calc/calc.el (calc, calc-trail-display, calc-mode):
290 Remove obsolete sections.
291
292 * calc/calc.el (calc-x-paste-text): Remove.
293
294 * calc/calc-ext.el (calc-init-extensions): Bind calc-yank to
295 mouse-2.
296
2972004-11-09 Nick Roberts <nickrob@snap.net.nz>
298
299 * progmodes/gdb-ui.el (gdb-current-stack-level): New variable.
300 (gdb-info-frames-custom, gdb-frame-handler): Use it to find
301 current frame (in case of recursive calls).
302 (gdb-show-changed-values): Add :version keyword.
303
3042004-11-08 Stefan Monnier <monnier@iro.umontreal.ca>
305
306 * international/mule-cmds.el: Change coding-system to utf-8.
307 (select-safe-coding-system-interactively):
308 New function extracted from select-safe-coding-system.
309 (select-safe-coding-system): Use it.
310
3112004-11-08 Richard M. Stallman <rms@gnu.org>
312
313 * subr.el (syntax-after): Doc fix.
314
315 * paren.el (show-paren-function): Change calls to syntax-after
316 for new way of returning the value.
317
318 * menu-bar.el (menu-bar-file-menu): Make this the real name
319 and menu-bar-files-menu the alias. Use the former.
320 (global-map): Use `file', not `files', as the symbol.
321
322 * info.el (Info-revert-find-node): Don't use beginning-of-buffer.
323
324 * filesets.el (filesets-spawn-external-viewer, filesets-run-cmd):
325 Don't use beginning-of-buffer.
326 (filesets-cmd-show-result): Use with-no-warnings.
327
3282004-11-08 Juri Linkov <juri@jurta.org>
329
330 * progmodes/compile.el (compile): Don't overwrite last command in
331 minibuffer history with default command if they are not equal.
332
3332004-11-08 Jay Belanger <belanger@truman.edu>
334
335 * calc/calcalg2.el (math-do-integral-methods): Try linear then
336 non-linear substitutions.
337
3382004-11-08 Jay Belanger <belanger@truman.edu>
339
340 * calc/calcalg2.el (math-linear-subst-tried): New variable.
341 (math-do-integral): Set `math-linear-subst-tried' to nil.
342 (math-do-integral-methods): Use `math-linear-subst-tried' to
343 determine what type of substitution to try.
344 (math-integ-try-linear-substituion):
345 Set `math-linear-subst-tried' to t.
346
3472004-11-08 Kim F. Storm <storm@cua.dk>
348
349 * Makefile.in (bootstrap-clean): New target for 'make bootstrap'.
350
3512004-11-07 Juri Linkov <juri@jurta.org>
352
353 * info-look.el (info-lookup): Allow reusing in the current buffer
354 not only *info* buffer, but all (even renamed) Info buffers
355 by checking for major-mode instead of *info* buffer name.
356 (c-mode, autoconf-mode, emacs-lisp-mode, scheme-mode)
357 (octave-mode, maxima-mode) <doc-spec>:
358 Allow long dashes generated by Texinfo 4.7 before definitions.
359 (texinfo-mode) <doc-spec>: Add space to suffix to find command
360 definitions with argument separated by space.
361
3622004-11-06 Richard M. Stallman <rms@gnu.org>
363
364 * simple.el (next-error group, face): Move before first use.
365 (next-error-highlight, next-error-highlight-no-select): Likewise.
366
367 * simple.el (line-move-invisible-p): Rename from line-move-invisible.
368 (line-move): New args NOERROR and TO-END.
369 Return t if if succeed in moving specified number of lines.
370 (move-end-of-line): New function.
371
372 * simple.el (beginning-of-buffer-other-window): Use with-no-warnings.
373 (end-of-buffer-other-window): Likewise.
374
375 * simple.el (line-move-ignore-invisible): Default to t.
376
377 * subr.el (syntax-after): Return the syntax letter, not the raw code.
378
379 * emacs-lisp/elp.el (elp-results): Delete wasteful beginning-of-buffer.
380
381 * international/iso-cvt.el (iso-cvt-define-menu):
382 Rename menu-bar-files-menu to menu-bar-file-menu.
383
384 * net/browse-url.el (browse-url-gnome-moz-program)
385 (browse-url-gnome-moz-arguments): Move up before first use.
386
387 * net/tramp.el (tramp group): Add :version.
388
389 * progmodes/ada-xref.el (ada-gdb-application):
390 Use goto-char instead of beginning-of-buffer.
391
392 * progmodes/cperl-mode.el (cperl-info-on-command):
393 Use goto-char instead of beginning-of-buffer.
394
395 * progmodes/idlw-shell.el (idlwave-shell-examine-map):
396 Move up before first use.
397 (idlwave-shell-temp-pro-file): Likewise.
398 (idlwave-shell-temp-rinfo-save-file): Likewise.
399 (idlwave-shell-temp-file): Minor doc fix.
400
401 * textmodes/flyspell.el (flyspell-external-point-words):
402 Use goto-char instead of beginning-of-buffer.
403
12004-11-06 Kai Grossjohann <kai.grossjohann@gmx.net> 4042004-11-06 Kai Grossjohann <kai.grossjohann@gmx.net>
2 405
3 * net/tramp.el (tramp-coding-commands): Additionally try "uudecode 406 * net/tramp.el (tramp-coding-commands): Additionally try "uudecode -o
4 -o /dev/stdout" before trying "uudecode -o -". Suggested by Han 407 /dev/stdout" before trying "uudecode -o -". Suggested by Han Boetes.
5 Boetes.
6 (tramp-uudecode): Mention `uudecode -o /dev/stdout'. 408 (tramp-uudecode): Mention `uudecode -o /dev/stdout'.
7 409
82004-11-06 David Ponce <david@dponce.com> 4102004-11-06 David Ponce <david@dponce.com>
@@ -59,8 +461,7 @@
59 461
602004-11-04 Daniel Pfeiffer <occitan@esperanto.org> 4622004-11-04 Daniel Pfeiffer <occitan@esperanto.org>
61 463
62 * files.el (set-auto-mode): Don't get error after setting 464 * files.el (set-auto-mode): Don't get error after setting -*-mode-*-.
63 -*-mode-*-.
64 465
652004-11-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 4662004-11-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
66 467
@@ -182,8 +583,7 @@
182 (icalendar-convert-diary-to-ical) 583 (icalendar-convert-diary-to-ical)
183 (icalendar-extract-ical-from-buffer): Use only two args for 584 (icalendar-extract-ical-from-buffer): Use only two args for
184 make-obsolete (XEmacs compatibility). 585 make-obsolete (XEmacs compatibility).
185 (icalendar-export-file, icalendar-import-file): Blank at end of 586 (icalendar-export-file, icalendar-import-file): Blank at end of prompt.
186 prompt.
187 (icalendar-export-region): Doc fix. 587 (icalendar-export-region): Doc fix.
188 If error, return non-nil and write errors to a buffer. 588 If error, return non-nil and write errors to a buffer.
189 Use correct weekday for weekly recurring events. 589 Use correct weekday for weekly recurring events.
@@ -223,16 +623,16 @@
223 623
2242004-11-02 Pavel Kobiakov <pk_at_work@yahoo.com> 6242004-11-02 Pavel Kobiakov <pk_at_work@yahoo.com>
225 625
226 * progmodes/flymake.el (flymake-err-line-patterns): Use 626 * progmodes/flymake.el (flymake-err-line-patterns):
227 `flymake-reformat-err-line-patterns-from-compile-el' to convert 627 Use `flymake-reformat-err-line-patterns-from-compile-el' to convert
228 `compilation-error-regexp-alist-alist' to internal Flymake format. 628 `compilation-error-regexp-alist-alist' to internal Flymake format.
229 629
230 * progmodes/flymake.el: eliminated byte-compiler warnings. 630 * progmodes/flymake.el: eliminated byte-compiler warnings.
231 631
2322004-11-01 Jay Belanger <belanger@truman.edu> 6322004-11-01 Jay Belanger <belanger@truman.edu>
233 633
234 * calc/calc-frac.el (calc-over-notation): Replaced 634 * calc/calc-frac.el (calc-over-notation): Replace `completing-read'
235 `completing-read' with `interactive "s"'. 635 with `interactive "s"'.
236 636
2372004-11-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 6372004-11-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
238 638
diff --git a/lisp/ChangeLog.10 b/lisp/ChangeLog.10
index 486f0f38964..a702e56fdf3 100644
--- a/lisp/ChangeLog.10
+++ b/lisp/ChangeLog.10
@@ -4150,6 +4150,7 @@
4150 (desktop-path): New customizable variable. List of directories in 4150 (desktop-path): New customizable variable. List of directories in
4151 which to lookup the desktop file. Replaces hardcoded list. 4151 which to lookup the desktop file. Replaces hardcoded list.
4152 (desktop-globals-to-clear): New variable replaces hardcoded list. 4152 (desktop-globals-to-clear): New variable replaces hardcoded list.
4153 (desktop-globals-to-save): Variable made customizable.
4153 (desktop-clear-preserve-buffers-regexp): New customizable variable. 4154 (desktop-clear-preserve-buffers-regexp): New customizable variable.
4154 (desktop-after-read-hook): New hook run after a desktop is read. 4155 (desktop-after-read-hook): New hook run after a desktop is read.
4155 (desktop-no-desktop-file-hook): New hook when no desktop file found. 4156 (desktop-no-desktop-file-hook): New hook when no desktop file found.
diff --git a/lisp/ChangeLog.7 b/lisp/ChangeLog.7
index 85dfaeaf35f..f89cb7b0d47 100644
--- a/lisp/ChangeLog.7
+++ b/lisp/ChangeLog.7
@@ -23104,8 +23104,8 @@
23104 * message.el (message-mode): Delete abbrev mode initialization. 23104 * message.el (message-mode): Delete abbrev mode initialization.
23105 (message-mode-hook): Move it here, instead, so the user can 23105 (message-mode-hook): Move it here, instead, so the user can
23106 override it. 23106 override it.
23107 (message-y-or-n-p, message-talkative-question, 23107 (message-y-or-n-p, message-talkative-question)
23108 message-flatten-list, message-flatten-list-1): Move utility 23108 (message-flatten-list, message-flatten-list-1): Move utility
23109 functions up so macro is defined before first invocation. 23109 functions up so macro is defined before first invocation.
23110 23110
23111 * f90.el (f90-auto-fill-mode): Function deleted, all references 23111 * f90.el (f90-auto-fill-mode): Function deleted, all references
@@ -23115,24 +23115,23 @@
23115 23115
231161996-08-13 Torbjorn Einarsson <etxeina@etxdn.ericsson.se> 231161996-08-13 Torbjorn Einarsson <etxeina@etxdn.ericsson.se>
23117 23117
23118 * f90.el: (f90-do-auto-fill): Fixed bug which made program hang for 23118 * f90.el: (f90-do-auto-fill): Fix bug which made program hang for
23119 space in fill-column. 23119 space in fill-column.
23120 (f90-font-lock-keywords-1): Now we have common font-lock 23120 (f90-font-lock-keywords-1): Now we have common font-lock
23121 exps for Emacs and XEmacs 23121 exps for Emacs and XEmacs
23122 (f90-font-lock-keywords-2): Changed reg-exp for line number. A 23122 (f90-font-lock-keywords-2): Change reg-exp for line number.
23123 number must be followed by a letter to be highlighted. Fixed 23123 A number must be followed by a letter to be highlighted.
23124 highlighting of declarations with trailing comments. 23124 Fix highlighting of declarations with trailing comments.
23125 (f90-match-end): Fixed bug due to new message syntax. 23125 (f90-match-end): Fix bug due to new message syntax.
23126 (f90-mode): Fixed setup of variable font-lock-defaults. 23126 (f90-mode): Fix setup of variable font-lock-defaults.
23127 (f90-looking-at-program-block-start): Small error in detecting of 23127 (f90-looking-at-program-block-start): Small error in detecting of
23128 function start. Made the detection of subroutine start more flexible. 23128 function start. Made the detection of subroutine start more flexible.
23129 (f90-mode-map): Much nicer menu with sections and added submenus 23129 (f90-mode-map): Much nicer menu with sections and added submenus
23130 for highlighting and keyword case change. 23130 for highlighting and keyword case change.
23131 Also added 'menu-enable' properties for region-based commands. 23131 Also added 'menu-enable' properties for region-based commands.
23132 (f90-imenu-generic-expression): Fixed expression to find 23132 (f90-imenu-generic-expression): Fix expression to find
23133 procedures, modules and types. 23133 procedures, modules and types.
23134 (f90-add-imenu-menu): New function for adding imenu menu to the 23134 (f90-add-imenu-menu): New function for adding imenu menu to the menubar.
23135 menubar.
23136 23135
231371996-08-13 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> 231361996-08-13 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
23138 23137
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 5085d3b5b91..e87ffa6f265 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -311,9 +311,12 @@ bootstrap-prepare:
311 fi \ 311 fi \
312 fi 312 fi
313 313
314maintainer-clean: 314maintainer-clean: distclean
315 cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL) 315 cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL)
316 316
317bootstrap-clean:
318 cd $(lisp); rm -f *.elc */*.elc
319
317# Generate/update files for the bootstrap process. 320# Generate/update files for the bootstrap process.
318 321
319bootstrap: update-subdirs autoloads compile 322bootstrap: update-subdirs autoloads compile
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index 2db722ccb2d..182b3b0635c 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -101,10 +101,7 @@
101 (message "Result: %s" buf))) 101 (message "Result: %s" buf)))
102 (if (eq last-command-char 10) 102 (if (eq last-command-char 10)
103 (insert shortbuf) 103 (insert shortbuf)
104 (setq kill-ring (cons shortbuf kill-ring)) 104 (kill-new shortbuf)))))
105 (when (> (length kill-ring) kill-ring-max)
106 (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))
107 (setq kill-ring-yank-pointer kill-ring)))))
108 105
109(defun calc-do-calc-eval (str separator args) 106(defun calc-do-calc-eval (str separator args)
110 (calc-check-defines) 107 (calc-check-defines)
@@ -301,10 +298,12 @@
301(defvar calc-alg-ent-esc-map nil 298(defvar calc-alg-ent-esc-map nil
302 "The keymap used for escapes in algebraic entry.") 299 "The keymap used for escapes in algebraic entry.")
303 300
301(defvar calc-alg-exp)
302
304(defun calc-do-alg-entry (&optional initial prompt no-normalize) 303(defun calc-do-alg-entry (&optional initial prompt no-normalize)
305 (let* ((calc-buffer (current-buffer)) 304 (let* ((calc-buffer (current-buffer))
306 (blink-paren-function 'calcAlg-blink-matching-open) 305 (blink-paren-function 'calcAlg-blink-matching-open)
307 (alg-exp 'error)) 306 (calc-alg-exp 'error))
308 (unless calc-alg-ent-map 307 (unless calc-alg-ent-map
309 (setq calc-alg-ent-map (copy-keymap minibuffer-local-map)) 308 (setq calc-alg-ent-map (copy-keymap minibuffer-local-map))
310 (define-key calc-alg-ent-map "'" 'calcAlg-previous) 309 (define-key calc-alg-ent-map "'" 'calcAlg-previous)
@@ -328,13 +327,13 @@
328 (let ((buf (read-from-minibuffer (or prompt "Algebraic: ") 327 (let ((buf (read-from-minibuffer (or prompt "Algebraic: ")
329 (or initial "") 328 (or initial "")
330 calc-alg-ent-map nil))) 329 calc-alg-ent-map nil)))
331 (when (eq alg-exp 'error) 330 (when (eq calc-alg-exp 'error)
332 (when (eq (car-safe (setq alg-exp (math-read-exprs buf))) 'error) 331 (when (eq (car-safe (setq calc-alg-exp (math-read-exprs buf))) 'error)
333 (setq alg-exp nil))) 332 (setq calc-alg-exp nil)))
334 (setq calc-aborted-prefix "alg'") 333 (setq calc-aborted-prefix "alg'")
335 (or no-normalize 334 (or no-normalize
336 (and alg-exp (setq alg-exp (mapcar 'calc-normalize alg-exp)))) 335 (and calc-alg-exp (setq calc-alg-exp (mapcar 'calc-normalize calc-alg-exp))))
337 alg-exp))) 336 calc-alg-exp)))
338 337
339(defun calcAlg-plus-minus () 338(defun calcAlg-plus-minus ()
340 (interactive) 339 (interactive)
@@ -364,8 +363,8 @@
364 (interactive) 363 (interactive)
365 (unwind-protect 364 (unwind-protect
366 (calcAlg-enter) 365 (calcAlg-enter)
367 (if (consp alg-exp) 366 (if (consp calc-alg-exp)
368 (progn (setq prefix-arg (length alg-exp)) 367 (progn (setq prefix-arg (length calc-alg-exp))
369 (calc-unread-command ?=))))) 368 (calc-unread-command ?=)))))
370 369
371(defun calcAlg-escape () 370(defun calcAlg-escape ()
@@ -383,8 +382,8 @@
383 (calc-minibuffer-contains 382 (calc-minibuffer-contains
384 "\\`\\([^\"]*\"[^\"]*\"\\)*[^\"]*\"[^\"]*\\'")) 383 "\\`\\([^\"]*\"[^\"]*\"\\)*[^\"]*\"[^\"]*\\'"))
385 (insert "`") 384 (insert "`")
386 (setq alg-exp (minibuffer-contents)) 385 (setq calc-alg-exp (minibuffer-contents))
387 (and (> (length alg-exp) 0) (setq calc-previous-alg-entry alg-exp)) 386 (and (> (length calc-alg-exp) 0) (setq calc-previous-alg-entry calc-alg-exp))
388 (exit-minibuffer))) 387 (exit-minibuffer)))
389 388
390(defun calcAlg-enter () 389(defun calcAlg-enter ()
@@ -402,7 +401,7 @@
402 (calc-temp-minibuffer-message 401 (calc-temp-minibuffer-message
403 (concat " [" (or (nth 2 exp) "Error") "]")) 402 (concat " [" (or (nth 2 exp) "Error") "]"))
404 (calc-clear-unread-commands)) 403 (calc-clear-unread-commands))
405 (setq alg-exp (if (calc-minibuffer-contains "\\` *\\[ *\\'") 404 (setq calc-alg-exp (if (calc-minibuffer-contains "\\` *\\[ *\\'")
406 '((incomplete vec)) 405 '((incomplete vec))
407 exp)) 406 exp))
408 (and (> (length str) 0) (setq calc-previous-alg-entry str)) 407 (and (> (length str) 0) (setq calc-previous-alg-entry str))
@@ -460,30 +459,39 @@
460 459
461;;; Algebraic expression parsing. [Public] 460;;; Algebraic expression parsing. [Public]
462 461
463(defun math-read-exprs (exp-str) 462;;; The next few variables are local to math-read-exprs (and math-read-expr)
464 (let ((exp-pos 0) 463;;; but are set in functions they call.
465 (exp-old-pos 0) 464
466 (exp-keep-spaces nil) 465(defvar math-exp-pos)
467 exp-token exp-data) 466(defvar math-exp-str)
467(defvar math-exp-old-pos)
468(defvar math-exp-token)
469(defvar math-exp-keep-spaces)
470
471(defun math-read-exprs (math-exp-str)
472 (let ((math-exp-pos 0)
473 (math-exp-old-pos 0)
474 (math-exp-keep-spaces nil)
475 math-exp-token math-expr-data)
468 (if calc-language-input-filter 476 (if calc-language-input-filter
469 (setq exp-str (funcall calc-language-input-filter exp-str))) 477 (setq math-exp-str (funcall calc-language-input-filter math-exp-str)))
470 (while (setq exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" exp-str)) 478 (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str))
471 (setq exp-str (concat (substring exp-str 0 exp-token) "\\dots" 479 (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots"
472 (substring exp-str (+ exp-token 2))))) 480 (substring math-exp-str (+ math-exp-token 2)))))
473 (math-build-parse-table) 481 (math-build-parse-table)
474 (math-read-token) 482 (math-read-token)
475 (let ((val (catch 'syntax (math-read-expr-list)))) 483 (let ((val (catch 'syntax (math-read-expr-list))))
476 (if (stringp val) 484 (if (stringp val)
477 (list 'error exp-old-pos val) 485 (list 'error math-exp-old-pos val)
478 (if (equal exp-token 'end) 486 (if (equal math-exp-token 'end)
479 val 487 val
480 (list 'error exp-old-pos "Syntax error")))))) 488 (list 'error math-exp-old-pos "Syntax error"))))))
481 489
482(defun math-read-expr-list () 490(defun math-read-expr-list ()
483 (let* ((exp-keep-spaces nil) 491 (let* ((math-exp-keep-spaces nil)
484 (val (list (math-read-expr-level 0))) 492 (val (list (math-read-expr-level 0)))
485 (last val)) 493 (last val))
486 (while (equal exp-data ",") 494 (while (equal math-expr-data ",")
487 (math-read-token) 495 (math-read-token)
488 (let ((rest (list (math-read-expr-level 0)))) 496 (let ((rest (list (math-read-expr-level 0))))
489 (setcdr last rest) 497 (setcdr last rest)
@@ -496,20 +504,23 @@
496(defvar calc-user-tokens nil) 504(defvar calc-user-tokens nil)
497(defvar calc-user-token-chars nil) 505(defvar calc-user-token-chars nil)
498 506
507(defvar math-toks nil
508 "Tokens to pass between math-build-parse-table and math-find-user-tokens.")
509
499(defun math-build-parse-table () 510(defun math-build-parse-table ()
500 (let ((mtab (cdr (assq nil calc-user-parse-tables))) 511 (let ((mtab (cdr (assq nil calc-user-parse-tables)))
501 (ltab (cdr (assq calc-language calc-user-parse-tables)))) 512 (ltab (cdr (assq calc-language calc-user-parse-tables))))
502 (or (and (eq mtab calc-last-main-parse-table) 513 (or (and (eq mtab calc-last-main-parse-table)
503 (eq ltab calc-last-lang-parse-table)) 514 (eq ltab calc-last-lang-parse-table))
504 (let ((p (append mtab ltab)) 515 (let ((p (append mtab ltab))
505 (toks nil)) 516 (math-toks nil))
506 (setq calc-user-parse-table p) 517 (setq calc-user-parse-table p)
507 (setq calc-user-token-chars nil) 518 (setq calc-user-token-chars nil)
508 (while p 519 (while p
509 (math-find-user-tokens (car (car p))) 520 (math-find-user-tokens (car (car p)))
510 (setq p (cdr p))) 521 (setq p (cdr p)))
511 (setq calc-user-tokens (mapconcat 'identity 522 (setq calc-user-tokens (mapconcat 'identity
512 (sort (mapcar 'car toks) 523 (sort (mapcar 'car math-toks)
513 (function (lambda (x y) 524 (function (lambda (x y)
514 (> (length x) 525 (> (length x)
515 (length y))))) 526 (length y)))))
@@ -517,7 +528,7 @@
517 calc-last-main-parse-table mtab 528 calc-last-main-parse-table mtab
518 calc-last-lang-parse-table ltab))))) 529 calc-last-lang-parse-table ltab)))))
519 530
520(defun math-find-user-tokens (p) ; uses "toks" 531(defun math-find-user-tokens (p)
521 (while p 532 (while p
522 (cond ((and (stringp (car p)) 533 (cond ((and (stringp (car p))
523 (or (> (length (car p)) 1) (equal (car p) "$") 534 (or (> (length (car p)) 1) (equal (car p) "$")
@@ -528,9 +539,9 @@
528 (setq s (concat "\\<" s))) 539 (setq s (concat "\\<" s)))
529 (if (string-match "[a-zA-Z0-9]\\'" s) 540 (if (string-match "[a-zA-Z0-9]\\'" s)
530 (setq s (concat s "\\>"))) 541 (setq s (concat s "\\>")))
531 (or (assoc s toks) 542 (or (assoc s math-toks)
532 (progn 543 (progn
533 (setq toks (cons (list s) toks)) 544 (setq math-toks (cons (list s) math-toks))
534 (or (memq (aref (car p) 0) calc-user-token-chars) 545 (or (memq (aref (car p) 0) calc-user-token-chars)
535 (setq calc-user-token-chars 546 (setq calc-user-token-chars
536 (cons (aref (car p) 0) 547 (cons (aref (car p) 0)
@@ -542,161 +553,168 @@
542 (setq p (cdr p)))) 553 (setq p (cdr p))))
543 554
544(defun math-read-token () 555(defun math-read-token ()
545 (if (>= exp-pos (length exp-str)) 556 (if (>= math-exp-pos (length math-exp-str))
546 (setq exp-old-pos exp-pos 557 (setq math-exp-old-pos math-exp-pos
547 exp-token 'end 558 math-exp-token 'end
548 exp-data "\000") 559 math-expr-data "\000")
549 (let ((ch (aref exp-str exp-pos))) 560 (let ((ch (aref math-exp-str math-exp-pos)))
550 (setq exp-old-pos exp-pos) 561 (setq math-exp-old-pos math-exp-pos)
551 (cond ((memq ch '(32 10 9)) 562 (cond ((memq ch '(32 10 9))
552 (setq exp-pos (1+ exp-pos)) 563 (setq math-exp-pos (1+ math-exp-pos))
553 (if exp-keep-spaces 564 (if math-exp-keep-spaces
554 (setq exp-token 'space 565 (setq math-exp-token 'space
555 exp-data " ") 566 math-expr-data " ")
556 (math-read-token))) 567 (math-read-token)))
557 ((and (memq ch calc-user-token-chars) 568 ((and (memq ch calc-user-token-chars)
558 (let ((case-fold-search nil)) 569 (let ((case-fold-search nil))
559 (eq (string-match calc-user-tokens exp-str exp-pos) 570 (eq (string-match calc-user-tokens math-exp-str math-exp-pos)
560 exp-pos))) 571 math-exp-pos)))
561 (setq exp-token 'punc 572 (setq math-exp-token 'punc
562 exp-data (math-match-substring exp-str 0) 573 math-expr-data (math-match-substring math-exp-str 0)
563 exp-pos (match-end 0))) 574 math-exp-pos (match-end 0)))
564 ((or (and (>= ch ?a) (<= ch ?z)) 575 ((or (and (>= ch ?a) (<= ch ?z))
565 (and (>= ch ?A) (<= ch ?Z))) 576 (and (>= ch ?A) (<= ch ?Z)))
566 (string-match (if (memq calc-language '(c fortran pascal maple)) 577 (string-match (if (memq calc-language '(c fortran pascal maple))
567 "[a-zA-Z0-9_#]*" 578 "[a-zA-Z0-9_#]*"
568 "[a-zA-Z0-9'#]*") 579 "[a-zA-Z0-9'#]*")
569 exp-str exp-pos) 580 math-exp-str math-exp-pos)
570 (setq exp-token 'symbol 581 (setq math-exp-token 'symbol
571 exp-pos (match-end 0) 582 math-exp-pos (match-end 0)
572 exp-data (math-restore-dashes 583 math-expr-data (math-restore-dashes
573 (math-match-substring exp-str 0))) 584 (math-match-substring math-exp-str 0)))
574 (if (eq calc-language 'eqn) 585 (if (eq calc-language 'eqn)
575 (let ((code (assoc exp-data math-eqn-ignore-words))) 586 (let ((code (assoc math-expr-data math-eqn-ignore-words)))
576 (cond ((null code)) 587 (cond ((null code))
577 ((null (cdr code)) 588 ((null (cdr code))
578 (math-read-token)) 589 (math-read-token))
579 ((consp (nth 1 code)) 590 ((consp (nth 1 code))
580 (math-read-token) 591 (math-read-token)
581 (if (assoc exp-data (cdr code)) 592 (if (assoc math-expr-data (cdr code))
582 (setq exp-data (format "%s %s" 593 (setq math-expr-data (format "%s %s"
583 (car code) exp-data)))) 594 (car code) math-expr-data))))
584 ((eq (nth 1 code) 'punc) 595 ((eq (nth 1 code) 'punc)
585 (setq exp-token 'punc 596 (setq math-exp-token 'punc
586 exp-data (nth 2 code))) 597 math-expr-data (nth 2 code)))
587 (t 598 (t
588 (math-read-token) 599 (math-read-token)
589 (math-read-token)))))) 600 (math-read-token))))))
590 ((or (and (>= ch ?0) (<= ch ?9)) 601 ((or (and (>= ch ?0) (<= ch ?9))
591 (and (eq ch '?\.) 602 (and (eq ch '?\.)
592 (eq (string-match "\\.[0-9]" exp-str exp-pos) exp-pos)) 603 (eq (string-match "\\.[0-9]" math-exp-str math-exp-pos)
604 math-exp-pos))
593 (and (eq ch '?_) 605 (and (eq ch '?_)
594 (eq (string-match "_\\.?[0-9]" exp-str exp-pos) exp-pos) 606 (eq (string-match "_\\.?[0-9]" math-exp-str math-exp-pos)
595 (or (eq exp-pos 0) 607 math-exp-pos)
608 (or (eq math-exp-pos 0)
596 (and (memq calc-language '(nil flat big unform 609 (and (memq calc-language '(nil flat big unform
597 tex eqn)) 610 tex eqn))
598 (eq (string-match "[^])}\"a-zA-Z0-9'$]_" 611 (eq (string-match "[^])}\"a-zA-Z0-9'$]_"
599 exp-str (1- exp-pos)) 612 math-exp-str (1- math-exp-pos))
600 (1- exp-pos)))))) 613 (1- math-exp-pos))))))
601 (or (and (eq calc-language 'c) 614 (or (and (eq calc-language 'c)
602 (string-match "0[xX][0-9a-fA-F]+" exp-str exp-pos)) 615 (string-match "0[xX][0-9a-fA-F]+" math-exp-str math-exp-pos))
603 (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" exp-str exp-pos)) 616 (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?"
604 (setq exp-token 'number 617 math-exp-str math-exp-pos))
605 exp-data (math-match-substring exp-str 0) 618 (setq math-exp-token 'number
606 exp-pos (match-end 0))) 619 math-expr-data (math-match-substring math-exp-str 0)
620 math-exp-pos (match-end 0)))
607 ((eq ch ?\$) 621 ((eq ch ?\$)
608 (if (and (eq calc-language 'pascal) 622 (if (and (eq calc-language 'pascal)
609 (eq (string-match 623 (eq (string-match
610 "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Z]\\)" 624 "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Z]\\)"
611 exp-str exp-pos) 625 math-exp-str math-exp-pos)
612 exp-pos)) 626 math-exp-pos))
613 (setq exp-token 'number 627 (setq math-exp-token 'number
614 exp-data (math-match-substring exp-str 1) 628 math-expr-data (math-match-substring math-exp-str 1)
615 exp-pos (match-end 1)) 629 math-exp-pos (match-end 1))
616 (if (eq (string-match "\\$\\([1-9][0-9]*\\)" exp-str exp-pos) 630 (if (eq (string-match "\\$\\([1-9][0-9]*\\)" math-exp-str math-exp-pos)
617 exp-pos) 631 math-exp-pos)
618 (setq exp-data (- (string-to-int (math-match-substring 632 (setq math-expr-data (- (string-to-int (math-match-substring
619 exp-str 1)))) 633 math-exp-str 1))))
620 (string-match "\\$+" exp-str exp-pos) 634 (string-match "\\$+" math-exp-str math-exp-pos)
621 (setq exp-data (- (match-end 0) (match-beginning 0)))) 635 (setq math-expr-data (- (match-end 0) (match-beginning 0))))
622 (setq exp-token 'dollar 636 (setq math-exp-token 'dollar
623 exp-pos (match-end 0)))) 637 math-exp-pos (match-end 0))))
624 ((eq ch ?\#) 638 ((eq ch ?\#)
625 (if (eq (string-match "#\\([1-9][0-9]*\\)" exp-str exp-pos) 639 (if (eq (string-match "#\\([1-9][0-9]*\\)" math-exp-str math-exp-pos)
626 exp-pos) 640 math-exp-pos)
627 (setq exp-data (string-to-int 641 (setq math-expr-data (string-to-int
628 (math-match-substring exp-str 1)) 642 (math-match-substring math-exp-str 1))
629 exp-pos (match-end 0)) 643 math-exp-pos (match-end 0))
630 (setq exp-data 1 644 (setq math-expr-data 1
631 exp-pos (1+ exp-pos))) 645 math-exp-pos (1+ math-exp-pos)))
632 (setq exp-token 'hash)) 646 (setq math-exp-token 'hash))
633 ((eq (string-match "~=\\|<=\\|>=\\|<>\\|/=\\|\\+/-\\|\\\\dots\\|\\\\ldots\\|\\*\\*\\|<<\\|>>\\|==\\|!=\\|&&&\\||||\\|!!!\\|&&\\|||\\|!!\\|:=\\|::\\|=>" 647 ((eq (string-match "~=\\|<=\\|>=\\|<>\\|/=\\|\\+/-\\|\\\\dots\\|\\\\ldots\\|\\*\\*\\|<<\\|>>\\|==\\|!=\\|&&&\\||||\\|!!!\\|&&\\|||\\|!!\\|:=\\|::\\|=>"
634 exp-str exp-pos) 648 math-exp-str math-exp-pos)
635 exp-pos) 649 math-exp-pos)
636 (setq exp-token 'punc 650 (setq math-exp-token 'punc
637 exp-data (math-match-substring exp-str 0) 651 math-expr-data (math-match-substring math-exp-str 0)
638 exp-pos (match-end 0))) 652 math-exp-pos (match-end 0)))
639 ((and (eq ch ?\") 653 ((and (eq ch ?\")
640 (string-match "\\(\"\\([^\"\\]\\|\\\\.\\)*\\)\\(\"\\|\\'\\)" exp-str exp-pos)) 654 (string-match "\\(\"\\([^\"\\]\\|\\\\.\\)*\\)\\(\"\\|\\'\\)"
655 math-exp-str math-exp-pos))
641 (if (eq calc-language 'eqn) 656 (if (eq calc-language 'eqn)
642 (progn 657 (progn
643 (setq exp-str (copy-sequence exp-str)) 658 (setq math-exp-str (copy-sequence math-exp-str))
644 (aset exp-str (match-beginning 1) ?\{) 659 (aset math-exp-str (match-beginning 1) ?\{)
645 (if (< (match-end 1) (length exp-str)) 660 (if (< (match-end 1) (length math-exp-str))
646 (aset exp-str (match-end 1) ?\})) 661 (aset math-exp-str (match-end 1) ?\}))
647 (math-read-token)) 662 (math-read-token))
648 (setq exp-token 'string 663 (setq math-exp-token 'string
649 exp-data (math-match-substring exp-str 1) 664 math-expr-data (math-match-substring math-exp-str 1)
650 exp-pos (match-end 0)))) 665 math-exp-pos (match-end 0))))
651 ((and (= ch ?\\) (eq calc-language 'tex) 666 ((and (= ch ?\\) (eq calc-language 'tex)
652 (< exp-pos (1- (length exp-str)))) 667 (< math-exp-pos (1- (length math-exp-str))))
653 (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}" exp-str exp-pos) 668 (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}"
654 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)" exp-str exp-pos)) 669 math-exp-str math-exp-pos)
655 (setq exp-token 'symbol 670 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)"
656 exp-pos (match-end 0) 671 math-exp-str math-exp-pos))
657 exp-data (math-restore-dashes 672 (setq math-exp-token 'symbol
658 (math-match-substring exp-str 1))) 673 math-exp-pos (match-end 0)
659 (let ((code (assoc exp-data math-tex-ignore-words))) 674 math-expr-data (math-restore-dashes
675 (math-match-substring math-exp-str 1)))
676 (let ((code (assoc math-expr-data math-tex-ignore-words)))
660 (cond ((null code)) 677 (cond ((null code))
661 ((null (cdr code)) 678 ((null (cdr code))
662 (math-read-token)) 679 (math-read-token))
663 ((eq (nth 1 code) 'punc) 680 ((eq (nth 1 code) 'punc)
664 (setq exp-token 'punc 681 (setq math-exp-token 'punc
665 exp-data (nth 2 code))) 682 math-expr-data (nth 2 code)))
666 ((and (eq (nth 1 code) 'mat) 683 ((and (eq (nth 1 code) 'mat)
667 (string-match " *{" exp-str exp-pos)) 684 (string-match " *{" math-exp-str math-exp-pos))
668 (setq exp-pos (match-end 0) 685 (setq math-exp-pos (match-end 0)
669 exp-token 'punc 686 math-exp-token 'punc
670 exp-data "[") 687 math-expr-data "[")
671 (let ((right (string-match "}" exp-str exp-pos))) 688 (let ((right (string-match "}" math-exp-str math-exp-pos)))
672 (and right 689 (and right
673 (setq exp-str (copy-sequence exp-str)) 690 (setq math-exp-str (copy-sequence math-exp-str))
674 (aset exp-str right ?\]))))))) 691 (aset math-exp-str right ?\])))))))
675 ((and (= ch ?\.) (eq calc-language 'fortran) 692 ((and (= ch ?\.) (eq calc-language 'fortran)
676 (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\." 693 (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\."
677 exp-str exp-pos) exp-pos)) 694 math-exp-str math-exp-pos) math-exp-pos))
678 (setq exp-token 'punc 695 (setq math-exp-token 'punc
679 exp-data (upcase (math-match-substring exp-str 0)) 696 math-expr-data (upcase (math-match-substring math-exp-str 0))
680 exp-pos (match-end 0))) 697 math-exp-pos (match-end 0)))
681 ((and (eq calc-language 'math) 698 ((and (eq calc-language 'math)
682 (eq (string-match "\\[\\[\\|->\\|:>" exp-str exp-pos) 699 (eq (string-match "\\[\\[\\|->\\|:>" math-exp-str math-exp-pos)
683 exp-pos)) 700 math-exp-pos))
684 (setq exp-token 'punc 701 (setq math-exp-token 'punc
685 exp-data (math-match-substring exp-str 0) 702 math-expr-data (math-match-substring math-exp-str 0)
686 exp-pos (match-end 0))) 703 math-exp-pos (match-end 0)))
687 ((and (eq calc-language 'eqn) 704 ((and (eq calc-language 'eqn)
688 (eq (string-match "->\\|<-\\|+-\\|\\\\dots\\|~\\|\\^" 705 (eq (string-match "->\\|<-\\|+-\\|\\\\dots\\|~\\|\\^"
689 exp-str exp-pos) 706 math-exp-str math-exp-pos)
690 exp-pos)) 707 math-exp-pos))
691 (setq exp-token 'punc 708 (setq math-exp-token 'punc
692 exp-data (math-match-substring exp-str 0) 709 math-expr-data (math-match-substring math-exp-str 0)
693 exp-pos (match-end 0)) 710 math-exp-pos (match-end 0))
694 (and (eq (string-match "\\\\dots\\." exp-str exp-pos) exp-pos) 711 (and (eq (string-match "\\\\dots\\." math-exp-str math-exp-pos)
695 (setq exp-pos (match-end 0))) 712 math-exp-pos)
696 (if (memq (aref exp-data 0) '(?~ ?^)) 713 (setq math-exp-pos (match-end 0)))
714 (if (memq (aref math-expr-data 0) '(?~ ?^))
697 (math-read-token))) 715 (math-read-token)))
698 ((eq (string-match "%%.*$" exp-str exp-pos) exp-pos) 716 ((eq (string-match "%%.*$" math-exp-str math-exp-pos) math-exp-pos)
699 (setq exp-pos (match-end 0)) 717 (setq math-exp-pos (match-end 0))
700 (math-read-token)) 718 (math-read-token))
701 (t 719 (t
702 (if (and (eq ch ?\{) (memq calc-language '(tex eqn))) 720 (if (and (eq ch ?\{) (memq calc-language '(tex eqn)))
@@ -705,9 +723,9 @@
705 (setq ch ?\))) 723 (setq ch ?\)))
706 (if (and (eq ch ?\&) (eq calc-language 'tex)) 724 (if (and (eq ch ?\&) (eq calc-language 'tex))
707 (setq ch ?\,)) 725 (setq ch ?\,))
708 (setq exp-token 'punc 726 (setq math-exp-token 'punc
709 exp-data (char-to-string ch) 727 math-expr-data (char-to-string ch)
710 exp-pos (1+ exp-pos))))))) 728 math-exp-pos (1+ math-exp-pos)))))))
711 729
712 730
713(defun math-read-expr-level (exp-prec &optional exp-term) 731(defun math-read-expr-level (exp-prec &optional exp-term)
@@ -716,10 +734,10 @@
716 (setq op (calc-check-user-syntax x exp-prec)) 734 (setq op (calc-check-user-syntax x exp-prec))
717 (setq x op 735 (setq x op
718 op '("2x" ident 999999 -1))) 736 op '("2x" ident 999999 -1)))
719 (and (setq op (assoc exp-data math-expr-opers)) 737 (and (setq op (assoc math-expr-data math-expr-opers))
720 (/= (nth 2 op) -1) 738 (/= (nth 2 op) -1)
721 (or (and (setq op2 (assoc 739 (or (and (setq op2 (assoc
722 exp-data 740 math-expr-data
723 (cdr (memq op math-expr-opers)))) 741 (cdr (memq op math-expr-opers))))
724 (eq (= (nth 3 op) -1) 742 (eq (= (nth 3 op) -1)
725 (/= (nth 3 op2) -1)) 743 (/= (nth 3 op2) -1))
@@ -728,27 +746,27 @@
728 (setq op op2)) 746 (setq op op2))
729 t)) 747 t))
730 (and (or (eq (nth 2 op) -1) 748 (and (or (eq (nth 2 op) -1)
731 (memq exp-token '(symbol number dollar hash)) 749 (memq math-exp-token '(symbol number dollar hash))
732 (equal exp-data "(") 750 (equal math-expr-data "(")
733 (and (equal exp-data "[") 751 (and (equal math-expr-data "[")
734 (not (eq calc-language 'math)) 752 (not (eq calc-language 'math))
735 (not (and exp-keep-spaces 753 (not (and math-exp-keep-spaces
736 (eq (car-safe x) 'vec))))) 754 (eq (car-safe x) 'vec)))))
737 (or (not (setq op (assoc exp-data math-expr-opers))) 755 (or (not (setq op (assoc math-expr-data math-expr-opers)))
738 (/= (nth 2 op) -1)) 756 (/= (nth 2 op) -1))
739 (or (not calc-user-parse-table) 757 (or (not calc-user-parse-table)
740 (not (eq exp-token 'symbol)) 758 (not (eq math-exp-token 'symbol))
741 (let ((p calc-user-parse-table)) 759 (let ((p calc-user-parse-table))
742 (while (and p 760 (while (and p
743 (or (not (integerp 761 (or (not (integerp
744 (car (car (car p))))) 762 (car (car (car p)))))
745 (not (equal 763 (not (equal
746 (nth 1 (car (car p))) 764 (nth 1 (car (car p)))
747 exp-data)))) 765 math-expr-data))))
748 (setq p (cdr p))) 766 (setq p (cdr p)))
749 (not p))) 767 (not p)))
750 (setq op (assoc "2x" math-expr-opers)))) 768 (setq op (assoc "2x" math-expr-opers))))
751 (not (and exp-term (equal exp-data exp-term))) 769 (not (and exp-term (equal math-expr-data exp-term)))
752 (>= (nth 2 op) exp-prec)) 770 (>= (nth 2 op) exp-prec))
753 (if (not (equal (car op) "2x")) 771 (if (not (equal (car op) "2x"))
754 (math-read-token)) 772 (math-read-token))
@@ -787,13 +805,13 @@
787 (if x 805 (if x
788 (and (integerp (car rule)) 806 (and (integerp (car rule))
789 (>= (car rule) prec) 807 (>= (car rule) prec)
790 (equal exp-data 808 (equal math-expr-data
791 (car (setq rule (cdr rule))))) 809 (car (setq rule (cdr rule)))))
792 (equal exp-data (car rule))))) 810 (equal math-expr-data (car rule)))))
793 (let ((save-exp-pos exp-pos) 811 (let ((save-exp-pos math-exp-pos)
794 (save-exp-old-pos exp-old-pos) 812 (save-exp-old-pos math-exp-old-pos)
795 (save-exp-token exp-token) 813 (save-exp-token math-exp-token)
796 (save-exp-data exp-data)) 814 (save-exp-data math-expr-data))
797 (or (not (listp 815 (or (not (listp
798 (setq matches (calc-match-user-syntax rule)))) 816 (setq matches (calc-match-user-syntax rule))))
799 (let ((args (progn 817 (let ((args (progn
@@ -856,22 +874,23 @@
856 (if match 874 (if match
857 (not (setq match (math-multi-subst 875 (not (setq match (math-multi-subst
858 match args matches))) 876 match args matches)))
859 (setq exp-old-pos save-exp-old-pos 877 (setq math-exp-old-pos save-exp-old-pos
860 exp-token save-exp-token 878 math-exp-token save-exp-token
861 exp-data save-exp-data 879 math-expr-data save-exp-data
862 exp-pos save-exp-pos))))))) 880 math-exp-pos save-exp-pos)))))))
863 (setq p (cdr p))) 881 (setq p (cdr p)))
864 (and p match))) 882 (and p match)))
865 883
866(defun calc-match-user-syntax (p &optional term) 884(defun calc-match-user-syntax (p &optional term)
867 (let ((matches nil) 885 (let ((matches nil)
868 (save-exp-pos exp-pos) 886 (save-exp-pos math-exp-pos)
869 (save-exp-old-pos exp-old-pos) 887 (save-exp-old-pos math-exp-old-pos)
870 (save-exp-token exp-token) 888 (save-exp-token math-exp-token)
871 (save-exp-data exp-data)) 889 (save-exp-data math-expr-data)
890 m)
872 (while (and p 891 (while (and p
873 (cond ((stringp (car p)) 892 (cond ((stringp (car p))
874 (and (equal exp-data (car p)) 893 (and (equal math-expr-data (car p))
875 (progn 894 (progn
876 (math-read-token) 895 (math-read-token)
877 t))) 896 t)))
@@ -895,7 +914,7 @@
895 (cons 'vec (and (listp m) m)))))) 914 (cons 'vec (and (listp m) m))))))
896 (or (listp m) (not (nth 2 (car p))) 915 (or (listp m) (not (nth 2 (car p)))
897 (not (eq (aref (car (nth 2 (car p))) 0) ?\$)) 916 (not (eq (aref (car (nth 2 (car p))) 0) ?\$))
898 (eq exp-token 'end))) 917 (eq math-exp-token 'end)))
899 (t 918 (t
900 (setq m (calc-match-user-syntax (nth 1 (car p)) 919 (setq m (calc-match-user-syntax (nth 1 (car p))
901 (car (nth 2 (car p))))) 920 (car (nth 2 (car p)))))
@@ -903,22 +922,22 @@
903 (let ((vec (cons 'vec m)) 922 (let ((vec (cons 'vec m))
904 opos mm) 923 opos mm)
905 (while (and (listp 924 (while (and (listp
906 (setq opos exp-pos 925 (setq opos math-exp-pos
907 mm (calc-match-user-syntax 926 mm (calc-match-user-syntax
908 (or (nth 2 (car p)) 927 (or (nth 2 (car p))
909 (nth 1 (car p))) 928 (nth 1 (car p)))
910 (car (nth 2 (car p)))))) 929 (car (nth 2 (car p))))))
911 (> exp-pos opos)) 930 (> math-exp-pos opos))
912 (setq vec (nconc vec mm))) 931 (setq vec (nconc vec mm)))
913 (setq matches (nconc matches (list vec)))) 932 (setq matches (nconc matches (list vec))))
914 (and (eq (car (car p)) '*) 933 (and (eq (car (car p)) '*)
915 (setq matches (nconc matches (list '(vec))))))))) 934 (setq matches (nconc matches (list '(vec)))))))))
916 (setq p (cdr p))) 935 (setq p (cdr p)))
917 (if p 936 (if p
918 (setq exp-pos save-exp-pos 937 (setq math-exp-pos save-exp-pos
919 exp-old-pos save-exp-old-pos 938 math-exp-old-pos save-exp-old-pos
920 exp-token save-exp-token 939 math-exp-token save-exp-token
921 exp-data save-exp-data 940 math-expr-data save-exp-data
922 matches "Failed")) 941 matches "Failed"))
923 matches)) 942 matches))
924 943
@@ -940,28 +959,28 @@
940 959
941(defun math-read-if (cond op) 960(defun math-read-if (cond op)
942 (let ((then (math-read-expr-level 0))) 961 (let ((then (math-read-expr-level 0)))
943 (or (equal exp-data ":") 962 (or (equal math-expr-data ":")
944 (throw 'syntax "Expected ':'")) 963 (throw 'syntax "Expected ':'"))
945 (math-read-token) 964 (math-read-token)
946 (list 'calcFunc-if cond then (math-read-expr-level (nth 3 op))))) 965 (list 'calcFunc-if cond then (math-read-expr-level (nth 3 op)))))
947 966
948(defun math-factor-after () 967(defun math-factor-after ()
949 (let ((exp-pos exp-pos) 968 (let ((math-exp-pos math-exp-pos)
950 exp-old-pos exp-token exp-data) 969 math-exp-old-pos math-exp-token math-expr-data)
951 (math-read-token) 970 (math-read-token)
952 (or (memq exp-token '(number symbol dollar hash string)) 971 (or (memq math-exp-token '(number symbol dollar hash string))
953 (and (assoc exp-data '(("-") ("+") ("!") ("|") ("/"))) 972 (and (assoc math-expr-data '(("-") ("+") ("!") ("|") ("/")))
954 (assoc (concat "u" exp-data) math-expr-opers)) 973 (assoc (concat "u" math-expr-data) math-expr-opers))
955 (eq (nth 2 (assoc exp-data math-expr-opers)) -1) 974 (eq (nth 2 (assoc math-expr-data math-expr-opers)) -1)
956 (assoc exp-data '(("(") ("[") ("{")))))) 975 (assoc math-expr-data '(("(") ("[") ("{"))))))
957 976
958(defun math-read-factor () 977(defun math-read-factor ()
959 (let (op) 978 (let (op)
960 (cond ((eq exp-token 'number) 979 (cond ((eq math-exp-token 'number)
961 (let ((num (math-read-number exp-data))) 980 (let ((num (math-read-number math-expr-data)))
962 (if (not num) 981 (if (not num)
963 (progn 982 (progn
964 (setq exp-old-pos exp-pos) 983 (setq math-exp-old-pos math-exp-pos)
965 (throw 'syntax "Bad format"))) 984 (throw 'syntax "Bad format")))
966 (math-read-token) 985 (math-read-token)
967 (if (and math-read-expr-quotes 986 (if (and math-read-expr-quotes
@@ -971,14 +990,14 @@
971 ((and calc-user-parse-table 990 ((and calc-user-parse-table
972 (setq op (calc-check-user-syntax))) 991 (setq op (calc-check-user-syntax)))
973 op) 992 op)
974 ((or (equal exp-data "-") 993 ((or (equal math-expr-data "-")
975 (equal exp-data "+") 994 (equal math-expr-data "+")
976 (equal exp-data "!") 995 (equal math-expr-data "!")
977 (equal exp-data "|") 996 (equal math-expr-data "|")
978 (equal exp-data "/")) 997 (equal math-expr-data "/"))
979 (setq exp-data (concat "u" exp-data)) 998 (setq math-expr-data (concat "u" math-expr-data))
980 (math-read-factor)) 999 (math-read-factor))
981 ((and (setq op (assoc exp-data math-expr-opers)) 1000 ((and (setq op (assoc math-expr-data math-expr-opers))
982 (eq (nth 2 op) -1)) 1001 (eq (nth 2 op) -1))
983 (if (consp (nth 1 op)) 1002 (if (consp (nth 1 op))
984 (funcall (car (nth 1 op)) op) 1003 (funcall (car (nth 1 op)) op)
@@ -990,20 +1009,20 @@
990 (equal (car op) "u-")) 1009 (equal (car op) "u-"))
991 (math-neg val)) 1010 (math-neg val))
992 (t (list (nth 1 op) val)))))) 1011 (t (list (nth 1 op) val))))))
993 ((eq exp-token 'symbol) 1012 ((eq math-exp-token 'symbol)
994 (let ((sym (intern exp-data))) 1013 (let ((sym (intern math-expr-data)))
995 (math-read-token) 1014 (math-read-token)
996 (if (equal exp-data calc-function-open) 1015 (if (equal math-expr-data calc-function-open)
997 (let ((f (assq sym math-expr-function-mapping))) 1016 (let ((f (assq sym math-expr-function-mapping)))
998 (math-read-token) 1017 (math-read-token)
999 (if (consp (cdr f)) 1018 (if (consp (cdr f))
1000 (funcall (car (cdr f)) f sym) 1019 (funcall (car (cdr f)) f sym)
1001 (let ((args (if (or (equal exp-data calc-function-close) 1020 (let ((args (if (or (equal math-expr-data calc-function-close)
1002 (eq exp-token 'end)) 1021 (eq math-exp-token 'end))
1003 nil 1022 nil
1004 (math-read-expr-list)))) 1023 (math-read-expr-list))))
1005 (if (not (or (equal exp-data calc-function-close) 1024 (if (not (or (equal math-expr-data calc-function-close)
1006 (eq exp-token 'end))) 1025 (eq math-exp-token 'end)))
1007 (throw 'syntax "Expected `)'")) 1026 (throw 'syntax "Expected `)'"))
1008 (math-read-token) 1027 (math-read-token)
1009 (if (and (eq calc-language 'fortran) args 1028 (if (and (eq calc-language 'fortran) args
@@ -1045,44 +1064,44 @@
1045 4)) 1064 4))
1046 (cdr v)))))) 1065 (cdr v))))))
1047 (while (and (memq calc-language '(c pascal maple)) 1066 (while (and (memq calc-language '(c pascal maple))
1048 (equal exp-data "[")) 1067 (equal math-expr-data "["))
1049 (math-read-token) 1068 (math-read-token)
1050 (setq val (append (list 'calcFunc-subscr val) 1069 (setq val (append (list 'calcFunc-subscr val)
1051 (math-read-expr-list))) 1070 (math-read-expr-list)))
1052 (if (equal exp-data "]") 1071 (if (equal math-expr-data "]")
1053 (math-read-token) 1072 (math-read-token)
1054 (throw 'syntax "Expected ']'"))) 1073 (throw 'syntax "Expected ']'")))
1055 val))))) 1074 val)))))
1056 ((eq exp-token 'dollar) 1075 ((eq math-exp-token 'dollar)
1057 (let ((abs (if (> exp-data 0) exp-data (- exp-data)))) 1076 (let ((abs (if (> math-expr-data 0) math-expr-data (- math-expr-data))))
1058 (if (>= (length calc-dollar-values) abs) 1077 (if (>= (length calc-dollar-values) abs)
1059 (let ((num exp-data)) 1078 (let ((num math-expr-data))
1060 (math-read-token) 1079 (math-read-token)
1061 (setq calc-dollar-used (max calc-dollar-used num)) 1080 (setq calc-dollar-used (max calc-dollar-used num))
1062 (math-check-complete (nth (1- abs) calc-dollar-values))) 1081 (math-check-complete (nth (1- abs) calc-dollar-values)))
1063 (throw 'syntax (if calc-dollar-values 1082 (throw 'syntax (if calc-dollar-values
1064 "Too many $'s" 1083 "Too many $'s"
1065 "$'s not allowed in this context"))))) 1084 "$'s not allowed in this context")))))
1066 ((eq exp-token 'hash) 1085 ((eq math-exp-token 'hash)
1067 (or calc-hashes-used 1086 (or calc-hashes-used
1068 (throw 'syntax "#'s not allowed in this context")) 1087 (throw 'syntax "#'s not allowed in this context"))
1069 (calc-extensions) 1088 (calc-extensions)
1070 (if (<= exp-data (length calc-arg-values)) 1089 (if (<= math-expr-data (length calc-arg-values))
1071 (let ((num exp-data)) 1090 (let ((num math-expr-data))
1072 (math-read-token) 1091 (math-read-token)
1073 (setq calc-hashes-used (max calc-hashes-used num)) 1092 (setq calc-hashes-used (max calc-hashes-used num))
1074 (nth (1- num) calc-arg-values)) 1093 (nth (1- num) calc-arg-values))
1075 (throw 'syntax "Too many # arguments"))) 1094 (throw 'syntax "Too many # arguments")))
1076 ((equal exp-data "(") 1095 ((equal math-expr-data "(")
1077 (let* ((exp (let ((exp-keep-spaces nil)) 1096 (let* ((exp (let ((math-exp-keep-spaces nil))
1078 (math-read-token) 1097 (math-read-token)
1079 (if (or (equal exp-data "\\dots") 1098 (if (or (equal math-expr-data "\\dots")
1080 (equal exp-data "\\ldots")) 1099 (equal math-expr-data "\\ldots"))
1081 '(neg (var inf var-inf)) 1100 '(neg (var inf var-inf))
1082 (math-read-expr-level 0))))) 1101 (math-read-expr-level 0)))))
1083 (let ((exp-keep-spaces nil)) 1102 (let ((math-exp-keep-spaces nil))
1084 (cond 1103 (cond
1085 ((equal exp-data ",") 1104 ((equal math-expr-data ",")
1086 (progn 1105 (progn
1087 (math-read-token) 1106 (math-read-token)
1088 (let ((exp2 (math-read-expr-level 0))) 1107 (let ((exp2 (math-read-expr-level 0)))
@@ -1090,7 +1109,7 @@
1090 (if (and exp2 (Math-realp exp) (Math-realp exp2)) 1109 (if (and exp2 (Math-realp exp) (Math-realp exp2))
1091 (math-normalize (list 'cplx exp exp2)) 1110 (math-normalize (list 'cplx exp exp2))
1092 (list '+ exp (list '* exp2 '(var i var-i)))))))) 1111 (list '+ exp (list '* exp2 '(var i var-i))))))))
1093 ((equal exp-data ";") 1112 ((equal math-expr-data ";")
1094 (progn 1113 (progn
1095 (math-read-token) 1114 (math-read-token)
1096 (let ((exp2 (math-read-expr-level 0))) 1115 (let ((exp2 (math-read-expr-level 0)))
@@ -1103,36 +1122,36 @@
1103 (list '* 1122 (list '*
1104 (math-to-radians-2 exp2) 1123 (math-to-radians-2 exp2)
1105 '(var i var-i))))))))) 1124 '(var i var-i)))))))))
1106 ((or (equal exp-data "\\dots") 1125 ((or (equal math-expr-data "\\dots")
1107 (equal exp-data "\\ldots")) 1126 (equal math-expr-data "\\ldots"))
1108 (progn 1127 (progn
1109 (math-read-token) 1128 (math-read-token)
1110 (let ((exp2 (if (or (equal exp-data ")") 1129 (let ((exp2 (if (or (equal math-expr-data ")")
1111 (equal exp-data "]") 1130 (equal math-expr-data "]")
1112 (eq exp-token 'end)) 1131 (eq math-exp-token 'end))
1113 '(var inf var-inf) 1132 '(var inf var-inf)
1114 (math-read-expr-level 0)))) 1133 (math-read-expr-level 0))))
1115 (setq exp 1134 (setq exp
1116 (list 'intv 1135 (list 'intv
1117 (if (equal exp-data ")") 0 1) 1136 (if (equal math-expr-data ")") 0 1)
1118 exp 1137 exp
1119 exp2))))))) 1138 exp2)))))))
1120 (if (not (or (equal exp-data ")") 1139 (if (not (or (equal math-expr-data ")")
1121 (and (equal exp-data "]") (eq (car-safe exp) 'intv)) 1140 (and (equal math-expr-data "]") (eq (car-safe exp) 'intv))
1122 (eq exp-token 'end))) 1141 (eq math-exp-token 'end)))
1123 (throw 'syntax "Expected `)'")) 1142 (throw 'syntax "Expected `)'"))
1124 (math-read-token) 1143 (math-read-token)
1125 exp)) 1144 exp))
1126 ((eq exp-token 'string) 1145 ((eq math-exp-token 'string)
1127 (calc-extensions) 1146 (calc-extensions)
1128 (math-read-string)) 1147 (math-read-string))
1129 ((equal exp-data "[") 1148 ((equal math-expr-data "[")
1130 (calc-extensions) 1149 (calc-extensions)
1131 (math-read-brackets t "]")) 1150 (math-read-brackets t "]"))
1132 ((equal exp-data "{") 1151 ((equal math-expr-data "{")
1133 (calc-extensions) 1152 (calc-extensions)
1134 (math-read-brackets nil "}")) 1153 (math-read-brackets nil "}"))
1135 ((equal exp-data "<") 1154 ((equal math-expr-data "<")
1136 (calc-extensions) 1155 (calc-extensions)
1137 (math-read-angle-brackets)) 1156 (math-read-angle-brackets))
1138 (t (throw 'syntax "Expected a number"))))) 1157 (t (throw 'syntax "Expected a number")))))
diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el
index c7ecbecc80b..8b0dffe3f15 100644
--- a/lisp/calc/calc-comb.el
+++ b/lisp/calc/calc-comb.el
@@ -82,6 +82,11 @@
82 4877 4889 4903 4909 4919 4931 4933 4937 4943 4951 4957 4967 4969 4973 82 4877 4889 4903 4909 4919 4931 4933 4937 4943 4951 4957 4967 4969 4973
83 4987 4993 4999 5003]) 83 4987 4993 4999 5003])
84 84
85;; The variable math-prime-factors-finished is set by calcFunc-prfac to
86;; indicate whether factoring is complete, and used by calcFunc-factors,
87;; calcFunc-totient and calcFunc-moebius.
88(defvar math-prime-factors-finished)
89
85;;; Combinatorics 90;;; Combinatorics
86 91
87(defun calc-gcd (arg) 92(defun calc-gcd (arg)
@@ -195,6 +200,8 @@
195 (res (math-prime-test n iters))) 200 (res (math-prime-test n iters)))
196 (calc-report-prime-test res)))) 201 (calc-report-prime-test res))))
197 202
203(defvar calc-verbose-nextprime nil)
204
198(defun calc-next-prime (iters) 205(defun calc-next-prime (iters)
199 (interactive "p") 206 (interactive "p")
200 (calc-slow-wrapper 207 (calc-slow-wrapper
@@ -386,7 +393,7 @@
386 (if (math-evenp temp) 393 (if (math-evenp temp)
387 even 394 even
388 (math-div (calcFunc-fact n) even)))) 395 (math-div (calcFunc-fact n) even))))
389 (list 'calcFunc-dfact max)))) 396 (list 'calcFunc-dfact n))))
390 ((equal n '(var inf var-inf)) n) 397 ((equal n '(var inf var-inf)) n)
391 (t (calc-record-why 'natnump n) 398 (t (calc-record-why 'natnump n)
392 (list 'calcFunc-dfact n)))) 399 (list 'calcFunc-dfact n))))
@@ -484,6 +491,12 @@
484 (math-stirling-number n m 0)) 491 (math-stirling-number n m 0))
485 492
486(defvar math-stirling-cache (vector [[1]] [[1]])) 493(defvar math-stirling-cache (vector [[1]] [[1]]))
494
495;; The variable math-stirling-local-cache is local to
496;; math-stirling-number, but is used by math-stirling-1
497;; and math-stirling-2, which are called by math-stirling-number.
498(defvar math-stirling-local-cache)
499
487(defun math-stirling-number (n m k) 500(defun math-stirling-number (n m k)
488 (or (math-num-natnump n) (math-reject-arg n 'natnump)) 501 (or (math-num-natnump n) (math-reject-arg n 'natnump))
489 (or (math-num-natnump m) (math-reject-arg m 'natnump)) 502 (or (math-num-natnump m) (math-reject-arg m 'natnump))
@@ -493,14 +506,16 @@
493 (or (integerp m) (math-reject-arg m 'fixnump)) 506 (or (integerp m) (math-reject-arg m 'fixnump))
494 (if (< n m) 507 (if (< n m)
495 0 508 0
496 (let ((cache (aref math-stirling-cache k))) 509 (let ((math-stirling-local-cache (aref math-stirling-cache k)))
497 (while (<= (length cache) n) 510 (while (<= (length math-stirling-local-cache) n)
498 (let ((i (1- (length cache))) 511 (let ((i (1- (length math-stirling-local-cache)))
499 row) 512 row)
500 (setq cache (vconcat cache (make-vector (length cache) nil))) 513 (setq math-stirling-local-cache
501 (aset math-stirling-cache k cache) 514 (vconcat math-stirling-local-cache
502 (while (< (setq i (1+ i)) (length cache)) 515 (make-vector (length math-stirling-local-cache) nil)))
503 (aset cache i (setq row (make-vector (1+ i) nil))) 516 (aset math-stirling-cache k math-stirling-local-cache)
517 (while (< (setq i (1+ i)) (length math-stirling-local-cache))
518 (aset math-stirling-local-cache i (setq row (make-vector (1+ i) nil)))
504 (aset row 0 0) 519 (aset row 0 0)
505 (aset row i 1)))) 520 (aset row i 1))))
506 (if (= k 1) 521 (if (= k 1)
@@ -508,14 +523,14 @@
508 (math-stirling-2 n m))))) 523 (math-stirling-2 n m)))))
509 524
510(defun math-stirling-1 (n m) 525(defun math-stirling-1 (n m)
511 (or (aref (aref cache n) m) 526 (or (aref (aref math-stirling-local-cache n) m)
512 (aset (aref cache n) m 527 (aset (aref math-stirling-local-cache n) m
513 (math-add (math-stirling-1 (1- n) (1- m)) 528 (math-add (math-stirling-1 (1- n) (1- m))
514 (math-mul (- 1 n) (math-stirling-1 (1- n) m)))))) 529 (math-mul (- 1 n) (math-stirling-1 (1- n) m))))))
515 530
516(defun math-stirling-2 (n m) 531(defun math-stirling-2 (n m)
517 (or (aref (aref cache n) m) 532 (or (aref (aref math-stirling-local-cache n) m)
518 (aset (aref cache n) m 533 (aset (aref math-stirling-local-cache n) m
519 (math-add (math-stirling-2 (1- n) (1- m)) 534 (math-add (math-stirling-2 (1- n) (1- m))
520 (math-mul m (math-stirling-2 (1- n) m)))))) 535 (math-mul m (math-stirling-2 (1- n) m))))))
521 536
@@ -527,8 +542,13 @@
527 542
528;;; Produce a random 10-bit integer, with (random) if no seed provided, 543;;; Produce a random 10-bit integer, with (random) if no seed provided,
529;;; or else with Numerical Recipes algorithm ran3 / Knuth 3.2.2-A. 544;;; or else with Numerical Recipes algorithm ran3 / Knuth 3.2.2-A.
545
546(defvar var-RandSeed nil)
547(defvar math-random-cache nil)
548(defvar math-gaussian-cache nil)
549
530(defun math-init-random-base () 550(defun math-init-random-base ()
531 (if (and (boundp 'var-RandSeed) var-RandSeed) 551 (if var-RandSeed
532 (if (eq (car-safe var-RandSeed) 'vec) 552 (if (eq (car-safe var-RandSeed) 'vec)
533 nil 553 nil
534 (if (Math-integerp var-RandSeed) 554 (if (Math-integerp var-RandSeed)
@@ -555,13 +575,13 @@
555 (random t) 575 (random t)
556 (setq var-RandSeed nil 576 (setq var-RandSeed nil
557 math-random-cache nil 577 math-random-cache nil
558 i 0
559 math-random-shift -4) ; assume RAND_MAX >= 16383 578 math-random-shift -4) ; assume RAND_MAX >= 16383
560 ;; This exercises the random number generator and also helps 579 ;; This exercises the random number generator and also helps
561 ;; deduce a better value for RAND_MAX. 580 ;; deduce a better value for RAND_MAX.
562 (while (< (setq i (1+ i)) 30) 581 (let ((i 0))
563 (if (> (lsh (math-abs (random)) math-random-shift) 4095) 582 (while (< (setq i (1+ i)) 30)
564 (setq math-random-shift (1- math-random-shift))))) 583 (if (> (lsh (math-abs (random)) math-random-shift) 4095)
584 (setq math-random-shift (1- math-random-shift))))))
565 (setq math-last-RandSeed var-RandSeed 585 (setq math-last-RandSeed var-RandSeed
566 math-gaussian-cache nil)) 586 math-gaussian-cache nil))
567 587
@@ -583,8 +603,8 @@
583;;; Avoid various pitfalls that may lurk in the built-in (random) function! 603;;; Avoid various pitfalls that may lurk in the built-in (random) function!
584;;; Shuffling algorithm from Numerical Recipes, section 7.1. 604;;; Shuffling algorithm from Numerical Recipes, section 7.1.
585(defun math-random-digit () 605(defun math-random-digit ()
586 (let (i) 606 (let (i math-random-last)
587 (or (and (boundp 'var-RandSeed) (eq var-RandSeed math-last-RandSeed)) 607 (or (eq var-RandSeed math-last-RandSeed)
588 (math-init-random-base)) 608 (math-init-random-base))
589 (or math-random-cache 609 (or math-random-cache
590 (progn 610 (progn
@@ -599,7 +619,6 @@
599 (aset math-random-cache i (math-random-base)) 619 (aset math-random-cache i (math-random-base))
600 (>= math-random-last 1000))) 620 (>= math-random-last 1000)))
601 math-random-last)) 621 math-random-last))
602(setq math-random-cache nil)
603 622
604;;; Produce an N-digit random integer. 623;;; Produce an N-digit random integer.
605(defun math-random-digits (n) 624(defun math-random-digits (n)
@@ -639,7 +658,6 @@
639 (setq math-gaussian-cache (cons calc-internal-prec 658 (setq math-gaussian-cache (cons calc-internal-prec
640 (math-mul v1 fac))) 659 (math-mul v1 fac)))
641 (math-mul v2 fac)))))) 660 (math-mul v2 fac))))))
642(setq math-gaussian-cache nil)
643 661
644;;; Produce a random integer or real 0 <= N < MAX. 662;;; Produce a random integer or real 0 <= N < MAX.
645(defun calcFunc-random (max) 663(defun calcFunc-random (max)
@@ -765,6 +783,12 @@
765;;; (nil unknown) if non-prime with no known factors, 783;;; (nil unknown) if non-prime with no known factors,
766;;; (t) if prime, 784;;; (t) if prime,
767;;; (maybe N P) if probably prime (after N iters with probability P%) 785;;; (maybe N P) if probably prime (after N iters with probability P%)
786(defvar math-prime-test-cache '(-1))
787
788(defvar math-prime-test-cache-k)
789(defvar math-prime-test-cache-q)
790(defvar math-prime-test-cache-nm1)
791
768(defun math-prime-test (n iters) 792(defun math-prime-test (n iters)
769 (if (and (Math-vectorp n) (cdr n)) 793 (if (and (Math-vectorp n) (cdr n))
770 (setq n (nth (1- (length n)) n))) 794 (setq n (nth (1- (length n)) n)))
@@ -849,7 +873,6 @@
849 (1- iters) 873 (1- iters)
850 0))) 874 0)))
851 res)) 875 res))
852(defvar math-prime-test-cache '(-1))
853 876
854(defun calcFunc-prime (n &optional iters) 877(defun calcFunc-prime (n &optional iters)
855 (or (math-num-integerp n) (math-reject-arg n 'integerp)) 878 (or (math-num-integerp n) (math-reject-arg n 'integerp))
@@ -965,7 +988,6 @@
965 (if (Math-realp n) 988 (if (Math-realp n)
966 (calcFunc-nextprime (math-trunc n) iters) 989 (calcFunc-nextprime (math-trunc n) iters)
967 (math-reject-arg n 'integerp)))) 990 (math-reject-arg n 'integerp))))
968(setq calc-verbose-nextprime nil)
969 991
970(defun calcFunc-prevprime (n &optional iters) 992(defun calcFunc-prevprime (n &optional iters)
971 (if (Math-integerp n) 993 (if (Math-integerp n)
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 4679cf8abaa..77057fd4a7a 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -108,6 +108,7 @@
108 (define-key calc-mode-map "\C-w" 'calc-kill-region) 108 (define-key calc-mode-map "\C-w" 'calc-kill-region)
109 (define-key calc-mode-map "\M-w" 'calc-copy-region-as-kill) 109 (define-key calc-mode-map "\M-w" 'calc-copy-region-as-kill)
110 (define-key calc-mode-map "\C-y" 'calc-yank) 110 (define-key calc-mode-map "\C-y" 'calc-yank)
111 (define-key calc-mode-map [mouse-2] 'calc-yank)
111 (define-key calc-mode-map "\C-_" 'calc-undo) 112 (define-key calc-mode-map "\C-_" 'calc-undo)
112 (define-key calc-mode-map "\C-xu" 'calc-undo) 113 (define-key calc-mode-map "\C-xu" 'calc-undo)
113 (define-key calc-mode-map "\M-\C-m" 'calc-last-args) 114 (define-key calc-mode-map "\M-\C-m" 'calc-last-args)
@@ -662,16 +663,6 @@
662 (define-key calc-alg-map "\e\C-m" 'calc-last-args-stub) 663 (define-key calc-alg-map "\e\C-m" 'calc-last-args-stub)
663 (define-key calc-alg-map "\e\177" 'calc-pop-above) 664 (define-key calc-alg-map "\e\177" 'calc-pop-above)
664 665
665 ;; The following is a relic for backward compatability only.
666 ;; The calc-define property list is now the recommended method.
667 (if (and (boundp 'calc-ext-defs)
668 calc-ext-defs)
669 (progn
670 (calc-need-macros)
671 (message "Evaluating calc-ext-defs...")
672 (eval (cons 'progn calc-ext-defs))
673 (setq calc-ext-defs nil)))
674
675;;;; (Autoloads here) 666;;;; (Autoloads here)
676 (mapcar (function (lambda (x) 667 (mapcar (function (lambda (x)
677 (mapcar (function (lambda (func) 668 (mapcar (function (lambda (func)
@@ -1769,10 +1760,13 @@ calc-kill calc-kill-region calc-yank))))
1769 (cdr res) 1760 (cdr res)
1770 res))) 1761 res)))
1771 1762
1763(defvar calc-z-prefix-buf nil)
1764(defvar calc-z-prefix-msgs nil)
1765
1772(defun calc-z-prefix-help () 1766(defun calc-z-prefix-help ()
1773 (interactive) 1767 (interactive)
1774 (let* ((msgs nil) 1768 (let* ((calc-z-prefix-msgs nil)
1775 (buf "") 1769 (calc-z-prefix-buf "")
1776 (kmap (sort (copy-sequence (calc-user-key-map)) 1770 (kmap (sort (copy-sequence (calc-user-key-map))
1777 (function (lambda (x y) (< (car x) (car y)))))) 1771 (function (lambda (x y) (< (car x) (car y))))))
1778 (flags (apply 'logior 1772 (flags (apply 'logior
@@ -1783,12 +1777,12 @@ calc-kill calc-kill-region calc-yank))))
1783 (if (= (logand flags 8) 0) 1777 (if (= (logand flags 8) 0)
1784 (calc-user-function-list kmap 7) 1778 (calc-user-function-list kmap 7)
1785 (calc-user-function-list kmap 1) 1779 (calc-user-function-list kmap 1)
1786 (setq msgs (cons buf msgs) 1780 (setq calc-z-prefix-msgs (cons calc-z-prefix-buf calc-z-prefix-msgs)
1787 buf "") 1781 calc-z-prefix-buf "")
1788 (calc-user-function-list kmap 6)) 1782 (calc-user-function-list kmap 6))
1789 (if (/= flags 0) 1783 (if (/= flags 0)
1790 (setq msgs (cons buf msgs))) 1784 (setq calc-z-prefix-msgs (cons calc-z-prefix-buf calc-z-prefix-msgs)))
1791 (calc-do-prefix-help (nreverse msgs) "user" ?z))) 1785 (calc-do-prefix-help (nreverse calc-z-prefix-msgs) "user" ?z)))
1792 1786
1793(defun calc-user-function-classify (key) 1787(defun calc-user-function-classify (key)
1794 (cond ((/= key (downcase key)) ; upper-case 1788 (cond ((/= key (downcase key)) ; upper-case
@@ -1822,14 +1816,15 @@ calc-kill calc-kill-region calc-yank))))
1822 (upcase key) 1816 (upcase key)
1823 (downcase name)))) 1817 (downcase name))))
1824 (char-to-string (upcase key))))) 1818 (char-to-string (upcase key)))))
1825 (if (= (length buf) 0) 1819 (if (= (length calc-z-prefix-buf) 0)
1826 (setq buf (concat (if (= flags 1) "SHIFT + " "") 1820 (setq calc-z-prefix-buf (concat (if (= flags 1) "SHIFT + " "")
1827 desc)) 1821 desc))
1828 (if (> (+ (length buf) (length desc)) 58) 1822 (if (> (+ (length calc-z-prefix-buf) (length desc)) 58)
1829 (setq msgs (cons buf msgs) 1823 (setq calc-z-prefix-msgs
1830 buf (concat (if (= flags 1) "SHIFT + " "") 1824 (cons calc-z-prefix-buf calc-z-prefix-msgs)
1825 calc-z-prefix-buf (concat (if (= flags 1) "SHIFT + " "")
1831 desc)) 1826 desc))
1832 (setq buf (concat buf ", " desc)))))) 1827 (setq calc-z-prefix-buf (concat calc-z-prefix-buf ", " desc))))))
1833 (calc-user-function-list (cdr map) flags)))) 1828 (calc-user-function-list (cdr map) flags))))
1834 1829
1835 1830
@@ -1854,10 +1849,10 @@ calc-kill calc-kill-region calc-yank))))
1854 (last-prec (intern (concat (symbol-name name) "-last-prec"))) 1849 (last-prec (intern (concat (symbol-name name) "-last-prec")))
1855 (last-val (intern (concat (symbol-name name) "-last")))) 1850 (last-val (intern (concat (symbol-name name) "-last"))))
1856 (list 'progn 1851 (list 'progn
1857 (list 'setq cache-prec (if init (math-numdigs (nth 1 init)) -100)) 1852 (list 'defvar cache-prec (if init (math-numdigs (nth 1 init)) -100))
1858 (list 'setq cache-val (list 'quote init)) 1853 (list 'defvar cache-val (list 'quote init))
1859 (list 'setq last-prec -100) 1854 (list 'defvar last-prec -100)
1860 (list 'setq last-val nil) 1855 (list 'defvar last-val nil)
1861 (list 'setq 'math-cache-list 1856 (list 'setq 'math-cache-list
1862 (list 'cons 1857 (list 'cons
1863 (list 'quote cache-prec) 1858 (list 'quote cache-prec)
@@ -2223,25 +2218,25 @@ calc-kill calc-kill-region calc-yank))))
2223 (math-normalize (car a)) 2218 (math-normalize (car a))
2224 (error "Can't use multi-valued function in an expression"))))) 2219 (error "Can't use multi-valued function in an expression")))))
2225 2220
2226(defun math-normalize-nonstandard () ; uses "a" 2221(defun math-normalize-nonstandard ()
2227 (if (consp calc-simplify-mode) 2222 (if (consp calc-simplify-mode)
2228 (progn 2223 (progn
2229 (setq calc-simplify-mode 'none 2224 (setq calc-simplify-mode 'none
2230 math-simplify-only (car-safe (cdr-safe a))) 2225 math-simplify-only (car-safe (cdr-safe math-normalize-a)))
2231 nil) 2226 nil)
2232 (and (symbolp (car a)) 2227 (and (symbolp (car math-normalize-a))
2233 (or (eq calc-simplify-mode 'none) 2228 (or (eq calc-simplify-mode 'none)
2234 (and (eq calc-simplify-mode 'num) 2229 (and (eq calc-simplify-mode 'num)
2235 (let ((aptr (setq a (cons 2230 (let ((aptr (setq math-normalize-a
2236 (car a) 2231 (cons
2237 (mapcar 'math-normalize (cdr a)))))) 2232 (car math-normalize-a)
2233 (mapcar 'math-normalize
2234 (cdr math-normalize-a))))))
2238 (while (and aptr (math-constp (car aptr))) 2235 (while (and aptr (math-constp (car aptr)))
2239 (setq aptr (cdr aptr))) 2236 (setq aptr (cdr aptr)))
2240 aptr))) 2237 aptr)))
2241 (cons (car a) (mapcar 'math-normalize (cdr a)))))) 2238 (cons (car math-normalize-a)
2242 2239 (mapcar 'math-normalize (cdr math-normalize-a))))))
2243
2244
2245 2240
2246 2241
2247;;; Normalize a bignum digit list by trimming high-end zeros. [L l] 2242;;; Normalize a bignum digit list by trimming high-end zeros. [L l]
@@ -2619,22 +2614,27 @@ calc-kill calc-kill-region calc-yank))))
2619 2614
2620(defvar var-FactorRules 'calc-FactorRules) 2615(defvar var-FactorRules 'calc-FactorRules)
2621 2616
2622(defun math-map-tree (mmt-func mmt-expr &optional mmt-many) 2617(defvar math-mt-many nil)
2623 (or mmt-many (setq mmt-many 1000000)) 2618(defvar math-mt-func nil)
2619
2620(defun math-map-tree (math-mt-func mmt-expr &optional math-mt-many)
2621 (or math-mt-many (setq math-mt-many 1000000))
2624 (math-map-tree-rec mmt-expr)) 2622 (math-map-tree-rec mmt-expr))
2625 2623
2626(defun math-map-tree-rec (mmt-expr) 2624(defun math-map-tree-rec (mmt-expr)
2627 (or (= mmt-many 0) 2625 (or (= math-mt-many 0)
2628 (let ((mmt-done nil) 2626 (let ((mmt-done nil)
2629 mmt-nextval) 2627 mmt-nextval)
2630 (while (not mmt-done) 2628 (while (not mmt-done)
2631 (while (and (/= mmt-many 0) 2629 (while (and (/= math-mt-many 0)
2632 (setq mmt-nextval (funcall mmt-func mmt-expr)) 2630 (setq mmt-nextval (funcall math-mt-func mmt-expr))
2633 (not (equal mmt-expr mmt-nextval))) 2631 (not (equal mmt-expr mmt-nextval)))
2634 (setq mmt-expr mmt-nextval 2632 (setq mmt-expr mmt-nextval
2635 mmt-many (if (> mmt-many 0) (1- mmt-many) (1+ mmt-many)))) 2633 math-mt-many (if (> math-mt-many 0)
2634 (1- math-mt-many)
2635 (1+ math-mt-many))))
2636 (if (or (Math-primp mmt-expr) 2636 (if (or (Math-primp mmt-expr)
2637 (<= mmt-many 0)) 2637 (<= math-mt-many 0))
2638 (setq mmt-done t) 2638 (setq mmt-done t)
2639 (setq mmt-nextval (cons (car mmt-expr) 2639 (setq mmt-nextval (cons (car mmt-expr)
2640 (mapcar 'math-map-tree-rec 2640 (mapcar 'math-map-tree-rec
@@ -2885,22 +2885,24 @@ calc-kill calc-kill-region calc-yank))))
2885 2885
2886;;; Expression parsing. 2886;;; Expression parsing.
2887 2887
2888(defun math-read-expr (exp-str) 2888(defvar math-expr-data)
2889 (let ((exp-pos 0) 2889
2890 (exp-old-pos 0) 2890(defun math-read-expr (math-exp-str)
2891 (exp-keep-spaces nil) 2891 (let ((math-exp-pos 0)
2892 exp-token exp-data) 2892 (math-exp-old-pos 0)
2893 (while (setq exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" exp-str)) 2893 (math-exp-keep-spaces nil)
2894 (setq exp-str (concat (substring exp-str 0 exp-token) "\\dots" 2894 math-exp-token math-expr-data)
2895 (substring exp-str (+ exp-token 2))))) 2895 (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str))
2896 (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots"
2897 (substring math-exp-str (+ math-exp-token 2)))))
2896 (math-build-parse-table) 2898 (math-build-parse-table)
2897 (math-read-token) 2899 (math-read-token)
2898 (let ((val (catch 'syntax (math-read-expr-level 0)))) 2900 (let ((val (catch 'syntax (math-read-expr-level 0))))
2899 (if (stringp val) 2901 (if (stringp val)
2900 (list 'error exp-old-pos val) 2902 (list 'error math-exp-old-pos val)
2901 (if (equal exp-token 'end) 2903 (if (equal math-exp-token 'end)
2902 val 2904 val
2903 (list 'error exp-old-pos "Syntax error")))))) 2905 (list 'error math-exp-old-pos "Syntax error"))))))
2904 2906
2905(defun math-read-plain-expr (exp-str &optional error-check) 2907(defun math-read-plain-expr (exp-str &optional error-check)
2906 (let* ((calc-language nil) 2908 (let* ((calc-language nil)
@@ -2913,8 +2915,8 @@ calc-kill calc-kill-region calc-yank))))
2913 2915
2914 2916
2915(defun math-read-string () 2917(defun math-read-string ()
2916 (let ((str (read-from-string (concat exp-data "\"")))) 2918 (let ((str (read-from-string (concat math-expr-data "\""))))
2917 (or (and (= (cdr str) (1+ (length exp-data))) 2919 (or (and (= (cdr str) (1+ (length math-expr-data)))
2918 (stringp (car str))) 2920 (stringp (car str)))
2919 (throw 'syntax "Error in string constant")) 2921 (throw 'syntax "Error in string constant"))
2920 (math-read-token) 2922 (math-read-token)
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index 31f9e776a0c..e64983ad33d 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -1791,8 +1791,8 @@ and ends on the last Sunday of October at 2 a.m."
1791 1791
1792 1792
1793(defun math-read-angle-brackets () 1793(defun math-read-angle-brackets ()
1794 (let* ((last (or (math-check-for-commas t) (length exp-str))) 1794 (let* ((last (or (math-check-for-commas t) (length math-exp-str)))
1795 (str (substring exp-str exp-pos last)) 1795 (str (substring math-exp-str math-exp-pos last))
1796 (res 1796 (res
1797 (if (string-match "\\` *\\([a-zA-Z#][a-zA-Z0-9#]* *,? *\\)*:" str) 1797 (if (string-match "\\` *\\([a-zA-Z#][a-zA-Z0-9#]* *,? *\\)*:" str)
1798 (let ((str1 (substring str 0 (1- (match-end 0)))) 1798 (let ((str1 (substring str 0 (1- (match-end 0))))
@@ -1818,7 +1818,7 @@ and ends on the last Sunday of October at 2 a.m."
1818 (throw 'syntax res)) 1818 (throw 'syntax res))
1819 (if (eq (car-safe res) 'error) 1819 (if (eq (car-safe res) 'error)
1820 (throw 'syntax (nth 2 res))) 1820 (throw 'syntax (nth 2 res)))
1821 (setq exp-pos (1+ last)) 1821 (setq math-exp-pos (1+ last))
1822 (math-read-token) 1822 (math-read-token)
1823 res)) 1823 res))
1824 1824
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el
index cec7a5d2136..ff537109816 100644
--- a/lisp/calc/calc-graph.el
+++ b/lisp/calc/calc-graph.el
@@ -66,6 +66,7 @@
66(defvar calc-graph-data-cache-limit 10) 66(defvar calc-graph-data-cache-limit 10)
67(defvar calc-graph-no-auto-view nil) 67(defvar calc-graph-no-auto-view nil)
68(defvar calc-graph-no-wait nil) 68(defvar calc-graph-no-wait nil)
69(defvar calc-gnuplot-trail-mark)
69 70
70(defun calc-graph-fast (many) 71(defun calc-graph-fast (many)
71 (interactive "P") 72 (interactive "P")
@@ -224,11 +225,10 @@
224 thing 225 thing
225 (let ((found (assoc thing calc-graph-var-cache))) 226 (let ((found (assoc thing calc-graph-var-cache)))
226 (or found 227 (or found
227 (progn 228 (let ((varname (concat "PlotData"
228 (setq varname (concat "PlotData" 229 (int-to-string
229 (int-to-string 230 (1+ (length calc-graph-var-cache))))))
230 (1+ (length calc-graph-var-cache)))) 231 (setq var (list 'var (intern varname)
231 var (list 'var (intern varname)
232 (intern (concat "var-" varname))) 232 (intern (concat "var-" varname)))
233 found (cons thing var) 233 found (cons thing var)
234 calc-graph-var-cache (cons found calc-graph-var-cache)) 234 calc-graph-var-cache (cons found calc-graph-var-cache))
@@ -275,6 +275,47 @@
275 (interactive "P") 275 (interactive "P")
276 (calc-graph-plot flag t)) 276 (calc-graph-plot flag t))
277 277
278(defvar var-DUMMY)
279(defvar var-DUMMY2)
280(defvar var-PlotRejects)
281
282;; The following variables are local to calc-graph-plot, but are
283;; used in the functions calc-graph-compute-2d, calc-graph-refine-2d,
284;; calc-graph-recompute-2d, calc-graph-compute-3d and
285;; calc-graph-format-data, which are called by calc-graph-plot.
286(defvar calc-graph-yvalue)
287(defvar calc-graph-yvec)
288(defvar calc-graph-numsteps)
289(defvar calc-graph-numsteps3)
290(defvar calc-graph-xvalue)
291(defvar calc-graph-xvec)
292(defvar calc-graph-xname)
293(defvar calc-graph-yname)
294(defvar calc-graph-xstep)
295(defvar calc-graph-ycache)
296(defvar calc-graph-ycacheptr)
297(defvar calc-graph-refine)
298(defvar calc-graph-keep-file)
299(defvar calc-graph-xval)
300(defvar calc-graph-xlow)
301(defvar calc-graph-xhigh)
302(defvar calc-graph-yval)
303(defvar calc-graph-yp)
304(defvar calc-graph-xp)
305(defvar calc-graph-zp)
306(defvar calc-graph-yvector)
307(defvar calc-graph-resolution)
308(defvar calc-graph-y3value)
309(defvar calc-graph-y3name)
310(defvar calc-graph-y3step)
311(defvar calc-graph-zval)
312(defvar calc-graph-stepcount)
313(defvar calc-graph-is-splot)
314(defvar calc-graph-surprise-splot)
315(defvar calc-graph-blank)
316(defvar calc-graph-non-blank)
317(defvar calc-graph-curve-num)
318
278(defun calc-graph-plot (flag &optional printing) 319(defun calc-graph-plot (flag &optional printing)
279 (interactive "P") 320 (interactive "P")
280 (calc-slow-wrapper 321 (calc-slow-wrapper
@@ -282,22 +323,20 @@
282 (tempbuf (get-buffer-create "*Gnuplot Temp-2*")) 323 (tempbuf (get-buffer-create "*Gnuplot Temp-2*"))
283 (tempbuftop 1) 324 (tempbuftop 1)
284 (tempoutfile nil) 325 (tempoutfile nil)
285 (curve-num 0) 326 (calc-graph-curve-num 0)
286 (refine (and flag (> (prefix-numeric-value flag) 0))) 327 (calc-graph-refine (and flag (> (prefix-numeric-value flag) 0)))
287 (recompute (and flag (< (prefix-numeric-value flag) 0))) 328 (recompute (and flag (< (prefix-numeric-value flag) 0)))
288 (surprise-splot nil) 329 (calc-graph-surprise-splot nil)
289 (tty-output nil) 330 (tty-output nil)
290 cache-env is-splot device output resolution precision samples-pos) 331 cache-env calc-graph-is-splot device output calc-graph-resolution precision samples-pos)
291 (or (boundp 'calc-graph-prev-kill-hook) 332 (add-hook 'kill-emacs-hook 'calc-graph-kill-hook)
292 (setq calc-graph-prev-kill-hook nil)
293 (add-hook 'kill-emacs-hook 'calc-graph-kill-hook))
294 (save-excursion 333 (save-excursion
295 (calc-graph-init) 334 (calc-graph-init)
296 (set-buffer tempbuf) 335 (set-buffer tempbuf)
297 (erase-buffer) 336 (erase-buffer)
298 (set-buffer calc-gnuplot-input) 337 (set-buffer calc-gnuplot-input)
299 (goto-char (point-min)) 338 (goto-char (point-min))
300 (setq is-splot (re-search-forward "^splot[ \t]" nil t)) 339 (setq calc-graph-is-splot (re-search-forward "^splot[ \t]" nil t))
301 (let ((str (buffer-string)) 340 (let ((str (buffer-string))
302 (ver calc-gnuplot-version)) 341 (ver calc-gnuplot-version))
303 (set-buffer (get-buffer-create "*Gnuplot Temp*")) 342 (set-buffer (get-buffer-create "*Gnuplot Temp*"))
@@ -313,14 +352,14 @@
313 "set nogrid\nset nokey\nset nopolar\n")) 352 "set nogrid\nset nokey\nset nopolar\n"))
314 (if (>= ver 3) 353 (if (>= ver 3)
315 (insert "set surface\nset nocontour\n" 354 (insert "set surface\nset nocontour\n"
316 "set " (if is-splot "" "no") "parametric\n" 355 "set " (if calc-graph-is-splot "" "no") "parametric\n"
317 "set notime\nset border\nset ztics\nset zeroaxis\n" 356 "set notime\nset border\nset ztics\nset zeroaxis\n"
318 "set view 60,30,1,1\nset offsets 0,0,0,0\n")) 357 "set view 60,30,1,1\nset offsets 0,0,0,0\n"))
319 (setq samples-pos (point)) 358 (setq samples-pos (point))
320 (insert "\n\n" str)) 359 (insert "\n\n" str))
321 (goto-char (point-min)) 360 (goto-char (point-min))
322 (if is-splot 361 (if calc-graph-is-splot
323 (if refine 362 (if calc-graph-refine
324 (error "This option works only for 2d plots") 363 (error "This option works only for 2d plots")
325 (setq recompute t))) 364 (setq recompute t)))
326 (let ((calc-gnuplot-input (current-buffer)) 365 (let ((calc-gnuplot-input (current-buffer))
@@ -366,10 +405,10 @@
366 (if (equal output "STDOUT") 405 (if (equal output "STDOUT")
367 "" 406 ""
368 (prin1-to-string output))))) 407 (prin1-to-string output)))))
369 (setq resolution (calc-graph-find-command "samples")) 408 (setq calc-graph-resolution (calc-graph-find-command "samples"))
370 (if resolution 409 (if calc-graph-resolution
371 (setq resolution (string-to-int resolution)) 410 (setq calc-graph-resolution (string-to-int calc-graph-resolution))
372 (setq resolution (if is-splot 411 (setq calc-graph-resolution (if calc-graph-is-splot
373 calc-graph-default-resolution-3d 412 calc-graph-default-resolution-3d
374 calc-graph-default-resolution))) 413 calc-graph-default-resolution)))
375 (setq precision (calc-graph-find-command "precision")) 414 (setq precision (calc-graph-find-command "precision"))
@@ -381,8 +420,8 @@
381 (calc-graph-set-command "samples") 420 (calc-graph-set-command "samples")
382 (calc-graph-set-command "precision")) 421 (calc-graph-set-command "precision"))
383 (goto-char samples-pos) 422 (goto-char samples-pos)
384 (insert "set samples " (int-to-string (max (if is-splot 20 200) 423 (insert "set samples " (int-to-string (max (if calc-graph-is-splot 20 200)
385 (+ 5 resolution))) "\n") 424 (+ 5 calc-graph-resolution))) "\n")
386 (while (re-search-forward "{\\*[^}]+}[^,\n]*" nil t) 425 (while (re-search-forward "{\\*[^}]+}[^,\n]*" nil t)
387 (delete-region (match-beginning 0) (match-end 0)) 426 (delete-region (match-beginning 0) (match-end 0))
388 (if (looking-at ",") 427 (if (looking-at ",")
@@ -398,7 +437,7 @@
398 calc-simplify-mode 437 calc-simplify-mode
399 calc-infinite-mode 438 calc-infinite-mode
400 calc-word-size 439 calc-word-size
401 precision is-splot)) 440 precision calc-graph-is-splot))
402 (if (and (not recompute) 441 (if (and (not recompute)
403 (equal (cdr (car calc-graph-data-cache)) cache-env)) 442 (equal (cdr (car calc-graph-data-cache)) cache-env))
404 (while (> (length calc-graph-data-cache) 443 (while (> (length calc-graph-data-cache)
@@ -408,88 +447,88 @@
408 (setq calc-graph-data-cache (list (cons nil cache-env))))) 447 (setq calc-graph-data-cache (list (cons nil cache-env)))))
409 (calc-graph-find-plot t t) 448 (calc-graph-find-plot t t)
410 (while (re-search-forward 449 (while (re-search-forward
411 (if is-splot 450 (if calc-graph-is-splot
412 "{\\([^{}:\n]+\\):\\([^{}:\n]+\\):\\([^{}:\n]+\\)}" 451 "{\\([^{}:\n]+\\):\\([^{}:\n]+\\):\\([^{}:\n]+\\)}"
413 "{\\([^{}:\n]+\\)\\(:\\)\\([^{}:\n]+\\)}") 452 "{\\([^{}:\n]+\\)\\(:\\)\\([^{}:\n]+\\)}")
414 nil t) 453 nil t)
415 (setq curve-num (1+ curve-num)) 454 (setq calc-graph-curve-num (1+ calc-graph-curve-num))
416 (let* ((xname (buffer-substring (match-beginning 1) (match-end 1))) 455 (let* ((calc-graph-xname (buffer-substring (match-beginning 1) (match-end 1)))
417 (xvar (intern (concat "var-" xname))) 456 (xvar (intern (concat "var-" calc-graph-xname)))
418 (xvalue (math-evaluate-expr (calc-var-value xvar))) 457 (calc-graph-xvalue (math-evaluate-expr (calc-var-value xvar)))
419 (y3name (and is-splot 458 (calc-graph-y3name (and calc-graph-is-splot
420 (buffer-substring (match-beginning 2) 459 (buffer-substring (match-beginning 2)
421 (match-end 2)))) 460 (match-end 2))))
422 (y3var (and is-splot (intern (concat "var-" y3name)))) 461 (y3var (and calc-graph-is-splot (intern (concat "var-" calc-graph-y3name))))
423 (y3value (and is-splot (calc-var-value y3var))) 462 (calc-graph-y3value (and calc-graph-is-splot (calc-var-value y3var)))
424 (yname (buffer-substring (match-beginning 3) (match-end 3))) 463 (calc-graph-yname (buffer-substring (match-beginning 3) (match-end 3)))
425 (yvar (intern (concat "var-" yname))) 464 (yvar (intern (concat "var-" calc-graph-yname)))
426 (yvalue (calc-var-value yvar)) 465 (calc-graph-yvalue (calc-var-value yvar))
427 filename) 466 filename)
428 (delete-region (match-beginning 0) (match-end 0)) 467 (delete-region (match-beginning 0) (match-end 0))
429 (setq filename (calc-temp-file-name curve-num)) 468 (setq filename (calc-temp-file-name calc-graph-curve-num))
430 (save-excursion 469 (save-excursion
431 (set-buffer calcbuf) 470 (set-buffer calcbuf)
432 (let (tempbuftop 471 (let (tempbuftop
433 (xp xvalue) 472 (calc-graph-xp calc-graph-xvalue)
434 (yp yvalue) 473 (calc-graph-yp calc-graph-yvalue)
435 (zp nil) 474 (calc-graph-zp nil)
436 (xlow nil) (xhigh nil) (y3low nil) (y3high nil) 475 (calc-graph-xlow nil) (calc-graph-xhigh nil) (y3low nil) (y3high nil)
437 xvec xval xstep var-DUMMY 476 calc-graph-xvec calc-graph-xval calc-graph-xstep var-DUMMY
438 y3vec y3val y3step var-DUMMY2 (zval nil) 477 y3val calc-graph-y3step var-DUMMY2 (calc-graph-zval nil)
439 yvec yval ycache ycacheptr yvector 478 calc-graph-yvec calc-graph-yval calc-graph-ycache calc-graph-ycacheptr calc-graph-yvector
440 numsteps numsteps3 479 calc-graph-numsteps calc-graph-numsteps3
441 (keep-file (and (not is-splot) (file-exists-p filename))) 480 (calc-graph-keep-file (and (not calc-graph-is-splot) (file-exists-p filename)))
442 (stepcount 0) 481 (calc-graph-stepcount 0)
443 (calc-symbolic-mode nil) 482 (calc-symbolic-mode nil)
444 (calc-prefer-frac nil) 483 (calc-prefer-frac nil)
445 (calc-internal-prec (max 3 precision)) 484 (calc-internal-prec (max 3 precision))
446 (calc-simplify-mode (and (not (memq calc-simplify-mode 485 (calc-simplify-mode (and (not (memq calc-simplify-mode
447 '(none num))) 486 '(none num)))
448 calc-simplify-mode)) 487 calc-simplify-mode))
449 (blank t) 488 (calc-graph-blank t)
450 (non-blank nil) 489 (calc-graph-non-blank nil)
451 (math-working-step 0) 490 (math-working-step 0)
452 (math-working-step-2 nil)) 491 (math-working-step-2 nil))
453 (save-excursion 492 (save-excursion
454 (if is-splot 493 (if calc-graph-is-splot
455 (calc-graph-compute-3d) 494 (calc-graph-compute-3d)
456 (calc-graph-compute-2d)) 495 (calc-graph-compute-2d))
457 (set-buffer tempbuf) 496 (set-buffer tempbuf)
458 (goto-char (point-max)) 497 (goto-char (point-max))
459 (insert "\n" xname) 498 (insert "\n" calc-graph-xname)
460 (if is-splot 499 (if calc-graph-is-splot
461 (insert ":" y3name)) 500 (insert ":" calc-graph-y3name))
462 (insert ":" yname "\n\n") 501 (insert ":" calc-graph-yname "\n\n")
463 (setq tempbuftop (point)) 502 (setq tempbuftop (point))
464 (let ((calc-group-digits nil) 503 (let ((calc-group-digits nil)
465 (calc-leading-zeros nil) 504 (calc-leading-zeros nil)
466 (calc-number-radix 10) 505 (calc-number-radix 10)
467 (entry (and (not is-splot) 506 (entry (and (not calc-graph-is-splot)
468 (list xp yp xhigh numsteps)))) 507 (list calc-graph-xp calc-graph-yp calc-graph-xhigh calc-graph-numsteps))))
469 (or (equal entry 508 (or (equal entry
470 (nth 1 (nth (1+ curve-num) 509 (nth 1 (nth (1+ calc-graph-curve-num)
471 calc-graph-file-cache))) 510 calc-graph-file-cache)))
472 (setq keep-file nil)) 511 (setq calc-graph-keep-file nil))
473 (setcar (cdr (nth (1+ curve-num) calc-graph-file-cache)) 512 (setcar (cdr (nth (1+ calc-graph-curve-num) calc-graph-file-cache))
474 entry) 513 entry)
475 (or keep-file 514 (or calc-graph-keep-file
476 (calc-graph-format-data))) 515 (calc-graph-format-data)))
477 (or keep-file 516 (or calc-graph-keep-file
478 (progn 517 (progn
479 (or non-blank 518 (or calc-graph-non-blank
480 (error "No valid data points for %s:%s" 519 (error "No valid data points for %s:%s"
481 xname yname)) 520 calc-graph-xname calc-graph-yname))
482 (write-region tempbuftop (point-max) filename 521 (write-region tempbuftop (point-max) filename
483 nil 'quiet)))))) 522 nil 'quiet))))))
484 (insert (prin1-to-string filename)))) 523 (insert (prin1-to-string filename))))
485 (if surprise-splot 524 (if calc-graph-surprise-splot
486 (setcdr cache-env nil)) 525 (setcdr cache-env nil))
487 (if (= curve-num 0) 526 (if (= calc-graph-curve-num 0)
488 (progn 527 (progn
489 (calc-gnuplot-command "clear") 528 (calc-gnuplot-command "clear")
490 (calc-clear-command-flag 'clear-message) 529 (calc-clear-command-flag 'clear-message)
491 (message "No data to plot!")) 530 (message "No data to plot!"))
492 (setq calc-graph-data-cache-limit (max curve-num 531 (setq calc-graph-data-cache-limit (max calc-graph-curve-num
493 calc-graph-data-cache-limit) 532 calc-graph-data-cache-limit)
494 filename (calc-temp-file-name 0)) 533 filename (calc-temp-file-name 0))
495 (write-region (point-min) (point-max) filename nil 'quiet) 534 (write-region (point-min) (point-max) filename nil 'quiet)
@@ -517,325 +556,325 @@
517 (eval command)))))))))) 556 (eval command))))))))))
518 557
519(defun calc-graph-compute-2d () 558(defun calc-graph-compute-2d ()
520 (if (setq yvec (eq (car-safe yvalue) 'vec)) 559 (if (setq calc-graph-yvec (eq (car-safe calc-graph-yvalue) 'vec))
521 (if (= (setq numsteps (1- (length yvalue))) 0) 560 (if (= (setq calc-graph-numsteps (1- (length calc-graph-yvalue))) 0)
522 (error "Can't plot an empty vector") 561 (error "Can't plot an empty vector")
523 (if (setq xvec (eq (car-safe xvalue) 'vec)) 562 (if (setq calc-graph-xvec (eq (car-safe calc-graph-xvalue) 'vec))
524 (or (= (1- (length xvalue)) numsteps) 563 (or (= (1- (length calc-graph-xvalue)) calc-graph-numsteps)
525 (error "%s and %s have different lengths" xname yname)) 564 (error "%s and %s have different lengths" calc-graph-xname calc-graph-yname))
526 (if (and (eq (car-safe xvalue) 'intv) 565 (if (and (eq (car-safe calc-graph-xvalue) 'intv)
527 (math-constp xvalue)) 566 (math-constp calc-graph-xvalue))
528 (setq xstep (math-div (math-sub (nth 3 xvalue) 567 (setq calc-graph-xstep (math-div (math-sub (nth 3 calc-graph-xvalue)
529 (nth 2 xvalue)) 568 (nth 2 calc-graph-xvalue))
530 (1- numsteps)) 569 (1- calc-graph-numsteps))
531 xvalue (nth 2 xvalue)) 570 calc-graph-xvalue (nth 2 calc-graph-xvalue))
532 (if (math-realp xvalue) 571 (if (math-realp calc-graph-xvalue)
533 (setq xstep 1) 572 (setq calc-graph-xstep 1)
534 (error "%s is not a suitable basis for %s" xname yname))))) 573 (error "%s is not a suitable basis for %s" calc-graph-xname calc-graph-yname)))))
535 (or (math-realp yvalue) 574 (or (math-realp calc-graph-yvalue)
536 (let ((arglist nil)) 575 (let ((arglist nil))
537 (setq yvalue (math-evaluate-expr yvalue)) 576 (setq calc-graph-yvalue (math-evaluate-expr calc-graph-yvalue))
538 (calc-default-formula-arglist yvalue) 577 (calc-default-formula-arglist calc-graph-yvalue)
539 (or arglist 578 (or arglist
540 (error "%s does not contain any unassigned variables" yname)) 579 (error "%s does not contain any unassigned variables" calc-graph-yname))
541 (and (cdr arglist) 580 (and (cdr arglist)
542 (error "%s contains more than one variable: %s" 581 (error "%s contains more than one variable: %s"
543 yname arglist)) 582 calc-graph-yname arglist))
544 (setq yvalue (math-expr-subst yvalue 583 (setq calc-graph-yvalue (math-expr-subst calc-graph-yvalue
545 (math-build-var-name (car arglist)) 584 (math-build-var-name (car arglist))
546 '(var DUMMY var-DUMMY))))) 585 '(var DUMMY var-DUMMY)))))
547 (setq ycache (assoc yvalue calc-graph-data-cache)) 586 (setq calc-graph-ycache (assoc calc-graph-yvalue calc-graph-data-cache))
548 (delq ycache calc-graph-data-cache) 587 (delq calc-graph-ycache calc-graph-data-cache)
549 (nconc calc-graph-data-cache 588 (nconc calc-graph-data-cache
550 (list (or ycache (setq ycache (list yvalue))))) 589 (list (or calc-graph-ycache (setq calc-graph-ycache (list calc-graph-yvalue)))))
551 (if (and (not (setq xvec (eq (car-safe xvalue) 'vec))) 590 (if (and (not (setq calc-graph-xvec (eq (car-safe calc-graph-xvalue) 'vec)))
552 refine (cdr (cdr ycache))) 591 calc-graph-refine (cdr (cdr calc-graph-ycache)))
553 (calc-graph-refine-2d) 592 (calc-graph-refine-2d)
554 (calc-graph-recompute-2d)))) 593 (calc-graph-recompute-2d))))
555 594
556(defun calc-graph-refine-2d () 595(defun calc-graph-refine-2d ()
557 (setq keep-file nil 596 (setq calc-graph-keep-file nil
558 ycacheptr (cdr ycache)) 597 calc-graph-ycacheptr (cdr calc-graph-ycache))
559 (if (and (setq xval (calc-graph-find-command "xrange")) 598 (if (and (setq calc-graph-xval (calc-graph-find-command "xrange"))
560 (string-match "\\`\\[\\([0-9.eE+-]*\\):\\([0-9.eE+-]*\\)\\]\\'" 599 (string-match "\\`\\[\\([0-9.eE+-]*\\):\\([0-9.eE+-]*\\)\\]\\'"
561 xval)) 600 calc-graph-xval))
562 (let ((b2 (match-beginning 2)) 601 (let ((b2 (match-beginning 2))
563 (e2 (match-end 2))) 602 (e2 (match-end 2)))
564 (setq xlow (math-read-number (substring xval 603 (setq calc-graph-xlow (math-read-number (substring calc-graph-xval
565 (match-beginning 1) 604 (match-beginning 1)
566 (match-end 1))) 605 (match-end 1)))
567 xhigh (math-read-number (substring xval b2 e2)))) 606 calc-graph-xhigh (math-read-number (substring calc-graph-xval b2 e2))))
568 (if xlow 607 (if calc-graph-xlow
569 (while (and (cdr ycacheptr) 608 (while (and (cdr calc-graph-ycacheptr)
570 (Math-lessp (car (nth 1 ycacheptr)) xlow)) 609 (Math-lessp (car (nth 1 calc-graph-ycacheptr)) calc-graph-xlow))
571 (setq ycacheptr (cdr ycacheptr))))) 610 (setq calc-graph-ycacheptr (cdr calc-graph-ycacheptr)))))
572 (setq math-working-step-2 (1- (length ycacheptr))) 611 (setq math-working-step-2 (1- (length calc-graph-ycacheptr)))
573 (while (and (cdr ycacheptr) 612 (while (and (cdr calc-graph-ycacheptr)
574 (or (not xhigh) 613 (or (not calc-graph-xhigh)
575 (Math-lessp (car (car ycacheptr)) xhigh))) 614 (Math-lessp (car (car calc-graph-ycacheptr)) calc-graph-xhigh)))
576 (setq var-DUMMY (math-div (math-add (car (car ycacheptr)) 615 (setq var-DUMMY (math-div (math-add (car (car calc-graph-ycacheptr))
577 (car (nth 1 ycacheptr))) 616 (car (nth 1 calc-graph-ycacheptr)))
578 2) 617 2)
579 math-working-step (1+ math-working-step) 618 math-working-step (1+ math-working-step)
580 yval (math-evaluate-expr yvalue)) 619 calc-graph-yval (math-evaluate-expr calc-graph-yvalue))
581 (setcdr ycacheptr (cons (cons var-DUMMY yval) 620 (setcdr calc-graph-ycacheptr (cons (cons var-DUMMY calc-graph-yval)
582 (cdr ycacheptr))) 621 (cdr calc-graph-ycacheptr)))
583 (setq ycacheptr (cdr (cdr ycacheptr)))) 622 (setq calc-graph-ycacheptr (cdr (cdr calc-graph-ycacheptr))))
584 (setq yp ycache 623 (setq calc-graph-yp calc-graph-ycache
585 numsteps 1000000)) 624 calc-graph-numsteps 1000000))
586 625
587(defun calc-graph-recompute-2d () 626(defun calc-graph-recompute-2d ()
588 (setq ycacheptr ycache) 627 (setq calc-graph-ycacheptr calc-graph-ycache)
589 (if xvec 628 (if calc-graph-xvec
590 (setq numsteps (1- (length xvalue)) 629 (setq calc-graph-numsteps (1- (length calc-graph-xvalue))
591 yvector nil) 630 calc-graph-yvector nil)
592 (if (and (eq (car-safe xvalue) 'intv) 631 (if (and (eq (car-safe calc-graph-xvalue) 'intv)
593 (math-constp xvalue)) 632 (math-constp calc-graph-xvalue))
594 (setq numsteps resolution 633 (setq calc-graph-numsteps calc-graph-resolution
595 yp nil 634 calc-graph-yp nil
596 xlow (nth 2 xvalue) 635 calc-graph-xlow (nth 2 calc-graph-xvalue)
597 xhigh (nth 3 xvalue) 636 calc-graph-xhigh (nth 3 calc-graph-xvalue)
598 xstep (math-div (math-sub xhigh xlow) 637 calc-graph-xstep (math-div (math-sub calc-graph-xhigh calc-graph-xlow)
599 (1- numsteps)) 638 (1- calc-graph-numsteps))
600 xvalue (nth 2 xvalue)) 639 calc-graph-xvalue (nth 2 calc-graph-xvalue))
601 (error "%s is not a suitable basis for %s" 640 (error "%s is not a suitable basis for %s"
602 xname yname))) 641 calc-graph-xname calc-graph-yname)))
603 (setq math-working-step-2 numsteps) 642 (setq math-working-step-2 calc-graph-numsteps)
604 (while (>= (setq numsteps (1- numsteps)) 0) 643 (while (>= (setq calc-graph-numsteps (1- calc-graph-numsteps)) 0)
605 (setq math-working-step (1+ math-working-step)) 644 (setq math-working-step (1+ math-working-step))
606 (if xvec 645 (if calc-graph-xvec
607 (progn 646 (progn
608 (setq xp (cdr xp) 647 (setq calc-graph-xp (cdr calc-graph-xp)
609 xval (car xp)) 648 calc-graph-xval (car calc-graph-xp))
610 (and (not (eq ycacheptr ycache)) 649 (and (not (eq calc-graph-ycacheptr calc-graph-ycache))
611 (consp (car ycacheptr)) 650 (consp (car calc-graph-ycacheptr))
612 (not (Math-lessp (car (car ycacheptr)) xval)) 651 (not (Math-lessp (car (car calc-graph-ycacheptr)) calc-graph-xval))
613 (setq ycacheptr ycache))) 652 (setq calc-graph-ycacheptr calc-graph-ycache)))
614 (if (= numsteps 0) 653 (if (= calc-graph-numsteps 0)
615 (setq xval xhigh) ; avoid cumulative roundoff 654 (setq calc-graph-xval calc-graph-xhigh) ; avoid cumulative roundoff
616 (setq xval xvalue 655 (setq calc-graph-xval calc-graph-xvalue
617 xvalue (math-add xvalue xstep)))) 656 calc-graph-xvalue (math-add calc-graph-xvalue calc-graph-xstep))))
618 (while (and (cdr ycacheptr) 657 (while (and (cdr calc-graph-ycacheptr)
619 (Math-lessp (car (nth 1 ycacheptr)) xval)) 658 (Math-lessp (car (nth 1 calc-graph-ycacheptr)) calc-graph-xval))
620 (setq ycacheptr (cdr ycacheptr))) 659 (setq calc-graph-ycacheptr (cdr calc-graph-ycacheptr)))
621 (or (and (cdr ycacheptr) 660 (or (and (cdr calc-graph-ycacheptr)
622 (Math-equal (car (nth 1 ycacheptr)) xval)) 661 (Math-equal (car (nth 1 calc-graph-ycacheptr)) calc-graph-xval))
623 (progn 662 (progn
624 (setq keep-file nil 663 (setq calc-graph-keep-file nil
625 var-DUMMY xval) 664 var-DUMMY calc-graph-xval)
626 (setcdr ycacheptr (cons (cons xval (math-evaluate-expr yvalue)) 665 (setcdr calc-graph-ycacheptr (cons (cons calc-graph-xval (math-evaluate-expr calc-graph-yvalue))
627 (cdr ycacheptr))))) 666 (cdr calc-graph-ycacheptr)))))
628 (setq ycacheptr (cdr ycacheptr)) 667 (setq calc-graph-ycacheptr (cdr calc-graph-ycacheptr))
629 (if xvec 668 (if calc-graph-xvec
630 (setq yvector (cons (cdr (car ycacheptr)) yvector)) 669 (setq calc-graph-yvector (cons (cdr (car calc-graph-ycacheptr)) calc-graph-yvector))
631 (or yp (setq yp ycacheptr)))) 670 (or calc-graph-yp (setq calc-graph-yp calc-graph-ycacheptr))))
632 (if xvec 671 (if calc-graph-xvec
633 (setq xp xvalue 672 (setq calc-graph-xp calc-graph-xvalue
634 yvec t 673 calc-graph-yvec t
635 yp (cons 'vec (nreverse yvector)) 674 calc-graph-yp (cons 'vec (nreverse calc-graph-yvector))
636 numsteps (1- (length xp))) 675 calc-graph-numsteps (1- (length calc-graph-xp)))
637 (setq numsteps 1000000))) 676 (setq calc-graph-numsteps 1000000)))
638 677
639(defun calc-graph-compute-3d () 678(defun calc-graph-compute-3d ()
640 (if (setq yvec (eq (car-safe yvalue) 'vec)) 679 (if (setq calc-graph-yvec (eq (car-safe calc-graph-yvalue) 'vec))
641 (if (math-matrixp yvalue) 680 (if (math-matrixp calc-graph-yvalue)
642 (progn 681 (progn
643 (setq numsteps (1- (length yvalue)) 682 (setq calc-graph-numsteps (1- (length calc-graph-yvalue))
644 numsteps3 (1- (length (nth 1 yvalue)))) 683 calc-graph-numsteps3 (1- (length (nth 1 calc-graph-yvalue))))
645 (if (eq (car-safe xvalue) 'vec) 684 (if (eq (car-safe calc-graph-xvalue) 'vec)
646 (or (= (1- (length xvalue)) numsteps) 685 (or (= (1- (length calc-graph-xvalue)) calc-graph-numsteps)
647 (error "%s has wrong length" xname)) 686 (error "%s has wrong length" calc-graph-xname))
648 (if (and (eq (car-safe xvalue) 'intv) 687 (if (and (eq (car-safe calc-graph-xvalue) 'intv)
649 (math-constp xvalue)) 688 (math-constp calc-graph-xvalue))
650 (setq xvalue (calcFunc-index numsteps 689 (setq calc-graph-xvalue (calcFunc-index calc-graph-numsteps
651 (nth 2 xvalue) 690 (nth 2 calc-graph-xvalue)
652 (math-div 691 (math-div
653 (math-sub (nth 3 xvalue) 692 (math-sub (nth 3 calc-graph-xvalue)
654 (nth 2 xvalue)) 693 (nth 2 calc-graph-xvalue))
655 (1- numsteps)))) 694 (1- calc-graph-numsteps))))
656 (if (math-realp xvalue) 695 (if (math-realp calc-graph-xvalue)
657 (setq xvalue (calcFunc-index numsteps xvalue 1)) 696 (setq calc-graph-xvalue (calcFunc-index calc-graph-numsteps calc-graph-xvalue 1))
658 (error "%s is not a suitable basis for %s" xname yname)))) 697 (error "%s is not a suitable basis for %s" calc-graph-xname calc-graph-yname))))
659 (if (eq (car-safe y3value) 'vec) 698 (if (eq (car-safe calc-graph-y3value) 'vec)
660 (or (= (1- (length y3value)) numsteps3) 699 (or (= (1- (length calc-graph-y3value)) calc-graph-numsteps3)
661 (error "%s has wrong length" y3name)) 700 (error "%s has wrong length" calc-graph-y3name))
662 (if (and (eq (car-safe y3value) 'intv) 701 (if (and (eq (car-safe calc-graph-y3value) 'intv)
663 (math-constp y3value)) 702 (math-constp calc-graph-y3value))
664 (setq y3value (calcFunc-index numsteps3 703 (setq calc-graph-y3value (calcFunc-index calc-graph-numsteps3
665 (nth 2 y3value) 704 (nth 2 calc-graph-y3value)
666 (math-div 705 (math-div
667 (math-sub (nth 3 y3value) 706 (math-sub (nth 3 calc-graph-y3value)
668 (nth 2 y3value)) 707 (nth 2 calc-graph-y3value))
669 (1- numsteps3)))) 708 (1- calc-graph-numsteps3))))
670 (if (math-realp y3value) 709 (if (math-realp calc-graph-y3value)
671 (setq y3value (calcFunc-index numsteps3 y3value 1)) 710 (setq calc-graph-y3value (calcFunc-index calc-graph-numsteps3 calc-graph-y3value 1))
672 (error "%s is not a suitable basis for %s" y3name yname)))) 711 (error "%s is not a suitable basis for %s" calc-graph-y3name calc-graph-yname))))
673 (setq xp nil 712 (setq calc-graph-xp nil
674 yp nil 713 calc-graph-yp nil
675 zp nil 714 calc-graph-zp nil
676 xvec t) 715 calc-graph-xvec t)
677 (while (setq xvalue (cdr xvalue) yvalue (cdr yvalue)) 716 (while (setq calc-graph-xvalue (cdr calc-graph-xvalue) calc-graph-yvalue (cdr calc-graph-yvalue))
678 (setq xp (nconc xp (make-list (1+ numsteps3) (car xvalue))) 717 (setq calc-graph-xp (nconc calc-graph-xp (make-list (1+ calc-graph-numsteps3) (car calc-graph-xvalue)))
679 yp (nconc yp (cons 0 (copy-sequence (cdr y3value)))) 718 calc-graph-yp (nconc calc-graph-yp (cons 0 (copy-sequence (cdr calc-graph-y3value))))
680 zp (nconc zp (cons '(skip) 719 calc-graph-zp (nconc calc-graph-zp (cons '(skip)
681 (copy-sequence (cdr (car yvalue))))))) 720 (copy-sequence (cdr (car calc-graph-yvalue)))))))
682 (setq numsteps (1- (* numsteps (1+ numsteps3))))) 721 (setq calc-graph-numsteps (1- (* calc-graph-numsteps
683 (if (= (setq numsteps (1- (length yvalue))) 0) 722 (1+ calc-graph-numsteps3)))))
723 (if (= (setq calc-graph-numsteps (1- (length calc-graph-yvalue))) 0)
684 (error "Can't plot an empty vector")) 724 (error "Can't plot an empty vector"))
685 (or (and (eq (car-safe xvalue) 'vec) 725 (or (and (eq (car-safe calc-graph-xvalue) 'vec)
686 (= (1- (length xvalue)) numsteps)) 726 (= (1- (length calc-graph-xvalue)) calc-graph-numsteps))
687 (error "%s is not a suitable basis for %s" xname yname)) 727 (error "%s is not a suitable basis for %s" calc-graph-xname calc-graph-yname))
688 (or (and (eq (car-safe y3value) 'vec) 728 (or (and (eq (car-safe calc-graph-y3value) 'vec)
689 (= (1- (length y3value)) numsteps)) 729 (= (1- (length calc-graph-y3value)) calc-graph-numsteps))
690 (error "%s is not a suitable basis for %s" y3name yname)) 730 (error "%s is not a suitable basis for %s" calc-graph-y3name calc-graph-yname))
691 (setq xp xvalue 731 (setq calc-graph-xp calc-graph-xvalue
692 yp y3value 732 calc-graph-yp calc-graph-y3value
693 zp yvalue 733 calc-graph-zp calc-graph-yvalue
694 xvec t)) 734 calc-graph-xvec t))
695 (or (math-realp yvalue) 735 (or (math-realp calc-graph-yvalue)
696 (let ((arglist nil)) 736 (let ((arglist nil))
697 (setq yvalue (math-evaluate-expr yvalue)) 737 (setq calc-graph-yvalue (math-evaluate-expr calc-graph-yvalue))
698 (calc-default-formula-arglist yvalue) 738 (calc-default-formula-arglist calc-graph-yvalue)
699 (setq arglist (sort arglist 'string-lessp)) 739 (setq arglist (sort arglist 'string-lessp))
700 (or (cdr arglist) 740 (or (cdr arglist)
701 (error "%s does not contain enough unassigned variables" yname)) 741 (error "%s does not contain enough unassigned variables" calc-graph-yname))
702 (and (cdr (cdr arglist)) 742 (and (cdr (cdr arglist))
703 (error "%s contains too many variables: %s" yname arglist)) 743 (error "%s contains too many variables: %s" calc-graph-yname arglist))
704 (setq yvalue (math-multi-subst yvalue 744 (setq calc-graph-yvalue (math-multi-subst calc-graph-yvalue
705 (mapcar 'math-build-var-name 745 (mapcar 'math-build-var-name
706 arglist) 746 arglist)
707 '((var DUMMY var-DUMMY) 747 '((var DUMMY var-DUMMY)
708 (var DUMMY2 var-DUMMY2)))))) 748 (var DUMMY2 var-DUMMY2))))))
709 (if (setq xvec (eq (car-safe xvalue) 'vec)) 749 (if (setq calc-graph-xvec (eq (car-safe calc-graph-xvalue) 'vec))
710 (setq numsteps (1- (length xvalue))) 750 (setq calc-graph-numsteps (1- (length calc-graph-xvalue)))
711 (if (and (eq (car-safe xvalue) 'intv) 751 (if (and (eq (car-safe calc-graph-xvalue) 'intv)
712 (math-constp xvalue)) 752 (math-constp calc-graph-xvalue))
713 (setq numsteps resolution 753 (setq calc-graph-numsteps calc-graph-resolution
714 xvalue (calcFunc-index numsteps 754 calc-graph-xvalue (calcFunc-index calc-graph-numsteps
715 (nth 2 xvalue) 755 (nth 2 calc-graph-xvalue)
716 (math-div (math-sub (nth 3 xvalue) 756 (math-div (math-sub (nth 3 calc-graph-xvalue)
717 (nth 2 xvalue)) 757 (nth 2 calc-graph-xvalue))
718 (1- numsteps)))) 758 (1- calc-graph-numsteps))))
719 (error "%s is not a suitable basis for %s" 759 (error "%s is not a suitable basis for %s"
720 xname yname))) 760 calc-graph-xname calc-graph-yname)))
721 (if (setq y3vec (eq (car-safe y3value) 'vec)) 761 (if (eq (car-safe calc-graph-y3value) 'vec)
722 (setq numsteps3 (1- (length y3value))) 762 (setq calc-graph-numsteps3 (1- (length calc-graph-y3value)))
723 (if (and (eq (car-safe y3value) 'intv) 763 (if (and (eq (car-safe calc-graph-y3value) 'intv)
724 (math-constp y3value)) 764 (math-constp calc-graph-y3value))
725 (setq numsteps3 resolution 765 (setq calc-graph-numsteps3 calc-graph-resolution
726 y3value (calcFunc-index numsteps3 766 calc-graph-y3value (calcFunc-index calc-graph-numsteps3
727 (nth 2 y3value) 767 (nth 2 calc-graph-y3value)
728 (math-div (math-sub (nth 3 y3value) 768 (math-div (math-sub (nth 3 calc-graph-y3value)
729 (nth 2 y3value)) 769 (nth 2 calc-graph-y3value))
730 (1- numsteps3)))) 770 (1- calc-graph-numsteps3))))
731 (error "%s is not a suitable basis for %s" 771 (error "%s is not a suitable basis for %s"
732 y3name yname))) 772 calc-graph-y3name calc-graph-yname)))
733 (setq xp nil 773 (setq calc-graph-xp nil
734 yp nil 774 calc-graph-yp nil
735 zp nil 775 calc-graph-zp nil
736 xvec t) 776 calc-graph-xvec t)
737 (setq math-working-step 0) 777 (setq math-working-step 0)
738 (while (setq xvalue (cdr xvalue)) 778 (while (setq calc-graph-xvalue (cdr calc-graph-xvalue))
739 (setq xp (nconc xp (make-list (1+ numsteps3) (car xvalue))) 779 (setq calc-graph-xp (nconc calc-graph-xp (make-list (1+ calc-graph-numsteps3) (car calc-graph-xvalue)))
740 yp (nconc yp (cons 0 (copy-sequence (cdr y3value)))) 780 calc-graph-yp (nconc calc-graph-yp (cons 0 (copy-sequence (cdr calc-graph-y3value))))
741 zp (cons '(skip) zp) 781 calc-graph-zp (cons '(skip) calc-graph-zp)
742 y3step y3value 782 calc-graph-y3step calc-graph-y3value
743 var-DUMMY (car xvalue) 783 var-DUMMY (car calc-graph-xvalue)
744 math-working-step-2 0 784 math-working-step-2 0
745 math-working-step (1+ math-working-step)) 785 math-working-step (1+ math-working-step))
746 (while (setq y3step (cdr y3step)) 786 (while (setq calc-graph-y3step (cdr calc-graph-y3step))
747 (setq math-working-step-2 (1+ math-working-step-2) 787 (setq math-working-step-2 (1+ math-working-step-2)
748 var-DUMMY2 (car y3step) 788 var-DUMMY2 (car calc-graph-y3step)
749 zp (cons (math-evaluate-expr yvalue) zp)))) 789 calc-graph-zp (cons (math-evaluate-expr calc-graph-yvalue) calc-graph-zp))))
750 (setq zp (nreverse zp) 790 (setq calc-graph-zp (nreverse calc-graph-zp)
751 numsteps (1- (* numsteps (1+ numsteps3)))))) 791 calc-graph-numsteps (1- (* calc-graph-numsteps (1+ calc-graph-numsteps3))))))
752 792
753(defun calc-graph-format-data () 793(defun calc-graph-format-data ()
754 (while (<= (setq stepcount (1+ stepcount)) numsteps) 794 (while (<= (setq calc-graph-stepcount (1+ calc-graph-stepcount)) calc-graph-numsteps)
755 (if xvec 795 (if calc-graph-xvec
756 (setq xp (cdr xp) 796 (setq calc-graph-xp (cdr calc-graph-xp)
757 xval (car xp) 797 calc-graph-xval (car calc-graph-xp)
758 yp (cdr yp) 798 calc-graph-yp (cdr calc-graph-yp)
759 yval (car yp) 799 calc-graph-yval (car calc-graph-yp)
760 zp (cdr zp) 800 calc-graph-zp (cdr calc-graph-zp)
761 zval (car zp)) 801 calc-graph-zval (car calc-graph-zp))
762 (if yvec 802 (if calc-graph-yvec
763 (setq xval xvalue 803 (setq calc-graph-xval calc-graph-xvalue
764 xvalue (math-add xvalue xstep) 804 calc-graph-xvalue (math-add calc-graph-xvalue calc-graph-xstep)
765 yp (cdr yp) 805 calc-graph-yp (cdr calc-graph-yp)
766 yval (car yp)) 806 calc-graph-yval (car calc-graph-yp))
767 (setq xval (car (car yp)) 807 (setq calc-graph-xval (car (car calc-graph-yp))
768 yval (cdr (car yp)) 808 calc-graph-yval (cdr (car calc-graph-yp))
769 yp (cdr yp)) 809 calc-graph-yp (cdr calc-graph-yp))
770 (if (or (not yp) 810 (if (or (not calc-graph-yp)
771 (and xhigh (equal xval xhigh))) 811 (and calc-graph-xhigh (equal calc-graph-xval calc-graph-xhigh)))
772 (setq numsteps 0)))) 812 (setq calc-graph-numsteps 0))))
773 (if is-splot 813 (if calc-graph-is-splot
774 (if (and (eq (car-safe zval) 'calcFunc-xyz) 814 (if (and (eq (car-safe calc-graph-zval) 'calcFunc-xyz)
775 (= (length zval) 4)) 815 (= (length calc-graph-zval) 4))
776 (setq xval (nth 1 zval) 816 (setq calc-graph-xval (nth 1 calc-graph-zval)
777 yval (nth 2 zval) 817 calc-graph-yval (nth 2 calc-graph-zval)
778 zval (nth 3 zval))) 818 calc-graph-zval (nth 3 calc-graph-zval)))
779 (if (and (eq (car-safe yval) 'calcFunc-xyz) 819 (if (and (eq (car-safe calc-graph-yval) 'calcFunc-xyz)
780 (= (length yval) 4)) 820 (= (length calc-graph-yval) 4))
781 (progn 821 (progn
782 (or surprise-splot 822 (or calc-graph-surprise-splot
783 (save-excursion 823 (save-excursion
784 (set-buffer (get-buffer-create "*Gnuplot Temp*")) 824 (set-buffer (get-buffer-create "*Gnuplot Temp*"))
785 (save-excursion 825 (save-excursion
786 (goto-char (point-max)) 826 (goto-char (point-max))
787 (re-search-backward "^plot[ \t]") 827 (re-search-backward "^plot[ \t]")
788 (insert "set parametric\ns") 828 (insert "set parametric\ns")
789 (setq surprise-splot t)))) 829 (setq calc-graph-surprise-splot t))))
790 (setq xval (nth 1 yval) 830 (setq calc-graph-xval (nth 1 calc-graph-yval)
791 zval (nth 3 yval) 831 calc-graph-zval (nth 3 calc-graph-yval)
792 yval (nth 2 yval))) 832 calc-graph-yval (nth 2 calc-graph-yval)))
793 (if (and (eq (car-safe yval) 'calcFunc-xy) 833 (if (and (eq (car-safe calc-graph-yval) 'calcFunc-xy)
794 (= (length yval) 3)) 834 (= (length calc-graph-yval) 3))
795 (setq xval (nth 1 yval) 835 (setq calc-graph-xval (nth 1 calc-graph-yval)
796 yval (nth 2 yval))))) 836 calc-graph-yval (nth 2 calc-graph-yval)))))
797 (if (and (Math-realp xval) 837 (if (and (Math-realp calc-graph-xval)
798 (Math-realp yval) 838 (Math-realp calc-graph-yval)
799 (or (not zval) (Math-realp zval))) 839 (or (not calc-graph-zval) (Math-realp calc-graph-zval)))
800 (progn 840 (progn
801 (setq blank nil 841 (setq calc-graph-blank nil
802 non-blank t) 842 calc-graph-non-blank t)
803 (if (Math-integerp xval) 843 (if (Math-integerp calc-graph-xval)
804 (insert (math-format-number xval)) 844 (insert (math-format-number calc-graph-xval))
805 (if (eq (car xval) 'frac) 845 (if (eq (car calc-graph-xval) 'frac)
806 (setq xval (math-float xval))) 846 (setq calc-graph-xval (math-float calc-graph-xval)))
807 (insert (math-format-number (nth 1 xval)) 847 (insert (math-format-number (nth 1 calc-graph-xval))
808 "e" (int-to-string (nth 2 xval)))) 848 "e" (int-to-string (nth 2 calc-graph-xval))))
809 (insert " ") 849 (insert " ")
810 (if (Math-integerp yval) 850 (if (Math-integerp calc-graph-yval)
811 (insert (math-format-number yval)) 851 (insert (math-format-number calc-graph-yval))
812 (if (eq (car yval) 'frac) 852 (if (eq (car calc-graph-yval) 'frac)
813 (setq yval (math-float yval))) 853 (setq calc-graph-yval (math-float calc-graph-yval)))
814 (insert (math-format-number (nth 1 yval)) 854 (insert (math-format-number (nth 1 calc-graph-yval))
815 "e" (int-to-string (nth 2 yval)))) 855 "e" (int-to-string (nth 2 calc-graph-yval))))
816 (if zval 856 (if calc-graph-zval
817 (progn 857 (progn
818 (insert " ") 858 (insert " ")
819 (if (Math-integerp zval) 859 (if (Math-integerp calc-graph-zval)
820 (insert (math-format-number zval)) 860 (insert (math-format-number calc-graph-zval))
821 (if (eq (car zval) 'frac) 861 (if (eq (car calc-graph-zval) 'frac)
822 (setq zval (math-float zval))) 862 (setq calc-graph-zval (math-float calc-graph-zval)))
823 (insert (math-format-number (nth 1 zval)) 863 (insert (math-format-number (nth 1 calc-graph-zval))
824 "e" (int-to-string (nth 2 zval)))))) 864 "e" (int-to-string (nth 2 calc-graph-zval))))))
825 (insert "\n")) 865 (insert "\n"))
826 (and (not (equal zval '(skip))) 866 (and (not (equal calc-graph-zval '(skip)))
827 (boundp 'var-PlotRejects)
828 (eq (car-safe var-PlotRejects) 'vec) 867 (eq (car-safe var-PlotRejects) 'vec)
829 (nconc var-PlotRejects 868 (nconc var-PlotRejects
830 (list (list 'vec 869 (list (list 'vec
831 curve-num 870 calc-graph-curve-num
832 stepcount 871 calc-graph-stepcount
833 xval yval))) 872 calc-graph-xval calc-graph-yval)))
834 (calc-refresh-evaltos 'var-PlotRejects)) 873 (calc-refresh-evaltos 'var-PlotRejects))
835 (or blank 874 (or calc-graph-blank
836 (progn 875 (progn
837 (insert "\n") 876 (insert "\n")
838 (setq blank t)))))) 877 (setq calc-graph-blank t))))))
839 878
840(defun calc-temp-file-name (num) 879(defun calc-temp-file-name (num)
841 (while (<= (length calc-graph-file-cache) (1+ num)) 880 (while (<= (length calc-graph-file-cache) (1+ num))
@@ -859,9 +898,7 @@
859 (setq calc-graph-file-cache (cdr calc-graph-file-cache)))) 898 (setq calc-graph-file-cache (cdr calc-graph-file-cache))))
860 899
861(defun calc-graph-kill-hook () 900(defun calc-graph-kill-hook ()
862 (calc-graph-delete-temps) 901 (calc-graph-delete-temps))
863 (if calc-graph-prev-kill-hook
864 (funcall calc-graph-prev-kill-hook)))
865 902
866(defun calc-graph-show-tty (output) 903(defun calc-graph-show-tty (output)
867 "Default calc-gnuplot-plot-command for \"tty\" output mode. 904 "Default calc-gnuplot-plot-command for \"tty\" output mode.
@@ -870,6 +907,9 @@ This is useful for tek40xx and other graphics-terminal types."
870 nil calc-gnuplot-buffer nil 907 nil calc-gnuplot-buffer nil
871 "-c" (format "cat %s >/dev/tty; rm %s" output output))) 908 "-c" (format "cat %s >/dev/tty; rm %s" output output)))
872 909
910(defvar calc-dumb-map nil
911 "The keymap for the \"dumb\" terminal plot.")
912
873(defun calc-graph-show-dumb (&optional output) 913(defun calc-graph-show-dumb (&optional output)
874 "Default calc-gnuplot-plot-command for Pinard's \"dumb\" terminal type. 914 "Default calc-gnuplot-plot-command for Pinard's \"dumb\" terminal type.
875This \"dumb\" driver will be present in Gnuplot 3.0." 915This \"dumb\" driver will be present in Gnuplot 3.0."
@@ -882,7 +922,6 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
882 (sleep-for 1)) 922 (sleep-for 1))
883 (goto-char (point-max)) 923 (goto-char (point-max))
884 (re-search-backward "\f\\|^[ \t]+\\^$\\|G N U P L O T") 924 (re-search-backward "\f\\|^[ \t]+\\^$\\|G N U P L O T")
885 (setq found-pt (point))
886 (if (looking-at "\f") 925 (if (looking-at "\f")
887 (progn 926 (progn
888 (forward-char 1) 927 (forward-char 1)
@@ -898,7 +937,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
898 (end-of-line) 937 (end-of-line)
899 (backward-char 1) 938 (backward-char 1)
900 (recenter '(4))) 939 (recenter '(4)))
901 (or (boundp 'calc-dumb-map) 940 (or calc-dumb-map
902 (progn 941 (progn
903 (setq calc-dumb-map (make-sparse-keymap)) 942 (setq calc-dumb-map (make-sparse-keymap))
904 (define-key calc-dumb-map "\n" 'scroll-up) 943 (define-key calc-dumb-map "\n" 'scroll-up)
@@ -1097,7 +1136,8 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
1097 (or (calc-graph-find-plot nil nil) 1136 (or (calc-graph-find-plot nil nil)
1098 (error "No data points have been set!")) 1137 (error "No data points have been set!"))
1099 (let ((base (point)) 1138 (let ((base (point))
1100 start) 1139 start
1140 end)
1101 (re-search-forward "[,\n]\\|[ \t]+with") 1141 (re-search-forward "[,\n]\\|[ \t]+with")
1102 (setq end (match-beginning 0)) 1142 (setq end (match-beginning 0))
1103 (goto-char base) 1143 (goto-char base)
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index bb6699a4ac9..ee00e022553 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -263,15 +263,15 @@
263 (let ((math-parsing-fortran-vector '(end . "\000"))) 263 (let ((math-parsing-fortran-vector '(end . "\000")))
264 (prog1 264 (prog1
265 (math-read-brackets t "]") 265 (math-read-brackets t "]")
266 (setq exp-token (car math-parsing-fortran-vector) 266 (setq math-exp-token (car math-parsing-fortran-vector)
267 exp-data (cdr math-parsing-fortran-vector))))) 267 math-expr-data (cdr math-parsing-fortran-vector)))))
268 268
269(defun math-parse-fortran-vector-end (x op) 269(defun math-parse-fortran-vector-end (x op)
270 (if math-parsing-fortran-vector 270 (if math-parsing-fortran-vector
271 (progn 271 (progn
272 (setq math-parsing-fortran-vector (cons exp-token exp-data) 272 (setq math-parsing-fortran-vector (cons math-exp-token math-expr-data)
273 exp-token 'end 273 math-exp-token 'end
274 exp-data "\000") 274 math-expr-data "\000")
275 x) 275 x)
276 (throw 'syntax "Unmatched closing `/'"))) 276 (throw 'syntax "Unmatched closing `/'")))
277 277
@@ -384,15 +384,15 @@
384 384
385(defun math-parse-tex-sum (f val) 385(defun math-parse-tex-sum (f val)
386 (let (low high save) 386 (let (low high save)
387 (or (equal exp-data "_") (throw 'syntax "Expected `_'")) 387 (or (equal math-expr-data "_") (throw 'syntax "Expected `_'"))
388 (math-read-token) 388 (math-read-token)
389 (setq save exp-old-pos) 389 (setq save math-exp-old-pos)
390 (setq low (math-read-factor)) 390 (setq low (math-read-factor))
391 (or (eq (car-safe low) 'calcFunc-eq) 391 (or (eq (car-safe low) 'calcFunc-eq)
392 (progn 392 (progn
393 (setq exp-old-pos (1+ save)) 393 (setq math-exp-old-pos (1+ save))
394 (throw 'syntax "Expected equation"))) 394 (throw 'syntax "Expected equation")))
395 (or (equal exp-data "^") (throw 'syntax "Expected `^'")) 395 (or (equal math-expr-data "^") (throw 'syntax "Expected `^'"))
396 (math-read-token) 396 (math-read-token)
397 (setq high (math-read-factor)) 397 (setq high (math-read-factor))
398 (list (nth 2 f) (math-read-factor) (nth 1 low) (nth 2 low) high))) 398 (list (nth 2 f) (math-read-factor) (nth 1 low) (nth 2 low) high)))
@@ -484,31 +484,31 @@
484 484
485(defun math-parse-eqn-matrix (f sym) 485(defun math-parse-eqn-matrix (f sym)
486 (let ((vec nil)) 486 (let ((vec nil))
487 (while (assoc exp-data '(("ccol") ("lcol") ("rcol"))) 487 (while (assoc math-expr-data '(("ccol") ("lcol") ("rcol")))
488 (math-read-token) 488 (math-read-token)
489 (or (equal exp-data calc-function-open) 489 (or (equal math-expr-data calc-function-open)
490 (throw 'syntax "Expected `{'")) 490 (throw 'syntax "Expected `{'"))
491 (math-read-token) 491 (math-read-token)
492 (setq vec (cons (cons 'vec (math-read-expr-list)) vec)) 492 (setq vec (cons (cons 'vec (math-read-expr-list)) vec))
493 (or (equal exp-data calc-function-close) 493 (or (equal math-expr-data calc-function-close)
494 (throw 'syntax "Expected `}'")) 494 (throw 'syntax "Expected `}'"))
495 (math-read-token)) 495 (math-read-token))
496 (or (equal exp-data calc-function-close) 496 (or (equal math-expr-data calc-function-close)
497 (throw 'syntax "Expected `}'")) 497 (throw 'syntax "Expected `}'"))
498 (math-read-token) 498 (math-read-token)
499 (math-transpose (cons 'vec (nreverse vec))))) 499 (math-transpose (cons 'vec (nreverse vec)))))
500 500
501(defun math-parse-eqn-prime (x sym) 501(defun math-parse-eqn-prime (x sym)
502 (if (eq (car-safe x) 'var) 502 (if (eq (car-safe x) 'var)
503 (if (equal exp-data calc-function-open) 503 (if (equal math-expr-data calc-function-open)
504 (progn 504 (progn
505 (math-read-token) 505 (math-read-token)
506 (let ((args (if (or (equal exp-data calc-function-close) 506 (let ((args (if (or (equal math-expr-data calc-function-close)
507 (eq exp-token 'end)) 507 (eq math-exp-token 'end))
508 nil 508 nil
509 (math-read-expr-list)))) 509 (math-read-expr-list))))
510 (if (not (or (equal exp-data calc-function-close) 510 (if (not (or (equal math-expr-data calc-function-close)
511 (eq exp-token 'end))) 511 (eq math-exp-token 'end)))
512 (throw 'syntax "Expected `)'")) 512 (throw 'syntax "Expected `)'"))
513 (math-read-token) 513 (math-read-token)
514 (cons (intern (format "calcFunc-%s'" (nth 1 x))) args))) 514 (cons (intern (format "calcFunc-%s'" (nth 1 x))) args)))
@@ -622,10 +622,10 @@
622 622
623(defun math-read-math-subscr (x op) 623(defun math-read-math-subscr (x op)
624 (let ((idx (math-read-expr-level 0))) 624 (let ((idx (math-read-expr-level 0)))
625 (or (and (equal exp-data "]") 625 (or (and (equal math-expr-data "]")
626 (progn 626 (progn
627 (math-read-token) 627 (math-read-token)
628 (equal exp-data "]"))) 628 (equal math-expr-data "]")))
629 (throw 'syntax "Expected ']]'")) 629 (throw 'syntax "Expected ']]'"))
630 (math-read-token) 630 (math-read-token)
631 (list 'calcFunc-subscr x idx))) 631 (list 'calcFunc-subscr x idx)))
diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el
index 213b7dc4474..6ede0888319 100644
--- a/lisp/calc/calc-poly.el
+++ b/lisp/calc/calc-poly.el
@@ -1040,7 +1040,7 @@
1040 (memq (car-safe (nth 1 expr)) '(+ -)) 1040 (memq (car-safe (nth 1 expr)) '(+ -))
1041 (integerp (nth 2 expr)) 1041 (integerp (nth 2 expr))
1042 (if (> (nth 2 expr) 0) 1042 (if (> (nth 2 expr) 0)
1043 (or (and (or (> mmt-many 500000) (< mmt-many -500000)) 1043 (or (and (or (> math-mt-many 500000) (< math-mt-many -500000))
1044 (math-expand-power (nth 1 expr) (nth 2 expr) 1044 (math-expand-power (nth 1 expr) (nth 2 expr)
1045 nil t)) 1045 nil t))
1046 (list '* 1046 (list '*
diff --git a/lisp/calc/calc-rewr.el b/lisp/calc/calc-rewr.el
index 47b48bd88d8..fd361bd3eee 100644
--- a/lisp/calc/calc-rewr.el
+++ b/lisp/calc/calc-rewr.el
@@ -166,7 +166,7 @@
166 166
167 167
168 168
169(defun math-rewrite (whole-expr rules &optional mmt-many) 169(defun math-rewrite (whole-expr rules &optional math-mt-many)
170 (let ((crules (math-compile-rewrites rules)) 170 (let ((crules (math-compile-rewrites rules))
171 (heads (math-rewrite-heads whole-expr)) 171 (heads (math-rewrite-heads whole-expr))
172 (trace-buffer (get-buffer "*Trace*")) 172 (trace-buffer (get-buffer "*Trace*"))
@@ -176,20 +176,20 @@
176 (calc-line-numbering nil) 176 (calc-line-numbering nil)
177 (calc-show-selections t) 177 (calc-show-selections t)
178 (calc-why nil) 178 (calc-why nil)
179 (mmt-func (function 179 (math-mt-func (function
180 (lambda (x) 180 (lambda (x)
181 (let ((result (math-apply-rewrites x (cdr crules) 181 (let ((result (math-apply-rewrites x (cdr crules)
182 heads crules))) 182 heads crules)))
183 (if result 183 (if result
184 (progn 184 (progn
185 (if trace-buffer 185 (if trace-buffer
186 (let ((fmt (math-format-stack-value 186 (let ((fmt (math-format-stack-value
187 (list result nil nil)))) 187 (list result nil nil))))
188 (save-excursion 188 (save-excursion
189 (set-buffer trace-buffer) 189 (set-buffer trace-buffer)
190 (insert "\nrewrite to\n" fmt "\n")))) 190 (insert "\nrewrite to\n" fmt "\n"))))
191 (setq heads (math-rewrite-heads result heads t)))) 191 (setq heads (math-rewrite-heads result heads t))))
192 result))))) 192 result)))))
193 (if trace-buffer 193 (if trace-buffer
194 (let ((fmt (math-format-stack-value (list whole-expr nil nil)))) 194 (let ((fmt (math-format-stack-value (list whole-expr nil nil))))
195 (save-excursion 195 (save-excursion
@@ -197,22 +197,22 @@
197 (setq truncate-lines t) 197 (setq truncate-lines t)
198 (goto-char (point-max)) 198 (goto-char (point-max))
199 (insert "\n\nBegin rewriting\n" fmt "\n")))) 199 (insert "\n\nBegin rewriting\n" fmt "\n"))))
200 (or mmt-many (setq mmt-many (or (nth 1 (car crules)) 200 (or math-mt-many (setq math-mt-many (or (nth 1 (car crules))
201 math-rewrite-default-iters))) 201 math-rewrite-default-iters)))
202 (if (equal mmt-many '(var inf var-inf)) (setq mmt-many 1000000)) 202 (if (equal math-mt-many '(var inf var-inf)) (setq math-mt-many 1000000))
203 (if (equal mmt-many '(neg (var inf var-inf))) (setq mmt-many -1000000)) 203 (if (equal math-mt-many '(neg (var inf var-inf))) (setq math-mt-many -1000000))
204 (math-rewrite-phase (nth 3 (car crules))) 204 (math-rewrite-phase (nth 3 (car crules)))
205 (if trace-buffer 205 (if trace-buffer
206 (let ((fmt (math-format-stack-value (list whole-expr nil nil)))) 206 (let ((fmt (math-format-stack-value (list whole-expr nil nil))))
207 (save-excursion 207 (save-excursion
208 (set-buffer trace-buffer) 208 (set-buffer trace-buffer)
209 (insert "\nDone rewriting" 209 (insert "\nDone rewriting"
210 (if (= mmt-many 0) " (reached iteration limit)" "") 210 (if (= math-mt-many 0) " (reached iteration limit)" "")
211 ":\n" fmt "\n")))) 211 ":\n" fmt "\n"))))
212 whole-expr)) 212 whole-expr))
213 213
214(defun math-rewrite-phase (sched) 214(defun math-rewrite-phase (sched)
215 (while (and sched (/= mmt-many 0)) 215 (while (and sched (/= math-mt-many 0))
216 (if (listp (car sched)) 216 (if (listp (car sched))
217 (while (let ((save-expr whole-expr)) 217 (while (let ((save-expr whole-expr))
218 (math-rewrite-phase (car sched)) 218 (math-rewrite-phase (car sched))
diff --git a/lisp/calc/calc-vec.el b/lisp/calc/calc-vec.el
index 51d7450278e..a78f98ec3cc 100644
--- a/lisp/calc/calc-vec.el
+++ b/lisp/calc/calc-vec.el
@@ -1466,103 +1466,103 @@
1466(defun math-read-brackets (space-sep close) 1466(defun math-read-brackets (space-sep close)
1467 (and space-sep (setq space-sep (not (math-check-for-commas)))) 1467 (and space-sep (setq space-sep (not (math-check-for-commas))))
1468 (math-read-token) 1468 (math-read-token)
1469 (while (eq exp-token 'space) 1469 (while (eq math-exp-token 'space)
1470 (math-read-token)) 1470 (math-read-token))
1471 (if (or (equal exp-data close) 1471 (if (or (equal math-expr-data close)
1472 (eq exp-token 'end)) 1472 (eq math-exp-token 'end))
1473 (progn 1473 (progn
1474 (math-read-token) 1474 (math-read-token)
1475 '(vec)) 1475 '(vec))
1476 (let ((save-exp-pos exp-pos) 1476 (let ((save-exp-pos math-exp-pos)
1477 (save-exp-old-pos exp-old-pos) 1477 (save-exp-old-pos math-exp-old-pos)
1478 (save-exp-token exp-token) 1478 (save-exp-token math-exp-token)
1479 (save-exp-data exp-data) 1479 (save-exp-data math-expr-data)
1480 (vals (let ((exp-keep-spaces space-sep)) 1480 (vals (let ((math-exp-keep-spaces space-sep))
1481 (if (or (equal exp-data "\\dots") 1481 (if (or (equal math-expr-data "\\dots")
1482 (equal exp-data "\\ldots")) 1482 (equal math-expr-data "\\ldots"))
1483 '(vec (neg (var inf var-inf))) 1483 '(vec (neg (var inf var-inf)))
1484 (catch 'syntax (math-read-vector)))))) 1484 (catch 'syntax (math-read-vector))))))
1485 (if (stringp vals) 1485 (if (stringp vals)
1486 (if space-sep 1486 (if space-sep
1487 (let ((error-exp-pos exp-pos) 1487 (let ((error-exp-pos math-exp-pos)
1488 (error-exp-old-pos exp-old-pos) 1488 (error-exp-old-pos math-exp-old-pos)
1489 vals2) 1489 vals2)
1490 (setq exp-pos save-exp-pos 1490 (setq math-exp-pos save-exp-pos
1491 exp-old-pos save-exp-old-pos 1491 math-exp-old-pos save-exp-old-pos
1492 exp-token save-exp-token 1492 math-exp-token save-exp-token
1493 exp-data save-exp-data) 1493 math-expr-data save-exp-data)
1494 (let ((exp-keep-spaces nil)) 1494 (let ((math-exp-keep-spaces nil))
1495 (setq vals2 (catch 'syntax (math-read-vector)))) 1495 (setq vals2 (catch 'syntax (math-read-vector))))
1496 (if (and (not (stringp vals2)) 1496 (if (and (not (stringp vals2))
1497 (or (assoc exp-data '(("\\ldots") ("\\dots") (";"))) 1497 (or (assoc math-expr-data '(("\\ldots") ("\\dots") (";")))
1498 (equal exp-data close) 1498 (equal math-expr-data close)
1499 (eq exp-token 'end))) 1499 (eq math-exp-token 'end)))
1500 (setq space-sep nil 1500 (setq space-sep nil
1501 vals vals2) 1501 vals vals2)
1502 (setq exp-pos error-exp-pos 1502 (setq math-exp-pos error-exp-pos
1503 exp-old-pos error-exp-old-pos) 1503 math-exp-old-pos error-exp-old-pos)
1504 (throw 'syntax vals))) 1504 (throw 'syntax vals)))
1505 (throw 'syntax vals))) 1505 (throw 'syntax vals)))
1506 (if (or (equal exp-data "\\dots") 1506 (if (or (equal math-expr-data "\\dots")
1507 (equal exp-data "\\ldots")) 1507 (equal math-expr-data "\\ldots"))
1508 (progn 1508 (progn
1509 (math-read-token) 1509 (math-read-token)
1510 (setq vals (if (> (length vals) 2) 1510 (setq vals (if (> (length vals) 2)
1511 (cons 'calcFunc-mul (cdr vals)) (nth 1 vals))) 1511 (cons 'calcFunc-mul (cdr vals)) (nth 1 vals)))
1512 (let ((exp2 (if (or (equal exp-data close) 1512 (let ((exp2 (if (or (equal math-expr-data close)
1513 (equal exp-data ")") 1513 (equal math-expr-data ")")
1514 (eq exp-token 'end)) 1514 (eq math-exp-token 'end))
1515 '(var inf var-inf) 1515 '(var inf var-inf)
1516 (math-read-expr-level 0)))) 1516 (math-read-expr-level 0))))
1517 (setq vals 1517 (setq vals
1518 (list 'intv 1518 (list 'intv
1519 (if (equal exp-data ")") 2 3) 1519 (if (equal math-expr-data ")") 2 3)
1520 vals 1520 vals
1521 exp2))) 1521 exp2)))
1522 (if (not (or (equal exp-data close) 1522 (if (not (or (equal math-expr-data close)
1523 (equal exp-data ")") 1523 (equal math-expr-data ")")
1524 (eq exp-token 'end))) 1524 (eq math-exp-token 'end)))
1525 (throw 'syntax "Expected `]'"))) 1525 (throw 'syntax "Expected `]'")))
1526 (if (equal exp-data ";") 1526 (if (equal math-expr-data ";")
1527 (let ((exp-keep-spaces space-sep)) 1527 (let ((math-exp-keep-spaces space-sep))
1528 (setq vals (cons 'vec (math-read-matrix (list vals)))))) 1528 (setq vals (cons 'vec (math-read-matrix (list vals))))))
1529 (if (not (or (equal exp-data close) 1529 (if (not (or (equal math-expr-data close)
1530 (eq exp-token 'end))) 1530 (eq math-exp-token 'end)))
1531 (throw 'syntax "Expected `]'"))) 1531 (throw 'syntax "Expected `]'")))
1532 (or (eq exp-token 'end) 1532 (or (eq math-exp-token 'end)
1533 (math-read-token)) 1533 (math-read-token))
1534 vals))) 1534 vals)))
1535 1535
1536(defun math-check-for-commas (&optional balancing) 1536(defun math-check-for-commas (&optional balancing)
1537 (let ((count 0) 1537 (let ((count 0)
1538 (pos (1- exp-pos))) 1538 (pos (1- math-exp-pos)))
1539 (while (and (>= count 0) 1539 (while (and (>= count 0)
1540 (setq pos (string-match 1540 (setq pos (string-match
1541 (if balancing "[],[{}()<>]" "[],[{}()]") 1541 (if balancing "[],[{}()<>]" "[],[{}()]")
1542 exp-str (1+ pos))) 1542 math-exp-str (1+ pos)))
1543 (or (/= (aref exp-str pos) ?,) (> count 0) balancing)) 1543 (or (/= (aref math-exp-str pos) ?,) (> count 0) balancing))
1544 (cond ((memq (aref exp-str pos) '(?\[ ?\{ ?\( ?\<)) 1544 (cond ((memq (aref math-exp-str pos) '(?\[ ?\{ ?\( ?\<))
1545 (setq count (1+ count))) 1545 (setq count (1+ count)))
1546 ((memq (aref exp-str pos) '(?\] ?\} ?\) ?\>)) 1546 ((memq (aref math-exp-str pos) '(?\] ?\} ?\) ?\>))
1547 (setq count (1- count))))) 1547 (setq count (1- count)))))
1548 (if balancing 1548 (if balancing
1549 pos 1549 pos
1550 (and pos (= (aref exp-str pos) ?,))))) 1550 (and pos (= (aref math-exp-str pos) ?,)))))
1551 1551
1552(defun math-read-vector () 1552(defun math-read-vector ()
1553 (let* ((val (list (math-read-expr-level 0))) 1553 (let* ((val (list (math-read-expr-level 0)))
1554 (last val)) 1554 (last val))
1555 (while (progn 1555 (while (progn
1556 (while (eq exp-token 'space) 1556 (while (eq math-exp-token 'space)
1557 (math-read-token)) 1557 (math-read-token))
1558 (and (not (eq exp-token 'end)) 1558 (and (not (eq math-exp-token 'end))
1559 (not (equal exp-data ";")) 1559 (not (equal math-expr-data ";"))
1560 (not (equal exp-data close)) 1560 (not (equal math-expr-data close))
1561 (not (equal exp-data "\\dots")) 1561 (not (equal math-expr-data "\\dots"))
1562 (not (equal exp-data "\\ldots")))) 1562 (not (equal math-expr-data "\\ldots"))))
1563 (if (equal exp-data ",") 1563 (if (equal math-expr-data ",")
1564 (math-read-token)) 1564 (math-read-token))
1565 (while (eq exp-token 'space) 1565 (while (eq math-exp-token 'space)
1566 (math-read-token)) 1566 (math-read-token))
1567 (let ((rest (list (math-read-expr-level 0)))) 1567 (let ((rest (list (math-read-expr-level 0))))
1568 (setcdr last rest) 1568 (setcdr last rest)
@@ -1570,9 +1570,9 @@
1570 (cons 'vec val))) 1570 (cons 'vec val)))
1571 1571
1572(defun math-read-matrix (mat) 1572(defun math-read-matrix (mat)
1573 (while (equal exp-data ";") 1573 (while (equal math-expr-data ";")
1574 (math-read-token) 1574 (math-read-token)
1575 (while (eq exp-token 'space) 1575 (while (eq math-exp-token 'space)
1576 (math-read-token)) 1576 (math-read-token))
1577 (setq mat (nconc mat (list (math-read-vector))))) 1577 (setq mat (nconc mat (list (math-read-vector)))))
1578 mat) 1578 mat)
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 4ace5fb6780..6480b1960a5 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -654,6 +654,20 @@ If nil, selections displayed but ignored.")
654 calc-word-size 654 calc-word-size
655 calc-internal-prec)) 655 calc-internal-prec))
656 656
657(defvar calc-mode-hook nil
658 "Hook run when entering calc-mode.")
659
660(defvar calc-trail-mode-hook nil
661 "Hook run when entering calc-trail-mode.")
662
663(defvar calc-start-hook nil
664 "Hook run when calc is started.")
665
666(defvar calc-end-hook nil
667 "Hook run when calc is quit.")
668
669(defvar calc-load-hook nil
670 "Hook run when calc.el is loaded.")
657 671
658;; Verify that Calc is running on the right kind of system. 672;; Verify that Calc is running on the right kind of system.
659(defvar calc-emacs-type-lucid (not (not (string-match "Lucid" emacs-version)))) 673(defvar calc-emacs-type-lucid (not (not (string-match "Lucid" emacs-version))))
@@ -1056,9 +1070,6 @@ Notations: 3.14e6 3.14 * 10^6
1056 (progn 1070 (progn
1057 (setq calc-loaded-settings-file t) 1071 (setq calc-loaded-settings-file t)
1058 (load calc-settings-file t))) ; t = missing-ok 1072 (load calc-settings-file t))) ; t = missing-ok
1059 (if (and (eq window-system 'x) (boundp 'mouse-map))
1060 (substitute-key-definition 'x-paste-text 'calc-x-paste-text
1061 mouse-map))
1062 (let ((p command-line-args)) 1073 (let ((p command-line-args))
1063 (while p 1074 (while p
1064 (and (equal (car p) "-f") 1075 (and (equal (car p) "-f")
@@ -1069,14 +1080,6 @@ Notations: 3.14e6 3.14 * 10^6
1069 (run-hooks 'calc-mode-hook) 1080 (run-hooks 'calc-mode-hook)
1070 (calc-refresh t) 1081 (calc-refresh t)
1071 (calc-set-mode-line) 1082 (calc-set-mode-line)
1072 ;; The calc-defs variable is a relic. Use calc-define properties instead.
1073 (when (and (boundp 'calc-defs)
1074 calc-defs)
1075 (message "Evaluating calc-defs...")
1076 (calc-need-macros)
1077 (eval (cons 'progn calc-defs))
1078 (setq calc-defs nil)
1079 (calc-set-mode-line))
1080 (calc-check-defines)) 1083 (calc-check-defines))
1081 1084
1082(defvar calc-check-defines 'calc-check-defines) ; suitable for run-hooks 1085(defvar calc-check-defines 'calc-check-defines) ; suitable for run-hooks
@@ -1163,20 +1166,18 @@ commands given here will actually operate on the *Calculator* stack."
1163 (switch-to-buffer (current-buffer) t) 1166 (switch-to-buffer (current-buffer) t)
1164 (if (get-buffer-window (current-buffer)) 1167 (if (get-buffer-window (current-buffer))
1165 (select-window (get-buffer-window (current-buffer))) 1168 (select-window (get-buffer-window (current-buffer)))
1166 (if (and (boundp 'calc-window-hook) calc-window-hook) 1169 (let ((w (get-largest-window)))
1167 (run-hooks 'calc-window-hook) 1170 (if (and pop-up-windows
1168 (let ((w (get-largest-window))) 1171 (> (window-height w)
1169 (if (and pop-up-windows 1172 (+ window-min-height calc-window-height 2)))
1170 (> (window-height w) 1173 (progn
1171 (+ window-min-height calc-window-height 2))) 1174 (setq w (split-window w
1172 (progn 1175 (- (window-height w)
1173 (setq w (split-window w 1176 calc-window-height 2)
1174 (- (window-height w) 1177 nil))
1175 calc-window-height 2) 1178 (set-window-buffer w (current-buffer))
1176 nil)) 1179 (select-window w))
1177 (set-window-buffer w (current-buffer)) 1180 (pop-to-buffer (current-buffer))))))
1178 (select-window w))
1179 (pop-to-buffer (current-buffer)))))))
1180 (save-excursion 1181 (save-excursion
1181 (set-buffer (calc-trail-buffer)) 1182 (set-buffer (calc-trail-buffer))
1182 (and calc-display-trail 1183 (and calc-display-trail
@@ -1722,27 +1723,6 @@ See calc-keypad for details."
1722 (calc-refresh align))) 1723 (calc-refresh align)))
1723 (setq calc-refresh-count (1+ calc-refresh-count))) 1724 (setq calc-refresh-count (1+ calc-refresh-count)))
1724 1725
1725
1726(defun calc-x-paste-text (arg)
1727 "Move point to mouse position and insert window system cut buffer contents.
1728If mouse is pressed in Calc window, push cut buffer contents onto the stack."
1729 (x-mouse-select arg)
1730 (if (memq major-mode '(calc-mode calc-trail-mode))
1731 (progn
1732 (calc-wrapper
1733 (calc-extensions)
1734 (let* ((buf (x-get-cut-buffer))
1735 (val (math-read-exprs (calc-clean-newlines buf))))
1736 (if (eq (car-safe val) 'error)
1737 (progn
1738 (setq val (math-read-exprs buf))
1739 (if (eq (car-safe val) 'error)
1740 (error "%s in yanked data" (nth 2 val)))))
1741 (calc-enter-result 0 "Xynk" val))))
1742 (x-paste-text arg)))
1743
1744
1745
1746;;;; The Calc Trail buffer. 1726;;;; The Calc Trail buffer.
1747 1727
1748(defun calc-check-trail-aligned () 1728(defun calc-check-trail-aligned ()
@@ -1808,10 +1788,8 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
1808 (not (if flag (memq flag '(nil 0)) win))) 1788 (not (if flag (memq flag '(nil 0)) win)))
1809 (if (null win) 1789 (if (null win)
1810 (progn 1790 (progn
1811 (if (and (boundp 'calc-trail-window-hook) calc-trail-window-hook) 1791 (let ((w (split-window nil (/ (* (window-width) 2) 3) t)))
1812 (run-hooks 'calc-trail-window-hook) 1792 (set-window-buffer w calc-trail-buffer))
1813 (let ((w (split-window nil (/ (* (window-width) 2) 3) t)))
1814 (set-window-buffer w calc-trail-buffer)))
1815 (calc-wrapper 1793 (calc-wrapper
1816 (setq overlay-arrow-string calc-trail-overlay 1794 (setq overlay-arrow-string calc-trail-overlay
1817 overlay-arrow-position calc-trail-pointer) 1795 overlay-arrow-position calc-trail-pointer)
@@ -2254,62 +2232,72 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
2254(defvar math-eval-rules-cache) 2232(defvar math-eval-rules-cache)
2255(defvar math-eval-rules-cache-other) 2233(defvar math-eval-rules-cache-other)
2256;;; Reduce an object to canonical (normalized) form. [O o; Z Z] [Public] 2234;;; Reduce an object to canonical (normalized) form. [O o; Z Z] [Public]
2257(defun math-normalize (a) 2235
2236(defvar math-normalize-a)
2237(defun math-normalize (math-normalize-a)
2258 (cond 2238 (cond
2259 ((not (consp a)) 2239 ((not (consp math-normalize-a))
2260 (if (integerp a) 2240 (if (integerp math-normalize-a)
2261 (if (or (>= a 1000000) (<= a -1000000)) 2241 (if (or (>= math-normalize-a 1000000) (<= math-normalize-a -1000000))
2262 (math-bignum a) 2242 (math-bignum math-normalize-a)
2263 a) 2243 math-normalize-a)
2264 a)) 2244 math-normalize-a))
2265 ((eq (car a) 'bigpos) 2245 ((eq (car math-normalize-a) 'bigpos)
2266 (if (eq (nth (1- (length a)) a) 0) 2246 (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0)
2267 (let* ((last (setq a (copy-sequence a))) (digs a)) 2247 (let* ((last (setq math-normalize-a
2248 (copy-sequence math-normalize-a))) (digs math-normalize-a))
2268 (while (setq digs (cdr digs)) 2249 (while (setq digs (cdr digs))
2269 (or (eq (car digs) 0) (setq last digs))) 2250 (or (eq (car digs) 0) (setq last digs)))
2270 (setcdr last nil))) 2251 (setcdr last nil)))
2271 (if (cdr (cdr (cdr a))) 2252 (if (cdr (cdr (cdr math-normalize-a)))
2272 a 2253 math-normalize-a
2273 (cond 2254 (cond
2274 ((cdr (cdr a)) (+ (nth 1 a) (* (nth 2 a) 1000))) 2255 ((cdr (cdr math-normalize-a)) (+ (nth 1 math-normalize-a)
2275 ((cdr a) (nth 1 a)) 2256 (* (nth 2 math-normalize-a) 1000)))
2257 ((cdr math-normalize-a) (nth 1 math-normalize-a))
2276 (t 0)))) 2258 (t 0))))
2277 ((eq (car a) 'bigneg) 2259 ((eq (car math-normalize-a) 'bigneg)
2278 (if (eq (nth (1- (length a)) a) 0) 2260 (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0)
2279 (let* ((last (setq a (copy-sequence a))) (digs a)) 2261 (let* ((last (setq math-normalize-a (copy-sequence math-normalize-a)))
2262 (digs math-normalize-a))
2280 (while (setq digs (cdr digs)) 2263 (while (setq digs (cdr digs))
2281 (or (eq (car digs) 0) (setq last digs))) 2264 (or (eq (car digs) 0) (setq last digs)))
2282 (setcdr last nil))) 2265 (setcdr last nil)))
2283 (if (cdr (cdr (cdr a))) 2266 (if (cdr (cdr (cdr math-normalize-a)))
2284 a 2267 math-normalize-a
2285 (cond 2268 (cond
2286 ((cdr (cdr a)) (- (+ (nth 1 a) (* (nth 2 a) 1000)))) 2269 ((cdr (cdr math-normalize-a)) (- (+ (nth 1 math-normalize-a)
2287 ((cdr a) (- (nth 1 a))) 2270 (* (nth 2 math-normalize-a) 1000))))
2271 ((cdr math-normalize-a) (- (nth 1 math-normalize-a)))
2288 (t 0)))) 2272 (t 0))))
2289 ((eq (car a) 'float) 2273 ((eq (car math-normalize-a) 'float)
2290 (math-make-float (math-normalize (nth 1 a)) (nth 2 a))) 2274 (math-make-float (math-normalize (nth 1 math-normalize-a))
2291 ((or (memq (car a) '(frac cplx polar hms date mod sdev intv vec var quote 2275 (nth 2 math-normalize-a)))
2292 special-const calcFunc-if calcFunc-lambda 2276 ((or (memq (car math-normalize-a)
2293 calcFunc-quote calcFunc-condition 2277 '(frac cplx polar hms date mod sdev intv vec var quote
2294 calcFunc-evalto)) 2278 special-const calcFunc-if calcFunc-lambda
2295 (integerp (car a)) 2279 calcFunc-quote calcFunc-condition
2296 (and (consp (car a)) (not (eq (car (car a)) 'lambda)))) 2280 calcFunc-evalto))
2281 (integerp (car math-normalize-a))
2282 (and (consp (car math-normalize-a))
2283 (not (eq (car (car math-normalize-a)) 'lambda))))
2297 (calc-extensions) 2284 (calc-extensions)
2298 (math-normalize-fancy a)) 2285 (math-normalize-fancy math-normalize-a))
2299 (t 2286 (t
2300 (or (and calc-simplify-mode 2287 (or (and calc-simplify-mode
2301 (calc-extensions) 2288 (calc-extensions)
2302 (math-normalize-nonstandard)) 2289 (math-normalize-nonstandard))
2303 (let ((args (mapcar 'math-normalize (cdr a)))) 2290 (let ((args (mapcar 'math-normalize (cdr math-normalize-a))))
2304 (or (condition-case err 2291 (or (condition-case err
2305 (let ((func (assq (car a) '( ( + . math-add ) 2292 (let ((func
2306 ( - . math-sub ) 2293 (assq (car math-normalize-a) '( ( + . math-add )
2307 ( * . math-mul ) 2294 ( - . math-sub )
2308 ( / . math-div ) 2295 ( * . math-mul )
2309 ( % . math-mod ) 2296 ( / . math-div )
2310 ( ^ . math-pow ) 2297 ( % . math-mod )
2311 ( neg . math-neg ) 2298 ( ^ . math-pow )
2312 ( | . math-concat ) )))) 2299 ( neg . math-neg )
2300 ( | . math-concat ) ))))
2313 (or (and var-EvalRules 2301 (or (and var-EvalRules
2314 (progn 2302 (progn
2315 (or (eq var-EvalRules math-eval-rules-cache-tag) 2303 (or (eq var-EvalRules math-eval-rules-cache-tag)
@@ -2317,51 +2305,54 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
2317 (calc-extensions) 2305 (calc-extensions)
2318 (math-recompile-eval-rules))) 2306 (math-recompile-eval-rules)))
2319 (and (or math-eval-rules-cache-other 2307 (and (or math-eval-rules-cache-other
2320 (assq (car a) math-eval-rules-cache)) 2308 (assq (car math-normalize-a)
2309 math-eval-rules-cache))
2321 (math-apply-rewrites 2310 (math-apply-rewrites
2322 (cons (car a) args) 2311 (cons (car math-normalize-a) args)
2323 (cdr math-eval-rules-cache) 2312 (cdr math-eval-rules-cache)
2324 nil math-eval-rules-cache)))) 2313 nil math-eval-rules-cache))))
2325 (if func 2314 (if func
2326 (apply (cdr func) args) 2315 (apply (cdr func) args)
2327 (and (or (consp (car a)) 2316 (and (or (consp (car math-normalize-a))
2328 (fboundp (car a)) 2317 (fboundp (car math-normalize-a))
2329 (and (not calc-extensions-loaded) 2318 (and (not calc-extensions-loaded)
2330 (calc-extensions) 2319 (calc-extensions)
2331 (fboundp (car a)))) 2320 (fboundp (car math-normalize-a))))
2332 (apply (car a) args))))) 2321 (apply (car math-normalize-a) args)))))
2333 (wrong-number-of-arguments 2322 (wrong-number-of-arguments
2334 (calc-record-why "*Wrong number of arguments" 2323 (calc-record-why "*Wrong number of arguments"
2335 (cons (car a) args)) 2324 (cons (car math-normalize-a) args))
2336 nil) 2325 nil)
2337 (wrong-type-argument 2326 (wrong-type-argument
2338 (or calc-next-why (calc-record-why "Wrong type of argument" 2327 (or calc-next-why
2339 (cons (car a) args))) 2328 (calc-record-why "Wrong type of argument"
2329 (cons (car math-normalize-a) args)))
2340 nil) 2330 nil)
2341 (args-out-of-range 2331 (args-out-of-range
2342 (calc-record-why "*Argument out of range" (cons (car a) args)) 2332 (calc-record-why "*Argument out of range"
2333 (cons (car math-normalize-a) args))
2343 nil) 2334 nil)
2344 (inexact-result 2335 (inexact-result
2345 (calc-record-why "No exact representation for result" 2336 (calc-record-why "No exact representation for result"
2346 (cons (car a) args)) 2337 (cons (car math-normalize-a) args))
2347 nil) 2338 nil)
2348 (math-overflow 2339 (math-overflow
2349 (calc-record-why "*Floating-point overflow occurred" 2340 (calc-record-why "*Floating-point overflow occurred"
2350 (cons (car a) args)) 2341 (cons (car math-normalize-a) args))
2351 nil) 2342 nil)
2352 (math-underflow 2343 (math-underflow
2353 (calc-record-why "*Floating-point underflow occurred" 2344 (calc-record-why "*Floating-point underflow occurred"
2354 (cons (car a) args)) 2345 (cons (car math-normalize-a) args))
2355 nil) 2346 nil)
2356 (void-variable 2347 (void-variable
2357 (if (eq (nth 1 err) 'var-EvalRules) 2348 (if (eq (nth 1 err) 'var-EvalRules)
2358 (progn 2349 (progn
2359 (setq var-EvalRules nil) 2350 (setq var-EvalRules nil)
2360 (math-normalize (cons (car a) args))) 2351 (math-normalize (cons (car math-normalize-a) args)))
2361 (calc-record-why "*Variable is void" (nth 1 err))))) 2352 (calc-record-why "*Variable is void" (nth 1 err)))))
2362 (if (consp (car a)) 2353 (if (consp (car math-normalize-a))
2363 (math-dimension-error) 2354 (math-dimension-error)
2364 (cons (car a) args)))))))) 2355 (cons (car math-normalize-a) args))))))))
2365 2356
2366 2357
2367 2358
diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el
index 2a463009e58..ff23c3e5421 100644
--- a/lisp/calc/calcalg2.el
+++ b/lisp/calc/calcalg2.el
@@ -738,8 +738,12 @@
738 (setcar (cdr cur-record) 'cancelled))) 738 (setcar (cdr cur-record) 'cancelled)))
739 (math-replace-integral-parts (car expr))))))) 739 (math-replace-integral-parts (car expr)))))))
740 740
741(defvar math-linear-subst-tried t
742 "Non-nil means that a linear substitution has been tried.")
743
741(defun math-do-integral (expr) 744(defun math-do-integral (expr)
742 (let (t1 t2) 745 (let ((math-linear-subst-tried nil)
746 t1 t2)
743 (or (cond ((not (math-expr-contains expr math-integ-var)) 747 (or (cond ((not (math-expr-contains expr math-integ-var))
744 (math-mul expr math-integ-var)) 748 (math-mul expr math-integ-var))
745 ((equal expr math-integ-var) 749 ((equal expr math-integ-var)
@@ -977,9 +981,8 @@
977 981
978 ;; Integration by substitution, for various likely sub-expressions. 982 ;; Integration by substitution, for various likely sub-expressions.
979 ;; (In first pass, we look only for sub-exprs that are linear in X.) 983 ;; (In first pass, we look only for sub-exprs that are linear in X.)
980 (or (if math-enable-subst 984 (or (math-integ-try-linear-substitutions expr)
981 (math-integ-try-substitutions expr) 985 (math-integ-try-substitutions expr)
982 (math-integ-try-linear-substitutions expr))
983 986
984 ;; If function has sines and cosines, try tan(x/2) substitution. 987 ;; If function has sines and cosines, try tan(x/2) substitution.
985 (and (let ((p (setq rat-in (math-expr-rational-in expr)))) 988 (and (let ((p (setq rat-in (math-expr-rational-in expr))))
@@ -1189,6 +1192,7 @@
1189 1192
1190;;; Look for substitutions of the form u = a x + b. 1193;;; Look for substitutions of the form u = a x + b.
1191(defun math-integ-try-linear-substitutions (sub-expr) 1194(defun math-integ-try-linear-substitutions (sub-expr)
1195 (setq math-linear-subst-tried t)
1192 (and (not (Math-primp sub-expr)) 1196 (and (not (Math-primp sub-expr))
1193 (or (and (not (memq (car sub-expr) '(+ - * / neg))) 1197 (or (and (not (memq (car sub-expr) '(+ - * / neg)))
1194 (not (and (eq (car sub-expr) '^) 1198 (not (and (eq (car sub-expr) '^)
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 945119f06df..679c4b991b6 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -1974,19 +1974,20 @@ message contains an appointment, don't make a diary entry."
1974 (throw 'finished t)))) 1974 (throw 'finished t))))
1975 nil)) 1975 nil))
1976 1976
1977(defun diary-from-outlook () 1977(defun diary-from-outlook (&optional noconfirm)
1978 "Maybe snarf diary entry from current Outlook-generated message. 1978 "Maybe snarf diary entry from current Outlook-generated message.
1979Currently knows about Gnus and Rmail modes." 1979Currently knows about Gnus and Rmail modes. Unless the optional
1980 (interactive) 1980argument NOCONFIRM is non-nil (which is the case when this
1981function is called interactively), then if an entry is found the
1982user is asked to confirm its addition."
1983 (interactive "p")
1981 (let ((func (cond 1984 (let ((func (cond
1982 ((eq major-mode 'rmail-mode) 1985 ((eq major-mode 'rmail-mode)
1983 #'diary-from-outlook-rmail) 1986 #'diary-from-outlook-rmail)
1984 ((memq major-mode '(gnus-summary-mode gnus-article-mode)) 1987 ((memq major-mode '(gnus-summary-mode gnus-article-mode))
1985 #'diary-from-outlook-gnus) 1988 #'diary-from-outlook-gnus)
1986 (t (error "Don't know how to snarf in `%s'" major-mode))))) 1989 (t (error "Don't know how to snarf in `%s'" major-mode)))))
1987 (if (interactive-p) 1990 (funcall func noconfirm)))
1988 (call-interactively func)
1989 (funcall func))))
1990 1991
1991 1992
1992(defvar gnus-article-mime-handles) 1993(defvar gnus-article-mime-handles)
@@ -1996,11 +1997,14 @@ Currently knows about Gnus and Rmail modes."
1996(autoload 'gnus-narrow-to-body "gnus") 1997(autoload 'gnus-narrow-to-body "gnus")
1997(autoload 'mm-get-part "mm-decode") 1998(autoload 'mm-get-part "mm-decode")
1998 1999
1999(defun diary-from-outlook-gnus () 2000(defun diary-from-outlook-gnus (&optional noconfirm)
2000 "Maybe snarf diary entry from Outlook-generated message in Gnus. 2001 "Maybe snarf diary entry from Outlook-generated message in Gnus.
2001Add this to `gnus-article-prepare-hook' to notice appointments 2002Unless the optional argument NOCONFIRM is non-nil (which is the case when
2003this function is called interactively), then if an entry is found the
2004user is asked to confirm its addition.
2005Add this function to `gnus-article-prepare-hook' to notice appointments
2002automatically." 2006automatically."
2003 (interactive) 2007 (interactive "p")
2004 (with-current-buffer gnus-article-buffer 2008 (with-current-buffer gnus-article-buffer
2005 (let ((subject (gnus-fetch-field "subject")) 2009 (let ((subject (gnus-fetch-field "subject"))
2006 (body (if gnus-article-mime-handles 2010 (body (if gnus-article-mime-handles
@@ -2011,8 +2015,7 @@ automatically."
2011 (gnus-narrow-to-body) 2015 (gnus-narrow-to-body)
2012 (buffer-string))))) 2016 (buffer-string)))))
2013 (when (diary-from-outlook-internal t) 2017 (when (diary-from-outlook-internal t)
2014 (when (or (interactive-p) 2018 (when (or noconfirm (y-or-n-p "Snarf diary entry? "))
2015 (y-or-n-p "Snarf diary entry? "))
2016 (diary-from-outlook-internal) 2019 (diary-from-outlook-internal)
2017 (message "Diary entry added")))))) 2020 (message "Diary entry added"))))))
2018 2021
@@ -2021,9 +2024,12 @@ automatically."
2021 2024
2022(defvar rmail-buffer) 2025(defvar rmail-buffer)
2023 2026
2024(defun diary-from-outlook-rmail () 2027(defun diary-from-outlook-rmail (&optional noconfirm)
2025 "Maybe snarf diary entry from Outlook-generated message in Rmail." 2028 "Maybe snarf diary entry from Outlook-generated message in Rmail.
2026 (interactive) 2029Unless the optional argument NOCONFIRM is non-nil (which is the case when
2030this function is called interactively), then if an entry is found the
2031user is asked to confirm its addition."
2032 (interactive "p")
2027 (with-current-buffer rmail-buffer 2033 (with-current-buffer rmail-buffer
2028 (let ((subject (mail-fetch-field "subject")) 2034 (let ((subject (mail-fetch-field "subject"))
2029 (body (buffer-substring (save-excursion 2035 (body (buffer-substring (save-excursion
@@ -2031,8 +2037,7 @@ automatically."
2031 (point)) 2037 (point))
2032 (point-max)))) 2038 (point-max))))
2033 (when (diary-from-outlook-internal t) 2039 (when (diary-from-outlook-internal t)
2034 (when (or (interactive-p) 2040 (when (or noconfirm (y-or-n-p "Snarf diary entry? "))
2035 (y-or-n-p "Snarf diary entry? "))
2036 (diary-from-outlook-internal) 2041 (diary-from-outlook-internal)
2037 (message "Diary entry added")))))) 2042 (message "Diary entry added"))))))
2038 2043
diff --git a/lisp/cvs-status.el b/lisp/cvs-status.el
index 419f8567a90..324da8d3ce1 100644
--- a/lisp/cvs-status.el
+++ b/lisp/cvs-status.el
@@ -1,6 +1,6 @@
1;;; cvs-status.el --- major mode for browsing `cvs status' output -*- coding: utf-8 -*- 1;;; cvs-status.el --- major mode for browsing `cvs status' output -*- coding: utf-8 -*-
2 2
3;; Copyright (C) 1999, 2000, 03, 2004 Free Software Foundation, Inc. 3;; Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
4 4
5;; Author: Stefan Monnier <monnier@cs.yale.edu> 5;; Author: Stefan Monnier <monnier@cs.yale.edu>
6;; Keywords: pcl-cvs cvs status tree tools 6;; Keywords: pcl-cvs cvs status tree tools
@@ -31,8 +31,8 @@
31;;; Code: 31;;; Code:
32 32
33(eval-when-compile (require 'cl)) 33(eval-when-compile (require 'cl))
34(eval-when-compile (require 'pcvs))
35(require 'pcvs-util) 34(require 'pcvs-util)
35(eval-when-compile (require 'pcvs))
36 36
37;;; 37;;;
38 38
@@ -50,7 +50,7 @@
50 ("\M-p" . cvs-status-prev) 50 ("\M-p" . cvs-status-prev)
51 ("t" . cvs-status-cvstrees) 51 ("t" . cvs-status-cvstrees)
52 ("T" . cvs-status-trees) 52 ("T" . cvs-status-trees)
53 (">" . cvs-status-checkout)) 53 (">" . cvs-mode-checkout))
54 "CVS-Status' keymap." 54 "CVS-Status' keymap."
55 :group 'cvs-status 55 :group 'cvs-status
56 :inherit 'cvs-mode-map) 56 :inherit 'cvs-mode-map)
@@ -89,7 +89,7 @@
89(defconst cvs-status-font-lock-defaults 89(defconst cvs-status-font-lock-defaults
90 '(cvs-status-font-lock-keywords t nil nil nil (font-lock-multiline . t))) 90 '(cvs-status-font-lock-keywords t nil nil nil (font-lock-multiline . t)))
91 91
92 92(defvar cvs-minor-wrap-function)
93(put 'cvs-status-mode 'mode-class 'special) 93(put 'cvs-status-mode 'mode-class 'special)
94;;;###autoload 94;;;###autoload
95(define-derived-mode cvs-status-mode fundamental-mode "CVS-Status" 95(define-derived-mode cvs-status-mode fundamental-mode "CVS-Status"
@@ -108,7 +108,8 @@
108 (let* ((file (match-string 1)) 108 (let* ((file (match-string 1))
109 (cvsdir (and (re-search-backward cvs-status-dir-re nil t) 109 (cvsdir (and (re-search-backward cvs-status-dir-re nil t)
110 (match-string 1))) 110 (match-string 1)))
111 (pcldir (and (re-search-backward cvs-pcl-cvs-dirchange-re nil t) 111 (pcldir (and (if (boundp 'cvs-pcl-cvs-dirchange-re)
112 (re-search-backward cvs-pcl-cvs-dirchange-re nil t))
112 (match-string 1))) 113 (match-string 1)))
113 (dir "")) 114 (dir ""))
114 (let ((default-directory "")) 115 (let ((default-directory ""))
@@ -466,25 +467,6 @@ Optional prefix ARG chooses between two representations."
466 ;;(sit-for 0) 467 ;;(sit-for 0)
467 )))))) 468 ))))))
468 469
469(defun-cvs-mode (cvs-status-checkout . NOARGS) (dir)
470 "Run cvs-checkout against the tag under the point.
471The files are stored to DIR."
472 (interactive
473 (let* ((module (cvs-get-module))
474 (branch (cvs-prefix-get 'cvs-branch-prefix))
475 (prompt (format "CVS Checkout Directory for `%s%s': "
476 module
477 (if branch (format "(branch: %s)" branch)
478 ""))))
479 (list
480 (read-directory-name prompt
481 nil default-directory nil))))
482 (let ((modules (cvs-string->strings (cvs-get-module)))
483 (flags (cvs-add-branch-prefix
484 (cvs-flags-query 'cvs-checkout-flags "cvs checkout flags")))
485 (cvs-cvsroot (cvs-get-cvsroot)))
486 (cvs-checkout modules dir flags)))
487
488(defun cvs-tree-tags-insert (tags prev) 470(defun cvs-tree-tags-insert (tags prev)
489 (when tags 471 (when tags
490 (let* ((tag (car tags)) 472 (let* ((tag (car tags))
@@ -556,5 +538,5 @@ The files are stored to DIR."
556 538
557(provide 'cvs-status) 539(provide 'cvs-status)
558 540
559;;; arch-tag: db8b5094-d02a-473e-a476-544e89ff5ad0 541;; arch-tag: db8b5094-d02a-473e-a476-544e89ff5ad0
560;;; cvs-status.el ends here 542;;; cvs-status.el ends here
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 72ddde7c8cb..7dd6966a486 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -507,7 +507,10 @@ as well as widgets, buttons, overlays, and text properties."
507 (format "%d" (nth 1 split)) 507 (format "%d" (nth 1 split))
508 (format "%d %d" (nth 1 split) (nth 2 split))))) 508 (format "%d %d" (nth 1 split) (nth 2 split)))))
509 ("syntax" 509 ("syntax"
510 ,(let ((syntax (syntax-after pos))) 510 ,(let* ((st (if parse-sexp-lookup-properties
511 (get-char-property pos 'syntax-table)))
512 (syntax (if (consp st) st
513 (aref (or st (syntax-table)) (char-after pos)))))
511 (with-temp-buffer 514 (with-temp-buffer
512 (internal-describe-syntax-value syntax) 515 (internal-describe-syntax-value syntax)
513 (buffer-string)))) 516 (buffer-string))))
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 64e8770ffd0..55ebd662df6 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -129,7 +129,8 @@ determine where the desktop is saved."
129 (const :tag "Ask if desktop file exists, else don't save" ask-if-exists) 129 (const :tag "Ask if desktop file exists, else don't save" ask-if-exists)
130 (const :tag "Save if desktop file exists, else don't" if-exists) 130 (const :tag "Save if desktop file exists, else don't" if-exists)
131 (const :tag "Never save" nil)) 131 (const :tag "Never save" nil))
132 :group 'desktop) 132 :group 'desktop
133 :version "21.4")
133 134
134(defcustom desktop-base-file-name 135(defcustom desktop-base-file-name
135 (convert-standard-filename ".emacs.desktop") 136 (convert-standard-filename ".emacs.desktop")
@@ -142,7 +143,8 @@ determine where the desktop is saved."
142 "List of directories to search for the desktop file. 143 "List of directories to search for the desktop file.
143The base name of the file is specified in `desktop-base-file-name'." 144The base name of the file is specified in `desktop-base-file-name'."
144 :type '(repeat directory) 145 :type '(repeat directory)
145 :group 'desktop) 146 :group 'desktop
147 :version "21.4")
146 148
147(defcustom desktop-missing-file-warning nil 149(defcustom desktop-missing-file-warning nil
148 "*If non-nil then `desktop-read' asks if a non-existent file should be recreated. 150 "*If non-nil then `desktop-read' asks if a non-existent file should be recreated.
@@ -151,19 +153,22 @@ Also pause for a moment to display message about errors signaled in
151 153
152If nil, just print error messages in the message buffer." 154If nil, just print error messages in the message buffer."
153 :type 'boolean 155 :type 'boolean
154 :group 'desktop) 156 :group 'desktop
157 :version "21.4")
155 158
156(defcustom desktop-no-desktop-file-hook nil 159(defcustom desktop-no-desktop-file-hook nil
157 "Normal hook run when `desktop-read' can't find a desktop file. 160 "Normal hook run when `desktop-read' can't find a desktop file.
158May e.g. be used to show a dired buffer." 161May e.g. be used to show a dired buffer."
159 :type 'hook 162 :type 'hook
160 :group 'desktop) 163 :group 'desktop
164 :version "21.4")
161 165
162(defcustom desktop-after-read-hook nil 166(defcustom desktop-after-read-hook nil
163 "Normal hook run after a successful `desktop-read'. 167 "Normal hook run after a successful `desktop-read'.
164May e.g. be used to show a buffer list." 168May e.g. be used to show a buffer list."
165 :type 'hook 169 :type 'hook
166 :group 'desktop) 170 :group 'desktop
171 :version "21.4")
167 172
168(defcustom desktop-save-hook nil 173(defcustom desktop-save-hook nil
169 "Normal hook run before the desktop is saved in a desktop file. 174 "Normal hook run before the desktop is saved in a desktop file.
@@ -198,14 +203,16 @@ An element may be variable name (a symbol) or a cons cell of the form
198\(VAR . FORM). Symbols are set to nil and for cons cells VAR is set 203\(VAR . FORM). Symbols are set to nil and for cons cells VAR is set
199to the value obtained by evaluateing FORM." 204to the value obtained by evaluateing FORM."
200 :type '(repeat (restricted-sexp :match-alternatives (symbolp consp))) 205 :type '(repeat (restricted-sexp :match-alternatives (symbolp consp)))
201 :group 'desktop) 206 :group 'desktop
207 :version "21.4")
202 208
203(defcustom desktop-clear-preserve-buffers-regexp 209(defcustom desktop-clear-preserve-buffers-regexp
204 "^\\(\\*scratch\\*\\|\\*Messages\\*\\|\\*tramp/.+\\*\\)$" 210 "^\\(\\*scratch\\*\\|\\*Messages\\*\\|\\*tramp/.+\\*\\)$"
205 "Regexp identifying buffers that `desktop-clear' should not delete. 211 "Regexp identifying buffers that `desktop-clear' should not delete.
206See also `desktop-clear-preserve-buffers'." 212See also `desktop-clear-preserve-buffers'."
207 :type 'regexp 213 :type 'regexp
208 :group 'desktop) 214 :group 'desktop
215 :version "21.4")
209 216
210(defcustom desktop-clear-preserve-buffers nil 217(defcustom desktop-clear-preserve-buffers nil
211 "*List of buffer names that `desktop-clear' should not delete. 218 "*List of buffer names that `desktop-clear' should not delete.
@@ -257,7 +264,8 @@ Possible values are:
257 tilde -- Relative to ~. 264 tilde -- Relative to ~.
258 local -- Relative to directory of desktop file." 265 local -- Relative to directory of desktop file."
259 :type '(choice (const absolute) (const tilde) (const local)) 266 :type '(choice (const absolute) (const tilde) (const local))
260 :group 'desktop) 267 :group 'desktop
268 :version "21.4")
261 269
262;;;###autoload 270;;;###autoload
263(defvar desktop-save-buffer nil 271(defvar desktop-save-buffer nil
@@ -628,7 +636,7 @@ See also `desktop-base-file-name'."
628 ";; Desktop file format version " desktop-file-version "\n" 636 ";; Desktop file format version " desktop-file-version "\n"
629 ";; Emacs version " emacs-version "\n\n" 637 ";; Emacs version " emacs-version "\n\n"
630 ";; Global section:\n") 638 ";; Global section:\n")
631 (mapcar (function desktop-outvar) desktop-globals-to-save) 639 (mapc (function desktop-outvar) desktop-globals-to-save)
632 (if (memq 'kill-ring desktop-globals-to-save) 640 (if (memq 'kill-ring desktop-globals-to-save)
633 (insert 641 (insert
634 "(setq kill-ring-yank-pointer (nthcdr " 642 "(setq kill-ring-yank-pointer (nthcdr "
@@ -636,15 +644,15 @@ See also `desktop-base-file-name'."
636 " kill-ring))\n")) 644 " kill-ring))\n"))
637 645
638 (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n") 646 (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n")
639 (mapcar #'(lambda (l) 647 (mapc #'(lambda (l)
640 (if (apply 'desktop-save-buffer-p l) 648 (if (apply 'desktop-save-buffer-p l)
641 (progn 649 (progn
642 (insert "(desktop-create-buffer " desktop-file-version) 650 (insert "(desktop-create-buffer " desktop-file-version)
643 (mapcar #'(lambda (e) 651 (mapc #'(lambda (e)
644 (insert "\n " (desktop-value-to-string e))) 652 (insert "\n " (desktop-value-to-string e)))
645 l) 653 l)
646 (insert ")\n\n")))) 654 (insert ")\n\n"))))
647 info) 655 info)
648 (setq default-directory dirname) 656 (setq default-directory dirname)
649 (when (file-exists-p filename) (delete-file filename)) 657 (when (file-exists-p filename) (delete-file filename))
650 (let ((coding-system-for-write 'emacs-mule)) 658 (let ((coding-system-for-write 'emacs-mule))
@@ -865,9 +873,9 @@ directory DIRNAME."
865 ((equal '(nil) desktop-buffer-minor-modes) ; backwards compatible 873 ((equal '(nil) desktop-buffer-minor-modes) ; backwards compatible
866 (auto-fill-mode 0)) 874 (auto-fill-mode 0))
867 (t 875 (t
868 (mapcar #'(lambda (minor-mode) 876 (mapc #'(lambda (minor-mode)
869 (when (functionp minor-mode) (funcall minor-mode 1))) 877 (when (functionp minor-mode) (funcall minor-mode 1)))
870 desktop-buffer-minor-modes))) 878 desktop-buffer-minor-modes)))
871 ;; Even though point and mark are non-nil when written by `desktop-save' 879 ;; Even though point and mark are non-nil when written by `desktop-save'
872 ;; they may be modified by handlers wanting to set point or mark themselves. 880 ;; they may be modified by handlers wanting to set point or mark themselves.
873 (when desktop-buffer-point 881 (when desktop-buffer-point
diff --git a/lisp/ebuff-menu.el b/lisp/ebuff-menu.el
index bed46c71618..2bfbace4c4b 100644
--- a/lisp/ebuff-menu.el
+++ b/lisp/ebuff-menu.el
@@ -38,9 +38,12 @@
38 38
39(defvar electric-buffer-menu-mode-map nil) 39(defvar electric-buffer-menu-mode-map nil)
40 40
41(defvar electric-buffer-menu-mode-hook nil
42 "Normal hook run by `electric-buffer-list'.")
43
41;;;###autoload 44;;;###autoload
42(defun electric-buffer-list (arg) 45(defun electric-buffer-list (arg)
43 "Pops up a buffer describing the set of Emacs buffers. 46 "Pop up a buffer describing the set of Emacs buffers.
44Vaguely like ITS lunar select buffer; combining typeoutoid buffer 47Vaguely like ITS lunar select buffer; combining typeoutoid buffer
45listing with menuoid buffer selection. 48listing with menuoid buffer selection.
46 49
@@ -50,9 +53,9 @@ window, marking buffers to be selected, saved or deleted.
50 53
51To exit and select a new buffer, type a space when the cursor is on 54To exit and select a new buffer, type a space when the cursor is on
52the appropriate line of the buffer-list window. Other commands are 55the appropriate line of the buffer-list window. Other commands are
53much like those of buffer-menu-mode. 56much like those of `Buffer-menu-mode'.
54 57
55Calls value of `electric-buffer-menu-mode-hook' on entry if non-nil. 58Run hooks in `electric-buffer-menu-mode-hook' on entry.
56 59
57\\{electric-buffer-menu-mode-map}" 60\\{electric-buffer-menu-mode-map}"
58 (interactive "P") 61 (interactive "P")
@@ -144,8 +147,8 @@ Letters do not insert themselves; instead, they are commands.
144 147
145\\{electric-buffer-menu-mode-map} 148\\{electric-buffer-menu-mode-map}
146 149
147Entry to this mode via command electric-buffer-list calls the value of 150Entry to this mode via command `electric-buffer-list' calls the value of
148electric-buffer-menu-mode-hook if it is non-nil." 151`electric-buffer-menu-mode-hook'."
149 (kill-all-local-variables) 152 (kill-all-local-variables)
150 (use-local-map electric-buffer-menu-mode-map) 153 (use-local-map electric-buffer-menu-mode-map)
151 (setq mode-name "Electric Buffer Menu") 154 (setq mode-name "Electric Buffer Menu")
@@ -223,8 +226,8 @@ electric-buffer-menu-mode-hook if it is non-nil."
223 226
224(defun Electric-buffer-menu-select () 227(defun Electric-buffer-menu-select ()
225 "Leave Electric Buffer Menu, selecting buffers and executing changes. 228 "Leave Electric Buffer Menu, selecting buffers and executing changes.
226Saves buffers marked \"S\". Deletes buffers marked \"K\". 229Save buffers marked \"S\". Delete buffers marked \"K\".
227Selects buffer at point and displays buffers marked \">\" in other windows." 230Select buffer at point and display buffers marked \">\" in other windows."
228 (interactive) 231 (interactive)
229 (throw 'electric-buffer-menu-select (point))) 232 (throw 'electric-buffer-menu-select (point)))
230 233
@@ -237,7 +240,7 @@ Selects buffer at point and displays buffers marked \">\" in other windows."
237 240
238(defun Electric-buffer-menu-quit () 241(defun Electric-buffer-menu-quit ()
239 "Leave Electric Buffer Menu, restoring previous window configuration. 242 "Leave Electric Buffer Menu, restoring previous window configuration.
240Does not execute select, save, or delete commands." 243Skip execution of select, save, and delete commands."
241 (interactive) 244 (interactive)
242 (throw 'electric-buffer-menu-select nil)) 245 (throw 'electric-buffer-menu-select nil))
243 246
@@ -258,7 +261,7 @@ Type \\[Electric-buffer-menu-quit] to exit, \
258 261
259(defun Electric-buffer-menu-mode-view-buffer () 262(defun Electric-buffer-menu-mode-view-buffer ()
260 "View buffer on current line in Electric Buffer Menu. 263 "View buffer on current line in Electric Buffer Menu.
261Returns to Electric Buffer Menu when done." 264Return to Electric Buffer Menu when done."
262 (interactive) 265 (interactive)
263 (let ((bufnam (Buffer-menu-buffer nil))) 266 (let ((bufnam (Buffer-menu-buffer nil)))
264 (if bufnam 267 (if bufnam
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index e00bebc91d5..856a31551df 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1,6 +1,7 @@
1;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler 1;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler
2 2
3;; Copyright (c) 1991,1994,2000,01,02,2004 Free Software Foundation, Inc. 3;; Copyright (c) 1991, 1994, 2000, 2001, 2002, 2004
4;; Free Software Foundation, Inc.
4 5
5;; Author: Jamie Zawinski <jwz@lucid.com> 6;; Author: Jamie Zawinski <jwz@lucid.com>
6;; Hallvard Furuseth <hbf@ulrik.uio.no> 7;; Hallvard Furuseth <hbf@ulrik.uio.no>
@@ -266,7 +267,7 @@
266 (cdr (assq name byte-compile-function-environment))))) 267 (cdr (assq name byte-compile-function-environment)))))
267 (if (and (consp fn) (eq (car fn) 'autoload)) 268 (if (and (consp fn) (eq (car fn) 'autoload))
268 (error "File `%s' didn't define `%s'" (nth 1 fn) name)) 269 (error "File `%s' didn't define `%s'" (nth 1 fn) name))
269 (if (symbolp fn) 270 (if (and (symbolp fn) (not (eq fn t)))
270 (byte-compile-inline-expand (cons fn (cdr form))) 271 (byte-compile-inline-expand (cons fn (cdr form)))
271 (if (byte-code-function-p fn) 272 (if (byte-code-function-p fn)
272 (let (string) 273 (let (string)
@@ -2032,5 +2033,5 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
2032 byte-optimize-lapcode)))) 2033 byte-optimize-lapcode))))
2033 nil) 2034 nil)
2034 2035
2035;;; arch-tag: 0f14076b-737e-4bef-aae6-908826ec1ff1 2036;; arch-tag: 0f14076b-737e-4bef-aae6-908826ec1ff1
2036;;; byte-opt.el ends here 2037;;; byte-opt.el ends here
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2116cc33b34..ee29039e05e 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1,7 +1,7 @@
1;;; bytecomp.el --- compilation of Lisp code into byte code 1;;; bytecomp.el --- compilation of Lisp code into byte code
2 2
3;; Copyright (C) 1985,86,87,92,94,1998,2000,01,02,03,2004 3;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1998, 2000, 2001, 2002,
4;; Free Software Foundation, Inc. 4;; 2003, 2004 Free Software Foundation, Inc.
5 5
6;; Author: Jamie Zawinski <jwz@lucid.com> 6;; Author: Jamie Zawinski <jwz@lucid.com>
7;; Hallvard Furuseth <hbf@ulrik.uio.no> 7;; Hallvard Furuseth <hbf@ulrik.uio.no>
@@ -447,7 +447,9 @@ Each element looks like (MACRONAME . DEFINITION). It is
447 "Alist of functions defined in the file being compiled. 447 "Alist of functions defined in the file being compiled.
448This is so we can inline them when necessary. 448This is so we can inline them when necessary.
449Each element looks like (FUNCTIONNAME . DEFINITION). It is 449Each element looks like (FUNCTIONNAME . DEFINITION). It is
450\(FUNCTIONNAME . nil) when a function is redefined as a macro.") 450\(FUNCTIONNAME . nil) when a function is redefined as a macro.
451It is \(FUNCTIONNAME . t) when all we know is that it was defined,
452and we don't know the definition.")
451 453
452(defvar byte-compile-unresolved-functions nil 454(defvar byte-compile-unresolved-functions nil
453 "Alist of undefined functions to which calls have been compiled. 455 "Alist of undefined functions to which calls have been compiled.
@@ -1103,6 +1105,10 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1103 1105
1104;;; sanity-checking arglists 1106;;; sanity-checking arglists
1105 1107
1108;; If a function has an entry saying (FUNCTION . t).
1109;; that means we know it is defined but we don't know how.
1110;; If a function has an entry saying (FUNCTION . nil),
1111;; that means treat it as not defined.
1106(defun byte-compile-fdefinition (name macro-p) 1112(defun byte-compile-fdefinition (name macro-p)
1107 (let* ((list (if macro-p 1113 (let* ((list (if macro-p
1108 byte-compile-macro-environment 1114 byte-compile-macro-environment
@@ -1168,7 +1174,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1168(defun byte-compile-callargs-warn (form) 1174(defun byte-compile-callargs-warn (form)
1169 (let* ((def (or (byte-compile-fdefinition (car form) nil) 1175 (let* ((def (or (byte-compile-fdefinition (car form) nil)
1170 (byte-compile-fdefinition (car form) t))) 1176 (byte-compile-fdefinition (car form) t)))
1171 (sig (if def 1177 (sig (if (and def (not (eq def t)))
1172 (byte-compile-arglist-signature 1178 (byte-compile-arglist-signature
1173 (if (eq 'lambda (car-safe def)) 1179 (if (eq 'lambda (car-safe def))
1174 (nth 1 def) 1180 (nth 1 def)
@@ -1198,7 +1204,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1198 (byte-compile-format-warn form) 1204 (byte-compile-format-warn form)
1199 ;; Check to see if the function will be available at runtime 1205 ;; Check to see if the function will be available at runtime
1200 ;; and/or remember its arity if it's unknown. 1206 ;; and/or remember its arity if it's unknown.
1201 (or (and (or sig (fboundp (car form))) ; might be a subr or autoload. 1207 (or (and (or def (fboundp (car form))) ; might be a subr or autoload.
1202 (not (memq (car form) byte-compile-noruntime-functions))) 1208 (not (memq (car form) byte-compile-noruntime-functions)))
1203 (eq (car form) byte-compile-current-form) ; ## this doesn't work 1209 (eq (car form) byte-compile-current-form) ; ## this doesn't work
1204 ; with recursion. 1210 ; with recursion.
@@ -1209,9 +1215,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1209 (if cons 1215 (if cons
1210 (or (memq n (cdr cons)) 1216 (or (memq n (cdr cons))
1211 (setcdr cons (cons n (cdr cons)))) 1217 (setcdr cons (cons n (cdr cons))))
1212 (setq byte-compile-unresolved-functions 1218 (push (list (car form) n)
1213 (cons (list (car form) n) 1219 byte-compile-unresolved-functions))))))
1214 byte-compile-unresolved-functions)))))))
1215 1220
1216(defun byte-compile-format-warn (form) 1221(defun byte-compile-format-warn (form)
1217 "Warn if FORM is `format'-like with inconsistent args. 1222 "Warn if FORM is `format'-like with inconsistent args.
@@ -1243,7 +1248,7 @@ extra args."
1243;; number of arguments. 1248;; number of arguments.
1244(defun byte-compile-arglist-warn (form macrop) 1249(defun byte-compile-arglist-warn (form macrop)
1245 (let ((old (byte-compile-fdefinition (nth 1 form) macrop))) 1250 (let ((old (byte-compile-fdefinition (nth 1 form) macrop)))
1246 (if old 1251 (if (and old (not (eq old t)))
1247 (let ((sig1 (byte-compile-arglist-signature 1252 (let ((sig1 (byte-compile-arglist-signature
1248 (if (eq 'lambda (car-safe old)) 1253 (if (eq 'lambda (car-safe old))
1249 (nth 1 old) 1254 (nth 1 old)
@@ -2123,9 +2128,9 @@ list that represents a doc string reference.
2123 (eq (car (nth 1 form)) 'quote) 2128 (eq (car (nth 1 form)) 'quote)
2124 (consp (cdr (nth 1 form))) 2129 (consp (cdr (nth 1 form)))
2125 (symbolp (nth 1 (nth 1 form)))) 2130 (symbolp (nth 1 (nth 1 form))))
2126 (add-to-list 'byte-compile-function-environment 2131 (push (cons (nth 1 (nth 1 form))
2127 (cons (nth 1 (nth 1 form)) 2132 (cons 'autoload (cdr (cdr form))))
2128 (cons 'autoload (cdr (cdr form)))))) 2133 byte-compile-function-environment))
2129 (if (stringp (nth 3 form)) 2134 (if (stringp (nth 3 form))
2130 form 2135 form
2131 ;; No doc string, so we can compile this as a normal form. 2136 ;; No doc string, so we can compile this as a normal form.
@@ -3608,7 +3613,6 @@ being undefined will be suppressed."
3608(byte-defop-compiler-1 defconst byte-compile-defvar) 3613(byte-defop-compiler-1 defconst byte-compile-defvar)
3609(byte-defop-compiler-1 autoload) 3614(byte-defop-compiler-1 autoload)
3610(byte-defop-compiler-1 lambda byte-compile-lambda-form) 3615(byte-defop-compiler-1 lambda byte-compile-lambda-form)
3611(byte-defop-compiler-1 defalias)
3612 3616
3613(defun byte-compile-defun (form) 3617(defun byte-compile-defun (form)
3614 ;; This is not used for file-level defuns with doc strings. 3618 ;; This is not used for file-level defuns with doc strings.
@@ -3710,22 +3714,22 @@ being undefined will be suppressed."
3710 (error "`lambda' used as function name is invalid")) 3714 (error "`lambda' used as function name is invalid"))
3711 3715
3712;; Compile normally, but deal with warnings for the function being defined. 3716;; Compile normally, but deal with warnings for the function being defined.
3713(defun byte-compile-defalias (form) 3717(put 'defalias 'byte-hunk-handler 'byte-compile-file-form-defalias)
3718(defun byte-compile-file-form-defalias (form)
3714 (if (and (consp (cdr form)) (consp (nth 1 form)) 3719 (if (and (consp (cdr form)) (consp (nth 1 form))
3715 (eq (car (nth 1 form)) 'quote) 3720 (eq (car (nth 1 form)) 'quote)
3716 (consp (cdr (nth 1 form))) 3721 (consp (cdr (nth 1 form)))
3717 (symbolp (nth 1 (nth 1 form))) 3722 (symbolp (nth 1 (nth 1 form))))
3718 (consp (nthcdr 2 form)) 3723 (let ((constant
3719 (consp (nth 2 form)) 3724 (and (consp (nthcdr 2 form))
3720 (eq (car (nth 2 form)) 'quote) 3725 (consp (nth 2 form))
3721 (consp (cdr (nth 2 form))) 3726 (eq (car (nth 2 form)) 'quote)
3722 (symbolp (nth 1 (nth 2 form)))) 3727 (consp (cdr (nth 2 form)))
3723 (progn 3728 (symbolp (nth 1 (nth 2 form))))))
3724 (byte-compile-defalias-warn (nth 1 (nth 1 form))) 3729 (byte-compile-defalias-warn (nth 1 (nth 1 form)))
3725 (setq byte-compile-function-environment 3730 (push (cons (nth 1 (nth 1 form))
3726 (cons (cons (nth 1 (nth 1 form)) 3731 (if constant (nth 1 (nth 2 form)) t))
3727 (nth 1 (nth 2 form))) 3732 byte-compile-function-environment)))
3728 byte-compile-function-environment))))
3729 (byte-compile-normal-call form)) 3733 (byte-compile-normal-call form))
3730 3734
3731;; Turn off warnings about prior calls to the function being defalias'd. 3735;; Turn off warnings about prior calls to the function being defalias'd.
@@ -3928,7 +3932,7 @@ invoked interactively."
3928 (while rest 3932 (while rest
3929 (or (nth 1 (car rest)) 3933 (or (nth 1 (car rest))
3930 (null (setq f (car (car rest)))) 3934 (null (setq f (car (car rest))))
3931 (byte-compile-fdefinition f t) 3935 (functionp (byte-compile-fdefinition f t))
3932 (commandp (byte-compile-fdefinition f nil)) 3936 (commandp (byte-compile-fdefinition f nil))
3933 (setq uncalled (cons f uncalled))) 3937 (setq uncalled (cons f uncalled)))
3934 (setq rest (cdr rest))) 3938 (setq rest (cdr rest)))
@@ -4110,5 +4114,5 @@ For example, invoke `emacs -batch -f batch-byte-recompile-directory .'."
4110 4114
4111(run-hooks 'bytecomp-load-hook) 4115(run-hooks 'bytecomp-load-hook)
4112 4116
4113;;; arch-tag: 9c97b0f0-8745-4571-bfc3-8dceb677292a 4117;; arch-tag: 9c97b0f0-8745-4571-bfc3-8dceb677292a
4114;;; bytecomp.el ends here 4118;;; bytecomp.el ends here
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 7b18756fd7e..b0f3b9b9d3e 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -42,25 +42,7 @@ menus, turn this variable off, otherwise it is probably better to keep it on."
42 :version "20.3") 42 :version "20.3")
43 43
44(defsubst easy-menu-intern (s) 44(defsubst easy-menu-intern (s)
45 (if (stringp s) 45 (if (stringp s) (intern s) s))
46 (let ((copy (copy-sequence s))
47 (pos 0)
48 found)
49 ;; For each letter that starts a word, flip its case.
50 ;; This way, the usual convention for menu strings (capitalized)
51 ;; corresponds to the usual convention for menu item event types
52 ;; (all lower case). It's a 1-1 mapping so causes no conflicts.
53 (while (setq found (string-match "\\<\\sw" copy pos))
54 (setq pos (match-end 0))
55 (unless (= (upcase (aref copy found))
56 (downcase (aref copy found)))
57 (aset copy found
58 (if (= (upcase (aref copy found))
59 (aref copy found))
60 (downcase (aref copy found))
61 (upcase (aref copy found))))))
62 (intern copy))
63 s))
64 46
65;;;###autoload 47;;;###autoload
66(put 'easy-menu-define 'lisp-indent-function 'defun) 48(put 'easy-menu-define 'lisp-indent-function 'defun)
@@ -396,6 +378,7 @@ otherwise put the new binding last in MENU.
396BEFORE can be either a string (menu item name) or a symbol 378BEFORE can be either a string (menu item name) or a symbol
397\(the fake function key for the menu item). 379\(the fake function key for the menu item).
398KEY does not have to be a symbol, and comparison is done with equal." 380KEY does not have to be a symbol, and comparison is done with equal."
381 (if (symbolp menu) (setq menu (indirect-function menu)))
399 (let ((inserted (null item)) ; Fake already inserted. 382 (let ((inserted (null item)) ; Fake already inserted.
400 tail done) 383 tail done)
401 (while (not done) 384 (while (not done)
@@ -437,8 +420,7 @@ ITEM should be a keymap binding of the form (KEY . MENU-ITEM)."
437 (error nil)) ;`item' might not be a proper list. 420 (error nil)) ;`item' might not be a proper list.
438 ;; Also check the string version of the symbol name, 421 ;; Also check the string version of the symbol name,
439 ;; for backwards compatibility. 422 ;; for backwards compatibility.
440 (eq (car-safe item) (intern name)) 423 (eq (car-safe item) (intern name)))))))
441 (eq (car-safe item) (easy-menu-intern name)))))))
442 424
443(defun easy-menu-always-true-p (x) 425(defun easy-menu-always-true-p (x)
444 "Return true if form X never evaluates to nil." 426 "Return true if form X never evaluates to nil."
@@ -541,15 +523,10 @@ earlier by `easy-menu-define' or `easy-menu-create-menu'."
541 (easy-menu-define-key map (easy-menu-intern (car item)) 523 (easy-menu-define-key map (easy-menu-intern (car item))
542 (cdr item) before) 524 (cdr item) before)
543 (if (or (keymapp item) 525 (if (or (keymapp item)
544 (and (symbolp item) (keymapp (symbol-value item)))) 526 (and (symbolp item) (keymapp (symbol-value item))
527 (setq item (symbol-value item))))
545 ;; Item is a keymap, find the prompt string and use as item name. 528 ;; Item is a keymap, find the prompt string and use as item name.
546 (let ((tail (easy-menu-get-map item nil)) name) 529 (setq item (cons (keymap-prompt item) item)))
547 (if (not (keymapp item)) (setq item tail))
548 (while (and (null name) (consp (setq tail (cdr tail)))
549 (not (keymapp tail)))
550 (if (stringp (car tail)) (setq name (car tail)) ; Got a name.
551 (setq tail (cdr tail))))
552 (setq item (cons name item))))
553 (easy-menu-do-add-item map item before))) 530 (easy-menu-do-add-item map item before)))
554 531
555(defun easy-menu-item-present-p (map path name) 532(defun easy-menu-item-present-p (map path name)
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index d701db9e9b6..82ce6f404f7 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -564,7 +564,6 @@ displayed."
564 (generate-new-buffer elp-results-buffer)))) 564 (generate-new-buffer elp-results-buffer))))
565 (set-buffer resultsbuf) 565 (set-buffer resultsbuf)
566 (erase-buffer) 566 (erase-buffer)
567 (beginning-of-buffer)
568 ;; get the length of the longest function name being profiled 567 ;; get the length of the longest function name being profiled
569 (let* ((longest 0) 568 (let* ((longest 0)
570 (title "Function Name") 569 (title "Function Name")
diff --git a/lisp/files.el b/lisp/files.el
index 75d9965133c..d0f3b47f2b5 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1751,6 +1751,30 @@ in that case, this function acts as if `enable-local-variables' were t."
1751 ("BROWSE\\'" . ebrowse-tree-mode) 1751 ("BROWSE\\'" . ebrowse-tree-mode)
1752 ("\\.ebrowse\\'" . ebrowse-tree-mode) 1752 ("\\.ebrowse\\'" . ebrowse-tree-mode)
1753 ("#\\*mail\\*" . mail-mode) 1753 ("#\\*mail\\*" . mail-mode)
1754 ("\\.g\\'" . antlr-mode)
1755 ("\\.ses\\'" . ses-mode)
1756 ("\\.\\(soa\\|zone\\)\\'" . dns-mode)
1757 ("\\.docbook\\'" . sgml-mode)
1758 ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode)
1759 ;; Windows candidates may be opened case sensitively on Unix
1760 ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . conf-mode)
1761 ("\\.\\(?:desktop\\|la\\)\\'" . conf-unix-mode)
1762 ("java.+\\.conf\\'" . conf-javaprop-mode)
1763 ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode)
1764 ;; *.cf, *.cfg, *.conf, *.config[.local|.de_DE.UTF8|...], */config
1765 ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-mode)
1766 ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|permissions\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
1767 ("\\`/etc/\\(?:aliases\\|hosts\\..+\\|ksysguarddrc\\|opera6rc\\)\\'" . conf-mode)
1768 ;; either user's dot-files or under /etc or some such
1769 ("/\\.?\\(?:gnokiirc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-mode)
1770 ;; alas not all ~/.*rc files are like this
1771 ("/\\.\\(?:enigma\\|gltron\\|hxplayer\\|net\\|neverball\\|qt/.+\\|realplayer\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-mode)
1772 ("/\\.\\(?:gdbtkinit\\|grip\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-mode)
1773 ("/\\.?X\\(?:default\\|resource\\|re\\)s\\>" . conf-xdefaults-mode)
1774 ("/X11.+app-defaults/" . conf-xdefaults-mode)
1775 ("/X11.+locale/.+/Compose\\'" . conf-colon-mode)
1776 ;; this contains everything twice, with space and with colon :-(
1777 ("/X11.+locale/compose\\.dir\\'" . conf-javaprop-mode)
1754 ;; Get rid of any trailing .n.m and try again. 1778 ;; Get rid of any trailing .n.m and try again.
1755 ;; This is for files saved by cvs-merge that look like .#<file>.<rev> 1779 ;; This is for files saved by cvs-merge that look like .#<file>.<rev>
1756 ;; or .#<file>.<rev>-<rev> or VC's <file>.~<rev>~. 1780 ;; or .#<file>.<rev>-<rev> or VC's <file>.~<rev>~.
@@ -1761,11 +1785,7 @@ in that case, this function acts as if `enable-local-variables' were t."
1761 ;; for the sake of ChangeLog.1, etc. 1785 ;; for the sake of ChangeLog.1, etc.
1762 ;; and after the .scm.[0-9] and CVS' <file>.<rev> patterns too. 1786 ;; and after the .scm.[0-9] and CVS' <file>.<rev> patterns too.
1763 ("\\.[1-9]\\'" . nroff-mode) 1787 ("\\.[1-9]\\'" . nroff-mode)
1764 ("\\.g\\'" . antlr-mode) 1788 ("\\.\\(?:orig\\|in\\|[bB][aA][kK]\\)\\'" nil t)))
1765 ("\\.ses\\'" . ses-mode)
1766 ("\\.orig\\'" nil t) ; from patch
1767 ("\\.\\(soa\\|zone\\)\\'" . dns-mode)
1768 ("\\.in\\'" nil t)))
1769 "Alist of filename patterns vs corresponding major mode functions. 1789 "Alist of filename patterns vs corresponding major mode functions.
1770Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL). 1790Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
1771\(NON-NIL stands for anything that is not nil; the value does not matter.) 1791\(NON-NIL stands for anything that is not nil; the value does not matter.)
@@ -1846,26 +1866,32 @@ regular expression. The mode is then determined as the mode associated
1846with that interpreter in `interpreter-mode-alist'.") 1866with that interpreter in `interpreter-mode-alist'.")
1847 1867
1848(defvar magic-mode-alist 1868(defvar magic-mode-alist
1849 '(;; The < comes before the groups (but the first) to reduce backtracking. 1869 `(;; The < comes before the groups (but the first) to reduce backtracking.
1850 ;; Is there a nicer way of getting . including \n?
1851 ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff. 1870 ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff.
1852 ("\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\)?\\s *\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*[Hh][Tt][Mm][Ll]" . html-mode) 1871 (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
1872 (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)")))
1873 (concat "\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<"
1874 comment-re "*"
1875 "\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\s *" comment-re "*\\)?"
1876 "[Hh][Tt][Mm][Ll]")) . html-mode)
1853 ;; These two must come after html, because they are more general: 1877 ;; These two must come after html, because they are more general:
1854 ("<\\?xml " . xml-mode) 1878 ("<\\?xml " . xml-mode)
1855 ("\\s *<\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*!DOCTYPE " . sgml-mode) 1879 (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
1856 ("%![^V]" . ps-mode)) 1880 (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)")))
1857 "Alist of buffer beginnings vs corresponding major mode functions. 1881 (concat "\\s *<" comment-re "*!DOCTYPE ")) . sgml-mode)
1882 ("%![^V]" . ps-mode)
1883 ("# xmcd " . conf-unix-mode))
1884 "Alist of buffer beginnings vs. corresponding major mode functions.
1858Each element looks like (REGEXP . FUNCTION). FUNCTION will be 1885Each element looks like (REGEXP . FUNCTION). FUNCTION will be
1859called, unless it is nil.") 1886called, unless it is nil (to allow `auto-mode-alist' to override).")
1860 1887
1861(defun set-auto-mode (&optional keep-mode-if-same) 1888(defun set-auto-mode (&optional keep-mode-if-same)
1862 "Select major mode appropriate for current buffer. 1889 "Select major mode appropriate for current buffer.
1863 1890
1864This checks for a -*- mode tag in the buffer's text, checks the 1891This checks for a -*- mode tag in the buffer's text, checks the
1865interpreter that runs this file against `interpreter-mode-alist', 1892interpreter that runs this file against `interpreter-mode-alist',
1866compares the buffer beginning against `magic-mode-alist', 1893compares the buffer beginning against `magic-mode-alist', or
1867or compares the filename against the entries in 1894compares the filename against the entries in `auto-mode-alist'.
1868`auto-mode-alist'.
1869 1895
1870It does not check for the `mode:' local variable in the 1896It does not check for the `mode:' local variable in the
1871Local Variables section of the file; for that, use `hack-local-variables'. 1897Local Variables section of the file; for that, use `hack-local-variables'.
@@ -1876,13 +1902,11 @@ If `enable-local-variables' is nil, this function does not check for a
1876If the optional argument KEEP-MODE-IF-SAME is non-nil, then we 1902If the optional argument KEEP-MODE-IF-SAME is non-nil, then we
1877only set the major mode, if that would change it." 1903only set the major mode, if that would change it."
1878 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- 1904 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*-
1879 (let (end done mode modes xml) 1905 (let (end done mode modes)
1880 ;; Find a -*- mode tag 1906 ;; Find a -*- mode tag
1881 (save-excursion 1907 (save-excursion
1882 (goto-char (point-min)) 1908 (goto-char (point-min))
1883 (skip-chars-forward " \t\n") 1909 (skip-chars-forward " \t\n")
1884 ;; While we're at this point, check xml for later.
1885 (setq xml (looking-at "<\\?xml \\|<!DOCTYPE"))
1886 (and enable-local-variables 1910 (and enable-local-variables
1887 (setq end (set-auto-mode-1)) 1911 (setq end (set-auto-mode-1))
1888 (if (save-excursion (search-forward ":" end t)) 1912 (if (save-excursion (search-forward ":" end t))
@@ -1926,9 +1950,10 @@ only set the major mode, if that would change it."
1926 ;; same time. 1950 ;; same time.
1927 done (assoc (file-name-nondirectory mode) 1951 done (assoc (file-name-nondirectory mode)
1928 interpreter-mode-alist)) 1952 interpreter-mode-alist))
1953 ;; If we found an interpreter mode to use, invoke it now.
1929 (if done 1954 (if done
1930 (set-auto-mode-0 (cdr done) keep-mode-if-same))) 1955 (set-auto-mode-0 (cdr done) keep-mode-if-same)))
1931 ;; If we found an interpreter mode to use, invoke it now. 1956 ;; If we didn't, match the buffer beginning against magic-mode-alist.
1932 (unless done 1957 (unless done
1933 (if (setq done (save-excursion 1958 (if (setq done (save-excursion
1934 (goto-char (point-min)) 1959 (goto-char (point-min))
@@ -1936,6 +1961,7 @@ only set the major mode, if that would change it."
1936 (lambda (re dummy) 1961 (lambda (re dummy)
1937 (looking-at re))))) 1962 (looking-at re)))))
1938 (set-auto-mode-0 done keep-mode-if-same) 1963 (set-auto-mode-0 done keep-mode-if-same)
1964 ;; Compare the filename against the entries in auto-mode-alist.
1939 (if buffer-file-name 1965 (if buffer-file-name
1940 (let ((name buffer-file-name)) 1966 (let ((name buffer-file-name))
1941 ;; Remove backup-suffixes from file name. 1967 ;; Remove backup-suffixes from file name.
@@ -1945,7 +1971,7 @@ only set the major mode, if that would change it."
1945 (let ((case-fold-search 1971 (let ((case-fold-search
1946 (memq system-type '(vax-vms windows-nt cygwin)))) 1972 (memq system-type '(vax-vms windows-nt cygwin))))
1947 (if (and (setq mode (assoc-default name auto-mode-alist 1973 (if (and (setq mode (assoc-default name auto-mode-alist
1948 'string-match)) 1974 'string-match))
1949 (consp mode) 1975 (consp mode)
1950 (cadr mode)) 1976 (cadr mode))
1951 (setq mode (car mode) 1977 (setq mode (car mode)
@@ -1954,7 +1980,6 @@ only set the major mode, if that would change it."
1954 (when mode 1980 (when mode
1955 (set-auto-mode-0 mode keep-mode-if-same))))))))) 1981 (set-auto-mode-0 mode keep-mode-if-same)))))))))
1956 1982
1957
1958;; When `keep-mode-if-same' is set, we are working on behalf of 1983;; When `keep-mode-if-same' is set, we are working on behalf of
1959;; set-visited-file-name. In that case, if the major mode specified is the 1984;; set-visited-file-name. In that case, if the major mode specified is the
1960;; same one we already have, don't actually reset it. We don't want to lose 1985;; same one we already have, don't actually reset it. We don't want to lose
@@ -1973,7 +1998,6 @@ same, do nothing and return nil."
1973 (funcall mode) 1998 (funcall mode)
1974 mode)) 1999 mode))
1975 2000
1976
1977(defun set-auto-mode-1 () 2001(defun set-auto-mode-1 ()
1978 "Find the -*- spec in the buffer. 2002 "Find the -*- spec in the buffer.
1979Call with point at the place to start searching from. 2003Call with point at the place to start searching from.
diff --git a/lisp/filesets.el b/lisp/filesets.el
index 74a2a72bb34..8599cb01d93 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -1356,7 +1356,7 @@ Use the viewer defined in EV-ENTRY (a valid element of
1356 (run-hooks 'oh)) 1356 (run-hooks 'oh))
1357 (set-buffer-modified-p nil) 1357 (set-buffer-modified-p nil)
1358 (setq buffer-read-only t) 1358 (setq buffer-read-only t)
1359 (beginning-of-buffer)) 1359 (goto-char (point-min)))
1360 (when oh 1360 (when oh
1361 (run-hooks 'oh)))) 1361 (run-hooks 'oh))))
1362 (filesets-error 'error 1362 (filesets-error 'error
@@ -1593,7 +1593,8 @@ SAVE-FUNCTION takes no argument, but works on the current buffer."
1593(defun filesets-cmd-show-result (cmd output) 1593(defun filesets-cmd-show-result (cmd output)
1594 "Show OUTPUT of CMD (a shell command)." 1594 "Show OUTPUT of CMD (a shell command)."
1595 (pop-to-buffer "*Filesets: Shell Command Output*") 1595 (pop-to-buffer "*Filesets: Shell Command Output*")
1596 (end-of-buffer) 1596 (with-no-warnings
1597 (end-of-buffer))
1597 (insert "*** ") 1598 (insert "*** ")
1598 (insert cmd) 1599 (insert cmd)
1599 (newline) 1600 (newline)
@@ -1638,7 +1639,7 @@ Replace <file-name> or <<file-name>> with filename."
1638 (save-restriction 1639 (save-restriction
1639 (let ((buffer (filesets-find-file this))) 1640 (let ((buffer (filesets-find-file this)))
1640 (when buffer 1641 (when buffer
1641 (beginning-of-buffer) 1642 (goto-char (point-min))
1642 (let () 1643 (let ()
1643 (cond 1644 (cond
1644 ((stringp fn) 1645 ((stringp fn)
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index d0c749bf385..8a7e1c28cf4 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1,7 +1,7 @@
1;;; font-lock.el --- Electric font lock mode 1;;; font-lock.el --- Electric font lock mode
2 2
3;; Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001, 02, 2003, 2004 3;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4;; Free Software Foundation, Inc. 4;; 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5 5
6;; Author: jwz, then rms, then sm 6;; Author: jwz, then rms, then sm
7;; Maintainer: FSF 7;; Maintainer: FSF
@@ -1289,20 +1289,20 @@ START should be at the beginning of a line."
1289 (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) 1289 (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name)))
1290 (goto-char start) 1290 (goto-char start)
1291 ;; 1291 ;;
1292 ;; Find the state at the `beginning-of-line' before `start'. 1292 ;; Find the `start' state.
1293 (setq state (or ppss (syntax-ppss start))) 1293 (setq state (or ppss (syntax-ppss start)))
1294 ;; 1294 ;;
1295 ;; Find each interesting place between here and `end'. 1295 ;; Find each interesting place between here and `end'.
1296 (while 1296 (while
1297 (progn 1297 (progn
1298 (setq state (parse-partial-sexp (point) end nil nil state
1299 'syntax-table))
1298 (when (or (nth 3 state) (nth 4 state)) 1300 (when (or (nth 3 state) (nth 4 state))
1299 (setq face (funcall font-lock-syntactic-face-function state)) 1301 (setq face (funcall font-lock-syntactic-face-function state))
1300 (setq beg (max (nth 8 state) start)) 1302 (setq beg (max (nth 8 state) start))
1301 (setq state (parse-partial-sexp (point) end nil nil state 1303 (setq state (parse-partial-sexp (point) end nil nil state
1302 'syntax-table)) 1304 'syntax-table))
1303 (when face (put-text-property beg (point) 'face face))) 1305 (when face (put-text-property beg (point) 'face face)))
1304 (setq state (parse-partial-sexp (point) end nil nil state
1305 'syntax-table))
1306 (< (point) end))))) 1306 (< (point) end)))))
1307 1307
1308;;; End of Syntactic fontification functions. 1308;;; End of Syntactic fontification functions.
@@ -2003,5 +2003,5 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
2003 2003
2004(provide 'font-lock) 2004(provide 'font-lock)
2005 2005
2006;;; arch-tag: 682327e4-64d8-4057-b20b-1fbb9f1fc54c 2006;; arch-tag: 682327e4-64d8-4057-b20b-1fbb9f1fc54c
2007;;; font-lock.el ends here 2007;;; font-lock.el ends here
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index d7ebedc53f8..b605875da89 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,17 @@
12004-11-10 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * gnus-art.el (gnus-emphasis-alist): Don't hide asterisks by
4 default; improve customization type.
5 (gnus-emphasis-custom-with-format): New macro.
6 (gnus-emphasis-custom-value-to-external): New function.
7 (gnus-emphasis-custom-value-to-internal): New function.
8
92004-11-07 Katsumi Yamaoka <yamaoka@jpl.org>
10
11 * gnus-msg.el (gnus-configure-posting-styles): Don't cause the
12 "Args out of range" error. Reported by Arnaud Giersch
13 <arnaud.giersch@free.fr>.
14
12004-11-04 Richard M. Stallman <rms@gnu.org> 152004-11-04 Richard M. Stallman <rms@gnu.org>
2 16
3 * spam.el (spam group): Add :version. 17 * spam.el (spam group): Add :version.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index c0266300983..a87348188f9 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -321,27 +321,55 @@ advertisements. For example:
321 :version "21.4" 321 :version "21.4"
322 :group 'gnus-article-washing) 322 :group 'gnus-article-washing)
323 323
324(defmacro gnus-emphasis-custom-with-format (&rest body)
325 `(let ((format "\
326\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\
327\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)"))
328 ,@body))
329
330(defun gnus-emphasis-custom-value-to-external (value)
331 (gnus-emphasis-custom-with-format
332 (if (consp (car value))
333 (list (format format (car (car value)) (cdr (car value)))
334 2
335 (if (nth 1 value) 2 3)
336 (nth 2 value))
337 value)))
338
339(defun gnus-emphasis-custom-value-to-internal (value)
340 (gnus-emphasis-custom-with-format
341 (let ((regexp (concat "\\`"
342 (format (regexp-quote format)
343 "\\([^()]+\\)" "\\([^()]+\\)")
344 "\\'"))
345 pattern)
346 (if (string-match regexp (setq pattern (car value)))
347 (list (cons (match-string 1 pattern) (match-string 2 pattern))
348 (= (nth 2 value) 2)
349 (nth 3 value))
350 value))))
351
324(defcustom gnus-emphasis-alist 352(defcustom gnus-emphasis-alist
325 (let ((format 353 (let ((types
326 "\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)") 354 '(("\\*" "\\*" bold nil 2)
327 (types
328 '(("\\*" "\\*" bold)
329 ("_" "_" underline) 355 ("_" "_" underline)
330 ("/" "/" italic) 356 ("/" "/" italic)
331 ("_/" "/_" underline-italic) 357 ("_/" "/_" underline-italic)
332 ("_\\*" "\\*_" underline-bold) 358 ("_\\*" "\\*_" underline-bold)
333 ("\\*/" "/\\*" bold-italic) 359 ("\\*/" "/\\*" bold-italic)
334 ("_\\*/" "/\\*_" underline-bold-italic)))) 360 ("_\\*/" "/\\*_" underline-bold-italic))))
335 `(,@(mapcar 361 (nconc
336 (lambda (spec) 362 (gnus-emphasis-custom-with-format
337 (list 363 (mapcar (lambda (spec)
338 (format format (car spec) (cadr spec)) 364 (list (format format (car spec) (cadr spec))
339 2 3 (intern (format "gnus-emphasis-%s" (nth 2 spec))))) 365 (or (nth 3 spec) 2)
340 types) 366 (or (nth 4 spec) 3)
341 ("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)" 367 (intern (format "gnus-emphasis-%s" (nth 2 spec)))))
342 2 3 gnus-emphasis-strikethru) 368 types))
343 ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)" 369 '(("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)"
344 2 3 gnus-emphasis-underline))) 370 2 3 gnus-emphasis-strikethru)
371 ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
372 2 3 gnus-emphasis-underline))))
345 "*Alist that says how to fontify certain phrases. 373 "*Alist that says how to fontify certain phrases.
346Each item looks like this: 374Each item looks like this:
347 375
@@ -352,11 +380,43 @@ is a number that says what regular expression grouping used to find
352the entire emphasized word. The third is a number that says what 380the entire emphasized word. The third is a number that says what
353regexp grouping should be displayed and highlighted. The fourth 381regexp grouping should be displayed and highlighted. The fourth
354is the face used for highlighting." 382is the face used for highlighting."
355 :type '(repeat (list :value ("" 0 0 default) 383 :type
356 regexp 384 '(repeat
357 (integer :tag "Match group") 385 (menu-choice
358 (integer :tag "Emphasize group") 386 :format "%[Customizing Style%]\n%v"
359 face)) 387 :indent 2
388 (group :tag "Default"
389 :value ("" 0 0 default)
390 :value-create
391 (lambda (widget)
392 (let ((value (widget-get
393 (cadr (widget-get (widget-get widget :parent)
394 :args))
395 :value)))
396 (if (not (eq (nth 2 value) 'default))
397 (widget-put
398 widget
399 :value
400 (gnus-emphasis-custom-value-to-external value))))
401 (widget-group-value-create widget))
402 (regexp :format "%t: %v\n" :size 1)
403 (integer :format "Match group: %v\n" :size 0)
404 (integer :format "Emphasize group: %v\n" :size 0)
405 face)
406 (group :tag "Simple"
407 :value (("_" . "_") nil default)
408 (cons :format "%v"
409 (regexp :format "Start regexp: %v\n" :size 0)
410 (regexp :format "End regexp: %v\n" :size 0))
411 (boolean :format "Show start and end patterns: %[%v%]\n"
412 :on " On " :off " Off ")
413 face)))
414 :get (lambda (symbol)
415 (mapcar 'gnus-emphasis-custom-value-to-internal
416 (default-value symbol)))
417 :set (lambda (symbol value)
418 (set-default symbol (mapcar 'gnus-emphasis-custom-value-to-external
419 value)))
360 :group 'gnus-article-emphasis) 420 :group 'gnus-article-emphasis)
361 421
362(defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n" 422(defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index 6b093480940..7948efc2572 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -1871,11 +1871,13 @@ this is a reply."
1871 (when (and filep v) 1871 (when (and filep v)
1872 (setq v (with-temp-buffer 1872 (setq v (with-temp-buffer
1873 (insert-file-contents v) 1873 (insert-file-contents v)
1874 (goto-char (point-max)) 1874 (buffer-substring
1875 (skip-chars-backward "\n") 1875 (point-min)
1876 (delete-region (+ (point) (if (bolp) 0 1)) 1876 (progn
1877 (point-max)) 1877 (goto-char (point-max))
1878 (buffer-string)))) 1878 (if (zerop (skip-chars-backward "\n"))
1879 (point)
1880 (1+ (point))))))))
1879 (setq results (delq (assoc element results) results)) 1881 (setq results (delq (assoc element results) results))
1880 (push (cons element v) results)))) 1882 (push (cons element v) results))))
1881 ;; Now we have all the styles, so we insert them. 1883 ;; Now we have all the styles, so we insert them.
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 8f2a1b7fa6e..c06a7b1ee73 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -228,9 +228,14 @@ KIND should be `var' for a variable or `subr' for a subroutine."
228 (if (eobp) 228 (if (eobp)
229 (insert-file-contents-literally 229 (insert-file-contents-literally
230 (expand-file-name internal-doc-file-name doc-directory))) 230 (expand-file-name internal-doc-file-name doc-directory)))
231 (search-forward (concat "" name "\n")) 231 (let ((file (catch 'loop
232 (while t
233 (let ((pnt (search-forward (concat "" name "\n"))))
232 (re-search-backward "S\\(.*\\)") 234 (re-search-backward "S\\(.*\\)")
233 (let ((file (match-string 1))) 235 (let ((file (match-string 1)))
236 (if (member file build-files)
237 (throw 'loop file)
238 (goto-char pnt))))))))
234 (if (string-match "\\.\\(o\\|obj\\)\\'" file) 239 (if (string-match "\\.\\(o\\|obj\\)\\'" file)
235 (setq file (replace-match ".c" t t file))) 240 (setq file (replace-match ".c" t t file)))
236 (if (string-match "\\.c\\'" file) 241 (if (string-match "\\.c\\'" file)
diff --git a/lisp/info-look.el b/lisp/info-look.el
index 3f3ea7c2fd4..4bc90c7e5aa 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -328,22 +328,22 @@ If optional argument QUERY is non-nil, query for the help mode."
328 (modes (info-lookup->all-modes topic mode)) 328 (modes (info-lookup->all-modes topic mode))
329 (window (selected-window)) 329 (window (selected-window))
330 found doc-spec node prefix suffix doc-found) 330 found doc-spec node prefix suffix doc-found)
331 (if (or (not info-lookup-other-window-flag) 331 (if (not (eq major-mode 'Info-mode))
332 (eq (current-buffer) (get-buffer "*info*"))) 332 (if (not info-lookup-other-window-flag)
333 (info) 333 (info)
334 (progn 334 (progn
335 (save-window-excursion (info)) 335 (save-window-excursion (info))
336 ;; Determine whether or not the Info buffer is visible in 336 ;; Determine whether or not the Info buffer is visible in
337 ;; another frame on the same display. If it is, simply raise 337 ;; another frame on the same display. If it is, simply raise
338 ;; that frame. Otherwise, display it in another window. 338 ;; that frame. Otherwise, display it in another window.
339 (let* ((window (get-buffer-window "*info*" t)) 339 (let* ((window (get-buffer-window "*info*" t))
340 (info-frame (and window (window-frame window)))) 340 (info-frame (and window (window-frame window))))
341 (if (and info-frame 341 (if (and info-frame
342 (display-multi-frame-p) 342 (display-multi-frame-p)
343 (memq info-frame (frames-on-display-list)) 343 (memq info-frame (frames-on-display-list))
344 (not (eq info-frame (selected-frame)))) 344 (not (eq info-frame (selected-frame))))
345 (select-frame info-frame) 345 (select-frame info-frame)
346 (switch-to-buffer-other-window "*info*"))))) 346 (switch-to-buffer-other-window "*info*"))))))
347 (while (and (not found) modes) 347 (while (and (not found) modes)
348 (setq doc-spec (info-lookup->doc-spec topic (car modes))) 348 (setq doc-spec (info-lookup->doc-spec topic (car modes)))
349 (while (and (not found) doc-spec) 349 (while (and (not found) doc-spec)
@@ -633,11 +633,11 @@ Return nil if there is nothing appropriate in the buffer near point."
633 :mode 'c-mode :topic 'symbol 633 :mode 'c-mode :topic 'symbol
634 :regexp "\\(struct \\|union \\|enum \\)?[_a-zA-Z][_a-zA-Z0-9]*" 634 :regexp "\\(struct \\|union \\|enum \\)?[_a-zA-Z][_a-zA-Z0-9]*"
635 :doc-spec '(("(libc)Function Index" nil 635 :doc-spec '(("(libc)Function Index" nil
636 "^[ \t]+- \\(Function\\|Macro\\): .*\\<" "\\>") 636 "^[ \t]+-+ \\(Function\\|Macro\\): .*\\<" "\\>")
637 ("(libc)Variable Index" nil 637 ("(libc)Variable Index" nil
638 "^[ \t]+- \\(Variable\\|Macro\\): .*\\<" "\\>") 638 "^[ \t]+-+ \\(Variable\\|Macro\\): .*\\<" "\\>")
639 ("(libc)Type Index" nil 639 ("(libc)Type Index" nil
640 "^[ \t]+- Data Type: \\<" "\\>") 640 "^[ \t]+-+ Data Type: \\<" "\\>")
641 ("(termcap)Var Index" nil 641 ("(termcap)Var Index" nil
642 "^[ \t]*`" "'")) 642 "^[ \t]*`" "'"))
643 :parse-rule 'info-lookup-guess-c-symbol) 643 :parse-rule 'info-lookup-guess-c-symbol)
@@ -673,7 +673,7 @@ Return nil if there is nothing appropriate in the buffer near point."
673 (lambda (item) 673 (lambda (item)
674 (if (string-match "^\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\( .*\\)?$" item) 674 (if (string-match "^\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\( .*\\)?$" item)
675 (concat "@" (match-string 1 item)))) 675 (concat "@" (match-string 1 item))))
676 "`" "'"))) 676 "`" "[' ]")))
677 677
678(info-lookup-maybe-add-help 678(info-lookup-maybe-add-help
679 :mode 'm4-mode 679 :mode 'm4-mode
@@ -690,7 +690,7 @@ Return nil if there is nothing appropriate in the buffer near point."
690 ("(autoconf)Autoconf Macro Index" 690 ("(autoconf)Autoconf Macro Index"
691 (lambda (item) 691 (lambda (item)
692 (if (string-match "^A._" item) item (concat "AC_" item))) 692 (if (string-match "^A._" item) item (concat "AC_" item)))
693 "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>") 693 "^[ \t]+-+ \\(Macro\\|Variable\\): .*\\<" "\\>")
694 ;; M4 Macro Index entries are without "AS_" prefixes, and 694 ;; M4 Macro Index entries are without "AS_" prefixes, and
695 ;; mostly without "m4_" prefixes. "dnl" is an exception, not 695 ;; mostly without "m4_" prefixes. "dnl" is an exception, not
696 ;; wanting any prefix. So AS_ is added back to upper-case 696 ;; wanting any prefix. So AS_ is added back to upper-case
@@ -705,13 +705,13 @@ Return nil if there is nothing appropriate in the buffer near point."
705 (concat "AS_" item)) 705 (concat "AS_" item))
706 (t 706 (t
707 (concat "m4_" item))))) 707 (concat "m4_" item)))))
708 "^[ \t]+- Macro: .*\\<" "\\>") 708 "^[ \t]+-+ Macro: .*\\<" "\\>")
709 ;; Autotest Macro Index entries are without "AT_". 709 ;; Autotest Macro Index entries are without "AT_".
710 ("(autoconf)Autotest Macro Index" "AT_" 710 ("(autoconf)Autotest Macro Index" "AT_"
711 "^[ \t]+- Macro: .*\\<" "\\>") 711 "^[ \t]+-+ Macro: .*\\<" "\\>")
712 ;; This is for older versions (probably pre autoconf 2.5x): 712 ;; This is for older versions (probably pre autoconf 2.5x):
713 ("(autoconf)Macro Index" "AC_" 713 ("(autoconf)Macro Index" "AC_"
714 "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>") 714 "^[ \t]+-+ \\(Macro\\|Variable\\): .*\\<" "\\>")
715 ;; Automake has index entries for its notes on various autoconf 715 ;; Automake has index entries for its notes on various autoconf
716 ;; macros (eg. AC_PROG_CC). Ensure this is after the autoconf 716 ;; macros (eg. AC_PROG_CC). Ensure this is after the autoconf
717 ;; index, so as to prefer the autoconf docs. 717 ;; index, so as to prefer the autoconf docs.
@@ -788,13 +788,13 @@ Return nil if there is nothing appropriate in the buffer near point."
788 ;; Variables normally appear in nodes as just `foo'. 788 ;; Variables normally appear in nodes as just `foo'.
789 ("(emacs)Variable Index" nil "`" "'") 789 ("(emacs)Variable Index" nil "`" "'")
790 ;; Almost all functions, variables, etc appear in nodes as 790 ;; Almost all functions, variables, etc appear in nodes as
791 ;; " - Function: foo" etc. A small number of aliases and 791 ;; " -- Function: foo" etc. A small number of aliases and
792 ;; symbols appear only as `foo', and will miss out on exact 792 ;; symbols appear only as `foo', and will miss out on exact
793 ;; positions. Allowing `foo' would hit too many false matches 793 ;; positions. Allowing `foo' would hit too many false matches
794 ;; for things that should go to Function: etc, and those latter 794 ;; for things that should go to Function: etc, and those latter
795 ;; are much more important. Perhaps this could change if some 795 ;; are much more important. Perhaps this could change if some
796 ;; sort of fallback match scheme existed. 796 ;; sort of fallback match scheme existed.
797 ("(elisp)Index" nil "^ - .*: " "\\( \\|$\\)"))) 797 ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)")))
798 798
799(info-lookup-maybe-add-help 799(info-lookup-maybe-add-help
800 :mode 'lisp-interaction-mode 800 :mode 'lisp-interaction-mode
@@ -814,14 +814,14 @@ Return nil if there is nothing appropriate in the buffer near point."
814 :ignore-case t 814 :ignore-case t
815 ;; Aubrey Jaffer's rendition from <URL:ftp://ftp-swiss.ai.mit.edu/pub/scm> 815 ;; Aubrey Jaffer's rendition from <URL:ftp://ftp-swiss.ai.mit.edu/pub/scm>
816 :doc-spec '(("(r5rs)Index" nil 816 :doc-spec '(("(r5rs)Index" nil
817 "^[ \t]+- [^:]+:[ \t]*" "\\b"))) 817 "^[ \t]+-+ [^:]+:[ \t]*" "\\b")))
818 818
819(info-lookup-maybe-add-help 819(info-lookup-maybe-add-help
820 :mode 'octave-mode 820 :mode 'octave-mode
821 :regexp "[_a-zA-Z0-9]+" 821 :regexp "[_a-zA-Z0-9]+"
822 :doc-spec '(("(octave)Function Index" nil 822 :doc-spec '(("(octave)Function Index" nil
823 "^ - [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil) 823 "^ -+ [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil)
824 ("(octave)Variable Index" nil "^ - [^:]+:[ ]+" nil) 824 ("(octave)Variable Index" nil "^ -+ [^:]+:[ ]+" nil)
825 ;; Catch lines of the form "xyz statement" 825 ;; Catch lines of the form "xyz statement"
826 ("(octave)Concept Index" 826 ("(octave)Concept Index"
827 (lambda (item) 827 (lambda (item)
@@ -829,15 +829,15 @@ Return nil if there is nothing appropriate in the buffer near point."
829 ((string-match "^\\([A-Z]+\\) statement\\b" item) 829 ((string-match "^\\([A-Z]+\\) statement\\b" item)
830 (match-string 1 item)) 830 (match-string 1 item))
831 (t nil))) 831 (t nil)))
832 nil; "^ - [^:]+:[ ]+" don't think this prefix is useful here. 832 nil; "^ -+ [^:]+:[ ]+" don't think this prefix is useful here.
833 nil))) 833 nil)))
834 834
835(info-lookup-maybe-add-help 835(info-lookup-maybe-add-help
836 :mode 'maxima-mode 836 :mode 'maxima-mode
837 :ignore-case t 837 :ignore-case t
838 :regexp "[a-zA-Z_%]+" 838 :regexp "[a-zA-Z_%]+"
839 :doc-spec '( ("(maxima)Function and Variable Index" nil 839 :doc-spec '( ("(maxima)Function and Variable Index" nil
840 "^ - [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil))) 840 "^ -+ [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil)))
841 841
842(info-lookup-maybe-add-help 842(info-lookup-maybe-add-help
843 :mode 'inferior-maxima-mode 843 :mode 'inferior-maxima-mode
diff --git a/lisp/info.el b/lisp/info.el
index 8aaf7755df2..cc7ed2ae59b 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -657,10 +657,10 @@ is preserved, if possible."
657 (equal old-nodename Info-current-node)) 657 (equal old-nodename Info-current-node))
658 (progn 658 (progn
659 ;; note goto-line is no good, we want to measure from point-min 659 ;; note goto-line is no good, we want to measure from point-min
660 (beginning-of-buffer) 660 (goto-char (point-min))
661 (forward-line wline) 661 (forward-line wline)
662 (set-window-start (selected-window) (point)) 662 (set-window-start (selected-window) (point))
663 (beginning-of-buffer) 663 (goto-char (point-min))
664 (forward-line pline) 664 (forward-line pline)
665 (move-to-column pcolumn)) 665 (move-to-column pcolumn))
666 ;; only add to the history when coming from a different file+node 666 ;; only add to the history when coming from a different file+node
@@ -1484,13 +1484,18 @@ If DIRECTION is `backward', search in the reverse direction."
1484 (1- (point))) 1484 (1- (point)))
1485 (point-max))) 1485 (point-max)))
1486 (while (and (not give-up) 1486 (while (and (not give-up)
1487 (or (null found) 1487 (save-match-data
1488 (if backward 1488 (or (null found)
1489 (isearch-range-invisible found beg-found) 1489 (if backward
1490 (isearch-range-invisible beg-found found)) 1490 (isearch-range-invisible found beg-found)
1491 ;; Skip node header line 1491 (isearch-range-invisible beg-found found))
1492 (save-excursion (forward-line -1) 1492 ;; Skip node header line
1493 (looking-at "\^_")))) 1493 (save-excursion (forward-line -1)
1494 (looking-at "\^_"))
1495 ;; Skip Tag Table node
1496 (save-excursion
1497 (and (search-backward "\^_" nil t)
1498 (looking-at "\^_\nTag Table"))))))
1494 (if (if backward 1499 (if (if backward
1495 (re-search-backward regexp bound t) 1500 (re-search-backward regexp bound t)
1496 (re-search-forward regexp bound t)) 1501 (re-search-forward regexp bound t))
@@ -1552,13 +1557,18 @@ If DIRECTION is `backward', search in the reverse direction."
1552 (setq list (cdr list)) 1557 (setq list (cdr list))
1553 (setq give-up nil found nil) 1558 (setq give-up nil found nil)
1554 (while (and (not give-up) 1559 (while (and (not give-up)
1555 (or (null found) 1560 (save-match-data
1556 (if backward 1561 (or (null found)
1557 (isearch-range-invisible found beg-found) 1562 (if backward
1558 (isearch-range-invisible beg-found found)) 1563 (isearch-range-invisible found beg-found)
1559 ;; Skip node header line 1564 (isearch-range-invisible beg-found found))
1560 (save-excursion (forward-line -1) 1565 ;; Skip node header line
1561 (looking-at "\^_")))) 1566 (save-excursion (forward-line -1)
1567 (looking-at "\^_"))
1568 ;; Skip Tag Table node
1569 (save-excursion
1570 (and (search-backward "\^_" nil t)
1571 (looking-at "\^_\nTag Table"))))))
1562 (if (if backward 1572 (if (if backward
1563 (re-search-backward regexp nil t) 1573 (re-search-backward regexp nil t)
1564 (re-search-forward regexp nil t)) 1574 (re-search-forward regexp nil t))
diff --git a/lisp/international/iso-cvt.el b/lisp/international/iso-cvt.el
index b0dffc40f50..d7baabb29c8 100644
--- a/lisp/international/iso-cvt.el
+++ b/lisp/international/iso-cvt.el
@@ -1,7 +1,8 @@
1;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: iso-latin-1 -*- 1;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: iso-latin-1 -*-
2;; This file was formerly called gm-lingo.el. 2;; This file was formerly called gm-lingo.el.
3 3
4;; Copyright (C) 1993, 1994, 1995, 1996, 1998, 2000 Free Software Foundation, Inc. 4;; Copyright (C) 1993, 1994, 1995, 1996, 1998, 2000, 2003, 2004
5;; Free Software Foundation, Inc.
5 6
6;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at> 7;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
7;; Keywords: tex, iso, latin, i18n 8;; Keywords: tex, iso, latin, i18n
@@ -828,69 +829,67 @@ Optional arg BUFFER is ignored (for use in `format-alist')."
828 829
829;;;###autoload 830;;;###autoload
830(defun iso-cvt-define-menu () 831(defun iso-cvt-define-menu ()
831 "Add submenus to the Files menu, to convert to and from various formats." 832 "Add submenus to the File menu, to convert to and from various formats."
832 (interactive) 833 (interactive)
833 834
834 (define-key menu-bar-files-menu [load-as-separator] '("--")) 835 (let ((load-as-menu-map (make-sparse-keymap "Load As..."))
835 836 (insert-as-menu-map (make-sparse-keymap "Insert As..."))
836 (define-key menu-bar-files-menu [load-as] '("Load As..." . load-as)) 837 (write-as-menu-map (make-sparse-keymap "Write As..."))
837 (defvar load-as-menu-map (make-sparse-keymap "Load As...")) 838 (translate-to-menu-map (make-sparse-keymap "Translate to..."))
838 (fset 'load-as load-as-menu-map) 839 (translate-from-menu-map (make-sparse-keymap "Translate from..."))
839 840 (menu menu-bar-file-menu))
840 ;;(define-key menu-bar-files-menu [insert-as] '("Insert As..." . insert-as)) 841
841 (defvar insert-as-menu-map (make-sparse-keymap "Insert As...")) 842 (define-key menu [load-as-separator] '("--"))
842 (fset 'insert-as insert-as-menu-map) 843
843 844 (define-key menu [load-as] '("Load As..." . iso-cvt-load-as))
844 (define-key menu-bar-files-menu [write-as] '("Write As..." . write-as)) 845 (fset 'iso-cvt-load-as load-as-menu-map)
845 (defvar write-as-menu-map (make-sparse-keymap "Write As...")) 846
846 (fset 'write-as write-as-menu-map) 847 ;;(define-key menu [insert-as] '("Insert As..." . iso-cvt-insert-as))
847 848 (fset 'iso-cvt-insert-as insert-as-menu-map)
848 (define-key menu-bar-files-menu [translate-separator] '("--")) 849
849 850 (define-key menu [write-as] '("Write As..." . iso-cvt-write-as))
850 (define-key menu-bar-files-menu [translate-to] '("Translate to..." . translate-to)) 851 (fset 'iso-cvt-write-as write-as-menu-map)
851 (defvar translate-to-menu-map (make-sparse-keymap "Translate to...")) 852
852 (fset 'translate-to translate-to-menu-map) 853 (define-key menu [translate-separator] '("--"))
853 854
854 (define-key menu-bar-files-menu [translate-from] '("Translate from..." . translate-from)) 855 (define-key menu [translate-to] '("Translate to..." . iso-cvt-translate-to))
855 (defvar translate-from-menu-map (make-sparse-keymap "Translate from...")) 856 (fset 'iso-cvt-translate-to translate-to-menu-map)
856 (fset 'translate-from translate-from-menu-map) 857
857 858 (define-key menu [translate-from] '("Translate from..." . iso-cvt-translate-from))
858 (let ((file-types (reverse format-alist)) 859 (fset 'iso-cvt-translate-from translate-from-menu-map)
859 name 860
860 str-name) 861 (dolist (file-type (reverse format-alist))
861 (while file-types 862 (let ((name (car file-type))
862 (setq name (car (car file-types)) 863 (str-name (cadr file-type)))
863 str-name (car (cdr (car file-types))) 864 (if (stringp str-name)
864 file-types (cdr file-types)) 865 (progn
865 (if (stringp str-name) 866 (define-key load-as-menu-map (vector name)
866 (progn 867 (cons str-name
867 (define-key load-as-menu-map (vector name) 868 `(lambda (file)
868 (cons str-name 869 (interactive ,(format "FFind file (as %s): " name))
869 `(lambda (file) 870 (format-find-file file ',name))))
870 (interactive (format "FFind file (as %s): " ,name)) 871 (define-key insert-as-menu-map (vector name)
871 (format-find-file file ',name)))) 872 (cons str-name
872 (define-key insert-as-menu-map (vector name) 873 `(lambda (file)
873 (cons str-name 874 (interactive (format "FInsert file (as %s): " ,name))
874 `(lambda (file) 875 (format-insert-file file ',name))))
875 (interactive (format "FInsert file (as %s): " ,name)) 876 (define-key write-as-menu-map (vector name)
876 (format-insert-file file ',name)))) 877 (cons str-name
877 (define-key write-as-menu-map (vector name) 878 `(lambda (file)
878 (cons str-name 879 (interactive (format "FWrite file (as %s): " ,name))
879 `(lambda (file) 880 (format-write-file file ',name))))
880 (interactive (format "FWrite file (as %s): " ,name)) 881 (define-key translate-to-menu-map (vector name)
881 (format-write-file file ',name)))) 882 (cons str-name
882 (define-key translate-to-menu-map (vector name) 883 `(lambda ()
883 (cons str-name 884 (interactive)
884 `(lambda () 885 (format-encode-buffer ',name))))
885 (interactive) 886 (define-key translate-from-menu-map (vector name)
886 (format-encode-buffer ',name)))) 887 (cons str-name
887 (define-key translate-from-menu-map (vector name) 888 `(lambda ()
888 (cons str-name 889 (interactive)
889 `(lambda () 890 (format-decode-buffer ',name))))))))))
890 (interactive)
891 (format-decode-buffer ',name)))))))))
892 891
893(provide 'iso-cvt) 892(provide 'iso-cvt)
894 893
895;;; arch-tag: 64ae843f-ed0e-43e1-ba50-ffd581b90840 894;; arch-tag: 64ae843f-ed0e-43e1-ba50-ffd581b90840
896;;; iso-cvt.el ends here 895;;; iso-cvt.el ends here
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 510a3c9358d..404ee5529f8 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1,7 +1,8 @@
1;;; mule-cmds.el --- commands for mulitilingual environment -*-coding: iso-2022-7bit -*- 1;;; mule-cmds.el --- commands for mulitilingual environment -*-coding: iso-2022-7bit -*-
2
3;; Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2;; Copyright (C) 1995, 2003 Electrotechnical Laboratory, JAPAN. 4;; Copyright (C) 1995, 2003 Electrotechnical Laboratory, JAPAN.
3;; Licensed to the Free Software Foundation. 5;; Licensed to the Free Software Foundation.
4;; Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5 6
6;; Keywords: mule, multilingual 7;; Keywords: mule, multilingual
7 8
@@ -625,6 +626,175 @@ The meaning is the same as the argument ACCEPT-DEFAULT-P of the
625function `select-safe-coding-system' (which see). This variable 626function `select-safe-coding-system' (which see). This variable
626overrides that argument.") 627overrides that argument.")
627 628
629(defun select-safe-coding-system-interactively (from to codings unsafe
630 &optional rejected default)
631 "Select interactively a coding system for the region FROM ... TO.
632FROM can be a string, as in `write-region'.
633CODINGS is the list of base coding systems known to be safe for this region,
634 typically obtained with `find-coding-systems-region'.
635UNSAFE is a list of coding systems known to be unsafe for this region.
636REJECTED is a list of coding systems which were safe but for some reason
637 were not recommended in the particular context.
638DEFAULT is the coding system to use by default in the query."
639 ;; At first, if some defaults are unsafe, record at most 11
640 ;; problematic characters and their positions for them by turning
641 ;; (CODING ...)
642 ;; into
643 ;; ((CODING (POS . CHAR) (POS . CHAR) ...) ...)
644 (if unsafe
645 (setq unsafe
646 (mapcar #'(lambda (coding)
647 (cons coding
648 (if (stringp from)
649 (mapcar #'(lambda (pos)
650 (cons pos (aref from pos)))
651 (unencodable-char-position
652 0 (length from) coding
653 11 from))
654 (mapcar #'(lambda (pos)
655 (cons pos (char-after pos)))
656 (unencodable-char-position
657 from to coding 11)))))
658 unsafe)))
659
660 ;; Change each safe coding system to the corresponding
661 ;; mime-charset name if it is also a coding system. Such a name
662 ;; is more friendly to users.
663 (let ((l codings)
664 mime-charset)
665 (while l
666 (setq mime-charset (coding-system-get (car l) 'mime-charset))
667 (if (and mime-charset (coding-system-p mime-charset))
668 (setcar l mime-charset))
669 (setq l (cdr l))))
670
671 ;; Don't offer variations with locking shift, which you
672 ;; basically never want.
673 (let (l)
674 (dolist (elt codings (setq codings (nreverse l)))
675 (unless (or (eq 'coding-category-iso-7-else
676 (coding-system-category elt))
677 (eq 'coding-category-iso-8-else
678 (coding-system-category elt)))
679 (push elt l))))
680
681 ;; Remove raw-text, emacs-mule and no-conversion unless nothing
682 ;; else is available.
683 (setq codings
684 (or (delq 'raw-text
685 (delq 'emacs-mule
686 (delq 'no-conversion codings)))
687 '(raw-text emacs-mule no-conversion)))
688
689 (let ((window-configuration (current-window-configuration))
690 (bufname (buffer-name))
691 coding-system)
692 (save-excursion
693 ;; If some defaults are unsafe, make sure the offending
694 ;; buffer is displayed.
695 (when (and unsafe (not (stringp from)))
696 (pop-to-buffer bufname)
697 (goto-char (apply 'min (mapcar #'(lambda (x) (car (cadr x)))
698 unsafe))))
699 ;; Then ask users to select one from CODINGS while showing
700 ;; the reason why none of the defaults are not used.
701 (with-output-to-temp-buffer "*Warning*"
702 (with-current-buffer standard-output
703 (if (and (null rejected) (null unsafe))
704 (insert "No default coding systems to try for "
705 (if (stringp from)
706 (format "string \"%s\"." from)
707 (format "buffer `%s'." bufname)))
708 (insert
709 "These default coding systems were tried to encode"
710 (if (stringp from)
711 (concat " \"" (if (> (length from) 10)
712 (concat (substring from 0 10) "...\"")
713 (concat from "\"")))
714 (format " text\nin the buffer `%s'" bufname))
715 ":\n")
716 (let ((pos (point))
717 (fill-prefix " "))
718 (dolist (x (append rejected unsafe))
719 (princ " ") (princ (car x)))
720 (insert "\n")
721 (fill-region-as-paragraph pos (point)))
722 (when rejected
723 (insert "These safely encodes the target text,
724but it is not recommended for encoding text in this context,
725e.g., for sending an email message.\n ")
726 (dolist (x rejected)
727 (princ " ") (princ x))
728 (insert "\n"))
729 (when unsafe
730 (insert (if rejected "And the others"
731 "However, each of them")
732 " encountered these problematic characters:\n")
733 (dolist (coding unsafe)
734 (insert (format " %s:" (car coding)))
735 (let ((i 0)
736 (func1
737 #'(lambda (bufname pos)
738 (when (buffer-live-p (get-buffer bufname))
739 (pop-to-buffer bufname)
740 (goto-char pos))))
741 (func2
742 #'(lambda (bufname pos coding)
743 (when (buffer-live-p (get-buffer bufname))
744 (pop-to-buffer bufname)
745 (if (< (point) pos)
746 (goto-char pos)
747 (forward-char 1)
748 (search-unencodable-char coding)
749 (forward-char -1))))))
750 (dolist (elt (cdr coding))
751 (insert " ")
752 (if (stringp from)
753 (insert (if (< i 10) (cdr elt) "..."))
754 (if (< i 10)
755 (insert-text-button
756 (cdr elt)
757 :type 'help-xref
758 'help-echo
759 "mouse-2, RET: jump to this character"
760 'help-function func1
761 'help-args (list bufname (car elt)))
762 (insert-text-button
763 "..."
764 :type 'help-xref
765 'help-echo
766 "mouse-2, RET: next unencodable character"
767 'help-function func2
768 'help-args (list bufname (car elt)
769 (car coding)))))
770 (setq i (1+ i))))
771 (insert "\n"))
772 (insert "\
773The first problematic character is at point in the displayed buffer,\n"
774 (substitute-command-keys "\
775and \\[universal-argument] \\[what-cursor-position] will give information about it.\n"))))
776 (insert "\nSelect \
777one of the following safe coding systems, or edit the buffer:\n")
778 (let ((pos (point))
779 (fill-prefix " "))
780 (dolist (x codings)
781 (princ " ") (princ x))
782 (insert "\n")
783 (fill-region-as-paragraph pos (point)))
784 (insert "Or specify any other coding system
785at the risk of losing the problematic characters.\n")))
786
787 ;; Read a coding system.
788 (setq coding-system
789 (read-coding-system
790 (format "Select coding system (default %s): " default)
791 default))
792 (setq last-coding-system-specified coding-system))
793
794 (kill-buffer "*Warning*")
795 (set-window-configuration window-configuration)
796 coding-system))
797
628(defun select-safe-coding-system (from to &optional default-coding-system 798(defun select-safe-coding-system (from to &optional default-coding-system
629 accept-default-p file) 799 accept-default-p file)
630 "Ask a user to select a safe coding system from candidates. 800 "Ask a user to select a safe coding system from candidates.
@@ -721,7 +891,6 @@ and TO is ignored."
721 891
722 (let ((codings (find-coding-systems-region from to)) 892 (let ((codings (find-coding-systems-region from to))
723 (coding-system nil) 893 (coding-system nil)
724 (bufname (buffer-name))
725 safe rejected unsafe) 894 safe rejected unsafe)
726 (if (eq (car codings) 'undecided) 895 (if (eq (car codings) 'undecided)
727 ;; Any coding system is ok. 896 ;; Any coding system is ok.
@@ -739,172 +908,8 @@ and TO is ignored."
739 908
740 ;; If all the defaults failed, ask a user. 909 ;; If all the defaults failed, ask a user.
741 (when (not coding-system) 910 (when (not coding-system)
742 ;; At first, if some defaults are unsafe, record at most 11 911 (setq coding-system (select-safe-coding-system-interactively
743 ;; problematic characters and their positions for them by turning 912 from to codings unsafe rejected (car codings))))
744 ;; (CODING ...)
745 ;; into
746 ;; ((CODING (POS . CHAR) (POS . CHAR) ...) ...)
747 (if unsafe
748 (if (stringp from)
749 (setq unsafe
750 (mapcar #'(lambda (coding)
751 (cons coding
752 (mapcar #'(lambda (pos)
753 (cons pos (aref from pos)))
754 (unencodable-char-position
755 0 (length from) coding
756 11 from))))
757 unsafe))
758 (setq unsafe
759 (mapcar #'(lambda (coding)
760 (cons coding
761 (mapcar #'(lambda (pos)
762 (cons pos (char-after pos)))
763 (unencodable-char-position
764 from to coding 11))))
765 unsafe))))
766
767 ;; Change each safe coding system to the corresponding
768 ;; mime-charset name if it is also a coding system. Such a name
769 ;; is more friendly to users.
770 (let ((l codings)
771 mime-charset)
772 (while l
773 (setq mime-charset (coding-system-get (car l) 'mime-charset))
774 (if (and mime-charset (coding-system-p mime-charset))
775 (setcar l mime-charset))
776 (setq l (cdr l))))
777
778 ;; Don't offer variations with locking shift, which you
779 ;; basically never want.
780 (let (l)
781 (dolist (elt codings (setq codings (nreverse l)))
782 (unless (or (eq 'coding-category-iso-7-else
783 (coding-system-category elt))
784 (eq 'coding-category-iso-8-else
785 (coding-system-category elt)))
786 (push elt l))))
787
788 ;; Remove raw-text, emacs-mule and no-conversion unless nothing
789 ;; else is available.
790 (setq codings
791 (or (delq 'raw-text
792 (delq 'emacs-mule
793 (delq 'no-conversion codings)))
794 '(raw-text emacs-mule no-conversion)))
795
796 (let ((window-configuration (current-window-configuration)))
797 (save-excursion
798 ;; If some defaults are unsafe, make sure the offending
799 ;; buffer is displayed.
800 (when (and unsafe (not (stringp from)))
801 (pop-to-buffer bufname)
802 (goto-char (apply 'min (mapcar #'(lambda (x) (car (cadr x)))
803 unsafe))))
804 ;; Then ask users to select one from CODINGS while showing
805 ;; the reason why none of the defaults are not used.
806 (with-output-to-temp-buffer "*Warning*"
807 (save-excursion
808 (set-buffer standard-output)
809 (if (not default-coding-system)
810 (insert "No default coding systems to try for "
811 (if (stringp from)
812 (format "string \"%s\"." from)
813 (format "buffer `%s'." bufname)))
814 (insert
815 "These default coding systems were tried to encode"
816 (if (stringp from)
817 (concat " \"" (if (> (length from) 10)
818 (concat (substring from 0 10) "...\"")
819 (concat from "\"")))
820 (format " text\nin the buffer `%s'" bufname))
821 ":\n")
822 (let ((pos (point))
823 (fill-prefix " "))
824 (mapc #'(lambda (x) (princ " ") (princ (car x)))
825 default-coding-system)
826 (insert "\n")
827 (fill-region-as-paragraph pos (point)))
828 (when rejected
829 (insert "These safely encodes the target text,
830but it is not recommended for encoding text in this context,
831e.g., for sending an email message.\n ")
832 (mapc #'(lambda (x) (princ " ") (princ x)) rejected)
833 (insert "\n"))
834 (when unsafe
835 (insert (if rejected "And the others"
836 "However, each of them")
837 " encountered these problematic characters:\n")
838 (mapc
839 #'(lambda (coding)
840 (insert (format " %s:" (car coding)))
841 (let ((i 0)
842 (func1
843 #'(lambda (bufname pos)
844 (when (buffer-live-p (get-buffer bufname))
845 (pop-to-buffer bufname)
846 (goto-char pos))))
847 (func2
848 #'(lambda (bufname pos coding)
849 (when (buffer-live-p (get-buffer bufname))
850 (pop-to-buffer bufname)
851 (if (< (point) pos)
852 (goto-char pos)
853 (forward-char 1)
854 (search-unencodable-char coding)
855 (forward-char -1))))))
856 (dolist (elt (cdr coding))
857 (insert " ")
858 (if (stringp from)
859 (insert (if (< i 10) (cdr elt) "..."))
860 (if (< i 10)
861 (insert-text-button
862 (cdr elt)
863 :type 'help-xref
864 'help-echo
865 "mouse-2, RET: jump to this character"
866 'help-function func1
867 'help-args (list bufname (car elt)))
868 (insert-text-button
869 "..."
870 :type 'help-xref
871 'help-echo
872 "mouse-2, RET: next unencodable character"
873 'help-function func2
874 'help-args (list bufname (car elt)
875 (car coding)))))
876 (setq i (1+ i))))
877 (insert "\n"))
878 unsafe)
879 (insert "\
880The first problematic character is at point in the displayed buffer,\n"
881 (substitute-command-keys "\
882and \\[universal-argument] \\[what-cursor-position] will give information about it.\n"))))
883 (insert (if safe
884 "\nSelect the above, or "
885 "\nSelect ")
886 "\
887one of the following safe coding systems, or edit the buffer:\n")
888 (let ((pos (point))
889 (fill-prefix " "))
890 (mapcar (function (lambda (x) (princ " ") (princ x)))
891 codings)
892 (insert "\n")
893 (fill-region-as-paragraph pos (point)))
894 (insert "Or specify any other coding system
895at the risk of losing the problematic characters.\n")))
896
897 ;; Read a coding system.
898 (setq default-coding-system (or (car safe) (car codings)))
899 (setq coding-system
900 (read-coding-system
901 (format "Select coding system (default %s): "
902 default-coding-system)
903 default-coding-system))
904 (setq last-coding-system-specified coding-system))
905
906 (kill-buffer "*Warning*")
907 (set-window-configuration window-configuration)))
908 913
909 (if (vectorp (coding-system-eol-type coding-system)) 914 (if (vectorp (coding-system-eol-type coding-system))
910 (let ((eol (coding-system-eol-type buffer-file-coding-system))) 915 (let ((eol (coding-system-eol-type buffer-file-coding-system)))
@@ -2627,5 +2632,5 @@ If CODING-SYSTEM can't safely encode CHAR, return nil."
2627 (substring enc2 0 i2)))) 2632 (substring enc2 0 i2))))
2628 2633
2629 2634
2630;;; arch-tag: b382c432-4b36-460e-bf4c-05efd0bb18dc 2635;; arch-tag: b382c432-4b36-460e-bf4c-05efd0bb18dc
2631;;; mule-cmds.el ends here 2636;;; mule-cmds.el ends here
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index f5294fea92f..9136a257ee1 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -2126,7 +2126,7 @@ This function is intended to be added to `auto-coding-functions'."
2126 (save-excursion 2126 (save-excursion
2127 (forward-line 10) 2127 (forward-line 10)
2128 (point)))) 2128 (point))))
2129 (when (and (search-forward "<html>" size t) 2129 (when (and (search-forward "<html" size t)
2130 (re-search-forward "<meta\\s-+http-equiv=\"content-type\"\\s-+content=\"text/\\sw+;\\s-*charset=\\(.+?\\)\"" size t)) 2130 (re-search-forward "<meta\\s-+http-equiv=\"content-type\"\\s-+content=\"text/\\sw+;\\s-*charset=\\(.+?\\)\"" size t))
2131 (let* ((match (match-string 1)) 2131 (let* ((match (match-string 1))
2132 (sym (intern (downcase match)))) 2132 (sym (intern (downcase match))))
diff --git a/lisp/mail/rmail-spam-filter.el b/lisp/mail/rmail-spam-filter.el
index 43177b7c99b..c7fc8a0da03 100644
--- a/lisp/mail/rmail-spam-filter.el
+++ b/lisp/mail/rmail-spam-filter.el
@@ -302,13 +302,14 @@ it from rmail file. Called for each new message retrieved by
302 302
303 ;; Check white list, and likewise cause while loop 303 ;; Check white list, and likewise cause while loop
304 ;; bypass. 304 ;; bypass.
305 (if (let ((white-list rsf-white-list) 305 (if (and message-sender
306 (found nil)) 306 (let ((white-list rsf-white-list)
307 (while (and (not found) white-list) 307 (found nil))
308 (if (string-match (car white-list) message-sender) 308 (while (and (not found) white-list)
309 (setq found t) 309 (if (string-match (car white-list) message-sender)
310 (setq white-list (cdr white-list)))) 310 (setq found t)
311 found) 311 (setq white-list (cdr white-list))))
312 found))
312 (setq exit-while-loop t 313 (setq exit-while-loop t
313 maybe-spam nil 314 maybe-spam nil
314 this-is-a-spam-email nil)) 315 this-is-a-spam-email nil))
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index f8e31dfda04..a7524cc8246 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1504,8 +1504,8 @@ It returns t if it got any new messages."
1504 (if (and (featurep 'rmail-spam-filter) 1504 (if (and (featurep 'rmail-spam-filter)
1505 rmail-use-spam-filter 1505 rmail-use-spam-filter
1506 (> rsf-number-of-spam 0)) 1506 (> rsf-number-of-spam 0))
1507 (progn (if rmail-spam-filter-beep (beep t)) 1507 (progn (if rsf-beep (beep t))
1508 (sleep-for rmail-spam-sleep-after-message))) 1508 (sleep-for rsf-sleep-after-message)))
1509 1509
1510 ;; Move to the first new message 1510 ;; Move to the first new message
1511 ;; unless we have other unseen messages before it. 1511 ;; unless we have other unseen messages before it.
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 2c1d37c80e2..597e77b6165 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -63,78 +63,78 @@ A large number or nil slows down menu responsiveness."
63 (cons "Options" menu-bar-options-menu)) 63 (cons "Options" menu-bar-options-menu))
64(defvar menu-bar-edit-menu (make-sparse-keymap "Edit")) 64(defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
65(define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu)) 65(define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu))
66(defvar menu-bar-files-menu (make-sparse-keymap "File")) 66(defvar menu-bar-file-menu (make-sparse-keymap "File"))
67(define-key global-map [menu-bar files] (cons "File" menu-bar-files-menu)) 67(define-key global-map [menu-bar file] (cons "File" menu-bar-file-menu))
68 68
69;; This alias is for compatibility with 19.28 and before. 69;; This alias is for compatibility with 19.28 and before.
70(defvar menu-bar-file-menu menu-bar-files-menu) 70(defvar menu-bar-files-menu menu-bar-file-menu)
71 71
72;; This is referenced by some code below; it is defined in uniquify.el 72;; This is referenced by some code below; it is defined in uniquify.el
73(defvar uniquify-buffer-name-style) 73(defvar uniquify-buffer-name-style)
74 74
75 75
76;; The "File" menu items 76;; The "File" menu items
77(define-key menu-bar-files-menu [exit-emacs] 77(define-key menu-bar-file-menu [exit-emacs]
78 '(menu-item "Exit Emacs" save-buffers-kill-emacs 78 '(menu-item "Exit Emacs" save-buffers-kill-emacs
79 :help "Save unsaved buffers, then exit")) 79 :help "Save unsaved buffers, then exit"))
80 80
81(define-key menu-bar-files-menu [separator-exit] 81(define-key menu-bar-file-menu [separator-exit]
82 '("--")) 82 '("--"))
83 83
84;; Don't use delete-frame as event name because that is a special 84;; Don't use delete-frame as event name because that is a special
85;; event. 85;; event.
86(define-key menu-bar-files-menu [delete-this-frame] 86(define-key menu-bar-file-menu [delete-this-frame]
87 '(menu-item "Delete Frame" delete-frame 87 '(menu-item "Delete Frame" delete-frame
88 :visible (fboundp 'delete-frame) 88 :visible (fboundp 'delete-frame)
89 :enable (delete-frame-enabled-p) 89 :enable (delete-frame-enabled-p)
90 :help "Delete currently selected frame")) 90 :help "Delete currently selected frame"))
91(define-key menu-bar-files-menu [make-frame-on-display] 91(define-key menu-bar-file-menu [make-frame-on-display]
92 '(menu-item "New Frame on Display..." make-frame-on-display 92 '(menu-item "New Frame on Display..." make-frame-on-display
93 :visible (fboundp 'make-frame-on-display) 93 :visible (fboundp 'make-frame-on-display)
94 :help "Open a new frame on another display")) 94 :help "Open a new frame on another display"))
95(define-key menu-bar-files-menu [make-frame] 95(define-key menu-bar-file-menu [make-frame]
96 '(menu-item "New Frame" make-frame-command 96 '(menu-item "New Frame" make-frame-command
97 :visible (fboundp 'make-frame-command) 97 :visible (fboundp 'make-frame-command)
98 :help "Open a new frame")) 98 :help "Open a new frame"))
99 99
100(define-key menu-bar-files-menu [one-window] 100(define-key menu-bar-file-menu [one-window]
101 '(menu-item "Unsplit Windows" delete-other-windows 101 '(menu-item "Unsplit Windows" delete-other-windows
102 :enable (not (one-window-p t nil)) 102 :enable (not (one-window-p t nil))
103 :help "Make selected window fill its frame")) 103 :help "Make selected window fill its frame"))
104 104
105(define-key menu-bar-files-menu [split-window] 105(define-key menu-bar-file-menu [split-window]
106 '(menu-item "Split Window" split-window-vertically 106 '(menu-item "Split Window" split-window-vertically
107 :help "Split selected window in two")) 107 :help "Split selected window in two"))
108 108
109(define-key menu-bar-files-menu [separator-window] 109(define-key menu-bar-file-menu [separator-window]
110 '(menu-item "--")) 110 '(menu-item "--"))
111 111
112(define-key menu-bar-files-menu [ps-print-region] 112(define-key menu-bar-file-menu [ps-print-region]
113 '(menu-item "Postscript Print Region (B+W)" ps-print-region 113 '(menu-item "Postscript Print Region (B+W)" ps-print-region
114 :enable mark-active 114 :enable mark-active
115 :help "Pretty-print marked region in black and white to PostScript printer")) 115 :help "Pretty-print marked region in black and white to PostScript printer"))
116(define-key menu-bar-files-menu [ps-print-buffer] 116(define-key menu-bar-file-menu [ps-print-buffer]
117 '(menu-item "Postscript Print Buffer (B+W)" ps-print-buffer 117 '(menu-item "Postscript Print Buffer (B+W)" ps-print-buffer
118 :help "Pretty-print current buffer in black and white to PostScript printer")) 118 :help "Pretty-print current buffer in black and white to PostScript printer"))
119(define-key menu-bar-files-menu [ps-print-region-faces] 119(define-key menu-bar-file-menu [ps-print-region-faces]
120 '(menu-item "Postscript Print Region" ps-print-region-with-faces 120 '(menu-item "Postscript Print Region" ps-print-region-with-faces
121 :enable mark-active 121 :enable mark-active
122 :help "Pretty-print marked region to PostScript printer")) 122 :help "Pretty-print marked region to PostScript printer"))
123(define-key menu-bar-files-menu [ps-print-buffer-faces] 123(define-key menu-bar-file-menu [ps-print-buffer-faces]
124 '(menu-item "Postscript Print Buffer" ps-print-buffer-with-faces 124 '(menu-item "Postscript Print Buffer" ps-print-buffer-with-faces
125 :help "Pretty-print current buffer to PostScript printer")) 125 :help "Pretty-print current buffer to PostScript printer"))
126(define-key menu-bar-files-menu [print-region] 126(define-key menu-bar-file-menu [print-region]
127 '(menu-item "Print Region" print-region 127 '(menu-item "Print Region" print-region
128 :enable mark-active 128 :enable mark-active
129 :help "Print region between mark and current position")) 129 :help "Print region between mark and current position"))
130(define-key menu-bar-files-menu [print-buffer] 130(define-key menu-bar-file-menu [print-buffer]
131 '(menu-item "Print Buffer" print-buffer 131 '(menu-item "Print Buffer" print-buffer
132 :help "Print current buffer with page headings")) 132 :help "Print current buffer with page headings"))
133 133
134(define-key menu-bar-files-menu [separator-print] 134(define-key menu-bar-file-menu [separator-print]
135 '(menu-item "--")) 135 '(menu-item "--"))
136 136
137(define-key menu-bar-files-menu [recover-session] 137(define-key menu-bar-file-menu [recover-session]
138 '(menu-item "Recover Crashed Session..." recover-session 138 '(menu-item "Recover Crashed Session..." recover-session
139 :enable (and auto-save-list-file-prefix 139 :enable (and auto-save-list-file-prefix
140 (file-directory-p 140 (file-directory-p
@@ -148,7 +148,7 @@ A large number or nil slows down menu responsiveness."
148 auto-save-list-file-prefix))) 148 auto-save-list-file-prefix)))
149 t)) 149 t))
150 :help "Recover edits from a crashed session")) 150 :help "Recover edits from a crashed session"))
151(define-key menu-bar-files-menu [revert-buffer] 151(define-key menu-bar-file-menu [revert-buffer]
152 '(menu-item "Revert Buffer" revert-buffer 152 '(menu-item "Revert Buffer" revert-buffer
153 :enable (or revert-buffer-function 153 :enable (or revert-buffer-function
154 revert-buffer-insert-file-contents-function 154 revert-buffer-insert-file-contents-function
@@ -157,12 +157,12 @@ A large number or nil slows down menu responsiveness."
157 (not (verify-visited-file-modtime 157 (not (verify-visited-file-modtime
158 (current-buffer)))))) 158 (current-buffer))))))
159 :help "Re-read current buffer from its file")) 159 :help "Re-read current buffer from its file"))
160(define-key menu-bar-files-menu [write-file] 160(define-key menu-bar-file-menu [write-file]
161 '(menu-item "Save Buffer As..." write-file 161 '(menu-item "Save Buffer As..." write-file
162 :enable (not (window-minibuffer-p 162 :enable (not (window-minibuffer-p
163 (frame-selected-window menu-updating-frame))) 163 (frame-selected-window menu-updating-frame)))
164 :help "Write current buffer to another file")) 164 :help "Write current buffer to another file"))
165(define-key menu-bar-files-menu [save-buffer] 165(define-key menu-bar-file-menu [save-buffer]
166 '(menu-item "Save (current buffer)" save-buffer 166 '(menu-item "Save (current buffer)" save-buffer
167 :enable (and (buffer-modified-p) 167 :enable (and (buffer-modified-p)
168 (buffer-file-name) 168 (buffer-file-name)
@@ -170,27 +170,27 @@ A large number or nil slows down menu responsiveness."
170 (frame-selected-window menu-updating-frame)))) 170 (frame-selected-window menu-updating-frame))))
171 :help "Save current buffer to its file")) 171 :help "Save current buffer to its file"))
172 172
173(define-key menu-bar-files-menu [separator-save] 173(define-key menu-bar-file-menu [separator-save]
174 '(menu-item "--")) 174 '(menu-item "--"))
175 175
176(define-key menu-bar-files-menu [kill-buffer] 176(define-key menu-bar-file-menu [kill-buffer]
177 '(menu-item "Close (current buffer)" kill-this-buffer 177 '(menu-item "Close (current buffer)" kill-this-buffer
178 :enable (kill-this-buffer-enabled-p) 178 :enable (kill-this-buffer-enabled-p)
179 :help "Discard current buffer")) 179 :help "Discard current buffer"))
180(define-key menu-bar-files-menu [insert-file] 180(define-key menu-bar-file-menu [insert-file]
181 '(menu-item "Insert File..." insert-file 181 '(menu-item "Insert File..." insert-file
182 :enable (not (window-minibuffer-p 182 :enable (not (window-minibuffer-p
183 (frame-selected-window menu-updating-frame))) 183 (frame-selected-window menu-updating-frame)))
184 :help "Insert another file into current buffer")) 184 :help "Insert another file into current buffer"))
185(define-key menu-bar-files-menu [dired] 185(define-key menu-bar-file-menu [dired]
186 '(menu-item "Open Directory..." dired 186 '(menu-item "Open Directory..." dired
187 :help "Read a directory, operate on its files")) 187 :help "Read a directory, operate on its files"))
188(define-key menu-bar-files-menu [open-file] 188(define-key menu-bar-file-menu [open-file]
189 '(menu-item "Open File..." find-file-existing 189 '(menu-item "Open File..." find-file-existing
190 :enable (not (window-minibuffer-p 190 :enable (not (window-minibuffer-p
191 (frame-selected-window menu-updating-frame))) 191 (frame-selected-window menu-updating-frame)))
192 :help "Read an existing file into an Emacs buffer")) 192 :help "Read an existing file into an Emacs buffer"))
193(define-key menu-bar-files-menu [new-file] 193(define-key menu-bar-file-menu [new-file]
194 '(menu-item "New File..." find-file 194 '(menu-item "New File..." find-file
195 :enable (not (window-minibuffer-p 195 :enable (not (window-minibuffer-p
196 (frame-selected-window menu-updating-frame))) 196 (frame-selected-window menu-updating-frame)))
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 0194160bcf4..231b7c3d6e3 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -1,6 +1,6 @@
1;;; mwheel.el --- Wheel mouse support 1;;; mwheel.el --- Wheel mouse support
2 2
3;; Copyright (C) 1998,2000,2001,2002 Free Software Foundation, Inc. 3;; Copyright (C) 1998, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
4;; Maintainer: William M. Perry <wmperry@gnu.org> 4;; Maintainer: William M. Perry <wmperry@gnu.org>
5;; Keywords: mouse 5;; Keywords: mouse
6 6
@@ -137,7 +137,7 @@ less than a full screen."
137 (integer :tag "Specific # of lines") 137 (integer :tag "Specific # of lines")
138 (float :tag "Fraction of window")))))) 138 (float :tag "Fraction of window"))))))
139 139
140(defcustom mouse-wheel-progessive-speed t 140(defcustom mouse-wheel-progressive-speed t
141 "If non-nil, the faster the user moves the wheel, the faster the scrolling. 141 "If non-nil, the faster the user moves the wheel, the faster the scrolling.
142Note that this has no effect when `mouse-wheel-scroll-amount' specifies 142Note that this has no effect when `mouse-wheel-scroll-amount' specifies
143a \"near full screen\" scroll or when the mouse wheel sends key instead 143a \"near full screen\" scroll or when the mouse wheel sends key instead
@@ -197,7 +197,7 @@ This should only be bound to mouse buttons 4 and 5."
197 (let ((list-elt mouse-wheel-scroll-amount)) 197 (let ((list-elt mouse-wheel-scroll-amount))
198 (while (consp (setq amt (pop list-elt)))))) 198 (while (consp (setq amt (pop list-elt))))))
199 (if (floatp amt) (setq amt (1+ (truncate (* amt (window-height)))))) 199 (if (floatp amt) (setq amt (1+ (truncate (* amt (window-height))))))
200 (when (and mouse-wheel-progessive-speed (numberp amt)) 200 (when (and mouse-wheel-progressive-speed (numberp amt))
201 ;; When the double-mouse-N comes in, a mouse-N has been executed already, 201 ;; When the double-mouse-N comes in, a mouse-N has been executed already,
202 ;; So by adding things up we get a squaring up (1, 3, 6, 10, 15, ...). 202 ;; So by adding things up we get a squaring up (1, 3, 6, 10, 15, ...).
203 (setq amt (* amt (event-click-count event)))) 203 (setq amt (* amt (event-click-count event))))
@@ -250,5 +250,5 @@ Returns non-nil if the new state is enabled."
250 250
251(provide 'mwheel) 251(provide 'mwheel)
252 252
253;;; arch-tag: 50ed00e7-3686-4b7a-8037-fb31aa5c237f 253;; arch-tag: 50ed00e7-3686-4b7a-8037-fb31aa5c237f
254;;; mwheel.el ends here 254;;; mwheel.el ends here
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index c5a2218e36e..098f2988f1b 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -357,6 +357,15 @@ Defaults to the value of `browse-url-epiphany-arguments' at the time
357 :type '(repeat (string :tag "Argument")) 357 :type '(repeat (string :tag "Argument"))
358 :group 'browse-url) 358 :group 'browse-url)
359 359
360;; GNOME means of invoking either Mozilla or Netrape.
361(defvar browse-url-gnome-moz-program "gnome-moz-remote")
362
363(defcustom browse-url-gnome-moz-arguments '()
364 "*A list of strings passed to the GNOME mozilla viewer as arguments."
365 :version "21.1"
366 :type '(repeat (string :tag "Argument"))
367 :group 'browse-url)
368
360(defcustom browse-url-mozilla-new-window-is-tab nil 369(defcustom browse-url-mozilla-new-window-is-tab nil
361 "*Whether to open up new windows in a tab or a new window. 370 "*Whether to open up new windows in a tab or a new window.
362If non-nil, then open the URL in a new tab rather than a new window if 371If non-nil, then open the URL in a new tab rather than a new window if
@@ -1032,14 +1041,6 @@ used instead of `browse-url-new-window-flag'."
1032 browse-url-epiphany-program 1041 browse-url-epiphany-program
1033 (append browse-url-epiphany-startup-arguments (list url)))))) 1042 (append browse-url-epiphany-startup-arguments (list url))))))
1034 1043
1035;; GNOME means of invoking either Mozilla or Netrape.
1036(defvar browse-url-gnome-moz-program "gnome-moz-remote")
1037(defcustom browse-url-gnome-moz-arguments '()
1038 "*A list of strings passed to the GNOME mozilla viewer as arguments."
1039 :version "21.1"
1040 :type '(repeat (string :tag "Argument"))
1041 :group 'browse-url)
1042
1043;;;###autoload 1044;;;###autoload
1044(defun browse-url-gnome-moz (url &optional new-window) 1045(defun browse-url-gnome-moz (url &optional new-window)
1045 "Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'. 1046 "Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e153ab3341f..502dc5e5115 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -159,7 +159,8 @@ Nil means to use a separate filename syntax for Tramp.")
159 159
160(defgroup tramp nil 160(defgroup tramp nil
161 "Edit remote files with a combination of rsh and rcp or similar programs." 161 "Edit remote files with a combination of rsh and rcp or similar programs."
162 :group 'files) 162 :group 'files
163 :version "21.4")
163 164
164(defcustom tramp-verbose 9 165(defcustom tramp-verbose 9
165 "*Verbosity level for tramp.el. 0 means be silent, 10 is most verbose." 166 "*Verbosity level for tramp.el. 0 means be silent, 10 is most verbose."
diff --git a/lisp/paren.el b/lisp/paren.el
index 6c5f9dece99..10695a41098 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -139,8 +139,8 @@ in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time."
139(defun show-paren-function () 139(defun show-paren-function ()
140 (if show-paren-mode 140 (if show-paren-mode
141 (let ((oldpos (point)) 141 (let ((oldpos (point))
142 (dir (cond ((eq (car (syntax-after (1- (point)))) 5) -1) 142 (dir (cond ((eq (car (syntax-after (1- (point)))) ?\)) -1)
143 ((eq (car (syntax-after (point))) 4) 1))) 143 ((eq (car (syntax-after (point))) ?\() 1)))
144 pos mismatch face) 144 pos mismatch face)
145 ;; 145 ;;
146 ;; Find the other end of the sexp. 146 ;; Find the other end of the sexp.
diff --git a/lisp/pcvs.el b/lisp/pcvs.el
index 0a666927c52..0c8fe92f2d6 100644
--- a/lisp/pcvs.el
+++ b/lisp/pcvs.el
@@ -1,7 +1,7 @@
1;;; pcvs.el --- a front-end to CVS 1;;; pcvs.el --- a front-end to CVS
2 2
3;; Copyright (C) 1991,92,93,94,95,95,97,98,99,2000,02,03,2004 3;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4;; Free Software Foundation, Inc. 4;; 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
5 5
6;; Author: (The PCL-CVS Trust) pcl-cvs@cyclic.com 6;; Author: (The PCL-CVS Trust) pcl-cvs@cyclic.com
7;; (Per Cederqvist) ceder@lysator.liu.se 7;; (Per Cederqvist) ceder@lysator.liu.se
@@ -923,6 +923,21 @@ With a prefix argument, prompt for cvs FLAGS to use."
923 (append flags modules) nil 'new 923 (append flags modules) nil 'new
924 :noexist t)) 924 :noexist t))
925 925
926(defun-cvs-mode (cvs-mode-checkout . NOARGS) (dir)
927 "Run cvs checkout against the current branch.
928The files are stored to DIR."
929 (interactive
930 (let* ((branch (cvs-prefix-get 'cvs-branch-prefix))
931 (prompt (format "CVS Checkout Directory for `%s%s': "
932 (cvs-get-module)
933 (if branch (format " (branch: %s)" branch)
934 ""))))
935 (list (read-directory-name prompt nil default-directory nil))))
936 (let ((modules (cvs-string->strings (cvs-get-module)))
937 (flags (cvs-add-branch-prefix
938 (cvs-flags-query 'cvs-checkout-flags "cvs checkout flags")))
939 (cvs-cvsroot (cvs-get-cvsroot)))
940 (cvs-checkout modules dir flags)))
926 941
927;;;; 942;;;;
928;;;; The code for running a "cvs update" and friends in various ways. 943;;;; The code for running a "cvs update" and friends in various ways.
@@ -2353,5 +2368,5 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
2353 2368
2354(provide 'pcvs) 2369(provide 'pcvs)
2355 2370
2356;;; arch-tag: 8e3a7494-0453-4389-9ab3-a557ce9fab61 2371;; arch-tag: 8e3a7494-0453-4389-9ab3-a557ce9fab61
2357;;; pcvs.el ends here 2372;;; pcvs.el ends here
diff --git a/lisp/printing.el b/lisp/printing.el
index 3efb53111fd..003e6893428 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -5,13 +5,13 @@
5 5
6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8;; Time-stamp: <2004/09/26 22:11:24 vinicius> 8;; Time-stamp: <2004/11/11 23:54:13 vinicius>
9;; Keywords: wp, print, PostScript 9;; Keywords: wp, print, PostScript
10;; Version: 6.8.1 10;; Version: 6.8.2
11;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ 11;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
12 12
13(defconst pr-version "6.8.1" 13(defconst pr-version "6.8.2"
14 "printing.el, v 6.8.1 <2004/09/26 vinicius> 14 "printing.el, v 6.8.2 <2004/11/11 vinicius>
15 15
16Please send all bug fixes and enhancements to 16Please send all bug fixes and enhancements to
17 Vinicius Jose Latorre <viniciusjl@ig.com.br> 17 Vinicius Jose Latorre <viniciusjl@ig.com.br>
@@ -1099,6 +1099,7 @@ Unless optional argument INPLACE is non-nil, return a new string."
1099 :tag "Printing Utilities" 1099 :tag "Printing Utilities"
1100 :link '(emacs-library-link :tag "Source Lisp File" "printing.el") 1100 :link '(emacs-library-link :tag "Source Lisp File" "printing.el")
1101 :prefix "pr-" 1101 :prefix "pr-"
1102 :version "20"
1102 :group 'wp 1103 :group 'wp
1103 :group 'postscript) 1104 :group 'postscript)
1104 1105
@@ -2474,20 +2475,16 @@ See `pr-ps-printer-alist'.")
2474 2475
2475(eval-and-compile 2476(eval-and-compile
2476 (defun pr-get-symbol (name) 2477 (defun pr-get-symbol (name)
2477 ;; Recent versions of easy-menu downcase names before interning them. 2478 (easy-menu-intern name))
2478 (and (fboundp 'easy-menu-name-match)
2479 (setq name (downcase name)))
2480 (or (intern-soft name)
2481 (make-symbol name)))
2482 2479
2483 (cond 2480 (cond
2484 ((eq ps-print-emacs-type 'emacs) ; GNU Emacs 2481 ((eq ps-print-emacs-type 'emacs) ; GNU Emacs
2485 (defsubst pr-region-active-p () 2482 (defun pr-region-active-p ()
2486 (and pr-auto-region transient-mark-mode mark-active))) 2483 (and pr-auto-region transient-mark-mode mark-active)))
2487 2484
2488 ((eq ps-print-emacs-type 'xemacs) ; XEmacs 2485 ((eq ps-print-emacs-type 'xemacs) ; XEmacs
2489 (defvar zmacs-region-stays nil) ; to avoid compilation gripes 2486 (defvar zmacs-region-stays nil) ; to avoid compilation gripes
2490 (defsubst pr-region-active-p () 2487 (defun pr-region-active-p ()
2491 (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p))))) 2488 (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p)))))
2492 2489
2493 2490
@@ -2907,18 +2904,18 @@ See `pr-ps-printer-alist'.")
2907 (pr-get-symbol "Printing"))))) 2904 (pr-get-symbol "Printing")))))
2908 ;; Emacs 21 2905 ;; Emacs 21
2909 (pr-menu-print-item 2906 (pr-menu-print-item
2910 (easy-menu-change '("files") "Print" pr-menu-spec "print-buffer") 2907 (easy-menu-change '("file") "Print" pr-menu-spec "print-buffer")
2911 (let ((items '("print-buffer" "print-region" 2908 (let ((items '("print-buffer" "print-region"
2912 "ps-print-buffer-faces" "ps-print-region-faces" 2909 "ps-print-buffer-faces" "ps-print-region-faces"
2913 "ps-print-buffer" "ps-print-region"))) 2910 "ps-print-buffer" "ps-print-region")))
2914 (while items 2911 (while items
2915 (easy-menu-remove-item nil '("files") (car items)) 2912 (easy-menu-remove-item nil '("file") (car items))
2916 (setq items (cdr items))) 2913 (setq items (cdr items)))
2917 (setq pr-menu-print-item nil 2914 (setq pr-menu-print-item nil
2918 pr-menu-bar (vector 'menu-bar 'files 2915 pr-menu-bar (vector 'menu-bar 'file
2919 (pr-get-symbol "Print"))))) 2916 (pr-get-symbol "Print")))))
2920 (t 2917 (t
2921 (easy-menu-change '("files") "Print" pr-menu-spec))) 2918 (easy-menu-change '("file") "Print" pr-menu-spec)))
2922 2919
2923 ;; Key binding 2920 ;; Key binding
2924 (global-set-key [print] 'pr-ps-fast-fire) 2921 (global-set-key [print] 'pr-ps-fast-fire)
@@ -6385,5 +6382,5 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
6385(provide 'printing) 6382(provide 'printing)
6386 6383
6387 6384
6388;;; arch-tag: 9ce9ac3f-0f60-4370-900b-1943215d9d18 6385;; arch-tag: 9ce9ac3f-0f60-4370-900b-1943215d9d18
6389;;; printing.el ends here 6386;;; printing.el ends here
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 472cfc3053e..e7eb0657eac 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -1292,7 +1292,7 @@ If ARG is non-nil, ask the user to confirm the command."
1292 1292
1293 ;; Move to the end of the debugger buffer, so that it is automatically 1293 ;; Move to the end of the debugger buffer, so that it is automatically
1294 ;; scrolled from then on. 1294 ;; scrolled from then on.
1295 (end-of-buffer) 1295 (goto-char (point-max))
1296 1296
1297 ;; Display both the source window and the debugger window (the former 1297 ;; Display both the source window and the debugger window (the former
1298 ;; above the latter). No need to show the debugger window unless it 1298 ;; above the latter). No need to show the debugger window unless it
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 223455e9872..034cdaf5fdd 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -785,11 +785,14 @@ the function in `compilation-buffer-name-function', so you can set that
785to a function that generates a unique name." 785to a function that generates a unique name."
786 (interactive 786 (interactive
787 (list 787 (list
788 (if (or compilation-read-command current-prefix-arg) 788 (let ((command (eval compile-command)))
789 (read-from-minibuffer "Compile command: " 789 (if (or compilation-read-command current-prefix-arg)
790 (eval compile-command) nil nil 790 (read-from-minibuffer "Compile command: "
791 '(compile-history . 1)) 791 command nil nil
792 (eval compile-command)) 792 (if (equal (car compile-history) command)
793 '(compile-history . 1)
794 'compile-history))
795 command))
793 (consp current-prefix-arg))) 796 (consp current-prefix-arg)))
794 (unless (equal command (eval compile-command)) 797 (unless (equal command (eval compile-command))
795 (setq compile-command command)) 798 (setq compile-command command))
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 94458df56e8..38cc167d942 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -5292,7 +5292,7 @@ Customized by setting variables `cperl-shrink-wrap-info-frame',
5292 iniwin (selected-window) 5292 iniwin (selected-window)
5293 fr1 (window-frame iniwin)) 5293 fr1 (window-frame iniwin))
5294 (set-buffer buf) 5294 (set-buffer buf)
5295 (beginning-of-buffer) 5295 (goto-char (point-min))
5296 (or isvar 5296 (or isvar
5297 (progn (re-search-forward "^-X[ \t\n]") 5297 (progn (re-search-forward "^-X[ \t\n]")
5298 (forward-line -1))) 5298 (forward-line -1)))
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 74368661d3e..cf2b0797e82 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -60,6 +60,7 @@
60(defvar gdb-previous-address nil) 60(defvar gdb-previous-address nil)
61(defvar gdb-previous-frame nil) 61(defvar gdb-previous-frame nil)
62(defvar gdb-current-frame nil) 62(defvar gdb-current-frame nil)
63(defvar gdb-current-stack-level nil)
63(defvar gdb-current-language nil) 64(defvar gdb-current-language nil)
64(defvar gdb-view-source t "Non-nil means that source code can be viewed.") 65(defvar gdb-view-source t "Non-nil means that source code can be viewed.")
65(defvar gdb-selected-view 'source "Code type that user wishes to view.") 66(defvar gdb-selected-view 'source "Code type that user wishes to view.")
@@ -183,6 +184,7 @@ detailed description of this mode.
183 (setq gdb-previous-address nil) 184 (setq gdb-previous-address nil)
184 (setq gdb-previous-frame nil) 185 (setq gdb-previous-frame nil)
185 (setq gdb-current-frame nil) 186 (setq gdb-current-frame nil)
187 (setq gdb-current-stack-level nil)
186 (setq gdb-view-source t) 188 (setq gdb-view-source t)
187 (setq gdb-selected-view 'source) 189 (setq gdb-selected-view 'source)
188 (setq gdb-var-list nil) 190 (setq gdb-var-list nil)
@@ -393,7 +395,8 @@ detailed description of this mode.
393 "If non-nil highlight values that have recently changed in the speedbar. 395 "If non-nil highlight values that have recently changed in the speedbar.
394The highlighting is done with `font-lock-warning-face'." 396The highlighting is done with `font-lock-warning-face'."
395 :type 'boolean 397 :type 'boolean
396 :group 'gud) 398 :group 'gud
399 :version "21.4")
397 400
398(defun gdb-speedbar-expand-node (text token indent) 401(defun gdb-speedbar-expand-node (text token indent)
399 "Expand the node the user clicked on. 402 "Expand the node the user clicked on.
@@ -1291,9 +1294,8 @@ static char *magick[] = {
1291 '(mouse-face highlight 1294 '(mouse-face highlight
1292 help-echo "mouse-2, RET: Select frame")) 1295 help-echo "mouse-2, RET: Select frame"))
1293 (beginning-of-line) 1296 (beginning-of-line)
1294 (when (and (or (looking-at "^#[0-9]*\\s-*\\S-* in \\(\\S-*\\)") 1297 (when (and (looking-at "^#\\([0-9]+\\)")
1295 (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)")) 1298 (equal (match-string 1) gdb-current-stack-level))
1296 (equal (match-string 1) gdb-current-frame))
1297 (put-text-property (point-at-bol) (point-at-eol) 1299 (put-text-property (point-at-bol) (point-at-eol)
1298 'face '(:inverse-video t))) 1300 'face '(:inverse-video t)))
1299 (forward-line 1)))))) 1301 (forward-line 1))))))
@@ -2047,6 +2049,8 @@ BUFFER nil or omitted means use the current buffer."
2047 (delq 'gdb-get-current-frame gdb-pending-triggers)) 2049 (delq 'gdb-get-current-frame gdb-pending-triggers))
2048 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) 2050 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
2049 (goto-char (point-min)) 2051 (goto-char (point-min))
2052 (if (looking-at "Stack level \\([0-9]+\\)")
2053 (setq gdb-current-stack-level (match-string 1)))
2050 (forward-line) 2054 (forward-line)
2051 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ") 2055 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ")
2052 (progn 2056 (progn
diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el
index 692fce0234e..6720014ed31 100644
--- a/lisp/progmodes/idlw-shell.el
+++ b/lisp/progmodes/idlw-shell.el
@@ -508,11 +508,19 @@ the expression output by IDL."
508(defvar comint-last-input-start) 508(defvar comint-last-input-start)
509(defvar comint-last-input-end) 509(defvar comint-last-input-end)
510 510
511(defvar idlwave-shell-temp-pro-file nil
512 "Absolute pathname for temporary IDL file for compiling regions")
513
514(defvar idlwave-shell-temp-rinfo-save-file nil
515 "Absolute pathname for temporary IDL file save file for routine_info.
516This is used to speed up the reloading of the routine info procedure
517before use by the shell.")
518
511(defun idlwave-shell-temp-file (type) 519(defun idlwave-shell-temp-file (type)
512 "Return a temp file, creating it if necessary. 520 "Return a temp file, creating it if necessary.
513 521
514TYPE is either 'pro or 'rinfo, and idlwave-shell-temp-pro-file or 522TYPE is either `pro' or `rinfo', and `idlwave-shell-temp-pro-file' or
515idlwave-shell-temp-rinfo-save-file is set (respectively)." 523`idlwave-shell-temp-rinfo-save-file' is set (respectively)."
516 (cond 524 (cond
517 ((eq type 'rinfo) 525 ((eq type 'rinfo)
518 (or idlwave-shell-temp-rinfo-save-file 526 (or idlwave-shell-temp-rinfo-save-file
@@ -550,17 +558,6 @@ idlwave-shell-temp-rinfo-save-file is set (respectively)."
550 nil) 558 nil)
551 file))) 559 file)))
552 560
553;; Other variables
554(defvar idlwave-shell-temp-pro-file
555 nil
556 "Absolute pathname for temporary IDL file for compiling regions")
557
558(defvar idlwave-shell-temp-rinfo-save-file
559 nil
560 "Absolute pathname for temporary IDL file save file for routine_info.
561This is used to speed up the reloading of the routine info procedure
562before use by the shell.")
563
564(defvar idlwave-shell-dirstack-query "cd,current=___cur & print,___cur" 561(defvar idlwave-shell-dirstack-query "cd,current=___cur & print,___cur"
565 "Command used by `idlwave-shell-resync-dirs' to query IDL for 562 "Command used by `idlwave-shell-resync-dirs' to query IDL for
566the directory stack.") 563the directory stack.")
@@ -2523,6 +2520,10 @@ idlw-shell-examine-alist from which to select the help command text."
2523(defvar idlwave-shell-examine-window-alist nil 2520(defvar idlwave-shell-examine-window-alist nil
2524 "Variable to hold the win/height pairs for all *Examine* windows.") 2521 "Variable to hold the win/height pairs for all *Examine* windows.")
2525 2522
2523(defvar idlwave-shell-examine-map (make-sparse-keymap))
2524(define-key idlwave-shell-examine-map "q" 'idlwave-shell-examine-display-quit)
2525(define-key idlwave-shell-examine-map "c" 'idlwave-shell-examine-display-clear)
2526
2526(defun idlwave-shell-examine-display () 2527(defun idlwave-shell-examine-display ()
2527 "View the examine command output in a separate buffer." 2528 "View the examine command output in a separate buffer."
2528 (let (win cur-beg cur-end) 2529 (let (win cur-beg cur-end)
@@ -2603,10 +2604,6 @@ idlw-shell-examine-alist from which to select the help command text."
2603 (skip-chars-backward "\n") 2604 (skip-chars-backward "\n")
2604 (recenter -1))))) 2605 (recenter -1)))))
2605 2606
2606(defvar idlwave-shell-examine-map (make-sparse-keymap))
2607(define-key idlwave-shell-examine-map "q" 'idlwave-shell-examine-display-quit)
2608(define-key idlwave-shell-examine-map "c" 'idlwave-shell-examine-display-clear)
2609
2610(defun idlwave-shell-examine-display-quit () 2607(defun idlwave-shell-examine-display-quit ()
2611 (interactive) 2608 (interactive)
2612 (let ((win (selected-window))) 2609 (let ((win (selected-window)))
diff --git a/lisp/simple.el b/lisp/simple.el
index b45d9eee348..8f38dfde2ec 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -67,6 +67,44 @@
67 (switch-to-buffer found))) 67 (switch-to-buffer found)))
68 68
69;;; next-error support framework 69;;; next-error support framework
70
71(defgroup next-error nil
72 "next-error support framework."
73 :group 'compilation
74 :version "21.4")
75
76(defface next-error
77 '((t (:inherit region)))
78 "Face used to highlight next error locus."
79 :group 'next-error
80 :version "21.4")
81
82(defcustom next-error-highlight 0.1
83 "*Highlighting of locations in selected source buffers.
84If number, highlight the locus in next-error face for given time in seconds.
85If t, use persistent overlays fontified in next-error face.
86If nil, don't highlight the locus in the source buffer.
87If `fringe-arrow', indicate the locus by the fringe arrow."
88 :type '(choice (number :tag "Delay")
89 (const :tag "Persistent overlay" t)
90 (const :tag "No highlighting" nil)
91 (const :tag "Fringe arrow" 'fringe-arrow))
92 :group 'next-error
93 :version "21.4")
94
95(defcustom next-error-highlight-no-select 0.1
96 "*Highlighting of locations in non-selected source buffers.
97If number, highlight the locus in next-error face for given time in seconds.
98If t, use persistent overlays fontified in next-error face.
99If nil, don't highlight the locus in the source buffer.
100If `fringe-arrow', indicate the locus by the fringe arrow."
101 :type '(choice (number :tag "Delay")
102 (const :tag "Persistent overlay" t)
103 (const :tag "No highlighting" nil)
104 (const :tag "Fringe arrow" 'fringe-arrow))
105 :group 'next-error
106 :version "21.4")
107
70(defvar next-error-last-buffer nil 108(defvar next-error-last-buffer nil
71 "The most recent next-error buffer. 109 "The most recent next-error buffer.
72A buffer becomes most recent when its compilation, grep, or 110A buffer becomes most recent when its compilation, grep, or
@@ -213,43 +251,6 @@ select the source buffer."
213 (interactive "p") 251 (interactive "p")
214 (next-error-no-select (- (or n 1)))) 252 (next-error-no-select (- (or n 1))))
215 253
216(defgroup next-error nil
217 "next-error support framework."
218 :group 'compilation
219 :version "21.4")
220
221(defface next-error
222 '((t (:inherit region)))
223 "Face used to highlight next error locus."
224 :group 'next-error
225 :version "21.4")
226
227(defcustom next-error-highlight 0.1
228 "*Highlighting of locations in selected source buffers.
229If number, highlight the locus in next-error face for given time in seconds.
230If t, use persistent overlays fontified in next-error face.
231If nil, don't highlight the locus in the source buffer.
232If `fringe-arrow', indicate the locus by the fringe arrow."
233 :type '(choice (number :tag "Delay")
234 (const :tag "Persistent overlay" t)
235 (const :tag "No highlighting" nil)
236 (const :tag "Fringe arrow" 'fringe-arrow))
237 :group 'next-error
238 :version "21.4")
239
240(defcustom next-error-highlight-no-select 0.1
241 "*Highlighting of locations in non-selected source buffers.
242If number, highlight the locus in next-error face for given time in seconds.
243If t, use persistent overlays fontified in next-error face.
244If nil, don't highlight the locus in the source buffer.
245If `fringe-arrow', indicate the locus by the fringe arrow."
246 :type '(choice (number :tag "Delay")
247 (const :tag "Persistent overlay" t)
248 (const :tag "No highlighting" nil)
249 (const :tag "Fringe arrow" 'fringe-arrow))
250 :group 'next-error
251 :version "21.4")
252
253;;; Internal variable for `next-error-follow-mode-post-command-hook'. 254;;; Internal variable for `next-error-follow-mode-post-command-hook'.
254(defvar next-error-follow-last-line nil) 255(defvar next-error-follow-last-line nil)
255 256
@@ -2284,6 +2285,8 @@ This command is similar to `copy-region-as-kill', except that it gives
2284visual feedback indicating the extent of the region being copied." 2285visual feedback indicating the extent of the region being copied."
2285 (interactive "r") 2286 (interactive "r")
2286 (copy-region-as-kill beg end) 2287 (copy-region-as-kill beg end)
2288 ;; This use of interactive-p is correct
2289 ;; because the code it controls just gives the user visual feedback.
2287 (if (interactive-p) 2290 (if (interactive-p)
2288 (let ((other-end (if (= (point) beg) end beg)) 2291 (let ((other-end (if (= (point) beg) end beg))
2289 (opoint (point)) 2292 (opoint (point))
@@ -3085,13 +3088,13 @@ It is the column where point was
3085at the start of current run of vertical motion commands. 3088at the start of current run of vertical motion commands.
3086When the `track-eol' feature is doing its job, the value is 9999.") 3089When the `track-eol' feature is doing its job, the value is 9999.")
3087 3090
3088(defcustom line-move-ignore-invisible nil 3091(defcustom line-move-ignore-invisible t
3089 "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines. 3092 "*Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
3090Outline mode sets this." 3093Outline mode sets this."
3091 :type 'boolean 3094 :type 'boolean
3092 :group 'editing-basics) 3095 :group 'editing-basics)
3093 3096
3094(defun line-move-invisible (pos) 3097(defun line-move-invisible-p (pos)
3095 "Return non-nil if the character after POS is currently invisible." 3098 "Return non-nil if the character after POS is currently invisible."
3096 (let ((prop 3099 (let ((prop
3097 (get-char-property pos 'invisible))) 3100 (get-char-property pos 'invisible)))
@@ -3102,7 +3105,8 @@ Outline mode sets this."
3102 3105
3103;; This is the guts of next-line and previous-line. 3106;; This is the guts of next-line and previous-line.
3104;; Arg says how many lines to move. 3107;; Arg says how many lines to move.
3105(defun line-move (arg) 3108;; The value is t if we can move the specified number of lines.
3109(defun line-move (arg &optional noerror to-end)
3106 ;; Don't run any point-motion hooks, and disregard intangibility, 3110 ;; Don't run any point-motion hooks, and disregard intangibility,
3107 ;; for intermediate positions. 3111 ;; for intermediate positions.
3108 (let ((inhibit-point-motion-hooks t) 3112 (let ((inhibit-point-motion-hooks t)
@@ -3118,6 +3122,7 @@ Outline mode sets this."
3118 (or (not (bolp)) (eq last-command 'end-of-line))) 3122 (or (not (bolp)) (eq last-command 'end-of-line)))
3119 9999 3123 9999
3120 (current-column)))) 3124 (current-column))))
3125
3121 (if (and (not (integerp selective-display)) 3126 (if (and (not (integerp selective-display))
3122 (not line-move-ignore-invisible)) 3127 (not line-move-ignore-invisible))
3123 ;; Use just newline characters. 3128 ;; Use just newline characters.
@@ -3133,28 +3138,43 @@ Outline mode sets this."
3133 (and (zerop (forward-line arg)) 3138 (and (zerop (forward-line arg))
3134 (bolp) 3139 (bolp)
3135 (setq arg 0))) 3140 (setq arg 0)))
3136 (signal (if (< arg 0) 3141 (unless noerror
3137 'beginning-of-buffer 3142 (signal (if (< arg 0)
3138 'end-of-buffer) 3143 'beginning-of-buffer
3139 nil)) 3144 'end-of-buffer)
3145 nil)))
3140 ;; Move by arg lines, but ignore invisible ones. 3146 ;; Move by arg lines, but ignore invisible ones.
3141 (while (> arg 0) 3147 (let (done)
3142 ;; If the following character is currently invisible, 3148 (while (and (> arg 0) (not done))
3143 ;; skip all characters with that same `invisible' property value. 3149 ;; If the following character is currently invisible,
3144 (while (and (not (eobp)) (line-move-invisible (point))) 3150 ;; skip all characters with that same `invisible' property value.
3145 (goto-char (next-char-property-change (point)))) 3151 (while (and (not (eobp)) (line-move-invisible-p (point)))
3146 ;; Now move a line. 3152 (goto-char (next-char-property-change (point))))
3147 (end-of-line) 3153 ;; Now move a line.
3148 (and (zerop (vertical-motion 1)) 3154 (end-of-line)
3149 (signal 'end-of-buffer nil)) 3155 (and (zerop (vertical-motion 1))
3150 (setq arg (1- arg))) 3156 (if (not noerror)
3151 (while (< arg 0) 3157 (signal 'end-of-buffer nil)
3152 (beginning-of-line) 3158 (setq done t)))
3153 (and (zerop (vertical-motion -1)) 3159 (unless done
3154 (signal 'beginning-of-buffer nil)) 3160 (setq arg (1- arg))))
3155 (setq arg (1+ arg)) 3161 (while (and (< arg 0) (not done))
3156 (while (and (not (bobp)) (line-move-invisible (1- (point)))) 3162 (beginning-of-line)
3157 (goto-char (previous-char-property-change (point))))))) 3163
3164 (if (zerop (vertical-motion -1))
3165 (if (not noerror)
3166 (signal 'beginning-of-buffer nil)
3167 (setq done t)))
3168 (unless done
3169 (setq arg (1+ arg))
3170 (while (and ;; Don't move over previous invis lines
3171 ;; if our target is the middle of this line.
3172 (or (zerop (or goal-column temporary-goal-column))
3173 (< arg 0))
3174 (not (bobp)) (line-move-invisible-p (1- (point))))
3175 (goto-char (previous-char-property-change (point))))))))
3176 ;; This is the value the function returns.
3177 (= arg 0))
3158 3178
3159 (cond ((> arg 0) 3179 (cond ((> arg 0)
3160 ;; If we did not move down as far as desired, 3180 ;; If we did not move down as far as desired,
@@ -3165,8 +3185,7 @@ Outline mode sets this."
3165 ;; at least go to end of line. 3185 ;; at least go to end of line.
3166 (beginning-of-line)) 3186 (beginning-of-line))
3167 (t 3187 (t
3168 (line-move-finish (or goal-column temporary-goal-column) opoint))))) 3188 (line-move-finish (or goal-column temporary-goal-column) opoint))))))
3169 nil)
3170 3189
3171(defun line-move-finish (column opoint) 3190(defun line-move-finish (column opoint)
3172 (let ((repeat t)) 3191 (let ((repeat t))
@@ -3179,9 +3198,11 @@ Outline mode sets this."
3179 (line-end 3198 (line-end
3180 ;; Compute the end of the line 3199 ;; Compute the end of the line
3181 ;; ignoring effectively intangible newlines. 3200 ;; ignoring effectively intangible newlines.
3182 (let ((inhibit-point-motion-hooks nil) 3201 (save-excursion
3183 (inhibit-field-text-motion t)) 3202 (let ((inhibit-point-motion-hooks nil)
3184 (save-excursion (end-of-line) (point))))) 3203 (inhibit-field-text-motion t))
3204 (end-of-line))
3205 (point))))
3185 3206
3186 ;; Move to the desired column. 3207 ;; Move to the desired column.
3187 (line-move-to-column column) 3208 (line-move-to-column column)
@@ -3232,13 +3253,13 @@ and `current-column' to be able to ignore invisible text."
3232 (move-to-column col)) 3253 (move-to-column col))
3233 3254
3234 (when (and line-move-ignore-invisible 3255 (when (and line-move-ignore-invisible
3235 (not (bolp)) (line-move-invisible (1- (point)))) 3256 (not (bolp)) (line-move-invisible-p (1- (point))))
3236 (let ((normal-location (point)) 3257 (let ((normal-location (point))
3237 (normal-column (current-column))) 3258 (normal-column (current-column)))
3238 ;; If the following character is currently invisible, 3259 ;; If the following character is currently invisible,
3239 ;; skip all characters with that same `invisible' property value. 3260 ;; skip all characters with that same `invisible' property value.
3240 (while (and (not (eobp)) 3261 (while (and (not (eobp))
3241 (line-move-invisible (point))) 3262 (line-move-invisible-p (point)))
3242 (goto-char (next-char-property-change (point)))) 3263 (goto-char (next-char-property-change (point))))
3243 ;; Have we advanced to a larger column position? 3264 ;; Have we advanced to a larger column position?
3244 (if (> (current-column) normal-column) 3265 (if (> (current-column) normal-column)
@@ -3251,9 +3272,45 @@ and `current-column' to be able to ignore invisible text."
3251 ;; but with a more reasonable buffer position. 3272 ;; but with a more reasonable buffer position.
3252 (goto-char normal-location) 3273 (goto-char normal-location)
3253 (let ((line-beg (save-excursion (beginning-of-line) (point)))) 3274 (let ((line-beg (save-excursion (beginning-of-line) (point))))
3254 (while (and (not (bolp)) (line-move-invisible (1- (point)))) 3275 (while (and (not (bolp)) (line-move-invisible-p (1- (point))))
3255 (goto-char (previous-char-property-change (point) line-beg)))))))) 3276 (goto-char (previous-char-property-change (point) line-beg))))))))
3256 3277
3278(defun move-end-of-line (arg)
3279 "Move point to end of current line.
3280With argument ARG not nil or 1, move forward ARG - 1 lines first.
3281If point reaches the beginning or end of buffer, it stops there.
3282To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
3283
3284This command does not move point across a field boundary unless doing so
3285would move beyond there to a different line; if ARG is nil or 1, and
3286point starts at a field boundary, point does not move. To ignore field
3287boundaries bind `inhibit-field-text-motion' to t."
3288 (interactive "p")
3289 (or arg (setq arg 1))
3290 (let (done)
3291 (while (not done)
3292 (let ((newpos
3293 (save-excursion
3294 (let ((goal-column 0))
3295 (and (line-move arg t)
3296 (not (bobp))
3297 (progn
3298 (while (and (not (bobp)) (line-move-invisible-p (1- (point))))
3299 (goto-char (previous-char-property-change (point))))
3300 (backward-char 1)))
3301 (point)))))
3302 (goto-char newpos)
3303 (if (and (> (point) newpos)
3304 (eq (preceding-char) ?\n))
3305 (backward-char 1)
3306 (if (and (> (point) newpos) (not (eobp))
3307 (not (eq (following-char) ?\n)))
3308 ;; If we skipped something intangible
3309 ;; and now we're not really at eol,
3310 ;; keep going.
3311 (setq arg 1)
3312 (setq done t)))))))
3313
3257;;; Many people have said they rarely use this feature, and often type 3314;;; Many people have said they rarely use this feature, and often type
3258;;; it by accident. Maybe it shouldn't even be on a key. 3315;;; it by accident. Maybe it shouldn't even be on a key.
3259(put 'set-goal-column 'disabled t) 3316(put 'set-goal-column 'disabled t)
@@ -3302,7 +3359,8 @@ With arg N, put point N/10 of the way from the true beginning."
3302 (progn 3359 (progn
3303 (select-window window) 3360 (select-window window)
3304 ;; Set point and mark in that window's buffer. 3361 ;; Set point and mark in that window's buffer.
3305 (beginning-of-buffer arg) 3362 (with-no-warnings
3363 (beginning-of-buffer arg))
3306 ;; Set point accordingly. 3364 ;; Set point accordingly.
3307 (recenter '(t))) 3365 (recenter '(t)))
3308 (select-window orig-window)))) 3366 (select-window orig-window))))
@@ -3318,7 +3376,8 @@ With arg N, put point N/10 of the way from the true end."
3318 (unwind-protect 3376 (unwind-protect
3319 (progn 3377 (progn
3320 (select-window window) 3378 (select-window window)
3321 (end-of-buffer arg) 3379 (with-no-warnings
3380 (end-of-buffer arg))
3322 (recenter '(t))) 3381 (recenter '(t)))
3323 (select-window orig-window)))) 3382 (select-window orig-window))))
3324 3383
diff --git a/lisp/subr.el b/lisp/subr.el
index 621aec8d571..bb13298d6fe 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2221,12 +2221,20 @@ from `standard-syntax-table' otherwise."
2221 table)) 2221 table))
2222 2222
2223(defun syntax-after (pos) 2223(defun syntax-after (pos)
2224 "Return the syntax of the char after POS." 2224 "Return the syntax of the char after POS.
2225The value is either a syntax class character (a character that designates
2226a syntax in `modify-syntax-entry'), or a cons cell
2227of the form (CLASS . MATCH), where CLASS is the syntax class character
2228and MATCH is the matching parenthesis."
2225 (unless (or (< pos (point-min)) (>= pos (point-max))) 2229 (unless (or (< pos (point-min)) (>= pos (point-max)))
2226 (let ((st (if parse-sexp-lookup-properties 2230 (let* ((st (if parse-sexp-lookup-properties
2227 (get-char-property pos 'syntax-table)))) 2231 (get-char-property pos 'syntax-table)))
2228 (if (consp st) st 2232 (value
2229 (aref (or st (syntax-table)) (char-after pos)))))) 2233 (if (consp st) st
2234 (aref (or st (syntax-table)) (char-after pos))))
2235 (code (if (consp value) (car value) value)))
2236 (setq code (aref "-.w_()'\"$\\/<>@!|" code))
2237 (if (consp value) (cons code (cdr value)) code))))
2230 2238
2231(defun add-to-invisibility-spec (arg) 2239(defun add-to-invisibility-spec (arg)
2232 "Add elements to `buffer-invisibility-spec'. 2240 "Add elements to `buffer-invisibility-spec'.
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
new file mode 100644
index 00000000000..cb692616947
--- /dev/null
+++ b/lisp/textmodes/conf-mode.el
@@ -0,0 +1,531 @@
1;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files
2
3;; Copyright (C) 2004 by Daniel Pfeiffer <occitan@esperanto.org>
4;; Keywords: conf ini windows java
5
6;; This file is part of GNU Emacs.
7
8;; GNU Emacs is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation; either version 2, or (at your option)
11;; any later version.
12
13;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with GNU Emacs; see the file COPYING. If not, write to the
20;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21;; Boston, MA 02111-1307, USA.
22
23;;; Commentary:
24;;
25;; This mode is designed to edit many similar varieties of Conf/Ini files and
26;; Java properties. It started out from Aurélien Tisné's ini-mode.
27;; `conf-space-keywords' were inspired by Robert Fitzgerald's any-ini-mode.
28
29
30;;; Code:
31
32(require 'newcomment)
33
34;; Variables:
35
36(defgroup conf nil
37 "Configuration files."
38 :group 'data
39 :version "21.4")
40
41(defcustom conf-assignment-column 24
42 "Align assignments to this column by default with \\[conf-align-assignments].
43If this number is negative, the `=' comes before the whitespace. Use 0 to
44not align (only setting space according to `conf-assignment-space')."
45 :type 'integer
46 :group 'conf)
47
48(defcustom conf-javaprop-assignment-column 32
49 "Value for `conf-assignment-column' in Java properties buffers."
50 :type 'integer
51 :group 'conf)
52
53(defcustom conf-colon-assignment-column (- (abs conf-assignment-column))
54 "Value for `conf-assignment-column' in Java properties buffers."
55 :type 'integer
56 :group 'conf)
57
58(defcustom conf-assignment-space t
59 "Put at least one space around assignments when aligning."
60 :type 'boolean
61 :group 'conf)
62
63(defcustom conf-colon-assignment-space nil
64 "Value for `conf-assignment-space' in colon style Conf mode buffers."
65 :type 'boolean
66 :group 'conf)
67
68
69(defvar conf-mode-map
70 (let ((map (make-sparse-keymap)))
71 (define-key map "\C-c\C-u" 'conf-unix-mode)
72 (define-key map "\C-c\C-w" 'conf-windows-mode)
73 (define-key map "\C-c\C-j" 'conf-javaprop-mode)
74 (define-key map "\C-c\C-s" 'conf-space-mode)
75 (define-key map "\C-c " 'conf-space-mode)
76 (define-key map "\C-c\C-c" 'conf-colon-mode)
77 (define-key map "\C-c:" 'conf-colon-mode)
78 (define-key map "\C-c\C-x" 'conf-xdefaults-mode)
79 (define-key map "\C-c\C-q" 'conf-quote-normal)
80 (define-key map "\C-c\"" 'conf-quote-normal)
81 (define-key map "\C-c'" 'conf-quote-normal)
82 (define-key map "\C-c\C-a" 'conf-align-assignments)
83 map)
84 "Local keymap for conf-mode buffers.")
85
86(defvar conf-mode-syntax-table
87 (let ((table (make-syntax-table)))
88 (modify-syntax-entry ?= "." table)
89 (modify-syntax-entry ?_ "_" table)
90 (modify-syntax-entry ?- "_" table)
91 (modify-syntax-entry ?. "_" table)
92 (modify-syntax-entry ?\' "\"" table)
93; (modify-syntax-entry ?: "_" table)
94 (modify-syntax-entry ?\; "<" table)
95 (modify-syntax-entry ?\n ">" table)
96 (modify-syntax-entry ?\r ">" table)
97 table)
98 "Syntax table in use in Windows style conf-mode buffers.")
99
100(defvar conf-unix-mode-syntax-table
101 (let ((table (make-syntax-table conf-mode-syntax-table)))
102 (modify-syntax-entry ?\# "<" table)
103 ;; override
104 (modify-syntax-entry ?\; "." table)
105 table)
106 "Syntax table in use in Unix style conf-mode buffers.")
107
108(defvar conf-javaprop-mode-syntax-table
109 (let ((table (make-syntax-table conf-unix-mode-syntax-table)))
110 (modify-syntax-entry ?/ ". 124" table)
111 (modify-syntax-entry ?* ". 23b" table)
112 table)
113 "Syntax table in use in Java prperties buffers.")
114
115(defvar conf-xdefaults-mode-syntax-table
116 (let ((table (make-syntax-table conf-mode-syntax-table)))
117 (modify-syntax-entry ?! "<" table)
118 ;; override
119 (modify-syntax-entry ?\; "." table)
120 table)
121 "Syntax table in use in Xdefaults style conf-mode buffers.")
122
123
124(defvar conf-font-lock-keywords
125 `(;; [section] (do this first because it may look like a parameter)
126 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
127 ;; var=val or var[index]=val
128 ("^[ \t]*\\(.+?\\)\\(?:\\[\\(.*?\\)\\]\\)?[ \t]*="
129 (1 'font-lock-variable-name-face)
130 (2 'font-lock-constant-face nil t))
131 ;; section { ... } (do this last because some assign ...{...)
132 ("^[ \t]*\\([^=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
133 "Keywords to hilight in Conf mode")
134
135(defvar conf-javaprop-font-lock-keywords
136 '(;; var=val
137 ("^[ \t]*\\(.+?\\)\\(?:\\.\\([0-9]+\\)\\(?:\\.\\(.+?\\)\\(?:\\.\\([0-9]+\\)\\(?:\\.\\(.+?\\)\\(?:\\.\\([0-9]+\\)\\(\\..+?\\)?\\)?\\)?\\)?\\)?\\)?\\([:= \t]\\|$\\)"
138 (1 'font-lock-variable-name-face)
139 (2 'font-lock-constant-face nil t)
140 (3 'font-lock-variable-name-face nil t)
141 (4 'font-lock-constant-face nil t)
142 (5 'font-lock-variable-name-face nil t)
143 (6 'font-lock-constant-face nil t)
144 (7 'font-lock-variable-name-face nil t)))
145 "Keywords to hilight in Conf Java Properties mode")
146
147(defvar conf-space-keywords-alist
148 '(("\\`/etc/gpm/" . "key\\|name\\|foreground\\|background\\|border\\|head")
149 ("\\`/etc/magic\\'" . "[^ \t]+[ \t]+\\(?:[bl]?e?\\(?:short\\|long\\)\\|byte\\|string\\)[^ \t]*")
150 ("/mod\\(?:ules\\|probe\\)\\.conf" . "alias\\|in\\(?:clude\\|stall\\)\\|options\\|remove")
151 ("/manpath\\.config" . "MAN\\(?:DATORY_MANPATH\\|PATH_MAP\\|DB_MAP\\)")
152 ("/sensors\\.conf" . "chip\\|bus\\|label\\|compute\\|set\\|ignore")
153 ("/sane\\(\\.d\\)?/" . "option\\|device\\|port\\|usb\\|sc\\(?:si\\|anner\\)")
154 ("/resmgr\\.conf" . "class\\|add\\|allow\\|deny")
155 ("/dictionary\\.lst\\'" . "DICT\\|HYPH\\|THES")
156 ("/tuxracer/options" . "set"))
157 "File name based settings for `conf-space-keywords'.")
158
159(defvar conf-space-keywords nil
160 "Regexps for functions that may come before a space assignment.
161This allows constructs such as
162keyword var value
163This variable is best set in the file local variables, or through
164`conf-space-keywords-alist'.")
165
166(defvar conf-space-font-lock-keywords
167 `(;; [section] (do this first because it may look like a parameter)
168 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
169 ;; section { ... } (do this first because it looks like a parameter)
170 ("^[ \t]*\\(.+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face)
171 ;; var val
172 (eval if conf-space-keywords
173 (list (concat "^[ \t]*\\(" conf-space-keywords "\\)[ \t]+\\([^\000- ]+\\)")
174 '(1 'font-lock-keyword-face)
175 '(2 'font-lock-variable-name-face))
176 '("^[ \t]*\\([^\000- ]+\\)" 1 'font-lock-variable-name-face)))
177 "Keywords to hilight in Conf Space mode")
178
179(defvar conf-colon-font-lock-keywords
180 `(;; [section] (do this first because it may look like a parameter)
181 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
182 ;; var: val
183 ("^[ \t]*\\(.+?\\)[ \t]*:"
184 (1 'font-lock-variable-name-face))
185 ;; section { ... } (do this last because some assign ...{...)
186 ("^[ \t]*\\([^:\n]+\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
187 "Keywords to hilight in Conf Colon mode")
188
189(defvar conf-assignment-sign ?=
190 "What sign is used for assignments.")
191
192(defvar conf-assignment-regexp ".+?\\([ \t]*=[ \t]*\\)"
193 "Regexp to recognize assignments.
194It is anchored after the first sexp on a line. There must a
195grouping for the assignment sign, including leading and trailing
196whitespace.")
197
198
199;; If anybody can figure out how to get the same effect by configuring
200;; `align', I'd be glad to hear.
201(defun conf-align-assignments (&optional arg)
202 (interactive "P")
203 (setq arg (if arg
204 (prefix-numeric-value arg)
205 conf-assignment-column))
206 (save-excursion
207 (goto-char (point-min))
208 (while (not (eobp))
209 (let ((cs (comment-beginning))) ; go before comment if within
210 (if cs (goto-char cs)))
211 (while (forward-comment 9)) ; max-int?
212 (when (and (not (eobp))
213 (looking-at conf-assignment-regexp))
214 (goto-char (match-beginning 1))
215 (delete-region (point) (match-end 1))
216 (if conf-assignment-sign
217 (if (>= arg 0)
218 (progn
219 (indent-to-column arg)
220 (or (not conf-assignment-space) (memq (char-before (point)) '(? ?\t)) (insert ? ))
221 (insert conf-assignment-sign (if (and conf-assignment-space (not (eolp))) ?\ "")))
222 (insert (if conf-assignment-space ?\ "") conf-assignment-sign)
223 (unless (eolp)
224 (indent-to-column (- arg))
225 (or (not conf-assignment-space) (memq (char-before (point)) '(? ?\t)) (insert ? ))))
226 (unless (eolp)
227 (if (>= (current-column) (abs arg))
228 (insert ? )
229 (indent-to-column (abs arg))))))
230 (forward-line))))
231
232
233(defun conf-quote-normal ()
234 "Set the syntax of \" and ' to punctuation.
235This only affects the current buffer. Some conf files use quotes
236to delimit strings, while others allow quotes as simple parts of
237the assigned value. In those files font locking will be wrong,
238and you can correct it with this command. (Some files even do
239both, i.e. quotes delimit strings, except when they are
240unbalanced, but hey...)"
241 (interactive)
242 (let ((table (copy-syntax-table (syntax-table))))
243 (modify-syntax-entry ?\" "." table)
244 (modify-syntax-entry ?\' "." table)
245 (set-syntax-table table)
246 (and (boundp 'font-lock-mode)
247 font-lock-mode
248 (font-lock-fontify-buffer))))
249
250
251(defun conf-outline-level ()
252 (let ((depth 0)
253 (pt (match-end 0)))
254 (condition-case nil
255 (while (setq pt (scan-lists pt -1 1)
256 depth (1+ depth)))
257 (scan-error depth))))
258
259
260
261;;;###autoload
262(defun conf-mode (&optional comment syntax-table name)
263 "Mode for Unix and Windows Conf files and Java properties.
264Most conf files know only three kinds of constructs: parameter
265assignments optionally grouped into sections and comments. Yet
266there is a great range of variation in the exact syntax of conf
267files. See below for various wrapper commands that set up the
268details for some of the most widespread variants.
269
270This mode sets up font locking, outline, imenu and it provides
271alignment support through `conf-align-assignments'. If strings
272come out wrong, try `conf-quote-normal'.
273
274Some files allow continuation lines, either with a backslash at
275the end of line, or by indenting the next line (further). These
276constructs cannot currently be recognized.
277
278Because of this great variety of nuances, which are often not
279even clearly specified, please don't expect it to get every file
280quite right. Patches that clearly identify some special case,
281without breaking the general ones, are welcome.
282
283If instead you start this mode with the generic `conf-mode'
284command, it will parse the buffer. It will generally well
285identify the first four cases listed below. If the buffer
286doesn't have enough contents to decide, this is identical to
287`conf-windows-mode' on Windows, elsewhere to `conf-unix-mode'. See
288also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode' and
289`conf-xdefaults-mode'.
290
291\\{conf-mode-map}"
292
293 (interactive)
294 (if (not comment)
295 (let ((unix 0) (win 0) (equal 0) (colon 0) (space 0) (jp 0))
296 (save-excursion
297 (goto-char (point-min))
298 (while (not (eobp))
299 (skip-chars-forward " \t\f")
300 (cond ((eq (char-after) ?\#) (setq unix (1+ unix)))
301 ((eq (char-after) ?\;) (setq win (1+ win)))
302 ((eq (char-after) ?\[)) ; nop
303 ((eolp)) ; nop
304 ((eq (char-after) ?})) ; nop
305 ;; recognize at most double spaces within names
306 ((looking-at "[^ \t\n=:]+\\(?: ?[^ \t\n=:]+\\)*[ \t]*[=:]")
307 (if (eq (char-before (match-end 0)) ?=)
308 (setq equal (1+ equal))
309 (setq colon (1+ colon))))
310 ((looking-at "/[/*]") (setq jp (1+ jp)))
311 ((looking-at ".*{")) ; nop
312 ((setq space (1+ space))))
313 (forward-line)))
314 (if (> jp (max unix win 3))
315 (conf-javaprop-mode)
316 (if (> colon (max equal space))
317 (conf-colon-mode)
318 (if (> space (max equal colon))
319 (conf-space-mode)
320 (if (or (> win unix)
321 (and (= win unix) (eq system-type 'windows-nt)))
322 (conf-windows-mode)
323 (conf-unix-mode))))))
324 (kill-all-local-variables)
325 (use-local-map conf-mode-map)
326
327 (setq major-mode 'conf-mode
328 mode-name name)
329 (set (make-local-variable 'comment-start) comment)
330 (set (make-local-variable 'comment-start-skip)
331 (concat comment-start "+\\s *"))
332 (set (make-local-variable 'comment-use-syntax) t)
333 (set (make-local-variable 'parse-sexp-ignore-comments) t)
334 (set (make-local-variable 'outline-regexp)
335 "[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)")
336 (set (make-local-variable 'outline-heading-end-regexp)
337 "[\n}]")
338 (set (make-local-variable 'outline-level)
339 'conf-outline-level)
340 (set-syntax-table syntax-table)
341 (setq imenu-generic-expression
342 '(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*=" 1)
343 ;; [section]
344 (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1)
345 ;; section { ... }
346 (nil "^[ \t]*\\([^=:\n]+\\)[ \t\n]*{" 1)))
347
348 (run-mode-hooks 'conf-mode-hook)))
349
350;;;###autoload
351(defun conf-unix-mode ()
352 "Conf Mode starter for Unix style Conf files.
353Comments start with `#'.
354For details see `conf-mode'. Example:
355
356# Conf mode font-locks this right on Unix and with C-c C-u
357
358\[Desktop Entry]
359 Encoding=UTF-8
360 Name=The GIMP
361 Name[ca]=El GIMP
362 Name[cs]=GIMP"
363 (interactive)
364 (conf-mode "#" conf-unix-mode-syntax-table "Conf[Unix]"))
365
366;;;###autoload
367(defun conf-windows-mode ()
368 "Conf Mode starter for Windows style Conf files.
369Comments start with `;'.
370For details see `conf-mode'. Example:
371
372; Conf mode font-locks this right on Windows and with C-c C-w
373
374\[ExtShellFolderViews]
375Default={5984FFE0-28D4-11CF-AE66-08002B2E1262}
376{5984FFE0-28D4-11CF-AE66-08002B2E1262}={5984FFE0-28D4-11CF-AE66-08002B2E1262}
377
378\[{5984FFE0-28D4-11CF-AE66-08002B2E1262}]
379PersistMoniker=file://Folder.htt"
380 (interactive)
381 (conf-mode ";" conf-mode-syntax-table "Conf[WinIni]"))
382
383;; Here are a few more or less widespread styles. There are others, so
384;; obscure, they are not covered. E.g. RFC 2614 allows both Unix and Windows
385;; comments. Or the donkey has (* Pascal comments *) -- roll your own starter
386;; if you need it.
387
388;;;###autoload
389(defun conf-javaprop-mode ()
390 "Conf Mode starter for Java properties files.
391Comments start with `#' but are also recognized with `//' or
392between `/*' and `*/'.
393For details see `conf-mode'. Example:
394
395# Conf mode font-locks this right with C-c C-j (Java properties)
396// another kind of comment
397/* yet another */
398
399name:value
400name=value
401name value
402x.1 =
403x.2.y.1.z.1 =
404x.2.y.1.z.2.zz ="
405 (interactive)
406 (conf-mode "#" conf-javaprop-mode-syntax-table "Conf[JavaProp]")
407 (set (make-local-variable 'conf-assignment-column)
408 conf-javaprop-assignment-column)
409 (set (make-local-variable 'conf-assignment-regexp)
410 ".+?\\([ \t]*[=: \t][ \t]*\\|$\\)")
411 (set (make-local-variable 'conf-font-lock-keywords)
412 conf-javaprop-font-lock-keywords)
413 (setq comment-start-skip "\\(?:#+\\|/[/*]+\\)\\s *")
414 (setq imenu-generic-expression
415 '(("Parameters" "^[ \t]*\\(.+?\\)[=: \t]" 1))))
416
417;;;###autoload
418(defun conf-space-mode (&optional keywords)
419 "Conf Mode starter for space separated conf files.
420\"Assignments\" are with ` '. Keywords before the parameters are
421recognized according to `conf-space-keywords'. Interactively
422with a prefix ARG of `0' no keywords will be recognized. With
423any other prefix arg you will be prompted for a regexp to match
424the keywords. Programmatically you can pass such a regexp as
425KEYWORDS, or any non-nil non-string for no keywords.
426
427For details see `conf-mode'. Example:
428
429# Conf mode font-locks this right with C-c C-s (space separated)
430
431image/jpeg jpeg jpg jpe
432image/png png
433image/tiff tiff tif
434
435# Or with keywords (from a recognized file name):
436class desktop
437# Standard multimedia devices
438add /dev/audio desktop
439add /dev/mixer desktop"
440 (interactive
441 (list (if current-prefix-arg
442 (if (> (prefix-numeric-value current-prefix-arg) 0)
443 (read-string "Regexp to match keywords: ")
444 t))))
445 (conf-unix-mode)
446 (setq mode-name "Conf[Space]")
447 (set (make-local-variable 'conf-assignment-sign)
448 nil)
449 (set (make-local-variable 'conf-font-lock-keywords)
450 conf-space-font-lock-keywords)
451 ;; This doesn't seem right, but the next two depend on conf-space-keywords
452 ;; being set, while after-change-major-mode-hook might set up imenu, needing
453 ;; the following result:
454 (hack-local-variables-prop-line)
455 (hack-local-variables)
456 (if keywords
457 (set (make-local-variable 'conf-space-keywords)
458 (if (stringp keywords) keywords))
459 (or conf-space-keywords
460 (not buffer-file-name)
461 (set (make-local-variable 'conf-space-keywords)
462 (assoc-default buffer-file-name conf-space-keywords-alist
463 'string-match))))
464 (set (make-local-variable 'conf-assignment-regexp)
465 (if conf-space-keywords
466 (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)")
467 ".+?\\([ \t]+\\|$\\)"))
468 (setq imenu-generic-expression
469 `(,@(cdr imenu-generic-expression)
470 ("Parameters"
471 ,(if conf-space-keywords
472 (concat "^[ \t]*\\(?:" conf-space-keywords
473 "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)")
474 "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)")
475 1))))
476
477;;;###autoload
478(defun conf-colon-mode (&optional comment syntax-table name)
479 "Conf Mode starter for Colon files.
480\"Assignments\" are with `:'.
481For details see `conf-mode'. Example:
482
483# Conf mode font-locks this right with C-c C-c (colon)
484
485<Multi_key> <exclam> <exclam> : \"\\241\" exclamdown
486<Multi_key> <c> <slash> : \"\\242\" cent"
487 (interactive)
488 (if comment
489 (conf-mode comment syntax-table name)
490 (conf-unix-mode)
491 (setq mode-name "Conf[Colon]"))
492 (set (make-local-variable 'conf-assignment-space)
493 conf-colon-assignment-space)
494 (set (make-local-variable 'conf-assignment-column)
495 conf-colon-assignment-column)
496 (set (make-local-variable 'conf-assignment-sign)
497 ?:)
498 (set (make-local-variable 'conf-assignment-regexp)
499 ".+?\\([ \t]*:[ \t]*\\)")
500 (set (make-local-variable 'conf-font-lock-keywords)
501 conf-colon-font-lock-keywords)
502 (setq imenu-generic-expression
503 `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)
504 ,@(cdr imenu-generic-expression))))
505
506;;;###autoload
507(defun conf-xdefaults-mode ()
508 "Conf Mode starter for Xdefaults files.
509Comments start with `!' and \"assignments\" are with `:'.
510For details see `conf-mode'. Example:
511
512! Conf mode font-locks this right with C-c C-x (.Xdefaults)
513
514*background: gray99
515*foreground: black"
516 (interactive)
517 (conf-colon-mode "!" conf-xdefaults-mode-syntax-table "Conf[Xdefaults]"))
518
519
520;; font lock support
521(if (boundp 'font-lock-defaults-alist)
522 (add-to-list
523 'font-lock-defaults-alist
524 (cons 'conf-mode
525 (list 'conf-font-lock-keywords nil t nil nil))))
526
527
528(provide 'conf-mode)
529
530;; arch-tag: 0a3805b2-0371-4d3a-8498-8897116b2356
531;;; conf-mode.el ends here
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 556369077d8..441d9972173 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1281,7 +1281,7 @@ Word syntax described by `ispell-dictionary-alist' (which see)."
1281(defun flyspell-external-point-words () 1281(defun flyspell-external-point-words ()
1282 (let ((buffer flyspell-external-ispell-buffer)) 1282 (let ((buffer flyspell-external-ispell-buffer))
1283 (set-buffer buffer) 1283 (set-buffer buffer)
1284 (beginning-of-buffer) 1284 (goto-char (point-min))
1285 (let ((size (- flyspell-large-region-end flyspell-large-region-beg)) 1285 (let ((size (- flyspell-large-region-end flyspell-large-region-beg))
1286 (start flyspell-large-region-beg)) 1286 (start flyspell-large-region-beg))
1287 ;; now we are done with ispell, we have to find the word in 1287 ;; now we are done with ispell, we have to find the word in
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 4ac96b2e4b0..dd606a53434 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1,6 +1,7 @@
1;;; sgml-mode.el --- SGML- and HTML-editing modes 1;;; sgml-mode.el --- SGML- and HTML-editing modes
2 2
3;; Copyright (C) 1992,95,96,98,2001,2002, 2003 Free Software Foundation, Inc. 3;; Copyright (C) 1992, 1995, 1996, 1998, 2001, 2002, 2003, 2004
4;; Free Software Foundation, Inc.
4 5
5;; Author: James Clark <jjc@jclark.com> 6;; Author: James Clark <jjc@jclark.com>
6;; Maintainer: FSF 7;; Maintainer: FSF
@@ -1053,53 +1054,79 @@ You might want to turn on `auto-fill-mode' to get better results."
1053 (and (>= start (point-min)) 1054 (and (>= start (point-min))
1054 (equal str (buffer-substring-no-properties start (point)))))) 1055 (equal str (buffer-substring-no-properties start (point))))))
1055 1056
1057(defun sgml-tag-text-p (start end)
1058 "Return non-nil if text between START and END is a tag.
1059Checks among other things that the tag does not contain spurious
1060unquoted < or > chars inside, which would indicate that it
1061really isn't a tag after all."
1062 (save-excursion
1063 (with-syntax-table sgml-tag-syntax-table
1064 (let ((pps (parse-partial-sexp start end 2)))
1065 (and (= (nth 0 pps) 0))))))
1066
1056(defun sgml-parse-tag-backward (&optional limit) 1067(defun sgml-parse-tag-backward (&optional limit)
1057 "Parse an SGML tag backward, and return information about the tag. 1068 "Parse an SGML tag backward, and return information about the tag.
1058Assume that parsing starts from within a textual context. 1069Assume that parsing starts from within a textual context.
1059Leave point at the beginning of the tag." 1070Leave point at the beginning of the tag."
1060 (let (tag-type tag-start tag-end name) 1071 (catch 'found
1061 (or (re-search-backward "[<>]" limit 'move) 1072 (let (tag-type tag-start tag-end name)
1062 (error "No tag found")) 1073 (or (re-search-backward "[<>]" limit 'move)
1063 (when (eq (char-after) ?<) 1074 (error "No tag found"))
1064 ;; Oops!! Looks like we were not in a textual context after all!. 1075 (when (eq (char-after) ?<)
1065 ;; Let's try to recover. 1076 ;; Oops!! Looks like we were not in a textual context after all!.
1066 (with-syntax-table sgml-tag-syntax-table 1077 ;; Let's try to recover.
1067 (forward-sexp) 1078 (with-syntax-table sgml-tag-syntax-table
1068 (forward-char -1))) 1079 (let ((pos (point)))
1069 (setq tag-end (1+ (point))) 1080 (condition-case nil
1070 (cond 1081 (forward-sexp)
1071 ((sgml-looking-back-at "--") ; comment 1082 (scan-error
1072 (setq tag-type 'comment 1083 ;; This < seems to be just a spurious one, let's ignore it.
1073 tag-start (search-backward "<!--" nil t))) 1084 (goto-char pos)
1074 ((sgml-looking-back-at "]]") ; cdata 1085 (throw 'found (sgml-parse-tag-backward limit))))
1075 (setq tag-type 'cdata 1086 ;; Check it is really a tag, without any extra < or > inside.
1076 tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t))) 1087 (unless (sgml-tag-text-p pos (point))
1077 (t 1088 (goto-char pos)
1078 (setq tag-start 1089 (throw 'found (sgml-parse-tag-backward limit)))
1079 (with-syntax-table sgml-tag-syntax-table 1090 (forward-char -1))))
1080 (goto-char tag-end) 1091 (setq tag-end (1+ (point)))
1081 (backward-sexp) 1092 (cond
1082 (point))) 1093 ((sgml-looking-back-at "--") ; comment
1083 (goto-char (1+ tag-start)) 1094 (setq tag-type 'comment
1084 (case (char-after) 1095 tag-start (search-backward "<!--" nil t)))
1085 (?! ; declaration 1096 ((sgml-looking-back-at "]]") ; cdata
1086 (setq tag-type 'decl)) 1097 (setq tag-type 'cdata
1087 (?? ; processing-instruction 1098 tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t)))
1088 (setq tag-type 'pi)) 1099 (t
1089 (?/ ; close-tag 1100 (setq tag-start
1090 (forward-char 1) 1101 (with-syntax-table sgml-tag-syntax-table
1091 (setq tag-type 'close 1102 (goto-char tag-end)
1092 name (sgml-parse-tag-name))) 1103 (condition-case nil
1093 (?% ; JSP tags 1104 (backward-sexp)
1094 (setq tag-type 'jsp)) 1105 (scan-error
1095 (t ; open or empty tag 1106 ;; This > isn't really the end of a tag. Skip it.
1096 (setq tag-type 'open 1107 (goto-char (1- tag-end))
1097 name (sgml-parse-tag-name)) 1108 (throw 'found (sgml-parse-tag-backward limit))))
1098 (if (or (eq ?/ (char-before (- tag-end 1))) 1109 (point)))
1099 (sgml-empty-tag-p name)) 1110 (goto-char (1+ tag-start))
1100 (setq tag-type 'empty)))))) 1111 (case (char-after)
1101 (goto-char tag-start) 1112 (?! ; declaration
1102 (sgml-make-tag tag-type tag-start tag-end name))) 1113 (setq tag-type 'decl))
1114 (?? ; processing-instruction
1115 (setq tag-type 'pi))
1116 (?/ ; close-tag
1117 (forward-char 1)
1118 (setq tag-type 'close
1119 name (sgml-parse-tag-name)))
1120 (?% ; JSP tags
1121 (setq tag-type 'jsp))
1122 (t ; open or empty tag
1123 (setq tag-type 'open
1124 name (sgml-parse-tag-name))
1125 (if (or (eq ?/ (char-before (- tag-end 1)))
1126 (sgml-empty-tag-p name))
1127 (setq tag-type 'empty))))))
1128 (goto-char tag-start)
1129 (sgml-make-tag tag-type tag-start tag-end name))))
1103 1130
1104(defun sgml-get-context (&optional until) 1131(defun sgml-get-context (&optional until)
1105 "Determine the context of the current position. 1132 "Determine the context of the current position.
@@ -1966,5 +1993,5 @@ Can be used as a value for `html-mode-hook'."
1966 1993
1967(provide 'sgml-mode) 1994(provide 'sgml-mode)
1968 1995
1969;;; arch-tag: 9675da94-b7f9-4bda-ad19-73ed7b4fb401 1996;; arch-tag: 9675da94-b7f9-4bda-ad19-73ed7b4fb401
1970;;; sgml-mode.el ends here 1997;;; sgml-mode.el ends here
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 6ff86b4cf0b..f8243f4a0ac 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -1,6 +1,6 @@
1;;; tooltip.el --- show tooltip windows 1;;; tooltip.el --- show tooltip windows
2 2
3;; Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc. 3;; Copyright (C) 1997, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
4 4
5;; Author: Gerd Moellmann <gerd@acm.org> 5;; Author: Gerd Moellmann <gerd@acm.org>
6;; Keywords: help c mouse tools 6;; Keywords: help c mouse tools
@@ -26,11 +26,7 @@
26 26
27;;; Code: 27;;; Code:
28 28
29(eval-when-compile 29(eval-when-compile (require 'cl)) ; for case macro
30 (require 'cl)
31 (require 'comint)
32 (require 'gud)
33 (require 'gdb-ui))
34 30
35 31
36;;; Customizable settings 32;;; Customizable settings
@@ -524,5 +520,5 @@ use either \\[customize] or the function `tooltip-mode'."
524 520
525(provide 'tooltip) 521(provide 'tooltip)
526 522
527;;; arch-tag: 3d61135e-4618-4a78-af28-183f6df5636f 523;; arch-tag: 3d61135e-4618-4a78-af28-183f6df5636f
528;;; tooltip.el ends here 524;;; tooltip.el ends here
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 261635d51e2..eb10dd2a933 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
12004-11-12 Masatake YAMATO <jet@gyve.org>
2
3 * url-mailto.el (url-mailto): Fix a typo in the
4 comment.
5
12004-11-02 Masatake YAMATO <jet@gyve.org> 62004-11-02 Masatake YAMATO <jet@gyve.org>
2 7
3 * url-imap.el (url-imap-open-host): Don't use 8 * url-imap.el (url-imap-open-host): Don't use
diff --git a/lisp/url/url-mailto.el b/lisp/url/url-mailto.el
index f5192bcb03f..42793093117 100644
--- a/lisp/url/url-mailto.el
+++ b/lisp/url/url-mailto.el
@@ -63,7 +63,7 @@
63(defun url-mailto (url) 63(defun url-mailto (url)
64 "Handle the mailto: URL syntax." 64 "Handle the mailto: URL syntax."
65 (if (url-user url) 65 (if (url-user url)
66 ;; malformed mailto URL (mailto://wmperry@gnu.org instead of 66 ;; malformed mailto URL (mailto://wmperry@gnu.org) instead of
67 ;; mailto:wmperry@gnu.org 67 ;; mailto:wmperry@gnu.org
68 (url-set-filename url (concat (url-user url) "@" (url-filename url)))) 68 (url-set-filename url (concat (url-user url) "@" (url-filename url))))
69 (setq url (url-filename url)) 69 (setq url (url-filename url))
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 197c7217785..4491956f06f 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,7 @@
12004-11-08 Richard M. Stallman <rms@gnu.org>
2
3 * syntax.texi (Syntax Table Functions): Add syntax-after.
4
12004-11-06 Lars Brinkhoff <lars@nocrew.org> 52004-11-06 Lars Brinkhoff <lars@nocrew.org>
2 6
3 * os.texi (Processor Run Time): New section documenting 7 * os.texi (Processor Run Time): New section documenting
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/oldXMenu/Activate.c b/oldXMenu/Activate.c
index 840c423471b..363b225a355 100644
--- a/oldXMenu/Activate.c
+++ b/oldXMenu/Activate.c
@@ -85,6 +85,20 @@
85/* For debug, set this to 0 to not grab the keyboard on menu popup */ 85/* For debug, set this to 0 to not grab the keyboard on menu popup */
86int x_menu_grab_keyboard = 1; 86int x_menu_grab_keyboard = 1;
87 87
88typedef void (*Wait_func)();
89
90static Wait_func wait_func;
91static void* wait_data;
92
93void
94XMenuActivateSetWaitFunction (func, data)
95 Wait_func func;
96 void *data;
97{
98 wait_func = func;
99 wait_data = data;
100}
101
88int 102int
89XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data, 103XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
90 help_callback) 104 help_callback)
@@ -266,6 +280,7 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
266 * Begin event processing loop. 280 * Begin event processing loop.
267 */ 281 */
268 while (1) { 282 while (1) {
283 if (wait_func) (*wait_func) (wait_data);
269 XNextEvent(display, &event); /* Get next event. */ 284 XNextEvent(display, &event); /* Get next event. */
270 switch (event.type) { /* Dispatch on the event type. */ 285 switch (event.type) { /* Dispatch on the event type. */
271 case Expose: 286 case Expose:
@@ -557,6 +572,8 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
557 free((char *)feq_tmp); 572 free((char *)feq_tmp);
558 } 573 }
559 574
575 wait_func = 0;
576
560 /* 577 /*
561 * Return successfully. 578 * Return successfully.
562 */ 579 */
diff --git a/oldXMenu/ChangeLog b/oldXMenu/ChangeLog
index 4bcd8120556..ab86c364736 100644
--- a/oldXMenu/ChangeLog
+++ b/oldXMenu/ChangeLog
@@ -1,3 +1,10 @@
12004-11-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * XMenu.h (XMenuActivateSetWaitFunction): New function.
4
5 * Activate.c (XMenuActivateSetWaitFunction): New function.
6 (XMenuActivate): Call wait_func if set, before XNextEvent.
7
12002-04-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 82002-04-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2 9
3 * Activate.c: Add calls to GrabKeyboard to remove strange 10 * Activate.c: Add calls to GrabKeyboard to remove strange
diff --git a/oldXMenu/XMenu.h b/oldXMenu/XMenu.h
index fde2a954620..46e390d3b0a 100644
--- a/oldXMenu/XMenu.h
+++ b/oldXMenu/XMenu.h
@@ -251,6 +251,7 @@ int XMenuRecompute();
251int XMenuEventHandler(); /* No value actually returned. */ 251int XMenuEventHandler(); /* No value actually returned. */
252int XMenuLocate(); 252int XMenuLocate();
253int XMenuSetFreeze(); /* No value actually returned. */ 253int XMenuSetFreeze(); /* No value actually returned. */
254void XMenuActivateSetWaitFunction();
254int XMenuActivate(); 255int XMenuActivate();
255char *XMenuPost(); 256char *XMenuPost();
256int XMenuDeletePane(); 257int XMenuDeletePane();
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 b65bb2d5714..cc9e71290d5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,189 @@
12004-11-12 Kim F. Storm <storm@cua.dk>
2
3 * dispextern.h (struct glyph_row): New member extra_line_spacing.
4 (struct it): New member max_extra_line_spacing.
5 (MR_PARTIALLY_VISIBLE, MR_PARTIALLY_VISIBLE_AT_TOP)
6 (MR_PARTIALLY_VISIBLE_AT_BOTTOM): New helper macros.
7 (MATRIX_ROW_PARTIALLY_VISIBLE_P): Fix to return false if invisible
8 part of last line is only extra line spacing (so the text on the
9 line is fully visible). Use helper macros.
10 Add W arg (to use them). All callers changed.
11 (MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P)
12 (MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P): Use helper macros.
13
14 * window.c (window_scroll_pixel_based, Frecenter): Use
15 move_it_vertically_backward directly.
16 (Frecenter): Fix calculation of new start pos for negative arg.
17 Before, the new start pos was sometimes chosen too far back, so
18 the last line became only partially visible, and thus would be
19 either only semi-visible or automatically scrolled to the middle
20 of the window by redisplay.
21
22 * xdisp.c (init_iterator): Clear it.max_extra_line_spacing.
23 (move_it_vertically_backward): Don't recure to move further back.
24 (move_it_vertically): Remove superfluous condition.
25 (move_it_by_lines): Clear last_height when moved 0 lines.
26 (resize_mini_window): use it.max_extra_line_spacing.
27 (display_tool_bar_line): Clear row->extra_line_spacing.
28 (try_scrolling): Use move_it_vertically_backward directly.
29 (redisplay_window): Likewise.
30 (compute_line_metrics): Set row->extra_line_spacing.
31 (display_line, display_string): Likewise.
32 (x_produce_glyphs): Update it->max_extra_line_spacing.
33
34 * xmenu.c (pop_down_menu): Return nil.
35
362004-11-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
37
38 * xmenu.c (x_menu_wait_for_event): New function.
39 (popup_get_selection, popup_widget_loop): Call x_menu_wait_for_event
40 to handle timers.
41 (popup_widget_loop): Add argument do_timers.
42 (create_and_show_popup_menu, create_and_show_dialog): Pass 1 for
43 do_timers to popup_widget_loop.
44 (xmenu_show): Call XMenuActivateSetWaitFunction so that
45 x_menu_wait_for_event is called by XMenuActivate.
46 (create_and_show_popup_menu): Pass 1 for do_timers to
47 popup_get_selection.
48 (pop_down_menu): New function.
49 (popup_get_selection, popup_widget_loop): Unwind protect to
50 pop_down_menu.
51 (popup_widget_loop): Add argument widget.
52 (create_and_show_popup_menu, create_and_show_dialog): Pass new
53 argument widget to popup_widget_loop.
54
552004-11-10 Stefan Monnier <monnier@iro.umontreal.ca>
56
57 * keymap.c (Fkeymap_prompt): Accept symbol keymaps.
58
592004-11-09 Kim F. Storm <storm@cua.dk>
60
61 * xselect.c: Include <sys/types.h> and <unistd.h> (for getpid).
62 Fix various comments referring to XEvents instead of input events.
63 (x_queue_event): Fix format strings.
64 (x_stop_queuing_selection_requests): Likewise.
65
66 * xdisp.c (produce_image_glyph): Remove unused variable 'face_ascent'.
67 (pint2hrstr): Add extra braces to silence compiler.
68
69 * print.c (print_object): Fix format string.
70
71 * lread.c (read1): Fix next_char matching.
72
73 * lisp.h (Fdelete): Add EXFUN.
74 (replace_range_2): Add prototype.
75
76 * keyboard.c (read_avail_input): Remove unused variable 'discard'.
77
78 * intervals.h (NULL_INTERVAL_P): Add separate version when
79 ENABLE_CHECKING is not defined to silence compiler.
80 (compare_string_intervals): Add prototype.
81
82 * fringe.c (destroy_fringe_bitmap): Fix return type.
83 (Ffringe_bitmaps_at_pos): Remove unused var 'old_buffer'.
84
85 * emacs.c (Fdump_emacs): Fix format string.
86
87 * doc.c: Include <ctype.h>.
88 (Fsubstitute_command_keys): Remove unused variable 'firstkey'.
89
90 * data.c (store_symval_forwarding): Remove unused variables.
91
92 * callint.c (Fcall_interactively): Remove unused variable 'funcar'.
93
942004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
95
96 * Makefile.in (stamp-oldxmenu): If HAVE_GTK, don't add dependencies
97 to ${OLDXMENU}.
98
992004-11-09 Kim F. Storm <storm@cua.dk>
100
101 * process.c (Fmake_network_process): Remove kludge for interrupted
102 connects on BSD. If connect is interrupted, just close socket and
103 start over rather than sleeping and retry with same socket.
104
1052004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
106
107 * .cvsignore: Add buildobj.lst.
108
109 * doc.c: New variable Vbuild_files.
110 (Fsnarf_documentation): If Vbuild_files is nil, populate it with
111 file names from buildobh.lst. Only attach docstrings from files
112 that are in Vbuild_files.
113 (syms_of_doc): Defvar Vbuild_files.
114
115 * Makefile.in (SOME_MACHINE_OBJECTS): Add fringe.o, image.o
116 and w32*.o.
117 (temacs${EXEEXT}): Generate buildobj.lst when temacs is linked.
118 (mostlyclean): rm buildobj.lst
119
120 * makefile.w32-in ($(TEMACS)): Generate buildobj.lst when temacs
121 is linked.
122
1232004-11-09 Kim F. Storm <storm@cua.dk>
124
125 * fringe.c (update_window_fringes): Update fringe bitmaps if
126 cur and row ends_at_zv_p differs. If bitmaps of a row is updated,
127 also update previous row to get rid of misc. artifacts.
128
1292004-11-08 Kim F. Storm <storm@cua.dk>
130
131 * xdisp.c (fast_find_position): Fix start pos if header line present.
132 (note_mouse_highlight): Clear mouse face if we move out of text area.
133
1342004-11-08 Eli Zaretskii <eliz@gnu.org>
135
136 * editfns.c: Move #include "systime.h" before <sys/resource.h>.
137 Don't include <sys/time.h> explicitly.
138 Include <stdio.h> unconditionally, not just on MacOS.
139
1402004-11-08 Kenichi Handa <handa@m17n.org>
141
142 * fontset.c (fontset_pattern_regexp): Cancel my previous change;
143 don't pay attention to '\' before '*'.
144 (fontset_pattern_regexp): Change the meaning of the second arg.
145 (Fnew_fontset): Call fs_query_fontset, not Fquery_fontset.
146 (check_fontset_name): Try NAME as literal at first, and if it
147 failes, try NAME as pattern.
148
1492004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
150
151 * emacs.c (Fdump_emacs): Only output warning on GNU/Linux.
152
1532004-11-07 Andreas Schwab <schwab@suse.de>
154
155 * lisp.h: Declare Fmsdos_downcase_filename.
156 * dired.c: Don't declare Fmsdos_downcase_filename.
157 * fileio.c: Likewise.
158
1592004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
160
161 * dosfns.c (Fdos_memget, Fdos_memput): Use integer variable offs in
162 comparisons with integers instead of Lisp_Object address.
163 (Fmsdos_set_keyboard): Declare argument allkeys.
164
165 * msdos.c (IT_set_frame_parameters): Use EQ, not ==, for Lisp_Object:s.
166
167 * dired.c: extern declare Fmsdos_downcase_filename on MSDOS to avoid
168 int/Lisp_Object mixup.
169
170 * fileio.c: Ditto.
171
1722004-11-06 Steven Tamm <steventamm@mac.com>
173
174 * editfns.c: Need to include sys/time.h before resource.h on darwin.
175
1762004-11-06 Richard M. Stallman <rms@gnu.org>
177
178 * callint.c (Fcall_interactively): Avoid reusing EVENT for other data.
179
180 * xfaces.c (merge_named_face): GCPRO the face_name in the
181 named_merge_point struct that we make.
182 (merge_face_heights): Eliminate GCPRO arg. All callers changed.
183
184 * keyboard.c (command_loop_1): Change Vtransient_mark_mode
185 before deciding whether to inactivate mark.
186
12004-11-06 Lars Brinkhoff <lars@nocrew.org> 1872004-11-06 Lars Brinkhoff <lars@nocrew.org>
2 188
3 * config.in: Regenerate (add HAVE_GETRUSAGE). 189 * config.in: Regenerate (add HAVE_GETRUSAGE).
@@ -16,7 +202,6 @@
16 202
17 * xmenu.c (popup_get_selection, create_and_show_popup_menu) 203 * xmenu.c (popup_get_selection, create_and_show_popup_menu)
18 (create_and_show_dialog): Revert change from 2004-10-31. 204 (create_and_show_dialog): Revert change from 2004-10-31.
19
20 205
212004-11-05 Luc Teirlinck <teirllm@auburn.edu> 2062004-11-05 Luc Teirlinck <teirllm@auburn.edu>
22 207
@@ -37,8 +222,8 @@
37 (x_stop_queuing_selection_requests): Add new queue for selection 222 (x_stop_queuing_selection_requests): Add new queue for selection
38 input events to replace previous XEvent queue in xterm.c. 223 input events to replace previous XEvent queue in xterm.c.
39 (queue_selection_requests_unwind): Adapt to new queue. 224 (queue_selection_requests_unwind): Adapt to new queue.
40 (x_reply_selection_request): Adapt to new queue. Unexpect 225 (x_reply_selection_request): Adapt to new queue.
41 wait_object in case of x errors (memory leak). 226 Unexpect wait_object in case of x errors (memory leak).
42 (x_handle_selection_request, x_handle_selection_clear): Make static. 227 (x_handle_selection_request, x_handle_selection_clear): Make static.
43 (x_handle_selection_event): New function. May queue selection events. 228 (x_handle_selection_event): New function. May queue selection events.
44 (wait_for_property_change_unwind): Use save_value instead of cons. 229 (wait_for_property_change_unwind): Use save_value instead of cons.
@@ -91,7 +276,7 @@
91 * gtkutil.h: Declare use_old_gtk_file_dialog. 276 * gtkutil.h: Declare use_old_gtk_file_dialog.
92 277
93 * gtkutil.c: Make use_old_gtk_file_dialog non-static. 278 * gtkutil.c: Make use_old_gtk_file_dialog non-static.
94 (xg_initialize): Moved DEFVAR_BOOL for use_old_gtk_file_dialog ... 279 (xg_initialize): Move DEFVAR_BOOL for use_old_gtk_file_dialog ...
95 * xfns.c (syms_of_xfns): ... to here. 280 * xfns.c (syms_of_xfns): ... to here.
96 281
97 * gtkutil.c (xg_get_file_with_chooser): Expand DEFAULT_FILENAME if 282 * gtkutil.c (xg_get_file_with_chooser): Expand DEFAULT_FILENAME if
@@ -166,20 +351,20 @@
166 351
167 * lisp.h: Fx_file_dialog takes 5 parameters. 352 * lisp.h: Fx_file_dialog takes 5 parameters.
168 353
169 * xfns.c (Fx_file_dialog): Both Motif and GTK version: Add 354 * xfns.c (Fx_file_dialog): Both Motif and GTK version:
170 parameter only_dir_p. 355 Add parameter only_dir_p.
171 In Motif version, don't put DEFAULT_FILENAME in filter part of the 356 In Motif version, don't put DEFAULT_FILENAME in filter part of the
172 dialog, just text field part. Do not add DEFAULT_FILENAME 357 dialog, just text field part. Do not add DEFAULT_FILENAME
173 to list of files if it isn't there. 358 to list of files if it isn't there.
174 In GTK version, pass only_dir_p parameter to xg_get_file_name. 359 In GTK version, pass only_dir_p parameter to xg_get_file_name.
175 360
176 * macfns.c (Fx_file_dialog): Add parameter only_dir_p. Check 361 * macfns.c (Fx_file_dialog): Add parameter only_dir_p.
177 only_dir_p instead of comparing prompt to "Dired". When using 362 Check only_dir_p instead of comparing prompt to "Dired". When using
178 a save dialog, add option kNavDontConfirmReplacement, change title 363 a save dialog, add option kNavDontConfirmReplacement, change title
179 to "Enter name", change text for save button to "Ok". 364 to "Enter name", change text for save button to "Ok".
180 365
181 * w32fns.c (Fx_file_dialog): Add parameter only_dir_p. Check 366 * w32fns.c (Fx_file_dialog): Add parameter only_dir_p.
182 only_dir_p instead of comparing prompt to "Dired". 367 Check only_dir_p instead of comparing prompt to "Dired".
183 368
184 * gtkutil.c (xg_get_file_with_chooser) 369 * gtkutil.c (xg_get_file_with_chooser)
185 (xg_get_file_with_selection): New functions, only defined ifdef 370 (xg_get_file_with_selection): New functions, only defined ifdef
@@ -196,8 +381,8 @@
196 381
1972004-11-01 Kim F. Storm <storm@cua.dk> 3822004-11-01 Kim F. Storm <storm@cua.dk>
198 383
199 * process.c (connect_wait_mask, num_pending_connects): Only 384 * process.c (connect_wait_mask, num_pending_connects):
200 declare and use them if NON_BLOCKING_CONNECT is defined. 385 Only declare and use them if NON_BLOCKING_CONNECT is defined.
201 (init_process): Initialize them if NON_BLOCKING_CONNECT defined. 386 (init_process): Initialize them if NON_BLOCKING_CONNECT defined.
202 (IF_NON_BLOCKING_CONNECT): New helper macro. 387 (IF_NON_BLOCKING_CONNECT): New helper macro.
203 (wait_reading_process_output): Only declare and use local vars 388 (wait_reading_process_output): Only declare and use local vars
@@ -212,8 +397,8 @@
212 * xmenu.c: Add prototypes for forward function declarations. 397 * xmenu.c: Add prototypes for forward function declarations.
213 (popup_get_selection): Remove parameter do_timers, remove call to 398 (popup_get_selection): Remove parameter do_timers, remove call to
214 timer_check. 399 timer_check.
215 (create_and_show_popup_menu, create_and_show_dialog): Remove 400 (create_and_show_popup_menu, create_and_show_dialog):
216 parameter do_timers from call to popup_get_selection. 401 Remove parameter do_timers from call to popup_get_selection.
217 402
218 * xdisp.c (update_tool_bar): Pass a copy of f->tool_bar_items to 403 * xdisp.c (update_tool_bar): Pass a copy of f->tool_bar_items to
219 tool_bar_items and assign the result to f->tool_bar_items if 404 tool_bar_items and assign the result to f->tool_bar_items if
@@ -232,7 +417,7 @@
232 * macterm.c: allow user to assign key modifiers to the Mac Option 417 * macterm.c: allow user to assign key modifiers to the Mac Option
233 key via a 'mac-option-modifier' variable. 418 key via a 'mac-option-modifier' variable.
234 419
2352004-10-28 Stefan <monnier@iro.umontreal.ca> 4202004-10-28 Stefan Monnier <monnier@iro.umontreal.ca>
236 421
237 * xselect.c (Vx_lost_selection_functions, Vx_sent_selection_functions): 422 * xselect.c (Vx_lost_selection_functions, Vx_sent_selection_functions):
238 Rename from Vx_lost_selection_hooks and Vx_sent_selection_hooks. 423 Rename from Vx_lost_selection_hooks and Vx_sent_selection_hooks.
diff --git a/src/Makefile.in b/src/Makefile.in
index ebbc4f45d61..820ade11d39 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
@@ -948,6 +950,7 @@ ${libsrc}make-docfile${EXEEXT}:
948#endif 950#endif
949 951
950temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT} 952temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
953 echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
951 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \ 954 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
952 -o temacs ${STARTFILES} ${obj} ${otherobj} \ 955 -o temacs ${STARTFILES} ${obj} ${otherobj} \
953 OBJECTS_MACHINE ${LIBES} 956 OBJECTS_MACHINE ${LIBES}
@@ -963,7 +966,7 @@ prefix-args${EXEEXT}: prefix-args.c $(config_h)
963#define OLDXMENU_OPTIONS 966#define OLDXMENU_OPTIONS
964#endif 967#endif
965 968
966#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) 969#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (HAVE_GTK)
967 970
968/* We use stamp-xmenu with these two deps 971/* We use stamp-xmenu with these two deps
969 to both ensure that lwlib gets remade based on its dependencies 972 to both ensure that lwlib gets remade based on its dependencies
@@ -1019,12 +1022,12 @@ really-oldXMenu:
1019 @true /* make -t should not create really-oldXMenu. */ 1022 @true /* make -t should not create really-oldXMenu. */
1020.PHONY: really-oldXMenu 1023.PHONY: really-oldXMenu
1021#endif /* not USE_X_TOOLKIT */ 1024#endif /* not USE_X_TOOLKIT */
1022#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS) */ 1025#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
1023 1026
1024/* We don\'t really need this, but satisfy the dependency. */ 1027/* We don\'t really need this, but satisfy the dependency. */
1025stamp-oldxmenu: 1028stamp-oldxmenu:
1026 touch stamp-oldxmenu 1029 touch stamp-oldxmenu
1027#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS) */ 1030#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
1028 1031
1029../config.status:: epaths.in 1032../config.status:: epaths.in
1030 @echo "The file epaths.h needs to be set up from epaths.in." 1033 @echo "The file epaths.h needs to be set up from epaths.in."
@@ -1279,6 +1282,7 @@ mostlyclean:
1279 rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a 1282 rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
1280 rm -f ../etc/DOC 1283 rm -f ../etc/DOC
1281 rm -f bootstrap-emacs${EXEEXT} 1284 rm -f bootstrap-emacs${EXEEXT}
1285 rm -f buildobj.lst
1282clean: mostlyclean 1286clean: mostlyclean
1283 rm -f emacs-*${EXEEXT} emacs${EXEEXT} 1287 rm -f emacs-*${EXEEXT} emacs${EXEEXT}
1284/**/# This is used in making a distribution. 1288/**/# 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/data.c b/src/data.c
index 92487f82ddb..2e3378cf319 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/dispextern.h b/src/dispextern.h
index 166d420d857..a179c8488dd 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -694,6 +694,10 @@ struct glyph_row
694 frames. It may be < 0 in case of completely invisible rows. */ 694 frames. It may be < 0 in case of completely invisible rows. */
695 int visible_height; 695 int visible_height;
696 696
697 /* Extra line spacing added after this row. Do not consider this
698 in last row when checking if row is fully visible. */
699 int extra_line_spacing;
700
697 /* Hash code. This hash code is available as soon as the row 701 /* Hash code. This hash code is available as soon as the row
698 is constructed, i.e. after a call to display_line. */ 702 is constructed, i.e. after a call to display_line. */
699 unsigned hash; 703 unsigned hash;
@@ -916,22 +920,39 @@ struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int));
916 920
917#define MATRIX_ROW_DISPLAYS_TEXT_P(ROW) ((ROW)->displays_text_p) 921#define MATRIX_ROW_DISPLAYS_TEXT_P(ROW) ((ROW)->displays_text_p)
918 922
923
924/* Helper macros */
925
926#define MR_PARTIALLY_VISIBLE(ROW) \
927 ((ROW)->height != (ROW)->visible_height)
928
929#define MR_PARTIALLY_VISIBLE_AT_TOP(W, ROW) \
930 ((ROW)->y < WINDOW_HEADER_LINE_HEIGHT ((W)))
931
932#define MR_PARTIALLY_VISIBLE_AT_BOTTOM(W, ROW) \
933 (((ROW)->y + (ROW)->height - (ROW)->extra_line_spacing) \
934 > WINDOW_BOX_HEIGHT_NO_MODE_LINE ((W)))
935
919/* Non-zero if ROW is not completely visible in window W. */ 936/* Non-zero if ROW is not completely visible in window W. */
920 937
921#define MATRIX_ROW_PARTIALLY_VISIBLE_P(ROW) \ 938#define MATRIX_ROW_PARTIALLY_VISIBLE_P(W, ROW) \
922 ((ROW)->height != (ROW)->visible_height) 939 (MR_PARTIALLY_VISIBLE ((ROW)) \
940 && (MR_PARTIALLY_VISIBLE_AT_TOP ((W), (ROW)) \
941 || MR_PARTIALLY_VISIBLE_AT_BOTTOM ((W), (ROW))))
942
943
923 944
924/* Non-zero if ROW is partially visible at the top of window W. */ 945/* Non-zero if ROW is partially visible at the top of window W. */
925 946
926#define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW) \ 947#define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW) \
927 (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \ 948 (MR_PARTIALLY_VISIBLE ((ROW)) \
928 && (ROW)->y < WINDOW_HEADER_LINE_HEIGHT ((W))) 949 && MR_PARTIALLY_VISIBLE_AT_TOP ((W), (ROW)))
929 950
930/* Non-zero if ROW is partially visible at the bottom of window W. */ 951/* Non-zero if ROW is partially visible at the bottom of window W. */
931 952
932#define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW) \ 953#define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW) \
933 (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \ 954 (MR_PARTIALLY_VISIBLE ((ROW)) \
934 && (ROW)->y + (ROW)->height > WINDOW_BOX_HEIGHT_NO_MODE_LINE ((W))) 955 && MR_PARTIALLY_VISIBLE_AT_BOTTOM ((W), (ROW)))
935 956
936/* Return the bottom Y + 1 of ROW. */ 957/* Return the bottom Y + 1 of ROW. */
937 958
@@ -1986,10 +2007,13 @@ struct it
1986 line, if the window has one. */ 2007 line, if the window has one. */
1987 int last_visible_y; 2008 int last_visible_y;
1988 2009
1989 /* Additional space in pixels between lines (for window systems 2010 /* Default amount of additional space in pixels between lines (for
1990 only.) */ 2011 window systems only.) */
1991 int extra_line_spacing; 2012 int extra_line_spacing;
1992 2013
2014 /* Max extra line spacing added in this row. */
2015 int max_extra_line_spacing;
2016
1993 /* Override font height information for this glyph. 2017 /* Override font height information for this glyph.
1994 Used if override_ascent >= 0. Cleared after this glyph. */ 2018 Used if override_ascent >= 0. Cleared after this glyph. */
1995 int override_ascent, override_descent, override_boff; 2019 int override_ascent, override_descent, override_boff;
diff --git a/src/doc.c b/src/doc.c
index 82df9134f61..f306caed36a 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 d9714693507..bd62147ad48 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 2e8134d4495..45b7caa280b 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,11 +34,10 @@ 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"
40#endif
41 41
42#if defined HAVE_SYS_RESOURCE_H 42#if defined HAVE_SYS_RESOURCE_H
43#include <sys/resource.h> 43#include <sys/resource.h>
@@ -53,8 +53,6 @@ Boston, MA 02111-1307, USA. */
53#include "frame.h" 53#include "frame.h"
54#include "window.h" 54#include "window.h"
55 55
56#include "systime.h"
57
58#ifdef STDC_HEADERS 56#ifdef STDC_HEADERS
59#include <float.h> 57#include <float.h>
60#define MAX_10_EXP DBL_MAX_10_EXP 58#define MAX_10_EXP DBL_MAX_10_EXP
diff --git a/src/emacs.c b/src/emacs.c
index ab60df39e27..356f74204bf 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1621,16 +1621,14 @@ main (argc, argv
1621 keys_of_minibuf (); 1621 keys_of_minibuf ();
1622 keys_of_window (); 1622 keys_of_window ();
1623 } 1623 }
1624 else 1624 else
1625 { 1625 {
1626 /* 1626 /* Initialization that must be done even if the global variable
1627 Initialization that must be done even if the global variable 1627 initialized is non zero. */
1628 initialized is non zero
1629 */
1630#ifdef HAVE_NTGUI 1628#ifdef HAVE_NTGUI
1631 globals_of_w32fns (); 1629 globals_of_w32fns ();
1632 globals_of_w32menu (); 1630 globals_of_w32menu ();
1633#endif /* end #ifdef HAVE_NTGUI */ 1631#endif /* HAVE_NTGUI */
1634 } 1632 }
1635 1633
1636 init_process (); /* init_display uses add_keyboard_wait_descriptor. */ 1634 init_process (); /* init_display uses add_keyboard_wait_descriptor. */
@@ -2180,16 +2178,19 @@ You must run Emacs in batch mode in order to dump it. */)
2180 if (! noninteractive) 2178 if (! noninteractive)
2181 error ("Dumping Emacs works only in batch mode"); 2179 error ("Dumping Emacs works only in batch mode");
2182 2180
2181#ifdef __linux__
2183 if (heap_bss_diff > MAX_HEAP_BSS_DIFF) 2182 if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
2184 { 2183 {
2185 fprintf (stderr, "**************************************************\n"); 2184 fprintf (stderr, "**************************************************\n");
2186 fprintf (stderr, "Warning: Your system has a gap between BSS and the\n"); 2185 fprintf (stderr, "Warning: Your system has a gap between BSS and the\n");
2187 fprintf (stderr, "heap. This usually means that exec-shield or\n"); 2186 fprintf (stderr, "heap (%lu byte). This usually means that exec-shield\n",
2188 fprintf (stderr, "something similar is in effect. The dump may fail\n"); 2187 heap_bss_diff);
2189 fprintf (stderr, "because of this. See the section about exec-shield\n"); 2188 fprintf (stderr, "or something similar is in effect. The dump may\n");
2190 fprintf (stderr, "in etc/PROBLEMS for more information.\n"); 2189 fprintf (stderr, "fail because of this. See the section about \n");
2190 fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n");
2191 fprintf (stderr, "**************************************************\n"); 2191 fprintf (stderr, "**************************************************\n");
2192 } 2192 }
2193#endif /* __linux__ */
2193 2194
2194 /* Bind `command-line-processed' to nil before dumping, 2195 /* Bind `command-line-processed' to nil before dumping,
2195 so that the dumped Emacs will process its command line 2196 so that the dumped Emacs will process its command line
@@ -2278,7 +2279,7 @@ synchronize_locale (category, plocale, desired_locale)
2278 { 2279 {
2279 *plocale = desired_locale; 2280 *plocale = desired_locale;
2280 setlocale (category, (STRINGP (desired_locale) 2281 setlocale (category, (STRINGP (desired_locale)
2281 ? (char *)(SDATA (desired_locale)) 2282 ? (char *) SDATA (desired_locale)
2282 : "")); 2283 : ""));
2283 } 2284 }
2284} 2285}
diff --git a/src/fontset.c b/src/fontset.c
index f370f2ae981..7dff29f3ed8 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -797,7 +797,7 @@ fontset_pattern_regexp (pattern)
797 { 797 {
798 if (*p0 == '-') 798 if (*p0 == '-')
799 ndashes++; 799 ndashes++;
800 else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 800 else if (*p0 == '*')
801 nstars++; 801 nstars++;
802 } 802 }
803 803
@@ -812,7 +812,7 @@ fontset_pattern_regexp (pattern)
812 *p1++ = '^'; 812 *p1++ = '^';
813 for (p0 = SDATA (pattern); *p0; p0++) 813 for (p0 = SDATA (pattern); *p0; p0++)
814 { 814 {
815 if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 815 if (*p0 == '*')
816 { 816 {
817 if (ndashes < 14) 817 if (ndashes < 14)
818 *p1++ = '.'; 818 *p1++ = '.';
@@ -836,29 +836,33 @@ fontset_pattern_regexp (pattern)
836} 836}
837 837
838/* Return ID of the base fontset named NAME. If there's no such 838/* Return ID of the base fontset named NAME. If there's no such
839 fontset, return -1. */ 839 fontset, return -1. NAME_PATTERN specifies how to treat NAME as this:
840 0: pattern containing '*' and '?' as wildcards
841 1: regular expression
842 2: literal fontset name
843*/
840 844
841int 845int
842fs_query_fontset (name, regexpp) 846fs_query_fontset (name, name_pattern)
843 Lisp_Object name; 847 Lisp_Object name;
844 int regexpp; 848 int name_pattern;
845{ 849{
846 Lisp_Object tem; 850 Lisp_Object tem;
847 int i; 851 int i;
848 852
849 name = Fdowncase (name); 853 name = Fdowncase (name);
850 if (!regexpp) 854 if (name_pattern != 1)
851 { 855 {
852 tem = Frassoc (name, Vfontset_alias_alist); 856 tem = Frassoc (name, Vfontset_alias_alist);
853 if (CONSP (tem) && STRINGP (XCAR (tem))) 857 if (CONSP (tem) && STRINGP (XCAR (tem)))
854 name = XCAR (tem); 858 name = XCAR (tem);
855 else 859 else if (name_pattern == 0)
856 { 860 {
857 tem = fontset_pattern_regexp (name); 861 tem = fontset_pattern_regexp (name);
858 if (STRINGP (tem)) 862 if (STRINGP (tem))
859 { 863 {
860 name = tem; 864 name = tem;
861 regexpp = 1; 865 name_pattern = 1;
862 } 866 }
863 } 867 }
864 } 868 }
@@ -873,7 +877,7 @@ fs_query_fontset (name, regexpp)
873 continue; 877 continue;
874 878
875 this_name = FONTSET_NAME (fontset); 879 this_name = FONTSET_NAME (fontset);
876 if (regexpp 880 if (name_pattern == 1
877 ? fast_string_match (name, this_name) >= 0 881 ? fast_string_match (name, this_name) >= 0
878 : !strcmp (SDATA (name), SDATA (this_name))) 882 : !strcmp (SDATA (name), SDATA (this_name)))
879 return i; 883 return i;
@@ -964,6 +968,7 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */)
964{ 968{
965 Lisp_Object fontset, elements, ascii_font; 969 Lisp_Object fontset, elements, ascii_font;
966 Lisp_Object tem, tail, elt; 970 Lisp_Object tem, tail, elt;
971 int id;
967 972
968 (*check_window_system_func) (); 973 (*check_window_system_func) ();
969 974
@@ -971,10 +976,14 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */)
971 CHECK_LIST (fontlist); 976 CHECK_LIST (fontlist);
972 977
973 name = Fdowncase (name); 978 name = Fdowncase (name);
974 tem = Fquery_fontset (name, Qnil); 979 id = fs_query_fontset (name, 2);
975 if (!NILP (tem)) 980 if (id >= 0)
976 error ("Fontset `%s' matches the existing fontset `%s'", 981 {
977 SDATA (name), SDATA (tem)); 982 fontset = FONTSET_FROM_ID (id);
983 tem = FONTSET_NAME (fontset);
984 error ("Fontset `%s' matches the existing fontset `%s'",
985 SDATA (name), SDATA (tem));
986 }
978 987
979 /* Check the validity of FONTLIST while creating a template for 988 /* Check the validity of FONTLIST while creating a template for
980 fontset elements. */ 989 fontset elements. */
@@ -1049,7 +1058,11 @@ check_fontset_name (name)
1049 return Vdefault_fontset; 1058 return Vdefault_fontset;
1050 1059
1051 CHECK_STRING (name); 1060 CHECK_STRING (name);
1052 id = fs_query_fontset (name, 0); 1061 /* First try NAME as literal. */
1062 id = fs_query_fontset (name, 2);
1063 if (id < 0)
1064 /* For backward compatibility, try again NAME as pattern. */
1065 id = fs_query_fontset (name, 0);
1053 if (id < 0) 1066 if (id < 0)
1054 error ("Fontset `%s' does not exist", SDATA (name)); 1067 error ("Fontset `%s' does not exist", SDATA (name));
1055 return FONTSET_FROM_ID (id); 1068 return FONTSET_FROM_ID (id);
diff --git a/src/fringe.c b/src/fringe.c
index e66fa4adecc..03abffab5c8 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -931,6 +931,7 @@ update_window_fringes (w, force_p)
931 if (force_p 931 if (force_p
932 || row->y != cur->y 932 || row->y != cur->y
933 || row->visible_height != cur->visible_height 933 || row->visible_height != cur->visible_height
934 || row->ends_at_zv_p != cur->ends_at_zv_p
934 || left != cur->left_fringe_bitmap 935 || left != cur->left_fringe_bitmap
935 || right != cur->right_fringe_bitmap 936 || right != cur->right_fringe_bitmap
936 || left_face_id != cur->left_fringe_face_id 937 || left_face_id != cur->left_fringe_face_id
@@ -954,6 +955,9 @@ update_window_fringes (w, force_p)
954 row->right_fringe_bitmap = right; 955 row->right_fringe_bitmap = right;
955 row->left_fringe_face_id = left_face_id; 956 row->left_fringe_face_id = left_face_id;
956 row->right_fringe_face_id = right_face_id; 957 row->right_fringe_face_id = right_face_id;
958
959 if (rn > 0 && row->redraw_fringe_bitmaps_p)
960 row[-1].redraw_fringe_bitmaps_p = cur[-1].redraw_fringe_bitmaps_p = 1;
957 } 961 }
958 962
959 return redraw_p; 963 return redraw_p;
@@ -1057,7 +1061,7 @@ compute_fringe_widths (f, redraw)
1057 1061
1058/* Free resources used by a user-defined bitmap. */ 1062/* Free resources used by a user-defined bitmap. */
1059 1063
1060int 1064void
1061destroy_fringe_bitmap (n) 1065destroy_fringe_bitmap (n)
1062 int n; 1066 int n;
1063{ 1067{
diff --git a/src/intervals.h b/src/intervals.h
index 15e59537377..f3b281f4184 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 ((void)CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL) 90 ((void)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,7 +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));
292extern int compare_string_intervals P_ ((Lisp_Object s1, Lisp_Object s2)); 297extern int compare_string_intervals P_ ((Lisp_Object, Lisp_Object));
293extern Lisp_Object textget P_ ((Lisp_Object, Lisp_Object)); 298extern Lisp_Object textget P_ ((Lisp_Object, Lisp_Object));
294extern Lisp_Object lookup_char_property P_ ((Lisp_Object, Lisp_Object, int)); 299extern Lisp_Object lookup_char_property P_ ((Lisp_Object, Lisp_Object, int));
295extern 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 35bfd1402c9..b520d655fb9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1827,6 +1827,14 @@ command_loop_1 ()
1827 1827
1828 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) 1828 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
1829 { 1829 {
1830 /* Setting transient-mark-mode to `only' is a way of
1831 turning it on for just one command. */
1832
1833 if (EQ (Vtransient_mark_mode, Qidentity))
1834 Vtransient_mark_mode = Qnil;
1835 if (EQ (Vtransient_mark_mode, Qonly))
1836 Vtransient_mark_mode = Qidentity;
1837
1830 if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode)) 1838 if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
1831 { 1839 {
1832 /* We could also call `deactivate'mark'. */ 1840 /* We could also call `deactivate'mark'. */
@@ -1842,16 +1850,6 @@ command_loop_1 ()
1842 call1 (Vrun_hooks, intern ("activate-mark-hook")); 1850 call1 (Vrun_hooks, intern ("activate-mark-hook"));
1843 } 1851 }
1844 1852
1845 /* Setting transient-mark-mode to `only' is a way of
1846 turning it on for just one command. */
1847 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
1848 {
1849 if (EQ (Vtransient_mark_mode, Qidentity))
1850 Vtransient_mark_mode = Qnil;
1851 if (EQ (Vtransient_mark_mode, Qonly))
1852 Vtransient_mark_mode = Qidentity;
1853 }
1854
1855 finalize: 1853 finalize:
1856 1854
1857 if (current_buffer == prev_buffer 1855 if (current_buffer == prev_buffer
@@ -6640,7 +6638,6 @@ read_avail_input (expected)
6640 if (d->read_socket_hook) 6638 if (d->read_socket_hook)
6641 { 6639 {
6642 int nr; 6640 int nr;
6643
6644 struct input_event hold_quit; 6641 struct input_event hold_quit;
6645 6642
6646 EVENT_INIT (hold_quit); 6643 EVENT_INIT (hold_quit);
diff --git a/src/keymap.c b/src/keymap.c
index 256485079c1..891e41f0b58 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 7b9b0427da6..2c3141733bc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2278,6 +2278,7 @@ EXFUN (Felt, 2);
2278EXFUN (Fmember, 2); 2278EXFUN (Fmember, 2);
2279EXFUN (Frassq, 2); 2279EXFUN (Frassq, 2);
2280EXFUN (Fdelq, 2); 2280EXFUN (Fdelq, 2);
2281EXFUN (Fdelete, 2);
2281EXFUN (Fsort, 2); 2282EXFUN (Fsort, 2);
2282EXFUN (Freverse, 1); 2283EXFUN (Freverse, 1);
2283EXFUN (Fnreverse, 1); 2284EXFUN (Fnreverse, 1);
@@ -2369,6 +2370,7 @@ extern void adjust_after_replace P_ ((int, int, Lisp_Object, int, int));
2369extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int)); 2370extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int));
2370extern void adjust_after_insert P_ ((int, int, int, int, int)); 2371extern void adjust_after_insert P_ ((int, int, int, int, int));
2371extern void replace_range P_ ((int, int, Lisp_Object, int, int, int)); 2372extern void replace_range P_ ((int, int, Lisp_Object, int, int, int));
2373extern void replace_range_2 P_ ((int, int, int, int, char *, int, int, int));
2372extern void syms_of_insdel P_ ((void)); 2374extern void syms_of_insdel P_ ((void));
2373 2375
2374/* Defined in dispnew.c */ 2376/* Defined in dispnew.c */
@@ -3137,6 +3139,11 @@ extern void syms_of_xterm P_ ((void));
3137 3139
3138/* Defined in getloadavg.c */ 3140/* Defined in getloadavg.c */
3139extern int getloadavg P_ ((double [], int)); 3141extern int getloadavg P_ ((double [], int));
3142
3143#ifdef MSDOS
3144/* Defined in msdos.c */
3145EXFUN (Fmsdos_downcase_filename, 1);
3146#endif
3140 3147
3141/* Nonzero means Emacs has already been initialized. 3148/* Nonzero means Emacs has already been initialized.
3142 Used during startup to detect startup of dumped Emacs. */ 3149 Used during startup to detect startup of dumped Emacs. */
diff --git a/src/lread.c b/src/lread.c
index 46fe6cd3e51..77750eea4fa 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2375,7 +2375,7 @@ read1 (readcharfun, pch, first_in_list)
2375 c = 0; 2375 c = 0;
2376 else if (c == (CHAR_CTL | '?')) 2376 else if (c == (CHAR_CTL | '?'))
2377 c = 127; 2377 c = 127;
2378 2378
2379 if (c & CHAR_SHIFT) 2379 if (c & CHAR_SHIFT)
2380 { 2380 {
2381 /* Shift modifier is valid only with [A-Za-z]. */ 2381 /* Shift modifier is valid only with [A-Za-z]. */
@@ -2460,9 +2460,9 @@ read1 (readcharfun, pch, first_in_list)
2460 2460
2461 if (next_char <= 040 2461 if (next_char <= 040
2462 || (next_char < 0200 2462 || (next_char < 0200
2463 && index ("\"';([#?", next_char) 2463 && (index ("\"';([#?", next_char)
2464 || (!first_in_list && next_char == '`') 2464 || (!first_in_list && next_char == '`')
2465 || (new_backquote_flag && next_char == ','))) 2465 || (new_backquote_flag && next_char == ','))))
2466 { 2466 {
2467 *pch = c; 2467 *pch = c;
2468 return Qnil; 2468 return Qnil;
@@ -3682,7 +3682,7 @@ init_lread ()
3682 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is 3682 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is
3683 almost never correct, thereby causing a warning to be printed out that 3683 almost never correct, thereby causing a warning to be printed out that
3684 confuses users. Since PATH_LOADSEARCH is always overridden by the 3684 confuses users. Since PATH_LOADSEARCH is always overridden by the
3685 EMACSLOADPATH environment variable below, disable the warning on NT. 3685 EMACSLOADPATH environment variable below, disable the warning on NT.
3686 Also, when using the "self-contained" option for Carbon Emacs for MacOSX, 3686 Also, when using the "self-contained" option for Carbon Emacs for MacOSX,
3687 the "standard" paths may not exist and would be overridden by 3687 the "standard" paths may not exist and would be overridden by
3688 EMACSLOADPATH as on NT. Since this depends on how the executable 3688 EMACSLOADPATH as on NT. Since this depends on how the executable
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index a7efcc4cae5..5a232e28362 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -168,6 +168,9 @@ temacs: $(BLD) $(TEMACS)
168$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) 168$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES)
169 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS) 169 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
170 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 16 170 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 16
171 echo $(OBJ0) > $(BLD)/buildobj.lst
172 echo $(OBJ1) >> $(BLD)/buildobj.lst
173 echo $(WIN32OBJ) >> $(BLD)/buildobj.lst
171 174
172bootstrap: bootstrap-emacs 175bootstrap: bootstrap-emacs
173 176
diff --git a/src/msdos.c b/src/msdos.c
index 712eb05b959..ab71b642e80 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 76c648b9a2e..8bb55f21248 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2087,7 +2087,7 @@ print_object (obj, printcharfun, escapeflag)
2087 2087
2088 case Lisp_Misc_Save_Value: 2088 case Lisp_Misc_Save_Value:
2089 strout ("#<save_value ", -1, -1, printcharfun, 0); 2089 strout ("#<save_value ", -1, -1, printcharfun, 0);
2090 sprintf(buf, "ptr=0x%08x int=%d", 2090 sprintf(buf, "ptr=0x%08lx int=%d",
2091 (unsigned long) XSAVE_VALUE (obj)->pointer, 2091 (unsigned long) XSAVE_VALUE (obj)->pointer,
2092 XSAVE_VALUE (obj)->integer); 2092 XSAVE_VALUE (obj)->integer);
2093 strout (buf, -1, -1, printcharfun, 0); 2093 strout (buf, -1, -1, printcharfun, 0);
diff --git a/src/process.c b/src/process.c
index db6e85c0fb3..65dec1457b0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2722,7 +2722,6 @@ usage: (make-network-process &rest ARGS) */)
2722 int xerrno = 0; 2722 int xerrno = 0;
2723 int s = -1, outch, inch; 2723 int s = -1, outch, inch;
2724 struct gcpro gcpro1; 2724 struct gcpro gcpro1;
2725 int retry = 0;
2726 int count = SPECPDL_INDEX (); 2725 int count = SPECPDL_INDEX ();
2727 int count1; 2726 int count1;
2728 Lisp_Object QCaddress; /* one of QClocal or QCremote */ 2727 Lisp_Object QCaddress; /* one of QClocal or QCremote */
@@ -3023,6 +3022,8 @@ usage: (make-network-process &rest ARGS) */)
3023 { 3022 {
3024 int optn, optbits; 3023 int optn, optbits;
3025 3024
3025 retry_connect:
3026
3026 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); 3027 s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol);
3027 if (s < 0) 3028 if (s < 0)
3028 { 3029 {
@@ -3101,8 +3102,6 @@ usage: (make-network-process &rest ARGS) */)
3101 break; 3102 break;
3102 } 3103 }
3103 3104
3104 retry_connect:
3105
3106 immediate_quit = 1; 3105 immediate_quit = 1;
3107 QUIT; 3106 QUIT;
3108 3107
@@ -3144,22 +3143,13 @@ usage: (make-network-process &rest ARGS) */)
3144 3143
3145 immediate_quit = 0; 3144 immediate_quit = 0;
3146 3145
3147 if (xerrno == EINTR)
3148 goto retry_connect;
3149 if (xerrno == EADDRINUSE && retry < 20)
3150 {
3151 /* A delay here is needed on some FreeBSD systems,
3152 and it is harmless, since this retrying takes time anyway
3153 and should be infrequent. */
3154 Fsleep_for (make_number (1), Qnil);
3155 retry++;
3156 goto retry_connect;
3157 }
3158
3159 /* Discard the unwind protect closing S. */ 3146 /* Discard the unwind protect closing S. */
3160 specpdl_ptr = specpdl + count1; 3147 specpdl_ptr = specpdl + count1;
3161 emacs_close (s); 3148 emacs_close (s);
3162 s = -1; 3149 s = -1;
3150
3151 if (xerrno == EINTR)
3152 goto retry_connect;
3163 } 3153 }
3164 3154
3165 if (s >= 0) 3155 if (s >= 0)
diff --git a/src/window.c b/src/window.c
index d9ac2eb62bd..be5e9167d67 100644
--- a/src/window.c
+++ b/src/window.c
@@ -206,7 +206,7 @@ static int window_initialized;
206Lisp_Object Qwindow_configuration_change_hook; 206Lisp_Object Qwindow_configuration_change_hook;
207Lisp_Object Vwindow_configuration_change_hook; 207Lisp_Object Vwindow_configuration_change_hook;
208 208
209/* Nonzero means scroll commands try to put point 209/* Non-nil means scroll commands try to put point
210 at the same screen height as previously. */ 210 at the same screen height as previously. */
211 211
212Lisp_Object Vscroll_preserve_screen_position; 212Lisp_Object Vscroll_preserve_screen_position;
@@ -4508,7 +4508,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4508 results for variable height lines. */ 4508 results for variable height lines. */
4509 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); 4509 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
4510 it.current_y = it.last_visible_y; 4510 it.current_y = it.last_visible_y;
4511 move_it_vertically (&it, - window_box_height (w) / 2); 4511 move_it_vertically_backward (&it, window_box_height (w) / 2);
4512 4512
4513 /* The function move_iterator_vertically may move over more than 4513 /* The function move_iterator_vertically may move over more than
4514 the specified y-distance. If it->w is small, e.g. a 4514 the specified y-distance. If it->w is small, e.g. a
@@ -4518,14 +4518,14 @@ window_scroll_pixel_based (window, n, whole, noerror)
4518 if (it.current_y <= 0) 4518 if (it.current_y <= 0)
4519 { 4519 {
4520 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); 4520 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
4521 move_it_vertically (&it, 0); 4521 move_it_vertically_backward (&it, 0);
4522 it.current_y = 0; 4522 it.current_y = 0;
4523 } 4523 }
4524 4524
4525 start = it.current.pos; 4525 start = it.current.pos;
4526 } 4526 }
4527 4527
4528 /* If scroll_preserve_screen_position is non-zero, we try to set 4528 /* If scroll_preserve_screen_position is non-nil, we try to set
4529 point in the same window line as it is now, so get that line. */ 4529 point in the same window line as it is now, so get that line. */
4530 if (!NILP (Vscroll_preserve_screen_position)) 4530 if (!NILP (Vscroll_preserve_screen_position))
4531 { 4531 {
@@ -5187,7 +5187,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5187 5187
5188 SET_TEXT_POS (pt, PT, PT_BYTE); 5188 SET_TEXT_POS (pt, PT, PT_BYTE);
5189 start_display (&it, w, pt); 5189 start_display (&it, w, pt);
5190 move_it_vertically (&it, - window_box_height (w) / 2); 5190 move_it_vertically_backward (&it, window_box_height (w) / 2);
5191 charpos = IT_CHARPOS (it); 5191 charpos = IT_CHARPOS (it);
5192 bytepos = IT_BYTEPOS (it); 5192 bytepos = IT_BYTEPOS (it);
5193 } 5193 }
@@ -5195,29 +5195,62 @@ and redisplay normally--don't erase and redraw the frame. */)
5195 { 5195 {
5196 struct it it; 5196 struct it it;
5197 struct text_pos pt; 5197 struct text_pos pt;
5198 int y0, y1, h, nlines; 5198 int nlines = - XINT (arg);
5199 int extra_line_spacing;
5200 int h = window_box_height (w);
5199 5201
5200 SET_TEXT_POS (pt, PT, PT_BYTE); 5202 SET_TEXT_POS (pt, PT, PT_BYTE);
5201 start_display (&it, w, pt); 5203 start_display (&it, w, pt);
5202 y0 = it.current_y; 5204
5205 /* Be sure we have the exact height of the full line containing PT. */
5206 move_it_by_lines (&it, 0, 1);
5203 5207
5204 /* The amount of pixels we have to move back is the window 5208 /* The amount of pixels we have to move back is the window
5205 height minus what's displayed in the line containing PT, 5209 height minus what's displayed in the line containing PT,
5206 and the lines below. */ 5210 and the lines below. */
5207 nlines = - XINT (arg) - 1; 5211 it.current_y = 0;
5212 it.vpos = 0;
5208 move_it_by_lines (&it, nlines, 1); 5213 move_it_by_lines (&it, nlines, 1);
5209 5214
5210 y1 = line_bottom_y (&it); 5215 if (it.vpos == nlines)
5216 h -= it.current_y;
5217 else
5218 {
5219 /* Last line has no newline */
5220 h -= line_bottom_y (&it);
5221 it.vpos++;
5222 }
5223
5224 /* Don't reserve space for extra line spacing of last line. */
5225 extra_line_spacing = it.max_extra_line_spacing;
5211 5226
5212 /* If we can't move down NLINES lines because we hit 5227 /* If we can't move down NLINES lines because we hit
5213 the end of the buffer, count in some empty lines. */ 5228 the end of the buffer, count in some empty lines. */
5214 if (it.vpos < nlines) 5229 if (it.vpos < nlines)
5215 y1 += (nlines - it.vpos) * FRAME_LINE_HEIGHT (it.f); 5230 {
5216 5231 nlines -= it.vpos;
5217 h = window_box_height (w) - (y1 - y0); 5232 extra_line_spacing = it.extra_line_spacing;
5233 h -= nlines * (FRAME_LINE_HEIGHT (it.f) + extra_line_spacing);
5234 }
5235 if (h <= 0)
5236 return Qnil;
5218 5237
5238 /* Now find the new top line (starting position) of the window. */
5219 start_display (&it, w, pt); 5239 start_display (&it, w, pt);
5220 move_it_vertically (&it, - h); 5240 it.current_y = 0;
5241 move_it_vertically_backward (&it, h);
5242
5243 /* If extra line spacing is present, we may move too far
5244 back. This causes the last line to be only partially
5245 visible (which triggers redisplay to recenter that line
5246 in the middle), so move forward.
5247 But ignore extra line spacing on last line, as it is not
5248 considered to be part of the visible height of the line.
5249 */
5250 h += extra_line_spacing;
5251 while (-it.current_y > h)
5252 move_it_by_lines (&it, 1, 1);
5253
5221 charpos = IT_CHARPOS (it); 5254 charpos = IT_CHARPOS (it);
5222 bytepos = IT_BYTEPOS (it); 5255 bytepos = IT_BYTEPOS (it);
5223 } 5256 }
diff --git a/src/xdisp.c b/src/xdisp.c
index 4b0865aa4f0..c3f659a85e6 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2071,6 +2071,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
2071 * FRAME_LINE_HEIGHT (it->f)); 2071 * FRAME_LINE_HEIGHT (it->f));
2072 else if (it->f->extra_line_spacing > 0) 2072 else if (it->f->extra_line_spacing > 0)
2073 it->extra_line_spacing = it->f->extra_line_spacing; 2073 it->extra_line_spacing = it->f->extra_line_spacing;
2074 it->max_extra_line_spacing = 0;
2074 } 2075 }
2075 2076
2076 /* If realized faces have been removed, e.g. because of face 2077 /* If realized faces have been removed, e.g. because of face
@@ -6066,10 +6067,13 @@ move_it_vertically_backward (it, dy)
6066{ 6067{
6067 int nlines, h; 6068 int nlines, h;
6068 struct it it2, it3; 6069 struct it it2, it3;
6069 int start_pos = IT_CHARPOS (*it); 6070 int start_pos;
6070 6071
6072 move_further_back:
6071 xassert (dy >= 0); 6073 xassert (dy >= 0);
6072 6074
6075 start_pos = IT_CHARPOS (*it);
6076
6073 /* Estimate how many newlines we must move back. */ 6077 /* Estimate how many newlines we must move back. */
6074 nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f)); 6078 nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f));
6075 6079
@@ -6135,13 +6139,13 @@ move_it_vertically_backward (it, dy)
6135 a line height of 13 pixels each, recentering with point 6139 a line height of 13 pixels each, recentering with point
6136 on the bottom line will try to move -39/2 = 19 pixels 6140 on the bottom line will try to move -39/2 = 19 pixels
6137 backward. Try to avoid moving into the first line. */ 6141 backward. Try to avoid moving into the first line. */
6138 && it->current_y - target_y > line_height / 3 * 2 6142 && it->current_y - target_y > line_height * 2 / 3
6139 && IT_CHARPOS (*it) > BEGV) 6143 && IT_CHARPOS (*it) > BEGV)
6140 { 6144 {
6141 TRACE_MOVE ((stderr, " not far enough -> move_vert %d\n", 6145 TRACE_MOVE ((stderr, " not far enough -> move_vert %d\n",
6142 target_y - it->current_y)); 6146 target_y - it->current_y));
6143 move_it_vertically (it, target_y - it->current_y); 6147 dy = it->current_y - target_y;
6144 xassert (IT_CHARPOS (*it) >= BEGV); 6148 goto move_further_back;
6145 } 6149 }
6146 else if (target_y >= it->current_y + line_height 6150 else if (target_y >= it->current_y + line_height
6147 && IT_CHARPOS (*it) < ZV) 6151 && IT_CHARPOS (*it) < ZV)
@@ -6182,7 +6186,7 @@ move_it_vertically (it, dy)
6182{ 6186{
6183 if (dy <= 0) 6187 if (dy <= 0)
6184 move_it_vertically_backward (it, -dy); 6188 move_it_vertically_backward (it, -dy);
6185 else if (dy > 0) 6189 else
6186 { 6190 {
6187 TRACE_MOVE ((stderr, "move_it_v: from %d, %d\n", IT_CHARPOS (*it), dy)); 6191 TRACE_MOVE ((stderr, "move_it_v: from %d, %d\n", IT_CHARPOS (*it), dy));
6188 move_it_to (it, ZV, -1, it->current_y + dy, -1, 6192 move_it_to (it, ZV, -1, it->current_y + dy, -1,
@@ -6279,6 +6283,8 @@ move_it_by_lines (it, dvpos, need_y_p)
6279 /* DVPOS == 0 means move to the start of the screen line. */ 6283 /* DVPOS == 0 means move to the start of the screen line. */
6280 move_it_vertically_backward (it, 0); 6284 move_it_vertically_backward (it, 0);
6281 xassert (it->current_x == 0 && it->hpos == 0); 6285 xassert (it->current_x == 0 && it->hpos == 0);
6286 /* Let next call to line_bottom_y calculate real line height */
6287 last_height = 0;
6282 } 6288 }
6283 else if (dvpos > 0) 6289 else if (dvpos > 0)
6284 move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS); 6290 move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS);
@@ -7422,7 +7428,7 @@ resize_mini_window (w, exact_p)
7422 height = it.current_y + last_height; 7428 height = it.current_y + last_height;
7423 else 7429 else
7424 height = it.current_y + it.max_ascent + it.max_descent; 7430 height = it.current_y + it.max_ascent + it.max_descent;
7425 height -= it.extra_line_spacing; 7431 height -= min (it.extra_line_spacing, it.max_extra_line_spacing);
7426 height = (height + unit - 1) / unit; 7432 height = (height + unit - 1) / unit;
7427 } 7433 }
7428 7434
@@ -8699,6 +8705,7 @@ display_tool_bar_line (it)
8699 { 8705 {
8700 row->height = row->phys_height = it->last_visible_y - row->y; 8706 row->height = row->phys_height = it->last_visible_y - row->y;
8701 row->ascent = row->phys_ascent = 0; 8707 row->ascent = row->phys_ascent = 0;
8708 row->extra_line_spacing = 0;
8702 } 8709 }
8703 8710
8704 row->full_width_p = 1; 8711 row->full_width_p = 1;
@@ -10888,7 +10895,7 @@ make_cursor_line_fully_visible (w, force_p)
10888 row = MATRIX_ROW (matrix, w->cursor.vpos); 10895 row = MATRIX_ROW (matrix, w->cursor.vpos);
10889 10896
10890 /* If the cursor row is not partially visible, there's nothing to do. */ 10897 /* If the cursor row is not partially visible, there's nothing to do. */
10891 if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) 10898 if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row))
10892 return 1; 10899 return 1;
10893 10900
10894 /* If the row the cursor is in is taller than the window's height, 10901 /* If the row the cursor is in is taller than the window's height,
@@ -11042,7 +11049,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
11042 { 11049 {
11043 start_display (&it, w, scroll_margin_pos); 11050 start_display (&it, w, scroll_margin_pos);
11044 if (this_scroll_margin) 11051 if (this_scroll_margin)
11045 move_it_vertically (&it, - this_scroll_margin); 11052 move_it_vertically_backward (&it, this_scroll_margin);
11046 if (extra_scroll_margin_lines) 11053 if (extra_scroll_margin_lines)
11047 move_it_by_lines (&it, - extra_scroll_margin_lines, 0); 11054 move_it_by_lines (&it, - extra_scroll_margin_lines, 0);
11048 scroll_margin_pos = it.current.pos; 11055 scroll_margin_pos = it.current.pos;
@@ -11162,7 +11169,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
11162 if (amount_to_scroll <= 0) 11169 if (amount_to_scroll <= 0)
11163 return SCROLLING_FAILED; 11170 return SCROLLING_FAILED;
11164 11171
11165 move_it_vertically (&it, - amount_to_scroll); 11172 move_it_vertically_backward (&it, amount_to_scroll);
11166 startp = it.current.pos; 11173 startp = it.current.pos;
11167 } 11174 }
11168 } 11175 }
@@ -11466,7 +11473,7 @@ try_cursor_movement (window, startp, scroll_step)
11466 /* if PT is not in the glyph row, give up. */ 11473 /* if PT is not in the glyph row, give up. */
11467 rc = CURSOR_MOVEMENT_MUST_SCROLL; 11474 rc = CURSOR_MOVEMENT_MUST_SCROLL;
11468 } 11475 }
11469 else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) 11476 else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row))
11470 { 11477 {
11471 if (PT == MATRIX_ROW_END_CHARPOS (row) 11478 if (PT == MATRIX_ROW_END_CHARPOS (row)
11472 && !row->ends_at_zv_p 11479 && !row->ends_at_zv_p
@@ -12043,7 +12050,7 @@ redisplay_window (window, just_this_one_p)
12043 if (it.current_y <= 0) 12050 if (it.current_y <= 0)
12044 { 12051 {
12045 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); 12052 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
12046 move_it_vertically (&it, 0); 12053 move_it_vertically_backward (&it, 0);
12047 xassert (IT_CHARPOS (it) <= PT); 12054 xassert (IT_CHARPOS (it) <= PT);
12048 it.current_y = 0; 12055 it.current_y = 0;
12049 } 12056 }
@@ -12395,7 +12402,7 @@ try_window_reusing_current_matrix (w)
12395 /* Give up if old or new display is scrolled vertically. We could 12402 /* Give up if old or new display is scrolled vertically. We could
12396 make this function handle this, but right now it doesn't. */ 12403 make this function handle this, but right now it doesn't. */
12397 start_row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 12404 start_row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
12398 if (w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (start_row)) 12405 if (w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (w, start_row))
12399 return 0; 12406 return 0;
12400 12407
12401 /* The variable new_start now holds the new window start. The old 12408 /* The variable new_start now holds the new window start. The old
@@ -12443,7 +12450,7 @@ try_window_reusing_current_matrix (w)
12443 start = start_row->start.pos; 12450 start = start_row->start.pos;
12444 /* If there are no more rows to try, or just one, give up. */ 12451 /* If there are no more rows to try, or just one, give up. */
12445 if (start_row == MATRIX_MODE_LINE_ROW (w->current_matrix) - 1 12452 if (start_row == MATRIX_MODE_LINE_ROW (w->current_matrix) - 1
12446 || w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (start_row) 12453 || w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (w, start_row)
12447 || CHARPOS (start) == ZV) 12454 || CHARPOS (start) == ZV)
12448 { 12455 {
12449 clear_glyph_matrix (w->desired_matrix); 12456 clear_glyph_matrix (w->desired_matrix);
@@ -14237,6 +14244,7 @@ compute_line_metrics (it)
14237 row->height = it->max_ascent + it->max_descent; 14244 row->height = it->max_ascent + it->max_descent;
14238 row->phys_ascent = it->max_phys_ascent; 14245 row->phys_ascent = it->max_phys_ascent;
14239 row->phys_height = it->max_phys_ascent + it->max_phys_descent; 14246 row->phys_height = it->max_phys_ascent + it->max_phys_descent;
14247 row->extra_line_spacing = it->max_extra_line_spacing;
14240 } 14248 }
14241 14249
14242 /* Compute the width of this line. */ 14250 /* Compute the width of this line. */
@@ -14280,6 +14288,7 @@ compute_line_metrics (it)
14280 row->pixel_width -= it->truncation_pixel_width; 14288 row->pixel_width -= it->truncation_pixel_width;
14281 row->ascent = row->phys_ascent = 0; 14289 row->ascent = row->phys_ascent = 0;
14282 row->height = row->phys_height = row->visible_height = 1; 14290 row->height = row->phys_height = row->visible_height = 1;
14291 row->extra_line_spacing = 0;
14283 } 14292 }
14284 14293
14285 /* Compute a hash code for this row. */ 14294 /* Compute a hash code for this row. */
@@ -14616,6 +14625,7 @@ display_line (it)
14616 row->height = it->max_ascent + it->max_descent; 14625 row->height = it->max_ascent + it->max_descent;
14617 row->phys_ascent = it->max_phys_ascent; 14626 row->phys_ascent = it->max_phys_ascent;
14618 row->phys_height = it->max_phys_ascent + it->max_phys_descent; 14627 row->phys_height = it->max_phys_ascent + it->max_phys_descent;
14628 row->extra_line_spacing = it->max_extra_line_spacing;
14619 14629
14620 /* Loop generating characters. The loop is left with IT on the next 14630 /* Loop generating characters. The loop is left with IT on the next
14621 character to display. */ 14631 character to display. */
@@ -14681,6 +14691,8 @@ display_line (it)
14681 row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent); 14691 row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
14682 row->phys_height = max (row->phys_height, 14692 row->phys_height = max (row->phys_height,
14683 it->max_phys_ascent + it->max_phys_descent); 14693 it->max_phys_ascent + it->max_phys_descent);
14694 row->extra_line_spacing = max (row->extra_line_spacing,
14695 it->max_extra_line_spacing);
14684 set_iterator_to_next (it, 1); 14696 set_iterator_to_next (it, 1);
14685 continue; 14697 continue;
14686 } 14698 }
@@ -14709,6 +14721,8 @@ display_line (it)
14709 row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent); 14721 row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
14710 row->phys_height = max (row->phys_height, 14722 row->phys_height = max (row->phys_height,
14711 it->max_phys_ascent + it->max_phys_descent); 14723 it->max_phys_ascent + it->max_phys_descent);
14724 row->extra_line_spacing = max (row->extra_line_spacing,
14725 it->max_extra_line_spacing);
14712 if (it->current_x - it->pixel_width < it->first_visible_x) 14726 if (it->current_x - it->pixel_width < it->first_visible_x)
14713 row->x = x - it->first_visible_x; 14727 row->x = x - it->first_visible_x;
14714 } 14728 }
@@ -14860,6 +14874,8 @@ display_line (it)
14860 row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent); 14874 row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
14861 row->phys_height = max (row->phys_height, 14875 row->phys_height = max (row->phys_height,
14862 it->max_phys_ascent + it->max_phys_descent); 14876 it->max_phys_ascent + it->max_phys_descent);
14877 row->extra_line_spacing = max (row->extra_line_spacing,
14878 it->max_extra_line_spacing);
14863 14879
14864 /* End of this display line if row is continued. */ 14880 /* End of this display line if row is continued. */
14865 if (row->continued_p || row->ends_at_zv_p) 14881 if (row->continued_p || row->ends_at_zv_p)
@@ -16043,27 +16059,31 @@ pint2hrstr (buf, width, d)
16043 { 16059 {
16044 tenths = remainder / 100; 16060 tenths = remainder / 100;
16045 if (50 <= remainder % 100) 16061 if (50 <= remainder % 100)
16046 if (tenths < 9) 16062 {
16047 tenths++; 16063 if (tenths < 9)
16048 else 16064 tenths++;
16049 { 16065 else
16050 quotient++; 16066 {
16051 if (quotient == 10) 16067 quotient++;
16052 tenths = -1; 16068 if (quotient == 10)
16053 else 16069 tenths = -1;
16054 tenths = 0; 16070 else
16055 } 16071 tenths = 0;
16072 }
16073 }
16056 } 16074 }
16057 else 16075 else
16058 if (500 <= remainder) 16076 if (500 <= remainder)
16059 if (quotient < 999) 16077 {
16060 quotient++; 16078 if (quotient < 999)
16061 else 16079 quotient++;
16062 { 16080 else
16063 quotient = 1; 16081 {
16064 exponent++; 16082 quotient = 1;
16065 tenths = 0; 16083 exponent++;
16066 } 16084 tenths = 0;
16085 }
16086 }
16067 } 16087 }
16068 16088
16069 /* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */ 16089 /* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */
@@ -16765,6 +16785,7 @@ display_string (string, lisp_string, face_string, face_string_pos,
16765 row->height = it->max_ascent + it->max_descent; 16785 row->height = it->max_ascent + it->max_descent;
16766 row->phys_ascent = it->max_phys_ascent; 16786 row->phys_ascent = it->max_phys_ascent;
16767 row->phys_height = it->max_phys_ascent + it->max_phys_descent; 16787 row->phys_height = it->max_phys_ascent + it->max_phys_descent;
16788 row->extra_line_spacing = it->max_extra_line_spacing;
16768 16789
16769 /* This condition is for the case that we are called with current_x 16790 /* This condition is for the case that we are called with current_x
16770 past last_visible_x. */ 16791 past last_visible_x. */
@@ -16824,6 +16845,8 @@ display_string (string, lisp_string, face_string, face_string_pos,
16824 row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent); 16845 row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
16825 row->phys_height = max (row->phys_height, 16846 row->phys_height = max (row->phys_height,
16826 it->max_phys_ascent + it->max_phys_descent); 16847 it->max_phys_ascent + it->max_phys_descent);
16848 row->extra_line_spacing = max (row->extra_line_spacing,
16849 it->max_extra_line_spacing);
16827 x += glyph->pixel_width; 16850 x += glyph->pixel_width;
16828 ++i; 16851 ++i;
16829 } 16852 }
@@ -18350,7 +18373,7 @@ produce_image_glyph (it)
18350{ 18373{
18351 struct image *img; 18374 struct image *img;
18352 struct face *face; 18375 struct face *face;
18353 int face_ascent, glyph_ascent; 18376 int glyph_ascent;
18354 struct glyph_slice slice; 18377 struct glyph_slice slice;
18355 18378
18356 xassert (it->what == IT_IMAGE); 18379 xassert (it->what == IT_IMAGE);
@@ -18433,7 +18456,7 @@ produce_image_glyph (it)
18433 18456
18434#if 0 /* this breaks image tiling */ 18457#if 0 /* this breaks image tiling */
18435 /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */ 18458 /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */
18436 face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f); 18459 int face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f);
18437 if (face_ascent > it->ascent) 18460 if (face_ascent > it->ascent)
18438 it->ascent = it->phys_ascent = face_ascent; 18461 it->ascent = it->phys_ascent = face_ascent;
18439#endif 18462#endif
@@ -19446,7 +19469,11 @@ x_produce_glyphs (it)
19446 it->current_x += it->pixel_width; 19469 it->current_x += it->pixel_width;
19447 19470
19448 if (extra_line_spacing > 0) 19471 if (extra_line_spacing > 0)
19449 it->descent += extra_line_spacing; 19472 {
19473 it->descent += extra_line_spacing;
19474 if (extra_line_spacing > it->max_extra_line_spacing)
19475 it->max_extra_line_spacing = extra_line_spacing;
19476 }
19450 19477
19451 it->max_ascent = max (it->max_ascent, it->ascent); 19478 it->max_ascent = max (it->max_ascent, it->ascent);
19452 it->max_descent = max (it->max_descent, it->descent); 19479 it->max_descent = max (it->max_descent, it->descent);
@@ -20413,19 +20440,20 @@ fast_find_position (w, charpos, hpos, vpos, x, y, stop)
20413 int past_end = 0; 20440 int past_end = 0;
20414 20441
20415 first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 20442 first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
20443 if (charpos < MATRIX_ROW_START_CHARPOS (first))
20444 {
20445 *x = first->x;
20446 *y = first->y;
20447 *hpos = 0;
20448 *vpos = MATRIX_ROW_VPOS (first, w->current_matrix);
20449 return 1;
20450 }
20451
20416 row = row_containing_pos (w, charpos, first, NULL, 0); 20452 row = row_containing_pos (w, charpos, first, NULL, 0);
20417 if (row == NULL) 20453 if (row == NULL)
20418 { 20454 {
20419 if (charpos < MATRIX_ROW_START_CHARPOS (first)) 20455 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
20420 { 20456 past_end = 1;
20421 *x = *y = *hpos = *vpos = 0;
20422 return 1;
20423 }
20424 else
20425 {
20426 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
20427 past_end = 1;
20428 }
20429 } 20457 }
20430 20458
20431 *x = row->x; 20459 *x = row->x;
@@ -20970,8 +20998,10 @@ note_mouse_highlight (f, x, y)
20970 /* Which window is that in? */ 20998 /* Which window is that in? */
20971 window = window_from_coordinates (f, x, y, &part, 0, 0, 1); 20999 window = window_from_coordinates (f, x, y, &part, 0, 0, 1);
20972 21000
20973 /* If we were displaying active text in another window, clear that. */ 21001 /* If we were displaying active text in another window, clear that.
20974 if (! EQ (window, dpyinfo->mouse_face_window)) 21002 Also clear if we move out of text area in same window. */
21003 if (! EQ (window, dpyinfo->mouse_face_window)
21004 || (part != ON_TEXT && !NILP (dpyinfo->mouse_face_window)))
20975 clear_mouse_face (dpyinfo); 21005 clear_mouse_face (dpyinfo);
20976 21006
20977 /* Not on a window -> return. */ 21007 /* Not on a window -> return. */
diff --git a/src/xfaces.c b/src/xfaces.c
index 5137ab7e721..b8b946bea47 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3435,8 +3435,8 @@ set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p)
3435 call into lisp. */ 3435 call into lisp. */
3436 3436
3437Lisp_Object 3437Lisp_Object
3438merge_face_heights (from, to, invalid, gcpro) 3438merge_face_heights (from, to, invalid)
3439 Lisp_Object from, to, invalid, gcpro; 3439 Lisp_Object from, to, invalid;
3440{ 3440{
3441 Lisp_Object result = invalid; 3441 Lisp_Object result = invalid;
3442 3442
@@ -3461,16 +3461,11 @@ merge_face_heights (from, to, invalid, gcpro)
3461 /* Call function with current height as argument. 3461 /* Call function with current height as argument.
3462 From is the new height. */ 3462 From is the new height. */
3463 Lisp_Object args[2]; 3463 Lisp_Object args[2];
3464 struct gcpro gcpro1;
3465
3466 GCPRO1 (gcpro);
3467 3464
3468 args[0] = from; 3465 args[0] = from;
3469 args[1] = to; 3466 args[1] = to;
3470 result = safe_call (2, args); 3467 result = safe_call (2, args);
3471 3468
3472 UNGCPRO;
3473
3474 /* Ensure that if TO was absolute, so is the result. */ 3469 /* Ensure that if TO was absolute, so is the result. */
3475 if (INTEGERP (to) && !INTEGERP (result)) 3470 if (INTEGERP (to) && !INTEGERP (result))
3476 result = invalid; 3471 result = invalid;
@@ -3523,8 +3518,7 @@ merge_face_vectors (f, from, to, named_merge_points)
3523 if (!UNSPECIFIEDP (from[i])) 3518 if (!UNSPECIFIEDP (from[i]))
3524 { 3519 {
3525 if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i])) 3520 if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i]))
3526 to[i] = merge_face_heights (from[i], to[i], to[i], 3521 to[i] = merge_face_heights (from[i], to[i], to[i]);
3527 named_merge_points);
3528 else 3522 else
3529 to[i] = from[i]; 3523 to[i] = from[i];
3530 } 3524 }
@@ -3551,11 +3545,16 @@ merge_named_face (f, face_name, to, named_merge_points)
3551 if (push_named_merge_point (&named_merge_point, 3545 if (push_named_merge_point (&named_merge_point,
3552 face_name, &named_merge_points)) 3546 face_name, &named_merge_points))
3553 { 3547 {
3548 struct gcpro gcpro1;
3554 Lisp_Object from[LFACE_VECTOR_SIZE]; 3549 Lisp_Object from[LFACE_VECTOR_SIZE];
3555 int ok = get_lface_attributes (f, face_name, from, 0); 3550 int ok = get_lface_attributes (f, face_name, from, 0);
3556 3551
3557 if (ok) 3552 if (ok)
3558 merge_face_vectors (f, from, to, named_merge_points); 3553 {
3554 GCPRO1 (named_merge_point.face_name);
3555 merge_face_vectors (f, from, to, named_merge_points);
3556 UNGCPRO;
3557 }
3559 3558
3560 return ok; 3559 return ok;
3561 } 3560 }
@@ -3646,8 +3645,7 @@ merge_face_ref (f, face_ref, to, err_msgs, named_merge_points)
3646 else if (EQ (keyword, QCheight)) 3645 else if (EQ (keyword, QCheight))
3647 { 3646 {
3648 Lisp_Object new_height = 3647 Lisp_Object new_height =
3649 merge_face_heights (value, to[LFACE_HEIGHT_INDEX], 3648 merge_face_heights (value, to[LFACE_HEIGHT_INDEX], Qnil);
3650 Qnil, Qnil);
3651 3649
3652 if (! NILP (new_height)) 3650 if (! NILP (new_height))
3653 to[LFACE_HEIGHT_INDEX] = new_height; 3651 to[LFACE_HEIGHT_INDEX] = new_height;
@@ -4034,7 +4032,7 @@ FRAME 0 means change the face on all frames, and change the default
4034 /* The default face must have an absolute size, 4032 /* The default face must have an absolute size,
4035 otherwise, we do a test merge with a random 4033 otherwise, we do a test merge with a random
4036 height to see if VALUE's ok. */ 4034 height to see if VALUE's ok. */
4037 : merge_face_heights (value, make_number (10), Qnil, Qnil)); 4035 : merge_face_heights (value, make_number (10), Qnil));
4038 4036
4039 if (!INTEGERP (test) || XINT (test) <= 0) 4037 if (!INTEGERP (test) || XINT (test) <= 0)
4040 signal_error ("Invalid face height", value); 4038 signal_error ("Invalid face height", value);
@@ -4740,7 +4738,7 @@ the result will be absolute, otherwise it will be relative. */)
4740 if (EQ (value1, Qunspecified)) 4738 if (EQ (value1, Qunspecified))
4741 return value2; 4739 return value2;
4742 else if (EQ (attribute, QCheight)) 4740 else if (EQ (attribute, QCheight))
4743 return merge_face_heights (value1, value2, value1, Qnil); 4741 return merge_face_heights (value1, value2, value1);
4744 else 4742 else
4745 return value1; 4743 return value1;
4746} 4744}
diff --git a/src/xmenu.c b/src/xmenu.c
index a08f4610101..0a83266a482 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -48,6 +48,7 @@ Boston, MA 02111-1307, USA. */
48#include "buffer.h" 48#include "buffer.h"
49#include "charset.h" 49#include "charset.h"
50#include "coding.h" 50#include "coding.h"
51#include "sysselect.h"
51 52
52#ifdef MSDOS 53#ifdef MSDOS
53#include "msdos.h" 54#include "msdos.h"
@@ -157,8 +158,6 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
157static void list_of_panes P_ ((Lisp_Object)); 158static void list_of_panes P_ ((Lisp_Object));
158static void list_of_items P_ ((Lisp_Object)); 159static void list_of_items P_ ((Lisp_Object));
159 160
160extern EMACS_TIME timer_check P_ ((int));
161
162 161
163/* This holds a Lisp vector that holds the results of decoding 162/* This holds a Lisp vector that holds the results of decoding
164 the keymaps or alist-of-alists that specify a menu. 163 the keymaps or alist-of-alists that specify a menu.
@@ -525,7 +524,7 @@ single_menu_item (key, item, dummy, skp_v)
525 return; /* Not a menu item. */ 524 return; /* Not a menu item. */
526 525
527 map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP]; 526 map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP];
528 527
529 if (skp->notreal) 528 if (skp->notreal)
530 { 529 {
531 /* We don't want to make a menu, just traverse the keymaps to 530 /* We don't want to make a menu, just traverse the keymaps to
@@ -1099,7 +1098,7 @@ on the left of the dialog box and all following items on the right.
1099 the dialog. Also, the lesstif/motif version crashes if there are 1098 the dialog. Also, the lesstif/motif version crashes if there are
1100 no buttons. */ 1099 no buttons. */
1101 contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil)); 1100 contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil));
1102 1101
1103 list_of_panes (Fcons (contents, Qnil)); 1102 list_of_panes (Fcons (contents, Qnil));
1104 1103
1105 /* Display them in a dialog box. */ 1104 /* Display them in a dialog box. */
@@ -1115,9 +1114,73 @@ on the left of the dialog box and all following items on the right.
1115 } 1114 }
1116#endif 1115#endif
1117} 1116}
1117
1118
1119#ifndef MSDOS
1120
1121/* Wait for an X event to arrive or for a timer to expire. */
1122
1123static void
1124x_menu_wait_for_event (void *data)
1125{
1126 extern EMACS_TIME timer_check P_ ((int));
1127
1128 /* Another way to do this is to register a timer callback, that can be
1129 done in GTK and Xt. But we have to do it like this when using only X
1130 anyway, and with callbacks we would have three variants for timer handling
1131 instead of the small ifdefs below. */
1132
1133 while (
1134#ifdef USE_X_TOOLKIT
1135 ! XtAppPending (Xt_app_con)
1136#elif defined USE_GTK
1137 ! gtk_events_pending ()
1138#else
1139 ! XPending ((Display*) data)
1140#endif
1141 )
1142 {
1143 EMACS_TIME next_time = timer_check (1);
1144 long secs = EMACS_SECS (next_time);
1145 long usecs = EMACS_USECS (next_time);
1146 SELECT_TYPE read_fds;
1147 struct x_display_info *dpyinfo;
1148 int n = 0;
1149
1150 FD_ZERO (&read_fds);
1151 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
1152 {
1153 int fd = ConnectionNumber (dpyinfo->display);
1154 FD_SET (fd, &read_fds);
1155 if (fd > n) n = fd;
1156 }
1157
1158 if (secs < 0 || (secs == 0 && usecs == 0))
1159 {
1160 /* Sometimes timer_check returns -1 (no timers) even if there are
1161 timers. So do a timeout anyway. */
1162 EMACS_SET_SECS (next_time, 1);
1163 EMACS_SET_USECS (next_time, 0);
1164 }
1165
1166 select (n + 1, &read_fds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, &next_time);
1167 }
1168}
1169#endif /* ! MSDOS */
1170
1118 1171
1119#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 1172#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
1120 1173
1174#ifdef USE_X_TOOLKIT
1175
1176static Lisp_Object
1177pop_down_menu (dummy)
1178 int dummy;
1179{
1180 popup_activated_flag = 0;
1181 return Qnil;
1182}
1183
1121/* Loop in Xt until the menu pulldown or dialog popup has been 1184/* Loop in Xt until the menu pulldown or dialog popup has been
1122 popped down (deactivated). This is used for x-popup-menu 1185 popped down (deactivated). This is used for x-popup-menu
1123 and x-popup-dialog; it is not used for the menu bar. 1186 and x-popup-dialog; it is not used for the menu bar.
@@ -1127,7 +1190,6 @@ on the left of the dialog box and all following items on the right.
1127 NOTE: All calls to popup_get_selection should be protected 1190 NOTE: All calls to popup_get_selection should be protected
1128 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ 1191 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */
1129 1192
1130#ifdef USE_X_TOOLKIT
1131static void 1193static void
1132popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) 1194popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress)
1133 XEvent *initial_event; 1195 XEvent *initial_event;
@@ -1138,19 +1200,21 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress)
1138{ 1200{
1139 XEvent event; 1201 XEvent event;
1140 1202
1203 int specpdl_count = SPECPDL_INDEX ();
1204 record_unwind_protect (pop_down_menu, Qnil);
1205
1141 while (popup_activated_flag) 1206 while (popup_activated_flag)
1142 { 1207 {
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) 1208 if (initial_event)
1148 { 1209 {
1149 event = *initial_event; 1210 event = *initial_event;
1150 initial_event = 0; 1211 initial_event = 0;
1151 } 1212 }
1152 else 1213 else
1153 XtAppNextEvent (Xt_app_con, &event); 1214 {
1215 if (do_timers) x_menu_wait_for_event (0);
1216 XtAppNextEvent (Xt_app_con, &event);
1217 }
1154 1218
1155 /* Make sure we don't consider buttons grabbed after menu goes. 1219 /* Make sure we don't consider buttons grabbed after menu goes.
1156 And make sure to deactivate for any ButtonRelease, 1220 And make sure to deactivate for any ButtonRelease,
@@ -1188,6 +1252,8 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress)
1188 1252
1189 x_dispatch_event (&event, event.xany.display); 1253 x_dispatch_event (&event, event.xany.display);
1190 } 1254 }
1255
1256 unbind_to (specpdl_count, Qnil);
1191} 1257}
1192 1258
1193#endif /* USE_X_TOOLKIT */ 1259#endif /* USE_X_TOOLKIT */
@@ -1195,16 +1261,40 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress)
1195#ifdef USE_GTK 1261#ifdef USE_GTK
1196/* Loop util popup_activated_flag is set to zero in a callback. 1262/* Loop util popup_activated_flag is set to zero in a callback.
1197 Used for popup menus and dialogs. */ 1263 Used for popup menus and dialogs. */
1264static GtkWidget *current_menu;
1265
1266static Lisp_Object
1267pop_down_menu (dummy)
1268 int dummy;
1269{
1270 if (current_menu)
1271 {
1272 gtk_widget_unmap (current_menu);
1273 current_menu = 0;
1274 popup_activated_flag = 0;
1275 }
1276 return Qnil;
1277}
1278
1198static void 1279static void
1199popup_widget_loop () 1280popup_widget_loop (do_timers, widget)
1281 int do_timers;
1282 GtkWidget *widget;
1200{ 1283{
1284 int specpdl_count = SPECPDL_INDEX ();
1285 current_menu = widget;
1286 record_unwind_protect (pop_down_menu, Qnil);
1287
1201 ++popup_activated_flag; 1288 ++popup_activated_flag;
1202 1289
1203 /* Process events in the Gtk event loop until done. */ 1290 /* Process events in the Gtk event loop until done. */
1204 while (popup_activated_flag) 1291 while (popup_activated_flag)
1205 { 1292 {
1293 if (do_timers) x_menu_wait_for_event (0);
1206 gtk_main_iteration (); 1294 gtk_main_iteration ();
1207 } 1295 }
1296
1297 unbind_to (specpdl_count, Qnil);
1208} 1298}
1209#endif 1299#endif
1210 1300
@@ -2329,7 +2419,7 @@ menu_position_func (menu, x, y, push_in, user_data)
2329 GtkRequisition req; 2419 GtkRequisition req;
2330 int disp_width = FRAME_X_DISPLAY_INFO (data->f)->width; 2420 int disp_width = FRAME_X_DISPLAY_INFO (data->f)->width;
2331 int disp_height = FRAME_X_DISPLAY_INFO (data->f)->height; 2421 int disp_height = FRAME_X_DISPLAY_INFO (data->f)->height;
2332 2422
2333 *x = data->x; 2423 *x = data->x;
2334 *y = data->y; 2424 *y = data->y;
2335 2425
@@ -2402,7 +2492,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
2402 two. show_help_echo uses this to detect popup menus. */ 2492 two. show_help_echo uses this to detect popup menus. */
2403 popup_activated_flag = 1; 2493 popup_activated_flag = 1;
2404 /* Process events that apply to the menu. */ 2494 /* Process events that apply to the menu. */
2405 popup_widget_loop (); 2495 popup_widget_loop (1, 0);
2406 2496
2407 gtk_widget_destroy (menu); 2497 gtk_widget_destroy (menu);
2408 2498
@@ -2490,7 +2580,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
2490 popup_activated_flag = 1; 2580 popup_activated_flag = 1;
2491 2581
2492 /* Process events that apply to the menu. */ 2582 /* Process events that apply to the menu. */
2493 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0, 0); 2583 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1, 0);
2494 2584
2495 /* fp turned off the following statement and wrote a comment 2585 /* fp turned off the following statement and wrote a comment
2496 that it is unnecessary--that the menu has already disappeared. 2586 that it is unnecessary--that the menu has already disappeared.
@@ -2811,7 +2901,7 @@ create_and_show_dialog (f, first_wv)
2811 gtk_widget_show_all (menu); 2901 gtk_widget_show_all (menu);
2812 2902
2813 /* Process events that apply to the menu. */ 2903 /* Process events that apply to the menu. */
2814 popup_widget_loop (); 2904 popup_widget_loop (1, menu);
2815 2905
2816 gtk_widget_destroy (menu); 2906 gtk_widget_destroy (menu);
2817 } 2907 }
@@ -3323,6 +3413,10 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
3323 XMenuSetFreeze (menu, TRUE); 3413 XMenuSetFreeze (menu, TRUE);
3324 pane = selidx = 0; 3414 pane = selidx = 0;
3325 3415
3416#ifndef MSDOS
3417 XMenuActivateSetWaitFunction (x_menu_wait_for_event, FRAME_X_DISPLAY (f));
3418#endif
3419
3326 /* Help display under X won't work because XMenuActivate contains 3420 /* Help display under X won't work because XMenuActivate contains
3327 a loop that doesn't give Emacs a chance to process it. */ 3421 a loop that doesn't give Emacs a chance to process it. */
3328 menu_help_frame = f; 3422 menu_help_frame = f;
diff --git a/src/xselect.c b/src/xselect.c
index 06f4bfbd2a1..cd059e81979 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 */
@@ -174,7 +182,8 @@ static Lisp_Object x_get_window_property_as_lisp_data ();
174 182
175 183
176 184
177/* Define a queue to save up SelectionRequest events for later handling. */ 185/* Define a queue to save up SELECTION_REQUEST_EVENT events for later
186 handling. */
178 187
179struct selection_event_queue 188struct selection_event_queue
180 { 189 {
@@ -184,11 +193,11 @@ struct selection_event_queue
184 193
185static struct selection_event_queue *selection_queue; 194static struct selection_event_queue *selection_queue;
186 195
187/* Nonzero means queue up certain events--don't process them yet. */ 196/* Nonzero means queue up SELECTION_REQUEST_EVENT events. */
188 197
189static int x_queue_selection_requests; 198static int x_queue_selection_requests;
190 199
191/* Queue up an X event *EVENT, to be processed later. */ 200/* Queue up an SELECTION_REQUEST_EVENT *EVENT, to be processed later. */
192 201
193static void 202static void
194x_queue_event (event) 203x_queue_event (event)
@@ -196,12 +205,14 @@ x_queue_event (event)
196{ 205{
197 struct selection_event_queue *queue_tmp; 206 struct selection_event_queue *queue_tmp;
198 207
199 /* Don't queue repeated requests */ 208 /* Don't queue repeated requests.
209 This only happens for large requests which uses the incremental protocol. */
200 for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next) 210 for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next)
201 { 211 {
202 if (!bcmp (&queue_tmp->event, event, sizeof (*event))) 212 if (!bcmp (&queue_tmp->event, event, sizeof (*event)))
203 { 213 {
204 TRACE1 ("IGNORE DUP SELECTION EVENT %08x", (unsigned long)queue_tmp); 214 TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp);
215 x_decline_selection_request (event);
205 return; 216 return;
206 } 217 }
207 } 218 }
@@ -211,14 +222,14 @@ x_queue_event (event)
211 222
212 if (queue_tmp != NULL) 223 if (queue_tmp != NULL)
213 { 224 {
214 TRACE1 ("QUEUE SELECTION EVENT %08x", (unsigned long)queue_tmp); 225 TRACE1 ("QUEUE SELECTION EVENT %08lx", (unsigned long)queue_tmp);
215 queue_tmp->event = *event; 226 queue_tmp->event = *event;
216 queue_tmp->next = selection_queue; 227 queue_tmp->next = selection_queue;
217 selection_queue = queue_tmp; 228 selection_queue = queue_tmp;
218 } 229 }
219} 230}
220 231
221/* Start queuing SelectionRequest events. */ 232/* Start queuing SELECTION_REQUEST_EVENT events. */
222 233
223static void 234static void
224x_start_queuing_selection_requests () 235x_start_queuing_selection_requests ()
@@ -230,7 +241,7 @@ x_start_queuing_selection_requests ()
230 TRACE1 ("x_start_queuing_selection_requests %d", x_queue_selection_requests); 241 TRACE1 ("x_start_queuing_selection_requests %d", x_queue_selection_requests);
231} 242}
232 243
233/* Stop queuing SelectionRequest events. */ 244/* Stop queuing SELECTION_REQUEST_EVENT events. */
234 245
235static void 246static void
236x_stop_queuing_selection_requests () 247x_stop_queuing_selection_requests ()
@@ -244,7 +255,7 @@ x_stop_queuing_selection_requests ()
244 while (selection_queue != NULL) 255 while (selection_queue != NULL)
245 { 256 {
246 struct selection_event_queue *queue_tmp = selection_queue; 257 struct selection_event_queue *queue_tmp = selection_queue;
247 TRACE1 ("RESTORE SELECTION EVENT %08x", (unsigned long)queue_tmp); 258 TRACE1 ("RESTORE SELECTION EVENT %08lx", (unsigned long)queue_tmp);
248 kbd_buffer_unget_event (&queue_tmp->event); 259 kbd_buffer_unget_event (&queue_tmp->event);
249 selection_queue = queue_tmp->next; 260 selection_queue = queue_tmp->next;
250 xfree ((char *)queue_tmp); 261 xfree ((char *)queue_tmp);
@@ -877,7 +888,9 @@ x_handle_selection_request (event)
877 struct x_display_info *dpyinfo 888 struct x_display_info *dpyinfo
878 = x_display_info_for_display (SELECTION_EVENT_DISPLAY (event)); 889 = x_display_info_for_display (SELECTION_EVENT_DISPLAY (event));
879 890
880 TRACE0 ("x_handle_selection_request"); 891 TRACE2 ("x_handle_selection_request, from=0x%08lx time=%lu",
892 (unsigned long) SELECTION_EVENT_REQUESTOR (event),
893 (unsigned long) SELECTION_EVENT_TIME (event));
881 894
882 local_selection_data = Qnil; 895 local_selection_data = Qnil;
883 target_symbol = Qnil; 896 target_symbol = Qnil;