aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS21
-rw-r--r--lisp/ChangeLog195
-rw-r--r--lisp/calc/calc-incom.el3
-rw-r--r--lisp/calc/calc-misc.el6
-rw-r--r--lisp/calc/calc-rewr.el6
-rw-r--r--lisp/calc/calc.el37
-rw-r--r--lisp/calendar/icalendar.el87
-rw-r--r--lisp/files.el220
-rw-r--r--lisp/find-file.el30
-rw-r--r--lisp/gnus/ChangeLog10
-rw-r--r--lisp/gnus/gnus-start.el5
-rw-r--r--lisp/gnus/html2text.el18
-rw-r--r--lisp/help.el18
-rw-r--r--lisp/ibuf-ext.el98
-rw-r--r--lisp/ibuffer.el4
-rw-r--r--lisp/imenu.el51
-rw-r--r--lisp/indent.el8
-rw-r--r--lisp/info.el3
-rw-r--r--lisp/man.el11
-rw-r--r--lisp/menu-bar.el10
-rw-r--r--lisp/mouse-sel.el1
-rw-r--r--lisp/net/password.el56
-rw-r--r--lisp/net/tramp-vc.el3
-rw-r--r--lisp/net/tramp.el15
-rw-r--r--lisp/pcomplete.el6
-rw-r--r--lisp/progmodes/asm-mode.el4
-rw-r--r--lisp/progmodes/flymake.el5
-rw-r--r--lisp/progmodes/gdb-ui.el66
-rw-r--r--lisp/simple.el33
-rw-r--r--lisp/subr.el55
-rw-r--r--lisp/textmodes/sgml-mode.el20
-rw-r--r--lisp/textmodes/tex-mode.el6
-rw-r--r--lisp/vc.el2
-rw-r--r--lisp/woman.el2
-rw-r--r--lispref/ChangeLog27
-rw-r--r--lispref/commands.texi29
-rw-r--r--lispref/minibuf.texi61
-rw-r--r--lispref/processes.texi41
-rw-r--r--lispref/text.texi6
-rw-r--r--lispref/windows.texi9
-rw-r--r--man/ChangeLog8
-rw-r--r--man/text.texi512
-rw-r--r--nt/INSTALL4
-rw-r--r--src/ChangeLog43
-rw-r--r--src/buffer.c12
-rw-r--r--src/callint.c23
-rw-r--r--src/fontset.c26
-rw-r--r--src/gtkutil.c105
-rw-r--r--src/regex.c3
-rw-r--r--src/regex.h3
-rw-r--r--src/xfns.c17
-rw-r--r--src/xsmfns.c82
52 files changed, 1629 insertions, 497 deletions
diff --git a/etc/NEWS b/etc/NEWS
index bf36242173b..718faca4ea8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -174,6 +174,12 @@ types any more. Add -DUSE_LISP_UNION_TYPE if you want union types.
174* Changes in Emacs 21.4 174* Changes in Emacs 21.4
175 175
176+++ 176+++
177** `set-auto-mode' now gives the interpreter magic line (if present)
178precedence over the file name. Likewise an <?xml or <!DOCTYPE declaration
179will give the buffer XML or SGML mode, unless the file name leads to a mode in
180`xml-based-modes'.
181
182+++
177** New function `looking-back' checks whether a regular expression matches 183** New function `looking-back' checks whether a regular expression matches
178the text before point. Specifying the LIMIT argument bounds how far 184the text before point. Specifying the LIMIT argument bounds how far
179back the match can start; this is a way to keep it from taking too long. 185back the match can start; this is a way to keep it from taking too long.
@@ -2127,6 +2133,8 @@ anyone has committed to the repository since you last executed
2127 2133
2128* New modes and packages in Emacs 21.4 2134* New modes and packages in Emacs 21.4
2129 2135
2136** The new package password.el provide a password cache and expiring mechanism.
2137
2130** The new package dns-mode.el add syntax highlight of DNS master files. 2138** The new package dns-mode.el add syntax highlight of DNS master files.
2131The key binding C-c C-s (`dns-mode-soa-increment-serial') can be used 2139The key binding C-c C-s (`dns-mode-soa-increment-serial') can be used
2132to increment the SOA serial. 2140to increment the SOA serial.
@@ -2363,6 +2371,14 @@ configuration files.
2363* Lisp Changes in Emacs 21.4 2371* Lisp Changes in Emacs 21.4
2364 2372
2365+++ 2373+++
2374** An interactive specification may now use the code letter 'U' to get
2375the up-event that was discarded in case the last key sequence read for a
2376previous 'k' or 'K' argument was a down-event; otherwise nil is used.
2377
2378** Function `translate-region' accepts also a char-table as TABLE
2379argument.
2380
2381+++
2366** Major mode functions now run the new normal hook 2382** Major mode functions now run the new normal hook
2367`after-change-major-mode-hook', at their very end, after the mode hooks. 2383`after-change-major-mode-hook', at their very end, after the mode hooks.
2368 2384
@@ -3578,6 +3594,11 @@ status, and other information about a specific network interface.
3578+++ 3594+++
3579** New function `call-process-shell-command'. 3595** New function `call-process-shell-command'.
3580 3596
3597** New function `process-file'.
3598
3599This is similar to `call-process', but obeys file handlers. The file
3600handler is chosen based on default-directory.
3601
3581--- 3602---
3582** The dummy function keys made by easymenu 3603** The dummy function keys made by easymenu
3583are now always lower case. If you specify the 3604are now always lower case. If you specify the
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 556f9ad2a94..260dfb22af5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,13 +1,166 @@
12004-10-26 Daniel Pfeiffer <occitan@esperanto.org>
2
3 * files.el (auto-mode-alist): Add pod, js, xbm and xpm and group
4 trivial variants to shorten the list.
5 (xml-based-modes): New var.
6 (set-auto-mode): Give interpreter-mode-alist or <?xml or <!DOCTYPE
7 declaration higher priority than auto-mode-alist.
8
9 * find-file.el (cc-other-file-alist): Bring it in line with
10 cc-mode's auto-mode-alist entries and use \' instead of $.
11
12 * textmodes/sgml-mode.el (sgml-mode): Fix imenu-generic-expression
13 and add "Id" and "Name" submenus to it.
14
15 * imenu.el (imenu--generic-function): Skip matches in comments.
16
172004-10-26 Jay Belanger <belanger@truman.edu>
18
19 * calc/calc.el (calc,full-calc, calc-quit, calc-keypad)
20 (full-calc-keypad, calc-trail-display): Use an extra argument
21 instead of `interactive-p'.
22
23 * calc/calc-misc.el (calc-other-window): Use an extra argument
24 instead of `interactive-p'.
25
26 * calc/calc-rewr.el (calc-match): Use an extra argument instead of
27 `interactive-p'.
28
292004-10-26 Kim F. Storm <storm@cua.dk>
30
31 * help.el (describe-key): Describe both down-event and up-event
32 for a mouse click.
33
342004-10-26 Richard M. Stallman <rms@gnu.org>
35
36 * woman.el (woman): Don't call interactive-p.
37
38 * pcomplete.el (pcomplete): Instead of interactive-p,
39 use an arg set non-nil by the interactive spec.
40
41 * menu-bar.el (menu-bar-make-toggle): Instead of interactive-p,
42 use an arg set non-nil by the interactive spec.
43
44 * man.el (Man-cleanup-manpage): Instead of interactive-p,
45 use an arg set non-nil by the interactive spec.
46
472004-10-26 Pavel Kobiakov <pk_at_work@yahoo.com>
48
49 * progmodes/flymake.el (flymake-split-string): Use
50 `flymake-split-string-remove-empty-edges' in any case.
51
522004-10-26 Masatake YAMATO <jet@gyve.org>
53
54 * progmodes/flymake.el (flymake-err-line-patterns):
55 Use `compilation-error-regexp-alist-alist' instead of
56 `compilation-error-regexp-alist'.
57
582004-10-25 Jay Belanger <belanger@truman.edu>
59
60 * calc/calc-incom.el (calc-digit-dots): Inhibit read-only before
61 erasing minibuffer.
62
632004-10-25 Simon Josefsson <jas@extundo.com>
64
65 * subr.el (read-passwd): Move to net/password.el.
66
67 * net/password.el (read-passwd): Add. Autoload it.
68
692004-10-25 Kai Grossjohann <kai.grossjohann@gmx.net>
70
71 * mouse-sel.el (mouse-sel-mode): Specify custom group.
72
73 * simple.el (process-file): Fix logic.
74
752004-10-24 Luc Teirlinck <teirllm@auburn.edu>
76
77 * indent.el (set-left-margin, set-right-margin): Delete redundant code.
78 (increase-right-margin): Remove erroneous call to `interactive-p'.
79
802004-10-24 Kim F. Storm <storm@cua.dk>
81
82 * help.el (describe-mode): Fix 2004-10-13 change.
83 Copy pure "Auto Fill" string so it can be propertized later
84 without causing a read-only error.
85
862004-10-24 Luc Teirlinck <teirllm@auburn.edu>
87
88 * info.el (Info-find-emacs-command-nodes): Adapt to Texinfo-4.7
89 style indexes.
90
912004-10-24 Kai Grossjohann <kai.grossjohann@gmx.net>
92
93 * simple.el (process-file): Accept nil for INFILE. Reported by
94 Luc Teirlinck.
95
962004-10-24 Masatake YAMATO <jet@gyve.org>
97
98 * progmodes/gdb-ui.el (gdb-assembler-font-lock-keywords):
99 Handle periods and underscores in a function name.
100 Remove the address fontification.
101
1022004-10-24 Masatake YAMATO <jet@gyve.org>
103
104 * progmodes/asm-mode.el (asm-font-lock-keywords):
105 Use font-lock-variable-name-face for registers.
106
1072004-10-24 Nick Roberts <nickrob@snap.net.nz>
108
109 * progmodes/gdb-ui.el (gdb-get-create-buffer): Allow modes to run
110 kill-all-local-variables.
111 (gdb-breakpoints-mode, gdb-frames-mode, gdb-threads-mode)
112 (gdb-registers-mode, gdb-locals-mode, gdb-assembler-mode):
113 Use kill-all-local-variables and provide mode-hooks.
114 (gdb-assembler-font-lock-keywords): New font lock keywords definition.
115 (gdb-assembler-mode): Use 'gdb-assembler-font-lock-keywords'.
116 Suggested by Masatake YAMATO <jet@gyve.org>.
117
1182004-10-23 Kai Grossjohann <kai.grossjohann@gmx.net>
119
120 * simple.el (process-file): New function, similar to call-process
121 but supports file handlers.
122 * vc.el (vc-do-command): Use it, instead of call-process.
123 * net/tramp-vc.el (vc-do-command): Do not advise it if
124 process-file is fboundp.
125 * net/tramp.el (tramp-file-name-handler-alist): Add entry for
126 process-file.
127 (tramp-handle-process-file): New function.
128 (tramp-file-name-for-operation): Support process-file.
129
1302004-10-23 Ulf Jasper <ulf.jasper@web.de>
131
132 * calendar/icalendar.el (icalendar--weekday-array): New constant.
133 (icalendar-weekdayabbrev-table)
134 (icalendar-monthnumber-table): Delete.
135 (icalendar--get-month-number): Use calendar-month-name-array.
136 (icalendar--get-weekday-number): New function.
137 (icalendar--get-weekday-abbrev) Use calendar-day-name-array.
138 (icalendar-export-region): Handle multi-line entries.
139 (icalendar--convert-ical-to-diary): Use calendar-day-name-array.
140
1412004-10-23 John Paul Wallington <jpw@gnu.org>
142
143 * ibuffer.el (ibuffer-find-file): Remove `interactive-p' call;
144 `wildcards' set to t in interactive spec.
145
146 * ibuf-ext.el (ibuffer-jump-to-buffer): Read buffer name in
147 interactive spec rather than use `interactive-p'.
148 (ibuffer-kill-line): Set arg `interactive-p' in interactive spec
149 rather than use function `interactive-p'.
150
12004-10-21 Jay Belanger <belanger@truman.edu> 1512004-10-21 Jay Belanger <belanger@truman.edu>
2 152
3 * calc/calc-aent.el (calc-alg-ent-map, calc-alg-ent-esc-map): 153 * calc/calc-aent.el (calc-alg-ent-map, calc-alg-ent-esc-map):
4 Declared these variables with defvar. 154 Declare these variables with defvar.
5 155
6 * calc/calc-aent.el (calc-do-alg-entry): Since `calc-alg-ent-map' 156 * calc/calc-aent.el (calc-do-alg-entry): Since `calc-alg-ent-map'
7 is bound, only check to see if it is bound. 157 is bound, only check to see if it is bound.
8 158
92004-10-21 Stefan Monnier <monnier@iro.umontreal.ca> 1592004-10-21 Stefan Monnier <monnier@iro.umontreal.ca>
10 160
161 * textmodes/tex-mode.el (tex-compilation-parse-errors):
162 Don't output messages.
163
11 * calc/calc-help.el (calc-describe-bindings): Fix last change. 164 * calc/calc-help.el (calc-describe-bindings): Fix last change.
12 165
132004-10-21 John Paul Wallington <jpw@gnu.org> 1662004-10-21 John Paul Wallington <jpw@gnu.org>
@@ -245,6 +398,13 @@
245 398
246 * net/password.el: Add. 399 * net/password.el: Add.
247 400
4012004-10-14 Masatake YAMATO <jet@gyve.org>
402
403 * progmodes/gud.el (gdb-script-beginning-of-defun): New function.
404 (gdb-script-end-of-defun): New function.
405 (gdb-script-mode): Use `gdb-script-beginning-of-defun' and
406 `gdb-script-end-of-defun' as *-of-defun-function.
407
2482004-10-13 Daniel Pfeiffer <occitan@esperanto.org> 4082004-10-13 Daniel Pfeiffer <occitan@esperanto.org>
249 409
250 * button.el (button-activate): Allow a marker to display as an action. 410 * button.el (button-activate): Allow a marker to display as an action.
@@ -254,13 +414,6 @@
254 * help.el (describe-mode): Use it to make minor mode list into 414 * help.el (describe-mode): Use it to make minor mode list into
255 hyperlinks. 415 hyperlinks.
256 416
2572004-10-14 Masatake YAMATO <jet@gyve.org>
258
259 * progmodes/gud.el (gdb-script-beginning-of-defun): New function.
260 (gdb-script-end-of-defun): New function.
261 (gdb-script-mode): Use `gdb-script-beginning-of-defun' and
262 `gdb-script-end-of-defun' as *-of-defun-function.
263
2642004-10-13 Stefan Monnier <monnier@iro.umontreal.ca> 4172004-10-13 Stefan Monnier <monnier@iro.umontreal.ca>
265 418
266 * vc.el (vc-annotate-display-select): Fix typo. 419 * vc.el (vc-annotate-display-select): Fix typo.
@@ -564,15 +717,6 @@
564 * diff-mode.el (diff-file-header-re): Tighten up regexp a tiny bit. 717 * diff-mode.el (diff-file-header-re): Tighten up regexp a tiny bit.
565 (diff-fixup-modifs): Catch unified-diff file-headers. 718 (diff-fixup-modifs): Catch unified-diff file-headers.
566 719
5672004-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
568
569 * dired.el (dired-view-command-alist): Use more efficient regexps.
570 Remove dubious arguments.
571 (dired-align-file): New function.
572 (dired-insert-directory): Use it.
573 (dired-move-to-end-of-filename): Make the " -> " search more specific.
574 (dired-buffers-for-dir): Remove unused var `pattern'.
575
5762004-09-29 Kim F. Storm <storm@cua.dk> 7202004-09-29 Kim F. Storm <storm@cua.dk>
577 721
578 * progmodes/gdb-ui.el (breakpoint): Define as fringe bitmap. 722 * progmodes/gdb-ui.el (breakpoint): Define as fringe bitmap.
@@ -582,6 +726,15 @@
582 * fringe.el (fringe-bitmap-p): New macro. 726 * fringe.el (fringe-bitmap-p): New macro.
583 (fringe-bitmaps): Add standard fringe bitmaps on load. 727 (fringe-bitmaps): Add standard fringe bitmaps on load.
584 728
7292004-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
730
731 * dired.el (dired-view-command-alist): Use more efficient regexps.
732 Remove dubious arguments.
733 (dired-align-file): New function.
734 (dired-insert-directory): Use it.
735 (dired-move-to-end-of-filename): Make the " -> " search more specific.
736 (dired-buffers-for-dir): Remove unused var `pattern'.
737
5852004-09-28 Matthew Mundell <matt@mundell.ukfsn.org> (tiny change) 7382004-09-28 Matthew Mundell <matt@mundell.ukfsn.org> (tiny change)
586 739
587 * calendar/diary-lib.el (list-diary-entries): Save diary buffer 740 * calendar/diary-lib.el (list-diary-entries): Save diary buffer
@@ -720,7 +873,7 @@
720 873
721 * calc/calc-graph.el (calc-graph-add-curve): Moved the call to 874 * calc/calc-graph.el (calc-graph-add-curve): Moved the call to
722 `calc-graph-set-styles' so the gnuplot buffer will appear in a 875 `calc-graph-set-styles' so the gnuplot buffer will appear in a
723 separate window. 876 separate window.
724 877
7252004-09-21 Luc Teirlinck <teirllm@auburn.edu> 8782004-09-21 Luc Teirlinck <teirllm@auburn.edu>
726 879
@@ -737,7 +890,7 @@
737 fixed. 890 fixed.
738 891
7392004-09-21 Jay Belanger <belanger@truman.edu> 8922004-09-21 Jay Belanger <belanger@truman.edu>
740 893
741 * calc/calc.el (calc-mode-var-list): Removed unnecessary quotes. 894 * calc/calc.el (calc-mode-var-list): Removed unnecessary quotes.
742 895
7432004-09-20 Luc Teirlinck <teirllm@auburn.edu> 8962004-09-20 Luc Teirlinck <teirllm@auburn.edu>
@@ -828,8 +981,8 @@
8282004-09-17 Jay Belanger <belanger@truman.edu> 9812004-09-17 Jay Belanger <belanger@truman.edu>
829 982
830 * calc/calc.el (calc-mode-var-list): Fixed the value of 983 * calc/calc.el (calc-mode-var-list): Fixed the value of
831 `calc-matrix-brackets'. 984 `calc-matrix-brackets'.
832 985
8332004-09-17 Romain Francoise <romain@orebokech.com> 9862004-09-17 Romain Francoise <romain@orebokech.com>
834 987
835 * ibuf-ext.el (define-ibuffer-filter filename): 988 * ibuf-ext.el (define-ibuffer-filter filename):
diff --git a/lisp/calc/calc-incom.el b/lisp/calc/calc-incom.el
index b8bb7ab4f9a..7dc7f08b4bd 100644
--- a/lisp/calc/calc-incom.el
+++ b/lisp/calc/calc-incom.el
@@ -183,7 +183,8 @@
183 (if calc-prev-prev-char 183 (if calc-prev-prev-char
184 (calcDigit-nondigit) 184 (calcDigit-nondigit)
185 (setq calc-digit-value nil) 185 (setq calc-digit-value nil)
186 (erase-buffer) 186 (let ((inhibit-read-only t))
187 (erase-buffer))
187 (exit-minibuffer))) 188 (exit-minibuffer)))
188 ;; just ignore extra decimal point, anticipating ".." 189 ;; just ignore extra decimal point, anticipating ".."
189 (delete-backward-char 1))) 190 (delete-backward-char 1)))
diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el
index c01d37e6848..159b1ee3178 100644
--- a/lisp/calc/calc-misc.el
+++ b/lisp/calc/calc-misc.el
@@ -130,9 +130,9 @@ Calc user interface as before (either M-# C or M-# K; initially M-# C)."
130 "Now using full screen for Calc" 130 "Now using full screen for Calc"
131 "Now using partial screen for Calc")))) 131 "Now using partial screen for Calc"))))
132 132
133(defun calc-other-window () 133(defun calc-other-window (&optional interactive)
134 "Invoke the Calculator in another window." 134 "Invoke the Calculator in another window."
135 (interactive) 135 (interactive "p")
136 (if (memq major-mode '(calc-mode calc-trail-mode)) 136 (if (memq major-mode '(calc-mode calc-trail-mode))
137 (progn 137 (progn
138 (other-window 1) 138 (other-window 1)
@@ -141,7 +141,7 @@ Calc user interface as before (either M-# C or M-# K; initially M-# C)."
141 (if (get-buffer-window "*Calculator*") 141 (if (get-buffer-window "*Calculator*")
142 (calc-quit) 142 (calc-quit)
143 (let ((win (selected-window))) 143 (let ((win (selected-window)))
144 (calc nil win (interactive-p)))))) 144 (calc nil win interactive)))))
145 145
146(defun another-calc () 146(defun another-calc ()
147 "Create another, independent Calculator buffer." 147 "Create another, independent Calculator buffer."
diff --git a/lisp/calc/calc-rewr.el b/lisp/calc/calc-rewr.el
index 51cffb753fc..47b48bd88d8 100644
--- a/lisp/calc/calc-rewr.el
+++ b/lisp/calc/calc-rewr.el
@@ -143,15 +143,15 @@
143 (calc-pop-push-record-list n "rwrt" (list expr))) 143 (calc-pop-push-record-list n "rwrt" (list expr)))
144 (calc-handle-whys))) 144 (calc-handle-whys)))
145 145
146(defun calc-match (pat) 146(defun calc-match (pat &optional interactive)
147 (interactive "sPattern: \n") 147 (interactive "sPattern: \np")
148 (calc-slow-wrapper 148 (calc-slow-wrapper
149 (let (n expr) 149 (let (n expr)
150 (if (or (null pat) (equal pat "") (equal pat "$")) 150 (if (or (null pat) (equal pat "") (equal pat "$"))
151 (setq expr (calc-top-n 2) 151 (setq expr (calc-top-n 2)
152 pat (calc-top-n 1) 152 pat (calc-top-n 1)
153 n 2) 153 n 2)
154 (if (interactive-p) (setq calc-previous-alg-entry pat)) 154 (if interactive (setq calc-previous-alg-entry pat))
155 (setq pat (if (stringp pat) (math-read-expr pat) pat)) 155 (setq pat (if (stringp pat) (math-read-expr pat) pat))
156 (if (eq (car-safe pat) 'error) 156 (if (eq (car-safe pat) 'error)
157 (error "Bad format in expression: %s" (nth 1 pat))) 157 (error "Bad format in expression: %s" (nth 1 pat)))
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index c1669f78f08..4ace5fb6780 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1142,7 +1142,7 @@ commands given here will actually operate on the *Calculator* stack."
1142;;;###autoload 1142;;;###autoload
1143(defun calc (&optional arg full-display interactive) 1143(defun calc (&optional arg full-display interactive)
1144 "The Emacs Calculator. Full documentation is listed under \"calc-mode\"." 1144 "The Emacs Calculator. Full documentation is listed under \"calc-mode\"."
1145 (interactive "P") 1145 (interactive "P\ni\np")
1146 (if arg 1146 (if arg
1147 (unless (eq arg 0) 1147 (unless (eq arg 0)
1148 (calc-extensions) 1148 (calc-extensions)
@@ -1188,17 +1188,16 @@ commands given here will actually operate on the *Calculator* stack."
1188 (window-point full-display) 1188 (window-point full-display)
1189 (select-window full-display)) 1189 (select-window full-display))
1190 (calc-check-defines) 1190 (calc-check-defines)
1191 (when (and calc-said-hello 1191 (when (and calc-said-hello interactive)
1192 (or (interactive-p) interactive))
1193 (sit-for 2) 1192 (sit-for 2)
1194 (message "")) 1193 (message ""))
1195 (setq calc-said-hello t))))) 1194 (setq calc-said-hello t)))))
1196 1195
1197;;;###autoload 1196;;;###autoload
1198(defun full-calc () 1197(defun full-calc (&optional interactive)
1199 "Invoke the Calculator and give it a full-sized window." 1198 "Invoke the Calculator and give it a full-sized window."
1200 (interactive) 1199 (interactive "p")
1201 (calc nil t (interactive-p))) 1200 (calc nil t interactive))
1202 1201
1203(defun calc-same-interface (arg) 1202(defun calc-same-interface (arg)
1204 "Invoke the Calculator using the most recent interface (calc or calc-keypad)." 1203 "Invoke the Calculator using the most recent interface (calc or calc-keypad)."
@@ -1215,8 +1214,8 @@ commands given here will actually operate on the *Calculator* stack."
1215 (calc arg calc-full-mode t)))))) 1214 (calc arg calc-full-mode t))))))
1216 1215
1217 1216
1218(defun calc-quit (&optional non-fatal) 1217(defun calc-quit (&optional non-fatal interactive)
1219 (interactive) 1218 (interactive "i\np")
1220 (and calc-standalone-flag (not non-fatal) 1219 (and calc-standalone-flag (not non-fatal)
1221 (save-buffers-kill-emacs nil)) 1220 (save-buffers-kill-emacs nil))
1222 (if (and (equal (buffer-name) "*Gnuplot Trail*") 1221 (if (and (equal (buffer-name) "*Gnuplot Trail*")
@@ -1226,7 +1225,7 @@ commands given here will actually operate on the *Calculator* stack."
1226 (calc-edit-cancel) 1225 (calc-edit-cancel)
1227 (if (eq major-mode 'MacEdit-mode) 1226 (if (eq major-mode 'MacEdit-mode)
1228 (MacEdit-cancel-edit) 1227 (MacEdit-cancel-edit)
1229 (if (and (interactive-p) 1228 (if (and interactive
1230 calc-embedded-info 1229 calc-embedded-info
1231 (eq (current-buffer) (aref calc-embedded-info 0))) 1230 (eq (current-buffer) (aref calc-embedded-info 0)))
1232 (calc-embedded nil) 1231 (calc-embedded nil)
@@ -1266,22 +1265,22 @@ or a list containing a character position and an error message in string form."
1266 (calc-do-calc-eval str separator args)) 1265 (calc-do-calc-eval str separator args))
1267 1266
1268;;;###autoload 1267;;;###autoload
1269(defun calc-keypad () 1268(defun calc-keypad (&optional interactive)
1270 "Invoke the Calculator in \"visual keypad\" mode. 1269 "Invoke the Calculator in \"visual keypad\" mode.
1271This is most useful in the X window system. 1270This is most useful in the X window system.
1272In this mode, click on the Calc \"buttons\" using the left mouse button. 1271In this mode, click on the Calc \"buttons\" using the left mouse button.
1273Or, position the cursor manually and do M-x calc-keypad-press." 1272Or, position the cursor manually and do M-x calc-keypad-press."
1274 (interactive) 1273 (interactive "p")
1275 (calc-extensions) 1274 (calc-extensions)
1276 (calc-do-keypad calc-full-mode (interactive-p))) 1275 (calc-do-keypad calc-full-mode interactive))
1277 1276
1278;;;###autoload 1277;;;###autoload
1279(defun full-calc-keypad () 1278(defun full-calc-keypad (&optional interactive)
1280 "Invoke the Calculator in full-screen \"visual keypad\" mode. 1279 "Invoke the Calculator in full-screen \"visual keypad\" mode.
1281See calc-keypad for details." 1280See calc-keypad for details."
1282 (interactive) 1281 (interactive "p")
1283 (calc-extensions) 1282 (calc-extensions)
1284 (calc-do-keypad t (interactive-p))) 1283 (calc-do-keypad t interactive))
1285 1284
1286 1285
1287(defvar calc-aborted-prefix nil) 1286(defvar calc-aborted-prefix nil)
@@ -1802,8 +1801,8 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
1802 val) 1801 val)
1803 1802
1804 1803
1805(defun calc-trail-display (flag &optional no-refresh) 1804(defun calc-trail-display (flag &optional no-refresh interactive)
1806 (interactive "P") 1805 (interactive "P\ni\np")
1807 (let ((win (get-buffer-window (calc-trail-buffer)))) 1806 (let ((win (get-buffer-window (calc-trail-buffer))))
1808 (if (setq calc-display-trail 1807 (if (setq calc-display-trail
1809 (not (if flag (memq flag '(nil 0)) win))) 1808 (not (if flag (memq flag '(nil 0)) win)))
@@ -1817,7 +1816,7 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
1817 (setq overlay-arrow-string calc-trail-overlay 1816 (setq overlay-arrow-string calc-trail-overlay
1818 overlay-arrow-position calc-trail-pointer) 1817 overlay-arrow-position calc-trail-pointer)
1819 (or no-refresh 1818 (or no-refresh
1820 (if (interactive-p) 1819 (if interactive
1821 (calc-do-refresh) 1820 (calc-do-refresh)
1822 (calc-refresh)))))) 1821 (calc-refresh))))))
1823 (if win 1822 (if win
@@ -1825,7 +1824,7 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
1825 (delete-window win) 1824 (delete-window win)
1826 (calc-wrapper 1825 (calc-wrapper
1827 (or no-refresh 1826 (or no-refresh
1828 (if (interactive-p) 1827 (if interactive
1829 (calc-do-refresh) 1828 (calc-do-refresh)
1830 (calc-refresh)))))))) 1829 (calc-refresh))))))))
1831 calc-trail-buffer) 1830 calc-trail-buffer)
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 9e5f2b93c22..5f581e1d74a 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -39,6 +39,8 @@
39;; Added icalendar-export-region. 39;; Added icalendar-export-region.
40;; The import and export commands do not clear their target file, 40;; The import and export commands do not clear their target file,
41;; but append their results to the target file. 41;; but append their results to the target file.
42;; I18n-problems fixed -- use calendar-(month|day)-name-array.
43;; Fixed problems with export of multi-line diary entries.
42 44
43;; 0.06: Bugfixes regarding icalendar-import-format-*. 45;; 0.06: Bugfixes regarding icalendar-import-format-*.
44;; Fix in icalendar-convert-diary-to-ical -- thanks to Philipp 46;; Fix in icalendar-convert-diary-to-ical -- thanks to Philipp
@@ -167,31 +169,7 @@ longer than they are."
167;; NO USER SERVICABLE PARTS BELOW THIS LINE 169;; NO USER SERVICABLE PARTS BELOW THIS LINE
168;; ====================================================================== 170;; ======================================================================
169 171
170(defconst icalendar-weekdayabbrev-table 172(defconst icalendar--weekday-array ["SU" "MO" "TU" "WE" "TH" "FR" "SA"])
171 '(("mon\\(day\\)?" . "MO")
172 ("tue\\(sday\\)?" . "TU")
173 ("wed\\(nesday\\)?" . "WE")
174 ("thu\\(rsday\\)?" . "TH")
175 ("fri\\(day\\)?" . "FR")
176 ("sat\\(urday\\)?" . "SA")
177 ("sun\\(day\\)?" . "SU"))
178 "Translation table for weekdays.")
179
180(defconst icalendar-monthnumber-table
181 '(("^jan\\(uar\\)?y?$" . 1)
182 ("^feb\\(ruar\\)?y?$" . 2)
183 ("^mar\\(ch\\)?\\|märz$" . 3)
184 ("^apr\\(il\\)?$" . 4)
185 ("^ma[iy]$" . 5)
186 ("^jun[ie]?$" . 6)
187 ("^jul[iy]?$" . 7)
188 ("^aug\\(ust\\)?$" . 8)
189 ("^sep\\(tember\\)?$" . 9)
190 ("^o[ck]t\\(ober\\)?$" . 10)
191 ("^nov\\(ember\\)?$" . 11)
192 ("^de[cz]\\(ember\\)?$" . 12))
193 "Regular expressions for month names.
194Currently this matches only German and English.")
195 173
196(defvar icalendar-debug nil ".") 174(defvar icalendar-debug nil ".")
197 175
@@ -511,18 +489,47 @@ Note that this silently ignores seconds."
511 489
512(defun icalendar--get-month-number (monthname) 490(defun icalendar--get-month-number (monthname)
513 "Return the month number for the given MONTHNAME." 491 "Return the month number for the given MONTHNAME."
514 (save-match-data 492 (catch 'found
515 (let ((case-fold-search t)) 493 (let ((num 1)
516 (assoc-default monthname icalendar-monthnumber-table 494 (m (downcase monthname)))
517 'string-match)))) 495 (mapc (lambda (month)
496 (let ((mm (downcase month)))
497 (if (or (string-equal mm m)
498 (string-equal (substring mm 0 3) m))
499 (throw 'found num))
500 (setq num (1+ num))))
501 calendar-month-name-array))
502 ;; Error:
503 -1))
504
505(defun icalendar--get-weekday-number (abbrevweekday)
506 "Return the number for the ABBREVWEEKDAY."
507 (catch 'found
508 (let ((num 0)
509 (aw (downcase abbrevweekday)))
510 (mapc (lambda (day)
511 (let ((d (downcase day)))
512 (if (string-equal d aw)
513 (throw 'found num))
514 (setq num (1+ num))))
515 icalendar--weekday-array))
516 ;; Error:
517 -1))
518 518
519(defun icalendar--get-weekday-abbrev (weekday) 519(defun icalendar--get-weekday-abbrev (weekday)
520 "Return the abbreviated WEEKDAY." 520 "Return the abbreviated WEEKDAY."
521 ;;FIXME: ISO-like(?). 521 (catch 'found
522 (save-match-data 522 (let ((num 0)
523 (let ((case-fold-search t)) 523 (w (downcase weekday)))
524 (assoc-default weekday icalendar-weekdayabbrev-table 524 (mapc (lambda (day)
525 'string-match)))) 525 (let ((d (downcase day)))
526 (if (or (string-equal d w)
527 (string-equal (substring d 0 3) w))
528 (throw 'found (aref icalendar--weekday-array num)))
529 (setq num (1+ num))))
530 calendar-day-name-array))
531 ;; Error:
532 "??"))
526 533
527(defun icalendar--datestring-to-isodate (datestring &optional day-shift) 534(defun icalendar--datestring-to-isodate (datestring &optional day-shift)
528 "Convert diary-style DATESTRING to iso-style date. 535 "Convert diary-style DATESTRING to iso-style date.
@@ -648,7 +655,7 @@ FExport diary data into iCalendar file: ")
648 (save-excursion 655 (save-excursion
649 (goto-char min) 656 (goto-char min)
650 (while (re-search-forward 657 (while (re-search-forward
651 "^\\([^ \t\n].*\\)\\(\n[ \t].*\\)*" max t) 658 "^\\([^ \t\n].*\\)\\(\\(\n[ \t].*\\)*\\)" max t)
652 (setq entry-main (match-string 1)) 659 (setq entry-main (match-string 1))
653 (if (match-beginning 2) 660 (if (match-beginning 2)
654 (setq entry-rest (match-string 2)) 661 (setq entry-rest (match-string 2))
@@ -1171,13 +1178,13 @@ written into the buffer ` *icalendar-errors*'."
1171 ;; weekly and not all-day 1178 ;; weekly and not all-day
1172 (let* ((byday (cadr (assoc 'BYDAY rrule-props))) 1179 (let* ((byday (cadr (assoc 'BYDAY rrule-props)))
1173 (weekday 1180 (weekday
1174 (cdr (rassoc 1181 (icalendar--get-weekday-number byday)))
1175 byday
1176 icalendar-weekdayabbrev-table))))
1177 (icalendar--dmsg "weekly not-all-day") 1182 (icalendar--dmsg "weekly not-all-day")
1178 (if weekday 1183 (if (> weekday -1)
1179 (setq diary-string 1184 (setq diary-string
1180 (format "%s %s%s%s" weekday 1185 (format "%s %s%s%s"
1186 (aref calendar-day-name-array
1187 weekday)
1181 start-t (if end-t "-" "") 1188 start-t (if end-t "-" "")
1182 (or end-t ""))) 1189 (or end-t "")))
1183 ;; FIXME!!!! 1190 ;; FIXME!!!!
diff --git a/lisp/files.el b/lisp/files.el
index aaed1395275..c9fb3514b57 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1646,40 +1646,33 @@ in that case, this function acts as if `enable-local-variables' were t."
1646 (lambda (elt) 1646 (lambda (elt)
1647 (cons (purecopy (car elt)) (cdr elt))) 1647 (cons (purecopy (car elt)) (cdr elt)))
1648 '(("\\.te?xt\\'" . text-mode) 1648 '(("\\.te?xt\\'" . text-mode)
1649 ("\\.tex\\'" . tex-mode) 1649 ("\\.[tT]e[xX]\\'" . tex-mode)
1650 ("\\.ins\\'" . tex-mode) ;Installation files for TeX packages. 1650 ("\\.ins\\'" . tex-mode) ;Installation files for TeX packages.
1651 ("\\.ltx\\'" . latex-mode) 1651 ("\\.ltx\\'" . latex-mode)
1652 ("\\.dtx\\'" . doctex-mode) 1652 ("\\.dtx\\'" . doctex-mode)
1653 ("\\.el\\'" . emacs-lisp-mode) 1653 ("\\.el\\'" . emacs-lisp-mode)
1654 ("\\.\\(scm\\|stk\\|ss\\|sch\\)\\'" . scheme-mode) 1654 ("\\.\\(scm\\|stk\\|ss\\|sch\\)\\'" . scheme-mode)
1655 ("\\.l\\'" . lisp-mode) 1655 ("\\.l\\'" . lisp-mode)
1656 ("\\.lisp\\'" . lisp-mode) 1656 ("\\.li?sp\\'" . lisp-mode)
1657 ("\\.f\\'" . fortran-mode) 1657 ("\\.[fF]\\'" . fortran-mode)
1658 ("\\.F\\'" . fortran-mode)
1659 ("\\.for\\'" . fortran-mode) 1658 ("\\.for\\'" . fortran-mode)
1660 ("\\.p\\'" . pascal-mode) 1659 ("\\.p\\'" . pascal-mode)
1661 ("\\.pas\\'" . pascal-mode) 1660 ("\\.pas\\'" . pascal-mode)
1662 ("\\.ad[abs]\\'" . ada-mode) 1661 ("\\.ad[abs]\\'" . ada-mode)
1663 ("\\.ad[bs].dg\\'" . ada-mode) 1662 ("\\.ad[bs].dg\\'" . ada-mode)
1664 ("\\.\\([pP]\\([Llm]\\|erl\\)\\|al\\)\\'" . perl-mode) 1663 ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode)
1665 ("\\.s?html?\\'" . html-mode) 1664 ("\\.s?html?\\'" . html-mode)
1666 ("\\.mk\\'" . makefile-mode) 1665 ("\\.mk\\'" . makefile-mode)
1667 ("\\(M\\|m\\|GNUm\\)akefile\\'" . makefile-mode) 1666 ("\\([Mm]\\|GNUm\\)akep*file\\'" . makefile-mode)
1668 ("\\.am\\'" . makefile-mode) ;For Automake. 1667 ("\\.am\\'" . makefile-mode) ;For Automake.
1669 ;; Less common extensions come here 1668 ;; Less common extensions come here
1670 ;; so more common ones above are found faster. 1669 ;; so more common ones above are found faster.
1671 ("\\.texinfo\\'" . texinfo-mode) 1670 ("\\.texinfo\\'" . texinfo-mode)
1672 ("\\.te?xi\\'" . texinfo-mode) 1671 ("\\.te?xi\\'" . texinfo-mode)
1673 ("\\.s\\'" . asm-mode) 1672 ("\\.[sS]\\'" . asm-mode)
1674 ("\\.S\\'" . asm-mode)
1675 ("\\.asm\\'" . asm-mode) 1673 ("\\.asm\\'" . asm-mode)
1676 ("ChangeLog\\'" . change-log-mode) 1674 ("[cC]hange\\.?[lL]og?\\'" . change-log-mode)
1677 ("change\\.log\\'" . change-log-mode) 1675 ("[cC]hange[lL]og\\.[0-9]+\\'" . change-log-mode)
1678 ("changelo\\'" . change-log-mode)
1679 ("ChangeLog\\.[0-9]+\\'" . change-log-mode)
1680 ;; for MSDOS and MS-Windows (which are case-insensitive)
1681 ("changelog\\'" . change-log-mode)
1682 ("changelog\\.[0-9]+\\'" . change-log-mode)
1683 ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode) 1676 ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode)
1684 ("\\.scm\\.[0-9]*\\'" . scheme-mode) 1677 ("\\.scm\\.[0-9]*\\'" . scheme-mode)
1685 ("\\.[ck]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode) 1678 ("\\.[ck]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
@@ -1688,36 +1681,27 @@ in that case, this function acts as if `enable-local-variables' were t."
1688 ("\\(/\\|\\`\\)\\.\\(bash_logout\\|shrc\\|[kz]shrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode) 1681 ("\\(/\\|\\`\\)\\.\\(bash_logout\\|shrc\\|[kz]shrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode)
1689 ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode) 1682 ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode)
1690 ("\\.m?spec\\'" . sh-mode) 1683 ("\\.m?spec\\'" . sh-mode)
1691 ("\\.mm\\'" . nroff-mode) 1684 ("\\.m[mes]\\'" . nroff-mode)
1692 ("\\.me\\'" . nroff-mode)
1693 ("\\.ms\\'" . nroff-mode)
1694 ("\\.man\\'" . nroff-mode) 1685 ("\\.man\\'" . nroff-mode)
1695 ("\\.TeX\\'" . tex-mode)
1696 ("\\.sty\\'" . latex-mode) 1686 ("\\.sty\\'" . latex-mode)
1697 ("\\.cls\\'" . latex-mode) ;LaTeX 2e class 1687 ("\\.cl[so]\\'" . latex-mode) ;LaTeX 2e class option
1698 ("\\.clo\\'" . latex-mode) ;LaTeX 2e class option
1699 ("\\.bbl\\'" . latex-mode) 1688 ("\\.bbl\\'" . latex-mode)
1700 ("\\.bib\\'" . bibtex-mode) 1689 ("\\.bib\\'" . bibtex-mode)
1701 ("\\.sql\\'" . sql-mode) 1690 ("\\.sql\\'" . sql-mode)
1702 ("\\.m4\\'" . m4-mode) 1691 ("\\.m[4c]\\'" . m4-mode)
1703 ("\\.mc\\'" . m4-mode) 1692 ("\\.m[fp]\\'" . metapost-mode)
1704 ("\\.mf\\'" . metafont-mode)
1705 ("\\.mp\\'" . metapost-mode)
1706 ("\\.vhdl?\\'" . vhdl-mode) 1693 ("\\.vhdl?\\'" . vhdl-mode)
1707 ("\\.article\\'" . text-mode) 1694 ("\\.article\\'" . text-mode)
1708 ("\\.letter\\'" . text-mode) 1695 ("\\.letter\\'" . text-mode)
1709 ("\\.tcl\\'" . tcl-mode) 1696 ("\\.i?tcl\\'" . tcl-mode)
1710 ("\\.exp\\'" . tcl-mode) 1697 ("\\.exp\\'" . tcl-mode)
1711 ("\\.itcl\\'" . tcl-mode)
1712 ("\\.itk\\'" . tcl-mode) 1698 ("\\.itk\\'" . tcl-mode)
1713 ("\\.icn\\'" . icon-mode) 1699 ("\\.icn\\'" . icon-mode)
1714 ("\\.sim\\'" . simula-mode) 1700 ("\\.sim\\'" . simula-mode)
1715 ("\\.mss\\'" . scribe-mode) 1701 ("\\.mss\\'" . scribe-mode)
1716 ("\\.f90\\'" . f90-mode) 1702 ("\\.f9[05]\\'" . f90-mode)
1717 ("\\.f95\\'" . f90-mode)
1718 ("\\.indent\\.pro\\'" . fundamental-mode) ; to avoid idlwave-mode 1703 ("\\.indent\\.pro\\'" . fundamental-mode) ; to avoid idlwave-mode
1719 ("\\.pro\\'" . idlwave-mode) 1704 ("\\.pro\\'" . idlwave-mode)
1720 ("\\.lsp\\'" . lisp-mode)
1721 ("\\.prolog\\'" . prolog-mode) 1705 ("\\.prolog\\'" . prolog-mode)
1722 ("\\.tar\\'" . tar-mode) 1706 ("\\.tar\\'" . tar-mode)
1723 ("\\.\\(arc\\|zip\\|lzh\\|zoo\\|ear\\|jar\\|war\\)\\'" . archive-mode) 1707 ("\\.\\(arc\\|zip\\|lzh\\|zoo\\|ear\\|jar\\|war\\)\\'" . archive-mode)
@@ -1733,10 +1717,11 @@ in that case, this function acts as if `enable-local-variables' were t."
1733 ("\\`/tmp/fol/" . text-mode) 1717 ("\\`/tmp/fol/" . text-mode)
1734 ("\\.oak\\'" . scheme-mode) 1718 ("\\.oak\\'" . scheme-mode)
1735 ("\\.sgml?\\'" . sgml-mode) 1719 ("\\.sgml?\\'" . sgml-mode)
1736 ("\\.xml\\'" . sgml-mode) 1720 ("\\.x[ms]l\\'" . xml-mode)
1737 ("\\.xsl\\'" . sgml-mode)
1738 ("\\.dtd\\'" . sgml-mode) 1721 ("\\.dtd\\'" . sgml-mode)
1739 ("\\.ds\\(ss\\)?l\\'" . dsssl-mode) 1722 ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
1723 ("\\.js\\'" . java-mode) ; javascript-mode would be better
1724 ("\\.x[bp]m\\'" . c-mode)
1740 ;; .emacs or .gnus or .viper following a directory delimiter in 1725 ;; .emacs or .gnus or .viper following a directory delimiter in
1741 ;; Unix, MSDOG or VMS syntax. 1726 ;; Unix, MSDOG or VMS syntax.
1742 ("[]>:/\\]\\..*\\(emacs\\|gnus\\|viper\\)\\'" . emacs-lisp-mode) 1727 ("[]>:/\\]\\..*\\(emacs\\|gnus\\|viper\\)\\'" . emacs-lisp-mode)
@@ -1760,7 +1745,7 @@ in that case, this function acts as if `enable-local-variables' were t."
1760 ;; or .#<file>.<rev>-<rev> or VC's <file>.~<rev>~. 1745 ;; or .#<file>.<rev>-<rev> or VC's <file>.~<rev>~.
1761 ;; Using mode nil rather than `ignore' would let the search continue 1746 ;; Using mode nil rather than `ignore' would let the search continue
1762 ;; through this list (with the shortened name) rather than start over. 1747 ;; through this list (with the shortened name) rather than start over.
1763 ("\\.~?[0-9]+\\.[0-9][-.0-9]*~?\\'" ignore t) 1748 ("\\.~?[0-9]+\\.[0-9][-.0-9]*~?\\'" nil t)
1764 ;; The following should come after the ChangeLog pattern 1749 ;; The following should come after the ChangeLog pattern
1765 ;; for the sake of ChangeLog.1, etc. 1750 ;; for the sake of ChangeLog.1, etc.
1766 ;; and after the .scm.[0-9] and CVS' <file>.<rev> patterns too. 1751 ;; and after the .scm.[0-9] and CVS' <file>.<rev> patterns too.
@@ -1849,12 +1834,20 @@ be interpreted by the interpreter matched by the second group of the
1849regular expression. The mode is then determined as the mode associated 1834regular expression. The mode is then determined as the mode associated
1850with that interpreter in `interpreter-mode-alist'.") 1835with that interpreter in `interpreter-mode-alist'.")
1851 1836
1837(defvar xml-based-modes '(html-mode)
1838 "Modes that override an XML declaration.
1839When `set-auto-mode' sees an <?xml or <!DOCTYPE declaration, that
1840buffer will be in some XML mode. If `auto-mode-alist' associates
1841the file with one of the modes in this list, that mode will be
1842used. Else `xml-mode' or `sgml-mode' is used.")
1843
1852(defun set-auto-mode (&optional just-from-file-name) 1844(defun set-auto-mode (&optional just-from-file-name)
1853 "Select major mode appropriate for current buffer. 1845 "Select major mode appropriate for current buffer.
1854This checks for a -*- mode tag in the buffer's text, 1846This checks for a -*- mode tag in the buffer's text, checks the
1855compares the filename against the entries in `auto-mode-alist', 1847interpreter that runs this file against `interpreter-mode-alist',
1856or checks the interpreter that runs this file against 1848looks for an <?xml or <!DOCTYPE declaration (see
1857`interpreter-mode-alist'. 1849`xml-based-modes'), or compares the filename against the entries
1850in `auto-mode-alist'.
1858 1851
1859It does not check for the `mode:' local variable in the 1852It does not check for the `mode:' local variable in the
1860Local Variables section of the file; for that, use `hack-local-variables'. 1853Local Variables section of the file; for that, use `hack-local-variables'.
@@ -1866,87 +1859,84 @@ If the optional argument JUST-FROM-FILE-NAME is non-nil,
1866then we do not set anything but the major mode, 1859then we do not set anything but the major mode,
1867and we don't even do that unless it would come from the file name." 1860and we don't even do that unless it would come from the file name."
1868 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- 1861 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*-
1869 (let (end done modes) 1862 (let (end done mode modes xml)
1870 (save-excursion
1871 (goto-char (point-min))
1872 (skip-chars-forward " \t\n")
1873 (and enable-local-variables
1874 (setq end (set-auto-mode-1))
1875 (if (save-excursion (search-forward ":" end t))
1876 ;; Find all specifications for the `mode:' variable
1877 ;; and execute them left to right.
1878 (while (let ((case-fold-search t))
1879 (or (and (looking-at "mode:")
1880 (goto-char (match-end 0)))
1881 (re-search-forward "[ \t;]mode:" end t)))
1882 (skip-chars-forward " \t")
1883 (let ((beg (point)))
1884 (if (search-forward ";" end t)
1885 (forward-char -1)
1886 (goto-char end))
1887 (skip-chars-backward " \t")
1888 (push (intern (concat (downcase (buffer-substring beg (point))) "-mode"))
1889 modes)))
1890 ;; Simple -*-MODE-*- case.
1891 (push (intern (concat (downcase (buffer-substring (point) end))
1892 "-mode"))
1893 modes))))
1894 ;; If we found modes to use, invoke them now,
1895 ;; outside the save-excursion.
1896 (unless just-from-file-name 1863 (unless just-from-file-name
1897 (dolist (mode (nreverse modes)) 1864 ;; Find a -*- mode tag
1898 (if (not (functionp mode)) 1865 (save-excursion
1899 (message "Ignoring unknown mode `%s'" mode) 1866 (goto-char (point-min))
1900 (setq done t) 1867 (skip-chars-forward " \t\n")
1901 (funcall mode)))) 1868 ;; While we're at this point, check xml for later.
1902 ;; If we didn't find a mode from a -*- line, try using the file name. 1869 (setq xml (looking-at "<\\?xml \\|<!DOCTYPE"))
1870 (and enable-local-variables
1871 (setq end (set-auto-mode-1))
1872 (if (save-excursion (search-forward ":" end t))
1873 ;; Find all specifications for the `mode:' variable
1874 ;; and execute them left to right.
1875 (while (let ((case-fold-search t))
1876 (or (and (looking-at "mode:")
1877 (goto-char (match-end 0)))
1878 (re-search-forward "[ \t;]mode:" end t)))
1879 (skip-chars-forward " \t")
1880 (let ((beg (point)))
1881 (if (search-forward ";" end t)
1882 (forward-char -1)
1883 (goto-char end))
1884 (skip-chars-backward " \t")
1885 (push (intern (concat (downcase (buffer-substring beg (point))) "-mode"))
1886 modes)))
1887 ;; Simple -*-MODE-*- case.
1888 (push (intern (concat (downcase (buffer-substring (point) end))
1889 "-mode"))
1890 modes))))
1891 ;; If we found modes to use, invoke them now, outside the save-excursion.
1892 (if modes
1893 (dolist (mode (nreverse modes))
1894 (if (not (functionp mode))
1895 (message "Ignoring unknown mode `%s'" mode)
1896 (setq done t)
1897 (funcall mode)))
1898 ;; If we didn't, look for an interpreter specified in the first line.
1899 ;; As a special case, allow for things like "#!/bin/env perl", which
1900 ;; finds the interpreter anywhere in $PATH.
1901 (setq mode (save-excursion
1902 (goto-char (point-min))
1903 (if (looking-at auto-mode-interpreter-regexp)
1904 (match-string 2)
1905 ""))
1906 ;; Map interpreter name to a mode, signalling we're done at the
1907 ;; same time.
1908 done (assoc (file-name-nondirectory mode)
1909 interpreter-mode-alist))
1910 ;; If we found an interpreter mode to use, invoke it now.
1911 (if done (funcall (cdr done)))))
1903 (if (and (not done) buffer-file-name) 1912 (if (and (not done) buffer-file-name)
1904 (let ((name buffer-file-name) 1913 (let ((name buffer-file-name))
1905 (keep-going t))
1906 ;; Remove backup-suffixes from file name. 1914 ;; Remove backup-suffixes from file name.
1907 (setq name (file-name-sans-versions name)) 1915 (setq name (file-name-sans-versions name))
1908 (while keep-going 1916 (while (not done)
1909 (setq keep-going nil) 1917 ;; Find first matching alist entry.
1910 (let ((alist auto-mode-alist) 1918 (let ((case-fold-search
1911 (mode nil)) 1919 (memq system-type '(vax-vms windows-nt cygwin))))
1912 ;; Find first matching alist entry. 1920 (if (and (setq mode (assoc-default name auto-mode-alist
1913 (let ((case-fold-search 1921 'string-match))
1914 (memq system-type '(vax-vms windows-nt cygwin)))) 1922 (consp mode)
1915 (while (and (not mode) alist) 1923 (cadr mode))
1916 (if (string-match (car (car alist)) name) 1924 (setq mode (car mode)
1917 (if (and (consp (cdr (car alist))) 1925 name (substring name 0 (match-beginning 0)))
1918 (nth 2 (car alist))) 1926 (setq done t)))
1919 (setq mode (car (cdr (car alist))) 1927 (if mode
1920 name (substring name 0 (match-beginning 0)) 1928 ;; When JUST-FROM-FILE-NAME is set, we are working on behalf
1921 keep-going t) 1929 ;; of set-visited-file-name. In that case, if the major mode
1922 (setq mode (cdr (car alist)) 1930 ;; specified is the same one we already have, don't actually
1923 keep-going nil))) 1931 ;; reset it. We don't want to lose minor modes such as Font
1924 (setq alist (cdr alist)))) 1932 ;; Lock.
1925 (if mode 1933 (unless (and just-from-file-name (eq mode major-mode))
1926 ;; When JUST-FROM-FILE-NAME is set, 1934 (if (if xml (memq mode xml-based-modes) t)
1927 ;; we are working on behalf of set-visited-file-name. 1935 (funcall mode)
1928 ;; In that case, if the major mode specified is the 1936 (xml-mode)))))))
1929 ;; same one we already have, don't actually reset it. 1937 (and (not done)
1930 ;; We don't want to lose minor modes such as Font Lock. 1938 xml
1931 (unless (and just-from-file-name (eq mode major-mode)) 1939 (xml-mode))))
1932 (funcall mode))
1933 ;; If we can't deduce a mode from the file name,
1934 ;; look for an interpreter specified in the first line.
1935 ;; As a special case, allow for things like "#!/bin/env perl",
1936 ;; which finds the interpreter anywhere in $PATH.
1937 (let ((interpreter
1938 (save-excursion
1939 (goto-char (point-min))
1940 (if (looking-at auto-mode-interpreter-regexp)
1941 (match-string 2)
1942 "")))
1943 elt)
1944 ;; Map interpreter name to a mode.
1945 (setq elt (assoc (file-name-nondirectory interpreter)
1946 interpreter-mode-alist))
1947 (unless just-from-file-name
1948 (if elt
1949 (funcall (cdr elt))))))))))))
1950 1940
1951 1941
1952(defun set-auto-mode-1 () 1942(defun set-auto-mode-1 ()
@@ -2157,7 +2147,7 @@ is specified, returning t if it is specified."
2157 (error "Local variables entry is missing the suffix"))) 2147 (error "Local variables entry is missing the suffix")))
2158 (forward-line 1)) 2148 (forward-line 1))
2159 (goto-char (point-min)) 2149 (goto-char (point-min))
2160 2150
2161 (while (not (eobp)) 2151 (while (not (eobp))
2162 ;; Find the variable name; strip whitespace. 2152 ;; Find the variable name; strip whitespace.
2163 (skip-chars-forward " \t") 2153 (skip-chars-forward " \t")
diff --git a/lisp/find-file.el b/lisp/find-file.el
index 4805d08400b..d85d2ab0f51 100644
--- a/lisp/find-file.el
+++ b/lisp/find-file.el
@@ -57,7 +57,7 @@
57;; format above can be changed to include a function to be called when the 57;; format above can be changed to include a function to be called when the
58;; current file matches the regexp: 58;; current file matches the regexp:
59;; 59;;
60;; '(("\\.cc$" cc-function) 60;; '(("\\.cc$" cc--function)
61;; ("\\.hh$" hh-function)) 61;; ("\\.hh$" hh-function))
62;; 62;;
63;; These functions must return a list consisting of the possible names of the 63;; These functions must return a list consisting of the possible names of the
@@ -239,22 +239,26 @@ the preceding slash. The star represents all the subdirectories except
239 :group 'ff) 239 :group 'ff)
240 240
241(defcustom cc-other-file-alist 241(defcustom cc-other-file-alist
242 '( 242 '(("\\.cc\\'" (".hh" ".h"))
243 ("\\.cc$" (".hh" ".h")) 243 ("\\.hh\\'" (".cc" ".C"))
244 ("\\.hh$" (".cc" ".C"))
245 244
246 ("\\.c$" (".h")) 245 ("\\.c\\'" (".h"))
247 ("\\.h$" (".c" ".cc" ".C" ".CC" ".cxx" ".cpp")) 246 ("\\.h\\'" (".c" ".cc" ".C" ".CC" ".cxx" ".cpp"))
248 247
249 ("\\.C$" (".H" ".hh" ".h")) 248 ("\\.C\\'" (".H" ".hh" ".h"))
250 ("\\.H$" (".C" ".CC")) 249 ("\\.H\\'" (".C" ".CC"))
251 250
252 ("\\.CC$" (".HH" ".H" ".hh" ".h")) 251 ("\\.CC\\'" (".HH" ".H" ".hh" ".h"))
253 ("\\.HH$" (".CC")) 252 ("\\.HH\\'" (".CC"))
254 253
255 ("\\.cxx$" (".hh" ".h")) 254 ("\\.c\\+\\+\\'" (".h++" ".hh" ".h"))
256 ("\\.cpp$" (".hh" ".h")) 255 ("\\.h\\+\\+\\'" (".c++"))
257 ) 256
257 ("\\.cpp\\'" (".hpp" ".hh" ".h"))
258 ("\\.hpp\\'" (".cpp"))
259
260 ("\\.cxx\\'" (".hxx" ".hh" ".h"))
261 ("\\.hxx\\'" (".cxx")))
258 "*Alist of extensions to find given the current file's extension. 262 "*Alist of extensions to find given the current file's extension.
259 263
260This list should contain the most used extensions before the others, 264This list should contain the most used extensions before the others,
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 2a4b0a80398..02d8fe24007 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,13 @@
12004-10-25 Reiner Steib <Reiner.Steib@gmx.de>
2
3 * html2text.el (html2text-buffer-head): Removed. Use `goto-char'
4 instead.
5
62004-10-24 Kevin Greiner <kevin.greiner@compsol.cc>
7
8 * gnus-start.el (gnus-convert-old-newsrc): Fixed numeric
9 comparison on string.
10
12004-10-21 Katsumi Yamaoka <yamaoka@jpl.org> 112004-10-21 Katsumi Yamaoka <yamaoka@jpl.org>
2 12
3 * mm-view.el (mm-display-inline-fontify): Inhibit font-lock when 13 * mm-view.el (mm-display-inline-fontify): Inhibit font-lock when
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index dda03b864b1..ecce9f00b37 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -2227,7 +2227,8 @@ If FORCE is non-nil, the .newsrc file is read."
2227(defun gnus-convert-old-newsrc () 2227(defun gnus-convert-old-newsrc ()
2228 "Convert old newsrc formats into the current format, if needed." 2228 "Convert old newsrc formats into the current format, if needed."
2229 (let ((fcv (and gnus-newsrc-file-version 2229 (let ((fcv (and gnus-newsrc-file-version
2230 (gnus-continuum-version gnus-newsrc-file-version)))) 2230 (gnus-continuum-version gnus-newsrc-file-version)))
2231 (gcv (gnus-continuum-version)))
2231 (when fcv 2232 (when fcv
2232 ;; A newsrc file was loaded. 2233 ;; A newsrc file was loaded.
2233 (let (prompt-displayed 2234 (let (prompt-displayed
@@ -2261,7 +2262,7 @@ If FORCE is non-nil, the .newsrc file is read."
2261 ;; Perform converters to bring older version up to date. 2262 ;; Perform converters to bring older version up to date.
2262 (when (and converters (< fcv (caar converters))) 2263 (when (and converters (< fcv (caar converters)))
2263 (while (and converters (< fcv (caar converters)) 2264 (while (and converters (< fcv (caar converters))
2264 (<= (caar converters) gnus-version)) 2265 (<= (caar converters) gcv))
2265 (let* ((converter-spec (pop converters)) 2266 (let* ((converter-spec (pop converters))
2266 (convert-to (nth 1 converter-spec)) 2267 (convert-to (nth 1 converter-spec))
2267 (load-from (nth 2 converter-spec)) 2268 (load-from (nth 2 converter-spec))
diff --git a/lisp/gnus/html2text.el b/lisp/gnus/html2text.el
index 6f1ef3b0289..31d1869c695 100644
--- a/lisp/gnus/html2text.el
+++ b/lisp/gnus/html2text.el
@@ -116,12 +116,6 @@ formatting, and then moved afterward.")
116;; <Utility functions> 116;; <Utility functions>
117;; 117;;
118 118
119(defun html2text-buffer-head ()
120 (if (string= mode-name "Article")
121 (beginning-of-buffer)
122 (beginning-of-buffer)
123 )
124 )
125 119
126(defun html2text-replace-string (from-string to-string p1 p2) 120(defun html2text-replace-string (from-string to-string p1 p2)
127 (goto-char p1) 121 (goto-char p1)
@@ -432,11 +426,11 @@ formatting, and then moved afterward.")
432 "This _tries_ to fix up the paragraphs - this is done in quite a ad-hook 426 "This _tries_ to fix up the paragraphs - this is done in quite a ad-hook
433fashion, quite close to pure guess-work. It does work in some cases though." 427fashion, quite close to pure guess-work. It does work in some cases though."
434 (interactive) 428 (interactive)
435 (html2text-buffer-head) 429 (goto-char (point-min))
436 (replace-regexp "^<br>$" "") 430 (replace-regexp "^<br>$" "")
437 ;; Removing lonely <br> on a single line, if they are left intact we 431 ;; Removing lonely <br> on a single line, if they are left intact we
438 ;; dont have any paragraphs at all. 432 ;; dont have any paragraphs at all.
439 (html2text-buffer-head) 433 (goto-char (point-min))
440 (while (not (eobp)) 434 (while (not (eobp))
441 (let ((p1 (point))) 435 (let ((p1 (point)))
442 (forward-paragraph 1) 436 (forward-paragraph 1)
@@ -462,7 +456,7 @@ fashion, quite close to pure guess-work. It does work in some cases though."
462See the documentation for that variable." 456See the documentation for that variable."
463 (interactive) 457 (interactive)
464 (dolist (tag tag-list) 458 (dolist (tag tag-list)
465 (html2text-buffer-head) 459 (goto-char (point-min))
466 (while (re-search-forward (format "\\(</?%s[^>]*>\\)" tag) (point-max) t) 460 (while (re-search-forward (format "\\(</?%s[^>]*>\\)" tag) (point-max) t)
467 (delete-region (match-beginning 0) (match-end 0))))) 461 (delete-region (match-beginning 0) (match-end 0)))))
468 462
@@ -472,7 +466,7 @@ See the documentation for that variable."
472 (dolist (tag-and-function html2text-format-tag-list) 466 (dolist (tag-and-function html2text-format-tag-list)
473 (let ((tag (car tag-and-function)) 467 (let ((tag (car tag-and-function))
474 (function (cdr tag-and-function))) 468 (function (cdr tag-and-function)))
475 (html2text-buffer-head) 469 (goto-char (point-min))
476 (while (re-search-forward (format "\\(<%s\\( [^>]*\\)?>\\)" tag) 470 (while (re-search-forward (format "\\(<%s\\( [^>]*\\)?>\\)" tag)
477 (point-max) t) 471 (point-max) t)
478 (let ((p1) 472 (let ((p1)
@@ -497,7 +491,7 @@ See the documentation for that variable."
497 "See the variable \"html2text-replace-list\" for documentation" 491 "See the variable \"html2text-replace-list\" for documentation"
498 (interactive) 492 (interactive)
499 (dolist (e html2text-replace-list) 493 (dolist (e html2text-replace-list)
500 (html2text-buffer-head) 494 (goto-char (point-min))
501 (let ((old-string (car e)) 495 (let ((old-string (car e))
502 (new-string (cdr e))) 496 (new-string (cdr e)))
503 (html2text-replace-string old-string new-string (point-min) (point-max)) 497 (html2text-replace-string old-string new-string (point-min) (point-max))
@@ -511,7 +505,7 @@ See the documentation for that variable."
511 (dolist (tag-and-function html2text-format-single-element-list) 505 (dolist (tag-and-function html2text-format-single-element-list)
512 (let ((tag (car tag-and-function)) 506 (let ((tag (car tag-and-function))
513 (function (cdr tag-and-function))) 507 (function (cdr tag-and-function)))
514 (html2text-buffer-head) 508 (goto-char (point-min))
515 (while (re-search-forward (format "\\(<%s\\( [^>]*\\)?>\\)" tag) 509 (while (re-search-forward (format "\\(<%s\\( [^>]*\\)?>\\)" tag)
516 (point-max) t) 510 (point-max) t)
517 (let ((p1) 511 (let ((p1)
diff --git a/lisp/help.el b/lisp/help.el
index 5a2867bdc18..ee35d007639 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -573,14 +573,14 @@ the last key hit are used."
573 (if (symbolp defn) defn (prin1-to-string defn))))))))) 573 (if (symbolp defn) defn (prin1-to-string defn)))))))))
574 574
575 575
576(defun describe-key (key &optional untranslated) 576(defun describe-key (key &optional untranslated up-event)
577 "Display documentation of the function invoked by KEY. 577 "Display documentation of the function invoked by KEY.
578KEY should be a key sequence--when calling from a program, 578KEY should be a key sequence--when calling from a program,
579pass a string or a vector. 579pass a string or a vector.
580If non-nil UNTRANSLATED is a vector of the untranslated events. 580If non-nil UNTRANSLATED is a vector of the untranslated events.
581It can also be a number in which case the untranslated events from 581It can also be a number in which case the untranslated events from
582the last key hit are used." 582the last key hit are used."
583 (interactive "kDescribe key: \np") 583 (interactive "kDescribe key: \np\nU")
584 (if (numberp untranslated) 584 (if (numberp untranslated)
585 (setq untranslated (this-single-command-raw-keys))) 585 (setq untranslated (this-single-command-raw-keys)))
586 (save-excursion 586 (save-excursion
@@ -608,6 +608,17 @@ the last key hit are used."
608 (prin1 defn) 608 (prin1 defn)
609 (princ "\n which is ") 609 (princ "\n which is ")
610 (describe-function-1 defn) 610 (describe-function-1 defn)
611 (when up-event
612 (let ((defn (or (string-key-binding up-event) (key-binding up-event))))
613 (unless (or (null defn) (integerp defn) (equal defn 'undefined))
614 (princ "\n\n-------------- up event ---------------\n\n")
615 (princ (key-description up-event))
616 (if (windowp window)
617 (princ " at that spot"))
618 (princ " runs the command ")
619 (prin1 defn)
620 (princ "\n which is ")
621 (describe-function-1 defn))))
611 (print-help-return-message))))))) 622 (print-help-return-message)))))))
612 623
613 624
@@ -651,7 +662,8 @@ whose documentation describes the minor mode."
651 (push (list pretty-minor-mode mode indicator) 662 (push (list pretty-minor-mode mode indicator)
652 minor-modes)))) 663 minor-modes))))
653 (if auto-fill-function 664 (if auto-fill-function
654 (push '("Auto Fill" auto-fill-mode " Fill") 665 ;; copy pure string so we can add face property to it below.
666 (push (list (copy-sequence "Auto Fill") 'auto-fill-mode " Fill")
655 minor-modes)) 667 minor-modes))
656 (setq minor-modes 668 (setq minor-modes
657 (sort minor-modes 669 (sort minor-modes
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 5d24964362a..bed4330d0c2 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -645,16 +645,16 @@ The group will be added to `ibuffer-filter-group-kill-ring'."
645 (ibuffer-update nil t)) 645 (ibuffer-update nil t))
646 646
647;;;###autoload 647;;;###autoload
648(defun ibuffer-kill-line (&optional arg) 648(defun ibuffer-kill-line (&optional arg interactive-p)
649 "Kill the filter group at point. 649 "Kill the filter group at point.
650See also `ibuffer-kill-filter-group'." 650See also `ibuffer-kill-filter-group'."
651 (interactive "P") 651 (interactive "P\np")
652 (ibuffer-aif (save-excursion 652 (ibuffer-aif (save-excursion
653 (ibuffer-forward-line 0) 653 (ibuffer-forward-line 0)
654 (get-text-property (point) 'ibuffer-filter-group-name)) 654 (get-text-property (point) 'ibuffer-filter-group-name))
655 (progn 655 (progn
656 (ibuffer-kill-filter-group it)) 656 (ibuffer-kill-filter-group it))
657 (funcall (if (interactive-p) #'call-interactively #'funcall) 657 (funcall (if interactive-p #'call-interactively #'funcall)
658 #'kill-line arg))) 658 #'kill-line arg)))
659 659
660(defun ibuffer-insert-filter-group-before (newgroup group) 660(defun ibuffer-insert-filter-group-before (newgroup group)
@@ -1237,53 +1237,51 @@ hidden group filter, open it.
1237If `ibuffer-jump-offer-only-visible-buffers' is non-nil, only offer 1237If `ibuffer-jump-offer-only-visible-buffers' is non-nil, only offer
1238visible buffers in the completion list. Calling the command with 1238visible buffers in the completion list. Calling the command with
1239a prefix argument reverses the meaning of that variable." 1239a prefix argument reverses the meaning of that variable."
1240 (interactive (list nil)) 1240 (interactive (list
1241 (let ((only-visible ibuffer-jump-offer-only-visible-buffers)) 1241 (let ((only-visible ibuffer-jump-offer-only-visible-buffers))
1242 (when current-prefix-arg 1242 (when current-prefix-arg
1243 (setq only-visible (not only-visible))) 1243 (setq only-visible (not only-visible)))
1244 (if only-visible 1244 (if only-visible
1245 (let ((table (mapcar #'(lambda (x) 1245 (let ((table (mapcar #'(lambda (x)
1246 (buffer-name (car x))) 1246 (buffer-name (car x)))
1247 (ibuffer-current-state-list)))) 1247 (ibuffer-current-state-list))))
1248 (when (null table) 1248 (when (null table)
1249 (error "No buffers!")) 1249 (error "No buffers!"))
1250 (when (interactive-p) 1250 (completing-read "Jump to buffer: "
1251 (setq name (completing-read "Jump to buffer: " 1251 table nil t))
1252 table nil t)))) 1252 (read-buffer "Jump to buffer: " nil t)))))
1253 (when (interactive-p) 1253 (when (not (string= "" name))
1254 (setq name (read-buffer "Jump to buffer: " nil t)))) 1254 (let (buf-point)
1255 (when (not (string= "" name)) 1255 ;; Blindly search for our buffer: it is very likely that it is
1256 (let (buf-point) 1256 ;; not in a hidden filter group.
1257 ;; Blindly search for our buffer: it is very likely that it is 1257 (ibuffer-map-lines #'(lambda (buf marks)
1258 ;; not in a hidden filter group. 1258 (when (string= (buffer-name buf) name)
1259 (ibuffer-map-lines #'(lambda (buf marks) 1259 (setq buf-point (point))
1260 (when (string= (buffer-name buf) name) 1260 nil))
1261 (setq buf-point (point)) 1261 t nil)
1262 nil)) 1262 (when (and
1263 t nil) 1263 (null buf-point)
1264 (when (and 1264 (not (null ibuffer-hidden-filter-groups)))
1265 (null buf-point) 1265 ;; We did not find our buffer. It must be in a hidden filter
1266 (not (null ibuffer-hidden-filter-groups))) 1266 ;; group, so go through all hidden filter groups to find it.
1267 ;; We did not find our buffer. It must be in a hidden filter 1267 (catch 'found
1268 ;; group, so go through all hidden filter groups to find it. 1268 (dolist (group ibuffer-hidden-filter-groups)
1269 (catch 'found 1269 (ibuffer-jump-to-filter-group group)
1270 (dolist (group ibuffer-hidden-filter-groups) 1270 (ibuffer-toggle-filter-group)
1271 (ibuffer-jump-to-filter-group group) 1271 (ibuffer-map-lines #'(lambda (buf marks)
1272 (ibuffer-toggle-filter-group) 1272 (when (string= (buffer-name buf) name)
1273 (ibuffer-map-lines #'(lambda (buf marks) 1273 (setq buf-point (point))
1274 (when (string= (buffer-name buf) name) 1274 nil))
1275 (setq buf-point (point)) 1275 t group)
1276 nil)) 1276 (if buf-point
1277 t group) 1277 (throw 'found nil)
1278 (if buf-point 1278 (ibuffer-toggle-filter-group)))))
1279 (throw 'found nil) 1279 (if (null buf-point)
1280 (ibuffer-toggle-filter-group))))) 1280 ;; Still not found even though we expanded all hidden filter
1281 (if (null buf-point) 1281 ;; groups: that must be because it's hidden by predicate:
1282 ;; Still not found even though we expanded all hidden filter 1282 ;; we won't bother trying to display it.
1283 ;; groups: that must be because it's hidden by predicate: 1283 (error "No buffer with name %s" name)
1284 ;; we won't bother trying to display it. 1284 (goto-char buf-point)))))
1285 (error "No buffer with name %s" name)
1286 (goto-char buf-point))))))
1287 1285
1288;;;###autoload 1286;;;###autoload
1289(defun ibuffer-diff-with-file () 1287(defun ibuffer-diff-with-file ()
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 12f29bdac63..30c97a383d3 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -873,8 +873,8 @@ width and the longest string in LIST."
873 default-directory) 873 default-directory)
874 default-directory)))) 874 default-directory))))
875 (list (read-file-name "Find file: " default-directory) 875 (list (read-file-name "Find file: " default-directory)
876 current-prefix-arg))) 876 t)))
877 (find-file file (or wildcards (interactive-p)))) 877 (find-file file wildcards))
878 878
879(defun ibuffer-mouse-visit-buffer (event) 879(defun ibuffer-mouse-visit-buffer (event)
880 "Visit the buffer chosen with the mouse." 880 "Visit the buffer chosen with the mouse."
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 6859c0c74c7..924746f3bd1 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -62,6 +62,8 @@
62 62
63;;; Code: 63;;; Code:
64 64
65(require 'newcomment)
66
65(eval-when-compile (require 'cl)) 67(eval-when-compile (require 'cl))
66 68
67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -796,32 +798,37 @@ depending on PATTERNS."
796 (regexp (nth 1 pat)) 798 (regexp (nth 1 pat))
797 (index (nth 2 pat)) 799 (index (nth 2 pat))
798 (function (nth 3 pat)) 800 (function (nth 3 pat))
799 (rest (nthcdr 4 pat))) 801 (rest (nthcdr 4 pat))
802 cs)
800 ;; Go backwards for convenience of adding items in order. 803 ;; Go backwards for convenience of adding items in order.
801 (goto-char (point-max)) 804 (goto-char (point-max))
802 (while (re-search-backward regexp nil t) 805 (while (re-search-backward regexp nil t)
803 (imenu-progress-message prev-pos nil t) 806 (goto-char (match-end index))
804 (setq beg (match-beginning index)) 807 (setq beg (match-beginning index))
805 ;; Add this sort of submenu only when we've found an 808 (if (setq cs (save-match-data (comment-beginning)))
806 ;; item for it, avoiding empty, duff menus. 809 (goto-char cs) ; skip this one, it's in a comment
807 (unless (assoc menu-title index-alist) 810 (goto-char beg)
808 (push (list menu-title) index-alist)) 811 (imenu-progress-message prev-pos nil t)
809 (if imenu-use-markers 812 ;; Add this sort of submenu only when we've found an
810 (setq beg (copy-marker beg))) 813 ;; item for it, avoiding empty, duff menus.
811 (let ((item 814 (unless (assoc menu-title index-alist)
812 (if function 815 (push (list menu-title) index-alist))
813 (nconc (list (match-string-no-properties index) 816 (if imenu-use-markers
814 beg function) 817 (setq beg (copy-marker beg)))
815 rest) 818 (let ((item
816 (cons (match-string-no-properties index) 819 (if function
817 beg))) 820 (nconc (list (match-string-no-properties index)
818 ;; This is the desired submenu, 821 beg function)
819 ;; starting with its title (or nil). 822 rest)
820 (menu (assoc menu-title index-alist))) 823 (cons (match-string-no-properties index)
821 ;; Insert the item unless it is already present. 824 beg)))
822 (unless (member item (cdr menu)) 825 ;; This is the desired submenu,
823 (setcdr menu 826 ;; starting with its title (or nil).
824 (cons item (cdr menu)))))))) 827 (menu (assoc menu-title index-alist)))
828 ;; Insert the item unless it is already present.
829 (unless (member item (cdr menu))
830 (setcdr menu
831 (cons item (cdr menu)))))))))
825 (set-syntax-table old-table))) 832 (set-syntax-table old-table)))
826 (imenu-progress-message prev-pos 100 t) 833 (imenu-progress-message prev-pos 100 t)
827 ;; Sort each submenu by position. 834 ;; Sort each submenu by position.
diff --git a/lisp/indent.el b/lisp/indent.el
index e1a9cae4819..9713268f03b 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -205,7 +205,6 @@ If `auto-fill-mode' is active, re-fill the region to fit the new margin.
205Interactively, WIDTH is the prefix argument, if specified. 205Interactively, WIDTH is the prefix argument, if specified.
206Without prefix argument, the command prompts for WIDTH." 206Without prefix argument, the command prompts for WIDTH."
207 (interactive "r\nNSet left margin to column: ") 207 (interactive "r\nNSet left margin to column: ")
208 (if (interactive-p) (setq width (prefix-numeric-value width)))
209 (save-excursion 208 (save-excursion
210 ;; If inside indentation, start from BOL. 209 ;; If inside indentation, start from BOL.
211 (goto-char from) 210 (goto-char from)
@@ -229,7 +228,6 @@ If `auto-fill-mode' is active, re-fill the region to fit the new margin.
229Interactively, WIDTH is the prefix argument, if specified. 228Interactively, WIDTH is the prefix argument, if specified.
230Without prefix argument, the command prompts for WIDTH." 229Without prefix argument, the command prompts for WIDTH."
231 (interactive "r\nNSet right margin to width: ") 230 (interactive "r\nNSet right margin to width: ")
232 (if (interactive-p) (setq width (prefix-numeric-value width)))
233 (save-excursion 231 (save-excursion
234 (goto-char from) 232 (goto-char from)
235 (skip-chars-backward " \t") 233 (skip-chars-backward " \t")
@@ -289,12 +287,10 @@ to change the margin by, in characters. A negative argument decreases
289the right margin width. 287the right margin width.
290If `auto-fill-mode' is active, re-fill the region to fit the new margin." 288If `auto-fill-mode' is active, re-fill the region to fit the new margin."
291 (interactive "r\nP") 289 (interactive "r\nP")
292 (if (interactive-p) 290 (setq inc (if inc (prefix-numeric-value inc) standard-indent))
293 (setq inc (if inc (prefix-numeric-value current-prefix-arg)
294 standard-indent)))
295 (save-excursion 291 (save-excursion
296 (alter-text-property from to 'right-margin 292 (alter-text-property from to 'right-margin
297 (lambda (v) (+ inc (or v 0)))) 293 (lambda (v) (+ inc (or v 0))))
298 (if auto-fill-function 294 (if auto-fill-function
299 (fill-region from to nil t t)))) 295 (fill-region from to nil t t))))
300 296
diff --git a/lisp/info.el b/lisp/info.el
index 17905c6d738..4fc7b5c9cf7 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3248,7 +3248,8 @@ The locations are of the format used in `Info-history', i.e.
3248\(FILENAME NODENAME BUFFERPOS\)." 3248\(FILENAME NODENAME BUFFERPOS\)."
3249 (let ((where '()) 3249 (let ((where '())
3250 (cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command)) 3250 (cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command))
3251 "\\( <[0-9]+>\\)?:\\s *\\(.*\\)\\.$")) 3251 "\\( <[0-9]+>\\)?:\\s *\\(.*\\)\\."
3252 "\\([ \t]*(line[ \t]*[0-9]*)\\)?$"))
3252 (info-file "emacs")) ;default 3253 (info-file "emacs")) ;default
3253 ;; Determine which info file this command is documented in. 3254 ;; Determine which info file this command is documented in.
3254 (if (get command 'info-file) 3255 (if (get command 'info-file)
diff --git a/lisp/man.el b/lisp/man.el
index cbfae21e44b..afd183fa720 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -893,12 +893,15 @@ header file(#include <foo.h>) and files in FILES"
893 'Man-target-string (match-string target-pos) 893 'Man-target-string (match-string target-pos)
894 ))))) 894 )))))
895 895
896(defun Man-cleanup-manpage () 896(defun Man-cleanup-manpage (&optional interactive)
897 "Remove overstriking and underlining from the current buffer." 897 "Remove overstriking and underlining from the current buffer.
898 (interactive) 898Normally skip any jobs that should have been done by the sed script,
899but when called interactively, do those jobs even if the sed
900script would have done them."
901 (interactive "p")
899 (message "Please wait: cleaning up the %s man page..." 902 (message "Please wait: cleaning up the %s man page..."
900 Man-arguments) 903 Man-arguments)
901 (if (or (interactive-p) (not Man-sed-script)) 904 (if (or interactive (not Man-sed-script))
902 (progn 905 (progn
903 (goto-char (point-min)) 906 (goto-char (point-min))
904 (while (search-forward "_\b" nil t) (backward-delete-char 2)) 907 (while (search-forward "_\b" nil t) (backward-delete-char 2))
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 17deeff4619..22840896c17 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -596,10 +596,12 @@ PROPS are additional properties."
596 596
597(defmacro menu-bar-make-toggle (name variable doc message help &rest body) 597(defmacro menu-bar-make-toggle (name variable doc message help &rest body)
598 `(progn 598 `(progn
599 (defun ,name () 599 (defun ,name (&optional interactively)
600 ,(concat "Toggle whether to " (downcase (substring help 0 1)) 600 ,(concat "Toggle whether to " (downcase (substring help 0 1))
601 (substring help 1) ".") 601 (substring help 1) ".\
602 (interactive) 602In an interactive call, record this option as a candidate for saving
603by \"Save Options\" in Custom buffers.")
604 (interactive "p")
603 (if ,(if body `(progn . ,body) 605 (if ,(if body `(progn . ,body)
604 `(progn 606 `(progn
605 (custom-load-symbol ',variable) 607 (custom-load-symbol ',variable)
@@ -612,7 +614,7 @@ PROPS are additional properties."
612 ;; a variable is set interactively, as the purpose is to mark it as 614 ;; a variable is set interactively, as the purpose is to mark it as
613 ;; a candidate for "Save Options", and we do not want to save options 615 ;; a candidate for "Save Options", and we do not want to save options
614 ;; the user have already set explicitly in his init file. 616 ;; the user have already set explicitly in his init file.
615 (if (interactive-p) (customize-mark-as-set ',variable))) 617 (if interactively (customize-mark-as-set ',variable)))
616 '(menu-item ,doc ,name 618 '(menu-item ,doc ,name
617 :help ,help 619 :help ,help
618 :button (:toggle . (and (default-boundp ',variable) 620 :button (:toggle . (and (default-boundp ',variable)
diff --git a/lisp/mouse-sel.el b/lisp/mouse-sel.el
index f9b90fbfc6a..b6f4558f280 100644
--- a/lisp/mouse-sel.el
+++ b/lisp/mouse-sel.el
@@ -240,6 +240,7 @@ to the kill ring. Pressing mouse-1 or mouse-3 kills it.
240& mouse-3, but operate on the X secondary selection rather than the 240& mouse-3, but operate on the X secondary selection rather than the
241primary selection and region." 241primary selection and region."
242 :global t 242 :global t
243 :group 'mouse-sel
243 (if mouse-sel-mode 244 (if mouse-sel-mode
244 (progn 245 (progn
245 (add-hook 'x-lost-selection-hooks 'mouse-sel-lost-selection-hook) 246 (add-hook 'x-lost-selection-hooks 'mouse-sel-lost-selection-hook)
diff --git a/lisp/net/password.el b/lisp/net/password.el
index e8be612ecca..da009ed9ea0 100644
--- a/lisp/net/password.el
+++ b/lisp/net/password.el
@@ -122,6 +122,62 @@ seconds."
122 key)) 122 key))
123 nil) 123 nil)
124 124
125;;;###autoload
126(defun read-passwd (prompt &optional confirm default)
127 "Read a password, prompting with PROMPT, and return it.
128If optional CONFIRM is non-nil, read the password twice to make sure.
129Optional DEFAULT is a default password to use instead of empty input.
130
131This function echoes `.' for each character that the user types.
132The user ends with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line.
133C-g quits; if `inhibit-quit' was non-nil around this function,
134then it returns nil if the user types C-g.
135
136Once the caller uses the password, it can erase the password
137by doing (clear-string STRING)."
138 (with-local-quit
139 (if confirm
140 (let (success)
141 (while (not success)
142 (let ((first (read-passwd prompt nil default))
143 (second (read-passwd "Confirm password: " nil default)))
144 (if (equal first second)
145 (progn
146 (and (arrayp second) (clear-string second))
147 (setq success first))
148 (and (arrayp first) (clear-string first))
149 (and (arrayp second) (clear-string second))
150 (message "Password not repeated accurately; please start over")
151 (sit-for 1))))
152 success)
153 (let ((pass nil)
154 (c 0)
155 (echo-keystrokes 0)
156 (cursor-in-echo-area t))
157 (while (progn (message "%s%s"
158 prompt
159 (make-string (length pass) ?.))
160 (setq c (read-char-exclusive nil t))
161 (and (/= c ?\r) (/= c ?\n) (/= c ?\e)))
162 (clear-this-command-keys)
163 (if (= c ?\C-u)
164 (progn
165 (and (arrayp pass) (clear-string pass))
166 (setq pass ""))
167 (if (and (/= c ?\b) (/= c ?\177))
168 (let* ((new-char (char-to-string c))
169 (new-pass (concat pass new-char)))
170 (and (arrayp pass) (clear-string pass))
171 (clear-string new-char)
172 (setq c ?\0)
173 (setq pass new-pass))
174 (if (> (length pass) 0)
175 (let ((new-pass (substring pass 0 -1)))
176 (and (arrayp pass) (clear-string pass))
177 (setq pass new-pass))))))
178 (message nil)
179 (or pass default "")))))
180
125(provide 'password) 181(provide 'password)
126 182
127;;; arch-tag: ab160494-16c8-4c68-a4a1-73eebf6686e5 183;;; arch-tag: ab160494-16c8-4c68-a4a1-73eebf6686e5
diff --git a/lisp/net/tramp-vc.el b/lisp/net/tramp-vc.el
index e720deb8f07..3cc54eda650 100644
--- a/lisp/net/tramp-vc.el
+++ b/lisp/net/tramp-vc.el
@@ -217,6 +217,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
217;; Daniel Pittman <daniel@danann.net> 217;; Daniel Pittman <daniel@danann.net>
218;;-(if (fboundp 'vc-call-backend) 218;;-(if (fboundp 'vc-call-backend)
219;;- () ;; This is the new VC for which we don't have an appropriate advice yet 219;;- () ;; This is the new VC for which we don't have an appropriate advice yet
220(unless (fboundp 'process-file)
220(if (fboundp 'vc-call-backend) 221(if (fboundp 'vc-call-backend)
221 (defadvice vc-do-command 222 (defadvice vc-do-command
222 (around tramp-advice-vc-do-command 223 (around tramp-advice-vc-do-command
@@ -242,7 +243,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
242 (setq ad-return-value 243 (setq ad-return-value
243 (apply 'tramp-vc-do-command buffer okstatus command 244 (apply 'tramp-vc-do-command buffer okstatus command
244 (or file (buffer-file-name)) last flags)) 245 (or file (buffer-file-name)) last flags))
245 ad-do-it)))) 246 ad-do-it)))))
246;;-) 247;;-)
247 248
248 249
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 582ae8ee207..5a71a50c5db 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1770,6 +1770,7 @@ on the FILENAME argument, even if VISIT was a string.")
1770 (delete-file . tramp-handle-delete-file) 1770 (delete-file . tramp-handle-delete-file)
1771 (directory-file-name . tramp-handle-directory-file-name) 1771 (directory-file-name . tramp-handle-directory-file-name)
1772 (shell-command . tramp-handle-shell-command) 1772 (shell-command . tramp-handle-shell-command)
1773 (process-file . tramp-handle-process-file)
1773 (insert-directory . tramp-handle-insert-directory) 1774 (insert-directory . tramp-handle-insert-directory)
1774 (expand-file-name . tramp-handle-expand-file-name) 1775 (expand-file-name . tramp-handle-expand-file-name)
1775 (file-local-copy . tramp-handle-file-local-copy) 1776 (file-local-copy . tramp-handle-file-local-copy)
@@ -3469,6 +3470,18 @@ This will break if COMMAND prints a newline, followed by the value of
3469 (tramp-run-real-handler 'shell-command 3470 (tramp-run-real-handler 'shell-command
3470 (list command output-buffer error-buffer)))) 3471 (list command output-buffer error-buffer))))
3471 3472
3473(defun tramp-handle-process-file (program &optional infile buffer display &rest args)
3474 "Like `process-file' for Tramp files."
3475 (when infile (error "Implementation does not handle input from file"))
3476 (when (and (numberp buffer) (zerop buffer))
3477 (error "Implementation does not handle immediate return"))
3478 (when (consp buffer) (error "Implementation does not handle error files"))
3479 (shell-command
3480 (mapconcat 'tramp-shell-quote-argument
3481 (cons program args)
3482 " ")
3483 buffer))
3484
3472;; File Editing. 3485;; File Editing.
3473 3486
3474(defsubst tramp-make-temp-file () 3487(defsubst tramp-make-temp-file ()
@@ -3960,6 +3973,8 @@ ARGS are the arguments OPERATION has been called with."
3960 ; COMMAND 3973 ; COMMAND
3961 ((member operation 3974 ((member operation
3962 (list 'dired-call-process 'shell-command 3975 (list 'dired-call-process 'shell-command
3976 ; Post Emacs 21.3 only
3977 'process-file
3963 ; XEmacs only 3978 ; XEmacs only
3964 'dired-print-file 'dired-shell-call-process)) 3979 'dired-print-file 'dired-shell-call-process))
3965 default-directory) 3980 default-directory)
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 1260867f7c6..5dff6d954f8 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -347,12 +347,12 @@ modified to be an empty string, or the desired separation string."
347;;; User Functions: 347;;; User Functions:
348 348
349;;;###autoload 349;;;###autoload
350(defun pcomplete () 350(defun pcomplete (&optional interactively)
351 "Support extensible programmable completion. 351 "Support extensible programmable completion.
352To use this function, just bind the TAB key to it, or add it to your 352To use this function, just bind the TAB key to it, or add it to your
353completion functions list (it should occur fairly early in the list)." 353completion functions list (it should occur fairly early in the list)."
354 (interactive) 354 (interactive "p")
355 (if (and (interactive-p) 355 (if (and interactively
356 pcomplete-cycle-completions 356 pcomplete-cycle-completions
357 pcomplete-current-completions 357 pcomplete-current-completions
358 (memq last-command '(pcomplete 358 (memq last-command '(pcomplete
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index 76d12aa6f6e..17cb7c78316 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -90,7 +90,9 @@
90 2 font-lock-keyword-face) 90 2 font-lock-keyword-face)
91 ;; directive started from ".". 91 ;; directive started from ".".
92 ("^\\(\\.\\(\\sw\\|\\s_\\)+\\)\\>[^:]?" 92 ("^\\(\\.\\(\\sw\\|\\s_\\)+\\)\\>[^:]?"
93 1 font-lock-keyword-face)) 93 1 font-lock-keyword-face)
94 ;; %register
95 ("%\\sw+" . font-lock-variable-name-face))
94 "Additional expressions to highlight in Assembler mode.") 96 "Additional expressions to highlight in Assembler mode.")
95 97
96;;;###autoload 98;;;###autoload
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 2cd62eeecee..3ccea967bc5 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -94,7 +94,7 @@
94(defun flymake-split-string(str pattern) 94(defun flymake-split-string(str pattern)
95 (cond 95 (cond
96 ((equal flymake-emacs 'xemacs) (flymake-split-string-remove-empty-edges str pattern)) 96 ((equal flymake-emacs 'xemacs) (flymake-split-string-remove-empty-edges str pattern))
97 (t (split-string str pattern)) 97 (t (flymake-split-string-remove-empty-edges str pattern))
98 ) 98 )
99) 99)
100 100
@@ -1243,7 +1243,8 @@ Whenether a buffer for master-file-name exists, use it as a source instead of re
1243 (" *\\(\\[javac\\]\\)? *\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[ \t\n]*\\(.+\\)" 1243 (" *\\(\\[javac\\]\\)? *\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[ \t\n]*\\(.+\\)"
1244 2 4 nil 5) 1244 2 4 nil 5)
1245 ) 1245 )
1246 compilation-error-regexp-alist) 1246 ;; compilation-error-regexp-alist)
1247 (mapcar (lambda (x) (cdr x)) compilation-error-regexp-alist-alist))
1247 "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)" 1248 "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)"
1248) 1249)
1249;(defcustom flymake-err-line-patterns 1250;(defcustom flymake-err-line-patterns
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index d8f2cf34867..64f8808c7f1 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -177,7 +177,7 @@ detailed description of this mode.
177 177
178 (setq comint-input-sender 'gdb-send) 178 (setq comint-input-sender 'gdb-send)
179 ;; 179 ;;
180 ;; (re-)initialise 180 ;; (re-)initialize
181 (setq gdb-current-address "main") 181 (setq gdb-current-address "main")
182 (setq gdb-previous-address nil) 182 (setq gdb-previous-address nil)
183 (setq gdb-previous-frame nil) 183 (setq gdb-previous-frame nil)
@@ -482,14 +482,14 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'."
482 (name (funcall (gdb-rules-name-maker rules))) 482 (name (funcall (gdb-rules-name-maker rules)))
483 (new (get-buffer-create name))) 483 (new (get-buffer-create name)))
484 (with-current-buffer new 484 (with-current-buffer new
485 ;; FIXME: This should be set after calling the function, since the 485 (let ((trigger))
486 ;; function should run kill-all-local-variables. 486 (if (cdr (cdr rules))
487 (set (make-local-variable 'gdb-buffer-type) key) 487 (setq trigger (funcall (car (cdr (cdr rules))))))
488 (if (cdr (cdr rules)) 488 (set (make-local-variable 'gdb-buffer-type) key)
489 (funcall (car (cdr (cdr rules))))) 489 (set (make-local-variable 'gud-minor-mode)
490 (set (make-local-variable 'gud-minor-mode) 490 (with-current-buffer gud-comint-buffer gud-minor-mode))
491 (with-current-buffer gud-comint-buffer gud-minor-mode)) 491 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
492 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) 492 (if trigger (funcall trigger)))
493 new)))) 493 new))))
494 494
495(defun gdb-rules-name-maker (rules) (car (cdr rules))) 495(defun gdb-rules-name-maker (rules) (car (cdr rules)))
@@ -1190,13 +1190,15 @@ static char *magick[] = {
1190 "Major mode for gdb breakpoints. 1190 "Major mode for gdb breakpoints.
1191 1191
1192\\{gdb-breakpoints-mode-map}" 1192\\{gdb-breakpoints-mode-map}"
1193 (kill-all-local-variables)
1193 (setq major-mode 'gdb-breakpoints-mode) 1194 (setq major-mode 'gdb-breakpoints-mode)
1194 (setq mode-name "Breakpoints") 1195 (setq mode-name "Breakpoints")
1195 (use-local-map gdb-breakpoints-mode-map) 1196 (use-local-map gdb-breakpoints-mode-map)
1196 (setq buffer-read-only t) 1197 (setq buffer-read-only t)
1198 (run-mode-hooks 'gdb-breakpoints-mode-hook)
1197 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) 1199 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
1198 (gdb-invalidate-breakpoints) 1200 'gdb-invalidate-breakpoints
1199 (gdbmi-invalidate-breakpoints))) 1201 'gdbmi-invalidate-breakpoints))
1200 1202
1201(defun gdb-toggle-breakpoint () 1203(defun gdb-toggle-breakpoint ()
1202 "Enable/disable the breakpoint at current line." 1204 "Enable/disable the breakpoint at current line."
@@ -1317,14 +1319,16 @@ static char *magick[] = {
1317 "Major mode for gdb frames. 1319 "Major mode for gdb frames.
1318 1320
1319\\{gdb-frames-mode-map}" 1321\\{gdb-frames-mode-map}"
1322 (kill-all-local-variables)
1320 (setq major-mode 'gdb-frames-mode) 1323 (setq major-mode 'gdb-frames-mode)
1321 (setq mode-name "Frames") 1324 (setq mode-name "Frames")
1322 (setq buffer-read-only t) 1325 (setq buffer-read-only t)
1323 (use-local-map gdb-frames-mode-map) 1326 (use-local-map gdb-frames-mode-map)
1324 (font-lock-mode -1) 1327 (font-lock-mode -1)
1328 (run-mode-hooks 'gdb-frames-mode-hook)
1325 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) 1329 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
1326 (gdb-invalidate-frames) 1330 'gdb-invalidate-frames
1327 (gdbmi-invalidate-frames))) 1331 'gdbmi-invalidate-frames))
1328 1332
1329(defun gdb-get-frame-number () 1333(defun gdb-get-frame-number ()
1330 (save-excursion 1334 (save-excursion
@@ -1396,11 +1400,13 @@ static char *magick[] = {
1396 "Major mode for gdb frames. 1400 "Major mode for gdb frames.
1397 1401
1398\\{gdb-threads-mode-map}" 1402\\{gdb-threads-mode-map}"
1403 (kill-all-local-variables)
1399 (setq major-mode 'gdb-threads-mode) 1404 (setq major-mode 'gdb-threads-mode)
1400 (setq mode-name "Threads") 1405 (setq mode-name "Threads")
1401 (setq buffer-read-only t) 1406 (setq buffer-read-only t)
1402 (use-local-map gdb-threads-mode-map) 1407 (use-local-map gdb-threads-mode-map)
1403 (gdb-invalidate-threads)) 1408 (run-mode-hooks 'gdb-threads-mode-hook)
1409 'gdb-invalidate-threads)
1404 1410
1405(defun gdb-get-thread-number () 1411(defun gdb-get-thread-number ()
1406 (save-excursion 1412 (save-excursion
@@ -1444,11 +1450,13 @@ static char *magick[] = {
1444 "Major mode for gdb registers. 1450 "Major mode for gdb registers.
1445 1451
1446\\{gdb-registers-mode-map}" 1452\\{gdb-registers-mode-map}"
1453 (kill-all-local-variables)
1447 (setq major-mode 'gdb-registers-mode) 1454 (setq major-mode 'gdb-registers-mode)
1448 (setq mode-name "Registers") 1455 (setq mode-name "Registers")
1449 (setq buffer-read-only t) 1456 (setq buffer-read-only t)
1450 (use-local-map gdb-registers-mode-map) 1457 (use-local-map gdb-registers-mode-map)
1451 (gdb-invalidate-registers)) 1458 (run-mode-hooks 'gdb-registers-mode-hook)
1459 'gdb-invalidate-registers)
1452 1460
1453(defun gdb-registers-buffer-name () 1461(defun gdb-registers-buffer-name ()
1454 (with-current-buffer gud-comint-buffer 1462 (with-current-buffer gud-comint-buffer
@@ -1518,13 +1526,15 @@ static char *magick[] = {
1518 "Major mode for gdb locals. 1526 "Major mode for gdb locals.
1519 1527
1520\\{gdb-locals-mode-map}" 1528\\{gdb-locals-mode-map}"
1529 (kill-all-local-variables)
1521 (setq major-mode 'gdb-locals-mode) 1530 (setq major-mode 'gdb-locals-mode)
1522 (setq mode-name (concat "Locals:" gdb-current-frame)) 1531 (setq mode-name (concat "Locals:" gdb-current-frame))
1523 (setq buffer-read-only t) 1532 (setq buffer-read-only t)
1524 (use-local-map gdb-locals-mode-map) 1533 (use-local-map gdb-locals-mode-map)
1534 (run-mode-hooks 'gdb-locals-mode-hook)
1525 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) 1535 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
1526 (gdb-invalidate-locals) 1536 'gdb-invalidate-locals
1527 (gdbmi-invalidate-locals))) 1537 'gdbmi-invalidate-locals))
1528 1538
1529(defun gdb-locals-buffer-name () 1539(defun gdb-locals-buffer-name ()
1530 (with-current-buffer gud-comint-buffer 1540 (with-current-buffer gud-comint-buffer
@@ -1939,10 +1949,26 @@ BUFFER nil or omitted means use the current buffer."
1939 (suppress-keymap map) 1949 (suppress-keymap map)
1940 map)) 1950 map))
1941 1951
1952(defvar gdb-assembler-font-lock-keywords
1953 '(;; <__function.name+n>
1954 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>"
1955 (1 font-lock-function-name-face))
1956 ;; 0xNNNNNNNN <__function.name+n>: opcode
1957 ("^0x[0-9a-f]+ \\(<\\(\\(\\sw\\|[_.]\\)+\\)\\+[0-9]+>\\)?:[ \t]+\\(\\sw+\\)"
1958 (4 font-lock-keyword-face))
1959 ;; %register(at least i386)
1960 ("%\\sw+" . font-lock-variable-name-face)
1961 ("^\\(Dump of assembler code for function\\) \\(.+\\):"
1962 (1 font-lock-comment-face)
1963 (2 font-lock-function-name-face))
1964 ("^\\(End of assembler dump\\.\\)" . font-lock-comment-face))
1965 "Font lock keywords used in `gdb-assembler-mode'.")
1966
1942(defun gdb-assembler-mode () 1967(defun gdb-assembler-mode ()
1943 "Major mode for viewing code assembler. 1968 "Major mode for viewing code assembler.
1944 1969
1945\\{gdb-assembler-mode-map}" 1970\\{gdb-assembler-mode-map}"
1971 (kill-all-local-variables)
1946 (setq major-mode 'gdb-assembler-mode) 1972 (setq major-mode 'gdb-assembler-mode)
1947 (setq mode-name "Machine") 1973 (setq mode-name "Machine")
1948 (setq gdb-overlay-arrow-position nil) 1974 (setq gdb-overlay-arrow-position nil)
@@ -1951,7 +1977,11 @@ BUFFER nil or omitted means use the current buffer."
1951 (setq fringes-outside-margins t) 1977 (setq fringes-outside-margins t)
1952 (setq buffer-read-only t) 1978 (setq buffer-read-only t)
1953 (use-local-map gdb-assembler-mode-map) 1979 (use-local-map gdb-assembler-mode-map)
1954 (gdb-invalidate-assembler)) 1980 (gdb-invalidate-assembler)
1981 (set (make-local-variable 'font-lock-defaults)
1982 '(gdb-assembler-font-lock-keywords))
1983 (run-mode-hooks 'gdb-assembler-mode-hook)
1984 'gdb-invalidate-assembler)
1955 1985
1956(defun gdb-assembler-buffer-name () 1986(defun gdb-assembler-buffer-name ()
1957 (with-current-buffer gud-comint-buffer 1987 (with-current-buffer gud-comint-buffer
diff --git a/lisp/simple.el b/lisp/simple.el
index 1e6e49012e1..6420ebffd54 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1879,6 +1879,39 @@ specifies the value of ERROR-BUFFER."
1879 (with-current-buffer 1879 (with-current-buffer
1880 standard-output 1880 standard-output
1881 (call-process shell-file-name nil t nil shell-command-switch command)))) 1881 (call-process shell-file-name nil t nil shell-command-switch command))))
1882
1883(defun process-file (program &optional infile buffer display &rest args)
1884 "Process files synchronously in a separate process.
1885Similar to `call-process', but may invoke a file handler based on
1886`default-directory'. The current working directory of the
1887subprocess is `default-directory'.
1888
1889File names in INFILE and BUFFER are handled normally, but file
1890names in ARGS should be relative to `default-directory', as they
1891are passed to the process verbatim. \(This is a difference to
1892`call-process' which does not support file handlers for INFILE
1893and BUFFER.\)
1894
1895Some file handlers might not support all variants, for example
1896they might behave as if DISPLAY was nil, regardless of the actual
1897value passed."
1898 (let ((fh (find-file-name-handler default-directory 'process-file))
1899 lc stderr-file)
1900 (unwind-protect
1901 (if fh (apply fh 'process-file program infile buffer display args)
1902 (when infile (setq lc (file-local-copy infile)))
1903 (setq stderr-file (when (and (consp buffer) (stringp (cadr buffer)))
1904 (make-temp-file "emacs")))
1905 (prog1
1906 (apply 'call-process program
1907 (or lc infile)
1908 (if stderr-file (list (car buffer) stderr-file) buffer)
1909 display args)
1910 (when stderr-file (copy-file stderr-file (cadr buffer)))))
1911 (when stderr-file (delete-file stderr-file))
1912 (when lc (delete-file lc)))))
1913
1914
1882 1915
1883(defvar universal-argument-map 1916(defvar universal-argument-map
1884 (let ((map (make-sparse-keymap))) 1917 (let ((map (make-sparse-keymap)))
diff --git a/lisp/subr.el b/lisp/subr.el
index 5e162ef5c83..7d666f4c157 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1211,61 +1211,6 @@ any other non-digit terminates the character code and is then used as input."))
1211 (setq first nil)) 1211 (setq first nil))
1212 code)) 1212 code))
1213 1213
1214(defun read-passwd (prompt &optional confirm default)
1215 "Read a password, prompting with PROMPT, and return it.
1216If optional CONFIRM is non-nil, read the password twice to make sure.
1217Optional DEFAULT is a default password to use instead of empty input.
1218
1219This function echoes `.' for each character that the user types.
1220The user ends with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line.
1221C-g quits; if `inhibit-quit' was non-nil around this function,
1222then it returns nil if the user types C-g.
1223
1224Once the caller uses the password, it can erase the password
1225by doing (clear-string STRING)."
1226 (with-local-quit
1227 (if confirm
1228 (let (success)
1229 (while (not success)
1230 (let ((first (read-passwd prompt nil default))
1231 (second (read-passwd "Confirm password: " nil default)))
1232 (if (equal first second)
1233 (progn
1234 (and (arrayp second) (clear-string second))
1235 (setq success first))
1236 (and (arrayp first) (clear-string first))
1237 (and (arrayp second) (clear-string second))
1238 (message "Password not repeated accurately; please start over")
1239 (sit-for 1))))
1240 success)
1241 (let ((pass nil)
1242 (c 0)
1243 (echo-keystrokes 0)
1244 (cursor-in-echo-area t))
1245 (while (progn (message "%s%s"
1246 prompt
1247 (make-string (length pass) ?.))
1248 (setq c (read-char-exclusive nil t))
1249 (and (/= c ?\r) (/= c ?\n) (/= c ?\e)))
1250 (clear-this-command-keys)
1251 (if (= c ?\C-u)
1252 (progn
1253 (and (arrayp pass) (clear-string pass))
1254 (setq pass ""))
1255 (if (and (/= c ?\b) (/= c ?\177))
1256 (let* ((new-char (char-to-string c))
1257 (new-pass (concat pass new-char)))
1258 (and (arrayp pass) (clear-string pass))
1259 (clear-string new-char)
1260 (setq c ?\0)
1261 (setq pass new-pass))
1262 (if (> (length pass) 0)
1263 (let ((new-pass (substring pass 0 -1)))
1264 (and (arrayp pass) (clear-string pass))
1265 (setq pass new-pass))))))
1266 (message nil)
1267 (or pass default "")))))
1268
1269;; This should be used by `call-interactively' for `n' specs. 1214;; This should be used by `call-interactively' for `n' specs.
1270(defun read-number (prompt &optional default) 1215(defun read-number (prompt &optional default)
1271 (let ((n nil)) 1216 (let ((n nil))
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 584056bf30b..28f3d7c3b27 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -451,10 +451,22 @@ Do \\[describe-key] on the following bindings to discover what they do.
451 ;; recognized. 451 ;; recognized.
452 (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*") 452 (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*")
453 (set (make-local-variable 'comment-end-skip) "[ \t]*--\\([ \t\n]*>\\)?") 453 (set (make-local-variable 'comment-end-skip) "[ \t]*--\\([ \t\n]*>\\)?")
454 ;; This definition probably is not useful in derived modes. 454 ;; This definition has an HTML leaning but probably fits well for other modes.
455 (set (make-local-variable 'imenu-generic-expression) 455 (setq imenu-generic-expression
456 (concat "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\(" 456 `((nil
457 sgml-name-re "\\)"))) 457 ,(concat "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\("
458 sgml-name-re "\\)")
459 2)
460 ("Id"
461 ,(concat "<[^>]+[ \t\n]+[Ii][Dd]=\\(['\"]"
462 (if sgml-xml-mode "" "?")
463 "\\)\\(" sgml-name-re "\\)\\1")
464 2)
465 ("Name"
466 ,(concat "<[^>]+[ \t\n]+[Nn][Aa][Mm][Ee]=\\(['\"]"
467 (if sgml-xml-mode "" "?")
468 "\\)\\(" sgml-name-re "\\)\\1")
469 2))))
458 470
459;; Some programs (such as Glade 2) generate XML which has 471;; Some programs (such as Glade 2) generate XML which has
460;; -*- mode: xml -*-. 472;; -*- mode: xml -*-.
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index a7ca14d1294..06ae4db1d8a 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -468,6 +468,10 @@ An alternative value is \" . \", if you use a font with a narrow period."
468 ;; (arg "\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)")) 468 ;; (arg "\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)"))
469 (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")) 469 (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)"))
470 (list 470 (list
471 ;; font-lock-syntactic-keywords causes the \ of \end{verbatim} to be
472 ;; highlighted as tex-verbatim-face. Let's undo that.
473 ;; This is ugly and brittle :-( --Stef
474 '("^\\(\\\\\\)end" (1 (get-text-property (match-end 1) 'face) t))
471 ;; display $$ math $$ 475 ;; display $$ math $$
472 ;; We only mark the match between $$ and $$ because the $$ delimiters 476 ;; We only mark the match between $$ and $$ because the $$ delimiters
473 ;; themselves have already been marked (along with $..$) by syntactic 477 ;; themselves have already been marked (along with $..$) by syntactic
@@ -619,6 +623,8 @@ An alternative value is \" . \", if you use a font with a narrow period."
619 ;; 2 - font-lock considers the preceding \n as being part of the 623 ;; 2 - font-lock considers the preceding \n as being part of the
620 ;; preceding line, so things gets screwed every time the previous 624 ;; preceding line, so things gets screwed every time the previous
621 ;; line is re-font-locked on its own. 625 ;; line is re-font-locked on its own.
626 ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim
627 ;; face from the \ but C-M-f still jumps to the wrong spot :-( --Stef
622 (,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<")) 628 (,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<"))
623 ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b") 629 ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b")
624 ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b") 630 ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b")
diff --git a/lisp/vc.el b/lisp/vc.el
index a0d3d1cd4be..15d0258e85d 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -953,7 +953,7 @@ that is inserted into the command line before the filename."
953 (vc-exec-after 953 (vc-exec-after
954 `(unless (active-minibuffer-window) 954 `(unless (active-minibuffer-window)
955 (message "Running %s in the background... done" ',command)))) 955 (message "Running %s in the background... done" ',command))))
956 (setq status (apply 'call-process command nil t nil squeezed)) 956 (setq status (apply 'process-file command nil t nil squeezed))
957 (when (or (not (integerp status)) (and okstatus (< okstatus status))) 957 (when (or (not (integerp status)) (and okstatus (< okstatus status)))
958 (pop-to-buffer (current-buffer)) 958 (pop-to-buffer (current-buffer))
959 (goto-char (point-min)) 959 (goto-char (point-min))
diff --git a/lisp/woman.el b/lisp/woman.el
index cea1c61bcc4..610590a2972 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1132,7 +1132,7 @@ Used non-interactively, arguments are optional: if given then TOPIC
1132should be a topic string and non-nil RE-CACHE forces re-caching." 1132should be a topic string and non-nil RE-CACHE forces re-caching."
1133 (interactive (list nil current-prefix-arg)) 1133 (interactive (list nil current-prefix-arg))
1134 ;; The following test is for non-interactive calls via gnudoit etc. 1134 ;; The following test is for non-interactive calls via gnudoit etc.
1135 (if (or (interactive-p) (not (stringp topic)) (string-match "\\S " topic)) 1135 (if (or (not (stringp topic)) (string-match "\\S " topic))
1136 (let ((file-name (woman-file-name topic re-cache))) 1136 (let ((file-name (woman-file-name topic re-cache)))
1137 (if file-name 1137 (if file-name
1138 (woman-find-file file-name) 1138 (woman-find-file file-name)
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 6c9d83edb17..dc8f1771263 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,30 @@
12004-10-26 Kim F. Storm <storm@cua.dk>
2
3 * commands.texi (Interactive Codes): Add U code letter.
4
52004-10-25 Simon Josefsson <jas@extundo.com>
6
7 * minibuf.texi (Reading a Password): Add.
8
92004-10-24 Jason Rumney <jasonr@gnu.org>
10
11 * commands.texi (Misc Events): Remove mouse-wheel. Add wheel-up
12 and wheel-down.
13
142004-10-24 Kai Grossjohann <kai.grossjohann@gmx.net>
15
16 * processes.texi (Synchronous Processes): Document process-file.
17
182004-10-22 Kenichi Handa <handa@m17n.org>
19
20 * text.texi (translate-region): Document that it accepts also a
21 char-table.
22
232004-10-22 David Ponce <david@dponce.com>
24
25 * windows.texi (Resizing Windows): Document the `preserve-before'
26 argument of the functions `enlarge-window' and `shrink-window'.
27
12004-10-19 Jason Rumney <jasonr@gnu.org> 282004-10-19 Jason Rumney <jasonr@gnu.org>
2 29
3 * makefile.w32-in (elisp): Change order of arguments to makeinfo. 30 * makefile.w32-in (elisp): Change order of arguments to makeinfo.
diff --git a/lispref/commands.texi b/lispref/commands.texi
index 5f0a73b2153..cb772ff6eb5 100644
--- a/lispref/commands.texi
+++ b/lispref/commands.texi
@@ -360,6 +360,9 @@ until a command (or undefined command) is found in the current key
360maps. The key sequence argument is represented as a string or vector. 360maps. The key sequence argument is represented as a string or vector.
361The cursor does not move into the echo area. Prompt. 361The cursor does not move into the echo area. Prompt.
362 362
363If the key sequence is a down-event, the following up-event is discarded,
364but can be read via the @code{U} code character.
365
363This kind of input is used by commands such as @code{describe-key} and 366This kind of input is used by commands such as @code{describe-key} and
364@code{global-set-key}. 367@code{global-set-key}.
365 368
@@ -416,6 +419,11 @@ character terminates the input. (Use @kbd{C-q} to include whitespace in
416the string.) Other characters that normally terminate a symbol (e.g., 419the string.) Other characters that normally terminate a symbol (e.g.,
417parentheses and brackets) do not do so here. Prompt. 420parentheses and brackets) do not do so here. Prompt.
418 421
422@item U
423A key sequence or nil. May be used after a @code{k} or @code{K}
424argument to get the up-event that was discarded in case the key
425sequence read for that argument was a down-event. No I/O.
426
419@item v 427@item v
420A variable declared to be a user option (i.e., satisfying the 428A variable declared to be a user option (i.e., satisfying the
421predicate @code{user-variable-p}). This reads the variable using 429predicate @code{user-variable-p}). This reads the variable using
@@ -1501,21 +1509,20 @@ This kind of event indicates that the user deiconified @var{frame} using
1501the window manager. Its standard definition is @code{ignore}; since the 1509the window manager. Its standard definition is @code{ignore}; since the
1502frame has already been made visible, Emacs has no work to do. 1510frame has already been made visible, Emacs has no work to do.
1503 1511
1504@cindex @code{mouse-wheel} event 1512@cindex @code{wheel-up} event
1505@item (mouse-wheel @var{position} @var{delta}) 1513@cindex @code{wheel-down} event
1506This kind of event is generated by moving a wheel on a mouse (such as 1514@item (wheel-up @var{position})
1507the MS Intellimouse). Its effect is typically a kind of scroll or zoom. 1515@item (wheel-down @var{position})
1508 1516This kind of event is generated by moving a wheel on a mouse. Its
1509The element @var{delta} describes the amount and direction of the wheel 1517effect is typically a kind of scroll or zoom.
1510rotation. Its absolute value is the number of increments by which the
1511wheel was rotated. A negative @var{delta} indicates that the wheel was
1512rotated backwards, towards the user, and a positive @var{delta}
1513indicates that the wheel was rotated forward, away from the user.
1514 1518
1515The element @var{position} is a list describing the position of the 1519The element @var{position} is a list describing the position of the
1516event, in the same format as used in a mouse-click event. 1520event, in the same format as used in a mouse-click event.
1517 1521
1518This kind of event is generated only on some kinds of systems. 1522This kind of event is generated only on some kinds of systems. On
1523other systems, mouse-4 and mouse-5 may be used instead. For portable
1524code, the variables @code{mouse-wheel-up-event} and
1525@code{mouse-wheel-down-event} defined in @file{mwheel.el} can be used.
1519 1526
1520@cindex @code{drag-n-drop} event 1527@cindex @code{drag-n-drop} event
1521@item (drag-n-drop @var{position} @var{files}) 1528@item (drag-n-drop @var{position} @var{files})
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi
index 1b076c5837d..08e156b327e 100644
--- a/lispref/minibuf.texi
+++ b/lispref/minibuf.texi
@@ -1660,6 +1660,32 @@ The return value of @code{map-y-or-n-p} is the number of objects acted on.
1660 To read a password to pass to another program, you can use the 1660 To read a password to pass to another program, you can use the
1661function @code{read-passwd}. 1661function @code{read-passwd}.
1662 1662
1663@cindex password cache
1664 Passwords are sometimes needed several times throughout an Emacs
1665session. Then it can be useful to avoid having to ask for a password
1666more than once. Passwords are entered into the password cache using
1667the function @code{password-cache-add}. To read a password, possibly
1668retrieving the password from the cache without querying the user, you
1669can use the function @code{password-read}. The two calls can be
1670combined into the function @code{password-read-and-add} that read a
1671password and store it in the cache.
1672
1673 Typically users do not use the same password for all services. The
1674password cache mechanism use a @samp{key} string to differentiate
1675among the passwords. The @samp{key} string is typically a fixed
1676string chosen to be related to what the password is used for. For
1677example, a password used when connecting to a @acronym{IMAP} mail
1678server called @samp{mail.example.org}, could use a @samp{key} string
1679of @samp{imap:mail.example.org}. You can use any string, as long as
1680it is reasonably unique.
1681
1682@cindex password expiry
1683Passwords in the cache typically expire after a while (controlled by
1684the variable @code{password-cache-expiry}), but you can force removal
1685of a password using the function @code{password-cache-remove}. This
1686is useful when there is a problem with the password, to avoid using
1687the same incorrect password from the cache in the future.
1688
1663@defun read-passwd prompt &optional confirm default 1689@defun read-passwd prompt &optional confirm default
1664This function reads a password, prompting with @var{prompt}. It does 1690This function reads a password, prompting with @var{prompt}. It does
1665not echo the password as the user types it; instead, it echoes @samp{.} 1691not echo the password as the user types it; instead, it echoes @samp{.}
@@ -1675,6 +1701,41 @@ return if the user enters empty input. If @var{default} is @code{nil},
1675then @code{read-passwd} returns the null string in that case. 1701then @code{read-passwd} returns the null string in that case.
1676@end defun 1702@end defun
1677 1703
1704@defun password-read prompt key
1705Read a password from the user, using @code{read-passwd}, prompting
1706with @var{prompt}. If a password has been stored in the password
1707cache, using @code{password-cache-add} on the same @var{key}, it is
1708returned directly, without querying the user.
1709@end defun
1710
1711@defun password-cache-add key password
1712Add a password to the password cache, indexed under the given
1713@var{key}. The password is later retrieved using @code{password-read}
1714called with the same @var{key}.
1715@end defun
1716
1717@defun password-cache-remove key
1718Remove a password from the cache, indexed under the given @var{key}.
1719@end defun
1720
1721@defun password-read-and-add prompt &optional key
1722Read a password, prompting with @var{prompt}, and possibly add it to
1723the cache, indexed using the @var{key} string. This is one-call
1724interface to @code{password-read} and @code{password-cache-add}.
1725@end defun
1726
1727@defvar password-cache-expiry
1728This variable specify for how many seconds passwords are retained in
1729the password cache before they are expired. For high security, use a
1730low value (below a minute). For more lax security, use a setting of
1731@samp{14400} corresponding to half a work day (4 hours).
1732@end defvar
1733
1734@defvar password-cache
1735This variable toggle whether or not the password cache is used at all.
1736The default is non-@code{nil}, i.e., to use the cache.
1737@end defvar
1738
1678@node Minibuffer Misc 1739@node Minibuffer Misc
1679@section Minibuffer Miscellany 1740@section Minibuffer Miscellany
1680 1741
diff --git a/lispref/processes.texi b/lispref/processes.texi
index ccf8f76d87e..35041677b80 100644
--- a/lispref/processes.texi
+++ b/lispref/processes.texi
@@ -317,6 +317,47 @@ be found in the definition of @code{insert-directory}:
317@end smallexample 317@end smallexample
318@end defun 318@end defun
319 319
320@defun process-file program &optional infile buffer display &rest args
321This function processes files synchronously in a separate process. It
322is similar to @code{call-process} but may invoke a file handler based
323on the value of the variable @code{default-directory}. The current
324working directory of the subprocess is @code{default-directory}.
325
326The arguments are handled in almost the same way as for
327@code{call-process}, with the following differences:
328
329Some file handlers may not support all combinations and forms of the
330arguments @var{infile}, @var{buffer}, and @var{display}. For example,
331some file handlers might behave as if @var{display} was nil,
332regardless of the value actually passed. As another example, some
333file handlers might not support separating standard output and error
334output by way of the @var{buffer} argument.
335
336If a file handler is invoked, it determines the program to run based
337on the first argument @var{program}. For instance, consider that a
338handler for remote files is invoked. Then the path that is used for
339searching the program might be different than @code{exec-path}.
340
341The second argument @var{infile} may invoke a file handler. The file
342handler could be different from the handler chosen for the
343@code{process-file} function itself. (For example,
344@code{default-directory} could be on a remote host, whereas
345@var{infile} is on another remote host. Or @code{default-directory}
346could be non-special, whereas @var{infile} is on a remote host.)
347
348If @var{buffer} has the form @code{(@var{real-destination}
349@var{error-destination})}, and @var{error-destination} names a file,
350then the same remarks as for @var{infile} apply.
351
352The remaining arguments (@var{args}) will be passed to the process
353verbatim. Emacs is not involved in processing file names that are
354present in @var{args}. To avoid confusion, it may be best to avoid
355absolute file names in @var{args}, but rather to specify all file
356names as relative to @code{default-directory}. The function
357@code{file-relative-name} is useful for constructing such relative
358file names.
359@end defun
360
320@defun call-process-region start end program &optional delete destination display &rest args 361@defun call-process-region start end program &optional delete destination display &rest args
321This function sends the text from @var{start} to @var{end} as 362This function sends the text from @var{start} to @var{end} as
322standard input to a process running @var{program}. It deletes the text 363standard input to a process running @var{program}. It deletes the text
diff --git a/lispref/text.texi b/lispref/text.texi
index 00aa235f513..1f61c1cf22c 100644
--- a/lispref/text.texi
+++ b/lispref/text.texi
@@ -3620,9 +3620,9 @@ ThXs Xs the contents of the buffer before.
3620This function applies a translation table to the characters in the 3620This function applies a translation table to the characters in the
3621buffer between positions @var{start} and @var{end}. 3621buffer between positions @var{start} and @var{end}.
3622 3622
3623The translation table @var{table} is a string; @code{(aref @var{table} 3623The translation table @var{table} is a string or a char-table;
3624@var{ochar})} gives the translated character corresponding to 3624@code{(aref @var{table} @var{ochar})} gives the translated character
3625@var{ochar}. If the length of @var{table} is less than 256, any 3625corresponding to @var{ochar}. If @var{table} is a string, any
3626characters with codes larger than the length of @var{table} are not 3626characters with codes larger than the length of @var{table} are not
3627altered by the translation. 3627altered by the translation.
3628 3628
diff --git a/lispref/windows.texi b/lispref/windows.texi
index 0fdc6734181..0bf3a9ed211 100644
--- a/lispref/windows.texi
+++ b/lispref/windows.texi
@@ -1922,7 +1922,7 @@ that change the size of windows and low-level functions that access
1922window size. Emacs does not permit overlapping windows or gaps between 1922window size. Emacs does not permit overlapping windows or gaps between
1923windows, so resizing one window affects other windows. 1923windows, so resizing one window affects other windows.
1924 1924
1925@deffn Command enlarge-window size &optional horizontal 1925@deffn Command enlarge-window size &optional horizontal preserve-before
1926This function makes the selected window @var{size} lines taller, 1926This function makes the selected window @var{size} lines taller,
1927stealing lines from neighboring windows. It takes the lines from one 1927stealing lines from neighboring windows. It takes the lines from one
1928window at a time until that window is used up, then takes from another. 1928window at a time until that window is used up, then takes from another.
@@ -1945,6 +1945,11 @@ other windows are ``robbed.'' If it would be necessary to alter the
1945size of a fixed-size window, @code{enlarge-window} gets an error 1945size of a fixed-size window, @code{enlarge-window} gets an error
1946instead. 1946instead.
1947 1947
1948If @var{preserve-before} is non-@code{nil}, this function does not
1949change the size of the siblings above or to the left of the selected
1950window. Only the size of the siblings below or to the right of the
1951selected window are changed.
1952
1948If @var{size} is negative, this function shrinks the window by 1953If @var{size} is negative, this function shrinks the window by
1949@minus{}@var{size} lines or columns. If that makes the window smaller 1954@minus{}@var{size} lines or columns. If that makes the window smaller
1950than the minimum size (@code{window-min-height} and 1955than the minimum size (@code{window-min-height} and
@@ -1965,7 +1970,7 @@ It could be defined as follows:
1965@end example 1970@end example
1966@end deffn 1971@end deffn
1967 1972
1968@deffn Command shrink-window size &optional horizontal 1973@deffn Command shrink-window size &optional horizontal preserve-before
1969This function is like @code{enlarge-window} but negates the argument 1974This function is like @code{enlarge-window} but negates the argument
1970@var{size}, making the selected window smaller by giving lines (or 1975@var{size}, making the selected window smaller by giving lines (or
1971columns) to the other windows. If the window shrinks below 1976columns) to the other windows. If the window shrinks below
diff --git a/man/ChangeLog b/man/ChangeLog
index f70d49f9e29..d91fbf0267c 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,11 @@
12004-10-23 Eli Zaretskii <eliz@gnu.org>
2
3 * text.texi (Text Based Tables, Table Definition)
4 (Table Creation, Table Recognition, Cell Commands)
5 (Cell Justification, Row Commands, Column Commands)
6 (Fixed Width Mode, Table Conversion, Measuring Tables)
7 (Table Misc): New nodes, documenting the Table Mode.
8
12004-10-21 Jay Belanger <belanger@truman.edu> 92004-10-21 Jay Belanger <belanger@truman.edu>
2 * calc.texi (Algebraic-Style Calculations): Removed a comment. 10 * calc.texi (Algebraic-Style Calculations): Removed a comment.
3 11
diff --git a/man/text.texi b/man/text.texi
index 01405ae525b..5e97c7183ed 100644
--- a/man/text.texi
+++ b/man/text.texi
@@ -70,6 +70,7 @@ Then the formatting appears on the screen in Emacs while you edit.
70* HTML Mode:: Editing HTML, SGML, and XML files. 70* HTML Mode:: Editing HTML, SGML, and XML files.
71* Nroff Mode:: Editing input to the formatter nroff. 71* Nroff Mode:: Editing input to the formatter nroff.
72* Formatted Text:: Editing formatted text directly in WYSIWYG fashion. 72* Formatted Text:: Editing formatted text directly in WYSIWYG fashion.
73* Text Based Tables:: Editing text-based tables in WYSIWYG fashion.
73@end menu 74@end menu
74 75
75@node Words 76@node Words
@@ -2290,6 +2291,517 @@ uncompression (@pxref{Compressed Files}). To disable format conversion
2290but allow character code conversion and/or automatic uncompression if 2291but allow character code conversion and/or automatic uncompression if
2291appropriate, use @code{format-find-file} with suitable arguments. 2292appropriate, use @code{format-find-file} with suitable arguments.
2292 2293
2294@node Text Based Tables
2295@section Editing Text-based Tables
2296@cindex table mode
2297@cindex text-based tables
2298
2299 Table Mode provides an easy and intuitive way to create and edit WYSIWYG
2300text-based tables. Here is an example of such a table:
2301
2302@smallexample
2303+-----------------+--------------------------------+-----------------+
2304| Command | Description | Key Binding |
2305+-----------------+--------------------------------+-----------------+
2306| forward-char |Move point right N characters | C-f |
2307| |(left if N is negative). | |
2308| | | |
2309| |On reaching end of buffer, stop | |
2310| |and signal error. | |
2311+-----------------+--------------------------------+-----------------+
2312| backward-char |Move point left N characters | C-b |
2313| |(right if N is negative). | |
2314| | | |
2315| |On attempt to pass beginning or | |
2316| |end of buffer, stop and signal | |
2317| |error. | |
2318+-----------------+--------------------------------+-----------------+
2319@end smallexample
2320
2321 Table Mode allows the contents of the table such as this one to be
2322easily manipulated by inserting or deleting characters inside a cell.
2323A cell is effectively a localized rectangular edit region and edits to
2324a cell do not affect the contents of the surrounding cells. If the
2325contents do not fit into a cell, then the cell is automatically
2326expanded in the vertical and/or horizontal directions and the rest of
2327the table is restructured and reformatted in accordance with the
2328growth of the cell.
2329
2330@menu
2331* Table Definition:: What is a text based table.
2332* Table Creation:: How to create a table.
2333* Table Recognition:: How to activate and deactivate tables.
2334* Cell Commands:: Cell-oriented commands in a table.
2335* Cell Justification:: Justifying cell contents.
2336* Row Commands:: Manipulating rows of table cell.
2337* Column Commands:: Manipulating columns of table cell.
2338* Fixed Width Mode:: Fixing cell width.
2339* Table Conversion:: Converting between plain text and tables.
2340* Measuring Tables:: Analyzing table dimension.
2341* Table Misc:: Table miscellany.
2342@end menu
2343
2344@node Table Definition
2345@subsection What is a Text-based Table?
2346
2347 Look at the following examples of valid tables as a reference while
2348you read this section:
2349
2350@example
2351 +--+----+---+ +-+ +--+-----+
2352 | | | | | | | | |
2353 +--+----+---+ +-+ | +--+--+
2354 | | | | | | | |
2355 +--+----+---+ +--+--+ |
2356 | | |
2357 +-----+--+
2358@end example
2359
2360 A table consists of a rectangular frame and the contents inside the
2361frame. A table's cells must be at least one character wide and one
2362character high with two adjacent cells sharing a boarder line. A cell
2363can be subdivided into multiple rectangular cells but cannot nest or
2364overlap.
2365
2366 Both the table frame and cell border lines must consist of one of
2367three special characters. The variables that hold these characters
2368are described below:
2369
2370@table @code
2371@vindex table-cell-vertical-char
2372@item table-cell-vertical-char
2373Holds the character used for vertical lines. The default value is
2374@samp{|}.
2375
2376@vindex table-cell-horizontal-char
2377@item table-cell-horizontal-char
2378Holds the character used for horizontal lines. The default value is
2379@samp{-}.
2380
2381@vindex table-cell-intersection-char
2382@item table-cell-intersection-char
2383Holds the character used at where horizontal line and vertical line
2384meet. The default value is @samp{+}.
2385@end table
2386
2387@noindent
2388Based on this definition, the following five tables are examples of invalid
2389tables:
2390
2391@example
2392 +-----+ +-----+ +--+ +-++--+ ++
2393 | | | | | | | || | ++
2394 | +-+ | | | | | | || |
2395 | | | | +--+ | +--+--+ +-++--+
2396 | +-+ | | | | | | | +-++--+
2397 | | | | | | | | | || |
2398 +-----+ +--+--+ +--+--+ +-++--+
2399 a b c d e
2400@end example
2401
2402From left to right:
2403
2404@enumerate a
2405@item
2406Nested cells are not allowed.
2407@item
2408Overlapped cells or non-rectangular cells are not allowed.
2409@item
2410The border must be rectangular.
2411@item
2412Cells must have a minimum width/height of one character.
2413@item
2414Same as d.
2415@end enumerate
2416
2417@node Table Creation
2418@subsection How to Create a Table?
2419@cindex create a text-based table
2420@cindex table creation
2421
2422@findex table-insert
2423 The command to create a table is @code{table-insert}. When called
2424interactively, it asks for the number of columns, number of rows, cell
2425width and cell height. The number of columns is a number of cells
2426within the table's width. The number of rows is the number of cells
2427within the table's height. The cell width is a number of characters
2428that fit within a cell width. The cell height is a number of lines
2429within cell height. While the number of columns and number of rows
2430must be an integer number, the cell width and the cell height can be
2431either an integer number (when the value is constant across the table)
2432or a series of integer numbers, separated by spaces or commas, where
2433each number corresponds to each cell width within a row from left to
2434right or each cell height within a column from top to bottom.
2435
2436@node Table Recognition
2437@subsection Table Recognition
2438@cindex table recognition
2439
2440@findex table-recognize
2441@findex table-unrecognize
2442 Table Mode maintains special text properties in the buffer to allow
2443editing in a convenient fashion. When a buffer with tables is saved
2444to its file, these text properties are lost, so when you visit this
2445file again later, Emacs does not see a table, but just formatted text.
2446To resurrect the table text properties, issue the @kbd{M-x
2447table-recognize} command. It scans the current buffer, recognizes
2448valid table cells, and attaches appropriate text properties to allow
2449for table editing. The converse command, @code{table-unrecognize}, is
2450used to remove the special text properties and revert the buffer back
2451to plain text.
2452
2453 An optional numeric prefix argument can precede the
2454@code{table-recognize} command. If the argument is negative, tables
2455in the buffer become inactive. This is equivalent to invoking
2456@code{table-unrecognize}.
2457
2458 Similar functions exist to enable or disable tables within a region,
2459enable or disable individual tables, and enable/disable individual
2460cells. These commands are:
2461
2462@table @kbd
2463@findex table-recognize-region
2464@item M-x table-recognize-region
2465Recognize tables within the current region and activate them.
2466@findex table-unrecognize-region
2467@item M-x table-unrecognize-region
2468Deactivate tables within the current region.
2469@findex table-recognize-table
2470@item M-x table-recognize-table
2471Recognize the table under point and activate it.
2472@findex table-unrecognize-table
2473@item M-x table-unrecognize-table
2474Deactivate the table under point.
2475@findex table-recognize-cell
2476@item M-x table-recognize-cell
2477Recognize the cell under point and activate it.
2478@findex table-unrecognize-cell
2479@item M-x table-unrecognize-cell
2480Deactivate the cell under point.
2481@end table
2482
2483 For another way of converting text into tables, see @ref{Table
2484Conversion}.
2485
2486@node Cell Commands
2487@subsection Commands for Table Cells
2488
2489@findex table-forward-cell
2490@findex table-backward-cell
2491 The commands @code{table-forward-cell} and
2492@code{table-backward-cell} move point from the current cell to an
2493adjacent cell forward and backward respectively. The order of the
2494cell is wrapped. When point is positioned in the last cell of a
2495table, typing @kbd{M-x table-forward-cell} moves point to the first
2496cell in the table. Likewise @kbd{M-x table-backward-cell} from the
2497first cell in a table moves point to the last cell in the table.
2498
2499@findex table-span-cell
2500 The command @code{table-span-cell} spans the current cell into one
2501of the four directions---right, left, above or below---and merges the
2502current cell with the adjacent cell. It does not allow directions to
2503which spanning does not produce a legitimate cell.
2504
2505@findex table-split-cell
2506@cindex text-based tables, split a cell
2507@cindex split table cell
2508 The command @code{table-split-cell} splits the current cell
2509vertically or horizontally. This command is a wrapper to the
2510direction specific commands @code{table-split-cell-vertically} and
2511@code{table-split-cell-horizontally}.
2512
2513@findex table-split-cell-vertically
2514 The command @code{table-split-cell-vertically} splits the current
2515cell vertically and creates a pair of cells above and below where
2516point is located. The content in the original cell is split as well.
2517
2518@findex table-split-cell-horizontally
2519 The command @code{table-split-cell-horizontally} splits the current
2520cell horizontally and creates a pair of cells right and left of where
2521point is located. If the subject cell to split is not empty the user
2522is asked how to handle the cell contents. The three options are:
2523@code{split}, @code{left}, or @code{right}. @code{split} splits the
2524contents at point literally while the @code{left} and @code{right}
2525options move the entire contents into the left or right cell
2526respectively.
2527
2528@cindex enlarge a table cell
2529@cindex shrink a table cell
2530 The next four commands enlarge or shrink a cell. These commands
2531accept numeric arguments (@pxref{Arguments}) to specify how many
2532columns or rows to enlarge or shrink a particular table.
2533
2534@table @kbd
2535@findex table-heighten-cell
2536@item M-x table-heighten-cell
2537Enlarge the current cell vertically.
2538@findex table-shorten-cell
2539@item M-x table-shorten-cell
2540Shrink the current cell vertically.
2541@findex table-widen-cell
2542@item M-x table-widen-cell
2543Enlarge the current cell horizontally.
2544@findex table-narrow-cell
2545@item M-x table-narrow-cell
2546Shrink the current cell horizontally.
2547@end table
2548
2549@node Cell Justification
2550@subsection Cell Justification
2551@cindex cell text justification
2552
2553 You can specify text justification for each cell. The justification
2554is remembered independently for each cell and the subsequent editing
2555of cell contents is subject to the specified justification.
2556
2557@findex table-justify
2558 The command @code{table-justify} requests the user to specify what
2559to justify: a cell,a column, or a row. If you select cell
2560justification, this command sets the justification only to the current
2561cell. Selecting column or row justification set the justification to
2562all the cells within a column or row respectively. The command then
2563requests the user to enter which justification to apply: @code{left},
2564@code{center}, @code{right}, @code{top}, @code{middle}, @code{bottom},
2565or @code{none}. The options @code{left}, @code{center}, and
2566@code{right} specify horizontal justification while the options
2567@code{top}, @code{middle}, @code{bottom}, and @code{none} specify
2568vertical justification. The vertical justification @code{none}
2569effectively removes vertical justification while horizontal
2570justification must be one of @code{left}, @code{center}, or
2571@code{right}. Horizontal justification and vertical justification are
2572specified independently.
2573
2574@vindex table-detect-cell-alignment
2575 Justification information is stored in the buffer as a part of text
2576property. Therefore, this information is ephemeral and does not
2577survive through the loss of the buffer (closing the buffer and
2578revisiting the buffer erase any previous text properties). To
2579countermand for this, the command @code{table-recognize} and other
2580recognition commands (@pxref{Table Recognition}) are equipped with a
2581convenience feature (turned on by default). During table recognition,
2582the contents of a cell are examined to determine which justification
2583was originally applied to the cell and then applies this justification
2584to the the cell. This is a speculative algorithm and is therefore not
2585perfect, however, the justification is deduced correctly most of the
2586time. If you desire to disable this feature, customize the variable
2587@code{table-detect-cell-alignment} to set it to @code{nil}.
2588
2589@node Row Commands
2590@subsection Commands for Table Rows
2591@cindex table row commands
2592
2593@cindex insert row in table
2594@findex table-insert-row
2595 The command @code{table-insert-row} inserts a row of cells before
2596the current row in a table. The current row where point is located is
2597pushed down after the newly inserted row. A numeric prefix argument
2598specifies the number of rows to insert. Note that in order to insert
2599rows @emph{after} the last row at the bottom of a table, you must
2600place point below the table, i.e.@: outside the table, prior to
2601invoking this command.
2602
2603@cindex delete row in table
2604@findex table-delete-row
2605 The command @code{table-delete-row} deletes a row of cells at point.
2606A numeric prefix argument specifies the number of rows to delete.
2607
2608@node Column Commands
2609@subsection Commands for Table Columns
2610@cindex table column commands
2611
2612@cindex insert column in table
2613@findex table-insert-column
2614 The command @code{table-insert-column} inserts a column of cells to
2615the left of the current row in a table. The current column where
2616point is located at is pushed right of the newly inserted column. To
2617insert a column to the right side of the right most column, place
2618point to the right of the rightmost column, which is outside of the
2619table, prior to invoking this command. A numeric prefix argument
2620specifies the number of columns to insert.
2621
2622@cindex delete column in table
2623 A command @code{table-delete-column} deletes a column of cells at
2624point. A numeric prefix argument specifies the number of columns to
2625delete.
2626
2627@node Fixed Width Mode
2628@subsection Fix Width of Cells
2629@cindex fix width of table cells
2630
2631@findex table-fixed-width-mode
2632 The command @code{table-fixed-width-mode} toggles fixed width mode
2633on and off. When the fixed width mode is turned on, editing inside a
2634cell never changes the cell width; when it is off, the cell width
2635expands automatically in order to prevent a word from being folded
2636into multiple lines. By default, the fixed width mode is turned off.
2637
2638
2639@node Table Conversion
2640@subsection Conversion Between Plain Text and Tables
2641@cindex text to table
2642@cindex table to text
2643
2644@findex table-capture
2645 The command @code{table-capture} captures plain text in a region and
2646turns it into a table. Unlike @code{table-recognize} (@pxref{Table
2647Recognition}), the original text does not have a table appearance but
2648may hold a logical table structure. For example, some elements
2649separated by known patterns form a two dimensional structure which can
2650be turned into a table. Look at the numbers below. The numbers are
2651horizontally separated by a comma and vertically separated by a
2652newline character.
2653
2654@example
26551, 2, 3, 4
26565, 6, 7, 8
2657, 9, 10
2658@end example
2659
2660@noindent
2661When you invoke @kbd{M-x table-capture} on the above three-line
2662region, the region can be turned into the next table:
2663
2664@example
2665+-----+-----+-----+-----+
2666|1 |2 |3 |4 |
2667+-----+-----+-----+-----+
2668|5 |6 |7 |8 |
2669+-----+-----+-----+-----+
2670| |9 |10 | |
2671+-----+-----+-----+-----+
2672@end example
2673
2674@noindent
2675where @samp{,} is used for a column delimiter regexp, a newline is
2676used for a row delimiter regexp, cells are left justified, and minimum
2677cell width is 5.
2678
2679@findex table-release
2680 The command @code{table-release} does the opposite of
2681@code{table-capture}. It releases a table by removing the table frame
2682and cell borders. This leaves the table contents as plain text. One
2683of the useful applications of @code{table-capture} and
2684@code{table-release} is to edit a text in layout. Look at the
2685following three paragraphs (the latter two are indented with header
2686lines):
2687
2688@example
2689@samp{table-capture} is a powerful command however mastering its power
2690requires some practice. Here is a list of items what it can do.
2691
2692Parse Cell Items By using column delimiter regular
2693 expression and raw delimiter regular
2694 expression, it parses the specified text
2695 area and extracts cell items from
2696 non-table text and then forms a table out
2697 of them.
2698
2699Capture Text Area When no delimiters are specified it
2700 creates a single cell table. The text in
2701 the specified region is placed in that
2702 cell.
2703@end example
2704
2705@noindent
2706Applying @code{table-capture} to a region containing the above three
2707paragraphs, with empty strings for column delimiter regexp and row
2708delimiter regexp, creates a table with a single cell like the
2709following one.
2710
2711@c The first line's right-hand frame in the following two examples
2712@c sticks out to accommodate for the removal of @samp in the
2713@c produced output!!
2714@example
2715+-----------------------------------------------------------------+
2716|@samp{table-capture} is a powerful command however mastering its |
2717|power requires some practice. Here is a list of items what it |
2718|can do. |
2719| |
2720|Parse Cell Items By using column delimiter regular |
2721| expression and raw delimiter regular |
2722| expression, it parses the specified text |
2723| area and extracts cell items from |
2724| non-table text and then forms a table out |
2725| of them. |
2726| |
2727|Capture Text Area When no delimiters are specified it |
2728| creates a single cell table. The text in |
2729| the specified region is placed in that |
2730| cell. |
2731+-----------------------------------------------------------------+
2732@end example
2733
2734@noindent
2735By splitting the cell appropriately we now have a table consisting of
2736paragraphs occupying its own cell. Each cell can now be edited
2737independently without affecting the layout of other cells.
2738
2739@example
2740+-----------------------------------------------------------------+
2741|@samp{table-capture} is a powerful command however mastering its |
2742|power requires some practice. Here is a list of items what it |
2743|can do. |
2744+---------------------+-------------------------------------------+
2745|Parse Cell Items |By using column delimiter regular |
2746| |expression and raw delimiter regular |
2747| |expression, it parses the specified text |
2748| |area and extracts cell items from |
2749| |non-table text and then forms a table out |
2750| |of them. |
2751+---------------------+-------------------------------------------+
2752|Capture Text Area |When no delimiters are specified it |
2753| |creates a single cell table. The text in |
2754| |the specified region is placed in that |
2755| |cell. |
2756+---------------------+-------------------------------------------+
2757@end example
2758
2759@noindent
2760By applying @code{table-release}, which does the opposite process, the
2761contents become once again plain text. @code{table-release} works as
2762a companion command to @code{table-capture}.
2763
2764@node Measuring Tables
2765@subsection Analyzing Table Dimensions
2766@cindex table dimensions
2767
2768@findex table-query-dimension
2769 The command @code{table-query-dimension} analyzes a table structure
2770and reports information regarding its dimensions. In case of the
2771above example table, the @code{table-query-dimension} command displays
2772in echo area:
2773
2774@smallexample
2775Cell: (21w, 6h), Table: (67w, 16h), Dim: (2c, 3r), Total Cells: 5
2776@end smallexample
2777
2778@noindent
2779This indicates that the current cell is 21 character wide and 6 lines
2780high, the entire table is 67 characters wide and 16 lines high. The
2781table has 2 columns and 3 rows. It has a total of 5 cells, since the
2782first row has a spanned cell.
2783
2784@node Table Misc
2785@subsection Table Miscellany
2786
2787@cindex insert string into table cells
2788@findex table-insert-sequence
2789 The command @code{table-insert-sequence} inserts a string into each
2790cell. Each string is a part of a sequence i.e.@: a series of
2791increasing integer numbers.
2792
2793@cindex table in language format
2794@cindex table for HTML and LaTeX
2795@findex table-generate-source
2796The command @code{table-generate-source} generates a table formatted
2797for a specific markup language. It asks for a language (which must be
2798one of @code{html}, @code{latex}, or @code{cals}), a destination
2799buffer where to put the result, and the table caption (a string), and
2800then inserts the generated table in the proper syntax into the
2801destination buffer. The default destination buffer is
2802@code{table.@var{lang}}, where @var{lang} is the language you
2803specified.
2804
2293@ignore 2805@ignore
2294 arch-tag: 8db54ed8-2036-49ca-b0df-23811d03dc70 2806 arch-tag: 8db54ed8-2036-49ca-b0df-23811d03dc70
2295@end ignore 2807@end ignore
diff --git a/nt/INSTALL b/nt/INSTALL
index 09de93bca01..a96f182452c 100644
--- a/nt/INSTALL
+++ b/nt/INSTALL
@@ -54,7 +54,9 @@
54 54
55 In addition, using 4NT as your shell is known to fail the build process, 55 In addition, using 4NT as your shell is known to fail the build process,
56 at least for 4NT version 3.01. Use cmd.exe, the default NT shell, 56 at least for 4NT version 3.01. Use cmd.exe, the default NT shell,
57 instead. 57 instead. MSYS sh.exe also appears to cause various problems. If you have
58 MSYS installed, try "make SHELL=cmd.exe" to force the use of cmd.exe
59 instead of sh.exe.
58 60
59 sh exists no sh 61 sh exists no sh
60 62
diff --git a/src/ChangeLog b/src/ChangeLog
index efb792df4d6..2b0f6922ed6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,46 @@
12004-10-26 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * gtkutil.c: Put empty line between comment and function body.
4 (xg_destroy_widgets): Renamed from remove_from_container. Just
5 destroy all widgets in list. Argument wcont removed.
6 (xg_update_menubar, xg_update_submenu): Call xg_destroy_widgets
7 instead of remove_from_container.
8 (xg_display_close, xg_create_tool_bar, update_frame_tool_bar)
9 (free_frame_tool_bar): Add comment.
10
11 * xfns.c (xic_create_xfontset): Check that FRAME_XIC_BASE_FONTNAME
12 is not NULL before strcmp.
13
142004-10-26 Kim F. Storm <storm@cua.dk>
15
16 * callint.c (Fcall_interactively): Add 'U' code to get the
17 up-event discarded by a previous 'k' or 'K' argument.
18
192004-10-26 David Kastrup <dak@gnu.org>
20
21 * buffer.c (syms_of_buffer): Fix a few typos.
22
232004-10-26 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
24
25 * xsmfns.c: Put empty line between comment and function body.
26 Use two spaces before comment end.
27
282004-10-25 Kenichi Handa <handa@m17n.org>
29
30 * fontset.c (fontset_pattern_regexp): Optimize for the case that
31 PATTERN is full XLFD.
32
332004-10-24 Kenichi Handa <handa@m17n.org>
34
35 * regex.h (enum reg_errcode_t): New value REG_ERANGEX.
36
37 * regex.c (re_error_msgid): Add an entry for REG_ERANGEX.
38 (regex_compile): Return REG_ERANGEX if appropriate.
39
402004-10-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
41
42 * xfns.c (xic_create_xfontset): Initialize missing_list to NULL.
43
12004-10-21 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> 442004-10-21 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu>
2 45
3 * xterm.h (x_output): New member `xic_base_fontname'. 46 * xterm.h (x_output): New member `xic_base_fontname'.
diff --git a/src/buffer.c b/src/buffer.c
index b8aefcdbcca..b3dd6149487 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5828,21 +5828,21 @@ If the value of the variable is t, undo information is not recorded. */);
5828 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. 5828 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly.
5829 5829
5830Normally, the line-motion functions work by scanning the buffer for 5830Normally, the line-motion functions work by scanning the buffer for
5831newlines. Columnar operations (like move-to-column and 5831newlines. Columnar operations (like `move-to-column' and
5832compute-motion) also work by scanning the buffer, summing character 5832`compute-motion') also work by scanning the buffer, summing character
5833widths as they go. This works well for ordinary text, but if the 5833widths as they go. This works well for ordinary text, but if the
5834buffer's lines are very long (say, more than 500 characters), these 5834buffer's lines are very long (say, more than 500 characters), these
5835motion functions will take longer to execute. Emacs may also take 5835motion functions will take longer to execute. Emacs may also take
5836longer to update the display. 5836longer to update the display.
5837 5837
5838If cache-long-line-scans is non-nil, these motion functions cache the 5838If `cache-long-line-scans' is non-nil, these motion functions cache the
5839results of their scans, and consult the cache to avoid rescanning 5839results of their scans, and consult the cache to avoid rescanning
5840regions of the buffer until the text is modified. The caches are most 5840regions of the buffer until the text is modified. The caches are most
5841beneficial when they prevent the most searching---that is, when the 5841beneficial when they prevent the most searching---that is, when the
5842buffer contains long lines and large regions of characters with the 5842buffer contains long lines and large regions of characters with the
5843same, fixed screen width. 5843same, fixed screen width.
5844 5844
5845When cache-long-line-scans is non-nil, processing short lines will 5845When `cache-long-line-scans' is non-nil, processing short lines will
5846become slightly slower (because of the overhead of consulting the 5846become slightly slower (because of the overhead of consulting the
5847cache), and the caches will use memory roughly proportional to the 5847cache), and the caches will use memory roughly proportional to the
5848number of newlines and characters whose screen width varies. 5848number of newlines and characters whose screen width varies.
@@ -5922,8 +5922,8 @@ Values are interpreted as follows:
5922 hollow display a hollow box cursor 5922 hollow display a hollow box cursor
5923 bar display a vertical bar cursor with default width 5923 bar display a vertical bar cursor with default width
5924 (bar . WIDTH) display a vertical bar cursor with width WIDTH 5924 (bar . WIDTH) display a vertical bar cursor with width WIDTH
5925 hbar display a horisontal bar cursor with default width 5925 hbar display a horizontal bar cursor with default width
5926 (hbar . WIDTH) display a horisontal bar cursor with width WIDTH 5926 (hbar . WIDTH) display a horizontal bar cursor with width WIDTH
5927 ANYTHING ELSE display a hollow box cursor. 5927 ANYTHING ELSE display a hollow box cursor.
5928 5928
5929When the buffer is displayed in a nonselected window, 5929When the buffer is displayed in a nonselected window,
diff --git a/src/callint.c b/src/callint.c
index 8b8cb032095..da88693cd78 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -110,6 +110,7 @@ P -- Prefix arg in raw form. Does not do I/O.
110r -- Region: point and mark as 2 numeric args, smallest first. Does no I/O. 110r -- Region: point and mark as 2 numeric args, smallest first. Does no I/O.
111s -- Any string. Does not inherit the current input method. 111s -- Any string. Does not inherit the current input method.
112S -- Any symbol. 112S -- Any symbol.
113U -- Mouse up event discarded by a previous k or K argument.
113v -- Variable name: symbol that is user-variable-p. 114v -- Variable name: symbol that is user-variable-p.
114x -- Lisp expression read but not evaluated. 115x -- Lisp expression read but not evaluated.
115X -- Lisp expression read and evaluated. 116X -- Lisp expression read and evaluated.
@@ -268,6 +269,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
268 Lisp_Object specs; 269 Lisp_Object specs;
269 Lisp_Object filter_specs; 270 Lisp_Object filter_specs;
270 Lisp_Object teml; 271 Lisp_Object teml;
272 Lisp_Object up_event;
271 Lisp_Object enable; 273 Lisp_Object enable;
272 int speccount = SPECPDL_INDEX (); 274 int speccount = SPECPDL_INDEX ();
273 275
@@ -289,7 +291,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
289 char prompt1[100]; 291 char prompt1[100];
290 char *tem1; 292 char *tem1;
291 int arg_from_tty = 0; 293 int arg_from_tty = 0;
292 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 294 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
293 int key_count; 295 int key_count;
294 int record_then_fail = 0; 296 int record_then_fail = 0;
295 297
@@ -328,6 +330,9 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
328 The feature is not fully implemented. */ 330 The feature is not fully implemented. */
329 filter_specs = Qnil; 331 filter_specs = Qnil;
330 332
333 /* If k or K discard an up-event, save it here so it can be retrieved with U */
334 up_event = Qnil;
335
331 /* Decode the kind of function. Either handle it and return, 336 /* Decode the kind of function. Either handle it and return,
332 or go to `lose' if not interactive, or go to `retry' 337 or go to `lose' if not interactive, or go to `retry'
333 to specify a different function, or set either STRING or SPECS. */ 338 to specify a different function, or set either STRING or SPECS. */
@@ -499,7 +504,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
499 varies[i] = 0; 504 varies[i] = 0;
500 } 505 }
501 506
502 GCPRO4 (prefix_arg, function, *args, *visargs); 507 GCPRO5 (prefix_arg, function, *args, *visargs, up_event);
503 gcpro3.nvars = (count + 1); 508 gcpro3.nvars = (count + 1);
504 gcpro4.nvars = (count + 1); 509 gcpro4.nvars = (count + 1);
505 510
@@ -628,7 +633,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
628 /* Ignore first element, which is the base key. */ 633 /* Ignore first element, which is the base key. */
629 tem2 = Fmemq (intern ("down"), Fcdr (teml)); 634 tem2 = Fmemq (intern ("down"), Fcdr (teml));
630 if (! NILP (tem2)) 635 if (! NILP (tem2))
631 Fread_event (Qnil, Qnil); 636 up_event = Fread_event (Qnil, Qnil);
632 } 637 }
633 } 638 }
634 break; 639 break;
@@ -656,11 +661,21 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
656 /* Ignore first element, which is the base key. */ 661 /* Ignore first element, which is the base key. */
657 tem2 = Fmemq (intern ("down"), Fcdr (teml)); 662 tem2 = Fmemq (intern ("down"), Fcdr (teml));
658 if (! NILP (tem2)) 663 if (! NILP (tem2))
659 Fread_event (Qnil, Qnil); 664 up_event = Fread_event (Qnil, Qnil);
660 } 665 }
661 } 666 }
662 break; 667 break;
663 668
669 case 'U': /* Up event from last k or K */
670 if (!NILP (up_event))
671 {
672 args[i] = Fmake_vector (make_number (1), up_event);
673 up_event = Qnil;
674 teml = args[i];
675 visargs[i] = Fkey_description (teml, Qnil);
676 }
677 break;
678
664 case 'e': /* The invoking event. */ 679 case 'e': /* The invoking event. */
665 if (next_event >= key_count) 680 if (next_event >= key_count)
666 error ("%s must be bound to an event with parameters", 681 error ("%s must be bound to an event with parameters",
diff --git a/src/fontset.c b/src/fontset.c
index 84384c06d8c..a8bab6897d6 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1069,16 +1069,34 @@ fontset_pattern_regexp (pattern)
1069 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) 1069 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
1070 { 1070 {
1071 /* We must at first update the cached data. */ 1071 /* We must at first update the cached data. */
1072 char *regex = (char *) alloca (SCHARS (pattern) * 2 + 3); 1072 char *regex, *p0, *p1;
1073 char *p0, *p1 = regex; 1073 int ndashes = 0, nstars = 0;
1074
1075 for (p0 = SDATA (pattern); *p0; p0++)
1076 {
1077 if (*p0 == '-')
1078 ndashes++;
1079 else if (*p0 == '*')
1080 nstars++;
1081 }
1082
1083 /* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise
1084 we convert "*" to "[^-]*" which is much faster in regular
1085 expression matching. */
1086 if (ndashes < 14)
1087 p1 = regex = (char *) alloca (SBYTES (pattern) + 2 * nstars + 1);
1088 else
1089 p1 = regex = (char *) alloca (SBYTES (pattern) + 5 * nstars + 1);
1074 1090
1075 /* Convert "*" to ".*", "?" to ".". */
1076 *p1++ = '^'; 1091 *p1++ = '^';
1077 for (p0 = (char *) SDATA (pattern); *p0; p0++) 1092 for (p0 = (char *) SDATA (pattern); *p0; p0++)
1078 { 1093 {
1079 if (*p0 == '*') 1094 if (*p0 == '*')
1080 { 1095 {
1081 *p1++ = '.'; 1096 if (ndashes < 14)
1097 *p1++ = '.';
1098 else
1099 *p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']';
1082 *p1++ = '*'; 1100 *p1++ = '*';
1083 } 1101 }
1084 else if (*p0 == '?') 1102 else if (*p0 == '?')
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 8182ff45766..dc091c1a09b 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -48,6 +48,7 @@ Boston, MA 02111-1307, USA. */
48#ifdef HAVE_GTK_MULTIDISPLAY 48#ifdef HAVE_GTK_MULTIDISPLAY
49 49
50/* Return the GdkDisplay that corresponds to the X display DPY. */ 50/* Return the GdkDisplay that corresponds to the X display DPY. */
51
51static GdkDisplay * 52static GdkDisplay *
52xg_get_gdk_display (dpy) 53xg_get_gdk_display (dpy)
53 Display *dpy; 54 Display *dpy;
@@ -58,6 +59,7 @@ xg_get_gdk_display (dpy)
58/* When the GTK widget W is to be created on a display for F that 59/* When the GTK widget W is to be created on a display for F that
59 is not the default display, set the display for W. 60 is not the default display, set the display for W.
60 W can be a GtkMenu or a GtkWindow widget. */ 61 W can be a GtkMenu or a GtkWindow widget. */
62
61static void 63static void
62xg_set_screen (w, f) 64xg_set_screen (w, f)
63 GtkWidget *w; 65 GtkWidget *w;
@@ -80,6 +82,7 @@ xg_set_screen (w, f)
80 82
81/* Make some defines so we can use the GTK 2.2 functions when 83/* Make some defines so we can use the GTK 2.2 functions when
82 compiling with GTK 2.0. */ 84 compiling with GTK 2.0. */
85
83#define xg_set_screen(w, f) 86#define xg_set_screen(w, f)
84#define gdk_xid_table_lookup_for_display(dpy, w) gdk_xid_table_lookup (w) 87#define gdk_xid_table_lookup_for_display(dpy, w) gdk_xid_table_lookup (w)
85#define gdk_pixmap_foreign_new_for_display(dpy, p) gdk_pixmap_foreign_new (p) 88#define gdk_pixmap_foreign_new_for_display(dpy, p) gdk_pixmap_foreign_new (p)
@@ -95,6 +98,7 @@ xg_set_screen (w, f)
95 Returns non-zero if display could be opened, zero if display could not 98 Returns non-zero if display could be opened, zero if display could not
96 be opened, and less than zero if the GTK version doesn't support 99 be opened, and less than zero if the GTK version doesn't support
97 multipe displays. */ 100 multipe displays. */
101
98int 102int
99xg_display_open (display_name, dpy) 103xg_display_open (display_name, dpy)
100 char *display_name; 104 char *display_name;
@@ -115,6 +119,8 @@ xg_display_open (display_name, dpy)
115} 119}
116 120
117 121
122/* Close display DPY. */
123
118void 124void
119xg_display_close (Display *dpy) 125xg_display_close (Display *dpy)
120{ 126{
@@ -176,6 +182,7 @@ static int malloc_cpt;
176 widget_value_free_list or by malloc:ing a new one. 182 widget_value_free_list or by malloc:ing a new one.
177 183
178 Return a pointer to the allocated structure. */ 184 Return a pointer to the allocated structure. */
185
179widget_value * 186widget_value *
180malloc_widget_value () 187malloc_widget_value ()
181{ 188{
@@ -197,6 +204,7 @@ malloc_widget_value ()
197 204
198/* This is analogous to free. It frees only what was allocated 205/* This is analogous to free. It frees only what was allocated
199 by malloc_widget_value, and no substructures. */ 206 by malloc_widget_value, and no substructures. */
207
200void 208void
201free_widget_value (wv) 209free_widget_value (wv)
202 widget_value *wv; 210 widget_value *wv;
@@ -221,6 +229,7 @@ free_widget_value (wv)
221 229
222/* Create and return the cursor to be used for popup menus and 230/* Create and return the cursor to be used for popup menus and
223 scroll bars on display DPY. */ 231 scroll bars on display DPY. */
232
224GdkCursor * 233GdkCursor *
225xg_create_default_cursor (dpy) 234xg_create_default_cursor (dpy)
226 Display *dpy; 235 Display *dpy;
@@ -239,6 +248,7 @@ xg_create_default_cursor (dpy)
239 WIDGET is used to find the GdkColormap to use for the GdkPixbuf. 248 WIDGET is used to find the GdkColormap to use for the GdkPixbuf.
240 If OLD_WIDGET is NULL, a new widget is constructed and returned. 249 If OLD_WIDGET is NULL, a new widget is constructed and returned.
241 If OLD_WIDGET is not NULL, that widget is modified. */ 250 If OLD_WIDGET is not NULL, that widget is modified. */
251
242static GtkWidget * 252static GtkWidget *
243xg_get_image_for_pixmap (f, img, widget, old_widget) 253xg_get_image_for_pixmap (f, img, widget, old_widget)
244 FRAME_PTR f; 254 FRAME_PTR f;
@@ -373,6 +383,7 @@ xg_get_image_for_pixmap (f, img, widget, old_widget)
373/* Set CURSOR on W and all widgets W contain. We must do like this 383/* Set CURSOR on W and all widgets W contain. We must do like this
374 for scroll bars and menu because they create widgets internally, 384 for scroll bars and menu because they create widgets internally,
375 and it is those widgets that are visible. */ 385 and it is those widgets that are visible. */
386
376static void 387static void
377xg_set_cursor (w, cursor) 388xg_set_cursor (w, cursor)
378 GtkWidget *w; 389 GtkWidget *w;
@@ -400,6 +411,7 @@ xg_set_cursor (w, cursor)
400 has expired by calling the GTK event loop. 411 has expired by calling the GTK event loop.
401 Also, when a menu is active, it has a small timeout before it 412 Also, when a menu is active, it has a small timeout before it
402 pops down the sub menu under it. */ 413 pops down the sub menu under it. */
414
403static void 415static void
404xg_process_timeouts (timer) 416xg_process_timeouts (timer)
405 struct atimer *timer; 417 struct atimer *timer;
@@ -415,6 +427,7 @@ xg_process_timeouts (timer)
415/* Start the xg_timer with an interval of 0.1 seconds, if not already started. 427/* Start the xg_timer with an interval of 0.1 seconds, if not already started.
416 xg_process_timeouts is called when the timer expires. The timer 428 xg_process_timeouts is called when the timer expires. The timer
417 started is continuous, i.e. runs until xg_stop_timer is called. */ 429 started is continuous, i.e. runs until xg_stop_timer is called. */
430
418static void 431static void
419xg_start_timer () 432xg_start_timer ()
420{ 433{
@@ -430,6 +443,7 @@ xg_start_timer ()
430} 443}
431 444
432/* Stop the xg_timer if started. */ 445/* Stop the xg_timer if started. */
446
433static void 447static void
434xg_stop_timer () 448xg_stop_timer ()
435{ 449{
@@ -441,6 +455,7 @@ xg_stop_timer ()
441} 455}
442 456
443/* Insert NODE into linked LIST. */ 457/* Insert NODE into linked LIST. */
458
444static void 459static void
445xg_list_insert (xg_list_node *list, xg_list_node *node) 460xg_list_insert (xg_list_node *list, xg_list_node *node)
446{ 461{
@@ -453,6 +468,7 @@ xg_list_insert (xg_list_node *list, xg_list_node *node)
453} 468}
454 469
455/* Remove NODE from linked LIST. */ 470/* Remove NODE from linked LIST. */
471
456static void 472static void
457xg_list_remove (xg_list_node *list, xg_list_node *node) 473xg_list_remove (xg_list_node *list, xg_list_node *node)
458{ 474{
@@ -473,6 +489,7 @@ xg_list_remove (xg_list_node *list, xg_list_node *node)
473 utf8 or NULL, just return STR. 489 utf8 or NULL, just return STR.
474 If not, a new string is allocated and the caller must free the result 490 If not, a new string is allocated and the caller must free the result
475 with g_free. */ 491 with g_free. */
492
476static char * 493static char *
477get_utf8_string (str) 494get_utf8_string (str)
478 char *str; 495 char *str;
@@ -496,6 +513,7 @@ get_utf8_string (str)
496 only way to get geometry position right if the user explicitly 513 only way to get geometry position right if the user explicitly
497 asked for a position when starting Emacs. 514 asked for a position when starting Emacs.
498 F is the frame we shall set geometry for. */ 515 F is the frame we shall set geometry for. */
516
499static void 517static void
500xg_set_geometry (f) 518xg_set_geometry (f)
501 FRAME_PTR f; 519 FRAME_PTR f;
@@ -529,6 +547,7 @@ xg_set_geometry (f)
529/* Resize the outer window of frame F after chainging the height. 547/* Resize the outer window of frame F after chainging the height.
530 This happend when the menu bar or the tool bar is added or removed. 548 This happend when the menu bar or the tool bar is added or removed.
531 COLUMNS/ROWS is the size the edit area shall have after the resize. */ 549 COLUMNS/ROWS is the size the edit area shall have after the resize. */
550
532static void 551static void
533xg_resize_outer_widget (f, columns, rows) 552xg_resize_outer_widget (f, columns, rows)
534 FRAME_PTR f; 553 FRAME_PTR f;
@@ -555,6 +574,7 @@ xg_resize_outer_widget (f, columns, rows)
555 manually. 574 manually.
556 F is the frame to resize. 575 F is the frame to resize.
557 PIXELWIDTH, PIXELHEIGHT is the new size in pixels. */ 576 PIXELWIDTH, PIXELHEIGHT is the new size in pixels. */
577
558void 578void
559xg_resize_widgets (f, pixelwidth, pixelheight) 579xg_resize_widgets (f, pixelwidth, pixelheight)
560 FRAME_PTR f; 580 FRAME_PTR f;
@@ -591,6 +611,7 @@ xg_resize_widgets (f, pixelwidth, pixelheight)
591 611
592 612
593/* Update our widget size to be COLS/ROWS characters for frame F. */ 613/* Update our widget size to be COLS/ROWS characters for frame F. */
614
594void 615void
595xg_frame_set_char_size (f, cols, rows) 616xg_frame_set_char_size (f, cols, rows)
596 FRAME_PTR f; 617 FRAME_PTR f;
@@ -630,6 +651,7 @@ xg_frame_set_char_size (f, cols, rows)
630 X Window that aren't accessible. 651 X Window that aren't accessible.
631 652
632 Return 0 if no widget match WDESC. */ 653 Return 0 if no widget match WDESC. */
654
633GtkWidget * 655GtkWidget *
634xg_win_to_widget (dpy, wdesc) 656xg_win_to_widget (dpy, wdesc)
635 Display *dpy; 657 Display *dpy;
@@ -655,6 +677,7 @@ xg_win_to_widget (dpy, wdesc)
655 677
656/* Fill in the GdkColor C so that it represents PIXEL. 678/* Fill in the GdkColor C so that it represents PIXEL.
657 W is the widget that color will be used for. Used to find colormap. */ 679 W is the widget that color will be used for. Used to find colormap. */
680
658static void 681static void
659xg_pix_to_gcolor (w, pixel, c) 682xg_pix_to_gcolor (w, pixel, c)
660 GtkWidget *w; 683 GtkWidget *w;
@@ -667,6 +690,7 @@ xg_pix_to_gcolor (w, pixel, c)
667 690
668/* Create and set up the GTK widgets for frame F. 691/* Create and set up the GTK widgets for frame F.
669 Return 0 if creation failed, non-zero otherwise. */ 692 Return 0 if creation failed, non-zero otherwise. */
693
670int 694int
671xg_create_frame_widgets (f) 695xg_create_frame_widgets (f)
672 FRAME_PTR f; 696 FRAME_PTR f;
@@ -802,6 +826,7 @@ xg_create_frame_widgets (f)
802 that the window now has. 826 that the window now has.
803 If USER_POSITION is nonzero, we set the User Position 827 If USER_POSITION is nonzero, we set the User Position
804 flag (this is useful when FLAGS is 0). */ 828 flag (this is useful when FLAGS is 0). */
829
805void 830void
806x_wm_set_size_hint (f, flags, user_position) 831x_wm_set_size_hint (f, flags, user_position)
807 FRAME_PTR f; 832 FRAME_PTR f;
@@ -900,6 +925,7 @@ x_wm_set_size_hint (f, flags, user_position)
900 keep the GTK and X colors in sync. 925 keep the GTK and X colors in sync.
901 F is the frame to change, 926 F is the frame to change,
902 BG is the pixel value to change to. */ 927 BG is the pixel value to change to. */
928
903void 929void
904xg_set_background_color (f, bg) 930xg_set_background_color (f, bg)
905 FRAME_PTR f; 931 FRAME_PTR f;
@@ -923,6 +949,7 @@ xg_set_background_color (f, bg)
923 ***********************************************************************/ 949 ***********************************************************************/
924/* Return the dialog title to use for a dialog of type KEY. 950/* Return the dialog title to use for a dialog of type KEY.
925 This is the encoding used by lwlib. We use the same for GTK. */ 951 This is the encoding used by lwlib. We use the same for GTK. */
952
926static char * 953static char *
927get_dialog_title (char key) 954get_dialog_title (char key)
928{ 955{
@@ -963,6 +990,7 @@ get_dialog_title (char key)
963 user_data is NULL (not used). 990 user_data is NULL (not used).
964 991
965 Returns TRUE to end propagation of event. */ 992 Returns TRUE to end propagation of event. */
993
966static gboolean 994static gboolean
967dialog_delete_callback (w, event, user_data) 995dialog_delete_callback (w, event, user_data)
968 GtkWidget *w; 996 GtkWidget *w;
@@ -979,6 +1007,7 @@ dialog_delete_callback (w, event, user_data)
979 DEACTIVATE_CB is the callback to use when the dialog pops down. 1007 DEACTIVATE_CB is the callback to use when the dialog pops down.
980 1008
981 Returns the GTK dialog widget. */ 1009 Returns the GTK dialog widget. */
1010
982static GtkWidget * 1011static GtkWidget *
983create_dialog (wv, select_cb, deactivate_cb) 1012create_dialog (wv, select_cb, deactivate_cb)
984 widget_value *wv; 1013 widget_value *wv;
@@ -1101,6 +1130,7 @@ enum
1101 a file dialog. 1130 a file dialog.
1102 W is the file dialog widget, 1131 W is the file dialog widget,
1103 ARG points to an integer where we record what has happend. */ 1132 ARG points to an integer where we record what has happend. */
1133
1104static void 1134static void
1105xg_file_sel_ok (w, arg) 1135xg_file_sel_ok (w, arg)
1106 GtkWidget *w; 1136 GtkWidget *w;
@@ -1113,6 +1143,7 @@ xg_file_sel_ok (w, arg)
1113 a file dialog. 1143 a file dialog.
1114 W is the file dialog widget, 1144 W is the file dialog widget,
1115 ARG points to an integer where we record what has happend. */ 1145 ARG points to an integer where we record what has happend. */
1146
1116static void 1147static void
1117xg_file_sel_cancel (w, arg) 1148xg_file_sel_cancel (w, arg)
1118 GtkWidget *w; 1149 GtkWidget *w;
@@ -1127,6 +1158,7 @@ xg_file_sel_cancel (w, arg)
1127 the dialog is popped down, but the dialog widget is not destroyed. 1158 the dialog is popped down, but the dialog widget is not destroyed.
1128 W is the file dialog widget, 1159 W is the file dialog widget,
1129 ARG points to an integer where we record what has happend. */ 1160 ARG points to an integer where we record what has happend. */
1161
1130static void 1162static void
1131xg_file_sel_destroy (w, arg) 1163xg_file_sel_destroy (w, arg)
1132 GtkWidget *w; 1164 GtkWidget *w;
@@ -1144,6 +1176,7 @@ xg_file_sel_destroy (w, arg)
1144 1176
1145 Returns a file name or NULL if no file was selected. 1177 Returns a file name or NULL if no file was selected.
1146 The returned string must be freed by the caller. */ 1178 The returned string must be freed by the caller. */
1179
1147char * 1180char *
1148xg_get_file_name (f, prompt, default_filename, mustmatch_p) 1181xg_get_file_name (f, prompt, default_filename, mustmatch_p)
1149 FRAME_PTR f; 1182 FRAME_PTR f;
@@ -1234,6 +1267,7 @@ static xg_list_node xg_menu_item_cb_list;
1234 1267
1235 Returns CL_DATA if CL_DATA is not NULL, or a pointer to a newly 1268 Returns CL_DATA if CL_DATA is not NULL, or a pointer to a newly
1236 allocated xg_menu_cb_data if CL_DATA is NULL. */ 1269 allocated xg_menu_cb_data if CL_DATA is NULL. */
1270
1237static xg_menu_cb_data * 1271static xg_menu_cb_data *
1238make_cl_data (cl_data, f, highlight_cb) 1272make_cl_data (cl_data, f, highlight_cb)
1239 xg_menu_cb_data *cl_data; 1273 xg_menu_cb_data *cl_data;
@@ -1267,6 +1301,7 @@ make_cl_data (cl_data, f, highlight_cb)
1267 HIGHLIGHT_CB could change, there is no check that the same 1301 HIGHLIGHT_CB could change, there is no check that the same
1268 function is given when modifying a menu bar as was given when 1302 function is given when modifying a menu bar as was given when
1269 creating the menu bar. */ 1303 creating the menu bar. */
1304
1270static void 1305static void
1271update_cl_data (cl_data, f, highlight_cb) 1306update_cl_data (cl_data, f, highlight_cb)
1272 xg_menu_cb_data *cl_data; 1307 xg_menu_cb_data *cl_data;
@@ -1284,6 +1319,7 @@ update_cl_data (cl_data, f, highlight_cb)
1284 1319
1285/* Decrease reference count for CL_DATA. 1320/* Decrease reference count for CL_DATA.
1286 If reference count is zero, free CL_DATA. */ 1321 If reference count is zero, free CL_DATA. */
1322
1287static void 1323static void
1288unref_cl_data (cl_data) 1324unref_cl_data (cl_data)
1289 xg_menu_cb_data *cl_data; 1325 xg_menu_cb_data *cl_data;
@@ -1300,6 +1336,7 @@ unref_cl_data (cl_data)
1300} 1336}
1301 1337
1302/* Function that marks all lisp data during GC. */ 1338/* Function that marks all lisp data during GC. */
1339
1303void 1340void
1304xg_mark_data () 1341xg_mark_data ()
1305{ 1342{
@@ -1321,6 +1358,7 @@ xg_mark_data ()
1321/* Callback called when a menu item is destroyed. Used to free data. 1358/* Callback called when a menu item is destroyed. Used to free data.
1322 W is the widget that is being destroyed (not used). 1359 W is the widget that is being destroyed (not used).
1323 CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. */ 1360 CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. */
1361
1324static void 1362static void
1325menuitem_destroy_callback (w, client_data) 1363menuitem_destroy_callback (w, client_data)
1326 GtkWidget *w; 1364 GtkWidget *w;
@@ -1340,6 +1378,7 @@ menuitem_destroy_callback (w, client_data)
1340 CLIENT_DATA points to the xg_menu_item_cb_data associated with the W. 1378 CLIENT_DATA points to the xg_menu_item_cb_data associated with the W.
1341 1379
1342 Returns FALSE to tell GTK to keep processing this event. */ 1380 Returns FALSE to tell GTK to keep processing this event. */
1381
1343static gboolean 1382static gboolean
1344menuitem_highlight_callback (w, event, client_data) 1383menuitem_highlight_callback (w, event, client_data)
1345 GtkWidget *w; 1384 GtkWidget *w;
@@ -1364,6 +1403,7 @@ menuitem_highlight_callback (w, event, client_data)
1364/* Callback called when a menu is destroyed. Used to free data. 1403/* Callback called when a menu is destroyed. Used to free data.
1365 W is the widget that is being destroyed (not used). 1404 W is the widget that is being destroyed (not used).
1366 CLIENT_DATA points to the xg_menu_cb_data associated with W. */ 1405 CLIENT_DATA points to the xg_menu_cb_data associated with W. */
1406
1367static void 1407static void
1368menu_destroy_callback (w, client_data) 1408menu_destroy_callback (w, client_data)
1369 GtkWidget *w; 1409 GtkWidget *w;
@@ -1379,6 +1419,7 @@ menu_destroy_callback (w, client_data)
1379 W is the widget that does the grab (not used). 1419 W is the widget that does the grab (not used).
1380 UNGRAB_P is TRUE if this is an ungrab, FALSE if it is a grab. 1420 UNGRAB_P is TRUE if this is an ungrab, FALSE if it is a grab.
1381 CLIENT_DATA is NULL (not used). */ 1421 CLIENT_DATA is NULL (not used). */
1422
1382static void 1423static void
1383menu_grab_callback (GtkWidget *widget, 1424menu_grab_callback (GtkWidget *widget,
1384 gboolean ungrab_p, 1425 gboolean ungrab_p,
@@ -1398,6 +1439,7 @@ menu_grab_callback (GtkWidget *widget,
1398 must be non-NULL) and can be inserted into a menu item. 1439 must be non-NULL) and can be inserted into a menu item.
1399 1440
1400 Returns the GtkHBox. */ 1441 Returns the GtkHBox. */
1442
1401static GtkWidget * 1443static GtkWidget *
1402make_widget_for_menu_item (utf8_label, utf8_key) 1444make_widget_for_menu_item (utf8_label, utf8_key)
1403 char *utf8_label; 1445 char *utf8_label;
@@ -1437,6 +1479,7 @@ make_widget_for_menu_item (utf8_label, utf8_key)
1437 1479
1438 Unfortunately, keys don't line up as nicely as in Motif, 1480 Unfortunately, keys don't line up as nicely as in Motif,
1439 but the MacOS X version doesn't either, so I guess that is OK. */ 1481 but the MacOS X version doesn't either, so I guess that is OK. */
1482
1440static GtkWidget * 1483static GtkWidget *
1441make_menu_item (utf8_label, utf8_key, item, group) 1484make_menu_item (utf8_label, utf8_key, item, group)
1442 char *utf8_label; 1485 char *utf8_label;
@@ -1486,6 +1529,7 @@ make_menu_item (utf8_label, utf8_key, item, group)
1486 1529
1487/* Return non-zero if LABEL specifies a separator (GTK only has one 1530/* Return non-zero if LABEL specifies a separator (GTK only has one
1488 separator type) */ 1531 separator type) */
1532
1489static int 1533static int
1490xg_separator_p (char *label) 1534xg_separator_p (char *label)
1491{ 1535{
@@ -1534,6 +1578,7 @@ xg_separator_p (char *label)
1534static int xg_detached_menus; 1578static int xg_detached_menus;
1535 1579
1536/* Returns non-zero if there are detached menus. */ 1580/* Returns non-zero if there are detached menus. */
1581
1537int 1582int
1538xg_have_tear_offs () 1583xg_have_tear_offs ()
1539{ 1584{
@@ -1544,6 +1589,7 @@ xg_have_tear_offs ()
1544 decrease the xg_detached_menus count. 1589 decrease the xg_detached_menus count.
1545 WIDGET is the top level window that is removed (the parent of the menu). 1590 WIDGET is the top level window that is removed (the parent of the menu).
1546 CLIENT_DATA is not used. */ 1591 CLIENT_DATA is not used. */
1592
1547static void 1593static void
1548tearoff_remove (widget, client_data) 1594tearoff_remove (widget, client_data)
1549 GtkWidget *widget; 1595 GtkWidget *widget;
@@ -1556,6 +1602,7 @@ tearoff_remove (widget, client_data)
1556 xg_detached_menus count. 1602 xg_detached_menus count.
1557 WIDGET is the GtkTearoffMenuItem. 1603 WIDGET is the GtkTearoffMenuItem.
1558 CLIENT_DATA is not used. */ 1604 CLIENT_DATA is not used. */
1605
1559static void 1606static void
1560tearoff_activate (widget, client_data) 1607tearoff_activate (widget, client_data)
1561 GtkWidget *widget; 1608 GtkWidget *widget;
@@ -1585,6 +1632,7 @@ tearoff_activate (widget, client_data)
1585 in the group. On exit, *GROUP contains the radio item group. 1632 in the group. On exit, *GROUP contains the radio item group.
1586 1633
1587 Returns the created GtkWidget. */ 1634 Returns the created GtkWidget. */
1635
1588static GtkWidget * 1636static GtkWidget *
1589xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group) 1637xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group)
1590 widget_value *item; 1638 widget_value *item;
@@ -1802,6 +1850,7 @@ create_menus (data, f, select_cb, deactivate_cb, highlight_cb,
1802 HIGHLIGHT_CB is the callback to call when entering/leaving menu items. 1850 HIGHLIGHT_CB is the callback to call when entering/leaving menu items.
1803 1851
1804 Returns the widget created. */ 1852 Returns the widget created. */
1853
1805GtkWidget * 1854GtkWidget *
1806xg_create_widget (type, name, f, val, 1855xg_create_widget (type, name, f, val,
1807 select_cb, deactivate_cb, highlight_cb) 1856 select_cb, deactivate_cb, highlight_cb)
@@ -1859,6 +1908,7 @@ xg_create_widget (type, name, f, val,
1859} 1908}
1860 1909
1861/* Return the label for menu item WITEM. */ 1910/* Return the label for menu item WITEM. */
1911
1862static const char * 1912static const char *
1863xg_get_menu_item_label (witem) 1913xg_get_menu_item_label (witem)
1864 GtkMenuItem *witem; 1914 GtkMenuItem *witem;
@@ -1868,6 +1918,7 @@ xg_get_menu_item_label (witem)
1868} 1918}
1869 1919
1870/* Return non-zero if the menu item WITEM has the text LABEL. */ 1920/* Return non-zero if the menu item WITEM has the text LABEL. */
1921
1871static int 1922static int
1872xg_item_label_same_p (witem, label) 1923xg_item_label_same_p (witem, label)
1873 GtkMenuItem *witem; 1924 GtkMenuItem *witem;
@@ -1887,10 +1938,10 @@ xg_item_label_same_p (witem, label)
1887 return is_same; 1938 return is_same;
1888} 1939}
1889 1940
1890/* Remove widgets in LIST from container WCONT. */ 1941/* Destroy widgets in LIST. */
1942
1891static void 1943static void
1892remove_from_container (wcont, list) 1944xg_destroy_widgets (list)
1893 GtkWidget *wcont;
1894 GList *list; 1945 GList *list;
1895{ 1946{
1896 GList *iter; 1947 GList *iter;
@@ -1899,15 +1950,7 @@ remove_from_container (wcont, list)
1899 { 1950 {
1900 GtkWidget *w = GTK_WIDGET (iter->data); 1951 GtkWidget *w = GTK_WIDGET (iter->data);
1901 1952
1902 /* Add a ref to w so we can explicitly destroy it later. */ 1953 /* Destroying the widget will remove it from the container it is in. */
1903 gtk_widget_ref (w);
1904 gtk_container_remove (GTK_CONTAINER (wcont), w);
1905
1906 /* If there is a menu under this widget that has been detached,
1907 there is a reference to it, and just removing w from the
1908 container does not destroy the submenu. By explicitly
1909 destroying w we make sure the submenu is destroyed, thus
1910 removing the detached window also if there was one. */
1911 gtk_widget_destroy (w); 1954 gtk_widget_destroy (w);
1912 } 1955 }
1913} 1956}
@@ -1923,6 +1966,7 @@ remove_from_container (wcont, list)
1923 CL_DATA points to the callback data to be used for this menu bar. 1966 CL_DATA points to the callback data to be used for this menu bar.
1924 1967
1925 This function calls itself to walk through the menu bar names. */ 1968 This function calls itself to walk through the menu bar names. */
1969
1926static void 1970static void
1927xg_update_menubar (menubar, f, list, iter, pos, val, 1971xg_update_menubar (menubar, f, list, iter, pos, val,
1928 select_cb, highlight_cb, cl_data) 1972 select_cb, highlight_cb, cl_data)
@@ -1941,7 +1985,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val,
1941 else if (iter && ! val) 1985 else if (iter && ! val)
1942 { 1986 {
1943 /* Item(s) have been removed. Remove all remaining items. */ 1987 /* Item(s) have been removed. Remove all remaining items. */
1944 remove_from_container (menubar, iter); 1988 xg_destroy_widgets (iter);
1945 1989
1946 /* All updated. */ 1990 /* All updated. */
1947 val = 0; 1991 val = 0;
@@ -2095,6 +2139,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val,
2095 SELECT_CB is the callback to use when a menu item is selected. 2139 SELECT_CB is the callback to use when a menu item is selected.
2096 HIGHLIGHT_CB is the callback to call when entering/leaving menu items. 2140 HIGHLIGHT_CB is the callback to call when entering/leaving menu items.
2097 CL_DATA is the data to set in the widget for menu invokation. */ 2141 CL_DATA is the data to set in the widget for menu invokation. */
2142
2098static void 2143static void
2099xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data) 2144xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data)
2100 widget_value *val; 2145 widget_value *val;
@@ -2229,6 +2274,7 @@ xg_update_menu_item (val, w, select_cb, highlight_cb, cl_data)
2229} 2274}
2230 2275
2231/* Update the toggle menu item W so it corresponds to VAL. */ 2276/* Update the toggle menu item W so it corresponds to VAL. */
2277
2232static void 2278static void
2233xg_update_toggle_item (val, w) 2279xg_update_toggle_item (val, w)
2234 widget_value *val; 2280 widget_value *val;
@@ -2238,6 +2284,7 @@ xg_update_toggle_item (val, w)
2238} 2284}
2239 2285
2240/* Update the radio menu item W so it corresponds to VAL. */ 2286/* Update the radio menu item W so it corresponds to VAL. */
2287
2241static void 2288static void
2242xg_update_radio_item (val, w) 2289xg_update_radio_item (val, w)
2243 widget_value *val; 2290 widget_value *val;
@@ -2367,8 +2414,8 @@ xg_update_submenu (submenu, f, val,
2367 { 2414 {
2368 /* If we are adding new menu items below, we must remove from 2415 /* If we are adding new menu items below, we must remove from
2369 first radio button so that radio groups become correct. */ 2416 first radio button so that radio groups become correct. */
2370 if (cur && first_radio) remove_from_container (submenu, first_radio); 2417 if (cur && first_radio) xg_destroy_widgets (first_radio);
2371 else remove_from_container (submenu, iter); 2418 else xg_destroy_widgets (iter);
2372 } 2419 }
2373 2420
2374 if (cur) 2421 if (cur)
@@ -2400,6 +2447,7 @@ xg_update_submenu (submenu, f, val,
2400 SELECT_CB is the callback to use when a menu item is selected. 2447 SELECT_CB is the callback to use when a menu item is selected.
2401 DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore. 2448 DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore.
2402 HIGHLIGHT_CB is the callback to call when entering/leaving menu items. */ 2449 HIGHLIGHT_CB is the callback to call when entering/leaving menu items. */
2450
2403void 2451void
2404xg_modify_menubar_widgets (menubar, f, val, deep_p, 2452xg_modify_menubar_widgets (menubar, f, val, deep_p,
2405 select_cb, deactivate_cb, highlight_cb) 2453 select_cb, deactivate_cb, highlight_cb)
@@ -2544,12 +2592,14 @@ free_frame_menubar (f)
2544 2592
2545/* Setting scroll bar values invokes the callback. Use this variable 2593/* Setting scroll bar values invokes the callback. Use this variable
2546 to indicate that callback should do nothing. */ 2594 to indicate that callback should do nothing. */
2595
2547int xg_ignore_gtk_scrollbar; 2596int xg_ignore_gtk_scrollbar;
2548 2597
2549/* SET_SCROLL_BAR_X_WINDOW assumes the second argument fits in 2598/* SET_SCROLL_BAR_X_WINDOW assumes the second argument fits in
2550 32 bits. But we want to store pointers, and they may be larger 2599 32 bits. But we want to store pointers, and they may be larger
2551 than 32 bits. Keep a mapping from integer index to widget pointers 2600 than 32 bits. Keep a mapping from integer index to widget pointers
2552 to get around the 32 bit limitation. */ 2601 to get around the 32 bit limitation. */
2602
2553static struct 2603static struct
2554{ 2604{
2555 GtkWidget **widgets; 2605 GtkWidget **widgets;
@@ -2558,9 +2608,11 @@ static struct
2558} id_to_widget; 2608} id_to_widget;
2559 2609
2560/* Grow this much every time we need to allocate more */ 2610/* Grow this much every time we need to allocate more */
2611
2561#define ID_TO_WIDGET_INCR 32 2612#define ID_TO_WIDGET_INCR 32
2562 2613
2563/* Store the widget pointer W in id_to_widget and return the integer index. */ 2614/* Store the widget pointer W in id_to_widget and return the integer index. */
2615
2564static int 2616static int
2565xg_store_widget_in_map (w) 2617xg_store_widget_in_map (w)
2566 GtkWidget *w; 2618 GtkWidget *w;
@@ -2599,6 +2651,7 @@ xg_store_widget_in_map (w)
2599 2651
2600/* Remove pointer at IDX from id_to_widget. 2652/* Remove pointer at IDX from id_to_widget.
2601 Called when scroll bar is destroyed. */ 2653 Called when scroll bar is destroyed. */
2654
2602static void 2655static void
2603xg_remove_widget_from_map (idx) 2656xg_remove_widget_from_map (idx)
2604 int idx; 2657 int idx;
@@ -2611,6 +2664,7 @@ xg_remove_widget_from_map (idx)
2611} 2664}
2612 2665
2613/* Get the widget pointer at IDX from id_to_widget. */ 2666/* Get the widget pointer at IDX from id_to_widget. */
2667
2614static GtkWidget * 2668static GtkWidget *
2615xg_get_widget_from_map (idx) 2669xg_get_widget_from_map (idx)
2616 int idx; 2670 int idx;
@@ -2623,6 +2677,7 @@ xg_get_widget_from_map (idx)
2623 2677
2624/* Return the scrollbar id for X Window WID on display DPY. 2678/* Return the scrollbar id for X Window WID on display DPY.
2625 Return -1 if WID not in id_to_widget. */ 2679 Return -1 if WID not in id_to_widget. */
2680
2626int 2681int
2627xg_get_scroll_id_for_window (dpy, wid) 2682xg_get_scroll_id_for_window (dpy, wid)
2628 Display *dpy; 2683 Display *dpy;
@@ -2646,6 +2701,7 @@ xg_get_scroll_id_for_window (dpy, wid)
2646/* Callback invoked when scroll bar WIDGET is destroyed. 2701/* Callback invoked when scroll bar WIDGET is destroyed.
2647 DATA is the index into id_to_widget for WIDGET. 2702 DATA is the index into id_to_widget for WIDGET.
2648 We free pointer to last scroll bar values here and remove the index. */ 2703 We free pointer to last scroll bar values here and remove the index. */
2704
2649static void 2705static void
2650xg_gtk_scroll_destroy (widget, data) 2706xg_gtk_scroll_destroy (widget, data)
2651 GtkWidget *widget; 2707 GtkWidget *widget;
@@ -2668,6 +2724,7 @@ xg_gtk_scroll_destroy (widget, data)
2668 2724
2669 Returns FALSE to tell GTK that it shall continue propagate the event 2725 Returns FALSE to tell GTK that it shall continue propagate the event
2670 to widgets. */ 2726 to widgets. */
2727
2671static gboolean 2728static gboolean
2672scroll_bar_button_cb (widget, event, user_data) 2729scroll_bar_button_cb (widget, event, user_data)
2673 GtkWidget *widget; 2730 GtkWidget *widget;
@@ -2692,6 +2749,7 @@ scroll_bar_button_cb (widget, event, user_data)
2692 bar changes. 2749 bar changes.
2693 SCROLL_BAR_NAME is the name we use for the scroll bar. Can be used 2750 SCROLL_BAR_NAME is the name we use for the scroll bar. Can be used
2694 to set resources for the widget. */ 2751 to set resources for the widget. */
2752
2695void 2753void
2696xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name) 2754xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name)
2697 FRAME_PTR f; 2755 FRAME_PTR f;
@@ -2753,6 +2811,7 @@ xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name)
2753} 2811}
2754 2812
2755/* Make the scroll bar represented by SCROLLBAR_ID visible. */ 2813/* Make the scroll bar represented by SCROLLBAR_ID visible. */
2814
2756void 2815void
2757xg_show_scroll_bar (scrollbar_id) 2816xg_show_scroll_bar (scrollbar_id)
2758 int scrollbar_id; 2817 int scrollbar_id;
@@ -2763,6 +2822,7 @@ xg_show_scroll_bar (scrollbar_id)
2763} 2822}
2764 2823
2765/* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */ 2824/* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */
2825
2766void 2826void
2767xg_remove_scroll_bar (f, scrollbar_id) 2827xg_remove_scroll_bar (f, scrollbar_id)
2768 FRAME_PTR f; 2828 FRAME_PTR f;
@@ -2782,6 +2842,7 @@ xg_remove_scroll_bar (f, scrollbar_id)
2782 in frame F. 2842 in frame F.
2783 TOP/LEFT are the new pixel positions where the bar shall appear. 2843 TOP/LEFT are the new pixel positions where the bar shall appear.
2784 WIDTH, HEIGHT is the size in pixels the bar shall have. */ 2844 WIDTH, HEIGHT is the size in pixels the bar shall have. */
2845
2785void 2846void
2786xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) 2847xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height)
2787 FRAME_PTR f; 2848 FRAME_PTR f;
@@ -2810,6 +2871,7 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height)
2810 2871
2811/* Set the thumb size and position of scroll bar BAR. We are currently 2872/* Set the thumb size and position of scroll bar BAR. We are currently
2812 displaying PORTION out of a whole WHOLE, and our position POSITION. */ 2873 displaying PORTION out of a whole WHOLE, and our position POSITION. */
2874
2813void 2875void
2814xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) 2876xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
2815 struct scroll_bar *bar; 2877 struct scroll_bar *bar;
@@ -2902,6 +2964,7 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
2902 W is the button widget in the tool bar that got pressed, 2964 W is the button widget in the tool bar that got pressed,
2903 CLIENT_DATA is an integer that is the index of the button in the 2965 CLIENT_DATA is an integer that is the index of the button in the
2904 tool bar. 0 is the first button. */ 2966 tool bar. 0 is the first button. */
2967
2905static void 2968static void
2906xg_tool_bar_callback (w, client_data) 2969xg_tool_bar_callback (w, client_data)
2907 GtkWidget *w; 2970 GtkWidget *w;
@@ -2938,6 +3001,7 @@ xg_tool_bar_callback (w, client_data)
2938 WBOX is the handle box widget that enables detach/attach of the tool bar. 3001 WBOX is the handle box widget that enables detach/attach of the tool bar.
2939 W is the tool bar widget. 3002 W is the tool bar widget.
2940 CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ 3003 CLIENT_DATA is a pointer to the frame the tool bar belongs to. */
3004
2941static void 3005static void
2942xg_tool_bar_detach_callback (wbox, w, client_data) 3006xg_tool_bar_detach_callback (wbox, w, client_data)
2943 GtkHandleBox *wbox; 3007 GtkHandleBox *wbox;
@@ -2966,6 +3030,7 @@ xg_tool_bar_detach_callback (wbox, w, client_data)
2966 WBOX is the handle box widget that enables detach/attach of the tool bar. 3030 WBOX is the handle box widget that enables detach/attach of the tool bar.
2967 W is the tool bar widget. 3031 W is the tool bar widget.
2968 CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ 3032 CLIENT_DATA is a pointer to the frame the tool bar belongs to. */
3033
2969static void 3034static void
2970xg_tool_bar_attach_callback (wbox, w, client_data) 3035xg_tool_bar_attach_callback (wbox, w, client_data)
2971 GtkHandleBox *wbox; 3036 GtkHandleBox *wbox;
@@ -2995,6 +3060,7 @@ xg_tool_bar_attach_callback (wbox, w, client_data)
2995 tool bar. 0 is the first button. 3060 tool bar. 0 is the first button.
2996 3061
2997 Returns FALSE to tell GTK to keep processing this event. */ 3062 Returns FALSE to tell GTK to keep processing this event. */
3063
2998static gboolean 3064static gboolean
2999xg_tool_bar_help_callback (w, event, client_data) 3065xg_tool_bar_help_callback (w, event, client_data)
3000 GtkWidget *w; 3066 GtkWidget *w;
@@ -3040,6 +3106,7 @@ xg_tool_bar_help_callback (w, event, client_data)
3040 CLIENT_DATA is unused. 3106 CLIENT_DATA is unused.
3041 3107
3042 Returns FALSE to tell GTK to keep processing this event. */ 3108 Returns FALSE to tell GTK to keep processing this event. */
3109
3043static gboolean 3110static gboolean
3044xg_tool_bar_item_expose_callback (w, event, client_data) 3111xg_tool_bar_item_expose_callback (w, event, client_data)
3045 GtkWidget *w; 3112 GtkWidget *w;
@@ -3070,6 +3137,7 @@ xg_tool_bar_item_expose_callback (w, event, client_data)
3070 CLIENT_DATA is pointing to the frame for this tool bar. 3137 CLIENT_DATA is pointing to the frame for this tool bar.
3071 3138
3072 Returns FALSE to tell GTK to keep processing this event. */ 3139 Returns FALSE to tell GTK to keep processing this event. */
3140
3073static gboolean 3141static gboolean
3074xg_tool_bar_expose_callback (w, event, client_data) 3142xg_tool_bar_expose_callback (w, event, client_data)
3075 GtkWidget *w; 3143 GtkWidget *w;
@@ -3080,6 +3148,8 @@ xg_tool_bar_expose_callback (w, event, client_data)
3080 return FALSE; 3148 return FALSE;
3081} 3149}
3082 3150
3151/* Create a tool bar for frame F. */
3152
3083static void 3153static void
3084xg_create_tool_bar (f) 3154xg_create_tool_bar (f)
3085 FRAME_PTR f; 3155 FRAME_PTR f;
@@ -3133,6 +3203,8 @@ xg_create_tool_bar (f)
3133 SET_FRAME_GARBAGED (f); 3203 SET_FRAME_GARBAGED (f);
3134} 3204}
3135 3205
3206/* Update the tool bar for frame F. Add new buttons and remove old. */
3207
3136void 3208void
3137update_frame_tool_bar (f) 3209update_frame_tool_bar (f)
3138 FRAME_PTR f; 3210 FRAME_PTR f;
@@ -3300,6 +3372,9 @@ update_frame_tool_bar (f)
3300 UNBLOCK_INPUT; 3372 UNBLOCK_INPUT;
3301} 3373}
3302 3374
3375/* Deallocate all resources for the tool bar on frame F.
3376 Remove the tool bar. */
3377
3303void 3378void
3304free_frame_tool_bar (f) 3379free_frame_tool_bar (f)
3305 FRAME_PTR f; 3380 FRAME_PTR f;
diff --git a/src/regex.c b/src/regex.c
index 006b79acba8..71a450f9b23 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1308,6 +1308,7 @@ static const char *re_error_msgid[] =
1308 gettext_noop ("Premature end of regular expression"), /* REG_EEND */ 1308 gettext_noop ("Premature end of regular expression"), /* REG_EEND */
1309 gettext_noop ("Regular expression too big"), /* REG_ESIZE */ 1309 gettext_noop ("Regular expression too big"), /* REG_ESIZE */
1310 gettext_noop ("Unmatched ) or \\)"), /* REG_ERPAREN */ 1310 gettext_noop ("Unmatched ) or \\)"), /* REG_ERPAREN */
1311 gettext_noop ("Range striding over charsets") /* REG_ERANGEX */
1311 }; 1312 };
1312 1313
1313/* Avoiding alloca during matching, to placate r_alloc. */ 1314/* Avoiding alloca during matching, to placate r_alloc. */
@@ -2925,7 +2926,7 @@ regex_compile (pattern, size, syntax, bufp)
2925 if (c > c1) 2926 if (c > c1)
2926 { 2927 {
2927 if (syntax & RE_NO_EMPTY_RANGES) 2928 if (syntax & RE_NO_EMPTY_RANGES)
2928 FREE_STACK_RETURN (REG_ERANGE); 2929 FREE_STACK_RETURN (REG_ERANGEX);
2929 /* Else, repeat the loop. */ 2930 /* Else, repeat the loop. */
2930 } 2931 }
2931 } 2932 }
diff --git a/src/regex.h b/src/regex.h
index 26c589bde92..b1cfd5fdd11 100644
--- a/src/regex.h
+++ b/src/regex.h
@@ -316,7 +316,8 @@ typedef enum
316 /* Error codes we've added. */ 316 /* Error codes we've added. */
317 REG_EEND, /* Premature end. */ 317 REG_EEND, /* Premature end. */
318 REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ 318 REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
319 REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ 319 REG_ERPAREN, /* Unmatched ) or \); not returned from regcomp. */
320 REG_ERANGEX /* Range striding over charsets. */
320} reg_errcode_t; 321} reg_errcode_t;
321 322
322/* This data structure represents a compiled pattern. Before calling 323/* This data structure represents a compiled pattern. Before calling
diff --git a/src/xfns.c b/src/xfns.c
index 3c8035c925a..39262235e8b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1929,7 +1929,7 @@ xic_create_xfontset (f, base_fontname)
1929 char *base_fontname; 1929 char *base_fontname;
1930{ 1930{
1931 XFontSet xfs = NULL; 1931 XFontSet xfs = NULL;
1932 char **missing_list; 1932 char **missing_list = NULL;
1933 int missing_count; 1933 int missing_count;
1934 char *def_string; 1934 char *def_string;
1935 Lisp_Object rest, frame; 1935 Lisp_Object rest, frame;
@@ -1940,6 +1940,7 @@ xic_create_xfontset (f, base_fontname)
1940 struct frame *cf = XFRAME (frame); 1940 struct frame *cf = XFRAME (frame);
1941 if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf) 1941 if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf)
1942 && FRAME_X_DISPLAY_INFO (cf) == FRAME_X_DISPLAY_INFO (f) 1942 && FRAME_X_DISPLAY_INFO (cf) == FRAME_X_DISPLAY_INFO (f)
1943 && FRAME_XIC_BASE_FONTNAME (cf)
1943 && !strcmp (FRAME_XIC_BASE_FONTNAME (cf), base_fontname)) 1944 && !strcmp (FRAME_XIC_BASE_FONTNAME (cf), base_fontname))
1944 { 1945 {
1945 xfs = FRAME_XIC_FONTSET (cf); 1946 xfs = FRAME_XIC_FONTSET (cf);
@@ -1948,12 +1949,14 @@ xic_create_xfontset (f, base_fontname)
1948 } 1949 }
1949 1950
1950 if (!xfs) 1951 if (!xfs)
1951 /* New fontset. */ 1952 {
1952 xfs = XCreateFontSet (FRAME_X_DISPLAY (f), 1953 /* New fontset. */
1953 base_fontname, &missing_list, 1954 xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
1954 &missing_count, &def_string); 1955 base_fontname, &missing_list,
1955 if (missing_list) 1956 &missing_count, &def_string);
1956 XFreeStringList (missing_list); 1957 if (missing_list)
1958 XFreeStringList (missing_list);
1959 }
1957 1960
1958 if (FRAME_XIC_BASE_FONTNAME (f)) 1961 if (FRAME_XIC_BASE_FONTNAME (f))
1959 xfree (FRAME_XIC_BASE_FONTNAME (f)); 1962 xfree (FRAME_XIC_BASE_FONTNAME (f));
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 9a6a7ccefb8..5b53c0ca34d 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -73,33 +73,35 @@ static int ice_fd = -1;
73 73
74static int doing_interact = False; 74static int doing_interact = False;
75 75
76/* The session manager object for the session manager connection */ 76/* The session manager object for the session manager connection. */
77 77
78static SmcConn smc_conn; 78static SmcConn smc_conn;
79 79
80/* The client session id for this session */ 80/* The client session id for this session. */
81
81static char *client_id; 82static char *client_id;
82 83
83/* The full path name to the Emacs program */ 84/* The full path name to the Emacs program. */
85
84static char *emacs_program; 86static char *emacs_program;
85 87
86/* The client session id for this session as a lisp object. */ 88/* The client session id for this session as a lisp object. */
87 89
88Lisp_Object Vx_session_id; 90Lisp_Object Vx_session_id;
89 91
90/* The id we had the previous session. This is only available if we 92/* The id we had the previous session. This is only available if we
91 have been started by the session manager with SMID_OPT. */ 93 have been started by the session manager with SMID_OPT. */
92 94
93Lisp_Object Vx_session_previous_id; 95Lisp_Object Vx_session_previous_id;
94 96
95/* The option we tell the session manager to start Emacs with when 97/* The option we tell the session manager to start Emacs with when
96 restarting Emacs. The client_id is appended. */ 98 restarting Emacs. The client_id is appended. */
97 99
98#define SMID_OPT "--smid=" 100#define SMID_OPT "--smid="
99 101
100 102
101/* The option to start Emacs without the splash screen when 103/* The option to start Emacs without the splash screen when
102 restarting Emacs. */ 104 restarting Emacs. */
103 105
104#define NOSPLASH_OPT "--no-splash" 106#define NOSPLASH_OPT "--no-splash"
105 107
@@ -107,6 +109,7 @@ Lisp_Object Vx_session_previous_id;
107/* Handle any messages from the session manager. If no connection is 109/* Handle any messages from the session manager. If no connection is
108 open to a session manager, just return 0. 110 open to a session manager, just return 0.
109 Otherwise returns 1 if SAVE_SESSION_EVENT is stored in buffer BUFP. */ 111 Otherwise returns 1 if SAVE_SESSION_EVENT is stored in buffer BUFP. */
112
110int 113int
111x_session_check_input (bufp) 114x_session_check_input (bufp)
112 struct input_event *bufp; 115 struct input_event *bufp;
@@ -125,7 +128,7 @@ x_session_check_input (bufp)
125 /* Reset this so wo can check kind after callbacks have been called by 128 /* Reset this so wo can check kind after callbacks have been called by
126 IceProcessMessages. The smc_interact_CB sets the kind to 129 IceProcessMessages. The smc_interact_CB sets the kind to
127 SAVE_SESSION_EVENT, but we don't know beforehand if that callback 130 SAVE_SESSION_EVENT, but we don't know beforehand if that callback
128 will be called. */ 131 will be called. */
129 emacs_event.kind = NO_EVENT; 132 emacs_event.kind = NO_EVENT;
130 133
131 if (select (ice_fd+1, &read_fds, 134 if (select (ice_fd+1, &read_fds,
@@ -142,7 +145,7 @@ x_session_check_input (bufp)
142 145
143 146
144 /* Check if smc_interact_CB was called and we shall generate a 147 /* Check if smc_interact_CB was called and we shall generate a
145 SAVE_SESSION_EVENT. */ 148 SAVE_SESSION_EVENT. */
146 if (emacs_event.kind == NO_EVENT) 149 if (emacs_event.kind == NO_EVENT)
147 return 0; 150 return 0;
148 151
@@ -150,7 +153,8 @@ x_session_check_input (bufp)
150 return 1; 153 return 1;
151} 154}
152 155
153/* Return non-zero if we have a connection to a session manager.*/ 156/* Return non-zero if we have a connection to a session manager. */
157
154int 158int
155x_session_have_connection () 159x_session_have_connection ()
156{ 160{
@@ -159,7 +163,8 @@ x_session_have_connection ()
159 163
160/* This is called when the session manager says it is OK to interact with the 164/* This is called when the session manager says it is OK to interact with the
161 user. Here we set the kind to SAVE_SESSION_EVENT so an event is generated. 165 user. Here we set the kind to SAVE_SESSION_EVENT so an event is generated.
162 Then lisp code can interact with the user. */ 166 Then lisp code can interact with the user. */
167
163static void 168static void
164smc_interact_CB (smcConn, clientData) 169smc_interact_CB (smcConn, clientData)
165 SmcConn smcConn; 170 SmcConn smcConn;
@@ -175,7 +180,8 @@ smc_interact_CB (smcConn, clientData)
175 are started in the correct directory. 180 are started in the correct directory.
176 181
177 If this is a shutdown and we can request to interact with the user, 182 If this is a shutdown and we can request to interact with the user,
178 we do so, because we don't know what the lisp code might do. */ 183 we do so, because we don't know what the lisp code might do. */
184
179static void 185static void
180smc_save_yourself_CB (smcConn, 186smc_save_yourself_CB (smcConn,
181 clientData, 187 clientData,
@@ -202,7 +208,7 @@ smc_save_yourself_CB (smcConn,
202 char cwd[MAXPATHLEN+1]; 208 char cwd[MAXPATHLEN+1];
203 char *smid_opt; 209 char *smid_opt;
204 210
205 /* How to start a new instance of Emacs */ 211 /* How to start a new instance of Emacs. */
206 props[props_idx] = &prop_ptr[props_idx]; 212 props[props_idx] = &prop_ptr[props_idx];
207 props[props_idx]->name = SmCloneCommand; 213 props[props_idx]->name = SmCloneCommand;
208 props[props_idx]->type = SmLISTofARRAY8; 214 props[props_idx]->type = SmLISTofARRAY8;
@@ -212,7 +218,7 @@ smc_save_yourself_CB (smcConn,
212 props[props_idx]->vals[0].value = emacs_program; 218 props[props_idx]->vals[0].value = emacs_program;
213 ++props_idx; 219 ++props_idx;
214 220
215 /* The name of the program */ 221 /* The name of the program. */
216 props[props_idx] = &prop_ptr[props_idx]; 222 props[props_idx] = &prop_ptr[props_idx];
217 props[props_idx]->name = SmProgram; 223 props[props_idx]->name = SmProgram;
218 props[props_idx]->type = SmARRAY8; 224 props[props_idx]->type = SmARRAY8;
@@ -222,11 +228,11 @@ smc_save_yourself_CB (smcConn,
222 props[props_idx]->vals[0].value = SDATA (Vinvocation_name); 228 props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
223 ++props_idx; 229 ++props_idx;
224 230
225 /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx --no-splash). */ 231 /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx --no-splash). */
226 props[props_idx] = &prop_ptr[props_idx]; 232 props[props_idx] = &prop_ptr[props_idx];
227 props[props_idx]->name = SmRestartCommand; 233 props[props_idx]->name = SmRestartCommand;
228 props[props_idx]->type = SmLISTofARRAY8; 234 props[props_idx]->type = SmLISTofARRAY8;
229 props[props_idx]->num_vals = 3; /* /path/to/emacs, --smid=xxx --no-splash */ 235 props[props_idx]->num_vals = 3; /* /path/to/emacs, --smid=xxx --no-splash */
230 props[props_idx]->vals = &values[val_idx]; 236 props[props_idx]->vals = &values[val_idx];
231 props[props_idx]->vals[0].length = strlen (emacs_program); 237 props[props_idx]->vals[0].length = strlen (emacs_program);
232 props[props_idx]->vals[0].value = emacs_program; 238 props[props_idx]->vals[0].value = emacs_program;
@@ -243,7 +249,7 @@ smc_save_yourself_CB (smcConn,
243 val_idx += 3; 249 val_idx += 3;
244 ++props_idx; 250 ++props_idx;
245 251
246 /* User id */ 252 /* User id. */
247 props[props_idx] = &prop_ptr[props_idx]; 253 props[props_idx] = &prop_ptr[props_idx];
248 props[props_idx]->name = SmUserID; 254 props[props_idx]->name = SmUserID;
249 props[props_idx]->type = SmARRAY8; 255 props[props_idx]->type = SmARRAY8;
@@ -253,7 +259,7 @@ smc_save_yourself_CB (smcConn,
253 props[props_idx]->vals[0].value = SDATA (Vuser_login_name); 259 props[props_idx]->vals[0].value = SDATA (Vuser_login_name);
254 ++props_idx; 260 ++props_idx;
255 261
256 /* The current directory property, not mandatory */ 262 /* The current directory property, not mandatory. */
257#ifdef HAVE_GETCWD 263#ifdef HAVE_GETCWD
258 if (getcwd (cwd, MAXPATHLEN+1) != 0) 264 if (getcwd (cwd, MAXPATHLEN+1) != 0)
259#else 265#else
@@ -275,18 +281,19 @@ smc_save_yourself_CB (smcConn,
275 281
276 xfree (smid_opt); 282 xfree (smid_opt);
277 283
278 /* See if we maybe shall interact with the user. */ 284 /* See if we maybe shall interact with the user. */
279 if (interactStyle != SmInteractStyleAny 285 if (interactStyle != SmInteractStyleAny
280 || ! shutdown 286 || ! shutdown
281 || saveType == SmSaveLocal 287 || saveType == SmSaveLocal
282 || ! SmcInteractRequest (smcConn, SmDialogNormal, smc_interact_CB, 0)) 288 || ! SmcInteractRequest (smcConn, SmDialogNormal, smc_interact_CB, 0))
283 { 289 {
284 /* No interaction, we are done saving ourself. */ 290 /* No interaction, we are done saving ourself. */
285 SmcSaveYourselfDone (smcConn, True); 291 SmcSaveYourselfDone (smcConn, True);
286 } 292 }
287} 293}
288 294
289/* According to the SM specification, this shall close the connection */ 295/* According to the SM specification, this shall close the connection. */
296
290static void 297static void
291smc_die_CB (smcConn, clientData) 298smc_die_CB (smcConn, clientData)
292 SmcConn smcConn; 299 SmcConn smcConn;
@@ -300,7 +307,8 @@ smc_die_CB (smcConn, clientData)
300 According to the SM specification, we should not interact with the 307 According to the SM specification, we should not interact with the
301 user between smc_save_yourself_CB is called and until smc_save_complete_CB 308 user between smc_save_yourself_CB is called and until smc_save_complete_CB
302 is called. It seems like a lot of job to implement this and it doesn't 309 is called. It seems like a lot of job to implement this and it doesn't
303 even seem necessary. */ 310 even seem necessary. */
311
304static void 312static void
305smc_save_complete_CB (smcConn, clientData) 313smc_save_complete_CB (smcConn, clientData)
306 SmcConn smcConn; 314 SmcConn smcConn;
@@ -318,7 +326,8 @@ smc_shutdown_cancelled_CB (smcConn, clientData)
318} 326}
319 327
320/* Error handlers for SM and ICE. We don't want to exit Emacs just 328/* Error handlers for SM and ICE. We don't want to exit Emacs just
321 because there is some error in the session management. */ 329 because there is some error in the session management. */
330
322static void 331static void
323smc_error_handler (smcConn, 332smc_error_handler (smcConn,
324 swap, 333 swap,
@@ -335,7 +344,7 @@ smc_error_handler (smcConn,
335 int severity; 344 int severity;
336 SmPointer values; 345 SmPointer values;
337{ 346{
338 /* Empty */ 347 /* Empty */
339} 348}
340 349
341static void 350static void
@@ -354,7 +363,7 @@ ice_error_handler (iceConn,
354 int severity; 363 int severity;
355 IcePointer values; 364 IcePointer values;
356{ 365{
357 /* Empty */ 366 /* Empty */
358} 367}
359 368
360 369
@@ -362,12 +371,13 @@ static void
362ice_io_error_handler (iceConn) 371ice_io_error_handler (iceConn)
363 IceConn iceConn; 372 IceConn iceConn;
364{ 373{
365 /* Connection probably gone. */ 374 /* Connection probably gone. */
366 ice_fd = -1; 375 ice_fd = -1;
367} 376}
368 377
369/* This is called when the ICE connection is created or closed. The SM library 378/* This is called when the ICE connection is created or closed. The SM library
370 uses ICE as it transport protocol. */ 379 uses ICE as it transport protocol. */
380
371static void 381static void
372ice_conn_watch_CB (iceConn, clientData, opening, watchData) 382ice_conn_watch_CB (iceConn, clientData, opening, watchData)
373 IceConn iceConn; 383 IceConn iceConn;
@@ -400,6 +410,7 @@ ice_conn_watch_CB (iceConn, clientData, opening, watchData)
400} 410}
401 411
402/* Create the client leader window. */ 412/* Create the client leader window. */
413
403static void 414static void
404create_client_leader_window (dpyinfo, client_id) 415create_client_leader_window (dpyinfo, client_id)
405 struct x_display_info *dpyinfo; 416 struct x_display_info *dpyinfo;
@@ -426,7 +437,8 @@ create_client_leader_window (dpyinfo, client_id)
426 dpyinfo->client_leader_window = w; 437 dpyinfo->client_leader_window = w;
427} 438}
428 439
429/* Try to open a connection to the session manager. */ 440/* Try to open a connection to the session manager. */
441
430void 442void
431x_session_initialize (dpyinfo) 443x_session_initialize (dpyinfo)
432 struct x_display_info *dpyinfo; 444 struct x_display_info *dpyinfo;
@@ -438,17 +450,17 @@ x_session_initialize (dpyinfo)
438 int name_len = 0; 450 int name_len = 0;
439 451
440 /* Check if we where started by the session manager. If so, we will 452 /* Check if we where started by the session manager. If so, we will
441 have a previous id. */ 453 have a previous id. */
442 if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id)) 454 if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
443 previous_id = SDATA (Vx_session_previous_id); 455 previous_id = SDATA (Vx_session_previous_id);
444 456
445 /* Construct the path to the Emacs program. */ 457 /* Construct the path to the Emacs program. */
446 if (! EQ (Vinvocation_directory, Qnil)) 458 if (! EQ (Vinvocation_directory, Qnil))
447 name_len += strlen (SDATA (Vinvocation_directory)); 459 name_len += strlen (SDATA (Vinvocation_directory));
448 name_len += strlen (SDATA (Vinvocation_name)); 460 name_len += strlen (SDATA (Vinvocation_name));
449 461
450 /* This malloc will not be freed, but it is only done once, and hopefully 462 /* This malloc will not be freed, but it is only done once, and hopefully
451 not very large */ 463 not very large */
452 emacs_program = xmalloc (name_len + 1); 464 emacs_program = xmalloc (name_len + 1);
453 emacs_program[0] = '\0'; 465 emacs_program[0] = '\0';
454 466
@@ -457,7 +469,7 @@ x_session_initialize (dpyinfo)
457 strcat (emacs_program, SDATA (Vinvocation_name)); 469 strcat (emacs_program, SDATA (Vinvocation_name));
458 470
459 /* The SM protocol says all callbacks are mandatory, so set up all 471 /* The SM protocol says all callbacks are mandatory, so set up all
460 here and in the mask passed to SmcOpenConnection */ 472 here and in the mask passed to SmcOpenConnection. */
461 callbacks.save_yourself.callback = smc_save_yourself_CB; 473 callbacks.save_yourself.callback = smc_save_yourself_CB;
462 callbacks.save_yourself.client_data = 0; 474 callbacks.save_yourself.client_data = 0;
463 callbacks.die.callback = smc_die_CB; 475 callbacks.die.callback = smc_die_CB;
@@ -467,17 +479,17 @@ x_session_initialize (dpyinfo)
467 callbacks.shutdown_cancelled.callback = smc_shutdown_cancelled_CB; 479 callbacks.shutdown_cancelled.callback = smc_shutdown_cancelled_CB;
468 callbacks.shutdown_cancelled.client_data = 0; 480 callbacks.shutdown_cancelled.client_data = 0;
469 481
470 /* Set error handlers. */ 482 /* Set error handlers. */
471 SmcSetErrorHandler (smc_error_handler); 483 SmcSetErrorHandler (smc_error_handler);
472 IceSetErrorHandler (ice_error_handler); 484 IceSetErrorHandler (ice_error_handler);
473 IceSetIOErrorHandler (ice_io_error_handler); 485 IceSetIOErrorHandler (ice_io_error_handler);
474 486
475 /* Install callback for when connection status changes. */ 487 /* Install callback for when connection status changes. */
476 IceAddConnectionWatch (ice_conn_watch_CB, 0); 488 IceAddConnectionWatch (ice_conn_watch_CB, 0);
477 489
478 /* Open the connection to the session manager. A failure is not 490 /* Open the connection to the session manager. A failure is not
479 critical, it usually means that no session manager is running. 491 critical, it usually means that no session manager is running.
480 The errorstring is here for debugging. */ 492 The errorstring is here for debugging. */
481 smc_conn = SmcOpenConnection (NULL, NULL, 1, 0, 493 smc_conn = SmcOpenConnection (NULL, NULL, 1, 0,
482 (SmcSaveYourselfProcMask| 494 (SmcSaveYourselfProcMask|
483 SmcDieProcMask| 495 SmcDieProcMask|