From 4dbdb9eb939fffaa7dcf1b39053913ff1f799c7f Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 28 Jul 2006 11:11:51 +0000 Subject: [PATCH 001/361] *** empty log message *** --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 79271fe23fa..2f51ce899f5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-07-28 Kim F. Storm + + * alloc.c (valid_pointer_p): New function (from valid_lisp_object_p). + (valid_lisp_object_p): Use it to check for valid SUBRP obj. + 2006-07-26 Chong Yidong * keyboard.c (read_char): New arg END_TIME specifying timeout. From 7ffb6955ce67ed159ae2386b053df929d6220725 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 28 Jul 2006 11:12:23 +0000 Subject: [PATCH 002/361] (valid_pointer_p): New function (from valid_lisp_object_p). (valid_lisp_object_p): Use it to check for valid SUBRP obj. --- src/alloc.c | 51 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index b058b29c697..a861504ab89 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4606,6 +4606,27 @@ mark_stack () #endif /* GC_MARK_STACK != 0 */ +/* Determine whether it is safe to access memory at address P. */ +int valid_pointer_p (p) + void *p; +{ + int fd; + + /* Obviously, we cannot just access it (we would SEGV trying), so we + trick the o/s to tell us whether p is a valid pointer. + Unfortunately, we cannot use NULL_DEVICE here, as emacs_write may + not validate p in that case. */ + + if ((fd = emacs_open ("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0) + { + int valid = (emacs_write (fd, (char *)p, 16) == 16); + emacs_close (fd); + unlink ("__Valid__Lisp__Object__"); + return valid; + } + + return -1; +} /* Return 1 if OBJ is a valid lisp object. Return 0 if OBJ is NOT a valid lisp object. @@ -4618,9 +4639,7 @@ valid_lisp_object_p (obj) Lisp_Object obj; { void *p; -#if !GC_MARK_STACK - int fd; -#else +#if GC_MARK_STACK struct mem_node *m; #endif @@ -4632,26 +4651,22 @@ valid_lisp_object_p (obj) return 1; #if !GC_MARK_STACK - /* We need to determine whether it is safe to access memory at - address P. Obviously, we cannot just access it (we would SEGV - trying), so we trick the o/s to tell us whether p is a valid - pointer. Unfortunately, we cannot use NULL_DEVICE here, as - emacs_write may not validate p in that case. */ - if ((fd = emacs_open ("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0) - { - int valid = (emacs_write (fd, (char *)p, 16) == 16); - emacs_close (fd); - unlink ("__Valid__Lisp__Object__"); - return valid; - } - - return -1; + return valid_pointer_p (p); #else m = mem_find (p); if (m == MEM_NIL) - return 0; + { + int valid = valid_pointer_p (p); + if (valid <= 0) + return valid; + + if (SUBRP (obj)) + return 1; + + return 0; + } switch (m->type) { From 210f78ee1eb3056f354cec5e830a44bdb04c7c22 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Fri, 28 Jul 2006 12:10:33 +0000 Subject: [PATCH 003/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 30aee0030ba..a09227f4136 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-07-29 Nick Roberts + + * progmodes/gdb-ui.el (gdb-info-breakpoints-custom): Use different + faces for enable character. + 2006-07-28 Nick Roberts * Makefile.in (recompile): Update comment to reflect change From a9502111b2e211e87594dcc68ae5d53a6951550b Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Fri, 28 Jul 2006 12:11:09 +0000 Subject: [PATCH 004/361] (gdb-info-breakpoints-custom): Use different faces for enable character. --- lisp/progmodes/gdb-ui.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index dca6fa16df0..466ef70ff23 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -1754,6 +1754,7 @@ static char *magick[] = { (gdb-remove-breakpoint-icons (point-min) (point-max))))) (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) (save-excursion + (let ((buffer-read-only nil)) (goto-char (point-min)) (while (< (point) (- (point-max) 1)) (forward-line 1) @@ -1762,14 +1763,19 @@ static char *magick[] = { (looking-at "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)") (setq bptno (match-string 1)) (setq flag (char-after (match-beginning 2))) + (add-text-properties + (match-beginning 2) (match-end 2) + (if (eq flag ?y) + '(face font-lock-warning-face) + '(face font-lock-type-face))) (beginning-of-line) (if (re-search-forward " in \\(.*\\) at\\s-+" nil t) (progn - (let ((buffer-read-only nil)) - (add-text-properties (match-beginning 1) (match-end 1) - '(face font-lock-function-name-face))) + (add-text-properties + (match-beginning 1) (match-end 1) + '(face font-lock-function-name-face)) (looking-at "\\(\\S-+\\):\\([0-9]+\\)") - (let ((line (match-string 2)) (buffer-read-only nil) + (let ((line (match-string 2)) (file (match-string 1))) (add-text-properties (line-beginning-position) (line-end-position) @@ -1799,7 +1805,7 @@ static char *magick[] = { (list (concat gdb-server-prefix "info source\n") `(lambda () (gdb-get-location ,bptno ,line ,flag)))))))))) - (end-of-line))))) + (end-of-line)))))) (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) (defun gdb-mouse-set-clear-breakpoint (event) From a8da2abd40cd6fb47ebd139fe02552018ace5821 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 28 Jul 2006 18:08:11 +0000 Subject: [PATCH 005/361] * cus-edit.el (custom-no-edit): Revert 2006-07-27 change, so that self-insert-command keys don't activate buttons. (custom-mode-map): Just don't bind "\C-m" to `custom-no-edit'. --- lisp/ChangeLog | 6 ++++++ lisp/cus-edit.el | 9 ++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a09227f4136..8fd1f8a4255 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-07-28 Chong Yidong + + * cus-edit.el (custom-no-edit): Revert 2006-07-27 change, so that + self-insert-command keys don't activate buttons. + (custom-mode-map): Just don't bind "\C-m" to `custom-no-edit'. + 2006-07-29 Nick Roberts * progmodes/gdb-ui.el (gdb-info-breakpoints-custom): Use different diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 15f43080aff..0493dd0894c 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4435,9 +4435,7 @@ The format is suitable for use with `easy-menu-define'." ;; Actually, this misfeature of dense keymaps was fixed on 2001-11-26. (let ((map (make-keymap))) (set-keymap-parent map widget-keymap) - (define-key map [remap self-insert-command] - 'custom-no-edit) - (define-key map "\^m" 'custom-no-edit) + (define-key map [remap self-insert-command] 'custom-no-edit) (define-key map " " 'scroll-up) (define-key map "\177" 'scroll-down) (define-key map "\C-c\C-c" 'Custom-set) @@ -4452,10 +4450,7 @@ The format is suitable for use with `easy-menu-define'." (defun custom-no-edit (pos &optional event) "Invoke button at POS, or refuse to allow editing of Custom buffer." (interactive "@d") - (let ((button (get-char-property pos 'button))) - (if button - (widget-apply-action button event) - (error "You can't edit this part of the Custom buffer")))) + (error "You can't edit this part of the Custom buffer")) (easy-menu-define Custom-mode-menu custom-mode-map From 91395839184a2d726650fe9170140a5009ff3837 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Fri, 28 Jul 2006 21:00:15 +0000 Subject: [PATCH 006/361] (wdired-change-to-wdired-mode, wdired-change-to-dired-mode): Throw error if buffer is not in Dired and Wdired mode, respectively. --- lisp/ChangeLog | 5 +++++ lisp/wdired.el | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8fd1f8a4255..70a83fc4345 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-07-28 Bill Atkins (tiny change) + + * wdired.el (wdired-change-to-wdired-mode, wdired-change-to-dired-mode): + Throw error if buffer is not in Dired and Wdired mode, respectively. + 2006-07-28 Chong Yidong * cus-edit.el (custom-no-edit): Revert 2006-07-27 change, so that diff --git a/lisp/wdired.el b/lisp/wdired.el index 1363181524c..bc70e0ddcfd 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -238,6 +238,8 @@ in disk. See `wdired-mode'." (interactive) + (or (eq major-mode 'dired-mode) + (error "Not a Dired buffer")) (set (make-local-variable 'wdired-old-content) (buffer-substring (point-min) (point-max))) (set (make-local-variable 'wdired-old-point) (point)) @@ -328,6 +330,8 @@ non-nil means return old filename." (defun wdired-change-to-dired-mode () "Change the mode back to dired." + (or (eq major-mode 'wdired-mode) + (error "Not a Wdired buffer")) (let ((inhibit-read-only t)) (remove-text-properties (point-min) (point-max) '(read-only nil local-map nil))) From 5a6116642e6d614a53ee84c9acf61672759c00b1 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 28 Jul 2006 23:03:05 +0000 Subject: [PATCH 007/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 70a83fc4345..a83a56e288a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-07-29 Kim F. Storm + + * progmodes/grep.el (grep-tag-default): New function. + (grep-default-command, grep-read-regexp): Use it. + 2006-07-28 Bill Atkins (tiny change) * wdired.el (wdired-change-to-wdired-mode, wdired-change-to-dired-mode): From 7cb0d0ef5aa4369c88e1234e6ddc0cc5d45bd0aa Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 28 Jul 2006 23:03:18 +0000 Subject: [PATCH 008/361] (grep-tag-default): New function. (grep-default-command, grep-read-regexp): Use it. --- lisp/progmodes/grep.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index e7d85910a63..96f449c2b05 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -455,13 +455,17 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." (search-forward "--color" nil t)) t))))) +(defun grep-tag-default () + (or (and transient-mark-mode mark-active + (/= (point) (mark)) + (buffer-substring-no-properties (point) (mark))) + (funcall (or find-tag-default-function + (get major-mode 'find-tag-default-function) + 'find-tag-default)) + "")) + (defun grep-default-command () - (let ((tag-default - (shell-quote-argument - (or (funcall (or find-tag-default-function - (get major-mode 'find-tag-default-function) - 'find-tag-default)) - ""))) + (let ((tag-default (shell-quote-argument (grep-tag-default))) (sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)") (grep-default (or (car grep-history) grep-command))) ;; Replace the thing matching for with that around cursor. @@ -590,15 +594,11 @@ substitution string. Note dynamic scoping of variables.") (defun grep-read-regexp () "Read regexp arg for interactive grep." - (let ((default - (or (funcall (or find-tag-default-function - (get major-mode 'find-tag-default-function) - 'find-tag-default)) - ""))) + (let ((default (grep-tag-default))) (read-string (concat "Search for" (if (and default (> (length default) 0)) - (format " (default %s): " default) ": ")) + (format " (default \"%s\"): " default) ": ")) nil 'grep-regexp-history default))) (defun grep-read-files (regexp) From a912bc0d0aef24b7694507b35caef0f3f812a781 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 28 Jul 2006 23:19:56 +0000 Subject: [PATCH 009/361] *** empty log message *** --- lisp/ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a83a56e288a..f0099a15514 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * progmodes/grep.el (grep-tag-default): New function. (grep-default-command, grep-read-regexp): Use it. + (grep-read-files): Use car of grep-files-history or grep-files-aliases + as default if nothing else applies. 2006-07-28 Bill Atkins (tiny change) From bcdf86fb51ea5a3860aaade93276f2661cbc70b2 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 28 Jul 2006 23:20:21 +0000 Subject: [PATCH 010/361] (grep-read-files): Use car of grep-files-history or grep-files-aliases as default if nothing else applies. --- lisp/progmodes/grep.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 96f449c2b05..1c29bfe9cc8 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -620,7 +620,9 @@ substitution string. Note dynamic scoping of variables.") (cdr alias))) (and fn (let ((ext (file-name-extension fn))) - (and ext (concat "*." ext)))))) + (and ext (concat "*." ext)))) + (car grep-files-history) + (car (car grep-files-aliases)))) (files (read-string (concat "Search for \"" regexp "\" in files" From 464dfe8f0ac72820c0a1f1de4dbd2a36cc865b44 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 01:52:29 +0000 Subject: [PATCH 011/361] (Transient Mark): Clarify that region never disappears when Transient Mark mode is off, and not when it is on. --- man/mark.texi | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/man/mark.texi b/man/mark.texi index cf7b87366e8..7429b67db2b 100644 --- a/man/mark.texi +++ b/man/mark.texi @@ -139,21 +139,23 @@ have a text terminal where typing @kbd{C-@key{SPC}} does not produce On a terminal that supports colors, Emacs has the ability to highlight the current region. But normally it does not. Why not? - Once you have set the mark in a buffer, there is @emph{always} a -region in that buffer. This is because every command that sets the -mark also activates it, and nothing ever deactivates it. Highlighting -the region all the time would be a nuisance. So normally Emacs -highlights the region only immediately after you have selected one -with the mouse. + In the normal mode of use, every command that sets the mark also +activates it, and nothing ever deactivates it. Thus, once you have +set the mark in a buffer, there is @emph{always} a region in that +buffer. Highlighting the region all the time would be a nuisance. So +normally Emacs highlights the region only immediately after you have +selected one with the mouse. If you want region highlighting, you can use Transient Mark mode. -This is a more rigid mode of operation in which the region always -``lasts'' only until you use it; you explicitly must set up a region -for each command that uses one. In Transient Mark mode, most of the -time there is no region; therefore, highlighting the region when it -exists is useful and not annoying. When Transient Mark mode is -enabled, Emacs always highlights the region whenever there is a -region. +This is a more rigid mode of operation in which the region ``lasts'' +only until you use it; operating on the region text deactivates the +mark, so there is no region any more. Therefore, you must explicitly +set up a region for each command that uses one. + + When Transient Mark mode is enabled, Emacs highlights the region, +whenever there is a region. In Transient Mark mode, most of the time +there is no region; therefore, highlighting the region when it exists +is useful and not annoying. @findex transient-mark-mode To enable Transient Mark mode, type @kbd{M-x transient-mark-mode}. From 69b9efaa09b5fe495b5520af1a44f7f84dfd6b90 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 01:53:31 +0000 Subject: [PATCH 012/361] Whitespace change. --- src/alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/alloc.c b/src/alloc.c index a861504ab89..4c1a81e7c92 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4607,7 +4607,8 @@ mark_stack () /* Determine whether it is safe to access memory at address P. */ -int valid_pointer_p (p) +int +valid_pointer_p (p) void *p; { int fd; From 5e093f4432b787ddf421b96abfe5f4c04554188a Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 01:54:16 +0000 Subject: [PATCH 013/361] (safe_run_hooks_1): Don't crash if Vrun_hooks is nil. --- src/keyboard.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/keyboard.c b/src/keyboard.c index 23e10aefac1..95d880d1209 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2032,6 +2032,8 @@ static Lisp_Object safe_run_hooks_1 (hook) Lisp_Object hook; { + if (NILP (Vrun_hooks)) + return Qnil; return call1 (Vrun_hooks, Vinhibit_quit); } From 9e62c96292a11f1905fb45881c3996832f6265d1 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 01:56:35 +0000 Subject: [PATCH 014/361] (update_menu_bar): New arg HOOKS_RUN. Callers changed. Used to avoid running the hooks over and over for each frame. (prepare_menu_bars): Pass value from update_menu_bar as HOOKS_RUN of next call. --- src/xdisp.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 22be60f7eb8..9911f47c2a4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -900,7 +900,7 @@ static void redisplay_window P_ ((Lisp_Object, int)); static Lisp_Object redisplay_window_error (); static Lisp_Object redisplay_window_0 P_ ((Lisp_Object)); static Lisp_Object redisplay_window_1 P_ ((Lisp_Object)); -static void update_menu_bar P_ ((struct frame *, int)); +static int update_menu_bar P_ ((struct frame *, int, int)); static int try_window_reusing_current_matrix P_ ((struct window *)); static int try_window_id P_ ((struct window *)); static int display_line P_ ((struct it *)); @@ -9036,6 +9036,9 @@ prepare_menu_bars () { Lisp_Object tail, frame; int count = SPECPDL_INDEX (); + /* 1 means that update_menu_bar has run its hooks + so any further calls to update_menu_bar shouldn't do so again. */ + int menu_bar_hooks_run = 0; record_unwind_save_match_data (); @@ -9067,7 +9070,7 @@ prepare_menu_bars () } GCPRO1 (tail); - update_menu_bar (f, 0); + menu_bar_hooks_run = update_menu_bar (f, 0, menu_bar_hooks_run); #ifdef HAVE_WINDOW_SYSTEM update_tool_bar (f, 0); #ifdef MAC_OS @@ -9082,7 +9085,7 @@ prepare_menu_bars () else { struct frame *sf = SELECTED_FRAME (); - update_menu_bar (sf, 1); + update_menu_bar (sf, 1, 0); #ifdef HAVE_WINDOW_SYSTEM update_tool_bar (sf, 1); #ifdef MAC_OS @@ -9103,12 +9106,18 @@ prepare_menu_bars () before we start to fill in any display lines, because it can call eval. - If SAVE_MATCH_DATA is non-zero, we must save and restore it here. */ + If SAVE_MATCH_DATA is non-zero, we must save and restore it here. -static void -update_menu_bar (f, save_match_data) + If HOOKS_RUN is 1, that means a previous call to update_menu_bar + already ran the menu bar hooks for this redisplay, so there + is no need to run them again. The return value is the + updated value of this flag, to pass to the next call. */ + +static int +update_menu_bar (f, save_match_data, hooks_run) struct frame *f; int save_match_data; + int hooks_run; { Lisp_Object window; register struct window *w; @@ -9173,15 +9182,21 @@ update_menu_bar (f, save_match_data) specbind (Qoverriding_local_map, Qnil); } - /* Run the Lucid hook. */ - safe_run_hooks (Qactivate_menubar_hook); + if (!hooks_run) + { + /* Run the Lucid hook. */ + safe_run_hooks (Qactivate_menubar_hook); - /* If it has changed current-menubar from previous value, - really recompute the menu-bar from the value. */ - if (! NILP (Vlucid_menu_bar_dirty_flag)) - call0 (Qrecompute_lucid_menubar); + /* If it has changed current-menubar from previous value, + really recompute the menu-bar from the value. */ + if (! NILP (Vlucid_menu_bar_dirty_flag)) + call0 (Qrecompute_lucid_menubar); + + safe_run_hooks (Qmenu_bar_update_hook); + + hooks_run = 1; + } - safe_run_hooks (Qmenu_bar_update_hook); FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); /* Redisplay the menu bar in case we changed it. */ @@ -9210,6 +9225,8 @@ update_menu_bar (f, save_match_data) set_buffer_internal_1 (prev); } } + + return hooks_run; } From 418ca4d22a6bb3aa5bd4584f21ed4c7da12e0b80 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 01:57:38 +0000 Subject: [PATCH 015/361] (lookup_named_face, Fdisplay_supports_face_attributes_p): Add conditional aborts for clarity. --- src/xfaces.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xfaces.c b/src/xfaces.c index f67ea61b37a..99355cca6af 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5717,6 +5717,8 @@ lookup_named_face (f, symbol, c, signal_p) if (!realize_basic_faces (f)) return -1; default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); + if (default_face == NULL) + abort (); /* realize_basic_faces must have set it up */ } if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p)) @@ -6221,6 +6223,8 @@ face for italic. */) if (! realize_basic_faces (f)) error ("Cannot realize default face"); def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); + if (def_face == NULL) + abort (); /* realize_basic_faces must have set it up */ } /* Dispatch to the appropriate handler. */ From eb107d095c503ebe018e333bc479f24e83d8c305 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 02:00:26 +0000 Subject: [PATCH 016/361] (Common Keywords): Document how to use :package-version in a package not in Emacs. --- lispref/ChangeLog | 5 +++++ lispref/customize.texi | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 09757fca10b..7bc5e51062e 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,8 @@ +2006-07-28 Richard Stallman + + * customize.texi (Common Keywords): Document how to use + :package-version in a package not in Emacs. + 2006-07-28 Kim F. Storm * commands.texi (Reading One Event): Fix last change. diff --git a/lispref/customize.texi b/lispref/customize.texi index 3aca1a90bcf..e3e78c46bb4 100644 --- a/lispref/customize.texi +++ b/lispref/customize.texi @@ -133,18 +133,21 @@ version. The value @var{version} must be a string. @item :package-version '(@var{package} . @var{version}) This option specifies that the item was first introduced in -@var{package} version @var{version}, or that its default value was -changed in that version. This keyword takes priority over :version. -The value of @var{package} is a symbol and @var{version} is a string. -The @var{package} and @var{version} must appear in the alist -@code{customize-package-emacs-version-alist}. Since @var{package} must -be unique and the user might see it in an error message, a good choice -is the official name of the package, such as MH-E or Gnus. +@var{package} version @var{version}, or that its meaning or default +value was changed in that version. The value of @var{package} is a +symbol and @var{version} is a string. +This keyword takes priority over @code{:version}. + +@var{package} should be the official name of the package, such as MH-E +or Gnus. If the package @var{package} is released as part of Emacs, +@var{package} and @var{version} should appear in the value of +@code{customize-package-emacs-version-alist}. @end table -Packages that use the @code{:package-version} keyword must also update -the @code{customize-package-emacs-version-alist} variable. +Packages distributed as part of Emacs that use the +@code{:package-version} keyword must also update the +@code{customize-package-emacs-version-alist} variable. @defvar customize-package-emacs-version-alist This alist provides a mapping for the versions of Emacs that are From 13eb1bded17be81b2041fb9979f9d7a13b914742 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 02:03:21 +0000 Subject: [PATCH 017/361] (grep-default-command): Catch errors from wildcard-to-regexp. --- lisp/progmodes/grep.el | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 1c29bfe9cc8..a939d54b3c9 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -465,28 +465,38 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." "")) (defun grep-default-command () + "Compute the default grep command for C-u M-x grep to offer." (let ((tag-default (shell-quote-argument (grep-tag-default))) + ;; This a regexp to match single shell arguments. + ;; Could someone please add comments explaining it? (sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)") (grep-default (or (car grep-history) grep-command))) - ;; Replace the thing matching for with that around cursor. + ;; In the default command, find the arg that specifies the pattern. (when (or (string-match (concat "[^ ]+\\s +\\(?:-[^ ]+\\s +\\)*" sh-arg-re "\\(\\s +\\(\\S +\\)\\)?") grep-default) ;; If the string is not yet complete. (string-match "\\(\\)\\'" grep-default)) - (unless (or (not (stringp buffer-file-name)) - (when (match-beginning 2) - (save-match-data - (string-match - (wildcard-to-regexp - (file-name-nondirectory - (match-string 3 grep-default))) - (file-name-nondirectory buffer-file-name))))) - (setq grep-default (concat (substring grep-default - 0 (match-beginning 2)) - " *." - (file-name-extension buffer-file-name)))) + ;; Maybe we will replace the pattern with the default tag. + ;; But first, maybe replace the file name pattern. + (condition-case nil + (unless (or (not (stringp buffer-file-name)) + (when (match-beginning 2) + (save-match-data + (string-match + (wildcard-to-regexp + (file-name-nondirectory + (match-string 3 grep-default))) + (file-name-nondirectory buffer-file-name))))) + (setq grep-default (concat (substring grep-default + 0 (match-beginning 2)) + " *." + (file-name-extension buffer-file-name)))) + ;; In case wildcard-to-regexp gets an error + ;; from invalid data. + (error nil)) + ;; Now replace the pattern with the default tag. (replace-match tag-default t t grep-default 1)))) From 3bd80f8b6b82dfabeacd93070a718bf99f83a244 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 02:07:22 +0000 Subject: [PATCH 018/361] (mode-line-frame-identification) (propertized-buffer-identification): Centralize the code to initialize the variable. --- lisp/bindings.el | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/lisp/bindings.el b/lisp/bindings.el index 5420badde90..8a96387f2a1 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -209,14 +209,6 @@ mnemonics of the following coding systems: (make-variable-buffer-local 'mode-line-mule-info) -(defvar mode-line-buffer-identification (purecopy '("%12b")) "\ -Mode-line control for identifying the buffer being displayed. -Its default value is (\"%12b\"). -Major modes that edit things other than ordinary files may change this -\(e.g. Info, Dired,...)") - -(make-variable-buffer-local 'mode-line-buffer-identification) - (defvar mode-line-frame-identification '("-%F ") "Mode-line control to describe the current frame.") @@ -337,6 +329,25 @@ Keymap to display on minor modes.") (defvar mode-line-buffer-identification-keymap nil "\ Keymap for what is displayed by `mode-line-buffer-identification'.") +(defun propertized-buffer-identification (fmt) + "Return a list suitable for `mode-line-buffer-identification'. +FMT is a format specifier such as \"%12b\". This function adds +text properties for face, help-echo, and local-map to it." + (list (propertize fmt + 'face 'mode-line-buffer-id + 'help-echo + (purecopy "mouse-1: previous buffer, mouse-3: next buffer") + 'mouse-face 'mode-line-highlight + 'local-map mode-line-buffer-identification-keymap))) + +(defvar mode-line-buffer-identification (propertized-buffer-identification "%12b") "\ +Mode-line control for identifying the buffer being displayed. +Its default value is (\"%12b\") with some text properties added. +Major modes that edit things other than ordinary files may change this +\(e.g. Info, Dired,...)") + +(make-variable-buffer-local 'mode-line-buffer-identification) + (defun unbury-buffer () "\ Switch to the last buffer in the buffer list." (interactive) @@ -457,20 +468,6 @@ Menu of mode operations in the mode line.") (define-key map [header-line mouse-3] 'mode-line-next-buffer) (setq mode-line-buffer-identification-keymap map)) -(defun propertized-buffer-identification (fmt) - "Return a list suitable for `mode-line-buffer-identification'. -FMT is a format specifier such as \"%12b\". This function adds -text properties for face, help-echo, and local-map to it." - (list (propertize fmt - 'face 'mode-line-buffer-id - 'help-echo - (purecopy "mouse-1: previous buffer, mouse-3: next buffer") - 'mouse-face 'mode-line-highlight - 'local-map mode-line-buffer-identification-keymap))) - -(setq-default mode-line-buffer-identification - (propertized-buffer-identification "%12b")) - (defvar minor-mode-alist nil "\ Alist saying how to show minor modes in the mode line. Each element looks like (VARIABLE STRING); From e3b4d8490c3c2a45f2d38a7afb25ed83d1aa1b42 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 02:26:45 +0000 Subject: [PATCH 019/361] (Face Attributes): Simplify wording. (Attribute Functions): Clarify meaning of new-frame default attribute settings. --- lispref/display.texi | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lispref/display.texi b/lispref/display.texi index 678ca657b5b..bcf32a508c8 100644 --- a/lispref/display.texi +++ b/lispref/display.texi @@ -1857,9 +1857,9 @@ as if they had a light background. The effect of using a face is determined by a fixed set of @dfn{face attributes}. This table lists all the face attributes, and what they -mean. Note that in general, more than one face can be specified for a -given piece of text; when that happens, the attributes of all the faces -are merged to specify how to display the text. @xref{Displaying Faces}. +mean. You can specify more than one face for a given piece of text; +Emacs merges the attributes of all the faces to determine how to +display the text. @xref{Displaying Faces}. Any attribute in a face can have the value @code{unspecified}. This means the face doesn't specify that attribute. In face merging, when @@ -2054,9 +2054,9 @@ otherwise, they affect all frames as well as the defaults that apply to new frames. @defun set-face-attribute face frame &rest arguments -This function sets one or more attributes of face @var{face} -for frame @var{frame}. If @var{frame} is @code{nil}, it sets -the attribute for all frames, and the defaults for new frames. +This function sets one or more attributes of face @var{face} for frame +@var{frame}. The attributes you specify this way override whatever +the @code{defface} says. The extra arguments @var{arguments} specify the attributes to set, and the values for them. They should consist of alternating attribute names @@ -2073,6 +2073,11 @@ Thus, @noindent sets the attributes @code{:width}, @code{:weight} and @code{:underline} to the corresponding values. + +If @var{frame} is @code{t}, this function sets the attributes for all +existing frames, and sets defaults that will apply for new frames. +Default attribute values specified this way override the +@code{defface} for newly created frames. @end defun @defun face-attribute face attribute &optional frame inherit @@ -2080,8 +2085,10 @@ This returns the value of the @var{attribute} attribute of face @var{face} on @var{frame}. If @var{frame} is @code{nil}, that means the selected frame (@pxref{Input Focus}). -If @var{frame} is @code{t}, the value is the default for -@var{face} for new frames. +If @var{frame} is @code{t}, this returns whatever new-frames default +value you previously specified with @code{set-face-attribute} for the +@var{attribute} attribute of @var{face}. If you have not specified +one, it returns @code{nil}. If @var{inherit} is @code{nil}, only attributes directly defined by @var{face} are considered, so the return value may be From 0de8dcc97732834702d25e2be92f62d4b9ae4e35 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 02:27:00 +0000 Subject: [PATCH 020/361] *** empty log message *** --- lisp/ChangeLog | 9 +++++++++ lispref/ChangeLog | 4 ++++ man/ChangeLog | 5 +++++ src/ChangeLog | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f0099a15514..9312730c06f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2006-07-28 Richard Stallman + + * bindings.el (mode-line-frame-identification) + (propertized-buffer-identification): Centralize the code + to initialize the variable. + + * progmodes/grep.el (grep-default-command): Catch errors from + wildcard-to-regexp. + 2006-07-29 Kim F. Storm * progmodes/grep.el (grep-tag-default): New function. diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 7bc5e51062e..0e0936db0a3 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,5 +1,9 @@ 2006-07-28 Richard Stallman + * display.texi (Face Attributes): Simplify wording. + (Attribute Functions): Clarify meaning of new-frame default + attribute settings. + * customize.texi (Common Keywords): Document how to use :package-version in a package not in Emacs. diff --git a/man/ChangeLog b/man/ChangeLog index 6385b4393a0..479d9d5af92 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-07-28 Richard Stallman + + * mark.texi (Transient Mark): Clarify that region never disappears + when Transient Mark mode is off, and not when it is on. + 2006-07-27 Richard Stallman * search.texi (Non-ASCII Isearch): Clarify. Mention C-q. diff --git a/src/ChangeLog b/src/ChangeLog index 2f51ce899f5..029b7368be1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2006-07-28 Richard Stallman + + * xfaces.c (lookup_named_face, Fdisplay_supports_face_attributes_p): + Add conditional aborts for clarity. + + * xdisp.c (update_menu_bar): New arg HOOKS_RUN. Callers changed. + Used to avoid running the hooks over and over for each frame. + (prepare_menu_bars): Pass value from update_menu_bar + as HOOKS_RUN of next call. + + * keyboard.c (safe_run_hooks_1): Don't crash if Vrun_hooks is nil. + 2006-07-28 Kim F. Storm * alloc.c (valid_pointer_p): New function (from valid_lisp_object_p). @@ -182,6 +194,14 @@ (mac_initialize_display_info) [MAC_OSX]: Use CGDisplaySamplesPerPixel. (x_delete_display): Apply 2006-07-04 change for xterm.c. +2006-07-17 Richard Stallman + + * keyboard.c (Vcommand_error_function): New variable. + (syms_of_keyboard): Defvar it. + (cmd_error_internal): Simplify, and handle Vcommand_error_function. + + * dispnew.c (init_display): Mention DISPLAY as well as TERM in err msg. + 2006-07-17 Kim F. Storm * xdisp.c (handle_single_display_spec): Ensure the right value of From 69666f776a28c398808c3a6c8004a5c831f84b7d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 29 Jul 2006 10:18:48 +0000 Subject: [PATCH 021/361] [WINDOWSNT]: Include fcntl.h, to fix last change. --- src/ChangeLog | 4 ++++ src/alloc.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 029b7368be1..7b7c1747aad 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-07-29 Eli Zaretskii + + * alloc.c [WINDOWSNT]: Include fcntl.h, to fix last change. + 2006-07-28 Richard Stallman * xfaces.c (lookup_named_face, Fdisplay_supports_face_attributes_p): diff --git a/src/alloc.c b/src/alloc.c index 4c1a81e7c92..e5735e03fd9 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -78,6 +78,10 @@ extern POINTER_TYPE *sbrk (); #define O_WRONLY 1 #endif +#ifdef WINDOWSNT +#include +#endif + #ifdef DOUG_LEA_MALLOC #include From 21f7b9d85747f586e03a410d7c1fc743cfaa208c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 29 Jul 2006 10:48:30 +0000 Subject: [PATCH 022/361] Document the change in position policy on MS-Windows. --- etc/NEWS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index c00d13937eb..cb1b025c03d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -202,6 +202,13 @@ an interactively callable function. all frames you create. A position specified with --geometry only affects the initial frame. +--- +** Emacs built for MS-Windows now behaves like Emacs on X does, +wrt its frame position: if you don't specify a position (in your +.emacs init file, in the Registry, or with the --geometry command-line +option), Emacs leaves the frame position to the Windows' window +manager. + +++ ** Emacs can now be invoked in full-screen mode on a windowed display. When Emacs is invoked on a window system, the new command-line options @@ -243,6 +250,7 @@ according to the value of `save-abbrevs'. ** If the environment variable EMAIL is defined, Emacs now uses its value to compute the default value of `use-mail-address', in preference to concatenation of `user-login-name' with the name of your host machine. + * Incompatible Editing Changes in Emacs 22.1 From 0ef973bb131f5a622162a1b1053521f6ed0d6f60 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 29 Jul 2006 10:59:50 +0000 Subject: [PATCH 023/361] (Ffind_operation_coding_system): Revert the change from 2006-05-29. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coding.c b/src/coding.c index a3fd8f91284..f0b3cb74acd 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7539,7 +7539,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) return Fcons (val, val); if (! NILP (Ffboundp (val))) { - val = safe_call1 (val, Flist (nargs, args)); + val = call1 (val, Flist (nargs, args)); if (CONSP (val)) return val; if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val))) From 2439e18370ef97bfab0339274a322cd65c09c5f3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 29 Jul 2006 11:12:06 +0000 Subject: [PATCH 024/361] (Operating on Files): Add cross-references. State the Unix commands that do similar things. --- man/dired.texi | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/man/dired.texi b/man/dired.texi index 97597ffcd81..02950035515 100644 --- a/man/dired.texi +++ b/man/dired.texi @@ -550,34 +550,38 @@ next window, that other buffer's directory is suggested instead. @item C @var{new} @key{RET} Copy the specified files (@code{dired-do-copy}). The argument @var{new} is the directory to copy into, or (if copying a single file) the new -name. +name. This is similar to what the Unix @code{cp} command does. @vindex dired-copy-preserve-time If @code{dired-copy-preserve-time} is non-@code{nil}, then copying with this command preserves the modification time of the old file in -the copy. +the copy, similarly to @kbd{cp -p}. @vindex dired-recursive-copies @cindex recursive copying The variable @code{dired-recursive-copies} controls whether to copy -directories recursively. The default is @code{nil}, which means that -directories cannot be copied. +directories recursively (a-la @kbd{cp -r}). The default is +@code{nil}, which means that directories cannot be copied. @item D @findex dired-do-delete @kindex D @r{(Dired)} -Delete the specified files (@code{dired-do-delete}). Like the other -commands in this section, this command operates on the @emph{marked} -files, or the next @var{n} files. By contrast, @kbd{x} +Delete the specified files (@code{dired-do-delete}). This is similar +to what the Unix @code{rm} command does. Like the other commands in +this section, this command operates on the @emph{marked} files, or the +next @var{n} files. By contrast, @kbd{x} (@code{dired-do-flagged-delete}) deletes all @dfn{flagged} files. @findex dired-do-rename @kindex R @r{(Dired)} @cindex renaming files (in Dired) +@cindex moving files (in Dired) @item R @var{new} @key{RET} -Rename the specified files (@code{dired-do-rename}). The argument -@var{new} is the directory to rename into, or (if renaming a single -file) the new name. +Rename the specified files (@code{dired-do-rename}). If you rename a +single file, the argument @var{new} is the new name of the file. If +you rename several files, the argument @var{new} is the directory into +which to move the files (this is similar to what the Unix @code{mv} +command does). Dired automatically changes the visited file name of buffers associated with renamed files so that they refer to the new names. @@ -586,17 +590,19 @@ with renamed files so that they refer to the new names. @kindex H @r{(Dired)} @cindex hard links (in Dired) @item H @var{new} @key{RET} -Make hard links to the specified files (@code{dired-do-hardlink}). The -argument @var{new} is the directory to make the links in, or (if making -just one link) the name to give the link. +Make hard links to the specified files (@code{dired-do-hardlink}). +This is similar to what the Unix @code{ln} command does. The argument +@var{new} is the directory to make the links in, or (if making just +one link) the name to give the link. @findex dired-do-symlink @kindex S @r{(Dired)} @cindex symbolic links (creation in Dired) @item S @var{new} @key{RET} -Make symbolic links to the specified files (@code{dired-do-symlink}). -The argument @var{new} is the directory to make the links in, or (if -making just one link) the name to give the link. +Make symbolic links to the specified files (@code{dired-do-symlink}) +(this is similar to what @kbd{ln -s} does on Unix). The argument +@var{new} is the directory to make the links in, or (if making just +one link) the name to give the link. @findex dired-do-chmod @kindex M @r{(Dired)} @@ -631,7 +637,8 @@ different places). @cindex changing file time (in Dired) @item T @var{timestamp} @key{RET} Touch the specified files (@code{dired-do-touch}). This means -updating their modification times to the present time. +updating their modification times to the present time. This is +similar to what the Unix @code{touch} command does. @findex dired-do-print @kindex P @r{(Dired)} From 114b3e94ec69f283a82298a1607f1943ec22c540 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 29 Jul 2006 11:19:58 +0000 Subject: [PATCH 025/361] (bw-get-tree): Don't integerp subtree if it's nil. --- lisp/window.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index 2ae1a2c9e79..7810ba4c5be 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -246,9 +246,10 @@ then the smallest tree containing that window is returned." (windowp window-or-frame)) (error "Not a frame or window: %s" window-or-frame))) (let ((subtree (bw-find-tree-sub window-or-frame))) - (if (integerp subtree) - nil - (bw-get-tree-1 subtree)))) + (when subtree + (if (integerp subtree) + nil + (bw-get-tree-1 subtree))))) (defun bw-get-tree-1 (split) (if (windowp split) From cfb37af8b15a302aacf7be22daa5980f00fe93d6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 29 Jul 2006 11:20:42 +0000 Subject: [PATCH 026/361] *** empty log message *** --- lisp/ChangeLog | 4 ++++ src/ChangeLog | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9312730c06f..fbaff43682b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-07-29 Lennart Borgman + + * window.el (bw-get-tree): Don't integerp subtree if it's nil. + 2006-07-28 Richard Stallman * bindings.el (mode-line-frame-identification) diff --git a/src/ChangeLog b/src/ChangeLog index 7b7c1747aad..9f293bc1025 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2006-07-29 Eli Zaretskii + * coding.c (Ffind_operation_coding_system): Revert the change from + 2006-05-29. + * alloc.c [WINDOWSNT]: Include fcntl.h, to fix last change. 2006-07-28 Richard Stallman From ebdcf65aa82789250274ca7613ccaf6aed42a816 Mon Sep 17 00:00:00 2001 From: Reiner Steib Date: Sat, 29 Jul 2006 11:51:47 +0000 Subject: [PATCH 027/361] Fix typo. --- etc/ChangeLog | 4 ++++ etc/NEWS | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 627d536ee69..9c0a1399c19 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2006-07-29 Reiner Steib + + * NEWS: Fix typo. + 2006-07-17 Reiner Steib * ru-refcard.ps: Regenerate. diff --git a/etc/NEWS b/etc/NEWS index cb1b025c03d..1414748a3dd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -95,7 +95,6 @@ doesn't automatically select the right one. Its name is `pt-br-refcard.tex'. The corresponding PostScript file is also included. - --- ** A French translation of the `Emacs Survival Guide' is available. @@ -248,7 +247,7 @@ according to the value of `save-abbrevs'. +++ ** If the environment variable EMAIL is defined, Emacs now uses its value -to compute the default value of `use-mail-address', in preference to +to compute the default value of `user-mail-address', in preference to concatenation of `user-login-name' with the name of your host machine. From 18b28ef18f66eed75843a3dce4c5ad890c09e0d8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 29 Jul 2006 12:05:28 +0000 Subject: [PATCH 028/361] (convert-standard-filename): For Cygwin, replace characters not allowed in Windows file names. (make-auto-save-file-name): Add Cygwin to the list of systems where the auto-save file name needs to be run through convert-standard-filename. --- lisp/files.el | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index fdc4464da86..0cd17932fd8 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -540,13 +540,21 @@ is a valid DOS file name, but c:/bar/c:/foo is not. This function's standard definition is trivial; it just returns the argument. However, on Windows and DOS, replace invalid -characters. On DOS, make sure to obey the 8.3 limitations. On -Windows, turn Cygwin names into native names, and also turn -slashes into backslashes if the shell requires it (see +characters. On DOS, make sure to obey the 8.3 limitations. +In the native Windows build, turn Cygwin names into native names, +and also turn slashes into backslashes if the shell requires it (see `w32-shell-dos-semantics'). See Info node `(elisp)Standard File Names' for more details." - filename) + (if (eq system-type 'cygwin) + (let ((name (copy-sequence filename)) + (start 0)) + ;; Replace invalid filename characters with ! + (while (string-match "[?*:<>|\"\000-\037]" name start) + (aset name (match-beginning 0) ?!) + (setq start (match-end 0))) + name) + filename)) (defun read-directory-name (prompt &optional dir default-dirname mustmatch initial) "Read directory name, prompting with PROMPT and completing in directory DIR. @@ -4368,7 +4376,7 @@ See also `auto-save-file-name-p'." "#"))) ;; Make sure auto-save file names don't contain characters ;; invalid for the underlying filesystem. - (if (and (memq system-type '(ms-dos windows-nt)) + (if (and (memq system-type '(ms-dos windows-nt cygwin)) ;; Don't modify remote (ange-ftp) filenames (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result))) (convert-standard-filename result) @@ -4403,7 +4411,7 @@ See also `auto-save-file-name-p'." ((file-writable-p default-directory) default-directory) ((file-writable-p "/var/tmp/") "/var/tmp/") ("~/"))))) - (if (and (memq system-type '(ms-dos windows-nt)) + (if (and (memq system-type '(ms-dos windows-nt cygwin)) ;; Don't modify remote (ange-ftp) filenames (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" fname))) ;; The call to convert-standard-filename is in case From 65bbcead0e04927e97d4719fdd8d74f40f20d6d0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 29 Jul 2006 12:06:07 +0000 Subject: [PATCH 029/361] *** empty log message *** --- lisp/ChangeLog | 8 ++++++++ man/ChangeLog | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fbaff43682b..bf2b61f3756 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2006-07-29 Eli Zaretskii + + * files.el (convert-standard-filename): For Cygwin, replace + characters not allowed in Windows file names. + (make-auto-save-file-name): Add Cygwin to the list of systems + where the auto-save file name needs to be run through + convert-standard-filename. + 2006-07-29 Lennart Borgman * window.el (bw-get-tree): Don't integerp subtree if it's nil. diff --git a/man/ChangeLog b/man/ChangeLog index 479d9d5af92..efaa6ae4755 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-07-29 Eli Zaretskii + + * dired.texi (Operating on Files): Add cross-references. State the + Unix commands that do similar things. + 2006-07-28 Richard Stallman * mark.texi (Transient Mark): Clarify that region never disappears From c888d352a6ab60016749103398ab21b188634349 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 29 Jul 2006 15:05:50 +0000 Subject: [PATCH 030/361] * loadhist.el (unload-feature): Handle new `(t . SYMBOL)' format for load-history elements. --- lisp/ChangeLog | 5 +++++ lisp/loadhist.el | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bf2b61f3756..6ee708c4392 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-07-29 Chong Yidong + + * loadhist.el (unload-feature): Handle new `(t . SYMBOL)' format + for load-history elements. + 2006-07-29 Eli Zaretskii * files.el (convert-standard-filename): For Cygwin, replace diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 635059f93e5..61f15c8ef1c 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -222,8 +222,8 @@ such as redefining an Emacs function." (if aload (fset fun (cons 'autoload aload)) (fmakunbound fun)))))) - (require nil) - (t (message "Unexpected element %s in load-history" x))) + ((t require) nil) + (t (message "Unexpected element %s in load-history" x))) ;; Kill local values as much as possible. (dolist (buf (buffer-list)) (with-current-buffer buf From 4f213bd48da55b1be08892b3c77a705b2a122546 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 22:03:14 +0000 Subject: [PATCH 031/361] Comment change. --- src/coding.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/coding.c b/src/coding.c index f0b3cb74acd..1af7b4c0d52 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7539,6 +7539,9 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) return Fcons (val, val); if (! NILP (Ffboundp (val))) { + /* We use call1 rather than safe_call1 + so as to get bug reports about functions called here + which don't handle the current interface. */ val = call1 (val, Flist (nargs, args)); if (CONSP (val)) return val; From 6d3361b9d5b80acc5741e80a24452937afdda7fa Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 Jul 2006 22:09:15 +0000 Subject: [PATCH 032/361] (Operating on Files): Simplify previous change and fix Texinfo usage. --- man/ChangeLog | 5 +++++ man/dired.texi | 36 ++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/man/ChangeLog b/man/ChangeLog index efaa6ae4755..acf86b84160 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-07-29 Richard Stallman + + * dired.texi (Operating on Files): Simplify previous change + and fix Texinfo usage. + 2006-07-29 Eli Zaretskii * dired.texi (Operating on Files): Add cross-references. State the diff --git a/man/dired.texi b/man/dired.texi index 02950035515..3bb32c1ac74 100644 --- a/man/dired.texi +++ b/man/dired.texi @@ -550,26 +550,27 @@ next window, that other buffer's directory is suggested instead. @item C @var{new} @key{RET} Copy the specified files (@code{dired-do-copy}). The argument @var{new} is the directory to copy into, or (if copying a single file) the new -name. This is similar to what the Unix @code{cp} command does. +name. This is like the shell command @code{cp}. @vindex dired-copy-preserve-time If @code{dired-copy-preserve-time} is non-@code{nil}, then copying with this command preserves the modification time of the old file in -the copy, similarly to @kbd{cp -p}. +the copy, like @samp{cp -p}. @vindex dired-recursive-copies @cindex recursive copying The variable @code{dired-recursive-copies} controls whether to copy -directories recursively (a-la @kbd{cp -r}). The default is +directories recursively (like @samp{cp -r}). The default is @code{nil}, which means that directories cannot be copied. @item D @findex dired-do-delete @kindex D @r{(Dired)} -Delete the specified files (@code{dired-do-delete}). This is similar -to what the Unix @code{rm} command does. Like the other commands in -this section, this command operates on the @emph{marked} files, or the -next @var{n} files. By contrast, @kbd{x} +Delete the specified files (@code{dired-do-delete}). This is like the +shell command @code{rm}. + +Like the other commands in this section, this command operates on the +@emph{marked} files, or the next @var{n} files. By contrast, @kbd{x} (@code{dired-do-flagged-delete}) deletes all @dfn{flagged} files. @findex dired-do-rename @@ -580,8 +581,7 @@ next @var{n} files. By contrast, @kbd{x} Rename the specified files (@code{dired-do-rename}). If you rename a single file, the argument @var{new} is the new name of the file. If you rename several files, the argument @var{new} is the directory into -which to move the files (this is similar to what the Unix @code{mv} -command does). +which to move the files (this is like the shell command @code{mv}). Dired automatically changes the visited file name of buffers associated with renamed files so that they refer to the new names. @@ -591,18 +591,18 @@ with renamed files so that they refer to the new names. @cindex hard links (in Dired) @item H @var{new} @key{RET} Make hard links to the specified files (@code{dired-do-hardlink}). -This is similar to what the Unix @code{ln} command does. The argument -@var{new} is the directory to make the links in, or (if making just -one link) the name to give the link. +This is like the shell command @code{ln}. The argument @var{new} is +the directory to make the links in, or (if making just one link) the +name to give the link. @findex dired-do-symlink @kindex S @r{(Dired)} @cindex symbolic links (creation in Dired) @item S @var{new} @key{RET} -Make symbolic links to the specified files (@code{dired-do-symlink}) -(this is similar to what @kbd{ln -s} does on Unix). The argument -@var{new} is the directory to make the links in, or (if making just -one link) the name to give the link. +Make symbolic links to the specified files (@code{dired-do-symlink}). +This is like @samp{ln -s}. The argument @var{new} is the directory to +make the links in, or (if making just one link) the name to give the +link. @findex dired-do-chmod @kindex M @r{(Dired)} @@ -637,8 +637,8 @@ different places). @cindex changing file time (in Dired) @item T @var{timestamp} @key{RET} Touch the specified files (@code{dired-do-touch}). This means -updating their modification times to the present time. This is -similar to what the Unix @code{touch} command does. +updating their modification times to the present time. This is like +the shell command @code{touch}. @findex dired-do-print @kindex P @r{(Dired)} From fc185ae6a7d5204a123604821f593a8ac12c04a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Potort=C3=AC?= Date: Sun, 30 Jul 2006 09:41:41 +0000 Subject: [PATCH 033/361] *** empty log message *** --- lib-src/ChangeLog | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 6be0910d27a..f61188fb8d5 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,14 @@ +2002-07-30 Adrian Aichner (tiny change) + + * etags.c: It's XEmacs, not Xemacs: change all the occurences. + +2006-07-30 Francesco Potort,Al(B + + * etags.c [ETAGS_REGEXPS]: Now is unconditionally defined. + [LONG_OPTIONS]: Changed to NO_LONG_OPTIONS, which is undefined. + (Objc_suffixes): Suggest using --lang=c for full help. + (C_entries): Initialise savetoken to 0 to shut up the compiler. + 2006-07-20 Andreas Schwab * fakemail.c (fatal): Drop second parameter and treat first From 35a4c758b3e9c7014267c983ca01911f5cd69b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Potort=C3=AC?= Date: Sun, 30 Jul 2006 09:43:47 +0000 Subject: [PATCH 034/361] Adrian Aichner: It's XEmacs, not Xemacs: change all the occurences. [ETAGS_REGEXPS]: Now is unconditionally defined. [LONG_OPTIONS]: Changed to NO_LONG_OPTIONS, which is undefined. (Objc_suffixes): Suggest using --lang=c for full help. (C_entries): Initialise savetoken to 0 to shut up the compiler. --- lib-src/etags.c | 89 ++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 64 deletions(-) diff --git a/lib-src/etags.c b/lib-src/etags.c index b5ff33c8b4c..d60c12c2bcc 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -41,7 +41,7 @@ * configuration file containing regexp definitions for etags. */ -char pot_etags_version[] = "@(#) pot revision number is 17.18"; +char pot_etags_version[] = "@(#) pot revision number is 17.20"; #define TRUE 1 #define FALSE 0 @@ -59,12 +59,10 @@ char pot_etags_version[] = "@(#) pot revision number is 17.18"; /* On some systems, Emacs defines static as nothing for the sake of unexec. We don't want that here since we don't use unexec. */ # undef static -# define ETAGS_REGEXPS /* use the regexp features */ -# define LONG_OPTIONS /* accept long options */ -# ifndef PTR /* for Xemacs */ +# ifndef PTR /* for XEmacs */ # define PTR void * # endif -# ifndef __P /* for Xemacs */ +# ifndef __P /* for XEmacs */ # define __P(args) args # endif #else /* no config.h */ @@ -82,14 +80,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.18"; # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ #endif -#ifdef LONG_OPTIONS -# undef LONG_OPTIONS -# define LONG_OPTIONS TRUE -#else -# define LONG_OPTIONS FALSE -#endif - -/* WIN32_NATIVE is for Xemacs. +/* WIN32_NATIVE is for XEmacs. MSDOS, WINDOWSNT, DOS_NT are for Emacs. */ #ifdef WIN32_NATIVE # undef MSDOS @@ -167,25 +158,25 @@ char pot_etags_version[] = "@(#) pot revision number is 17.18"; # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif -#if LONG_OPTIONS -# include -#else +#ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */ +# define NO_LONG_OPTIONS TRUE # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) extern char *optarg; extern int optind, opterr; -#endif /* LONG_OPTIONS */ +#else +# define NO_LONG_OPTIONS FALSE +# include +#endif /* NO_LONG_OPTIONS */ -#ifdef ETAGS_REGEXPS -# ifndef HAVE_CONFIG_H /* this is a standalone compilation */ -# ifdef __CYGWIN__ /* compiling on Cygwin */ +#ifndef HAVE_CONFIG_H /* this is a standalone compilation */ +# ifdef __CYGWIN__ /* compiling on Cygwin */ !!! NOTICE !!! the regex.h distributed with Cygwin is not compatible with etags, alas! If you want regular expression support, you should delete this notice and arrange to use the GNU regex.h and regex.c. -# endif # endif -# include -#endif /* ETAGS_REGEXPS */ +#endif +#include /* Define CTAGS to make the program "ctags" compatible with the usual one. Leave it undefined to make the program "etags", which makes emacs-style @@ -312,7 +303,6 @@ typedef struct char *what; /* the argument itself */ } argument; -#ifdef ETAGS_REGEXPS /* Structure defining a regular expression. */ typedef struct regexp { @@ -327,7 +317,6 @@ typedef struct regexp bool ignore_case; /* ignore case when matching */ bool multi_line; /* do a multi-line match on the whole file */ } regexp; -#endif /* ETAGS_REGEXPS */ /* Many compilers barf on this: @@ -375,11 +364,9 @@ static long readline_internal __P((linebuffer *, FILE *)); static bool nocase_tail __P((char *)); static void get_tag __P((char *, char **)); -#ifdef ETAGS_REGEXPS static void analyse_regex __P((char *)); static void free_regexps __P((void)); static void regex_tag_multiline __P((void)); -#endif /* ETAGS_REGEXPS */ static void error __P((const char *, const char *)); static void suggest_asking_for_help __P((void)); void fatal __P((char *, char *)); @@ -485,14 +472,9 @@ static bool packages_only; /* --packages-only: in Ada, only tag packages*/ #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ static bool parsing_stdin; /* --parse-stdin used */ -#ifdef ETAGS_REGEXPS static regexp *p_head; /* list of all regexps */ static bool need_filebuf; /* some regexes are multi-line */ -#else -# define need_filebuf FALSE -#endif /* ETAGS_REGEXPS */ -#if LONG_OPTIONS static struct option longopts[] = { { "append", no_argument, NULL, 'a' }, @@ -507,11 +489,9 @@ static struct option longopts[] = { "members", no_argument, &members, TRUE }, { "no-members", no_argument, &members, FALSE }, { "output", required_argument, NULL, 'o' }, -#ifdef ETAGS_REGEXPS { "regex", required_argument, NULL, 'r' }, { "no-regex", no_argument, NULL, 'R' }, { "ignore-case-regex", required_argument, NULL, 'c' }, -#endif /* ETAGS_REGEXPS */ { "parse-stdin", required_argument, NULL, STDIN }, { "version", no_argument, NULL, 'V' }, @@ -533,7 +513,6 @@ static struct option longopts[] = #endif { NULL } }; -#endif /* LONG_OPTIONS */ static compressor compressors[] = { @@ -681,13 +660,15 @@ static char *Objc_suffixes [] = static char Objc_help [] = "In Objective C code, tags include Objective C definitions for classes,\n\ class categories, methods and protocols. Tags for variables and\n\ -functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'."; +functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\ +(Use --help --lang=c --lang=objc --lang=java for full help.)"; static char *Pascal_suffixes [] = { "p", "pas", NULL }; static char Pascal_help [] = "In Pascal code, the tags are the functions and procedures defined\n\ in the file."; +/* " // this is for working around an Emacs highlighting bug... */ static char *Perl_suffixes [] = { "pl", "pm", NULL }; @@ -885,11 +866,11 @@ print_help (argbuffer) printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ \n\ These are the options accepted by %s.\n", progname, progname); - if (LONG_OPTIONS) - puts ("You may use unambiguous abbreviations for the long option names."); + if (NO_LONG_OPTIONS) + puts ("WARNING: long option names do not work with this executable,\n\ +as it is not linked with GNU getopt."); else - puts ("Long option names do not work with this executable, as it is not\n\ -linked with GNU getopt."); + puts ("You may use unambiguous abbreviations for the long option names."); puts (" A - as file name means read names from stdin (one per line).\n\ Absolute names are stored in the output file as they are.\n\ Relative ones are stored relative to the output file's directory.\n"); @@ -949,7 +930,6 @@ Relative ones are stored relative to the output file's directory.\n"); puts ("--members\n\ Create tag entries for members of structures in some languages."); -#ifdef ETAGS_REGEXPS puts ("-r REGEXP, --regex=REGEXP or --regex=@regexfile\n\ Make a tag for each line matching a regular expression pattern\n\ in the following files. {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\ @@ -964,7 +944,6 @@ Relative ones are stored relative to the output file's directory.\n"); causes dot to match any character, including newline."); puts ("-R, --no-regex\n\ Don't create tags from regexps for the following files."); -#endif /* ETAGS_REGEXPS */ puts ("-I, --ignore-indentation\n\ In C and C++ do not assume that a closing brace in the first\n\ column is the final brace of a function or structure definition."); @@ -1194,14 +1173,8 @@ main (argc, argv) /* When the optstring begins with a '-' getopt_long does not rearrange the non-options arguments to be at the end, but leaves them alone. */ - optstring = "-"; -#ifdef ETAGS_REGEXPS - optstring = "-r:Rc:"; -#endif /* ETAGS_REGEXPS */ - if (!LONG_OPTIONS) - optstring += 1; /* remove the initial '-' */ - optstring = concat (optstring, - "aCf:Il:o:SVhH", + optstring = concat (NO_LONG_OPTIONS ? "" : "-", + "ac:Cf:Il:o:r:RSVhH", (CTAGS) ? "BxdtTuvw" : "Di:"); while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF) @@ -1375,11 +1348,9 @@ main (argc, argv) case at_language: lang = argbuffer[i].lang; break; -#ifdef ETAGS_REGEXPS case at_regexp: analyse_regex (argbuffer[i].what); break; -#endif case at_filename: #ifdef VMS while ((this_file = gfnames (argbuffer[i].what, &got_err)) != NULL) @@ -1419,9 +1390,7 @@ main (argc, argv) } } -#ifdef ETAGS_REGEXPS free_regexps (); -#endif /* ETAGS_REGEXPS */ free (lb.buffer); free (filebuf.buffer); free (token_name.buffer); @@ -1979,9 +1948,7 @@ find_entries (inf) parser (inf); -#ifdef ETAGS_REGEXPS regex_tag_multiline (); -#endif /* ETAGS_REGEXPS */ } @@ -3239,7 +3206,7 @@ C_entries (c_ext, inf) int typdefbracelev; /* bracelev where a typedef struct body begun */ bool incomm, inquote, inchar, quotednl, midtoken; bool yacc_rules; /* in the rules part of a yacc file */ - struct tok savetoken; /* token saved during preprocessor handling */ + struct tok savetoken = {0}; /* token saved during preprocessor handling */ linebuffer_init (&lbs[0].lb); @@ -5735,8 +5702,6 @@ erlang_atom (s) } -#ifdef ETAGS_REGEXPS - static char *scan_separators __P((char *)); static void add_regex __P((char *, language *)); static char *substitute __P((char *, char *, struct re_registers *)); @@ -6141,8 +6106,6 @@ regex_tag_multiline () } } -#endif /* ETAGS_REGEXPS */ - static bool nocase_tail (cp) @@ -6405,7 +6368,6 @@ readline (lbp, stream) } } /* if #line directives should be considered */ -#ifdef ETAGS_REGEXPS { int match; regexp *rp; @@ -6462,7 +6424,6 @@ readline (lbp, stream) } } } -#endif /* ETAGS_REGEXPS */ } @@ -6623,7 +6584,7 @@ static void suggest_asking_for_help () { fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", - progname, LONG_OPTIONS ? "--help" : "-h"); + progname, NO_LONG_OPTIONS ? "-h" : "--help"); exit (EXIT_FAILURE); } From 0466836353bb20a75293b4f358184f2e264ebba5 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 30 Jul 2006 12:34:23 +0000 Subject: [PATCH 035/361] (Fields): Mention POS requirement when narrowing is in effect. --- lispref/text.texi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lispref/text.texi b/lispref/text.texi index 898f33443b5..fccc72d3d0b 100644 --- a/lispref/text.texi +++ b/lispref/text.texi @@ -3697,7 +3697,8 @@ field nor the following field; the field functions treat it as belonging to an empty field whose beginning and end are both at @var{pos}. In all of these functions, if @var{pos} is omitted or @code{nil}, the -value of point is used by default. +value of point is used by default. If narrowing is in effect, then +@var{pos} should fall within the accessible portion. @xref{Narrowing}. @defun field-beginning &optional pos escape-from-edge limit This function returns the beginning of the field specified by @var{pos}. From f554db0f9656259e14ba65667db567d68c16dc3c Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 30 Jul 2006 12:43:09 +0000 Subject: [PATCH 036/361] Undo 2006-06-28 change. --- src/editfns.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/editfns.c b/src/editfns.c index aea044db068..e692204c702 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -629,10 +629,7 @@ find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end) DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0, doc: /* Delete the field surrounding POS. A field is a region of text with the same `field' property. -If POS is nil, the value of point is used for POS. - -An `args-out-of-range' error is signaled if POS is outside the -buffer's accessible portion. */) +If POS is nil, the value of point is used for POS. */) (pos) Lisp_Object pos; { @@ -646,10 +643,7 @@ buffer's accessible portion. */) DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0, doc: /* Return the contents of the field surrounding POS as a string. A field is a region of text with the same `field' property. -If POS is nil, the value of point is used for POS. - -An `args-out-of-range' error is signaled if POS is outside the -buffer's accessible portion. */) +If POS is nil, the value of point is used for POS. */) (pos) Lisp_Object pos; { @@ -661,10 +655,7 @@ buffer's accessible portion. */) DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0, doc: /* Return the contents of the field around POS, without text-properties. A field is a region of text with the same `field' property. -If POS is nil, the value of point is used for POS. - -An `args-out-of-range' error is signaled if POS is outside the -buffer's accessible portion. */) +If POS is nil, the value of point is used for POS. */) (pos) Lisp_Object pos; { @@ -680,10 +671,7 @@ If POS is nil, the value of point is used for POS. If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its field, then the beginning of the *previous* field is returned. If LIMIT is non-nil, it is a buffer position; if the beginning of the field -is before LIMIT, then LIMIT will be returned instead. - -An `args-out-of-range' error is signaled if POS is outside the -buffer's accessible portion. */) +is before LIMIT, then LIMIT will be returned instead. */) (pos, escape_from_edge, limit) Lisp_Object pos, escape_from_edge, limit; { @@ -699,10 +687,7 @@ If POS is nil, the value of point is used for POS. If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field, then the end of the *following* field is returned. If LIMIT is non-nil, it is a buffer position; if the end of the field -is after LIMIT, then LIMIT will be returned instead. - -An `args-out-of-range' error is signaled if POS is outside the -buffer's accessible portion. */) +is after LIMIT, then LIMIT will be returned instead. */) (pos, escape_from_edge, limit) Lisp_Object pos, escape_from_edge, limit; { From 0f42ea765f6efc819b38e28343ed35f81022d37b Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 30 Jul 2006 12:45:36 +0000 Subject: [PATCH 037/361] *** empty log message *** --- lispref/ChangeLog | 5 +++++ src/ChangeLog | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 0e0936db0a3..8113a30af25 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,8 @@ +2006-07-30 Thien-Thi Nguyen + + * text.texi (Fields): Mention POS + requirement when narrowing is in effect. + 2006-07-28 Richard Stallman * display.texi (Face Attributes): Simplify wording. diff --git a/src/ChangeLog b/src/ChangeLog index 9f293bc1025..7f62aebf9e6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-07-30 Thien-Thi Nguyen + + * editfns.c: Undo 2006-06-27 change. + 2006-07-29 Eli Zaretskii * coding.c (Ffind_operation_coding_system): Revert the change from @@ -7,7 +11,7 @@ 2006-07-28 Richard Stallman - * xfaces.c (lookup_named_face, Fdisplay_supports_face_attributes_p): + * xfaces.c (lookup_named_face, Fdisplay_supports_face_attributes_p): Add conditional aborts for clarity. * xdisp.c (update_menu_bar): New arg HOOKS_RUN. Callers changed. From ecfbb4888a487435190bd3abc1835a5be7ba484d Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 30 Jul 2006 20:21:14 +0000 Subject: [PATCH 038/361] (url-hexify-string): Rewrite. --- lisp/url/ChangeLog | 5 +++++ lisp/url/url-util.el | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 901fac01208..e29b4b6b67e 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,8 @@ +2006-07-30 Thien-Thi Nguyen + + * url-util.el (url-hexify-string): Rewrite. + Suggested by David Smith . + 2006-07-12 Michael Olson * url-irc.el (url-irc-erc): Call erc-handle-irc-url. diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index f33a58950fc..4293b0e301f 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el @@ -352,17 +352,18 @@ forbidden in URL encoding." This is taken from RFC 2396.") ;;;###autoload -(defun url-hexify-string (str) - "Escape characters in a string." - (mapconcat - (lambda (char) - ;; Fixme: use a char table instead. - (if (not (memq char url-unreserved-chars)) - (if (> char 255) - (error "Hexifying multibyte character %s" str) - (format "%%%02X" char)) - (char-to-string char))) - str "")) +(defun url-hexify-string (string) + "Return a new string that is STRING URI-encoded. +First, STRING is converted to utf-8, if necessary. Then, for each +character in the utf-8 string, those found in `url-unreserved-chars' +are left as-is, all others are represented as a three-character +string: \"%\" followed by two lowercase hex digits." + (mapconcat (lambda (char) + (if (memq char url-unreserved-chars) + (char-to-string char) + (format "%%%02x" char))) + (encode-coding-string string 'utf-8 t) + "")) ;;;###autoload (defun url-file-extension (fname &optional x) From 36f8f49f38ecce74b42ef8dfbcc79df9a54919f9 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 31 Jul 2006 06:04:39 +0000 Subject: [PATCH 039/361] *** empty log message *** --- lisp/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6ee708c4392..b875a73356f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-07-31 Nick Roberts + + * t-mouse.el (t-mouse-mode): Use set-process-query-on-exit-flag. + 2006-07-29 Chong Yidong * loadhist.el (unload-feature): Handle new `(t . SYMBOL)' format From ab5e2abdcabcd3921f73b451e799f3146e46e0f1 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 31 Jul 2006 06:05:04 +0000 Subject: [PATCH 040/361] (t-mouse-mode): Use set-process-query-on-exit-flag. --- lisp/t-mouse.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lisp/t-mouse.el b/lisp/t-mouse.el index 17d486749b3..06b77840c0d 100644 --- a/lisp/t-mouse.el +++ b/lisp/t-mouse.el @@ -292,9 +292,7 @@ Turn it on to use emacs mouse commands, and off to use t-mouse commands." "-f"))) (setq t-mouse-filter-accumulator "") (set-process-filter t-mouse-process 't-mouse-process-filter) -; use commented line instead for emacs 21.4 onwards - (process-kill-without-query t-mouse-process))) -; (set-process-query-on-exit-flag t-mouse-process nil))) + (set-process-query-on-exit-flag t-mouse-process nil))) ;; Turn it off (setq mouse-position-function nil) (delete-process t-mouse-process) From 2b63aedbe1ccc3205c61f3913f5ed0b199398c9e Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 31 Jul 2006 06:13:18 +0000 Subject: [PATCH 041/361] (gdb-find-source-frame): New option. (gdb-stopped): Use it. --- lisp/progmodes/gdb-ui.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 466ef70ff23..ce50c81e92d 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -1358,6 +1358,12 @@ directives." :type 'boolean :version "22.1") +(defcustom gdb-find-source-frame t + "Non-nil means try to find source further up stack e.g after signal." + :group 'gud + :type 'boolean + :version "22.1") + (defun gdb-stopped (ignored) "An annotation handler for `stopped'. It is just like `gdb-stopping', except that if we already set the output @@ -1371,14 +1377,15 @@ sink to `user' in `gdb-stopping', that is fine." (if gdb-same-frame (gdb-display-gdb-buffer) (gdb-frame-gdb-buffer)) + (if gdb-find-source-frame ;;Try to find source further up stack e.g after signal. - (setq gdb-look-up-stack - (if (gdb-get-buffer 'gdb-stack-buffer) - 'keep - (progn - (gdb-get-buffer-create 'gdb-stack-buffer) - (gdb-invalidate-frames) - 'delete))))) + (setq gdb-look-up-stack + (if (gdb-get-buffer 'gdb-stack-buffer) + 'keep + (progn + (gdb-get-buffer-create 'gdb-stack-buffer) + (gdb-invalidate-frames) + 'delete)))))) (unless (member gdb-inferior-status '("exited" "signal")) (setq gdb-inferior-status "stopped") (gdb-force-mode-line-update From dc3a38c346ae1992fdc8eddf5e57114cff1dc96f Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 31 Jul 2006 06:57:03 +0000 Subject: [PATCH 042/361] *** empty log message *** --- lisp/ChangeLog | 3 +++ man/ChangeLog | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b875a73356f..474cd5d6b46 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2006-07-31 Nick Roberts + * progmodes/gdb-ui.el (gdb-find-source-frame): New option. + (gdb-stopped): Use it. + * t-mouse.el (t-mouse-mode): Use set-process-query-on-exit-flag. 2006-07-29 Chong Yidong diff --git a/man/ChangeLog b/man/ChangeLog index acf86b84160..0c619689e58 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,9 @@ +2006-07-31 Nick Roberts + + * building.texi (GDB commands in Fringe): Rename to... + (Source Buffers): ..this and move forward. Describe hollow arrow and + new option gdb-find-source-frame. + 2006-07-29 Richard Stallman * dired.texi (Operating on Files): Simplify previous change From 988fd256ad902c9475feb34ac14b485576049f12 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 31 Jul 2006 06:57:28 +0000 Subject: [PATCH 043/361] (GDB commands in Fringe): Rename to... (Source Buffers): ..this and move forward. Describe hollow arrow and new option gdb-find-source-frame. --- man/building.texi | 118 +++++++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 53 deletions(-) diff --git a/man/building.texi b/man/building.texi index 549c69da544..b4caa537e10 100644 --- a/man/building.texi +++ b/man/building.texi @@ -834,12 +834,12 @@ that way, you can use @kbd{M-x gdba} to invoke GDB in graphical mode. @menu * GDB User Interface Layout:: Control the number of displayed buffers. +* Source Buffers:: Use the mouse in the fringe/margin to + control your program. * Breakpoints Buffer:: A breakpoint control panel. * Stack Buffer:: Select a frame from the call stack. * Other GDB User Interface Buffers:: Input/output, locals, registers, assembler, threads and memory buffers. -* GDB commands in the Fringe:: Use the mouse in the fringe/margin to - control your program. * Watch Expressions:: Monitor variable values in the speedbar. @end menu @@ -863,7 +863,7 @@ displays the following frame layout: +--------------------------------+--------------------------------+ | GUD buffer (I/O of GDB) | Locals buffer | |--------------------------------+--------------------------------+ -| Source buffer | I/O buffer for debugged pgm | +| Primary Source buffer | I/O buffer for debugged pgm | |--------------------------------+--------------------------------+ | Stack buffer | Breakpoints buffer | +--------------------------------+--------------------------------+ @@ -871,8 +871,8 @@ displays the following frame layout: @end smallexample However, if @code{gdb-use-separate-io-buffer} is @code{nil}, the I/O -buffer does not appear and the source buffer occupies the full width -of the frame. +buffer does not appear and the primary source buffer occupies the full +width of the frame. @findex gdb-restore-windows If you change the window layout, for example, while editing and @@ -904,6 +904,61 @@ as well as GDB's breakpoints. You do need to check that the breakpoints in recently edited source files are still in the right places. +@node Source Buffers +@subsubsection Source Buffers +@cindex GDB commands in Fringe + +@c @findex gdb-mouse-set-clear-breakpoint +@c @findex gdb-mouse-toggle-breakpoint +Many GDB commands can be entered using keybindings or the tool bar but +sometimes it is quicker to use the fringe. These commands either +manipulate breakpoints or control program execution. When there is no +fringe, you can use the margin but this is only present when the +source file already has a breakpoint. + +You can click @kbd{Mouse-1} in the fringe or display margin of a +source buffer to set a breakpoint there and, on a graphical display, a +red bullet will appear on that line. If a breakpoint already exists +on that line, the same click will remove it. You can also enable or +disable a breakpoint by clicking @kbd{C-Mouse-1} on the bullet. + +A solid arrow in the left fringe of a source buffer indicates the line +of the innermost frame where the debugged program has stopped. A +hollow arrow indicates the current execution line of higher level +frames. + +If you drag the arrow in the fringe with @kbd{Mouse-1} +(@code{gdb-mouse-until}), execution will continue to the line where +you release the button, provided it is still in the same frame. +Alternatively, you can click @kbd{Mouse-3} at some point in the fringe +of this buffer and execution will advance to there. A similar command +(@code{gdb-mouse-jump}) allows you to jump to a source line without +executing the intermediate lines by clicking @kbd{C-Mouse-3}. This +command allows you to go backwards which can be useful for running +through code that has already executed, in order to examine its +execution in more detail. + +@table @kbd +@item Mouse-1 +Set or clear a breakpoint. + +@item C-Mouse-1 +Enable or disable a breakpoint. + +@item Mouse-3 +Continue execution to here. + +@item C-Mouse-3 +Jump to here. +@end table + +If the variable @code{gdb-find-source-frame} is non-@code{nil} and +execution stops in a frame for which there is no source code e.g after +an interrupt, then Emacs finds and displays the first frame further up +stack for which there is source. If it is @code{nil} then the source +buffer continues to display the last frame which maybe more useful, +for example, when re-setting a breakpoint. + @node Breakpoints Buffer @subsubsection Breakpoints Buffer @@ -918,7 +973,7 @@ breakpoint}, the breakpoint which point is on. @findex gdb-toggle-breakpoint Enable/disable the current breakpoint (@code{gdb-toggle-breakpoint}). On a graphical display, this changes the color of a bullet in the -margin of the source buffer at the relevant line. This is red when +margin of a source buffer at the relevant line. This is red when the breakpoint is enabled and grey when it is disabled. Text-only terminals correspondingly display a @samp{B} or @samp{b}. @@ -1003,10 +1058,10 @@ The threads buffer displays a summary of all threads currently in your program (@pxref{Threads, Threads, Debugging programs with multiple threads, gdb, The GNU debugger}). Move point to any thread in the list and press @key{RET} to select it (@code{gdb-threads-select}) and -display the associated source in the source buffer. Alternatively, -click @kbd{Mouse-2} on a thread to select it. If the locals buffer is -visible, its contents update to display the variables that are local -in the new thread. +display the associated source in the primary source buffer. +Alternatively, click @kbd{Mouse-2} on a thread to select it. If the +locals buffer is visible, its contents update to display the variables +that are local in the new thread. @item Memory Buffer The memory buffer lets you examine sections of program memory @@ -1017,49 +1072,6 @@ displays. Click @kbd{Mouse-3} on the header line to select the display format or unit size for these data items. @end table -@node GDB commands in the Fringe -@subsubsection GDB commands in the Fringe -@cindex GDB commands in the Fringe - -@c @findex gdb-mouse-set-clear-breakpoint -@c @findex gdb-mouse-toggle-breakpoint -Many GDB commands can be entered using keybindings or the tool bar but -sometimes it is quicker to use the fringe. These commands either -manipulate breakpoints or control program execution. When there is no -fringe, you can use the margin but this is only present when the -source file already has a breakpoint. - -You can click @kbd{Mouse-1} in the fringe or display margin of a -source buffer to set a breakpoint there and, on a graphical display, a -red bullet will appear on that line. If a breakpoint already exists -on that line, the same click will remove it. You can also enable or -disable a breakpoint by clicking @kbd{C-Mouse-1} on the bullet. - -If you drag the debugger arrow in the fringe with @kbd{Mouse-1} -(@code{gdb-mouse-until}), execution will continue to the line where -you release the button, provided it is still in the same frame. -Alternatively, you can click @kbd{Mouse-3} at some point in the fringe -of this buffer and execution will advance to there. A similar command -(@code{gdb-mouse-jump}) allows you to jump to a source line without -executing the intermediate lines by clicking @kbd{C-Mouse-3}. This -command allows you to go backwards which can be useful for running -through code that has already executed, in order to examine its -execution in more detail. - -@table @kbd -@item Mouse-1 -Set or clear a breakpoint. - -@item C-Mouse-1 -Enable or disable a breakpoint. - -@item Mouse-3 -Continue execution to here. - -@item C-Mouse-3 -Jump to here. -@end table - @node Watch Expressions @subsubsection Watch Expressions @cindex Watching expressions in GDB From ebf693f35f0780516a57f50b2ae286b7cedc85ec Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 31 Jul 2006 09:40:13 +0000 Subject: [PATCH 044/361] Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 121-122) - Update from CVS 2006-07-28 Reiner Steib * etc/GNUS-NEWS: Regenerate from Oort Gnus node in texi/gnus.texi using texi/gnus-news.el of the trunk. 2006-07-28 Katsumi Yamaoka * lisp/gnus/nnheader.el (nnheader-insert-head): Make it work with Mac as well. 2006-07-27 Katsumi Yamaoka * lisp/gnus/nnheader.el (nnheader-insert-head): Make it work even if the file uses CRLF for the line-break code. 2006-07-28 Katsumi Yamaoka * man/gnus.texi (Oort Gnus): Mention that the Lisp files are now installed in .../site-lisp/gnus/ by default. [ From gnus-news.texi in the trunk. ] 2006-07-27 Reiner Steib * man/gnus.texi (MIME Commands): Additions for yEnc. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-375 --- etc/ChangeLog | 5 + etc/GNUS-NEWS | 828 +++++++++++++++++++++--------------------- lisp/gnus/ChangeLog | 9 + lisp/gnus/nnheader.el | 20 +- man/ChangeLog | 10 + man/gnus.texi | 14 +- 6 files changed, 458 insertions(+), 428 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 9c0a1399c19..f1bab406fd4 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,8 @@ +2006-07-28 Reiner Steib + + * GNUS-NEWS: Regenerate from Oort Gnus node in texi/gnus.texi using + texi/gnus-news.el of the trunk. + 2006-07-29 Reiner Steib * NEWS: Fix typo. diff --git a/etc/GNUS-NEWS b/etc/GNUS-NEWS index f13b4fa5dd3..31f9ad6613e 100644 --- a/etc/GNUS-NEWS +++ b/etc/GNUS-NEWS @@ -1,152 +1,201 @@ GNUS NEWS -- history of user-visible changes. -Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Free Software Foundation, Inc. +Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. See the end for copying conditions. Please send Gnus bug reports to bugs@gnus.org. For older news, see Gnus info node "New Features". -* Changes in Oort Gnus - -** `F' (`gnus-article-followup-with-original') and `R' -(`gnus-article-reply-with-original') only yank the text in the region if the -region is active. - -** `gnus-group-read-ephemeral-group' can be called interactively, using `G M'. - -** In draft groups, `e' is now bound to `gnus-draft-edit-message'. -Use `B w' for `gnus-summary-edit-article' instead. - -** The revised Gnus FAQ is included in the manual. -See the info node "Frequently Asked Questions". +* Installation changes ** Upgrading from previous (stable) version if you have used Oort. If you have tried Oort (the unstable Gnus branch leading to this -release) but went back to a stable version, be careful when upgrading -to this version. In particular, you will probably want to remove all -.marks (nnml) and .mrk (nnfolder) files, so that flags are read from -your ~/.newsrc.eld instead of from the .marks/.mrk file where this +release) but went back to a stable version, be careful when upgrading to +this version. In particular, you will probably want to remove all +`.marks' (nnml) and `.mrk' (nnfolder) files, so that flags are read from +your `.newsrc.eld' instead of from the `.marks'/`.mrk' file where this release store flags. See a later entry for more information about -marks. Note that downgrading isn't safe in general. +marks. Note that downgrading isn't save in general. + +** Lisp files are now installed in `.../site-lisp/gnus/' by default. It +defaulted to `.../site-lisp/' formerly. In addition to this, the new +installer issues a warning if other Gnus installations which will shadow +the latest one are detected. You can then remove those shadows manually +or remove them using `make remove-installed-shadows'. + +** New `make.bat' for compiling and installing Gnus under MS Windows + +Use `make.bat' if you want to install Gnus under MS Windows, the first +argument to the batch-program should be the directory where `xemacs.exe' +respectively `emacs.exe' is located, iff you want to install Gnus after +compiling it, give `make.bat' `/copy' as the second parameter. + +`make.bat' has been rewritten from scratch, it now features automatic +recognition of XEmacs and GNU Emacs, generates `gnus-load.el', checks if +errors occur while compilation and generation of info files and reports +them at the end of the build process. It now uses `makeinfo' if it is +available and falls back to `infohack.el' otherwise. `make.bat' should +now install all files which are necessary to run Gnus and be generally a +complete replacement for the `configure; make; make install' cycle used +under Unix systems. + +The new `make.bat' makes `make-x.bat' and `xemacs.mak' superfluous, so +they have been removed. + +** `~/News/overview/' not used. + +As a result of the following change, the `~/News/overview/' directory is +not used any more. You can safely delete the entire hierarchy. + +** `(require 'gnus-load)' + +If you use a stand-alone Gnus distribution, you'd better add `(require +'gnus-load)' into your `~/.emacs' after adding the Gnus lisp directory +into load-path. + +File `gnus-load.el' contains autoload commands, functions and variables, +some of which may not be included in distributions of Emacsen. + + + +* New packages and libraries within Gnus + +** The revised Gnus FAQ is included in the manual, *Note Frequently Asked +Questions::. + +** TLS wrapper shipped with Gnus + +TLS/SSL is now supported in IMAP and NNTP via `tls.el' and GNUTLS. The +old TLS/SSL support via (external third party) `ssl.el' and OpenSSL +still works. + +** Improved anti-spam features. + +Gnus is now able to take out spam from your mail and news streams using +a wide variety of programs and filter rules. Among the supported +methods are RBL blocklists, bogofilter and white/blacklists. Hooks for +easy use of external packages such as SpamAssassin and Hashcash are also +new. *Note Thwarting Email Spam::. + +** Gnus supports server-side mail filtering using Sieve. + +Sieve rules can be added as Group Parameters for groups, and the +complete Sieve script is generated using `D g' from the Group buffer, +and then uploaded to the server using `C-c C-l' in the generated Sieve +buffer. *Note Sieve Commands::, and the new Sieve manual *Note Top: +(sieve)Top. + + + +* Changes in group mode + +** `gnus-group-read-ephemeral-group' can be called interactively, using `G +M'. + +** Retrieval of charters and control messages + +There are new commands for fetching newsgroup charters (`H c') and +control messages (`H C'). + +** The new variable `gnus-parameters' can be used to set group parameters. + +Earlier this was done only via `G p' (or `G c'), which stored the +parameters in `~/.newsrc.eld', but via this variable you can enjoy the +powers of customize, and simplified backups since you set the variable +in `~/.gnus.el' instead of `~/.newsrc.eld'. The variable maps regular +expressions matching group names to group parameters, a'la: +(setq gnus-parameters + '(("mail\\..*" + (gnus-show-threads nil) + (gnus-use-scoring nil)) + ("^nnimap:\\(foo.bar\\)$" + (to-group . "\\1")))) + +** Unread count correct in nnimap groups. + +The estimated number of unread articles in the group buffer should now +be correct for nnimap groups. This is achieved by calling +`nnimap-fixup-unread-after-getting-new-news' from the +`gnus-setup-news-hook' (called on startup) and +`gnus-after-getting-new-news-hook'. (called after getting new mail). If +you have modified those variables from the default, you may want to add +`nnimap-fixup-unread-after-getting-new-news' again. If you were happy +with the estimate and want to save some (minimal) time when getting new +mail, remove the function. + +** Group names are treated as UTF-8 by default. + +This is supposedly what USEFOR wanted to migrate to. See +`gnus-group-name-charset-group-alist' and +`gnus-group-name-charset-method-alist' for customization. + +** `gnus-group-charset-alist' and `gnus-group-ignored-charsets-alist'. + +The regexps in these variables are compared with full group names +instead of real group names in 5.8. Users who customize these variables +should change those regexps accordingly. For example: +("^han\\>" euc-kr) -> ("\\(^\\|:\\)han\\>" euc-kr) + + + +* Changes in summary and article mode + +** `F' (`gnus-article-followup-with-original') and `R' +(`gnus-article-reply-with-original') only yank the text in the region if +the region is active. + +** In draft groups, `e' is now bound to `gnus-draft-edit-message'. Use `B +w' for `gnus-summary-edit-article' instead. ** Article Buttons -More buttons for URLs, mail addresses, Message-IDs, Info links, man pages and -Emacs or Gnus related references, see the info node "Article Buttons". The -variables `gnus-button-*-level' can be used to control the appearance of all -article buttons, see the info node "Article Button Levels". - -** Dired integration - -`gnus-dired-minor-mode' installs key bindings in dired buffers to send a file -as an attachment (`C-c C-m C-a'), open a file using the approriate mailcap -entry (`C-c C-m C-l'), and print a file using the mailcap entry (`C-c C-m -C-p'). See the info node "Other modes". - - -** Gnus can display RSS newsfeeds as a newsgroup. To get started do `B -nnrss RET RET' in the Group buffer. +More buttons for URLs, mail addresses, Message-IDs, Info links, man +pages and Emacs or Gnus related references. *Note Article Buttons::. +The variables `gnus-button-*-level' can be used to control the +appearance of all article buttons. *Note Article Button Levels::. ** Single-part yenc encoded attachments can be decoded. ** Picons -The picons code has been reimplemented to work in Emacs 21 -- some of -the previous options have been removed or renamed. + +The picons code has been reimplemented to work in GNU Emacs--some of the +previous options have been removed or renamed. Picons are small "personal icons" representing users, domain and -newsgroups, which can be displayed in the Article buffer. To enable -picons, install the picons database from +newsgroups, which can be displayed in the Article buffer. *Note +Picons::. - http://www.cs.indiana.edu/picons/ftp/index.html - -and point `gnus-picon-databases' to that location. - -** If the new option `gnus-treat-body-boundary' is `head', a boundary +** If the new option `gnus-treat-body-boundary' is non-`nil', a boundary line is drawn at the end of the headers. -** Retrieval of charters and control messages -There are new commands for fetching newsgroup charters (`H c') and -control messages (`H C'). - -** Delayed articles -You can delay the sending of a message with `C-c C-j' in the Message -buffer. The messages are delivered at specified time. This is useful -for sending yourself reminders. Setup with (gnus-delay-initialize). - -** If `auto-compression-mode' is enabled, attachments are automatically -decompressed when activated. - -** If the new option `nnml-use-compressed-files' is non-nil, -the nnml back end allows compressed message files. - ** Signed article headers (X-PGP-Sig) can be verified with `W p'. -** The Summary Buffer uses an arrow in the fringe to indicate the -current article in Emacs 21 running on a graphical display. Customize -`gnus-summary-display-arrow' to disable it. +** The Summary Buffer uses an arrow in the fringe to indicate the current +article. Use `(setq gnus-summary-display-arrow nil)' to disable it. ** Warn about email replies to news + Do you often find yourself replying to news by email by mistake? Then the new option `gnus-confirm-mail-reply-to-news' is just the thing for you. -** If the new option `gnus-summary-display-while-building' is non-nil, +** If the new option `gnus-summary-display-while-building' is non-`nil', the summary buffer is shown and updated as it's being built. -** The new `recent' mark "." indicates newly arrived messages (as -opposed to old but unread messages). - -** The new option `gnus-gcc-mark-as-read' automatically marks -Gcc articles as read. - -** The nndoc back end now supports mailman digests and exim bounces. +** The new `recent' mark `.' indicates newly arrived messages (as opposed +to old but unread messages). ** Gnus supports RFC 2369 mailing list headers, and adds a number of -related commands in mailing list groups. +related commands in mailing list groups. *Note Mailing List::. -** The Date header can be displayed in a format that can be read aloud -in English, see `gnus-treat-date-english'. - -** The envelope sender address can be customized when using Sendmail, see -`message-sendmail-envelope-from'. +** The Date header can be displayed in a format that can be read aloud in +English. *Note Article Date::. ** diffs are automatically highlighted in groups matching `mm-uu-diff-groups-regexp' -** TLS wrapper shipped with Gnus - -TLS/SSL is now supported in IMAP and NNTP via tls.el and GNUTLS. The -old TLS/SSL support via (external third party) ssl.el and OpenSSL -still works. - -** New make.bat for compiling and installing Gnus under MS Windows - -Use make.bat if you want to install Gnus under MS Windows, the first -argument to the batch-program should be the directory where xemacs.exe -respectively emacs.exe is located, iff you want to install Gnus after -compiling it, give make.bat /copy as the second parameter. - -`make.bat' has been rewritten from scratch, it now features automatic -recognition of XEmacs and GNU Emacs, generates gnus-load.el, checks if -errors occur while compilation and generation of info files and reports -them at the end of the build process. It now uses makeinfo if it is -available and falls back to infohack.el otherwise. `make.bat' should now -install all files which are necessary to run Gnus and be generally a -complete replacement for the "configure; make; make install" cycle used -under Unix systems. - -The new make.bat makes make-x.bat superfluous, so it has been removed. - -** Support for non-ASCII domain names - -Message supports non-ASCII domain names in From:, To: and Cc: and will -encode them when you try to send a message. The variable -`message-use-idna' controls this. Gnus will also decode non-ASCII -domain names in From:, To: and Cc: when you view a message. The -variable `gnus-use-idna' controls this. - ** Better handling of Microsoft citation styles Gnus now tries to recognize the mangled header block that some Microsoft @@ -155,228 +204,184 @@ though it is not quoted in any way. The variable `gnus-cite-unsightly-citation-regexp' matches the start of these citations. -** gnus-article-skip-boring +The new command `W Y f' (`gnus-article-outlook-deuglify-article') allows +deuglifying broken Outlook (Express) articles. -If you set `gnus-article-skip-boring' to t, then Gnus will not scroll -down to show you a page that contains only boring text, which by -default means cited text and signature. You can customize what is -skippable using `gnus-article-boring-faces'. +** `gnus-article-skip-boring' -This feature is especially useful if you read many articles that -consist of a little new content at the top with a long, untrimmed -message cited below. +If you set `gnus-article-skip-boring' to `t', then Gnus will not scroll +down to show you a page that contains only boring text, which by default +means cited text and signature. You can customize what is skippable +using `gnus-article-boring-faces'. -** The format spec %C for positioning point has changed to %*. +This feature is especially useful if you read many articles that consist +of a little new content at the top with a long, untrimmed message cited +below. -** The new variable `gnus-parameters' can be used to set group parameters. +** Smileys (`:-)', `;-)' etc) are now displayed graphically in Emacs too. -Earlier this was done only via `G p' (or `G c'), which stored the -parameters in ~/.newsrc.eld, but via this variable you can enjoy the -powers of customize, and simplified backups since you set the variable -in ~/.emacs instead of ~/.newsrc.eld. The variable maps regular -expressions matching group names to group parameters, a'la: +Put `(setq gnus-treat-display-smileys nil)' in `~/.gnus.el' to disable +it. - (setq gnus-parameters - '(("mail\\..*" - (gnus-show-threads nil) - (gnus-use-scoring nil)) - ("^nnimap:\\(foo.bar\\)$" - (to-group . "\\1")))) +** Face headers handling. *Note Face::. -** Smileys (":-)", ";-)" etc) are now iconized for Emacs too. +** In the summary buffer, the new command `/ N' inserts new messages and `/ +o' inserts old messages. -Customize `gnus-treat-display-smileys' to disable it. +** Gnus decodes morse encoded messages if you press `W m'. -** Gnus no longer generates the Sender: header automatically. +** `gnus-summary-line-format' -Earlier it was generated iff the user configurable email address was -different from the Gnus guessed default user address. As the guessing -algorithm is rarely correct these days, and (more controversially) the -only use of the Sender: header was to check if you are entitled to -cancel/supersede news (which is now solved by Cancel Locks instead, -see another entry), generation of the header has been disabled by -default. See the variables `message-required-headers', -`message-required-news-headers', and `message-required-mail-headers'. - -** Features from third party message-utils.el added to message.el. - -Message now asks if you wish to remove "(was: )" from -subject lines (see `message-subject-trailing-was-query'). C-c M-m and -C-c M-f inserts markers indicating included text. C-c C-f a adds a -X-No-Archive: header. C-c C-f x inserts appropriate headers and a -note in the body for cross-postings and followups (see the variables -`message-cross-post-*'). - -** References and X-Draft-Headers are no longer generated when you -start composing messages and `message-generate-headers-first' is nil. - -** Improved anti-spam features. - -Gnus is now able to take out spam from your mail and news streams -using a wide variety of programs and filter rules. Among the supported -methods are RBL blocklists, bogofilter and white/blacklists. Hooks -for easy use of external packages such as SpamAssassin and Hashcash -are also new. - -** Easy inclusion of X-Faces headers. - -** In the summary buffer, the new command / N inserts new messages and -/ o inserts old messages. - -** Gnus decodes morse encoded messages if you press W m. - -** Unread count correct in nnimap groups. - -The estimated number of unread articles in the group buffer should now -be correct for nnimap groups. This is achieved by calling -`nnimap-fixup-unread-after-getting-new-news' from the -`gnus-setup-news-hook' (called on startup) and -`gnus-after-getting-new-news-hook' (called after getting new mail). -If you have modified those variables from the default, you may want to -add n-f-u-a-g-n-n again. If you were happy with the estimate and want -to save some (minimal) time when getting new mail, remove the -function. - -** Group Carbon Copy (GCC) quoting - -To support groups that contains SPC and other weird characters, groups -are quoted before they are placed in the Gcc: header. This means -variables such as `gnus-message-archive-group' should no longer -contain quote characters to make groups containing SPC work. Also, if -you are using the string "nnml:foo, nnml:bar" (indicating Gcc into two -groups) you must change it to return the list ("nnml:foo" "nnml:bar"), -otherwise the Gcc: line will be quoted incorrectly. Note that -returning the string "nnml:foo, nnml:bar" was incorrect earlier, it -just didn't generate any problems since it was inserted directly. - -** ~/News/overview/ not used. - -As a result of the following change, the ~/News/overview/ directory is -not used any more. You can safely delete the entire hierarchy. - -** gnus-agent - -The Gnus Agent has seen a major update. It is now enabled by default, -and all nntp and nnimap servers from `gnus-select-method' and -`gnus-secondary-select-method' are agentized by default. Earlier only -the server in `gnus-select-method' was agentized by the default, and the -agent was disabled by default. When the agent is enabled, headers are -now also retrieved from the Agent cache instead of the backends when -possible. Earlier this only happened in the unplugged state. You can -enroll or remove servers with `J a' and `J r' in the server buffer. -Gnus will not download articles into the Agent cache, unless you -instruct it to do so, though, by using `J u' or `J s' from the Group -buffer. You revert to the old behaviour of having the Agent disabled -by customizing `gnus-agent'. Note that putting `(gnus-agentize)' in -~/.gnus is not needed any more. - -** gnus-summary-line-format - -The default value changed to "%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n". +The default value changed to `%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n'. Moreover `gnus-extra-headers', `nnmail-extra-headers' and `gnus-ignored-from-addresses' changed their default so that the users -name will be replaced by the recipient's name or the group name -posting to for NNTP groups. +name will be replaced by the recipient's name or the group name posting +to for NNTP groups. -** deuglify.el (gnus-article-outlook-deuglify-article) - -A new file from Raymond Scholz for deuglifying -broken Outlook (Express) articles. - -** (require 'gnus-load) - -If you use a stand-alone Gnus distribution, you'd better add -"(require 'gnus-load)" to your ~/.emacs after adding the Gnus -lisp directory into load-path. - -File gnus-load.el contains autoload commands, functions and variables, -some of which may not be included in distributions of Emacsen. - -** gnus-slave-unplugged - -A new command which starts gnus offline in slave mode. - -** message-insinuate-rmail - -Adding (message-insinuate-rmail) in .emacs and customizing -`mail-user-agent' to `gnus-user-agent' convinces Rmail to compose, -reply and forward messages in Message mode, where you can enjoy the -power of MML. - -** message-minibuffer-local-map - -The line below enables BBDB in resending a message: - -(define-key message-minibuffer-local-map [?\t] 'bbdb-complete-name) - -** Externalizing and deleting of attachments. - -If `gnus-gcc-externalize-attachments' (or -`message-fcc-externalize-attachments') is non-nil, attach local files -as external parts. +** Deleting of attachments. The command `gnus-mime-save-part-and-strip' (bound to `C-o' on MIME buttons) saves a part and replaces the part with an external one. `gnus-mime-delete-part' (bound to `d' on MIME buttons) removes a part. It works only on back ends that support editing. -** gnus-default-charset +** `gnus-default-charset' -The default value now guesses on the basis of your environment instead -of using Latin-1. Also the ".*" item in gnus-group-charset-alist is -removed. - -** gnus-posting-styles - -Add a new format of match like - - ((header "to" "larsi.*org") - (Organization "Somewhere, Inc.")) - -The old format like the lines below is obsolete, but still accepted. - - (header "to" "larsi.*org" - (Organization "Somewhere, Inc.")) - -** message-ignored-news-headers and message-ignored-mail-headers - -X-Draft-From and X-Gnus-Agent-Meta-Information have been added into -these two variables. If you customized those, perhaps you need add -those two headers too. - -** Gnus reads the NOV and articles in the Agent if plugged. - -If one reads an article while plugged, and the article already exists -in the Agent, it won't get downloaded once more. Customize -`gnus-agent-cache' to revert to the old behavior. - -** Gnus supports the "format=flowed" (RFC 2646) parameter. - -On composing messages, it is enabled by `use-hard-newlines'. Decoding -format=flowed was present but not documented in earlier versions. - -** The option `mm-fill-flowed' can be used to disable treatment of -format=flowed messages. Also, flowed text is disabled when sending -inline PGP signed messages. (New in Gnus 5.10.8) - -** The tool bar icons are now (de)activated correctly in the group -buffer, see the variable `gnus-group-update-tool-bar'. It's default -value depends on your Emacs version. (New in Gnus 5.10.8) - -** Gnus supports the generation of RFC 2298 Disposition Notification requests. - -This is invoked with the C-c M-n key binding from message mode. - -** Gnus supports Maildir groups. - -Gnus includes a new backend nnmaildir.el. +The default value is determined from the `current-language-environment' +variable, instead of `iso-8859-1'. Also the `.*' item in +`gnus-group-charset-alist' is removed. ** Printing capabilities are enhanced. -Gnus supports Muttprint natively with O P from the Summary and Article -buffers. Also, each individual MIME part can be printed using p on +Gnus supports Muttprint natively with `O P' from the Summary and Article +buffers. Also, each individual MIME part can be printed using `p' on the MIME button. +** Extended format specs. + +Format spec `%&user-date;' is added into +`gnus-summary-line-format-alist'. Also, user defined extended format +specs are supported. The extended format specs look like `%u&foo;', +which invokes function `gnus-user-format-function-FOO'. Because `&' is +used as the escape character, old user defined format `%u&' is no longer +supported. + +** `/ *' (`gnus-summary-limit-include-cached') is rewritten. + +It was aliased to `Y c' (`gnus-summary-insert-cached-articles'). The +new function filters out other articles. + +** Some limiting commands accept a `C-u' prefix to negate the match. + +If `C-u' is used on subject, author or extra headers, i.e., `/ s', `/ +a', and `/ x' (`gnus-summary-limit-to-{subject,author,extra}') +respectively, the result will be to display all articles that do not +match the expression. + +** Gnus inlines external parts (message/external). + + + +* Changes in Message mode and related Gnus features + +** Delayed articles + +You can delay the sending of a message with `C-c C-j' in the Message +buffer. The messages are delivered at specified time. This is useful +for sending yourself reminders. *Note Delayed Articles::. + +** If the new option `nnml-use-compressed-files' is non-`nil', the nnml +back end allows compressed message files. + +** The new option `gnus-gcc-mark-as-read' automatically marks Gcc articles +as read. + +** Externalizing of attachments + +If `gnus-gcc-externalize-attachments' or +`message-fcc-externalize-attachments' is non-`nil', attach local files +as external parts. + +** The envelope sender address can be customized when using Sendmail. + *Note Mail Variables: (message)Mail Variables. + +** Gnus no longer generate the Sender: header automatically. + +Earlier it was generated iff the user configurable email address was +different from the Gnus guessed default user address. As the guessing +algorithm is rarely correct these days, and (more controversially) the +only use of the Sender: header was to check if you are entitled to +cancel/supersede news (which is now solved by Cancel Locks instead, see +another entry), generation of the header has been disabled by default. +See the variables `message-required-headers', +`message-required-news-headers', and `message-required-mail-headers'. + +** Features from third party `message-utils.el' added to `message.el'. + +Message now asks if you wish to remove `(was: )' from +subject lines (see `message-subject-trailing-was-query'). `C-c M-m' and +`C-c M-f' inserts markers indicating included text. `C-c C-f a' adds a +X-No-Archive: header. `C-c C-f x' inserts appropriate headers and a +note in the body for cross-postings and followups (see the variables +`message-cross-post-*'). + +** References and X-Draft-From headers are no longer generated when you +start composing messages and `message-generate-headers-first' is `nil'. + +** Easy inclusion of X-Faces headers. *Note X-Face::. + +** Group Carbon Copy (GCC) quoting + +To support groups that contains SPC and other weird characters, groups +are quoted before they are placed in the Gcc: header. This means +variables such as `gnus-message-archive-group' should no longer contain +quote characters to make groups containing SPC work. Also, if you are +using the string `nnml:foo, nnml:bar' (indicating Gcc into two groups) +you must change it to return the list `("nnml:foo" "nnml:bar")', +otherwise the Gcc: line will be quoted incorrectly. Note that returning +the string `nnml:foo, nnml:bar' was incorrect earlier, it just didn't +generate any problems since it was inserted directly. + +** `message-insinuate-rmail' + +Adding `(message-insinuate-rmail)' and `(setq mail-user-agent +'gnus-user-agent)' in `.emacs' convinces Rmail to compose, reply and +forward messages in message-mode, where you can enjoy the power of MML. + +** `message-minibuffer-local-map' + +The line below enables BBDB in resending a message: +(define-key message-minibuffer-local-map [(tab)] + 'bbdb-complete-name) + +** `gnus-posting-styles' + +Add a new format of match like +((header "to" "larsi.*org") + (Organization "Somewhere, Inc.")) +The old format like the lines below is obsolete, but still accepted. +(header "to" "larsi.*org" + (Organization "Somewhere, Inc.")) + +** `message-ignored-news-headers' and `message-ignored-mail-headers' + +`X-Draft-From' and `X-Gnus-Agent-Meta-Information' have been added into +these two variables. If you customized those, perhaps you need add +those two headers too. + +** Gnus supports the "format=flowed" (RFC 2646) parameter. On composing +messages, it is enabled by `use-hard-newlines'. Decoding format=flowed +was present but not documented in earlier versions. + +** The option `mm-fill-flowed' can be used to disable treatment of +"format=flowed" messages. Also, flowed text is disabled when sending +inline PGP signed messages. (New in Gnus 5.10.7) + +** Gnus supports the generation of RFC 2298 Disposition Notification +requests. + +This is invoked with the `C-c M-n' key binding from message mode. + ** Message supports the Importance: (RFC 2156) header. In the message buffer, `C-c C-f C-i' or `C-c C-u' cycles through the @@ -384,151 +389,130 @@ valid values. ** Gnus supports Cancel Locks in News. -This means a header "Cancel-Lock" is inserted in news posting. It is -used to determine if you wrote a article or not (for cancelling and +This means a header `Cancel-Lock' is inserted in news posting. It is +used to determine if you wrote an article or not (for canceling and superseding). Gnus generates a random password string the first time -you post a message, and saves it using the Custom system. While the -variable is called `canlock-password', it is not security sensitive -data. Publishing your canlock string on the web will not allow anyone -to be able to anything she could not already do. The behaviour can be -changed by customizing `message-insert-canlock'. +you post a message, and saves it in your `~/.emacs' using the Custom +system. While the variable is called `canlock-password', it is not +security sensitive data. Publishing your canlock string on the web will +not allow anyone to be able to anything she could not already do. The +behavior can be changed by customizing `message-insert-canlock'. -** Gnus supports server-side mail filtering using Sieve. - -Sieve rules can be added as Group Parameters for groups, and the -complete Sieve script is generated using `D g' from the Group buffer, -and then uploaded to the server using `C-c C-l' in the generated Sieve -buffer. Search the online Gnus manual for "sieve", and see the new -Sieve manual, for more information. - -** Extended format specs. - -Format spec "%&user-date;" is added into -`gnus-summary-line-format-alist'. Also, user defined extended format -specs are supported. The extended format specs look like "%u&foo;", -which invokes function `gnus-user-format-function-foo'. Because "&" is -used as the escape character, old user defined format "%u&" is no -longer supported. - -** `/ *' (gnus-summary-limit-include-cached) is rewritten. - -It was aliased to `Y c' (gnus-summary-insert-cached-articles). The new -function filters out other articles. - -** Some limiting commands accept a C-u prefix to negate the match. - -If C-u is used on subject, author or extra headers, i.e., `/ s', `/ -a', and `/ x' (gnus-summary-limit-to-{subject,author,extra}) -respectively, the result will be to display all articles that do not -match the expression. - -** Group names are treated as UTF-8 by default. - -This is supposedly what USEFOR wanted to migrate to. See -`gnus-group-name-charset-group-alist' and -`gnus-group-name-charset-method-alist' for customization. - -** The nnml and nnfolder backends store marks for each group. - -This makes it possible to take backup of nnml/nnfolder servers/groups -separately of ~/.newsrc.eld, while preserving marks. It also makes it -possible to share articles and marks between users (without sharing -the ~/.newsrc.eld file) within e.g. a department. It works by storing -the marks stored in ~/.newsrc.eld in a per-group file ".marks" (for -nnml) and "groupname.mrk" (for nnfolder, named "groupname"). If the -nnml/nnfolder is moved to another machine, Gnus will automatically use -the .marks or .mrk file instead of the information in ~/.newsrc.eld. -The new server variables `nnml-marks-is-evil' and -`nnfolder-marks-is-evil' can be used to disable this feature. - -** The menu bar item (in Group and Summary buffer) named "Misc" has -been renamed to "Gnus". - -** The menu bar item (in Message mode) named "MML" has been renamed to -"Attachments". Note that this menu also contains security related -stuff, like signing and encryption. - -** gnus-group-charset-alist and gnus-group-ignored-charsets-alist. - -The regexps in these variables are compared with full group names -instead of real group names in 5.8. Users who customize these -variables should change those regexps accordingly. For example: - - ("^han\\>" euc-kr) -> ("\\(^\\|:\\)han\\>" euc-kr) - -** Gnus supports PGP (RFC 1991/2440), PGP/MIME (RFC 2015/3156) and -S/MIME (RFC 2630-2633). +** Gnus supports PGP (RFC 1991/2440), PGP/MIME (RFC 2015/3156) and S/MIME +(RFC 2630-2633). It needs an external S/MIME and OpenPGP implementation, but no -additional lisp libraries. This add several menu items to the -Attachments menu, and C-c RET key bindings, when composing messages. +additional Lisp libraries. This add several menu items to the +Attachments menu, and `C-c RET' key bindings, when composing messages. This also obsoletes `gnus-article-hide-pgp-hook'. -** Gnus inlines external parts (message/external). - ** MML (Mime compose) prefix changed from `M-m' to `C-c C-m'. This change was made to avoid conflict with the standard binding of `back-to-indentation', which is also useful in message mode. -** The default for message-forward-show-mml changed to symbol best. +** The default for `message-forward-show-mml' changed to the symbol `best'. -The behaviour for the `best' value is to show MML (i.e., convert MIME -to MML) when appropriate. MML will not be used when forwarding signed -or encrypted messages, as the conversion invalidate the digital -signature. +The behavior for the `best' value is to show MML (i.e., convert to MIME) +when appropriate. MML will not be used when forwarding signed or +encrypted messages, as the conversion invalidate the digital signature. + +** If `auto-compression-mode' is enabled, attachments are automatically +decompressed when activated. + +** Support for non-ASCII domain names + +Message supports non-ASCII domain names in From:, To: and Cc: and will +query you whether to perform encoding when you try to send a message. +The variable `message-use-idna' controls this. Gnus will also decode +non-ASCII domain names in From:, To: and Cc: when you view a message. +The variable `gnus-use-idna' controls this. + +** You can now drag and drop attachments to the Message buffer. See +`mml-dnd-protocol-alist' and `mml-dnd-attach-options'. *Note MIME: +(message)MIME. -** Bug fixes. -* Changes in Pterodactyl Gnus (5.8/5.9) +* Changes in back ends -The Gnus NEWS entries are short, but they reflect sweeping changes in -four areas: Article display treatment, MIME treatment, -internationalization and mail-fetching. +** Gnus can display RSS newsfeeds as a newsgroup. *Note RSS::. -** The mail-fetching functions have changed. See the manual for the -many details. In particular, all procmail fetching variables are gone. +** The nndoc back end now supports mailman digests and exim bounces. -If you used procmail like in +** Gnus supports Maildir groups. -(setq nnmail-use-procmail t) -(setq nnmail-spool-file 'procmail) -(setq nnmail-procmail-directory "~/mail/incoming/") -(setq nnmail-procmail-suffix "\\.in") +Gnus includes a new back end `nnmaildir.el'. *Note Maildir::. -this now has changed to +** The nnml and nnfolder back ends store marks for each groups. -(setq mail-sources - '((directory :path "~/mail/incoming/" - :suffix ".in"))) +This makes it possible to take backup of nnml/nnfolder servers/groups +separately of `~/.newsrc.eld', while preserving marks. It also makes it +possible to share articles and marks between users (without sharing the +`~/.newsrc.eld' file) within e.g. a department. It works by storing the +marks stored in `~/.newsrc.eld' in a per-group file `.marks' (for nnml) +and `GROUPNAME.mrk' (for nnfolder, named GROUPNAME). If the +nnml/nnfolder is moved to another machine, Gnus will automatically use +the `.marks' or `.mrk' file instead of the information in +`~/.newsrc.eld'. The new server variables `nnml-marks-is-evil' and +`nnfolder-marks-is-evil' can be used to disable this feature. -More information is available in the info doc at Select Methods -> -Getting Mail -> Mail Sources -** Gnus is now a MIME-capable reader. This affects many parts of -Gnus, and adds a slew of new commands. See the manual for details. + +* Appearance -** Gnus has also been multilingualized. This also affects too -many parts of Gnus to summarize here, and adds many new variables. +** The menu bar item (in Group and Summary buffer) named "Misc" has been +renamed to "Gnus". -** gnus-auto-select-first can now be a function to be -called to position point. +** The menu bar item (in Message mode) named "MML" has been renamed to +"Attachments". Note that this menu also contains security related +stuff, like signing and encryption (*note Security: (message)Security.). -** The user can now decide which extra headers should be included in -summary buffers and NOV files. +** The tool bars have been updated to use GNOME icons in Group, Summary and +Message mode. You can also customize the tool bars. This is a new +feature in Gnus 5.10.9. (Only for Emacs, not in XEmacs.) -** `gnus-article-display-hook' has been removed. Instead, a number -of variables starting with `gnus-treat-' have been added. +** The tool bar icons are now (de)activated correctly in the group buffer, +see the variable `gnus-group-update-tool-bar'. Its default value +depends on your Emacs version. This is a new feature in Gnus 5.10.9. -** The Gnus posting styles have been redone again and now works in a -subtly different manner. + +* Miscellaneous changes -** New web-based backends have been added: nnslashdot, nnwarchive -and nnultimate. nnweb has been revamped, again, to keep up with -ever-changing layouts. +** `gnus-agent' + +The Gnus Agent has seen a major updated and is now enabled by default, +and all nntp and nnimap servers from `gnus-select-method' and +`gnus-secondary-select-method' are agentized by default. Earlier only +the server in `gnus-select-method' was agentized by the default, and the +agent was disabled by default. When the agent is enabled, headers are +now also retrieved from the Agent cache instead of the back ends when +possible. Earlier this only happened in the unplugged state. You can +enroll or remove servers with `J a' and `J r' in the server buffer. +Gnus will not download articles into the Agent cache, unless you +instruct it to do so, though, by using `J u' or `J s' from the Group +buffer. You revert to the old behavior of having the Agent disabled +with `(setq gnus-agent nil)'. Note that putting `(gnus-agentize)' in +`~/.gnus.el' is not needed any more. + +** Gnus reads the NOV and articles in the Agent if plugged. + +If one reads an article while plugged, and the article already exists in +the Agent, it won't get downloaded once more. `(setq gnus-agent-cache +nil)' reverts to the old behavior. + +** Dired integration + +`gnus-dired-minor-mode' (see *Note Other modes::) installs key bindings +in dired buffers to send a file as an attachment, open a file using the +appropriate mailcap entry, and print a file using the mailcap entry. + +** The format spec `%C' for positioning point has changed to `%*'. + +** `gnus-slave-unplugged' + +A new command which starts Gnus offline in slave mode. -** Gnus can now read IMAP mail via nnimap. * For older news, see Gnus info node "New Features". @@ -536,8 +520,8 @@ ever-changing layouts. ---------------------------------------------------------------------- Copyright information: -Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Free Software Foundation, Inc. +Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index beccd918c3e..750956b9f8b 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,12 @@ +2006-07-28 Katsumi Yamaoka + + * nnheader.el (nnheader-insert-head): Make it work with Mac as well. + +2006-07-27 Katsumi Yamaoka + + * nnheader.el (nnheader-insert-head): Make it work even if the file + uses CRLF for the line-break code. + 2006-07-19 Andreas Seltenreich * mm-url.el (mm-url-insert-file-contents): Inhibit Connection: close diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el index d564d42414e..79732cd3d88 100644 --- a/lisp/gnus/nnheader.el +++ b/lisp/gnus/nnheader.el @@ -586,17 +586,27 @@ the line could be found." (if (eq nnheader-max-head-length t) ;; Just read the entire file. (nnheader-insert-file-contents file) - ;; Read 1K blocks until we find a separator. + ;; Read blocks of the size specified by `nnheader-head-chop-length' + ;; until we find a separator. (let ((beg 0) - format-alist) + (start (point)) + ;; Use `binary' to prevent the contents from being decoded, + ;; or it will change the number of characters that + ;; `insert-file-contents' returns. + (coding-system-for-read 'binary)) (while (and (eq nnheader-head-chop-length - (nth 1 (nnheader-insert-file-contents + (nth 1 (mm-insert-file-contents file nil beg (incf beg nnheader-head-chop-length)))) - (prog1 (not (search-forward "\n\n" nil t)) + ;; CRLF of CR might be used for the line-break code. + (prog1 (not (re-search-forward "\n\r?\n\\|\r\r" nil t)) (goto-char (point-max))) (or (null nnheader-max-head-length) - (< beg nnheader-max-head-length)))))) + (< beg nnheader-max-head-length)))) + ;; Finally decode the contents. + (when (mm-coding-system-p nnheader-file-coding-system) + (mm-decode-coding-region start (point-max) + nnheader-file-coding-system)))) t)) (defun nnheader-article-p () diff --git a/man/ChangeLog b/man/ChangeLog index 0c619689e58..efaff2d173f 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,13 @@ +2006-07-28 Katsumi Yamaoka + + * gnus.texi (Oort Gnus): Mention that the Lisp files are now installed + in .../site-lisp/gnus/ by default. + [ From gnus-news.texi in the trunk. ] + +2006-07-27 Reiner Steib + + * gnus.texi (MIME Commands): Additions for yEnc. + 2006-07-31 Nick Roberts * building.texi (GDB commands in Fringe): Rename to... diff --git a/man/gnus.texi b/man/gnus.texi index 9092999dfc9..6e350bc4517 100644 --- a/man/gnus.texi +++ b/man/gnus.texi @@ -9372,11 +9372,15 @@ default is @code{nil}. @item gnus-article-emulate-mime @vindex gnus-article-emulate-mime +@cindex uuencode +@cindex yEnc There are other, non-@acronym{MIME} encoding methods used. The most common is @samp{uuencode}, but yEncode is also getting to be popular. If this variable is non-@code{nil}, Gnus will look in message bodies to see if it finds these encodings, and if so, it'll run them through the -Gnus @acronym{MIME} machinery. The default is @code{t}. +Gnus @acronym{MIME} machinery. The default is @code{t}. Only +single-part yEnc encoded attachments can be decoded. There's no support +for encoding in Gnus. @item gnus-unbuttonized-mime-types @vindex gnus-unbuttonized-mime-types @@ -26074,6 +26078,14 @@ read from your @file{.newsrc.eld} instead of from the later entry for more information about marks. Note that downgrading isn't save in general. +@item +Lisp files are now installed in @file{.../site-lisp/gnus/} by default. +It defaulted to @file{.../site-lisp/} formerly. In addition to this, +the new installer issues a warning if other Gnus installations which +will shadow the latest one are detected. You can then remove those +shadows manually or remove them using @code{make +remove-installed-shadows}. + @item New @file{make.bat} for compiling and installing Gnus under MS Windows From ec77710195cd7112365c653f5bc24176c9267a33 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 31 Jul 2006 10:55:56 +0000 Subject: [PATCH 045/361] *** empty log message *** --- lispref/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 8113a30af25..2b20fb9e2a9 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,9 @@ +2006-07-31 Nick Roberts + + * modes.texi (Minor Mode Conventions): Update link for add-to-list. + + * lists.texi (Sets And Lists): Likewise. + 2006-07-30 Thien-Thi Nguyen * text.texi (Fields): Mention POS From c45ab038a42ff8a9889fb9b6db44ae50a5f6396a Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 31 Jul 2006 10:56:25 +0000 Subject: [PATCH 046/361] (Minor Mode Conventions): Update link for add-to-list. --- lispref/modes.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lispref/modes.texi b/lispref/modes.texi index b0c057ec1c9..8b4188ecff2 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi @@ -1295,7 +1295,7 @@ check for an existing element, to avoid duplication. For example: @end smallexample @noindent -or like this, using @code{add-to-list} (@pxref{Setting Variables}): +or like this, using @code{add-to-list} (@pxref{List Variables}): @smallexample @group From ab04a72ade2cbc1eb2f4ecd5b0940c43ce14cf54 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 31 Jul 2006 10:57:16 +0000 Subject: [PATCH 047/361] (Sets And Lists): Update link for add-to-list. --- lispref/lists.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lispref/lists.texi b/lispref/lists.texi index cb60baef900..1c6247d818c 100644 --- a/lispref/lists.texi +++ b/lispref/lists.texi @@ -1489,7 +1489,7 @@ several @code{equal} occurrences of an element in @var{list}, @code{delete-dups} keeps the first one. @end defun - See also the function @code{add-to-list}, in @ref{Setting Variables}, + See also the function @code{add-to-list}, in @ref{List Variables}, for another way to add an element to a list stored in a variable. @node Association Lists From 29d74a46781a27422043639c27d1c333d553a066 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 31 Jul 2006 18:30:24 +0000 Subject: [PATCH 048/361] (Query Replace): Add xref for Dired's Q command. --- man/search.texi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/man/search.texi b/man/search.texi index 282b36e3a50..9bf71a7efdb 100644 --- a/man/search.texi +++ b/man/search.texi @@ -1241,8 +1241,10 @@ line. used the minibuffer to read its arguments. @xref{Repetition, C-x ESC ESC}. - See also @ref{Transforming File Names}, for Dired commands to rename, -copy, or link files by replacing regexp matches in file names. + @xref{Operating on Files}, for the Dired @kbd{Q} command which +performs query replace on selected files. See also @ref{Transforming +File Names}, for Dired commands to rename, copy, or link files by +replacing regexp matches in file names. @node Other Repeating Search @section Other Search-and-Loop Commands From 47f6532e25e2eb2bba5531d9bff45712c3b2b5b4 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 31 Jul 2006 18:32:16 +0000 Subject: [PATCH 049/361] (Face Functions): Fix explanations of FRAME=t or nil. --- lispref/display.texi | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lispref/display.texi b/lispref/display.texi index bcf32a508c8..e762c14a7f0 100644 --- a/lispref/display.texi +++ b/lispref/display.texi @@ -2048,10 +2048,8 @@ suitable for use with @code{:stipple} (see above). It returns @node Attribute Functions @subsection Face Attribute Functions - You can modify the attributes of an existing face with the following -functions. If you specify @var{frame}, they affect just that frame; -otherwise, they affect all frames as well as the defaults that apply to -new frames. + This section describes the functions for accessing and modifying the +attributes of an existing face. @defun set-face-attribute face frame &rest arguments This function sets one or more attributes of face @var{face} for frame @@ -2074,10 +2072,12 @@ Thus, sets the attributes @code{:width}, @code{:weight} and @code{:underline} to the corresponding values. -If @var{frame} is @code{t}, this function sets the attributes for all -existing frames, and sets defaults that will apply for new frames. -Default attribute values specified this way override the -@code{defface} for newly created frames. +If @var{frame} is @code{t}, this function sets the default attributes +for new frames. Default attribute values specified this way override +the @code{defface} for newly created frames. + +If @var{frame} is @code{nil}, this function sets the attributes for +all existing frames, and the default for new frames. @end defun @defun face-attribute face attribute &optional frame inherit @@ -2142,6 +2142,8 @@ face attribute @var{attribute}, returns @var{value1} unchanged. The functions above did not exist before Emacs 21. For compatibility with older Emacs versions, you can use the following functions to set and examine the face attributes which existed in those versions. +They use values of @code{t} and @code{nil} for @var{frame} +just like @code{set-face-attribute} and @code{face-attribute}. @defun set-face-foreground face color &optional frame @defunx set-face-background face color &optional frame @@ -2198,9 +2200,10 @@ This function swaps the foreground and background colors of face @end defun These functions examine the attributes of a face. If you don't -specify @var{frame}, they refer to the default data for new frames. -They return the symbol @code{unspecified} if the face doesn't define any -value for that attribute. +specify @var{frame}, they refer to the selected frame; @code{t} refers +to the default data for new frames. They return the symbol +@code{unspecified} if the face doesn't define any value for that +attribute. @defun face-foreground face &optional frame inherit @defunx face-background face &optional frame inherit From 2410b13a189d3196e831bc0404394578575fe684 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 31 Jul 2006 18:34:36 +0000 Subject: [PATCH 050/361] (Top): Update subnode menu. --- lispref/elisp.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lispref/elisp.texi b/lispref/elisp.texi index bbf91a8be10..15f33aaf8ae 100644 --- a/lispref/elisp.texi +++ b/lispref/elisp.texi @@ -1039,8 +1039,8 @@ Operating System Interface * Processor Run Time:: Getting the run time used by Emacs. * Time Calculations:: Adding, subtracting, comparing times, etc. * Timers:: Setting a timer to call a function at a certain time. -* Terminal Input:: Recording terminal input for debugging. -* Terminal Output:: Recording terminal output for debugging. +* Terminal Input:: Accessing and recordingo terminal input. +* Terminal Output:: Controlling and recording terminal output. * Sound Output:: Playing sounds on the computer's speaker. * X11 Keysyms:: Operating on key symbols for X Windows * Batch Mode:: Running Emacs without terminal interaction. From f044bf27111d1a6000a0f6e987d8bdb10c4bbe9a Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 31 Jul 2006 18:37:18 +0000 Subject: [PATCH 051/361] (Translation Keymaps): New node. Update xrefs from Translating Input to Translation Keymaps. --- lispref/keymaps.texi | 124 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi index f93c94b8dfe..44b92ddfcb8 100644 --- a/lispref/keymaps.texi +++ b/lispref/keymaps.texi @@ -33,6 +33,7 @@ found. The whole process is called @dfn{key lookup}. * Functions for Key Lookup:: How to request key lookup. * Changing Key Bindings:: Redefining a key in a keymap. * Remapping Commands:: Bindings that translate one command to another. +* Translation Keymaps:: Keymaps for translating sequences of events. * Key Binding Commands:: Interactive interfaces for redefining keys. * Scanning Keymaps:: Looking through all keymaps, for printing help. * Menu Keymaps:: Defining a menu as a keymap. @@ -642,7 +643,7 @@ only when the mode is used for the first time in a session. and exit commands. @xref{Intro to Minibuffers}. Emacs has other keymaps that are used in a different way---translating -events within @code{read-key-sequence}. @xref{Translating Input}. +events within @code{read-key-sequence}. @xref{Translation Keymaps}. @xref{Standard Keymaps}, for a list of standard keymaps. @@ -682,7 +683,7 @@ An error is signaled if @var{key} is not a string or a vector. @node Searching Keymaps @section Searching the Active Keymaps - After translation of the input events (@pxref{Translating Input}) + After translation of event subsequences (@pxref{Translation Keymaps}) Emacs looks for them in the active keymaps. Here is a pseudo-Lisp description of the order in which the active keymaps are searched: @@ -1472,6 +1473,125 @@ given the current active keymaps. If @var{command} is not remapped @code{nil}. @end defun +@node Translation Keymaps +@section Keymaps for Translating Sequences of Events + + This section describes keymaps that are used during reading a key +sequence, to translate certain event sequences into others. +@code{read-key-sequence} checks every subsequence of the key sequence +being read, as it is read, against @code{function-key-map} and then +against @code{key-translation-map}. + +@defvar function-key-map +This variable holds a keymap that describes the character sequences sent +by function keys on an ordinary character terminal. This keymap has the +same structure as other keymaps, but is used differently: it specifies +translations to make while reading key sequences, rather than bindings +for key sequences. + +If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector +@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a +key sequence, it is replaced with the events in @var{v}. + +For example, VT100 terminals send @kbd{@key{ESC} O P} when the +keypad @key{PF1} key is pressed. Therefore, we want Emacs to translate +that sequence of events into the single event @code{pf1}. We accomplish +this by ``binding'' @kbd{@key{ESC} O P} to @code{[pf1]} in +@code{function-key-map}, when using a VT100. + +Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c +@key{ESC} O P}; later the function @code{read-key-sequence} translates +this back into @kbd{C-c @key{PF1}}, which it returns as the vector +@code{[?\C-c pf1]}. + +Entries in @code{function-key-map} are ignored if they conflict with +bindings made in the minor mode, local, or global keymaps. The intent +is that the character sequences that function keys send should not have +command bindings in their own right---but if they do, the ordinary +bindings take priority. + +The value of @code{function-key-map} is usually set up automatically +according to the terminal's Terminfo or Termcap entry, but sometimes +those need help from terminal-specific Lisp files. Emacs comes with +terminal-specific files for many common terminals; their main purpose is +to make entries in @code{function-key-map} beyond those that can be +deduced from Termcap and Terminfo. @xref{Terminal-Specific}. +@end defvar + +@defvar key-translation-map +This variable is another keymap used just like @code{function-key-map} +to translate input events into other events. It differs from +@code{function-key-map} in two ways: + +@itemize @bullet +@item +@code{key-translation-map} goes to work after @code{function-key-map} is +finished; it receives the results of translation by +@code{function-key-map}. + +@item +Non-prefix bindings in @code{key-translation-map} override actual key +bindings. For example, if @kbd{C-x f} has a non-prefix binding in +@code{key-translation-map}, that translation takes effect even though +@kbd{C-x f} also has a key binding in the global map. +@end itemize + +Note however that actual key bindings can have an effect on +@code{key-translation-map}, even though they are overridden by it. +Indeed, actual key bindings override @code{function-key-map} and thus +may alter the key sequence that @code{key-translation-map} receives. +Clearly, it is better to avoid this type of situation. + +The intent of @code{key-translation-map} is for users to map one +character set to another, including ordinary characters normally bound +to @code{self-insert-command}. +@end defvar + +@cindex key translation function +You can use @code{function-key-map} or @code{key-translation-map} for +more than simple aliases, by using a function, instead of a key +sequence, as the ``translation'' of a key. Then this function is called +to compute the translation of that key. + +The key translation function receives one argument, which is the prompt +that was specified in @code{read-key-sequence}---or @code{nil} if the +key sequence is being read by the editor command loop. In most cases +you can ignore the prompt value. + +If the function reads input itself, it can have the effect of altering +the event that follows. For example, here's how to define @kbd{C-c h} +to turn the character that follows into a Hyper character: + +@example +@group +(defun hyperify (prompt) + (let ((e (read-event))) + (vector (if (numberp e) + (logior (lsh 1 24) e) + (if (memq 'hyper (event-modifiers e)) + e + (add-event-modifier "H-" e)))))) + +(defun add-event-modifier (string e) + (let ((symbol (if (symbolp e) e (car e)))) + (setq symbol (intern (concat string + (symbol-name symbol)))) +@end group +@group + (if (symbolp e) + symbol + (cons symbol (cdr e))))) + +(define-key function-key-map "\C-ch" 'hyperify) +@end group +@end example + + If you have enabled keyboard character set decoding using +@code{set-keyboard-coding-system}, decoding is done after the +translations listed above. @xref{Terminal I/O Encoding}. However, in +future Emacs versions, character set decoding may be done at an +earlier stage. + @node Key Binding Commands @section Commands for Binding Keys From 1352a2031978d9358d7ca2d87ca298fb445323d0 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 31 Jul 2006 18:39:14 +0000 Subject: [PATCH 052/361] Update xrefs from Translating Input to Translation Keymaps. --- lispref/maps.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lispref/maps.texi b/lispref/maps.texi index ec7728f7840..cdbd655eb3c 100644 --- a/lispref/maps.texi +++ b/lispref/maps.texi @@ -115,7 +115,7 @@ Properties menu. @item function-key-map The keymap for translating keypad and function keys.@* If there are none, then it contains an empty sparse keymap. -@xref{Translating Input}. +@xref{Translation Keymaps}. @item fundamental-mode-map @vindex fundamental-mode-map @@ -158,7 +158,7 @@ search. @item key-translation-map A keymap for translating keys. This one overrides ordinary key -bindings, unlike @code{function-key-map}. @xref{Translating Input}. +bindings, unlike @code{function-key-map}. @xref{Translation Keymaps}. @item kmacro-map @vindex kmacro-map From 160ab7f94edfc632d89cea3cf149bdefb0adb825 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 31 Jul 2006 18:41:58 +0000 Subject: [PATCH 053/361] Update xrefs. (Event Mod): New node, cut out from old Translating Input. --- lispref/commands.texi | 89 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 4 deletions(-) diff --git a/lispref/commands.texi b/lispref/commands.texi index 10cd97400f8..8e34fe360bf 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi @@ -1087,7 +1087,7 @@ Lisp programs by representing the former as the integer 9, and the latter as the symbol @code{tab}. Most of the time, it's not useful to distinguish the two. So normally -@code{function-key-map} (@pxref{Translating Input}) is set up to map +@code{function-key-map} (@pxref{Translation Keymaps}) is set up to map @code{tab} into 9. Thus, a key binding for character code 9 (the character @kbd{C-i}) also applies to @code{tab}. Likewise for the other symbols in this group. The function @code{read-char} likewise converts @@ -2051,14 +2051,14 @@ functions for event input are also available for use in Lisp programs. See also @code{momentary-string-display} in @ref{Temporary Displays}, and @code{sit-for} in @ref{Waiting}. @xref{Terminal Input}, for functions and variables for controlling terminal input modes and -debugging terminal input. @xref{Translating Input}, for features you -can use for translating or modifying input events while reading them. +debugging terminal input. For higher-level input facilities, see @ref{Minibuffers}. @menu * Key Sequence Input:: How to read one key sequence. * Reading One Event:: How to read just one event. +* Event Mod:: How Emacs modifies events as they are read. * Invoking the Input Method:: How reading an event uses the input method. * Quoted Character Input:: Asking the user to specify a character. * Event Input Misc:: How to reread or throw away input events. @@ -2088,7 +2088,7 @@ events---characters, symbols, and lists. The elements of the string or vector are the events in the key sequence. Reading a key sequence includes translating the events in various -ways. @xref{Translating Input}. +ways. @xref{Translation Keymaps}. The argument @var{prompt} is either a string to be displayed in the echo area as a prompt, or @code{nil}, meaning not to display a prompt. @@ -2290,6 +2290,87 @@ This variable holds the total number of input events received so far from the terminal---not counting those generated by keyboard macros. @end defvar +@node Event Mod +@subsection Modifying and Translating Input Events + + Emacs modifies every event it reads according to +@code{extra-keyboard-modifiers}, then translates it through +@code{keyboard-translate-table} (if applicable), before returning it +from @code{read-event}. + +@c Emacs 19 feature +@defvar extra-keyboard-modifiers +This variable lets Lisp programs ``press'' the modifier keys on the +keyboard. The value is a character. Only the modifiers of the +character matter. Each time the user types a keyboard key, it is +altered as if those modifier keys were held down. For instance, if +you bind @code{extra-keyboard-modifiers} to @code{?\C-\M-a}, then all +keyboard input characters typed during the scope of the binding will +have the control and meta modifiers applied to them. The character +@code{?\C-@@}, equivalent to the integer 0, does not count as a control +character for this purpose, but as a character with no modifiers. +Thus, setting @code{extra-keyboard-modifiers} to zero cancels any +modification. + +When using a window system, the program can ``press'' any of the +modifier keys in this way. Otherwise, only the @key{CTL} and @key{META} +keys can be virtually pressed. + +Note that this variable applies only to events that really come from +the keyboard, and has no effect on mouse events or any other events. +@end defvar + +@defvar keyboard-translate-table +This variable is the translate table for keyboard characters. It lets +you reshuffle the keys on the keyboard without changing any command +bindings. Its value is normally a char-table, or else @code{nil}. +(It can also be a string or vector, but this is considered obsolete.) + +If @code{keyboard-translate-table} is a char-table +(@pxref{Char-Tables}), then each character read from the keyboard is +looked up in this char-table. If the value found there is +non-@code{nil}, then it is used instead of the actual input character. + +Note that this translation is the first thing that happens to a +character after it is read from the terminal. Record-keeping features +such as @code{recent-keys} and dribble files record the characters after +translation. + +Note also that this translation is done before the characters are +supplied to input methods (@pxref{Input Methods}). Use +@code{translation-table-for-input} (@pxref{Translation of Characters}), +if you want to translate characters after input methods operate. +@end defvar + +@defun keyboard-translate from to +This function modifies @code{keyboard-translate-table} to translate +character code @var{from} into character code @var{to}. It creates +the keyboard translate table if necessary. +@end defun + + Here's an example of using the @code{keyboard-translate-table} to +make @kbd{C-x}, @kbd{C-c} and @kbd{C-v} perform the cut, copy and paste +operations: + +@example +(keyboard-translate ?\C-x 'control-x) +(keyboard-translate ?\C-c 'control-c) +(keyboard-translate ?\C-v 'control-v) +(global-set-key [control-x] 'kill-region) +(global-set-key [control-c] 'kill-ring-save) +(global-set-key [control-v] 'yank) +@end example + +@noindent +On a graphical terminal that supports extended @acronym{ASCII} input, +you can still get the standard Emacs meanings of one of those +characters by typing it with the shift key. That makes it a different +character as far as keyboard translation is concerned, but it has the +same usual meaning. + + @xref{Translation Keymaps}, for mechanisms that translate event sequences +at the level of @code{read-key-sequence}. + @node Invoking the Input Method @subsection Invoking the Input Method From 13bdd945ba870660f922d8b8d881cda4cc0099de Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 31 Jul 2006 18:42:37 +0000 Subject: [PATCH 054/361] (System Interface): Fix menu descriptions of some nodes. (Translating Input): Node deleted. --- lispref/os.texi | 204 +----------------------------------------------- 1 file changed, 2 insertions(+), 202 deletions(-) diff --git a/lispref/os.texi b/lispref/os.texi index e3634746988..30f66889387 100644 --- a/lispref/os.texi +++ b/lispref/os.texi @@ -28,8 +28,8 @@ pertaining to the terminal and the screen. * Processor Run Time:: Getting the run time used by Emacs. * Time Calculations:: Adding, subtracting, comparing times, etc. * Timers:: Setting a timer to call a function at a certain time. -* Terminal Input:: Recording terminal input for debugging. -* Terminal Output:: Recording terminal output for debugging. +* Terminal Input:: Accessing and recording terminal input. +* Terminal Output:: Controlling and recording terminal output. * Sound Output:: Playing sounds on the computer's speaker. * X11 Keysyms:: Operating on key symbols for X Windows * Batch Mode:: Running Emacs without terminal interaction. @@ -1521,8 +1521,6 @@ functions. @menu * Input Modes:: Options for how input is processed. -* Translating Input:: Low level conversion of some characters or events - into others. * Recording Input:: Saving histories of recent or all input events. @end menu @@ -1587,204 +1585,6 @@ is the character Emacs currently uses for quitting, usually @kbd{C-g}. @end table @end defun -@node Translating Input -@subsection Translating Input Events -@cindex translating input events - - This section describes features for translating input events into -other input events before they become part of key sequences. These -features apply to each event in the order they are described here: each -event is first modified according to @code{extra-keyboard-modifiers}, -then translated through @code{keyboard-translate-table} (if applicable), -and finally decoded with the specified keyboard coding system. If it is -being read as part of a key sequence, it is then added to the sequence -being read; then subsequences containing it are checked first with -@code{function-key-map} and then with @code{key-translation-map}. - -@c Emacs 19 feature -@defvar extra-keyboard-modifiers -This variable lets Lisp programs ``press'' the modifier keys on the -keyboard. The value is a character. Only the modifiers of the -character matter. Each time the user types a keyboard key, it is -altered as if those modifier keys were held down. For instance, if -you bind @code{extra-keyboard-modifiers} to @code{?\C-\M-a}, then all -keyboard input characters typed during the scope of the binding will -have the control and meta modifiers applied to them. The character -@code{?\C-@@}, equivalent to the integer 0, does not count as a control -character for this purpose, but as a character with no modifiers. -Thus, setting @code{extra-keyboard-modifiers} to zero cancels any -modification. - -When using a window system, the program can ``press'' any of the -modifier keys in this way. Otherwise, only the @key{CTL} and @key{META} -keys can be virtually pressed. - -Note that this variable applies only to events that really come from -the keyboard, and has no effect on mouse events or any other events. -@end defvar - -@defvar keyboard-translate-table -This variable is the translate table for keyboard characters. It lets -you reshuffle the keys on the keyboard without changing any command -bindings. Its value is normally a char-table, or else @code{nil}. -(It can also be a string or vector, but this is considered obsolete.) - -If @code{keyboard-translate-table} is a char-table -(@pxref{Char-Tables}), then each character read from the keyboard is -looked up in this char-table. If the value found there is -non-@code{nil}, then it is used instead of the actual input character. - -Note that this translation is the first thing that happens to a -character after it is read from the terminal. Record-keeping features -such as @code{recent-keys} and dribble files record the characters after -translation. - -Note also that this translation is done before the characters are -supplied to input methods (@pxref{Input Methods}). Use -@code{translation-table-for-input} (@pxref{Translation of Characters}), -if you want to translate characters after input methods operate. -@end defvar - -@defun keyboard-translate from to -This function modifies @code{keyboard-translate-table} to translate -character code @var{from} into character code @var{to}. It creates -the keyboard translate table if necessary. -@end defun - - Here's an example of using the @code{keyboard-translate-table} to -make @kbd{C-x}, @kbd{C-c} and @kbd{C-v} perform the cut, copy and paste -operations: - -@example -(keyboard-translate ?\C-x 'control-x) -(keyboard-translate ?\C-c 'control-c) -(keyboard-translate ?\C-v 'control-v) -(global-set-key [control-x] 'kill-region) -(global-set-key [control-c] 'kill-ring-save) -(global-set-key [control-v] 'yank) -@end example - -@noindent -On a graphical terminal that supports extended @acronym{ASCII} input, -you can still get the standard Emacs meanings of one of those -characters by typing it with the shift key. That makes it a different -character as far as keyboard translation is concerned, but it has the -same usual meaning. - - The remaining translation features translate subsequences of key -sequences being read. They are implemented in @code{read-key-sequence} -and have no effect on input read with @code{read-event}. - -@defvar function-key-map -This variable holds a keymap that describes the character sequences sent -by function keys on an ordinary character terminal. This keymap has the -same structure as other keymaps, but is used differently: it specifies -translations to make while reading key sequences, rather than bindings -for key sequences. - -If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector -@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a -key sequence, it is replaced with the events in @var{v}. - -For example, VT100 terminals send @kbd{@key{ESC} O P} when the -keypad @key{PF1} key is pressed. Therefore, we want Emacs to translate -that sequence of events into the single event @code{pf1}. We accomplish -this by ``binding'' @kbd{@key{ESC} O P} to @code{[pf1]} in -@code{function-key-map}, when using a VT100. - -Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c -@key{ESC} O P}; later the function @code{read-key-sequence} translates -this back into @kbd{C-c @key{PF1}}, which it returns as the vector -@code{[?\C-c pf1]}. - -Entries in @code{function-key-map} are ignored if they conflict with -bindings made in the minor mode, local, or global keymaps. The intent -is that the character sequences that function keys send should not have -command bindings in their own right---but if they do, the ordinary -bindings take priority. - -The value of @code{function-key-map} is usually set up automatically -according to the terminal's Terminfo or Termcap entry, but sometimes -those need help from terminal-specific Lisp files. Emacs comes with -terminal-specific files for many common terminals; their main purpose is -to make entries in @code{function-key-map} beyond those that can be -deduced from Termcap and Terminfo. @xref{Terminal-Specific}. -@end defvar - -@defvar key-translation-map -This variable is another keymap used just like @code{function-key-map} -to translate input events into other events. It differs from -@code{function-key-map} in two ways: - -@itemize @bullet -@item -@code{key-translation-map} goes to work after @code{function-key-map} is -finished; it receives the results of translation by -@code{function-key-map}. - -@item -Non-prefix bindings in @code{key-translation-map} override actual key -bindings. For example, if @kbd{C-x f} has a non-prefix binding in -@code{key-translation-map}, that translation takes effect even though -@kbd{C-x f} also has a key binding in the global map. -@end itemize - -Note however that actual key bindings can have an effect on -@code{key-translation-map}, even though they are overridden by it. -Indeed, actual key bindings override @code{function-key-map} and thus -may alter the key sequence that @code{key-translation-map} receives. -Clearly, it is better to avoid this type of situation. - -The intent of @code{key-translation-map} is for users to map one -character set to another, including ordinary characters normally bound -to @code{self-insert-command}. -@end defvar - -@cindex key translation function -You can use @code{function-key-map} or @code{key-translation-map} for -more than simple aliases, by using a function, instead of a key -sequence, as the ``translation'' of a key. Then this function is called -to compute the translation of that key. - -The key translation function receives one argument, which is the prompt -that was specified in @code{read-key-sequence}---or @code{nil} if the -key sequence is being read by the editor command loop. In most cases -you can ignore the prompt value. - -If the function reads input itself, it can have the effect of altering -the event that follows. For example, here's how to define @kbd{C-c h} -to turn the character that follows into a Hyper character: - -@example -@group -(defun hyperify (prompt) - (let ((e (read-event))) - (vector (if (numberp e) - (logior (lsh 1 24) e) - (if (memq 'hyper (event-modifiers e)) - e - (add-event-modifier "H-" e)))))) - -(defun add-event-modifier (string e) - (let ((symbol (if (symbolp e) e (car e)))) - (setq symbol (intern (concat string - (symbol-name symbol)))) -@end group -@group - (if (symbolp e) - symbol - (cons symbol (cdr e))))) - -(define-key function-key-map "\C-ch" 'hyperify) -@end group -@end example - -Finally, if you have enabled keyboard character set decoding using -@code{set-keyboard-coding-system}, decoding is done after the -translations listed above. @xref{Terminal I/O Encoding}. In future -Emacs versions, character set decoding may be done before the other -translations. - @node Recording Input @subsection Recording Input From f8262222a6f8ae23e035751fe339c7d9a6ee83c9 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 31 Jul 2006 18:43:42 +0000 Subject: [PATCH 055/361] (vhdl-speedbar-display-directory, vhdl-speedbar-display-projects): Update old obsolete speedbar variable names. --- lisp/progmodes/vhdl-mode.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 987b37cf2c2..cf887394e6b 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -14112,8 +14112,8 @@ if required." (defun vhdl-speedbar-display-directory (directory depth &optional rescan) "Display directory and hierarchy information in speedbar." (setq vhdl-speedbar-show-projects nil) - (setq speedbar-ignored-path-regexp - (speedbar-extension-list-to-regex speedbar-ignored-path-expressions)) + (setq speedbar-ignored-directory-regexp + (speedbar-extension-list-to-regex speedbar-ignored-directory-expressions)) (setq directory (abbreviate-file-name (file-name-as-directory directory))) (setq speedbar-last-selected-file nil) (speedbar-with-writable @@ -14133,7 +14133,7 @@ if required." (defun vhdl-speedbar-display-projects (project depth &optional rescan) "Display projects and hierarchy information in speedbar." (setq vhdl-speedbar-show-projects t) - (setq speedbar-ignored-path-regexp ".") + (setq speedbar-ignored-directory-regexp ".") (setq speedbar-last-selected-file nil) (setq vhdl-speedbar-last-selected-project nil) (speedbar-with-writable From a3483884d3891085d2f78c14dec9f8ff4aace770 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 31 Jul 2006 18:44:18 +0000 Subject: [PATCH 056/361] *** empty log message *** --- lisp/ChangeLog | 6 ++++++ lispref/ChangeLog | 17 +++++++++++++++++ man/ChangeLog | 4 ++++ 3 files changed, 27 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 474cd5d6b46..b8abb120998 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-07-31 Richard Stallman + + * progmodes/vhdl-mode.el (vhdl-speedbar-display-directory) + (vhdl-speedbar-display-projects): Update old obsolete + speedbar variable names. + 2006-07-31 Nick Roberts * progmodes/gdb-ui.el (gdb-find-source-frame): New option. diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 2b20fb9e2a9..2bb3f1b1874 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,20 @@ +2006-07-31 Richard Stallman + + * commands.texi: Update xrefs. + (Event Mod): New node, cut out from old Translating Input. + + * maps.texi: Update xrefs. + + * keymaps.texi (Translation Keymaps): New node. + Update xrefs from Translating Input to Translation Keymaps. + + * elisp.texi (Top): Update subnode menu. + + * display.texi (Face Functions): Fix explanations of FRAME=t or nil. + + * os.texi (System Interface): Fix menu descriptions of some nodes. + (Translating Input): Node deleted. + 2006-07-31 Nick Roberts * modes.texi (Minor Mode Conventions): Update link for add-to-list. diff --git a/man/ChangeLog b/man/ChangeLog index efaff2d173f..a433448fe35 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-07-31 Richard Stallman + + * search.texi (Query Replace): Add xref for Dired's Q command. + 2006-07-28 Katsumi Yamaoka * gnus.texi (Oort Gnus): Mention that the Lisp files are now installed From fc0ba1d08092f5daedde890cb26e01883ab8afeb Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 31 Jul 2006 20:33:33 +0000 Subject: [PATCH 057/361] (Clickable Text): Mention `help-echo' text property. Update intro, examples and associated explanations. --- lispref/ChangeLog | 11 ++++++--- lispref/text.texi | 60 ++++++++++++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 2bb3f1b1874..f64f9eb56df 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,20 +1,25 @@ +2006-07-31 Thien-Thi Nguyen + + * text.texi (Clickable Text): Mention `help-echo' text property. + Update intro, examples and associated explanations. + 2006-07-31 Richard Stallman * commands.texi: Update xrefs. (Event Mod): New node, cut out from old Translating Input. * maps.texi: Update xrefs. - + * keymaps.texi (Translation Keymaps): New node. Update xrefs from Translating Input to Translation Keymaps. - + * elisp.texi (Top): Update subnode menu. * display.texi (Face Functions): Fix explanations of FRAME=t or nil. * os.texi (System Interface): Fix menu descriptions of some nodes. (Translating Input): Node deleted. - + 2006-07-31 Nick Roberts * modes.texi (Minor Mode Conventions): Update link for add-to-list. diff --git a/lispref/text.texi b/lispref/text.texi index fccc72d3d0b..08e55f18f05 100644 --- a/lispref/text.texi +++ b/lispref/text.texi @@ -3480,25 +3480,31 @@ being called over and over for the same text. @cindex clickable text There are two parts of setting up @dfn{clickable text} in a buffer: -(1) to make that text highlight when the mouse moves over it, and (2) +(1) to indicate clickability when the mouse moves over the text, and (2) to make a mouse button do something when you click on that text. - For highlighting, use the @code{mouse-face} text property. Here is -an example of how Dired does it: + Indicating clickability usually involves highlighting the text, and +often involves displaying helpful information about the action, such +as which mouse button to press, or a short summary of the action. +This can be done with the @code{mouse-face} and @code{help-echo} +text properties. @xref{Special Properties}. +Here is an example of how Dired does it: @smallexample (condition-case nil (if (dired-move-to-filename) - (put-text-property (point) - (save-excursion - (dired-move-to-end-of-filename) - (point)) - 'mouse-face 'highlight)) + (add-text-properties + (point) + (save-excursion + (dired-move-to-end-of-filename) + (point)) + '(mouse-face highlight + help-echo "mouse-2: visit this file in other window"))) (error nil)) @end smallexample @noindent -The first two arguments to @code{put-text-property} specify the +The first two arguments to @code{add-text-properties} specify the beginning and end of the text. The usual way to make the mouse do something when you click it @@ -3508,24 +3514,34 @@ is done by the command definition. Here is how Dired does it: @smallexample (defun dired-mouse-find-file-other-window (event) - "In dired, visit the file or directory name you click on." + "In Dired, visit the file or directory name you click on." (interactive "e") - (let (file) + (let (window pos file) (save-excursion - (set-buffer (window-buffer (posn-window (event-end event)))) - (save-excursion - (goto-char (posn-point (event-end event))) - (setq file (dired-get-filename)))) - (select-window (posn-window (event-end event))) - (find-file-other-window (file-name-sans-versions file t)))) + (setq window (posn-window (event-end event)) + pos (posn-point (event-end event))) + (if (not (windowp window)) + (error "No file chosen")) + (set-buffer (window-buffer window)) + (goto-char pos) + (setq file (dired-get-file-for-visit))) + (if (file-directory-p file) + (or (and (cdr dired-subdir-alist) + (dired-goto-subdir file)) + (progn + (select-window window) + (dired-other-window file))) + (select-window window) + (find-file-other-window (file-name-sans-versions file t))))) @end smallexample @noindent -The reason for the outer @code{save-excursion} construct is to avoid -changing the current buffer; the reason for the inner one is to avoid -permanently altering point in the buffer you click on. In this case, -Dired uses the function @code{dired-get-filename} to determine which -file to visit, based on the position found in the event. +The reason for the @code{save-excursion} construct is to avoid +changing the current buffer. In this case, +Dired uses the functions @code{posn-window} and @code{posn-point} +to determine which buffer the click happened in and where, and +in that buffer, @code{dired-get-file-for-visit} to determine which +file to visit. Instead of defining a mouse command for the major mode, you can define a key binding for the clickable text itself, using the @code{keymap} From 07e9b3f01c7b354a3f526295abbd5c422499d370 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 31 Jul 2006 21:36:43 +0000 Subject: [PATCH 058/361] (url-hexify-string): Only utf-8 encode if it's a multibyte string. (url-normalize-url): Remove unused var `grok'. (url-truncate-url-for-viewing): Remove unused var `tail'. --- lisp/url/ChangeLog | 7 +++++++ lisp/url/url-util.el | 29 ++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index e29b4b6b67e..2bbe6085be4 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,10 @@ +2006-07-31 Stefan Monnier + + * url-util.el (url-hexify-string): Only utf-8 encode if it's + a multibyte string. + (url-normalize-url): Remove unused var `grok'. + (url-truncate-url-for-viewing): Remove unused var `tail'. + 2006-07-30 Thien-Thi Nguyen * url-util.el (url-hexify-string): Rewrite. diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index 4293b0e301f..0aeb141c017 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el @@ -163,7 +163,7 @@ Also replaces the \" character, so that the result may be safely used as (defun url-normalize-url (url) "Return a 'normalized' version of URL. Strips out default port numbers, etc." - (let (type data grok retval) + (let (type data retval) (setq data (url-generic-parse-url url) type (url-type data)) (if (member type '("www" "about" "mailto" "info")) @@ -358,11 +358,24 @@ First, STRING is converted to utf-8, if necessary. Then, for each character in the utf-8 string, those found in `url-unreserved-chars' are left as-is, all others are represented as a three-character string: \"%\" followed by two lowercase hex digits." - (mapconcat (lambda (char) - (if (memq char url-unreserved-chars) - (char-to-string char) - (format "%%%02x" char))) - (encode-coding-string string 'utf-8 t) + ;; To go faster and avoid a lot of consing, we could do: + ;; + ;; (defconst url-hexify-table + ;; (let ((map (make-vector 256 nil))) + ;; (dotimes (byte 256) (aset map byte + ;; (if (memq byte url-unreserved-chars) + ;; (char-to-string byte) + ;; (format "%%%02x" byte)))) + ;; map)) + ;; + ;; (mapconcat (curry 'aref url-hexify-table) ...) + (mapconcat (lambda (byte) + (if (memq byte url-unreserved-chars) + (char-to-string byte) + (format "%%%02x" byte))) + (if (multibyte-string-p string) + (encode-coding-string string 'utf-8) + string) "")) ;;;###autoload @@ -390,7 +403,6 @@ then return the basename of the file with the extension stripped off." WIDTH defaults to the current frame width." (let* ((fr-width (or width (frame-width))) (str-width (length url)) - (tail (file-name-nondirectory url)) (fname nil) (modified 0) (urlobj nil)) @@ -398,8 +410,7 @@ WIDTH defaults to the current frame width." (if (and (>= str-width fr-width) (string-match "?" url)) (setq url (concat (substring url 0 (match-beginning 0)) "?...") - str-width (length url) - tail (file-name-nondirectory url))) + str-width (length url))) (if (< str-width fr-width) nil ; Hey, we are done! (setq urlobj (url-generic-parse-url url) From 0885202f7213195d276ad9d4fa9db3b2c97efba0 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Tue, 1 Aug 2006 00:12:55 +0000 Subject: [PATCH 059/361] *** empty log message *** --- src/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 7f62aebf9e6..08590d793da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2006-08-01 Kim F. Storm + + * process.c (wait_reading_process_output_unwind): New function. + Restores waiting_for_user_input_p to saved value. + (wait_reading_process_output): Unwind protect waiting_for_user_input_p + instead of save/restore old value on stack. + 2006-07-30 Thien-Thi Nguyen * editfns.c: Undo 2006-06-27 change. From 2beb96f9ccc60babc90159ea1508966d93d2c0db Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Tue, 1 Aug 2006 00:13:08 +0000 Subject: [PATCH 060/361] (wait_reading_process_output_unwind): New function. Restores waiting_for_user_input_p to saved value. (wait_reading_process_output): Unwind protect waiting_for_user_input_p instead of save/restore old value on stack. --- src/process.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/process.c b/src/process.c index 857d7494c69..b24dee002c6 100644 --- a/src/process.c +++ b/src/process.c @@ -4158,6 +4158,14 @@ server_accept_connection (server, channel) when not inside wait_reading_process_output. */ static int waiting_for_user_input_p; +static Lisp_Object +wait_reading_process_output_unwind (data) + Lisp_Object data; +{ + waiting_for_user_input_p = XINT (data); + return Qnil; +} + /* This is here so breakpoints can be put on it. */ static void wait_reading_process_output_1 () @@ -4240,9 +4248,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, EMACS_TIME timeout, end_time; int wait_channel = -1; int got_some_input = 0; - /* Either nil or a cons cell, the car of which is of interest and - may be changed outside of this routine. */ - int saved_waiting_for_user_input_p = waiting_for_user_input_p; + int count = SPECPDL_INDEX (); FD_ZERO (&Available); #ifdef NON_BLOCKING_CONNECT @@ -4253,6 +4259,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, if (wait_proc != NULL) wait_channel = XINT (wait_proc->infd); + record_unwind_protect (wait_reading_process_output_unwind, + make_number (waiting_for_user_input_p)); waiting_for_user_input_p = read_kbd; /* Since we may need to wait several times, @@ -4879,7 +4887,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, } /* end for each file descriptor */ } /* end while exit conditions not met */ - waiting_for_user_input_p = saved_waiting_for_user_input_p; + unbind_to (count, Qnil); /* If calling from keyboard input, do not quit since we want to return C-g as an input character. From 68ce47af293360401e79bed77e46eee4d1cdb444 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 1 Aug 2006 00:49:58 +0000 Subject: [PATCH 061/361] (find-operation-coding-system): Describe the more detail of the change. --- etc/ChangeLog | 5 +++++ etc/NEWS | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index f1bab406fd4..4937aef2bca 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,8 @@ +2006-08-01 Kenichi Handa + + * NEWS (find-operation-coding-system): Describe the more detail of + the change. + 2006-07-28 Reiner Steib * GNUS-NEWS: Regenerate from Oort Gnus node in texi/gnus.texi using diff --git a/etc/NEWS b/etc/NEWS index 1414748a3dd..52fcc1eea2a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3661,8 +3661,10 @@ w32-use-full-screen-buffer to t. * Incompatible Lisp Changes in Emacs 22.1 -** The function find-operation-coding-system accepts a cons (FILENAME -. BUFFER) in an argument correponding to the target. +** The function find-operation-coding-system may be called with a cons +(FILENAME . BUFFER) in the second argument if the first argument +OPERATION is `insert-file-contents', and thus a function registered in +`file-coding-system-alist' is also called with such an argument. --- ** The variables post-command-idle-hook and post-command-idle-delay have From 1730f68ee7b2b727176c418446ea408f13931686 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 1 Aug 2006 02:49:11 +0000 Subject: [PATCH 062/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b8abb120998..4219388e72e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-01 Nick Roberts + + * progmodes/gdb-ui.el (gdb-set-hollow): Check for + gud-last-last-frame. + 2006-07-31 Richard Stallman * progmodes/vhdl-mode.el (vhdl-speedbar-display-directory) From c534076ccd2f07aaeb8e22e1c825f40bbefd9e82 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 1 Aug 2006 02:49:47 +0000 Subject: [PATCH 063/361] (gdb-set-hollow): Check for gud-last-last-frame. --- lisp/progmodes/gdb-ui.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index ce50c81e92d..595ec545eef 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -2049,9 +2049,10 @@ static char *magick[] = { (setq gdb-look-up-stack nil)) (defun gdb-set-hollow () - (with-current-buffer (gud-find-file (car gud-last-last-frame)) - (setq fringe-indicator-alist - '((overlay-arrow . hollow-right-triangle))))) + (if gud-last-last-frame + (with-current-buffer (gud-find-file (car gud-last-last-frame)) + (setq fringe-indicator-alist + '((overlay-arrow . hollow-right-triangle)))))) (defun gdb-stack-buffer-name () (with-current-buffer gud-comint-buffer From da95a9c86f7a15ac9bb23568a84a86920702f3e4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 1 Aug 2006 05:29:19 +0000 Subject: [PATCH 064/361] (longlines-show-region): Make it work on read-only buffers as well. --- lisp/ChangeLog | 16 ++++++++++------ lisp/longlines.el | 11 ++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4219388e72e..0540072e0c7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,11 @@ +2006-08-01 Stefan Monnier + + * longlines.el (longlines-show-region): Make it work on read-only + buffers as well. + 2006-08-01 Nick Roberts - * progmodes/gdb-ui.el (gdb-set-hollow): Check for - gud-last-last-frame. + * progmodes/gdb-ui.el (gdb-set-hollow): Check for gud-last-last-frame. 2006-07-31 Richard Stallman @@ -112,10 +116,10 @@ * tumme.el (tumme-track-original-file): Add `buffer-live-p' check. (tumme-format-properties-string): Handle empty `buf'. - (tumme-get-comment): Change variable names inside `let'. Add - missing `let' variable that cause font-lock problems. - (tumme-write-comments): Change variable names inside `let'. Add - missing `let' variable that cause font-lock problems. + (tumme-get-comment): Change variable names inside `let'. + Add missing `let' variable that cause font-lock problems. + (tumme-write-comments): Change variable names inside `let'. + Add missing `let' variable that cause font-lock problems. (tumme-forward-image): Rename from `tumme-forward-char'. (tumme-backward-image): Rename from `tumme-backward-char'. diff --git a/lisp/longlines.el b/lisp/longlines.el index 9da3de217ab..77e0b415344 100644 --- a/lisp/longlines.el +++ b/lisp/longlines.el @@ -44,7 +44,7 @@ :group 'fill) (defcustom longlines-auto-wrap t - "*Non-nil means long lines are automatically wrapped after each command. + "Non-nil means long lines are automatically wrapped after each command. Otherwise, you can perform filling using `fill-paragraph' or `auto-fill-mode'. In any case, the soft newlines will be removed when the file is saved to disk." @@ -52,7 +52,7 @@ when the file is saved to disk." :type 'boolean) (defcustom longlines-wrap-follows-window-size nil - "*Non-nil means wrapping and filling happen at the edge of the window. + "Non-nil means wrapping and filling happen at the edge of the window. Otherwise, `fill-column' is used, regardless of the window size. This does not work well when the buffer is displayed in multiple windows with differing widths." @@ -60,7 +60,7 @@ with differing widths." :type 'boolean) (defcustom longlines-show-hard-newlines nil - "*Non-nil means each hard newline is marked on the screen. + "Non-nil means each hard newline is marked on the screen. \(The variable `longlines-show-effect' controls what they look like.) You can also enable the display temporarily, using the command `longlines-show-hard-newlines'" @@ -68,7 +68,7 @@ You can also enable the display temporarily, using the command :type 'boolean) (defcustom longlines-show-effect (propertize "|\n" 'face 'escape-glyph) - "*A string to display when showing hard newlines. + "A string to display when showing hard newlines. This is used when `longlines-show-hard-newlines' is on." :group 'longlines :type 'string) @@ -202,7 +202,8 @@ With optional argument ARG, make the hard newlines invisible again." "Make hard newlines between BEG and END visible." (let* ((pmin (min beg end)) (pmax (max beg end)) - (pos (text-property-not-all pmin pmax 'hard nil))) + (pos (text-property-not-all pmin pmax 'hard nil)) + (inhibit-read-only t)) (while pos (put-text-property pos (1+ pos) 'display (copy-sequence longlines-show-effect)) From 2927229a7746ef224c47087af2c40b06fa77e5e0 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 1 Aug 2006 06:50:28 +0000 Subject: [PATCH 065/361] *** empty log message *** --- man/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/man/ChangeLog b/man/ChangeLog index a433448fe35..eb3dfdcfcf8 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,9 @@ +2006-08-01 Nick Roberts + + * building.texi (GDB Graphical Interface): Shorten node names. + (GDB-UI Layout): Use GDB-related. + (Stack Buffer): Simplify English. + 2006-07-31 Richard Stallman * search.texi (Query Replace): Add xref for Dired's Q command. From be0f250c1771a0555440c9740c965e8f1b75b6d9 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 1 Aug 2006 06:50:51 +0000 Subject: [PATCH 066/361] (GDB Graphical Interface): Shorten node names. (GDB-UI Layout): Use GDB-related. (Stack Buffer): Simplify English. --- man/building.texi | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/man/building.texi b/man/building.texi index b4caa537e10..8b479960e71 100644 --- a/man/building.texi +++ b/man/building.texi @@ -833,17 +833,17 @@ Emacs session. If you have customized @code{gud-gdb-command-name} in that way, you can use @kbd{M-x gdba} to invoke GDB in graphical mode. @menu -* GDB User Interface Layout:: Control the number of displayed buffers. +* GDB-UI Layout:: Control the number of displayed buffers. * Source Buffers:: Use the mouse in the fringe/margin to control your program. * Breakpoints Buffer:: A breakpoint control panel. * Stack Buffer:: Select a frame from the call stack. -* Other GDB User Interface Buffers:: Input/output, locals, registers, +* Other GDB-UI Buffers:: Input/output, locals, registers, assembler, threads and memory buffers. * Watch Expressions:: Monitor variable values in the speedbar. @end menu -@node GDB User Interface Layout +@node GDB-UI Layout @subsubsection GDB User Interface Layout @cindex GDB User Interface layout @@ -884,7 +884,7 @@ layout with the command @code{gdb-restore-windows}. containing just the GUD buffer and a source file, type @kbd{M-x gdb-many-windows}. - You may also specify additional GUD-related buffers to display, + You may also specify additional GDB-related buffers to display, either in the same frame or a different one. Select the buffers you want with the @samp{GUD->GDB-windows} and @samp{GUD->GDB-Frames} sub-menus. If the menu-bar is unavailable, type @code{M-x @@ -1008,21 +1008,20 @@ frame and type @key{RET} (@code{gdb-frames-select}), or click selecting a stack frame updates it to display the local variables of the new frame. -@node Other GDB User Interface Buffers +@node Other GDB-UI Buffers @subsubsection Other Buffers @table @asis @item Input/Output Buffer @vindex gdb-use-separate-io-buffer If the variable @code{gdb-use-separate-io-buffer} is non-@code{nil}, -the executable program that is being debugged takes its input and -displays its output here. Otherwise it uses the GUD buffer for that. -To toggle whether GUD mode uses this buffer, do @kbd{M-x -gdb-use-separate-io-buffer}. That takes effect when you next -restart the program you are debugging. +the program being debugged takes its input and displays its output +here. Otherwise it uses the GUD buffer for that. To toggle whether +GUD mode uses this buffer, do @kbd{M-x gdb-use-separate-io-buffer}. +That takes effect when you next restart the program you are debugging. The history and replay commands from Shell mode are available here, -as are the commands to send signals to the program you are debugging. +as are the commands to send signals to the debugged program. @xref{Shell Mode}. @item Locals Buffer From 88680f4ebf9c2a5d394d805a6a028f967f4371d7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 1 Aug 2006 18:13:20 +0000 Subject: [PATCH 067/361] *** empty log message *** --- admin/FOR-RELEASE | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 13469376c9b..e894601c5c8 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -31,6 +31,13 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. * BUGS +** bojohan's and johnsu01@wjsullivan.net's 18 July bug reports that + "C-n doesn't work in Customize Option buffer in -nw with long value + displayed". Yidong proposed a fix, but needs a field expert to check + it. + +** Stephen.Berman@gmx.net: isearch-yank-line and field text property + ** Markus Gritsch's report about Emacs looping on Windoze with the following .emacs file, and then reduce Emacs frame width to "something quite narrow": (setq-default truncate-lines t) From 374f4f51dffcca37d7a048de79290877f4cc074e Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Tue, 1 Aug 2006 18:19:36 +0000 Subject: [PATCH 068/361] isearch-yank-line bug already fixed. --- admin/FOR-RELEASE | 2 -- 1 file changed, 2 deletions(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index e894601c5c8..cb5df6149c7 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -36,8 +36,6 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. displayed". Yidong proposed a fix, but needs a field expert to check it. -** Stephen.Berman@gmx.net: isearch-yank-line and field text property - ** Markus Gritsch's report about Emacs looping on Windoze with the following .emacs file, and then reduce Emacs frame width to "something quite narrow": (setq-default truncate-lines t) From 4cffd2213707e403e379ec24934ec37edba3b6d3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 1 Aug 2006 18:58:18 +0000 Subject: [PATCH 069/361] (font-lock-extend-jit-lock-region-after-change): New fun. (font-lock-turn-on-thing-lock): Use it. --- lisp/ChangeLog | 3 +++ lisp/font-lock.el | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0540072e0c7..039c0ad90fc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2006-08-01 Stefan Monnier + * font-lock.el (font-lock-extend-jit-lock-region-after-change): New fun. + (font-lock-turn-on-thing-lock): Use it. + * longlines.el (longlines-show-region): Make it work on read-only buffers as well. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 207d3b88f86..ecf54895c1c 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -893,7 +893,11 @@ The value of this variable is used when Font Lock mode is turned on." (set (make-local-variable 'font-lock-fontified) t) ;; Use jit-lock. (jit-lock-register 'font-lock-fontify-region - (not font-lock-keywords-only)))))) + (not font-lock-keywords-only)) + ;; Tell jit-lock how we extend the region to refontify. + (add-hook 'jit-lock-after-change-extend-region-functions + 'font-lock-extend-jit-lock-region-after-change + nil t))))) (defun font-lock-turn-off-thing-lock () (cond ((and (boundp 'fast-lock-mode) fast-lock-mode) @@ -1096,6 +1100,35 @@ what properties to clear before refontifying a region.") end (progn (goto-char end) (line-beginning-position 2)))) (font-lock-fontify-region beg end))))) +(defvar jit-lock-start) (defvar jit-lock-end) +(defun font-lock-extend-jit-lock-region-after-change (beg end old-len) + (let ((region (font-lock-extend-region beg end old-len))) + (if region + (setq jit-lock-start (min jit-lock-start (car region)) + jit-lock-end (max jit-lock-end (cdr region))) + (save-excursion + (goto-char beg) + (forward-line 0) + (setq jit-lock-start + (min jit-lock-start + (if (and (not (eobp)) + (get-text-property (point) 'font-lock-multiline)) + (or (previous-single-property-change + (point) 'font-lock-multiline) + (point-min)) + (point)))) + (goto-char end) + (forward-line 1) + (setq jit-lock-end + (max jit-lock-end + (if (and (not (bobp)) + (get-text-property (1- (point)) + 'font-lock-multiline)) + (or (next-single-property-change + (1- (point)) 'font-lock-multiline) + (point-max)) + (point)))))))) + (defun font-lock-fontify-block (&optional arg) "Fontify some lines the way `font-lock-fontify-buffer' would. The lines could be a function or paragraph, or a specified number of lines. From 663e16604c06d8c8961ef5716fc459be5ecfb4ff Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 1 Aug 2006 19:01:24 +0000 Subject: [PATCH 070/361] (jit-lock-fontify-now): Cause a second redisplay if needed. (jit-lock-start, jit-lock-end): New dynamic scoped vars. (jit-lock-after-change-extend-region-functions): New hook. (jit-lock-after-change): Use it instead of hard-coding font-lock code. --- lisp/jit-lock.el | 86 ++++++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index 0e131b665ef..7077d7880eb 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -331,7 +331,7 @@ Defaults to the whole buffer. END can be out of bounds." ;; from the end of a buffer to its start, can do repeated ;; `parse-partial-sexp' starting from `point-min', which can ;; take a long time in a large buffer. - (let (next) + (let ((orig-start start) next) (save-match-data ;; Fontify chunks beginning at START. The end of a ;; chunk is either `end', or the start of a region @@ -374,6 +374,21 @@ Defaults to the whole buffer. END can be out of bounds." (quit (put-text-property start next 'fontified nil) (funcall 'signal (car err) (cdr err)))) + ;; The redisplay engine has already rendered the buffer up-to + ;; `orig-start' and won't notice if the above jit-lock-functions + ;; changed the appearance of any part of the buffer prior + ;; to that. So if `start' is before `orig-start', we need to + ;; cause a new redisplay cycle after this one so that any changes + ;; are properly reflected on screen. + ;; To make such repeated redisplay happen less often, we can + ;; eagerly extend the refontified region with + ;; jit-lock-after-change-extend-region-functions. + (when (< start orig-start) + (run-with-timer + 0 nil `(lambda () + (put-text-property ',start ',orig-start + 'fontified t ',(current-buffer))))) + ;; Find the start of the next chunk, if any. (setq start (text-property-any next end 'fontified nil)))))))) @@ -548,6 +563,19 @@ This functions is called after Emacs has been idle for '(fontified nil jit-lock-defer-multiline nil))) (setq jit-lock-context-unfontify-pos (point-max))))))))) +(defvar jit-lock-start) (defvar jit-lock-end) ; Dynamically scoped variables. +(defvar jit-lock-after-change-extend-region-functions nil + "Hook that can extend the text to refontify after a change. +This is run after every buffer change. The functions are called with +the three arguments of `after-change-functions': START END OLD-LEN. +The extended region to refontify is returned indirectly by modifying +the variables `jit-lock-start' and `jit-lock-end'. + +Note that extending the region this way is not strictly necessary, +except that the nature of the redisplay code tends to otherwise leave +some of the rehighlighted text displayed with the old highlight until the +next redisplay. See comment in `jit-lock-fontify-now'.") + (defun jit-lock-after-change (start end old-len) "Mark the rest of the buffer as not fontified after a change. Installed on `after-change-functions'. @@ -557,44 +585,24 @@ This function ensures that lines following the change will be refontified in case the syntax of those lines has changed. Refontification will take place when text is fontified stealthily." (when (and jit-lock-mode (not memory-full)) - (let ((region (font-lock-extend-region start end old-len))) - (save-excursion - (with-buffer-prepared-for-jit-lock - ;; It's important that the `fontified' property be set from the - ;; beginning of the line, else font-lock will properly change the - ;; text's face, but the display will have been done already and will - ;; be inconsistent with the buffer's content. - ;; - ;; FIXME!!! (Alan Mackenzie, 2006-03-14): If start isn't at a BOL, - ;; expanding the region to BOL might mis-fontify, should the BOL not - ;; be at a "safe" position. - (setq start (if region - (car region) - (goto-char start) - (line-beginning-position))) - - ;; If we're in text that matches a multi-line font-lock pattern, - ;; make sure the whole text will be redisplayed. - ;; I'm not sure this is ever necessary and/or sufficient. -stef - (when (get-text-property start 'font-lock-multiline) - (setq start (or (previous-single-property-change - start 'font-lock-multiline) - (point-min)))) - - (if region (setq end (cdr region))) - ;; Make sure we change at least one char (in case of deletions). - (setq end (min (max end (1+ start)) (point-max))) - ;; Request refontification. - (put-text-property start end 'fontified nil)) - ;; Mark the change for deferred contextual refontification. - (when jit-lock-context-unfontify-pos - (setq jit-lock-context-unfontify-pos - ;; Here we use `start' because nothing guarantees that the - ;; text between start and end will be otherwise refontified: - ;; usually it will be refontified by virtue of being - ;; displayed, but if it's outside of any displayed area in the - ;; buffer, only jit-lock-context-* will re-fontify it. - (min jit-lock-context-unfontify-pos start))))))) + (let ((jit-lock-start start) + (jit-lock-end end)) + (with-buffer-prepared-for-jit-lock + (run-hook-with-args 'jit-lock-after-change-extend-region-functions + start end old-len) + ;; Make sure we change at least one char (in case of deletions). + (setq jit-lock-end (min (max jit-lock-end (1+ start)) (point-max))) + ;; Request refontification. + (put-text-property jit-lock-start jit-lock-end 'fontified nil)) + ;; Mark the change for deferred contextual refontification. + (when jit-lock-context-unfontify-pos + (setq jit-lock-context-unfontify-pos + ;; Here we use `start' because nothing guarantees that the + ;; text between start and end will be otherwise refontified: + ;; usually it will be refontified by virtue of being + ;; displayed, but if it's outside of any displayed area in the + ;; buffer, only jit-lock-context-* will re-fontify it. + (min jit-lock-context-unfontify-pos jit-lock-start)))))) (provide 'jit-lock) From 2821e1b6f8af1bab644fedd85ba1405b24f15f42 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 1 Aug 2006 19:09:11 +0000 Subject: [PATCH 071/361] (font-lock-extend-region-function, font-lock-extend-region): Move from font-core.el. Simplify. --- lisp/ChangeLog | 12 ++++++++++++ lisp/font-lock.el | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 039c0ad90fc..960200f8721 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,17 @@ 2006-08-01 Stefan Monnier + * font-core.el (font-lock-extend-region-function) + (font-lock-extend-region): Move to font-lock.el. + + * font-lock.el (font-lock-extend-region-function) + (font-lock-extend-region): Move from font-core.el. Simplify. + + * jit-lock.el (jit-lock-fontify-now): Cause a second redisplay + if needed. + (jit-lock-start, jit-lock-end): New dynamic scoped vars. + (jit-lock-after-change-extend-region-functions): New hook. + (jit-lock-after-change): Use it instead of hard-coding font-lock code. + * font-lock.el (font-lock-extend-jit-lock-region-after-change): New fun. (font-lock-turn-on-thing-lock): Use it. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index ecf54895c1c..201d236f7ac 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -975,6 +975,31 @@ The value of this variable is used when Font Lock mode is turned on." ;; directives correctly and cleanly. (It is the same problem as fontifying ;; multi-line strings and comments; regexps are not appropriate for the job.) +(defvar font-lock-extend-region-function nil + "A function that determines the region to fontify after a change. + +This variable is either nil, or is a function that determines the +region to refontify after a change. +It is usually set by the major mode via `font-lock-defaults'. +Font-lock calls this function after each buffer change. + +The function is given three parameters, the standard BEG, END, and OLD-LEN +from `after-change-functions'. It should return either a cons of the beginning +and end buffer positions \(in that order) of the region to fontify, or nil +\(which directs the caller to fontify a default region). This function +should preserve point and the match-data. +The region it returns may start or end in the middle of a line.") + +(defun font-lock-extend-region (beg end old-len) + "Determine the region to fontify after a buffer change. + +BEG END and OLD-LEN are the standard parameters from `after-change-functions'. +The return value is either nil \(which directs the caller to chose the region +itself), or a cons of the beginning and end \(in that order) of the region. +The region returned may start or end in the middle of a line." + (if font-lock-extend-region-function + (funcall font-lock-extend-region-function beg end old-len))) + (defun font-lock-fontify-buffer () "Fontify the current buffer the way the function `font-lock-mode' would." (interactive) From b0c76bd4a598b257e8db86e25b05be31baafda84 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 1 Aug 2006 19:09:27 +0000 Subject: [PATCH 072/361] (font-lock-extend-region-function, font-lock-extend-region): Move to font-lock.el. --- lisp/font-core.el | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/lisp/font-core.el b/lisp/font-core.el index d2cb8dccd10..85bbf60f0d9 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el @@ -83,34 +83,6 @@ where MAJOR-MODE is a symbol and FONT-LOCK-DEFAULTS is a list of default settings. See the variable `font-lock-defaults', which takes precedence.") (make-obsolete-variable 'font-lock-defaults-alist 'font-lock-defaults) -(defvar font-lock-extend-region-function nil - "A function that determines the region to fontify after a change. - -This buffer-local variable is either nil, or is a function that determines the -region to fontify. It is usually set by the major mode. The currently active -font-lock after-change function calls this function after each buffer change. - -The function is given three parameters, the standard BEG, END, and OLD-LEN -from after-change-functions. It should return either a cons of the beginning -and end buffer positions \(in that order) of the region to fontify, or nil -\(which directs the caller to fontify a default region). This function need -not preserve point or the match-data, but must preserve the current -restriction. The region it returns may start or end in the middle of a -line.") -(make-variable-buffer-local 'font-lock-extend-region-function) - -(defun font-lock-extend-region (beg end old-len) - "Determine the region to fontify after a buffer change. - -BEG END and OLD-LEN are the standard parameters from after-change-functions. -The return value is either nil \(which directs the caller to chose the region -itself), or a cons of the beginning and end \(in that order) of the region. -The region returned may start or end in the middle of a line." - (if font-lock-extend-region-function - (save-match-data - (save-excursion - (funcall font-lock-extend-region-function beg end old-len))))) - (defvar font-lock-function 'font-lock-default-function "A function which is called when `font-lock-mode' is toggled. It will be passed one argument, which is the current value of From 68b9e79b2dcf59796653029f80248e6f124a56af Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 1 Aug 2006 23:15:32 +0000 Subject: [PATCH 073/361] *** empty log message *** --- lisp/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 960200f8721..349309ac6af 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2006-08-02 Nick Roberts + + * progmodes/gdb-ui.el (gdb-find-source-frame): Make nil the + default value. + (gdb-find-source-frame): New function. + (menu): Add to menu bar. + 2006-08-01 Stefan Monnier * font-core.el (font-lock-extend-region-function) From a6c7c026a4e3e44ebe700a5ccc6eef33f88f8171 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 1 Aug 2006 23:16:00 +0000 Subject: [PATCH 074/361] (gdb-find-source-frame): Make nil the default value. (gdb-find-source-frame): New function. (menu): Add to menu bar. --- lisp/progmodes/gdb-ui.el | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 595ec545eef..e6c6380bf88 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -1358,12 +1358,23 @@ directives." :type 'boolean :version "22.1") -(defcustom gdb-find-source-frame t - "Non-nil means try to find source further up stack e.g after signal." +(defcustom gdb-find-source-frame nil + "Non-nil means try to find a source frame further up stack e.g after signal." :group 'gud :type 'boolean :version "22.1") +(defun gdb-find-source-frame (arg) + "Toggle trying to find a source frame further up stack. +With arg, look for a source frame further up stack iff arg is positive." + (interactive "P") + (setq gdb-find-source-frame + (if (null arg) + (not gdb-find-source-frame) + (> (prefix-numeric-value arg) 0))) + (message (format "Looking for source frame %sabled" + (if gdb-find-source-frame "en" "dis")))) + (defun gdb-stopped (ignored) "An annotation handler for `stopped'. It is just like `gdb-stopping', except that if we already set the output @@ -2785,8 +2796,13 @@ corresponding to the mode line clicked." (define-key gud-menu-map [ui] `(menu-item (if (eq gud-minor-mode 'gdba) "GDB-UI" "GDB-MI") ,menu :visible (memq gud-minor-mode '(gdbmi gdba)))) + (define-key menu [gdb-find-source-frame] + '(menu-item "Look For Source Frame" gdb-find-source-frame + :visible (eq gud-minor-mode 'gdba) + :help "Toggle look for source frame." + :button (:toggle . gdb-find-source-frame))) (define-key menu [gdb-use-separate-io] - '(menu-item "Separate inferior IO" gdb-use-separate-io-buffer + '(menu-item "Separate Inferior IO" gdb-use-separate-io-buffer :visible (eq gud-minor-mode 'gdba) :help "Toggle separate IO for inferior." :button (:toggle . gdb-use-separate-io-buffer))) From 4c78c45016a717daf772df3860b319323c518f24 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 2 Aug 2006 01:43:29 +0000 Subject: [PATCH 075/361] (Name Help): Add index entries for describe-variable. --- man/help.texi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/man/help.texi b/man/help.texi index 47600b711fa..6696b3440dd 100644 --- a/man/help.texi +++ b/man/help.texi @@ -251,6 +251,8 @@ name is defined as a Lisp function. Type @kbd{C-g} to cancel the @kbd{C-h f} command if you don't really want to view the documentation. +@kindex C-h v +@findex describe-variable @kbd{C-h v} (@code{describe-variable}) is like @kbd{C-h f} but describes Lisp variables instead of Lisp functions. Its default is the Lisp symbol around or before point, if that is the name of a From 9593ae179d0a86cf7ad46b641b439f0f4d979983 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 2 Aug 2006 01:57:45 +0000 Subject: [PATCH 076/361] (mode-line-format): Adjust spacing around vc-mode. --- lisp/bindings.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/bindings.el b/lisp/bindings.el index 8a96387f2a1..caaddc67e86 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -291,7 +291,8 @@ Keymap to display on minor modes.") 'mode-line-buffer-identification (propertize " " 'help-echo help-echo) 'mode-line-position - `(vc-mode ("" vc-mode ,(propertize " " 'help-echo help-echo))) + `(vc-mode ("" vc-mode)) + (propertize " " 'help-echo help-echo) 'mode-line-modes `(which-func-mode ("" which-func-format ,dashes)) `(global-mode-string (,dashes global-mode-string)) From 946bb8881daeba7b7b30200fb77e6e6a90736984 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 2 Aug 2006 01:58:40 +0000 Subject: [PATCH 077/361] *** empty log message *** --- lisp/ChangeLog | 4 ++++ man/ChangeLog | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 349309ac6af..b6adcb50a8e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-01 Richard Stallman + + * bindings.el (mode-line-format): Adjust spacing around vc-mode. + 2006-08-02 Nick Roberts * progmodes/gdb-ui.el (gdb-find-source-frame): Make nil the diff --git a/man/ChangeLog b/man/ChangeLog index eb3dfdcfcf8..23788624bf9 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-08-01 Richard Stallman + + * help.texi (Name Help): Add index entries for describe-variable. + 2006-08-01 Nick Roberts * building.texi (GDB Graphical Interface): Shorten node names. From 042802316246aecab6d3f11d17b9f0e01da9a6c7 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Wed, 2 Aug 2006 09:48:46 +0000 Subject: [PATCH 078/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b6adcb50a8e..70adbc8a044 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-02 Nick Roberts + + * bindings.el (map): Make mode-line-buffer-identification-keymap + before defining propertized-buffer-identification. + 2006-08-01 Richard Stallman * bindings.el (mode-line-format): Adjust spacing around vc-mode. From 0bbb2a3a8dc0d4c0c8d665a585960f2ca0748b6b Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Wed, 2 Aug 2006 09:49:08 +0000 Subject: [PATCH 079/361] (map): Make mode-line-buffer-identification-keymap before defining propertized-buffer-identification. --- lisp/bindings.el | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lisp/bindings.el b/lisp/bindings.el index caaddc67e86..0769b3ad081 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -330,6 +330,21 @@ Keymap to display on minor modes.") (defvar mode-line-buffer-identification-keymap nil "\ Keymap for what is displayed by `mode-line-buffer-identification'.") +;; Add menu of buffer operations to the buffer identification part +;; of the mode line.or header line. +; +(let ((map (make-sparse-keymap))) + ;; Bind down- events so that the global keymap won't ``shine + ;; through''. + (define-key map [mode-line mouse-1] 'mode-line-previous-buffer) + (define-key map [header-line down-mouse-1] 'ignore) + (define-key map [header-line mouse-1] 'mode-line-previous-buffer) + (define-key map [header-line down-mouse-3] 'ignore) + (define-key map [mode-line mouse-3] 'mode-line-next-buffer) + (define-key map [header-line down-mouse-3] 'ignore) + (define-key map [header-line mouse-3] 'mode-line-next-buffer) + (setq mode-line-buffer-identification-keymap map)) + (defun propertized-buffer-identification (fmt) "Return a list suitable for `mode-line-buffer-identification'. FMT is a format specifier such as \"%12b\". This function adds @@ -454,21 +469,6 @@ Menu of mode operations in the mode line.") (let ((indicator (car (nth 4 (car (cdr event)))))) (describe-minor-mode-from-indicator indicator))) -;; Add menu of buffer operations to the buffer identification part -;; of the mode line.or header line. -; -(let ((map (make-sparse-keymap))) - ;; Bind down- events so that the global keymap won't ``shine - ;; through''. - (define-key map [mode-line mouse-1] 'mode-line-previous-buffer) - (define-key map [header-line down-mouse-1] 'ignore) - (define-key map [header-line mouse-1] 'mode-line-previous-buffer) - (define-key map [header-line down-mouse-3] 'ignore) - (define-key map [mode-line mouse-3] 'mode-line-next-buffer) - (define-key map [header-line down-mouse-3] 'ignore) - (define-key map [header-line mouse-3] 'mode-line-next-buffer) - (setq mode-line-buffer-identification-keymap map)) - (defvar minor-mode-alist nil "\ Alist saying how to show minor modes in the mode line. Each element looks like (VARIABLE STRING); From 3862ba195c151ebc6930dbd3b4a9ed3a38e53a48 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 2 Aug 2006 09:56:16 +0000 Subject: [PATCH 080/361] (mode-line-format): Simplify reference to vc-mode. --- lisp/ChangeLog | 4 ++++ lisp/bindings.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 70adbc8a044..9e028970a00 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-02 Andreas Schwab + + * bindings.el (mode-line-format): Simplify reference to vc-mode. + 2006-08-02 Nick Roberts * bindings.el (map): Make mode-line-buffer-identification-keymap diff --git a/lisp/bindings.el b/lisp/bindings.el index 0769b3ad081..699a05203af 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -291,7 +291,7 @@ Keymap to display on minor modes.") 'mode-line-buffer-identification (propertize " " 'help-echo help-echo) 'mode-line-position - `(vc-mode ("" vc-mode)) + '(vc-mode vc-mode) (propertize " " 'help-echo help-echo) 'mode-line-modes `(which-func-mode ("" which-func-format ,dashes)) From 424f4c9cfaf7c44e1e4ed1cc21d0d13f7dd59331 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 2 Aug 2006 14:08:49 +0000 Subject: [PATCH 081/361] =?UTF-8?q?(PC-expand-many-files):=20Avoid=20signa?= =?UTF-8?q?lling=20an=20error=20when=20the=20current=20directory=20doesn't?= =?UTF-8?q?=20exist.=20=20Reported=20by=20Micha=C3=ABl=20Cadilhac.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lisp/ChangeLog | 5 +++++ lisp/complete.el | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9e028970a00..a8d70ba5619 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-02 Stefan Monnier + + * complete.el (PC-expand-many-files): Avoid signalling an error when + the current directory doesn't exist. Reported by Micha,Ak(Bl Cadilhac. + 2006-08-02 Andreas Schwab * bindings.el (mode-line-format): Simplify reference to vc-mode. diff --git a/lisp/complete.el b/lisp/complete.el index ca6231893c3..c49ad488536 100644 --- a/lisp/complete.el +++ b/lisp/complete.el @@ -811,6 +811,12 @@ or properties are considered." (defun PC-expand-many-files (name) (with-current-buffer (generate-new-buffer " *Glob Output*") (erase-buffer) + (when (and (file-name-absolute-p name) + (not (file-directory-p default-directory))) + ;; If the current working directory doesn't exist `shell-command' + ;; signals an error. So if the file names we're looking for don't + ;; depend on the working directory, switch to a valid directory first. + (setq default-directory "/")) (shell-command (concat "echo " name) t) (goto-char (point-min)) ;; CSH-style shells were known to output "No match", whereas From c6dbae471872a8844d1ee1fb44d3ba8ffee8cd79 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 2 Aug 2006 14:14:19 +0000 Subject: [PATCH 082/361] (cvs-get-buffer-create): Obey `noreuse' even if `name' doesn't look like a file name. --- lisp/ChangeLog | 3 +++ lisp/pcvs-util.el | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a8d70ba5619..6703fed19db 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2006-08-02 Stefan Monnier + * pcvs-util.el (cvs-get-buffer-create): Obey `noreuse' even if `name' + doesn't look like a file name. + * complete.el (PC-expand-many-files): Avoid signalling an error when the current directory doesn't exist. Reported by Micha,Ak(Bl Cadilhac. diff --git a/lisp/pcvs-util.el b/lisp/pcvs-util.el index cb18fc83d59..84ce2e117b9 100644 --- a/lisp/pcvs-util.el +++ b/lisp/pcvs-util.el @@ -126,7 +126,9 @@ with `create-file-buffer' and will probably get another name than NAME. In such a case, the search for another buffer with the same name doesn't use the buffer name but the buffer's `list-buffers-directory' variable. If NOREUSE is non-nil, always return a new buffer." - (or (and (not (file-name-absolute-p name)) (get-buffer-create name)) + (or (and (not (file-name-absolute-p name)) + (if noreuse (generate-new-buffer name) + (get-buffer-create name))) (unless noreuse (dolist (buf (buffer-list)) (with-current-buffer buf From 97cd4340109b6f63e8eeb1beee1e21756e683801 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Wed, 2 Aug 2006 22:37:08 +0000 Subject: [PATCH 083/361] *** empty log message *** --- lisp/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6703fed19db..dc624acb0be 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-03 Kim F. Storm + + * edmacro.el (edmacro-fix-menu-commands): Ignore switch-frame. + 2006-08-02 Stefan Monnier * pcvs-util.el (cvs-get-buffer-create): Obey `noreuse' even if `name' From d2f00838a139465c7d0d49fe83eee36902943f13 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Wed, 2 Aug 2006 22:37:17 +0000 Subject: [PATCH 084/361] (edmacro-fix-menu-commands): Ignore switch-frame. --- lisp/edmacro.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/edmacro.el b/lisp/edmacro.el index 0998697dc2a..0fecaf2f5d4 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el @@ -670,6 +670,7 @@ This function assumes that the events can be stored in a string." (cond ((atom ev) (push ev result)) ((eq (car ev) 'help-echo)) + ((eq (car ev) 'switch-frame)) ((equal ev '(menu-bar)) (push 'menu-bar result)) ((equal (cadadr ev) '(menu-bar)) From 1200843820a76d33eeb0386cd617feec55a247f0 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Wed, 2 Aug 2006 22:51:44 +0000 Subject: [PATCH 085/361] Docstring style and grammar tweaks; nfc. --- lisp/format.el | 76 +++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/lisp/format.el b/lisp/format.el index 58c69575d36..66eca0c2ac2 100644 --- a/lisp/format.el +++ b/lisp/format.el @@ -117,17 +117,17 @@ DOC-STR should be a single line providing more information about the REGEXP is a regular expression to match against the beginning of the file; it should match only files in that format. Use nil to avoid - matching at all for formats for which this isn't appropriate to + matching at all for formats for which it isn't appropriate to require explicit encoding/decoding. -FROM-FN is called to decode files in that format; it gets two args, BEGIN +FROM-FN is called to decode files in that format; it takes two args, BEGIN and END, and can make any modifications it likes, returning the new end. It must make sure that the beginning of the file no longer matches REGEXP, or else it will get called again. Alternatively, FROM-FN can be a string, which specifies a shell command (including options) to be used as a filter to perform the conversion. -TO-FN is called to encode a region into that format; it is passed three +TO-FN is called to encode a region into that format; it takes three arguments: BEGIN, END, and BUFFER. BUFFER is the original buffer that the data being written came from, which the function could use, for example, to find the values of local variables. TO-FN should either @@ -142,7 +142,7 @@ MODIFY, if non-nil, means the TO-FN wants to modify the region. If nil, MODE-FN, if specified, is called when visiting a file with that format. It is called with a single positive argument, on the assumption - that it turns on some Emacs mode. + that this would turn on some minor mode. PRESERVE, if non-nil, means that `format-write-file' should not remove this format from `buffer-file-formats'.") @@ -150,8 +150,8 @@ PRESERVE, if non-nil, means that `format-write-file' should not remove ;;; Basic Functions (called from Lisp) (defun format-encode-run-method (method from to &optional buffer) - "Translate using function or shell script METHOD the text from FROM to TO. -If METHOD is a string, it is a shell command; + "Translate using METHOD the text from FROM to TO. +If METHOD is a string, it is a shell command (including options); otherwise, it should be a Lisp function. BUFFER should be the buffer that the output originally came from." (if (stringp method) @@ -173,9 +173,9 @@ BUFFER should be the buffer that the output originally came from." (funcall method from to buffer))) (defun format-decode-run-method (method from to &optional buffer) - "Decode using function or shell script METHOD the text from FROM to TO. -If METHOD is a string, it is a shell command; otherwise, it should be -a Lisp function. Decoding is done for the given BUFFER." + "Decode using METHOD the text from FROM to TO. +If METHOD is a string, it is a shell command (including options); otherwise, +it should be a Lisp function. Decoding is done for the given BUFFER." (if (stringp method) (let ((error-buff (get-buffer-create "*Format Errors*")) (coding-system-for-write 'no-conversion) @@ -200,15 +200,15 @@ a Lisp function. Decoding is done for the given BUFFER." (defun format-annotate-function (format from to orig-buf format-count) "Return annotations for writing region as FORMAT. -FORMAT is a symbol naming one of the formats defined in `format-alist', -it must be a single symbol, not a list like `buffer-file-format'. +FORMAT is a symbol naming one of the formats defined in `format-alist'. +It must be a single symbol, not a list like `buffer-file-format'. FROM and TO delimit the region to be operated on in the current buffer. ORIG-BUF is the original buffer that the data came from. FORMAT-COUNT is an integer specifying how many times this function has been called in the process of decoding ORIG-BUF. -This function works like a function on `write-region-annotate-functions': +This function works like a function in `write-region-annotate-functions': it either returns a list of annotations, or returns with a different buffer current, which contains the modified text to write. In the latter case, this function's value is nil. @@ -253,7 +253,7 @@ If optional third arg VISIT-FLAG is true, set `buffer-file-format' to the reverted list of formats used, and call any mode functions defined for those formats. -Returns the new length of the decoded region. +Return the new length of the decoded region. For most purposes, consider using `format-decode-region' instead." (let ((mod (buffer-modified-p)) @@ -312,9 +312,9 @@ For most purposes, consider using `format-decode-region' instead." (defun format-decode-buffer (&optional format) "Translate the buffer from some FORMAT. -If the format is not specified, this function attempts to guess. -`buffer-file-format' is set to the format used, and any mode-functions -for the format are called." +If the format is not specified, attempt a regexp-based guess. +Set `buffer-file-format' to the format used, and call any +format-specific mode functions." (interactive (list (format-read "Translate buffer from format (default guess): "))) (save-excursion @@ -343,7 +343,7 @@ formats defined in `format-alist', or a list of such symbols." (defun format-encode-region (beg end &optional format) "Translate the region into some FORMAT. -FORMAT defaults to `buffer-file-format', it is a symbol naming +FORMAT defaults to `buffer-file-format'. It is a symbol naming one of the formats defined in `format-alist', or a list of such symbols." (interactive (list (region-beginning) (region-end) @@ -374,9 +374,9 @@ Make buffer visit that file and set the format as the default for future saves. If the buffer is already visiting a file, you can specify a directory name as FILENAME, to write a file of the same old name in that directory. -If optional third arg CONFIRM is non-nil, this function asks for -confirmation before overwriting an existing file. Interactively, -confirmation is required unless you supply a prefix argument." +If optional third arg CONFIRM is non-nil, ask for confirmation before +overwriting an existing file. Interactively, confirmation is required +unless you supply a prefix argument." (interactive ;; Same interactive spec as write-file, plus format question. (let* ((file (if buffer-file-name @@ -419,7 +419,7 @@ If FORMAT is nil then do not do any format conversion." "Insert the contents of file FILENAME using data format FORMAT. If FORMAT is nil then do not do any format conversion. The optional third and fourth arguments BEG and END specify -the part of the file to read. +the part (in bytes) of the file to read. The return value is like the value of `insert-file-contents': a list (ABSOLUTE-FILE-NAME SIZE)." @@ -456,10 +456,10 @@ Formats are defined in `format-alist'. Optional arg is the PROMPT to use." (defun format-replace-strings (alist &optional reverse beg end) "Do multiple replacements on the buffer. ALIST is a list of (FROM . TO) pairs, which should be proper arguments to -`search-forward' and `replace-match' respectively. -Optional 2nd arg REVERSE, if non-nil, means the pairs are (TO . FROM), so that -you can use the same list in both directions if it contains only literal -strings. +`search-forward' and `replace-match', respectively. +Optional second arg REVERSE, if non-nil, means the pairs are (TO . FROM), +so that you can use the same list in both directions if it contains only +literal strings. Optional args BEG and END specify a region of the buffer on which to operate." (save-excursion (save-restriction @@ -497,7 +497,7 @@ the value of `foo'." (defun format-make-relatively-unique (a b) "Delete common elements of lists A and B, return as pair. -Compares using `equal'." +Compare using `equal'." (let* ((acopy (copy-sequence a)) (bcopy (copy-sequence b)) (tail acopy)) @@ -511,9 +511,9 @@ Compares using `equal'." (defun format-common-tail (a b) "Given two lists that have a common tail, return it. -Compares with `equal', and returns the part of A that is equal to the +Compare with `equal', and return the part of A that is equal to the equivalent part of B. If even the last items of the two are not equal, -returns nil." +return nil." (let ((la (length a)) (lb (length b))) ;; Make sure they are the same length @@ -534,9 +534,9 @@ A proper list is a list ending with a nil cdr, not with an atom " (null list))) (defun format-reorder (items order) - "Arrange ITEMS to following partial ORDER. -Elements of ITEMS equal to elements of ORDER will be rearranged to follow the -ORDER. Unmatched items will go last." + "Arrange ITEMS to follow partial ORDER. +Elements of ITEMS equal to elements of ORDER will be rearranged +to follow the ORDER. Unmatched items will go last." (if order (let ((item (member (car order) items))) (if item @@ -793,7 +793,7 @@ yet known. ;; next-single-property-change instead of text-property-not-all, but then ;; we have to see if we passed TO. (defun format-property-increment-region (from to prop delta default) - "Over the region between FROM and TO increment property PROP by amount DELTA. + "In the region from FROM to TO increment property PROP by amount DELTA. DELTA may be negative. If property PROP is nil anywhere in the region, it is treated as though it were DEFAULT." (let ((cur from) val newval next) @@ -810,7 +810,7 @@ in the region, it is treated as though it were DEFAULT." (defun format-insert-annotations (list &optional offset) "Apply list of annotations to buffer as `write-region' would. -Inserts each element of the given LIST of buffer annotations at its +Insert each element of the given LIST of buffer annotations at its appropriate place. Use second arg OFFSET if the annotations' locations are not relative to the beginning of the buffer: annotations will be inserted at their location-OFFSET+1 \(ie, the offset is treated as the position of @@ -834,7 +834,7 @@ property is the name of the annotation that you want to use, as it is for the (defun format-annotate-region (from to translations format-fn ignore) "Generate annotations for text properties in the region. -Searches for changes between FROM and TO, and describes them with a list of +Search for changes between FROM and TO, and describe them with a list of annotations as defined by alist TRANSLATIONS and FORMAT-FN. IGNORE lists text properties not to consider; any text properties that are neither ignored nor listed in TRANSLATIONS are warned about. @@ -975,9 +975,9 @@ either strings, or lists of the form (PARAMETER VALUE)." "Return annotations for property PROP changing from OLD to NEW. These are searched for in the translations alist TRANSLATIONS (see `format-annotate-region' for the format). -If NEW does not appear in the list, but there is a default function, then that -function is called. -Returns a cons of the form (CLOSE . OPEN) +If NEW does not appear in the list, but there is a default function, +then call that function. +Return a cons of the form (CLOSE . OPEN) where CLOSE is a list of annotations to close and OPEN is a list of annotations to open. @@ -1016,7 +1016,7 @@ either strings, or lists of the form (PARAMETER VALUE)." (format-annotate-atomic-property-change prop-alist old new))))) (defun format-annotate-atomic-property-change (prop-alist old new) - "Internal function annotate a single property change. + "Internal function to annotate a single property change. PROP-ALIST is the relevant element of a TRANSLATIONS list. OLD and NEW are the values." (let (num-ann) From 6b2fcbb546b8b69b2eef40c5042439d3f822bec7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Aug 2006 03:35:45 +0000 Subject: [PATCH 086/361] (jit-lock-fontify-now): Preserve the buffer's modification status when forcing the second redisplay. --- lisp/ChangeLog | 5 +++++ lisp/jit-lock.el | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dc624acb0be..a92c989b9b5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-02 Stefan Monnier + + * jit-lock.el (jit-lock-fontify-now): Preserve the buffer's + modification status when forcing the second redisplay. + 2006-08-03 Kim F. Storm * edmacro.el (edmacro-fix-menu-commands): Ignore switch-frame. diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index 7077d7880eb..4d7afe8c33f 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -31,6 +31,8 @@ (eval-when-compile + (require 'cl) + (defmacro with-buffer-unmodified (&rest body) "Eval BODY, preserving the current buffer's modified state." (declare (debug t)) @@ -384,10 +386,14 @@ Defaults to the whole buffer. END can be out of bounds." ;; eagerly extend the refontified region with ;; jit-lock-after-change-extend-region-functions. (when (< start orig-start) - (run-with-timer - 0 nil `(lambda () - (put-text-property ',start ',orig-start - 'fontified t ',(current-buffer))))) + (lexical-let ((start start) + (orig-start orig-start) + (buf (current-buffer))) + (run-with-timer + 0 nil (lambda () + (with-buffer-prepared-for-jit-lock + (put-text-property start orig-start + 'fontified t buf)))))) ;; Find the start of the next chunk, if any. (setq start (text-property-any next end 'fontified nil)))))))) From 2e3ef421a9e7888ed48241bbeecedaeefb58ab54 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 3 Aug 2006 05:10:38 +0000 Subject: [PATCH 087/361] Merge from erc--emacs--21 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-379 Creator: Michael Olson --- etc/ChangeLog | 4 ++++ etc/ERC-NEWS | 23 ++++++++++++++++++++++- lisp/erc/ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ lisp/erc/erc-backend.el | 11 ++++++----- lisp/erc/erc-log.el | 19 +++++++++++++++---- lisp/erc/erc-spelling.el | 14 ++++++-------- lisp/erc/erc.el | 12 ++++++++---- man/ChangeLog | 4 ++++ man/erc.texi | 2 +- 9 files changed, 103 insertions(+), 23 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 4937aef2bca..ae887b33da9 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2006-08-03 Michael Olson + + * ERC-NEWS: Update for ERC 5.1.4. + 2006-08-01 Kenichi Handa * NEWS (find-operation-coding-system): Describe the more detail of diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index 778344c68c7..3a026ee1162 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS @@ -1,6 +1,27 @@ ERC NEWS -*- outline -*- -* Changes in ERC 5.2 (unreleased) +* Changes in ERC 5.1.4 + +** Make find-function and find-variable work in Emacs 22 for +names that are constructed by `define-erc-module'. + +** Fix bug introduced in ERC 5.1.3 that caused messages to go the +wrong buffer. + +** Changes and additions to modules + +*** Highlighting (erc-match.el) + +**** Don't activate view-mode. + +*** Logging (erc-log.el) + +**** When this module is activated, make sure logging is enabled on +already-opened buffers. Ditto for disabling logging when the module +is deactivated. + +**** Fix some errors that occur when exiting Emacs without first +quitting open IRC servers. * Changes in ERC 5.1.3 diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index 216d14d0aa6..0129bd43976 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,40 @@ +2006-08-02 Michael Olson + + * erc.el (erc-version-string): Release ERC 5.1.4. + + * Makefile, NEWS, erc.texi: Update for the 5.1.4 release. + + * erc.el (erc-active-buffer): Fix bug that caused messages to go + to the wrong buffer. Thanks to offby1 for the report. + + * erc-backend.el (erc-coding-system-for-target): Handle case where + target is nil. Thanks to Kai Fan for the patch. + +2006-07-29 Michael Olson + + * erc-log.el (erc-log-setup-logging): Don't offer to save the + buffer. It will be saved automatically killed. Thanks to Johan + BockgÃ¥rd and Tassilo Horn for pointing this out. + +2006-07-27 Johan BockgÃ¥rd + + * erc.el (define-erc-module): Make find-function and find-variable + find the names constructed by `define-erc-module' in Emacs 22. + +2006-07-14 Michael Olson + + * erc-log.el (log): Make sure that we enable logging on + already-opened buffers as well, in case the user toggles this + module after loading ERC. Also be sure to remove logging ability + from all ERC buffers when the module is disabled. + (erc-log-setup-logging): Set buffer-file-name to nil rather than + the empty string. This should fix some errors that occur when + quitting Emacs without first killing all ERC buffers. + (erc-log-disable-logging): New function that removes the logging + ability from the current buffer. + + * erc-spelling.el (spelling): Use dolist and buffer-live-p. + 2006-07-12 Michael Olson * erc-match.el (erc-log-matches): Bind inhibit-read-only rather diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 7dce9e4bf01..705ca7a9e63 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -563,11 +563,12 @@ action." "Return the coding system or cons cell appropriate for TARGET. This is determined via `erc-encoding-coding-alist' or `erc-server-coding-system'." - (or (let ((case-fold-search t)) - (catch 'match - (dolist (pat erc-encoding-coding-alist) - (when (string-match (car pat) target) - (throw 'match (cdr pat)))))) + (or (when target + (let ((case-fold-search t)) + (catch 'match + (dolist (pat erc-encoding-coding-alist) + (when (string-match (car pat) target) + (throw 'match (cdr pat))))))) (and (functionp erc-server-coding-system) (funcall erc-server-coding-system)) erc-server-coding-system)) diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el index b316a8588bd..418e45060bd 100644 --- a/lisp/erc/erc-log.el +++ b/lisp/erc/erc-log.el @@ -218,7 +218,10 @@ also be a predicate function. To only log when you are not set away, use: (add-hook 'erc-quit-hook 'erc-conditional-save-queries) (add-hook 'erc-part-hook 'erc-conditional-save-buffer) ;; append, so that 'erc-initialize-log-marker runs first - (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append)) + (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append) + (dolist (buffer (erc-buffer-list)) + (when (buffer-live-p buffer) + (with-current-buffer buffer (erc-log-setup-logging))))) ;; disable ((remove-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs) (remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs) @@ -226,7 +229,10 @@ also be a predicate function. To only log when you are not set away, use: (remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs) (remove-hook 'erc-quit-hook 'erc-conditional-save-queries) (remove-hook 'erc-part-hook 'erc-conditional-save-buffer) - (remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging))) + (remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging) + (dolist (buffer (erc-buffer-list)) + (when (buffer-live-p buffer) + (with-current-buffer buffer (erc-log-disable-logging)))))) (define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs) @@ -236,8 +242,7 @@ also be a predicate function. To only log when you are not set away, use: This function is destined to be run from `erc-connect-pre-hook'." (when (erc-logging-enabled) (auto-save-mode -1) - (setq buffer-offer-save t - buffer-file-name "") + (setq buffer-file-name nil) (set (make-local-variable 'write-file-functions) '(erc-save-buffer-in-logs)) (when erc-log-insert-log-on-open @@ -245,6 +250,12 @@ This function is destined to be run from `erc-connect-pre-hook'." (move-marker erc-last-saved-position (1- (point-max))))))) +(defun erc-log-disable-logging () + "Disable logging in the current buffer." + (when (erc-logging-enabled) + (setq buffer-offer-save nil + erc-enable-logging nil))) + (defun erc-log-all-but-server-buffers (buffer) "Returns t if logging should be enabled in BUFFER. Returns nil iff `erc-server-buffer-p' returns t." diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el index 3cbc786274d..7ed0f510539 100644 --- a/lisp/erc/erc-spelling.el +++ b/lisp/erc/erc-spelling.el @@ -40,15 +40,13 @@ ;; Use erc-connect-pre-hook instead of erc-mode-hook as pre-hook is ;; called AFTER the server buffer is initialized. ((add-hook 'erc-connect-pre-hook 'erc-spelling-init) - (mapc (lambda (buffer) - (when buffer - (with-current-buffer buffer (erc-spelling-init)))) - (erc-buffer-list))) + (dolist (buffer (erc-buffer-list)) + (when (buffer-live-p buffer) + (with-current-buffer buffer (erc-spelling-init))))) ((remove-hook 'erc-connect-pre-hook 'erc-spelling-init) - (mapc (lambda (buffer) - (when buffer - (with-current-buffer buffer (flyspell-mode 0)))) - (erc-buffer-list)))) + (dolist (buffer (erc-buffer-list)) + (when (buffer-live-p buffer) + (with-current-buffer buffer (flyspell-mode 0)))))) (defcustom erc-spelling-dictionaries nil "An alist mapping buffer names to dictionaries. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index fd5a49eae4b..4317b831d56 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -67,7 +67,7 @@ ;;; Code: -(defconst erc-version-string "Version 5.1.3" +(defconst erc-version-string "Version 5.1.4" "ERC version. This is used by function `erc-version'.") (eval-when-compile (require 'cl)) @@ -1243,7 +1243,11 @@ With arg, turn ERC %S mode on if and only if arg is positive. (format "erc-%s-mode" (downcase (symbol-name alias))))) (quote - ,mode)))))) + ,mode))) + ;; For find-function and find-variable. + (put ',mode 'definition-name ',name) + (put ',enable 'definition-name ',name) + (put ',disable 'definition-name ',name)))) (put 'define-erc-module 'doc-string-elt 3) @@ -1388,8 +1392,8 @@ server buffer") Defaults to the server buffer." (with-current-buffer (erc-server-buffer) (if (buffer-live-p erc-active-buffer) - erc-active-buffer) - (setq erc-active-buffer (current-buffer)))) + erc-active-buffer + (setq erc-active-buffer (current-buffer))))) (defun erc-set-active-buffer (buffer) "Set the value of `erc-active-buffer' to BUFFER." diff --git a/man/ChangeLog b/man/ChangeLog index 23788624bf9..4723b892276 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-08-03 Michael Olson + + * erc.texi: Update for ERC 5.1.4. + 2006-08-01 Richard Stallman * help.texi (Name Help): Add index entries for describe-variable. diff --git a/man/erc.texi b/man/erc.texi index 29b0f059722..c4317f11511 100644 --- a/man/erc.texi +++ b/man/erc.texi @@ -12,7 +12,7 @@ @syncodeindex fn cp @copying -This manual is for ERC version 5.1.3. +This manual is for ERC version 5.1.4. Copyright @copyright{} 2005, 2006 Free Software Foundation, Inc. From ab0dd59ce73e9b13b44ffe52d9937a7a7221e000 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Aug 2006 05:42:53 +0000 Subject: [PATCH 088/361] (font-lock-extend-after-change-region-function): Rename from font-lock-extend-region-function. (font-lock-extend-region): Remove by inlining at call sites. (font-lock-after-change-function): Don't needlessly round up to a whole number of lines. (font-lock-extend-jit-lock-region-after-change): Be more careful about the boundary conditions and the interactions between the various ways to extend the region. --- lisp/ChangeLog | 11 ++++++ lisp/font-lock.el | 87 ++++++++++++++++++++++------------------------ lispref/modes.texi | 2 +- 3 files changed, 54 insertions(+), 46 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a92c989b9b5..dd1b63ba4ee 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2006-08-03 Stefan Monnier + + * font-lock.el (font-lock-extend-after-change-region-function): + Rename from font-lock-extend-region-function. + (font-lock-extend-region): Remove by inlining at call sites. + (font-lock-after-change-function): Don't needlessly round up to a whole + number of lines. + (font-lock-extend-jit-lock-region-after-change): Be more careful about + the boundary conditions and the interactions between the various ways + to extend the region. + 2006-08-02 Stefan Monnier * jit-lock.el (jit-lock-fontify-now): Preserve the buffer's diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 201d236f7ac..a7cc1a09022 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -975,7 +975,7 @@ The value of this variable is used when Font Lock mode is turned on." ;; directives correctly and cleanly. (It is the same problem as fontifying ;; multi-line strings and comments; regexps are not appropriate for the job.) -(defvar font-lock-extend-region-function nil +(defvar font-lock-extend-after-change-region-function nil "A function that determines the region to fontify after a change. This variable is either nil, or is a function that determines the @@ -986,20 +986,10 @@ Font-lock calls this function after each buffer change. The function is given three parameters, the standard BEG, END, and OLD-LEN from `after-change-functions'. It should return either a cons of the beginning and end buffer positions \(in that order) of the region to fontify, or nil -\(which directs the caller to fontify a default region). This function -should preserve point and the match-data. +\(which directs the caller to fontify a default region). +This function should preserve the match-data. The region it returns may start or end in the middle of a line.") -(defun font-lock-extend-region (beg end old-len) - "Determine the region to fontify after a buffer change. - -BEG END and OLD-LEN are the standard parameters from `after-change-functions'. -The return value is either nil \(which directs the caller to chose the region -itself), or a cons of the beginning and end \(in that order) of the region. -The region returned may start or end in the middle of a line." - (if font-lock-extend-region-function - (funcall font-lock-extend-region-function beg end old-len))) - (defun font-lock-fontify-buffer () "Fontify the current buffer the way the function `font-lock-mode' would." (interactive) @@ -1112,47 +1102,54 @@ what properties to clear before refontifying a region.") ;; Called when any modification is made to buffer text. (defun font-lock-after-change-function (beg end old-len) - (let ((inhibit-point-motion-hooks t) - (inhibit-quit t) - (region (font-lock-extend-region beg end old-len))) - (save-excursion + (save-excursion + (let ((inhibit-point-motion-hooks t) + (inhibit-quit t) + (region (if font-lock-extend-after-change-region-function + (funcall font-lock-extend-after-change-region-function + beg end old-len)))) (save-match-data (if region ;; Fontify the region the major mode has specified. (setq beg (car region) end (cdr region)) ;; Fontify the whole lines which enclose the region. - (setq beg (progn (goto-char beg) (line-beginning-position)) - end (progn (goto-char end) (line-beginning-position 2)))) + ;; Actually, this is not needed because + ;; font-lock-default-fontify-region already rounds up to a whole + ;; number of lines. + ;; (setq beg (progn (goto-char beg) (line-beginning-position)) + ;; end (progn (goto-char end) (line-beginning-position 2))) + ) (font-lock-fontify-region beg end))))) (defvar jit-lock-start) (defvar jit-lock-end) (defun font-lock-extend-jit-lock-region-after-change (beg end old-len) - (let ((region (font-lock-extend-region beg end old-len))) - (if region - (setq jit-lock-start (min jit-lock-start (car region)) - jit-lock-end (max jit-lock-end (cdr region))) - (save-excursion - (goto-char beg) - (forward-line 0) - (setq jit-lock-start - (min jit-lock-start - (if (and (not (eobp)) - (get-text-property (point) 'font-lock-multiline)) - (or (previous-single-property-change - (point) 'font-lock-multiline) - (point-min)) - (point)))) - (goto-char end) - (forward-line 1) - (setq jit-lock-end - (max jit-lock-end - (if (and (not (bobp)) - (get-text-property (1- (point)) - 'font-lock-multiline)) - (or (next-single-property-change - (1- (point)) 'font-lock-multiline) - (point-max)) - (point)))))))) + (save-excursion + ;; First extend the region as font-lock-after-change-function would. + (let ((region (if font-lock-extend-after-change-region-function + (funcall font-lock-extend-after-change-region-function + beg end old-len)))) + (if region + (setq beg (min jit-lock-start (car region)) + end (max jit-lock-end (cdr region)))) + ;; Then extend the region obeying font-lock-multiline properties, + ;; indicating which part of the buffer needs to be refontified. + (when (and (> beg (point-min)) + (get-text-property (1- beg) 'font-lock-multiline)) + (setq beg (or (previous-single-property-change + beg 'font-lock-multiline) + (point-min)))) + (setq end (or (text-property-any end (point-max) + 'font-lock-multiline nil) + (point-max))) + ;; Finally, pre-enlarge the region to a whole number of lines, to try + ;; and predict what font-lock-default-fontify-region will do, so as to + ;; avoid double-redisplay. + (goto-char beg) + (forward-line 0) + (setq jit-lock-start (min jit-lock-start (point))) + (goto-char end) + (forward-line 1) + (setq jit-lock-end (max jit-lock-end (point)))))) (defun font-lock-fontify-block (&optional arg) "Fontify some lines the way `font-lock-fontify-buffer' would. diff --git a/lispref/modes.texi b/lispref/modes.texi index 8b4188ecff2..7ca8764a0a8 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi @@ -3144,7 +3144,7 @@ earlier line. You can enlarge (or even reduce) the region to fontify by setting one the following variables: -@defvar font-lock-extend-region-function +@defvar font-lock-extend-after-change-region-function This buffer-local variable is either @code{nil} or a function for Font-Lock to call to determine the region to scan and fontify. From 05a1066ff0521af95b3761376c853d96312ca2f3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Aug 2006 07:14:39 +0000 Subject: [PATCH 089/361] (font-lock-beg, font-lock-end, font-lock-extend-region-functions): New vars. (font-lock-extend-region-multiline) (font-lock-extend-region-wholelines): New functions. (font-lock-default-fontify-region): Use them. (font-lock-extend-jit-lock-region-after-change): Only round up if font-lock-default-fontify-region will do it as well. --- etc/NEWS | 5 +++ lisp/ChangeLog | 8 ++++ lisp/font-lock.el | 94 ++++++++++++++++++++++++++++++++++------------ lispref/modes.texi | 6 ++- 4 files changed, 88 insertions(+), 25 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 52fcc1eea2a..3f986846f17 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -5363,6 +5363,11 @@ text to being a piece of code, so you'd put a `jit-lock-defer-multiline' property over the second half of the command to force (deferred) refontification of `bar' whenever the `e' is added/removed. +*** `font-lock-extend-region-functions' makes it possible to alter the way +the fontification region is chosen. This can be used to prevent rounding +up to whole lines, or to extend the region to include all related lines +of multiline constructs so that such constructs get properly recognized. + ** Major mode mechanism changes: +++ diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dd1b63ba4ee..6329e0e699d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,13 @@ 2006-08-03 Stefan Monnier + * font-lock.el (font-lock-beg, font-lock-end) + (font-lock-extend-region-functions): New vars. + (font-lock-extend-region-multiline) + (font-lock-extend-region-wholelines): New functions. + (font-lock-default-fontify-region): Use them. + (font-lock-extend-jit-lock-region-after-change): Only round up + if font-lock-default-fontify-region will do it as well. + * font-lock.el (font-lock-extend-after-change-region-function): Rename from font-lock-extend-region-function. (font-lock-extend-region): Remove by inlining at call sites. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index a7cc1a09022..0cad924f201 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1040,6 +1040,53 @@ The region it returns may start or end in the middle of a line.") Useful for things like RMAIL and Info where the whole buffer is not a very meaningful entity to highlight.") + +(defvar font-lock-beg) (defvar font-lock-end) +(defvar font-lock-extend-region-functions + '(font-lock-extend-region-wholelines + font-lock-extend-region-multiline) + "Special hook run just before proceeding to fontify a region. +This is used to allow major modes to help font-lock find safe buffer positions +as beginning and end of the fontified region. Its most common use is to solve +the problem of /identification/ of multiline elements by providing a function +that tries to find such elements and move the boundaries such that they do +not fall in the middle of one. +Each function is called with no argument; it is expected to adjust the +dynamically bound variables `font-lock-beg' and `font-lock-end'; and return +non-nil iff it did make such an adjustment. +These functions are run in turn repeatedly until they all return nil. +Put first the functions more likely to cause a change and cheaper to compute.") +;; Mark it as a special hook which doesn't use any global setting +;; (i.e. doesn't obey the element t in the buffer-local value). +(make-variable-buffer-local 'font-lock-extend-region-functions) + +(defun font-lock-extend-region-multiline () + "Move fontification boundaries away from any `font-lock-multiline' property." + (let ((changed nil)) + (when (and (> font-lock-beg (point-min)) + (get-text-property (1- font-lock-beg) 'font-lock-multiline)) + (setq changed t) + (setq font-lock-beg (or (previous-single-property-change + font-lock-beg 'font-lock-multiline) + (point-min)))) + ;; + (when (get-text-property font-lock-end 'font-lock-multiline) + (setq changed t) + (setq font-lock-end (or (text-property-any font-lock-end (point-max) + 'font-lock-multiline nil) + (point-max)))) + changed)) + + +(defun font-lock-extend-region-wholelines () + "Move fontification boundaries to beginning of lines." + (let ((changed nil)) + (goto-char font-lock-beg) + (unless (bobp) (setq changed t font-lock-beg (line-beginning-position))) + (goto-char font-lock-end) + (unless (bobp) (setq changed t font-lock-end (line-beginning-position 2))) + changed)) + (defun font-lock-default-fontify-region (beg end loudly) (save-buffer-state ((parse-sexp-lookup-properties @@ -1051,24 +1098,21 @@ a very meaningful entity to highlight.") ;; Use the fontification syntax table, if any. (when font-lock-syntax-table (set-syntax-table font-lock-syntax-table)) - (goto-char beg) - (setq beg (line-beginning-position)) - ;; check to see if we should expand the beg/end area for - ;; proper multiline matches - (when (and (> beg (point-min)) - (get-text-property (1- beg) 'font-lock-multiline)) - ;; We are just after or in a multiline match. - (setq beg (or (previous-single-property-change - beg 'font-lock-multiline) - (point-min))) - (goto-char beg) - (setq beg (line-beginning-position))) - (setq end (or (text-property-any end (point-max) - 'font-lock-multiline nil) - (point-max))) - (goto-char end) - ;; Round up to a whole line. - (unless (bolp) (setq end (line-beginning-position 2))) + ;; Extend the region to fontify so that it starts and ends at + ;; safe places. + (let ((funs font-lock-extend-region-functions) + (font-lock-beg beg) + (font-lock-end end)) + (while funs + (setq funs (if (or (not (funcall (car funs))) + (eq funs font-lock-extend-region-functions)) + (cdr funs) + ;; If there's been a change, we should go through + ;; the list again since this new position may + ;; warrant a different answer from one of the fun + ;; we've already seen. + font-lock-extend-region-functions))) + (setq beg font-lock-beg end font-lock-end)) ;; Now do the fontification. (font-lock-unfontify-region beg end) (when font-lock-syntactic-keywords @@ -1144,12 +1188,14 @@ what properties to clear before refontifying a region.") ;; Finally, pre-enlarge the region to a whole number of lines, to try ;; and predict what font-lock-default-fontify-region will do, so as to ;; avoid double-redisplay. - (goto-char beg) - (forward-line 0) - (setq jit-lock-start (min jit-lock-start (point))) - (goto-char end) - (forward-line 1) - (setq jit-lock-end (max jit-lock-end (point)))))) + (when (memq 'font-lock-extend-region-wholelines + font-lock-extend-region-functions) + (goto-char beg) + (forward-line 0) + (setq jit-lock-start (min jit-lock-start (point))) + (goto-char end) + (forward-line 1) + (setq jit-lock-end (max jit-lock-end (point))))))) (defun font-lock-fontify-block (&optional arg) "Fontify some lines the way `font-lock-fontify-buffer' would. diff --git a/lispref/modes.texi b/lispref/modes.texi index 7ca8764a0a8..38227633c6b 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi @@ -3044,7 +3044,7 @@ closely related, and often getting one of them to work will appear to make the other also work. However, for reliable results you must attend explicitly to both aspects. - There are two ways to ensure correct identification of multiline + There are three ways to ensure correct identification of multiline constructs: @itemize @@ -3055,6 +3055,10 @@ property on the construct when it is added to the buffer. Use @code{font-lock-fontify-region-function} hook to extend the scan so that the scanned text never starts or ends in the middle of a multiline construct. +@item +Add a function to @code{font-lock-extend-region-functions} that does +the \emph{identification} and extends the scan so that the scanned +text never starts or ends in the middle of a multiline construct. @end itemize There are three ways to do rehighlighting of multiline constructs: From e642d1fea767e716d584e48ee5654513175edadb Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 3 Aug 2006 09:44:24 +0000 Subject: [PATCH 090/361] Fix typo in markup. --- lispref/modes.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lispref/modes.texi b/lispref/modes.texi index 38227633c6b..8b24db35621 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi @@ -3057,7 +3057,7 @@ so that the scanned text never starts or ends in the middle of a multiline construct. @item Add a function to @code{font-lock-extend-region-functions} that does -the \emph{identification} and extends the scan so that the scanned +the @emph{identification} and extends the scan so that the scanned text never starts or ends in the middle of a multiline construct. @end itemize From 9b7fa2975f40b82e94dadd13c049ff67ef0ef449 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 3 Aug 2006 10:14:49 +0000 Subject: [PATCH 091/361] *** empty log message *** --- lisp/ChangeLog | 12 ++++++------ lispref/ChangeLog | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6329e0e699d..28c8ac15e40 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -173,9 +173,9 @@ 2006-07-26 Mathias Dahl - * tumme.el (tumme-backward-image): Add prefix argument. Add error + * tumme.el (tumme-backward-image): Add prefix argument. Add error when at first image. - (tumme-forward-image): Add prefix argument. Add error when at last + (tumme-forward-image): Add prefix argument. Add error when at last image. 2006-07-25 Stefan Monnier @@ -239,8 +239,8 @@ 2006-07-24 Daiki Ueno * pgg-def.el (pgg-truncate-key-identifier): Truncate the key ID to 8 - letters from the end. Thanks to "David Smith" and - andreas@altroot.de (Andreas V,Av(Bgele) + letters from the end. Thanks to "David Smith" + and andreas@altroot.de (Andreas V,Av(Bgele). 2006-07-23 Thien-Thi Nguyen @@ -279,7 +279,7 @@ 2006-07-21 Dan Nicolaescu * term/xterm.el (terminal-init-xterm): Fix key bindings - syntax. Bind S-return, C-M-., C-TAB, S-TAB and C-S-TAB. + syntax. Bind S-return, C-M-., C-TAB, S-TAB and C-S-TAB. 2006-07-21 Eli Zaretskii @@ -315,7 +315,7 @@ * calc.el (calc-previous-alg-entry): Remove variable. - * calc-aent.el (calc-alg-entry-history, calc-quick-calc-history): + * calc-aent.el (calc-alg-entry-history, calc-quick-calc-history): New variables. (calc-alg-entry): Use `calc-alg-entry-history'. (calc-do-quick-calc): Use `calc-quick-calc-history'. diff --git a/lispref/ChangeLog b/lispref/ChangeLog index f64f9eb56df..f3f3037e4d1 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -290,7 +290,7 @@ * anti.texi, customize.texi, display.texi, internals.texi: * minibuf.texi, modes.texi, tips.texi: - Fix overfull/underfull boxes. + Fix overfull/underfull boxes. 2006-07-05 Thien-Thi Nguyen @@ -367,7 +367,7 @@ 2006-06-09 Aidan Kehoe - * objects.texi (Character Type): Describe the\uABCD and \U00ABCDEF + * objects.texi (Character Type): Describe the \uABCD and \U00ABCDEF syntax. 2006-06-07 Eli Zaretskii @@ -679,7 +679,7 @@ 2006-04-13 Bill Wohler * customize.texi (Common Keywords): Use dotted notation for - :package-version value. Specify its values. Improve documentation + :package-version value. Specify its values. Improve documentation for customize-package-emacs-version-alist. 2006-04-12 Bill Wohler @@ -1724,7 +1724,7 @@ (Jumping): Clarify description of `h' command. Eliminate redundant @ref. (Breaks): New node. - (Breakpoints): is now a subsubsection. + (Breakpoints): Is now a subsubsection. (Global Break Condition): Mention `C-x X X'. (Edebug Views): Clarify `v' and `p'. Mention `C-x X w'. (Trace Buffer): Clarify STRING arg of `edebug-tracing'. @@ -2974,7 +2974,7 @@ 2004-10-24 Jason Rumney - * commands.texi (Misc Events): Remove mouse-wheel. Add wheel-up + * commands.texi (Misc Events): Remove mouse-wheel. Add wheel-up and wheel-down. 2004-10-24 Kai Grossjohann @@ -3203,7 +3203,7 @@ except while processing `frame-title-format' or `icon-title-format'. (Deleting Frames): Correct description of `delete-frame'. Non-nil return values of `frame-live-p' are like those of `framep'. - (Frames and Windows): mention return value of + (Frames and Windows): Mention return value of `set-frame-selected-window'. (Visibility of Frames): Mention `force' argument to `make-frame-invisible'. `frame-visible-p' returns t for all @@ -3530,7 +3530,7 @@ 2004-03-07 Thien-Thi Nguyen - * customize.texi: Fix typo. Remove eol whitespace. + * customize.texi: Fix typo. Remove eol whitespace. 2004-03-04 Richard M. Stallman @@ -3566,7 +3566,7 @@ * text.texi: Various small changes in addition to the following: (User-Level Deletion): Mention optional BACKWARD-ONLY argument to delete-horizontal-space. - (Kill Functions, Yanking, Low-Level Kill Ring): clarify and correct + (Kill Functions, Yanking, Low-Level Kill Ring): Clarify and correct description of yank-handler text property at various places. * frames.texi (Window System Selections): Add anchor. @@ -4593,7 +4593,7 @@ * loading.texi (Unloading): Fix recent change for load-history. * customize.texi (Simple Types): Clarify description of custom - type 'number. Describe new custom type 'float. + type 'number. Describe new custom type 'float. 2002-12-04 Markus Rost @@ -5123,7 +5123,7 @@ Mon Apr 17 18:56:50 1989 Robert J. Chassell (bob@rice-chex.ai.mit.edu) Tue Apr 11 12:23:28 1989 Robert J. Chassell (bob@rice-chex.ai.mit.edu) * Applied Karl Berry's patches to *.texinfo files, but not to - texinfo.tex; those diffs are in `berry-texinfo-tex-diffs'. (Karl's + texinfo.tex; those diffs are in `berry-texinfo-tex-diffs'. (Karl's new title page format is also not applied, since it requires texinfo.tex changes.) From 7abcd3e393cead48a7ac8c76e6d85b40ca48effe Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 3 Aug 2006 14:26:27 +0000 Subject: [PATCH 092/361] * simple.el (line-move-to-column): Constrain move-to-column to current field. --- lisp/ChangeLog | 5 +++++ lisp/simple.el | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 28c8ac15e40..d6ca6734af4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-03 Chong Yidong + + * simple.el (line-move-to-column): Constrain move-to-column to + current field. + 2006-08-03 Stefan Monnier * font-lock.el (font-lock-beg, font-lock-end) diff --git a/lisp/simple.el b/lisp/simple.el index 2af4bbd1d76..9288ab6bd79 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3697,7 +3697,10 @@ because what we really need is for `move-to-column' and `current-column' to be able to ignore invisible text." (if (zerop col) (beginning-of-line) - (move-to-column col)) + (let ((opoint (point))) + (move-to-column col) + ;; move-to-column doesn't respect field boundaries. + (goto-char (constrain-to-field (point) opoint)))) (when (and line-move-ignore-invisible (not (bolp)) (line-move-invisible-p (1- (point)))) From d634a67054364f0a1d1ddad6791fe69186505fbe Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 3 Aug 2006 15:19:20 +0000 Subject: [PATCH 093/361] * process.c: Revert last change. --- src/ChangeLog | 4 ++++ src/process.c | 18 ++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 08590d793da..78cfea5dff2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-03 Chong Yidong + + * process.c: Revert last change. + 2006-08-01 Kim F. Storm * process.c (wait_reading_process_output_unwind): New function. diff --git a/src/process.c b/src/process.c index b24dee002c6..dc70ef37761 100644 --- a/src/process.c +++ b/src/process.c @@ -4158,14 +4158,6 @@ server_accept_connection (server, channel) when not inside wait_reading_process_output. */ static int waiting_for_user_input_p; -static Lisp_Object -wait_reading_process_output_unwind (data) - Lisp_Object data; -{ - waiting_for_user_input_p = XINT (data); - return Qnil; -} - /* This is here so breakpoints can be put on it. */ static void wait_reading_process_output_1 () @@ -4248,7 +4240,11 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, EMACS_TIME timeout, end_time; int wait_channel = -1; int got_some_input = 0; - int count = SPECPDL_INDEX (); + /* We can't record_unwind_protect here because after the + set_waiting_for_input call, C-g (interrupt_signal) would run + throw_to_read_char instead of Fsignal, which means unbind_to + doesn't get called. */ + int saved_waiting_for_user_input_p = waiting_for_user_input_p; FD_ZERO (&Available); #ifdef NON_BLOCKING_CONNECT @@ -4259,8 +4255,6 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, if (wait_proc != NULL) wait_channel = XINT (wait_proc->infd); - record_unwind_protect (wait_reading_process_output_unwind, - make_number (waiting_for_user_input_p)); waiting_for_user_input_p = read_kbd; /* Since we may need to wait several times, @@ -4887,7 +4881,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, } /* end for each file descriptor */ } /* end while exit conditions not met */ - unbind_to (count, Qnil); + waiting_for_user_input_p = saved_waiting_for_user_input_p; /* If calling from keyboard input, do not quit since we want to return C-g as an input character. From 8dea3e2baf6c0cf04bacf77745ac381ba291f522 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 3 Aug 2006 18:27:50 +0000 Subject: [PATCH 094/361] *** empty log message *** --- admin/FOR-RELEASE | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index cb5df6149c7..75720668bcf 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -31,6 +31,9 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. * BUGS +** Romain Francoise , Aug 2: + Abort at end of Fbyte_code because specpdl did not balance. + ** bojohan's and johnsu01@wjsullivan.net's 18 July bug reports that "C-n doesn't work in Customize Option buffer in -nw with long value displayed". Yidong proposed a fix, but needs a field expert to check From 402adebf6941095fd63f6076352dcc380ff8413f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Aug 2006 18:30:13 +0000 Subject: [PATCH 095/361] (gdb-script-font-lock-syntactic-keywords): Correctly mark the end-of-docstring char. --- lisp/ChangeLog | 10 ++++++++++ lisp/progmodes/gud.el | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d6ca6734af4..1f6e469dd62 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-03 Stefan Monnier + + * progmodes/gud.el (gdb-script-font-lock-syntactic-keywords): + Correctly mark the end-of-docstring char. + 2006-08-03 Chong Yidong * simple.el (line-move-to-column): Constrain move-to-column to @@ -180,8 +185,13 @@ * tumme.el (tumme-backward-image): Add prefix argument. Add error when at first image. +<<<<<<< ChangeLog + (tumme-forward-image): Add prefix argument. + Add error when at last image. +======= (tumme-forward-image): Add prefix argument. Add error when at last image. +>>>>>>> 1.9899 2006-07-25 Stefan Monnier diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 97e54135a6f..84b40e8ba80 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -3180,7 +3180,15 @@ class of the file (using s to separate nested class ids)." (defvar gdb-script-font-lock-syntactic-keywords '(("^document\\s-.*\\(\n\\)" (1 "< b")) ;; It would be best to change the \n in front, but it's more difficult. - ("^en\\(d\\)\\>" (1 "> b")))) + ("^end\\>" + (0 (progn + (unless (eq (match-beginning 0) (point-min)) + (put-text-property (1- (match-beginning 0)) (match-beginning 0) + 'syntax-table (eval-when-compile + (string-to-syntax "> b"))) + (put-text-property (1- (match-beginning 0)) (match-end 0) + 'font-lock-multiline t) + nil)))))) (defun gdb-script-font-lock-syntactic-face (state) (cond From fa9398d09ea120de89f587bfba40453f7ef1a0a2 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 3 Aug 2006 18:30:37 +0000 Subject: [PATCH 096/361] *** empty log message *** --- admin/FOR-RELEASE | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 75720668bcf..342914337a3 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -34,6 +34,13 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. ** Romain Francoise , Aug 2: Abort at end of Fbyte_code because specpdl did not balance. +** lennart.borgman July 27: Custom and mode-line-format default + M-x customize-option RET mode-line-format RET + +and then click the button "Erase Customization". This will set +mode-line-format to "%-" which does not seem to be useful. + + ** bojohan's and johnsu01@wjsullivan.net's 18 July bug reports that "C-n doesn't work in Customize Option buffer in -nw with long value displayed". Yidong proposed a fix, but needs a field expert to check From 8a38d42d83bb9fc54ce958ca6b791f7748e2f6d3 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Thu, 3 Aug 2006 18:41:58 +0000 Subject: [PATCH 097/361] *** empty log message *** --- lisp/ChangeLog | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1f6e469dd62..d00d8308c91 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -185,13 +185,8 @@ * tumme.el (tumme-backward-image): Add prefix argument. Add error when at first image. -<<<<<<< ChangeLog - (tumme-forward-image): Add prefix argument. - Add error when at last image. -======= (tumme-forward-image): Add prefix argument. Add error when at last image. ->>>>>>> 1.9899 2006-07-25 Stefan Monnier From f3e0a6de08025d4f77a55b74a28760cc9a5e30e7 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Thu, 3 Aug 2006 22:08:09 +0000 Subject: [PATCH 098/361] (w32_menu_show, w32_dialog_show): Call Fsignal to quit when no option selected except when for_click. --- src/ChangeLog | 5 +++++ src/w32menu.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 78cfea5dff2..1a70edd2a07 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-03 Jason Rumney + + * w32menu.c (w32_menu_show, w32_dialog_show): Call Fsignal to quit + when no option selected. + 2006-08-03 Chong Yidong * process.c: Revert last change. diff --git a/src/w32menu.c b/src/w32menu.c index 389e6c5b856..11af1d66b6f 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -1994,6 +1994,9 @@ w32_menu_show (f, x, y, for_click, keymaps, title, error) } } } + else if (!for_click) + /* Make "Cancel" equivalent to C-g. */ + Fsignal (Qquit, Qnil); return Qnil; } @@ -2186,6 +2189,9 @@ w32_dialog_show (f, keymaps, title, header, error) } } } + else + /* Make "Cancel" equivalent to C-g. */ + Fsignal (Qquit, Qnil); return Qnil; } From dc3ca1078f41aaf51d84fe06f9cdf22672b8a85e Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 4 Aug 2006 01:41:14 +0000 Subject: [PATCH 099/361] (x_query_font): Compare names by ignoring case. --- src/xterm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 5e4eeb3bb64..4203411e888 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10056,8 +10056,8 @@ x_query_font (f, fontname) for (i = 0; i < dpyinfo->n_fonts; i++) if (dpyinfo->font_table[i].name - && (!strcmp (dpyinfo->font_table[i].name, fontname) - || !strcmp (dpyinfo->font_table[i].full_name, fontname))) + && (!strcasecmp (dpyinfo->font_table[i].name, fontname) + || !strcasecmp (dpyinfo->font_table[i].full_name, fontname))) return (dpyinfo->font_table + i); return NULL; } From fca31fbb6681f58052d28cd21f90b1510fe88292 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 4 Aug 2006 01:48:10 +0000 Subject: [PATCH 100/361] (describe-font): Improve docstring and error message. Use frame-parameter (not frame-parameters). --- lisp/international/mule-diag.el | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 0a2e5a7c325..57b77249ba8 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -1039,18 +1039,28 @@ but still contains full information about each coding system." ;;;###autoload (defun describe-font (fontname) - "Display information about fonts which partially match FONTNAME." - (interactive "sFontname (default current choice for ASCII chars): ") + "Display information about a font whose name is FONTNAME. +The font must be already used by Emacs." + (interactive "sFont name (default current choice for ASCII chars): ") (or (and window-system (fboundp 'fontset-list)) - (error "No fontsets being used")) - (when (or (not fontname) (= (length fontname) 0)) - (setq fontname (cdr (assq 'font (frame-parameters)))) - (if (query-fontset fontname) - (setq fontname - (nth 1 (assq 'ascii (aref (fontset-info fontname) 2)))))) - (let ((font-info (font-info fontname))) + (error "No fonts being used")) + (let (fontset font-info) + (when (or (not fontname) (= (length fontname) 0)) + (setq fontname (frame-parameter nil 'font)) + ;; Check if FONTNAME is a fontset. + (if (query-fontset fontname) + (setq fontset fontname + fontname (nth 1 (assq 'ascii + (aref (fontset-info fontname) 2)))))) + (setq font-info (font-info fontname)) (if (null font-info) - (message "No matching font") + (if fontset + ;; The font should be surely used. So, there's some + ;; problem about getting information about it. It is + ;; better to print the fontname to show which font has + ;; this problem. + (message "No information about \"%s\"" fontname) + (message "No matching font being used")) (with-output-to-temp-buffer "*Help*" (describe-font-internal font-info 'verbose))))) From ef8f7cddb377a5fd5b8ec6549ded05bb9aa3da81 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 4 Aug 2006 01:49:05 +0000 Subject: [PATCH 101/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ src/ChangeLog | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d00d8308c91..69a67e059bd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-04 Kenichi Handa + + * international/mule-diag.el (describe-font): Improve docstring + and error message. Use frame-parameter (not frame-parameters). + 2006-08-03 Stefan Monnier * progmodes/gud.el (gdb-script-font-lock-syntactic-keywords): diff --git a/src/ChangeLog b/src/ChangeLog index 1a70edd2a07..b81ffed78b1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-04 Kenichi Handa + + * xterm.c (x_query_font): Compare names by ignoring case. + 2006-08-03 Jason Rumney * w32menu.c (w32_menu_show, w32_dialog_show): Call Fsignal to quit From 6f64cebf164a4a613f445aa32e70e95ba6a50d45 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 4 Aug 2006 02:50:10 +0000 Subject: [PATCH 102/361] (w32_query_font): Compare names by ignoring case. --- src/ChangeLog | 2 ++ src/w32fns.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index b81ffed78b1..faa7db9b206 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2006-08-04 Kenichi Handa + * w32fns.c (w32_query_font): Compare names by ignoring case. + * xterm.c (x_query_font): Compare names by ignoring case. 2006-08-03 Jason Rumney diff --git a/src/w32fns.c b/src/w32fns.c index 68fcced88c2..a3df8de5338 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6207,7 +6207,7 @@ w32_query_font (struct frame *f, char *fontname) for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++) { - if (strcmp(pfi->name, fontname) == 0) return pfi; + if (strcasecmp(pfi->name, fontname) == 0) return pfi; } return NULL; From 65c6c6b6ca9b39fc0d06621db620c5b235e7d45f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Aug 2006 10:42:41 +0000 Subject: [PATCH 103/361] (Formatting Strings): Warn against arbitrary strings as first arg to `format'. --- lispref/ChangeLog | 5 +++++ lispref/strings.texi | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index f3f3037e4d1..eb1fd9797c2 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,8 @@ +2006-08-04 Eli Zaretskii + + * strings.texi (Formatting Strings): Warn against arbitrary + strings as first arg to `format'. + 2006-07-31 Thien-Thi Nguyen * text.texi (Clickable Text): Mention `help-echo' text property. diff --git a/lispref/strings.texi b/lispref/strings.texi index 46c01982f32..12abc38ee02 100644 --- a/lispref/strings.texi +++ b/lispref/strings.texi @@ -701,7 +701,6 @@ arguments @var{objects} are the computed values to be formatted. The characters in @var{string}, other than the format specifications, are copied directly into the output; if they have text properties, -these are copied into the output also. @end defun @cindex @samp{%} in format @@ -719,6 +718,17 @@ For example: @end group @end example + Since @code{format} interprets @samp{%} characters as format +specifications, you should @emph{never} pass an arbitrary string as +the first argument. This is particularly true when the string is +generated by some Lisp code. Unless the string is @emph{known} to +never include any @samp{%} characters, pass @code{"%s"}, described +below, as the first argument, and the string as the second, like this: + +@example + (format "%s" @var{arbitrary-string}) +@end example + If @var{string} contains more than one format specification, the format specifications correspond to successive values from @var{objects}. Thus, the first format specification in @var{string} From df70725f7a2437a7c1edc39b4119a30016c84690 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Aug 2006 11:36:02 +0000 Subject: [PATCH 104/361] (w32_createwindow): Handle -geometry command line option and the geometry settings in the Registry. --- src/w32fns.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/w32fns.c b/src/w32fns.c index a3df8de5338..4c933f0631e 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -2066,7 +2066,8 @@ w32_createwindow (f) { HWND hwnd; RECT rect; - Lisp_Object top, left; + Lisp_Object top = Qunbound; + Lisp_Object left = Qunbound; rect.left = rect.top = 0; rect.right = FRAME_PIXEL_WIDTH (f); @@ -2079,13 +2080,41 @@ w32_createwindow (f) if (!hprevinst) { + Lisp_Object ifa; + w32_init_class (hinst); + + /* Handle the -geometry command line option and the geometry + settings in the registry. They are decoded and put into + initial-frame-alist by w32-win.el:x-handle-geometry. */ + ifa = Fsymbol_value (intern ("initial-frame-alist")); + if (CONSP (ifa)) + { + Lisp_Object lt = Fassq (Qleft, ifa); + Lisp_Object tp = Fassq (Qtop, ifa); + + if (!NILP (lt)) + { + lt = XCDR (lt); + if (INTEGERP (lt)) + left = lt; + } + if (!NILP (tp)) + { + tp = XCDR (tp); + if (INTEGERP (tp)) + top = tp; + } + } } - /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero - for anything that is not a number and is not Qunbound. */ - left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER); - top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER); + if (EQ (left, Qunbound) && EQ (top, Qunbound)) + { + /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero + for anything that is not a number and is not Qunbound. */ + left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER); + top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER); + } FRAME_W32_WINDOW (f) = hwnd = CreateWindow (EMACS_CLASS, From 8bdb96bccbcfe8d5c673235b293dcaceef966383 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Aug 2006 11:43:27 +0000 Subject: [PATCH 105/361] (Window Size X) <--geometry>: Only width and height apply to all frames. --- man/cmdargs.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/man/cmdargs.texi b/man/cmdargs.texi index a1b26bcdcb3..fc17d7ec695 100644 --- a/man/cmdargs.texi +++ b/man/cmdargs.texi @@ -1013,7 +1013,9 @@ position of the initial Emacs frame: @cindex geometry, command-line argument Specify the size @var{width} and @var{height} (measured in character columns and lines), and positions @var{xoffset} and @var{yoffset} -(measured in pixels). This applies to all frames. +(measured in pixels). The @var{width} and @var{height} parameters +apply to all frames, whereas @var{xoffset} and @var{yoffset} only to +the initial frame. @item -fs @opindex -fs From 316a275a1e626f7689affcf96f4e98953a6b5c97 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Aug 2006 11:43:45 +0000 Subject: [PATCH 106/361] *** empty log message *** --- man/ChangeLog | 5 +++++ src/ChangeLog | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/man/ChangeLog b/man/ChangeLog index 4723b892276..ba745d0574b 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-08-04 Eli Zaretskii + + * cmdargs.texi (Window Size X) <--geometry>: Only width and height + apply to all frames. + 2006-08-03 Michael Olson * erc.texi: Update for ERC 5.1.4. diff --git a/src/ChangeLog b/src/ChangeLog index faa7db9b206..52847a7fe1f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-04 Ralf Angeli + + * w32fns.c (w32_createwindow): Handle -geometry command line option + and the geometry settings in the Registry. + 2006-08-04 Kenichi Handa * w32fns.c (w32_query_font): Compare names by ignoring case. From 0f2e2a3bbc74a84038de18603e5d734f38fa9db4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 4 Aug 2006 15:22:09 +0000 Subject: [PATCH 107/361] (Fsubst_char_in_region): Redo the setup work after running the before-change-functions since they may have altered the buffer. --- src/ChangeLog | 5 +++++ src/editfns.c | 24 +++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 52847a7fe1f..49c4649d144 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-04 Stefan Monnier + + * editfns.c (Fsubst_char_in_region): Redo the setup work after running + the before-change-functions since they may have altered the buffer. + 2006-08-04 Ralf Angeli * w32fns.c (w32_createwindow): Handle -geometry command line option diff --git a/src/editfns.c b/src/editfns.c index e692204c702..8ac61f3d006 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2691,6 +2691,10 @@ Both characters must have the same length of multi-byte form. */) Lisp_Object start, end, fromchar, tochar, noundo; { register int pos, pos_byte, stop, i, len, end_byte; + /* Keep track of the first change in the buffer: + if 0 we haven't found it yet. + if < 0 we've found it and we've run the before-change-function. + if > 0 we've actually performed it and the value is its position. */ int changed = 0; unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH]; unsigned char *p; @@ -2703,6 +2707,8 @@ Both characters must have the same length of multi-byte form. */) int last_changed = 0; int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); + restart: + validate_region (&start, &end); CHECK_NUMBER (fromchar); CHECK_NUMBER (tochar); @@ -2740,7 +2746,7 @@ Both characters must have the same length of multi-byte form. */) That's faster than getting rid of things, and it prevents even the entry for a first change. Also inhibit locking the file. */ - if (!NILP (noundo)) + if (!changed && !NILP (noundo)) { record_unwind_protect (subst_char_in_region_unwind, current_buffer->undo_list); @@ -2774,10 +2780,14 @@ Both characters must have the same length of multi-byte form. */) && (len == 2 || (p[2] == fromstr[2] && (len == 3 || p[3] == fromstr[3])))))) { - if (! changed) + if (changed < 0) + /* We've already seen this and run the before-change-function; + this time we only need to record the actual position. */ + changed = pos; + else if (!changed) { - changed = pos; - modify_region (current_buffer, changed, XINT (end)); + changed = -1; + modify_region (current_buffer, pos, XINT (end)); if (! NILP (noundo)) { @@ -2786,6 +2796,10 @@ Both characters must have the same length of multi-byte form. */) if (MODIFF - 1 == current_buffer->auto_save_modified) current_buffer->auto_save_modified++; } + + /* The before-change-function may have moved the gap + or even modified the buffer so we should start over. */ + goto restart; } /* Take care of the case where the new character @@ -2838,7 +2852,7 @@ Both characters must have the same length of multi-byte form. */) pos++; } - if (changed) + if (changed > 0) { signal_after_change (changed, last_changed - changed, last_changed - changed); From 04146a367c7226bb47a2c6d0cd210c938a414e68 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 4 Aug 2006 15:44:27 +0000 Subject: [PATCH 108/361] "C-n doesn't work in Customize Option buffer in -nw with long value displayed" fix committed --- admin/FOR-RELEASE | 5 ----- 1 file changed, 5 deletions(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 342914337a3..8d618563d89 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -41,11 +41,6 @@ and then click the button "Erase Customization". This will set mode-line-format to "%-" which does not seem to be useful. -** bojohan's and johnsu01@wjsullivan.net's 18 July bug reports that - "C-n doesn't work in Customize Option buffer in -nw with long value - displayed". Yidong proposed a fix, but needs a field expert to check - it. - ** Markus Gritsch's report about Emacs looping on Windoze with the following .emacs file, and then reduce Emacs frame width to "something quite narrow": (setq-default truncate-lines t) From 3046c3f9246fde1c93c30bce6c011204333de29f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Aug 2006 17:22:18 +0000 Subject: [PATCH 109/361] (w32_query_font): Fix last change: use stricmp. --- src/ChangeLog | 4 ++++ src/w32fns.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 49c4649d144..59be848bf58 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-04 Eli Zaretskii + + * w32fns.c (w32_query_font): Fix last change: use stricmp. + 2006-08-04 Stefan Monnier * editfns.c (Fsubst_char_in_region): Redo the setup work after running diff --git a/src/w32fns.c b/src/w32fns.c index 4c933f0631e..e1cae4f3eb4 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6236,7 +6236,7 @@ w32_query_font (struct frame *f, char *fontname) for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++) { - if (strcasecmp(pfi->name, fontname) == 0) return pfi; + if (stricmp(pfi->name, fontname) == 0) return pfi; } return NULL; From 092869b9735590049a4be576970c95dc4b53af75 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 5 Aug 2006 01:38:21 +0000 Subject: [PATCH 110/361] * keyboard.c (read_char): Rebalance specpdl after receiving jump. --- src/ChangeLog | 6 ++++++ src/keyboard.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 59be848bf58..aa025125067 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2006-08-04 Chong Yidong + + * keyboard.c (read_char): Rebalance specpdl after receiving jump. + + * process.c: Reapply 2006-08-01 change. + 2006-08-04 Eli Zaretskii * w32fns.c (w32_query_font): Fix last change: use stricmp. diff --git a/src/keyboard.c b/src/keyboard.c index 95d880d1209..a4e1c98c013 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2403,7 +2403,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) EMACS_TIME *end_time; { volatile Lisp_Object c; - int count; + int count, jmpcount; jmp_buf local_getcjmp; jmp_buf save_jump; volatile int key_already_recorded = 0; @@ -2629,11 +2629,13 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) around any call to sit_for or kbd_buffer_get_event; it *must not* be in effect when we call redisplay. */ + jmpcount = SPECPDL_INDEX (); if (_setjmp (local_getcjmp)) { /* We must have saved the outer value of getcjmp here, so restore it now. */ restore_getcjmp (save_jump); + unbind_to (jmpcount, Qnil); XSETINT (c, quit_char); internal_last_event_frame = selected_frame; Vlast_event_frame = internal_last_event_frame; From 42ec1561cfb550dc580dd3e163b21289780a2a72 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 5 Aug 2006 01:38:42 +0000 Subject: [PATCH 111/361] * process.c: Reapply 2006-08-01 change. --- src/process.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/process.c b/src/process.c index dc70ef37761..b24dee002c6 100644 --- a/src/process.c +++ b/src/process.c @@ -4158,6 +4158,14 @@ server_accept_connection (server, channel) when not inside wait_reading_process_output. */ static int waiting_for_user_input_p; +static Lisp_Object +wait_reading_process_output_unwind (data) + Lisp_Object data; +{ + waiting_for_user_input_p = XINT (data); + return Qnil; +} + /* This is here so breakpoints can be put on it. */ static void wait_reading_process_output_1 () @@ -4240,11 +4248,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, EMACS_TIME timeout, end_time; int wait_channel = -1; int got_some_input = 0; - /* We can't record_unwind_protect here because after the - set_waiting_for_input call, C-g (interrupt_signal) would run - throw_to_read_char instead of Fsignal, which means unbind_to - doesn't get called. */ - int saved_waiting_for_user_input_p = waiting_for_user_input_p; + int count = SPECPDL_INDEX (); FD_ZERO (&Available); #ifdef NON_BLOCKING_CONNECT @@ -4255,6 +4259,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, if (wait_proc != NULL) wait_channel = XINT (wait_proc->infd); + record_unwind_protect (wait_reading_process_output_unwind, + make_number (waiting_for_user_input_p)); waiting_for_user_input_p = read_kbd; /* Since we may need to wait several times, @@ -4881,7 +4887,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, } /* end for each file descriptor */ } /* end while exit conditions not met */ - waiting_for_user_input_p = saved_waiting_for_user_input_p; + unbind_to (count, Qnil); /* If calling from keyboard input, do not quit since we want to return C-g as an input character. From 1b34e200d955daa147f41f4591743b2dcb544d6d Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 5 Aug 2006 01:39:40 +0000 Subject: [PATCH 112/361] specpdl unbalanced bug fixed. --- admin/FOR-RELEASE | 3 --- 1 file changed, 3 deletions(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 8d618563d89..9eb325a30b9 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -31,9 +31,6 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. * BUGS -** Romain Francoise , Aug 2: - Abort at end of Fbyte_code because specpdl did not balance. - ** lennart.borgman July 27: Custom and mode-line-format default M-x customize-option RET mode-line-format RET From a59dcf2e3f5401dda51c567bdf0572911c61a20a Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 5 Aug 2006 01:40:27 +0000 Subject: [PATCH 113/361] *** empty log message *** --- admin/FOR-RELEASE | 2 -- 1 file changed, 2 deletions(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 9eb325a30b9..698fea62a25 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -46,8 +46,6 @@ mode-line-format to "%-" which does not seem to be useful. '(hscroll-step 1) ) -** David Kastrup's report on strange scrolling of large images. - ** Jorgen Schaefer 's June 18 bug report about fields and invisible overlays needs attention from a field expert. From 1a77c985dd4bca943808130f6a61b43b6a678678 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 5 Aug 2006 04:42:57 +0000 Subject: [PATCH 114/361] (escape-glyph): Doc fix. --- lisp/ChangeLog | 4 ++++ lisp/faces.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 69a67e059bd..9c0dbf645c9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-05 Richard Stallman + + * faces.el (escape-glyph): Doc fix. + 2006-08-04 Kenichi Handa * international/mule-diag.el (describe-font): Improve docstring diff --git a/lisp/faces.el b/lisp/faces.el index 0f0dd41aa69..fe2f5037826 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2008,7 +2008,7 @@ created." ;; red4 is too dark, but some say blue is too loud. ;; brown seems to work ok. -- rms. (t :foreground "brown")) - "Face for characters displayed as ^-sequences or \-sequences." + "Face for characters displayed as sequences using `^' or `\\'." :group 'basic-faces :version "22.1") From a1ebfe34232143515306a0559066944761098f3e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Aug 2006 09:49:01 +0000 Subject: [PATCH 115/361] (Formatting Strings) Resurrect erroneously removed line. --- lispref/strings.texi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lispref/strings.texi b/lispref/strings.texi index 12abc38ee02..17a62b546b4 100644 --- a/lispref/strings.texi +++ b/lispref/strings.texi @@ -700,7 +700,8 @@ in the copy with encodings of the corresponding @var{objects}. The arguments @var{objects} are the computed values to be formatted. The characters in @var{string}, other than the format specifications, -are copied directly into the output; if they have text properties, +are copied directly into the output, including their text properties, +if any. @end defun @cindex @samp{%} in format From 6b657e423e2e10e4d9f7061e76cd3f8f3fcff7b7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Aug 2006 12:00:32 +0000 Subject: [PATCH 116/361] (kbd_buffer_get_event): Return Qnil when current time is exactly equal to end_time, not only when it is past that. --- src/ChangeLog | 5 +++++ src/keyboard.c | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index aa025125067..28109540800 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-05 Eli Zaretskii + + * keyboard.c (kbd_buffer_get_event): Return Qnil when current time + is exactly equal to end_time, not only when it is past that. + 2006-08-04 Chong Yidong * keyboard.c (read_char): Rebalance specpdl after receiving jump. diff --git a/src/keyboard.c b/src/keyboard.c index a4e1c98c013..6f12994a1b8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3954,13 +3954,15 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) { EMACS_TIME duration; EMACS_GET_TIME (duration); - EMACS_SUB_TIME (duration, *end_time, duration); - if (EMACS_TIME_NEG_P (duration)) - return Qnil; + if (EMACS_TIME_GE (duration, *end_time)) + return Qnil; /* finished waiting */ else - wait_reading_process_output (EMACS_SECS (duration), - EMACS_USECS (duration), - -1, 1, Qnil, NULL, 0); + { + EMACS_SUB_TIME (duration, *end_time, duration); + wait_reading_process_output (EMACS_SECS (duration), + EMACS_USECS (duration), + -1, 1, Qnil, NULL, 0); + } } else wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); From 10e81c5e228572be4adf6ea9ad0d16668c8840f8 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sat, 5 Aug 2006 12:33:22 +0000 Subject: [PATCH 117/361] (New in Emacs 22): Expand. --- man/ChangeLog | 4 ++++ man/faq.texi | 58 +++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/man/ChangeLog b/man/ChangeLog index ba745d0574b..1e5a9d23e89 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-08-05 Romain Francoise + + * faq.texi (New in Emacs 22): Expand. + 2006-08-04 Eli Zaretskii * cmdargs.texi (Window Size X) <--geometry>: Only width and height diff --git a/man/faq.texi b/man/faq.texi index 7890c13a4d8..5c3bff470a3 100644 --- a/man/faq.texi +++ b/man/faq.texi @@ -1146,16 +1146,28 @@ and on @code{xterm} with @kbd{emacs -nw}. @cindex Emacs 22, new features in @cindex Recently introduced features -@c FIXME: Improve this node before the 22.1 release. @cindex Default features -Font-lock mode, auto-compression mode, and file name shadow mode are now -enabled by default. It is now possible to follow links with -@kbd{mouse-1}. +Font Lock mode, auto-compression mode, and file name shadow mode are now +enabled by default. On graphics displays it is now possible to follow +links with @kbd{mouse-1}, and the modeline of the selected window is now +highlighted. Window fringes are now customizable. The minibuffer +prompt is now displayed in a distinct face. -@cindex Supported systems -Emacs 22 features support for GNU/Linux systems on S390 and X86-64 -machines, as well as support for the Mac OS X and Cygwin operating -systems. +Emacs now reads abbrev definitions automatically at startup. The +maximum size of buffers has been doubled and is now 256M on 32-bit +machines. Grep mode is now separate from Compilation mode and has many +new specific options and commands. + +The original Emacs macro system has been replaced by the new Kmacro +package, which provides many new commands and features and a simple +interface that uses the function keys F3 and F4. Macros are now stored +in a macro ring, and can be debugged and edited interactively. + +The GUD (Grand Unified Debugger) package can now be used with a full +graphical user interface to the debugger which provides many features +found in traditional development environments, making it easy to +manipulate breakpoints, add watch points, display the call stack, etc. +Breakpoints are now displayed in the source buffer. @cindex GTK+ Toolkit @cindex Drag-and-drop @@ -1164,15 +1176,39 @@ Emacs can now be built with GTK+ widgets, and supports drag-and-drop operation on X. Mouse wheel support is now enabled by default. @cindex New modes -Many new modes and packages have been included in Emacs, such as Leim, -Calc, Tramp and URL, as well as IDO, CUA, rcirc, ERC, conf-mode, -python-mode, table, tumme, SES, ruler, Flymake, Org, PGG, etc. +Many new modes and packages have been included in Emacs, such as Calc, +Tramp and URL, as well as IDO, CUA, rcirc, ERC, conf-mode, python-mode, +table, tumme, SES, ruler, Flymake, Org, PGG, wdired, t-mouse, longlines, +dns-mode, savehist, Password, Printing, Reveal, etc. + +@cindex Multilingual Environment +Leim is now part of Emacs. Unicode support has been much improved, and +the following input methods have been added: belarusian, bulgarian-bds, +bulgarian-phonetic, chinese-sisheng, croatian, dutch, georgian, +latin-alt-postfix, latin-postfix, latin-prefix, latvian-keyboard, +lithuanian-numeric, lithuanian-keyboard, malayalam-inscript, rfc1345, +russian-computer, sgml, slovenian, tamil-inscript ucs, +ukrainian-computer, vietnamese-telex, and welsh. + +The following language environment have also been added: Belarusian, +Bulgarian, Chinese-EUC-TW, Croatian, French, Georgian, Italian, Latin-6, +Latin-7, Latvian, Lithuanian, Malayalam, Russian, Russian, Slovenian, +Swedish, Tajik, Tamil, UTF-8, Ukrainian, Ukrainian, Welsh, and +Windows-1255. + +@cindex Supported systems +Emacs 22 features support for GNU/Linux systems on S390 and x86-64 +machines, as well as support for the Mac OS X and Cygwin operating +systems. @cindex Documentation @cindex Emacs Lisp Manual In addition, Emacs 22 now includes the Emacs Lisp Reference Manual (@pxref{Emacs Lisp documentation}) and the Emacs Lisp Intro. +Many other changes have been made in Emacs 22, use @kbd{C-h n} to get a +full list. + @c ------------------------------------------------------------ @node Common requests, Bugs and problems, Status of Emacs, Top @chapter Common requests From ed91b2add33be7f813979c8c64e5cd92758d75fc Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Aug 2006 13:01:10 +0000 Subject: [PATCH 118/361] (w32_valid_pointer_p): New function. --- src/w32.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/w32.c b/src/w32.c index c093eab599e..0da908ff932 100644 --- a/src/w32.c +++ b/src/w32.c @@ -323,6 +323,28 @@ w32_strerror (int error_no) return buf; } +/* Return 1 if P is a valid pointer to an object of size SIZE. Return + 0 if P is NOT a valid pointer. Return -1 if we cannot validate P. + + This is called from alloc.c:valid_pointer_p. */ +int +w32_valid_pointer_p (void *p, int size) +{ + SIZE_T done; + HANDLE h = OpenProcess (PROCESS_VM_READ, FALSE, GetCurrentProcessId ()); + + if (h) + { + unsigned char *buf = alloca (size); + int retval = ReadProcessMemory (h, p, buf, size, &done); + + CloseHandle (h); + return retval; + } + else + return -1; +} + static char startup_dir[MAXPATHLEN]; /* Get the current working directory. */ From 0c5c0e3dfe9396982d70d155430ec441867b3629 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Aug 2006 13:01:25 +0000 Subject: [PATCH 119/361] Add prototype for w32_valid_pointer_p. --- src/w32.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/w32.h b/src/w32.h index 1d5dbee6d40..6ba25a42403 100644 --- a/src/w32.h +++ b/src/w32.h @@ -110,6 +110,9 @@ extern void delete_child (child_process *cp); /* Equivalent of strerror for W32 error codes. */ extern char * w32_strerror (int error_no); +/* Validate a pointer. */ +extern int w32_valid_pointer_p (void *, int); + /* Get long (aka "true") form of file name, if it exists. */ extern BOOL w32_get_long_filename (char * name, char * buf, int size); From f892cf9c9d14e5920ad5c8ce236bd660f18c0816 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Aug 2006 13:01:50 +0000 Subject: [PATCH 120/361] Include w32.h. (valid_lisp_object_p) [WINDOWSNT]: Call w32_valid_pointer_p to do the job. --- src/alloc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/alloc.c b/src/alloc.c index e5735e03fd9..eb7acfd649f 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -80,6 +80,7 @@ extern POINTER_TYPE *sbrk (); #ifdef WINDOWSNT #include +#include "w32.h" #endif #ifdef DOUG_LEA_MALLOC @@ -4615,6 +4616,9 @@ int valid_pointer_p (p) void *p; { +#ifdef WINDOWSNT + return w32_valid_pointer_p (p, 16); +#else int fd; /* Obviously, we cannot just access it (we would SEGV trying), so we @@ -4631,6 +4635,7 @@ valid_pointer_p (p) } return -1; +#endif } /* Return 1 if OBJ is a valid lisp object. From b653cee476923bfab4fcaa808aa8b870051de70f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Aug 2006 13:30:17 +0000 Subject: [PATCH 121/361] (list-buffers-noselect): For Info buffers, use "(file)node" instead of the file name. --- lisp/buff-menu.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index e9e7e9a2bb8..398b362d4e4 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -117,6 +117,7 @@ file buffers. It affects both manual reverting and reverting by Auto Revert Mode.") (defvar Info-current-file) ;; from info.el +(defvar Info-current-node) ;; from info.el (make-variable-buffer-local 'Buffer-menu-files-only) @@ -786,7 +787,12 @@ For more information, see the function `buffer-menu'." ((eq file 'toc) (setq file "*Info TOC*")) ((not (stringp file)) ;; avoid errors - (setq file nil)))))) + (setq file nil)) + (t + (setq file (concat "(" + (file-name-nondirectory file) + ")" + Info-current-node))))))) (push (list buffer bits name (buffer-size) mode file) list)))))) ;; Preserve the original buffer-list ordering, just in case. From 0a3297f7bbfced678d4cd242d5c5eeb59fa57878 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Aug 2006 13:31:11 +0000 Subject: [PATCH 122/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ src/ChangeLog | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9c0dbf645c9..719ce5d4cac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-05 Eli Zaretskii + + * buff-menu.el (list-buffers-noselect): For Info buffers, use + "(file)node" instead of the file name. + 2006-08-05 Richard Stallman * faces.el (escape-glyph): Doc fix. diff --git a/src/ChangeLog b/src/ChangeLog index 28109540800..80d99505c44 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2006-08-05 Eli Zaretskii + * w32.c (w32_valid_pointer_p): New function. + + * w32.h: Add prototype for w32_valid_pointer_p. + + * alloc.c: Include w32.h. + (valid_lisp_object_p) [WINDOWSNT]: Call w32_valid_pointer_p to do + the job. + * keyboard.c (kbd_buffer_get_event): Return Qnil when current time is exactly equal to end_time, not only when it is past that. From 044c2978976821d4d799ac55ed7c7bdf23bacd22 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 6 Aug 2006 00:32:33 +0000 Subject: [PATCH 123/361] * bindings.el: Give mode-line-format, mode-line-modes, and mode-line-position `standard-value' properties. --- lisp/ChangeLog | 5 +++ lisp/bindings.el | 98 ++++++++++++++++++++++++++---------------------- 2 files changed, 59 insertions(+), 44 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 719ce5d4cac..09c891c29c2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-05 Chong Yidong + + * bindings.el: Give mode-line-format, mode-line-modes, and + mode-line-position `standard-value' properties. + 2006-08-05 Eli Zaretskii * buff-menu.el (list-buffers-noselect): For Info buffers, use diff --git a/lisp/bindings.el b/lisp/bindings.el index 699a05203af..65ff8b0f916 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -280,52 +280,62 @@ Keymap to display on minor modes.") ;; mouse-1: select window, mouse-2: delete others, mouse-3: delete, ;; drag-mouse-1: resize, C-mouse-2: split horizontally" "mouse-1: select (drag to resize), mouse-2: delete others, mouse-3: delete this") - (dashes (propertize "--" 'help-echo help-echo))) - (setq-default mode-line-format - (list - "%e" - (propertize "-" 'help-echo help-echo) - 'mode-line-mule-info - 'mode-line-modified - 'mode-line-frame-identification - 'mode-line-buffer-identification - (propertize " " 'help-echo help-echo) - 'mode-line-position - '(vc-mode vc-mode) - (propertize " " 'help-echo help-echo) - 'mode-line-modes - `(which-func-mode ("" which-func-format ,dashes)) - `(global-mode-string (,dashes global-mode-string)) - (propertize "-%-" 'help-echo help-echo))) + (dashes (propertize "--" 'help-echo help-echo)) + (standard-mode-line-format + (list + "%e" + (propertize "-" 'help-echo help-echo) + 'mode-line-mule-info + 'mode-line-modified + 'mode-line-frame-identification + 'mode-line-buffer-identification + (propertize " " 'help-echo help-echo) + 'mode-line-position + '(vc-mode vc-mode) + (propertize " " 'help-echo help-echo) + 'mode-line-modes + `(which-func-mode ("" which-func-format ,dashes)) + `(global-mode-string (,dashes global-mode-string)) + (propertize "-%-" 'help-echo help-echo))) + (standard-mode-line-modes + (list + (propertize "%[(" 'help-echo help-echo) + `(:propertize ("" mode-name) + help-echo "mouse-1: major mode, mouse-2: major mode help, mouse-3: toggle minor modes" + mouse-face mode-line-highlight + local-map ,mode-line-major-mode-keymap) + '("" mode-line-process) + `(:propertize ("" minor-mode-alist) + mouse-face mode-line-highlight + help-echo "mouse-2: minor mode help, mouse-3: toggle minor modes" + local-map ,mode-line-minor-mode-keymap) + (propertize "%n" 'help-echo "mouse-2: widen" + 'mouse-face 'mode-line-highlight + 'local-map (make-mode-line-mouse-map + 'mouse-2 #'mode-line-widen)) + (propertize ")%]--" 'help-echo help-echo))) + (standard-mode-line-position + `((-3 ,(propertize "%p" 'help-echo help-echo)) + (size-indication-mode + (8 ,(propertize " of %I" 'help-echo help-echo))) + (line-number-mode + ((column-number-mode + (10 ,(propertize " (%l,%c)" 'help-echo help-echo)) + (6 ,(propertize " L%l" 'help-echo help-echo)))) + ((column-number-mode + (5 ,(propertize " C%c" 'help-echo help-echo)))))))) - (setq-default mode-line-modes - (list - (propertize "%[(" 'help-echo help-echo) - `(:propertize ("" mode-name) - help-echo "mouse-1: major mode, mouse-2: major mode help, mouse-3: toggle minor modes" - mouse-face mode-line-highlight - local-map ,mode-line-major-mode-keymap) - '("" mode-line-process) - `(:propertize ("" minor-mode-alist) - mouse-face mode-line-highlight - help-echo "mouse-2: minor mode help, mouse-3: toggle minor modes" - local-map ,mode-line-minor-mode-keymap) - (propertize "%n" 'help-echo "mouse-2: widen" - 'mouse-face 'mode-line-highlight - 'local-map (make-mode-line-mouse-map - 'mouse-2 #'mode-line-widen)) - (propertize ")%]--" 'help-echo help-echo))) + (setq-default mode-line-format standard-mode-line-format) + (put 'mode-line-format 'standard-value + (list `(quote ,standard-mode-line-format))) - (setq-default mode-line-position - `((-3 ,(propertize "%p" 'help-echo help-echo)) - (size-indication-mode - (8 ,(propertize " of %I" 'help-echo help-echo))) - (line-number-mode - ((column-number-mode - (10 ,(propertize " (%l,%c)" 'help-echo help-echo)) - (6 ,(propertize " L%l" 'help-echo help-echo)))) - ((column-number-mode - (5 ,(propertize " C%c" 'help-echo help-echo)))))))) + (setq-default mode-line-modes standard-mode-line-modes) + (put 'mode-line-modes 'standard-value + (list `(quote ,standard-mode-line-modes))) + + (setq-default mode-line-position standard-mode-line-position) + (put 'mode-line-position 'standard-value + (list `(quote ,standard-mode-line-position)))) (defvar mode-line-buffer-identification-keymap nil "\ Keymap for what is displayed by `mode-line-buffer-identification'.") From 27bd6273775ea3d6801cd835da778db11336c6dd Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Sun, 6 Aug 2006 00:39:02 +0000 Subject: [PATCH 124/361] *** empty log message *** --- etc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index ae887b33da9..d5b56ded436 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2006-08-06 Nick Roberts + + * DEBUG (Note): Add note about ollowing a longjmp call. + 2006-08-03 Michael Olson * ERC-NEWS: Update for ERC 5.1.4. From 6205d23a8ce4ff231f42dc642d43e6cc9ff942d2 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Sun, 6 Aug 2006 00:39:50 +0000 Subject: [PATCH 125/361] (Note): Add note about ollowing a longjmp call. --- etc/DEBUG | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/etc/DEBUG b/etc/DEBUG index 63327b3ce5c..1eb5d5ca9f4 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -272,6 +272,13 @@ related data structures in a terse and user-friendly format: The above commands also exist in a version with an `x' suffix which takes an object of the relevant type as argument. +** Following longjmp call. + +Recent versions of glibc (2.4+?) encrypt stored values for setjmp/longjmp which +prevents GDB from being able to follow a longjmp call using `next'. To +disable this protection you need to set the environment variable +LD_POINTER_GUARD to 0. + ** Using GDB in Emacs Debugging with GDB in Emacs offers some advantages over the command line (See From bf69439f99cf722d8a76920a423c22686cbb0cf0 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Sun, 6 Aug 2006 00:45:53 +0000 Subject: [PATCH 126/361] *** empty log message *** --- etc/ChangeLog | 1 + etc/DEBUG | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index d5b56ded436..1befad29a34 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,6 +1,7 @@ 2006-08-06 Nick Roberts * DEBUG (Note): Add note about ollowing a longjmp call. + Add local variables list for outline mode. 2006-08-03 Michael Olson diff --git a/etc/DEBUG b/etc/DEBUG index 1eb5d5ca9f4..bc81d1d5dc2 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -746,4 +746,10 @@ look at the disassembly to determine which registers are being used, and look at those registers directly, to see the actual current values of these variables. + +Local variables: +mode: outline +paragraph-separate: "[ ]*$" +end: + ;;; arch-tag: fbf32980-e35d-481f-8e4c-a2eca2586e6b From 7172336736efd9dcf4439f784703d2138f077684 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 6 Aug 2006 04:31:58 +0000 Subject: [PATCH 127/361] (describe-mode): Make minor mode list more concise. --- lisp/ChangeLog | 4 ++++ lisp/help.el | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 09c891c29c2..3f94298abca 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-06 Richard Stallman + + * help.el (describe-mode): Make minor mode list more concise. + 2006-08-05 Chong Yidong * bindings.el: Give mode-line-format, mode-line-modes, and diff --git a/lisp/help.el b/lisp/help.el index 4d92f69cebd..af79bbcf57c 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -822,16 +822,13 @@ whose documentation describes the minor mode." (sort minor-modes (lambda (a b) (string-lessp (cadr a) (cadr b))))) (when minor-modes - (princ "Summary of minor modes:\n") + (princ "Enabled minor modes:\n") (make-local-variable 'help-button-cache) (with-current-buffer standard-output (dolist (mode minor-modes) (let ((mode-function (nth 0 mode)) (pretty-minor-mode (nth 1 mode)) (indicator (nth 2 mode))) - (setq indicator (if (zerop (length indicator)) - "no indicator" - (format "indicator%s" indicator))) (add-text-properties 0 (length pretty-minor-mode) '(face bold) pretty-minor-mode) (save-excursion @@ -840,16 +837,22 @@ whose documentation describes the minor mode." (push (point-marker) help-button-cache) ;; Document the minor modes fully. (insert pretty-minor-mode) - (princ (format " minor mode (%s):\n" indicator)) + (princ (format " minor mode (%s):\n" + (if (zerop (length indicator)) + "no indicator" + (format "indicator%s" + indicator)))) (princ (documentation mode-function))) - (princ " ") (insert-button pretty-minor-mode 'action (car help-button-cache) 'follow-link t 'help-echo "mouse-2, RET: show full information") - (princ (format " minor mode (%s):\n" indicator))))) - (princ "\n(Full information about these minor modes -follows the description of the major mode.)\n\n")) + (newline))) + (forward-line -1) + (fill-paragraph nil) + (forward-line 1)) + + (princ "\n(Information about these minor modes follows the major mode info.)\n\n")) ;; Document the major mode. (let ((mode mode-name)) (with-current-buffer standard-output From 9c6598c2494fce2fff84836a0fef6ff60e87c75a Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sun, 6 Aug 2006 08:23:29 +0000 Subject: [PATCH 128/361] *** empty log message *** --- etc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 1befad29a34..bc2d5cd0600 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,6 +1,6 @@ 2006-08-06 Nick Roberts - * DEBUG (Note): Add note about ollowing a longjmp call. + * DEBUG (Note): Add note about following a longjmp call. Add local variables list for outline mode. 2006-08-03 Michael Olson From 4c88aa80fe64722ea85826821838c52417c162da Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sun, 6 Aug 2006 11:56:03 +0000 Subject: [PATCH 129/361] Fix typo reported by Peter Dyballa . --- etc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index bc2d5cd0600..f144dd17954 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -191,7 +191,7 @@ 2006-05-29 Jan Dj,Ad(Brv - * NEWS: Mention F10 for Gtk+/Leddtif/Lucid menus. + * NEWS: Mention F10 for Gtk+/Lesstif/Lucid menus. 2006-05-26 Eli Zaretskii From 43ed3b8da0c563a5fec8708cada2ee39411062ec Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 6 Aug 2006 14:22:24 +0000 Subject: [PATCH 130/361] * buffer.c (Vchange_major_mode_hook, Qchange_major_mode_hook): New vars. (Fkill_all_local_variables): Use it. (syms_of_buffer): Defvar it. --- src/ChangeLog | 6 ++++++ src/buffer.c | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 80d99505c44..2e0563e44a7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2006-08-06 Chong Yidong + + * buffer.c (Vchange_major_mode_hook, Qchange_major_mode_hook): New vars. + (Fkill_all_local_variables): Use it. + (syms_of_buffer): Defvar it. + 2006-08-05 Eli Zaretskii * w32.c (w32_valid_pointer_p): New function. diff --git a/src/buffer.c b/src/buffer.c index fcb842de83c..3502afc9bf0 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -146,6 +146,9 @@ Lisp_Object Vinhibit_read_only; Lisp_Object Vkill_buffer_query_functions; Lisp_Object Qkill_buffer_query_functions; +/* Hook run before changing a major mode. */ +Lisp_Object Vchange_major_mode_hook, Qchange_major_mode_hook; + /* List of functions to call before changing an unmodified buffer. */ Lisp_Object Vfirst_change_hook; @@ -2386,7 +2389,7 @@ the normal hook `change-major-mode-hook'. */) Lisp_Object oalist; if (!NILP (Vrun_hooks)) - call1 (Vrun_hooks, intern ("change-major-mode-hook")); + call1 (Vrun_hooks, Qchange_major_mode_hook); oalist = current_buffer->local_var_alist; /* Make sure none of the bindings in oalist @@ -5998,6 +6001,13 @@ t means to use hollow box cursor. See `cursor-type' for other values. */); doc: /* List of functions called with no args to query before killing a buffer. */); Vkill_buffer_query_functions = Qnil; + DEFVAR_LISP ("change-major-mode-hook", &Vchange_major_mode_hook, + doc: /* Normal hook run before changing the major mode of a buffer. +The function `kill-all-local-variables' runs this before doing anything else. */); + Vchange_major_mode_hook = Qnil; + Qchange_major_mode_hook = intern ("change-major-mode-hook"); + staticpro (&Qchange_major_mode_hook); + defsubr (&Sbuffer_live_p); defsubr (&Sbuffer_list); defsubr (&Sget_buffer); From 2f057fa7c1f20a1206b234cbfd30be5ce5917468 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 6 Aug 2006 14:23:55 +0000 Subject: [PATCH 131/361] "standard-value for mode-line-format" bug fixed. --- admin/FOR-RELEASE | 7 ------- 1 file changed, 7 deletions(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 698fea62a25..2cae3a71b1b 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -31,13 +31,6 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. * BUGS -** lennart.borgman July 27: Custom and mode-line-format default - M-x customize-option RET mode-line-format RET - -and then click the button "Erase Customization". This will set -mode-line-format to "%-" which does not seem to be useful. - - ** Markus Gritsch's report about Emacs looping on Windoze with the following .emacs file, and then reduce Emacs frame width to "something quite narrow": (setq-default truncate-lines t) From b5bc193f309eadf04e02e5b1c9596fb07a456baf Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 7 Aug 2006 07:43:25 +0000 Subject: [PATCH 132/361] Update from erc--emacs--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-386 Creator: Michael Olson --- lisp/erc/ChangeLog | 17 +++++++++++++++++ lisp/erc/erc-log.el | 22 +++++++++++++++------- lisp/erc/erc.el | 18 +++++++++--------- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index 0129bd43976..cd5b825b71e 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,20 @@ +2006-08-06 Michael Olson + + * erc.el (erc-arrange-session-in-multiple-windows): Fix bug with + multi-tty Emacs. + +2006-08-05 Michael Olson + + * erc-log.el (erc-log-standardize-name): New function that returns + a filename that is safe for use for a log file. + (erc-current-logfile): Use it. + + * erc.el (erc-startup-file-list): Search in ~/.emacs.d first, + since that is a fairly standard directory. + (erc-select-startup-file): Re-write to use + convert-standard-filename, which will ensure that MS-DOS systems + look for the _ercrc.el file. + 2006-08-02 Michael Olson * erc.el (erc-version-string): Release ERC 5.1.4. diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el index 418e45060bd..2fe29e82fe5 100644 --- a/lisp/erc/erc-log.el +++ b/lisp/erc/erc-log.el @@ -71,8 +71,6 @@ ;; markers. ;;; TODO: -;; * Erc needs a generalised make-safe-file-name function, so that -;; generated file names don't contain any invalid file characters. ;; ;; * Really, we need to lock the logfiles somehow, so that if a user ;; is running multiple emacsen and/or on the same channel as more @@ -293,17 +291,27 @@ is writeable (it will be created as necessary) and (funcall erc-enable-logging (or buffer (current-buffer))) erc-enable-logging))) +(defun erc-log-standardize-name (filename) + "Make FILENAME safe to use as the name of an ERC log. +This will not work with full paths, only names. + +Any unsafe characters in the name are replaced with \"!\". The +filename is downcased." + (downcase (erc-replace-regexp-in-string + "[/\\]" "!" (convert-standard-filename filename)))) + (defun erc-current-logfile (&optional buffer) "Return the logfile to use for BUFFER. If BUFFER is nil, the value of `current-buffer' is used. This is determined by `erc-generate-log-file-name-function'. The result is converted to lowercase, as IRC is case-insensitive" (expand-file-name - (downcase (funcall erc-generate-log-file-name-function - (or buffer (current-buffer)) - (or (erc-default-target) (buffer-name buffer)) - (erc-current-nick) - erc-session-server erc-session-port)) + (erc-log-standardize-name + (funcall erc-generate-log-file-name-function + (or buffer (current-buffer)) + (or (erc-default-target) (buffer-name buffer)) + (erc-current-nick) + erc-session-server erc-session-port)) erc-log-channels-directory)) (defun erc-generate-log-file-name-with-date (buffer &rest ignore) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 4317b831d56..bd31ee3d3b7 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -822,7 +822,8 @@ See `erc-server-flood-margin' for other flood-related parameters.") ;; Script parameters (defcustom erc-startup-file-list - '("~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc") + '("~/.emacs.d/.ercrc.el" "~/.emacs.d/.ercrc" + "~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc") "List of files to try for a startup script. The first existent and readable one will get executed. @@ -5241,13 +5242,11 @@ If FILE is found, return the path to it." (defun erc-select-startup-file () "Select an ERC startup file. See also `erc-startup-file-list'." - (let ((l erc-startup-file-list) - (f nil)) - (while (and (not f) l) - (if (file-readable-p (car l)) - (setq f (car l))) - (setq l (cdr l))) - f)) + (catch 'found + (dolist (f erc-startup-file-list) + (setq f (convert-standard-file-name f)) + (when (file-readable-p f) + (throw 'found f))))) (defun erc-find-script-file (file) "Search for FILE in `default-directory', and any in `erc-script-path'." @@ -5894,7 +5893,8 @@ All windows are opened in the current frame." (setq bufs (cdr bufs)) (while bufs (split-window) - (switch-to-buffer-other-window (car bufs)) + (other-window 1) + (switch-to-buffer (car bufs)) (setq bufs (cdr bufs)) (balance-windows))))) From 26cced449af1c57c8a674aaafdbc6d57ef28cf57 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 7 Aug 2006 07:43:37 +0000 Subject: [PATCH 133/361] Fix ERC bug introduced in last patch Revision: emacs@sv.gnu.org/emacs--devo--0--patch-387 Creator: Michael Olson --- lisp/erc/ChangeLog | 1 + lisp/erc/erc.el | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index cd5b825b71e..b495eda20f1 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -2,6 +2,7 @@ * erc.el (erc-arrange-session-in-multiple-windows): Fix bug with multi-tty Emacs. + (erc-select-startup-file): Fix bug introduced by recent change. 2006-08-05 Michael Olson diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index bd31ee3d3b7..726d02ed613 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -5244,7 +5244,7 @@ If FILE is found, return the path to it." See also `erc-startup-file-list'." (catch 'found (dolist (f erc-startup-file-list) - (setq f (convert-standard-file-name f)) + (setq f (convert-standard-filename f)) (when (file-readable-p f) (throw 'found f))))) From f2c056984949eb4f9be66ad05a9ad865752ffa06 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 7 Aug 2006 07:43:48 +0000 Subject: [PATCH 134/361] Update from erc--emacs--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-388 Creator: Michael Olson --- lisp/erc/ChangeLog | 15 +++++++++++++++ lisp/erc/erc-backend.el | 15 ++++----------- lisp/erc/erc.el | 21 ++++++++++++++------- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index b495eda20f1..522e4623d63 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,18 @@ +2006-08-07 Michael Olson + + * erc-backend.el (erc-process-sentinel-1): Use erc-display-message + in several places instead of inserting text. + (erc-process-sentinel): Move to the input-marker before removing + the prompt. + + * erc.el (erc-port): Fix customization options. + (erc-display-message): Handle null type explicitly. Previously, + this was relying on a chance side-effect. Cosmetic indentation + tweak. + (english): Add 'finished and 'terminated entries to the catalog. + Add initial and terminal newlines to 'disconnected and + 'disconnected-noreconnect entries. Avoid long lines. + 2006-08-06 Michael Olson * erc.el (erc-arrange-session-in-multiple-windows): Fix bug with diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 705ca7a9e63..5acbcb05ab8 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -493,11 +493,7 @@ action." (if erc-server-quitting ;; normal quit (progn - (let ((string "\n\n*** ERC finished ***\n") - (inhibit-read-only t)) - (erc-put-text-property 0 (length string) - 'face 'erc-error-face string) - (insert string)) + (erc-display-message nil 'error (current-buffer) 'finished) (when erc-kill-server-buffer-on-quit (set-buffer-modified-p nil) (kill-buffer (current-buffer)))) @@ -519,12 +515,8 @@ action." (erc erc-session-server erc-session-port erc-server-current-nick erc-session-user-full-name t erc-session-password) ;; terminate, do not reconnect - (let ((string (concat "\n\n*** ERC terminated: " event - "\n")) - (inhibit-read-only t)) - (erc-put-text-property 0 (length string) - 'face 'erc-error-face string) - (insert string))))) + (erc-display-message nil 'error (current-buffer) + 'terminated ?e event)))) (defun erc-process-sentinel (cproc event) "Sentinel function for ERC process." @@ -545,6 +537,7 @@ action." (run-hook-with-args 'erc-disconnected-hook (erc-current-nick) (system-name) "") ;; Remove the prompt + (goto-char (or (marker-position erc-input-marker) (point-max))) (forward-line 0) (erc-remove-text-properties-region (point) (point-max)) (delete-region (point) (point-max)) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 726d02ed613..41d59576251 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -157,8 +157,8 @@ parameters and authentication." This can be either a string or a number." :group 'erc :type '(choice (const :tag "None" nil) - (const :tag "Port number" number) - (const :tag "Port string" string))) + (integer :tag "Port number") + (string :tag "Port string"))) (defcustom erc-nick nil "Nickname to use if one is not provided. @@ -2363,6 +2363,8 @@ See also `erc-format-message' and `erc-display-line'." msg))) (setq string (cond + ((null type) + string) ((listp type) (mapc (lambda (type) (setq string @@ -2375,7 +2377,7 @@ See also `erc-format-message' and `erc-display-line'." (if (not (erc-response-p parsed)) (erc-display-line string buffer) (unless (member (erc-response.command parsed) erc-hide-list) - (erc-put-text-property 0 (length string) 'erc-parsed parsed string) + (erc-put-text-property 0 (length string) 'erc-parsed parsed string) (erc-put-text-property 0 (length string) 'rear-sticky t string) (erc-display-line string buffer))))) @@ -5946,12 +5948,17 @@ All windows are opened in the current frame." (ctcp-request-to . "==> CTCP request from %n (%u@%h) to %t: %r") (ctcp-too-many . "Too many CTCP queries in single message. Ignoring") (flood-ctcp-off . "FLOOD PROTECTION: Automatic CTCP responses turned off.") - (flood-strict-mode . "FLOOD PROTECTION: Switched to Strict Flood Control mode.") - (disconnected . "Connection failed! Re-establishing connection...") - (disconnected-noreconnect . "Connection failed! Not re-establishing connection.") + (flood-strict-mode + . "FLOOD PROTECTION: Switched to Strict Flood Control mode.") + (disconnected . "\n\nConnection failed! Re-establishing connection...\n") + (disconnected-noreconnect + . "\n\nConnection failed! Not re-establishing connection.\n") + (finished . "\n\n*** ERC finished ***\n") + (terminated . "\n\n*** ERC terminated: %e\n") (login . "Logging in as \'%n\'...") (nick-in-use . "%n is in use. Choose new nickname: ") - (nick-too-long . "WARNING: Nick length (%i) exceeds max NICKLEN(%l) defined by server") + (nick-too-long + . "WARNING: Nick length (%i) exceeds max NICKLEN(%l) defined by server") (no-default-channel . "No default channel") (no-invitation . "You've got no invitation") (no-target . "No target") From 34e5974a22ec15f2baa2364b8fea18609fdfb690 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 7 Aug 2006 13:39:53 +0000 Subject: [PATCH 135/361] * modes.texi (Hooks): Clarify. (Major Mode Basics): Mention define-derived-mode explicitly. (Major Mode Conventions): Rebinding RET is OK for some modes. Mention change-major-mode-hook and after-change-major-mode-hook. (Example Major Modes): Moved to end of Modes section. (Mode Line Basics): Clarify. (Mode Line Data): Mention help-echo and local-map in strings. Explain reason for treatment of non-risky variables. (Properties in Mode): Clarify. (Faces for Font Lock): Add font-lock-negation-char-face. --- lispref/ChangeLog | 13 + lispref/modes.texi | 697 +++++++++++++++++++++++---------------------- 2 files changed, 365 insertions(+), 345 deletions(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index eb1fd9797c2..8c963512d2f 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,16 @@ +2006-08-07 Chong Yidong + + * modes.texi (Hooks): Clarify. + (Major Mode Basics): Mention define-derived-mode explicitly. + (Major Mode Conventions): Rebinding RET is OK for some modes. + Mention change-major-mode-hook and after-change-major-mode-hook. + (Example Major Modes): Moved to end of Modes section. + (Mode Line Basics): Clarify. + (Mode Line Data): Mention help-echo and local-map in strings. + Explain reason for treatment of non-risky variables. + (Properties in Mode): Clarify. + (Faces for Font Lock): Add font-lock-negation-char-face. + 2006-08-04 Eli Zaretskii * strings.texi (Formatting Strings): Warn against arbitrary diff --git a/lispref/modes.texi b/lispref/modes.texi index 8b24db35621..e0953c403b2 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi @@ -43,18 +43,19 @@ up in the init file (@pxref{Init File}), but Lisp programs can set them also. @cindex normal hook Most of the hooks in Emacs are @dfn{normal hooks}. These variables -contain lists of functions to be called with no arguments. When the -hook name ends in @samp{-hook}, that tells you it is normal. We try to -make all hooks normal, as much as possible, so that you can use them in -a uniform way. +contain lists of functions to be called with no arguments. By +convention, whenever the hook name ends in @samp{-hook}, that tells +you it is normal. We try to make all hooks normal, as much as +possible, so that you can use them in a uniform way. - Every major mode function is supposed to run a normal hook called the -@dfn{mode hook} as the last step of initialization. This makes it easy -for a user to customize the behavior of the mode, by overriding the -buffer-local variable assignments already made by the mode. Most -minor modes also run a mode hook at their end. But hooks are used in -other contexts too. For example, the hook @code{suspend-hook} runs -just before Emacs suspends itself (@pxref{Suspending Emacs}). + Every major mode function is supposed to run a normal hook called +the @dfn{mode hook} as the one of the last steps of initialization. +This makes it easy for a user to customize the behavior of the mode, +by overriding the buffer-local variable assignments already made by +the mode. Most minor modes also run a mode hook at their end. But +hooks are used in other contexts too. For example, the hook +@code{suspend-hook} runs just before Emacs suspends itself +(@pxref{Suspending Emacs}). The recommended way to add a hook function to a normal hook is by calling @code{add-hook} (see below). The hook functions may be any of @@ -68,14 +69,11 @@ globally or buffer-locally with @code{add-hook}. indicates it is probably an @dfn{abnormal hook}. Then you should look at its documentation to see how to use the hook properly. - If the variable's name ends in @samp{-functions} or @samp{-hooks}, -then the value is a list of functions, but it is abnormal in that either -these functions are called with arguments or their values are used in -some way. You can use @code{add-hook} to add a function to the list, -but you must take care in writing the function. (A few of these -variables, notably those ending in @samp{-hooks}, are actually -normal hooks which were named before we established the convention of -using @samp{-hook} for them.) + @dfn{Abnormal hooks} are hooks in which the functions are called +with arguments, or the return values are used in some way. By +convention, abnormal hook names end in @samp{-functions} or +@samp{-hooks}. You can use @code{add-hook} to add a function to the +list, but you must take care in writing the function. If the variable's name ends in @samp{-function}, then its value is just a single function, not a list of functions. @@ -96,12 +94,13 @@ arguments, and runs each hook in turn. Each argument should be a symbol that is a normal hook variable. These arguments are processed in the order specified. -If a hook variable has a non-@code{nil} value, that value may be a -function or a list of functions. (The former option is considered -obsolete.) If the value is a function (either a lambda expression or -a symbol with a function definition), it is called. If it is a list -that isn't a function, its elements are called, consecutively. All -the hook functions are called with no arguments. +If a hook variable has a non-@code{nil} value, that value should be a +list of functions. Each function in this list is called, +consecutively, with no arguments. + +A hook variable can also be a single function (either a lambda +expression or a symbol with a function definition) to be called. This +use is considered obsolete. @end defun @defun run-hook-with-args hook &rest args @@ -187,7 +186,6 @@ to another major mode in the same buffer. @menu * Major Mode Basics:: * Major Mode Conventions:: Coding conventions for keymaps, etc. -* Example Major Modes:: Text mode and Lisp modes. * Auto Major Mode:: How Emacs chooses the major mode automatically. * Mode Help:: Finding out how to use a mode. * Derived Modes:: Defining a new major mode based on another major @@ -195,6 +193,7 @@ to another major mode in the same buffer. * Generic Modes:: Defining a simple major mode that supports comment syntax and Font Lock mode. * Mode Hooks:: Hooks run at the end of major mode functions. +* Example Major Modes:: Text mode and Lisp modes. @end menu @node Major Mode Basics @@ -214,14 +213,14 @@ specialized editing task, creating a new major mode is usually a good idea. In practice, writing a major mode is easy (in contrast to writing a minor mode, which is often difficult). - If the new mode is similar to an old one, it is often unwise to modify -the old one to serve two purposes, since it may become harder to use and -maintain. Instead, copy and rename an existing major mode definition -and alter the copy---or define a @dfn{derived mode} (@pxref{Derived -Modes}). For example, Rmail Edit mode, which is in -@file{emacs/lisp/mail/rmailedit.el}, is a major mode that is very similar to -Text mode except that it provides two additional commands. Its -definition is distinct from that of Text mode, but uses that of Text mode. + If the new mode is similar to an old one, it is often unwise to +modify the old one to serve two purposes, since it may become harder +to use and maintain. Instead, copy and rename an existing major mode +definition and alter the copy---or use @code{define-derived-mode} to +define a @dfn{derived mode} (@pxref{Derived Modes}). For example, +Rmail Edit mode is a major mode that is very similar to Text mode +except that it provides two additional commands. Its definition is +distinct from that of Text mode, but uses that of Text mode. Even if the new mode is not an obvious derivative of any other mode, it is convenient to use @code{define-derived-mode} with a @code{nil} @@ -287,8 +286,10 @@ Documentation}. @item The major mode command should start by calling -@code{kill-all-local-variables}. This is what gets rid of the -buffer-local variables of the major mode previously in effect. +@code{kill-all-local-variables}. This runs the normal hook +@code{change-major-mode-hook}, then gets rid of the buffer-local +variables of the major mode previously in effect. @xref{Creating +Buffer-Local}. @item The major mode command should set the variable @code{major-mode} to the @@ -355,9 +356,10 @@ Rmail that do not allow self-insertion of text can reasonably redefine letters and other printing characters as special commands. @item -Major modes must not define @key{RET} to do anything other than insert -a newline. The command to insert a newline and then indent is -@kbd{C-j}. Please keep this distinction uniform for all major modes. +Major modes modes for editing text should not define @key{RET} to do +anything other than insert a newline. The command to insert a newline +and then indent is @kbd{C-j}. It is ok for more specialized modes, +such as Info mode, to redefine @key{RET} to something else. @item Major modes should not alter options that are primarily a matter of user @@ -427,10 +429,11 @@ other packages would interfere with them. @item @cindex mode hook @cindex major mode hook -Each major mode should have a @dfn{mode hook} named -@code{@var{modename}-mode-hook}. The major mode command should run that -hook, with @code{run-mode-hooks}, as the very last thing it -does. @xref{Mode Hooks}. +Each major mode should have a normal @dfn{mode hook} named +@code{@var{modename}-mode-hook}. The very last thing the major mode command +should do is to call @code{run-mode-hooks}. This runs the mode hook, +and then runs the normal hook @code{after-change-major-mode-hook}. +@xref{Mode Hooks}. @item The major mode command may start by calling some other major mode @@ -488,281 +491,6 @@ that they may be evaluated more than once without adverse consequences. Even if you never load the file more than once, someone else will. @end itemize -@node Example Major Modes -@subsection Major Mode Examples - - Text mode is perhaps the simplest mode besides Fundamental mode. -Here are excerpts from @file{text-mode.el} that illustrate many of -the conventions listed above: - -@smallexample -@group -;; @r{Create the syntax table for this mode.} -(defvar text-mode-syntax-table - (let ((st (make-syntax-table))) - (modify-syntax-entry ?\" ". " st) - (modify-syntax-entry ?\\ ". " st) - ;; Add `p' so M-c on `hello' leads to `Hello', not `hello'. - (modify-syntax-entry ?' "w p" st) - st) - "Syntax table used while in `text-mode'.") -@end group - -;; @r{Create the keymap for this mode.} -@group -(defvar text-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "\e\t" 'ispell-complete-word) - (define-key map "\es" 'center-line) - (define-key map "\eS" 'center-paragraph) - map) - "Keymap for `text-mode'. -Many other modes, such as Mail mode, Outline mode -and Indented Text mode, inherit all the commands -defined in this map.") -@end group -@end smallexample - - Here is how the actual mode command is defined now: - -@smallexample -@group -(define-derived-mode text-mode nil "Text" - "Major mode for editing text written for humans to read. -In this mode, paragraphs are delimited only by blank or white lines. -You can thus get the full benefit of adaptive filling - (see the variable `adaptive-fill-mode'). -\\@{text-mode-map@} -Turning on Text mode runs the normal hook `text-mode-hook'." -@end group -@group - (make-local-variable 'text-mode-variant) - (setq text-mode-variant t) - ;; @r{These two lines are a feature added recently.} - (set (make-local-variable 'require-final-newline) - mode-require-final-newline) - (set (make-local-variable 'indent-line-function) 'indent-relative)) -@end group -@end smallexample - - But here is how it was defined formerly, before -@code{define-derived-mode} existed: - -@smallexample -@group -;; @r{This isn't needed nowadays, since @code{define-derived-mode} does it.} -(defvar text-mode-abbrev-table nil - "Abbrev table used while in text mode.") -(define-abbrev-table 'text-mode-abbrev-table ()) -@end group - -@group -(defun text-mode () - "Major mode for editing text intended for humans to read... - Special commands: \\@{text-mode-map@} -@end group -@group -Turning on text-mode runs the hook `text-mode-hook'." - (interactive) - (kill-all-local-variables) - (use-local-map text-mode-map) -@end group -@group - (setq local-abbrev-table text-mode-abbrev-table) - (set-syntax-table text-mode-syntax-table) -@end group -@group - ;; @r{These four lines are absent from the current version} - ;; @r{not because this is done some other way, but rather} - ;; @r{because nowadays Text mode uses the normal definition of paragraphs.} - (make-local-variable 'paragraph-start) - (setq paragraph-start (concat "[ \t]*$\\|" page-delimiter)) - (make-local-variable 'paragraph-separate) - (setq paragraph-separate paragraph-start) - (make-local-variable 'indent-line-function) - (setq indent-line-function 'indent-relative-maybe) -@end group -@group - (setq mode-name "Text") - (setq major-mode 'text-mode) - (run-mode-hooks 'text-mode-hook)) ; @r{Finally, this permits the user to} - ; @r{customize the mode with a hook.} -@end group -@end smallexample - -@cindex @file{lisp-mode.el} - The three Lisp modes (Lisp mode, Emacs Lisp mode, and Lisp -Interaction mode) have more features than Text mode and the code is -correspondingly more complicated. Here are excerpts from -@file{lisp-mode.el} that illustrate how these modes are written. - -@cindex syntax table example -@smallexample -@group -;; @r{Create mode-specific table variables.} -(defvar lisp-mode-syntax-table nil "") -(defvar lisp-mode-abbrev-table nil "") -@end group - -@group -(defvar emacs-lisp-mode-syntax-table - (let ((table (make-syntax-table))) - (let ((i 0)) -@end group - -@group - ;; @r{Set syntax of chars up to @samp{0} to say they are} - ;; @r{part of symbol names but not words.} - ;; @r{(The digit @samp{0} is @code{48} in the @acronym{ASCII} character set.)} - (while (< i ?0) - (modify-syntax-entry i "_ " table) - (setq i (1+ i))) - ;; @r{@dots{} similar code follows for other character ranges.} -@end group -@group - ;; @r{Then set the syntax codes for characters that are special in Lisp.} - (modify-syntax-entry ? " " table) - (modify-syntax-entry ?\t " " table) - (modify-syntax-entry ?\f " " table) - (modify-syntax-entry ?\n "> " table) -@end group -@group - ;; @r{Give CR the same syntax as newline, for selective-display.} - (modify-syntax-entry ?\^m "> " table) - (modify-syntax-entry ?\; "< " table) - (modify-syntax-entry ?` "' " table) - (modify-syntax-entry ?' "' " table) - (modify-syntax-entry ?, "' " table) -@end group -@group - ;; @r{@dots{}likewise for many other characters@dots{}} - (modify-syntax-entry ?\( "() " table) - (modify-syntax-entry ?\) ")( " table) - (modify-syntax-entry ?\[ "(] " table) - (modify-syntax-entry ?\] ")[ " table)) - table)) -@end group -@group -;; @r{Create an abbrev table for lisp-mode.} -(define-abbrev-table 'lisp-mode-abbrev-table ()) -@end group -@end smallexample - - Much code is shared among the three Lisp modes. The following -function sets various variables; it is called by each of the major Lisp -mode functions: - -@smallexample -@group -(defun lisp-mode-variables (lisp-syntax) - (when lisp-syntax - (set-syntax-table lisp-mode-syntax-table)) - (setq local-abbrev-table lisp-mode-abbrev-table) - @dots{} -@end group -@end smallexample - - Functions such as @code{forward-paragraph} use the value of the -@code{paragraph-start} variable. Since Lisp code is different from -ordinary text, the @code{paragraph-start} variable needs to be set -specially to handle Lisp. Also, comments are indented in a special -fashion in Lisp and the Lisp modes need their own mode-specific -@code{comment-indent-function}. The code to set these variables is the -rest of @code{lisp-mode-variables}. - -@smallexample -@group - (make-local-variable 'paragraph-start) - (setq paragraph-start (concat page-delimiter "\\|$" )) - (make-local-variable 'paragraph-separate) - (setq paragraph-separate paragraph-start) - @dots{} -@end group -@group - (make-local-variable 'comment-indent-function) - (setq comment-indent-function 'lisp-comment-indent)) - @dots{} -@end group -@end smallexample - - Each of the different Lisp modes has a slightly different keymap. For -example, Lisp mode binds @kbd{C-c C-z} to @code{run-lisp}, but the other -Lisp modes do not. However, all Lisp modes have some commands in -common. The following code sets up the common commands: - -@smallexample -@group -(defvar shared-lisp-mode-map () - "Keymap for commands shared by all sorts of Lisp modes.") - -;; @r{Putting this @code{if} after the @code{defvar} is an older style.} -(if shared-lisp-mode-map - () - (setq shared-lisp-mode-map (make-sparse-keymap)) - (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp) - (define-key shared-lisp-mode-map "\177" - 'backward-delete-char-untabify)) -@end group -@end smallexample - -@noindent -And here is the code to set up the keymap for Lisp mode: - -@smallexample -@group -(defvar lisp-mode-map () - "Keymap for ordinary Lisp mode...") - -(if lisp-mode-map - () - (setq lisp-mode-map (make-sparse-keymap)) - (set-keymap-parent lisp-mode-map shared-lisp-mode-map) - (define-key lisp-mode-map "\e\C-x" 'lisp-eval-defun) - (define-key lisp-mode-map "\C-c\C-z" 'run-lisp)) -@end group -@end smallexample - - Finally, here is the complete major mode function definition for -Lisp mode. - -@smallexample -@group -(defun lisp-mode () - "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp. -Commands: -Delete converts tabs to spaces as it moves back. -Blank lines separate paragraphs. Semicolons start comments. -\\@{lisp-mode-map@} -Note that `run-lisp' may be used either to start an inferior Lisp job -or to switch back to an existing one. -@end group - -@group -Entry to this mode calls the value of `lisp-mode-hook' -if that value is non-nil." - (interactive) - (kill-all-local-variables) -@end group -@group - (use-local-map lisp-mode-map) ; @r{Select the mode's keymap.} - (setq major-mode 'lisp-mode) ; @r{This is how @code{describe-mode}} - ; @r{finds out what to describe.} - (setq mode-name "Lisp") ; @r{This goes into the mode line.} - (lisp-mode-variables t) ; @r{This defines various variables.} - (make-local-variable 'comment-start-skip) - (setq comment-start-skip - "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") - (make-local-variable 'font-lock-keywords-case-fold-search) - (setq font-lock-keywords-case-fold-search t) -@end group -@group - (setq imenu-case-fold-search t) - (set-syntax-table lisp-mode-syntax-table) - (run-mode-hooks 'lisp-mode-hook)) ; @r{This permits the user to use a} - ; @r{hook to customize the mode.} -@end group -@end smallexample - @node Auto Major Mode @subsection How Emacs Chooses a Major Mode @@ -1074,10 +802,9 @@ Do not write an @code{interactive} spec in the definition; @cindex generic mode @dfn{Generic modes} are simple major modes with basic support for -comment syntax and Font Lock mode. They are primarily useful for -configuration files. To define a generic mode, use the macro -@code{define-generic-mode}. See the file @file{generic-x.el} for some -examples of the use of @code{define-generic-mode}. +comment syntax and Font Lock mode. To define a generic mode, use the +macro @code{define-generic-mode}. See the file @file{generic-x.el} +for some examples of the use of @code{define-generic-mode}. @defmac define-generic-mode mode comment-list keyword-list font-lock-list auto-mode-list function-list &optional docstring This macro creates a new generic mode. The argument @var{mode} (an @@ -1171,6 +898,281 @@ as the very last thing it does, and the last thing @code{run-mode-hooks} does is run @code{after-change-major-mode-hook}. @end defvar +@node Example Major Modes +@subsection Major Mode Examples + + Text mode is perhaps the simplest mode besides Fundamental mode. +Here are excerpts from @file{text-mode.el} that illustrate many of +the conventions listed above: + +@smallexample +@group +;; @r{Create the syntax table for this mode.} +(defvar text-mode-syntax-table + (let ((st (make-syntax-table))) + (modify-syntax-entry ?\" ". " st) + (modify-syntax-entry ?\\ ". " st) + ;; Add `p' so M-c on `hello' leads to `Hello', not `hello'. + (modify-syntax-entry ?' "w p" st) + st) + "Syntax table used while in `text-mode'.") +@end group + +;; @r{Create the keymap for this mode.} +@group +(defvar text-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\e\t" 'ispell-complete-word) + (define-key map "\es" 'center-line) + (define-key map "\eS" 'center-paragraph) + map) + "Keymap for `text-mode'. +Many other modes, such as Mail mode, Outline mode +and Indented Text mode, inherit all the commands +defined in this map.") +@end group +@end smallexample + + Here is how the actual mode command is defined now: + +@smallexample +@group +(define-derived-mode text-mode nil "Text" + "Major mode for editing text written for humans to read. +In this mode, paragraphs are delimited only by blank or white lines. +You can thus get the full benefit of adaptive filling + (see the variable `adaptive-fill-mode'). +\\@{text-mode-map@} +Turning on Text mode runs the normal hook `text-mode-hook'." +@end group +@group + (make-local-variable 'text-mode-variant) + (setq text-mode-variant t) + ;; @r{These two lines are a feature added recently.} + (set (make-local-variable 'require-final-newline) + mode-require-final-newline) + (set (make-local-variable 'indent-line-function) 'indent-relative)) +@end group +@end smallexample + + But here is how it was defined formerly, before +@code{define-derived-mode} existed: + +@smallexample +@group +;; @r{This isn't needed nowadays, since @code{define-derived-mode} does it.} +(defvar text-mode-abbrev-table nil + "Abbrev table used while in text mode.") +(define-abbrev-table 'text-mode-abbrev-table ()) +@end group + +@group +(defun text-mode () + "Major mode for editing text intended for humans to read... + Special commands: \\@{text-mode-map@} +@end group +@group +Turning on text-mode runs the hook `text-mode-hook'." + (interactive) + (kill-all-local-variables) + (use-local-map text-mode-map) +@end group +@group + (setq local-abbrev-table text-mode-abbrev-table) + (set-syntax-table text-mode-syntax-table) +@end group +@group + ;; @r{These four lines are absent from the current version} + ;; @r{not because this is done some other way, but rather} + ;; @r{because nowadays Text mode uses the normal definition of paragraphs.} + (make-local-variable 'paragraph-start) + (setq paragraph-start (concat "[ \t]*$\\|" page-delimiter)) + (make-local-variable 'paragraph-separate) + (setq paragraph-separate paragraph-start) + (make-local-variable 'indent-line-function) + (setq indent-line-function 'indent-relative-maybe) +@end group +@group + (setq mode-name "Text") + (setq major-mode 'text-mode) + (run-mode-hooks 'text-mode-hook)) ; @r{Finally, this permits the user to} + ; @r{customize the mode with a hook.} +@end group +@end smallexample + +@cindex @file{lisp-mode.el} + The three Lisp modes (Lisp mode, Emacs Lisp mode, and Lisp +Interaction mode) have more features than Text mode and the code is +correspondingly more complicated. Here are excerpts from +@file{lisp-mode.el} that illustrate how these modes are written. + +@cindex syntax table example +@smallexample +@group +;; @r{Create mode-specific table variables.} +(defvar lisp-mode-syntax-table nil "") +(defvar lisp-mode-abbrev-table nil "") +@end group + +@group +(defvar emacs-lisp-mode-syntax-table + (let ((table (make-syntax-table))) + (let ((i 0)) +@end group + +@group + ;; @r{Set syntax of chars up to @samp{0} to say they are} + ;; @r{part of symbol names but not words.} + ;; @r{(The digit @samp{0} is @code{48} in the @acronym{ASCII} character set.)} + (while (< i ?0) + (modify-syntax-entry i "_ " table) + (setq i (1+ i))) + ;; @r{@dots{} similar code follows for other character ranges.} +@end group +@group + ;; @r{Then set the syntax codes for characters that are special in Lisp.} + (modify-syntax-entry ? " " table) + (modify-syntax-entry ?\t " " table) + (modify-syntax-entry ?\f " " table) + (modify-syntax-entry ?\n "> " table) +@end group +@group + ;; @r{Give CR the same syntax as newline, for selective-display.} + (modify-syntax-entry ?\^m "> " table) + (modify-syntax-entry ?\; "< " table) + (modify-syntax-entry ?` "' " table) + (modify-syntax-entry ?' "' " table) + (modify-syntax-entry ?, "' " table) +@end group +@group + ;; @r{@dots{}likewise for many other characters@dots{}} + (modify-syntax-entry ?\( "() " table) + (modify-syntax-entry ?\) ")( " table) + (modify-syntax-entry ?\[ "(] " table) + (modify-syntax-entry ?\] ")[ " table)) + table)) +@end group +@group +;; @r{Create an abbrev table for lisp-mode.} +(define-abbrev-table 'lisp-mode-abbrev-table ()) +@end group +@end smallexample + + Much code is shared among the three Lisp modes. The following +function sets various variables; it is called by each of the major Lisp +mode functions: + +@smallexample +@group +(defun lisp-mode-variables (lisp-syntax) + (when lisp-syntax + (set-syntax-table lisp-mode-syntax-table)) + (setq local-abbrev-table lisp-mode-abbrev-table) + @dots{} +@end group +@end smallexample + + Functions such as @code{forward-paragraph} use the value of the +@code{paragraph-start} variable. Since Lisp code is different from +ordinary text, the @code{paragraph-start} variable needs to be set +specially to handle Lisp. Also, comments are indented in a special +fashion in Lisp and the Lisp modes need their own mode-specific +@code{comment-indent-function}. The code to set these variables is the +rest of @code{lisp-mode-variables}. + +@smallexample +@group + (make-local-variable 'paragraph-start) + (setq paragraph-start (concat page-delimiter "\\|$" )) + (make-local-variable 'paragraph-separate) + (setq paragraph-separate paragraph-start) + @dots{} +@end group +@group + (make-local-variable 'comment-indent-function) + (setq comment-indent-function 'lisp-comment-indent)) + @dots{} +@end group +@end smallexample + + Each of the different Lisp modes has a slightly different keymap. For +example, Lisp mode binds @kbd{C-c C-z} to @code{run-lisp}, but the other +Lisp modes do not. However, all Lisp modes have some commands in +common. The following code sets up the common commands: + +@smallexample +@group +(defvar shared-lisp-mode-map () + "Keymap for commands shared by all sorts of Lisp modes.") + +;; @r{Putting this @code{if} after the @code{defvar} is an older style.} +(if shared-lisp-mode-map + () + (setq shared-lisp-mode-map (make-sparse-keymap)) + (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp) + (define-key shared-lisp-mode-map "\177" + 'backward-delete-char-untabify)) +@end group +@end smallexample + +@noindent +And here is the code to set up the keymap for Lisp mode: + +@smallexample +@group +(defvar lisp-mode-map () + "Keymap for ordinary Lisp mode...") + +(if lisp-mode-map + () + (setq lisp-mode-map (make-sparse-keymap)) + (set-keymap-parent lisp-mode-map shared-lisp-mode-map) + (define-key lisp-mode-map "\e\C-x" 'lisp-eval-defun) + (define-key lisp-mode-map "\C-c\C-z" 'run-lisp)) +@end group +@end smallexample + + Finally, here is the complete major mode function definition for +Lisp mode. + +@smallexample +@group +(defun lisp-mode () + "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp. +Commands: +Delete converts tabs to spaces as it moves back. +Blank lines separate paragraphs. Semicolons start comments. +\\@{lisp-mode-map@} +Note that `run-lisp' may be used either to start an inferior Lisp job +or to switch back to an existing one. +@end group + +@group +Entry to this mode calls the value of `lisp-mode-hook' +if that value is non-nil." + (interactive) + (kill-all-local-variables) +@end group +@group + (use-local-map lisp-mode-map) ; @r{Select the mode's keymap.} + (setq major-mode 'lisp-mode) ; @r{This is how @code{describe-mode}} + ; @r{finds out what to describe.} + (setq mode-name "Lisp") ; @r{This goes into the mode line.} + (lisp-mode-variables t) ; @r{This defines various variables.} + (make-local-variable 'comment-start-skip) + (setq comment-start-skip + "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") + (make-local-variable 'font-lock-keywords-case-fold-search) + (setq font-lock-keywords-case-fold-search t) +@end group +@group + (setq imenu-case-fold-search t) + (set-syntax-table lisp-mode-syntax-table) + (run-mode-hooks 'lisp-mode-hook)) ; @r{This permits the user to use a} + ; @r{hook to customize the mode.} +@end group +@end smallexample + @node Minor Modes @section Minor Modes @cindex minor mode @@ -1533,16 +1535,14 @@ minor modes. @subsection Mode Line Basics @code{mode-line-format} is a buffer-local variable that holds a -@dfn{mode line construct}, a kind of template, which controls the -display the mode line of the current buffer. All windows for the same -buffer use the same @code{mode-line-format}, so their mode lines -appear the same---except for scrolling percentages, and line and -column numbers, since those depend on point and on how the window is -scrolled. The value of @code{header-line-format} specifies the -buffer's header line in the same way, with a mode line construct. +@dfn{mode line construct}, a kind of template, which controls what is +displayed on the mode line of the current buffer. The value of +@code{header-line-format} specifies the buffer's header line in the +same way. All windows for the same buffer use the same +@code{mode-line-format} and @code{header-line-format}. - For efficiency, Emacs does not recompute the mode line and header -line of a window in every redisplay. It does so when circumstances + For efficiency, Emacs does not continuously recompute the mode +line and header line of a window. It does so when circumstances appear to call for it---for instance, if you change the window configuration, switch buffers, narrow or widen the buffer, scroll, or change the buffer's modification status. If you modify any of the @@ -1552,7 +1552,6 @@ how text is displayed (@pxref{Display}), you may want to force an update of the mode line so as to display the new information or display it in the new way. -@c Emacs 19 feature @defun force-mode-line-update &optional all Force redisplay of the current buffer's mode line and header line. The next redisplay will update the mode line and header line based on @@ -1589,15 +1588,17 @@ defined to have mode-line constructs as their values. @table @code @cindex percent symbol in mode line @item @var{string} -A string as a mode-line construct appears verbatim in the mode line -except for @dfn{@code{%}-constructs} in it. These stand for -substitution of other data; see @ref{%-Constructs}. +A string as a mode-line construct appears verbatim except for +@dfn{@code{%}-constructs} in it. These stand for substitution of +other data; see @ref{%-Constructs}. -If the string has @code{face} properties, they are copied into the -mode line contents too (@pxref{Properties in Mode}). Any characters -in the mode line which have no @code{face} properties are displayed, -by default, in the face @code{mode-line} or @code{mode-line-inactive} -(@pxref{Standard Faces,,, emacs, The GNU Emacs Manual}). +If parts of the string have @code{face} properties, they control +display of the text just as they would text in the buffer. Any +characters which have no @code{face} properties are displayed, by +default, in the face @code{mode-line} or @code{mode-line-inactive} +(@pxref{Standard Faces,,, emacs, The GNU Emacs Manual}). The +@code{help-echo} and @code{local-map} properties in @var{string} have +special meanings. @xref{Properties in Mode}. @item @var{symbol} A symbol as a mode-line construct stands for its value. The value of @@ -1612,7 +1613,9 @@ Unless @var{symbol} is marked as ``risky'' (i.e., it has a non-@code{nil} @code{risky-local-variable} property), all text properties specified in @var{symbol}'s value are ignored. This includes the text properties of strings in @var{symbol}'s value, as -well as all @code{:eval} and @code{:propertize} forms in it. +well as all @code{:eval} and @code{:propertize} forms in it. (The +reason for this is security: non-risky variables could be set +automatically from file variables without prompting the user.) @item (@var{string} @var{rest}@dots{}) @itemx (@var{list} @var{rest}@dots{}) @@ -2055,10 +2058,10 @@ structure, and make @var{form} evaluate to a string that has a text property. @end enumerate - You use the @code{local-map} property to specify a keymap. Like any -keymap, it can bind character keys and function keys; but that has no -effect, since it is impossible to move point into the mode line. This -keymap can only take real effect for mouse clicks. + You can use the @code{local-map} property to specify a keymap. This +keymap only takes real effect for mouse clicks; binding character keys +and function keys to it has no effect, since it is impossible to move +point into the mode line. When the mode line refers to a variable which does not have a non-@code{nil} @code{risky-local-variable} property, any text @@ -2889,6 +2892,10 @@ Used (typically) for constant names. @vindex font-lock-preprocessor-face Used (typically) for preprocessor commands. +@item font-lock-negation-char-face +@vindex font-lock-negation-char-face +Used (typically) for easily-overlooked negation characters. + @item font-lock-warning-face @vindex font-lock-warning-face Used (typically) for constructs that are peculiar, or that greatly From aadb7f6f5a85ec0afc6c46798e59938701df569c Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 7 Aug 2006 13:40:32 +0000 Subject: [PATCH 136/361] Double-checked modes.texi. --- admin/FOR-RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 2cae3a71b1b..27404cbd20c 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -87,7 +87,7 @@ lispref/macros.texi "Luc Teirlinck" Chong Yidong lispref/maps.texi Chong Yidong Kim F. Storm lispref/markers.texi "Luc Teirlinck" Chong Yidong lispref/minibuf.texi "Luc Teirlinck" Chong Yidong -lispref/modes.texi Chong Yidong +lispref/modes.texi Chong Yidong (double-checked) lispref/nonascii.texi "Luc Teirlinck" Chong Yidong lispref/numbers.texi "Luc Teirlinck" Chong Yidong lispref/objects.texi "Luc Teirlinck" Chong Yidong From 614869993024153d5c7167ca78a9013cb0f95fc4 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 7 Aug 2006 16:39:36 +0000 Subject: [PATCH 137/361] (BASE_PURESIZE): Increase to 1120000. --- src/ChangeLog | 4 ++++ src/puresize.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2e0563e44a7..7c0408196aa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-07 Andreas Schwab + + * puresize.h (BASE_PURESIZE): Increase to 1120000. + 2006-08-06 Chong Yidong * buffer.c (Vchange_major_mode_hook, Qchange_major_mode_hook): New vars. diff --git a/src/puresize.h b/src/puresize.h index bae7cbb6d6a..5dd374af207 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -43,7 +43,7 @@ Boston, MA 02110-1301, USA. */ #endif #ifndef BASE_PURESIZE -#define BASE_PURESIZE (1102000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) +#define BASE_PURESIZE (1120000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) #endif /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ From 1402611cf2f7573544c420d79f08b624ec39b970 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 7 Aug 2006 17:42:36 +0000 Subject: [PATCH 138/361] (font-lock-extend-after-change-region-function, font-lock-extend-region-functions, font-lock-extend-jit-lock-region-after-change): Better comments. --- lisp/font-lock.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 0cad924f201..3496560cc71 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -976,7 +976,7 @@ The value of this variable is used when Font Lock mode is turned on." ;; multi-line strings and comments; regexps are not appropriate for the job.) (defvar font-lock-extend-after-change-region-function nil - "A function that determines the region to fontify after a change. + "A function that determines the region to refontify after a change. This variable is either nil, or is a function that determines the region to refontify after a change. @@ -985,7 +985,7 @@ Font-lock calls this function after each buffer change. The function is given three parameters, the standard BEG, END, and OLD-LEN from `after-change-functions'. It should return either a cons of the beginning -and end buffer positions \(in that order) of the region to fontify, or nil +and end buffer positions \(in that order) of the region to refontify, or nil \(which directs the caller to fontify a default region). This function should preserve the match-data. The region it returns may start or end in the middle of a line.") @@ -1044,6 +1044,12 @@ a very meaningful entity to highlight.") (defvar font-lock-beg) (defvar font-lock-end) (defvar font-lock-extend-region-functions '(font-lock-extend-region-wholelines + ;; This use of font-lock-multiline property is unreliable but is just + ;; a handy heuristic: in case you don't have a function that does + ;; /identification/ of multiline elements, you may still occasionally + ;; discover them by accident (or you may /identify/ them but not in all + ;; cases), in which case the font-lock-multiline property can help make + ;; sure you will properly *re*identify them during refontification. font-lock-extend-region-multiline) "Special hook run just before proceeding to fontify a region. This is used to allow major modes to help font-lock find safe buffer positions @@ -1177,6 +1183,12 @@ what properties to clear before refontifying a region.") end (max jit-lock-end (cdr region)))) ;; Then extend the region obeying font-lock-multiline properties, ;; indicating which part of the buffer needs to be refontified. + ;; !!! This is the *main* user of font-lock-multiline property !!! + ;; font-lock-after-change-function could/should also do that, but it + ;; doesn't need to because font-lock-default-fontify-region does + ;; it anyway. Here OTOH we have no guarantee that + ;; font-lock-default-fontify-region will be executed on this region + ;; any time soon. (when (and (> beg (point-min)) (get-text-property (1- beg) 'font-lock-multiline)) (setq beg (or (previous-single-property-change From 65c986aa9470183c3a546b21dbd1d14eae109626 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 7 Aug 2006 17:47:55 +0000 Subject: [PATCH 139/361] (font-lock-extend-jit-lock-region-after-change): Add docstring. --- lisp/font-lock.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 3496560cc71..ab80316ae6a 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1173,6 +1173,13 @@ what properties to clear before refontifying a region.") (defvar jit-lock-start) (defvar jit-lock-end) (defun font-lock-extend-jit-lock-region-after-change (beg end old-len) + "Function meant for `jit-lock-after-change-extend-region-functions'. +This function does 2 things: +- extend the region so that it not only includes the part that was modified + but also the surrounding text whose highlighting may change as a consequence. +- anticipate (part of) the region extension that will happen later in + `font-lock-default-fontify-region', in order to avoid the need for + double-redisplay in `jit-lock-fontify-now'." (save-excursion ;; First extend the region as font-lock-after-change-function would. (let ((region (if font-lock-extend-after-change-region-function @@ -1198,8 +1205,11 @@ what properties to clear before refontifying a region.") 'font-lock-multiline nil) (point-max))) ;; Finally, pre-enlarge the region to a whole number of lines, to try - ;; and predict what font-lock-default-fontify-region will do, so as to + ;; and anticipate what font-lock-default-fontify-region will do, so as to ;; avoid double-redisplay. + ;; We could just run `font-lock-extend-region-functions', but since + ;; the only purpose is to avoid the double-redisplay, we prefer to + ;; do here only the part that is cheap and most likely to be useful. (when (memq 'font-lock-extend-region-wholelines font-lock-extend-region-functions) (goto-char beg) From 4a63ceb8901f019161baa9f481b1b12f4134fea4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 7 Aug 2006 18:06:28 +0000 Subject: [PATCH 140/361] (PC-do-completion): Strip out completion-ignored-extensions before checking whether there are multiple completions. Don't use `list' unnecessarily when building completion tables. --- lisp/ChangeLog | 10 +++++-- lisp/complete.el | 73 +++++++++++++++++++++++------------------------- 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3f94298abca..ff97d539496 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-07 Stefan Monnier + + * complete.el (PC-do-completion): Strip out completion-ignored-extensions + before checking whether there are multiple completions. + Don't use `list' unnecessarily when building completion tables. + 2006-08-06 Richard Stallman * help.el (describe-mode): Make minor mode list more concise. @@ -672,8 +678,8 @@ 2006-07-10 Chong Yidong - * progmodes/cc-awk.el (defconst): Use eval-and-compile to avoid - compilation error. + * progmodes/cc-awk.el (c-awk-escaped-nls*): Use eval-and-compile to + avoid compilation error. * subr.el (sit-for): New function. diff --git a/lisp/complete.el b/lisp/complete.el index c49ad488536..90c1ceceb32 100644 --- a/lisp/complete.el +++ b/lisp/complete.el @@ -543,8 +543,8 @@ of `minibuffer-completion-table' and the minibuffer contents.") (let ((compl (all-completions (if env-on (file-name-nondirectory (substring str 0 p)) (substring str 0 p)) - table - pred))) + table + pred))) (setq p compl) (while p (and (string-match regex (car p)) @@ -553,6 +553,34 @@ of `minibuffer-completion-table' and the minibuffer contents.") (setq poss (cons (car p) poss)))) (setq p (cdr p))))) + ;; Handle completion-ignored-extensions + (and filename + (not (eq mode 'help)) + (let ((p2 poss)) + + ;; Build a regular expression representing the extensions list + (or (equal completion-ignored-extensions PC-ignored-extensions) + (setq PC-ignored-regexp + (concat "\\(" + (mapconcat + 'regexp-quote + (setq PC-ignored-extensions + completion-ignored-extensions) + "\\|") + "\\)\\'"))) + + ;; Check if there are any without an ignored extension. + ;; Also ignore `.' and `..'. + (setq p nil) + (while p2 + (or (string-match PC-ignored-regexp (car p2)) + (string-match "\\(\\`\\|/\\)[.][.]?/?\\'" (car p2)) + (setq p (cons (car p2) p))) + (setq p2 (cdr p2))) + + ;; If there are "good" names, use them + (and p (setq poss p)))) + ;; Now we have a list of possible completions (cond @@ -575,34 +603,6 @@ of `minibuffer-completion-table' and the minibuffer contents.") ((or (cdr (setq helpposs poss)) (memq mode '(help word))) - ;; Handle completion-ignored-extensions - (and filename - (not (eq mode 'help)) - (let ((p2 poss)) - - ;; Build a regular expression representing the extensions list - (or (equal completion-ignored-extensions PC-ignored-extensions) - (setq PC-ignored-regexp - (concat "\\(" - (mapconcat - 'regexp-quote - (setq PC-ignored-extensions - completion-ignored-extensions) - "\\|") - "\\)\\'"))) - - ;; Check if there are any without an ignored extension. - ;; Also ignore `.' and `..'. - (setq p nil) - (while p2 - (or (string-match PC-ignored-regexp (car p2)) - (string-match "\\(\\`\\|/\\)[.][.]?/?\\'" (car p2)) - (setq p (cons (car p2) p))) - (setq p2 (cdr p2))) - - ;; If there are "good" names, use them - (and p (setq poss p)))) - ;; Is the actual string one of the possible completions? (setq p (and (not (eq mode 'help)) poss)) (while (and p @@ -623,7 +623,8 @@ of `minibuffer-completion-table' and the minibuffer contents.") ;; Check if next few letters are the same in all cases (if (and (not (eq mode 'help)) - (setq prefix (try-completion (PC-chunk-after basestr skip) (mapcar 'list poss)))) + (setq prefix (try-completion (PC-chunk-after basestr skip) + poss))) (let ((first t) i) ;; Retain capitalization of user input even if ;; completion-ignore-case is set. @@ -669,13 +670,9 @@ of `minibuffer-completion-table' and the minibuffer contents.") (+ beg (length dirname)) end) skip) (mapcar - (function - (lambda (x) - (list - (and (string-match skip x) - (substring - x - (match-end 0)))))) + (lambda (x) + (when (string-match skip x) + (substring x (match-end 0)))) poss))) (or (> i 0) (> (length prefix) 0)) (or (not (eq mode 'word)) From 10412e6312cabf9265acbe32fd3743927038015f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 7 Aug 2006 18:24:25 +0000 Subject: [PATCH 141/361] (font-lock-extend-jit-lock-region-after-change): Better comment. --- lisp/font-lock.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index ab80316ae6a..b662a6735b0 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1196,6 +1196,10 @@ This function does 2 things: ;; it anyway. Here OTOH we have no guarantee that ;; font-lock-default-fontify-region will be executed on this region ;; any time soon. + ;; Note: contrary to font-lock-default-fontify-region, we do not do + ;; any loop here because we are not looking for a safe spot: we just + ;; mark the text whose appearance may need to change as a result of + ;; the buffer modification. (when (and (> beg (point-min)) (get-text-property (1- beg) 'font-lock-multiline)) (setq beg (or (previous-single-property-change From c0658ad46e4928ecdf6a14904073dc8a2fcfe862 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Tue, 8 Aug 2006 05:31:09 +0000 Subject: [PATCH 142/361] (terminal-init-xterm): Add more key bindings. --- lisp/ChangeLog | 4 ++++ lisp/term/xterm.el | 31 ++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff97d539496..ceff0ca111a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-07 Dan Nicolaescu + + * term/xterm.el (terminal-init-xterm): Add more key bindings. + 2006-08-07 Stefan Monnier * complete.el (PC-do-completion): Strip out completion-ignored-extensions diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 7622f23752b..9ea51a2f774 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -228,8 +228,37 @@ (define-key map "\e[4~" [select]) (define-key map "\e[29~" [print]) - ;; These keys are available in xterm starting from version 214 + ;; These keys are available in xterm starting from version 216 ;; if the modifyOtherKeys resource is set to 1. + + (define-key map "\e[27;5;39~" [?\C-\']) + (define-key map "\e[27;5;45~" [?\C--]) + + (define-key map "\e[27;5;48~" [?\C-0]) + (define-key map "\e[27;5;49~" [?\C-1]) + ;; Not all C-DIGIT keys have a distinct binding. + (define-key map "\e[27;5;57~" [?\C-9]) + + (define-key map "\e[27;5;59~" [?\C-\;]) + (define-key map "\e[27;5;61~" [?\C-=]) + + + (define-key map "\e[27;6;33~" [?\C-!]) + (define-key map "\e[27;6;34~" [?\C-\"]) + (define-key map "\e[27;6;35~" [?\C-#]) + (define-key map "\e[27;6;36~" [?\C-$]) + (define-key map "\e[27;6;37~" [?\C-%]) + (define-key map "\e[27;6;38~" [(C-&)]) + (define-key map "\e[27;6;40~" [?\C-(]) + (define-key map "\e[27;6;41~" [?\C-)]) + (define-key map "\e[27;6;42~" [?\C-*]) + (define-key map "\e[27;6;43~" [?\C-+]) + + (define-key map "\e[27;6;58~" [?\C-:]) + (define-key map "\e[27;6;60~" [?\C-<]) + (define-key map "\e[27;6;62~" [?\C->]) + (define-key map "\e[27;6;63~" [(C-\?)]) + (define-key map "\e[27;5;9~" [C-tab]) (define-key map "\e[27;5;13~" [C-return]) (define-key map "\e[27;5;44~" [?\C-,]) From 878bf4b8602c8c08971c5d3beb778fd90c6bccf3 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Tue, 8 Aug 2006 08:06:08 +0000 Subject: [PATCH 143/361] (Marks vs Flags): Fix typo reported by Ari Roponen . --- man/ChangeLog | 5 +++++ man/dired.texi | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/man/ChangeLog b/man/ChangeLog index 1e5a9d23e89..df2d8536e0b 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-08-08 Romain Francoise + + * dired.texi (Marks vs Flags): Fix typo reported by Ari Roponen + . + 2006-08-05 Romain Francoise * faq.texi (New in Emacs 22): Expand. diff --git a/man/dired.texi b/man/dired.texi index 3bb32c1ac74..0281c6b0107 100644 --- a/man/dired.texi +++ b/man/dired.texi @@ -325,7 +325,7 @@ for @file{..} and typing @kbd{f} there. Instead of flagging a file with @samp{D}, you can @dfn{mark} the file with some other character (usually @samp{*}). Most Dired commands to operate on files use the files marked with @samp{*}. The -only command that operates on flagged flies is @kbd{x}, which expunges +only command that operates on flagged files is @kbd{x}, which expunges them. Here are some commands for marking with @samp{*}, for unmarking, and From 867cc23e444dd4fd25717f8df280b03718b99907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Tue, 8 Aug 2006 09:33:10 +0000 Subject: [PATCH 144/361] * etags.c (TEX_mode): Check getc retruns EOF. File ended without newline causes infinite loop. --- lib-src/ChangeLog | 5 +++++ lib-src/etags.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index f61188fb8d5..84b15459322 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-07 Masatake YAMATO + + * etags.c (TEX_mode): Check getc retruns EOF. + File ended without newline causes infinite loop. + 2002-07-30 Adrian Aichner (tiny change) * etags.c: It's XEmacs, not Xemacs: change all the occurences. diff --git a/lib-src/etags.c b/lib-src/etags.c index d60c12c2bcc..d455ddc276d 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -5165,7 +5165,7 @@ TEX_mode (inf) { /* Skip to next line if we hit the TeX comment char. */ if (c == '%') - while (c != '\n') + while (c != '\n' && c != EOF) c = getc (inf); else if (c == TEX_LESC || c == TEX_SESC ) break; From 1520a816ef390058c2afb984326cd6615e0487df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Tue, 8 Aug 2006 09:34:56 +0000 Subject: [PATCH 145/361] * etags.c (readline): expect sscanf returns 2, not 1. --- lib-src/ChangeLog | 5 +++++ lib-src/etags.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 84b15459322..ae6ddedf5f7 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-07 Masatake YAMATO + + * etags.c (readline): expect sscanf returns 2, + not 1. + 2006-08-07 Masatake YAMATO * etags.c (TEX_mode): Check getc retruns EOF. diff --git a/lib-src/etags.c b/lib-src/etags.c index d455ddc276d..50f7162ded0 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -6259,7 +6259,7 @@ readline (lbp, stream) int start, lno; if (DEBUG) start = 0; /* shut up the compiler */ - if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 1) + if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 2) { char *endp = lbp->buffer + start; From 4c7c5c7e48af8443102716b09b715047d49874c0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 8 Aug 2006 15:09:26 +0000 Subject: [PATCH 146/361] (sh-quoted-subshell): Make sure we don't mistake a closing " for an opening one. --- lisp/ChangeLog | 10 ++++++++-- lisp/progmodes/sh-script.el | 13 ++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ceff0ca111a..8abe7e99f71 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,11 +1,17 @@ +2006-08-08 Stefan Monnier + + * progmodes/sh-script.el (sh-quoted-subshell): Make sure we don't + mistake a closing " for an opening one. + 2006-08-07 Dan Nicolaescu * term/xterm.el (terminal-init-xterm): Add more key bindings. 2006-08-07 Stefan Monnier - * complete.el (PC-do-completion): Strip out completion-ignored-extensions - before checking whether there are multiple completions. + * complete.el (PC-do-completion): Filter out completions matching + completion-ignored-extensions before checking whether there are + multiple completions. Don't use `list' unnecessarily when building completion tables. 2006-08-06 Richard Stallman diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 6098c8be067..f828c36917b 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -986,7 +986,9 @@ subshells can nest." ;; FIXME: This can (and often does) match multiple lines, yet it makes no ;; effort to handle multiline cases correctly, so it ends up being ;; rather flakey. - (when (re-search-forward "\"\\(?:\\(?:.\\|\n\\)*?[^\\]\\(?:\\\\\\\\\\)*\\)??\\(\\$(\\|`\\)" limit t) + (when (and (re-search-forward "\"\\(?:\\(?:.\\|\n\\)*?[^\\]\\(?:\\\\\\\\\\)*\\)??\\(\\$(\\|`\\)" limit t) + ;; Make sure the " we matched is an opening quote. + (eq ?\" (nth 3 (syntax-ppss)))) ;; bingo we have a $( or a ` inside a "" (let ((char (char-after (point))) (continue t) @@ -1081,9 +1083,6 @@ This is used to flag quote characters in subshell constructs inside strings ("\\(\\\\\\)'" 1 ,sh-st-punc) ;; Make sure $@ and @? are correctly recognized as sexps. ("\\$\\([?@]\\)" 1 ,sh-st-symbol) - ;; highlight (possibly nested) subshells inside "" quoted regions correctly. - (sh-quoted-subshell - (1 (sh-apply-quoted-subshell) t t)) ;; Find HEREDOC starters and add a corresponding rule for the ender. (sh-font-lock-here-doc (2 (sh-font-lock-open-heredoc @@ -1093,7 +1092,11 @@ This is used to flag quote characters in subshell constructs inside strings (and (match-beginning 3) (/= (match-beginning 3) (match-end 3)))) nil t)) ;; Distinguish the special close-paren in `case'. - (")" 0 (sh-font-lock-paren (match-beginning 0))))) + (")" 0 (sh-font-lock-paren (match-beginning 0))) + ;; highlight (possibly nested) subshells inside "" quoted regions correctly. + ;; This should be at the very end because it uses syntax-ppss. + (sh-quoted-subshell + (1 (sh-apply-quoted-subshell) t t)))) (defun sh-font-lock-syntactic-face-function (state) (let ((q (nth 3 state))) From 08e5fcf12acce1b89b667e552a2d8f23e34c2423 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 8 Aug 2006 16:27:41 +0000 Subject: [PATCH 147/361] update from texinfo --- man/texinfo.tex | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/man/texinfo.tex b/man/texinfo.tex index d41d40084b0..36c1acad97c 100644 --- a/man/texinfo.tex +++ b/man/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2006-06-19.13} +\def\texinfoversion{2006-07-17.16} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free @@ -327,9 +327,9 @@ \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) + % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip + \vskip 24pt \unvbox\footlinebox \fi % @@ -2051,11 +2051,11 @@ % and arrange explicitly to hyphenate at a dash. % -- rms. { - \catcode`\-=\active - \catcode`\_=\active + \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active % \global\def\code{\begingroup - \catcode`\-=\active \catcode`\_=\active + \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active + \let'\singlequotechar \ifallowcodebreaks \let-\codedash \let_\codeunder @@ -2472,8 +2472,8 @@ % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} @@ -5042,7 +5042,7 @@ {\tentt \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} +\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt} % \setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. @@ -5265,11 +5265,10 @@ % \maketwodispenvs {lisp}{example}{% \nonfillstart - \tt + \tt\quoteexpand \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. \gobble % eat return } - % @display/@smalldisplay: same as @lisp except keep current font. % \makedispenv {display}{% @@ -5397,6 +5396,22 @@ \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % \def\starttabbox{\setbox0=\hbox\bgroup} + +% Allow an option to not replace quotes with a regular directed right +% quote/apostrophe (char 0x27), but instead use the undirected quote +% from cmtt (char 0x0d). The undirected quote is ugly, so don't make it +% the default, but it works for pasting with more pdf viewers (at least +% evince), the lilypond developers report. xpdf does work with the +% regular 0x27. +% +\def\singlequotechar{% + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else + \char'15 + \fi +} +% \begingroup \catcode`\^^I=\active \gdef\tabexpand{% @@ -5409,7 +5424,13 @@ \wd0=\dimen0 \box0 \starttabbox }% } + \catcode`\'=\active + \gdef\quoteexpand{% + \catcode`\'=\active + \def'{\singlequotechar} + }% \endgroup +% \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart @@ -5418,6 +5439,7 @@ \def\par{\leavevmode\egroup\box0\endgraf}% \catcode`\`=\active \tabexpand + \quoteexpand % Respect line breaks, % print special symbols as themselves, and % make each space count From 02a2b2ad4f23b253380485eca654bf4b338d0855 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 8 Aug 2006 17:39:08 +0000 Subject: [PATCH 148/361] Clean up wording in previous change. --- lispref/ChangeLog | 4 ++ lispref/modes.texi | 169 +++++++++++++++++++++------------------------ 2 files changed, 82 insertions(+), 91 deletions(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 8c963512d2f..318c00e84b6 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,7 @@ +2006-08-08 Richard Stallman + + * modes.texi: Clean up wording in previous change. + 2006-08-07 Chong Yidong * modes.texi (Hooks): Clarify. diff --git a/lispref/modes.texi b/lispref/modes.texi index e0953c403b2..f8afcd8a829 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi @@ -52,8 +52,8 @@ possible, so that you can use them in a uniform way. the @dfn{mode hook} as the one of the last steps of initialization. This makes it easy for a user to customize the behavior of the mode, by overriding the buffer-local variable assignments already made by -the mode. Most minor modes also run a mode hook at their end. But -hooks are used in other contexts too. For example, the hook +the mode. Most minor mode functions also run a mode hook at the end. +But hooks are used in other contexts too. For example, the hook @code{suspend-hook} runs just before Emacs suspends itself (@pxref{Suspending Emacs}). @@ -66,17 +66,16 @@ globally or buffer-locally with @code{add-hook}. @cindex abnormal hook If the hook variable's name does not end with @samp{-hook}, that -indicates it is probably an @dfn{abnormal hook}. Then you should look at its -documentation to see how to use the hook properly. +indicates it is probably an @dfn{abnormal hook}. That means the hook +functions are called with arguments, or their return values are used +in some way. The hook's documentation says how the functions are +called. You can use @code{add-hook} to add a function to an abnormal +hook, but you must write the function to follow the hook's calling +convention. - @dfn{Abnormal hooks} are hooks in which the functions are called -with arguments, or the return values are used in some way. By -convention, abnormal hook names end in @samp{-functions} or -@samp{-hooks}. You can use @code{add-hook} to add a function to the -list, but you must take care in writing the function. - - If the variable's name ends in @samp{-function}, then its value -is just a single function, not a list of functions. + By convention, abnormal hook names end in @samp{-functions} or +@samp{-hooks}. If the variable's name ends in @samp{-function}, then +its value is just a single function, not a list of functions. Here's an example that uses a mode hook to turn on Auto Fill mode when in Lisp Interaction mode: @@ -95,12 +94,12 @@ symbol that is a normal hook variable. These arguments are processed in the order specified. If a hook variable has a non-@code{nil} value, that value should be a -list of functions. Each function in this list is called, -consecutively, with no arguments. +list of functions. @code{run-hooks} calls all the functions, one by +one, with no arguments. -A hook variable can also be a single function (either a lambda -expression or a symbol with a function definition) to be called. This -use is considered obsolete. +The hook variable's value can also be a single function---either a +lambda expression or a symbol with a function definition---which +@code{run-hooks} calls. But this usage is obsolete. @end defun @defun run-hook-with-args hook &rest args @@ -357,9 +356,10 @@ letters and other printing characters as special commands. @item Major modes modes for editing text should not define @key{RET} to do -anything other than insert a newline. The command to insert a newline -and then indent is @kbd{C-j}. It is ok for more specialized modes, -such as Info mode, to redefine @key{RET} to something else. +anything other than insert a newline. However, it is ok for +specialized modes for text that users don't directly edit, such as +Dired and Info modes, to redefine @key{RET} to do something entirely +different. @item Major modes should not alter options that are primarily a matter of user @@ -801,101 +801,92 @@ Do not write an @code{interactive} spec in the definition; @subsection Generic Modes @cindex generic mode -@dfn{Generic modes} are simple major modes with basic support for + @dfn{Generic modes} are simple major modes with basic support for comment syntax and Font Lock mode. To define a generic mode, use the macro @code{define-generic-mode}. See the file @file{generic-x.el} for some examples of the use of @code{define-generic-mode}. @defmac define-generic-mode mode comment-list keyword-list font-lock-list auto-mode-list function-list &optional docstring -This macro creates a new generic mode. The argument @var{mode} (an -unquoted symbol) is the major mode command. The optional argument -@var{docstring} is the documentation for the mode command. If you do -not supply it, @code{define-generic-mode} uses a default documentation -string instead. +This macro defines a generic mode command named @var{mode} (a symbol, +not quoted). The optional argument @var{docstring} is the +documentation for the mode command. If you do not supply it, +@code{define-generic-mode} generates one by default. -@var{comment-list} is a list in which each element is either a -character, a string of one or two characters, or a cons cell. A -character or a string is set up in the mode's syntax table as a +The argument @var{comment-list} is a list in which each element is +either a character, a string of one or two characters, or a cons cell. +A character or a string is set up in the mode's syntax table as a ``comment starter.'' If the entry is a cons cell, the @sc{car} is set up as a ``comment starter'' and the @sc{cdr} as a ``comment ender.'' (Use @code{nil} for the latter if you want comments to end at the end -of the line.) Note that the syntax table has limitations about what -comment starters and enders are actually possible. @xref{Syntax -Tables}. +of the line.) Note that the syntax table mechanism has limitations +about what comment starters and enders are actually possible. +@xref{Syntax Tables}. -@var{keyword-list} is a list of keywords to highlight with -@code{font-lock-keyword-face}. Each keyword should be a string. -@var{font-lock-list} is a list of additional expressions to highlight. -Each element of this list should have the same form as an element of -@code{font-lock-keywords}. @xref{Search-based Fontification}. +The argument @var{keyword-list} is a list of keywords to highlight +with @code{font-lock-keyword-face}. Each keyword should be a string. +Meanwhile, @var{font-lock-list} is a list of additional expressions to +highlight. Each element of this list should have the same form as an +element of @code{font-lock-keywords}. @xref{Search-based +Fontification}. -@var{auto-mode-list} is a list of regular expressions to add to the -variable @code{auto-mode-alist}. These regular expressions are added -when Emacs runs the macro expansion. +The argument @var{auto-mode-list} is a list of regular expressions to +add to the variable @code{auto-mode-alist}. They are added by the execution +of the @code{define-generic-mode} form, not by expanding the macro call. -@var{function-list} is a list of functions to call to do some -additional setup. The mode command calls these functions just before -it runs the mode hook variable @code{@var{mode}-hook}. +Finally, @var{function-list} is a list of functions for the mode +command to call for additional setup. It calls these functions just +before it runs the mode hook variable @code{@var{mode}-hook}. @end defmac @node Mode Hooks @subsection Mode Hooks - The two last things a major mode function should do is run its mode -hook and finally the mode independent normal hook -@code{after-change-major-mode-hook}. If the major mode is a derived -mode, that is if it calls another major mode (the parent mode) in its -body, then the parent's mode hook is run just before the derived -mode's hook. Neither the parent's mode hook nor -@code{after-change-major-mode-hook} are run at the end of the actual -call to the parent mode. This applies recursively if the parent mode -has itself a parent. That is, the mode hooks of all major modes -called directly or indirectly by the major mode function are all run -in sequence at the end, just before -@code{after-change-major-mode-hook}. + Every major mode function should finish by running its mode hook and +the mode-independent normal hook @code{after-change-major-mode-hook}. +It does this by calling @code{run-mode-hooks}. If the major mode is a +derived mode, that is if it calls another major mode (the parent mode) +in its body, it should do this inside @code{delay-mode-hooks} so that +the parent won't run these hooks itself. Instead, the derived mode's +call to @code{run-mode-hooks} runs the parent's mode hook too. +@xref{Major Mode Conventions}. - These conventions are new in Emacs 22, and some major modes -implemented by users do not follow them yet. So if you put a function -onto @code{after-change-major-mode-hook}, keep in mind that some modes -will fail to run it. If a user complains about that, you can respond, -``That major mode fails to follow Emacs conventions, and that's why it -fails to work. Please fix the major mode.'' In most cases, that is -good enough, so go ahead and use @code{after-change-major-mode-hook}. -However, if a certain feature needs to be completely reliable, -it should not use @code{after-change-major-mode-hook} as of yet. + Emacs versions before Emacs 22 did not have @code{delay-mode-hooks}. +When user-implemented major modes have not been updated to use it, +they won't entirely follow these conventions: they may run the +parent's mode hook too early, or fail to run +@code{after-change-major-mode-hook}. If you encounter such a major +mode, please correct it to follow these conventions. When you defined a major mode using @code{define-derived-mode}, it automatically makes sure these conventions are followed. If you -define a major mode ``from scratch,'' not using -@code{define-derived-mode}, make sure the major mode command follows -these and other conventions. @xref{Major Mode Conventions}. You use -these functions to do it properly. +define a major mode ``by hand,'' not using @code{define-derived-mode}, +use the following functions to handle these conventions automatically. @defun run-mode-hooks &rest hookvars Major modes should run their mode hook using this function. It is similar to @code{run-hooks} (@pxref{Hooks}), but it also runs @code{after-change-major-mode-hook}. -When the call to this function is dynamically inside a -@code{delay-mode-hooks} form, this function does not run any hooks. +When this function is called during the execution of a +@code{delay-mode-hooks} form, it does not run the hooks immediately. Instead, it arranges for the next call to @code{run-mode-hooks} to run -@var{hookvars}. +them. @end defun @defmac delay-mode-hooks body@dots{} -This macro executes @var{body} like @code{progn}, but all calls to -@code{run-mode-hooks} inside @var{body} delay running their hooks. -They will be run by the first call to @code{run-mode-hooks} after exit -from @code{delay-mode-hooks}. This is the proper way for a major mode -command to invoke its parent mode. +When one major mode command calls another, it should do so inside of +@code{delay-mode-hooks}. + +This macro executes @var{body}, but tells all @code{run-mode-hooks} +calls during the execution of @var{body} to delay running their hooks. +The hooks will actually run during the next call to +@code{run-mode-hooks} after the end of the @code{delay-mode-hooks} +construct. @end defmac @defvar after-change-major-mode-hook -Every major mode function should run this normal hook at its very end. -It normally does not need to do so explicitly. Indeed, a major mode -function should normally run its mode hook with @code{run-mode-hooks} -as the very last thing it does, and the last thing -@code{run-mode-hooks} does is run @code{after-change-major-mode-hook}. +This is a normal hook run by @code{run-mode-hooks}. It is run at the +very end of every properly-written major mode function. @end defvar @node Example Major Modes @@ -1058,9 +1049,8 @@ correspondingly more complicated. Here are excerpts from @end group @end smallexample - Much code is shared among the three Lisp modes. The following -function sets various variables; it is called by each of the major Lisp -mode functions: + The three modes for Lisp share much of their code. For instance, +each calls the following function to set various variables: @smallexample @group @@ -1072,13 +1062,10 @@ mode functions: @end group @end smallexample - Functions such as @code{forward-paragraph} use the value of the -@code{paragraph-start} variable. Since Lisp code is different from -ordinary text, the @code{paragraph-start} variable needs to be set -specially to handle Lisp. Also, comments are indented in a special -fashion in Lisp and the Lisp modes need their own mode-specific -@code{comment-indent-function}. The code to set these variables is the -rest of @code{lisp-mode-variables}. + In Lisp and most programming languages, we want the paragraph +commands to treat only blank lines as paragraph separators. And the +modes should undestand the Lisp conventions for comments. The rest of +@code{lisp-mode-variables} sets this up: @smallexample @group From dc7ef9f02fdc4f992caea9a23e26f54a1ce48eac Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 8 Aug 2006 17:45:42 +0000 Subject: [PATCH 149/361] * info.el (Info-fontify-node): Handle preceding `in' for note reference hiding rules. --- lisp/ChangeLog | 5 +++++ lisp/info.el | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8abe7e99f71..c360d6c666f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-08 Chong Yidong + + * info.el (Info-fontify-node): Handle preceding `in' for note + reference hiding rules. + 2006-08-08 Stefan Monnier * progmodes/sh-script.el (sh-quoted-subshell): Make sure we don't diff --git a/lisp/info.el b/lisp/info.el index 87327d8656b..dc08557e28d 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -3805,6 +3805,8 @@ the variable `Info-file-list-for-emacs'." (setq other-tag (cond ((save-match-data (looking-back "\\ Date: Tue, 8 Aug 2006 20:53:10 +0000 Subject: [PATCH 150/361] Whitespace change. --- lisp/help.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/help.el b/lisp/help.el index af79bbcf57c..db76efb01a0 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -841,7 +841,7 @@ whose documentation describes the minor mode." (if (zerop (length indicator)) "no indicator" (format "indicator%s" - indicator)))) + indicator)))) (princ (documentation mode-function))) (insert-button pretty-minor-mode 'action (car help-button-cache) From dccee2cb1589448168edd0223256789b88f7f56f Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 9 Aug 2006 01:11:44 +0000 Subject: [PATCH 151/361] (latexenc-find-file-coding-system): Fix for the case that the 2nd element of arg-list is a cons. --- lisp/international/latexenc.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/international/latexenc.el b/lisp/international/latexenc.el index 25d56c1e928..58e8d6c88e8 100644 --- a/lisp/international/latexenc.el +++ b/lisp/international/latexenc.el @@ -138,8 +138,14 @@ coding system names is determined from `latex-inputenc-coding-alist'." ((and (require 'code-pages nil t) (coding-system-p sym)) sym) (t 'undecided))) ;; else try to find it in the master/main file - (let ((default-directory (file-name-directory (nth 1 arg-list))) - latexenc-main-file) + + ;; Fixme: If the current file is in an archive (e.g. tar, + ;; zip), we should find the master file in that archive. + ;; But, that is not yet implemented. -- K.Handa + (let ((default-directory (if (stringp (nth 1 arg-list)) + (file-name-directory (nth 1 arg-list)) + default-directory)) + latexenc-main-file) ;; Is there a TeX-master or tex-main-file in the local variables ;; section? (unless latexenc-dont-use-TeX-master-flag From 2c53e699a1a9705755ca239da5acfdf32fd77ac9 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 9 Aug 2006 01:25:03 +0000 Subject: [PATCH 152/361] (syms_of_coding): Improve the docstring file-coding-system-alist. --- src/coding.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coding.c b/src/coding.c index 1af7b4c0d52..ae9f6749792 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7968,8 +7968,9 @@ the file contents. If VAL is a cons of coding systems, the car part is used for decoding, and the cdr part is used for encoding. If VAL is a function symbol, the function must return a coding system -or a cons of coding systems which are used as above. The function gets -the arguments with which `find-operation-coding-system' was called. +or a cons of coding systems which are used as above. The function is +called with an argument that is a list of the arguments with which +`find-operation-coding-system' was called. See also the function `find-operation-coding-system' and the variable `auto-coding-alist'. */); From bb0825cb7d70a290d61946d53f2a665ce8a4a14c Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 9 Aug 2006 01:25:59 +0000 Subject: [PATCH 153/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ src/ChangeLog | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c360d6c666f..06834b2ac49 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-09 Kenichi Handa + + * international/latexenc.el (latexenc-find-file-coding-system): + Fix for the case that the 2nd element of arg-list is a cons. + 2006-08-08 Chong Yidong * info.el (Info-fontify-node): Handle preceding `in' for note diff --git a/src/ChangeLog b/src/ChangeLog index 7c0408196aa..9d23a23e6a5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-09 Kenichi Handa + + * coding.c (syms_of_coding): Improve the docstring + file-coding-system-alist. + 2006-08-07 Andreas Schwab * puresize.h (BASE_PURESIZE): Increase to 1120000. From c2028ac64fab925570fa9ef7e1ed564f4aa3eb2c Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 9 Aug 2006 04:55:10 +0000 Subject: [PATCH 154/361] (keyremap_step): No-op if fkey->parent = nil. (read_key_sequence): Always start fkey.start and fkey.end at 0, and likewise for keytran. --- src/ChangeLog | 6 ++++++ src/keyboard.c | 25 ++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9d23a23e6a5..678078d3781 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2006-08-09 Richard Stallman + + * keyboard.c (keyremap_step): No-op if fkey->parent = nil. + (read_key_sequence): Always start fkey.start and fkey.end at 0, + and likewise for keytran. + 2006-08-09 Kenichi Handa * coding.c (syms_of_coding): Improve the docstring diff --git a/src/keyboard.c b/src/keyboard.c index 6f12994a1b8..ae3b78b04d2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -8385,7 +8385,15 @@ follow_key (key, nmaps, current, defs, next) such as Vfunction_key_map and Vkey_translation_map. */ typedef struct keyremap { - Lisp_Object map, parent; + /* This is the map originally specified for this use. */ + Lisp_Object parent; + /* This is a submap reached by looking up, in PARENT, + the events from START to END. */ + Lisp_Object map; + /* Positions [START, END) in the key sequence buffer + are the key that we have scanned so far. + Those events are the ones that we will replace + if PAREHT maps them into a key sequence. */ int start, end; } keyremap; @@ -8458,7 +8466,11 @@ keyremap_step (keybuf, bufsize, fkey, input, doit, diff, prompt) Lisp_Object next, key; key = keybuf[fkey->end++]; - next = access_keymap_keyremap (fkey->map, key, prompt, doit); + + if (KEYMAPP (fkey->parent)) + next = access_keymap_keyremap (fkey->map, key, prompt, doit); + else + next = Qnil; /* If keybuf[fkey->start..fkey->end] is bound in the map and we're in a position to do the key remapping, replace it with @@ -8656,9 +8668,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, delayed_switch_frame = Qnil; fkey.map = fkey.parent = Vfunction_key_map; keytran.map = keytran.parent = Vkey_translation_map; - /* If there is no translation-map, turn off scanning. */ - fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; - keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1; + fkey.start = fkey.end = 0; + keytran.start = keytran.end = 0; if (INTERACTIVE) { @@ -9486,8 +9497,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, keybuf[t - 1] = new_key; mock_input = max (t, mock_input); - fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; - keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1; + fkey.start = fkey.end = 0; + keytran.start = keytran.end = 0; goto replay_sequence; } From 1f4edc37b89c6981092342ed44328bbdf7efd73a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Wed, 9 Aug 2006 06:22:27 +0000 Subject: [PATCH 155/361] * etags.c (readline): expect sscanf returns >= 1. --- lib-src/ChangeLog | 4 ++++ lib-src/etags.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index ae6ddedf5f7..3e7d9efad31 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-09 Jan Dj,Ad(Brv + + * etags.c (readline): expect sscanf returns >= 1. + 2006-08-07 Masatake YAMATO * etags.c (readline): expect sscanf returns 2, diff --git a/lib-src/etags.c b/lib-src/etags.c index 50f7162ded0..c7d18d34849 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -6259,7 +6259,7 @@ readline (lbp, stream) int start, lno; if (DEBUG) start = 0; /* shut up the compiler */ - if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 2) + if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) >= 1) { char *endp = lbp->buffer + start; From ea90c5d3bdb03846cbe7845b65d5be1343eddbe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Wed, 9 Aug 2006 06:56:16 +0000 Subject: [PATCH 156/361] (readline): Change position on %n and \" in sscanf. --- lib-src/ChangeLog | 1 + lib-src/etags.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 3e7d9efad31..3328f010846 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,6 +1,7 @@ 2006-08-09 Jan Dj,Ad(Brv * etags.c (readline): expect sscanf returns >= 1. + (readline): Change position on %n and \" in sscanf. 2006-08-07 Masatake YAMATO diff --git a/lib-src/etags.c b/lib-src/etags.c index c7d18d34849..b02268ac218 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -6259,9 +6259,10 @@ readline (lbp, stream) int start, lno; if (DEBUG) start = 0; /* shut up the compiler */ - if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) >= 1) + if (sscanf (lbp->buffer, "#line %d %n\"", &lno, &start) >= 1 + && inp[start] == '"') { - char *endp = lbp->buffer + start; + char *endp = lbp->buffer + ++start; assert (start > 0); while ((endp = etags_strchr (endp, '"')) != NULL From ae587d1d0cc496d38a369db44dfa0d2d1598d1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Wed, 9 Aug 2006 06:56:38 +0000 Subject: [PATCH 157/361] Fix previous change. --- lib-src/etags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-src/etags.c b/lib-src/etags.c index b02268ac218..49a18be1df5 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -6260,7 +6260,7 @@ readline (lbp, stream) if (DEBUG) start = 0; /* shut up the compiler */ if (sscanf (lbp->buffer, "#line %d %n\"", &lno, &start) >= 1 - && inp[start] == '"') + && lbp->buffer[start] == '"') { char *endp = lbp->buffer + ++start; From d070a65d0ec72e272c6688163db9c5e9c25c8359 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 9 Aug 2006 11:50:27 +0000 Subject: [PATCH 158/361] *** empty log message *** --- lisp/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 06834b2ac49..ed5bab6cc8a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-09 John Wiegley + + * calendar/timeclock.el (timeclock-use-elapsed): Added a new + variable, which causes timeclock to report elapsed time worked, + instead of just work remaining. + 2006-08-09 Kenichi Handa * international/latexenc.el (latexenc-find-file-coding-system): From 43f5aea1d8eed1254c65383f5bbcadf6f7ebd989 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 9 Aug 2006 11:51:57 +0000 Subject: [PATCH 159/361] (timeclock-use-elapsed): Added a new variable, which causes timeclock to report elapsed time worked, instead of just work remaining. --- lisp/calendar/timeclock.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index 3f2697509f3..13b3671e16a 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el @@ -95,7 +95,7 @@ :group 'timeclock) (defcustom timeclock-relative t - "*Whether to maken reported time relative to `timeclock-workday'. + "*Whether to make reported time relative to `timeclock-workday'. For example, if the length of a normal workday is eight hours, and you work four hours on Monday, then the amount of time \"remaining\" on Tuesday is twelve hours -- relative to an averaged work period of @@ -251,7 +251,10 @@ each day.") This value is not accurate enough to be useful by itself. Rather, call `timeclock-workday-elapsed', to determine how much time has been worked so far today. Also, if `timeclock-relative' is nil, this value -will be the same as `timeclock-discrepancy'.") ; ? gm +will be the same as `timeclock-discrepancy'.") + +(defvar timeclock-use-elapsed nil + "Non-nil if the modeline should display time elapsed, not remaining.") (defvar timeclock-last-period nil "Integer representing the number of seconds in the last period. @@ -424,7 +427,9 @@ If SHOW-SECONDS is non-nil, display second resolution. If TODAY-ONLY is non-nil, the display will be relative only to time worked today, ignoring the time worked on previous days." (interactive "P") - (let ((remainder (timeclock-workday-remaining)) ; today-only? + (let ((remainder (timeclock-workday-remaining + (or today-only + (not timeclock-relative)))) (last-in (equal (car timeclock-last-event) "i")) status) (setq status @@ -619,7 +624,10 @@ relative only to the time worked today, and not to past time." The value of `timeclock-relative' affects the display as described in that variable's documentation." (interactive) - (let ((remainder (timeclock-workday-remaining (not timeclock-relative))) + (let ((remainder + (if timeclock-use-elapsed + (timeclock-workday-elapsed) + (timeclock-workday-remaining (not timeclock-relative)))) (last-in (equal (car timeclock-last-event) "i"))) (when (and (< remainder 0) (not (and timeclock-day-over From 541a0de1e2dedd333a586886bd8cea35082133a4 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 9 Aug 2006 19:10:13 +0000 Subject: [PATCH 160/361] Don't say which side scroll bar is on. --- etc/ChangeLog | 4 ++++ etc/TUTORIAL | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index f144dd17954..b708594aa32 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2006-08-09 Richard Stallman + + * TUTORIAL: Don't say which side scroll bar is on. + 2006-08-06 Nick Roberts * DEBUG (Note): Add note about following a longjmp call. diff --git a/etc/TUTORIAL b/etc/TUTORIAL index 5748d0d4e5e..630cc4f9765 100644 --- a/etc/TUTORIAL +++ b/etc/TUTORIAL @@ -217,7 +217,7 @@ This should have scrolled the screen up by 8 lines. If you would like to scroll it down again, you can give an argument to M-v. If you are using a windowed display, such as X11 or MS-Windows, there -should be a tall rectangular area called a scroll bar at the left hand +should be a tall rectangular area called a scroll bar at the side of the Emacs window. You can scroll the text by clicking the mouse in the scroll bar. From 38ceb48f7f509590630c79c0709d3ecafd2c63e1 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 10 Aug 2006 03:37:29 +0000 Subject: [PATCH 161/361] * avoid.el (mouse-avoidance-animating-pointer): New var. (mouse-avoidance-nudge-mouse): Use it. (mouse-avoidance-banish): Rename from mouse-avoidance-banish-hook. (mouse-avoidance-exile): Rename from mouse-avoidance-exile-hook (mouse-avoidance-fancy): Rename from mouse-avoidance-fancy-hook. Don't activate if currently animating. All callers changed. --- lisp/ChangeLog | 9 +++++++++ lisp/avoid.el | 25 +++++++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed5bab6cc8a..8f2ee7d31d7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2006-08-09 Chong Yidong + + * avoid.el (mouse-avoidance-animating-pointer): New var. + (mouse-avoidance-nudge-mouse): Use it. + (mouse-avoidance-banish): Rename from mouse-avoidance-banish-hook. + (mouse-avoidance-exile): Rename from mouse-avoidance-exile-hook + (mouse-avoidance-fancy): Rename from mouse-avoidance-fancy-hook. + Don't activate if currently animating. All callers changed. + 2006-08-09 John Wiegley * calendar/timeclock.el (timeclock-use-elapsed): Added a new diff --git a/lisp/avoid.el b/lisp/avoid.el index 1868707720e..b497c2007bd 100644 --- a/lisp/avoid.el +++ b/lisp/avoid.el @@ -124,6 +124,7 @@ Only applies in mouse-avoidance-modes `animate' and `jump'." (defvar mouse-avoidance-pointer-shapes nil) (defvar mouse-avoidance-n-pointer-shapes 0) (defvar mouse-avoidance-old-pointer-shape nil) +(defvar mouse-avoidance-animating-pointer nil) ;; This timer is used to run something when Emacs is idle. (defvar mouse-avoidance-timer nil) @@ -243,16 +244,19 @@ You can redefine this if you want the mouse banished to a different corner." (+ (cdr mouse-avoidance-state) deltay))) (if (or (eq mouse-avoidance-mode 'animate) (eq mouse-avoidance-mode 'proteus)) - (let ((i 0.0)) + (let ((i 0.0) + (incr (max .1 (/ 1.0 mouse-avoidance-nudge-dist)))) + (setq mouse-avoidance-animating-pointer t) (while (<= i 1) (mouse-avoidance-set-mouse-position (cons (+ (car cur-pos) (round (* i deltax))) (+ (cdr cur-pos) (round (* i deltay))))) - (setq i (+ i (max .1 (/ 1.0 mouse-avoidance-nudge-dist)))) + (setq i (+ i incr)) (if (eq mouse-avoidance-mode 'proteus) (mouse-avoidance-set-pointer-shape (mouse-avoidance-random-shape))) - (sit-for mouse-avoidance-animation-delay))) + (sit-for mouse-avoidance-animation-delay)) + (setq mouse-avoidance-animating-pointer nil)) (mouse-avoidance-set-mouse-position (cons (+ (car (cdr cur)) deltax) (+ (cdr (cdr cur)) deltay)))))) @@ -294,11 +298,11 @@ redefine this function to suit your own tastes." (memq 'drag modifiers) (memq 'down modifiers))))))) -(defun mouse-avoidance-banish-hook () +(defun mouse-avoidance-banish () (if (not (mouse-avoidance-ignore-p)) (mouse-avoidance-banish-mouse))) -(defun mouse-avoidance-exile-hook () +(defun mouse-avoidance-exile () ;; For exile mode, the state is nil when the mouse is in its normal ;; position, and set to the old mouse-position when the mouse is in exile. (if (not (mouse-avoidance-ignore-p)) @@ -317,9 +321,10 @@ redefine this function to suit your own tastes." ;; but clear state anyway, to be ready for another move (setq mouse-avoidance-state nil)))))) -(defun mouse-avoidance-fancy-hook () +(defun mouse-avoidance-fancy () ;; Used for the "fancy" modes, ie jump et al. - (if (and (not (mouse-avoidance-ignore-p)) + (if (and (not mouse-avoidance-animating-pointer) + (not (mouse-avoidance-ignore-p)) (mouse-avoidance-too-close-p (mouse-position))) (let ((old-pos (mouse-position))) (mouse-avoidance-nudge-mouse) @@ -375,14 +380,14 @@ definition of \"random distance\".)" (eq mode 'animate) (eq mode 'proteus)) (setq mouse-avoidance-timer - (run-with-idle-timer 0.1 t 'mouse-avoidance-fancy-hook)) + (run-with-idle-timer 0.1 t 'mouse-avoidance-fancy)) (setq mouse-avoidance-mode mode mouse-avoidance-state (cons 0 0) mouse-avoidance-old-pointer-shape (and (boundp 'x-pointer-shape) x-pointer-shape))) ((eq mode 'exile) (setq mouse-avoidance-timer - (run-with-idle-timer 0.1 t 'mouse-avoidance-exile-hook)) + (run-with-idle-timer 0.1 t 'mouse-avoidance-exile)) (setq mouse-avoidance-mode mode mouse-avoidance-state nil)) ((or (eq mode 'banish) @@ -390,7 +395,7 @@ definition of \"random distance\".)" (and (null mode) (null mouse-avoidance-mode)) (and mode (> (prefix-numeric-value mode) 0))) (setq mouse-avoidance-timer - (run-with-idle-timer 0.1 t 'mouse-avoidance-banish-hook)) + (run-with-idle-timer 0.1 t 'mouse-avoidance-banish)) (setq mouse-avoidance-mode 'banish)) (t (setq mouse-avoidance-mode nil))) (force-mode-line-update)) From cd7890bd1af96ddbdaebccb45291f72d94d18941 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 10 Aug 2006 04:00:34 +0000 Subject: [PATCH 162/361] (facemenu-add-face): Pass frame to facemenu-active-faces. (facemenu-set-face): Doc fix. --- lisp/facemenu.el | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/lisp/facemenu.el b/lisp/facemenu.el index a8d8ea9a4b5..3c43bfbad7a 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -320,19 +320,24 @@ variables." ;;;###autoload (defun facemenu-set-face (face &optional start end) - "Add FACE to the region or next character typed. -This adds FACE to the top of the face list; any faces lower on the list that -will not show through at all will be removed. + "Apply FACE to the region or next character typed. -Interactively, reads the face name with the minibuffer. +If the region is active (normally true except in Transient +Mark mode) and nonempty, and there is no prefix argument, +this command applies FACE to the region. Otherwise, it applies FACE +to the faces to use for the next character +inserted. (Moving point or switching buffers before typing +a character to insert cancels the specification.) -If the region is active (normally true except in Transient Mark mode) -and there is no prefix argument, this command sets the region to the -requested face. +If FACE is `default', to \"apply\" it means clearing +the list of faces to be used. For any other value of FACE, +to \"apply\" it means putting FACE at the front of the list +of faces to be used, and removing any faces further +along in the list that would be completely overridden by +preceding faces (including FACE). -Otherwise, this command specifies the face for the next character -inserted. Moving point or switching buffers before -typing a character to insert cancels the specification." +This command can also add FACE to the menu of faces, +if `facemenu-listed-faces' says to do that." (interactive (list (progn (barf-if-buffer-read-only) (read-face-name "Use face")) @@ -612,7 +617,12 @@ effect. See `facemenu-remove-face-function'." (cons face (if (listp prev) prev - (list prev))))))) + (list prev))) + ;; Specify the selected frame + ;; because nil would mean to use + ;; the new-frame default settings, + ;; and those are usually nil. + (selected-frame))))) (setq part-start part-end))) (setq self-insert-face (if (eq last-command self-insert-face-command) (cons face (if (listp self-insert-face) @@ -655,9 +665,8 @@ use the selected frame. If t, then the global, non-frame faces are used." (nreverse active-list))) (defun facemenu-add-new-face (face) - "Add FACE (a face) to the Face menu. - -This is called whenever you create a new face." + "Add FACE (a face) to the Face menu if `facemenu-listed-faces' says so. +This is called whenever you create a new face, and at other times." (let* (name symbol menu docstring From 5667ecd2caf9e6f70eaf775a28668e6130a525e3 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 10 Aug 2006 04:19:57 +0000 Subject: [PATCH 163/361] (Format Faces): Substantial rewrites to deal with face merging. Empty regions don't count. Clarify face property inheritance. --- lisp/ChangeLog | 5 ++++ man/text.texi | 64 ++++++++++++++++++++++++++------------------------ 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8f2ee7d31d7..f584383ec23 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-10 Richard Stallman + + * facemenu.el (facemenu-add-face): Pass frame to facemenu-active-faces. + (facemenu-set-face): Doc fix. + 2006-08-09 Chong Yidong * avoid.el (mouse-avoidance-animating-pointer): New var. diff --git a/man/text.texi b/man/text.texi index 3a166174fda..b764a83d8db 100644 --- a/man/text.texi +++ b/man/text.texi @@ -2067,59 +2067,61 @@ Display a list of all the defined colors (@code{list-colors-display}). @subsection Faces in Formatted Text The Faces submenu lists various Emacs faces including @code{bold}, -@code{italic}, and @code{underline}. Selecting one of these adds the -chosen face to the region. @xref{Faces}. You can also specify a face -with these keyboard commands: +@code{italic}, and @code{underline} (@pxref{Faces}). These menu items +operate on the region if it is active and nonempty. Otherwise, they +specify to use that face for an immediately following self-inserting +character. Instead of the menu, you can use these keyboard commands: @table @kbd @kindex M-o d @r{(Enriched mode)} @findex facemenu-set-default @item M-o d -Set the region, or the next inserted character, to the @code{default} face -(@code{facemenu-set-default}). +Remove all @code{face} properties from the region (which includes +specified colors), or force the following inserted character to have no +@code{face} property (@code{facemenu-set-default}). @kindex M-o b @r{(Enriched mode)} @findex facemenu-set-bold @item M-o b -Set the region, or the next inserted character, to the @code{bold} face -(@code{facemenu-set-bold}). +Add the face @code{bold} to the region or to the following inserted +character (@code{facemenu-set-bold}). @kindex M-o i @r{(Enriched mode)} @findex facemenu-set-italic @item M-o i -Set the region, or the next inserted character, to the @code{italic} face -(@code{facemenu-set-italic}). +Add the face @code{italic} to the region or to the following inserted +character (@code{facemenu-set-italic}). @kindex M-o l @r{(Enriched mode)} @findex facemenu-set-bold-italic @item M-o l -Set the region, or the next inserted character, to the @code{bold-italic} face -(@code{facemenu-set-bold-italic}). +Add the face @code{bold-italic} to the region or to the following +inserted character (@code{facemenu-set-bold-italic}). @kindex M-o u @r{(Enriched mode)} @findex facemenu-set-underline @item M-o u -Set the region, or the next inserted character, to the @code{underline} face -(@code{facemenu-set-underline}). +Add the face @code{underline} to the region or to the following inserted +character (@code{facemenu-set-underline}). @kindex M-o o @r{(Enriched mode)} @findex facemenu-set-face @item M-o o @var{face} @key{RET} -Set the region, or the next inserted character, to the face @var{face} -(@code{facemenu-set-face}). +Add the face @var{face} to the region or to the following inserted +character (@code{facemenu-set-face}). @end table - If you use these commands with a prefix argument---or, in Transient Mark -mode, if the region is not active---then these commands specify a face -to use for any immediately following self-inserting input. -@xref{Transient Mark}. This applies to both the keyboard commands and -the menu commands. + With a prefix argument, all these commands apply to an immediately +following self-inserting character, disregarding the region. - Specifying the @code{default} face also resets foreground and -background color to their defaults.(@pxref{Format Colors}). + A self-inserting character normally inherits the @code{face} +property (and most other text properties) from the preceding character +in the buffer. If you use the above commands to specify face for the +next self-inserting character, or the next section's commands to +specify a foreground or background color for it, then it does not +inherit the @code{face} property from the preceding character; instead +it uses whatever you specified. It will still inherit other text +properties, though. - Any self-inserting character you type inherits, by default, the face -properties (as well as most other text properties) of the preceding -character. Specifying any face property, including foreground or -background color, for your next self-inserting character will prevent -it from inheriting any face properties from the preceding character, -although it will still inherit other text properties. Characters -inserted by yanking do not inherit text properties. + Strictly speaking, these commands apply only to the first following +self-inserting character that you type. But if you insert additional +characters after it, they will inherit from the first one. So it +appears that these commands apply to all of them. Enriched mode defines two additional faces: @code{excerpt} and @code{fixed}. These correspond to codes used in the text/enriched file @@ -2157,8 +2159,8 @@ colors that you have used in Enriched mode in the current Emacs session. If you specify a color with a prefix argument---or, in Transient Mark mode, if the region is not active---then it applies to any -immediately following self-inserting input. @xref{Transient Mark}. -Otherwise, the command applies to the region. +immediately following self-inserting input. Otherwise, the command +applies to the region. Each color menu contains one additional item: @samp{Other}. You can use this item to specify a color that is not listed in the menu; it reads From d7beaf538263b68d20df6eb01e693c31d27ea537 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 10 Aug 2006 04:31:21 +0000 Subject: [PATCH 164/361] (facemenu-listed-faces): Doc fix. --- lisp/facemenu.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 3c43bfbad7a..eaaf4dacd72 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -134,18 +134,24 @@ just before \"Other\" at the end." (defcustom facemenu-listed-faces nil "*List of faces to include in the Face menu. -Each element should be a symbol, which is the name of a face. +Each element should be a symbol, the name of a face. The \"basic \" faces in `facemenu-keybindings' are automatically -added to the Face menu, and are not included in this list. +added to the Face menu, and need not be in this list. -You can set this list before loading facemenu.el, or add a face to it before -creating that face if you want it to be listed. If you change the -variable so as to eliminate faces that have already been added to the menu, -call `facemenu-update' to recalculate the menu contents. +This value takes effect when you load facemenu.el. If the +list includes symbols which are not defined as faces, they +are ignored; however, subsequently defining or creating +those faces adds them to the menu then. You can call +`facemenu-update' to recalculate the menu contents, such as +if you change the value of this variable, -If this variable is t, all faces will be added to the menu. This -is useful for setting temporarily if you want to add faces to the -menu when they are created." +If this variable is t, all faces that you apply to text +using the face menu commands (even by name), and all faces +that you define or create, are added to the menu. You may +find it useful to set this variable to t temporarily while +you define some faces, so that they will be added. However, +if the value is no longer t and you call `facemenu-update', +it will remove any faces not explicitly in the list." :type '(choice (const :tag "List all faces" t) (const :tag "None" nil) (repeat symbol)) From 38cdf40b3ccebb28c9d94dcd36b3457b87e16918 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 10 Aug 2006 04:31:27 +0000 Subject: [PATCH 165/361] *** empty log message *** --- lisp/ChangeLog | 1 + man/ChangeLog | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f584383ec23..9d22cf958a7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,7 @@ * facemenu.el (facemenu-add-face): Pass frame to facemenu-active-faces. (facemenu-set-face): Doc fix. + (facemenu-listed-faces): Doc fix. 2006-08-09 Chong Yidong diff --git a/man/ChangeLog b/man/ChangeLog index df2d8536e0b..8d252755de6 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,9 @@ +2006-08-10 Richard Stallman + + * text.texi (Format Faces): Substantial rewrites to deal + with face merging. Empty regions don't count. Clarify + face property inheritance. + 2006-08-08 Romain Francoise * dired.texi (Marks vs Flags): Fix typo reported by Ari Roponen From 0e94a24a871c7032b29bb971abdd0353d5ace084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 10 Aug 2006 06:06:48 +0000 Subject: [PATCH 166/361] * keyboard.h: Declare in_sighandler. --- src/keyboard.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/keyboard.h b/src/keyboard.h index 96ac7d2e856..f8d8f789c08 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -190,6 +190,9 @@ extern EMACS_INT num_nonmacro_input_events; /* Nonzero means polling for input is temporarily suppressed. */ extern int poll_suppress_count; +/* Nonzero if we are executing from the SIGIO signal handler. */ +extern int in_sighandler; + /* Keymap mapping ASCII function key sequences onto their preferred forms. Initialized by the terminal-specific lisp files. */ extern Lisp_Object Vfunction_key_map; From 90b03d58966b9bb4f8de4f4b5fcbb24cec70b45a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 10 Aug 2006 06:07:15 +0000 Subject: [PATCH 167/361] * keyboard.c: Define in_sighandler. (input_available_signal): Set in_sighandler. --- src/keyboard.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/keyboard.c b/src/keyboard.c index ae3b78b04d2..c715eadeb80 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -100,6 +100,9 @@ int interrupt_input_pending; /* File descriptor to use for input. */ extern int input_fd; +/* Nonzero if we are executing from the SIGIO signal handler. */ +int in_sighandler; + #ifdef HAVE_WINDOW_SYSTEM /* Make all keyboard buffers much bigger when using X windows. */ #ifdef MAC_OS8 @@ -6924,6 +6927,8 @@ input_available_signal (signo) SIGNAL_THREAD_CHECK (signo); #endif + in_sighandler = 1; + if (input_available_clear_time) EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); @@ -6935,6 +6940,7 @@ input_available_signal (signo) sigfree (); #endif errno = old_errno; + in_sighandler = 0; } #endif /* SIGIO */ @@ -10802,6 +10808,7 @@ init_keyboard () do_mouse_tracking = Qnil; #endif input_pending = 0; + in_sighandler = 0; /* This means that command_loop_1 won't try to select anything the first time through. */ From 0d3e774694d20e3cf496204fad3447bac9f13d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 10 Aug 2006 06:09:30 +0000 Subject: [PATCH 168/361] * alloc.c (UNBLOCK_INPUT_ALLOC, BLOCK_INPUT_ALLOC): Use in_sighandler to check if mutex should be locked or not. --- src/alloc.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index eb7acfd649f..192b974196f 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -130,17 +130,27 @@ static pthread_mutex_t alloc_mutex; #define BLOCK_INPUT_ALLOC \ do \ { \ - pthread_mutex_lock (&alloc_mutex); \ - if (pthread_self () == main_thread) \ - BLOCK_INPUT; \ + if (!in_sighandler) \ + { \ + pthread_mutex_lock (&alloc_mutex); \ + if (pthread_self () == main_thread) \ + BLOCK_INPUT; \ + else \ + sigblock (sigmask (SIGIO)); \ + } \ } \ while (0) #define UNBLOCK_INPUT_ALLOC \ do \ { \ - if (pthread_self () == main_thread) \ - UNBLOCK_INPUT; \ - pthread_mutex_unlock (&alloc_mutex); \ + if (!in_sighandler) \ + { \ + pthread_mutex_unlock (&alloc_mutex); \ + if (pthread_self () == main_thread) \ + UNBLOCK_INPUT; \ + else \ + sigunblock (sigmask (SIGIO)); \ + } \ } \ while (0) From abef1dd799261ccb87282c30ad61b87e31b4dadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 10 Aug 2006 06:09:57 +0000 Subject: [PATCH 169/361] * keyboard.c: Define in_sighandler. (input_available_signal): Set in_sighandler. (init_keyboard): Initialize in_sighandler. * keyboard.h: Declare in_sighandler. * alloc.c (UNBLOCK_INPUT_ALLOC, BLOCK_INPUT_ALLOC): Use in_sighandler to check if mutex should be locked or not. --- src/ChangeLog | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 678078d3781..abd06ed521c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2006-08-10 Jan Dj,Ad(Brv + + * keyboard.c: Define in_sighandler. + (input_available_signal): Set in_sighandler. + (init_keyboard): Initialize in_sighandler. + + * keyboard.h: Declare in_sighandler. + + * alloc.c (UNBLOCK_INPUT_ALLOC, BLOCK_INPUT_ALLOC): Use in_sighandler + to check if mutex should be locked or not. + 2006-08-09 Richard Stallman * keyboard.c (keyremap_step): No-op if fkey->parent = nil. From 3a799327579db6f05aeaf4a9cf6f9ae73e8cae88 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 10 Aug 2006 15:27:41 +0000 Subject: [PATCH 170/361] * emacs-lisp/edebug.el (edebug-recursive-edit): Don't save and restore unread-command-events here. (edebug-display): Do it here, to detect sit-for interruptions. --- lisp/emacs-lisp/edebug.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 8645ec5a6ed..e7f5a736ded 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -2556,6 +2556,7 @@ MSG is printed after `::::} '." (edebug-outside-buffer (current-buffer)) (edebug-outside-point (point)) (edebug-outside-mark (edebug-mark)) + (edebug-outside-unread-command-events unread-command-events) edebug-outside-windows ; window or screen configuration edebug-buffer-points @@ -2574,6 +2575,7 @@ MSG is printed after `::::} '." (overlay-arrow-string overlay-arrow-string) (cursor-in-echo-area nil) (default-cursor-in-non-selected-windows t) + (unread-command-events nil) ;; any others?? ) (if (not (buffer-name edebug-buffer)) @@ -2681,8 +2683,7 @@ MSG is printed after `::::} '." ((eq edebug-execution-mode 'trace) (edebug-sit-for edebug-sit-for-seconds)) ; Force update and pause. ((eq edebug-execution-mode 'Trace-fast) - (edebug-sit-for 0)) ; Force update and continue. - ) + (edebug-sit-for 0))) ; Force update and continue. (unwind-protect (if (or edebug-stop @@ -2778,6 +2779,7 @@ MSG is printed after `::::} '." (with-timeout-unsuspend edebug-with-timeout-suspend) ;; Reset global variables to outside values in case they were changed. (setq + unread-command-events edebug-outside-unread-command-events overlay-arrow-position edebug-outside-o-a-p overlay-arrow-string edebug-outside-o-a-s cursor-in-echo-area edebug-outside-c-i-e-a @@ -2868,7 +2870,6 @@ MSG is printed after `::::} '." (edebug-outside-last-input-event last-input-event) (edebug-outside-last-command-event last-command-event) - (edebug-outside-unread-command-events unread-command-events) (edebug-outside-last-event-frame last-event-frame) (edebug-outside-last-nonmenu-event last-nonmenu-event) (edebug-outside-track-mouse track-mouse) @@ -2890,7 +2891,6 @@ MSG is printed after `::::} '." ;; More for Emacs 19 (last-input-event nil) (last-command-event nil) - (unread-command-events nil) (last-event-frame nil) (last-nonmenu-event nil) (track-mouse nil) @@ -2950,7 +2950,6 @@ MSG is printed after `::::} '." last-command edebug-outside-last-command this-command edebug-outside-this-command unread-command-char edebug-outside-unread-command-char - unread-command-events edebug-outside-unread-command-events current-prefix-arg edebug-outside-current-prefix-arg last-input-char edebug-outside-last-input-char last-input-event edebug-outside-last-input-event From 87c9ab0c7a97880e3303ad67692b3c627561bb1e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 10 Aug 2006 15:30:17 +0000 Subject: [PATCH 171/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9d22cf958a7..213f5939f62 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-10 John Wiegley + + * eshell/em-glob.el (eshell-glob-chars-list) + (eshell-glob-translate-alist): Add support for [^g] in character globs. + 2006-08-10 Richard Stallman * facemenu.el (facemenu-add-face): Pass frame to facemenu-active-faces. From f80c9382efe996857f34ddd36ddfc7513dc08eb0 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 10 Aug 2006 15:30:56 +0000 Subject: [PATCH 172/361] (eshell-glob-chars-list) (eshell-glob-translate-alist): Add support for [^g] in character globs. --- lisp/eshell/em-glob.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index 76bde7784dc..c700d5d7f6e 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el @@ -97,7 +97,7 @@ This option slows down recursive glob processing by quite a bit." :type 'boolean :group 'eshell-glob) -(defcustom eshell-glob-chars-list '(?\] ?\[ ?* ?? ?~ ?\( ?\) ?| ?#) +(defcustom eshell-glob-chars-list '(?\] ?\[ ?* ?? ?~ ?\( ?\) ?| ?# ?^) "*List of additional characters used in extended globbing." :type '(repeat character) :group 'eshell-glob) @@ -105,6 +105,7 @@ This option slows down recursive glob processing by quite a bit." (defcustom eshell-glob-translate-alist '((?\] . "]") (?\[ . "[") + (?^ . "^") (?? . ".") (?* . ".*") (?~ . "~") From 65b13f4bc0c6821e03a3d3be0f2ba4ad70001976 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 10 Aug 2006 16:07:43 +0000 Subject: [PATCH 173/361] Minor fix to last change. --- lisp/emacs-lisp/edebug.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index e7f5a736ded..5107ee60274 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -2575,7 +2575,7 @@ MSG is printed after `::::} '." (overlay-arrow-string overlay-arrow-string) (cursor-in-echo-area nil) (default-cursor-in-non-selected-windows t) - (unread-command-events nil) + (unread-command-events unread-command-events) ;; any others?? ) (if (not (buffer-name edebug-buffer)) @@ -2664,6 +2664,7 @@ MSG is printed after `::::} '." (t (message ""))) + (setq unread-command-events nil) (if (eq 'after edebug-arg-mode) (progn ;; Display result of previous evaluation. From 43901444a44d09f2fab59a1127e2659426dcd53e Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 10 Aug 2006 18:43:55 +0000 Subject: [PATCH 174/361] (Recognize Coding, Text Coding): Fix typos. --- man/ChangeLog | 20 ++++++++++++-------- man/mule.texi | 4 ++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/man/ChangeLog b/man/ChangeLog index 8d252755de6..6b14690768a 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-08-10 Sven Joachim (tiny change) + + * mule.texi (Recognize Coding, Text Coding): Fix typos. + 2006-08-10 Richard Stallman * text.texi (Format Faces): Substantial rewrites to deal @@ -51,7 +55,7 @@ * building.texi (GDB commands in Fringe): Rename to... (Source Buffers): ..this and move forward. Describe hollow arrow and new option gdb-find-source-frame. - + 2006-07-29 Richard Stallman * dired.texi (Operating on Files): Simplify previous change @@ -65,7 +69,7 @@ 2006-07-28 Richard Stallman * mark.texi (Transient Mark): Clarify that region never disappears - when Transient Mark mode is off, and not when it is on. + when Transient Mark mode is off, and not when it is on. 2006-07-27 Richard Stallman @@ -75,15 +79,15 @@ * xresources.texi (GTK styles): Fix texinfo usage. - * pgg.texi, org.texi, info.texi, forms.texi, flymake.texi: + * pgg.texi, org.texi, info.texi, forms.texi, flymake.texi: * faq.texi: Move periods and commas inside quotes. * commands.texi (User Input): Explain why we teach keyboard cmds. - - * xresources.texi, xresmini.texi, search.texi, programs.texi: - * misc.texi, kmacro.texi, killing.texi, glossary.texi: - * fortran-xtra.texi, files.texi, emacs.texi, emacs-xtra.texi: - * doclicense.texi, display.texi, dired.texi, basic.texi: + + * xresources.texi, xresmini.texi, search.texi, programs.texi: + * misc.texi, kmacro.texi, killing.texi, glossary.texi: + * fortran-xtra.texi, files.texi, emacs.texi, emacs-xtra.texi: + * doclicense.texi, display.texi, dired.texi, basic.texi: * anti.texi, ack.texi: Move periods and commas inside quotes. 2006-07-22 Eli Zaretskii diff --git a/man/mule.texi b/man/mule.texi index a49478dfe02..9437e30f485 100644 --- a/man/mule.texi +++ b/man/mule.texi @@ -785,7 +785,7 @@ file. The variable @code{file-coding-system-alist} specifies this correspondence. There is a special function @code{modify-coding-system-alist} for adding elements to this list. For example, to read and write all @samp{.txt} files using the coding system -@code{china-iso-8bit}, you can execute this Lisp expression: +@code{chinese-iso-8bit}, you can execute this Lisp expression: @smallexample (modify-coding-system-alist 'file "\\.txt\\'" 'chinese-iso-8bit) @@ -1003,7 +1003,7 @@ of with @kbd{C-x @key{RET} f}, there is no warning if the buffer contains characters that the coding system cannot handle. Other file commands affected by a specified coding system include -@kbd{C-x C-i} and @kbd{C-x C-v}, as well as the other-window variants +@kbd{C-x i} and @kbd{C-x C-v}, as well as the other-window variants of @kbd{C-x C-f}. @kbd{C-x @key{RET} c} also affects commands that start subprocesses, including @kbd{M-x shell} (@pxref{Shell}). If the immediately following command does not use the coding system, then From c40408fbe7d325d81ebe784f9565edb39ca23d9f Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Thu, 10 Aug 2006 20:06:19 +0000 Subject: [PATCH 175/361] * textmodes/dns-mode.el: Alias `zone-mode' to `dns-mode'. (dns-mode-soa-auto-increment-serial): New user option. (dns-mode-soa-maybe-increment-serial): New function. (dns-mode): Add the latter to `write-contents-functions'. * obsolete/zone-mode.el: Move to obsolete/ from net/. Delete autoload cookies. --- lisp/ChangeLog | 10 ++++++++++ lisp/{net => obsolete}/zone-mode.el | 2 -- lisp/textmodes/dns-mode.el | 29 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) rename lisp/{net => obsolete}/zone-mode.el (99%) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 213f5939f62..a994da42625 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2006-08-10 Romain Francoise + + * textmodes/dns-mode.el: Alias `zone-mode' to `dns-mode'. + (dns-mode-soa-auto-increment-serial): New user option. + (dns-mode-soa-maybe-increment-serial): New function. + (dns-mode): Add the latter to `write-contents-functions'. + + * obsolete/zone-mode.el: Move to obsolete/ from net/. + Delete autoload cookies. + 2006-08-10 John Wiegley * eshell/em-glob.el (eshell-glob-chars-list) diff --git a/lisp/net/zone-mode.el b/lisp/obsolete/zone-mode.el similarity index 99% rename from lisp/net/zone-mode.el rename to lisp/obsolete/zone-mode.el index 441ef143f9c..d8bfefc1e87 100644 --- a/lisp/net/zone-mode.el +++ b/lisp/obsolete/zone-mode.el @@ -64,7 +64,6 @@ (error "Serial numbers want to move backwards from %s to %s" old-serial new-serial) (replace-match (concat cur-date new-seq old-flag) t t)))))) -;;;###autoload (defun zone-mode-update-serial-hook () "Update the serial number in a zone if the file was modified." (interactive) @@ -82,7 +81,6 @@ (modify-syntax-entry ?\; "<" zone-mode-syntax-table) (modify-syntax-entry ?\n ">" zone-mode-syntax-table)) -;;;###autoload (define-derived-mode zone-mode fundamental-mode "zone" "A mode for editing DNS zone files. diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index a323d4c4468..78be0f888a3 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el @@ -90,6 +90,18 @@ :type 'sexp :group 'dns-mode) +(defcustom dns-mode-soa-auto-increment-serial t + "Whether to increment the SOA serial number automatically. + +If this variable is t, the serial number is incremented upon each save of +the file. If it is `ask', Emacs asks for confirmation whether it should +increment the serial upon saving. If nil, serials must be incremented +manually with \\[dns-mode-soa-increment-serial]." + :type '(choice (const :tag "Always" t) + (const :tag "Ask" ask) + (const :tag "Never" nil)) + :group 'dns-mode) + ;; Syntax table. (defvar dns-mode-syntax-table @@ -135,8 +147,12 @@ Turning on DNS mode runs `dns-mode-hook'." (unless (featurep 'xemacs) (set (make-local-variable 'font-lock-defaults) '(dns-mode-font-lock-keywords nil nil ((?_ . "w"))))) + (add-hook 'write-contents-functions 'dns-mode-soa-maybe-increment-serial + nil t) (easy-menu-add dns-mode-menu dns-mode-map)) +;;;###autoload (defalias 'zone-mode 'dns-mode) + ;; Tools. ;;;###autoload @@ -192,6 +208,19 @@ Turning on DNS mode runs `dns-mode-hook'." (message "Replaced old serial %s with %s" serial new)) (error "Cannot locate serial number in SOA record")))))) +(defun dns-mode-soa-maybe-increment-serial () + "Increment SOA serial if needed. + +This function is run from `write-contents-functions'." + (when (and (buffer-modified-p) + dns-mode-soa-auto-increment-serial + (or (eq dns-mode-soa-auto-increment-serial t) + (y-or-n-p "Increment SOA serial? "))) + ;; We must return nil. If `dns-mode-soa-increment-serial' signals + ;; an error saving will fail but that probably means that the + ;; serial should be fixed to comply with the RFC anyway! -rfr + (progn (dns-mode-soa-increment-serial) nil))) + ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode)) (provide 'dns-mode) From 82a33a215e1556251d6e0d8c1789d78ede98a88d Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Thu, 10 Aug 2006 20:07:08 +0000 Subject: [PATCH 176/361] Mention that zone-mode.el is now obsolete. --- etc/ChangeLog | 4 ++++ etc/NEWS | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index b708594aa32..c900ed296da 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2006-08-10 Romain Francoise + + * NEWS: Mention that zone-mode.el is now obsolete. + 2006-08-09 Richard Stallman * TUTORIAL: Don't say which side scroll bar is on. diff --git a/etc/NEWS b/etc/NEWS index 3f986846f17..0a8adc534be 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1771,9 +1771,8 @@ type "C-h i m org RET" to read that manual. A reference card is available in `etc/orgcard.tex' and `etc/orgcard.ps'. +++ -** The new package dns-mode.el add syntax highlight of DNS master files. -The key binding C-c C-s (`dns-mode-soa-increment-serial') can be used -to increment the SOA serial. +** The new package dns-mode.el adds syntax highlighting of DNS master files. +It is a modern replacement for zone-mode.el, which is now obsolete. --- ** The new global minor mode `file-name-shadow-mode' modifies the way @@ -3512,6 +3511,9 @@ variable `calculator-radix-grouping-mode'. --- ** iso-acc.el is now obsolete. Use one of the latin input methods instead. +--- +** zone-mode.el is now obsolete. Use dns-mode.el instead. + --- ** cplus-md.el has been deleted. From 9fc68699c62e1efe177e4dcce268ef74eef4dde9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Fri, 11 Aug 2006 07:30:14 +0000 Subject: [PATCH 177/361] * xselect.c (Fx_register_dnd_atom): New function. (syms_of_xselect): Defsubr it. (x_handle_dnd_message): Check that message_type is in dpyinfo->x_dnd_atoms before generating lisp event. --- src/xselect.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/src/xselect.c b/src/xselect.c index fcac2860359..013a52dbdb1 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2677,8 +2677,48 @@ If the value is 0 or the atom is not known, return the empty string. */) return ret; } -/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. - TODO: Check if this client event really is a DND event? */ +DEFUN ("x-register-dnd-atom", Fx_register_dnd_atom, + Sx_register_dnd_atom, 1, 2, 0, + doc: /* Request that dnd events are made for ClientMessages with ATOM. +ATOM can be a symbol or a string. The ATOM is interned on the display that +FRAME is on. If FRAME is nil, the selected frame is used. */) + (atom, frame) + Lisp_Object atom, frame; +{ + Atom x_atom; + struct frame *f = check_x_frame (frame); + size_t i; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + + + if (SYMBOLP (atom)) + x_atom = symbol_to_x_atom (dpyinfo, FRAME_X_DISPLAY (f), atom); + else if (STRINGP (atom)) + { + BLOCK_INPUT; + x_atom = XInternAtom (FRAME_X_DISPLAY (f), (char *) SDATA (atom), False); + UNBLOCK_INPUT; + } + else + error ("ATOM must be a symbol or a string"); + + for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) + if (dpyinfo->x_dnd_atoms[i] == x_atom) + return Qnil; + + if (dpyinfo->x_dnd_atoms_length == dpyinfo->x_dnd_atoms_size) + { + dpyinfo->x_dnd_atoms_size *= 2; + dpyinfo->x_dnd_atoms = xrealloc (dpyinfo->x_dnd_atoms, + sizeof (*dpyinfo->x_dnd_atoms) + * dpyinfo->x_dnd_atoms_size); + } + + dpyinfo->x_dnd_atoms[dpyinfo->x_dnd_atoms_length++] = x_atom; + return Qnil; +} + +/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */ int x_handle_dnd_message (f, event, dpyinfo, bufp) @@ -2694,6 +2734,12 @@ x_handle_dnd_message (f, event, dpyinfo, bufp) int x, y; unsigned char *data = (unsigned char *) event->data.b; int idata[5]; + size_t i; + + for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) + if (dpyinfo->x_dnd_atoms[i] == event->message_type) break; + + if (i == dpyinfo->x_dnd_atoms_length) return 0; XSETFRAME (frame, f); @@ -2867,6 +2913,7 @@ syms_of_xselect () defsubr (&Sx_get_atom_name); defsubr (&Sx_send_client_message); + defsubr (&Sx_register_dnd_atom); reading_selection_reply = Fcons (Qnil, Qnil); staticpro (&reading_selection_reply); From 9f562c51d616d1e534771600368e16705269c625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Fri, 11 Aug 2006 07:30:36 +0000 Subject: [PATCH 178/361] * xterm.h (struct x_display_info): Add x_dnd_atoms* to keep track of drag and drop Atoms. --- src/xterm.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xterm.h b/src/xterm.h index 10a9aaa2961..9aa1d8fcacb 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -389,6 +389,12 @@ struct x_display_info X_WMTYPE_A, X_WMTYPE_B } wm_type; + + + /* Atoms that are drag and drop atoms */ + Atom *x_dnd_atoms; + size_t x_dnd_atoms_size; + size_t x_dnd_atoms_length; }; #ifdef HAVE_X_I18N From 93acf8f34d3cdbe9e23f0207ff6285c759c67bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Fri, 11 Aug 2006 07:30:56 +0000 Subject: [PATCH 179/361] * xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms* --- src/xterm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xterm.c b/src/xterm.c index 4203411e888..6fb9ee28f42 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10584,6 +10584,11 @@ x_term_init (display_name, xrm_option, resource_name) dpyinfo->cut_buffers_initialized = 0; + dpyinfo->x_dnd_atoms_size = 8; + dpyinfo->x_dnd_atoms_length = 0; + dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms) + * dpyinfo->x_dnd_atoms_size); + connection = ConnectionNumber (dpyinfo->display); dpyinfo->connection = connection; From 0c584069b6212a25be12aa9edf2f713b03f54f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Fri, 11 Aug 2006 07:31:14 +0000 Subject: [PATCH 180/361] * xselect.c (Fx_register_dnd_atom): New function. (syms_of_xselect): Defsubr it. (x_handle_dnd_message): Check that message_type is in dpyinfo->x_dnd_atoms before generating lisp event. * xterm.h (struct x_display_info): Add x_dnd_atoms* to keep track of drag and drop Atoms. * xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms* --- src/ChangeLog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index abd06ed521c..b4016b546c0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2006-08-11 Jan Dj,Ad(Brv + + * xselect.c (Fx_register_dnd_atom): New function. + (syms_of_xselect): Defsubr it. + (x_handle_dnd_message): Check that message_type is in + dpyinfo->x_dnd_atoms before generating lisp event. + + * xterm.h (struct x_display_info): Add x_dnd_atoms* to keep track + of drag and drop Atoms. + + * xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms* + + 2006-08-10 Jan Dj,Ad(Brv * keyboard.c: Define in_sighandler. From 2f2f340fb561971fef6a846ff4621c69dab0a969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Fri, 11 Aug 2006 07:32:39 +0000 Subject: [PATCH 181/361] * x-dnd.el (x-dnd-init-frame): Call x-register-dnd-atom. --- lisp/ChangeLog | 4 ++++ lisp/x-dnd.el | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a994da42625..ada27d2c275 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-11 Jan Dj,Ad(Brv + + * x-dnd.el (x-dnd-init-frame): Call x-register-dnd-atom. + 2006-08-10 Romain Francoise * textmodes/dns-mode.el: Alias `zone-mode' to `dns-mode'. diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index 693a2d7fa4b..81fe9a8e868 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el @@ -121,6 +121,12 @@ any protocol specific data.") (defun x-dnd-init-frame (&optional frame) "Setup drag and drop for FRAME (i.e. create appropriate properties)." + (x-register-dnd-atom "DndProtocol" frame) + (x-register-dnd-atom "_MOTIF_DRAG_AND_DROP_MESSAGE" frame) + (x-register-dnd-atom "XdndEnter" frame) + (x-register-dnd-atom "XdndPosition" frame) + (x-register-dnd-atom "XdndLeave" frame) + (x-register-dnd-atom "XdndDrop" frame) (x-dnd-init-xdnd-for-frame frame) (x-dnd-init-motif-for-frame frame)) From bad03cfc8030793473927dff7f8c87bc45fc4bbe Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Fri, 11 Aug 2006 09:28:44 +0000 Subject: [PATCH 182/361] (bindat-ip-to-string): Use `format-network-address' if possible. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/bindat.el | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ada27d2c275..a6ee985c659 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-11 Thien-Thi Nguyen + + * emacs-lisp/bindat.el (bindat-ip-to-string): + Use `format-network-address' if possible. + 2006-08-11 Jan Dj,Ad(Brv * x-dnd.el (x-dnd-init-frame): Call x-register-dnd-atom. diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index d05eed2c4a2..1b37f3f772f 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -619,9 +619,12 @@ If optional second arg SEP is a string, use that as separator." (bindat-format-vector vect "%02x" (if (stringp sep) sep ":"))) (defun bindat-ip-to-string (ip) - "Format vector IP as an ip address in dotted notation." - (format "%d.%d.%d.%d" - (aref ip 0) (aref ip 1) (aref ip 2) (aref ip 3))) + "Format vector IP as an ip address in dotted notation. +The port (if any) is omitted. IP can be a string, as well." + (if (vectorp ip) + (format-network-address ip t) + (format "%d.%d.%d.%d" + (aref ip 0) (aref ip 1) (aref ip 2) (aref ip 3)))) (provide 'bindat) From aa7adb2ada9a42f088c2edb234248d7e078d19c6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 11 Aug 2006 13:56:50 +0000 Subject: [PATCH 183/361] (dns-mode): Use before-save-hook. --- lisp/ChangeLog | 4 ++++ lisp/textmodes/dns-mode.el | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a6ee985c659..7bb97d09b86 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-11 Stefan Monnier + + * textmodes/dns-mode.el (dns-mode): Use before-save-hook. + 2006-08-11 Thien-Thi Nguyen * emacs-lisp/bindat.el (bindat-ip-to-string): diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index 78be0f888a3..8ee69f03d7b 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el @@ -147,7 +147,7 @@ Turning on DNS mode runs `dns-mode-hook'." (unless (featurep 'xemacs) (set (make-local-variable 'font-lock-defaults) '(dns-mode-font-lock-keywords nil nil ((?_ . "w"))))) - (add-hook 'write-contents-functions 'dns-mode-soa-maybe-increment-serial + (add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial nil t) (easy-menu-add dns-mode-menu dns-mode-map)) @@ -211,15 +211,17 @@ Turning on DNS mode runs `dns-mode-hook'." (defun dns-mode-soa-maybe-increment-serial () "Increment SOA serial if needed. -This function is run from `write-contents-functions'." +This function is run from `before-save-hook'." (when (and (buffer-modified-p) dns-mode-soa-auto-increment-serial (or (eq dns-mode-soa-auto-increment-serial t) (y-or-n-p "Increment SOA serial? "))) - ;; We must return nil. If `dns-mode-soa-increment-serial' signals + ;; If `dns-mode-soa-increment-serial' signals ;; an error saving will fail but that probably means that the ;; serial should be fixed to comply with the RFC anyway! -rfr - (progn (dns-mode-soa-increment-serial) nil))) + (progn (dns-mode-soa-increment-serial) + ;; We return nil in case this is used in write-contents-functions. + nil))) ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode)) From b3302d9b0af367b9ef4e7f6663d5cb8f58725173 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 11 Aug 2006 14:11:10 +0000 Subject: [PATCH 184/361] * emacs-lisp/edebug.el (edebug-recursive-edit): Don't save and restore unread-command-events here. (edebug-display): Do it here, to detect sit-for interruptions. --- lisp/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7bb97d09b86..775b5dcfd05 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-10 Chong Yidong + + * emacs-lisp/edebug.el (edebug-recursive-edit): Don't save and + restore unread-command-events here. + (edebug-display): Do it here, to detect sit-for interruptions. + 2006-08-11 Stefan Monnier * textmodes/dns-mode.el (dns-mode): Use before-save-hook. From 08eedb79230d76e2faa005e8c343f744d0489a33 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Fri, 11 Aug 2006 14:11:24 +0000 Subject: [PATCH 185/361] Fix formatting/indentation. --- lisp/textmodes/dns-mode.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index 8ee69f03d7b..21fe137118f 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el @@ -216,12 +216,12 @@ This function is run from `before-save-hook'." dns-mode-soa-auto-increment-serial (or (eq dns-mode-soa-auto-increment-serial t) (y-or-n-p "Increment SOA serial? "))) - ;; If `dns-mode-soa-increment-serial' signals - ;; an error saving will fail but that probably means that the - ;; serial should be fixed to comply with the RFC anyway! -rfr + ;; If `dns-mode-soa-increment-serial' signals an error saving will + ;; fail but that probably means that the serial should be fixed to + ;; comply with the RFC anyway! -rfr (progn (dns-mode-soa-increment-serial) - ;; We return nil in case this is used in write-contents-functions. - nil))) + ;; We return nil in case this is used in write-contents-functions. + nil))) ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode)) From 946c199400a4eb2fa4a2d0889f1a6db5cb812a44 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Fri, 11 Aug 2006 15:42:48 +0000 Subject: [PATCH 186/361] Delete zone-mode.el. --- lisp/ChangeLog | 12 ++-- lisp/obsolete/zone-mode.el | 118 ------------------------------------- 2 files changed, 8 insertions(+), 122 deletions(-) delete mode 100644 lisp/obsolete/zone-mode.el diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 775b5dcfd05..ba902ce657f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,8 +1,6 @@ -2006-08-10 Chong Yidong +2006-08-11 Romain Francoise - * emacs-lisp/edebug.el (edebug-recursive-edit): Don't save and - restore unread-command-events here. - (edebug-display): Do it here, to detect sit-for interruptions. + * obsolete/zone-mode.el: Delete. 2006-08-11 Stefan Monnier @@ -17,6 +15,12 @@ * x-dnd.el (x-dnd-init-frame): Call x-register-dnd-atom. +2006-08-10 Chong Yidong + + * emacs-lisp/edebug.el (edebug-recursive-edit): Don't save and + restore unread-command-events here. + (edebug-display): Do it here, to detect sit-for interruptions. + 2006-08-10 Romain Francoise * textmodes/dns-mode.el: Alias `zone-mode' to `dns-mode'. diff --git a/lisp/obsolete/zone-mode.el b/lisp/obsolete/zone-mode.el deleted file mode 100644 index d8bfefc1e87..00000000000 --- a/lisp/obsolete/zone-mode.el +++ /dev/null @@ -1,118 +0,0 @@ -;;; zone-mode.el --- major mode for editing DNS zone files - -;; Copyright (C) 1998, 2002, 2003, 2004, 2005, -;; 2006 Free Software Foundation, Inc. - -;; Author: John Heidemann -;; Keywords: DNS, languages - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;;; -;;; See the comments in ``define-derived-mode zone-mode'' -;;; (the last function in this file) -;;; for what this mode is and how to use it automatically. -;;; - -;;; -;;; Credits: -;;; Zone-mode was written by John Heidemann , -;;; with bug fixes from Simon Leinen . -;;; - -;;; Code: - -(defun zone-mode-update-serial () - "Update the serial number in a zone." - (interactive) - (save-excursion - (goto-char (point-min)) - (while (re-search-forward "\\b\\([0-9]+\\)\\([0-9][0-9]\\)\\([ \t]+;[ \t]+[Ss]erial\\)" (point-max) t) - (let* ((old-date (match-string 1)) - (old-seq (match-string 2)) - (old-seq-num (string-to-number (match-string 2))) - (old-flag (match-string 3)) - (cur-date (format-time-string "%Y%m%d")) - (new-seq - (cond - ((not (string= old-date cur-date)) - "00") ;; reset sequence number - ((>= old-seq-num 99) - (error "Serial number's sequence cannot increment beyond 99")) - (t - (format "%02d" (1+ old-seq-num))))) - (old-serial (concat old-date old-seq)) - (new-serial (concat cur-date new-seq))) - (if (string-lessp new-serial old-serial) - (error "Serial numbers want to move backwards from %s to %s" old-serial new-serial) - (replace-match (concat cur-date new-seq old-flag) t t)))))) - -(defun zone-mode-update-serial-hook () - "Update the serial number in a zone if the file was modified." - (interactive) - (if (buffer-modified-p (current-buffer)) - (zone-mode-update-serial)) - nil ;; so we can run from write-file-hooks - ) - -(defvar zone-mode-syntax-table nil - "Zone-mode's syntax table.") - -(defun zone-mode-load-time-setup () - "Initialize `zone-mode' stuff." - (setq zone-mode-syntax-table (make-syntax-table)) - (modify-syntax-entry ?\; "<" zone-mode-syntax-table) - (modify-syntax-entry ?\n ">" zone-mode-syntax-table)) - -(define-derived-mode zone-mode fundamental-mode "zone" - "A mode for editing DNS zone files. - -Zone-mode does two things: - - - automatically update the serial number for a zone - when saving the file - - - fontification" - - (add-hook 'write-file-functions 'zone-mode-update-serial-hook nil t) - - (if (null zone-mode-syntax-table) - (zone-mode-load-time-setup)) ;; should have been run at load-time - - ;; font-lock support: - (set-syntax-table zone-mode-syntax-table) - (make-local-variable 'comment-start) - (setq comment-start ";") - (make-local-variable 'comment-start-skip) - ;; Look within the line for a ; following an even number of backslashes - ;; after either a non-backslash or the line beginning. - (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*") - (make-local-variable 'comment-column) - (setq comment-column 40) - (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults - '(nil nil nil nil beginning-of-line))) - -(zone-mode-load-time-setup) - -(provide 'zone-mode) - -;;; arch-tag: 6a2940ef-fd4f-4de7-b979-b027b09821fe -;;; zone-mode.el ends here From d5e5361f9fbc64540b42cefb819efec84fa910b3 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Fri, 11 Aug 2006 15:43:40 +0000 Subject: [PATCH 187/361] (Acknowledgments): Delete mention to zone-mode.el. --- man/ChangeLog | 4 ++++ man/ack.texi | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/man/ChangeLog b/man/ChangeLog index 6b14690768a..ca5ad50bacd 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-08-11 Romain Francoise + + * ack.texi (Acknowledgments): Delete mention to zone-mode.el. + 2006-08-10 Sven Joachim (tiny change) * mule.texi (Recognize Coding, Text Coding): Fix typos. diff --git a/man/ack.texi b/man/ack.texi index 7294cdc3350..67c731d6174 100644 --- a/man/ack.texi +++ b/man/ack.texi @@ -419,8 +419,6 @@ them. @item John Heidemann wrote @file{mouse-copy.el} and @file{mouse-drag.el}, which provide alternative mouse-based editing and scrolling features. -He also contributed @file{zone-mode.el}, a major mode for editing DNS -zone files. @item Jon K Hellan wrote @file{utf7.el}, support for mail-safe transformation From d0cd961e58fb5e421377fad88b1037546e9bec93 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 11:36:15 +0000 Subject: [PATCH 188/361] (Fmouse_position, Fmouse_pixel_position) (Fset_mouse_position, Fset_mouse_pixel_position): Doc fix. --- src/frame.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/frame.c b/src/frame.c index 1fdeb129f89..82a016be69e 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1429,7 +1429,8 @@ The functions are run with one arg, the frame to be deleted. */) DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0, doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position. The position is given in character cells, where (0, 0) is the -upper-left corner. +upper-left corner of the frame, X is the horizontal offset, and Y is +the vertical offset. If Emacs is running on a mouseless terminal or hasn't been programmed to read the mouse position, it returns the selected frame for FRAME and nil for X and Y. @@ -1477,7 +1478,8 @@ DEFUN ("mouse-pixel-position", Fmouse_pixel_position, Smouse_pixel_position, 0, 0, 0, doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position. The position is given in pixel units, where (0, 0) is the -upper-left corner. +upper-left corner of the frame, X is the horizontal offset, and Y is +the vertical offset. If Emacs is running on a mouseless terminal or hasn't been programmed to read the mouse position, it returns the selected frame for FRAME and nil for X and Y. */) @@ -1510,6 +1512,10 @@ Coordinates are relative to the frame, not a window, so the coordinates of the top left character in the frame may be nonzero due to left-hand scroll bars or the menu bar. +The position is given in character cells, where (0, 0) is the +upper-left corner of the frame, X is the horizontal offset, and Y is +the vertical offset. + This function is a no-op for an X frame that is not visible. If you have just created a frame, you must wait for it to become visible before calling this function on it, like this. @@ -1542,6 +1548,9 @@ before calling this function on it, like this. DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position, Sset_mouse_pixel_position, 3, 3, 0, doc: /* Move the mouse pointer to pixel position (X,Y) in FRAME. +The position is given in pixels, where (0, 0) is the upper-left corner +of the frame, X is the horizontal offset, and Y is the vertical offset. + Note, this is a no-op for an X frame that is not visible. If you have just created a frame, you must wait for it to become visible before calling this function on it, like this. From 5bfef96c0fc21d566a752a2c0fbd512811b7c84e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 12:00:30 +0000 Subject: [PATCH 189/361] (Saving Emacs Sessions): Clarify when desktop is restored on startup. --- man/misc.texi | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/man/misc.texi b/man/misc.texi index 6f6d448bc7d..33c85a9fc8b 100644 --- a/man/misc.texi +++ b/man/misc.texi @@ -1999,9 +1999,10 @@ subsequent Emacs sessions reload the saved desktop. @vindex desktop-save-mode You can save the desktop manually with the command @kbd{M-x desktop-save}. You can also enable automatic desktop saving when -you exit Emacs: use the Customization buffer (@pxref{Easy -Customization}) to set @code{desktop-save-mode} to @code{t} for future -sessions, or add this line in your @file{~/.emacs} file: +you exit Emacs and its restoring when Emacs starts: use the +Customization buffer (@pxref{Easy Customization}) to set +@code{desktop-save-mode} to @code{t} for future sessions, or add this +line in your @file{~/.emacs} file: @example (desktop-save-mode 1) @@ -2009,7 +2010,8 @@ sessions, or add this line in your @file{~/.emacs} file: @findex desktop-change-dir @findex desktop-revert - When Emacs starts, it looks for a saved desktop in the current + If you turn on @code{desktop-save-mode} in your @file{~/.emacs}, +then when Emacs starts, it looks for a saved desktop in the current directory. Thus, you can have separate saved desktops in different directories, and the starting directory determines which one Emacs reloads. You can save the current desktop and reload one saved in @@ -2018,7 +2020,10 @@ another directory by typing @kbd{M-x desktop-change-dir}. Typing Specify the option @samp{--no-desktop} on the command line when you don't want it to reload any saved desktop. This turns off -@code{desktop-save-mode} for the current session. +@code{desktop-save-mode} for the current session. Starting Emacs with +the @samp{--no-init-file} option also disables desktop reloading, +since it bypasses the @file{.emacs} init file, where +@code{desktop-save-mode} is usually turned on. @vindex desktop-restore-eager By default, all the buffers in the desktop are restored at one go. From c97f19653b493b272845daf68798c3e96ad6f3d1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 12:04:04 +0000 Subject: [PATCH 190/361] Clarify that bootstrap and the shorter procedure are alternatives. --- INSTALL.CVS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL.CVS b/INSTALL.CVS index ce3fa9f2627..3716930eccc 100644 --- a/INSTALL.CVS +++ b/INSTALL.CVS @@ -12,8 +12,8 @@ The bootstrap process makes sure all necessary files are rebuilt before it builds the final Emacs binary. Normally, it is not necessary to use "make bootstrap" after every CVS -update. Unless there are problems, we suggest the following -procedure: +update. Unless there are problems, we suggest to use the following +alternative procedure, after you did "make bootstrap" at least once: $ ./configure $ make From 48bd8440bc61d1d994f6139735270b1e7ca37035 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 12:33:32 +0000 Subject: [PATCH 191/361] (allout-prior-bindings, allout-added-bindings): Remove, after long deprecation. (allout-beginning-of-line-cycles, allout-end-of-line-cycles): Add customization vars controlling allout-beginning-of-line and allout-end-of-line conveniences. (allout-header-prefix, allout-use-mode-specific-leader) (allout-use-mode-specific-leader, allout-mode-leaders): Revised docstrings. (allout-infer-header-lead): Change to be an alias for allout-infer-header-lead-and-primary-bullet. (allout-infer-header-lead-and-primary-bullet): New version of allout-infer-header-lead which assigns the primary bullet to the same as the header lead, when its being changed. (allout-infer-body-reindent): Apply regexp-quote instead of unconditionally prepending "\\", so that all literal allout-header-prefix and allout-primary-bullet strings are properly handled. (allout-add-resumptions): Add optional qualifier for extending or appending to existing values, rather than replacing them. (allout-view-change-hook): Clarify docstring. (allout-exposure-change-hook): Take explicit arguments, via run-hook-with-args. (allout-structure-added-hook, allout-structure-deleted-hook) (allout-structure-shifted-hook): New hooks analogous to allout-exposure-change-hook for other kinds of structural outline edits. (allout-encryption-plaintext-sanitization-regexps): New encryption customization variable, by which cooperating modes can provde massage of the plaintext without actually being passed it. (allout-encryption-ciphertext-rejection-regexps) (allout-encryption-ciphertext-rejection-ceiling): New encryption customization variables, by which cooperating modes can prohibit rare but possible ciphertext patterns from fouling their operation, with actually being passed the ciphertext. (allout-mode): Run activation and deactivation hooks after the minor-mode variable has been toggled, to clarify the mode disposition. The new encryption ciphertext rejection variable is used to ensure that the ciphertext does not contain text that would be recognized as outline structural elements by allout. Substite allout-beginning-of-line and allout-end-of-line for conventionall beginning-of-line and end-of-line bindings. If allout-old-style-prefixes is non-nil, don't nullify it on mode activation! (allout-beginning-of-line): Respect `allout-beginning-of-line-cycles'. (allout-end-of-line): Respect `allout-end-of-line-cycles'. (allout-chart-subtree): Implement new mode, charting only the visible items in the subtree, when new 'visible' parameter is non-nil. (allout-end-of-subtree): Properly handle the last item in the buffer. (allout-pre-command-business, allout-command-counter): Increment an advertised counter so that cooperating enhancements can track revisions of items. (allout-open-topic): Run allout-structure-added-hook with suitable arguments. (allout-shift-in): Run allout-structure-shifted-hook with suitable arguments. (allout-shift-out): Fix doubling for negative args and ensure call of allout-structure-shifted-hook by solely using allout-shift-in. (allout-kill-line, allout-kill-topic): Run allout-structure-deleted-hook with suitable arguments. (allout-yank-processing): Run allout-structure-added-hook with proper arguments. (allout-yank): Enclose activity in allout-unprotected. (allout-flag-region): Run allout-exposure-change-hook with suitable arguments, instead of making the callee infer the arguments. (allout-encrypt-string): Support allout-encryption-plaintext-sanitization-regexps, allout-encryption-ciphertext-rejection-regexps, and allout-encryption-ciphertext-rejection-ceiling. Indicate correct en/decryption mode in symmetric encryption failure message. (allout-obtain-passphrase): Use copy-sequence to get a distinct copy of the passphrase, and don't zero it or we'll corrupt the stashed copy. (allout-create-encryption-passphrase-verifier) (allout-verify-passphrase): Respect the new signature for allout-encrypt-string. (allout-get-configvar-values): Convenience for getting a configuration variable value and handling its absence gracefully. --- lisp/allout.el | 811 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 571 insertions(+), 240 deletions(-) diff --git a/lisp/allout.el b/lisp/allout.el index f1f262c70b7..379f664d092 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -213,15 +213,73 @@ just the header." (put 'allout-show-bodies 'safe-local-variable (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil))))) +;;;_ = allout-beginning-of-line-cycles +(defcustom allout-beginning-of-line-cycles t + "*If non-nil, \\[allout-beginning-of-line] will cycle through smart-placement options. + +Cycling only happens on when the command is repeated, not when it +follows a different command. + +Smart-placement means that repeated calls to this function will +advance as follows: + + - if the cursor is on a non-headline body line and not on the first column: + then it goes to the first column + - if the cursor is on the first column of a non-headline body line: + then it goes to the start of the headline within the item body + - if the cursor is on the headline and not the start of the headline: + then it goes to the start of the headline + - if the cursor is on the start of the headline: + then it goes to the bullet character \(for hotspot navigation\) + - if the cursor is on the bullet character: + then it goes to the first column of that line \(the headline\) + - if the cursor is on the first column of the headline: + then it goes to the start of the headline within the item body. + +In this fashion, you can use the beginning-of-line command to do +its normal job and then, when repeated, advance through the +entry, cycling back to start. + +If this configuration variable is nil, then the cursor is just +advanced to the beginning of the line and remains there on +repeated calls." + :type 'boolean :group 'allout) +;;;_ = allout-end-of-line-cycles +(defcustom allout-end-of-line-cycles t + "*If non-nil, \\[allout-end-of-line] will cycle through smart-placement options. + +Cycling only happens on when the command is repeated, not when it +follows a different command. + +Smart-placement means that repeated calls to this function will +advance as follows: + + - if the cursor is not on the end-of-line, + then it goes to the end-of-line + - if the cursor is on the end-of-line but not the end-of-entry, + then it goes to the end-of-entry, exposing it if necessary + - if the cursor is on the end-of-entry, + then it goes to the end of the head line + +In this fashion, you can use the end-of-line command to do its +normal job and then, when repeated, advance through the entry, +cycling back to start. + +If this configuration variable is nil, then the cursor is just +advanced to the end of the line and remains there on repeated +calls." + :type 'boolean :group 'allout) + ;;;_ = allout-header-prefix (defcustom allout-header-prefix "." +;; this string is treated as literal match. it will be `regexp-quote'd, so +;; one cannot use regular expressions to match varying header prefixes. "*Leading string which helps distinguish topic headers. Outline topic header lines are identified by a leading topic header prefix, which mostly have the value of this var at their front. -\(Level 1 topics are exceptions. They consist of only a single -character, which is typically set to the `allout-primary-bullet'. Many -outlines start at level 2 to avoid this discrepancy." +Level 1 topics are exceptions. They consist of only a single +character, which is typically set to the `allout-primary-bullet'." :type 'string :group 'allout) (make-variable-buffer-local 'allout-header-prefix) @@ -300,11 +358,13 @@ strings." (defcustom allout-use-mode-specific-leader t "*When non-nil, use mode-specific topic-header prefixes. -Allout outline mode will use the mode-specific `allout-mode-leaders' -and/or comment-start string, if any, to lead the topic prefix string, -so topic headers look like comments in the programming language. +Allout outline mode will use the mode-specific `allout-mode-leaders' or +comment-start string, if any, to lead the topic prefix string, so topic +headers look like comments in the programming language. It will also use +the comment-start string, with an '_' appended, for `allout-primary-bullet'. -String values are used as they stand. +String values are used as literals, not regular expressions, so +do not escape any regulare-expression characters. Value t means to first check for assoc value in `allout-mode-leaders' alist, then use comment-start string, if any, then use default \(`.'). @@ -313,15 +373,17 @@ alist, then use comment-start string, if any, then use default \(`.'). Set to the symbol for either of `allout-mode-leaders' or `comment-start' to use only one of them, respectively. -Value nil means to always use the default \(`.'). +Value nil means to always use the default \(`.') and leave +`allout-primary-bullet' unaltered. -comment-start strings that do not end in spaces are tripled, and an -`_' underscore is tacked on the end, to distinguish them from regular -comment strings. comment-start strings that do end in spaces are not -tripled, but an underscore is substituted for the space. [This -presumes that the space is for appearance, not comment syntax. You -can use `allout-mode-leaders' to override this behavior, when -incorrect.]" +comment-start strings that do not end in spaces are tripled in +the header-prefix, and an `_' underscore is tacked on the end, to +distinguish them from regular comment strings. comment-start +strings that do end in spaces are not tripled, but an underscore +is substituted for the space. [This presumes that the space is +for appearance, not comment syntax. You can use +`allout-mode-leaders' to override this behavior, when +undesired.]" :type '(choice (const t) (const nil) string (const allout-mode-leaders) (const comment-start)) @@ -334,13 +396,14 @@ incorrect.]" (defvar allout-mode-leaders '() "Specific allout-prefix leading strings per major modes. -Entries will be used instead or in lieu of mode-specific -comment-start strings. See also `allout-use-mode-specific-leader'. +Use this if the mode's comment-start string isn't what you +prefer, or if the mode lacks a comment-start string. See +`allout-use-mode-specific-leader' for more details. If you're constructing a string that will comment-out outline structuring so it can be included in program code, append an extra character, like an \"_\" underscore, to distinguish the lead string -from regular comments that start at bol.") +from regular comments that start at the beginning-of-line.") ;;;_ = allout-old-style-prefixes (defcustom allout-old-style-prefixes nil @@ -828,9 +891,9 @@ language comments. Returns the leading string." (setq allout-reindent-bodies nil) (allout-reset-header-lead header-lead) header-lead) -;;;_ > allout-infer-header-lead () -(defun allout-infer-header-lead () - "Determine appropriate `allout-header-prefix'. +;;;_ > allout-infer-header-lead-and-primary-bullet () +(defun allout-infer-header-lead-and-primary-bullet () + "Determine appropriate `allout-header-prefix' and `allout-primary-bullet'. Works according to settings of: @@ -874,10 +937,14 @@ invoking it directly." "_"))))))) (if (not leader) nil - (if (string= leader allout-header-prefix) - nil ; no change, nothing to do. - (setq allout-header-prefix leader) - allout-header-prefix)))) + (setq allout-header-prefix leader) + (if (not allout-old-style-prefixes) + ;; setting allout-primary-bullet makes the top level topics use - + ;; actually, be - the special prefix: + (setq allout-primary-bullet leader)) + allout-header-prefix))) +(defalias 'allout-infer-header-lead + 'allout-infer-header-lead-and-primary-bullet) ;;;_ > allout-infer-body-reindent () (defun allout-infer-body-reindent () "Determine proper setting for `allout-reindent-bodies'. @@ -930,13 +997,13 @@ Works with respect to `allout-plain-bullets-string' and (setq allout-plain-bullets-string-len (length allout-plain-bullets-string)) (setq allout-header-subtraction (1- (length allout-header-prefix))) ;; Produce the new allout-regexp: - (setq allout-regexp (concat "\\(\\" - allout-header-prefix - "[ \t]*[" - allout-bullets-string - "]\\)\\|\\" - allout-primary-bullet - "+\\|\^l")) + (setq allout-regexp (concat "\\(" + (regexp-quote allout-header-prefix) + "[ \t]*[" + allout-bullets-string + "]\\)\\|" + (regexp-quote allout-primary-bullet) + "+\\|\^l")) (setq allout-line-boundary-regexp (concat "\\(\n\\)\\(" allout-regexp "\\)")) (setq allout-bob-regexp @@ -965,16 +1032,6 @@ See doc string for allout-keybindings-list for format of binding list." (car (cdr cell))))))) keymap-list) map)) -;;;_ = allout-prior-bindings - being deprecated. -(defvar allout-prior-bindings nil - "Variable for use in V18, with allout-added-bindings, for -resurrecting, on mode deactivation, bindings that existed before -activation. Being deprecated.") -;;;_ = allout-added-bindings - being deprecated -(defvar allout-added-bindings nil - "Variable for use in V18, with allout-prior-bindings, for -resurrecting, on mode deactivation, bindings that existed before -activation. Being deprecated.") ;;;_ : Menu bar (defvar allout-mode-exposure-menu) (defvar allout-mode-editing-menu) @@ -1050,43 +1107,65 @@ See `allout-add-resumptions' and `allout-do-resumptions'.") (make-variable-buffer-local 'allout-mode-prior-settings) ;;;_ > allout-add-resumptions (&rest pairs) (defun allout-add-resumptions (&rest pairs) - "Set name/value pairs. + "Set name/value PAIRS. Old settings are preserved for later resumption using `allout-do-resumptions'. +The new values are set as a buffer local. On resumption, the prior buffer +scope of the variable is restored along with its value. If it was a void +buffer-local value, then it is left as nil on resumption. + The pairs are lists whose car is the name of the variable and car of the -cdr is the new value: '(some-var some-value)'. +cdr is the new value: '(some-var some-value)'. The pairs can actually be +triples, where the third element qualifies the disposition of the setting, +as described further below. -The new value is set as a buffer local. +If the optional third element is the symbol 'extend, then the new value +created by `cons'ing the second element of the pair onto the front of the +existing value. -If the variable was not previously buffer-local, then that is noted and the -`allout-do-resumptions' will just `kill-local-variable' of that binding. +If the optional third element is the symbol 'append, then the new value is +extended from the existing one by `append'ing a list containing the second +element of the pair onto the end of the existing value. -If it previously was buffer-local, the old value is noted and resurrected -by `allout-do-resumptions'. \(If the local value was previously void, then -it is left as nil on resumption.\) +Extension, and resumptions in general, should not be used for hook +functions - use the 'local mode of `add-hook' for that, instead. The settings are stored on `allout-mode-prior-settings'." (while pairs (let* ((pair (pop pairs)) (name (car pair)) - (value (cadr pair))) + (value (cadr pair)) + (qualifier (if (> (length pair) 2) + (caddr pair))) + prior-value) (if (not (symbolp name)) (error "Pair's name, %S, must be a symbol, not %s" name (type-of name))) + (setq prior-value (condition-case err + (symbol-value name) + (void-variable nil))) (when (not (assoc name allout-mode-prior-settings)) ;; Not already added as a resumption, create the prior setting entry. (if (local-variable-p name) ;; is already local variable - preserve the prior value: - (push (list name (condition-case err - (symbol-value name) - (void-variable nil))) - allout-mode-prior-settings) + (push (list name prior-value) allout-mode-prior-settings) ;; wasn't local variable, indicate so for resumption by killing ;; local value, and make it local: (push (list name) allout-mode-prior-settings) (make-local-variable name))) - (set name value)))) + (if qualifier + (cond ((eq qualifier 'extend) + (if (not (listp prior-value)) + (error "extension of non-list prior value attempted") + (set name (cons value prior-value)))) + ((eq qualifier 'append) + (if (not (listp prior-value)) + (error "appending of non-list prior value attempted") + (set name (append prior-value (list value))))) + (t (error "unrecognized setting qualifier `%s' encountered" + qualifier))) + (set name value))))) ;;;_ > allout-do-resumptions () (defun allout-do-resumptions () "Resume all name/value settings registered by `allout-add-resumptions'. @@ -1121,18 +1200,67 @@ their settings before allout-mode was started." "Symbol for use as allout invisible-text overlay category.") ;;;_ x allout-view-change-hook (defvar allout-view-change-hook nil - "*\(Deprecated\) Hook that's run after allout outline exposure changes. + "*\(Deprecated\) A hook run after allout outline exposure changes. -Switch to using `allout-exposure-change-hook' instead. Both -variables are currently respected, but this one will be ignored -in a subsequent allout version.") +Switch to using `allout-exposure-change-hook' instead. Both hooks are +currently respected, but the other conveys the details of the exposure +change via explicit parameters, and this one will eventually be disabled in +a subsequent allout version.") ;;;_ = allout-exposure-change-hook (defvar allout-exposure-change-hook nil - "*Hook that's run after allout outline exposure changes. + "*Hook that's run after allout outline subtree exposure changes. -This variable will replace `allout-view-change-hook' in a subsequent allout -version, though both are currently respected.") +It is run at the conclusion of `allout-flag-region'. +Functions on the hook must take three arguments: + + - from - integer indicating the point at the start of the change. + - to - integer indicating the point of the end of the change. + - flag - change mode: nil for exposure, otherwise concealment. + +This hook might be invoked multiple times by a single command. + +This hook is replacing `allout-view-change-hook', which is being deprecated +and eventually will not be invoked.") +;;;_ = allout-structure-added-hook +(defvar allout-structure-added-hook nil + "*Hook that's run after addition of items to the outline. + +Functions on the hook should take two arguments: + + - new-start - integer indicating the point at the start of the first new item. + - new-end - integer indicating the point of the end of the last new item. + +Some edits that introduce new items may missed by this hook - +specifically edits that native allout routines do not control. + +This hook might be invoked multiple times by a single command.") +;;;_ = allout-structure-deleted-hook +(defvar allout-structure-deleted-hook nil + "*Hook that's run after disciplined deletion of subtrees from the outline. + +Functions on the hook must take two arguments: + + - depth - integer indicating the depth of the subtree that was deleted. + - removed-from - integer indicating the point where the subtree was removed. + +Some edits that remove or invalidate items may missed by this hook - +specifically edits that native allout routines do not control. + +This hook might be invoked multiple times by a single command.") +;;;_ = allout-structure-shifted-hook +(defvar allout-structure-shifted-hook nil + "*Hook that's run after shifting of items in the outline. + +Functions on the hook should take two arguments: + + - depth-change - integer indicating depth increase, negative for decrease + - start - integer indicating the start point of the shifted parent item. + +Some edits that shift items can be missed by this hook - specifically edits +that native allout routines do not control. + +This hook might be invoked multiple times by a single command.") ;;;_ = allout-outside-normal-auto-fill-function (defvar allout-outside-normal-auto-fill-function nil "Value of normal-auto-fill-function outside of allout mode. @@ -1186,6 +1314,42 @@ state, if file variable adjustments are enabled. See This is used to decrypt the topic that was currently being edited, if it was encrypted automatically as part of a file write or autosave.") (make-variable-buffer-local 'allout-after-save-decrypt) +;;;_ = allout-encryption-plaintext-sanitization-regexps +(defvar allout-encryption-plaintext-sanitization-regexps nil + "List of regexps whose matches are removed from plaintext before encryption. + +This is for the sake of removing artifacts, like escapes, that are added on +and not actually part of the original plaintext. The removal is done just +prior to encryption. + +Entries must be symbols that are bound to the desired values. + +Each value can be a regexp or a list with a regexp followed by a +substitution string. If it's just a regexp, all its matches are removed +before the text is encrypted. If it's a regexp and a substitution, the +substition is used against the regexp matches, a la `replace-match'.") +(make-variable-buffer-local 'allout-encryption-text-removal-regexps) +;;;_ = allout-encryption-ciphertext-rejection-regexps +(defvar allout-encryption-ciphertext-rejection-regexps nil + "Variable for regexps matching plaintext to remove before encryption. + +This is for the sake of redoing encryption in cases where the ciphertext +incidentally contains strings that would disrupt mode operation - +for example, a line that happens to look like an allout-mode topic prefix. + +Entries must be symbols that are bound to the desired regexp values. + +The encryption will be retried up to +`allout-encryption-ciphertext-rejection-limit' times, after which an error +is raised.") + +(make-variable-buffer-local 'allout-encryption-ciphertext-rejection-regexps) +;;;_ = allout-encryption-ciphertext-rejection-ceiling +(defvar allout-encryption-ciphertext-rejection-ceiling 5 + "Limit on number of times encryption ciphertext is rejected. + +See `allout-encryption-ciphertext-rejection-regexps' for rejection reasons.") +(make-variable-buffer-local 'allout-encryption-ciphertext-rejection-ceiling) ;;;_ > allout-mode-p () ;; Must define this macro above any uses, or byte compilation will lack ;; proper def, if file isn't loaded - eg, during emacs build! @@ -1637,16 +1801,15 @@ OPEN: A topic that is not closed, though its offspring or body may be." (remove-overlays (point-min) (point-max) 'category 'allout-exposure-category) - (run-hooks 'allout-mode-deactivate-hook) - (setq allout-mode nil)) + (setq allout-mode nil) + (run-hooks 'allout-mode-deactivate-hook)) ;; Activation: ((not active) (setq allout-explicitly-deactivated nil) (if allout-old-style-prefixes ;; Inhibit all the fancy formatting: - (allout-add-resumptions '((allout-primary-bullet "*") - (allout-old-style-prefixes ())))) + (allout-add-resumptions '(allout-primary-bullet "*"))) (allout-overlay-preparations) ; Doesn't hurt to redo this. @@ -1654,15 +1817,28 @@ OPEN: A topic that is not closed, though its offspring or body may be." (allout-infer-body-reindent) (set-allout-regexp) + (allout-add-resumptions + '(allout-encryption-ciphertext-rejection-regexps + allout-line-boundary-regexp + extend) + '(allout-encryption-ciphertext-rejection-regexps + allout-bob-regexp + extend)) ;; Produce map from current version of allout-keybindings-list: (setq allout-mode-map (produce-allout-mode-map allout-keybindings-list)) (substitute-key-definition 'beginning-of-line - 'move-beginning-of-line + 'allout-beginning-of-line + allout-mode-map global-map) + (substitute-key-definition 'move-beginning-of-line + 'allout-beginning-of-line allout-mode-map global-map) (substitute-key-definition 'end-of-line - 'move-end-of-line + 'allout-end-of-line + allout-mode-map global-map) + (substitute-key-definition 'move-end-of-line + 'allout-end-of-line allout-mode-map global-map) (produce-allout-mode-menubar-entries) (fset 'allout-mode-map allout-mode-map) @@ -1717,8 +1893,8 @@ OPEN: A topic that is not closed, though its offspring or body may be." (if allout-layout (setq do-layout t)) - (run-hooks 'allout-mode-hook) - (setq allout-mode t)) + (setq allout-mode t) + (run-hooks 'allout-mode-hook)) ;; Reactivation: ((setq do-layout t) @@ -2044,6 +2220,52 @@ Outermost is first." (while (allout-hidden-p) (end-of-line) (if (allout-hidden-p) (forward-char 1))))) +;;;_ > allout-beginning-of-line () +(defun allout-beginning-of-line () + "Beginning-of-line with `allout-beginning-of-line-cycles' behavior, if set." + + (interactive) + + (if (or (not allout-beginning-of-line-cycles) + (not (equal last-command this-command))) + (move-beginning-of-line 1) + (let ((beginning-of-body (save-excursion + (allout-beginning-of-current-entry) + (point)))) + (cond ((= (current-column) 0) + (allout-beginning-of-current-entry)) + ((< (point) beginning-of-body) + (allout-beginning-of-current-line)) + ((= (point) beginning-of-body) + (goto-char (allout-current-bullet-pos))) + (t (allout-beginning-of-current-line) + (if (< (point) beginning-of-body) + ;; we were on the headline after its start: + (allout-beginning-of-current-entry))))))) +;;;_ > allout-end-of-line () +(defun allout-end-of-line () + "End-of-line with `allout-end-of-line-cycles' behavior, if set." + + (interactive) + + (if (or (not allout-end-of-line-cycles) + (not (equal last-command this-command))) + (allout-end-of-current-line) + (let ((end-of-entry (save-excursion + (allout-end-of-entry) + (point)))) + (cond ((not (eolp)) + (allout-end-of-current-line)) + ((or (allout-hidden-p) (save-excursion + (forward-char -1) + (allout-hidden-p))) + (allout-back-to-current-heading) + (allout-show-current-entry) + (allout-end-of-entry)) + ((>= (point) end-of-entry) + (allout-back-to-current-heading) + (allout-end-of-current-line)) + (t (allout-end-of-entry)))))) ;;;_ > allout-next-heading () (defsubst allout-next-heading () "Move to the heading for the topic \(possibly invisible) after this one. @@ -2108,13 +2330,17 @@ Return the location of the beginning of the heading, or nil if not found." ;;; for assessment or adjustment of the subtree, without redundant ;;; traversal of the structure. -;;;_ > allout-chart-subtree (&optional levels orig-depth prev-depth) -(defun allout-chart-subtree (&optional levels orig-depth prev-depth) +;;;_ > allout-chart-subtree (&optional levels visible orig-depth prev-depth) +(defun allout-chart-subtree (&optional levels visible orig-depth prev-depth) "Produce a location \"chart\" of subtopics of the containing topic. Optional argument LEVELS specifies the depth \(relative to start -depth) for the chart. Subsequent optional args are not for public -use. +depth) for the chart. + +When optional argument VISIBLE is non-nil, the chart includes +only the visible subelements of the charted subjects. + +The remaining optional args are not for internal use by the function. Point is left at the end of the subtree. @@ -2141,7 +2367,9 @@ starting point, and PREV-DEPTH is depth of prior topic." ; position to first offspring: (progn (setq orig-depth (allout-depth)) (or prev-depth (setq prev-depth (1+ orig-depth))) - (allout-next-heading))) + (if visible + (allout-next-visible-heading 1) + (allout-next-heading)))) ;; Loop over the current levels' siblings. Besides being more ;; efficient than tail-recursing over a level, it avoids exceeding @@ -2163,8 +2391,12 @@ starting point, and PREV-DEPTH is depth of prior topic." ;; next heading at lesser depth: (while (and (<= curr-depth (allout-recent-depth)) - (allout-next-heading)))) - (allout-next-heading))) + (if visible + (allout-next-visible-heading 1) + (allout-next-heading))))) + (if visible + (allout-next-visible-heading 1) + (allout-next-heading)))) ((and (< prev-depth curr-depth) (or (not levels) @@ -2173,8 +2405,9 @@ starting point, and PREV-DEPTH is depth of prior topic." (setq chart (cons (allout-chart-subtree (and levels (1- levels)) - orig-depth - curr-depth) + visible + orig-depth + curr-depth) chart)) ;; ... then continue with this one. ) @@ -2369,7 +2602,9 @@ Returns the value of point." (while (and (not (eobp)) (> (allout-recent-depth) level)) (allout-next-heading)) - (and (not (eobp)) (forward-char -1)) + (if (eobp) + (allout-end-of-entry) + (forward-char -1)) (if (and (not include-trailing-blank) (= ?\n (preceding-char))) (forward-char -1)) (setq allout-recent-end-of-subtree (point)))) @@ -2675,6 +2910,13 @@ hot-spot operation, where literal characters typed over a topic bullet are mapped to the command of the corresponding control-key on the `allout-mode-map'.") (make-variable-buffer-local 'allout-post-goto-bullet) +;;;_ = allout-command-counter +(defvar allout-command-counter 0 + "Counter that monotonically increases in allout-mode buffers. + +Set by `allout-pre-command-business', to support allout addons in +coordinating with allout activity.") +(make-variable-buffer-local 'allout-command-counter) ;;;_ > allout-post-command-business () (defun allout-post-command-business () "Outline `post-command-hook' function. @@ -2692,7 +2934,7 @@ are mapped to the command of the corresponding control-key on the allout-after-save-decrypt) (allout-after-saves-handler)) - ;; Implement -post-goto-bullet, if set: + ;; Implement allout-post-goto-bullet, if set: (if (and allout-post-goto-bullet (allout-current-bullet-pos)) (progn (goto-char (allout-current-bullet-pos)) @@ -2701,7 +2943,9 @@ are mapped to the command of the corresponding control-key on the ;;;_ > allout-pre-command-business () (defun allout-pre-command-business () "Outline `pre-command-hook' function for outline buffers. -Implements special behavior when cursor is on bullet character. + +Among other things, implements special behavior when the cursor is on the +topic bullet character. When the cursor is on the bullet character, self-insert characters are reinterpreted as the corresponding control-character in the @@ -2709,7 +2953,7 @@ reinterpreted as the corresponding control-character in the the cursor which has moved as a result of such reinterpretation is positioned on the bullet character of the destination topic. -The upshot is that you can get easy, single (ie, unmodified) key +The upshot is that you can get easy, single \(ie, unmodified\) key outline maneuvering operations by positioning the cursor on the bullet char. When in this mode you can use regular cursor-positioning command/keystrokes to relocate the cursor off of a bullet character to @@ -2717,6 +2961,9 @@ return to regular interpretation of self-insert characters." (if (not (allout-mode-p)) nil + ;; Increment allout-command-counter + (setq allout-command-counter (1+ allout-command-counter)) + ;; Do hot-spot navigation. (if (and (eq this-command 'self-insert-command) (eq (point)(allout-current-bullet-pos))) (allout-hotspot-key-handler)))) @@ -2990,6 +3237,8 @@ case.) If OFFER-RECENT-BULLET is true, offer to use the bullet of the prior sibling. +Runs + Nuances: - Creation of new topics is with respect to the visible topic @@ -3040,7 +3289,8 @@ Nuances: allout-numbered-bullet)))) (point))) dbl-space - doing-beginning) + doing-beginning + start end) (if (not opening-on-blank) ; Positioning and vertical @@ -3141,8 +3391,10 @@ Nuances: (not (bolp))) (forward-char 1)))) )) + (setq start (point)) (insert (concat (allout-make-topic-prefix opening-numbered t depth) " ")) + (setq end (1+ (point))) (allout-rebullet-heading (and offer-recent-bullet ref-bullet) depth nil nil t) @@ -3150,6 +3402,8 @@ Nuances: (save-excursion (goto-char ref-topic) (allout-show-children))) (end-of-line) + + (run-hook-with-args 'allout-structure-added-hook start end) ) ) ;;;_ > allout-open-subtopic (arg) @@ -3548,6 +3802,7 @@ discontinuity. The first topic in the file can be adjusted to any positive depth, however." (interactive "p") (if (> arg 0) + ;; refuse to create a containment discontinuity: (save-excursion (allout-back-to-current-heading) (if (not (bobp)) @@ -3564,7 +3819,20 @@ depth, however." (1+ predecessor-depth))) (error (concat "Disallowed shift deeper than" " containing topic's children."))))))) - (allout-rebullet-topic arg)) + (let ((where (point)) + has-successor) + (if (and (< arg 0) + (allout-current-topic-collapsed-p) + (save-excursion (allout-next-sibling))) + (setq has-successor t)) + (allout-rebullet-topic arg) + (when (< arg 0) + (save-excursion + (if (allout-ascend) + (allout-show-children))) + (if has-successor + (allout-show-children))) + (run-hook-with-args 'allout-structure-shifted-hook arg where))) ;;;_ > allout-shift-out (arg) (defun allout-shift-out (arg) "Decrease depth of current heading and any topics collapsed within it. @@ -3574,9 +3842,7 @@ one level greater than the immediately previous topic, to avoid containment discontinuity. The first topic in the file can be adjusted to any positive depth, however." (interactive "p") - (if (< arg 0) - (allout-shift-in (* arg -1))) - (allout-rebullet-topic (* arg -1))) + (allout-shift-in (* arg -1))) ;;;_ : Surgery (kill-ring) functions with special provisions for outlines: ;;;_ > allout-kill-line (&optional arg) (defun allout-kill-line (&optional arg) @@ -3610,7 +3876,8 @@ depth, however." (save-excursion ; Renumber subsequent topics if needed: (if (not (looking-at allout-regexp)) (allout-next-heading)) - (allout-renumber-to-depth depth)))))) + (allout-renumber-to-depth depth))) + (run-hook-with-args 'allout-structure-deleted-hook depth (point))))) ;;;_ > allout-kill-topic () (defun allout-kill-topic () "Kill topic together with subtopics. @@ -3656,7 +3923,8 @@ when yank with allout-yank into an outline as a heading." (allout-unprotected (kill-region beg (point))) (sit-for 0) (save-excursion - (allout-renumber-to-depth depth)))) + (allout-renumber-to-depth depth)) + (run-hook-with-args 'allout-structure-deleted-hook depth (point)))) ;;;_ > allout-yank-processing () (defun allout-yank-processing (&optional arg) @@ -3683,112 +3951,113 @@ however, are left exactly like normal, non-allout-specific yanks." ; region around subject: (if (< (allout-mark-marker t) (point)) (exchange-point-and-mark)) - (let* ((inhibit-field-text-motion t) - (subj-beg (point)) - (into-bol (bolp)) - (subj-end (allout-mark-marker t)) - (was-collapsed (get-text-property subj-beg 'allout-was-collapsed)) - ;; 'resituate' if yanking an entire topic into topic header: - (resituate (and (allout-e-o-prefix-p) - (looking-at (concat "\\(" allout-regexp "\\)")) - (allout-prefix-data (match-beginning 1) + (allout-unprotected + (let* ((subj-beg (point)) + (into-bol (bolp)) + (subj-end (allout-mark-marker t)) + (was-collapsed (get-text-property subj-beg 'allout-was-collapsed)) + ;; 'resituate' if yanking an entire topic into topic header: + (resituate (and (allout-e-o-prefix-p) + (looking-at (concat "\\(" allout-regexp "\\)")) + (allout-prefix-data (match-beginning 1) (match-end 1)))) - ;; `rectify-numbering' if resituating (where several topics may - ;; be resituating) or yanking a topic into a topic slot (bol): - (rectify-numbering (or resituate - (and into-bol (looking-at allout-regexp))))) - (if resituate + ;; `rectify-numbering' if resituating (where several topics may + ;; be resituating) or yanking a topic into a topic slot (bol): + (rectify-numbering (or resituate + (and into-bol (looking-at allout-regexp))))) + (if resituate ; The yanked stuff is a topic: - (let* ((prefix-len (- (match-end 1) subj-beg)) - (subj-depth (allout-recent-depth)) - (prefix-bullet (allout-recent-bullet)) - (adjust-to-depth - ;; Nil if adjustment unnecessary, otherwise depth to which - ;; adjustment should be made: - (save-excursion - (and (goto-char subj-end) - (eolp) - (goto-char subj-beg) - (and (looking-at allout-regexp) - (progn - (beginning-of-line) - (not (= (point) subj-beg))) - (looking-at allout-regexp) - (allout-prefix-data (match-beginning 0) + (let* ((prefix-len (- (match-end 1) subj-beg)) + (subj-depth (allout-recent-depth)) + (prefix-bullet (allout-recent-bullet)) + (adjust-to-depth + ;; Nil if adjustment unnecessary, otherwise depth to which + ;; adjustment should be made: + (save-excursion + (and (goto-char subj-end) + (eolp) + (goto-char subj-beg) + (and (looking-at allout-regexp) + (progn + (beginning-of-line) + (not (= (point) subj-beg))) + (looking-at allout-regexp) + (allout-prefix-data (match-beginning 0) (match-end 0))) - (allout-recent-depth)))) - (more t)) - (setq rectify-numbering allout-numbered-bullet) - (if adjust-to-depth + (allout-recent-depth)))) + (more t)) + (setq rectify-numbering allout-numbered-bullet) + (if adjust-to-depth ; Do the adjustment: - (progn - (message "... yanking") (sit-for 0) - (save-restriction - (narrow-to-region subj-beg subj-end) + (progn + (message "... yanking") (sit-for 0) + (save-restriction + (narrow-to-region subj-beg subj-end) ; Trim off excessive blank ; line at end, if any: - (goto-char (point-max)) - (if (looking-at "^$") - (allout-unprotected (delete-char -1))) + (goto-char (point-max)) + (if (looking-at "^$") + (allout-unprotected (delete-char -1))) ; Work backwards, with each ; shallowest level, ; successively excluding the ; last processed topic from ; the narrow region: - (while more - (allout-back-to-current-heading) + (while more + (allout-back-to-current-heading) ; go as high as we can in each bunch: - (while (allout-ascend-to-depth (1- (allout-depth)))) - (save-excursion - (allout-rebullet-topic-grunt (- adjust-to-depth + (while (allout-ascend-to-depth (1- (allout-depth)))) + (save-excursion + (allout-rebullet-topic-grunt (- adjust-to-depth subj-depth)) - (allout-depth)) - (if (setq more (not (bobp))) - (progn (widen) - (forward-char -1) - (narrow-to-region subj-beg (point)))))) - (message "") - ;; Preserve new bullet if it's a distinctive one, otherwise - ;; use old one: - (if (string-match (regexp-quote prefix-bullet) - allout-distinctive-bullets-string) + (allout-depth)) + (if (setq more (not (bobp))) + (progn (widen) + (forward-char -1) + (narrow-to-region subj-beg (point)))))) + (message "") + ;; Preserve new bullet if it's a distinctive one, otherwise + ;; use old one: + (if (string-match (regexp-quote prefix-bullet) + allout-distinctive-bullets-string) ; Delete from bullet of old to ; before bullet of new: - (progn - (beginning-of-line) - (delete-region (point) subj-beg) - (set-marker (allout-mark-marker t) subj-end) - (goto-char subj-beg) - (allout-end-of-prefix)) + (progn + (beginning-of-line) + (delete-region (point) subj-beg) + (set-marker (allout-mark-marker t) subj-end) + (goto-char subj-beg) + (allout-end-of-prefix)) ; Delete base subj prefix, ; leaving old one: - (delete-region (point) (+ (point) - prefix-len - (- adjust-to-depth subj-depth))) + (delete-region (point) (+ (point) + prefix-len + (- adjust-to-depth subj-depth))) ; and delete residual subj ; prefix digits and space: - (while (looking-at "[0-9]") (delete-char 1)) - (if (looking-at " ") (delete-char 1)))) - (exchange-point-and-mark)))) - (if rectify-numbering - (progn - (save-excursion + (while (looking-at "[0-9]") (delete-char 1)) + (if (looking-at " ") (delete-char 1)))) + (exchange-point-and-mark)))) + (if rectify-numbering + (progn + (save-excursion ; Give some preliminary feedback: - (message "... reconciling numbers") (sit-for 0) + (message "... reconciling numbers") (sit-for 0) ; ... and renumber, in case necessary: - (goto-char subj-beg) - (if (allout-goto-prefix) - (allout-rebullet-heading nil ;;; solicit + (goto-char subj-beg) + (if (allout-goto-prefix) + (allout-rebullet-heading nil ;;; solicit (allout-depth) ;;; depth - nil ;;; number-control - nil ;;; index + nil ;;; number-control + nil ;;; index t)) - (message "")))) - (when (and (or into-bol resituate) was-collapsed) - (remove-text-properties subj-beg (1+ subj-beg) '(allout-was-collapsed)) - (allout-hide-current-subtree)) - (if (not resituate) - (exchange-point-and-mark)))) + (message "")))) + (when (and (or into-bol resituate) was-collapsed) + (remove-text-properties subj-beg (1+ subj-beg) '(allout-was-collapsed)) + (allout-hide-current-subtree)) + (if (not resituate) + (exchange-point-and-mark)) + (run-hook-with-args 'allout-structure-added-hook subj-beg subj-end)))) ;;;_ > allout-yank (&optional arg) (defun allout-yank (&optional arg) "`allout-mode' yank, with depth and numbering adjustment of yanked topics. @@ -3820,10 +4089,10 @@ works with normal `yank' in non-outline buffers." (interactive "*P") (setq this-command 'yank) - (yank arg) + (allout-unprotected + (yank arg)) (if (allout-mode-p) - (allout-yank-processing)) -) + (allout-yank-processing))) ;;;_ > allout-yank-pop (&optional arg) (defun allout-yank-pop (&optional arg) "Yank-pop like `allout-yank' when popping to bare outline prefixes. @@ -3882,9 +4151,13 @@ by pops to non-distinctive yanks. Bug..." ;;;_ - Fundamental ;;;_ > allout-flag-region (from to flag) (defun allout-flag-region (from to flag) - "Conceal text from FROM to TO if FLAG is non-nil, else reveal it. + "Conceal text between FROM and TO if FLAG is non-nil, else reveal it. + +Exposure-change hook `allout-exposure-change-hook' is run with the same +arguments as this function, after the exposure changes are made. \(The old +`allout-view-change-hook' is being deprecated, and eventually will not be +invoked.\)" -Text is shown if flag is nil and hidden otherwise." ;; We use outline invisibility spec. (remove-overlays from to 'category 'allout-exposure-category) (when flag @@ -3895,7 +4168,7 @@ Text is shown if flag is nil and hidden otherwise." (while props (overlay-put o (pop props) (pop props))))))) (run-hooks 'allout-view-change-hook) - (run-hooks 'allout-exposure-change-hook)) + (run-hook-with-args 'allout-exposure-change-hook from to flag)) ;;;_ > allout-flag-current-subtree (flag) (defun allout-flag-current-subtree (flag) "Conceal currently-visible topic's subtree if FLAG non-nil, else reveal it." @@ -4071,10 +4344,12 @@ true, then single-line topics are considered to be collapsed. By default, they are treated as being uncollapsed." (save-excursion (and - (= (progn (allout-back-to-current-heading) - (move-end-of-line 1) - (point)) - (allout-end-of-current-subtree (not (looking-at "\n\n")))) + ;; Is the topic all on one line (allowing for trailing blank line)? + (>= (progn (allout-back-to-current-heading) + (move-end-of-line 1) + (point)) + (allout-end-of-current-subtree (not (looking-at "\n\n")))) + (or include-single-liners (progn (backward-char 1) (allout-hidden-p)))))) ;;;_ > allout-hide-current-subtree (&optional just-close) @@ -5097,8 +5372,8 @@ See `allout-toggle-current-subtree-encryption' for more details." ;;; fetch-pass &optional retried verifying ;;; passphrase) (defun allout-encrypt-string (text decrypt allout-buffer key-type for-key - fetch-pass &optional retried verifying - passphrase) + fetch-pass &optional retried rejected + verifying passphrase) "Encrypt or decrypt message TEXT. If DECRYPT is true (default false), then decrypt instead of encrypt. @@ -5116,6 +5391,11 @@ that have been solicited in sequence leading to this current call. Optional PASSPHRASE enables explicit delivery of the decryption passphrase, for verification purposes. +Optional REJECTED is for internal use - conveys the number of +rejections due to matches against +`allout-encryption-ciphertext-rejection-regexps', as limited by +`allout-encryption-ciphertext-rejection-ceiling'. + Returns the resulting string, or nil if the transformation fails." (require 'pgg) @@ -5141,6 +5421,17 @@ Returns the resulting string, or nil if the transformation fails." target-prompt-id (or (buffer-file-name allout-buffer) target-prompt-id)))) + (strip-plaintext-regexps + (if (not decrypt) + (allout-get-configvar-values + 'allout-encryption-plaintext-sanitization-regexps))) + (reject-ciphertext-regexps + (if (not decrypt) + (allout-get-configvar-values + 'allout-encryption-ciphertext-rejection-regexps))) + (rejected (or rejected 0)) + (rejections-left (- allout-encryption-ciphertext-rejection-ceiling + rejected)) result-text status) (if (and fetch-pass (not passphrase)) @@ -5161,10 +5452,19 @@ Returns the resulting string, or nil if the transformation fails." key-type allout-buffer retried fetch-pass))) + (with-temp-buffer (insert text) + (when (and strip-plaintext-regexps (not decrypt)) + (dolist (re strip-plaintext-regexps) + (let ((re (if (listp re) (car re) re)) + (replacement (if (listp re) (cadr re) ""))) + (goto-char (point-min)) + (while (re-search-forward re nil t) + (replace-match replacement nil nil))))) + (cond ;; symmetric: @@ -5183,7 +5483,8 @@ Returns the resulting string, or nil if the transformation fails." (if verifying (throw 'encryption-failed nil) (pgg-remove-passphrase-from-cache target-cache-id t) - (error "Symmetric-cipher encryption failed - %s" + (error "Symmetric-cipher %scryption failed - %s" + (if decrypt "de" "en") "try again with different passphrase.")))) ;; encrypt 'keypair: @@ -5208,48 +5509,68 @@ Returns the resulting string, or nil if the transformation fails." (if status (pgg-situate-output (point-min) (point-max)) (error (pgg-remove-passphrase-from-cache target-cache-id t) - (error "decryption failed")))) - ) + (error "decryption failed"))))) (setq result-text (buffer-substring 1 (- (point-max) (if decrypt 0 1)))) - - ;; validate result - non-empty - (cond ((not result-text) - (if verifying - nil - ;; transform was fruitless, retry w/new passphrase. - (pgg-remove-passphrase-from-cache target-cache-id t) - (allout-encrypt-string text allout-buffer decrypt nil - (if retried (1+ retried) 1) - passphrase))) - - ;; Barf if encryption yields extraordinary control chars: - ((and (not decrypt) - (string-match "[\C-a\C-k\C-o-\C-z\C-@]" - result-text)) - (error (concat "encryption produced unusable" - " non-armored text - reconfigure!"))) - - ;; valid result and just verifying or non-symmetric: - ((or verifying (not (equal key-type 'symmetric))) - (if (or verifying decrypt) - (pgg-add-passphrase-to-cache target-cache-id - passphrase t)) - result-text) - - ;; valid result and regular symmetric - "register" - ;; passphrase with mnemonic aids/cache. - (t - (set-buffer allout-buffer) - (if passphrase - (pgg-add-passphrase-to-cache target-cache-id - passphrase t)) - (allout-update-passphrase-mnemonic-aids for-key passphrase - allout-buffer) - result-text) - ) ) + + ;; validate result - non-empty + (cond ((not result-text) + (if verifying + nil + ;; transform was fruitless, retry w/new passphrase. + (pgg-remove-passphrase-from-cache target-cache-id t) + (allout-encrypt-string text decrypt allout-buffer + key-type for-key nil + (if retried (1+ retried) 1) + rejected verifying nil))) + + ;; Retry (within limit) if ciphertext contains rejections: + ((and (not decrypt) + ;; Check for disqualification of this ciphertext: + (let ((regexps reject-ciphertext-regexps) + reject-it) + (while (and regexps (not reject-it)) + (setq reject-it (string-match (car regexps) + result-text)) + (pop regexps)) + reject-it)) + (setq rejections-left (1- rejections-left)) + (if (<= rejections-left 0) + (error (concat "Ciphertext rejected too many times" + " (%s), per `%s'") + allout-encryption-ciphertext-rejection-ceiling + 'allout-encryption-ciphertext-rejection-regexps) + (allout-encrypt-string text decrypt allout-buffer + key-type for-key nil + retried (1+ rejected) + verifying passphrase))) + ;; Barf if encryption yields extraordinary control chars: + ((and (not decrypt) + (string-match "[\C-a\C-k\C-o-\C-z\C-@]" + result-text)) + (error (concat "Encryption produced non-armored text, which" + "conflicts with allout mode - reconfigure!"))) + + ;; valid result and just verifying or non-symmetric: + ((or verifying (not (equal key-type 'symmetric))) + (if (or verifying decrypt) + (pgg-add-passphrase-to-cache target-cache-id + passphrase t)) + result-text) + + ;; valid result and regular symmetric - "register" + ;; passphrase with mnemonic aids/cache. + (t + (set-buffer allout-buffer) + (if passphrase + (pgg-add-passphrase-to-cache target-cache-id + passphrase t)) + (allout-update-passphrase-mnemonic-aids for-key passphrase + allout-buffer) + result-text) + ) ) ) ) @@ -5313,7 +5634,6 @@ of the availability of a cached copy." (pgg-read-passphrase-from-cache cache-id t))) (got-pass (or cached (pgg-read-passphrase full-prompt cache-id t))) - confirmation) (if (not got-pass) @@ -5321,14 +5641,14 @@ of the availability of a cached copy." ;; Duplicate our handle on the passphrase so it's not clobbered by ;; deactivate-passwd memory clearing: - (setq got-pass (format "%s" got-pass)) + (setq got-pass (copy-sequence got-pass)) (cond (verifier-string (save-window-excursion (if (allout-encrypt-string verifier-string 'decrypt allout-buffer 'symmetric - for-key nil 0 'verifying - got-pass) + for-key nil 0 0 'verifying + (copy-sequence got-pass)) (setq confirmation (format "%s" got-pass)))) (if (and (not confirmation) @@ -5365,15 +5685,7 @@ of the availability of a cached copy." ;; recurse to this routine: (pgg-read-passphrase prompt-sans-hint cache-id t)) (pgg-remove-passphrase-from-cache cache-id t) - (error "Confirmation failed."))) - ;; reduce opportunity for memory cherry-picking by zeroing duplicate: - (dotimes (i (length got-pass)) - (aset got-pass i 0)) - ) - ) - ) - ) - ) + (error "Confirmation failed.")))))))) ;;;_ > allout-encrypted-topic-p () (defun allout-encrypted-topic-p () "True if the current topic is encryptable and encrypted." @@ -5426,7 +5738,7 @@ An error is raised if the text is not encrypted." (dotimes (i (length spew)) (aset spew i (1+ (random 254)))) (allout-encrypt-string spew nil (current-buffer) 'symmetric - nil nil 0 passphrase)) + nil nil 0 0 passphrase)) ) ;;;_ > allout-update-passphrase-mnemonic-aids (for-key passphrase ;;; outline-buffer) @@ -5505,7 +5817,7 @@ Derived from value of `allout-passphrase-verifier-string'." allout-passphrase-verifier-string (allout-encrypt-string (allout-get-encryption-passphrase-verifier) 'decrypt allout-buffer 'symmetric - key nil 0 'verifying passphrase) + key nil 0 0 'verifying passphrase) t))) ;;;_ > allout-next-topic-pending-encryption (&optional except-mark) (defun allout-next-topic-pending-encryption (&optional except-mark) @@ -5808,6 +6120,25 @@ If BEG is bigger than END we return 0." (goto-char (1+ (match-beginning 0))) (setq count (1+ count))) count)))) +;;;_ > allout-get-configvar-values (varname) +(defun allout-get-configvar-values (configvar-name) + "Return a list of values of the symbols in list bound to CONFIGVAR-NAME. + +The user is prompted for removal of symbols that are unbound, and they +otherwise are ignored. + +CONFIGVAR-NAME should be the name of the configuration variable, +not its value." + + (let ((configvar-value (symbol-value configvar-name)) + got) + (dolist (sym configvar-value) + (if (not (boundp sym)) + (if (yes-or-no-p (format "%s entry `%s' is unbound - remove it? " + configvar-name sym)) + (delq sym (symbol-value configvar-name))) + (push (symbol-value sym) got))) + (reverse got))) ;;;_ > allout-mark-marker to accommodate divergent emacsen: (defun allout-mark-marker (&optional force buffer) "Accommodate the different signature for `mark-marker' across Emacsen. From e6b8d6628244c1978544b016006b9eac0310ef1f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 12:34:47 +0000 Subject: [PATCH 192/361] *** empty log message *** --- lisp/ChangeLog | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ man/ChangeLog | 5 +++ src/ChangeLog | 5 +++ 3 files changed, 94 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ba902ce657f..b4c654506b7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,87 @@ +2006-08-12 Ken Manheimer + + * allout.el (allout-prior-bindings, allout-added-bindings): + Remove, after long deprecation. + (allout-beginning-of-line-cycles, allout-end-of-line-cycles): + Add customization vars controlling allout-beginning-of-line and + allout-end-of-line conveniences. + (allout-header-prefix, allout-use-mode-specific-leader) + (allout-use-mode-specific-leader, allout-mode-leaders): Revised + docstrings. + (allout-infer-header-lead): Change to be an alias for + allout-infer-header-lead-and-primary-bullet. + (allout-infer-header-lead-and-primary-bullet): New version of + allout-infer-header-lead which assigns the primary bullet to the + same as the header lead, when its being changed. + (allout-infer-body-reindent): Apply regexp-quote instead of + unconditionally prepending "\\", so that all literal + allout-header-prefix and allout-primary-bullet strings are + properly handled. + (allout-add-resumptions): Add optional qualifier for extending or + appending to existing values, rather than replacing them. + (allout-view-change-hook): Clarify docstring. + (allout-exposure-change-hook): Take explicit arguments, via + run-hook-with-args. + (allout-structure-added-hook) + (allout-structure-deleted-hook) + (allout-structure-shifted-hook): New hooks analogous to + allout-exposure-change-hook for other kinds of structural outline + edits. + (allout-encryption-plaintext-sanitization-regexps): New encryption + customization variable, by which cooperating modes can provde + massage of the plaintext without actually being passed it. + (allout-encryption-ciphertext-rejection-regexps) + (allout-encryption-ciphertext-rejection-ceiling): New encryption + customization variables, by which cooperating modes can prohibit + rare but possible ciphertext patterns from fouling their + operation, with actually being passed the ciphertext. + (allout-mode): Run activation and deactivation hooks after the + minor-mode variable has been toggled, to clarify the mode + disposition. The new encryption ciphertext rejection variable is + used to ensure that the ciphertext does not contain text that + would be recognized as outline structural elements by allout. + Substite allout-beginning-of-line and allout-end-of-line for + conventionall beginning-of-line and end-of-line bindings. + If allout-old-style-prefixes is non-nil, don't nullify it on mode + activation! + (allout-beginning-of-line): Respect `allout-beginning-of-line-cycles'. + (allout-end-of-line): Respect `allout-end-of-line-cycles'. + (allout-chart-subtree): Implement new mode, charting only the + visible items in the subtree, when new 'visible' parameter is + non-nil. + (allout-end-of-subtree): Properly handle the last item in the + buffer. + (allout-pre-command-business, allout-command-counter): Increment + an advertised counter so that cooperating enhancements can track + revisions of items. + (allout-open-topic): Run allout-structure-added-hook with suitable + arguments. + (allout-shift-in): Run allout-structure-shifted-hook with suitable + arguments. + (allout-shift-out): Fix doubling for negative args and ensure call + of allout-structure-shifted-hook by solely using allout-shift-in. + (allout-kill-line, allout-kill-topic): Run + allout-structure-deleted-hook with suitable arguments. + (allout-yank-processing): Run allout-structure-added-hook with + proper arguments. + (allout-yank): Enclose activity in allout-unprotected. + (allout-flag-region): Run allout-exposure-change-hook with + suitable arguments, instead of making the callee infer the + arguments. + (allout-encrypt-string): Support + allout-encryption-plaintext-sanitization-regexps, + allout-encryption-ciphertext-rejection-regexps, and + allout-encryption-ciphertext-rejection-ceiling. Indicate correct + en/de cryption mode in symmetric encryption failure message. + (allout-obtain-passphrase): Use copy-sequence to get a distinct + copy of the passphrase, and don't zero it or we'll corrupt the + stashed copy. + (allout-create-encryption-passphrase-verifier) + (allout-verify-passphrase): Respect the new signature for + allout-encrypt-string. + (allout-get-configvar-values): Convenience for getting a + configuration variable value and handling its absence gracefully. + 2006-08-11 Romain Francoise * obsolete/zone-mode.el: Delete. diff --git a/man/ChangeLog b/man/ChangeLog index ca5ad50bacd..3aee6eeae72 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-08-12 Eli Zaretskii + + * misc.texi (Saving Emacs Sessions): Clarify when desktop is restored + on startup. + 2006-08-11 Romain Francoise * ack.texi (Acknowledgments): Delete mention to zone-mode.el. diff --git a/src/ChangeLog b/src/ChangeLog index b4016b546c0..7f0932a4206 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-12 Eli Zaretskii + + * frame.c (Fmouse_position, Fmouse_pixel_position) + (Fset_mouse_position, Fset_mouse_pixel_position): Doc fix. + 2006-08-11 Jan Dj,Ad(Brv * xselect.c (Fx_register_dnd_atom): New function. From 2d33a4790ac8139f865fa16577135c45a1420fab Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 12:38:38 +0000 Subject: [PATCH 193/361] Update the Allout entries. --- etc/NEWS | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 0a8adc534be..570db4a7656 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1993,6 +1993,7 @@ using hi-lock-mode in an initialization file will turn on Hi Lock in all buffers and no warning will be issued (for compatibility with the behavior in older versions of Emacs). +--- ** Changes in Allout *** Topic cryptography added, enabling easy gpg topic encryption and @@ -2001,11 +2002,19 @@ clear-text within a single file to your heart's content, using symmetric and/or public key modes. Time-limited key caching, user-provided symmetric key hinting and consistency verification, auto-encryption of pending topics on save, and more, make it easy to use encryption in -powerful ways. +powerful ways. Encryption behavior customization is collected in the +allout-encryption customization group. *** `allout-view-change-hook' marked as being deprecated - use -`allout-exposure-change-hook' instead. Both are currently being used, but -`allout-view-change-hook' will be ignored in a subsequent allout version. +`allout-exposure-change-hook' instead. Both are still invoked, but +`allout-view-change-hook' will eventually be ignored. The new +`allout-exposure-change-hook' is called with args that were passed to +`allout-flag-region', making it easier to use. + +*** Other allout functions which change the outline structure also have +hooks, enabling cooperative allout enhancements. See +`allout-structure-added-hook', `allout-structure-deleted-hook', and +`allout-structure-shifted-hook'. *** Default command prefix changed to "\C-c " (control-c space), to avoid intruding on user's keybinding space. Customize the @@ -2016,23 +2025,43 @@ concealed text, instead of selective-display. This simplifies the code, in particular avoiding the need for kludges for isearch dynamic-display, discretionary handling of edits of concealed text, undo concerns, etc. +*** Some previously rough topic-header format edge cases are reconciled. +Level 1 topics use the mode's comment format, and lines starting with the +asterisk - for instance, the comment close of some languages (eg, c's "*/" +or mathematica's "*)") - at the beginning of line are no longer are +interpreted as level 1 topics in those modes. (Yay!) + *** Many substantial fixes and refinements, including: - - repaired inhibition of inadvertent edits to concealed text - - repaired retention of topic body hanging indent upon topic depth shifts + - repaired regexp-quoting of custom header prefixes, so any literals + will now work (for instance, mathematica's "(*" is now properly + accepted). + - repaired inhibition of inadvertent edits to concealed text. - refuse to create "containment discontinuities", where a topic is shifted deeper than the offspring-depth of its' container - auto-fill-mode is now left inactive when allout-mode starts, if it already was inactive. also, `allout-inhibit-auto-fill' custom configuration variable makes it easy to disable auto fill in allout outlines in general or on a per-buffer basis. - - new hook `allout-mode-deactivate-hook', for coordinating with - deactivation of allout-mode. + - mode hook changes: new hook `allout-mode-deactivate-hook', for + coordinating with deactivation of allout-mode. `allout-mode-hook' is + now run after the `allout-mode' variable is changed, as is the new + `allout-mode-deactivate-hook'. + - allout now tolerates fielded text in outlines without disruption. + - hot-spot navigation now is modularized with a new function, + `allout-hotspot-key-handler', enabling easier articulation and + enhancement of the functionality by allout addons. + - topic body navigation is easier, where repeated beginning of line and + end of line key commands cycle through the actually beginning/end of + line and then beginning/end of topic, etc. see new customization vars + `allout-beginning-of-line-cycles' and `allout-end-of-line-cycles'. + - repaired retention of topic body hanging indent upon topic depth shifts - bulleting variation is simpler and more accommodating, both in the default behavior and in ability to vary when creating new topics - mode deactivation now does cleans up effectively, more properly restoring affected variables and hooks to former state, removing - overlays, etc. + overlays, etc. see `allout-add-resumptions' and + `allout-do-resumptions', which replace the old `allout-resumptions'. - included a few unit-tests for interior functionality. developers can have them automatically run at the end of module load by customizing the option `allout-run-unit-tests-on-load'. From 78e5d54902a455900943b3cb9327104cfd8f7cb4 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 12:55:07 +0000 Subject: [PATCH 194/361] (Time Parsing): Add %z to format-time-string, per docstring. Add cross reference to glibc manual for strftime. --- lispref/os.texi | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lispref/os.texi b/lispref/os.texi index 30f66889387..ab277afdce6 100644 --- a/lispref/os.texi +++ b/lispref/os.texi @@ -1256,7 +1256,9 @@ This stands for the year without century (00-99). @item %Y This stands for the year with century. @item %Z -This stands for the time zone abbreviation. +This stands for the time zone abbreviation (e.g., @samp{EST}). +@item %z +This stands for the time zone numerical offset (e.g., @samp{-0500}). @end table You can also specify the field width and type of padding for any of @@ -1286,12 +1288,14 @@ If @var{universal} is non-@code{nil}, that means to describe the time as Universal Time; @code{nil} means describe it using what Emacs believes is the local time zone (see @code{current-time-zone}). -This function uses the C library function @code{strftime} to do most of -the work. In order to communicate with that function, it first encodes -its argument using the coding system specified by -@code{locale-coding-system} (@pxref{Locales}); after @code{strftime} -returns the resulting string, @code{format-time-string} decodes the -string using that same coding system. +This function uses the C library function @code{strftime} +(@pxref{Formatting Calendar Time,,, libc, The GNU C Library Reference +Manual}) to do most of the work. In order to communicate with that +function, it first encodes its argument using the coding system +specified by @code{locale-coding-system} (@pxref{Locales}); after +@code{strftime} returns the resulting string, +@code{format-time-string} decodes the string using that same coding +system. @end defun @defun seconds-to-time seconds From 01892a52008a2e04ae271f06eb406356ff9194ad Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 13:04:44 +0000 Subject: [PATCH 195/361] : Move to the `indent' customization group. --- lisp/cus-start.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index bc0e2e7915b..8b68ede83a1 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -175,7 +175,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of ;; fringe.c (overflow-newline-into-fringe fringe boolean) ;; indent.c - (indent-tabs-mode fill boolean) + (indent-tabs-mode indent boolean) ;; keyboard.c (meta-prefix-char keyboard character) (auto-save-interval auto-save integer) From 0c80afbd3a0143126ee8c0c147eeaa6c0ae060ce Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 13:05:36 +0000 Subject: [PATCH 196/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ lispref/ChangeLog | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b4c654506b7..ccfffa13fa8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-12 Robert Thorpe (tiny change) + + * cus-start.el : Move to the `indent' + customization group. + 2006-08-12 Ken Manheimer * allout.el (allout-prior-bindings, allout-added-bindings): diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 318c00e84b6..8a7dffab75a 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,9 @@ +2006-08-12 Kevin Ryde + + * os.texi (Time Parsing): Add %z to description of + format-time-string, as per docstring. Add cross reference to + glibc manual for strftime. + 2006-08-08 Richard Stallman * modes.texi: Clean up wording in previous change. From d32a9a8c565b969382e75ef2f467db0358b9f19d Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Sat, 12 Aug 2006 13:28:29 +0000 Subject: [PATCH 197/361] *** empty log message *** --- lisp/ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ccfffa13fa8..1699a2c785a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2006-08-13 Nick Roberts + + * progmodes/gdb-ui.el (gdb-frame-separate-io-buffer) + (gdb-use-separate-io-buffer, menu): Avoid using `inferior' in text. + (gdb-memory-mode, gdb-locals-watch-map): Don't quote lambda + expressions. + (gdb-info-breakpoints-custom): Only search till end of line. + Add face to function names in case of no filename. + 2006-08-12 Robert Thorpe (tiny change) * cus-start.el : Move to the `indent' From 4bf152406e35a9ee5c473da2f511037f89a7c328 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Aug 2006 14:14:23 +0000 Subject: [PATCH 198/361] (How to add fonts): New node. --- man/ChangeLog | 2 + man/faq.texi | 127 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 126 insertions(+), 3 deletions(-) diff --git a/man/ChangeLog b/man/ChangeLog index 3aee6eeae72..c82bdc48c88 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,5 +1,7 @@ 2006-08-12 Eli Zaretskii + * faq.texi (How to add fonts): New node. + * misc.texi (Saving Emacs Sessions): Clarify when desktop is restored on startup. diff --git a/man/faq.texi b/man/faq.texi index 5c3bff470a3..54be5f38a65 100644 --- a/man/faq.texi +++ b/man/faq.texi @@ -4873,6 +4873,7 @@ You can get the old behavior by binding @kbd{SPC} to * Inputting eight-bit characters:: * Kanji and Chinese characters:: * Right-to-left alphabets:: +* How to add fonts:: @end menu @node Emacs does not display 8-bit characters, Inputting eight-bit characters, Alternate character sets, Alternate character sets @@ -4912,7 +4913,7 @@ Emacs 20 and later includes many of the features of MULE, the MULtilingual Enhancement to Emacs. @xref{Installing Emacs}, for information on where to find and download the latest version of Emacs. -@node Right-to-left alphabets, , Kanji and Chinese characters, Alternate character sets +@node Right-to-left alphabets, How to add fonts, Kanji and Chinese characters, Alternate character sets @section Where is an Emacs that can handle Semitic (right-to-left) alphabets? @cindex Right-to-left alphabets @cindex Hebrew, handling with Emacs @@ -4932,8 +4933,128 @@ Emacs 18. Write to Joel if you want the patches or package. @file{hebrew.el} requires a Hebrew screen font, but no other hardware support. Joel has a screen font for PCs running MS-DOS or GNU/Linux. -You might also try to query archie for files named with @file{hebrew}; -several ftp sites in Israel may also have the necessary files. +You might also try querying @code{archie} for files named with +@file{hebrew}; several ftp sites in Israel may also have the necessary +files. + +@node How to add fonts, , Right-to-left alphabets, Alternate character sets +@section How do I add fonts for use with Emacs? +@cindex add fonts for use with Emacs +@cindex intlfonts + +First, download and install the BDF font files and any auxiliary +packages they need. The GNU Intlfonts distribution can be found on +@uref{http://directory.fsf.org/localization/intlfonts.html, the GNU +Software Directory Web site}. + +Next, if you are on X Window system, issue the following two commands +from the shell's prompt: + +@example + xset +fp /usr/local/share/emacs/fonts + xset fp rehash +@end example + +@noindent +(Modify the first command if you installed the fonts in a directory +that is not @file{/usr/local/share/emacs/fonts}.) You also need to +arrange for these two commands to run whenever you log in, e.g., by +adding them to your window-system startup file, such as +@file{~/.xsessionrc} or @file{~/.gnomerc}. + +Now, add the following line to your @file{~/.emacs} init file: + +@lisp + (add-to-list 'bdf-directory-list "/usr/share/emacs/fonts/bdf") +@end lisp + +@noindent +(Again, modify the file name if you installed the fonts elsewhere.) + +Finally, if you wish to use the installed fonts with @code{ps-print}, +add the following line to your @file{~/.emacs}: + +@lisp + (setq ps-multibyte-buffer 'bdf-font-except-latin) +@end lisp + +A few additional steps are necessary for MS-Windows; they are listed +below. + +First, make sure @emph{all} the directories with BDF font files are +mentioned in @code{bdf-directory-list}. On Unix and GNU/Linux +systems, one normally runs @kbd{make install} to install the BDF fonts +in the same directory. By contrast, Windows users typically don't run +the Intlfonts installation command, but unpack the distribution in +some directory, which leaves the BDF fonts in its subdirectories. For +example, assume that you unpacked Intlfonts in @file{C:/Intlfonts}; +then you should set @code{bdf-directory-list} as follows: + +@lisp + (setq bdf-directory-list + '("C:/Intlfonts/Asian" + "C:/Intlfonts/Chinese" "C:/Intlfonts/Chinese.X" + "C:/Intlfonts/Chinese.BIG" "C:/Intlfonts/Ethiopic" + "C:/Intlfonts/European" "C:/Intlfonts/European.BIG" + "C:/Intlfonts/Japanese" "C:/Intlfonts/Japanese.X" + "C:/Intlfonts/Japanese.BIG" "C:/Intlfonts/Korean.X" + "C:/Intlfonts/Misc")) +@end lisp + +@cindex @code{w32-bdf-filename-alist} +@cindex @code{w32-find-bdf-fonts} +Next, you need to set up the variable @code{w32-bdf-filename-alist} to +an alist of the BDF fonts and their corresponding file names. +Assuming you have set @code{bdf-directory-list} to name all the +directories with the BDF font files, the following Lisp snippet will +set up @code{w32-bdf-filename-alist}: + +@lisp + (setq w32-bdf-filename-alist + (w32-find-bdf-fonts bdf-directory-list)) +@end lisp + +Now, create fontsets for the BDF fonts: + +@lisp + (create-fontset-from-fontset-spec + "-*-fixed-medium-r-normal-*-16-*-*-*-c-*-fontset-bdf, + japanese-jisx0208:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1983-*, + katakana-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, + latin-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, + japanese-jisx0208-1978:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1978-*, + thai-tis620:-misc-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1, + lao:-misc-fixed-medium-r-normal--16-160-72-72-m-80-MuleLao-1, + tibetan-1-column:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-80-MuleTibetan-1, + ethiopic:-Admas-Ethiomx16f-Medium-R-Normal--16-150-100-100-M-160-Ethiopic-Unicode, + tibetan:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-160-MuleTibetan-0") +@end lisp + +Many of the international bdf fonts from Intlfonts are type 0, and +therefore need to be added to font-encoding-alist: + +@lisp + (setq font-encoding-alist + (append '(("MuleTibetan-0" (tibetan . 0)) + ("GB2312" (chinese-gb2312 . 0)) + ("JISX0208" (japanese-jisx0208 . 0)) + ("JISX0212" (japanese-jisx0212 . 0)) + ("VISCII" (vietnamese-viscii-lower . 0)) + ("KSC5601" (korean-ksc5601 . 0)) + ("MuleArabic-0" (arabic-digit . 0)) + ("MuleArabic-1" (arabic-1-column . 0)) + ("MuleArabic-2" (arabic-2-column . 0))) + font-encoding-alist)) +@end lisp + +You can now use the Emacs font menu to select the @samp{bdf: 16-dot medium} +fontset, or you can select it by setting the default font in your +@file{~/.emacs}: + +@lisp + (set-default-font "fontset-bdf") +@end lisp + @c ------------------------------------------------------------ @node Mail and news, Concept index, Alternate character sets, Top From 9ae1fac166b215aadbac919ec50a3708d61a063c Mon Sep 17 00:00:00 2001 From: Werner LEMBERG Date: Sat, 12 Aug 2006 17:32:00 +0000 Subject: [PATCH 199/361] * TUTORIAL.de: Synchronize with TUTORIAL. --- etc/ChangeLog | 4 ++++ etc/TUTORIAL.de | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index c900ed296da..08eda1c1fc6 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2006-08-12 Werner Lemberg + + * TUTORIAL.de: Synchronize with TUTORIAL. + 2006-08-10 Romain Francoise * NEWS: Mention that zone-mode.el is now obsolete. diff --git a/etc/TUTORIAL.de b/etc/TUTORIAL.de index 4ccdd88523c..c181d596065 100644 --- a/etc/TUTORIAL.de +++ b/etc/TUTORIAL.de @@ -285,8 +285,8 @@ sein. Wollen Sie ihn nach unten verschieben, dann geben Sie M-v mit einem numerischen Argument ein. Wenn Sie eine graphische Oberfläche wie X oder MS-Windows verwenden, -dann befindet sich ein schmaler, langgezogener rechteckiger Bereich im -Regelfall auf der linken Seite des Emacs-Fensters. Dieser Bereich +dann befindet sich ein schmaler, langgezogener rechteckiger Bereich auf +der linken oder rechten Seite des Emacs-Fensters. Dieser Bereich wird Scrollbar genannt (`Verschiebungsbalken'). Sie können Text verschieben, indem Sie mit der Maus auf den Scrollbar klicken. From e96b005100958dcea4bf850e66a965ae05d5469d Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Sat, 12 Aug 2006 22:24:37 +0000 Subject: [PATCH 200/361] (Configuration): Use correct variable in rcirc-authinfo example. --- man/rcirc.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/rcirc.texi b/man/rcirc.texi index fb24a681b7f..606e6beea06 100644 --- a/man/rcirc.texi +++ b/man/rcirc.texi @@ -501,7 +501,7 @@ by the arguments this method requires. Here is an example to illustrate how you would set it: @example -(setq rcirc-startup-channels-alist +(setq rcirc-authinfo '(("freenode" nickserv "bob" "p455w0rd") ("freenode" chanserv "bob" "#bobland" "passwd99") ("bitlbee" bitlbee "robert" "sekrit"))) From ea25d374fdfba293af4d44262e02f6291edf8c4b Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Sun, 13 Aug 2006 00:07:07 +0000 Subject: [PATCH 201/361] *** empty log message *** --- man/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/man/ChangeLog b/man/ChangeLog index c82bdc48c88..d706cf8007b 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-08-13 Alex Schroeder + + * rcirc.texi (Configuration): Use correct variable in rcirc-authinfo + example. + 2006-08-12 Eli Zaretskii * faq.texi (How to add fonts): New node. From 4fc3133c50147911ab51833927cbce6a8d9e33e2 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Sun, 13 Aug 2006 01:08:48 +0000 Subject: [PATCH 202/361] *** empty log message *** --- lisp/ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1699a2c785a..8c9cfaff72a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,8 +4,10 @@ (gdb-use-separate-io-buffer, menu): Avoid using `inferior' in text. (gdb-memory-mode, gdb-locals-watch-map): Don't quote lambda expressions. - (gdb-info-breakpoints-custom): Only search till end of line. + (gdb-info-breakpoints-custom): Use gdb-breakpoint-regexp. + Only search till end of line. Add face to function names in case of no filename. + Add face to variable names of watchpoints. 2006-08-12 Robert Thorpe (tiny change) From 7443a6384579ad54709095b5944fb90d491954e2 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Sun, 13 Aug 2006 01:09:11 +0000 Subject: [PATCH 203/361] (gdb-frame-separate-io-buffer) (gdb-use-separate-io-buffer, menu): Avoid using `inferior' in text. (gdb-memory-mode, gdb-locals-watch-map): Don't quote lambda expressions. (gdb-info-breakpoints-custom): Use gdb-breakpoint-regexp. Only search till end of line. Add face to function names in case of no filename. Add face to variable names of watchpoints. --- lisp/progmodes/gdb-ui.el | 145 +++++++++++++++++++++------------------ 1 file changed, 78 insertions(+), 67 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index e6c6380bf88..e1378f0e07e 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -321,7 +321,7 @@ of the inferior. Non-nil means display the layout shown for :version "22.1") (defcustom gdb-use-separate-io-buffer nil - "Non-nil means display output from the inferior in a separate buffer." + "Non-nil means display output from the debugged program in a separate buffer." :type 'boolean :group 'gud :version "22.1") @@ -353,14 +353,14 @@ With arg, display additional buffers iff arg is positive." (error nil)))) (defun gdb-use-separate-io-buffer (arg) - "Toggle separate IO for inferior. + "Toggle separate IO for debugged program. With arg, use separate IO iff arg is positive." (interactive "P") (setq gdb-use-separate-io-buffer (if (null arg) (not gdb-use-separate-io-buffer) (> (prefix-numeric-value arg) 0))) - (message (format "Separate inferior IO %sabled" + (message (format "Separate IO %sabled" (if gdb-use-separate-io-buffer "en" "dis"))) (if (and gud-comint-buffer (buffer-name gud-comint-buffer)) @@ -1030,7 +1030,7 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'." (minibuffer . nil))) (defun gdb-frame-separate-io-buffer () - "Display IO of inferior in a new frame." + "Display IO of debugged program in a new frame." (interactive) (if gdb-use-separate-io-buffer (let ((special-display-regexps (append special-display-regexps '(".*"))) @@ -1776,9 +1776,8 @@ static char *magick[] = { (goto-char (point-min)) (while (< (point) (- (point-max) 1)) (forward-line 1) - (if (looking-at "[^\t].*?breakpoint") + (if (looking-at gdb-breakpoint-regexp) (progn - (looking-at "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)") (setq bptno (match-string 1)) (setq flag (char-after (match-beginning 2))) (add-text-properties @@ -1786,43 +1785,55 @@ static char *magick[] = { (if (eq flag ?y) '(face font-lock-warning-face) '(face font-lock-type-face))) - (beginning-of-line) - (if (re-search-forward " in \\(.*\\) at\\s-+" nil t) - (progn + (let ((bl (point)) + (el (line-end-position))) + (if (re-search-forward " in \\(.*\\) at\\s-+" el t) + (progn + (add-text-properties + (match-beginning 1) (match-end 1) + '(face font-lock-function-name-face)) + (looking-at "\\(\\S-+\\):\\([0-9]+\\)") + (let ((line (match-string 2)) + (file (match-string 1))) + (add-text-properties bl el + '(mouse-face highlight + help-echo "mouse-2, RET: visit breakpoint")) + (unless (file-exists-p file) + (setq file (cdr (assoc bptno gdb-location-alist)))) + (if (and file + (not (string-equal file "File not found"))) + (with-current-buffer + (find-file-noselect file 'nowarn) + (set (make-local-variable 'gud-minor-mode) + 'gdba) + (set (make-local-variable 'tool-bar-map) + gud-tool-bar-map) + ;; Only want one breakpoint icon at each + ;; location. + (save-excursion + (goto-line (string-to-number line)) + (gdb-put-breakpoint-icon (eq flag ?y) bptno))) + (gdb-enqueue-input + (list + (concat gdb-server-prefix "list " + (match-string-no-properties 1) ":1\n") + 'ignore)) + (gdb-enqueue-input + (list (concat gdb-server-prefix "info source\n") + `(lambda () (gdb-get-location + ,bptno ,line ,flag))))))) + (if (re-search-forward + "<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" + el t) + (add-text-properties + (match-beginning 1) (match-end 1) + '(face font-lock-function-name-face)) + (end-of-line) + (re-search-backward "\\s-\\(\\S-*\\)" + bl t) (add-text-properties (match-beginning 1) (match-end 1) - '(face font-lock-function-name-face)) - (looking-at "\\(\\S-+\\):\\([0-9]+\\)") - (let ((line (match-string 2)) - (file (match-string 1))) - (add-text-properties (line-beginning-position) - (line-end-position) - '(mouse-face highlight - help-echo "mouse-2, RET: visit breakpoint")) - (unless (file-exists-p file) - (setq file (cdr (assoc bptno gdb-location-alist)))) - (if (and file - (not (string-equal file "File not found"))) - (with-current-buffer - (find-file-noselect file 'nowarn) - (set (make-local-variable 'gud-minor-mode) - 'gdba) - (set (make-local-variable 'tool-bar-map) - gud-tool-bar-map) - ;; Only want one breakpoint icon at each - ;; location. - (save-excursion - (goto-line (string-to-number line)) - (gdb-put-breakpoint-icon (eq flag ?y) bptno))) - (gdb-enqueue-input - (list - (concat gdb-server-prefix "list " - (match-string-no-properties 1) ":1\n") - 'ignore)) - (gdb-enqueue-input - (list (concat gdb-server-prefix "info source\n") - `(lambda () (gdb-get-location - ,bptno ,line ,flag)))))))))) + '(face font-lock-variable-name-face))))))) (end-of-line)))))) (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) @@ -2549,18 +2560,18 @@ corresponding to the mode line clicked." 'local-map (gdb-make-header-line-mouse-map 'mouse-1 - #'(lambda () (interactive) - (let ((gdb-memory-address - ;; Let GDB do the arithmetic. - (concat - gdb-memory-address " - " - (number-to-string - (* gdb-memory-repeat-count - (cond ((string= gdb-memory-unit "b") 1) - ((string= gdb-memory-unit "h") 2) - ((string= gdb-memory-unit "w") 4) - ((string= gdb-memory-unit "g") 8))))))) - (gdb-invalidate-memory))))) + (lambda () (interactive) + (let ((gdb-memory-address + ;; Let GDB do the arithmetic. + (concat + gdb-memory-address " - " + (number-to-string + (* gdb-memory-repeat-count + (cond ((string= gdb-memory-unit "b") 1) + ((string= gdb-memory-unit "h") 2) + ((string= gdb-memory-unit "w") 4) + ((string= gdb-memory-unit "g") 8))))))) + (gdb-invalidate-memory))))) "|" (propertize "+" 'face font-lock-warning-face @@ -2568,9 +2579,9 @@ corresponding to the mode line clicked." 'mouse-face 'mode-line-highlight 'local-map (gdb-make-header-line-mouse-map 'mouse-1 - #'(lambda () (interactive) - (let ((gdb-memory-address nil)) - (gdb-invalidate-memory))))) + (lambda () (interactive) + (let ((gdb-memory-address nil)) + (gdb-invalidate-memory))))) "]: " (propertize gdb-memory-address 'face font-lock-warning-face @@ -2635,13 +2646,13 @@ corresponding to the mode line clicked." (defvar gdb-locals-watch-map (let ((map (make-sparse-keymap))) - (define-key map "\r" '(lambda () (interactive) - (beginning-of-line) - (gud-watch))) - (define-key map [mouse-2] '(lambda (event) (interactive "e") - (mouse-set-point event) - (beginning-of-line) - (gud-watch))) + (define-key map "\r" (lambda () (interactive) + (beginning-of-line) + (gud-watch))) + (define-key map [mouse-2] (lambda (event) (interactive "e") + (mouse-set-point event) + (beginning-of-line) + (gud-watch))) map) "Keymap to create watch expression of a complex data type local variable.") @@ -2764,7 +2775,7 @@ corresponding to the mode line clicked." (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer)) (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) (define-key menu [inferior] - '(menu-item "Inferior IO" gdb-display-separate-io-buffer + '(menu-item "Separate IO" gdb-display-separate-io-buffer :enable gdb-use-separate-io-buffer)) (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) @@ -2783,7 +2794,7 @@ corresponding to the mode line clicked." (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) (define-key menu [inferior] - '(menu-item "Inferior IO" gdb-frame-separate-io-buffer + '(menu-item "Separate IO" gdb-frame-separate-io-buffer :enable gdb-use-separate-io-buffer)) (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) (define-key menu [disassembly] '("Disassembly" . gdb-frame-assembler-buffer)) @@ -2802,9 +2813,9 @@ corresponding to the mode line clicked." :help "Toggle look for source frame." :button (:toggle . gdb-find-source-frame))) (define-key menu [gdb-use-separate-io] - '(menu-item "Separate Inferior IO" gdb-use-separate-io-buffer + '(menu-item "Separate IO" gdb-use-separate-io-buffer :visible (eq gud-minor-mode 'gdba) - :help "Toggle separate IO for inferior." + :help "Toggle separate IO for debugged program." :button (:toggle . gdb-use-separate-io-buffer))) (define-key menu [gdb-many-windows] '(menu-item "Display Other Windows" gdb-many-windows From b8f5396ad1a88f7cebe3635dc4b4e2cf17a7e089 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 13 Aug 2006 03:12:43 +0000 Subject: [PATCH 204/361] * text.texi (Near Point): Say "cursor" not "terminal cursor". (Commands for Insertion): Removed split-line since it's not relevant for Lisp programming. (Yank Commands): Rewrite introduction. (Undo): Clarify. (Maintaining Undo): Clarify. Document undo-ask-before-discard. (Filling): Remove redundant comment. Clarify return value of current-justification. (Margins): Minor clarifications. (Adaptive Fill): Update default value of adaptive-fill-regexp. (Sorting): Update definition of sort-lines. (Columns): Clarify behavior of sort-columns. (Indent Tabs): Link to Tab Stops in Emacs manual. (Special Properties): Clarify. (Clickable Text): Mention Buttons package. --- lispref/ChangeLog | 18 +++++++ lispref/text.texi | 126 +++++++++++++++++++++++++++------------------- 2 files changed, 91 insertions(+), 53 deletions(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 8a7dffab75a..6303c1c4563 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,21 @@ +2006-08-12 Chong Yidong + + * text.texi (Near Point): Say "cursor" not "terminal cursor". + (Commands for Insertion): Removed split-line since it's not + relevant for Lisp programming. + (Yank Commands): Rewrite introduction. + (Undo): Clarify. + (Maintaining Undo): Clarify. Document undo-ask-before-discard. + (Filling): Remove redundant comment. Clarify return value of + current-justification. + (Margins): Minor clarifications. + (Adaptive Fill): Update default value of adaptive-fill-regexp. + (Sorting): Update definition of sort-lines. + (Columns): Clarify behavior of sort-columns. + (Indent Tabs): Link to Tab Stops in Emacs manual. + (Special Properties): Clarify. + (Clickable Text): Mention Buttons package. + 2006-08-12 Kevin Ryde * os.texi (Time Parsing): Add %z to description of diff --git a/lispref/text.texi b/lispref/text.texi index 08e55f18f05..4d2f278bee8 100644 --- a/lispref/text.texi +++ b/lispref/text.texi @@ -103,9 +103,9 @@ This function returns the character following point in the current buffer. This is similar to @code{(char-after (point))}. However, if point is at the end of the buffer, then @code{following-char} returns 0. -Remember that point is always between characters, and the terminal -cursor normally appears over the character following point. Therefore, -the character returned by @code{following-char} is the character the +Remember that point is always between characters, and the cursor +normally appears over the character following point. Therefore, the +character returned by @code{following-char} is the character the cursor is over. In this example, point is between the @samp{a} and the @samp{c}. @@ -526,16 +526,6 @@ The value returned is @code{nil}. In an interactive call, @var{count} is the numeric prefix argument. @end deffn -@deffn Command split-line -This command splits the current line, moving the portion of the line -after point down vertically so that it is on the next line directly -below where it was before. Whitespace is inserted as needed at the -beginning of the lower line, using the @code{indent-to} function. -@code{split-line} returns the position of point. - -Programs hardly ever use this function. -@end deffn - @defvar overwrite-mode This variable controls whether overwrite mode is in effect. The value should be @code{overwrite-mode-textual}, @code{overwrite-mode-binary}, @@ -978,8 +968,11 @@ the @var{undo} value. @comment node-name, next, previous, up @subsection Functions for Yanking - @dfn{Yanking} means reinserting an entry of previously killed text -from the kill ring. The text properties are copied too. + This section describes higher-level commands for yanking, which are +intended primarily for the user but useful also in Lisp programs. +Both @code{yank} and @code{yank-pop} honor the +@code{yank-excluded-properties} variable and @code{yank-handler} text +property (@pxref{Yanking}). @deffn Command yank &optional arg @cindex inserting killed text @@ -1213,7 +1206,7 @@ value for @code{kill-ring-max} is 60. to the buffer's text so that they can be undone. (The buffers that don't have one are usually special-purpose buffers for which Emacs assumes that undoing is not useful. In particular, any buffer whose -name begins with a space has its undo recording off by default, +name begins with a space has its undo recording off by default; see @ref{Buffer Names}.) All the primitives that modify the text in the buffer automatically add elements to the front of the undo list, which is in the variable @code{buffer-undo-list}. @@ -1318,8 +1311,7 @@ they're being called for the sake of undoing. @defun primitive-undo count list This is the basic function for undoing elements of an undo list. It undoes the first @var{count} elements of @var{list}, returning -the rest of @var{list}. You could write this function in Lisp, -but it is convenient to have it in C. +the rest of @var{list}. @code{primitive-undo} adds elements to the buffer's undo list when it changes the buffer. Undo commands avoid confusion by saving the undo @@ -1372,7 +1364,9 @@ them back to size limits you can set. (For this purpose, the ``size'' of an undo list measures the cons cells that make up the list, plus the strings of deleted text.) Three variables control the range of acceptable sizes: @code{undo-limit}, @code{undo-strong-limit} and -@code{undo-outer-limit}. +@code{undo-outer-limit}. In these variables, size is counted as the +number of bytes occupied, which includes both saved text and other +data. @defopt undo-limit This is the soft limit for the acceptable size of an undo list. The @@ -1392,6 +1386,17 @@ exceeds this limit, Emacs discards the info and displays a warning. This is a last ditch limit to prevent memory overflow. @end defopt +@defopt undo-ask-before-discard +If this variable is non-@code{nil}, when the undo info exceeds +@code{undo-outer-limit}, Emacs asks in the echo area whether to +discard the info. The default value is @code{nil}, which means to +discard it automatically. + +This option is mainly intended for debugging. Garbage collection is +inhibited while the question is asked, which means that Emacs might +leak memory if the user waits too long before answering the question. +@end defopt + @node Filling @comment node-name, next, previous, up @section Filling @@ -1481,8 +1486,6 @@ it. If the region was made up of many paragraphs, the blank lines between paragraphs are removed. This function justifies as well as filling when @var{justify} is non-@code{nil}. -In an interactive call, any prefix argument requests justification. - If @var{nosqueeze} is non-@code{nil}, that means to leave whitespace other than line breaks untouched. If @var{squeeze-after} is non-@code{nil}, it specifies a position in the region, and means don't @@ -1522,6 +1525,11 @@ values are @code{left}, @code{right}, @code{full}, @code{center}, or @defun current-justification This function returns the proper justification style to use for filling the text around point. + +This returns the value of the @code{justification} text property at +point, or the variable @var{default-justification} if there is no such +text property. However, it returns @code{nil} rather than @code{none} +to mean ``don't justify''. @end defun @defopt sentence-end-double-space @@ -1569,14 +1577,14 @@ newlines'' act as paragraph separators. @section Margins for Filling @defopt fill-prefix -This buffer-local variable specifies a string of text that appears at -the beginning -of normal text lines and should be disregarded when filling them. Any -line that fails to start with the fill prefix is considered the start of -a paragraph; so is any line that starts with the fill prefix followed by -additional whitespace. Lines that start with the fill prefix but no -additional whitespace are ordinary text lines that can be filled -together. The resulting filled lines also start with the fill prefix. +This buffer-local variable, if non-@code{nil}, specifies a string of +text that appears at the beginning of normal text lines and should be +disregarded when filling them. Any line that fails to start with the +fill prefix is considered the start of a paragraph; so is any line +that starts with the fill prefix followed by additional whitespace. +Lines that start with the fill prefix but no additional whitespace are +ordinary text lines that can be filled together. The resulting filled +lines also start with the fill prefix. The fill prefix follows the left margin whitespace, if any. @end defopt @@ -1661,12 +1669,11 @@ becomes buffer-local when set in any fashion. @defvar fill-nobreak-predicate This variable gives major modes a way to specify not to break a line -at certain places. Its value should be a list of functions, but a -single function is also supported for compatibility. Whenever filling -considers breaking the line at a certain place in the buffer, it calls -each of these functions with no arguments and with point located at -that place. If any of the functions returns non-@code{nil}, then the -line won't be broken there. +at certain places. Its value should be a list of functions. Whenever +filling considers breaking the line at a certain place in the buffer, +it calls each of these functions with no arguments and with point +located at that place. If any of the functions returns +non-@code{nil}, then the line won't be broken there. @end defvar @node Adaptive Fill @@ -1733,7 +1740,7 @@ Adaptive Fill mode matches this regular expression against the text starting after the left margin whitespace (if any) on a line; the characters it matches are that line's candidate for the fill prefix. -@w{@code{"[ \t]*\\([-|#;>*]+[ \t]*\\|(?[0-9]+[.)][ \t]*\\)*"}} is the +@w{@code{"[ \t]*\\([-!|#%;>*·•‣âƒâ—¦]+[ \t]*\\|(?[0-9]+[.)][ \t]*\\)*"}} is the default value. This matches a number enclosed in parentheses or followed by a period, or certain punctuation characters, or any sequence of these intermingled with whitespace. In particular, it @@ -1898,7 +1905,8 @@ the sort order." (save-restriction (narrow-to-region beg end) (goto-char (point-min)) - (sort-subr reverse 'forward-line 'end-of-line)))) + (let ((inhibit-field-text-motion t)) + (sort-subr reverse 'forward-line 'end-of-line))))) @end group @end example @@ -2054,9 +2062,12 @@ One unusual thing about this command is that the entire line containing position @var{beg}, and the entire line containing position @var{end}, are included in the region sorted. -Note that @code{sort-columns} uses the @code{sort} utility program, -and so cannot work properly on text containing tab characters. Use -@kbd{M-x untabify} to convert tabs to spaces before sorting. +Note that @code{sort-columns} rejects text that contains tabs, because +tabs could be split across the specified columns. Use @kbd{M-x +untabify} to convert tabs to spaces before sorting. + +When possible, this command actually works by calling the @code{sort} +utility program. @end deffn @node Columns @@ -2391,6 +2402,7 @@ spaces and tab characters to reach the next tab stop column; it does not affect the display of tab characters in the buffer (@pxref{Usual Display}). Note that the @key{TAB} character as input uses this tab stop feature only in a few major modes, such as Text mode. +@xref{Tab Stops,,, emacs, The GNU Emacs Manual}. @deffn Command tab-to-tab-stop This command inserts spaces or tabs before point, up to the next tab @@ -3079,22 +3091,23 @@ This feature is used in the mode line and for other active text. @cindex keymap of character @kindex keymap @r{(text property)} The @code{keymap} property specifies an additional keymap for -commands. The property's value for the character before point applies -if it is non-@code{nil} and rear-sticky, and the property's value for -the character after point applies if it is non-@code{nil} and -front-sticky. (For mouse clicks, the position of the click is used -instead of the position of point.) If the property value is a symbol, -the symbol's function definition is used as the keymap. +commands. When this keymap applies, it is used for key lookup before +the minor mode keymaps and before the buffer's local map. +@xref{Active Keymaps}. If the property value is a symbol, the +symbol's function definition is used as the keymap. -When this keymap applies, it is used for key lookup before the minor -mode keymaps and before the buffer's local map. @xref{Active -Keymaps}. +The property's value for the character before point applies if it is +non-@code{nil} and rear-sticky, and the property's value for the +character after point applies if it is non-@code{nil} and +front-sticky. (For mouse clicks, the position of the click is used +instead of the position of point.) @item local-map @kindex local-map @r{(text property)} This property works like @code{keymap} except that it specifies a keymap to use @emph{instead of} the buffer's local map. For most -purposes (perhaps all purposes), the @code{keymap} is superior. +purposes (perhaps all purposes), it is better to use the @code{keymap} +property. @item syntax-table The @code{syntax-table} property overrides what the syntax table says @@ -3479,9 +3492,16 @@ being called over and over for the same text. @subsection Defining Clickable Text @cindex clickable text - There are two parts of setting up @dfn{clickable text} in a buffer: -(1) to indicate clickability when the mouse moves over the text, and (2) -to make a mouse button do something when you click on that text. + @dfn{Clickable text} is text that can be clicked, with either the +the mouse or via keyboard commands, to produce some result. Many +major modes use clickable text to implement features such as +hyper-links. The @code{button} package provides an easy way to insert +and manipulate clickable text. @xref{Buttons}. + + In this section, we will explain how to manually set up clickable +text in a buffer using text properties. This involves two things: (1) +indicating clickability when the mouse moves over the text, and (2) +making @kbd{RET} or a mouse click on that text do something. Indicating clickability usually involves highlighting the text, and often involves displaying helpful information about the action, such From ed112b0c83fc5fae2002d99fe6db222d8c0de391 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 13 Aug 2006 03:13:23 +0000 Subject: [PATCH 205/361] text.texi checked. --- admin/FOR-RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 27404cbd20c..115037f372b 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -100,7 +100,7 @@ lispref/streams.texi "Luc Teirlinck" Chong Yidong lispref/strings.texi "Luc Teirlinck" Chong Yidong lispref/symbols.texi "Luc Teirlinck" Chong Yidong lispref/syntax.texi "Luc Teirlinck" Chong Yidong -lispref/text.texi Chong Yidong +lispref/text.texi Chong Yidong (double-checked) lispref/tips.texi "Luc Teirlinck" Chong Yidong lispref/variables.texi "Luc Teirlinck" Chong Yidong lispref/windows.texi "Luc Teirlinck" Chong Yidong From 35dbb6cf1d6909ce26ffe150fe8b593ab9718af7 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sun, 13 Aug 2006 16:01:44 +0000 Subject: [PATCH 206/361] (erc-log-matches-make-buffer): Add missing space. --- lisp/erc/ChangeLog | 4 ++++ lisp/erc/erc-match.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index 522e4623d63..75c87b0b269 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,7 @@ +2006-08-13 Romain Francoise + + * erc-match.el (erc-log-matches-make-buffer): Add missing space. + 2006-08-07 Michael Olson * erc-backend.el (erc-process-sentinel-1): Use erc-display-message diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index ffbc7482aae..b5dc913a8c4 100644 --- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el @@ -566,7 +566,7 @@ deactivate/activate match logging in the latter. See (unless buffer-already (insert " == Type \"q\" to dismiss messages ==\n") (erc-view-mode-enter nil (lambda (buffer) - (when (y-or-n-p "Discard messages?") + (when (y-or-n-p "Discard messages? ") (kill-buffer buffer))))) buffer))) From 5dab7628da331ba10d43a4f22017b8ea89218237 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sun, 13 Aug 2006 17:04:33 +0000 Subject: [PATCH 207/361] (mm-extern-mail-server): End `y-or-n-p' prompt with a space. --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/mm-extern.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 750956b9f8b..3da68ecb902 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2006-08-13 Romain Francoise + + * mm-extern.el (mm-extern-mail-server): End `y-or-n-p' prompt with a + space. + 2006-07-28 Katsumi Yamaoka * nnheader.el (nnheader-insert-head): Make it work with Mac as well. diff --git a/lisp/gnus/mm-extern.el b/lisp/gnus/mm-extern.el index c574bd6156e..f4c728541e9 100644 --- a/lisp/gnus/mm-extern.el +++ b/lisp/gnus/mm-extern.el @@ -97,7 +97,7 @@ (subject (or (cdr (assq 'subject params)) "none")) (buf (current-buffer)) info) - (if (y-or-n-p (format "Send a request message to %s?" server)) + (if (y-or-n-p (format "Send a request message to %s? " server)) (save-window-excursion (message-mail server subject) (message-goto-body) From 43db7b94c9f8fbb48c444149c47cc9e9fd1fe8d2 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sun, 13 Aug 2006 17:04:56 +0000 Subject: [PATCH 208/361] Fix last entry. --- lisp/erc/ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index 75c87b0b269..72754aa1cd3 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,6 +1,7 @@ 2006-08-13 Romain Francoise - * erc-match.el (erc-log-matches-make-buffer): Add missing space. + * erc-match.el (erc-log-matches-make-buffer): End `y-or-n-p' + prompt with a space. 2006-08-07 Michael Olson From e1a2960c0722989a844750468f748fca71bc65da Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sun, 13 Aug 2006 17:05:12 +0000 Subject: [PATCH 209/361] * cus-theme.el (customize-create-theme) (custom-theme-visit-theme): End `y-or-n-p' prompt with a space. * filesets.el (filesets-add-buffer): Ditto. * pcvs.el (cvs-change-cvsroot): Ditto. --- lisp/ChangeLog | 9 +++++++++ lisp/cus-theme.el | 6 +++--- lisp/filesets.el | 2 +- lisp/pcvs.el | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8c9cfaff72a..4e44ebd5fbc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2006-08-13 Romain Francoise + + * cus-theme.el (customize-create-theme) + (custom-theme-visit-theme): End `y-or-n-p' prompt with a space. + + * filesets.el (filesets-add-buffer): Ditto. + + * pcvs.el (cvs-change-cvsroot): Ditto. + 2006-08-13 Nick Roberts * progmodes/gdb-ui.el (gdb-frame-separate-io-buffer) diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index 53f530505ae..b4fe1e4b0bf 100644 --- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -99,7 +99,7 @@ the directory " custom-theme-directory "\n\n") (widget-insert " ") (widget-create 'push-button :notify (lambda (&rest ignore) - (when (y-or-n-p "Discard current changes?") + (when (y-or-n-p "Discard current changes? ") (kill-buffer (current-buffer)) (customize-create-theme))) "Reset Buffer") @@ -137,7 +137,7 @@ the directory " custom-theme-directory "\n\n") (widget-insert "\n") (widget-create 'push-button :notify (lambda (&rest ignore) - (when (y-or-n-p "Discard current changes?") + (when (y-or-n-p "Discard current changes? ") (kill-buffer (current-buffer)) (customize-create-theme))) "Reset Buffer") @@ -290,7 +290,7 @@ Optional EVENT is the location for the menu." (defun custom-theme-visit-theme () (interactive) (when (or (null custom-theme-variables) - (if (y-or-n-p "Discard current changes?") + (if (y-or-n-p "Discard current changes? ") (progn (customize-create-theme) t))) (let ((theme (call-interactively 'custom-theme-merge-theme))) (unless (eq theme 'user) diff --git a/lisp/filesets.el b/lisp/filesets.el index 4ca5a9d1420..eb8cdb02617 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -1798,7 +1798,7 @@ User will be queried, if no fileset name is provided." filesets-data nil))) (entry (or (assoc name filesets-data) (when (y-or-n-p - (format "Fileset %s does not exist. Create it?" + (format "Fileset %s does not exist. Create it? " name)) (progn (add-to-list 'filesets-data (list name '(:files))) diff --git a/lisp/pcvs.el b/lisp/pcvs.el index 89aeef53b80..a9105227bfd 100644 --- a/lisp/pcvs.el +++ b/lisp/pcvs.el @@ -2287,7 +2287,7 @@ this file, or a list of arguments to send to the program." (interactive "DNew repository: ") (if (or (file-directory-p (expand-file-name "CVSROOT" newroot)) (y-or-n-p (concat "Warning: no CVSROOT found inside repository." - " Change cvs-cvsroot anyhow?"))) + " Change cvs-cvsroot anyhow? "))) (setq cvs-cvsroot newroot))) ;;;; From e71cb549802ddb2ab5a04c2b7fdb2d892f846536 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 13 Aug 2006 19:02:57 +0000 Subject: [PATCH 210/361] * FOR-RELEASE: Elisp manual checking completed. --- admin/ChangeLog | 4 ++++ admin/FOR-RELEASE | 59 ----------------------------------------------- 2 files changed, 4 insertions(+), 59 deletions(-) diff --git a/admin/ChangeLog b/admin/ChangeLog index 51c8fa9100b..97602d53653 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,7 @@ +2006-08-13 Chong Yidong + + * FOR-RELEASE: Elisp manual checking completed. + 2006-07-17 Reiner Steib * FOR-RELEASE: Update refcard section. diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 115037f372b..8468742739c 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -46,65 +46,6 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. * DOCUMENTATION -** Check the Emacs Lisp manual. - -Each manual section should be checked for factual correctness -regarding recent changes by at least two people. After each file -name, on the same line or the following line, come the names of the -people who have checked it. - -SECTION READERS ----------------------------------- -lispref/abbrevs.texi "Luc Teirlinck" Chong Yidong -lispref/advice.texi Joakim Verona Chong Yidong -lispref/anti.texi Chong Yidong Kim F. Storm -lispref/backups.texi "Luc Teirlinck" Chong Yidong -lispref/buffers.texi "Luc Teirlinck" Chong Yidong -lispref/calendar.texi Joakim Verona Chong Yidong -lispref/commands.texi "Luc Teirlinck" Chong Yidong -lispref/compile.texi "Luc Teirlinck" Chong Yidong -lispref/control.texi "Luc Teirlinck" Chong Yidong -lispref/customize.texi Chong Yidong "Luc Teirlinck" -lispref/debugging.texi Joakim Verona Lute Kamstra -lispref/display.texi Chong Yidong Jason Rumney -lispref/edebug.texi Chong Yidong "Luc Teirlinck" -lispref/elisp.texi "Luc Teirlinck" Lute Kamstra -lispref/errors.texi "Luc Teirlinck" Chong Yidong -lispref/eval.texi "Luc Teirlinck" Chong Yidong -lispref/files.texi "Luc Teirlinck" Chong Yidong -lispref/frames.texi "Luc Teirlinck" Chong Yidong -lispref/functions.texi "Luc Teirlinck" Chong Yidong -lispref/hash.texi "Luc Teirlinck" Chong Yidong -lispref/help.texi "Luc Teirlinck" Chong Yidong -lispref/hooks.texi Lute Kamstra Chong Yidong -lispref/internals.texi "Luc Teirlinck" Chong Yidong -lispref/intro.texi "Luc Teirlinck" Josh Varner -lispref/keymaps.texi "Luc Teirlinck" Chong Yidong -lispref/lists.texi "Luc Teirlinck" Chong Yidong -lispref/loading.texi "Luc Teirlinck" Chong Yidong -lispref/locals.texi Chong Yidong Nick Roberts -lispref/macros.texi "Luc Teirlinck" Chong Yidong -lispref/maps.texi Chong Yidong Kim F. Storm -lispref/markers.texi "Luc Teirlinck" Chong Yidong -lispref/minibuf.texi "Luc Teirlinck" Chong Yidong -lispref/modes.texi Chong Yidong (double-checked) -lispref/nonascii.texi "Luc Teirlinck" Chong Yidong -lispref/numbers.texi "Luc Teirlinck" Chong Yidong -lispref/objects.texi "Luc Teirlinck" Chong Yidong -lispref/os.texi "Luc Teirlinck" Chong Yidong -lispref/positions.texi "Luc Teirlinck" Chong Yidong -lispref/processes.texi Chong Yidong ttn -lispref/searching.texi "Luc Teirlinck" Chong Yidong -lispref/sequences.texi "Luc Teirlinck" Chong Yidong -lispref/streams.texi "Luc Teirlinck" Chong Yidong -lispref/strings.texi "Luc Teirlinck" Chong Yidong -lispref/symbols.texi "Luc Teirlinck" Chong Yidong -lispref/syntax.texi "Luc Teirlinck" Chong Yidong -lispref/text.texi Chong Yidong (double-checked) -lispref/tips.texi "Luc Teirlinck" Chong Yidong -lispref/variables.texi "Luc Teirlinck" Chong Yidong -lispref/windows.texi "Luc Teirlinck" Chong Yidong - ** Check the Emacs Tutorial. The first line of every tutorial must begin with text ending in a period From 369422051239c7ac9fc48ee42f898e41a77c7561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Mon, 14 Aug 2006 09:00:36 +0000 Subject: [PATCH 211/361] * term/x-win.el (menu-bar-edit-menu): Disable paste if buffer is read only. --- lisp/ChangeLog | 5 +++++ lisp/term/x-win.el | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4e44ebd5fbc..07c2f08e138 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-14 Jan Dj,Ad(Brv + + * term/x-win.el (menu-bar-edit-menu): Disable paste if buffer is + read only. + 2006-08-13 Romain Francoise * cus-theme.el (customize-create-theme) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index af45c7c4270..38add1538aa 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -2513,8 +2513,9 @@ order until succeed.") (yank))) (define-key menu-bar-edit-menu [paste] - (cons "Paste" (cons "Paste text from clipboard or kill ring" - 'x-clipboard-yank))) + '(menu-item "Paste" x-clipboard-yank + :enable (not buffer-read-only) + :help "Paste (yank) text most recently cut/copied")) ;; Initiate drag and drop (add-hook 'after-make-frame-functions 'x-dnd-init-frame) From 9bdc2a5d70f1373b914d94cc8afb9fa82f320890 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Mon, 14 Aug 2006 09:58:03 +0000 Subject: [PATCH 212/361] *** empty log message *** --- src/ChangeLog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7f0932a4206..7bfc9a88967 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-14 Kim F. Storm + + * .gdbinit (pitx): Print iterator position. + Limit stack dump in case iterator is not initialized. + 2006-08-12 Eli Zaretskii * frame.c (Fmouse_position, Fmouse_pixel_position) @@ -7,7 +12,7 @@ * xselect.c (Fx_register_dnd_atom): New function. (syms_of_xselect): Defsubr it. - (x_handle_dnd_message): Check that message_type is in + (x_handle_dnd_message): Check that message_type is in dpyinfo->x_dnd_atoms before generating lisp event. * xterm.h (struct x_display_info): Add x_dnd_atoms* to keep track From 82d59cb0cabac3a51a23fe06b59a22bc14fa2000 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Mon, 14 Aug 2006 09:58:12 +0000 Subject: [PATCH 213/361] (pitx): Print iterator position. Limit stack dump in case iterator is not initialized. --- src/.gdbinit | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/.gdbinit b/src/.gdbinit index 564b3762bd7..a99b17e16fb 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -164,6 +164,10 @@ define pitx if ($it->current.pos.charpos != $it->current.pos.bytepos) printf "[%d]", $it->current.pos.bytepos end + printf " pos=%d", $it->position.charpos + if ($it->position.charpos != $it->position.bytepos) + printf "[%d]", $it->position.bytepos + end printf " start=%d", $it->start.pos.charpos if ($it->start.pos.charpos != $it->start.pos.bytepos) printf "[%d]", $it->start.pos.bytepos @@ -218,7 +222,7 @@ define pitx printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent printf "\n" set $i = 0 - while ($i < $it->sp) + while ($i < $it->sp && $i < 4) set $e = $it->stack[$i] printf "stack[%d]: ", $i output $e->method From 70282fce62e13117947dfb4151e93eeb60251d65 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 14 Aug 2006 18:32:23 +0000 Subject: [PATCH 214/361] * keyboard.c (read_char): Don't reset idle timers if a time limit is supplied. --- src/ChangeLog | 5 +++++ src/keyboard.c | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7bfc9a88967..e97b91cf42e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-14 Chong Yidong + + * keyboard.c (read_char): Don't reset idle timers if a time limit + is supplied. + 2006-08-14 Kim F. Storm * .gdbinit (pitx): Print iterator position. diff --git a/src/keyboard.c b/src/keyboard.c index c715eadeb80..bea35a05731 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2679,7 +2679,14 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) goto non_reread; } - timer_start_idle (); + /* Start idle timers. If a time limit is supplied, we don't reset + idle timers. This avoids an infinite recursion in case an idle + timer calls `sit-for'. */ + + if (end_time) + timer_resume_idle (); + else + timer_start_idle (); /* If in middle of key sequence and minibuffer not active, start echoing if enough time elapses. */ @@ -2879,7 +2886,10 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) /* Actually read a character, waiting if necessary. */ save_getcjmp (save_jump); restore_getcjmp (local_getcjmp); - timer_start_idle (); + if (end_time) + timer_resume_idle (); + else + timer_start_idle (); c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time); restore_getcjmp (save_jump); From 9143202cb6465e7e4c9ea5fde254485fccd0e6e0 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 15 Aug 2006 00:01:16 +0000 Subject: [PATCH 215/361] (gdb-info-stack-custom): Indicate selected frame with fringe arrow. Suggested by Simon Marshall . (gdb-stack-position): New variable. (gdb-starting, gdb-exited): Reset gdb-stack-position to nil. (gdb-frames-mode): Set gdb-stack-position to nil. Add to overlay-arrow-variable-list (gdb-reset): Delete gdb-stack-position from above list. --- lisp/progmodes/gdb-ui.el | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index e1378f0e07e..b5334ba5bc5 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -115,6 +115,7 @@ address for root variables.") (defvar gdb-main-file nil "Source file from which program execution begins.") (defvar gud-old-arrow nil) (defvar gdb-overlay-arrow-position nil) +(defvar gdb-stack-position nil) (defvar gdb-server-prefix nil) (defvar gdb-flush-pending-output nil) (defvar gdb-location-alist nil @@ -1296,6 +1297,7 @@ not GDB." (setq gud-old-arrow gud-overlay-arrow-position) (setq gud-overlay-arrow-position nil) (setq gdb-overlay-arrow-position nil) + (setq gdb-stack-position nil) (if gdb-use-separate-io-buffer (setq gdb-output-sink 'inferior)))) (t @@ -1330,6 +1332,7 @@ directives." (setq gdb-active-process nil) (setq gud-overlay-arrow-position nil) (setq gdb-overlay-arrow-position nil) + (setq gdb-stack-position nil) (setq gud-old-arrow nil) (setq gdb-inferior-status "exited") (gdb-force-mode-line-update @@ -2037,8 +2040,14 @@ static char *magick[] = { (goto-char bl) (when (looking-at "^#\\([0-9]+\\)") (when (string-equal (match-string 1) gdb-frame-number) - (put-text-property bl (+ bl 4) - 'face '(:inverse-video t))) + (if (> (car (window-fringes)) 0) + (progn + (or gdb-stack-position + (setq gdb-stack-position (make-marker))) + (set-marker gdb-stack-position (point))) + (set-marker gdb-stack-position nil) + (put-text-property bl (+ bl 4) + 'face '(:inverse-video t)))) (when (re-search-forward (concat (if (string-equal (match-string 1) "0") "" " in ") @@ -2109,6 +2118,8 @@ static char *magick[] = { (kill-all-local-variables) (setq major-mode 'gdb-frames-mode) (setq mode-name "Frames") + (setq gdb-stack-position nil) + (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position) (setq buffer-read-only t) (use-local-map gdb-frames-mode-map) (run-mode-hooks 'gdb-frames-mode-hook) @@ -2912,12 +2923,13 @@ Kills the gdb buffers, and resets variables and the source buffers." (setq gud-minor-mode nil) (kill-local-variable 'tool-bar-map) (kill-local-variable 'gdb-define-alist)))))) - (when (markerp gdb-overlay-arrow-position) - (move-marker gdb-overlay-arrow-position nil) - (setq gdb-overlay-arrow-position nil)) + (setq gdb-overlay-arrow-position nil) (setq overlay-arrow-variable-list (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list)) (setq fringe-indicator-alist '((overlay-arrow . right-triangle))) + (setq gdb-stack-position nil) + (setq overlay-arrow-variable-list + (delq 'gdb-stack-position overlay-arrow-variable-list)) (if (boundp 'speedbar-frame) (speedbar-timer-fn)) (setq gud-running nil) (setq gdb-active-process nil) @@ -3139,8 +3151,7 @@ BUFFER nil or omitted means use the current buffer." '((overlay-arrow . hollow-right-triangle)))) (or gdb-overlay-arrow-position (setq gdb-overlay-arrow-position (make-marker))) - (set-marker gdb-overlay-arrow-position - (point) (current-buffer)))))) + (set-marker gdb-overlay-arrow-position (point)))))) ;; remove all breakpoint-icons in assembler buffer before updating. (gdb-remove-breakpoint-icons (point-min) (point-max)))) (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer) From 8b12cd99d2b2a49d3608a9419b9a82a53d2cd002 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 15 Aug 2006 00:30:07 +0000 Subject: [PATCH 216/361] *** empty log message *** --- lisp/ChangeLog | 11 +++++++++++ man/ChangeLog | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 07c2f08e138..c32902da47a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2006-08-15 Nick Roberts + + * progmodes/gdb-ui.el (gdb-info-stack-custom): Indicate selected + frame with fringe arrow. Suggested by Simon Marshall + . + (gdb-stack-position): New variable. + (gdb-starting, gdb-exited): Reset gdb-stack-position to nil. + (gdb-frames-mode): Set gdb-stack-position to nil. Add to + overlay-arrow-variable-list + (gdb-reset): Delete gdb-stack-position from above list. + 2006-08-14 Jan Dj,Ad(Brv * term/x-win.el (menu-bar-edit-menu): Disable paste if buffer is diff --git a/man/ChangeLog b/man/ChangeLog index d706cf8007b..10e43a9dbd4 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-08-15 Nick Roberts + + * building.texi (Stack Buffer): Explain fringe arrow. + 2006-08-13 Alex Schroeder * rcirc.texi (Configuration): Use correct variable in rcirc-authinfo @@ -50,7 +54,7 @@ * building.texi (GDB Graphical Interface): Shorten node names. (GDB-UI Layout): Use GDB-related. - (Stack Buffer): Simplify English. + (Other GDB-UI Buffers): Simplify English. 2006-07-31 Richard Stallman From a7acd30f0cb170d96069065f0a60617cc0d75fa8 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 15 Aug 2006 00:33:09 +0000 Subject: [PATCH 217/361] (Stack Buffer): Explain fringe arrow. --- man/building.texi | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/man/building.texi b/man/building.texi index 8b479960e71..68aeb023b76 100644 --- a/man/building.texi +++ b/man/building.texi @@ -1001,12 +1001,13 @@ of the nested subroutine calls (@dfn{stack frames}) now active in the program. @xref{Backtrace,, Backtraces, gdb, The GNU debugger}. @findex gdb-frames-select - The selected frame number is displayed in reverse contrast. To -select a frame in GDB, move point in the stack buffer to that stack -frame and type @key{RET} (@code{gdb-frames-select}), or click +An arrow in the fringe points to the selected frame or, if the fringe is +not present, the number of the selected frame is displayed in reverse +contrast. To select a frame in GDB, move point in the stack buffer to +that stack frame and type @key{RET} (@code{gdb-frames-select}), or click @kbd{Mouse-2} on a stack frame. If the locals buffer is visible, -selecting a stack frame updates it to display the local variables of -the new frame. +selecting a stack frame updates it to display the local variables of the +new frame. @node Other GDB-UI Buffers @subsubsection Other Buffers @@ -1018,7 +1019,7 @@ If the variable @code{gdb-use-separate-io-buffer} is non-@code{nil}, the program being debugged takes its input and displays its output here. Otherwise it uses the GUD buffer for that. To toggle whether GUD mode uses this buffer, do @kbd{M-x gdb-use-separate-io-buffer}. -That takes effect when you next restart the program you are debugging. +This takes effect when you next restart the program you are debugging. The history and replay commands from Shell mode are available here, as are the commands to send signals to the debugged program. From 8db1f9fa0c11f5c2e1f4e5eb94911b573f61fd6f Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 15 Aug 2006 02:42:21 +0000 Subject: [PATCH 218/361] (ONE_MORE_BYTE_CHECK_MULTIBYTE): New arg RET. If SRC is exhausted, return with RET. (detect_coding_emacs_mule, detect_coding_iso2022) (detect_coding_sjis, detect_coding_big5, detect_coding_utf_8) (detect_coding_utf_16, detect_coding_ccl): Adjusted for the above change. --- src/ChangeLog | 9 ++++++++ src/coding.c | 61 +++++++++++++++++++++------------------------------ 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e97b91cf42e..5026f4f10f8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2006-08-15 Kenichi Handa + + * coding.c (ONE_MORE_BYTE_CHECK_MULTIBYTE): New arg RET. If SRC + is exhausted, return with RET. + (detect_coding_emacs_mule, detect_coding_iso2022) + (detect_coding_sjis, detect_coding_big5, detect_coding_utf_8) + (detect_coding_utf_16, detect_coding_ccl): Adjusted for the above + change. + 2006-08-14 Chong Yidong * keyboard.c (read_char): Don't reset idle timers if a time limit diff --git a/src/coding.c b/src/coding.c index ae9f6749792..28e7a3fafc1 100644 --- a/src/coding.c +++ b/src/coding.c @@ -219,14 +219,15 @@ encode_coding_XXX (coding, source, destination, src_bytes, dst_bytes) /* Like ONE_MORE_BYTE, but 8-bit bytes of data at SRC are in multibyte - form if MULTIBYTEP is nonzero. */ + form if MULTIBYTEP is nonzero. In addition, if SRC is not less + than SRC_END, return with RET. */ -#define ONE_MORE_BYTE_CHECK_MULTIBYTE(c1, multibytep) \ +#define ONE_MORE_BYTE_CHECK_MULTIBYTE(c1, multibytep, ret) \ do { \ if (src >= src_end) \ { \ coding->result = CODING_FINISH_INSUFFICIENT_SRC; \ - goto label_end_of_loop; \ + return ret; \ } \ c1 = *src++; \ if (multibytep && c1 == LEADING_CODE_8_BIT_CONTROL) \ @@ -632,15 +633,15 @@ detect_coding_emacs_mule (src, src_end, multibytep) while (1) { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); - + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, + CODING_CATEGORY_MASK_EMACS_MULE); if (composing) { if (c < 0xA0) composing = 0; else if (c == 0xA0) { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, 0); c &= 0x7F; } else @@ -669,8 +670,6 @@ detect_coding_emacs_mule (src, src_end, multibytep) } } } - label_end_of_loop: - return CODING_CATEGORY_MASK_EMACS_MULE; } @@ -1425,9 +1424,9 @@ detect_coding_iso2022 (src, src_end, multibytep) Lisp_Object safe_chars; reg[0] = CHARSET_ASCII, reg[1] = reg[2] = reg[3] = -1; - while (mask && src < src_end) + while (mask) { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, mask & mask_found); retry: switch (c) { @@ -1435,11 +1434,11 @@ detect_coding_iso2022 (src, src_end, multibytep) if (inhibit_iso_escape_detection) break; single_shifting = 0; - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, mask & mask_found); if (c >= '(' && c <= '/') { /* Designation sequence for a charset of dimension 1. */ - ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep, mask & mask_found); if (c1 < ' ' || c1 >= 0x80 || (charset = iso_charset_table[0][c >= ','][c1]) < 0) /* Invalid designation sequence. Just ignore. */ @@ -1449,13 +1448,14 @@ detect_coding_iso2022 (src, src_end, multibytep) else if (c == '$') { /* Designation sequence for a charset of dimension 2. */ - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, mask & mask_found); if (c >= '@' && c <= 'B') /* Designation for JISX0208.1978, GB2312, or JISX0208. */ reg[0] = charset = iso_charset_table[1][0][c]; else if (c >= '(' && c <= '/') { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep, + mask & mask_found); if (c1 < ' ' || c1 >= 0x80 || (charset = iso_charset_table[1][c >= ','][c1]) < 0) /* Invalid designation sequence. Just ignore. */ @@ -1630,7 +1630,8 @@ detect_coding_iso2022 (src, src_end, multibytep) c = -1; while (src < src_end) { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, + mask & mask_found); if (c < 0xA0) break; i++; @@ -1648,7 +1649,6 @@ detect_coding_iso2022 (src, src_end, multibytep) break; } } - label_end_of_loop: return (mask & mask_found); } @@ -2919,20 +2919,18 @@ detect_coding_sjis (src, src_end, multibytep) while (1) { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, CODING_CATEGORY_MASK_SJIS); if (c < 0x80) continue; if (c == 0x80 || c == 0xA0 || c > 0xEF) return 0; if (c <= 0x9F || c >= 0xE0) { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, 0); if (c < 0x40 || c == 0x7F || c > 0xFC) return 0; } } - label_end_of_loop: - return CODING_CATEGORY_MASK_SJIS; } /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". @@ -2951,17 +2949,15 @@ detect_coding_big5 (src, src_end, multibytep) while (1) { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, CODING_CATEGORY_MASK_BIG5); if (c < 0x80) continue; if (c < 0xA1 || c > 0xFE) return 0; - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, 0); if (c < 0x40 || (c > 0x7F && c < 0xA1) || c > 0xFE) return 0; } - label_end_of_loop: - return CODING_CATEGORY_MASK_BIG5; } /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". @@ -2989,7 +2985,7 @@ detect_coding_utf_8 (src, src_end, multibytep) while (1) { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, CODING_CATEGORY_MASK_UTF_8); if (UTF_8_1_OCTET_P (c)) continue; else if (UTF_8_2_OCTET_LEADING_P (c)) @@ -3007,16 +3003,13 @@ detect_coding_utf_8 (src, src_end, multibytep) do { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, 0); if (!UTF_8_EXTRA_OCTET_P (c)) return 0; seq_maybe_bytes--; } while (seq_maybe_bytes > 0); } - - label_end_of_loop: - return CODING_CATEGORY_MASK_UTF_8; } /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". @@ -3045,15 +3038,13 @@ detect_coding_utf_16 (src, src_end, multibytep) struct coding_system dummy_coding; struct coding_system *coding = &dummy_coding; - ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep); - ONE_MORE_BYTE_CHECK_MULTIBYTE (c2, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c1, multibytep, 0); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c2, multibytep, 0); if ((c1 == 0xFF) && (c2 == 0xFE)) return CODING_CATEGORY_MASK_UTF_16_LE; else if ((c1 == 0xFE) && (c2 == 0xFF)) return CODING_CATEGORY_MASK_UTF_16_BE; - - label_end_of_loop: return 0; } @@ -3322,12 +3313,10 @@ detect_coding_ccl (src, src_end, multibytep) valid = coding_system_table[CODING_CATEGORY_IDX_CCL]->spec.ccl.valid_codes; while (1) { - ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); + ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep, CODING_CATEGORY_MASK_CCL); if (! valid[c]) return 0; } - label_end_of_loop: - return CODING_CATEGORY_MASK_CCL; } From fa1f0963c428ad98d38848a07a3f767f581bb1bf Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 15 Aug 2006 02:50:30 +0000 Subject: [PATCH 219/361] *** empty log message *** --- admin/FOR-RELEASE | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 8468742739c..35070c082b1 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -44,6 +44,9 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. ** Implement buffer-chars-modified-tick. +** henman@it.to-be.co.jp 09 Aug 2006: ispell.el problem. + + * DOCUMENTATION ** Check the Emacs Tutorial. From 5137195a6228c57f41de7d40c1439dc2ba9d56a2 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 15 Aug 2006 11:55:38 +0000 Subject: [PATCH 220/361] (org-clock-special-range, org-clock-update-time-maybe): New functions. (org-stamp-time-of-day-regexp): Allow weekday to be of word chars, not only a-z. (org-agenda-get-blocks): Allow multiple blocks per headline. (org-timestamp-change): Call `org-clock-update-time-maybe'. (org-export-html-title-format) (org-export-html-toplevel-hlevel): New options. (org-export-language-setup): Added support for Czech. (org-mode, org-insert-todo-heading, org-find-visible) (org-find-invisible, org-invisible-p, org-invisible-p2) (org-back-to-heading, org-on-heading-p, org-up-heading-all) (org-show-subtree, org-show-entry, org-make-options-regexp): Removed compatibility support for old outline-mode. (org-check-occur-regexp): Funtion removed. (org-on-heading-p, org-back-to-heading): Made defalias. (org-set-local): New defsubst. (org-set-regexps-and-options, org-mode) (org-set-font-lock-defaults, org-edit-agenda-file-list) (org-timeline, org-agenda-list, org-todo-list, org-tags-view) (org-remember-apply-template, org-table-edit-field) (org-table-edit-formulas, orgtbl-mode, org-export-as-ascii) (org-set-autofill-regexps): Use `org-set-local'. (org-table-eval-formula): Fixed bug with parsing of display flags. --- lisp/textmodes/org.el | 575 ++++++++++++++++++++++-------------------- 1 file changed, 305 insertions(+), 270 deletions(-) diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index 4cda0d6b3a0..1fcac6855d9 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ -;; Version: 4.43 +;; Version: 4.44 ;; ;; This file is part of GNU Emacs. ;; @@ -90,10 +90,12 @@ ;; ;; Recent changes ;; -------------- -;; Version 4.43 -;; - Big fixes +;; Version 4.44 +;; - Clock table can be done for a limited time interval. +;; - Obsolete support for the old outline mode has been removed. +;; - Bug fixes and code cleaning. ;; -;; Version 4.42 +;; Version 4.43 ;; - Bug fixes ;; - `s' key in the agenda saves all org-mode buffers. ;; @@ -212,16 +214,13 @@ ;;; Customization variables -(defvar org-version "4.43" +(defvar org-version "4.44" "The version number of the file org.el.") (defun org-version () (interactive) (message "Org-mode version %s" org-version)) -;; The following constant is for compatibility with different versions -;; of outline.el. -(defconst org-noutline-p (featurep 'noutline) - "Are we using the new outline mode?") +;; Compatibility constants (defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself (defconst org-format-transports-properties-p (let ((x "a")) @@ -1132,7 +1131,7 @@ files and the cdr the corresponding command. Possible values for the file identifier are \"ext\" A string identifying an extension `directory' Matches a directory - `remote' Matches a remove file, accessible through tramp or efs. + `remote' Matches a remote file, accessible through tramp or efs. Remote files most likely should be visited through emacs because external applications cannot handle such paths. t Default for all remaining files @@ -1831,6 +1830,7 @@ Org-mode files lives." (defcustom org-export-language-setup '(("en" "Author" "Date" "Table of Contents") + ("cs" "Autor" "Datum" "Obsah") ("da" "Ophavsmand" "Dato" "Indhold") ("de" "Autor" "Datum" "Inhaltsverzeichnis") ("es" "Autor" "Fecha" "\xccndice") @@ -2150,6 +2150,16 @@ you can \"misuse\" it to add arbitrary text to the header." :group 'org-export-html :type 'string) +(defcustom org-export-html-title-format "

%s

\n" + "Format for typesetting the document title in HTML export." + :group 'org-export-html + :type 'string) + +(defcustom org-export-html-toplevel-hlevel 2 + "The level for level 1 headings in HTML export." + :group 'org-export-html + :type 'string) + (defcustom org-export-html-link-org-files-as-html t "Non-nil means, make file links to `file.org' point to `file.html'. When org-mode is exporting an org-mode file to HTML, links to @@ -2694,6 +2704,10 @@ Also put tags into group 4 if tags are present.") (remove-text-properties 0 (length s) org-rm-props s) s) +(defsubst org-set-local (var value) + "Make VAR local in current buffer and set it to VALUE." + (set (make-variable-buffer-local var) value)) + (defsubst org-mode-p () "Check if the current buffer is in Org-mode." (eq major-mode 'org-mode)) @@ -2703,7 +2717,7 @@ Also put tags into group 4 if tags are present.") (when (org-mode-p) (let ((re (org-make-options-regexp '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" - "STARTUP" "ARCHIVE" "TAGS"))) + "STARTUP" "ARCHIVE" "TAGS" "CALC"))) (splitre "[ \t]+") kwds int key value cat arch tags) (save-excursion @@ -2755,10 +2769,10 @@ Also put tags into group 4 if tags are present.") (remove-text-properties 0 (length arch) '(face t fontified t) arch))) ))) - (and cat (set (make-local-variable 'org-category) cat)) - (and kwds (set (make-local-variable 'org-todo-keywords) kwds)) - (and arch (set (make-local-variable 'org-archive-location) arch)) - (and int (set (make-local-variable 'org-todo-interpretation) int)) + (and cat (org-set-local 'org-category cat)) + (and kwds (org-set-local 'org-todo-keywords kwds)) + (and arch (org-set-local 'org-archive-location arch)) + (and int (org-set-local 'org-todo-interpretation int)) (when tags (let (e tgs) (while (setq e (pop tags)) @@ -2770,7 +2784,7 @@ Also put tags into group 4 if tags are present.") (string-to-char (match-string 2 e))) tgs)) (t (push (list e) tgs)))) - (set (make-local-variable 'org-tag-alist) nil) + (org-set-local 'org-tag-alist nil) (while (setq e (pop tgs)) (or (and (stringp (car e)) (assoc (car e) org-tag-alist)) @@ -2928,15 +2942,11 @@ The following commands are available: ;; Need to do this here because define-derived-mode sets up ;; the keymap so late. (if (featurep 'xemacs) - (if org-noutline-p - (progn - (easy-menu-remove outline-mode-menu-heading) - (easy-menu-remove outline-mode-menu-show) - (easy-menu-remove outline-mode-menu-hide)) - (delete-menu-item '("Headings")) - (delete-menu-item '("Show")) - (delete-menu-item '("Hide")) - (set-menubar-dirty-flag)) + (progn + ;; Assume this is Greg's port, it used easymenu + (easy-menu-remove outline-mode-menu-heading) + (easy-menu-remove outline-mode-menu-show) + (easy-menu-remove outline-mode-menu-hide)) (define-key org-mode-map [menu-bar headings] 'undefined) (define-key org-mode-map [menu-bar hide] 'undefined) (define-key org-mode-map [menu-bar show] 'undefined)) @@ -2947,7 +2957,7 @@ The following commands are available: (if org-descriptive-links (org-add-to-invisibility-spec '(org-link))) (org-add-to-invisibility-spec '(org-cwidth)) (when (featurep 'xemacs) - (set (make-local-variable 'line-move-ignore-invisible) t)) + (org-set-local 'line-move-ignore-invisible t)) (setq outline-regexp "\\*+") ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)") (setq outline-level 'org-outline-level) @@ -2958,12 +2968,14 @@ The following commands are available: 4 (string-to-vector org-ellipsis)) (setq buffer-display-table org-display-table)) (org-set-regexps-and-options) + ;; Calc embedded + (org-set-local 'calc-embedded-open-mode "# ") (modify-syntax-entry ?# "<") (if org-startup-truncated (setq truncate-lines t)) - (set (make-local-variable 'font-lock-unfontify-region-function) - 'org-unfontify-region) + (org-set-local 'font-lock-unfontify-region-function + 'org-unfontify-region) ;; Activate before-change-function - (set (make-local-variable 'org-table-may-need-update) t) + (org-set-local 'org-table-may-need-update t) (org-add-hook 'before-change-functions 'org-before-change-function nil 'local) ;; Check for running clock before killing a buffer @@ -3107,7 +3119,7 @@ that will be added to PLIST. Returns the string that was modified." org-ts-regexp "\\)?") "Regular expression matching a time stamp or time stamp range.") -(defvar org-§emph-face nil) +(defvar org-§emph-face nil) (defun org-do-emphasis-faces (limit) "Run through the buffer and add overlays to links." @@ -3340,10 +3352,9 @@ between words." ))) (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) ;; Now set the full font-lock-keywords - (set (make-local-variable 'org-font-lock-keywords) - org-font-lock-extra-keywords) - (set (make-local-variable 'font-lock-defaults) - '(org-font-lock-keywords t nil nil backward-paragraph)) + (org-set-local 'org-font-lock-keywords org-font-lock-extra-keywords) + (org-set-local 'font-lock-defaults + '(org-font-lock-keywords t nil nil backward-paragraph)) (kill-local-variable 'font-lock-keywords) nil)) (defvar org-m nil) @@ -3812,9 +3823,7 @@ state (TODO by default). Also with prefix arg, force first state." (org-insert-heading) (save-excursion (org-back-to-heading) - (if org-noutline-p - (outline-previous-heading) - (outline-previous-visible-heading t)) + (outline-previous-heading) (looking-at org-todo-line-regexp)) (if (or arg (not (match-beginning 2)) @@ -4703,7 +4712,7 @@ the children that do not contain any open TODO items." (pc '(:org-comment t)) (pall '(:org-archived t :org-comment t)) (rea (concat ":" org-archive-tag ":")) - bmp file re) + bmp file re) (save-excursion (while (setq file (pop files)) (org-check-agenda-file file) @@ -4775,7 +4784,7 @@ If not found, stay at current position and return nil." pos)) (defconst org-dblock-start-re - "^#\\+BEGIN:[ \t]+\\(\\S-+\\)[ \t]+\\(.*\\)" + "^#\\+BEGIN:[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?" "Matches the startline of a dynamic block, with parameters.") (defconst org-dblock-end-re "^#\\+END\\([: \t\r\n]\\|$\\)" @@ -4803,7 +4812,7 @@ the property list including an extra property :name with the block name." (let* ((begdel (1+ (match-end 0))) (name (match-string 1)) (params (append (list :name name) - (read (concat "(" (match-string 2) ")"))))) + (read (concat "(" (match-string 3) ")"))))) (unless (re-search-forward org-dblock-end-re nil t) (error "Dynamic block not terminated")) (delete-region begdel (match-beginning 0)) @@ -5200,7 +5209,6 @@ If CALLBACK is non-nil, it is a function which is called to confirm that the match should indeed be shown." (interactive "sRegexp: ") (org-remove-occur-highlights nil nil t) - (setq regexp (org-check-occur-regexp regexp)) (let ((cnt 0)) (save-excursion (goto-char (point-min)) @@ -5625,56 +5633,58 @@ next column. For time difference computation, a year is assumed to be exactly 365 days in order to avoid rounding problems." (interactive "P") - (save-excursion - (unless (org-at-date-range-p) - (goto-char (point-at-bol)) - (re-search-forward org-tr-regexp (point-at-eol) t)) - (if (not (org-at-date-range-p)) - (error "Not at a time-stamp range, and none found in current line"))) - (let* ((ts1 (match-string 1)) - (ts2 (match-string 2)) - (havetime (or (> (length ts1) 15) (> (length ts2) 15))) - (match-end (match-end 0)) - (time1 (org-time-string-to-time ts1)) - (time2 (org-time-string-to-time ts2)) - (t1 (time-to-seconds time1)) - (t2 (time-to-seconds time2)) - (diff (abs (- t2 t1))) - (negative (< (- t2 t1) 0)) - ;; (ys (floor (* 365 24 60 60))) - (ds (* 24 60 60)) - (hs (* 60 60)) - (fy "%dy %dd %02d:%02d") - (fy1 "%dy %dd") - (fd "%dd %02d:%02d") - (fd1 "%dd") - (fh "%02d:%02d") - y d h m align) - (if havetime - (setq ; y (floor (/ diff ys)) diff (mod diff ys) - y 0 - d (floor (/ diff ds)) diff (mod diff ds) - h (floor (/ diff hs)) diff (mod diff hs) - m (floor (/ diff 60))) - (setq ; y (floor (/ diff ys)) diff (mod diff ys) - y 0 - d (floor (+ (/ diff ds) 0.5)) - h 0 m 0)) - (if (not to-buffer) - (message (org-make-tdiff-string y d h m)) - (when (org-at-table-p) - (goto-char match-end) - (setq align t) - (and (looking-at " *|") (goto-char (match-end 0)))) - (if (looking-at - "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]") - (replace-match "")) - (if negative (insert " -")) - (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m)) - (if (> d 0) (insert " " (format (if havetime fd fd1) d h m)) - (insert " " (format fh h m)))) - (if align (org-table-align)) - (message "Time difference inserted")))) + (or + (org-clock-update-time-maybe) + (save-excursion + (unless (org-at-date-range-p) + (goto-char (point-at-bol)) + (re-search-forward org-tr-regexp (point-at-eol) t)) + (if (not (org-at-date-range-p)) + (error "Not at a time-stamp range, and none found in current line"))) + (let* ((ts1 (match-string 1)) + (ts2 (match-string 2)) + (havetime (or (> (length ts1) 15) (> (length ts2) 15))) + (match-end (match-end 0)) + (time1 (org-time-string-to-time ts1)) + (time2 (org-time-string-to-time ts2)) + (t1 (time-to-seconds time1)) + (t2 (time-to-seconds time2)) + (diff (abs (- t2 t1))) + (negative (< (- t2 t1) 0)) + ;; (ys (floor (* 365 24 60 60))) + (ds (* 24 60 60)) + (hs (* 60 60)) + (fy "%dy %dd %02d:%02d") + (fy1 "%dy %dd") + (fd "%dd %02d:%02d") + (fd1 "%dd") + (fh "%02d:%02d") + y d h m align) + (if havetime + (setq ; y (floor (/ diff ys)) diff (mod diff ys) + y 0 + d (floor (/ diff ds)) diff (mod diff ds) + h (floor (/ diff hs)) diff (mod diff hs) + m (floor (/ diff 60))) + (setq ; y (floor (/ diff ys)) diff (mod diff ys) + y 0 + d (floor (+ (/ diff ds) 0.5)) + h 0 m 0)) + (if (not to-buffer) + (message (org-make-tdiff-string y d h m)) + (when (org-at-table-p) + (goto-char match-end) + (setq align t) + (and (looking-at " *|") (goto-char (match-end 0)))) + (if (looking-at + "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]") + (replace-match "")) + (if negative (insert " -")) + (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m)) + (if (> d 0) (insert " " (format (if havetime fd fd1) d h m)) + (insert " " (format fh h m)))) + (if align (org-table-align)) + (message "Time difference inserted"))))) (defun org-make-tdiff-string (y d h m) (let ((fmt "") @@ -5817,6 +5827,7 @@ in the timestamp determines what will be changed." (setcar (nthcdr 2 time0) (or (nth 1 time0) 0)) (setq time (apply 'encode-time time0)))) (insert (setq org-last-changed-timestamp (format-time-string fmt time))) + (org-clock-update-time-maybe) (goto-char pos) ;; Try to recenter the calendar window, if any (if (and org-calendar-follow-timestamp-change @@ -5937,18 +5948,19 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." "Holds the file total time in minutes, after a call to `org-clock-sum'.") (make-variable-buffer-local 'org-clock-file-total-minutes) -(defun org-clock-sum () +(defun org-clock-sum (&optional tstart tend) "Sum the times for each subtree. Puts the resulting times in minutes as a text property on each headline." (interactive) (let* ((bmp (buffer-modified-p)) (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" org-clock-string - ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$")) + "[ \t]*\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)")) (lmax 30) (ltimes (make-vector lmax 0)) (t1 0) (level 0) + ts te dt time) (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) (save-excursion @@ -5956,8 +5968,16 @@ Puts the resulting times in minutes as a text property on each headline." (while (re-search-backward re nil t) (if (match-end 2) ;; A time - (setq t1 (+ t1 (* 60 (string-to-number (match-string 2))) - (string-to-number (match-string 3)))) + (setq ts (match-string 2) + te (match-string 3) + ts (time-to-seconds + (apply 'encode-time (org-parse-time-string ts))) + te (time-to-seconds + (apply 'encode-time (org-parse-time-string te))) + ts (if tstart (max ts tstart) ts) + te (if tend (min te tend) te) + dt (- te ts) + t1 (if (> dt 0) (+ t1 (floor (/ dt 60))) t1)) ;; A headline (setq level (- (match-end 1) (match-beginning 1))) (when (or (> t1 0) (> (aref ltimes level) 0)) @@ -6069,26 +6089,112 @@ The BEGIN line can contain parameters. Allowed are: (interactive) (org-remove-clock-overlays) (unless (org-find-dblock "clocktable") - (org-create-dblock (list :name "clocktable" - :maxlevel 2 :emphasize nil))) + (org-create-dblock (list :name "clocktable" + :maxlevel 2 :emphasize nil))) (org-update-dblock)) +(defun org-clock-update-time-maybe () + "If this is a CLOCK line, update it and return t. +Otherwise, return nil." + (interactive) + (save-excursion + (beginning-of-line 1) + (skip-chars-forward " \t") + (when (looking-at org-clock-string) + (let ((re (concat "[ \t]*" org-clock-string + " *[[<]\\([^]>]+\\)[]>]-+[[<]\\([^]>]+\\)[]>]" + "\\([ \t]*=>.*\\)?")) + ts te h m s) + (if (not (looking-at re)) + nil + (and (match-end 3) (delete-region (match-beginning 3) (match-end 3))) + (end-of-line 1) + (setq ts (match-string 1) + te (match-string 2)) + (setq s (- (time-to-seconds + (apply 'encode-time (org-parse-time-string te))) + (time-to-seconds + (apply 'encode-time (org-parse-time-string ts)))) + h (floor (/ s 3600)) + s (- s (* 3600 h)) + m (floor (/ s 60)) + s (- s (* 60 s))) + (insert " => " (format "%2d:%02d" h m)) + t))))) + +(defun org-clock-special-range (key &optional time as-strings) + "Return two times bordering a special time range. +Key is a symbol specifying the range and can be one of `today', `yesterday', +`thisweek', `lastweek', `thismonth', `lastmonth', `thisyear', `lastyear'. +A week starts Monday 0:00 and ends Sunday 24:00. +The range is determined relative to TIME. TIME defaults to the current time. +The return value is a cons cell with two internal times like the ones +returned by `current time' or `encode-time'. if AS-STRINGS is non-nil, +the returned times will be formatted strings." + (let* ((tm (decode-time (or time (current-time)))) + (s 0) (m (nth 1 tm)) (h (nth 2 tm)) + (d (nth 3 tm)) (month (nth 4 tm)) (y (nth 5 tm)) + (dow (nth 6 tm)) + s1 m1 h1 d1 month1 y1 diff ts te fm) + (cond + ((eq key 'today) + (setq h 0 m 0 h1 24 m1 0)) + ((eq key 'yesterday) + (setq d (1- d) h 0 m 0 h1 24 m1 0)) + ((eq key 'thisweek) + (setq diff (if (= dow 0) 6 (1- dow)) + m 0 h 0 d (- d diff) d1 (+ 7 d))) + ((eq key 'lastweek) + (setq diff (+ 7 (if (= dow 0) 6 (1- dow))) + m 0 h 0 d (- d diff) d1 (+ 7 d))) + ((eq key 'thismonth) + (setq d 1 h 0 m 0 d1 1 month1 (1+ month) h1 0 m1 0)) + ((eq key 'lastmonth) + (setq d 1 h 0 m 0 d1 1 month (1- month) month1 (1+ month) h1 0 m1 0)) + ((eq key 'thisyear) + (setq m 0 h 0 d 1 month 1 y1 (1+ y))) + ((eq key 'lastyear) + (setq m 0 h 0 d 1 month 1 y (1- y) y1 (1+ y))) + (t (error "No such time block %s" key))) + (setq ts (encode-time s m h d month y) + te (encode-time (or s1 s) (or m1 m) (or h1 h) + (or d1 d) (or month1 month) (or y1 y))) + (setq fm (cdr org-time-stamp-formats)) + (if as-strings + (cons (format-time-string fm ts) (format-time-string fm te)) + (cons ts te)))) + (defun org-dblock-write:clocktable (params) "Write the standard clocktable." (let ((hlchars '((1 . "*") (2 . ?/))) (emph nil) (ins (make-marker)) - ipos time h m p level hlc hdl maxlevel) + ipos time h m p level hlc hdl maxlevel + ts te cc block) (setq maxlevel (or (plist-get params :maxlevel) 3) - emph (plist-get params :emphasize)) + emph (plist-get params :emphasize) + ts (plist-get params :tstart) + te (plist-get params :tend) + block (plist-get params :block)) + (when block + (setq cc (org-clock-special-range block nil t) + ts (car cc) te (cdr cc))) + (if ts (setq ts (time-to-seconds + (apply 'encode-time (org-parse-time-string ts))))) + (if te (setq te (time-to-seconds + (apply 'encode-time (org-parse-time-string te))))) (move-marker ins (point)) (setq ipos (point)) (insert-before-markers "Clock summary at [" (substring (format-time-string (cdr org-time-stamp-formats)) 1 -1) - "]\n|L|Headline|Time|\n") - (org-clock-sum) + "]." + (if block + (format " Considered range is /%s/." block) + "") + "\n\n|L|Headline|Time|\n") + (org-clock-sum ts te) (setq h (/ org-clock-file-total-minutes 60) m (- org-clock-file-total-minutes (* 60 h))) (insert-before-markers "|-\n|0|" "*Total file time*| " @@ -6475,7 +6581,7 @@ the buffer and restores the previous window configuration." (if (stringp org-agenda-files) (let ((cw (current-window-configuration))) (find-file org-agenda-files) - (set (make-local-variable 'org-window-configuration) cw) + (org-set-local 'org-window-configuration cw) (org-add-hook 'after-save-hook (lambda () (set-window-configuration @@ -6603,7 +6709,7 @@ dates." (setq buffer-read-only nil) (erase-buffer) (org-agenda-mode) (setq buffer-read-only nil) - (set (make-local-variable 'org-agenda-type) 'timeline) + (org-set-local 'org-agenda-type 'timeline) (if doclosed (push :closed args)) (push :timestamp args) (if dotodo (push :todo args)) @@ -6701,9 +6807,9 @@ NDAYS defaults to `org-agenda-ndays'." (setq buffer-read-only nil) (erase-buffer) (org-agenda-mode) (setq buffer-read-only nil) - (set (make-local-variable 'org-agenda-type) 'agenda) - (set (make-local-variable 'starting-day) (car day-numbers)) - (set (make-local-variable 'include-all-loc) include-all) + (org-set-local 'org-agenda-type 'agenda) + (org-set-local 'starting-day (car day-numbers)) + (org-set-local 'include-all-loc include-all) (when (and (or include-all org-agenda-include-all-todo) (member today day-numbers)) (setq files thefiles @@ -6812,11 +6918,11 @@ for a keyword. A numeric prefix directly selects the Nth keyword in (setq buffer-read-only nil) (erase-buffer) (org-agenda-mode) (setq buffer-read-only nil) - (set (make-local-variable 'org-agenda-type) 'todo) - (set (make-local-variable 'last-arg) arg) - (set (make-local-variable 'org-todo-keywords) kwds) - (set (make-local-variable 'org-agenda-redo-command) - '(org-todo-list (or current-prefix-arg last-arg) t)) + (org-set-local 'org-agenda-type 'todo) + (org-set-local 'last-arg arg) + (org-set-local 'org-todo-keywords kwds) + (org-set-local 'org-agenda-redo-command + '(org-todo-list (or current-prefix-arg last-arg) t)) (setq files (org-agenda-files) rtnall nil) (org-prepare-agenda-buffers files) @@ -7704,11 +7810,12 @@ the documentation of `org-diary'." (abbreviate-file-name buffer-file-name)))) (regexp org-tr-regexp) (d0 (calendar-absolute-from-gregorian date)) - marker hdmarker ee txt d1 d2 s1 s2 timestr category tags) + marker hdmarker ee txt d1 d2 s1 s2 timestr category tags pos) (goto-char (point-min)) (while (re-search-forward regexp nil t) (catch :skip (org-agenda-skip) + (setq pos (point)) (setq timestr (match-string 0) s1 (match-string 1) s2 (match-string 2) @@ -7736,7 +7843,8 @@ the documentation of `org-diary'." 'org-marker marker 'org-hd-marker hdmarker 'priority (org-get-priority txt) 'category category) (push txt ee))) - (outline-next-heading))) + (goto-char pos))) +; (outline-next-heading))) ;FIXME: correct to be removed?????? ;; Sort the entries by expiration date. (nreverse ee))) @@ -7757,7 +7865,7 @@ groups carry important information: (defconst org-stamp-time-of-day-regexp (concat - "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +[a-zA-Z]+ +\\)" + "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)" "\\([012][0-9]:[0-5][0-9]\\)>" "\\(--?" "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?") @@ -8620,10 +8728,10 @@ The prefix arg TODO-ONLY limits the search to TODO entries." (setq buffer-read-only nil) (erase-buffer) (org-agenda-mode) (setq buffer-read-only nil) - (set (make-local-variable 'org-agenda-type) 'tags) - (set (make-local-variable 'org-agenda-redo-command) - (list 'org-tags-view (list 'quote todo-only) - (list 'if 'current-prefix-arg nil match) t)) + (org-set-local 'org-agenda-type 'tags) + (org-set-local 'org-agenda-redo-command + (list 'org-tags-view (list 'quote todo-only) + (list 'if 'current-prefix-arg nil match) t)) (setq files (org-agenda-files) rtnall nil) (org-prepare-agenda-buffers files) @@ -10234,13 +10342,13 @@ to be run from that hook to fucntion properly." (org-startup-with-deadline-check nil)) (org-mode)) (if (and file (string-match "\\S-" file) (not (file-directory-p file))) - (set (make-local-variable 'org-default-notes-file) file)) + (org-set-local 'org-default-notes-file file)) (goto-char (point-min)) (if (re-search-forward "%\\?" nil t) (replace-match ""))) (let ((org-startup-folded nil) (org-startup-with-deadline-check nil)) (org-mode))) - (set (make-local-variable 'org-finish-function) 'remember-buffer)) + (org-set-local 'org-finish-function 'remember-buffer)) ;;;###autoload (defun org-remember-handler () @@ -11492,10 +11600,10 @@ it can be edited in place." '(invisible t org-cwidth t display t intangible t)) (goto-char p) - (set (make-local-variable 'org-finish-function) - 'org-table-finish-edit-field) - (set (make-local-variable 'org-window-configuration) cw) - (set (make-local-variable 'org-field-marker) pos) + (org-set-local 'org-finish-function + 'org-table-finish-edit-field) + (org-set-local 'org-window-configuration cw) + (org-set-local 'org-field-marker pos) (message "Edit and finish with C-c C-c")))) (defun org-table-finish-edit-field () @@ -12098,10 +12206,11 @@ not overwrite the stored one." (setq formula (car tmp) fmt (concat (cdr (assoc "%" org-table-local-parameters)) (nth 1 tmp))) - (while (string-match "[pnfse]\\(-?[0-9]+\\)" fmt) + (while (string-match "\\([pnfse]\\)\\(-?[0-9]+\\)" fmt) (setq c (string-to-char (match-string 1 fmt)) - n (string-to-number (or (match-string 1 fmt) ""))) - (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n)) + n (string-to-number (match-string 2 fmt))) + (if (= c ?p) + (setq modes (org-set-calc-mode 'calc-internal-prec n)) (setq modes (org-set-calc-mode 'calc-float-format (list (cdr (assoc c '((?n . float) (?f . fix) @@ -12314,8 +12423,8 @@ Parameters get priority." (switch-to-buffer-other-window "*Edit Formulas*") (erase-buffer) (fundamental-mode) - (set (make-local-variable 'org-pos) pos) - (set (make-local-variable 'org-window-configuration) wc) + (org-set-local 'org-pos pos) + (org-set-local 'org-window-configuration wc) (use-local-map org-edit-formulas-map) (setq s "# Edit formulas and finish with `C-c C-c'. # Use `C-u C-c C-c' to also appy them immediately to the entire table. @@ -12481,15 +12590,15 @@ table editor in arbitrary modes.") (let ((c (assq 'orgtbl-mode minor-mode-map-alist))) (and c (setq minor-mode-map-alist (cons c (delq c minor-mode-map-alist))))) - (set (make-local-variable (quote org-table-may-need-update)) t) + (org-set-local (quote org-table-may-need-update) t) (org-add-hook 'before-change-functions 'org-before-change-function nil 'local) - (set (make-local-variable 'org-old-auto-fill-inhibit-regexp) - auto-fill-inhibit-regexp) - (set (make-local-variable 'auto-fill-inhibit-regexp) - (if auto-fill-inhibit-regexp - (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) - "[ \t]*|")) + (org-set-local 'org-old-auto-fill-inhibit-regexp + auto-fill-inhibit-regexp) + (org-set-local 'auto-fill-inhibit-regexp + (if auto-fill-inhibit-regexp + (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) + "[ \t]*|")) (org-add-to-invisibility-spec '(org-cwidth)) (easy-menu-add orgtbl-mode-menu) (run-hooks 'orgtbl-mode-hook)) @@ -13388,7 +13497,7 @@ underlined headlines. The default is 3." (set (make-local-variable (cdr x)) (plist-get opt-plist (car x)))) org-export-plist-vars) - (set (make-local-variable 'org-odd-levels-only) odd) + (org-set-local 'org-odd-levels-only odd) (setq umax (if arg (prefix-numeric-value arg) org-export-headline-levels)) @@ -13594,22 +13703,15 @@ command." (goto-char (point-min))))) (defun org-find-visible () - (if (featurep 'noutline) - (let ((s (point))) - (while (and (not (= (point-max) (setq s (next-overlay-change s)))) - (get-char-property s 'invisible))) - s) - (skip-chars-forward "^\n") - (point))) + (let ((s (point))) + (while (and (not (= (point-max) (setq s (next-overlay-change s)))) + (get-char-property s 'invisible))) + s)) (defun org-find-invisible () - (if (featurep 'noutline) - (let ((s (point))) - (while (and (not (= (point-max) (setq s (next-overlay-change s)))) - (not (get-char-property s 'invisible)))) - s) - (skip-chars-forward "^\r") - (point))) - + (let ((s (point))) + (while (and (not (= (point-max) (setq s (next-overlay-change s)))) + (not (get-char-property s 'invisible)))) + s)) ;; HTML @@ -13859,14 +13961,16 @@ lang=\"%s\" xml:lang=\"%s\"> (insert (or (plist-get opt-plist :preamble) "")) (when (plist-get opt-plist :auto-preamble) - (if title (insert (concat "

" - (org-html-expand title) "

\n"))) - + (if title (insert (format org-export-html-title-format + (org-html-expand title)))) (if text (insert "

\n" (org-html-expand text) "

"))) (if org-export-with-toc (progn - (insert (format "

%s

\n" (nth 3 lang-words))) + (insert (format "%s\n" + org-export-html-toplevel-hlevel + (nth 3 lang-words) + org-export-html-toplevel-hlevel)) (insert "
    \n
  • ") (setq lines (mapcar '(lambda (line) @@ -14553,7 +14657,7 @@ When TITLE is nil, just close all open levels." (insert "
      \n
    • " title "
      \n"))) (if org-export-with-section-numbers (setq title (concat (org-section-number level) " " title))) - (setq level (+ level 1)) + (setq level (+ level org-export-html-toplevel-hlevel -1)) (if with-toc (insert (format "\n%s\n" level head-count title level)) @@ -15763,6 +15867,10 @@ See the individual commands for more information." "--" ("TODO Lists" ["TODO/DONE/-" org-todo t] + ("Select keyword" + ["Next keyword" org-shiftright (org-on-heading-p)] + ["Previous keyword" org-shiftleft (org-on-heading-p)] + ["Complete Keyword" org-complete (assq :todo-keyword (org-context))]) ["Show TODO Tree" org-show-todo-tree t] ["Global TODO list" org-todo-list t] "--" @@ -16042,31 +16150,32 @@ return nil." ;; In the paragraph separator we include headlines, because filling ;; text in a line directly attached to a headline would otherwise ;; fill the headline as well. - (set (make-local-variable 'comment-start-skip) "^#+[ \t]*") - (set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]") + (org-set-local 'comment-start-skip "^#+[ \t]*") + (org-set-local 'paragraph-separate "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]") ;; The paragraph starter includes hand-formatted lists. - (set (make-local-variable 'paragraph-start) - "\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]") + (org-set-local 'paragraph-start + "\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]") ;; Inhibit auto-fill for headers, tables and fixed-width lines. ;; But only if the user has not turned off tables or fixed-width regions - (set (make-local-variable 'auto-fill-inhibit-regexp) - (concat "\\*\\|#" - "\\|[ \t]*" org-keyword-time-regexp - (if (or org-enable-table-editor org-enable-fixed-width-editor) - (concat - "\\|[ \t]*[" - (if org-enable-table-editor "|" "") - (if org-enable-fixed-width-editor ":" "") - "]")))) + (org-set-local + 'auto-fill-inhibit-regexp + (concat "\\*\\|#" + "\\|[ \t]*" org-keyword-time-regexp + (if (or org-enable-table-editor org-enable-fixed-width-editor) + (concat + "\\|[ \t]*[" + (if org-enable-table-editor "|" "") + (if org-enable-fixed-width-editor ":" "") + "]")))) ;; We use our own fill-paragraph function, to make sure that tables ;; and fixed-width regions are not wrapped. That function will pass ;; through to `fill-paragraph' when appropriate. - (set (make-local-variable 'fill-paragraph-function) 'org-fill-paragraph) - ;; Adaptive filling: To get full control, first make sure that + (org-set-local 'fill-paragraph-function 'org-fill-paragraph) + ; Adaptive filling: To get full control, first make sure that ;; `adaptive-fill-regexp' never matches. Then install our own matcher. - (set (make-local-variable 'adaptive-fill-regexp) "\000") - (set (make-local-variable 'adaptive-fill-function) - 'org-adaptive-fill-function)) + (org-set-local 'adaptive-fill-regexp "\000") + (org-set-local 'adaptive-fill-function + 'org-adaptive-fill-function)) (defun org-fill-paragraph (&optional justify) "Re-align a table, pass through to fill-paragraph if no table." @@ -16145,18 +16254,7 @@ that can be added." t) "\\'")))) -;; Functions needed for compatibility with old outline.el. - -;; Programming for the old outline.el (that uses selective display -;; instead of `invisible' text properties) is a nightmare, mostly -;; because regular expressions can no longer be anchored at -;; beginning/end of line. Therefore a number of function need special -;; treatment when the old outline.el is being used. - -;; The following functions capture almost the entire compatibility code -;; between the different versions of outline-mode. The only other -;; places where this is important are the font-lock-keywords, and in -;; `org-export-visible'. Search for `org-noutline-p' to find them. +;; Functions extending outline functionality ;; C-a should go to the beginning of a *visible* line, also in the ;; new outline.el. I guess this should be patched into Emacs? @@ -16174,60 +16272,26 @@ to a visible line beginning. This makes the function of C-a more intuitive." (beginning-of-line 1)) (forward-char 1)))) -(when org-noutline-p - (define-key org-mode-map "\C-a" 'org-beginning-of-line)) +(define-key org-mode-map "\C-a" 'org-beginning-of-line) (defun org-invisible-p () "Check if point is at a character currently not visible." - (if org-noutline-p - ;; Early versions of noutline don't have `outline-invisible-p'. - (if (fboundp 'outline-invisible-p) - (outline-invisible-p) - (get-char-property (point) 'invisible)) - (save-excursion - (skip-chars-backward "^\r\n") - (equal (char-before) ?\r)))) + ;; Early versions of noutline don't have `outline-invisible-p'. + (if (fboundp 'outline-invisible-p) + (outline-invisible-p) + (get-char-property (point) 'invisible))) (defun org-invisible-p2 () "Check if point is at a character currently not visible." (save-excursion - (if org-noutline-p - (progn - (if (and (eolp) (not (bobp))) (backward-char 1)) - ;; Early versions of noutline don't have `outline-invisible-p'. - (if (fboundp 'outline-invisible-p) - (outline-invisible-p) - (get-char-property (point) 'invisible))) - (skip-chars-backward "^\r\n") - (equal (char-before) ?\r)))) + (if (and (eolp) (not (bobp))) (backward-char 1)) + ;; Early versions of noutline don't have `outline-invisible-p'. + (if (fboundp 'outline-invisible-p) + (outline-invisible-p) + (get-char-property (point) 'invisible)))) -(defun org-back-to-heading (&optional invisible-ok) - "Move to previous heading line, or beg of this line if it's a heading. -Only visible heading lines are considered, unless INVISIBLE-OK is non-nil." - (if org-noutline-p - (outline-back-to-heading invisible-ok) - (if (and (or (bobp) (memq (char-before) '(?\n ?\r))) - (looking-at outline-regexp)) - t - (if (re-search-backward (concat (if invisible-ok "\\([\r\n]\\|^\\)" "^") - outline-regexp) - nil t) - (if invisible-ok - (progn (goto-char (or (match-end 1) (match-beginning 0))) - (looking-at outline-regexp))) - (error "Before first heading"))))) - -(defun org-on-heading-p (&optional invisible-ok) - "Return t if point is on a (visible) heading line. -If INVISIBLE-OK is non-nil, an invisible heading line is ok too." - (if org-noutline-p - (outline-on-heading-p 'invisible-ok) - (save-excursion - (skip-chars-backward "^\n\r") - (and (looking-at outline-regexp) - (or invisible-ok - (bobp) - (equal (char-before) ?\n)))))) +(defalias 'org-back-to-heading 'outline-back-to-heading) +(defalias 'org-on-heading-p 'outline-on-heading-p) (defun org-on-target-p () (let ((pos (point))) @@ -16243,47 +16307,20 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too." "Move to the heading line of which the present line is a subheading. This function considers both visible and invisible heading lines. With argument, move up ARG levels." - (if org-noutline-p - (if (fboundp 'outline-up-heading-all) - (outline-up-heading-all arg) ; emacs 21 version of outline.el - (outline-up-heading arg t)) ; emacs 22 version of outline.el - (org-back-to-heading t) - (looking-at outline-regexp) - (if (<= (- (match-end 0) (match-beginning 0)) arg) - (error "Cannot move up %d levels" arg) - (re-search-backward - (concat "[\n\r]" (regexp-quote - (make-string (- (match-end 0) (match-beginning 0) arg) - ?*)) - "[^*]")) - (forward-char 1)))) + (if (fboundp 'outline-up-heading-all) + (outline-up-heading-all arg) ; emacs 21 version of outline.el + (outline-up-heading arg t))) ; emacs 22 version of outline.el (defun org-show-hidden-entry () "Show an entry where even the heading is hidden." (save-excursion - (if (not org-noutline-p) - (progn - (org-back-to-heading t) - (org-flag-heading nil))) (org-show-entry))) -(defun org-check-occur-regexp (regexp) - "If REGEXP starts with \"^\", modify it to check for \\r as well. -Of course, only for the old outline mode." - (if org-noutline-p - regexp - (if (string-match "^\\^" regexp) - (concat "[\n\r]" (substring regexp 1)) - regexp))) - (defun org-flag-heading (flag &optional entry) "Flag the current heading. FLAG non-nil means make invisible. When ENTRY is non-nil, show the entire entry." (save-excursion (org-back-to-heading t) - (if (not org-noutline-p) - ;; Make the current headline visible - (outline-flag-region (max 1 (1- (point))) (point) (if flag ?\r ?\n))) ;; Check if we should show the entire entry (if entry (progn @@ -16293,9 +16330,7 @@ When ENTRY is non-nil, show the entire entry." (org-flag-heading nil)))) (outline-flag-region (max 1 (1- (point))) (save-excursion (outline-end-of-heading) (point)) - (if org-noutline-p - flag - (if flag ?\r ?\n)))))) + flag)))) (defun org-end-of-subtree (&optional invisible-OK) ;; This is an exact copy of the original function, but it uses @@ -16324,7 +16359,7 @@ When ENTRY is non-nil, show the entire entry." (point) (save-excursion (outline-end-of-subtree) (outline-next-heading) (point)) - (if org-noutline-p nil ?\n))) + nil)) (defun org-show-entry () "Show the body directly following this heading. @@ -16337,16 +16372,16 @@ Show the heading too, if it is currently invisible." (save-excursion (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) (or (match-beginning 1) (point-max))) - (if org-noutline-p nil ?\n)))) + nil))) (defun org-make-options-regexp (kwds) "Make a regular expression for keyword lines." (concat - (if org-noutline-p "^" "[\n\r]") + "^" "#?[ \t]*\\+\\(" (mapconcat 'regexp-quote kwds "\\|") "\\):[ \t]*" - (if org-noutline-p "\\(.+\\)" "\\([^\n\r]+\\)"))) + "\\(.+\\)")) ;; Make `bookmark-jump' show the jump location if it was hidden. (eval-after-load "bookmark" From 22a616f7afff613bd378eac51d56bca748fecdbf Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 15 Aug 2006 11:58:05 +0000 Subject: [PATCH 221/361] (Installation, Activation): Split from Installation and Activation. (Clocking work time): Documented new features. --- man/org.texi | 154 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 114 insertions(+), 40 deletions(-) diff --git a/man/org.texi b/man/org.texi index 3e327279726..7897ba32867 100644 --- a/man/org.texi +++ b/man/org.texi @@ -3,8 +3,8 @@ @setfilename ../info/org @settitle Org Mode Manual -@set VERSION 4.43 -@set DATE July 2006 +@set VERSION 4.44 +@set DATE August 2006 @dircategory Emacs @direntry @@ -98,7 +98,8 @@ Software Foundation raise funds for GNU development.'' Introduction * Summary:: Brief summary of what Org-mode does -* Installation:: How to install Org-mode +* Installation:: How to install a downloaded version of Org-mode +* Activation:: How to activate Org-mode for certain buffers. * Feedback:: Bug reports, ideas, patches etc. Document Structure @@ -270,7 +271,8 @@ Extensions, Hooks and Hacking @menu * Summary:: Brief summary of what Org-mode does -* Installation:: How to install Org-mode +* Installation:: How to install a downloaded version of Org-mode +* Activation:: How to activate Org-mode for certain buffers. * Feedback:: Bug reports, ideas, patches etc. @end menu @@ -323,18 +325,68 @@ questions (FAQ), links to tutorials etc. This page is located at @page -@node Installation, Feedback, Summary, Introduction -@section Installation and Activation +@node Installation, Activation, Summary, Introduction +@section Installation @cindex installation +@cindex XEmacs + +@b{Important:} If Org-mode is part of the Emacs distribution or an +XEmacs package, please skip this section and go directly to +@ref{Activation}. + +If you have downloaded Org-mode from the Web, you must take the +following steps to install it: Go into the Org-mode distribution +directory and edit the top section of the file @file{Makefile}. You +must set the name of the Emacs binary (likely either @file{emacs} or +@file{xemacs}), and the paths to the directories where local Lisp and +Info files are kept. If you don't have access to the system-wide +directories, create your own two directories for these files, enter them +into the Makefile, and make sure Emacs finds the Lisp files by adding +the following line to @file{.emacs}: + +@example +(setq load-path (cons "~/path/to/lispdir" load-path)) +@end example + +@b{XEmacs users now need to install the file @file{noutline.el} from +the @file{xemacs} subdirectory of the Org-mode distribution. Use the +command:} + +@example +@b{make install-noutline} +@end example + +@noindent Now byte-compile and install the Lisp files with the shell +commands: + +@example +make +make install +@end example + +@noindent If you want to install the info documentation, use this command: + +@example +make install-info +@end example + +@noindent Then add to @file{.emacs}: + +@lisp +;; This line only if org-mode is not part of the X/Emacs distribution. +(require 'org-install) +@end lisp + +@node Activation, Feedback, Installation, Introduction +@section Activation +@cindex activation @cindex autoload @cindex global keybindings @cindex keybindings, global -If Org-mode is part of the Emacs distribution or an XEmacs package, -you only need to copy the following lines to your @file{.emacs} file. -The last two lines define @emph{global} keys for the commands -@command{org-store-link} and @command{org-agenda} - please -choose suitable keys yourself. +Add the following lines to your @file{.emacs} file. The last two lines +define @emph{global} keys for the commands @command{org-store-link} and +@command{org-agenda} - please choose suitable keys yourself. @lisp ;; The following lines are always needed. Choose your own keys. @@ -345,30 +397,17 @@ choose suitable keys yourself. Furthermore, you must activate @code{font-lock-mode} in org-mode buffers, because significant functionality depends on font-locking being -active. You can do this with either one of the following two lines: +active. You can do this with either one of the following two lines +(XEmacs user must use the second option): @lisp (global-font-lock-mode 1) ; for all buffers (add-hook 'org-mode-hook 'turn-on-font-lock) ; org-mode buffers only @end lisp -If you have downloaded Org-mode from the Web, you must take additional -action: Byte-compile @file{org.el} and @file{org-publish.el} and put -them together with @file{org-install.el} on your load path. Then add to -@file{.emacs}: - -@lisp -;; This line only if org-mode is not part of the X/Emacs distribution. -(require 'org-install) -@end lisp - -If you use Org-mode with XEmacs, you also need to install the file -@file{noutline.el} from the @file{xemacs} subdirectory of the Org-mode -distribution. - @cindex org-mode, turning on -With this setup, all files with extension @samp{.org} will be put into -Org-mode. As an alternative, make the first line of a file look like -this: +With this setup, all files with extension @samp{.org} will be put +into Org-mode. As an alternative, make the first line of a file look +like this: @example MY PROJECTS -*- mode: org; -*- @@ -378,7 +417,7 @@ MY PROJECTS -*- mode: org; -*- the file's name is. See also the variable @code{org-insert-mode-line-in-empty-file}. -@node Feedback, , Installation, Introduction +@node Feedback, , Activation, Introduction @section Feedback @cindex feedback @cindex bug reports @@ -826,8 +865,14 @@ But in the end, not individual scenes matter but the film as a whole. @end group @end example -Org-mode supports these lists by tuning filling and wrapping commands -to deal with them correctly. +Org-mode supports these lists by tuning filling and wrapping commands to +deal with them correctly@footnote{Org-mode only changes the filling +settings for Emacs. For XEmacs, you should use Kyle E. Jones' +@file{filladapt.el}. To turn is on, put into @file{.emacs}: +@example +(require 'filladapt) +@end example +}. The following commands act on items when the cursor is in the first line of an item (the line with the bullet or number). @@ -2160,7 +2205,7 @@ If you define many keywords, you can use in-buffer completion (see The second possibility is to use TODO keywords to indicate different types of action items. For example, you might want to indicate that -items are for ``work'' or ``home.'' If you are into David Allen's +items are for ``work'' or ``home''. If you are into David Allen's @emph{Getting Things DONE}, you might want to use todo types @samp{NEXTACTION}, @samp{WAITING}, @samp{MAYBE}. Or, when you work with several people on a single project, you might want to assign @@ -2547,7 +2592,12 @@ keyword together with a timestamp. Stop the clock (clock-out). The inserts another timestamp at the same location where the clock was last started. It also directly computes the resulting time in inserts it after the time range as @samp{=> -HH:MM}. +HH:MM}. +@kindex C-c C-y +@item C-c C-y +Recompute the time interval after changing one of the time stamps. This +is only necessary if you edit the time stamps directly. If you change +them with @kbd{S-@key{cursor}} keys, the update is automatic. @kindex C-c C-t @item C-c C-t Changing the TODO state of an item to DONE automatically stops the clock @@ -2565,8 +2615,8 @@ can use visibility cycling to study the tree, but the overlays disappear automatically when the buffer is changed. @kindex C-c C-x C-r @item C-c C-x C-r -Insert a dynamic block containing a clock report as an org-mode table -into the current file. +Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock +report as an org-mode table into the current file. @example #+BEGIN: clocktable :maxlevel 2 :emphasize nil @@ -2578,7 +2628,32 @@ table. The @samp{BEGIN} line can specify options: @example :maxlevels @r{Maximum level depth to which times are listed in the table.} :emphasize @r{When @code{t}, emphasize level one and level two items} +:block @r{The time block to consider. This block is specified relative} + @r{to the current time and may be any of these keywords:} + @r{@code{today}, @code{yesterday}, @code{thisweek}, @code{lastweek},} + @r{@code{thismonth}, @code{lastmonth}, @code{thisyear}, or @code{lastyear}}. +:tstart @r{A time string specifying when to start considering times} +:tend @r{A time string specifying when to stop considering times} @end example +So to get a clock summary for the current day, you could write +@example +#+BEGIN: clocktable :maxlevel 2 :block today + +#+END: clocktable +@end example +and to use a specific time range you could write@footnote{Note that all +parameters must be specified in a single line - the line is broken here +only to fit it onto the manual.} +@example +#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>" + :tend "<2006-08-10 Thu 12:00>" + +#+END: clocktable +@end example +@kindex C-u C-c C-x C-u +@item C-u C-c C-x C-u +Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if +you have several clocktable blocks in a buffer. @end table The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in @@ -4653,8 +4728,7 @@ setup. See the installation instructions in the file @item @file{cdlatex.el} by Carsten Dominik @cindex @file{cdlatex.el} Org-mode can make use of the cdlatex package to efficiently enter -La@TeX{} fragments into Org-mode files. -@file{cdlatex.el} is not part of Emacs, find it on the web. +La@TeX{} fragments into Org-mode files. See @ref{CDLaTeX mode}. @item @file{remember.el} by John Wiegley @cindex @file{remember.el} Org mode cooperates with remember, see @ref{Remember}. @@ -4784,7 +4858,7 @@ caused by the preparations for the 22.1 release. In the mean time, @url{http://dto.freeshell.org/e/org-publish.el}. @cindex @file{org-blog.el} @item @file{org-blog.el} by David O'Toole -A blogging plug-in for @file{org-publish.el}. +A blogging plug-in for @file{org-publish.el}.@* @url{http://dto.freeshell.org/notebook/OrgMode.html}. @cindex @file{org-blogging.el} @item @file{org-blogging.el} by Bastien Guerry @@ -4805,7 +4879,7 @@ to the block and can also specify parameters for the function producing the content of the block. @example -#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ..... +#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ... #+END: @end example From 4c3ec0fc9645276fc9f9084b6a9872860ac10de0 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 15 Aug 2006 11:58:49 +0000 Subject: [PATCH 222/361] *** empty log message *** --- etc/ChangeLog | 4 ++++ lisp/ChangeLog | 27 +++++++++++++++++++++++++++ man/ChangeLog | 6 ++++++ 3 files changed, 37 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index 08eda1c1fc6..32d7525e153 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2006-08-15 Carsten Dominik + + * orgcard.tex: Version number change. + 2006-08-12 Werner Lemberg * TUTORIAL.de: Synchronize with TUTORIAL. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c32902da47a..31201341796 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,30 @@ +2006-08-15 Carsten Dominik + + * textmodes/org.el (org-clock-special-range, + org-clock-update-time-maybe): New functions. + (org-stamp-time-of-day-regexp): Allow weekday to be of word chars, + not only a-z. + (org-agenda-get-blocks): Allow multiple blocks per headline. + (org-timestamp-change): Call `org-clock-update-time-maybe'. + (org-export-html-title-format) + (org-export-html-toplevel-hlevel): New options. + (org-export-language-setup): Added support for Czech. + (org-mode, org-insert-todo-heading, org-find-visible) + (org-find-invisible, org-invisible-p, org-invisible-p2) + (org-back-to-heading, org-on-heading-p, org-up-heading-all) + (org-show-subtree, org-show-entry, org-make-options-regexp): + Removed compatibility support for old outline-mode. + (org-check-occur-regexp): Funtion removed. + (org-on-heading-p, org-back-to-heading): Made defalias. + (org-set-local): New defsubst. + (org-set-regexps-and-options, org-mode) + (org-set-font-lock-defaults, org-edit-agenda-file-list) + (org-timeline, org-agenda-list, org-todo-list, org-tags-view) + (org-remember-apply-template, org-table-edit-field) + (org-table-edit-formulas, orgtbl-mode, org-export-as-ascii) + (org-set-autofill-regexps): Use `org-set-local'. + (org-table-eval-formula): Fixed bug with parsing of display flags. + 2006-08-15 Nick Roberts * progmodes/gdb-ui.el (gdb-info-stack-custom): Indicate selected diff --git a/man/ChangeLog b/man/ChangeLog index 10e43a9dbd4..cdf811da570 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,9 @@ +2006-08-15 Carsten Dominik + + * org.texi (Installation, Activation): Split from Installation and + Activation. + (Clocking work time): Documented new features. + 2006-08-15 Nick Roberts * building.texi (Stack Buffer): Explain fringe arrow. From 29cf022180b04a33c0dfa9ce571be7637ab1e5ae Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 15 Aug 2006 11:59:09 +0000 Subject: [PATCH 223/361] Version number change. --- etc/orgcard.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/orgcard.tex b/etc/orgcard.tex index 951d0167c2e..ef2e847b5f1 100644 --- a/etc/orgcard.tex +++ b/etc/orgcard.tex @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{4.43} +\def\orgversionnumber{4.44} \def\year{2006} % %**start of header From 3236e6b849ab228d0e0d466343f10b1202e1cf9d Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 15 Aug 2006 17:39:21 +0000 Subject: [PATCH 224/361] * keyboard.c (read_char): Don't change idle timer state at all if end_time is supplied. --- src/ChangeLog | 5 +++++ src/keyboard.c | 25 ++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5026f4f10f8..936f8a2546c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-15 Chong Yidong + + * keyboard.c (read_char): Don't change idle timer state at all if + end_time is supplied. + 2006-08-15 Kenichi Handa * coding.c (ONE_MORE_BYTE_CHECK_MULTIBYTE): New arg RET. If SRC diff --git a/src/keyboard.c b/src/keyboard.c index bea35a05731..fed6fbc79dd 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2679,13 +2679,11 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) goto non_reread; } - /* Start idle timers. If a time limit is supplied, we don't reset - idle timers. This avoids an infinite recursion in case an idle - timer calls `sit-for'. */ + /* Start idle timers if no time limit is supplied. We don't do it + if a time limit is supplied to avoid an infinite recursion in the + situation where an idle timer calls `sit-for'. */ - if (end_time) - timer_resume_idle (); - else + if (!end_time) timer_start_idle (); /* If in middle of key sequence and minibuffer not active, @@ -2756,7 +2754,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); /* Now that we have read an event, Emacs is not idle. */ - timer_stop_idle (); + if (!end_time) + timer_stop_idle (); goto exit; } @@ -2886,9 +2885,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) /* Actually read a character, waiting if necessary. */ save_getcjmp (save_jump); restore_getcjmp (local_getcjmp); - if (end_time) - timer_resume_idle (); - else + if (!end_time) timer_start_idle (); c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time); restore_getcjmp (save_jump); @@ -2941,7 +2938,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) non_reread: - timer_stop_idle (); + if (!end_time) + timer_stop_idle (); RESUME_POLLING; if (NILP (c)) @@ -2975,7 +2973,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) last_input_char = c; Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt); - if (CONSP (c) && EQ (XCAR (c), Qselect_window)) + if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time) /* We stopped being idle for this event; undo that. This prevents automatic window selection (under mouse_autoselect_window from acting as a real input event, for @@ -3181,7 +3179,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) show_help_echo (help, window, object, position, 0); /* We stopped being idle for this event; undo that. */ - timer_resume_idle (); + if (!end_time) + timer_resume_idle (); goto retry; } From 7e18844978b0a9827e9cd41b20740b74b1decef2 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 15 Aug 2006 19:59:08 +0000 Subject: [PATCH 225/361] * commands.texi (Reading One Event): Explain idleness in `read-event'. --- lispref/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 6303c1c4563..579918f36a2 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,8 @@ +2006-08-15 Chong Yidong + + * commands.texi (Reading One Event): Explain idleness in + `read-event'. + 2006-08-12 Chong Yidong * text.texi (Near Point): Say "cursor" not "terminal cursor". From 9411b080963173da11f2086118b33c0172216685 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 15 Aug 2006 22:28:02 +0000 Subject: [PATCH 226/361] * commands.texi (Reading One Event): Explain idleness in `read-event'. --- lispref/commands.texi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lispref/commands.texi b/lispref/commands.texi index 8e34fe360bf..2a091524bed 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi @@ -2229,6 +2229,15 @@ number of seconds; on these systems, @var{seconds} is rounded down. If @var{seconds} is @code{nil}, @code{read-event} waits as long as necessary for input to arrive. +If @var{seconds} is @code{nil}, Emacs is considered idle while waiting +for user input to arrive. Idle timers---those created with +@code{run-with-idle-timer} (@pxref{Timers})---can run during this +period. However, if @var{seconds} is non-@code{nil}, the state of +idleness remains unchanged. If Emacs is non-idle when +@code{read-event} is called, it remains non-idle throughout the +operation of @code{read-event}; if Emacs is idle (which can happen if +the call happens inside an idle timer), it remains idle. + If @code{read-event} gets an event that is defined as a help character, then in some cases @code{read-event} processes the event directly without returning. @xref{Help Functions}. Certain other events, called From 29cbc4829462914df43038b05711b71aad6e570a Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 16 Aug 2006 00:20:53 +0000 Subject: [PATCH 227/361] (choose_write_coding_system): Use LF for end-of-line in auto-saving. --- src/ChangeLog | 5 +++++ src/fileio.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 936f8a2546c..58929cc40d2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-16 Kenichi Handa + + * fileio.c (choose_write_coding_system): Use LF for end-of-line + in auto-saving. + 2006-08-15 Chong Yidong * keyboard.c (read_char): Don't change idle timer state at all if diff --git a/src/fileio.c b/src/fileio.c index d26b2808726..4a39e7ffa19 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4845,6 +4845,8 @@ choose_write_coding_system (start, end, filename, /* ... but with the special flag to indicate not to strip off leading code of eight-bit-control chars. */ coding->flags = 1; + /* We force LF for end-of-line because that is faster. */ + coding->eol_type = CODING_EOL_LF; goto done_setup_coding; } else if (!NILP (Vcoding_system_for_write)) From 7b245e6346d1759266bf22528d02fd6dc1b0be70 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 04:57:08 +0000 Subject: [PATCH 228/361] Clean up wording. --- INSTALL.CVS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/INSTALL.CVS b/INSTALL.CVS index 3716930eccc..e67ea4db0f2 100644 --- a/INSTALL.CVS +++ b/INSTALL.CVS @@ -12,8 +12,9 @@ The bootstrap process makes sure all necessary files are rebuilt before it builds the final Emacs binary. Normally, it is not necessary to use "make bootstrap" after every CVS -update. Unless there are problems, we suggest to use the following -alternative procedure, after you did "make bootstrap" at least once: +update. Unless there are problems, we suggest using the following +alternative procedure after you have done "make bootstrap" at least +once: $ ./configure $ make From 27f9dfbf21276dab85c3a2ff229d3188af8bf0e3 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:04:16 +0000 Subject: [PATCH 229/361] (compare-windows): Factor compare-ignore-whitespace into ignore-whitespace. Check each buffer for its skip-function. Handle compare-windows-skip-whitespace special-case test by returning t from default skip function. --- lisp/compare-w.el | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/lisp/compare-w.el b/lisp/compare-w.el index e61f24a0c7c..3aa01424fb5 100644 --- a/lisp/compare-w.el +++ b/lisp/compare-w.el @@ -167,16 +167,14 @@ on first call it advances points to the next difference, on second call it synchronizes points by skipping the difference, on third call it again advances points to the next difference and so on." (interactive "P") + (if compare-ignore-whitespace + (setq ignore-whitespace (not ignore-whitespace))) (let* (p1 p2 maxp1 maxp2 b1 b2 w2 (progress 1) (opoint1 (point)) opoint2 - (skip-func (if (if ignore-whitespace ; XOR - (not compare-ignore-whitespace) - compare-ignore-whitespace) - (if (stringp compare-windows-whitespace) - 'compare-windows-skip-whitespace - compare-windows-whitespace))) + skip-func-1 + skip-func-2 (sync-func (if (stringp compare-windows-sync) 'compare-windows-sync-regexp compare-windows-sync))) @@ -190,8 +188,19 @@ on third call it again advances points to the next difference and so on." b2 (window-buffer w2)) (setq opoint2 p2) (setq maxp1 (point-max)) - (save-excursion - (set-buffer b2) + + (setq skip-func-1 (if ignore-whitespace + (if (stringp compare-windows-whitespace) + (lambda () (compare-windows-skip-whitespace) + t) + compare-windows-whitespace))) + + (with-current-buffer b2 + (setq skip-func-2 (if ignore-whitespace + (if (stringp compare-windows-whitespace) + (lambda () (compare-windows-skip-whitespace) + t) + compare-windows-whitespace))) (push-mark p2 t) (setq maxp2 (point-max))) (push-mark) @@ -199,17 +208,16 @@ on third call it again advances points to the next difference and so on." (while (> progress 0) ;; If both windows have whitespace next to point, ;; optionally skip over it. - (and skip-func + (and skip-func-1 (save-excursion (let (p1a p2a w1 w2 result1 result2) - (setq result1 (funcall skip-func opoint1)) + (setq result1 (funcall skip-func-1 opoint1)) (setq p1a (point)) (set-buffer b2) (goto-char p2) - (setq result2 (funcall skip-func opoint2)) + (setq result2 (funcall skip-func-2 opoint2)) (setq p2a (point)) - (if (or (stringp compare-windows-whitespace) - (and result1 result2 (eq result1 result2))) + (if (and result1 result2 (eq result1 result2)) (setq p1 p1a p2 p2a))))) From 19f0515adac3bc3b0ffa371fb92350bdb0b5fd15 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:05:08 +0000 Subject: [PATCH 230/361] (custom-newline): New function. (custom-mode-map): Bind newline to custom-newline. --- lisp/cus-edit.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 0493dd0894c..609b5572a08 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4436,6 +4436,7 @@ The format is suitable for use with `easy-menu-define'." (let ((map (make-keymap))) (set-keymap-parent map widget-keymap) (define-key map [remap self-insert-command] 'custom-no-edit) + (define-key map "\^m" 'custom-newline) (define-key map " " 'scroll-up) (define-key map "\177" 'scroll-down) (define-key map "\C-c\C-c" 'Custom-set) @@ -4452,6 +4453,14 @@ The format is suitable for use with `easy-menu-define'." (interactive "@d") (error "You can't edit this part of the Custom buffer")) +(defun custom-newline (pos &optional event) + "Invoke button at POS, or refuse to allow editing of Custom buffer." + (interactive "@d") + (let ((button (get-char-property pos 'button))) + (if button + (widget-apply-action button event) + (error "You can't edit this part of the Custom buffer")))) + (easy-menu-define Custom-mode-menu custom-mode-map "Menu used in customization buffers." From b605a60ad353518cc072bc0f4cad78dfed6364a2 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:05:56 +0000 Subject: [PATCH 231/361] (comment-indent): Fully update INDENT before checking to see if it will change the text. --- lisp/newcomment.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 5dfa1eb8959..358c834de73 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -599,11 +599,16 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any." (if (and other (<= other max) (> other min)) ;; There is a comment and it's in the range: bingo. (setq indent other)))))))) + ;; Update INDENT to leave at least one space + ;; after other nonwhite text on the line. + (save-excursion + (skip-chars-backward " \t") + (unless (bolp) + (setq indent (max indent (1+ (current-column)))))) + ;; If that's different from comment's current position, change it. (unless (= (current-column) indent) - ;; If that's different from current, change it. (delete-region (point) (progn (skip-chars-backward " \t") (point))) - (indent-to (if (bolp) indent - (max indent (1+ (current-column))))))) + (indent-to indent))) (goto-char cpos) (set-marker cpos nil)))) From ad47c4a0a50bfb43ff1d29e80fa3edf9b0955249 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:07:22 +0000 Subject: [PATCH 232/361] (move-beginning-of-line): Test whether fields would prevent motion back to line's first visible character. If so, stop where the fields would stop the motion. --- lisp/simple.el | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 9288ab6bd79..f1b80968ff1 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3770,7 +3770,8 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." (interactive "p") (or arg (setq arg 1)) - (let ((orig (point))) + (let ((orig (point)) + start first-vis first-vis-field-value) ;; Move by lines, if ARG is not 1 (the default). (if (/= arg 1) @@ -3781,10 +3782,24 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." (while (and (not (bobp)) (line-move-invisible-p (1- (point)))) (goto-char (previous-char-property-change (point))) (skip-chars-backward "^\n")) + (setq start (point)) - ;; Take care of fields. - (goto-char (constrain-to-field (point) orig - (/= arg 1) t nil)))) + ;; Now find first visible char in the line + (while (and (not (eobp)) (line-move-invisible-p (point))) + (goto-char (next-char-property-change (point)))) + (setq first-vis (point)) + + ;; See if fields would stop us from reaching FIRST-VIS. + (setq first-vis-field-value + (constrain-to-field first-vis orig (/= arg 1) t nil)) + + (goto-char (if (/= first-vis-field-value first-vis) + ;; If yes, obey them. + first-vis-field-value + ;; Otherwise, move to START with attention to fields. + ;; (It is possible that fields never matter in this case.) + (constrain-to-field (point) orig + (/= arg 1) t nil))))) ;;; Many people have said they rarely use this feature, and often type From c0acb3ee4ce9a7255b060f2ec311ae6b3fda3ce9 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:09:18 +0000 Subject: [PATCH 233/361] (x-clipboard-yank): Specify * in interactive spec. (special-event-map): Process drag-n-drop events this way. --- lisp/term/x-win.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 38add1538aa..0fc76382130 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -2505,7 +2505,7 @@ order until succeed.") ;; Override Paste so it looks at CLIPBOARD first. (defun x-clipboard-yank () "Insert the clipboard contents, or the last stretch of killed text." - (interactive) + (interactive "*") (let ((clipboard-text (x-selection-value 'CLIPBOARD)) (x-select-enable-clipboard t)) (if (and clipboard-text (> (length clipboard-text) 0)) @@ -2519,7 +2519,7 @@ order until succeed.") ;; Initiate drag and drop (add-hook 'after-make-frame-functions 'x-dnd-init-frame) -(global-set-key [drag-n-drop] 'x-dnd-handle-drag-n-drop-event) +(define-key special-event-map [drag-n-drop] 'x-dnd-handle-drag-n-drop-event) ;; Let F10 do menu bar navigation. (and (fboundp 'menu-bar-open) From 81b4d9abbf1448128159f3f25fa3fc4cd51a09b7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:10:55 +0000 Subject: [PATCH 234/361] (Variable Definitions): Explain when the standard value expression is evaluated. --- lispref/customize.texi | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/lispref/customize.texi b/lispref/customize.texi index e3e78c46bb4..9e10e547b56 100644 --- a/lispref/customize.texi +++ b/lispref/customize.texi @@ -251,19 +251,30 @@ turn this feature back on, if someone would like to do the work. Use @code{defcustom} to declare user-editable variables. -@defmac defcustom option default doc [keyword value]@dots{} -Declare @var{option} as a customizable user option variable. Do not -quote @var{option}. The argument @var{doc} specifies the documentation -string for the variable. There is no need to start it with a @samp{*} -because @code{defcustom} automatically marks @var{option} as a -@dfn{user option} (@pxref{Defining Variables}). +@defmac defcustom option standard doc [keyword value]@dots{} +This construct declares @var{option} as a customizable user option +variable. You should not quote @var{option}. The argument @var{doc} +specifies the documentation string for the variable. There is no need +to start it with a @samp{*}, because @code{defcustom} automatically +marks @var{option} as a @dfn{user option} (@pxref{Defining +Variables}). -If @var{option} is void, @code{defcustom} initializes it to -@var{default}. @var{default} should be an expression to compute the -value; be careful in writing it, because it can be evaluated on more -than one occasion. You should normally avoid using backquotes in -@var{default} because they are not expanded when editing the value, -causing list values to appear to have the wrong structure. +The argument @var{standard} is an expression that specifies the +standard value for @var{option}. Evaluating the @code{defcustom} form +evaluates @var{standard}, but does not necessarily install the +standard value. If @var{option} already has a default value, +@code{defcustom} does not change it. If the user has saved a +customization for @var{option}, @code{defcustom} installs the user's +customized value as @var{option}'s default value. If neither of those +cases applies, @code{defcustom} installs the result of evaluating +@var{standard} as the default value. + +The expression @var{standard} can be evaluated at various other times, +too---whenever the customization facility needs to know @var{option}'s +standard value. So be sure to use an expression which is harmless to +evaluate at any time. We recommend avoiding backquotes in +@var{standard}, because they are not expanded when editing the value, +so list values will appear to have the wrong structure. If you specify the @code{:set} option, to make the variable take other special actions when set through the customization buffer, the @@ -406,7 +417,7 @@ type of @var{symbol}. @end defun Internally, @code{defcustom} uses the symbol property -@code{standard-value} to record the expression for the default value, +@code{standard-value} to record the expression for the standard value, and @code{saved-value} to record the value saved by the user with the customization buffer. Both properties are actually lists whose car is an expression which evaluates to the value. From 0007b8a660d4fde62c3f342acc15bd11123b066a Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:11:54 +0000 Subject: [PATCH 235/361] (Extended Menu Items): Show format of cached bindings in extended menu items. --- lispref/keymaps.texi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi index 44b92ddfcb8..13f4550a082 100644 --- a/lispref/keymaps.texi +++ b/lispref/keymaps.texi @@ -2016,7 +2016,7 @@ binding, like this: @c This line is not too long--rms. @example -(@var{item-string} @r{[}@var{help-string}@r{]} (@var{key-binding-data}) . @var{real-binding}) +(@var{item-string} @r{[}@var{help}@r{]} (@var{key-binding-data}) . @var{real-binding}) @end example @noindent @@ -2140,6 +2140,13 @@ operates on menu data structures, so you should write it so it can safely be called at any time. @end table + When an equivalent key binding is cached, the binding looks like this. + +@example +(menu-item @var{item-name} @var{real-binding} (@var{key-binding-data}) + . @var{item-property-list}) +@end example + @node Menu Separators @subsubsection Menu Separators @cindex menu separators From 4e7ab35cb786337cb9eb413fd2ca500075c3c930 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:12:46 +0000 Subject: [PATCH 236/361] (Help Mode): Move node up in file. --- man/help.texi | 114 +++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/man/help.texi b/man/help.texi index 6696b3440dd..08f528f5151 100644 --- a/man/help.texi +++ b/man/help.texi @@ -74,9 +74,9 @@ This displays the available Emacs packages based on keywords. * Key Help:: Asking what a key does in Emacs. * Name Help:: Asking about a command, variable or function name. * Apropos:: Asking what pertains to a given topic. +* Help Mode:: Special features of Help mode and Help buffers. * Library Keywords:: Finding Lisp libraries by keywords (topics). * Language Help:: Help relating to international language support. -* Help Mode:: Special features of Help mode and Help buffers. * Misc Help:: Other help commands. * Help Files:: Commands to display pre-written help files. * Help Echo:: Help on active text and tooltips (`balloon help') @@ -390,6 +390,62 @@ display the most relevant ones first. the variable @code{apropos-documentation-sort-by-scores} is @code{nil}, apropos lists the symbols found in alphabetical order. +@node Help Mode +@section Help Mode Commands + + Help buffers provide the same commands as View mode (@pxref{Misc File +Ops}), plus a few special commands of their own. + +@table @kbd +@item @key{SPC} +Scroll forward. +@item @key{DEL} +Scroll backward. +@item @key{RET} +Follow a cross reference at point. +@item @key{TAB} +Move point forward to the next cross reference. +@item S-@key{TAB} +Move point back to the previous cross reference. +@item Mouse-1 +@itemx Mouse-2 +Follow a cross reference that you click on. +@item C-c C-c +Show all documentation about the symbol at point. +@end table + + When a function name (@pxref{M-x,, Running Commands by Name}), +variable name (@pxref{Variables}), or face name (@pxref{Faces}) +appears in the documentation, it normally appears inside paired +single-quotes. To view the documentation of that command, variable or +face, you can click on the name with @kbd{Mouse-1} or @kbd{Mouse-2}, +or move point there and type @key{RET}. Use @kbd{C-c C-b} to retrace +your steps. + +@cindex URL, viewing in help +@cindex help, viewing web pages +@cindex viewing web pages in help +@cindex web pages, viewing in help +@findex browse-url + You can follow cross references to URLs (web pages) also. This uses +the @code{browse-url} command to view the page in the browser you +choose. @xref{Browse-URL}. + +@kindex @key{TAB} @r{(Help mode)} +@findex help-next-ref +@kindex S-@key{TAB} @r{(Help mode)} +@findex help-previous-ref + There are convenient commands to move point to cross references in +the help text. @key{TAB} (@code{help-next-ref}) moves point down to +the next cross reference. @kbd{S-@key{TAB}} moves up to the previous +cross reference (@code{help-previous-ref}). + + To view all documentation about any symbol name that appears in the +text, move point to the symbol name and type @kbd{C-c C-c} +(@code{help-follow-symbol}). This shows all available documentation +about the symbol as a variable, function and/or face. As above, use +@kbd{C-c C-b} to retrace your steps. + @node Library Keywords @section Keyword Search for Lisp Libraries @@ -460,62 +516,6 @@ input method currently in use. @xref{Input Methods}. coding systems---either a specified coding system, or the ones currently in use. @xref{Coding Systems}. -@node Help Mode -@section Help Mode Commands - - Help buffers provide the same commands as View mode (@pxref{Misc File -Ops}), plus a few special commands of their own. - -@table @kbd -@item @key{SPC} -Scroll forward. -@item @key{DEL} -Scroll backward. -@item @key{RET} -Follow a cross reference at point. -@item @key{TAB} -Move point forward to the next cross reference. -@item S-@key{TAB} -Move point back to the previous cross reference. -@item Mouse-1 -@itemx Mouse-2 -Follow a cross reference that you click on. -@item C-c C-c -Show all documentation about the symbol at point. -@end table - - When a function name (@pxref{M-x,, Running Commands by Name}), -variable name (@pxref{Variables}), or face name (@pxref{Faces}) -appears in the documentation, it normally appears inside paired -single-quotes. To view the documentation of that command, variable or -face, you can click on the name with @kbd{Mouse-1} or @kbd{Mouse-2}, -or move point there and type @key{RET}. Use @kbd{C-c C-b} to retrace -your steps. - -@cindex URL, viewing in help -@cindex help, viewing web pages -@cindex viewing web pages in help -@cindex web pages, viewing in help -@findex browse-url - You can follow cross references to URLs (web pages) also. This uses -the @code{browse-url} command to view the page in the browser you -choose. @xref{Browse-URL}. - -@kindex @key{TAB} @r{(Help mode)} -@findex help-next-ref -@kindex S-@key{TAB} @r{(Help mode)} -@findex help-previous-ref - There are convenient commands to move point to cross references in -the help text. @key{TAB} (@code{help-next-ref}) moves point down to -the next cross reference. @kbd{S-@key{TAB}} moves up to the previous -cross reference (@code{help-previous-ref}). - - To view all documentation about any symbol name that appears in the -text, move point to the symbol name and type @kbd{C-c C-c} -(@code{help-follow-symbol}). This shows all available documentation -about the symbol as a variable, function and/or face. As above, use -@kbd{C-c C-b} to retrace your steps. - @node Misc Help @section Other Help Commands From ef043ba0d6beddd7c6239ef34a79d6012a05e249 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:13:18 +0000 Subject: [PATCH 237/361] (Top): Update subnode menu. --- man/emacs.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/emacs.texi b/man/emacs.texi index 5277a5cebbc..780b5c97b6e 100644 --- a/man/emacs.texi +++ b/man/emacs.texi @@ -272,9 +272,9 @@ Help * Key Help:: Asking what a key does in Emacs. * Name Help:: Asking about a command, variable or function name. * Apropos:: Asking what pertains to a given topic. +* Help Mode:: Special features of Help mode and Help buffers. * Library Keywords:: Finding Lisp libraries by keywords (topics). * Language Help:: Help relating to international language support. -* Help Mode:: Special features of Help mode and Help buffers. * Misc Help:: Other help commands. * Help Files:: Commands to display pre-written help files. * Help Echo:: Help on active text and tooltips (`balloon help') From ba057869d6b25756a7785e7673466a5de25c39ab Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:13:48 +0000 Subject: [PATCH 238/361] (Marking Objects): Mention term "select all". --- man/mark.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/mark.texi b/man/mark.texi index 7429b67db2b..2736dccd297 100644 --- a/man/mark.texi +++ b/man/mark.texi @@ -369,7 +369,7 @@ negative) instead of the current page. Finally, @kbd{C-x h} (@code{mark-whole-buffer}) sets up the entire buffer as the region, by putting point at the beginning and the mark at -the end. +the end. (In some programs this is called ``select all.'') In Transient Mark mode, all of these commands activate the mark. From 1096b4a013322558b66d89ad9f71eb327696509a Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:14:31 +0000 Subject: [PATCH 239/361] (Saving Emacs Sessions): Clean up wording. --- man/misc.texi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/man/misc.texi b/man/misc.texi index 33c85a9fc8b..f6fb5edfbdb 100644 --- a/man/misc.texi +++ b/man/misc.texi @@ -1998,11 +1998,11 @@ subsequent Emacs sessions reload the saved desktop. @findex desktop-save @vindex desktop-save-mode You can save the desktop manually with the command @kbd{M-x -desktop-save}. You can also enable automatic desktop saving when -you exit Emacs and its restoring when Emacs starts: use the -Customization buffer (@pxref{Easy Customization}) to set -@code{desktop-save-mode} to @code{t} for future sessions, or add this -line in your @file{~/.emacs} file: +desktop-save}. You can also enable automatic saving of the desktop +when you exit Emacs, and automatic restoration of the last saved +desktop when Emacs starts: use the Customization buffer (@pxref{Easy +Customization}) to set @code{desktop-save-mode} to @code{t} for future +sessions, or add this line in your @file{~/.emacs} file: @example (desktop-save-mode 1) From c33f8948974b2c8614bec80860c6ec01a2a11d5f Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:15:25 +0000 Subject: [PATCH 240/361] (debug_output_compilation_hack): New function. --- src/print.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/print.c b/src/print.c index c36b9476f82..ac8736d2aa4 100644 --- a/src/print.c +++ b/src/print.c @@ -924,6 +924,15 @@ to make it write to the debugging output. */) return character; } +/* This function is never called. Its purpose is to prevent + print_output_debug_flag from being optimized away. */ + +int +debug_output_compilation_hack (x) + int x; +{ + print_output_debug_flag = x; +} #if defined(GNU_LINUX) From 3cb74cd1277590da7137297c1f2e6db95d9403a0 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 16 Aug 2006 05:17:30 +0000 Subject: [PATCH 241/361] *** empty log message *** --- ChangeLog | 4 ++++ lisp/ChangeLog | 21 +++++++++++++++++++++ lispref/ChangeLog | 8 ++++++++ man/ChangeLog | 10 ++++++++++ src/ChangeLog | 4 ++++ 5 files changed, 47 insertions(+) diff --git a/ChangeLog b/ChangeLog index b34b4d6d09c..0651090b995 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-08-16 Richard Stallman + + * INSTALL.CVS: Clean up wording. + 2006-07-14 Eli Zaretskii * configure.in (PKG_CHECK_MODULES): Redirect the output of diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 31201341796..44e3f73538e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,24 @@ +2006-08-16 Richard Stallman + + * term/x-win.el (x-clipboard-yank): Specify * in interactive spec. + (special-event-map): Process drag-n-drop events this way. + + * simple.el (move-beginning-of-line): Test whether fields + would prevent motion back to line's first visible character. + If so, stop where the fields would stop the motion. + + * newcomment.el (comment-indent): Fully update INDENT + before checking to see if it will change the text. + + * cus-edit.el (custom-newline): New function. + (custom-mode-map): Bind newline to custom-newline. + + * compare-w.el (compare-windows): Factor compare-ignore-whitespace + into ignore-whitespace. + Check each buffer for its skip-function. + Handle compare-windows-skip-whitespace special-case test + by returning t from default skip function. + 2006-08-15 Carsten Dominik * textmodes/org.el (org-clock-special-range, diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 579918f36a2..d09689ce637 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,11 @@ +2006-08-16 Richard Stallman + + * keymaps.texi (Extended Menu Items): Show format of cached + bindings in extended menu items. + + * customize.texi (Variable Definitions): Explain when the + standard value expression is evaluated. + 2006-08-15 Chong Yidong * commands.texi (Reading One Event): Explain idleness in diff --git a/man/ChangeLog b/man/ChangeLog index cdf811da570..4063ca3e2b0 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,13 @@ +2006-08-16 Richard Stallman + + * misc.texi (Saving Emacs Sessions): Clean up wording. + + * mark.texi (Marking Objects): Mention term "select all". + + * emacs.texi (Top): Update subnode menu. + + * help.texi (Help Mode): Move node up in file. + 2006-08-15 Carsten Dominik * org.texi (Installation, Activation): Split from Installation and diff --git a/src/ChangeLog b/src/ChangeLog index 58929cc40d2..b3242619d7f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-16 Richard Stallman + + * print.c (debug_output_compilation_hack): New function. + 2006-08-16 Kenichi Handa * fileio.c (choose_write_coding_system): Use LF for end-of-line From e9f67acfc1ab9c2038d7c82ddbed91ea824a599e Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 16 Aug 2006 09:04:47 +0000 Subject: [PATCH 242/361] (PKG_CHECK_MODULES): Use AS_MESSAGE_LOG_FD instead of hardcoding it. --- ChangeLog | 5 +++++ configure.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0651090b995..892a4a18ba3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-08-16 Andreas Schwab + + * configure.in (PKG_CHECK_MODULES): Use AS_MESSAGE_LOG_FD instead + of hardcoding it. + 2006-08-16 Richard Stallman * INSTALL.CVS: Clean up wording. diff --git a/configure.in b/configure.in index f6fe08f8f54..0b7a62907d2 100644 --- a/configure.in +++ b/configure.in @@ -1500,7 +1500,7 @@ AC_DEFUN([PKG_CHECK_MODULES], [ if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then AC_MSG_CHECKING(for $2) - if $PKG_CONFIG --exists "$2" 2>&5; then + if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD; then AC_MSG_RESULT(yes) succeeded=yes From dae581bf8d1eb6b08fac90505e38244db2a3f3da Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 16 Aug 2006 12:33:12 +0000 Subject: [PATCH 243/361] (debug_output_compilation_hack): Fix return type. --- src/ChangeLog | 4 ++++ src/print.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index b3242619d7f..f37715a4b71 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-16 Andreas Schwab + + * print.c (debug_output_compilation_hack): Fix return type. + 2006-08-16 Richard Stallman * print.c (debug_output_compilation_hack): New function. diff --git a/src/print.c b/src/print.c index ac8736d2aa4..e56c231d30a 100644 --- a/src/print.c +++ b/src/print.c @@ -927,7 +927,7 @@ to make it write to the debugging output. */) /* This function is never called. Its purpose is to prevent print_output_debug_flag from being optimized away. */ -int +void debug_output_compilation_hack (x) int x; { From 5ebdc2990a95cc38b21f772eea4de3ceee149e54 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Wed, 16 Aug 2006 14:04:41 +0000 Subject: [PATCH 244/361] Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 123-125) - Update from CVS 2006-08-09 Katsumi Yamaoka * lisp/gnus/compface.el (uncompface): Use binary rather than raw-text-unix. 2006-08-09 Katsumi Yamaoka * lisp/gnus/compface.el (uncompface): Make sure the eol conversion doesn't take place when communicating with the external programs. Reported by ARISAWA Akihiro . 2006-07-31 Katsumi Yamaoka * lisp/gnus/nnheader.el (nnheader-insert-head): Fix typo in comment. 2006-07-31 Andreas Seltenreich * lisp/gnus/nnweb.el (nnweb-google-parse-1): Update regexp for author and date. Make it more robust by parsing author and date independently. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-398 --- lisp/gnus/ChangeLog | 19 +++++++++++++++++++ lisp/gnus/compface.el | 40 ++++++++++++++++++++++------------------ lisp/gnus/nnheader.el | 2 +- lisp/gnus/nnweb.el | 11 ++++++----- 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 3da68ecb902..6ddd513610a 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -3,6 +3,25 @@ * mm-extern.el (mm-extern-mail-server): End `y-or-n-p' prompt with a space. +2006-08-09 Katsumi Yamaoka + + * compface.el (uncompface): Use binary rather than raw-text-unix. + +2006-08-09 Katsumi Yamaoka + + * compface.el (uncompface): Make sure the eol conversion doesn't take + place when communicating with the external programs. Reported by + ARISAWA Akihiro . + +2006-07-31 Katsumi Yamaoka + + * nnheader.el (nnheader-insert-head): Fix typo in comment. + +2006-07-31 Andreas Seltenreich + + * nnweb.el (nnweb-google-parse-1): Update regexp for author and date. + Make it more robust by parsing author and date independently. + 2006-07-28 Katsumi Yamaoka * nnheader.el (nnheader-insert-head): Make it work with Mac as well. diff --git a/lisp/gnus/compface.el b/lisp/gnus/compface.el index f6bd9bfd720..33e05046e84 100644 --- a/lisp/gnus/compface.el +++ b/lisp/gnus/compface.el @@ -34,24 +34,28 @@ GNU/Linux system these might be in packages with names like `compface' or `faces-xface' and `netpbm' or `libgr-progs', for instance." (with-temp-buffer (insert face) - (and (eq 0 (apply 'call-process-region (point-min) (point-max) - "uncompface" - 'delete '(t nil) nil)) - (progn - (goto-char (point-min)) - (insert "/* Width=48, Height=48 */\n") - ;; I just can't get "icontopbm" to work correctly on its - ;; own in XEmacs. And Emacs doesn't understand un-raw pbm - ;; files. - (if (not (featurep 'xemacs)) - (eq 0 (call-process-region (point-min) (point-max) - "icontopbm" - 'delete '(t nil))) - (shell-command-on-region (point-min) (point-max) - "icontopbm | pnmnoraw" - (current-buffer) t) - t)) - (buffer-string)))) + (let ((coding-system-for-read 'raw-text) + ;; At least "icontopbm" doesn't work with Windows because + ;; the line-break code is converted into CRLF by default. + (coding-system-for-write 'binary)) + (and (eq 0 (apply 'call-process-region (point-min) (point-max) + "uncompface" + 'delete '(t nil) nil)) + (progn + (goto-char (point-min)) + (insert "/* Width=48, Height=48 */\n") + ;; I just can't get "icontopbm" to work correctly on its + ;; own in XEmacs. And Emacs doesn't understand un-raw pbm + ;; files. + (if (not (featurep 'xemacs)) + (eq 0 (call-process-region (point-min) (point-max) + "icontopbm" + 'delete '(t nil))) + (shell-command-on-region (point-min) (point-max) + "icontopbm | pnmnoraw" + (current-buffer) t) + t)) + (buffer-string))))) (provide 'compface) diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el index 79732cd3d88..82e1d3ab554 100644 --- a/lisp/gnus/nnheader.el +++ b/lisp/gnus/nnheader.el @@ -598,7 +598,7 @@ the line could be found." (nth 1 (mm-insert-file-contents file nil beg (incf beg nnheader-head-chop-length)))) - ;; CRLF of CR might be used for the line-break code. + ;; CRLF or CR might be used for the line-break code. (prog1 (not (re-search-forward "\n\r?\n\\|\r\r" nil t)) (goto-char (point-max))) (or (null nnheader-max-head-length) diff --git a/lisp/gnus/nnweb.el b/lisp/gnus/nnweb.el index 7c0c8e0e444..d020d533aea 100644 --- a/lisp/gnus/nnweb.el +++ b/lisp/gnus/nnweb.el @@ -366,14 +366,15 @@ Valid types include `google', `dejanews', and `gmane'.") (mm-url-decode-entities) (search-backward " - ") (when (looking-at - " - \\([a-zA-Z]+\\) \\([0-9]+\\)\\(?: \\([0-9]\\{4\\}\\)\\)?[^\n]+by ?\n?\\([^<\n]+\\)\n") - (setq From (match-string 4) - Date (format "%s %s 00:00:00 %s" + "\\W+\\(\\w+\\) \\([0-9]+\\)\\(?: \\([0-9]\\{4\\}\\)\\)?") + (setq Date (format "%s %s 00:00:00 %s" (match-string 1) (match-string 2) (or (match-string 3) - (substring (current-time-string) -4))))) - + (substring (current-time-string) -4)))) + (goto-char (match-end 0))) + (when (looking-at "[^b]+by\\W+\\([^<\n]+\\)") + (setq From (match-string 1))) (widen) (forward-line 1) (incf i) From 3d93bda58994eed209f514a6f4aeb733516c4510 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 17 Aug 2006 03:19:55 +0000 Subject: [PATCH 245/361] (font-lock-extend-region-wholelines): Fix up typo. Reported by Martin Rudalics . --- lisp/ChangeLog | 48 ++++++++++++++++++++++++----------------------- lisp/font-lock.el | 4 ++-- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 44e3f73538e..98665776587 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-16 Stefan Monnier + + * font-lock.el (font-lock-extend-region-wholelines): Fix up typo. + Reported by Martin Rudalics . + 2006-08-16 Richard Stallman * term/x-win.el (x-clipboard-yank): Specify * in interactive spec. @@ -18,23 +23,23 @@ Check each buffer for its skip-function. Handle compare-windows-skip-whitespace special-case test by returning t from default skip function. - + 2006-08-15 Carsten Dominik - * textmodes/org.el (org-clock-special-range, - org-clock-update-time-maybe): New functions. + * textmodes/org.el (org-clock-special-range) + (org-clock-update-time-maybe): New functions. (org-stamp-time-of-day-regexp): Allow weekday to be of word chars, not only a-z. (org-agenda-get-blocks): Allow multiple blocks per headline. (org-timestamp-change): Call `org-clock-update-time-maybe'. (org-export-html-title-format) (org-export-html-toplevel-hlevel): New options. - (org-export-language-setup): Added support for Czech. + (org-export-language-setup): Add support for Czech. (org-mode, org-insert-todo-heading, org-find-visible) (org-find-invisible, org-invisible-p, org-invisible-p2) (org-back-to-heading, org-on-heading-p, org-up-heading-all) (org-show-subtree, org-show-entry, org-make-options-regexp): - Removed compatibility support for old outline-mode. + Remove compatibility support for old outline-mode. (org-check-occur-regexp): Funtion removed. (org-on-heading-p, org-back-to-heading): Made defalias. (org-set-local): New defsubst. @@ -44,7 +49,7 @@ (org-remember-apply-template, org-table-edit-field) (org-table-edit-formulas, orgtbl-mode, org-export-as-ascii) (org-set-autofill-regexps): Use `org-set-local'. - (org-table-eval-formula): Fixed bug with parsing of display flags. + (org-table-eval-formula): Fix bug with parsing of display flags. 2006-08-15 Nick Roberts @@ -53,8 +58,8 @@ . (gdb-stack-position): New variable. (gdb-starting, gdb-exited): Reset gdb-stack-position to nil. - (gdb-frames-mode): Set gdb-stack-position to nil. Add to - overlay-arrow-variable-list + (gdb-frames-mode): Set gdb-stack-position to nil. + Add to overlay-arrow-variable-list (gdb-reset): Delete gdb-stack-position from above list. 2006-08-14 Jan Dj,Ad(Brv @@ -95,8 +100,8 @@ Add customization vars controlling allout-beginning-of-line and allout-end-of-line conveniences. (allout-header-prefix, allout-use-mode-specific-leader) - (allout-use-mode-specific-leader, allout-mode-leaders): Revised - docstrings. + (allout-use-mode-specific-leader, allout-mode-leaders): + Revise docstrings. (allout-infer-header-lead): Change to be an alias for allout-infer-header-lead-and-primary-bullet. (allout-infer-header-lead-and-primary-bullet): New version of @@ -136,29 +141,26 @@ (allout-beginning-of-line): Respect `allout-beginning-of-line-cycles'. (allout-end-of-line): Respect `allout-end-of-line-cycles'. (allout-chart-subtree): Implement new mode, charting only the - visible items in the subtree, when new 'visible' parameter is - non-nil. - (allout-end-of-subtree): Properly handle the last item in the - buffer. - (allout-pre-command-business, allout-command-counter): Increment - an advertised counter so that cooperating enhancements can track - revisions of items. + visible items in the subtree, when new 'visible' parameter is non-nil. + (allout-end-of-subtree): Properly handle the last item in the buffer. + (allout-pre-command-business, allout-command-counter): + Increment an advertised counter so that cooperating enhancements can + track revisions of items. (allout-open-topic): Run allout-structure-added-hook with suitable arguments. (allout-shift-in): Run allout-structure-shifted-hook with suitable arguments. (allout-shift-out): Fix doubling for negative args and ensure call of allout-structure-shifted-hook by solely using allout-shift-in. - (allout-kill-line, allout-kill-topic): Run - allout-structure-deleted-hook with suitable arguments. + (allout-kill-line, allout-kill-topic): + Run allout-structure-deleted-hook with suitable arguments. (allout-yank-processing): Run allout-structure-added-hook with proper arguments. (allout-yank): Enclose activity in allout-unprotected. (allout-flag-region): Run allout-exposure-change-hook with - suitable arguments, instead of making the callee infer the - arguments. - (allout-encrypt-string): Support - allout-encryption-plaintext-sanitization-regexps, + suitable arguments, instead of making the callee infer the arguments. + (allout-encrypt-string): + Support allout-encryption-plaintext-sanitization-regexps, allout-encryption-ciphertext-rejection-regexps, and allout-encryption-ciphertext-rejection-ceiling. Indicate correct en/de cryption mode in symmetric encryption failure message. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index b662a6735b0..241a09b7908 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1088,9 +1088,9 @@ Put first the functions more likely to cause a change and cheaper to compute.") "Move fontification boundaries to beginning of lines." (let ((changed nil)) (goto-char font-lock-beg) - (unless (bobp) (setq changed t font-lock-beg (line-beginning-position))) + (unless (bolp) (setq changed t font-lock-beg (line-beginning-position))) (goto-char font-lock-end) - (unless (bobp) (setq changed t font-lock-end (line-beginning-position 2))) + (unless (bolp) (setq changed t font-lock-end (line-beginning-position 2))) changed)) (defun font-lock-default-fontify-region (beg end loudly) From 3e9323d603b0b47ab47af3398a8154b13d2d7e13 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 17 Aug 2006 03:36:17 +0000 Subject: [PATCH 246/361] (global-map): Allow yanking with mouse-2 at a spot whose cursor would normally be drawn in the fringe. --- lisp/ChangeLog | 3 +++ lisp/mouse.el | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 98665776587..6ef271e8f48 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2006-08-16 Stefan Monnier + * mouse.el (global-map): Allow yanking with mouse-2 at a spot whose + cursor would normally be drawn in the fringe. + * font-lock.el (font-lock-extend-region-wholelines): Fix up typo. Reported by Martin Rudalics . diff --git a/lisp/mouse.el b/lisp/mouse.el index 043c78578db..4e11b1d4c96 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -2398,6 +2398,8 @@ and selects that window." (global-set-key [right-fringe mouse-1] 'mouse-set-point) (global-set-key [mouse-2] 'mouse-yank-at-click) +;; Allow yanking also when the corresponding cursor is "in the fringe". +(global-set-key [right-fringe mouse-2] [mouse-2]) (global-set-key [mouse-3] 'mouse-save-then-kill) ;; By binding these to down-going events, we let the user use the up-going From 5802a1c92a0e3887fafdff25e405f76121d97dca Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Thu, 17 Aug 2006 11:44:05 +0000 Subject: [PATCH 247/361] *** empty log message *** --- lisp/ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6ef271e8f48..d703ee7cbba 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2006-08-17 Nick Roberts + + * progmodes/gdb-ui.el (gdb-locals-watch-map) + (gdb-locals-watch-map-1): Suppress keymap first. + (gdb-edit-locals-map-1): New variable. + (gdb-edit-locals-value): New function. + (gdb-stack-list-locals-handler): Use them. + 2006-08-16 Stefan Monnier * mouse.el (global-map): Allow yanking with mouse-2 at a spot whose From 38a52690e0d5d9f1ba1bbf9af21da50a1ce0a7c3 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Thu, 17 Aug 2006 11:44:40 +0000 Subject: [PATCH 248/361] (gdb-locals-watch-map, gdb-locals-watch-map-1): Suppress keymap first. (gdb-edit-locals-map-1): New variable. (gdb-edit-locals-value): New function. (gdb-stack-list-locals-handler): Use them. --- lisp/progmodes/gdb-ui.el | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index b5334ba5bc5..61078877c31 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -384,8 +384,7 @@ With arg, use separate IO iff arg is positive." (list t nil) nil "-c" (concat gdb-cpp-define-alist-program " " gdb-cpp-define-alist-flags))))) - (define-list (split-string output "\n" t)) - (name)) + (define-list (split-string output "\n" t)) (name)) (setq gdb-define-alist nil) (dolist (define define-list) (setq name (nth 1 (split-string define "[( ]"))) @@ -2657,6 +2656,7 @@ corresponding to the mode line clicked." (defvar gdb-locals-watch-map (let ((map (make-sparse-keymap))) + (suppress-keymap map) (define-key map "\r" (lambda () (interactive) (beginning-of-line) (gud-watch))) @@ -3512,10 +3512,32 @@ in_scope=\"\\(.*?\\)\".*?}") (defvar gdb-locals-watch-map-1 (let ((map (make-sparse-keymap))) + (suppress-keymap map) + (define-key map "\r" 'gud-watch) (define-key map [mouse-2] 'gud-watch) map) "Keymap to create watch expression of a complex data type local variable.") +(defvar gdb-edit-locals-map-1 + (let ((map (make-sparse-keymap))) + (suppress-keymap map) + (define-key map "\r" 'gdb-edit-locals-value) + (define-key map [mouse-2] 'gdb-edit-locals-value) + map) + "Keymap to edit value of a simple data type local variable.") + +(defun gdb-edit-locals-value (&optional event) + "Assign a value to a variable displayed in the locals buffer." + (interactive (list last-input-event)) + (save-excursion + (if event (posn-set-point (event-end event))) + (beginning-of-line) + (let* ((var (current-word)) + (value (read-string (format "New value (%s): " var)))) + (gdb-enqueue-input + (list (concat gdb-server-prefix"set variable " var " = " value "\n") + 'ignore)))))) + ;; Dont display values of arrays or structures. ;; These can be expanded using gud-watch. (defun gdb-stack-list-locals-handler () @@ -3543,17 +3565,23 @@ in_scope=\"\\(.*?\\)\".*?}") (let* ((window (get-buffer-window buf 0)) (start (window-start window)) (p (window-point window)) - (buffer-read-only nil)) + (buffer-read-only nil) (name) (value)) (erase-buffer) (dolist (local locals-list) (setq name (car local)) - (if (or (not (nth 2 local)) - (string-match "^\\0x" (nth 2 local))) + (setq value (nth 2 local)) + (if (or (not value) + (string-match "^\\0x" value)) (add-text-properties 0 (length name) `(mouse-face highlight help-echo "mouse-2: create watch expression" local-map ,gdb-locals-watch-map-1) - name)) + name) + (add-text-properties 0 (length value) + `(mouse-face highlight + help-echo "mouse-2: edit value" + local-map ,gdb-edit-locals-map-1) + value)) (insert (concat name "\t" (nth 1 local) "\t" (nth 2 local) "\n"))) From bce848ed515d75ccc24c7ea54b7ac72dbba6a630 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 17 Aug 2006 14:53:09 +0000 Subject: [PATCH 249/361] (cvs-parse-table): Accept the new `...' format for removed files. --- lisp/ChangeLog | 5 +++++ lisp/pcvs-parse.el | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d703ee7cbba..4234fdc3d44 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-17 Stefan Monnier + + * pcvs-parse.el (cvs-parse-table): Accept the new `...' format for + removed files. + 2006-08-17 Nick Roberts * progmodes/gdb-ui.el (gdb-locals-watch-map) diff --git a/lisp/pcvs-parse.el b/lisp/pcvs-parse.el index 0193939606c..bd493126532 100644 --- a/lisp/pcvs-parse.el +++ b/lisp/pcvs-parse.el @@ -285,7 +285,8 @@ The remaining KEYS are passed directly to `cvs-create-fileinfo'." (and (cvs-or (cvs-match "warning: \\(.*\\) is not (any longer) pertinent$" (file 1)) - (cvs-match "\\(.*\\) is no longer in the repository$" (file 1))) + (cvs-match "`\\(.*\\)' is no longer in the repository$" (file 1)) + (cvs-match "\\(.*\\) is no longer in the repository$" (file 1))) (cvs-parsed-fileinfo (if dont-change-disc '(NEED-UPDATE . REMOVED) 'DEAD) file)) From 9fd762b0633b14c6d065b2b448f57a2d62663ad6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 17 Aug 2006 15:10:21 +0000 Subject: [PATCH 250/361] (jit-lock-fontify-now): Protect the modified status of the right buffer. --- lisp/ChangeLog | 5 +++++ lisp/jit-lock.el | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4234fdc3d44..bec7cab8a3a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-17 Martin Rudalics + + * jit-lock.el (jit-lock-fontify-now): Protect the modified status of + the right buffer. + 2006-08-17 Stefan Monnier * pcvs-parse.el (cvs-parse-table): Accept the new `...' format for diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index 4d7afe8c33f..606cd1e0b84 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -391,9 +391,10 @@ Defaults to the whole buffer. END can be out of bounds." (buf (current-buffer))) (run-with-timer 0 nil (lambda () - (with-buffer-prepared-for-jit-lock - (put-text-property start orig-start - 'fontified t buf)))))) + (with-current-buffer buf + (with-buffer-prepared-for-jit-lock + (put-text-property start orig-start + 'fontified t))))))) ;; Find the start of the next chunk, if any. (setq start (text-property-any next end 'fontified nil)))))))) @@ -577,10 +578,10 @@ the three arguments of `after-change-functions': START END OLD-LEN. The extended region to refontify is returned indirectly by modifying the variables `jit-lock-start' and `jit-lock-end'. -Note that extending the region this way is not strictly necessary, -except that the nature of the redisplay code tends to otherwise leave -some of the rehighlighted text displayed with the old highlight until the -next redisplay. See comment in `jit-lock-fontify-now'.") +Note that extending the region this way is not strictly necessary, except +that the nature of the redisplay code tends to otherwise leave some of +the rehighlighted text displayed with the old highlight until the next +redisplay (see comment about repeated redisplay in `jit-lock-fontify-now').") (defun jit-lock-after-change (start end old-len) "Mark the rest of the buffer as not fontified after a change. From fb5422b2d186d61a86cc5aa3ca8c502cf6988409 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 17 Aug 2006 15:22:21 +0000 Subject: [PATCH 251/361] (compare-windows): lambda's take an arg and pass it to compare-windows-skip-whitespace. --- lisp/ChangeLog | 5 +++++ lisp/compare-w.el | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bec7cab8a3a..f62e924ffaf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-17 Richard Stallman + + * compare-w.el (compare-windows): lambda's take an arg and pass + it to compare-windows-skip-whitespace. + 2006-08-17 Martin Rudalics * jit-lock.el (jit-lock-fontify-now): Protect the modified status of diff --git a/lisp/compare-w.el b/lisp/compare-w.el index 3aa01424fb5..8dc0ac1e330 100644 --- a/lisp/compare-w.el +++ b/lisp/compare-w.el @@ -191,14 +191,16 @@ on third call it again advances points to the next difference and so on." (setq skip-func-1 (if ignore-whitespace (if (stringp compare-windows-whitespace) - (lambda () (compare-windows-skip-whitespace) + (lambda (pos) + (compare-windows-skip-whitespace pos) t) compare-windows-whitespace))) (with-current-buffer b2 (setq skip-func-2 (if ignore-whitespace (if (stringp compare-windows-whitespace) - (lambda () (compare-windows-skip-whitespace) + (lambda (pos) + (compare-windows-skip-whitespace pos) t) compare-windows-whitespace))) (push-mark p2 t) From 31ab08e6ad68add18a2ef89fcbe17138f534a851 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Thu, 17 Aug 2006 17:34:39 +0000 Subject: [PATCH 252/361] *** empty log message *** --- lisp/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f62e924ffaf..b90552008c8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -3,7 +3,7 @@ * compare-w.el (compare-windows): lambda's take an arg and pass it to compare-windows-skip-whitespace. -2006-08-17 Martin Rudalics +2006-08-17 Martin Rudalics * jit-lock.el (jit-lock-fontify-now): Protect the modified status of the right buffer. From bfe0c147d515c6e2eeca6d80ff295a125897ed17 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Thu, 17 Aug 2006 17:56:57 +0000 Subject: [PATCH 253/361] (gdb-edit-locals-value): Balance parens. --- lisp/ChangeLog | 4 ++++ lisp/progmodes/gdb-ui.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b90552008c8..86ac55cd5dc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-17 Romain Francoise + + * progmodes/gdb-ui.el (gdb-edit-locals-value): Balance parens. + 2006-08-17 Richard Stallman * compare-w.el (compare-windows): lambda's take an arg and pass diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 61078877c31..ff16daf6436 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -3536,7 +3536,7 @@ in_scope=\"\\(.*?\\)\".*?}") (value (read-string (format "New value (%s): " var)))) (gdb-enqueue-input (list (concat gdb-server-prefix"set variable " var " = " value "\n") - 'ignore)))))) + 'ignore))))) ;; Dont display values of arrays or structures. ;; These can be expanded using gud-watch. From 454e31b372768c8fb24eb10150e4032e3833af90 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Thu, 17 Aug 2006 21:00:13 +0000 Subject: [PATCH 254/361] *** empty log message *** --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index f37715a4b71..68a2bb082ec 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-18 Nick Roberts + + * window.c (Fset_window_fringes): Do nothing on a tty. + (Fwindow_fringes): Put ? operator after the line break. + 2006-08-16 Andreas Schwab * print.c (debug_output_compilation_hack): Fix return type. From d46c6df554b71c54ed9b66122f90d79ef66f1d63 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Thu, 17 Aug 2006 21:00:44 +0000 Subject: [PATCH 255/361] (Fset_window_fringes): Do nothing on a tty. (Fwindow_fringes): Put ? operator after the line break. --- src/window.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/window.c b/src/window.c index 5a7655999f5..47c47fe0f51 100644 --- a/src/window.c +++ b/src/window.c @@ -6656,10 +6656,12 @@ display marginal areas and the text area. */) CHECK_NATNUM (left_width); if (!NILP (right_width)) CHECK_NATNUM (right_width); - - if (!EQ (w->left_fringe_width, left_width) - || !EQ (w->right_fringe_width, right_width) - || !EQ (w->fringes_outside_margins, outside_margins)) + + /* Do nothing on a tty. */ + if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) + && (!EQ (w->left_fringe_width, left_width) + || !EQ (w->right_fringe_width, right_width) + || !EQ (w->fringes_outside_margins, outside_margins))) { w->left_fringe_width = left_width; w->right_fringe_width = right_width; @@ -6687,10 +6689,11 @@ Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) Lisp_Object window; { struct window *w = decode_window (window); + return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), - Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ? - Qt : Qnil), Qnil))); + Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? Qt : Qnil), Qnil))); } From 017e297ea90933bfde94de5f90f9f9260ff032e8 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 18 Aug 2006 01:52:19 +0000 Subject: [PATCH 256/361] Comment change. --- src/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window.c b/src/window.c index 47c47fe0f51..ba8a541e779 100644 --- a/src/window.c +++ b/src/window.c @@ -6657,7 +6657,7 @@ display marginal areas and the text area. */) if (!NILP (right_width)) CHECK_NATNUM (right_width); - /* Do nothing on a tty. */ + /* Do nothing on a tty. */ if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) && (!EQ (w->left_fringe_width, left_width) || !EQ (w->right_fringe_width, right_width) From a8bcc348b132a018956ca661db45d72b26225b0e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 18 Aug 2006 12:07:38 +0000 Subject: [PATCH 257/361] (spaces-string): Simplify and add doc string. --- lisp/ChangeLog | 4 ++++ lisp/rect.el | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 86ac55cd5dc..5ebd5bbb859 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-18 Gustav H,Ae(Bllberg (tiny change) + + * rect.el (spaces-string): Simplify and add doc string. + 2006-08-17 Romain Francoise * progmodes/gdb-ui.el (gdb-edit-locals-value): Balance parens. diff --git a/lisp/rect.el b/lisp/rect.el index be3a65ccd6a..9515733ef2b 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -181,12 +181,9 @@ the function is called." ;; this one is untouched --dv (defun spaces-string (n) + "Returns a string with N spaces." (if (<= n 8) (aref spaces-strings n) - (let ((val "")) - (while (> n 8) - (setq val (concat " " val) - n (- n 8))) - (concat val (aref spaces-strings n))))) + (make-string n ? ))) ;;;###autoload (defun delete-rectangle (start end &optional fill) From b8ae17637ce688e240446e680ee930002fd8beec Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 18 Aug 2006 12:41:09 +0000 Subject: [PATCH 258/361] Synchronize with TUTORIAL. --- etc/TUTORIAL.it | 6 +++--- etc/TUTORIAL.sl | 2 +- etc/TUTORIAL.sv | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/TUTORIAL.it b/etc/TUTORIAL.it index 46388e78cc3..84e10878fa8 100644 --- a/etc/TUTORIAL.it +++ b/etc/TUTORIAL.it @@ -219,9 +219,9 @@ La schermata si sposta di 8 righe verso l'alto. Se vuoi tornare di nuovo in basso puoi usare un argomento numerico con M-v. Quando si usa un sistema a finestre, come X11 o MS-Windows, ci dovrebbe -essere un'area rettangolare allungata chiamata barra di scorrimento sul -lato sinistro della finestra di Emacs. Si può far scorrere il testo con -un click del mouse nella barra di scorrimento. +essere un'area rettangolare allungata chiamata barra di scorrimento a +un lato della finestra di Emacs. Si può far scorrere il testo con un +click del mouse nella barra di scorrimento. >> Prova a premere il pulsante centrale del mouse sopra all'area evidenziata nella barra di scorrimento. Verrà visualizzata una parte diff --git a/etc/TUTORIAL.sl b/etc/TUTORIAL.sl index 52d2d18766c..3cb38ace65b 100644 --- a/etc/TUTORIAL.sl +++ b/etc/TUTORIAL.sl @@ -222,7 +222,7 @@ To bi moralo zaslon premakniti navzgor za osem vrstic. premaknili nazaj, poskusite M-v z istim argumentom. Èe uporabljate grafièni vmesnik, denimo X11 ali MS Windows, imate -verjetno ob levem robu Emacsovega okna navpièno pravokotno ploskev, +verjetno ob robu Emacsovega okna navpièno pravokotno ploskev, imenovano drsnik. Pogled na besedilo lahko premikate tudi tako, da z mi¹ko kliknete na drsnik. diff --git a/etc/TUTORIAL.sv b/etc/TUTORIAL.sv index a2e0cd9abea..732d1fa397e 100644 --- a/etc/TUTORIAL.sv +++ b/etc/TUTORIAL.sv @@ -224,7 +224,7 @@ Detta borde ha flyttat sk tillbaka igen är det bara att ge samma argument till M-v. Om du använder Emacs under ett fönstersystem, som X11 eller -MS-Windows, finns det troligen ett rektangulärt område på vänster sida +MS-Windows, finns det troligen ett rektangulärt område på sidan av Emacs-fönstret, en så kallad rullningslist. Genom att klicka i den med musen kan du rulla texten. From 6e6f0cb6ab4c8df5f33d5d857147f15a52400bf2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 18 Aug 2006 12:50:08 +0000 Subject: [PATCH 259/361] (whitespace-cleanup-internal): New optional arg REGION-ONLY. If it's non-nil, modify the message to the user accordingly. (whitespace-cleanup-region): Call whitespace-cleanup-internal with a non-nil argument. --- lisp/whitespace.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 449606607f6..1d162e515e4 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -524,7 +524,7 @@ See `whitespace-buffer' docstring for a summary of the problems." (whitespace-cleanup-region (region-beginning) (region-end)) (whitespace-cleanup-internal))) -(defun whitespace-cleanup-internal () +(defun whitespace-cleanup-internal (&optional region-only) ;; If this buffer really contains a file, then run, else quit. (whitespace-check-whitespace-mode current-prefix-arg) (if (and buffer-file-name whitespace-mode) @@ -569,9 +569,12 @@ See `whitespace-buffer' docstring for a summary of the problems." ;; Call this recursively till everything is taken care of (if whitespace-any (whitespace-cleanup-internal) + ;; if we are done, talk to the user (progn - (if (not whitespace-silent) - (message "%s clean" buffer-file-name)) + (unless whitespace-silent + (if region-only + (message "The region is now clean") + (message "%s is now clean" buffer-file-name))) (whitespace-update-modeline))) (setq tab-width whitespace-tabwith-saved)))) @@ -582,7 +585,7 @@ See `whitespace-buffer' docstring for a summary of the problems." (save-excursion (save-restriction (narrow-to-region s e) - (whitespace-cleanup-internal)) + (whitespace-cleanup-internal t)) (whitespace-buffer t))) (defun whitespace-buffer-leading () From fa1f79270d61d371e26bce5e60a0f9e17a7944da Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 18 Aug 2006 12:51:09 +0000 Subject: [PATCH 260/361] *** empty log message *** --- etc/ChangeLog | 12 ++++++++++++ lisp/ChangeLog | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index 32d7525e153..0d61048a858 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,15 @@ +2006-08-18 Primoz PETERLIN + + * TUTORIAL.sl: Synchronize with TUTORIAL. + +2006-08-18 Mats Lidell + + * TUTORIAL.sv: Synchronize with TUTORIAL. + +2006-08-18 Alfredo Finelli + + * TUTORIAL.it: Synchronize with TUTORIAL. + 2006-08-15 Carsten Dominik * orgcard.tex: Version number change. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5ebd5bbb859..e5692b08fb7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2006-08-18 Yoni Rabkin Katzenell (tiny change) + + * whitespace.el (whitespace-cleanup-internal): New optional arg + REGION-ONLY. If it's non-nil, modify the message to the user + accordingly. + (whitespace-cleanup-region): Call whitespace-cleanup-internal with + a non-nil argument. + 2006-08-18 Gustav H,Ae(Bllberg (tiny change) * rect.el (spaces-string): Simplify and add doc string. From 73a0e48276296383da15e948952cccccca2b4105 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 18 Aug 2006 16:17:20 +0000 Subject: [PATCH 261/361] - Jorgen Schaefer 's June 18 bug report Fixed in RMS' 2006-08-16 commit. --- admin/FOR-RELEASE | 3 --- 1 file changed, 3 deletions(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 35070c082b1..f0055d2a723 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -39,9 +39,6 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. '(hscroll-step 1) ) -** Jorgen Schaefer 's June 18 bug report about - fields and invisible overlays needs attention from a field expert. - ** Implement buffer-chars-modified-tick. ** henman@it.to-be.co.jp 09 Aug 2006: ispell.el problem. From ff458d812f881e04585bef6bdb96e3cd0ddd905d Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 20 Aug 2006 12:06:20 +0000 Subject: [PATCH 262/361] (Fcurrent_idle_time): New function. (syms_of_keyboard): defsubr it. --- src/keyboard.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/keyboard.c b/src/keyboard.c index fed6fbc79dd..13ab5299982 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4543,6 +4543,35 @@ timer_check (do_it_now) UNGCPRO; return nexttime; } + +DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0, + /* Return the current length of Emacs idleness. +The value is returned as a list of three integers. The first has the +most significant 16 bits of the seconds, while the second has the +least significant 16 bits. The third integer gives the microsecond +count. + +The microsecond count is zero on systems that do not provide +resolution finer than a second. */) + () +{ + EMACS_TIME now, idleness_now; + Lisp_Object result[3]; + + EMACS_GET_TIME (now); + if (! EMACS_TIME_NEG_P (timer_idleness_start_time)) + { + EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time); + + XSETINT (result[0], (EMACS_SECS (idleness_now) >> 16) & 0xffff); + XSETINT (result[1], (EMACS_SECS (idleness_now) >> 0) & 0xffff); + XSETINT (result[2], EMACS_USECS (idleness_now)); + + return Flist (3, result); + } + + return Qnil; +} /* Caches for modify_event_symbol. */ static Lisp_Object accent_key_syms; @@ -11131,6 +11160,7 @@ syms_of_keyboard () menu_bar_items_vector = Qnil; staticpro (&menu_bar_items_vector); + defsubr (&Scurrent_idle_time); defsubr (&Sevent_convert_list); defsubr (&Sread_key_sequence); defsubr (&Sread_key_sequence_vector); From 2eb582aeac58327a85bd1a5fbdb21fd95264293a Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 20 Aug 2006 12:06:59 +0000 Subject: [PATCH 263/361] (load_pixmap): Add quotes in error message. --- src/xfaces.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xfaces.c b/src/xfaces.c index 99355cca6af..3dc5ddc3401 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -1189,7 +1189,7 @@ load_pixmap (f, name, w_ptr, h_ptr) if (bitmap_id < 0) { - add_to_log ("Invalid or undefined bitmap %s", name, Qnil); + add_to_log ("Invalid or undefined bitmap `%s'", name, Qnil); bitmap_id = 0; if (w_ptr) From 9d45757a54c52f07d22029f999df1d9a1a89ddb4 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 20 Aug 2006 12:09:37 +0000 Subject: [PATCH 264/361] (Idle Timers): New node, split out from Timers. Document current-idle-time. --- lispref/os.texi | 65 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 5 deletions(-) diff --git a/lispref/os.texi b/lispref/os.texi index ab277afdce6..65510197e4e 100644 --- a/lispref/os.texi +++ b/lispref/os.texi @@ -28,6 +28,8 @@ pertaining to the terminal and the screen. * Processor Run Time:: Getting the run time used by Emacs. * Time Calculations:: Adding, subtracting, comparing times, etc. * Timers:: Setting a timer to call a function at a certain time. +* Idle Timers:: Setting a timer to call a function when Emacs has + been idle for a certain length of time. * Terminal Input:: Accessing and recording terminal input. * Terminal Output:: Controlling and recording terminal output. * Sound Output:: Playing sounds on the computer's speaker. @@ -1473,6 +1475,21 @@ calls one of those primitives. So use @code{with-timeout} only with a a timer to avoid waiting too long for an answer. @xref{Yes-or-No Queries}. +@defun cancel-timer timer +This cancels the requested action for @var{timer}, which should be a +timer---usually, one previously returned by @code{run-at-time} or +@code{run-with-idle-timer}. This cancels the effect of that call to +one of these functions; the arrival of the specified time will not +cause anything special to happen. +@end defun + +@node Idle Timers +@section Idle Timers + + Here is how to set up a timer that runs when Emacs is idle for a +certain length of time. Aside from how to set them nup, idle timers +work just like ordinary timers. + @deffn Command run-with-idle-timer secs repeat function &rest args Set up a timer which runs when Emacs has been idle for @var{secs} seconds. The value of @var{secs} may be an integer or a floating point @@ -1508,11 +1525,49 @@ minutes, and even if there have been garbage collections and autosaves. input. Then it becomes idle again, and all the idle timers that are set up to repeat will subsequently run another time, one by one. -@defun cancel-timer timer -Cancel the requested action for @var{timer}, which should be a value -previously returned by @code{run-at-time} or @code{run-with-idle-timer}. -This cancels the effect of that call to one of these functions; the -arrival of the specified time will not cause anything special to happen. +@c Emacs 19 feature +@defun current-idle-time +This function returns the length of time Emacs has been idle, as a +list of three integers: @code{(@var{high} @var{low} @var{microsec})}. +The integers @var{high} and @var{low} combine to give the number of +seconds of idleness, which is +@ifnottex +@var{high} * 2**16 + @var{low}. +@end ifnottex +@tex +$high*2^{16}+low$. +@end tex + +The third element, @var{microsec}, gives the microseconds since the +start of the current second (or 0 for systems that return time with +the resolution of only one second). + +The main use of this function is when an idle timer function wants to +``take a break'' for a while. It can set up another idle timer to +call the same function again, after a few seconds more idleness. +Here's an example: + +@smallexample +(defvar resume-timer nil + "Timer that `timer-function' used to reschedule itself, or nil.") + +(defun timer-function () + ;; @r{If the user types a command while @code{resume-timer}} + ;; @r{is active, the next time this function is called from} + ;; @r{its main idle timer, deactivate @code{resume-timer}.} + (when resume-timer + (cancel-timer resume-timer)) + ...@var{do the work for a while}... + (when @var{taking-a-break} + (setq resume-timer + (run-with-idle-timer + ;; Compute an idle time @var{break-length} + ;; more than the current value. + (time-add (current-idle-time) + (seconds-to-time @var{break-length})) + nil + 'timer-function)))) +@end smallexample @end defun @node Terminal Input From 3bde9bb9fb4eece73a40315e19653fc65af3753b Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 20 Aug 2006 12:10:04 +0000 Subject: [PATCH 265/361] (Top): Update subnode menu. --- lispref/elisp.texi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lispref/elisp.texi b/lispref/elisp.texi index 15f33aaf8ae..83cd2ba98ec 100644 --- a/lispref/elisp.texi +++ b/lispref/elisp.texi @@ -1039,6 +1039,8 @@ Operating System Interface * Processor Run Time:: Getting the run time used by Emacs. * Time Calculations:: Adding, subtracting, comparing times, etc. * Timers:: Setting a timer to call a function at a certain time. +* Idle Timers:: Setting a timer to call a function when Emacs has + been idle for a certain length of time. * Terminal Input:: Accessing and recordingo terminal input. * Terminal Output:: Controlling and recording terminal output. * Sound Output:: Playing sounds on the computer's speaker. From 4721317c7d11c24f2bac4fb20bba6e8750eb91b8 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 20 Aug 2006 12:11:24 +0000 Subject: [PATCH 266/361] (Reading One Event): Update xref. --- lispref/commands.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lispref/commands.texi b/lispref/commands.texi index 2a091524bed..514b55205a1 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi @@ -2231,7 +2231,7 @@ necessary for input to arrive. If @var{seconds} is @code{nil}, Emacs is considered idle while waiting for user input to arrive. Idle timers---those created with -@code{run-with-idle-timer} (@pxref{Timers})---can run during this +@code{run-with-idle-timer} (@pxref{Idle Timers})---can run during this period. However, if @var{seconds} is non-@code{nil}, the state of idleness remains unchanged. If Emacs is non-idle when @code{read-event} is called, it remains non-idle throughout the From 171d328e8dd84e6d9e8d168e4e91fe989b65b138 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 20 Aug 2006 12:16:26 +0000 Subject: [PATCH 267/361] (run-with-idle-timer): Pass t to timer-activate-when-idle, so timer can run before Emacs becomes non-idle again. --- lisp/emacs-lisp/timer.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index a98dd60fc21..ed85bc765f7 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -413,6 +413,8 @@ This function is for compatibility; see also `run-with-timer'." "Perform an action the next time Emacs is idle for SECS seconds. The action is to call FUNCTION with arguments ARGS. SECS may be an integer or a floating point number. +If Emacs is currently idle, and has been idle for N seconds (N < SECS), +then it will call FUNCTION in SECS - N seconds from now. If REPEAT is non-nil, do the action each time Emacs has been idle for exactly SECS seconds (that is, only once for each time Emacs becomes idle). @@ -425,7 +427,7 @@ This function returns a timer object which you can use in `cancel-timer'." (let ((timer (timer-create))) (timer-set-function timer function args) (timer-set-idle-time timer secs repeat) - (timer-activate-when-idle timer) + (timer-activate-when-idle timer t) timer)) (defun with-timeout-handler (tag) From 79ffb765f25e6e1bc3c6664fcd24bf7edb3b2d32 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 20 Aug 2006 12:16:58 +0000 Subject: [PATCH 268/361] (line-number-at-pos): Doc fix. --- lisp/simple.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index f1b80968ff1..3e19a8573e5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -899,7 +899,9 @@ and the greater of them is not at the start of a line." (defun line-number-at-pos (&optional pos) "Return (narrowed) buffer line number at position POS. -If POS is nil, use current buffer location." +If POS is nil, use current buffer location. +Counting starts at (point-min), so the value refers +to the contents of the accessible portion of the buffer." (let ((opoint (or pos (point))) start) (save-excursion (goto-char (point-min)) From ce6297137d3f5ae98335f35119faae72d04d6a44 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 20 Aug 2006 12:19:33 +0000 Subject: [PATCH 269/361] *** empty log message *** --- etc/NEWS | 4 ++++ lisp/ChangeLog | 8 ++++++++ lispref/ChangeLog | 7 +++++++ src/ChangeLog | 7 +++++++ 4 files changed, 26 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 570db4a7656..4b8f564a042 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -4665,6 +4665,7 @@ keymap alist to this list. *** The definition of a key-binding passed to define-key can use XEmacs-style key-sequences, such as [(control a)]. + ** Abbrev changes: +++ @@ -5493,6 +5494,9 @@ been renamed to `disabled-command-function'. The variable *** `emacsserver' now runs `pre-command-hook' and `post-command-hook' when it receives a request from emacsclient. ++++ +*** `current-idle-time' reports how long Emacs has been idle. + ** Lisp file loading changes: +++ diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e5692b08fb7..2fca315c263 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2006-08-20 Richard Stallman + + * simple.el (line-number-at-pos): Doc fix. + + * emacs-lisp/timer.el (run-with-idle-timer): Pass t to + timer-activate-when-idle, so timer can run before Emacs becomes + non-idle again. + 2006-08-18 Yoni Rabkin Katzenell (tiny change) * whitespace.el (whitespace-cleanup-internal): New optional arg diff --git a/lispref/ChangeLog b/lispref/ChangeLog index d09689ce637..ea6aa4e41b8 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,10 @@ +2006-08-20 Richard Stallman + + * os.texi (Idle Timers): New node, split out from Timers. + Document current-idle-time. + * commands.texi (Reading One Event): Update xref. + * elisp.texi (Top): Update subnode menu. + 2006-08-16 Richard Stallman * keymaps.texi (Extended Menu Items): Show format of cached diff --git a/src/ChangeLog b/src/ChangeLog index 68a2bb082ec..a820b51f77d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2006-08-20 Richard Stallman + + * xfaces.c (load_pixmap): Add quotes in error message. + + * keyboard.c (Fcurrent_idle_time): New function. + (syms_of_keyboard): defsubr it. + 2006-08-18 Nick Roberts * window.c (Fset_window_fringes): Do nothing on a tty. From 016c63b6451d72765ceaa11d6afff6b3dcfb84b1 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 20 Aug 2006 12:48:19 +0000 Subject: [PATCH 270/361] (comment-box): Call `comment-normalize-vars'. Add autoload cookie. --- lisp/newcomment.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 358c834de73..0cf0160afb1 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -299,7 +299,7 @@ the variables are properly set." (substring comment-start 1))) ;; Hasn't been necessary yet. ;; (unless (string-match comment-start-skip comment-continue) - ;; (kill-local-variable 'comment-continue)) + ;; (kill-local-variable 'comment-continue)) ) ;; comment-skip regexps (unless (and comment-start-skip @@ -602,7 +602,7 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any." ;; Update INDENT to leave at least one space ;; after other nonwhite text on the line. (save-excursion - (skip-chars-backward " \t") + (skip-chars-backward " \t") (unless (bolp) (setq indent (max indent (1+ (current-column)))))) ;; If that's different from comment's current position, change it. @@ -769,7 +769,7 @@ comment markers." (box-equal nil)) ;Whether we might be using `=' for boxes. (save-restriction (narrow-to-region spt ept) - + ;; Remove the comment-start. (goto-char ipt) (skip-syntax-backward " ") @@ -798,7 +798,7 @@ comment markers." ;; If there's something left but it doesn't look like ;; a comment-start any more, just remove it. (delete-region (point-min) (point)))) - + ;; Remove the end-comment (and leading padding and such). (goto-char (point-max)) (comment-enter-backward) ;; Check for special `=' used sometimes in comment-box. @@ -1062,11 +1062,13 @@ The strings used as comment starts are built from lines (nth 3 style)))))) +;;;###autoload (defun comment-box (beg end &optional arg) "Comment out the BEG .. END region, putting it inside a box. The numeric prefix ARG specifies how many characters to add to begin- and end- comment markers additionally to what `comment-add' already specifies." (interactive "*r\np") + (comment-normalize-vars) (let ((comment-style (if (cadr (assoc comment-style comment-styles)) 'box-multi 'box))) (comment-region beg end (+ comment-add arg)))) From 525efc448c2e574527761c8650a39c182d609788 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 20 Aug 2006 12:53:20 +0000 Subject: [PATCH 271/361] *** empty log message *** --- lisp/ChangeLog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2fca315c263..7052812ddd0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-20 Juanma Barranquero + + * newcomment.el (comment-box): Call `comment-normalize-vars'. + Add autoload cookie. + 2006-08-20 Richard Stallman * simple.el (line-number-at-pos): Doc fix. @@ -137,7 +142,7 @@ Add face to function names in case of no filename. Add face to variable names of watchpoints. -2006-08-12 Robert Thorpe (tiny change) +2006-08-12 Robert Thorpe (tiny change) * cus-start.el : Move to the `indent' customization group. From f9ac92c539946ca1f4dc77e044dd05708c71e03d Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 20 Aug 2006 14:43:29 +0000 Subject: [PATCH 272/361] * frame.el (blink-cursor-start): Set timer first. (blink-cursor-end): Ignore timer cancelling errors. Suggested by Ken Manheimer. --- lisp/ChangeLog | 6 ++++++ lisp/frame.el | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7052812ddd0..9214570678c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-20 Chong Yidong + + * frame.el (blink-cursor-start): Set timer first. + (blink-cursor-end): Ignore timer cancelling errors. + Suggested by Ken Manheimer. + 2006-08-20 Juanma Barranquero * newcomment.el (comment-box): Call `comment-normalize-vars'. diff --git a/lisp/frame.el b/lisp/frame.el index a92fa3c8133..873cec6c783 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1291,11 +1291,13 @@ This starts the timer `blink-cursor-timer', which makes the cursor blink if appropriate. It also arranges to cancel that timer when the next command starts, by installing a pre-command hook." (when (null blink-cursor-timer) - (add-hook 'pre-command-hook 'blink-cursor-end) - (internal-show-cursor nil nil) + ;; Set up the timer first, so that if this signals an error, + ;; blink-cursor-end is not added to pre-command-hook. (setq blink-cursor-timer (run-with-timer blink-cursor-interval blink-cursor-interval - 'blink-cursor-timer-function)))) + 'blink-cursor-timer-function)) + (add-hook 'pre-command-hook 'blink-cursor-end) + (internal-show-cursor nil nil))) (defun blink-cursor-timer-function () "Timer function of timer `blink-cursor-timer'." @@ -1308,10 +1310,11 @@ When run, it cancels the timer `blink-cursor-timer' and removes itself as a pre-command hook." (remove-hook 'pre-command-hook 'blink-cursor-end) (internal-show-cursor nil t) - (cancel-timer blink-cursor-timer) + (condition-case nil + (cancel-timer blink-cursor-timer) + (error nil)) (setq blink-cursor-timer nil)) - ;; Hourglass pointer From c7bb83bdeb37144192a4924535a11daa8d57535a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 20 Aug 2006 15:53:57 +0000 Subject: [PATCH 273/361] (eexecfile): Use the __main__ rather than `emacs' namespace. --- etc/ChangeLog | 4 ++++ etc/emacs.py | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 0d61048a858..ec2b017c25c 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2006-08-20 Slawomir Nowaczyk (tiny change) + + * emacs.py (eexecfile): Use the __main__ rather than `emacs' namespace. + 2006-08-18 Primoz PETERLIN * TUTORIAL.sl: Synchronize with TUTORIAL. diff --git a/etc/emacs.py b/etc/emacs.py index 9538b0b7127..bc6c5bb034d 100644 --- a/etc/emacs.py +++ b/etc/emacs.py @@ -26,13 +26,14 @@ def eexecfile (file): """Execute FILE and then remove it. + Execute the file within the __main__ namespace. If we get an exception, print a traceback with the top frame - (oursleves) excluded.""" + (ourselves) excluded.""" try: - try: execfile (file, globals (), globals ()) - except: - (type, value, tb) = sys.exc_info () - # Lose the stack frame for this location. + try: execfile (file, __main__.__dict__) + except: + (type, value, tb) = sys.exc_info () + # Lose the stack frame for this location. tb = tb.tb_next if tb is None: # print_exception won't do it print "Traceback (most recent call last):" From 67b595a2904e477aa06913ebf46e7ce7130801f9 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 20 Aug 2006 17:54:48 +0000 Subject: [PATCH 274/361] Update to Dave Love's latest version. (__all__): Fix args -> eargs. Add new `modpath' fun. (eargs): Add `imports' arg. (all_names): New fun. (complete): Rewrite without using rlcompleter. Remove `namespace' arg, add `imports' arg. (ehelp): Replace g and l args with `imports'. (eimport): Use __main__ rather than `emacs' namespace. (modpath): New fun. --- etc/ChangeLog | 12 +++++ etc/emacs.py | 144 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 124 insertions(+), 32 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index ec2b017c25c..6f177e3b890 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,15 @@ +2006-08-20 Dave Love + + * emacs.py: Update to Dave Love's latest version. + (__all__): Fix args -> eargs. Add new `modpath' fun. + (eargs): Add `imports' arg. + (all_names): New fun. + (complete): Rewrite without using rlcompleter. + Remove `namespace' arg, add `imports' arg. + (ehelp): Replace g and l args with `imports'. + (eimport): Use __main__ rather than `emacs' namespace. + (modpath): New fun. + 2006-08-20 Slawomir Nowaczyk (tiny change) * emacs.py (eexecfile): Use the __main__ rather than `emacs' namespace. diff --git a/etc/emacs.py b/etc/emacs.py index bc6c5bb034d..7614f0927df 100644 --- a/etc/emacs.py +++ b/etc/emacs.py @@ -1,7 +1,7 @@ """Definitions used by commands sent to inferior Python in python.el.""" -# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. -# Author: Dave Love +# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +# Author: Dave Love # This file is part of GNU Emacs. @@ -20,9 +20,10 @@ # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. -import os, sys, traceback, inspect, rlcompleter, __main__ +import os, sys, traceback, inspect, __main__ +from sets import Set -__all__ = ["eexecfile", "args", "complete", "ehelp", "eimport"] +__all__ = ["eexecfile", "eargs", "complete", "ehelp", "eimport", "modpath"] def eexecfile (file): """Execute FILE and then remove it. @@ -32,8 +33,8 @@ def eexecfile (file): try: try: execfile (file, __main__.__dict__) except: - (type, value, tb) = sys.exc_info () - # Lose the stack frame for this location. + (type, value, tb) = sys.exc_info () + # Lose the stack frame for this location. tb = tb.tb_next if tb is None: # print_exception won't do it print "Traceback (most recent call last):" @@ -41,9 +42,10 @@ def eexecfile (file): finally: os.remove (file) -def eargs (name): +def eargs (name, imports): "Get arglist of NAME for Eldoc &c." try: + if imports: exec imports parts = name.split ('.') if len (parts) > 1: exec 'import ' + parts[0] # might fail @@ -57,8 +59,7 @@ def eargs (name): return if inspect.ismethod (func): func = func.im_func - if not inspect.isfunction (func): - return + if not inspect.isfunction (func): return (args, varargs, varkw, defaults) = inspect.getargspec (func) # No space between name and arglist for consistency with builtins. print '_emacs_out', \ @@ -66,41 +67,109 @@ def eargs (name): defaults) except: pass -def complete (text, namespace = None): - """Complete TEXT in NAMESPACE and print a Lisp list of completions. - NAMESPACE is currently not used.""" - if namespace is None: namespace = __main__.__dict__ - c = rlcompleter.Completer (namespace) - try: - if '.' in text: - matches = c.attr_matches (text) - else: - matches = c.global_matches (text) - print '_emacs_out (', - for elt in matches: - print '"%s"' % elt, - print ')' - except: - print '_emacs_out ()' +def all_names (object): + """Return (an approximation to) a list of all possible attribute + names reachable via the attributes of OBJECT, i.e. roughly the + leaves of the dictionary tree under it.""" -def ehelp (name, g, l): - """Get help on string NAME using globals G and locals L. + def do_object (object, names): + if inspect.ismodule (object): + do_module (object, names) + elif inspect.isclass (object): + do_class (object, names) + # Might have an object without its class in scope. + elif hasattr (object, '__class__'): + names.add ('__class__') + do_class (object.__class__, names) + # Probably not a good idea to try to enumerate arbitrary + # dictionaries... + return names + + def do_module (module, names): + if hasattr (module, '__all__'): # limited export list + names.union_update (module.__all__) + for i in module.__all__: + do_object (getattr (module, i), names) + else: # use all names + names.union_update (dir (module)) + for i in dir (module): + do_object (getattr (module, i), names) + return names + + def do_class (object, names): + ns = dir (object) + names.union_update (ns) + if hasattr (object, '__bases__'): # superclasses + for i in object.__bases__: do_object (i, names) + return names + + return do_object (object, Set ([])) + +def complete (name, imports): + """Complete TEXT in NAMESPACE and print a Lisp list of completions. + Exec IMPORTS first.""" + import __main__, keyword + + def class_members(object): + names = dir (object) + if hasattr (object, '__bases__'): + for super in object.__bases__: + names = class_members (super) + return names + + names = Set ([]) + base = None + try: + dict = __main__.__dict__.copy() + if imports: exec imports in dict + l = len (name) + if not "." in name: + for list in [dir (__builtins__), keyword.kwlist, dict.keys()]: + for elt in list: + if elt[:l] == name: names.add(elt) + else: + base = name[:name.rfind ('.')] + name = name[name.rfind('.')+1:] + try: + object = eval (base, dict) + names = Set (dir (object)) + if hasattr (object, '__class__'): + names.add('__class__') + names.union_update (class_members (object)) + except: names = all_names (dict) + except: return [] + l = len(name) + print '_emacs_out (', + for n in names: + if name == n[:l]: + if base: print '"%s.%s"' % (base, n), + else: print '"%s"' % n, + print ')' + +def ehelp (name, imports): + """Get help on string NAME. First try to eval name for, e.g. user definitions where we need the object. Otherwise try the string form.""" - try: help (eval (name, g, l)) + locls = {} + if imports: + try: exec imports in locls + except: pass + try: help (eval (name, globals(), locls)) except: help (name) def eimport (mod, dir): """Import module MOD with directory DIR at the head of the search path. NB doesn't load from DIR if MOD shadows a system module.""" + from __main__ import __dict__ + path0 = sys.path[0] sys.path[0] = dir try: try: - if globals().has_key(mod) and inspect.ismodule (eval (mod)): - reload(eval (mod)) + if __dict__.has_key(mod) and inspect.ismodule (__dict__[mod]): + reload (__dict__[mod]) else: - globals ()[mod] = __import__ (mod) + __dict__[mod] = __import__ (mod) except: (type, value, tb) = sys.exc_info () print "Traceback (most recent call last):" @@ -108,6 +177,17 @@ def eimport (mod, dir): finally: sys.path[0] = path0 -print '_emacs_ok' # ready for input and can call continuation +def modpath (module): + """Return the source file for the given MODULE (or None). +Assumes that MODULE.py and MODULE.pyc are in the same directory.""" + try: + path = __import__ (module).__file__ + if path[-4:] == '.pyc' and os.path.exists (path[0:-1]): + path = path[:-1] + print "_emacs_out", path + except: + print "_emacs_out ()" + +# print '_emacs_ok' # ready for input and can call continuation # arch-tag: d90408f3-90e2-4de4-99c2-6eb9c7b9ca46 From c7e8d385a28e54d0caeef794c9ab50ff104d9c78 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 20 Aug 2006 17:55:16 +0000 Subject: [PATCH 275/361] Update to Dave Love's latest version. (python-font-lock-keywords, python-mode): Don't use font-lock-syntax-table, but match symbol elements explicitly instead. (python-mode-map): Add help, and a few more key bindings. (python-skip-comments/blanks): Move out of comments as well. (python-continuation-line-p): Behave better with unbalanced parens. (python-blank-line-p): New fun. (python-open-block-statement-p): Don't use a heuristic. (python-outdent-p): Better handle blocks-in-the-same-line. (python-calculate-indentation): Misc improvements. (python-comment-indent): Remove. (python-block-pairs): New var. (python-first-word): New fun. (python-indentation-levels): Handle more common cases. (python-indent-line-1): Add `leave' argument. (python-indent-region): New fun. (python-skip-out): New fun. (python-beginning-of-statement, python-end-of-statement): Use it. (python-next-statement): Return correct count even at eob. (python-end-of-block): Fix paren-typo. (python-imenu-create-index): Add module variables. (run-python): Add `new' arg. Check we're at a prompt before returning. (python-send-command): Move to end of buffer. Wait for prompt to return. (python-set-proc): New fun. (python-imports): New var. (python-describe-symbol): Use it. Adjust to new interface of `ehelp'. (python-eldoc-function): Try to move out of arg list. (python-outline-level): Offset by 1. (python-find-imports): New fun. (python-symbol-completions): Use python-imports. (python-module-path, ffap-alist): Add support for ffap. (python-skeletons, python-mode-abbrev-table, def-python-skeleton) (pythin-insert-*, python-default-template, python-expand-template): Add templates/skeletons. (python-setup-brm): Support for Bicycle Repair Man. (python-abbrev-syntax-table): New var. (python-abbrev-pc-hook, python-pea-hook): New funs. --- lisp/ChangeLog | 42 ++ lisp/progmodes/python.el | 1380 +++++++++++++++++++++++++------------- 2 files changed, 964 insertions(+), 458 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9214570678c..338b598be3f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,45 @@ +2006-08-20 Dave Love + + * progmodes/python.el: Update to Dave Love's latest version. + (python-font-lock-keywords, python-mode): Don't use + font-lock-syntax-table, but match symbol elements explicitly instead. + (python-mode-map): Add help, and a few more key bindings. + (python-skip-comments/blanks): Move out of comments as well. + (python-continuation-line-p): Behave better with unbalanced parens. + (python-blank-line-p): New fun. + (python-open-block-statement-p): Don't use a heuristic. + (python-outdent-p): Better handle blocks-in-the-same-line. + (python-calculate-indentation): Misc improvements. + (python-comment-indent): Remove. + (python-block-pairs): New var. + (python-first-word): New fun. + (python-indentation-levels): Handle more common cases. + (python-indent-line-1): Add `leave' argument. + (python-indent-region): New fun. + (python-skip-out): New fun. + (python-beginning-of-statement, python-end-of-statement): Use it. + (python-next-statement): Return correct count even at eob. + (python-end-of-block): Fix paren-typo. + (python-imenu-create-index): Add module variables. + (run-python): Add `new' arg. + Check we're at a prompt before returning. + (python-send-command): Move to end of buffer. + Wait for prompt to return. + (python-set-proc): New fun. + (python-imports): New var. + (python-describe-symbol): Use it. Adjust to new interface of `ehelp'. + (python-eldoc-function): Try to move out of arg list. + (python-outline-level): Offset by 1. + (python-find-imports): New fun. + (python-symbol-completions): Use python-imports. + (python-module-path, ffap-alist): Add support for ffap. + (python-skeletons, python-mode-abbrev-table, def-python-skeleton) + (pythin-insert-*, python-default-template, python-expand-template): + Add templates/skeletons. + (python-setup-brm): Support for Bicycle Repair Man. + (python-abbrev-syntax-table): New var. + (python-abbrev-pc-hook, python-pea-hook): New funs. + 2006-08-20 Chong Yidong * frame.el (blink-cursor-start): Set timer first. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9636f7eaeae..40f4e8aab57 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -9,19 +9,19 @@ ;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. -;; This file is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: @@ -32,41 +32,43 @@ ;; maintained with Python. That isn't covered by an FSF copyright ;; assignment, unlike this code, and seems not to be well-maintained ;; for Emacs (though I've submitted fixes). This mode is rather -;; simpler and is, perhaps, better in other ways. In particular, -;; using the syntax functions with text properties maintained by -;; font-lock should make it more correct with arbitrary string and -;; comment contents. +;; simpler and is better in other ways. In particular, using the +;; syntax functions with text properties maintained by font-lock makes +;; it more correct with arbitrary string and comment contents. ;; This doesn't implement all the facilities of python-mode.el. Some ;; just need doing, e.g. catching exceptions in the inferior Python ;; buffer (but see M-x pdb for debugging). [Actually, the use of -;; `compilation-minor-mode' now is probably enough for that.] Others -;; don't seem appropriate. For instance, `forward-into-nomenclature' -;; should be done separately, since it's not specific to Python, and -;; I've installed a minor mode to do the job properly in Emacs 22. +;; `compilation-shell-minor-mode' now is probably enough for that.] +;; Others don't seem appropriate. For instance, +;; `forward-into-nomenclature' should be done separately, since it's +;; not specific to Python, and I've installed a minor mode to do the +;; job properly in Emacs 23. [CC mode 5.31 contains an incompatible +;; feature, `c-subword-mode' which is intended to have a similar +;; effect, but actually only affects word-oriented keybindings.] + ;; Other things seem more natural or canonical here, e.g. the ;; {beginning,end}-of-defun implementation dealing with nested -;; definitions, and the inferior mode following `cmuscheme'. The +;; definitions, and the inferior mode following `cmuscheme'. (The ;; inferior mode can find the source of errors from -;; `python-send-region' & al via `compilation-minor-mode'. Successive -;; TABs cycle between possible indentations for the line. There is -;; symbol completion using lookup in Python. +;; `python-send-region' & al via `compilation-shell-minor-mode'.) +;; There is (limited) symbol completion using lookup in Python and +;; Eldoc support also using the inferior process. Successive TABs +;; cycle between possible indentations for the line. -;; Even where it has similar facilities, this is incompatible with -;; python-mode.el in various respects. For instance, various key -;; bindings are changed to obey Emacs conventions, and things like -;; marking blocks and `beginning-of-defun' behave differently. +;; Even where it has similar facilities, this mode is incompatible +;; with python-mode.el in some respects. For instance, various key +;; bindings are changed to obey Emacs conventions. ;; TODO: See various Fixmes below. ;;; Code: -;; It's messy to autoload the relevant comint functions so that comint -;; is only required when inferior Python is used. -(require 'comint) (eval-when-compile (require 'compile) - (autoload 'info-lookup-maybe-add-help "info-look")) + (require 'comint)) + +(autoload 'comint-mode "comint") (defgroup python nil "Silly walks in the Python language." @@ -84,31 +86,37 @@ ;;;; Font lock (defvar python-font-lock-keywords - `(,(rx (and word-start - ;; From v 2.3 reference. - ;; def and class dealt with separately below - (or "and" "assert" "break" "continue" "del" "elif" "else" - "except" "exec" "finally" "for" "from" "global" "if" - "import" "in" "is" "lambda" "not" "or" "pass" "print" - "raise" "return" "try" "while" "yield" - ;; Future keywords - "as" "None") - word-end)) - (,(rx (and word-start (group "class") (1+ space) (group (1+ word)))) - (1 font-lock-keyword-face) (2 font-lock-type-face)) - (,(rx (and word-start (group "def") (1+ space) (group (1+ word)))) - (1 font-lock-keyword-face) (2 font-lock-function-name-face)))) + `(,(rx symbol-start + ;; From v 2.4 reference. + ;; def and class dealt with separately below + (or "and" "assert" "break" "continue" "del" "elif" "else" + "except" "exec" "finally" "for" "from" "global" "if" + "import" "in" "is" "lambda" "not" "or" "pass" "print" + "raise" "return" "try" "while" "yield" + ;; Future keywords + "as" "None") + symbol-end) + ;; Definitions + (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_)))) + (1 font-lock-keyword-face) (2 font-lock-type-face)) + (,(rx symbol-start (group "def") (1+ space) (group (1+ (or word ?_)))) + (1 font-lock-keyword-face) (2 font-lock-function-name-face)) + ;; Top-level assignments are worth highlighting. + (,(rx line-start (group (1+ (or word ?_))) (0+ space) "=") + (1 font-lock-variable-name-face)) + (,(rx "@" (1+ (or word ?_))) ; decorators + (0 font-lock-preprocessor-face)))) (defconst python-font-lock-syntactic-keywords ;; Make outer chars of matching triple-quote sequences into generic ;; string delimiters. Fixme: Is there a better way? - `((,(rx (and (or line-start buffer-start (not (syntax escape))) ; avoid escaped - ; leading quote - (group (optional (any "uUrR"))) ; prefix gets syntax property - (optional (any "rR")) ; possible second prefix - (group (syntax string-quote)) ; maybe gets property - (backref 2) ; per first quote - (group (backref 2)))) ; maybe gets property + `((,(rx (or line-start buffer-start + (not (syntax escape))) ; avoid escaped leading quote + (group (optional (any "uUrR"))) ; prefix gets syntax property + (optional (any "rR")) ; possible second prefix + (group (syntax string-quote)) ; maybe gets property + (backref 2) ; per first quote + (group (backref 2))) ; maybe gets property (1 (python-quote-syntax 1)) (2 (python-quote-syntax 2)) (3 (python-quote-syntax 3))) @@ -132,6 +140,8 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." ;; x = ''' """ ' a ;; ''' ;; x '"""' x """ \"""" x + ;; Fixme: """""" goes wrong (due to syntax-ppss not getting the string + ;; fence context). (save-excursion (goto-char (match-beginning 0)) (cond @@ -140,19 +150,17 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." (let ((syntax (syntax-ppss))) (when (eq t (nth 3 syntax)) ; after unclosed fence (goto-char (nth 8 syntax)) ; fence position - ;; Skip any prefix. - (if (memq (char-after) '(?u ?U ?R ?r)) - (skip-chars-forward "uUrR")) + (skip-chars-forward "uUrR") ; skip any prefix ;; Is it a matching sequence? (if (eq (char-after) (char-after (match-beginning 2))) (eval-when-compile (string-to-syntax "|")))))) ;; Consider property for initial char, accounting for prefixes. - ((or (and (= n 2) ; not prefix + ((or (and (= n 2) ; leading quote (not prefix) (= (match-beginning 1) (match-end 1))) ; prefix is null (and (= n 1) ; prefix (/= (match-beginning 1) (match-end 1)))) ; non-empty (unless (eq 'string (syntax-ppss-context (syntax-ppss))) - (eval-when-compile (string-to-syntax "|")))) + (eval-when-compile (string-to-syntax "|")))) ;; Otherwise (we're in a non-matching string) the property is ;; nil, which is OK. ))) @@ -204,23 +212,37 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." (define-key map "\C-c\C-l" 'python-load-file) ; a la cmuscheme (substitute-key-definition 'complete-symbol 'python-complete-symbol map global-map) - ;; Fixme: Add :help to menu. + (define-key map "\C-c\C-i" 'python-find-imports) + (define-key map "\C-c\C-t" 'python-expand-template) (easy-menu-define python-menu map "Python Mode menu" - '("Python" - ["Shift region left" python-shift-left :active mark-active] - ["Shift region right" python-shift-right :active mark-active] + `("Python" + :help "Python-specific Features" + ["Shift region left" python-shift-left :active mark-active + :help "Shift by a single indentation step"] + ["Shift region right" python-shift-right :active mark-active + :help "Shift by a single indentation step"] "-" - ["Mark block" python-mark-block] + ["Mark block" python-mark-block + :help "Mark innermost block around point"] ["Mark def/class" mark-defun :help "Mark innermost definition around point"] "-" - ["Start of block" python-beginning-of-block] - ["End of block" python-end-of-block] + ["Start of block" python-beginning-of-block + :help "Go to start of innermost definition around point"] + ["End of block" python-end-of-block + :help "Go to end of innermost definition around point"] ["Start of def/class" beginning-of-defun :help "Go to start of innermost definition around point"] ["End of def/class" end-of-defun :help "Go to end of innermost definition around point"] "-" + ("Templates..." + :help "Expand templates for compound statements" + :filter (lambda (&rest junk) + (mapcar (lambda (elt) + (vector (car elt) (cdr elt) t)) + python-skeletons))) ; defined later + "-" ["Start interpreter" run-python :help "Run `inferior' Python in separate buffer"] ["Import/reload file" python-load-file @@ -233,12 +255,23 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." :help "Evaluate current definition in inferior Python session"] ["Switch to interpreter" python-switch-to-python :help "Switch to inferior Python buffer"] + ["Set default process" python-set-proc + :help "Make buffer's inferior process the default" + :active (buffer-live-p python-buffer)] ["Check file" python-check :help "Run pychecker"] ["Debugger" pdb :help "Run pdb under GUD"] "-" ["Help on symbol" python-describe-symbol - :help "Use pydoc on symbol at point"])) + :help "Use pydoc on symbol at point"] + ["Complete symbol" python-complete-symbol + :help "Complete (qualified) symbol before point"] + ["Update imports" python-find-imports + :help "Update list of top-level imports for completion"])) map)) +;; Fixme: add toolbar stuff for useful things like symbol help, send +;; region, at least. (Shouldn't be specific to Python, obviously.) +;; eric has items including: (un)indent, (un)comment, restart script, +;; run script, debug script; also things for profiling, unit testing. (defvar python-mode-syntax-table (let ((table (make-syntax-table))) @@ -263,7 +296,8 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." (defsubst python-in-string/comment () "Return non-nil if point is in a Python literal (a comment or string)." - (syntax-ppss-context (syntax-ppss))) + ;; We don't need to save the match data. + (nth 8 (syntax-ppss))) (defconst python-space-backslash-table (let ((table (copy-syntax-table python-mode-syntax-table))) @@ -273,13 +307,21 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." (defun python-skip-comments/blanks (&optional backward) "Skip comments and blank lines. -BACKWARD non-nil means go backwards, otherwise go forwards. Backslash is -treated as whitespace so that continued blank lines are skipped. -Doesn't move out of comments -- should be outside or at end of line." - (with-syntax-table python-space-backslash-table - (forward-comment (if backward - most-negative-fixnum - most-positive-fixnum)))) +BACKWARD non-nil means go backwards, otherwise go forwards. +Backslash is treated as whitespace so that continued blank lines +are skipped. Doesn't move out of comments -- should be outside +or at end of line." + (let ((arg (if backward + ;; If we're in a comment (including on the trailing + ;; newline), forward-comment doesn't move backwards out + ;; of it. Don't set the syntax table round this bit! + (let ((syntax (syntax-ppss))) + (if (nth 4 syntax) + (goto-char (nth 8 syntax))) + (- (point-max))) + (point-max)))) + (with-syntax-table python-space-backslash-table + (forward-comment arg)))) (defun python-backslash-continuation-line-p () "Non-nil if preceding line ends with backslash that is not in a comment." @@ -289,12 +331,17 @@ Doesn't move out of comments -- should be outside or at end of line." (defun python-continuation-line-p () "Return non-nil if current line continues a previous one. The criteria are that the previous line ends in a backslash outside -comments and strings, or that the bracket/paren nesting depth is nonzero." - (or (and (eq ?\\ (char-before (line-end-position 0))) - (not (syntax-ppss-context (syntax-ppss)))) - (< 0 (syntax-ppss-depth - (save-excursion ; syntax-ppss with arg changes point - (syntax-ppss (line-beginning-position))))))) +comments and strings, or that point is within brackets/parens." + (or (python-backslash-continuation-line-p) + (let ((depth (syntax-ppss-depth + (save-excursion ; syntax-ppss with arg changes point + (syntax-ppss (line-beginning-position)))))) + (or (> depth 0) + (if (< depth 0) ; Unbalanced brackets -- act locally + (save-excursion + (condition-case () + (progn (backward-up-list) t) ; actually within brackets + (error nil)))))))) (defun python-comment-line-p () "Return non-nil iff current line has only a comment." @@ -304,6 +351,12 @@ comments and strings, or that the bracket/paren nesting depth is nonzero." (back-to-indentation) (looking-at (rx (or (syntax comment-start) line-end)))))) +(defun python-blank-line-p () + "Return non-nil iff current line is blank." + (save-excursion + (beginning-of-line) + (looking-at "\\s-*$"))) + (defun python-beginning-of-string () "Go to beginning of string around point. Do nothing if not in string." @@ -316,50 +369,33 @@ Do nothing if not in string." BOS non-nil means point is known to be at beginning of statement." (save-excursion (unless bos (python-beginning-of-statement)) - (and (not (python-comment-line-p)) - (re-search-forward (rx (and ?: (0+ space) - (optional (and (syntax comment-start) - (0+ not-newline))) - line-end)) - (save-excursion (python-end-of-statement)) - t) - (not (progn (goto-char (match-beginning 0)) - (python-in-string/comment)))))) + (looking-at (rx (and (or "if" "else" "elif" "while" "for" "def" + "class" "try" "except" "finally") + symbol-end))))) (defun python-close-block-statement-p (&optional bos) "Return non-nil if current line is a statement closing a block. BOS non-nil means point is at beginning of statement. -The criteria are that the line isn't a comment or in string and starts with -keyword `raise', `break', `continue' or `pass'." +The criteria are that the line isn't a comment or in string and + starts with keyword `raise', `break', `continue' or `pass'." (save-excursion (unless bos (python-beginning-of-statement)) (back-to-indentation) - (looking-at (rx (and (or "return" "raise" "break" "continue" "pass") - symbol-end))))) + (looking-at (rx (or "return" "raise" "break" "continue" "pass") + symbol-end)))) (defun python-outdent-p () "Return non-nil if current line should outdent a level." (save-excursion (back-to-indentation) - (and (looking-at (rx (and (or (and (or "else" "finally") symbol-end) - (and (or "except" "elif") symbol-end - (1+ (not (any ?:))))) - (optional space) ":" (optional space) - (or (syntax comment-start) line-end)))) - (progn (end-of-line) - (not (python-in-string/comment))) + (and (looking-at (rx (and (or "else" "finally" "except" "elif") + symbol-end))) + (not (python-in-string/comment)) ;; Ensure there's a previous statement and move to it. (zerop (python-previous-statement)) (not (python-close-block-statement-p t)) ;; Fixme: check this - (not (looking-at (rx (and (or (and (or "if" "elif" "except" - "for" "while") - symbol-end (1+ (not (any ?:)))) - (and "try" symbol-end)) - (optional space) ":" (optional space) - (or (syntax comment-start) line-end))))) - (progn (end-of-line) - (not (python-in-string/comment)))))) + (not (python-open-block-statement-p))))) ;;;; Indentation. @@ -377,22 +413,26 @@ See also `\\[python-guess-indent]'" (defcustom python-indent-string-contents t "*Non-nil means indent contents of multi-line strings together. This means indent them the same as the preceding non-blank line. -Otherwise indent them to column zero." +Otherwise preserve their indentation. + +This only applies to `doc' strings, i.e. those that form statements; +the indentation is preserved in others." :type '(choice (const :tag "Align with preceding" t) - (const :tag "Indent to column 0" nil)) + (const :tag "Preserve indentation" nil)) :group 'python) (defcustom python-honour-comment-indentation nil "Non-nil means indent relative to preceding comment line. -Only do this for comments where the leading comment character is followed -by space. This doesn't apply to comment lines, which are always indented -in lines with preceding comments." +Only do this for comments where the leading comment character is +followed by space. This doesn't apply to comment lines, which +are always indented in lines with preceding comments." :type 'boolean :group 'python) (defcustom python-continuation-offset 4 "*Number of columns of additional indentation for continuation lines. -Continuation lines follow a backslash-terminated line starting a statement." +Continuation lines follow a backslash-terminated line starting a +statement." :group 'python :type 'integer) @@ -406,9 +446,9 @@ Set `python-indent' locally to the value guessed." (goto-char (point-min)) (let (done indent) (while (and (not done) (not (eobp))) - (when (and (re-search-forward (rx (and ?: (0+ space) - (or (syntax comment-start) - line-end))) + (when (and (re-search-forward (rx ?: (0+ space) + (or (syntax comment-start) + line-end)) nil 'move) (python-open-block-statement-p)) (save-excursion @@ -425,8 +465,21 @@ Set `python-indent' locally to the value guessed." (setq indent-tabs-mode nil))) indent))))) +;; Alist of possible indentations and start of statement they would +;; close. Used in indentation cycling (below). +(defvar python-indent-list nil + "Internal use.") +;; Length of the above +(defvar python-indent-list-length nil + "Internal use.") +;; Current index into the alist. +(defvar python-indent-index nil + "Internal use.") + (defun python-calculate-indentation () "Calculate Python indentation for line at point." + (setq python-indent-list nil + python-indent-list-length 1) (save-excursion (beginning-of-line) (let ((syntax (syntax-ppss)) @@ -434,17 +487,25 @@ Set `python-indent' locally to the value guessed." (cond ((eq 'string (syntax-ppss-context syntax)) ; multi-line string (if (not python-indent-string-contents) - 0 - (save-excursion + (current-indentation) + ;; Only respect `python-indent-string-contents' in doc + ;; strings (defined as those which form statements). + (if (not (save-excursion + (python-beginning-of-statement) + (looking-at (rx (or (syntax string-delimiter) + (syntax string-quote)))))) + (current-indentation) ;; Find indentation of preceding non-blank line within string. (setq start (nth 8 syntax)) (forward-line -1) (while (and (< start (point)) (looking-at "\\s-*$")) (forward-line -1)) (current-indentation)))) - ((python-continuation-line-p) + ((python-continuation-line-p) ; after backslash, or bracketed (let ((point (point)) - (open-start (cadr syntax))) + (open-start (cadr syntax)) + (backslash (python-backslash-continuation-line-p)) + (colon (eq ?: (char-before (1- (line-beginning-position)))))) (if open-start ;; Inside bracketed expression. (progn @@ -458,7 +519,11 @@ Set `python-indent' locally to the value guessed." (backward-sexp) (< (point) point)) (error nil)))) - (current-column) + ;; Extra level if we're backslash-continued or + ;; following a key. + (if (or backslash colon) + (+ python-indent (current-column)) + (current-column)) ;; Otherwise indent relative to statement start, one ;; level per bracketing level. (goto-char (1+ open-start)) @@ -472,16 +537,15 @@ Set `python-indent' locally to the value guessed." (current-indentation) ;; First continuation line. Indent one step, with an ;; extra one if statement opens a block. - (save-excursion - (python-beginning-of-statement) - (+ (current-indentation) python-continuation-offset - (if (python-open-block-statement-p t) - python-indent - 0))))))) + (python-beginning-of-statement) + (+ (current-indentation) python-continuation-offset + (if (python-open-block-statement-p t) + python-indent + 0)))))) ((bobp) 0) ;; Fixme: Like python-mode.el; not convinced by this. - ((looking-at (rx (and (0+ space) (syntax comment-start) - (not (any " \t\n"))))) ; non-indentable comment + ((looking-at (rx (0+ space) (syntax comment-start) + (not (any " \t\n")))) ; non-indentable comment (current-indentation)) (t (let ((point (point))) (if python-honour-comment-indentation @@ -498,86 +562,129 @@ Set `python-indent' locally to the value guessed." (python-beginning-of-statement) t) ;; indentable comment like python-mode.el - ((and (looking-at (rx (and (syntax comment-start) - (or space line-end)))) + ((and (looking-at (rx (syntax comment-start) + (or space line-end))) (/= 0 (current-column))))) - (throw 'done t)))) - ;; Else back over all comments. - (python-skip-comments/blanks t) - (python-beginning-of-statement)) - ;; don't lose on bogus outdent - (max 0 (+ (current-indentation) - (or (cond ((python-open-block-statement-p t) - python-indent) - ((python-close-block-statement-p t) - (- python-indent))) - (progn (goto-char point) - (if (python-outdent-p) - (- python-indent))) - 0))))))))) - -(defun python-comment-indent () - "`comment-indent-function' for Python." - ;; If previous non-blank line was a comment, use its indentation. - ;; FIXME: This seems unnecessary since the default code delegates to - ;; indent-according-to-mode. --Stef - (unless (bobp) - (save-excursion - (forward-comment -1) - (if (eq ?# (char-after)) (current-column))))) + (throw 'done t))))) + (python-indentation-levels) + ;; Prefer to indent comments with an immediately-following + ;; statement, e.g. + ;; ... + ;; # ... + ;; def ... + (when (and (> python-indent-list-length 1) + (python-comment-line-p)) + (forward-line) + (unless (python-comment-line-p) + (let ((elt (assq (current-indentation) python-indent-list))) + (setq python-indent-list + (nconc (delete elt python-indent-list) + (list elt)))))) + (caar (last python-indent-list)))))))) ;;;; Cycling through the possible indentations with successive TABs. ;; These don't need to be buffer-local since they're only relevant ;; during a cycle. -;; Alist of possible indentations and start of statement they would close. -(defvar python-indent-list nil - "Internal use.") -;; Length of the above -(defvar python-indent-list-length nil - "Internal use.") -;; Current index into the alist. -(defvar python-indent-index nil - "Internal use.") - (defun python-initial-text () "Text of line following indentation and ignoring any trailing comment." - (buffer-substring (+ (line-beginning-position) (current-indentation)) - (save-excursion - (end-of-line) - (forward-comment -1) - (point)))) + (save-excursion + (buffer-substring (progn + (back-to-indentation) + (point)) + (progn + (end-of-line) + (forward-comment -1) + (point))))) + +(defconst python-block-pairs + '(("else" "if" "elif" "while" "for" "try" "except") + ("elif" "if" "elif") + ("except" "try" "except") + ("finally" "try")) + "Alist of keyword matches. +The car of an element is a keyword introducing a statement which +can close a block opened by a keyword in the cdr.") + +(defun python-first-word () + "Return first word (actually symbol) on the line." + (save-excursion + (back-to-indentation) + (current-word t))) (defun python-indentation-levels () "Return a list of possible indentations for this line. +It is assumed not to be a continuation line or in a multi-line string. Includes the default indentation and those which would close all -enclosing blocks. Assumes the line has already been indented per -`python-indent-line'. Elements of the list are actually pairs: +enclosing blocks. Elements of the list are actually pairs: \(INDENTATION . TEXT), where TEXT is the initial text of the corresponding block opening (or nil)." (save-excursion - (let ((levels (list (cons (current-indentation) - (save-excursion - (if (python-beginning-of-block) - (python-initial-text))))))) - ;; Only one possibility if we immediately follow a block open or - ;; are in a continuation line. - (unless (or (python-continuation-line-p) - (save-excursion (and (python-previous-statement) - (python-open-block-statement-p t)))) - (while (python-beginning-of-block) - (push (cons (current-indentation) (python-initial-text)) - levels))) - levels))) + (let ((initial "") + levels indent) + ;; Only one possibility immediately following a block open + ;; statement, assuming it doesn't have a `suite' on the same line. + (cond + ((save-excursion (and (python-previous-statement) + (python-open-block-statement-p t) + (setq indent (current-indentation)) + ;; Check we don't have something like: + ;; if ...: ... + (if (progn (python-end-of-statement) + (python-skip-comments/blanks t) + (eq ?: (char-before))) + (setq indent (+ python-indent indent))))) + (push (cons indent initial) levels)) + ;; Only one possibility for comment line immediately following + ;; another. + ((save-excursion + (when (python-comment-line-p) + (forward-line -1) + (if (python-comment-line-p) + (push (cons (current-indentation) initial) levels))))) + ;; Fixme: Maybe have a case here which indents (only) first + ;; line after a lambda. + (t + (let ((start (car (assoc (python-first-word) python-block-pairs)))) + (python-previous-statement) + ;; Is this a valid indentation for the line of interest? + (unless (or (if start ; potentially only outdentable + ;; Check for things like: + ;; if ...: ... + ;; else ...: + ;; where the second line need not be outdented. + (not (member (python-first-word) + (cdr (assoc start + python-block-pairs))))) + ;; Not sensible to indent to the same level as + ;; previous `return' &c. + (python-close-block-statement-p)) + (push (cons (current-indentation) (python-initial-text)) + levels)) + (while (python-beginning-of-block) + (when (or (not start) + (member (python-first-word) + (cdr (assoc start python-block-pairs)))) + (push (cons (current-indentation) (python-initial-text)) + levels)))))) + (prog1 (or levels (setq levels '((0 . "")))) + (setq python-indent-list levels + python-indent-list-length (length python-indent-list)))))) ;; This is basically what `python-indent-line' would be if we didn't ;; do the cycling. -(defun python-indent-line-1 () - "Subroutine of `python-indent-line'." +(defun python-indent-line-1 (&optional leave) + "Subroutine of `python-indent-line'. +Does non-repeated indentation. LEAVE non-nil means leave +indentation if it is valid, i.e. one of the positions returned by +`python-calculate-indentation'." (let ((target (python-calculate-indentation)) (pos (- (point-max) (point)))) - (if (= target (current-indentation)) + (if (or (= target (current-indentation)) + ;; Maybe keep a valid indentation. + (and leave python-indent-list + (assq (current-indentation) python-indent-list))) (if (< (current-column) (current-indentation)) (back-to-indentation)) (beginning-of-line) @@ -589,29 +696,41 @@ corresponding block opening (or nil)." (defun python-indent-line () "Indent current line as Python code. When invoked via `indent-for-tab-command', cycle through possible -indentations for current line. The cycle is broken by a command different -from `indent-for-tab-command', i.e. successive TABs do the cycling." +indentations for current line. The cycle is broken by a command +different from `indent-for-tab-command', i.e. successive TABs do +the cycling." (interactive) - ;; Don't do extra work if invoked via `indent-region', for instance. - (if (not (eq this-command 'indent-for-tab-command)) - (python-indent-line-1) - (if (eq last-command this-command) - (if (= 1 python-indent-list-length) - (message "Sole indentation") - (progn (setq python-indent-index (% (1+ python-indent-index) - python-indent-list-length)) - (beginning-of-line) - (delete-horizontal-space) - (indent-to (car (nth python-indent-index python-indent-list))) - (if (python-block-end-p) - (let ((text (cdr (nth python-indent-index - python-indent-list)))) - (if text - (message "Closes: %s" text)))))) - (python-indent-line-1) - (setq python-indent-list (python-indentation-levels) - python-indent-list-length (length python-indent-list) - python-indent-index (1- python-indent-list-length))))) + (if (and (eq this-command 'indent-for-tab-command) + (eq last-command this-command)) + (if (= 1 python-indent-list-length) + (message "Sole indentation") + (progn (setq python-indent-index + (% (1+ python-indent-index) python-indent-list-length)) + (beginning-of-line) + (delete-horizontal-space) + (indent-to (car (nth python-indent-index python-indent-list))) + (if (python-block-end-p) + (let ((text (cdr (nth python-indent-index + python-indent-list)))) + (if text + (message "Closes: %s" text)))))) + (python-indent-line-1) + (setq python-indent-index (1- python-indent-list-length)))) + +(defun python-indent-region (start end) + "`indent-region-function' for Python. +Leaves validly-indented lines alone, i.e. doesn't indent to +another valid position." + (save-excursion + (goto-char end) + (setq end (point-marker)) + (goto-char start) + (or (bolp) (forward-line 1)) + (while (< (point) end) + (or (and (bolp) (eolp)) + (python-indent-line-1 t)) + (forward-line 1)) + (move-marker end nil))) (defun python-block-end-p () "Non-nil if this is a line in a statement closing a block, @@ -622,23 +741,20 @@ or a blank line indented to where it would close a block." (save-excursion (python-previous-statement) (current-indentation)))))) - -;; Fixme: Define an indent-region-function. It should probably leave -;; lines alone if the indentation is already at one of the allowed -;; levels. Otherwise, M-C-\ typically keeps indenting more deeply -;; down a function. ;;;; Movement. +;; Fixme: Define {for,back}ward-sexp-function? Maybe skip units like +;; block, statement, depending on context. + (defun python-beginning-of-defun () "`beginning-of-defun-function' for Python. Finds beginning of innermost nested class or method definition. -Returns the name of the definition found at the end, or nil if reached -start of buffer." +Returns the name of the definition found at the end, or nil if +reached start of buffer." (let ((ci (current-indentation)) - (def-re (rx (and line-start (0+ space) (or "def" "class") - (1+ space) - (group (1+ (or word (syntax symbol))))))) + (def-re (rx line-start (0+ space) (or "def" "class") (1+ space) + (group (1+ (or word (syntax symbol)))))) found lep def-line) (if (python-comment-line-p) (setq ci most-positive-fixnum)) @@ -652,10 +768,14 @@ start of buffer." ;; Must be less indented or matching top level, or ;; equally indented if we started on a definition line. (let ((in (current-indentation))) - (or (and (zerop ci) (zerop in)) - (= lep (line-end-position)) ; on initial line - (and def-line (= in ci)) - (< in ci))) + (or (and (zerop ci) (zerop in)) + (= lep (line-end-position)) ; on initial line + ;; Not sure why it was like this -- fails in case of + ;; last internal function followed by first + ;; non-def statement of the main body. +;; (and def-line (= in ci)) + (= in ci) + (< in ci))) (not (python-in-string/comment))) (setq found t))))) @@ -663,7 +783,7 @@ start of buffer." "`end-of-defun-function' for Python. Finds end of innermost nested class or method definition." (let ((orig (point)) - (pattern (rx (and line-start (0+ space) (or "def" "class") space)))) + (pattern (rx line-start (0+ space) (or "def" "class") space))) ;; Go to start of current block and check whether it's at top ;; level. If it is, and not a block start, look forward for ;; definition statement. @@ -692,8 +812,9 @@ Finds end of innermost nested class or method definition." (python-end-of-block) ;; Count trailing space in defun (but not trailing comments). (skip-syntax-forward " >") - (beginning-of-line)) - ;; Catch pathological case like this, where the beginning-of-defun + (unless (eobp) ; e.g. missing final newline + (beginning-of-line))) + ;; Catch pathological cases like this, where the beginning-of-defun ;; skips to a definition we're not in: ;; if ...: ;; ... @@ -706,26 +827,43 @@ Finds end of innermost nested class or method definition." (defun python-beginning-of-statement () "Go to start of current statement. -Accounts for continuation lines, multi-line strings, and multi-line bracketed -expressions." +Accounts for continuation lines, multi-line strings, and +multi-line bracketed expressions." (beginning-of-line) (python-beginning-of-string) - (catch 'foo - (while (python-continuation-line-p) - (beginning-of-line) - (if (python-backslash-continuation-line-p) + (while (python-continuation-line-p) + (beginning-of-line) + (if (python-backslash-continuation-line-p) + (progn + (forward-line -1) (while (python-backslash-continuation-line-p) - (forward-line -1)) - (python-beginning-of-string) - ;; Skip forward out of nested brackets. - (condition-case () ; beware invalid syntax - (let ((depth (syntax-ppss-depth (syntax-ppss)))) - ;; Beware negative depths. - (if (> depth 0) (backward-up-list depth)) - t) - (error (throw 'foo nil)))))) + (forward-line -1))) + (python-beginning-of-string) + (python-skip-out))) (back-to-indentation)) +(defun python-skip-out (&optional forward syntax) + "Skip out of any nested brackets. +Skip forward if FORWARD is non-nil, else backward. +If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point. +Return non-nil iff skipping was done." + (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss)))) + (forward (if forward -1 1))) + (unless (zerop depth) + (if (> depth 0) + ;; Skip forward out of nested brackets. + (condition-case () ; beware invalid syntax + (progn (backward-up-list (* forward depth)) t) + (error nil)) + ;; Invalid syntax (too many closed brackets). + ;; Skip out of as many as possible. + (let (done) + (while (condition-case () + (progn (backward-up-list forward) + (setq done t)) + (error nil))) + done))))) + (defun python-end-of-statement () "Go to the end of the current statement and return point. Usually this is the start of the next line, but if this is a @@ -745,13 +883,7 @@ On a comment line, go to end of line." (condition-case () ; beware invalid syntax (progn (forward-sexp) t) (error (end-of-line)))) - ((> (syntax-ppss-depth s) 0) - ;; Skip forward out of nested brackets. - (condition-case () ; beware invalid syntax - (progn (backward-up-list - (- (syntax-ppss-depth s))) - t) - (error (end-of-line)))))) + ((python-skip-out t s)))) (end-of-line)) (unless comment (eq ?\\ (char-before)))) ; Line continued? @@ -785,7 +917,8 @@ Return count of statements left to move." (while (and (> count 0) (not (eobp))) (python-end-of-statement) (python-skip-comments/blanks) - (setq count (1- count))) + (unless (eobp) + (setq count (1- count)))) count)) (defun python-beginning-of-block (&optional arg) @@ -802,7 +935,8 @@ Otherwise return non-nil." ((< arg 0) (python-end-of-block (- arg))) (t (let ((point (point))) - (if (python-comment-line-p) + (if (or (python-comment-line-p) + (python-blank-line-p)) (python-skip-comments/blanks t)) (python-beginning-of-statement) (let ((ci (current-indentation))) @@ -830,32 +964,31 @@ Otherwise return non-nil." (defun python-end-of-block (&optional arg) "Go to end of current block. -With numeric arg, do it that many times. If ARG is negative, call -`python-beginning-of-block' instead. -If current statement is in column zero and doesn't open a block, don't -move and return nil. Otherwise return t." +With numeric arg, do it that many times. If ARG is negative, +call `python-beginning-of-block' instead. +If current statement is in column zero and doesn't open a block, +don't move and return nil. Otherwise return t." (interactive "p") (unless arg (setq arg 1)) (if (< arg 0) - (python-beginning-of-block (- arg))) - (while (and (> arg 0) - (let* ((point (point)) - (_ (if (python-comment-line-p) - (python-skip-comments/blanks t))) - (ci (current-indentation)) - (open (python-open-block-statement-p))) - (if (and (zerop ci) (not open)) - (not (goto-char point)) - (catch 'done - (while (zerop (python-next-statement)) - (when (or (and open (<= (current-indentation) ci)) - (< (current-indentation) ci)) - (python-skip-comments/blanks t) - (beginning-of-line 2) - (throw 'done t))) - (not (goto-char point)))))) - (setq arg (1- arg))) - (zerop arg)) + (python-beginning-of-block (- arg)) + (while (and (> arg 0) + (let* ((point (point)) + (_ (if (python-comment-line-p) + (python-skip-comments/blanks t))) + (ci (current-indentation)) + (open (python-open-block-statement-p))) + (if (and (zerop ci) (not open)) + (not (goto-char point)) + (catch 'done + (while (zerop (python-next-statement)) + (when (or (and open (<= (current-indentation) ci)) + (< (current-indentation) ci)) + (python-skip-comments/blanks t) + (beginning-of-line 2) + (throw 'done t))))))) + (setq arg (1- arg))) + (zerop arg))) ;;;; Imenu. @@ -868,14 +1001,23 @@ The nested menus are headed by an item referencing the outer definition; it has a space prepended to the name so that it sorts first with `imenu--sort-by-name' (though, unfortunately, sub-menus precede it)." - (unless (boundp 'python-recursing) ; dynamically bound below - (goto-char (point-min))) ; normal call from Imenu - (let (index-alist ; accumulated value to return - name) + (unless (boundp 'python-recursing) ; dynamically bound below + ;; Normal call from Imenu. + (goto-char (point-min)) + ;; Without this, we can get an infloop if the buffer isn't all + ;; fontified. I guess this is really a bug in syntax.el. OTOH, + ;; _with_ this, imenu doesn't immediately work; I can't figure out + ;; what's going on, but it must be something to do with timers in + ;; font-lock. + ;; This can't be right, especially not when jit-lock is not used. --Stef + ;; (unless (get-text-property (1- (point-max)) 'fontified) + ;; (font-lock-fontify-region (point-min) (point-max))) + ) + (let (index-alist) ; accumulated value to return (while (re-search-forward - (rx (and line-start (0+ space) ; leading space - (or (group "def") (group "class")) ; type - (1+ space) (group (1+ (or word ?_))))) ; name + (rx line-start (0+ space) ; leading space + (or (group "def") (group "class")) ; type + (1+ space) (group (1+ (or word ?_)))) ; name nil t) (unless (python-in-string/comment) (let ((pos (match-beginning 0)) @@ -890,7 +1032,22 @@ precede it)." (progn (push (cons (concat " " name) pos) sublist) (push (cons name sublist) index-alist)) (push (cons name pos) index-alist))))))) - (nreverse index-alist))) + (unless (boundp 'python-recursing) + ;; Look for module variables. + (let (vars) + (goto-char (point-min)) + (while (re-search-forward + (rx line-start (group (1+ (or word ?_))) (0+ space) "=") + nil t) + (unless (python-in-string/comment) + (push (cons (match-string 1) (match-beginning 1)) + vars))) + (setq index-alist (nreverse index-alist)) + (if vars + (push (cons "Module variables" + (nreverse vars)) + index-alist)))) + index-alist)) ;;;; `Electric' commands. @@ -910,20 +1067,26 @@ just insert a single colon." (defun python-backspace (arg) "Maybe delete a level of indentation on the current line. -If not at the end of line's indentation, or on a comment line, just call -`backward-delete-char-untabify'. With ARG, repeat that many times." +Do so if point is at the end of the line's indentation. +Otherwise just call `backward-delete-char-untabify'. +Repeat ARG times." (interactive "*p") (if (or (/= (current-indentation) (current-column)) (bolp) (python-continuation-line-p)) (backward-delete-char-untabify arg) - (let ((indent 0)) - (save-excursion - (while (and (> arg 0) (python-beginning-of-block)) - (setq arg (1- arg))) - (when (zerop arg) - (setq indent (current-indentation)) - (message "Closes %s" (python-initial-text)))) + ;; Look for the largest valid indentation which is smaller than + ;; the current indentation. + (let ((indent 0) + (ci (current-indentation)) + (indents (python-indentation-levels)) + initial) + (dolist (x indents) + (if (< (car x) ci) + (setq indent (max indent (car x))))) + (setq initial (cdr (assq indent indents))) + (if (> (length initial) 0) + (message "Closes %s" initial)) (delete-horizontal-space) (indent-to indent)))) (put 'python-backspace 'delete-selection 'supersede) @@ -965,8 +1128,8 @@ See `python-check-command' for the default." (defcustom python-python-command "python" "*Shell command to run Python interpreter. Any arguments can't contain whitespace. -Note that IPython may not work properly; it must at least be used with the -`-cl' flag, i.e. use `ipython -cl'." +Note that IPython may not work properly; it must at least be used +with the `-cl' flag, i.e. use `ipython -cl'." :group 'python :type 'string) @@ -978,51 +1141,39 @@ Any arguments can't contain whitespace." (defvar python-command python-python-command "Actual command used to run Python. -May be `python-python-command' or `python-jython-command'. -Additional arguments are added when the command is used by `run-python' -et al.") +May be `python-python-command' or `python-jython-command', possibly +modified by the user. Additional arguments are added when the command +is used by `run-python' et al.") (defvar python-buffer nil - "The current python process buffer." - ;; Fixme: a single process is currently assumed, so that this doc - ;; is misleading. + "*The current python process buffer. -;; "*The current python process buffer. -;; To run multiple Python processes, start the first with \\[run-python]. -;; It will be in a buffer named *Python*. Rename that with -;; \\[rename-buffer]. Now start a new process with \\[run-python]. It -;; will be in a new buffer, named *Python*. Switch between the different -;; process buffers with \\[switch-to-buffer]. +Commands that send text from source buffers to Python processes have +to choose a process to send to. This is determined by buffer-local +value of `python-buffer'. If its value in the current buffer, +i.e. both any local value and the default one, is nil, `run-python' +and commands that send to the Python process will start a new process. -;; Commands that send text from source buffers to Python processes have -;; to choose a process to send to. This is determined by global variable -;; `python-buffer'. Suppose you have three inferior Pythons running: -;; Buffer Process -;; foo python -;; bar python<2> -;; *Python* python<3> -;; If you do a \\[python-send-region-and-go] command on some Python source -;; code, what process does it go to? +Whenever \\[run-python] starts a new process, it resets the default +value of `python-buffer' to be the new process's buffer and sets the +buffer-local value similarly if the current buffer is in Python mode +or Inferior Python mode, so that source buffer stays associated with a +specific sub-process. -;; - In a process buffer (foo, bar, or *Python*), send it to that process. -;; - In some other buffer (e.g. a source file), send it to the process -;; attached to `python-buffer'. -;; Process selection is done by function `python-proc'. - -;; Whenever \\[run-python] starts a new process, it resets `python-buffer' -;; to be the new process's buffer. If you only run one process, this will -;; do the right thing. If you run multiple processes, you can change -;; `python-buffer' to another process buffer with \\[set-variable]." - ) +Use \\[python-set-proc] to set the default value from a buffer with a +local value.") +(make-variable-buffer-local 'python-buffer) (defconst python-compilation-regexp-alist ;; FIXME: maybe these should move to compilation-error-regexp-alist-alist. - `((,(rx (and line-start (1+ (any " \t")) "File \"" - (group (1+ (not (any "\"<")))) ; avoid `' &c - "\", line " (group (1+ digit)))) + ;; The first already is (for CAML), but the second isn't. Anyhow, + ;; these are specific to the inferior buffer. -- fx + `((,(rx line-start (1+ (any " \t")) "File \"" + (group (1+ (not (any "\"<")))) ; avoid `' &c + "\", line " (group (1+ digit))) 1 2) - (,(rx (and " in file " (group (1+ not-newline)) " on line " - (group (1+ digit)))) + (,(rx " in file " (group (1+ not-newline)) " on line " + (group (1+ digit))) 1 2)) "`compilation-error-regexp-alist' for inferior Python.") @@ -1040,9 +1191,9 @@ et al.") ;; (define-key map "\C-c\C-f" 'python-describe-symbol) map)) -;; Fixme: This should inherit some stuff from python-mode, but I'm not -;; sure how much: at least some keybindings, like C-c C-f; syntax?; -;; font-locking, e.g. for triple-quoted strings? +;; Fixme: This should inherit some stuff from `python-mode', but I'm +;; not sure how much: at least some keybindings, like C-c C-f; +;; syntax?; font-locking, e.g. for triple-quoted strings? (define-derived-mode inferior-python-mode comint-mode "Inferior Python" "Major mode for interacting with an inferior Python process. A Python process can be started with \\[run-python]. @@ -1050,14 +1201,15 @@ A Python process can be started with \\[run-python]. Hooks `comint-mode-hook' and `inferior-python-mode-hook' are run in that order. -You can send text to the inferior Python process from other buffers containing -Python source. - * `python-switch-to-python' switches the current buffer to the Python +You can send text to the inferior Python process from other buffers +containing Python source. + * \\[python-switch-to-python] switches the current buffer to the Python process buffer. - * `python-send-region' sends the current region to the Python process. - * `python-send-region-and-go' switches to the Python process buffer + * \\[python-send-region] sends the current region to the Python process. + * \\[python-send-region-and-go] switches to the Python process buffer after sending the text. -For running multiple processes in multiple buffers, see `python-buffer'. +For running multiple processes in multiple buffers, see `run-python' and +`python-buffer'. \\{inferior-python-mode-map}" :group 'python @@ -1069,7 +1221,7 @@ For running multiple processes in multiple buffers, see `python-buffer'. ;; Still required by `comint-redirect-send-command', for instance ;; (and we need to match things like `>>> ... >>> '): (set (make-local-variable 'comint-prompt-regexp) - (rx (and line-start (1+ (and (repeat 3 (any ">.")) ?\s))))) + (rx line-start (1+ (and (repeat 3 (any ">.")) " ")))) (set (make-local-variable 'compilation-error-regexp-alist) python-compilation-regexp-alist) (compilation-shell-minor-mode 1)) @@ -1112,12 +1264,16 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." (when python-preoutput-leftover (setq s (concat python-preoutput-leftover s)) (setq python-preoutput-leftover nil)) - (cond ((and (string-match (rx (and string-start (repeat 3 (any ".>")) - " " string-end)) + (cond ((and (string-match (rx string-start (repeat 3 (any ".>")) + " " string-end) s) (/= (let ((inhibit-field-text-motion t)) (line-beginning-position)) (point))) + ;; The need for this seems to be system-dependent: + ;; What is this all about, exactly? --Stef + ;; (if (and (eq ?. (aref s 0))) + ;; (accept-process-output (get-buffer-process (current-buffer)) 1)) "") ((string= s "_emacs_ok\n") (when python-preoutput-continuation @@ -1136,60 +1292,82 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." "") (t s))) +(autoload 'comint-check-proc "comint") + ;;;###autoload -(defun run-python (&optional cmd noshow) +(defun run-python (&optional cmd noshow new) "Run an inferior Python process, input and output via buffer *Python*. CMD is the Python command to run. NOSHOW non-nil means don't show the buffer automatically. -If there is a process already running in `*Python*', switch to -that buffer. Interactively, a prefix arg allows you to edit the initial -command line (default is `python-command'); `-i' etc. args will be added -to this as appropriate. Runs the hook `inferior-python-mode-hook' -\(after the `comint-mode-hook' is run). -\(Type \\[describe-mode] in the process buffer for a list of commands.)" - (interactive (list (if current-prefix-arg - (read-string "Run Python: " python-command) - python-command))) + +Normally, if there is a process already running in `python-buffer', +switch to that buffer. Interactively, a prefix arg allows you to edit +the initial command line (default is `python-command'); `-i' etc. args +will be added to this as appropriate. A new process is started if: +one isn't running attached to `python-buffer', or interactively the +default `python-command', or argument NEW is non-nil. See also the +documentation for `python-buffer'. + +Runs the hook `inferior-python-mode-hook' \(after the +`comint-mode-hook' is run). \(Type \\[describe-mode] in the process +buffer for a list of commands.)" + (interactive (if current-prefix-arg + (list (read-string "Run Python: " python-command) nil t) + (list python-command))) (unless cmd (setq cmd python-python-command)) (setq python-command cmd) ;; Fixme: Consider making `python-buffer' buffer-local as a buffer ;; (not a name) in Python buffers from which `run-python' &c is ;; invoked. Would support multiple processes better. - (unless (comint-check-proc python-buffer) - (let* ((cmdlist (append (python-args-to-list cmd) '("-i"))) - (path (getenv "PYTHONPATH")) - (process-environment ; to import emacs.py - (cons (concat "PYTHONPATH=" data-directory - (if path (concat ":" path))) - process-environment))) - (set-buffer (apply 'make-comint "Python" (car cmdlist) nil - (cdr cmdlist))) - (setq python-buffer (buffer-name))) - (inferior-python-mode) - ;; Load function defintions we need. - ;; Before the preoutput function was used, this was done via -c in - ;; cmdlist, but that loses the banner and doesn't run the startup - ;; file. The code might be inline here, but there's enough that it - ;; seems worth putting in a separate file, and it's probably cleaner - ;; to put it in a module. - (python-send-string "import emacs")) - (unless noshow (pop-to-buffer python-buffer))) + (when (or new (not (comint-check-proc python-buffer))) + (save-current-buffer + (let* ((cmdlist (append (python-args-to-list cmd) '("-i"))) + (path (getenv "PYTHONPATH")) + (process-environment ; to import emacs.py + (cons (concat "PYTHONPATH=" data-directory + (if path (concat ":" path))) + process-environment))) + (set-buffer (apply 'make-comint-in-buffer "Python" + (generate-new-buffer "*Python*") + (car cmdlist) nil (cdr cmdlist))) + (setq-default python-buffer (current-buffer)) + (setq python-buffer (current-buffer))) + (accept-process-output (get-buffer-process python-buffer) 5) + (inferior-python-mode))) + (if (eq 'python-mode major-mode) + (setq python-buffer (default-value 'python-buffer))) ; buffer-local + ;; Load function definitions we need. + ;; Before the preoutput function was used, this was done via -c in + ;; cmdlist, but that loses the banner and doesn't run the startup + ;; file. The code might be inline here, but there's enough that it + ;; seems worth putting in a separate file, and it's probably cleaner + ;; to put it in a module. + (python-send-string "import emacs") + ;; Ensure we're at a prompt before doing anything else. + (python-send-receive "print '_emacs_out ()'") + ;; Without this, help output goes into the inferior python buffer if + ;; the process isn't already running. + (sit-for 1 t) ;Should we use accept-process-output instead? --Stef + (unless noshow (pop-to-buffer python-buffer t))) ;; Fixme: We typically lose if the inferior isn't in the normal REPL, ;; e.g. prompt is `help> '. Probably raise an error if the form of -;; the prompt is unexpected; actually, it needs to be `>>> ', not +;; the prompt is unexpected. Actually, it needs to be `>>> ', not ;; `... ', i.e. we're not inputting a block &c. However, this may not -;; be the place to do it, e.g. we might actually want to send commands -;; having set up such a state. +;; be the place to check it, e.g. we might actually want to send +;; commands having set up such a state. (defun python-send-command (command) - "Like `python-send-string' but resets `compilation-minor-mode'." - (goto-char (point-max)) + "Like `python-send-string' but resets `compilation-shell-minor-mode'." (let ((end (marker-position (process-mark (python-proc))))) + (with-current-buffer python-buffer (goto-char (point-max))) (compilation-forget-errors) (python-send-string command) - (set-marker compilation-parsing-end end) - (setq compilation-last-buffer (current-buffer)))) + ;; Must wait until this has completed before re-setting variables below. + (python-send-receive "print '_emacs_out ()'") + (with-current-buffer python-buffer + (set-marker compilation-parsing-end end) + (setq compilation-last-buffer (current-buffer))))) (defun python-send-region (start end) "Send the region to the inferior Python process." @@ -1202,8 +1380,8 @@ to this as appropriate. Runs the hook `inferior-python-mode-hook' ;; filter). This function also catches exceptions and truncates ;; tracebacks not to mention the frame of the function itself. ;; - ;; The compilation-minor-mode parsing takes care of relating the - ;; reference to the temporary file to the source. + ;; The `compilation-shell-minor-mode' parsing takes care of relating + ;; the reference to the temporary file to the source. ;; ;; Fixme: Write a `coding' header to the temp file if the region is ;; non-ASCII. @@ -1220,11 +1398,11 @@ to this as appropriate. Runs the hook `inferior-python-mode-hook' (set-marker orig-start (line-beginning-position 0))) (write-region "if True:\n" nil f nil 'nomsg)) (write-region start end f t 'nomsg) - (with-current-buffer (process-buffer (python-proc)) ;Runs python if needed. - (python-send-command command) + (python-send-command command) + (with-current-buffer (process-buffer (python-proc)) ;; Tell compile.el to redirect error locations in file `f' to ;; positions past marker `orig-start'. It has to be done *after* - ;; python-send-command's call to compilation-forget-errors. + ;; `python-send-command''s call to `compilation-forget-errors'. (compilation-fake-loc orig-start f)))) (defun python-send-string (string) @@ -1247,10 +1425,10 @@ to this as appropriate. Runs the hook `inferior-python-mode-hook' (progn (end-of-defun) (point))))) (defun python-switch-to-python (eob-p) - "Switch to the Python process buffer. + "Switch to the Python process buffer, maybe starting new process. With prefix arg, position cursor at end of buffer." (interactive "P") - (pop-to-buffer (process-buffer (python-proc))) ;Runs python if needed. + (pop-to-buffer (process-buffer (python-proc)) t) ;Runs python if needed. (when eob-p (push-mark) (goto-char (point-max)))) @@ -1264,9 +1442,9 @@ Then switch to the process buffer." (defcustom python-source-modes '(python-mode jython-mode) "*Used to determine if a buffer contains Python source code. -If it's loaded into a buffer that is in one of these major modes, it's -considered a Python source file by `python-load-file'. -Used by these commands to determine defaults." +If a file is loaded into a buffer that is in one of these major modes, +it is considered Python source by `python-load-file', which uses the +value to determine defaults." :type '(repeat function) :group 'python) @@ -1274,6 +1452,8 @@ Used by these commands to determine defaults." "Caches (directory . file) pair used in the last `python-load-file' command. Used for determining the default in the next one.") +(autoload 'comint-get-source "comint") + (defun python-load-file (file-name) "Load a Python file FILE-NAME into the inferior Python process. If the file has extension `.py' import or reload it as a module. @@ -1297,17 +1477,27 @@ module-qualified names." (format "execfile(%S)" file-name))) (message "%s loaded" file-name))) -;; Fixme: If we need to start the process, wait until we've got the OK -;; from the startup. (defun python-proc () "Return the current Python process. See variable `python-buffer'. Starts a new process if necessary." - (or (if python-buffer - (get-buffer-process (if (eq major-mode 'inferior-python-mode) + ;; Fixme: Maybe should look for another active process if there + ;; isn't one for `python-buffer'. + (unless (comint-check-proc python-buffer) + (run-python nil t)) + (get-buffer-process (or (if (eq major-mode 'inferior-python-mode) (current-buffer) - python-buffer))) - (progn (run-python nil t) - (python-proc)))) + python-buffer)))) + +(defun python-set-proc () + "Set the default value of `python-buffer' to correspond to this buffer. +If the current buffer has a local value of `python-buffer', set the +default (global) value to that. The associated Python process is +the one that gets input from \\[python-send-region] et al when used +in a buffer that doesn't have a local value of `python-buffer'." + (interactive) + (if (local-variable-p 'python-buffer) + (setq-default python-buffer python-buffer) + (error "No local value of `python-buffer'"))) ;;;; Context-sensitive help. @@ -1322,16 +1512,22 @@ Otherwise inherits from `python-mode-syntax-table'.") (defvar view-return-to-alist) (eval-when-compile (autoload 'help-buffer "help-fns")) +(defvar python-imports) ; forward declaration + ;; Fixme: Should this actually be used instead of info-look, i.e. be -;; bound to C-h S? Can we use other pydoc stuff before python 2.2? +;; bound to C-h S? [Probably not, since info-look may work in cases +;; where this doesn't.] (defun python-describe-symbol (symbol) "Get help on SYMBOL using `help'. Interactively, prompt for symbol. -Symbol may be anything recognized by the interpreter's `help' command -- -e.g. `CALLS' -- not just variables in scope. -This only works for Python version 2.2 or newer since earlier interpreters -don't support `help'." +Symbol may be anything recognized by the interpreter's `help' +command -- e.g. `CALLS' -- not just variables in scope in the +interpreter. This only works for Python version 2.2 or newer +since earlier interpreters don't support `help'. + +In some cases where this doesn't find documentation, \\[info-lookup-symbol] +will." ;; Note that we do this in the inferior process, not a separate one, to ;; ensure the environment is appropriate. (interactive @@ -1343,28 +1539,23 @@ don't support `help'." "Describe symbol: ") nil nil symbol)))) (if (equal symbol "") (error "No symbol")) - (let* ((func `(lambda () - (comint-redirect-send-command - (format "emacs.ehelp(%S, globals(), locals())\n" ,symbol) - "*Help*" nil)))) - ;; Ensure we have a suitable help buffer. - ;; Fixme: Maybe process `Related help topics' a la help xrefs and - ;; allow C-c C-f in help buffer. - (let ((temp-buffer-show-hook ; avoid xref stuff - (lambda () - (toggle-read-only 1) - (setq view-return-to-alist - (list (cons (selected-window) help-return-method)))))) - (help-setup-xref (list 'python-describe-symbol symbol) (interactive-p)) - (with-output-to-temp-buffer (help-buffer) - (with-current-buffer standard-output - (set (make-local-variable 'comint-redirect-subvert-readonly) t) - (print-help-return-message)))) - (if (and python-buffer (get-buffer python-buffer)) - (with-current-buffer python-buffer - (funcall func)) - (setq python-preoutput-continuation func) - (run-python nil t)))) + ;; Ensure we have a suitable help buffer. + ;; Fixme: Maybe process `Related help topics' a la help xrefs and + ;; allow C-c C-f in help buffer. + (let ((temp-buffer-show-hook ; avoid xref stuff + (lambda () + (toggle-read-only 1) + (setq view-return-to-alist + (list (cons (selected-window) help-return-method)))))) + (with-output-to-temp-buffer (help-buffer) + (with-current-buffer standard-output + ;; Fixme: Is this actually useful? + (help-setup-xref (list 'python-describe-symbol symbol) (interactive-p)) + (set (make-local-variable 'comint-redirect-subvert-readonly) t) + (print-help-return-message)))) + (comint-redirect-send-command-to-process (format "emacs.ehelp(%S, %s)" + symbol python-imports) + "*Help*" (python-proc) nil nil)) (add-to-list 'debug-ignored-errors "^No symbol") @@ -1379,17 +1570,32 @@ The result is what follows `_emacs_out' in the output (or nil)." python-preoutput-leftover)) python-preoutput-result)) -;; Fixme: try to make it work with point in the arglist. Also, is -;; there anything reasonable we can do with random methods? +;; Fixme: Is there anything reasonable we can do with random methods? ;; (Currently only works with functions.) (defun python-eldoc-function () "`eldoc-print-current-symbol-info' for Python. -Only works when point is in a function name, not its arglist, for instance. -Assumes an inferior Python is running." +Only works when point is in a function name, not its arg list, for +instance. Assumes an inferior Python is running." (let ((symbol (with-syntax-table python-dotty-syntax-table (current-word)))) - (when symbol - (python-send-receive (format "emacs.eargs(%S)" symbol))))) + ;; First try the symbol we're on. + (or (and symbol + (python-send-receive (format "emacs.eargs(%S, %s)" + symbol python-imports))) + ;; Try moving to symbol before enclosing parens. + (let ((s (syntax-ppss))) + (unless (zerop (car s)) + (when (eq ?\( (char-after (nth 1 s))) + (save-excursion + (goto-char (nth 1 s)) + (skip-syntax-backward "-") + (let ((point (point))) + (skip-chars-backward "a-zA-Z._") + (if (< (point) point) + (python-send-receive + (format "emacs.eargs(%S, %s)" + (buffer-substring-no-properties (point) point) + python-imports))))))))))) ;;;; Info-look functionality. @@ -1443,7 +1649,7 @@ Used with `eval-after-load'." ("(python-lib)Miscellaneous Index" nil "")))))) (eval-after-load "info-look" '(python-after-info-look)) -;;;; Miscellancy. +;;;; Miscellany. (defcustom python-jython-packages '("java" "javax" "org" "com") "Packages implying `jython-mode'. @@ -1473,8 +1679,8 @@ The criterion is either a match for `jython-mode' via (jython-mode) (if (catch 'done (while (re-search-forward - (rx (and line-start (or "import" "from") (1+ space) - (group (1+ (not (any " \t\n.")))))) + (rx line-start (or "import" "from") (1+ space) + (group (1+ (not (any " \t\n."))))) (+ (point-min) 10000) ; Probably not worth customizing. t) (if (member (match-string 1) python-jython-packages) @@ -1562,7 +1768,7 @@ END lie." "`outline-level' function for Python mode. The level is the number of `python-indent' steps of indentation of current line." - (/ (current-indentation) python-indent)) + (1+ (/ (current-indentation) python-indent))) ;; Fixme: Consider top-level assignments, imports, &c. (defun python-current-defun () @@ -1577,10 +1783,8 @@ of current line." (python-beginning-of-block) (end-of-line) (beginning-of-defun) - (if (looking-at (rx (and (0+ space) (or "def" "class") (1+ space) - (group (1+ (or word (syntax symbol)))) - ;; Greediness makes this unnecessary? --Stef - symbol-end))) + (if (looking-at (rx (0+ space) (or "def" "class") (1+ space) + (group (1+ (or word (syntax symbol)))))) (push (match-string 1) accum))) (if accum (mapconcat 'identity accum "."))))) @@ -1593,17 +1797,68 @@ Uses `python-beginning-of-block', `python-end-of-block'." (push-mark (point) nil t) (python-end-of-block) (exchange-point-and-mark)) + +;; Fixme: Provide a find-function-like command to find source of a +;; definition (separate from BicycleRepairMan). Complicated by +;; finding the right qualified name. ;;;; Completion. +(defvar python-imports nil + "String of top-level import statements updated by `python-find-imports'.") +(make-variable-buffer-local 'python-imports) + +;; Fixme: Should font-lock try to run this when it deals with an import? +;; Maybe not a good idea if it gets run multiple times when the +;; statement is being edited, and is more likely to end up with +;; something syntactically incorrect. +;; However, what we should do is to trundle up the block tree from point +;; to extract imports that appear to be in scope, and add those. +(defun python-find-imports () + "Find top-level imports, updating `python-imports'." + (interactive) + (save-excursion + (let (lines) + (goto-char (point-min)) + (while (re-search-forward "^import\\>\\|^from\\>" nil t) + (unless (syntax-ppss-context (syntax-ppss)) + (push (buffer-substring (line-beginning-position) + (line-beginning-position 2)) + lines))) + (setq python-imports + (if lines + (apply #'concat +;; This is probably best left out since you're unlikely to need the +;; doc for a function in the buffer and the import will lose if the +;; Python sub-process' working directory isn't the same as the +;; buffer's. +;; (if buffer-file-name +;; (concat +;; "import " +;; (file-name-sans-extension +;; (file-name-nondirectory buffer-file-name)))) + (nreverse lines)) + "None")) + (when lines + (set-text-properties 0 (length python-imports) nil python-imports) + ;; The output ends up in the wrong place if the string we + ;; send contains newlines (from the imports). + (setq python-imports + (replace-regexp-in-string "\n" "\\n" + (format "%S" python-imports) t t)))))) + +;; Fixme: This fails the first time if the sub-process isn't already +;; running. Presumably a timing issue with i/o to the process. (defun python-symbol-completions (symbol) "Return a list of completions of the string SYMBOL from Python process. -The list is sorted." +The list is sorted. +Uses `python-imports' to load modules against which to complete." (when symbol (let ((completions (condition-case () - (car (read-from-string (python-send-receive - (format "emacs.complete(%S)" symbol)))) + (car (read-from-string + (python-send-receive + (format "emacs.complete(%S,%s)" symbol python-imports)))) (error nil)))) (sort ;; We can get duplicates from the above -- don't know why. @@ -1615,15 +1870,12 @@ The list is sorted." (let ((end (point)) (start (save-excursion (and (re-search-backward - (rx (and (or buffer-start (regexp "[^[:alnum:]._]")) - (group (1+ (regexp "[[:alnum:]._]"))) - point)) + (rx (or buffer-start (regexp "[^[:alnum:]._]")) + (group (1+ (regexp "[[:alnum:]._]"))) point) nil t) (match-beginning 1))))) (if start (buffer-substring-no-properties start end)))) -;; Fixme: We should have an abstraction of this sort of thing in the -;; core. (defun python-complete-symbol () "Perform completion on the Python symbol preceding point. Repeating the command scrolls the completion window." @@ -1658,8 +1910,6 @@ Repeating the command scrolls the completion window." (display-completion-list completions symbol)) (message "Making completion list...%s" "done")))))))) -(eval-when-compile (require 'hippie-exp)) - (defun python-try-complete (old) "Completion function for Python for use with `hippie-expand'." (when (eq major-mode 'python-mode) ; though we only add it locally @@ -1680,16 +1930,211 @@ Repeating the command scrolls the completion window." (if old (he-reset-string)) nil))) +;;;; FFAP support + +(defun python-module-path (module) + "Function for `ffap-alist' to return path to MODULE." + (python-send-receive (format "emacs.modpath (%S)" module))) + +(eval-after-load "ffap" + '(push '(python-mode . python-module-path) ffap-alist)) + +;;;; Skeletons + +(defvar python-skeletons nil + "Alist of named skeletons for Python mode. +Elements are of the form (NAME . EXPANDER-FUNCTION).") + +(defvar python-mode-abbrev-table nil + "Abbrev table for Python mode. +The default contents correspond to the elements of `python-skeletons'.") +(define-abbrev-table 'python-mode-abbrev-table ()) + +(eval-when-compile + ;; Define a user-level skeleton and add it to `python-skeletons' and + ;; the abbrev table. +(defmacro def-python-skeleton (name &rest elements) + (let* ((name (symbol-name name)) + (function (intern (concat "python-insert-" name)))) + `(progn + (add-to-list 'python-skeletons ',(cons name function)) + (define-abbrev python-mode-abbrev-table ,name "" ',function nil t) + (define-skeleton ,function + ,(format "Insert Python \"%s\" template." name) + ,@elements))))) +(put 'def-python-skeleton 'lisp-indent-function 2) + +;; From `skeleton-further-elements': +;; `<': outdent a level; +;; `^': delete indentation on current line and also previous newline. +;; Not quote like `delete-indentation'. Assumes point is at +;; beginning of indentation. + +(def-python-skeleton if + "Condition: " + "if " str ":" \n + > _ \n + ("other condition, %s: " + < ; Avoid wrong indentation after block opening. + "elif " str ":" \n + > _ \n nil) + (python-else) | ^) + +(define-skeleton python-else + "Auxiliary skeleton." + nil + (unless (eq ?y (read-char "Add `else' clause? (y for yes or RET for no) ")) + (signal 'quit t)) + < "else:" \n + > _ \n) + +(def-python-skeleton while + "Condition: " + "while " str ":" \n + > _ \n + (python-else) | ^) + +(def-python-skeleton for + "Target, %s: " + "for " str " in " (skeleton-read "Expression, %s: ") ":" \n + > _ \n + (python-else) | ^) + +(def-python-skeleton try/except + nil + "try:" \n + > _ \n + ("Exception, %s: " + < "except " str (python-target) ":" \n + > _ \n nil) + < "except:" \n + > _ \n + (python-else) | ^) + +(define-skeleton python-target + "Auxiliary skeleton." + "Target, %s: " ", " str | -2) + +(def-python-skeleton try/finally + nil + "try:" \n + > _ \n + < "finally:" \n + > _ \n) + +(def-python-skeleton def + "Name: " + "def " str " (" ("Parameter, %s: " (unless (equal ?\( (char-before)) ", ") + str) "):" \n + "\"\"\"" @ " \"\"\"" \n ; Fixme: syntaxification wrong for """""" + > _ \n) + +(def-python-skeleton class + "Name: " + "class " str " (" ("Inheritance, %s: " + (unless (equal ?\( (char-before)) ", ") + str) + & ")" | -2 ; close list or remove opening + ":" \n + "\"\"\"" @ " \"\"\"" \n + > _ \n) + +(defvar python-default-template "if" + "Default template to expand by `python-insert-template'. +Updated on each expansion.") + +(defun python-expand-template (name) + "Expand template named NAME. +Interactively, prompt for the name with completion." + (interactive + (list (completing-read (format "Template to expand (default %s): " + python-default-template) + python-skeletons nil t))) + (if (equal "" name) + (setq name python-default-template) + (setq python-default-template name)) + (let ((func (cdr (assoc name python-skeletons)))) + (if func + (funcall func) + (error "Undefined template: %s" name)))) + +;;;; Bicycle Repair Man support + +(autoload 'pymacs-load "pymacs" nil t) +(autoload 'brm-init "bikemacs") + +;; I'm not sure how useful BRM really is, and it's certainly dangerous +;; the way it modifies files outside Emacs... Also note that the +;; current BRM loses with tabs used for indentation -- I submitted a +;; fix . +(defun python-setup-brm () + "Set up Bicycle Repair Man refactoring tool (if available). + +Note that the `refactoring' features change files independently of +Emacs and may modify and save the contents of the current buffer +without confirmation." + (interactive) + (condition-case data + (unless (fboundp 'brm-rename) + (pymacs-load "bikeemacs" "brm-") ; first line of normal recipe + (let ((py-mode-map (make-sparse-keymap)) ; it assumes this + (features (cons 'python-mode features)) ; and requires this + menu) + (brm-init) ; second line of normal recipe + (remove-hook 'python-mode-hook ; undo this from `brm-init' + '(lambda () (easy-menu-add brm-menu))) + (easy-menu-define + python-brm-menu python-mode-map + "Bicycle Repair Man" + '("BicycleRepairMan" + :help "Interface to navigation and refactoring tool" + "Queries" + ["Find References" brm-find-references + :help "Find references to name at point in compilation buffer"] + ["Find Definition" brm-find-definition + :help "Find definition of name at point"] + "-" + "Refactoring" + ["Rename" brm-rename + :help "Replace name at point with a new name everywhere"] + ["Extract Method" brm-extract-method + :active (and mark-active (not buffer-read-only)) + :help "Replace statements in region with a method"] + ["Extract Local Variable" brm-extract-local-variable + :active (and mark-active (not buffer-read-only)) + :help "Replace expression in region with an assignment"] + ["Inline Local Variable" brm-inline-local-variable + :help + "Substitute uses of variable at point with its definition"] + ;; Fixme: Should check for anything to revert. + ["Undo Last Refactoring" brm-undo :help ""])))) + (error (error "Bicyclerepairman setup failed: %s" data)))) + ;;;; Modes. (defvar outline-heading-end-regexp) (defvar eldoc-documentation-function) +;; Stuff to allow expanding abbrevs with non-word constituents. +(defun python-abbrev-pc-hook () + "Set the syntax table before possibly expanding abbrevs." + (remove-hook 'post-command-hook 'python-abbrev-pc-hook t) + (set-syntax-table python-mode-syntax-table)) + +(defvar python-abbrev-syntax-table + (copy-syntax-table python-mode-syntax-table) + "Syntax table used when expanding abbrevs.") + +(defun python-pea-hook () + "Reset the syntax table after possibly expanding abbrevs." + (set-syntax-table python-abbrev-syntax-table) + (add-hook 'post-command-hook 'python-abbrev-pc-hook nil t)) +(modify-syntax-entry ?/ "w" python-abbrev-syntax-table) + ;;;###autoload (define-derived-mode python-mode fundamental-mode "Python" "Major mode for editing Python files. -Turns on Font Lock mode unconditionally since it is required for correct -parsing of the source. +Font Lock mode is currently required for correct parsing of the source. See also `jython-mode', which is actually invoked if the buffer appears to contain Jython code. See also `run-python' and associated Python mode commands for running Python under Emacs. @@ -1703,21 +2148,27 @@ the end of definitions at that level, when they move up a level. Colon is electric: it outdents the line if appropriate, e.g. for an else statement. \\[python-backspace] at the beginning of an indented statement deletes a level of indentation to close the current block; otherwise it -deletes a charcter backward. TAB indents the current line relative to +deletes a character backward. TAB indents the current line relative to the preceding code. Successive TABs, with no intervening command, cycle through the possibilities for indentation on the basis of enclosing blocks. -\\[fill-paragraph] fills comments and multiline strings appropriately, but has no +\\[fill-paragraph] fills comments and multi-line strings appropriately, but has no effect outside them. Supports Eldoc mode (only for functions, using a Python process), Info-Look and Imenu. In Outline minor mode, `class' and `def' -lines count as headers. +lines count as headers. Symbol completion is available in the +same way as in the Python shell using the `rlcompleter' module +and this is added to the Hippie Expand functions locally if +Hippie Expand mode is turned on. Completion of symbols of the +form x.y only works if the components are literal +module/attribute names, not variables. An abbrev table is set up +with skeleton expansions for compound statement templates. \\{python-mode-map}" :group 'python (set (make-local-variable 'font-lock-defaults) - '(python-font-lock-keywords nil nil ((?_ . "w")) nil + '(python-font-lock-keywords nil nil nil nil (font-lock-syntactic-keywords . python-font-lock-syntactic-keywords) ;; This probably isn't worth it. @@ -1726,15 +2177,17 @@ lines count as headers. )) (set (make-local-variable 'parse-sexp-lookup-properties) t) (set (make-local-variable 'comment-start) "# ") - (set (make-local-variable 'comment-indent-function) #'python-comment-indent) (set (make-local-variable 'indent-line-function) #'python-indent-line) + (set (make-local-variable 'indent-region-function) #'python-indent-region) (set (make-local-variable 'paragraph-start) "\\s-*$") (set (make-local-variable 'fill-paragraph-function) 'python-fill-paragraph) (set (make-local-variable 'require-final-newline) mode-require-final-newline) (set (make-local-variable 'add-log-current-defun-function) #'python-current-defun) - ;; Fixme: Generalize to do all blocks? - (set (make-local-variable 'outline-regexp) "\\s-*\\(def\\|class\\)\\>") + (set (make-local-variable 'outline-regexp) + (rx (* space) (or "class" "def" "elif" "else" "except" "finally" + "for" "if" "try" "while") + symbol-end)) (set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n") (set (make-local-variable 'outline-level) #'python-outline-level) (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil) @@ -1746,20 +2199,28 @@ lines count as headers. (set (make-local-variable 'eldoc-documentation-function) #'python-eldoc-function) (add-hook 'eldoc-mode-hook - '(lambda () (run-python nil t)) nil t) ; need it running - (unless (assoc 'python-mode hs-special-modes-alist) - (setq - hs-special-modes-alist - (cons (list - 'python-mode "^\\s-*def\\>" nil "#" - (lambda (arg)(python-end-of-defun)(skip-chars-backward " \t\n")) - nil) - hs-special-modes-alist))) + (lambda () (run-python nil t)) ; need it running + nil t) + ;; Fixme: should be in hideshow. This seems to be of limited use + ;; since it isn't (can't be) indentation-based. Also hide-level + ;; doesn't seem to work properly. + (add-to-list 'hs-special-modes-alist + `(python-mode "^\\s-*def\\>" nil "#" + ,(lambda (arg) + (python-end-of-defun) + (skip-chars-backward " \t\n")) + nil)) + (set (make-local-variable 'skeleton-further-elements) + '((< '(backward-delete-char-untabify (min python-indent + (current-column)))) + (^ '(- (1+ (current-indentation)))))) + (add-hook 'pre-abbrev-expand-hook 'python-pea-hook nil t) (if (featurep 'hippie-exp) (set (make-local-variable 'hippie-expand-try-functions-list) (cons 'python-try-complete hippie-expand-try-functions-list))) (when python-guess-indent (python-guess-indent)) (set (make-local-variable 'python-command) python-python-command) + (python-find-imports) (unless (boundp 'python-mode-running) ; kill the recursion from jython-mode (let ((python-mode-running t)) (python-maybe-jython)))) @@ -1767,9 +2228,11 @@ lines count as headers. (custom-add-option 'python-mode-hook 'imenu-add-menubar-index) (custom-add-option 'python-mode-hook '(lambda () - "Turn on Indent Tabs mode." - (set (make-local-variable 'indent-tabs-mode) t))) + "Turn off Indent Tabs mode." + (set (make-local-variable 'indent-tabs-mode) nil))) (custom-add-option 'python-mode-hook 'turn-on-eldoc-mode) +(custom-add-option 'python-mode-hook 'abbrev-mode) +(custom-add-option 'python-mode-hook 'python-setup-brm) ;;;###autoload (define-derived-mode jython-mode python-mode "Jython" @@ -1780,5 +2243,6 @@ Runs `jython-mode-hook' after `python-mode-hook'." (set (make-local-variable 'python-command) python-jython-command)) (provide 'python) +(provide 'python-21) ;; arch-tag: 6fce1d99-a704-4de9-ba19-c6e4912b0554 ;;; python.el ends here From c5b76d6cf7f35283aae93ef33b8dad1bdf13e085 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 20 Aug 2006 17:58:09 +0000 Subject: [PATCH 276/361] * keyboard.c (show_help_echo): Preserve mouse movement flag if tracking mouse. --- src/ChangeLog | 5 ++ src/keyboard.c | 144 ++++++++++++++++++++++++++----------------------- 2 files changed, 82 insertions(+), 67 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index a820b51f77d..b7778885c13 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-20 Chong Yidong + + * keyboard.c (show_help_echo): Preserve mouse movement flag if + tracking mouse. + 2006-08-20 Richard Stallman * xfaces.c (load_pixmap): Add quotes in error message. diff --git a/src/keyboard.c b/src/keyboard.c index 13ab5299982..e4c17d5d43f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1390,6 +1390,72 @@ DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, return Qnil; } +#ifdef HAVE_MOUSE + +/* Restore mouse tracking enablement. See Ftrack_mouse for the only use + of this function. */ + +static Lisp_Object +tracking_off (old_value) + Lisp_Object old_value; +{ + do_mouse_tracking = old_value; + if (NILP (old_value)) + { + /* Redisplay may have been preempted because there was input + available, and it assumes it will be called again after the + input has been processed. If the only input available was + the sort that we have just disabled, then we need to call + redisplay. */ + if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW)) + { + redisplay_preserve_echo_area (6); + get_input_pending (&input_pending, + READABLE_EVENTS_DO_TIMERS_NOW); + } + } + return Qnil; +} + +DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0, + doc: /* Evaluate BODY with mouse movement events enabled. +Within a `track-mouse' form, mouse motion generates input events that +you can read with `read-event'. +Normally, mouse motion is ignored. +usage: (track-mouse BODY ...) */) + (args) + Lisp_Object args; +{ + int count = SPECPDL_INDEX (); + Lisp_Object val; + + record_unwind_protect (tracking_off, do_mouse_tracking); + + do_mouse_tracking = Qt; + + val = Fprogn (args); + return unbind_to (count, val); +} + +/* If mouse has moved on some frame, return one of those frames. + Return 0 otherwise. */ + +static FRAME_PTR +some_mouse_moved () +{ + Lisp_Object tail, frame; + + FOR_EACH_FRAME (tail, frame) + { + if (XFRAME (frame)->mouse_moved) + return XFRAME (frame); + } + + return 0; +} + +#endif /* HAVE_MOUSE */ + /* This is the actual command reading loop, sans error-handling encapsulation. */ @@ -2310,7 +2376,17 @@ show_help_echo (help, window, object, pos, ok_to_overwrite_keystroke_echo) #ifdef HAVE_MOUSE if (!noninteractive && STRINGP (help)) - help = call1 (Qmouse_fixup_help_message, help); + { + /* The mouse-fixup-help-message Lisp function can call + mouse_position_hook, which resets the mouse_moved flags. + This causes trouble if we are trying to read a mouse motion + event (i.e., if we are inside a `track-mouse' form), so we + restore the mouse_moved flag. */ + FRAME_PTR f = NILP (do_mouse_tracking) ? NULL : some_mouse_moved (); + help = call1 (Qmouse_fixup_help_message, help); + if (f) + f->mouse_moved = 1; + } #endif if (STRINGP (help) || NILP (help)) @@ -3464,72 +3540,6 @@ restore_getcjmp (temp) bcopy (temp, getcjmp, sizeof getcjmp); } -#ifdef HAVE_MOUSE - -/* Restore mouse tracking enablement. See Ftrack_mouse for the only use - of this function. */ - -static Lisp_Object -tracking_off (old_value) - Lisp_Object old_value; -{ - do_mouse_tracking = old_value; - if (NILP (old_value)) - { - /* Redisplay may have been preempted because there was input - available, and it assumes it will be called again after the - input has been processed. If the only input available was - the sort that we have just disabled, then we need to call - redisplay. */ - if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW)) - { - redisplay_preserve_echo_area (6); - get_input_pending (&input_pending, - READABLE_EVENTS_DO_TIMERS_NOW); - } - } - return Qnil; -} - -DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0, - doc: /* Evaluate BODY with mouse movement events enabled. -Within a `track-mouse' form, mouse motion generates input events that -you can read with `read-event'. -Normally, mouse motion is ignored. -usage: (track-mouse BODY ...) */) - (args) - Lisp_Object args; -{ - int count = SPECPDL_INDEX (); - Lisp_Object val; - - record_unwind_protect (tracking_off, do_mouse_tracking); - - do_mouse_tracking = Qt; - - val = Fprogn (args); - return unbind_to (count, val); -} - -/* If mouse has moved on some frame, return one of those frames. - Return 0 otherwise. */ - -static FRAME_PTR -some_mouse_moved () -{ - Lisp_Object tail, frame; - - FOR_EACH_FRAME (tail, frame) - { - if (XFRAME (frame)->mouse_moved) - return XFRAME (frame); - } - - return 0; -} - -#endif /* HAVE_MOUSE */ - /* Low level keyboard/mouse input. kbd_buffer_store_event places events in kbd_buffer, and kbd_buffer_get_event retrieves them. */ From 65a16bef2356d8972743ecc03ca8bf922d8eddeb Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 20 Aug 2006 18:14:50 +0000 Subject: [PATCH 277/361] Remove * in defcustom docstrings. (run-python, python-proc, python-try-complete): Use derived-mode-p. (python-mode): Set tab-width and indent-tabs-mode. --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/python.el | 39 ++++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 338b598be3f..dbc4b75d738 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-20 Stefan Monnier + + * progmodes/python.el: Remove * in defcustom docstrings. + (run-python, python-proc, python-try-complete): Use derived-mode-p. + (python-mode): Set tab-width and indent-tabs-mode. + 2006-08-20 Dave Love * progmodes/python.el: Update to Dave Love's latest version. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 40f4e8aab57..8a7b0537516 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -400,18 +400,18 @@ The criteria are that the line isn't a comment or in string and ;;;; Indentation. (defcustom python-indent 4 - "*Number of columns for a unit of indentation in Python mode. + "Number of columns for a unit of indentation in Python mode. See also `\\[python-guess-indent]'" :group 'python :type 'integer) (defcustom python-guess-indent t - "*Non-nil means Python mode guesses `python-indent' for the buffer." + "Non-nil means Python mode guesses `python-indent' for the buffer." :type 'boolean :group 'python) (defcustom python-indent-string-contents t - "*Non-nil means indent contents of multi-line strings together. + "Non-nil means indent contents of multi-line strings together. This means indent them the same as the preceding non-blank line. Otherwise preserve their indentation. @@ -430,7 +430,7 @@ are always indented in lines with preceding comments." :group 'python) (defcustom python-continuation-offset 4 - "*Number of columns of additional indentation for continuation lines. + "Number of columns of additional indentation for continuation lines. Continuation lines follow a backslash-terminated line starting a statement." :group 'python @@ -1094,7 +1094,7 @@ Repeat ARG times." ;;;; pychecker (defcustom python-check-command "pychecker --stdlib" - "*Command used to check a Python file." + "Command used to check a Python file." :type 'string :group 'python) @@ -1126,7 +1126,7 @@ See `python-check-command' for the default." ;; Fixme: Make sure we can work with IPython. (defcustom python-python-command "python" - "*Shell command to run Python interpreter. + "Shell command to run Python interpreter. Any arguments can't contain whitespace. Note that IPython may not work properly; it must at least be used with the `-cl' flag, i.e. use `ipython -cl'." @@ -1134,7 +1134,7 @@ with the `-cl' flag, i.e. use `ipython -cl'." :type 'string) (defcustom python-jython-command "jython" - "*Shell command to run Jython interpreter. + "Shell command to run Jython interpreter. Any arguments can't contain whitespace." :group 'python :type 'string) @@ -1227,7 +1227,7 @@ For running multiple processes in multiple buffers, see `run-python' and (compilation-shell-minor-mode 1)) (defcustom inferior-python-filter-regexp "\\`\\s-*\\S-?\\S-?\\s-*\\'" - "*Input matching this regexp is not saved on the history list. + "Input matching this regexp is not saved on the history list. Default ignores all inputs of 0, 1, or 2 non-blank characters." :type 'regexp :group 'python) @@ -1334,7 +1334,7 @@ buffer for a list of commands.)" (setq python-buffer (current-buffer))) (accept-process-output (get-buffer-process python-buffer) 5) (inferior-python-mode))) - (if (eq 'python-mode major-mode) + (if (derived-mode-p 'python-mode) (setq python-buffer (default-value 'python-buffer))) ; buffer-local ;; Load function definitions we need. ;; Before the preoutput function was used, this was done via -c in @@ -1441,7 +1441,7 @@ Then switch to the process buffer." (python-switch-to-python t)) (defcustom python-source-modes '(python-mode jython-mode) - "*Used to determine if a buffer contains Python source code. + "Used to determine if a buffer contains Python source code. If a file is loaded into a buffer that is in one of these major modes, it is considered Python source by `python-load-file', which uses the value to determine defaults." @@ -1484,9 +1484,9 @@ See variable `python-buffer'. Starts a new process if necessary." ;; isn't one for `python-buffer'. (unless (comint-check-proc python-buffer) (run-python nil t)) - (get-buffer-process (or (if (eq major-mode 'inferior-python-mode) - (current-buffer) - python-buffer)))) + (get-buffer-process (or (if (derived-mode-p 'inferior-python-mode) + (current-buffer) + python-buffer)))) (defun python-set-proc () "Set the default value of `python-buffer' to correspond to this buffer. @@ -1912,7 +1912,7 @@ Repeating the command scrolls the completion window." (defun python-try-complete (old) "Completion function for Python for use with `hippie-expand'." - (when (eq major-mode 'python-mode) ; though we only add it locally + (when (derived-mode-p 'python-mode) ; though we only add it locally (unless old (let ((symbol (python-partial-symbol))) (he-init-string (- (point) (length symbol)) (point)) @@ -2218,7 +2218,12 @@ with skeleton expansions for compound statement templates. (if (featurep 'hippie-exp) (set (make-local-variable 'hippie-expand-try-functions-list) (cons 'python-try-complete hippie-expand-try-functions-list))) + ;; Python defines TABs as being 8-char wide. + (set (make-local-variable 'tab-width) 8) (when python-guess-indent (python-guess-indent)) + ;; Let's make it harder for the user to shoot himself in the foot. + (unless (= tab-width python-indent) + (setq indent-tabs-mode nil)) (set (make-local-variable 'python-command) python-python-command) (python-find-imports) (unless (boundp 'python-mode-running) ; kill the recursion from jython-mode @@ -2227,9 +2232,9 @@ with skeleton expansions for compound statement templates. (custom-add-option 'python-mode-hook 'imenu-add-menubar-index) (custom-add-option 'python-mode-hook - '(lambda () - "Turn off Indent Tabs mode." - (set (make-local-variable 'indent-tabs-mode) nil))) + (lambda () + "Turn off Indent Tabs mode." + (set (make-local-variable 'indent-tabs-mode) nil))) (custom-add-option 'python-mode-hook 'turn-on-eldoc-mode) (custom-add-option 'python-mode-hook 'abbrev-mode) (custom-add-option 'python-mode-hook 'python-setup-brm) From 15fe08255793a44b9631184ce5cd88908abf1e33 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Sun, 20 Aug 2006 20:57:26 +0000 Subject: [PATCH 278/361] Tiny typo. --- lispref/os.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lispref/os.texi b/lispref/os.texi index 65510197e4e..d227cf92bcf 100644 --- a/lispref/os.texi +++ b/lispref/os.texi @@ -1487,7 +1487,7 @@ cause anything special to happen. @section Idle Timers Here is how to set up a timer that runs when Emacs is idle for a -certain length of time. Aside from how to set them nup, idle timers +certain length of time. Aside from how to set them up, idle timers work just like ordinary timers. @deffn Command run-with-idle-timer secs repeat function &rest args @@ -1561,7 +1561,7 @@ Here's an example: (when @var{taking-a-break} (setq resume-timer (run-with-idle-timer - ;; Compute an idle time @var{break-length} + ;; Compute an idle time @var{break-length} ;; more than the current value. (time-add (current-idle-time) (seconds-to-time @var{break-length})) From 748726f4d0afd75e639ab15ecef1c8ac62bf93f6 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 21 Aug 2006 02:09:31 +0000 Subject: [PATCH 279/361] (syms_of_keyboard): Docstring of Vunread_post_input_method_events and Vunread_input_method_events fixed. --- src/ChangeLog | 6 ++++++ src/keyboard.c | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b7778885c13..8308a1ab29d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2006-08-21 Kenichi Handa + + * keyboard.c (syms_of_keyboard): Docstring of + Vunread_post_input_method_events and Vunread_input_method_events + fixed. + 2006-08-20 Chong Yidong * keyboard.c (show_help_echo): Preserve mouse movement flag if diff --git a/src/keyboard.c b/src/keyboard.c index e4c17d5d43f..72e6844d841 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11228,14 +11228,16 @@ These events are processed first, before actual keyboard input. */); DEFVAR_LISP ("unread-post-input-method-events", &Vunread_post_input_method_events, doc: /* List of events to be processed as input by input methods. -These events are processed after `unread-command-events', but -before actual keyboard input. */); +These events are processed before `unread-command-events' +and actual keyboard input without given to `input-method-function'. */); Vunread_post_input_method_events = Qnil; DEFVAR_LISP ("unread-input-method-events", &Vunread_input_method_events, doc: /* List of events to be processed as input by input methods. These events are processed after `unread-command-events', but -before actual keyboard input. */); +before actual keyboard input. +If there's an active input method, the events are given to +`input-method-function'. */); Vunread_input_method_events = Qnil; DEFVAR_LISP ("meta-prefix-char", &meta_prefix_char, From c2659d233259c0aaab411906aaeeb2a485160726 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 21 Aug 2006 03:28:09 +0000 Subject: [PATCH 280/361] Sync with the latest TUTORIAL. --- etc/ChangeLog | 4 +++ etc/TUTORIAL.cn | 92 ++++++++++++++++++++++++++----------------------- 2 files changed, 52 insertions(+), 44 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 6f177e3b890..42d04fc2e7c 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2006-08-21 Sun Yijiang + + * TUTORIAL.cn: Sync with the latest TUTORIAL. + 2006-08-20 Dave Love * emacs.py: Update to Dave Love's latest version. diff --git a/etc/TUTORIAL.cn b/etc/TUTORIAL.cn index a1589aa0cd7..7ba8d808c2d 100644 --- a/etc/TUTORIAL.cn +++ b/etc/TUTORIAL.cn @@ -165,7 +165,7 @@ M-comma ´ó²¿·ÖµÄ Emacs ÃüÁî½ÓÊÜÊý×Ö²ÎÊý£¬²¢ÇÒ¶ÔÓÚ¶àÊýÃüÁî¶øÑÔ£¬ÕâЩÊý×Ö²ÎÊýµÄ×÷ ÓÃÊÇÖ¸¶¨ÃüÁîµÄÖØ¸´´ÎÊý¡£ÎªÒ»¸öÃüÁîÖ¸¶¨Êý×Ö²ÎÊý£¨Ò²¾ÍÊÇÖØ¸´´ÎÊý£©µÄ·½·¨ ÊÇ£ºÏÈÊäÈë C-u£¬È»ºóÊäÈëÊý×Ö×÷Ϊ²ÎÊý£¬×îºóÔÙÊäÈëÃüÁî¡£Èç¹ûÄãÓÐMETA £¨»ò -EDIT »ò ALT£©¼ü£¬ÄÇô»¹ÓÐÁíÒ»ÖÖ°ì·¨£º°´×¡ META ¼ü²»¶¯£¬È»ºóÊäÈëÊý×Ö¡£²» +EDIT »ò ALT£©¼ü£¬ÄÇô»¹ÓÐÁíÒ»ÖÖ°ì·¨£º°´×¡ META ¼ü²»·Å£¬È»ºóÊäÈëÊý×Ö¡£²» ¹ýÎÒÃÇ»¹Êǽ¨ÒéÄãÓà C-u£¬ÒòΪËüÔÚÈκÎÖÕ¶Ë»úÉ϶¼ÄÜÓá£ÕâÖÖÊý×Ö²ÎÊýÒ²³ÆÎª ¡°Ç°×º²ÎÊý¡±£¬Òâ˼ÊÇ˵Õâ¸ö²ÎÊýÊÇÏÈÓÚʹÓÃËüµÄÃüÁî¶øÊäÈëµÄ¡£ @@ -174,9 +174,9 @@ EDIT >> Ϊ C-n »òÕß C-p Ö¸¶¨Ò»¸öÊý×Ö²ÎÊý£¬ÕâÑùÄã¿ÉÒÔÖ»ÓÃÒ»¸öÃüÁî¾Í°Ñ¹â±êÒÆ¶¯ µ½±¾Ðеĸ½½ü¡£ -ËäÈ»´ó²¿·ÖÃüÁîÓÃÊý×Ö²ÎÊýÀ´×÷ΪÆäÖØ¸´´ÎÊý£¬µ«ÊÇÒ²ÓÐЩÃüÁîÀýÍ⣬ËüÃǽ«Êý -×Ö²ÎÊýÁí×öËüÓᣱÈÈçÓÐЩÃüÁĿǰ»¹Ã»Ñ§µ½£©½ö½ö½«Ç°×º²ÎÊý×÷Ϊһ¸ö±ê -Ö¾¡ª¡ªÖ»ÒªÓÐÒ»¸öǰ׺²ÎÊý³öÏÖ£¬²»¹ÜÆäֵΪºÎ£¬ÃüÁîµÄ¹¦Äܶ¼»á¸Ä±ä¡£ +ËäÈ»´ó²¿·ÖÃüÁî°ÑÊý×Ö²ÎÊý½âÊÍΪÆäÖØ¸´´ÎÊý£¬µ«ÊÇÒ²ÓÐЩÃüÁîÀýÍ⣬ËüÃǽ«Êý +×Ö²ÎÊýÁí×öËüÓᣱÈÈçÓÐЩÃüÁÎÒÃÇĿǰ»¹Ã»Ñ§µ½£©½ö½ö½«Ç°×º²ÎÊý×÷Ϊһ¸ö +±êÖ¾¡ª¡ªÖ»Òª¸ø³öÓÐÒ»¸öǰ׺²ÎÊý£¬²»¹ÜÆäֵΪºÎ£¬Ëü¶¼»á¸Ä±äÃüÁîµÄ¹¦ÄÜ¡£ ¶ø C-v ºÍ M-v ÔòÊôÓÚÁíÒ»ÖÖÀàÐ͵ÄÀýÍâ¡£µ±¸ø¶¨Ò»¸ö²ÎÊýʱ£¬ËüÃǽ«¹ö¶¯ÄãÖ¸ ¶¨µÄ¡°ÐÐÊý¡±£¬¶ø²»ÊÇ¡°ÆÁÊý¡±¡£¾ÙÀýÀ´Ëµ£¬C-u 8 C-v ½«ÆÁÄ»ÏòϹö¶¯ 8 ÐУ¬ @@ -188,8 +188,8 @@ EDIT ÒÔ¸ø¶¨Ò»¸ö²ÎÊýÈ»ºóÖ´ÐÐ M-v¡£ Èç¹ûÄãÕýÔÚʹÓÃÒ»¸ö´°¿Úϵͳ£¬±ÈÈç X11 »òÕß΢ÈíµÄ Windows£¬ÄÇôÔÚ Emacs -´°¿ÚµÄ×ó±ß»òÕßÓÒ±ßÓ¦¸ÃÓÐÒ»¸ö³¤·½ÐεÄÇøÓò½Ð¡°¹ö¶¯Ìõ¡±£¬Äã¿ÉÒÔÓÃÊó±ê²Ù×Ý -¹ö¶¯ÌõÀ´¹ö¶¯ÎÄ×Ö¡£ +´°¿ÚµÄ±ßÔµÓ¦¸ÃÓÐÒ»¸ö³¤·½ÐεÄÇøÓò½Ð¡°¹ö¶¯Ìõ¡±£¬Äã¿ÉÒÔÓÃÊó±ê²Ù×ݹö¶¯ÌõÀ´ +¹ö¶¯ÎÄ×Ö¡£ >> ÊÔ×ÅÔÚ¡°¹ö¶¯ÌõÄڵķ´°×ÇøÓò¡±Éϰ´Ò»ÏÂÊó±êÖмü¡£ ÎÄ×ÖÓ¦¸Ã»á¹ö¶¯µ½Êó±êËùָʾµÄλÖᣠ@@ -202,10 +202,10 @@ EDIT * ÔÚ EMACS ʧȥÏìÓ¦µÄʱºò£¨WHEN EMACS IS HUNG£© ----------------------------------------------- -Èç¹û Emacs ¶ÔÄãµÄÃüÁîʧȥÏìÓ¦£¬Äã¿ÉÒԺܰ²È«µØÓà C-g À´ÖÕÖ¹Õâ¸öÃüÁî¡£ -C-g Ò²¿ÉÒÔ±»ÓÃÀ´ÖÕÖ¹Ò»¸öÖ´Ðйý¾ÃµÄÃüÁî¡£ +Èç¹û Emacs ¶ÔÄãµÄÃüÁîʧȥÏìÓ¦£¬Äã¿ÉÒÔÓà C-g À´°²È«µØÖÕÖ¹ÕâÌõÃüÁî¡£C-g +Ò²¿ÉÒÔÖÕÖ¹Ò»ÌõÖ´Ðйý¾ÃµÄÃüÁî¡£ -C-g »¹¿ÉÒÔ±»À´È¡ÏûÊý×Ö²ÎÊýºÍÄÇЩÊäÈëµ½Ò»°ëµÄÃüÁî¡£ +C-g »¹¿ÉÒÔÈ¡ÏûÊý×Ö²ÎÊýºÍÖ»ÊäÈëµ½Ò»°ëµÄÃüÁî¡£ >> ÊäÈë C-u 100 É趨һ¸öֵΪ 100 µÄÊý×Ö²ÎÊý£¬È»ºó°´ C-g¡£ ÏÖÔÚÔÙ°´ C-f£¬¹â±êÓ¦¸ÃÖ»»áÒÆ¶¯Ò»¸ö×Ö·û£¬ÒòΪÄãÒѾ­Óà C-g È¡ÏûÁ˲ÎÊý¡£ @@ -219,16 +219,16 @@ C-g ----------------------------------- ÓÐһЩ Emacs ÃüÁî±»¡°½ûÓá±ÁË£¬ÒÔ±ÜÃâ³õѧÕßÔÚ²»Á˽âÆäÈ·Çй¦ÄܵÄÇé¿öÏÂÎó -ÓÃÕâЩÃüÁÔì³ÉÂé·³¡£ +ÓÃËüÃÇ£¬Ôì³ÉÂé·³¡£ Èç¹ûÄãÓõ½ÁËÒ»¸ö±»½ûÓõÄÃüÁEmacs »áÏÔʾһ¸öÌáʾÏûÏ¢£¬¸æËßÄãÕâ¸öÃüÁî µ½µ×ÊǸÉʲôµÄ£¬Ñ¯ÎÊÄãÊÇ·ñÒª¼ÌÐø£¬²¢Ôڵõ½ÄãµÄ¿Ï¶¨Ö®ºóÔÙÖ´ÐÐÕâÃüÁî¡£ -ÄãÒªÊÇÕæµÄÏëÖ´Ðб»½ûÓõÄÃüÁÄÇôÔÚ Emacs ѯÎÊÄãµÄʱºòÓ¦¸Ã°´¿Õ¸ñ¡£Ò»°ã -À´Ëµ£¬Èç¹ûÄã²»ÏëÖ´ÐУ¬°´¡°n¡±¾ÍÐÐÁË¡£ +Èç¹ûÄãÕæµÄÏëÓÃÕâÌõÃüÁÔÚ Emacs ѯÎÊÄãµÄʱºòÓ¦¸Ã°´¿Õ¸ñ¡£Ò»°ãÀ´Ëµ£¬Èç¹û +Äã²»ÏëÓ㬾Ͱ´¡°n¡±¡£ >> ÊÔÊÔ C-x C-l £¨ÕâÊÇÒ»¸ö±»½ûÓõÄÃüÁ - È»ºóÓà n À´»Ø´ðÎÊÌâ¡£ + È»ºóÓà n À´»Ø´ðѯÎÊ¡£ * ´°¸ñ£¨WINDOWS£© @@ -245,7 +245,7 @@ Emacs >> °Ñ¹â±êÒÆµ½±¾ÐÐÈ»ºóÊäÈë C-u 0 C-l¡£ >> ÊäÈë CONTROL-h k CONTROL-f¡£¹Û²ìµ±Ò»¸öд°¸ñ³öÏÖʱµ±Ç°´°¸ñ£¨ÓÃÀ´ÏÔʾ - CONTROL-f ÃüÁîµÄÎĵµ£©ÊÇÈçºÎËõСµÄ¡£ + CONTROL-f ÃüÁîµÄÎĵµ£©ÊÇÈçºÎ±äСµÄ¡£ >> ÊäÈë C-x 1 ¹ØµôÎĵµ´°¸ñ¡£ @@ -265,33 +265,33 @@ Emacs Ó÷¨Ó¦¸ÃÒ»Ñù¡£Ò»°ãÀ´Ëµ ¾ÍÊÇλÓÚ ¼üÉÏ·½Ä³´¦µÄÒ»¸ö´óºÅ ¼ü£¬Í¨³£±»±êʾΪ¡°Delete¡±¡¢¡°Del¡±»òÕß¡°Backspace¡±¡£ -Èç¹ûÄãÕÒµ½Á˱ê×Å¡°Backspace¡±µÄ¼ü£¬ÄÇôËüÓ¦¸Ã¾ÍÊÇ £»¼´±ãÄãÓÖÔÚ -¼üÅÌÆäËüµØ·½ÕÒµ½ÁËÒ»¸ö±êʾΪ¡°Del¡±µÄ¼ü£¬ÄÇôËüÒ²Ó¦¸Ã²»ÊÇ ¡£ +Èç¹ûÄãÕÒµ½ÁË¡°Backspace¡±¼ü£¬ÄÇôËüÓ¦¸Ã¾ÍÊÇ £»ÄÄÅÂÄãÓÖÔÚ±ðµÄµØ +·½ÕÒµ½ÁËÒ»¸ö¡°Del¡±¼ü£¬ÄÇôËüÒ²Ó¦¸Ã²»ÊÇ ¡£ -Ò»ÖÖ¸üͨÓõÄ˵·¨ÊÇ£¬ ½«Î»ÓÚ¹â±êǰµÄÒ»¸ö×Ö·ûɾ³ý¡£ +Ò»ÖÖ¸üͨÓõÄ˵·¨ÊÇ£¬ ½«É¾³ýλÓÚ¹â±êǰµÄÒ»¸ö×Ö·û¡£ >> ÏÖÔÚ¾ÍÊÔÊÔ¡ª¡ªÇõã×Ö£¬È»ºó°´¼¸Ï ɾ³ýËüÃÇ¡£ ²»Óõ£ÐÄÄã»áÐÞ¸ÄÎļþ£¬Äã¸Éʲô¶¼Ã»¹ØÏµ£¬ÕâÀï¾ÍÊÇר¸øÄãÁ·Ï°Óõġ£ Èç¹ûÒ»ÐÐÎÄ×ֺܳ¤¡¢³¬³öÁË´°¸ñµÄ¿í¶È£¬ÏÔʾ²»ÏµIJ¿·Ö»áÔÚ½ôÁÚµÄÏÂÒ»ÐмÌÐø -ÏÔʾ¡£Õâʱ»áÓÐÒ»¸ö·´Ð±Ïߣ¨¿ØÖÆÌ¨ÏÂÊÇ·´Ð±Ïߣ¬Èç¹ûÄãÓÃͼÐδ°¿Úϵͳ£¬ÔòÓ¦ -¸ÃÊÇÒ»¸öССµÄתÍä¼ýÍ·£©ÏÔʾÔÚÓÒ±ßÑØ£¬±íÃ÷ÕâÊÇijһÐеĽÓÐøÏÔʾ¡£ +ÏÔʾ¡£Õâʱ»áÓÐÒ»¸ö·´Ð±Ïߣ¨ÔÚ¿ØÖÆÌ¨ÏÂÊÇ·´Ð±Ïߣ¬Èç¹ûÄãÓÃͼÐδ°¿Úϵͳ£¬Ôò +Ó¦¸ÃÊÇÒ»¸öССµÄתÍä¼ýÍ·£©ÏÔʾÔÚÓÒ±ßÑØ£¬±íÃ÷ÕâÊÇijһÐеĽÓÐøÏÔʾ¡£ >> ÊäÈëÎÄ×Ö£¬Ò»Ö±µ½ÆÁÄ»µÄÓұ߽磬Ȼºó¼ÌÐø£¬Äã»á¿´µ½Ò»¸ö½ÓÐøÐгöÏÖ¡£ >> Óà ɾµôһЩÎÄ×Ö£¬Ö±µ½´ËÐ㤶ÈСÓÚ´°¸ñ¿í¶È£¬½ÓÐøÐоÍÏûʧÁË¡£ -Äã¿ÉÒÔÏñɾ³ýÆäËû×Ö·ûÒ»Ñùɾ³ý»»Ðзû¡£É¾³ýÁ½ÐÐÖмäµÄ»»Ðзû»á½«Á½Ðкϲ¢³É -Ò»ÐС£Èç¹ûºÏ²¢µÄ½á¹ûʹÕâÒ»ÐÐÌ«³¤£¬³¬³öÁË´°¸ñµÄ¿í¶È£¬Ëü¾Í»áÒÔÒ»¸ö½ÓÐøÐÐ -À´ÏÔʾ¡£ +»»Ðзû¸úÆäËû×Ö·ûÒ»Ñù¿ÉÒÔ±»É¾³ý¡£Á½ÐÐÖмäµÄ»»Ðзû±»É¾³ýºó£¬ÕâÁ½Ðн«»áºÏ +²¢³ÉÒ»ÐС£Èç¹ûºÏ²¢ºóµÄÕâÒ»ÐÐÌ«³¤£¬³¬³öÁË´°¸ñ¿í¶È£¬Ëü¾Í»áÒÔÒ»¸ö½ÓÐøÐÐÀ´ +ÏÔʾ¡£ ->> ÒÆ¶¯¹â±êµ½±¾ÐеĿªÍ·²¢ÊäÈë ¡£ - Õâʱ±¾ÐÐÓëÆäǰһÐн«±»ºÏ²¢ÎªÒ»ÐС£ +>> ÒÆ¶¯¹â±êµ½Ä³ÐеĿªÍ·²¢ÊäÈë ¡£ + Õâʱ¸ÃÐн«ÓëÆäǰһÐÐÒ»Æð±»ºÏ²¢ÎªÒ»ÐС£ >> ÊäÈë ÖØÐ²åÈëÄã¸Õ²Åɾ³ýµÄ»»Ðзû¡£ -Ç°ÃæËµ¹ý£¬´ó²¿·ÖµÄ Emacs ÃüÁî¶¼¿ÉÒÔÖ¸¶¨Öظ´´ÎÊý£¬ÕâÆäÖÐÒ²°üÀ¨ÊäÈë×Ö·ûµÄ -ÃüÁî¡£ÖØ¸´Ö´ÐÐÊäÈë×Ö·ûµÄÃüÁîʵ¼ÊÉϾÍÊÇÊäÈë¶à¸öÒ»ÑùµÄ×Ö·û¡£ +Ç°Ãæ½²¹ý£¬´ó²¿·ÖµÄ Emacs ÃüÁî¶¼¿ÉÒÔÖ¸¶¨Öظ´´ÎÊý£¬ÕâÆäÖÐÒ²°üÀ¨ÊäÈë×Ö·ûµÄ +ÃüÁî¡£ÖØ¸´Ö´ÐÐÊäÈë×Ö·ûµÄÃüÁîʵ¼ÊÉϾÍÊÇÊäÈë¶à¸öÏàͬµÄ×Ö·û¡£ >> ÊÔÊÔ C-u 8 *£¬Õ⽫»á²åÈë ********¡£ @@ -329,10 +329,10 @@ C-SPC ×¢Òâ,¡°ÒƳý£¨kill£©¡±ºÍ¡°É¾³ý£¨delete£©¡±µÄ²»Í¬ÔÚÓÚ±»ÒƳýµÄ¶«Î÷¿ÉÒÔÕÒ»Ø À´£¬¶ø±»É¾³ýµÄ¾Í²»ÐÐÁË¡£¡¾Êµ¼ÊÉÏ£¬ÒƳýµôµÄ¶«Î÷ËäÈ»¿´ÆðÀ´¡°Ïûʧ¡±ÁË£¬µ« ʵ¼ÊÉϱ» Emacs ¼Ç¼ÁËÏÂÀ´£¬Òò´Ë»¹¿ÉÒÔÕÒ»ØÀ´£»¶øÉ¾³ýµôµÄ¶«Î÷ËäȻҲ¿ÉÄÜ»¹ -ÔÚÄÚ´æÀµ«ÊÇÒѾ­±»Emacs¡°Åׯú¡±ÁË£¬ËùÒÔ¾ÍÕÒ²»»ØÀ´ÁË¡£¡¿ÖØÐ²åÈë±»ÒÆ³ý -µÄÎÄ×Ö³ÆÎª¡°Õٻأ¨yank£©¡±¡£Ò»°ã¶øÑÔ£¬ÄÇЩ»áÈ¥³ýºÜ¶àÎÄ×ÖµÄÃüÁî»á°ÑÈ¥³ý -µôµÄÎÄ×Ö´¢´æÆðÀ´£¨ËüÃDZ»É趨³ÉÁË¡°¿ÉÕٻء±£©£¬¶øÄÇЩֻÊÇÈ¥³ýÒ»¸ö×Ö·û»ò -ÕßÖ»ÊÇÈ¥³ý¿Õ°×µÄÃüÁî¾Í²»»á´¢´æÄÇЩ±»È¥³ýµôµÄ¶«Î÷£¨Òò´ËÄã¾ÍÎÞ·¨Õٻأ©¡£ +ÔÚÄÚ´æÀµ«ÊÇÒѾ­±» Emacs¡°Åׯú¡±ÁË£¬ËùÒÔ¾ÍÕÒ²»»ØÀ´ÁË¡£¡¿ÖØÐ²åÈë±»ÒÆ +³ýµÄÎÄ×Ö³ÆÎª¡°Õٻأ¨yank£©¡±¡£Ò»°ã¶øÑÔ£¬ÄÇЩ»áÈ¥³ýºÜ¶àÎÄ×ÖµÄÃüÁî»á°ÑÈ¥ +³ýµôµÄÎÄ×Ö´¢´æÆðÀ´£¨ËüÃDZ»É趨³ÉÁË¡°¿ÉÕٻء±£©£¬¶øÄÇЩֻÊÇÈ¥³ýÒ»¸ö×Ö·û +»òÕßÖ»ÊÇÈ¥³ý¿Õ°×µÄÃüÁî¾Í²»»á´¢´æ±»È¥³ýµôµÄ¶«Î÷£¨×ÔÈ»Äã¾ÍÎÞ·¨ÕÙ»ØÁË£©¡£ >> ÒÆ¶¯¹â±êµ½Ò»·Ç¿Õ°×ÐеÄÐÐÍ·£¬È»ºóÊäÈë C-k ÒÆ³ýÄÇÒ»ÐÐÉϵÄÎÄ×Ö¡£ @@ -409,9 +409,9 @@ C-_ Ò² ´æÅÌ£¬¾ÍÒªÔڱ༭ǰ¡°Ñ°ÕÒ¡±µ½Ò»¸ö´æÅÌÎļþ¡££¨Õâ¸ö¹ý³Ìͨ³£Ò²±»³ÆÎª¡°·ÃÎÊ¡± Îļþ¡££© -ѰÕÒµ½Ò»¸öÎļþÒâζ×ÅÄã¿ÉÒÔÔÚ Emacs Àï²é¿´Õâ¸öÎļþµÄÄÚÈÝ¡£´ÓºÜ¶à½Ç¶È½²£¬ +ѰÕÒµ½Ò»¸öÎļþÒâζ×ÅÄã¿ÉÒÔÔÚ Emacs Àï²é¿´Õâ¸öÎļþµÄÄÚÈÝ¡£´ÓºÜ¶à·½Ãæ½²£¬ Õâ¾ÍµÈÓÚÄãÔÚÖ±½Ó±à¼­Õâ¸öÎļþ¡£µ«ÊÇÄãËù×öµÄÐÞ¸ÄÖ»ÓÐÔÚ¡°´æÅÌ¡±µÄʱºò²Å»á -±»Ð´ÈëÎļþ¡£Ò²ÕýÒòΪÈç´Ë£¬Äã¿ÉÒÔ¶ªÆúÒ»¸ö¸Äµ½Ò»°ëµÄÎļþ¶ø²»±Ø°ÑÕâ¸ö²Ð·Ï +±»Ð´ÈëÎļþ¡£Ò²ÕýÒòΪÈç´Ë£¬Äã¿ÉÒÔ¶ªÆúÒ»¸ö¸Äµ½Ò»°ëµÄÎļþ¶ø²»±Ø°ÑÕâ¸ö²Ðȱ ÎļþÒ²±£´æµ½¼ÆËã»úÉÏ¡£×îºó¾ÍËãÄãÕæÕý´æÁËÅÌ£¬Emacs Ò²»á°Ñ´æÅÌǰµÄÎļþÖØ ÃüÃû±£´æ£¬ÒÔ·ÀÄã¸ÄÍêÖ®ºóÓÖÏë·´»Ú¡£ @@ -572,10 +572,10 @@ replace-string ×Ö·û´®Ìæ»»ÃüÁîÐèÒªÁ½¸ö²ÎÊý¡ª¡ª±»Ìæ»»µÄ×Ö·û´®ºÍÓÃÀ´Ìæ»»ËüµÄ×Ö·û´®¡£Ã¿¸ö ²ÎÊýµÄÊäÈëÓû»ÐзûÀ´½áÊø¡£ ->> ½«¹â±êÒÆµ½±¾ÐеÄÏÂÁ½Ðпհף¬È»ºóÊäÈë +>> ½«¹â±êÒÆµ½±¾ÐÐÏÂÃæµÚ¶þÐеĿհ״¦£¬È»ºóÊäÈë M-x repl schangedaltered¡£ - ¡¾ÎªÁ˼ÌÐøÁ·Ï°£¬±£ÁôÒ»ÐÐÔ­ÎÄÈçÏ£º + ¡¾ÒÔϱ£ÁôÒ»ÐÐÔ­ÎÄ£¬ÒÔÓ¦Á·Ï°Ö®Ð裺 Notice how this line has changed: you've replaced... ¡¿ Çë×¢ÒâÕâÒ»ÐÐÊÇÔõô¸Ä±äµÄ£ºÔÚ¹â±êÖ®ºóµÄ·¶Î§ÄÚ£¬ÄãÒѾ­½«¡°changed¡±Õâ¸ö @@ -617,7 +617,7 @@ replace-string ¹ûλÓÚÎļþµÄĩ⣬¾ÍÏÔʾ --Bot--¡£Èç¹ûÎļþºÜС£¬Ò»ÆÁ¾Í×ãÒÔÏÔʾȫ²¿ÄÚÈÝ£¬ ÄÇô״̬À¸»áÏÔʾ --All--¡£ -L ºÍÆäºóµÄÊý×Ö¸ø³öÁ˹â±êËùÔÚÐеÄÐкš£ +¡°L¡± ºÍÆäºóµÄÊý×Ö¸ø³öÁ˹â±êËùÔÚÐеÄÐкš£ ×ͷµÄÐǺţ¨*£©±íʾÄãÒѾ­¶ÔÎÄ×Ö×ö¹ý¸Ä¶¯¡£¸Õ¸Õ´ò¿ªµÄÎļþ¿Ï¶¨Ã»Óб»¸Ä¶¯ ¹ý£¬ËùÒÔ״̬À¸ÉÏÏÔʾµÄ²»ÊÇÐǺŶøÊǶÌÏߣ¨-£©¡£ @@ -690,14 +690,14 @@ Emacs ¹¦ºó£¬¹â±ê»áÍ£ÁôÔÚËÑË÷Ä¿±ê³öÏֵĵط½¡£ Emacs µÄËÑË÷ÃüÁîµÄ¶ÀÌØÖ®´¦ÔÚÓÚ£¬ËüÊÇ¡°½¥½øµÄ£¨incremental£©¡±£¬Òâ˼ÊÇËÑ -Ë÷ÓëÊäÈëͬʱ½øÐУºÄãÔÚÕâ±ßÒ»¸ö×ÖÒ»¸ö×ÖµØÊäÈëÄãÏëËÑË÷µÄ¶«Î÷£¬Í¬Ê± Emacs -ÔÚÄDZ߾ÍÌæÄãËÑË÷ÁË¡£ +Ë÷ÓëÊäÈëͬʱ½øÐУºÄãÔÚ¼üÅÌÉÏÒ»×ÖÒ»¾äµØÊäÈëËÑË÷´ÊµÄ¹ý³ÌÖУ¬Emacs ¾ÍÒѾ­ +¿ªÊ¼ÌæÄãËÑË÷ÁË¡£ C-s ÊÇÏòǰËÑË÷£¬C-r ÊÇÏòºóËÑË÷¡£²»¹ýÊÖ±ðÕâô¿ì£¡Ïȵȵȱð׿±ÊÔ¡£ -ÔÚÄã°´Ï C-s Ö®ºó£¬Äã»á·¢ÏÖ»ØÏÔÇøÀïÓС°I-search¡±×ÖÑù³öÏÖ£¬ÕâÊÇÔÚÌáʾ -ÄãĿǰ Emacs Õý´¦ÓÚ¡°½¥½øËÑË÷¡±×´Ì¬£¬ÕýÔڵȴýÄãÊäÈëËÑË÷×Ö´®¡£ -»á½áÊøËÑË÷¡£ +ÔÚÄã°´Ï C-s Ö®ºó£¬Äã»á·¢ÏÖ»ØÏÔÇøÀïÓС°I-search¡±×ÖÑù³öÏÖ£¬ÌáʾÄãĿǰ +Emacs Õý´¦ÓÚ¡°½¥½øËÑË÷¡±×´Ì¬£¬ÕýÔڵȴýÄãÊäÈëËÑË÷×Ö´®¡£°´ »á½á +ÊøËÑË÷¡£ >> ÊäÈë C-s ¿ªÊ¼Ò»¸öËÑË÷¡£×¢ÒâÇÃÂýÒ»µã£¬Ò»´ÎÊäÈëÒ»¸ö×Ö·û¡£ ÂýÂýÊäÈë¡°cursor¡±Õû¸ö´Ê£¬Ã¿ÇÃÒ»¸ö×Ö¾ÍÔÝͣһϣ¬×¢Òâ¹Û²ì¹â±ê¡£ @@ -917,10 +917,10 @@ Emacs Emacs ¿ìËÙÖ¸ÄÏ£¨Tutorial£©ÔçÓÐÁ½¸öÁõÕѺêµÄÖÐÎÄÒë±¾£¬·±¼ò¸÷Ò»¡£Æä¼òÌå°æ±¾ £¨TUTORIAL.cn£©»ù±¾ÓÉ·±Ìå°æ±¾£¨TUTORIAL.zh£©¾­´ÊÓïÌæ»»¶øµÃ¡£È»¶ø·±¼òÖÐÎÄ -²»½öÔÚÓôÊϰ¹ßÉÏÓÐËù²»Í¬£¬¸üÓÐÖî¶à±í´ï·½Ê½ºÍ¾ä·¨·½ÃæµÄ²îÒì¡£Òò´ËÒ»Ö±ÒÔÀ´ -ÔĶÁ TUTORIAL.cn ¶¼ÂÔ¾õ»ÞɬºÍÉúÓ²¡£Õâ´ÎÖØÐ·­Òë TUTORIAL.cn µÄ¶¯»úÕýÊÇÔ´ -ÓÚÕâÖÖÌåÑ飬ϣÍûÎÒÃǵŤ×÷Äܹ»Èñ¾ÎĸüºÃµÄ·¢»ÓÆäÓ¦ÓеÄ×÷Óá£TUTORIAL.zh -µÄÒëÎÄÖÊÁ¿ºÜ¸ß£¬ÔÚ·­Òë¹ý³ÌÖиøÓè¹ýÎÒÃǺܶà½è¼øºÍ²Î¿¼£¬Ôڴ˶ÔÁõÕѺêµÄ¹¤×÷ +²»½öÔÚÓôÊϰ¹ßÉÏÓÐËù²»Í¬£¬¸üÓÐÖî¶à±í´ï·½Ê½Óë¾ä·¨·½ÃæµÄ²îÒ죬Òò´ËÒ»Ö±ÒÔÀ´ +Óû§Ê¹Óà TUTORIAL.cn ¶¼»áÂÔ¾õÉúÓ²ºÍ»Þɬ¡£Õâ´ÎÖØÐ·­Òë TUTORIAL.cn µÄ¶¯»ú +ÕýÊÇÔ´ÓÚÕâÖÖÌåÑ飬ϣÍûÎÒÃǵŤ×÷Äܹ»Èñ¾ÎĸüºÃµØ·¢»ÓÆä×÷Óá£TUTORIAL.zh +µÄÒëÎÄÖÊÁ¿ºÜ¸ß£¬ÔÚ·­Òë¹ý³ÌÖиøÓè¹ýÎÒÃÇÐí¶à½è¼øºÍ²Î¿¼£¬Ôڴ˶ÔÁõÕѺêµÄ¹¤×÷ ±íʾ¸Ðл¡£ ·­Òë¹ý³ÌÖÐ×î´óµÄÌôսιýÓÚÊõÓïÒë´ÊµÄÑ¡ÔñÁË¡£¾­¹ýˮľÉçÇø Emacs °åÈÈÐÄÍø @@ -954,6 +954,10 @@ Emacs Öеġ°window¡±¾ÍÖ»ÄÜÒë³É¡°´°¸ñ¡±ÁË¡£ÎÒÃÇÈÏΪ Emacs ÖÐ window ºÍ frame µÄ¹ØÏµÓô°¸ñºÍ´°¿ÚÀ´Àà±ÈÊÇÊ®·ÖÐÎÏóµÄ¡£ + ¡¶Ñ§Ï°GNU Emacs¡·£¨µÚ¶þ°æ£©Ò»Êé¶Ô¡°window¡±ºÍ¡°frame¡±µÄ·­ÒëÓë±¾½Ì³Ì + ¸ÕºÃÏà·´£¨·Ö±ðÒë×÷¡°´°¿Ú¡±ºÍ¡°´°¸ñ¡±£©¡£ÔÚ´ËÌØ±ð×¢Ã÷£¬ÒÔÏû³ý¿ÉÄܲúÉú + µÄÒÉ»ó¡£ + [2] ¶ÔÓÚ¡°delete¡±ºÍ¡°kill¡±µÄÇø±ð£¬ÕýÎÄÒѾ­¸ø³öÁËÏêϸµÄ˵Ã÷¡£¡°É¾³ý¡±ºÍ ¡°ÒƳý¡±Ïà±È½ÏÆðÀ´£¬Ç°Õ߸ü¶àµØÒþº¬×Å¡°ÆÆ»µ¡±ºÍ¡°²»¿É»Ö¸´¡±µÄÒâ˼£¬¶ø ºóÕ߸ü¶àµØÒþº¬×Å¡°±»×ªÒÆ¡±ºÍ¡°¿É»Ö¸´¡±µÄÒâ˼¡£Òò´Ë·Ö±ðÑ¡ÔñËüÃÇ×÷ΪÉÏ From 3e46b34c817d33d581847ea169ebb57c71bc442d Mon Sep 17 00:00:00 2001 From: Lute Kamstra Date: Mon, 21 Aug 2006 05:22:22 +0000 Subject: [PATCH 281/361] Use ../man/texinfo.tex to build elisp.dvi. --- lispref/ChangeLog | 4 ++++ lispref/Makefile.in | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index ea6aa4e41b8..12528d35e55 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,7 @@ +2006-08-21 Lute Kamstra + + * Makefile.in: Use ../man/texinfo.tex to build elisp.dvi. + 2006-08-20 Richard Stallman * os.texi (Idle Timers): New node, split out from Timers. diff --git a/lispref/Makefile.in b/lispref/Makefile.in index e3d09fe2c6f..1eea23e122e 100644 --- a/lispref/Makefile.in +++ b/lispref/Makefile.in @@ -27,6 +27,7 @@ srcdir = @srcdir@ VPATH=@srcdir@ infodir = $(srcdir)/../info +usermanualdir = $(srcdir)/../man TEXI2DVI = texi2dvi SHELL = /bin/sh @@ -103,7 +104,7 @@ $(infodir)/elisp: $(srcs) $(MAKEINFO) -I. -I$(srcdir) $(srcdir)/elisp.texi -o $(infodir)/elisp elisp.dvi: $(srcs) - $(TEXI2DVI) -I $(srcdir) $(srcdir)/elisp.texi + $(TEXI2DVI) -I $(srcdir) -I $(usermanualdir) $(srcdir)/elisp.texi # This is for use in a separate distro of the Emacs Lisp manual. install: elisp From 7faa3f8c0b00a4f3cbd5152419c4a4dc31b1a723 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 21 Aug 2006 05:37:27 +0000 Subject: [PATCH 282/361] Rcirc update from Ryan Yeske 2006-08-20 Ryan Yeske * lisp/net/rcirc.el (rcirc-show-maximum-output): New var. (rcirc-buffer-process): If no buffer argument is supplied, use current-buffer. (rcirc-complete-nick): Complete to the last completed nick first. (rcirc-mode): Preserve the value of `rcirc-urls' across connections. Setup scroll function. (rcirc-scroll-to-bottom): New function. (rcirc-print): Use nick syntax around regexp work. Notice dim-nicks speaking only if they say our nick. (rcirc-update-activity-string): Do not show the modeline indicator if there are no live rcirc processes. (rcirc-cmd-ignore): Ignore case. (rcirc-browse-url-at-point): Fix off-by-one error. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-403 --- lisp/ChangeLog | 16 ++++++++++ lisp/net/rcirc.el | 81 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 71 insertions(+), 26 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dbc4b75d738..f39afc16d73 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,19 @@ +2006-08-20 Ryan Yeske + + * net/rcirc.el (rcirc-show-maximum-output): New var. + (rcirc-buffer-process): If no buffer argument is supplied, use + current-buffer. + (rcirc-complete-nick): Complete to the last completed nick first. + (rcirc-mode): Preserve the value of `rcirc-urls' across + connections. Setup scroll function. + (rcirc-scroll-to-bottom): New function. + (rcirc-print): Use nick syntax around regexp work. Notice + dim-nicks speaking only if they say our nick. + (rcirc-update-activity-string): Do not show the modeline indicator + if there are no live rcirc processes. + (rcirc-cmd-ignore): Ignore case. + (rcirc-browse-url-at-point): Fix off-by-one error. + 2006-08-20 Stefan Monnier * progmodes/python.el: Remove * in defcustom docstrings. diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 1f051ffa9f2..c34ac7dcf78 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -40,6 +40,8 @@ ;; Open a new irc connection with: ;; M-x irc RET +;;; Todo: + ;;; Code: (require 'ring) @@ -140,6 +142,10 @@ number. If zero or nil, no truncating is done." (integer :tag "Number of lines")) :group 'rcirc) +(defcustom rcirc-show-maximum-output t + "*If non-nil, scroll buffer to keep the point at the bottom of +the window.") + (defcustom rcirc-authinfo nil "List of authentication passwords. Each element of the list is a list with a SERVER-REGEXP string @@ -297,6 +303,7 @@ and the cdr part is used for encoding." (defvar rcirc-urls nil "List of urls seen in the current buffer.") +(put 'rcirc-urls 'permanent-local t) (defvar rcirc-keepalive-seconds 60 "Number of seconds between keepalive pings. @@ -539,7 +546,10 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") (defun rcirc-buffer-process (&optional buffer) "Return the process associated with channel BUFFER. With no argument or nil as argument, use the current buffer." - (get-buffer-process (or buffer rcirc-server-buffer))) + (get-buffer-process (if buffer + (with-current-buffer buffer + rcirc-server-buffer) + rcirc-server-buffer))) (defun rcirc-server-name (process) "Return PROCESS server name, given by the 001 response." @@ -601,10 +611,11 @@ If NOTICEP is non-nil, send a notice instead of privmsg." (defvar rcirc-nick-completions nil) (defvar rcirc-nick-completion-start-offset nil) + (defun rcirc-complete-nick () "Cycle through nick completions from list of nicks in channel." (interactive) - (if (eq last-command 'rcirc-complete-nick) + (if (eq last-command this-command) (setq rcirc-nick-completions (append (cdr rcirc-nick-completions) (list (car rcirc-nick-completions)))) @@ -626,9 +637,10 @@ If NOTICEP is non-nil, send a notice instead of privmsg." rcirc-target)))))) (let ((completion (car rcirc-nick-completions))) (when completion + (rcirc-put-nick-channel (rcirc-buffer-process) completion rcirc-target) (delete-region (+ rcirc-prompt-end-marker - rcirc-nick-completion-start-offset) - (point)) + rcirc-nick-completion-start-offset) + (point)) (insert (concat completion (if (= (+ rcirc-prompt-end-marker rcirc-nick-completion-start-offset) @@ -709,7 +721,6 @@ If NOTICEP is non-nil, send a notice instead of privmsg." (make-local-variable 'rcirc-short-buffer-name) (setq rcirc-short-buffer-name nil) (make-local-variable 'rcirc-urls) - (setq rcirc-urls nil) (setq use-hard-newlines t) (make-local-variable 'rcirc-decode-coding-system) @@ -742,6 +753,9 @@ If NOTICEP is non-nil, send a notice instead of privmsg." (make-local-variable 'kill-buffer-hook) (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook) + (make-local-variable 'window-scroll-functions) + (add-hook 'window-scroll-functions 'rcirc-scroll-to-bottom) + ;; add to buffer list, and update buffer abbrevs (when target ; skip server buffer (let ((buffer (current-buffer))) @@ -1144,6 +1158,15 @@ is found by looking up RESPONSE in `rcirc-response-formats'." (make-variable-buffer-local 'rcirc-last-sender) (defvar rcirc-gray-toggle nil) (make-variable-buffer-local 'rcirc-gray-toggle) + +(defun rcirc-scroll-to-bottom (window display-start) + "Scroll window to show maximum output if `rcirc-show-maximum-output' is +non-nil." + (when rcirc-show-maximum-output + (with-selected-window window + (when (>= (window-point) rcirc-prompt-end-marker) + (recenter -1))))) + (defun rcirc-print (process sender response target text &optional activity) "Print TEXT in the buffer associated with TARGET. Format based on SENDER and RESPONSE. If ACTIVITY is non-nil, @@ -1240,16 +1263,19 @@ record activity." ;; record modeline activity (when activity (let ((nick-match - (string-match (concat "\\b" - (regexp-quote (rcirc-nick process)) - "\\b") - text))) + (with-syntax-table rcirc-nick-syntax-table + (string-match (concat "\\b" + (regexp-quote (rcirc-nick process)) + "\\b") + text)))) (when (if rcirc-ignore-buffer-activity-flag ;; - Always notice when our nick is mentioned nick-match - ;; - Never bother us if a dim-nick spoke - (not (and rcirc-dim-nick-regexp sender - (string-match rcirc-dim-nick-regexp sender)))) + ;; - unless our nick is mentioned, don't bother us + ;; - with dim-nicks + (or nick-match + (not (and rcirc-dim-nick-regexp sender + (string-match rcirc-dim-nick-regexp sender))))) (rcirc-record-activity (current-buffer) (when (or nick-match (and (not (rcirc-channel-p rcirc-target)) @@ -1504,18 +1530,20 @@ activity. Only run if the buffer is not visible and (lopri (car pair)) (hipri (cdr pair))) (setq rcirc-activity-string - (if (or hipri lopri) - (concat "-" - (and hipri "[") - (rcirc-activity-string hipri) - (and hipri lopri ",") - (and lopri - (concat "(" - (rcirc-activity-string lopri) - ")")) - (and hipri "]") - "-") - "-[]-")))) + (cond ((or hipri lopri) + (concat "-" + (and hipri "[") + (rcirc-activity-string hipri) + (and hipri lopri ",") + (and lopri + (concat "(" + (rcirc-activity-string lopri) + ")")) + (and hipri "]") + "-")) + ((not (null (rcirc-process-list))) + "-[]-") + (t ""))))) (defun rcirc-activity-string (buffers) (mapconcat (lambda (b) @@ -1771,7 +1799,7 @@ nicks when no NICK is given. When listing ignored nicks, the ones added to the list automatically are marked with an asterisk." (interactive "sToggle ignoring of nick: ") (when (not (string= "" nick)) - (if (member nick rcirc-ignore-list) + (if (member-ignore-case nick rcirc-ignore-list) (setq rcirc-ignore-list (delete nick rcirc-ignore-list)) (setq rcirc-ignore-list (cons nick rcirc-ignore-list)))) (rcirc-print process (rcirc-nick process) "IGNORE" target @@ -1800,6 +1828,7 @@ ones added to the list automatically are marked with an asterisk." "://") "www.") (1+ (char "-a-zA-Z0-9_.")) + (1+ (char "-a-zA-Z0-9_")) (optional ":" (1+ (char "0-9")))) (and (1+ (char "-a-zA-Z0-9_.")) (or ".com" ".net" ".org") @@ -1823,7 +1852,7 @@ ones added to the list automatically are marked with an asterisk." (defun rcirc-browse-url-at-point (point) "Send URL at point to `browse-url'." (interactive "d") - (let ((beg (previous-single-property-change point 'mouse-face)) + (let ((beg (previous-single-property-change (1+ point) 'mouse-face)) (end (next-single-property-change point 'mouse-face))) (browse-url (buffer-substring-no-properties beg end)))) From c58790e68a9e81d4606a6f608694db76510eec07 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Mon, 21 Aug 2006 08:52:54 +0000 Subject: [PATCH 283/361] *** empty log message *** --- src/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 8308a1ab29d..fe4a59cf808 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2006-08-21 Kim F. Storm + + * macterm.c (x_draw_stretch_glyph_string): + * w32term.c (x_draw_stretch_glyph_string): + * xterm.c (x_draw_stretch_glyph_string): It is ok to draw a + stretch glyph in left marginal areas on header and mode lines. + 2006-08-21 Kenichi Handa * keyboard.c (syms_of_keyboard): Docstring of From 6c6939293677c179b65e23aee9ec40537a418dbd Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Mon, 21 Aug 2006 08:53:32 +0000 Subject: [PATCH 284/361] (x_draw_stretch_glyph_string): It is ok to draw a stretch glyph in left marginal areas on header and mode lines. --- src/macterm.c | 4 +++- src/w32term.c | 4 +++- src/xterm.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/macterm.c b/src/macterm.c index 69612302774..97e3b743469 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -3583,7 +3583,9 @@ x_draw_stretch_glyph_string (s) int background_width = s->background_width; int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); - if (x < left_x) + /* Don't draw into left margin, fringe or scrollbar area + except for header line and mode line. */ + if (x < left_x && !s->row->mode_line_p) { background_width -= left_x - x; x = left_x; diff --git a/src/w32term.c b/src/w32term.c index 294059aa77b..5e33c3af7b9 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2418,7 +2418,9 @@ x_draw_stretch_glyph_string (s) int background_width = s->background_width; int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); - if (x < left_x) + /* Don't draw into left margin, fringe or scrollbar area + except for header line and mode line. */ + if (x < left_x && !s->row->mode_line_p) { background_width -= left_x - x; x = left_x; diff --git a/src/xterm.c b/src/xterm.c index 6fb9ee28f42..9cea615ca1e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2589,7 +2589,9 @@ x_draw_stretch_glyph_string (s) int background_width = s->background_width; int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); - if (x < left_x) + /* Don't draw into left margin, fringe or scrollbar area + except for header line and mode line. */ + if (x < left_x && !s->row->mode_line_p) { background_width -= left_x - x; x = left_x; From a847570cfe72b1c65cf1951347fe34dbb12a6d6d Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 21 Aug 2006 10:54:46 +0000 Subject: [PATCH 285/361] (Basic Isearch): Add `isearch' index entry. --- man/search.texi | 1 + 1 file changed, 1 insertion(+) diff --git a/man/search.texi b/man/search.texi index 9bf71a7efdb..ef83260ed35 100644 --- a/man/search.texi +++ b/man/search.texi @@ -64,6 +64,7 @@ Incremental search backward (@code{isearch-backward}). @node Basic Isearch @subsection Basics of Incremental Search @cindex incremental search +@cindex isearch @kindex C-s @findex isearch-forward From 0d92660c530d143a89f2f49a0b399f40949a3cd0 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 21 Aug 2006 10:55:53 +0000 Subject: [PATCH 286/361] (whitespace-cleanup): Doc fix. --- lisp/whitespace.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 1d162e515e4..bb829278ef3 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -518,6 +518,8 @@ and: ;;;###autoload (defun whitespace-cleanup () "Cleanup the five different kinds of whitespace problems. +It normally applies to the whole buffer, but in Transient Mark mode +when the mark is active it applies to the region. See `whitespace-buffer' docstring for a summary of the problems." (interactive) (if (and transient-mark-mode mark-active) From 28cb9364d7ae3bc2839a502f1c85ffb2e5ae2dcf Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 21 Aug 2006 10:57:46 +0000 Subject: [PATCH 287/361] *** empty log message *** --- etc/TODO | 2 +- lisp/ChangeLog | 4 ++++ man/ChangeLog | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/etc/TODO b/etc/TODO index de0097cde87..9256175c01e 100644 --- a/etc/TODO +++ b/etc/TODO @@ -21,7 +21,7 @@ a window doesn't select it. but if you type M-n you should get the visited file name of the current buffer. -** whitespace-cleanup should work only on the region if the region is active. +** describe-face should show an example of text in the face. ** Distribute a bar cursor of width > 1 evenly between the two glyphs on each side of the bar (what to do at the edges?). diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f39afc16d73..cbde1434030 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-21 Richard Stallman + + * whitespace.el (whitespace-cleanup): Doc fix. + 2006-08-20 Ryan Yeske * net/rcirc.el (rcirc-show-maximum-output): New var. diff --git a/man/ChangeLog b/man/ChangeLog index 4063ca3e2b0..fd07fa7f05f 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-08-21 Richard Stallman + + * search.texi (Basic Isearch): Add `isearch' index entry. + 2006-08-16 Richard Stallman * misc.texi (Saving Emacs Sessions): Clean up wording. From 922fd3cb7b382fe0cd5cf48edc2f10f6a31bb0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Mon, 21 Aug 2006 12:54:47 +0000 Subject: [PATCH 288/361] Clarify difference between in_sighandler and handling_signal. --- src/keyboard.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/keyboard.c b/src/keyboard.c index 72e6844d841..0d13743f8b5 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -100,7 +100,12 @@ int interrupt_input_pending; /* File descriptor to use for input. */ extern int input_fd; -/* Nonzero if we are executing from the SIGIO signal handler. */ +/* Nonzero if we are executing from the SIGIO signal handler. + The difference between in_sighandler and handling_signal is that + in_sighandler is only set when executing in a signal handler. + handling_signal may be set even if not executing in a signal handler, for + example when reinvoke_input_signal is called from UNBLOCK_INPUT, or + when Emacs is compiled with SYNC_INPUT defined. */ int in_sighandler; #ifdef HAVE_WINDOW_SYSTEM From f73858ce4d4658fed5130a9d748f695e1b25c727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Mon, 21 Aug 2006 12:55:20 +0000 Subject: [PATCH 289/361] * keyboard.c: Clarify difference between in_sighandler and handling_signal. --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index fe4a59cf808..a299d7c603f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-21 Jan Dj,Ad(Brv + + * keyboard.c: Clarify difference between in_sighandler and + handling_signal. + 2006-08-21 Kim F. Storm * macterm.c (x_draw_stretch_glyph_string): From b22e5ea8ef609577dd48502897aa5d4fb49655fe Mon Sep 17 00:00:00 2001 From: "Robert J. Chassell" Date: Mon, 21 Aug 2006 14:22:22 +0000 Subject: [PATCH 290/361] * lispintro/texinfo.tex: changed to version 2006-02-13.16 to enable a DVI build using the more recent versions of TeX. --- lispintro/texinfo.tex | 6249 ++++++++++++++++++++++------------------- 1 file changed, 3349 insertions(+), 2900 deletions(-) diff --git a/lispintro/texinfo.tex b/lispintro/texinfo.tex index e960fb32992..dddd0140ff0 100644 --- a/lispintro/texinfo.tex +++ b/lispintro/texinfo.tex @@ -3,10 +3,11 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2003-12-30.09} +\def\texinfoversion{2006-02-13.16} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, -% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free +% Software Foundation, Inc. % % This texinfo.tex file is free software; you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -23,21 +24,16 @@ % to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. % -% In other words, you are welcome to use, share and improve this program. -% You are forbidden to forbid anyone else to use, share and improve -% what you give them. Help stamp out software-hoarding! +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex -% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or % ftp://tug.org/tex/texinfo.tex -% (and all CTAN mirrors, see http://www.ctan.org), -% and /home/gd/gnu/doc/texinfo.tex on the GNU machines. -% -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. -% -% The texinfo.tex in any given Texinfo distribution could well be out +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % % Send bug reports to bug-texinfo@gnu.org. Please include including a @@ -59,6 +55,9 @@ % It is possible to adapt texinfo.tex for other languages, to some % extent. You can get the existing language-specific files from the % full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + \message{Loading texinfo [version \texinfoversion]:} @@ -85,12 +84,16 @@ \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! +\let\ptexfootnote=\footnote \let\ptexgtr=> \let\ptexhat=^ \let\ptexi=\i \let\ptexindent=\indent +\let\ptexinsert=\insert \let\ptexlbrace=\{ \let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent \let\ptexplus=+ \let\ptexrbrace=\} \let\ptexslash=\/ @@ -101,6 +104,15 @@ % starts a new line in the output. \newlinechar = `^^J +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi @@ -139,43 +151,71 @@ \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi -\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi -% In some macros, we cannot use the `\? notation---the left quote is -% in some cases the escape char. -\chardef\colonChar = `\: -\chardef\commaChar = `\, -\chardef\dotChar = `\. -\chardef\equalChar = `\= -\chardef\exclamChar= `\! -\chardef\questChar = `\? -\chardef\semiChar = `\; -\chardef\spaceChar = `\ % -\chardef\underChar = `\_ +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} % Ignore a token. % \def\gobble#1{} -% True if #1 is the empty string, i.e., called like `\ifempty{}'. -% -\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}% -\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}% +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} % Hyphenation fixes. -\hyphenation{ap-pen-dix} -\hyphenation{eshell} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{time-stamp} -\hyphenation{white-space} +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} % Margin to add to right of even pages, to left of odd pages. \newdimen\bindingoffset \newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, % since that produces some useless output on the terminal. We also make @@ -200,7 +240,7 @@ \tracingassigns1 \fi \tracingcommands3 % 3 gives us more in etex - \errorcontextlines\maxdimen + \errorcontextlines16 }% % add check for \lastpenalty to plain's definitions. If the last thing @@ -252,13 +292,17 @@ % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. % - \escapechar = `\\ % use backslash in output files. \indexdummies % don't expand commands in the output. \normalturnoffactive % \ in index entries must not stay \, e.g., if - % the page break happens to be in the middle of an example. + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. - \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize @@ -306,7 +350,7 @@ \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox - }% end of group with \normalturnoffactive + }% end of group with \indexdummies \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } @@ -339,132 +383,162 @@ % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % -\def\parsearg#1{% - \let\next = #1% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\next{#2}% \begingroup \obeylines - \futurelet\temp\parseargx + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. } -% If the next token is an obeyed space (from an @example environment or -% the like), remove it and recurse. Otherwise, we're done. -\def\parseargx{% - % \obeyedspace is defined far below, after the definition of \sepspaces. - \ifx\obeyedspace\temp - \expandafter\parseargdiscardspace - \else - \expandafter\parseargline - \fi -} - -% Remove a single space (as the delimiter token to the macro call). -{\obeyspaces % - \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} - {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. - % - % First remove any @c comment, then any @comment. - % Result of each macro is put in \toks0. - \argremovec #1\c\relax % - \expandafter\argremovecomment \the\toks0 \comment\relax % - % - % Call the caller's macro, saved as \next in \parsearg. - \expandafter\next\expandafter{\the\toks0}% + \argremovecomment #1\comment\ArgTerm% }% } -% Since all \c{,omment} does is throw away the argument, we can let TeX -% do that for us. The \relax here is matched by the \relax in the call -% in \parseargline; it could be more or less anything, its purpose is -% just to delimit the argument to the \c. -\def\argremovec#1\c#2\relax{\toks0 = {#1}} -\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} -% \argremovec{,omment} might leave us with trailing spaces, though; e.g., +% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., % @end itemize @c foo -% will have two active spaces as part of the argument with the -% `itemize'. Here we remove all active spaces from #1, and assign the -% result to \toks0. +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. % -% This loses if there are any *other* active characters besides spaces -% in the argument -- _ ^ +, for example -- since they get expanded. -% Fortunately, Texinfo does not define any such commands. (If it ever -% does, the catcode of the characters in questionwill have to be changed -% here.) But this means we cannot call \removeactivespaces as part of -% \argremovec{,omment}, since @c uses \parsearg, and thus the argument -% that \parsearg gets might well have any character at all in it. -% -\def\removeactivespaces#1{% - \begingroup - \ignoreactivespaces - \edef\temp{#1}% - \global\toks0 = \expandafter{\temp}% - \endgroup +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % We cannot use \next here, as it holds the macro to run; + % thus we reuse \temp. + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm } -% Change the active space to expand to nothing. +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \next. +% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. % -\begingroup +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ \obeyspaces - \gdef\ignoreactivespaces{\obeyspaces\let =\empty} -\endgroup + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} -%% These are used to keep @begin/@end levels from running away -%% Call \inENV within environments (after a \begingroup) -\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} -\def\ENVcheck{% -\ifENV\errmessage{Still within an environment; press RETURN to continue} -\endgroup\fi} % This is not perfect, but it should reduce lossage - -% @begin foo is the same as @foo, for now. -\newhelp\EMsimple{Press RETURN to continue.} - -\outer\def\begin{\parsearg\beginxxx} - -\def\beginxxx #1{% -\expandafter\ifx\csname #1\endcsname\relax -{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else -\csname #1\endcsname\fi} - -% @end foo executes the definition of \Efoo. +% Define the framework for environments in texinfo.tex. It's used like this: % -\def\end{\parsearg\endxxx} -\def\endxxx #1{% - \removeactivespaces{#1}% - \edef\endthing{\the\toks0}% - % - \expandafter\ifx\csname E\endthing\endcsname\relax - \expandafter\ifx\csname \endthing\endcsname\relax - % There's no \foo, i.e., no ``environment'' foo. - \errhelp = \EMsimple - \errmessage{Undefined command `@end \endthing'}% - \else - \unmatchedenderror\endthing - \fi +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as enviroments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp \else - % Everything's ok; the right environment has been started. - \csname E\endthing\endcsname + \badenverr \fi } -% There is an environment #1, but it hasn't been started. Give an error. -% -\def\unmatchedenderror#1{% +% Evironment mismatch, #1 expected: +\def\badenverr{% \errhelp = \EMsimple - \errmessage{This `@end #1' doesn't have a matching `@#1'}% + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi } -% Define the control sequence \E#1 to give an unmatched @end error. +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv % -\def\defineunmatchedend#1{% - \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi } +\newhelp\EMsimple{Press RETURN to continue.} + %% Simple single-character @ commands @@ -486,7 +560,7 @@ \let\}=\myrbrace \begingroup % Definitions to produce \{ and \} commands for indices, - % and @{ and @} for the aux file. + % and @{ and @} for the aux/toc files. \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 \catcode`\! = 0 \catcode`\\ = \other @@ -496,6 +570,9 @@ !gdef!rbraceatcmd[@}]% !endgroup +% @comma{} to avoid , parsing problems. +\let\comma = , + % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \c @@ -505,10 +582,12 @@ \let\ubaraccent = \b \let\udotaccent = \d -% Other special characters: @questiondown @exclamdown +% Other special characters: @questiondown @exclamdown @ordf @ordm % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} @@ -521,6 +600,25 @@ \fi\fi } +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and @@ -543,13 +641,28 @@ \let\/=\allowbreak % @. is an end-of-sentence period. -\def\.{.\spacefactor=3000 } +\def\.{.\spacefactor=\endofsentencespacefactor\space} % @! is an end-of-sentence bang. -\def\!{!\spacefactor=3000 } +\def\!{!\spacefactor=\endofsentencespacefactor\space} % @? is an end-of-sentence query. -\def\?{?\spacefactor=3000 } +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \fi\fi +} % @w prevents a word break. Without the \leavevmode, @w at the % beginning of a paragraph, when TeX is still in vertical mode, would @@ -574,59 +687,14 @@ \newbox\groupbox \def\vfilllimit{0.7} % -\def\group{\begingroup - \ifnum\catcode13=\active \else +\envdef\group{% + \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi - % - % The \vtop we start below produces a box with normal height and large - % depth; thus, TeX puts \baselineskip glue before it, and (when the - % next line of text is done) \lineskip glue after it. (See p.82 of - % the TeXbook.) Thus, space below is not quite equal to space - % above. But it's pretty close. - \def\Egroup{% - \egroup % End the \vtop. - % \dimen0 is the vertical size of the group's box. - \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox - % \dimen2 is how much space is left on the page (more or less). - \dimen2 = \pageheight \advance\dimen2 by -\pagetotal - % if the group doesn't fit on the current page, and it's a big big - % group, force a page break. - \ifdim \dimen0 > \dimen2 - \ifdim \pagetotal < \vfilllimit\pageheight - \page - \fi - \fi - \copy\groupbox - \endgroup % End the \group. - }% + \startsavinginserts % \setbox\groupbox = \vtop\bgroup - % We have to put a strut on the last line in case the @group is in - % the midst of an example, rather than completely enclosing it. - % Otherwise, the interline space between the last line of the group - % and the first line afterwards is too small. But we can't put the - % strut in \Egroup, since there it would be on a line by itself. - % Hence this just inserts a strut at the beginning of each line. - \everypar = {\strut}% - % - % Since we have a strut on every line, we don't need any of TeX's - % normal interline spacing. - \offinterlineskip - % - % OK, but now we have to do something about blank - % lines in the input in @example-like environments, which normally - % just turn into \lisppar, which will insert no space now that we've - % turned off the interline space. Simplest is to make them be an - % empty paragraph. - \ifx\par\lisppar - \edef\par{\leavevmode \par}% - % - % Reset ^^M's definition to new definition of \par. - \obeylines - \fi - % % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after @@ -636,6 +704,32 @@ \comment } % +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. % @@ -648,10 +742,8 @@ \newdimen\mil \mil=0.001in -\def\need{\parsearg\needx} - % Old definition--didn't work. -%\def\needx #1{\par % +%\parseargdef\need{\par % %% This method tries to make TeX break the page naturally %% if the depth of the box does not fit. %{\baselineskip=0pt% @@ -659,7 +751,7 @@ %\prevdepth=-1000pt %}} -\def\needx#1{% +\parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par @@ -698,35 +790,10 @@ \fi } -% @br forces paragraph break +% @br forces paragraph break (and is undocumented). \let\br = \par -% @dots{} output an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \leavevmode - \hbox to 2em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% - \spacefactor=3000 -} - % @page forces the start of a new page. % \def\page{\par\vfill\supereject} @@ -739,13 +806,11 @@ \newskip\exdentamount % This defn is used inside fill environments such as @defun. -\def\exdent{\parsearg\exdentyyy} -\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. -\def\nofillexdent{\parsearg\nofillexdentyyy} -\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount -\leftline{\hskip\leftskip{\rm#1}}}} +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion @@ -797,8 +862,19 @@ } % @include file insert text of that file as input. -% Allow normal characters that we make active in the argument (a file name). -\def\include{\begingroup +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable + \def\temp{\input #1 }% + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% \catcode`\\=\other \catcode`~=\other \catcode`^=\other @@ -807,33 +883,50 @@ \catcode`<=\other \catcode`>=\other \catcode`+=\other - \parsearg\includezzz} -% Restore active chars for included file. -\def\includezzz#1{\endgroup\begingroup - % Read the included file in a group so nested @include's work. - \def\thisfile{#1}% - \let\value=\expandablevalue - \input\thisfile -\endgroup} + \catcode`-=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} \def\thisfile{} % @center line % outputs that line, centered. % -\def\center{\parsearg\docenter} -\def\docenter#1{{% - \ifhmode \hfil\break \fi - \advance\hsize by -\leftskip - \advance\hsize by -\rightskip - \line{\hfil \ignorespaces#1\unskip \hfil}% - \ifhmode \break \fi -}} +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} % @sp n outputs n lines of vertical space -\def\sp{\parsearg\spxxx} -\def\spxxx #1{\vskip #1\baselineskip} +\parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment @@ -854,8 +947,7 @@ \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % -\def\paragraphindent{\parsearg\doparagraphindent} -\def\doparagraphindent#1{% +\parseargdef\paragraphindent{% \def\temp{#1}% \ifx\temp\asisword \else @@ -872,8 +964,7 @@ % We'll use ems for NCHARS like @paragraphindent. % It seems @exampleindent asis isn't necessary, but % I preserve it to make it similar to @paragraphindent. -\def\exampleindent{\parsearg\doexampleindent} -\def\doexampleindent#1{% +\parseargdef\exampleindent{% \def\temp{#1}% \ifx\temp\asisword \else @@ -887,21 +978,18 @@ % @firstparagraphindent WORD % If WORD is `none', then suppress indentation of the first paragraph -% after a section heading. If WORD is `insert', then do indentat such +% after a section heading. If WORD is `insert', then do indent at such % paragraphs. % % The paragraph indentation is suppressed or not by calling -% \suppressfirstparagraphindent, which the sectioning commands do. We -% switch the definition of this back and forth according to WORD. By -% default, we suppress indentation. +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. % \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} -\newdimen\currentparindent -% \def\insertword{insert} % -\def\firstparagraphindent{\parsearg\dofirstparagraphindent} -\def\dofirstparagraphindent#1{% +\parseargdef\firstparagraphindent{% \def\temp{#1}% \ifx\temp\noneword \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent @@ -921,15 +1009,24 @@ % \gdef\dosuppressfirstparagraphindent{% \gdef\indent{% - \global\let\indent=\ptexindent - \global\everypar = {}% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent }% \global\everypar = {% - \kern-\parindent - \global\let\indent=\ptexindent - \global\everypar = {}% + \kern -\parindent + \restorefirstparagraphindent }% -}% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} % @asis just yields its argument. Used with @table, for example. @@ -937,23 +1034,18 @@ \def\asis#1{#1} % @math outputs its argument in math mode. -% We don't use $'s directly in the definition of \math because we need -% to set catcodes according to plain TeX first, to allow for subscripts, -% superscripts, special math chars, etc. -% -\let\implicitmath = $%$ font-lock fix % % One complication: _ usually means subscripts, but it could also mean % an actual _ character, as in @math{@var{some_variable} + 1}. So make -% _ within @math be active (mathcode "8000), and distinguish by seeing -% if the current family is \slfam, which is what @var uses. -% -{\catcode\underChar = \active -\gdef\mathunderscore{% - \catcode\underChar=\active - \def_{\ifnum\fam=\slfam \_\else\sb\fi}% -}} -% +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} % Another complication: we want \\ (and @\) to output a \ character. % FYI, plain.tex uses \\ as a temporary control sequence (why?), but % this is not advertised and we don't care. Texinfo does not @@ -964,15 +1056,16 @@ % \def\math{% \tex - \mathcode`\_="8000 \mathunderscore + \mathunderscore \let\\ = \mathbackslash \mathactive - \implicitmath\finishmath} -\def\finishmath#1{#1\implicitmath\Etex} + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. % Some active characters (such as <) are spaced differently in math. -% We have to reset their definitions in case the @math was an -% argument to a command which set the catcodes (such as @item or @section). +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). % { \catcode`^ = \active @@ -988,8 +1081,33 @@ } % @bullet and @minus need the same treatment as @math, just above. -\def\bullet{\implicitmath\ptexbullet\implicitmath} -\def\minus{\implicitmath-\implicitmath} +\def\bullet{$\ptexbullet$} +\def\minus{$-$} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in a typewriter +% font as three actual period characters. +% +\def\dots{% + \leavevmode + \hbox to 1.5em{% + \hskip 0pt plus 0.25fil + .\hfil.\hfil.% + \hskip 0pt plus 0.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , % @refill is a no-op. \let\refill=\relax @@ -1005,20 +1123,20 @@ % So open here the files we need to have open while reading the input. % This makes it possible to make a .fmt file for texinfo. \def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. \iflinks - \readauxfile + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux \fi % \openindices needs to do some work in any case. \openindices - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \global\let\setfilename=\comment % Ignore extra @setfilename cmds. + \let\setfilename=\comment % Ignore extra @setfilename cmds. % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. - % Just to be on the safe side, close the input stream before the \input. \openin 1 texinfo.cnf - \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi - \closein1 - \temp + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 % \comment % Ignore the actual filename. } @@ -1054,17 +1172,72 @@ \newif\ifpdf \newif\ifpdfmakepagedest +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. \ifx\pdfoutput\undefined - \pdffalse - \let\pdfmkdest = \gobble - \let\pdfurl = \gobble - \let\endlink = \relax - \let\linkcolor = \relax - \let\pdfmakeoutlines = \relax \else - \pdftrue - \pdfoutput = 1 + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% PDF uses PostScript string constants for the names of xref targets, +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% (and related messages, the final outcome is that it is up to the TeX +% user to double the backslashes and otherwise make the string valid, so +% that's what we do). + +% double active backslashes. +% +{\catcode`\@=0 \catcode`\\=\active + @gdef@activebackslashdouble{% + @catcode`@\=@active + @let\=@doublebackslash} +} + +% To handle parens, we must adopt a different approach, since parens are +% not active characters. hyperref.dtx (which has the same problem as +% us) handles it with this amazing macro to replace tokens. I've +% tinkered with it a little for texinfo, but it's definitely from there. +% +% #1 is the tokens to replace. +% #2 is the replacement. +% #3 is the control sequence with the string. +% +\def\HyPsdSubst#1#2#3{% + \def\HyPsdReplace##1#1##2\END{% + ##1% + \ifx\\##2\\% + \else + #2% + \HyReturnAfterFi{% + \HyPsdReplace##2\END + }% + \fi + }% + \xdef#3{\expandafter\HyPsdReplace#3#1\END}% +} +\long\def\HyReturnAfterFi#1\fi{\fi#1} + +% #1 is a control sequence in which to do the replacements. +\def\backslashparens#1{% + \xdef#1{#1}% redefine it as its expansion; the definition is simply + % \lastnode when called from \setref -> \pdfmkdest. + \HyPsdSubst{(}{\realbackslash(}{#1}% + \HyPsdSubst{)}{\realbackslash)}{#1}% +} + +\ifpdf \input pdfcolor + \pdfcatalog{/PageMode /UseOutlines}% \def\dopdfimage#1#2#3{% \def\imagewidth{#2}% \def\imageheight{#3}% @@ -1085,8 +1258,19 @@ \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} - \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}} - \def\pdfmkpgn#1{#1} + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \atdummies + \activebackslashdouble + \def\pdfdestname{#1}% + \backslashparens\pdfdestname + \pdfdest name{\pdfdestname} xyz% + }}% + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1}% + % \let\linkcolor = \Blue % was Cyan, but that seems light? \def\endlink{\Black\pdfendlink} % Adding outlines to PDF; macros for calculating structure of outlines @@ -1094,79 +1278,106 @@ \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} \def\advancenumber#1{\tempnum=\expnumber{#1}\relax - \advance\tempnum by1 + \advance\tempnum by 1 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} - \def\pdfmakeoutlines{{% - \openin 1 \jobname.toc - \ifeof 1\else\begingroup - \closein 1 + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + % Doubled backslashes in the name. + {\activebackslashdouble \xdef\pdfoutlinedest{#3}% + \backslashparens\pdfoutlinedest}% + \fi + % + % Also double the backslashes in the display string. + {\activebackslashdouble \xdef\pdfoutlinetext{#1}% + \backslashparens\pdfoutlinetext}% + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup % Thanh's hack / proper braces in bookmarks \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace % - \def\chapentry ##1##2##3{} - \def\secentry ##1##2##3##4{\advancenumber{chap##2}} - \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} - \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} - \let\appendixentry = \chapentry - \let\unnumbchapentry = \chapentry - \let\unnumbsecentry = \secentry - \let\unnumbsubsecentry = \subsecentry - \let\unnumbsubsubsecentry = \subsubsecentry - \input \jobname.toc - \def\chapentry ##1##2##3{% - \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} - \def\secentry ##1##2##3##4{% - \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} - \def\subsecentry ##1##2##3##4##5{% - \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} - \def\subsubsecentry ##1##2##3##4##5##6{% - \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} - \let\appendixentry = \chapentry - \let\unnumbchapentry = \chapentry - \let\unnumbsecentry = \secentry - \let\unnumbsubsecentry = \subsecentry - \let\unnumbsubsubsecentry = \subsubsecentry + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% % - % Make special characters normal for writing to the pdf file. + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. \indexnofonts - \let\tt=\relax - \turnoffactive + \setupdatafile + \catcode`\\=\active \otherbackslash \input \jobname.toc - \endgroup\fi - }} - \def\makelinks #1,{% - \def\params{#1}\def\E{END}% - \ifx\params\E - \let\nextmakelinks=\relax - \else - \let\nextmakelinks=\makelinks - \ifnum\lnkcount>0,\fi - \picknum{#1}% - \startlink attr{/Border [0 0 0]} - goto name{\pdfmkpgn{\the\pgn}}% - \linkcolor #1% - \advance\lnkcount by 1% - \endlink - \fi - \nextmakelinks + \endgroup } - \def\picknum#1{\expandafter\pn#1} - \def\pn#1{% - \def\p{#1}% - \ifx\p\lbrace - \let\nextpn=\ppn - \else - \let\nextpn=\ppnn - \def\first{#1} - \fi - \nextpn - } - \def\ppn#1{\pgn=#1\gobble} - \def\ppnn{\pgn=\first} - \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces @@ -1181,21 +1392,28 @@ \else \let \startlink \pdfstartlink \fi + % make a live url in pdf output. \def\pdfurl#1{% \begingroup - \normalturnoffactive\def\@{@}% - \let\value=\expandablevalue + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable \leavevmode\Red \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - % #1 \endgroup} \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} \def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS| + \expandafter\poptoks\the\toksA|ENDTOKS|\relax \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 @@ -1215,20 +1433,44 @@ \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \linkcolor #1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % \ifx\pdfoutput +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput \message{fonts,} -% Font-change commands. + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} % Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf analogous to plain's \rm, etc. +% So we set up a \sf. \newfam\sffam -\def\sf{\fam=\sffam \tensf} +\def\sf{\fam=\sffam \setfontstyle{sf}} \let\li = \sf % Sometimes we call it \li, not \sf. -% We don't need math for this one. -\def\ttsl{\tenttsl} +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} % Default leading. \newdimen\textleading \textleading = 13.2pt @@ -1279,21 +1521,11 @@ \def\scshape{csc} \def\scbshape{csc} -\newcount\mainmagstep -\ifx\bigger\relax - % not really supported. - \mainmagstep=\magstep1 - \setfont\textrm\rmshape{12}{1000} - \setfont\texttt\ttshape{12}{1000} -\else - \mainmagstep=\magstephalf - \setfont\textrm\rmshape{10}{\mainmagstep} - \setfont\texttt\ttshape{10}{\mainmagstep} -\fi -% Instead of cmb10, you may want to use cmbx10. -% cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10 -% (in Bob's opinion). +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep} +\setfont\texttt\ttshape{10}{\mainmagstep} \setfont\textbf\bfshape{10}{\mainmagstep} \setfont\textit\itshape{10}{\mainmagstep} \setfont\textsl\slshape{10}{\mainmagstep} @@ -1303,12 +1535,14 @@ \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep -% A few fonts for @defun, etc. -\setfont\defbf\bxshape{10}{\magstep1} %was 1314 +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1} \setfont\deftt\ttshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} +\setfont\defttsl\ttslshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000} \setfont\smalltt\ttshape{9}{1000} \setfont\smallbf\bfshape{10}{900} @@ -1321,6 +1555,7 @@ \font\smallsy=cmsy9 % Fonts for small examples (8pt). +\def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000} \setfont\smallertt\ttshape{8}{1000} \setfont\smallerbf\bfshape{10}{800} @@ -1332,7 +1567,8 @@ \font\smalleri=cmmi8 \font\smallersy=cmsy8 -% Fonts for title page: +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3} \setfont\titleit\itbshape{10}{\magstep4} \setfont\titlesl\slbshape{10}{\magstep4} @@ -1347,6 +1583,7 @@ \def\authortt{\sectt} % Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} \setfont\chaprm\rmbshape{12}{\magstep2} \setfont\chapit\itbshape{10}{\magstep3} \setfont\chapsl\slbshape{10}{\magstep3} @@ -1359,6 +1596,7 @@ \font\chapsy=cmsy10 scaled \magstep3 % Section fonts (14.4pt). +\def\secnominalsize{14pt} \setfont\secrm\rmbshape{12}{\magstep1} \setfont\secit\itbshape{10}{\magstep2} \setfont\secsl\slbshape{10}{\magstep2} @@ -1371,6 +1609,7 @@ \font\secsy=cmsy10 scaled \magstep2 % Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} \setfont\ssecrm\rmbshape{12}{\magstephalf} \setfont\ssecit\itbshape{10}{1315} \setfont\ssecsl\slbshape{10}{1315} @@ -1378,11 +1617,22 @@ \setfont\ssecttsl\ttslshape{10}{1315} \setfont\ssecsf\sfbshape{12}{\magstephalf} \let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{\magstep1} +\setfont\ssecsc\scbshape{10}{1315} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 -% The smallcaps and symbol fonts should actually be scaled \magstep1.5, -% but that is not a standard magnification. + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000} +\setfont\reducedtt\ttshape{10}{1000} +\setfont\reducedbf\bfshape{10}{1000} +\setfont\reducedit\itshape{10}{1000} +\setfont\reducedsl\slshape{10}{1000} +\setfont\reducedsf\sfshape{10}{1000} +\setfont\reducedsc\scshape{10}{1000} +\setfont\reducedttsl\ttslshape{10}{1000} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since @@ -1397,50 +1647,81 @@ } % The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this so that font changes will continue to work -% in math mode, where it is the current \fam that is relevant in most -% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam -% \tenbf}, for example. By redefining \tenbf, we obviate the need to -% redefine \bf itself. +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% \def\textfonts{% \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% \resetmathfonts \setleading{\textleading}} \def\titlefonts{% \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% \resetmathfonts \setleading{25pt}} \def\titlefont#1{{\titlefonts\rm #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% \resetmathfonts \setleading{19pt}} \def\secfonts{% \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% \resetmathfonts \setleading{16pt}} \def\subsecfonts{% \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} \def\smallfonts{% \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallerfonts{% \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} % Set the fonts to use with the @small... environments. @@ -1449,7 +1730,7 @@ % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample % can fit this many characters: % 8.5x11=86 smallbook=72 a4=90 a5=69 -% If we use \smallerfonts (8pt), then we can fit this many characters: +% If we use \scriptfonts (8pt), then we can fit this many characters: % 8.5x11=90+ smallbook=80 a4=90+ a5=77 % For me, subjectively, the few extra characters that fit aren't worth % the additional smallness of 8pt. So I'm making the default 9pt. @@ -1457,14 +1738,13 @@ % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 % -% I wish we used A4 paper on this side of the Atlantic. -% +% I wish the USA used A4 paper. % --karl, 24jan03. % Set up the default fonts, so we can use them for creating boxes. % -\textfonts +\textfonts \rm % Define these so they can be easily changed for other fonts. \def\angleleft{$\langle$} @@ -1475,7 +1755,7 @@ % Fonts for short table of contents. \setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bxshape{12}{1000} +\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 \setfont\shortcontsl\slshape{12}{1000} \setfont\shortconttt\ttshape{12}{1000} @@ -1489,15 +1769,27 @@ \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} + \let\i=\smartitalic +\let\slanted=\smartslanted \let\var=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic -\let\cite=\smartslanted +% @b, explicit bold. \def\b#1{{\bf #1}} \let\strong=\b +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + % We can't just use \exhyphenpenalty, because that only has effect at % the end of a paragraph. Restore normal hyphenation at the end of the % group within which \nohyphenation is presumably called. @@ -1509,18 +1801,31 @@ % Can't use plain's \frenchspacing because it uses the `\x notation, and % sometimes \x has an active definition that messes things up. % +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\questChar = `\? +\chardef\semiChar = `\; +% \catcode`@=11 - \def\frenchspacing{% + \def\plainfrenchspacing{% \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends } \catcode`@=\other +\def\endofsentencespacefactor{3000}% default \def\t#1{% - {\tt \rawbackslash \frenchspacing #1}% + {\tt \rawbackslash \plainfrenchspacing #1}% \null } -\let\ttfont=\t \def\samp#1{`\tclose{#1}'\null} \setfont\keyrm\rmshape{8}{1000} \font\keysy=cmsy9 @@ -1555,13 +1860,13 @@ \nohyphenation % \rawbackslash - \frenchspacing + \plainfrenchspacing #1% }% \null } -% We *must* turn on hyphenation at `-' and `_' in \code. +% We *must* turn on hyphenation at `-' and `_' in @code. % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. @@ -1575,14 +1880,16 @@ \catcode`\_=\active % \global\def\code{\begingroup - \catcode`\-=\active \let-\codedash - \catcode`\_=\active \let_\codeunder + \catcode`\-=\active \catcode`\_=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\realdash + \let_\realunder + \fi \codex } - % - % If we end up with any active - characters when handling the index, - % just treat them as a normal -. - \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} } \def\realdash{-} @@ -1600,24 +1907,45 @@ } \def\codex #1{\tclose{#1}\endgroup} +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is undesirable in +% some manuals, especially if they don't have long identifiers in +% general. @allowcodebreaks provides a way to control this. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \fi\fi +} + % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), % `example' (@kbd uses ttsl only inside of @example and friends), % or `code' (@kbd uses normal tty font always). -\def\kbdinputstyle{\parsearg\kbdinputstylexxx} -\def\kbdinputstylexxx#1{% - \def\arg{#1}% - \ifx\arg\worddistinct +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\arg\wordexample + \else\ifx\txiarg\wordexample \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\arg\wordcode + \else\ifx\txiarg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% \else \errhelp = \EMsimple - \errmessage{Unknown @kbdinputstyle option `\arg'}% + \errmessage{Unknown @kbdinputstyle option `\txiarg'}% \fi\fi\fi } \def\worddistinct{distinct} @@ -1633,8 +1961,8 @@ \else{\tclose{\kbdfont\look}}\fi \else{\tclose{\kbdfont\look}}\fi} -% For @url, @env, @command quotes seem unnecessary, so use \code. -\let\url=\code +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code \let\env=\code \let\command=\code @@ -1666,6 +1994,10 @@ \endlink \endgroup} +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + % rms does not like angle brackets --karl, 17may97. % So now @email is just like @uref, unless we are pdf. % @@ -1707,22 +2039,101 @@ \def\sc#1{{\smallcaps#1}} % smallcaps font \def\ii#1{{\it #1}} % italic font -% @acronym downcases the argument and prints in smallcaps. -\def\acronym#1{{\smallcaps \lowercase{#1}}} +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} -% @pounds{} is a sterling sign. +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% \def\pounds{{\it\$}} -% @registeredsymbol - R in a circle. For now, only works in text size; -% we'd have to redo the font mechanism to change the \scriptstyle and -% \scriptscriptstyle font sizes to make it look right in headings. +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. % \def\registeredsymbol{% - $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% }$% } +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + \message{page headings,} @@ -1741,87 +2152,103 @@ \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue -\def\shorttitlepage{\parsearg\shorttitlepagezzz} -\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% \endgroup\page\hbox{}\page} -\def\titlepage{\begingroup \parindent=0pt \textfonts - \let\subtitlerm=\tenrm - \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% - % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines - \let\tt=\authortt}% - % - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % - % Now you can print the title using @title. - \def\title{\parsearg\titlezzz}% - \def\titlezzz##1{\leftline{\titlefonts\rm ##1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Now you can put text using @subtitle. - \def\subtitle{\parsearg\subtitlezzz}% - \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% - % - % @author should come last, but may come many times. - \def\author{\parsearg\authorzzz}% - \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi - {\authorfont \leftline{##1}}}% - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% \iffinishedtitlepage\else - \finishtitlepage + \finishtitlepage \fi - \oldpage \let\page = \oldpage - \hbox{}}% -% \def\page{\oldpage \hbox{}} + \page + \null + }% } \def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - % - % Need this before the \...aftertitlepage checks so that if they are - % in effect the toc pages will come out with page numbers. - \HEADINGSon - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi } \def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue } +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rm #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\authorfont \leftline{#1}}% + \fi +} + + %%% Set up page headings and footings. \let\thispage=\folio @@ -1831,7 +2258,7 @@ \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages -% Now make Tex use those variables +% Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline @@ -1845,32 +2272,27 @@ % @evenfooting @thisfile|| % @oddfooting ||@thisfile + \def\evenheading{\parsearg\evenheadingxxx} -\def\oddheading{\parsearg\oddheadingxxx} -\def\everyheading{\parsearg\everyheadingxxx} - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\oddfooting{\parsearg\oddfootingxxx} -\def\everyfooting{\parsearg\everyfootingxxx} - -{\catcode`\@=0 % - -\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} -\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} -\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% -\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} -\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} -\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% % % Leave some space for the footline. Hopefully ok to assume @@ -1879,9 +2301,8 @@ \global\advance\vsize by -\baselineskip } -\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} -% -}% unbind the catcode of @. +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. @@ -1895,7 +2316,7 @@ \def\headings #1 {\csname HEADINGS#1\endcsname} -\def\HEADINGSoff{ +\def\HEADINGSoff{% \global\evenheadline={\hfil} \global\evenfootline={\hfil} \global\oddheadline={\hfil} \global\oddfootline={\hfil}} \HEADINGSoff @@ -1904,7 +2325,7 @@ % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. -\def\HEADINGSdouble{ +\def\HEADINGSdouble{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} @@ -1916,7 +2337,7 @@ % For single-sided printing, chapter title goes across top left of page, % page number on top right. -\def\HEADINGSsingle{ +\def\HEADINGSsingle{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} @@ -1963,12 +2384,11 @@ % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. \def\thistitle{\putwordNoTitle} -\def\settitle{\parsearg\settitlezzz} -\def\settitlezzz #1{\gdef\thistitle{#1}} +\def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). +% Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in @@ -1980,7 +2400,7 @@ % used internally for \itemindent minus \itemmargin \newdimen\itemmax -% Note @table, @vtable, and @vtable define @item, @itemx, etc., with +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with % these defs. % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). @@ -1992,22 +2412,10 @@ \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} -\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} - -\def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} - -\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% - \itemzzz {#1}} - -\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% - \itemzzz {#1}} - \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent - \setbox0=\hbox{\itemfont{#1}}% + \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % @@ -2031,17 +2439,13 @@ % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % - % Stop a page break at the \parskip glue coming up. (Unfortunately - % we can't prevent a possible page break at the following - % \baselineskip glue.) However, if what follows is an environment - % such as @example, there will be no \parskip glue; then - % the negative vskip we just would cause the example and the item to - % crash together. So we use this bizarre value of 10001 as a signal - % to \aboveenvbreak to insert \parskip glue after all. - % (Possibly there are other commands that could be followed by - % @example which need the same treatment, but not section titles; or - % maybe section titles are the only special case and they should be - % penalty 10001...) + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse @@ -2061,81 +2465,72 @@ \fi } -\def\item{\errmessage{@item while not in a table}} -\def\itemx{\errmessage{@itemx while not in a table}} -\def\kitem{\errmessage{@kitem while not in a table}} -\def\kitemx{\errmessage{@kitemx while not in a table}} -\def\xitem{\errmessage{@xitem while not in a table}} -\def\xitemx{\errmessage{@xitemx while not in a table}} - -% Contains a kludge to get @end[description] to work. -\def\description{\tablez{\dontindex}{1}{}{}{}{}} +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. -\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} -{\obeylines\obeyspaces% -\gdef\tablex #1^^M{% -\tabley\dontindex#1 \endtabley}} - -\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} -{\obeylines\obeyspaces% -\gdef\ftablex #1^^M{% -\tabley\fnitemindex#1 \endtabley -\def\Eftable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} -{\obeylines\obeyspaces% -\gdef\vtablex #1^^M{% -\tabley\vritemindex#1 \endtabley -\def\Evtable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\dontindex #1{} -\def\fnitemindex #1{\doind {fn}{\code{#1}}}% -\def\vritemindex #1{\doind {vr}{\code{#1}}}% - -{\obeyspaces % -\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% -\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} - -\def\tablez #1#2#3#4#5#6{% -\aboveenvbreak % -\begingroup % -\def\Edescription{\Etable}% Necessary kludge. -\let\itemindex=#1% -\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % -\ifnum 0#4>0 \tableindent=#4\mil \fi % -\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % -\def\itemfont{#2}% -\itemmax=\tableindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \tableindent % -\exdentamount=\tableindent -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def\Etable{\endgraf\afterenvbreak\endgroup}% -\let\item = \internalBitem % -\let\itemx = \internalBitemx % -\let\kitem = \internalBkitem % -\let\kitemx = \internalBkitemx % -\let\xitem = \internalBxitem % -\let\xitemx = \internalBxitemx % +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% } +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable % This is the counter used by @enumerate, which is really @itemize \newcount \itemno -\def\itemize{\parsearg\itemizezzz} +\envdef\itemize{\parsearg\doitemize} -\def\itemizezzz #1{% - \begingroup % ended by the @end itemize - \itemizey {#1}{\Eitemize} -} - -\def\itemizey#1#2{% +\def\doitemize#1{% \aboveenvbreak \itemmax=\itemindent \advance\itemmax by -\itemmargin @@ -2144,13 +2539,33 @@ \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi - \def#2{\endgraf\afterenvbreak\endgroup}% \def\itemcontents{#1}% % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi \let\item=\itemizeitem } +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. % @@ -2160,11 +2575,8 @@ % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % -\def\enumerate{\parsearg\enumeratezzz} -\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% - \begingroup % ended by the @end enumerate - % % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi @@ -2235,13 +2647,13 @@ }% } -% Call itemizey, adding a period to the first argument and supplying the +% Call \doitemize, adding a period to the first argument and supplying the % common last two arguments. Also subtract one from the initial value in % \itemno, since @item increments \itemno. % \def\startenumeration#1{% \advance\itemno by -1 - \itemizey{#1.}\Eenumerate\flushcr + \doitemize{#1.}\flushcr } % @alphaenumerate and @capsenumerate are abbreviations for giving an arg @@ -2252,16 +2664,6 @@ \def\Ealphaenumerate{\Eenumerate} \def\Ecapsenumerate{\Eenumerate} -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{In hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 1200}}% -\flushcr} % @multitable macros % Amy Hendrickson, 8/18/94, 3/6/96 @@ -2288,24 +2690,14 @@ % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item ... % using the widest term desired in each column. -% -% For those who want to use more than one line's worth of words in -% the preamble, break the line within one argument and it -% will parse correctly, i.e., -% -% @multitable {Column 1 template} {Column 2 template} {Column 3 -% template} -% Not: -% @multitable {Column 1 template} {Column 2 template} -% {Column 3 template} % Each new table line starts with @item, each subsequent new column % starts with @tab. Empty columns may be produced by supplying @tab's % with nothing between them for as many times as empty columns are needed, % ie, @tab@tab@tab will produce two empty columns. -% @item, @tab, @multitable or @end multitable do not need to be on their -% own lines, but it will not hurt if they are. +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. % Sample multitable: @@ -2349,13 +2741,12 @@ \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent -% #1 is the part of the @columnfraction before the decimal point, which -% is presumably either 0 or the empty string (but we don't check, we -% just throw it away). #2 is the decimal part, which we use as the -% percent of \hsize for this column. -\def\pickupwholefraction#1.#2 {% +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% \global\advance\colcount by 1 - \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } @@ -2388,18 +2779,33 @@ \go } +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + % @multitable ... @end multitable definitions: % -\def\multitable{\parsearg\dotable} -\def\dotable#1{\bgroup +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% \vskip\parskip - \let\item=\crcrwithfootnotes - % A \tab used to include \hskip1sp. But then the space in a template - % line is not enough. That is bad. So let's go back to just & until - % we encounter the problem it was intended to solve again. --karl, - % nathan@acm.org, 20apr99. - \let\tab=&% - \let\startfootins=\startsavedfootnote + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % \tolerance=9500 \hbadness=9500 \setmultitablespacing @@ -2407,85 +2813,93 @@ \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 - \def\Emultitable{% - \global\setpercentfalse - \crcrwithfootnotes\crcr - \egroup\egroup + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% }% % + \parsearg\domultitable +} +\def\domultitable#1{% % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable % - % \everycr will reset column counter, \colcount, at the end of - % each line. Every column entry will cause \colcount to advance by one. - % The table preamble - % looks at the current \colcount to find the correct column width. - \everycr{\noalign{% - % - % \filbreak%% keeps underfull box messages off when table breaks over pages. - % Maybe so, but it also creates really weird page breaks when the table - % breaks over pages. Wouldn't \vfil be better? Wait until the problem - % manifests itself, so it can be fixed for real --karl. - \global\colcount=0\relax}}% - % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. - \halign\bgroup&\global\advance\colcount by 1\relax - \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname - % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. - \rightskip=0pt - \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip - \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace - \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively marking - % characters. - \noindent\ignorespaces##\unskip\multistrut}\cr + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse } -\def\setmultitablespacing{% test to see if user has set \multitablelinespace. -% If so, do nothing. If not, give it an appropriate dimension based on -% current baselineskip. +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. \ifdim\multitablelinespace=0pt \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 -%% strut to put in table in case some entry doesn't have descenders, -%% to keep lines equally spaced -\let\multistrut = \strut -\else -%% FIXME: what is \box0 supposed to be? -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi +\fi %% Test to see if parskip is larger than space between lines of %% table. If not, do nothing. %% If so, set to same dimension as multitablelinespace. @@ -2500,364 +2914,175 @@ %% than skip between lines in the table. \fi} -% In case a @footnote appears inside an alignment, save the footnote -% text to a box and make the \insert when a row of the table is -% finished. Otherwise, the insertion is lost, it never migrates to the -% main vertical list. --kasal, 22jan03. -% -\newbox\savedfootnotes -% -% \dotable \let's \startfootins to this, so that \dofootnote will call -% it instead of starting the insertion right away. -\def\startsavedfootnote{% - \global\setbox\savedfootnotes = \vbox\bgroup - \unvbox\savedfootnotes -} -\def\crcrwithfootnotes{% - \crcr - \ifvoid\savedfootnotes \else - \noalign{\insert\footins{\box\savedfootnotes}}% - \fi -} \message{conditionals,} -% Prevent errors for section commands. -% Used in @ignore and in failing conditionals. -\def\ignoresections{% - \let\chapter=\relax - \let\unnumbered=\relax - \let\top=\relax - \let\unnumberedsec=\relax - \let\unnumberedsection=\relax - \let\unnumberedsubsec=\relax - \let\unnumberedsubsection=\relax - \let\unnumberedsubsubsec=\relax - \let\unnumberedsubsubsection=\relax - \let\section=\relax - \let\subsec=\relax - \let\subsubsec=\relax - \let\subsection=\relax - \let\subsubsection=\relax - \let\appendix=\relax - \let\appendixsec=\relax - \let\appendixsection=\relax - \let\appendixsubsec=\relax - \let\appendixsubsection=\relax - \let\appendixsubsubsec=\relax - \let\appendixsubsubsection=\relax - \let\contents=\relax - \let\smallbook=\relax - \let\titlepage=\relax -} -% Used in nested conditionals, where we have to parse the Texinfo source -% and so want to turn off most commands, in case they are used -% incorrectly. +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. % -% We use \empty instead of \relax for the @def... commands, so that \end -% doesn't throw an error. For instance: -% @ignore -% @deffn ... -% @end deffn -% @end ignore -% -% The @end deffn is going to get expanded, because we're trying to allow -% nested conditionals. But we don't want to expand the actual @deffn, -% since it might be syntactically correct and intended to be ignored. -% Since \end checks for \relax, using \empty does not cause an error. -% -\def\ignoremorecommands{% - \let\defcodeindex = \relax - \let\defcv = \empty - \let\defcvx = \empty - \let\Edefcv = \empty - \let\deffn = \empty - \let\deffnx = \empty - \let\Edeffn = \empty - \let\defindex = \relax - \let\defivar = \empty - \let\defivarx = \empty - \let\Edefivar = \empty - \let\defmac = \empty - \let\defmacx = \empty - \let\Edefmac = \empty - \let\defmethod = \empty - \let\defmethodx = \empty - \let\Edefmethod = \empty - \let\defop = \empty - \let\defopx = \empty - \let\Edefop = \empty - \let\defopt = \empty - \let\defoptx = \empty - \let\Edefopt = \empty - \let\defspec = \empty - \let\defspecx = \empty - \let\Edefspec = \empty - \let\deftp = \empty - \let\deftpx = \empty - \let\Edeftp = \empty - \let\deftypefn = \empty - \let\deftypefnx = \empty - \let\Edeftypefn = \empty - \let\deftypefun = \empty - \let\deftypefunx = \empty - \let\Edeftypefun = \empty - \let\deftypeivar = \empty - \let\deftypeivarx = \empty - \let\Edeftypeivar = \empty - \let\deftypemethod = \empty - \let\deftypemethodx = \empty - \let\Edeftypemethod = \empty - \let\deftypeop = \empty - \let\deftypeopx = \empty - \let\Edeftypeop = \empty - \let\deftypevar = \empty - \let\deftypevarx = \empty - \let\Edeftypevar = \empty - \let\deftypevr = \empty - \let\deftypevrx = \empty - \let\Edeftypevr = \empty - \let\defun = \empty - \let\defunx = \empty - \let\Edefun = \empty - \let\defvar = \empty - \let\defvarx = \empty - \let\Edefvar = \empty - \let\defvr = \empty - \let\defvrx = \empty - \let\Edefvr = \empty - \let\clear = \relax - \let\down = \relax - \let\evenfooting = \relax - \let\evenheading = \relax - \let\everyfooting = \relax - \let\everyheading = \relax - \let\headings = \relax - \let\include = \relax - \let\item = \relax - \let\lowersections = \relax - \let\oddfooting = \relax - \let\oddheading = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\raisesections = \relax - \let\ref = \relax - \let\set = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\settitle = \relax - \let\up = \relax - \let\verbatiminclude = \relax - \let\xref = \relax +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 } +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} % Ignore @ignore, @ifhtml, @ifinfo, and the like. % \def\direntry{\doignore{direntry}} -\def\documentdescriptionword{documentdescription} \def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} \def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} \def\ifhtml{\doignore{ifhtml}} \def\ifinfo{\doignore{ifinfo}} -\def\ifnottex{\nestedignore{ifnottex}} +\def\ifnottex{\doignore{ifnottex}} \def\ifplaintext{\doignore{ifplaintext}} \def\ifxml{\doignore{ifxml}} \def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} \def\xml{\doignore{xml}} -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory = \comment - -% Ignore text until a line `@end #1'. +% Ignore text until a line `@end #1', keeping track of nested conditionals. % +% A count to remember the depth of nesting. +\newcount\doignorecount + \def\doignore#1{\begingroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define a command to swallow text until we reach `@end #1'. - % This @ is a catcode 12 token (that is the normal catcode of @ in - % this texinfo.tex file). We change the catcode of @ below to match. - \long\def\doignoretext##1@end #1{\enddoignore}% + % Scan in ``verbatim'' mode: + \obeylines + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other % % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode\spaceChar = 10 + \spaceisspace % - % Ignore braces, too, so mismatched braces don't cause trouble. - \catcode`\{ = 9 - \catcode`\} = 9 + % Count number of #1's that we've seen. + \doignorecount = 0 % - % We must not have @c interpreted as a control sequence. - \catcode`\@ = 12 + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % % - \def\ignoreword{#1}% - \ifx\ignoreword\documentdescriptionword - % The c kludge breaks documentdescription, since - % `documentdescription' contains a `c'. Means not everything will - % be ignored inside @documentdescription, but oh well... - \else - % Make the letter c a comment character so that the rest of the line - % will be ignored. This way, the document can have (for example) - % @c @end ifinfo - % and the @end ifinfo will be properly ignored. - % (We've just changed @ to catcode 12.) - \catcode`\c = 14 + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M@end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). \fi - % - % And now expand the command defined above. - \doignoretext + \next #1% the token \_STOP_ is present just after this macro. } -% What we do to finish off ignored text. +% We have to swallow the remaining "\_STOP_". % -\def\enddoignore{\endgroup\ignorespaces}% - -\newif\ifwarnedobs\warnedobsfalse -\def\obstexwarn{% - \ifwarnedobs\relax\else - % We need to warn folks that they may have trouble with TeX 3.0. - % This uses \immediate\write16 rather than \message to get newlines. - \immediate\write16{} - \immediate\write16{WARNING: for users of Unix TeX 3.0!} - \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} - \immediate\write16{If you are running another version of TeX, relax.} - \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} - \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.org/non-gnu/TeX.README.)} - \immediate\write16{If you are stuck with version 3.0, run the} - \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} - \immediate\write16{ to use a workaround.} - \immediate\write16{} - \global\warnedobstrue - \fi +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next } -% **In TeX 3.0, setting text in \nullfont hangs tex. For a -% workaround (which requires the file ``dummy.tfm'' to be installed), -% uncomment the following line: -%%%%%\font\nullfont=dummy\let\obstexwarn=\relax - -% Ignore text, except that we keep track of conditional commands for -% purposes of nesting, up to an `@end #1' command. -% -\def\nestedignore#1{% - \obstexwarn - % We must actually expand the ignored text to look for the @end - % command, so that nested ignore constructs work. Thus, we put the - % text into a \vbox and then do nothing with the result. To minimize - % the chance of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook. - % - \setbox0 = \vbox\bgroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define `@end #1' to end the box, which will in turn undefine the - % @end command again. - \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% - % - % We are going to be parsing Texinfo commands. Most cause no - % trouble when they are used incorrectly, but some commands do - % complicated argument parsing or otherwise get confused, so we - % undefine them. - % - % We can't do anything about stray @-signs, unfortunately; - % they'll produce `undefined control sequence' errors. - \ignoremorecommands - % - % Set the current font to be \nullfont, a TeX primitive, and define - % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because some sites - % might not have that installed. Therefore, math mode will still - % produce output, but that should be an extremely small amount of - % stuff compared to the main input. - % - \nullfont - \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont - \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont - \let\tensf=\nullfont - % Similarly for index fonts. - \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont - \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont - \let\smallsf=\nullfont - % Similarly for smallexample fonts. - \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont - \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont - \let\smallersf=\nullfont - % - % Don't complain when characters are missing from the fonts. - \tracinglostchars = 0 - % - % Don't bother to do space factor calculations. - \frenchspacing - % - % Don't report underfull hboxes. - \hbadness = 10000 - % - % Do minimal line-breaking. - \pretolerance = 10000 - % - % Do not execute instructions in @tex. - \def\tex{\doignore{tex}}% - % Do not execute macro definitions. - % `c' is a comment character, so the word `macro' will get cut off. - \def\macro{\doignore{ma}}% +% Finish off ignored text. +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% } + % @set VAR sets the variable VAR to an empty value. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. % % Since we want to separate VAR from REST-OF-LINE (which might be % empty), we can't just use \parsearg; we have to insert a space of our % own to delimit the rest of the line, and then take it out again if we -% didn't need it. Make sure the catcode of space is correct to avoid -% losing inside @example, for instance. +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. % -\def\set{\begingroup\catcode` =10 - \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. - \parsearg\setxxx} -\def\setxxx#1{\setyyy#1 \endsetyyy} +\parseargdef\set{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% - \def\temp{#2}% - \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty - \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. - \fi - \endgroup + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% } -% Can't use \xdef to pre-expand #2 and save some time, since \temp or -% \next or other control sequences that we've defined might get us into -% an infinite loop. Consider `@set foo @cite{bar}'. -\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} % @clear VAR clears (i.e., unsets) the variable VAR. % -\def\clear{\parsearg\clearxxx} -\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} % @value{foo} gets the text saved in variable foo. -{ - \catcode`\_ = \active - % - % We might end up with active _ or - characters in the argument if - % we're called from @code, as @code{@value{foo-bar_}}. So \let any - % such active characters to their normal equivalents. - \gdef\value{\begingroup - \catcode`\-=\other \catcode`\_=\other - \indexbreaks \let_\normalunderscore - \valuexxx} -} +\def\value{\begingroup\makevalueexpandable\valuexxx} \def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} % We have this subroutine so that we can handle at least some @value's -% properly in indexes (we \let\value to this in \indexdummies). Ones -% whose names contain - or _ still won't work, but we can't do anything -% about that. The command has to be fully expandable (if the variable -% is set), since the result winds up in the index file. This means that -% if the variable's value contains other Texinfo commands, it's almost -% certain it will fail (although perhaps we could fix that with -% sufficient work to do a one-level expansion on the result, instead of -% complete). +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax @@ -2871,55 +3096,36 @@ % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % -\def\ifset{\parsearg\doifset} -\def\doifset#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \let\next=\ifsetfail - \else - \let\next=\ifsetsucceed - \fi - \next +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next } -\def\ifsetsucceed{\conditionalsucceed{ifset}} -\def\ifsetfail{\nestedignore{ifset}} -\defineunmatchedend{ifset} +\def\ifsetfail{\doignore{ifset}} % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % -\def\ifclear{\parsearg\doifclear} -\def\doifclear#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \let\next=\ifclearsucceed - \else - \let\next=\ifclearfail - \fi - \next -} -\def\ifclearsucceed{\conditionalsucceed{ifclear}} -\def\ifclearfail{\nestedignore{ifclear}} -\defineunmatchedend{ifclear} - -% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we -% read the text following, through the first @end iftex (etc.). Make -% `@end iftex' (etc.) valid only after an @iftex. +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. % -\def\iftex{\conditionalsucceed{iftex}} -\def\ifnothtml{\conditionalsucceed{ifnothtml}} -\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} -\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}} -\defineunmatchedend{iftex} -\defineunmatchedend{ifnothtml} -\defineunmatchedend{ifnotinfo} -\defineunmatchedend{ifnotplaintext} +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} -% True conditional. Since \set globally defines its variables, we can -% just start and end a group (to keep the @end definition undefined at -% the outer level). -% -\def\conditionalsucceed#1{\begingroup - \expandafter\def\csname E#1\endcsname{\endgroup}% -} +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment % @defininfoenclose. \let\definfoenclose=\comment @@ -2929,9 +3135,8 @@ % Index generation facilities % Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within \newindex. -{\catcode`\@=11 -\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} % \newindex {foo} defines an index named foo. % It automatically defines \fooindex such that @@ -3017,6 +3222,7 @@ % we have to laboriously prevent expansion for those that we don't. % \def\indexdummies{% + \escapechar = `\\ % use backslash in output files. \def\@{@}% change to @@ when we switch to @ as escape char in index files. \def\ {\realbackslash\space }% % Need these in case \tex is in effect and \{ is a \delimiter again. @@ -3025,10 +3231,34 @@ \let\{ = \mylbrace \let\} = \myrbrace % - % \definedummyword defines \#1 as \realbackslash #1\space, thus - % effectively preventing its expansion. This is used only for control - % words, not control letters, because the \space would be incorrect - % for control characters, but is needed to separate the control word + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies + \otherbackslash +} + +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control% words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word % from whatever follows. % % For control letters, we have \definedummyletter, which omits the @@ -3038,181 +3268,157 @@ % those that do not. If it is followed by {arg} in the input, then % that will dutifully get written to the index (or wherever). % - \def\definedummyword##1{% - \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% - }% - \def\definedummyletter##1{% - \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% - }% + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter % - % Do the redefinitions. - \commondummies -} - -% For the aux file, @ is the escape character. So we want to redefine -% everything using @ instead of \realbackslash. When everything uses -% @, this will be simpler. -% -\def\atdummies{% - \def\@{@@}% - \def\ {@ }% - \let\{ = \lbraceatcmd - \let\} = \rbraceatcmd + \commondummiesnofonts % - % (See comments in \indexdummies.) - \def\definedummyword##1{% - \expandafter\def\csname ##1\endcsname{@##1\space}% - }% - \def\definedummyletter##1{% - \expandafter\def\csname ##1\endcsname{@##1}% - }% + \definedummyletter\_% % - % Do the redefinitions. - \commondummies -} - -% Called from \indexdummies and \atdummies. \definedummyword and -% \definedummyletter must be defined first. -% -\def\commondummies{% + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\L + \definedummyword\OE + \definedummyword\O + \definedummyword\aa + \definedummyword\ae + \definedummyword\l + \definedummyword\oe + \definedummyword\o + \definedummyword\ss + \definedummyword\exclamdown + \definedummyword\questiondown + \definedummyword\ordf + \definedummyword\ordm + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\expansion + \definedummyword\minus + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\result + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist % \normalturnoffactive % - % Control letters and accents. - \definedummyletter{_}% - \definedummyletter{,}% - \definedummyletter{"}% - \definedummyletter{`}% - \definedummyletter{'}% - \definedummyletter{^}% - \definedummyletter{~}% - \definedummyletter{=}% - \definedummyword{u}% - \definedummyword{v}% - \definedummyword{H}% - \definedummyword{dotaccent}% - \definedummyword{ringaccent}% - \definedummyword{tieaccent}% - \definedummyword{ubaraccent}% - \definedummyword{udotaccent}% - \definedummyword{dotless}% - % - % Other non-English letters. - \definedummyword{AA}% - \definedummyword{AE}% - \definedummyword{L}% - \definedummyword{OE}% - \definedummyword{O}% - \definedummyword{aa}% - \definedummyword{ae}% - \definedummyword{l}% - \definedummyword{oe}% - \definedummyword{o}% - \definedummyword{ss}% - % - % Although these internal commands shouldn't show up, sometimes they do. - \definedummyword{bf}% - \definedummyword{gtr}% - \definedummyword{hat}% - \definedummyword{less}% - \definedummyword{sf}% - \definedummyword{sl}% - \definedummyword{tclose}% - \definedummyword{tt}% - % - % Texinfo font commands. - \definedummyword{b}% - \definedummyword{i}% - \definedummyword{r}% - \definedummyword{sc}% - \definedummyword{t}% - % - \definedummyword{TeX}% - \definedummyword{acronym}% - \definedummyword{cite}% - \definedummyword{code}% - \definedummyword{command}% - \definedummyword{dfn}% - \definedummyword{dots}% - \definedummyword{emph}% - \definedummyword{env}% - \definedummyword{file}% - \definedummyword{kbd}% - \definedummyword{key}% - \definedummyword{math}% - \definedummyword{option}% - \definedummyword{samp}% - \definedummyword{strong}% - \definedummyword{uref}% - \definedummyword{url}% - \definedummyword{var}% - \definedummyword{w}% - % - % Assorted special characters. - \definedummyword{bullet}% - \definedummyword{copyright}% - \definedummyword{dots}% - \definedummyword{enddots}% - \definedummyword{equiv}% - \definedummyword{error}% - \definedummyword{expansion}% - \definedummyword{minus}% - \definedummyword{pounds}% - \definedummyword{point}% - \definedummyword{print}% - \definedummyword{result}% - % - % Handle some cases of @value -- where the variable name does not - % contain - or _, and the value does not contain any + % Handle some cases of @value -- where it does not contain any % (non-fully-expandable) commands. - \let\value = \expandablevalue - % - % Normal spaces, not active ones. - \unsepspaces - % - % No macro expansion. - \turnoffmacros + \makevalueexpandable } -% If an index command is used in an @example environment, any spaces -% therein should become regular spaces in the raw index file, not the -% expansion of \tie (\leavevmode \penalty \@M \ ). -{\obeyspaces - \gdef\unsepspaces{\obeyspaces\let =\space}} - +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sc + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\acronym + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref +} % \indexnofonts is used when outputting the strings to sort the index % by, and when constructing control sequence names. It eliminates all % control sequences and just writes whatever the best ASCII sort string % would be for a given command (usually its argument). % -\def\indexdummytex{TeX} -\def\indexdummydots{...} -% \def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % \def\ { }% \def\@{@}% % how to handle braces? \def\_{\normalunderscore}% % - \let\,=\asis - \let\"=\asis - \let\`=\asis - \let\'=\asis - \let\^=\asis - \let\~=\asis - \let\==\asis - \let\u=\asis - \let\v=\asis - \let\H=\asis - \let\dotaccent=\asis - \let\ringaccent=\asis - \let\tieaccent=\asis - \let\ubaraccent=\asis - \let\udotaccent=\asis - \let\dotless=\asis - % - % Other non-English letters. + % Non-English letters. \def\AA{AA}% \def\AE{AE}% \def\L{L}% @@ -3226,130 +3432,178 @@ \def\ss{ss}% \def\exclamdown{!}% \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% % - % Don't no-op \tt, since it isn't a user-level command - % and is used in the definitions of the active chars like <, >, |, etc. - % Likewise with the other plain tex font commands. - %\let\tt=\asis + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% % - % Texinfo font commands. - \let\b=\asis - \let\i=\asis - \let\r=\asis - \let\sc=\asis - \let\t=\asis + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\result{=>}% % - \let\TeX=\indexdummytex - \let\acronym=\asis - \let\cite=\asis - \let\code=\asis - \let\command=\asis - \let\dfn=\asis - \let\dots=\indexdummydots - \let\emph=\asis - \let\env=\asis - \let\file=\asis - \let\kbd=\asis - \let\key=\asis - \let\math=\asis - \let\option=\asis - \let\samp=\asis - \let\strong=\asis - \let\uref=\asis - \let\url=\asis - \let\var=\asis - \let\w=\asis + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist } \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? -% For \ifx comparisons. -\def\emptymacro{\empty} - % Most index entries go through here, but \dosubind is the general case. -% -\def\doind#1#2{\dosubind{#1}{#2}\empty} +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} % Workhorse for all \fooindexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% \empty if called from \doind, as we usually are. The main exception -% is with defuns, which call us directly. +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). % \def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \ifvmode + \dosubindsanitize + \else + \dosubindwrite + \fi + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% % Put the index entry in the margin if desired. \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% \fi - {% - \count255=\lastpenalty - {% - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - {% - \let\folio = 0% We will expand all macros now EXCEPT \folio. - \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - % The main index entry text. - \toks0 = {#2}% - % - % If third arg is present, precede it with space in sort key. - \def\thirdarg{#3}% - \ifx\thirdarg\emptymacro \else - % If the third (subentry) arg is present, add it to the index - % line to write. - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - % Process the index entry with all font commands turned off, to - % get the string to sort by. - {\indexnofonts - \edef\temp{\the\toks0}% need full expansion - \xdef\indexsorttmp{\temp}% - }% - % - % Set up the complete index entry, with both the sort key and - % the original text, including any font commands. We write - % three arguments to \entry to the .?? file (four in the - % subentry case), texindex reduces to two when writing the .??s - % sorted result. - \edef\temp{% - \write\csname#1indfile\endcsname{% - \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% - }% - % - % If a skip is the last thing on the list now, preserve it - % by backing up by \lastskip, doing the \write, then inserting - % the skip again. Otherwise, the whatsit generated by the - % \write will make \lastskip zero. The result is that sequences - % like this: - % @end defun - % @tindex whatever - % @defun ... - % will have extra space inserted, because the \medbreak in the - % start of the @defun won't see the skip inserted by the @end of - % the previous defun. - % - % But don't do any of this if we're not in vertical mode. We - % don't want to do a \vskip and prematurely end a paragraph. - % - % Avoid page breaks due to these extra skips, too. - % - \iflinks - \ifvmode - \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi - \fi - % - \temp % do the write - % - \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi - \fi - }% - }% - \penalty\count255 + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write will make \lastskip zero. The result is that sequences +% like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +% ..., ready, GO: +% +\def\dosubindsanitize{% + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \skip0 = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \count255 = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\skip0 glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\skip0 + \fi + % + \dosubindwrite + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\count255>9999 \penalty\count255 \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\skip0 + \fi } % The index entry written in the file actually looks like @@ -3387,14 +3641,12 @@ % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % -\def\printindex{\parsearg\doprintindex} -\def\doprintindex#1{\begingroup +\parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % \smallfonts \rm \tolerance = 9500 \everypar = {}% don't want the \kern\-parindent from indentation suppression. - \indexbreaks % % See if the index file exists and is nonempty. % Change catcode of @ here so that if the index file contains @@ -3421,7 +3673,7 @@ % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. - \def\indexbackslash{\rawbackslashxx}% + \def\indexbackslash{\backslashcurfont}% \catcode`\\ = 0 \escapechar = `\\ \begindoublecolumns @@ -3443,7 +3695,10 @@ \removelastskip % % We like breaks before the index initials, so insert a bonus. - \penalty -300 + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column @@ -3453,80 +3708,100 @@ % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus .5\baselineskip \leftline{\secbf #1}% - \vskip .33\baselineskip plus .1\baselineskip - % % Do our best not to break after the initial. \nobreak + \vskip .33\baselineskip plus .1\baselineskip }} -% This typesets a paragraph consisting of #1, dot leaders, and then #2 -% flush to the right margin. It is used for index and table of contents -% entries. The paragraph is indented by \leftskip. +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. % -\def\entry#1#2{\begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing columns. - \vskip 0pt plus1pt - % - % Start a ``paragraph'' for the index entry so the line breaking - % parameters we've set above will have an effect. - \noindent - % - % Insert the text of the index entry. TeX will do line-breaking on it. - #1% - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#2}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd\ \else% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this frozes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ifpdf - \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \def\tempa{{\rm }}% + \def\tempb{#1}% + \edef\tempc{\tempa}% + \edef\tempd{\tempb}% + \ifx\tempc\tempd + \ % \else - \ #2% The page number ends the paragraph. + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi \fi - \fi% - \par -\endgroup} + \par + \endgroup +} % Like \dotfill except takes at least 1 em. \def\indexdotfill{\cleaders @@ -3695,6 +3970,12 @@ \message{sectioning,} % Chapters, sections, etc. +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 \newcount\chapno \newcount\secno \secno=0 \newcount\subsecno \subsecno=0 @@ -3702,9 +3983,12 @@ % This counter is funny since it counts through charcodes of letters A, B, ... \newcount\appendixno \appendixno = `\@ +% % \def\appendixletter{\char\the\appendixno} -% We do the following for the sake of pdftex, which needs the actual +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual % letter in the expansion, not just typeset. +% \def\appendixletter{% \ifnum\appendixno=`A A% \else\ifnum\appendixno=`B B% @@ -3742,11 +4026,12 @@ % Each @chapter defines this as the name of the chapter. % page headings and footings can use it. @section does likewise. +% However, they are not reliable, because we don't use marks. \def\thischapter{} \def\thissection{} \newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raise/lowersections modify this count +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count % @raisesections: treat @section as chapter, @subsection as section, etc. \def\raisesections{\global\advance\secbase by -1} @@ -3756,121 +4041,142 @@ \def\lowersections{\global\advance\secbase by 1} \let\down=\lowersections % original BFox name -% Choose a numbered-heading macro -% #1 is heading level if unmodified by @raisesections or @lowersections -% #2 is text for heading -\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \chapterzzz{#2} -\or - \seczzz{#2} -\or - \numberedsubseczzz{#2} -\or - \numberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \chapterzzz{#2} +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achive this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 \else - \numberedsubsubseczzz{#2} + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi \fi -\fi -\suppressfirstparagraphindent + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent } -% like \numhead, but chooses appendix heading levels -\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \appendixzzz{#2} -\or - \appendixsectionzzz{#2} -\or - \appendixsubseczzz{#2} -\or - \appendixsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \appendixzzz{#2} - \else - \appendixsubsubseczzz{#2} - \fi -\fi -\suppressfirstparagraphindent -} +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} -% like \numhead, but chooses numberless heading levels -\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \unnumberedzzz{#2} -\or - \unnumberedseczzz{#2} -\or - \unnumberedsubseczzz{#2} -\or - \unnumberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \unnumberedzzz{#2} - \else - \unnumberedsubsubseczzz{#2} - \fi -\fi -\suppressfirstparagraphindent -} - -% @chapter, @appendix, @unnumbered. -\def\thischaptername{No Chapter Title} -\outer\def\chapter{\parsearg\chapteryyy} -\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz #1{% - \secno=0 \subsecno=0 \subsubsecno=0 - \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% - \chapmacro {#1}{\the\chapno}% - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% - % We don't substitute the actual chapter name into \thischapter - % because we don't want its macros evaluated now. - \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% - \writetocentry{chap}{#1}{{\the\chapno}} - \donoderef +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. \global\let\section = \numberedsec \global\let\subsection = \numberedsubsec \global\let\subsubsection = \numberedsubsubsec } -% we use \chapno to avoid indenting back -\def\appendixbox#1{% - \setbox0 = \hbox{\putwordAppendix{} \the\chapno}% - \hbox to \wd0{#1\hss}} - -\outer\def\appendix{\parsearg\appendixyyy} -\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz #1{% - \secno=0 \subsecno=0 \subsubsecno=0 - \global\advance \appendixno by 1 - \message{\putwordAppendix\space \appendixletter}% - \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}% - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% - \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% - \writetocentry{appendix}{#1}{{\appendixletter}} - \appendixnoderef +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % \global\let\section = \appendixsec \global\let\subsection = \appendixsubsec \global\let\subsubsection = \appendixsubsubsec } -% @centerchap is like @unnumbered, but the heading is centered. -\outer\def\centerchap{\parsearg\centerchapyyy} -\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} - -% @top is like @unnumbered. -\outer\def\top{\parsearg\unnumberedyyy} - -\outer\def\unnumbered{\parsearg\unnumberedyyy} -\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz #1{% - \secno=0 \subsecno=0 \subsubsecno=0 +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos % % This used to be simply \message{#1}, but TeX fully expands the % argument to \message. Therefore, if #1 contained @-commands, TeX @@ -3883,134 +4189,98 @@ % \the to achieve this: TeX expands \the only once, % simply yielding the contents of . (We also do this for % the toc entries.) - \toks0 = {#1}\message{(\the\toks0)}% + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% % - \unnumbchapmacro {#1}% - \gdef\thischapter{#1}\gdef\thissection{#1}% - \writetocentry{unnumbchap}{#1}{{\the\chapno}} - \unnumbnoderef \global\let\section = \unnumberedsec \global\let\subsection = \unnumberedsubsec \global\let\subsubsection = \unnumberedsubsubsec } +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + % Sections. -\outer\def\numberedsec{\parsearg\secyyy} -\def\secyyy #1{\numhead1{#1}} % normally calls seczzz -\def\seczzz #1{% - \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % - \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% - \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}} - \donoderef - \nobreak +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } -\outer\def\appendixsection{\parsearg\appendixsecyyy} -\outer\def\appendixsec{\parsearg\appendixsecyyy} -\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz #1{% - \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % - \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% - \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}} - \appendixnoderef - \nobreak +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } +\let\appendixsec\appendixsection -\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} -\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz #1{% - \plainsecheading {#1}\gdef\thissection{#1}% - \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}} - \unnumbnoderef - \nobreak +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. -\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} -\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz #1{% - \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % - \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% - \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} - \donoderef - \nobreak +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } -\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} -\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz #1{% - \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % - \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% - \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}} - \appendixnoderef - \nobreak +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% } -\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} -\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz #1{% - \plainsubsecheading {#1}\gdef\thissection{#1}% - \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} - \unnumbnoderef - \nobreak +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% } % Subsubsections. -\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} -\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz #1{% - \gdef\thissection{#1}\global\advance \subsubsecno by 1 % - \subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% - \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} - \donoderef - \nobreak +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} -\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz #1{% - \gdef\thissection{#1}\global\advance \subsubsecno by 1 % - \subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% - \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}} - \appendixnoderef - \nobreak +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} -\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz #1{% - \plainsubsubsecheading {#1}\gdef\thissection{#1}% - \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} - \unnumbnoderef - \nobreak +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% } -% These are variants which are not "outer", so they can appear in @ifinfo. -% Actually, they should now be obsolete; ordinary section commands should work. -\def\infotop{\parsearg\unnumberedzzz} -\def\infounnumbered{\parsearg\unnumberedzzz} -\def\infounnumberedsec{\parsearg\unnumberedseczzz} -\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} - -\def\infoappendix{\parsearg\appendixzzz} -\def\infoappendixsec{\parsearg\appendixseczzz} -\def\infoappendixsubsec{\parsearg\appendixsubseczzz} -\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} - -\def\infochapter{\parsearg\chapterzzz} -\def\infosection{\parsearg\sectionzzz} -\def\infosubsection{\parsearg\subsectionzzz} -\def\infosubsubsection{\parsearg\subsubsectionzzz} - % These macros control what the section commands do, according % to what kind of chapter we are in (ordinary, appendix, or unnumbered). % Define them by default for a numbered chapter. -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading @@ -4023,23 +4293,27 @@ % if justification is not attempted. Hence \raggedright. -\def\majorheading{\parsearg\majorheadingzzz} -\def\majorheadingzzz #1{% +\def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% - {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + \parsearg\chapheadingzzz +} -\def\chapheading{\parsearg\chapheadingzzz} -\def\chapheadingzzz #1{\chapbreak % +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} % @heading, @subheading, @subsubheading. -\def\heading{\parsearg\plainsecheading} -\def\subheading{\parsearg\plainsubsecheading} -\def\subsubheading{\parsearg\plainsubsubsecheading} +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} % These macros generate a chapter, section, etc. heading only % (including whitespace, linebreaking, etc. around it), @@ -4048,8 +4322,6 @@ %%% Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - %%% Define plain chapter starts, and page on/off switching for it % Parameter controlling skip before chapter headings (if needed) @@ -4072,7 +4344,7 @@ \global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} -\def\CHAPPAGodd{ +\def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\let\pagealignmacro=\chapoddpage @@ -4080,116 +4352,201 @@ \CHAPPAGon -\def\CHAPFplain{ -\global\let\chapmacro=\chfplain -\global\let\unnumbchapmacro=\unnchfplain -\global\let\centerchapmacro=\centerchfplain} - -% Plain chapter opening. -% #1 is the text, #2 the chapter number or empty if unnumbered. -\def\chfplain#1#2{% +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% \pchapsepmacro {% \chapfonts \rm - \def\chapnum{#2}% - \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% + % + % Have to define \thissection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \gdef\thischapter{#1}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \gdef\thischapter{}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. And we don't + % use \thissection because that changes with each section. + % + \xdef\thischapter{\putwordAppendix{} \appendixletter: + \noexpand\thischaptername}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \xdef\thischapter{\putwordChapter{} \the\chapno: + \noexpand\thischaptername}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 \centerparametersmaybe + \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } -% Plain opening for unnumbered. -\def\unnchfplain#1{\chfplain{#1}{}} - % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax -\def\centerchfplain#1{{% - \def\centerparametersmaybe{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt - }% - \chfplain{#1}{}% -}} +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} -\CHAPFplain % The default +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% \def\unnchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\raggedright \rm #1\hfill}}\bigskip \par\nobreak } - \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% \par\penalty 5000 % } - \def\centerchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt \hfill {\rm #1}\hfill}}\bigskip \par\nobreak } - -\def\CHAPFopen{ -\global\let\chapmacro=\chfopen -\global\let\unnumbchapmacro=\unnchfopen -\global\let\centerchapmacro=\centerchfopen} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} -% Section titles. +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% \newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip {-1000}} -\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} -\def\plainsecheading#1{\sectionheading{sec}{}{#1}} +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. -\newskip \subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} -\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} -\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. -\let\subsubsecheadingskip = \subsecheadingskip -\let\subsubsecheadingbreak = \subsecheadingbreak -\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} -\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} -% Print any size section title. +% Print any size, any type, section title. % -% #1 is the section type (sec/subsec/subsubsec), #2 is the section -% number (maybe empty), #3 the text. -\def\sectionheading#1#2#3{% - {% - \expandafter\advance\csname #1headingskip\endcsname by \parskip - \csname #1headingbreak\endcsname - }% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\sectionheading#1#2#3#4{% {% % Switch to the right set of fonts. - \csname #1fonts\endcsname \rm + \csname #2fonts\endcsname \rm % - % Only insert the separating space if we have a section number. - \def\secnum{#2}% - \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% + % Insert space above the heading. + \csname #2headingbreak\endcsname % + % Only insert the space after the number if we have a section number. + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\thissection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \thissection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\thissection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\thissection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chapmacro. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chapmacro. + \donoderef{#3}% + % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % + % Output the actual section heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 % zero if no section number - \unhbox0 #3}% + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% }% - % Add extra space after the heading -- either a line space or a - % paragraph space, whichever is more. (Some people like to set - % \parskip to large values for some reason.) Don't allow stretch, though. - \nobreak - \ifdim\parskip>\normalbaselineskip - \kern\parskip - \else - \kern\normalbaselineskip - \fi + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 } @@ -4198,148 +4555,158 @@ \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. We supply {\folio} at the end of the -% argument, which will end up as the last argument to the \...entry macro. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. % -% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}} % We open the .toc file for writing here instead of at @setfilename (or % any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. % \newif\iftocfileopened +\def\omitkeyword{omit}% +% \def\writetocentry#1#2#3{% - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + }% + \fi \fi % - \iflinks - \toks0 = {#2}% - \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}% - \temp - \fi - % - % Tell \shipout to create a page destination if we're doing pdf, which - % will be the target of the links in the table of contents. We can't - % just do it on every page because the title pages are numbered 1 and - % 2 (the page numbers aren't printed), and so are the first two pages - % of the document. Thus, we'd have two destinations named `1', and - % two named `2'. - \ifpdf \pdfmakepagedesttrue \fi + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \jobname.toc } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 -% Finish up the main text and prepare to read what we've written -% to \tocfile. +% Prepare to read what we've written to \tocfile. % \def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund - \contentsalignmacro - \immediate\closeout\tocfile - % - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \unnumbchapmacro{#1}\def\thischapter{}% - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - % We can't do this, because then an actual ^ in a section - % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. - %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. - % - % Roman numerals for page numbers. - \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \def\thischapter{}% + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } % Normal (long) toc. \def\contents{% - \startcontents{\putwordTOC}% - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \pdfmakeoutlines - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno } % And just the chapters. \def\summarycontents{% - \startcontents{\putwordShortTOC}% - % - \let\chapentry = \shortchapentry - \let\appendixentry = \shortappendixentry - \let\unnumbchapentry = \shortunnumberedentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf - \let\sl=\shortcontsl \let\tt=\shortconttt - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\secentry ##1##2##3##4{} - \def\subsecentry ##1##2##3##4##5{} - \def\subsubsecentry ##1##2##3##4##5##6{} - \let\unnumbsecentry = \secentry - \let\unnumbsubsecentry = \subsecentry - \let\unnumbsubsubsecentry = \subsubsecentry - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno } \let\shortcontents = \summarycontents -\ifpdf - \pdfcatalog{/PageMode /UseOutlines}% -\fi - -% These macros generate individual entries in the table of contents. -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... - -% Chapters, in the main contents. -\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} -% -% Chapters, in the short toc. -% See comments in \dochapentry re vbox and related settings. -\def\shortchapentry#1#2#3{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% -} - -% Appendices, in the main contents. -\def\appendixentry#1#2#3{% - \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}} -% -% Appendices, in the short toc. -\let\shortappendixentry = \shortchapentry - % Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter. -% We could simplify the code here by writing out an \appendixentry -% command in the toc file for appendices, instead of using \chapentry -% for both, but it doesn't seem worth it. -% -\newdimen\shortappendixwidth +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. % \def\shortchaplabel#1{% % This space should be enough, since a single number is .5em, and the @@ -4347,29 +4714,61 @@ % But use \hss just in case. % (This space doesn't include the extra space that gets added after % the label; that gets put in by \shortchapentry above.) - \dimen0 = 1em - \hbox to \dimen0{#1\hss}% + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% } +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + % Unnumbered chapters. -\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}} -\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}} +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. -\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}} +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. -\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}} +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} % And subsubsections. -\def\subsubsecentry#1#2#3#4#5#6{% - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}} +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} % This parameter controls the indentation of the various levels. -\newdimen\tocindent \tocindent = 3pc +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text and #2 is the % page number. @@ -4400,17 +4799,8 @@ \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} -% Final typesetting of a toc entry; we use the same \entry macro as for -% the index entries, but we want to suppress hyphenation here. (We -% can't do that in the \entry macro, since index entries might consist -% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) -\def\tocentry#1#2{\begingroup - \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks - % Do not use \turnoffactive in these arguments. Since the toc is - % typeset in cmr, characters such as _ would come out wrong; we - % have to do the usual translation tricks. - \entry{#1}{#2}% -\endgroup} +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry % Space between chapter (or whatever) number and the title. \def\labelspace{\hskip1em \relax} @@ -4420,8 +4810,8 @@ \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} -\let\subsecentryfonts = \textfonts -\let\subsubsecentryfonts = \textfonts +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} \message{environments,} @@ -4448,10 +4838,10 @@ % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} % -\global\setbox\errorbox=\hbox to \dimen0{\hfil +\setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. - \vbox{ + \vbox{% \hrule height\dimen2 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. @@ -4465,14 +4855,13 @@ % One exception: @ is still an escape character, so that @end tex works. % But \@ or @@ will get a plain tex @ character. -\def\tex{\begingroup +\envdef\tex{% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 \catcode `\+=\other \catcode `\"=\other - \catcode `\==\other \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other @@ -4488,20 +4877,23 @@ \let\!=\ptexexclam \let\i=\ptexi \let\indent=\ptexindent + \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext + \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% -\let\Etex=\endgroup} +} +% There is no need to define \Etex. % Define @lisp ... @end lisp. -% @lisp does a \begingroup so it can rebind things, +% @lisp environment forms a group so it can rebind things, % including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. @@ -4512,19 +4904,6 @@ % have any width. \def\lisppar{\null\endgraf} -% Make each space character in the input produce a normal interword -% space in the output. Don't allow a line break at this space, as this -% is used only in environments like @example, where each line of input -% should produce a line of output anyway. -% -{\obeyspaces % -\gdef\sepspaces{\obeyspaces\let =\tie}} - -% Define \obeyedspace to be our active space, whatever it is. This is -% for use in \parsearg. -{\sepspaces% -\global\let\obeyedspace= } - % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt @@ -4534,7 +4913,8 @@ % start of the next paragraph will insert \parskip. % \def\aboveenvbreak{{% - % =10000 instead of <10000 because of a special case in \itemzzz, q.v. + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. \ifnum \lastpenalty=10000 \else \advance\envskipamount by \parskip \endgraf @@ -4542,7 +4922,7 @@ \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... - \ifnum\lastpenalty>10000 \else \penalty-50 \fi + \ifnum\lastpenalty<10000 \penalty-50 \fi \vskip\envskipamount \fi \fi @@ -4550,7 +4930,8 @@ \let\afterenvbreak = \aboveenvbreak -% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax % @cartouche ... @end cartouche: draw rectangle w/rounded corners around @@ -4574,52 +4955,52 @@ % \newskip\lskip\newskip\rskip -\def\cartouche{% -\par % can't be in the midst of a paragraph. -\begingroup - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt %we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either -% side, and for 6pt waste from -% each corner char, and rule thickness - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \hsize=\cartinner - \kern3pt - \begingroup - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} \def\Ecartouche{% - \endgroup - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup -\endgroup -}} + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} % This macro is called at the beginning of all the @example variants, % inside a group. \def\nonfillstart{% \aboveenvbreak - \inENV % This group ends at the end of the body \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. \let\par = \lisppar % don't ignore blank lines @@ -4627,116 +5008,134 @@ \parskip = 0pt \parindent = 0pt \emergencystretch = 0pt % don't try to avoid overfull boxes - % @cartouche defines \nonarrowing to inhibit narrowing - % at next level down. \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing - \let\exdent=\nofillexdent - \let\nonarrowing=\relax + \else + \let\nonarrowing = \relax + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \smallexamplefonts \rm \fi } -% Define the \E... control sequence only if we are inside the particular -% environment, so the error checking in \end will work. -% -% To end an @example-like environment, we first end the paragraph (via -% \afterenvbreak's vertical glue), and then the group. That way we keep -% the zero \parskip that the environments set -- \parskip glue will be -% inserted at the beginning of the next paragraph in the document, after -% the environment. -% -\def\nonfillfinish{\afterenvbreak\endgroup} +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} -% @lisp: indented, narrowed, typewriter font. -\def\lisp{\begingroup +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% \nonfillstart - \let\Elisp = \nonfillfinish \tt \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. \gobble % eat return } -% @example: Same as @lisp. -\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} - -% @smallexample and @smalllisp: use smaller fonts. -% Originally contributed by Pavel@xerox. -\def\smalllisp{\begingroup - \def\Esmalllisp{\nonfillfinish\endgroup}% - \def\Esmallexample{\nonfillfinish\endgroup}% - \smallexamplefonts - \lisp -} -\let\smallexample = \smalllisp - - -% @display: same as @lisp except keep current font. +% @display/@smalldisplay: same as @lisp except keep current font. % -\def\display{\begingroup +\makedispenv {display}{% \nonfillstart - \let\Edisplay = \nonfillfinish \gobble } -% -% @smalldisplay: @display plus smaller fonts. -% -\def\smalldisplay{\begingroup - \def\Esmalldisplay{\nonfillfinish\endgroup}% - \smallexamplefonts \rm - \display -} -% @format: same as @display except don't narrow margins. +% @format/@smallformat: same as @display except don't narrow margins. % -\def\format{\begingroup - \let\nonarrowing = t +\makedispenv{format}{% + \let\nonarrowing = t% \nonfillstart - \let\Eformat = \nonfillfinish \gobble } -% -% @smallformat: @format plus smaller fonts. -% -\def\smallformat{\begingroup - \def\Esmallformat{\nonfillfinish\endgroup}% - \smallexamplefonts \rm - \format -} -% @flushleft (same as @format). -% -\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak % @flushright. % -\def\flushright{\begingroup - \let\nonarrowing = t +\envdef\flushright{% + \let\nonarrowing = t% \nonfillstart - \let\Eflushright = \nonfillfinish \advance\leftskip by 0pt plus 1fill \gobble } +\let\Eflushright = \afterenvbreak % @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. % -\def\quotation{% - \begingroup\inENV %This group ends at the end of the @quotation body +\envdef\quotation{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt - % We have retained a nonzero parskip for the environment, since we're - % doing normal filling. So to avoid extra space below the environment... - \def\Equotation{\parskip = 0pt \nonfillfinish}% % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax \advance\leftskip by \lispnarrowing \advance\rightskip by \lispnarrowing \exdentamount = \lispnarrowing + \else \let\nonarrowing = \relax \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi } @@ -4758,7 +5157,7 @@ % % [Knuth] p. 380 \def\uncatcodespecials{% - \def\do##1{\catcode`##1=12}\dospecials} + \def\do##1{\catcode`##1=\other}\dospecials} % % [Knuth] pp. 380,381,391 % Disable Spanish ligatures ?` and !` of \tt font @@ -4806,6 +5205,8 @@ } \endgroup \def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart % Easiest (and conventionally used) font for verbatim \tt \def\par{\leavevmode\egroup\box0\endgraf}% @@ -4827,7 +5228,7 @@ % % [Knuth] p. 382; only eat outer {} \begingroup - \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12 + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] \endgroup % @@ -4844,13 +5245,6 @@ % we need not redefine '\', '{' and '}'. % % Inspired by LaTeX's verbatim command set [latex.ltx] -%% Include LaTeX hack for completeness -- never know -%% \begingroup -%% \catcode`|=0 \catcode`[=1 -%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active -%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[ -%% #1|endgroup|def|Everbatim[]|end[verbatim]] -%% |endgroup % \begingroup \catcode`\ =\active @@ -4858,54 +5252,32 @@ % ignore everything up to the first ^^M, that's the newline at the end % of the @verbatim input line itself. Otherwise we get an extra blank % line in the output. - \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}% + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. \endgroup % -\def\verbatim{% - \def\Everbatim{\nonfillfinish\endgroup}% - \begingroup - \nonfillstart - \advance\leftskip by -\defbodyindent - \begingroup\setupverbatim\doverbatim +\envdef\verbatim{% + \setupverbatim\doverbatim } +\let\Everbatim = \afterenvbreak + % @verbatiminclude FILE - insert text of file in verbatim environment. % -% Allow normal characters that we make active in the argument (a file name). -\def\verbatiminclude{% - \begingroup - \catcode`\\=\other - \catcode`~=\other - \catcode`^=\other - \catcode`_=\other - \catcode`|=\other - \catcode`<=\other - \catcode`>=\other - \catcode`+=\other - \parsearg\doverbatiminclude -} -\def\setupverbatiminclude{% - \begingroup - \nonfillstart - \advance\leftskip by -\defbodyindent - \begingroup\setupverbatim -} +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} % \def\doverbatiminclude#1{% - % Restore active chars for included file. - \endgroup - \begingroup - \let\value=\expandablevalue - \def\thisfile{#1}% - \expandafter\expandafter\setupverbatiminclude\input\thisfile - \endgroup - \nonfillfinish - \endgroup + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% } % @copying ... @end copying. -% Save the text away for @insertcopying later. Many commands won't be -% allowed in this context, but that's ok. +% Save the text away for @insertcopying later. % % We save the uninterpreted tokens, rather than creating a box. % Saving the text in a box would be much easier, but then all the @@ -4914,641 +5286,349 @@ % file; b) letting users define the frontmatter in as flexible order as % possible is very desirable. % -\def\copying{\begingroup - % Define a command to swallow text until we reach `@end copying'. - % \ is the escape char in this texinfo.tex file, so it is the - % delimiter for the command; @ will be the escape char when we read - % it, but that doesn't matter. - \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}% - % - % We must preserve ^^M's in the input file; see \insertcopying below. - \catcode`\^^M = \active - \docopying -} - -% What we do to finish off the copying text. +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} % -\def\enddocopying{\endgroup\ignorespaces} - -% @insertcopying. Here we must play games with ^^M's. On the one hand, -% we need them to delimit commands such as `@end quotation', so they -% must be active. On the other hand, we certainly don't want every -% end-of-line to be a \par, as would happen with the normal active -% definition of ^^M. On the third hand, two ^^M's in a row should still -% generate a \par. -% -% Our approach is to make ^^M insert a space and a penalty1 normally; -% then it can also check if \lastpenalty=1. If it does, then manually -% do \par. -% -% This messes up the normal definitions of @c[omment], so we redefine -% it. Similarly for @ignore. (These commands are used in the gcc -% manual for man page generation.) -% -% Seems pretty fragile, most line-oriented commands will presumably -% fail, but for the limited use of getting the copying text (which -% should be quite simple) inserted, we can hope it's ok. -% -{\catcode`\^^M=\active % -\gdef\insertcopying{\begingroup % - \parindent = 0pt % looks wrong on title page - \def^^M{% - \ifnum \lastpenalty=1 % - \par % - \else % - \space \penalty 1 % - \fi % - }% - % - % Fix @c[omment] for catcode 13 ^^M's. - \def\c##1^^M{\ignorespaces}% - \let\comment = \c % - % - % Don't bother jumping through all the hoops that \doignore does, it - % would be very hard since the catcodes are already set. - \long\def\ignore##1\end ignore{\ignorespaces}% - % - \copyingtext % -\endgroup}% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup } \message{defuns,} % @defun etc. -% Allow user to change definition object font (\df) internally -\def\setdeffont#1 {\csname DEF#1\endcsname} - \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt -\newcount\parencount - -% We want ()&[] to print specially on the defun line. -% -\def\activeparens{% - \catcode`\(=\active \catcode`\)=\active - \catcode`\&=\active - \catcode`\[=\active \catcode`\]=\active -} - -% Make control sequences which act like normal parenthesis chars. -\let\lparen = ( \let\rparen = ) - -{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) - -% Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. -\global\let(=\lparen \global\let)=\rparen -\global\let[=\lbrack \global\let]=\rbrack - -\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } -\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} -% This is used to turn on special parens -% but make & act ordinary (given that it's active). -\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} - -% Definitions of (, ) and & used in args for functions. -% This is the definition of ( outside of all parentheses. -\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested - \global\advance\parencount by 1 -} -% -% This is the definition of ( when already inside a level of parens. -\gdef\opnested{\char`\(\global\advance\parencount by 1 } -% -\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. - % also in that case restore the outer-level definition of (. - \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi - \global\advance \parencount by -1 } -% If we encounter &foo, then turn on ()-hacking afterwards -\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } -% -\gdef\normalparens{\boldbrax\let&=\ampnr} -} % End of definition inside \activeparens -%% These parens (in \boldbrax) actually are a little bolder than the -%% contained text. This is especially needed for [ and ] -\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } -\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } -\let\ampnr = \& -\def\lbrb{{\bf\char`\[}} -\def\rbrb{{\bf\char`\]}} - -% Active &'s sneak into the index arguments, so make sure it's defined. -{ - \catcode`& = \active - \global\let& = \ampnr -} - -% \defname, which formats the name of the @def (not the args). -% #1 is the function name. -% #2 is the type of definition, such as "Function". -% -\def\defname#1#2{% - % How we'll output the type name. Putting it in brackets helps - % distinguish it from the body text that may end up on the next line - % just below it. - \ifempty{#2}% - \def\defnametype{}% +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak \else - \def\defnametype{[\rm #2]}% + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \defargscommonending, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint \fi % - % Get the values of \leftskip and \rightskip as they were outside the @def... - \dimen2=\leftskip - \advance\dimen2 by -\defbodyindent - % - % Figure out values for the paragraph shape. - \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}% - \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line - \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations - \parshape 2 0in \dimen0 \defargsindent \dimen1 - % - % Output arg 2 ("Function" or some such) but stuck inside a box of - % width 0 so it does not interfere with linebreaking. - \noindent - % - {% Adjust \hsize to exclude the ambient margins, - % so that \rightline will obey them. - \advance \hsize by -\dimen2 - \dimen3 = 0pt % was -1.25pc - \rlap{\rightline{\defnametype\kern\dimen3}}% - }% - % - % Allow all lines to be underfull without complaint: - \tolerance=10000 \hbadness=10000 - \advance\leftskip by -\defbodyindent - \exdentamount=\defbodyindent - {\df #1}\enskip % output function name - % \defunargs will be called next to output the arguments, if any. -} - -% Common pieces to start any @def... -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence (which our caller defines). -% #3 is the control sequence to process the header, such as \defunheader. -% -\def\parsebodycommon#1#2#3{% - \begingroup\inENV - % If there are two @def commands in a row, we'll have a \nobreak, - % which is there to keep the function description together with its - % header. But if there's nothing but headers, we want to allow a - % break after all. Check for penalty 10002 (inserted by - % \defargscommonending) instead of 10000, since the sectioning - % commands insert a \penalty10000, and we don't want to allow a break - % between a section heading and a defun. - \ifnum\lastpenalty=10002 \penalty0 \fi - \medbreak - % - % Define the \E... end token that this defining construct specifies - % so that it will exit this group. - \def#1{\endgraf\endgroup\medbreak}% - % \parindent=0in \advance\leftskip by \defbodyindent \exdentamount=\defbodyindent } -% Common part of the \...x definitions. -% -\def\defxbodycommon{% - % As with \parsebodycommon above, allow line break if we have multiple - % x headers in a row. It's not a great place, though. - \ifnum\lastpenalty=10000 \penalty1000 \fi +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% % - \begingroup\obeylines + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% } +\def\gobbledefun#1\startdefun{} -% Process body of @defun, @deffn, @defmac, etc. +% \printdefunline \deffnheader{text} % -\def\defparsebody#1#2#3{% - \parsebodycommon{#1}{#2}{#3}% - \def#2{\defxbodycommon \activeparens \spacesplit#3}% - \catcode\equalChar=\active - \begingroup\obeylines\activeparens - \spacesplit#3% -} - -% #1, #2, #3 are the common arguments (see \parsebodycommon above). -% #4, delimited by the space, is the class name. -% -\def\defmethparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}% - \begingroup\obeylines\activeparens - % The \empty here prevents misinterpretation of a construct such as - % @deffn {whatever} {Enharmonic comma} - % See comments at \deftpparsebody, although in our case we don't have - % to remove the \empty afterwards, since it is empty. - \spacesplit{#3{#4}}\empty -} - -% Used for @deftypemethod and @deftypeivar. -% #1, #2, #3 are the common arguments (see \defparsebody). -% #4, delimited by a space, is the class name. -% #5 is the method's return type. -% -\def\deftypemethparsebody#1#2#3#4 #5 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}% - \begingroup\obeylines\activeparens - \spacesplit{#3{#4}{#5}}% -} - -% Used for @deftypeop. The change from \deftypemethparsebody is an -% extra argument at the beginning which is the `category', instead of it -% being the hardwired string `Method' or `Instance Variable'. We have -% to account for this both in the \...x definition and in parsing the -% input at hand. Thus also need a control sequence (passed as #5) for -% the \E... definition to assign the category name to. -% -\def\deftypeopparsebody#1#2#3#4#5 #6 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 ##3 {\def#4{##1}% - \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}% - \begingroup\obeylines\activeparens - \spacesplit{#3{#5}{#6}}% -} - -% For @defop. -\def\defopparsebody #1#2#3#4#5 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 {\def#4{##1}% - \defxbodycommon \activeparens \spacesplit{#3{##2}}}% - \begingroup\obeylines\activeparens - \spacesplit{#3{#5}}% -} - -% These parsing functions are similar to the preceding ones -% except that they do not make parens into active characters. -% These are used for "variables" since they have no arguments. -% -\def\defvarparsebody #1#2#3{% - \parsebodycommon{#1}{#2}{#3}% - \def#2{\defxbodycommon \spacesplit#3}% - \catcode\equalChar=\active - \begingroup\obeylines - \spacesplit#3% -} - -% @defopvar. -\def\defopvarparsebody #1#2#3#4#5 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 {\def#4{##1}% - \defxbodycommon \spacesplit{#3{##2}}}% - \begingroup\obeylines - \spacesplit{#3{#5}}% -} - -\def\defvrparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% - \begingroup\obeylines - \spacesplit{#3{#4}}% -} - -% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the -% type is just `struct', because we lose the braces in `{struct -% termios}' when \spacesplit reads its undelimited argument. Sigh. -% \let\deftpparsebody=\defvrparsebody -% -% So, to get around this, we put \empty in with the type name. That -% way, TeX won't find exactly `{...}' as an undelimited argument, and -% won't strip off the braces. -% -\def\deftpparsebody #1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% - \begingroup\obeylines - \spacesplit{\parsetpheaderline{#3{#4}}}\empty -} - -% Fine, but then we have to eventually remove the \empty *and* the -% braces (if any). That's what this does. -% -\def\removeemptybraces\empty#1\relax{#1} - -% After \spacesplit has done its work, this is called -- #1 is the final -% thing to call, #2 the type name (which starts with \empty), and #3 -% (which might be empty) the arguments. -% -\def\parsetpheaderline#1#2#3{% - #1{\removeemptybraces#2\relax}{#3}% -}% - -% Split up #2 (the rest of the input line) at the first space token. -% call #1 with two arguments: -% the first is all of #2 before the space token, -% the second is all of #2 after that space token. -% If #2 contains no space token, all of it is passed as the first arg -% and the second is passed as empty. -% -{\obeylines % - \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}% - \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{% - \ifx\relax #3% - #1{#2}{}% - \else % - #1{#2}{#3#4}% - \fi}% -} - -% Define @defun. - -% This is called to end the arguments processing for all the @def... commands. -% -\def\defargscommonending{% - \interlinepenalty = 10000 - \advance\rightskip by 0pt plus 1fil - \endgraf - \nobreak\vskip -\parskip - \penalty 10002 % signal to \parsebodycommon. -} - -% This expands the args and terminates the paragraph they comprise. -% -\def\defunargs#1{\functionparens \sl -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Set the font temporarily and use \font in case \setfont made \tensl a macro. -{\tensl\hyphenchar\font=0}% -#1% -{\tensl\hyphenchar\font=45}% -\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% - \defargscommonending -} - -\def\deftypefunargs #1{% -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Use \boldbraxnoamp, not \functionparens, so that & is not special. -\boldbraxnoamp -\tclose{#1}% avoid \code because of side effects on active chars - \defargscommonending -} - -% Do complete processing of one @defun or @defunx line already parsed. - -% @deffn Command forward-char nchars - -\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} - -\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% -\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody -} - -% @defun == @deffn Function - -\def\defun{\defparsebody\Edefun\defunx\defunheader} - -\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDeffunc}% -\defunargs {#2}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody -} - -% @deftypefun int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} - -% #1 is the data type. #2 is the name and args. -\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} -% #1 is the data type, #2 the name, #3 the args. -\def\deftypefunheaderx #1#2 #3\relax{% -\doind {fn}{\code{#2}}% Make entry in function index -\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}% -\deftypefunargs {#3}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody -} - -% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} - -% \defheaderxcond#1\relax$.$ -% puts #1 in @code, followed by a space, but does nothing if #1 is null. -\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi} - -% #1 is the classification. #2 is the data type. #3 is the name and args. -\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} -% #1 is the classification, #2 the data type, #3 the name, #4 the args. -\def\deftypefnheaderx #1#2#3 #4\relax{% -\doind {fn}{\code{#3}}% Make entry in function index -\begingroup -\normalparens % notably, turn off `&' magic, which prevents -% at least some C++ text from working -\defname {\defheaderxcond#2\relax$.$#3}{#1}% -\deftypefunargs {#4}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody -} - -% @defmac == @deffn Macro - -\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} - -\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefmac}% -\defunargs {#2}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody -} - -% @defspec == @deffn Special Form - -\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} - -\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefspec}% -\defunargs {#2}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody -} - -% @defop CATEGORY CLASS OPERATION ARG... -% -\def\defop #1 {\def\defoptype{#1}% -\defopparsebody\Edefop\defopx\defopheader\defoptype} -% -\def\defopheader#1#2#3{% - \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry +\def\printdefunline#1#2{% \begingroup - \defname{#2}{\defoptype\ \putwordon\ #1}% - \defunargs{#3}% + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts \endgroup } -% @deftypeop CATEGORY CLASS TYPE OPERATION ARG... +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. % -\def\deftypeop #1 {\def\deftypeopcategory{#1}% - \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader - \deftypeopcategory} -% -% #1 is the class name, #2 the data type, #3 the operation name, #4 the args. -\def\deftypeopheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$.$#3} - {\deftypeopcategory\ \putwordon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp } -% @deftypemethod CLASS TYPE METHOD ARG... +% \domakedefun \deffn \deffnx \deffnheader % -\def\deftypemethod{% - \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. % -% #1 is the class name, #2 the data type, #3 the method name, #4 the args. -\def\deftypemethodheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% } -% @deftypeivar CLASS TYPE VARNAME +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args % -\def\deftypeivar{% - \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} -% -% #1 is the class name, #2 the data type, #3 the variable name. -\def\deftypeivarheader#1#2#3{% - \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index - \begingroup - \defname{\defheaderxcond#2\relax$.$#3} - {\putwordInstanceVariableof\ \code{#1}}% - \defvarargs{#3}% - \endgroup +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } -% @defmethod == @defop Method +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args % -\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args % -% #1 is the class name, #2 the method name, #3 the args. -\def\defmethodheader#1#2#3{% - \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{#2}{\putwordMethodon\ \code{#1}}% - \defunargs{#3}% - \endgroup +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -% @defcv {Class Option} foo-class foo-flag +%%% Untyped variables: -\def\defcv #1 {\def\defcvtype{#1}% -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } -\def\defcvarheader #1#2#3{% - \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry - \begingroup - \defname{#2}{\defcvtype\ \putwordof\ #1}% - \defvarargs{#3}% - \endgroup +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% } -% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. % -\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} +% We are followed by (but not passed) the arguments, if any. % -\def\defivarheader#1#2#3{% - \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index - \begingroup - \defname{#2}{\putwordInstanceVariableof\ #1}% - \defvarargs{#3}% - \endgroup +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. } -% @defvar -% First, define the processing that is wanted for arguments of @defvar. -% This is actually simple: just print them in roman. -% This must expand the args and terminate the paragraph they make up -\def\defvarargs #1{\normalparens #1% - \defargscommonending -} - -% @defvr Counter foo-count - -\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} - -\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% -\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} - -% @defvar == @defvr Variable - -\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} - -\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefvar}% -\defvarargs {#2}\endgroup % -} - -% @defopt == @defvr {User Option} - -\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} - -\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefopt}% -\defvarargs {#2}\endgroup % -} - -% @deftypevar int foobar - -\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} - -% #1 is the data type. #2 is the name, perhaps followed by text that -% is actually part of the data type, which should not be put into the index. -\def\deftypevarheader #1#2{% -\dovarind#2 \relax% Make entry in variables index -\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}% - \defargscommonending -\endgroup} -\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} - -% @deftypevr {Global Flag} int enable - -\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} - -\def\deftypevrheader #1#2#3{\dovarind#3 \relax% -\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1} - \defargscommonending -\endgroup} - -% Now define @deftp -% Args are printed in bold, a slight difference from @defvar. - -\def\deftpargs #1{\bf \defvarargs{#1}} - -% @deftp Class window height width ... - -\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} - -\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% -\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} - -% These definitions are used if you use @defunx (etc.) -% anywhere other than immediately after a @defun or @defunx. +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. % -\def\defcvx#1 {\errmessage{@defcvx in invalid context}} -\def\deffnx#1 {\errmessage{@deffnx in invalid context}} -\def\defivarx#1 {\errmessage{@defivarx in invalid context}} -\def\defmacx#1 {\errmessage{@defmacx in invalid context}} -\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} -\def\defoptx #1 {\errmessage{@defoptx in invalid context}} -\def\defopx#1 {\errmessage{@defopx in invalid context}} -\def\defspecx#1 {\errmessage{@defspecx in invalid context}} -\def\deftpx#1 {\errmessage{@deftpx in invalid context}} -\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} -\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} -\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} -\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} -\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}} -\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} -\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} -\def\defunx#1 {\errmessage{@defunx in invalid context}} -\def\defvarx#1 {\errmessage{@defvarx in invalid context}} -\def\defvrx#1 {\errmessage{@defvrx in invalid context}} +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \let\var=\ttslanted + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +\def\badparencount{% + \errmessage{Unbalanced parentheses in @def}% + \global\parencount=0 +} +\def\badbrackcount{% + \errmessage{Unbalanced square braces in @def}% + \global\brackcount=0 +} \message{macros,} @@ -5557,42 +5637,69 @@ % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. \ifx\eTeXversion\undefined - \newwrite\macscribble - \def\scanmacro#1{% - \begingroup \newlinechar`\^^M - % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ - % Append \endinput to make sure that TeX does not see the ending newline. - \toks0={#1\endinput}% - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{\the\toks0}% - \immediate\closeout\macscribble - \let\xeatspaces\eatspaces - \input \jobname.tmp - \endgroup -} -\else -\def\scanmacro#1{% -\begingroup \newlinechar`\^^M -% Undo catcode changes of \startcontents and \doprintindex -\catcode`\@=0 \catcode`\\=\other \escapechar=`\@ -\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } \fi +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? -\def\macrolist{} % List of all defined macros in the form - % \do\macro1\do\macro2... + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} % Utility routines. -% Thisdoes \let #1 = #2, except with \csnames. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% \def\cslet#1#2{% -\expandafter\expandafter -\expandafter\let -\expandafter\expandafter -\csname#1\endcsname -\csname#2\endcsname} + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} % Trim leading and trailing spaces off a string. % Concepts from aro-bend problem 15 (see CTAN). @@ -5619,30 +5726,36 @@ % done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. -\def\macrobodyctxt{% - \catcode`\~=\other +\def\scanctxt{% + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\+=\other + \catcode`\~=\other +} + +\def\scanargctxt{% + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% + \scanctxt \catcode`\{=\other \catcode`\}=\other - \catcode`\@=\other \catcode`\^^M=\other - \usembodybackslash} + \usembodybackslash +} \def\macroargctxt{% - \catcode`\~=\other - \catcode`\^=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\+=\other - \catcode`\@=\other - \catcode`\\=\other} + \scanctxt + \catcode`\\=\other +} % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N @@ -5673,25 +5786,21 @@ \else \errmessage{Macro name \the\macname\space already defined}\fi \global\cslet{macsave.\the\macname}{\the\macname}% \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% - % Add the macroname to \macrolist - \toks0 = \expandafter{\macrolist\do}% - \xdef\macrolist{\the\toks0 - \expandafter\noexpand\csname\the\macname\endcsname}% + \addtomacrolist{\the\macname}% \fi \begingroup \macrobodyctxt \ifrecursive \expandafter\parsermacbody \else \expandafter\parsemacbody \fi} -\def\unmacro{\parsearg\dounmacro} -\def\dounmacro#1{% +\parseargdef\unmacro{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% % Remove the macro name from \macrolist: \begingroup \expandafter\let\csname#1\endcsname \relax - \let\do\unmacrodo + \let\definedummyword\unmacrodo \xdef\macrolist{\macrolist}% \endgroup \else @@ -5703,10 +5812,10 @@ % macro definitions that have been changed to \relax. % \def\unmacrodo#1{% - \ifx#1\relax + \ifx #1\relax % remove this \else - \noexpand\do \noexpand #1% + \noexpand\definedummyword \noexpand#1% \fi } @@ -5825,25 +5934,23 @@ \expandafter\parsearg \fi \next} -% We mant to disable all macros during \shipout so that they are not -% expanded by \write. -\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% - \edef\next{\macrolist}\expandafter\endgroup\next} - % @alias. % We need some trickery to remove the optional spaces around the equal % sign. Just make them active and then expand them all to nothing. -\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx} +\def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} -\def\aliasyyy #1=#2\relax{\ignoreactivespaces -\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=% - \expandafter\noexpand\csname#2\endcsname}% -\expandafter\endgroup\next} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} \message{cross references,} -% @xref etc. \newwrite\auxfile @@ -5855,64 +5962,68 @@ \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} -% @node's job is to define \lastnode. -\def\node{\ENVcheck\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx #1,\finishnodeparse} -\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}} +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + \let\nwnode=\node -\let\lastnode=\relax +\let\lastnode=\empty -% The sectioning commands (@chapter, etc.) call these. -\def\donoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Ysectionnumberandtype}% - \global\let\lastnode=\relax +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty \fi } -\def\unnumbnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% - \global\let\lastnode=\relax - \fi -} -\def\appendixnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Yappendixletterandtype}% - \global\let\lastnode=\relax - \fi -} - % @anchor{NAME} -- define xref target at arbitrary point. % \newcount\savesfregister -\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} -\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} -\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an -% anchor), namely NAME-title (the corresponding @chapter/etc. name), -% NAME-pg (the page number), and NAME-snt (section number and type). -% Called from \foonoderef. +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \thissection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. % -% We have to set \indexdummies so commands such as @code in a section -% title aren't expanded. It would be nicer not to expand the titles in -% the first place, but there's so many layers that that is hard to do. +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. % -% Likewise, use \turnoffactive so that punctuation chars such as underscore -% and backslash work in node names. -% -\def\setref#1#2{{% - \atdummies +\def\setref#1#2{% \pdfmkdest{#1}% - % - \turnoffactive - \dosetq{#1-title}{Ytitle}% - \dosetq{#1-pg}{Ypagenumber}% - \dosetq{#1-snt}{#2}% -}} + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\thissection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \writexrdef{pg}{\folio}% will be written later, during \shipout + }% + \fi +} % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed @@ -5925,105 +6036,125 @@ \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces \def\printedmanual{\ignorespaces #5}% - \def\printednodename{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual}% - \setbox0=\hbox{\printednodename}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% \ifdim \wd0 = 0pt % No printed node name was explicitly given. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax % Use the node name inside the square brackets. - \def\printednodename{\ignorespaces #1}% + \def\printedrefname{\ignorespaces #1}% \else % Use the actual chapter/section title appear inside % the square brackets. Use the real section title if we have it. \ifdim \wd1 > 0pt % It is in another manual, so we don't have it. - \def\printednodename{\ignorespaces #1}% + \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs % We know the real title if we have the xref values. - \def\printednodename{\refx{#1-title}{}}% + \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. - \def\printednodename{\ignorespaces #1}% + \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. + % Make link in pdf output. \ifpdf \leavevmode \getfilename{#4}% - {\turnoffactive \otherbackslash + {\turnoffactive + % See comments at \activebackslashdouble. + {\activebackslashdouble \xdef\pdfxrefdest{#1}% + \backslashparens\pdfxrefdest}% + % \ifnum\filenamelength>0 \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{#1}% + goto file{\the\filename.pdf} name{\pdfxrefdest}% \else \startlink attr{/Border [0 0 0]}% - goto name{#1}% + goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% \linkcolor \fi % - \ifdim \wd1 > 0pt - \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}{}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\turnoffactive \otherbackslash - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi - }% - % output the `[mynode]' via a macro. - \xrefprintnodename\printednodename + % node/anchor (non-float) references. % - % But we always want a comma and a space: - ,\space - % - % output the `page 3'. - \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi \fi \endlink \endgroup} % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, -% since not square brackets don't work in some documents. Particularly +% since square brackets don't work well in some documents. Particularly % one that Bob is working on :). % \def\xrefprintnodename#1{[#1]} -% \dosetq is called from \setref to do the actual \write (\iflinks). +% Things referred to by \setref. % -\def\dosetq#1#2{% - {\let\folio=0% - \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks \next \fi - }% -} - -% \internalsetq{foo}{page} expands into -% CHARACTERS @xrdef{foo}{...expansion of \page...} -\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq. -% -\def\Ypagenumber{\folio} -\def\Ytitle{\thissection} \def\Ynothing{} -\def\Ysectionnumberandtype{% +\def\Yomitfromtoc{} +\def\Ynumbered{% \ifnum\secno=0 \putwordChapter@tie \the\chapno \else \ifnum\subsecno=0 @@ -6034,8 +6165,7 @@ \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } - -\def\Yappendixletterandtype{% +\def\Yappendix{% \ifnum\secno=0 \putwordAppendix@tie @char\the\appendixno{}% \else \ifnum\subsecno=0 @@ -6048,15 +6178,6 @@ \fi\fi\fi } -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. -% -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Pre-3.0. -\else - \def\linenumber{\the\inputlineno:\space} -\fi - % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. % @@ -6065,7 +6186,7 @@ \indexnofonts \otherbackslash \expandafter\global\expandafter\let\expandafter\thisrefX - \csname X#1\endcsname + \csname XR#1\endcsname }% \ifx\thisrefX\relax % If not defined, say something at least. @@ -6087,12 +6208,45 @@ #2% Output the suffix in any case. } -% This is the macro invoked by entries in the aux file. +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. % -\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname} +\def\xrdef#1#2{% + \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR#1\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \fi +} % Read the last existing aux file, if any. No error if none exists. -\def\readauxfile{\begingroup +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% \catcode`\^^@=\other \catcode`\^^A=\other \catcode`\^^B=\other @@ -6150,41 +6304,39 @@ \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off % - % Make the characters 128-255 be printing characters + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. {% - \count 1=128 + \count1=128 \def\loop{% - \catcode\count 1=\other - \advance\count 1 by 1 - \ifnum \count 1<256 \loop \fi + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi }% }% % - % Turn off \ as an escape so we do not lose on - % entries which were dumped with control sequences in their names. - % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^ - % Reference to such entries still does not work the way one would wish, - % but at least they do not bomb out when the aux file is read in. - \catcode`\\=\other - % - % @ is our escape character in .aux files. + % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 \catcode`\@=0 - % - \openin 1 \jobname.aux - \ifeof 1 \else - \closein 1 - \input \jobname.aux - \global\havexrefstrue - \global\warnedobstrue - \fi - % Open the new aux file. TeX will close it automatically at exit. - \openout\auxfile=\jobname.aux +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 \endgroup} - -% Footnotes. +\message{insertions,} +% including footnotes. \newcount \footnoteno @@ -6198,13 +6350,12 @@ % @footnotestyle is meaningful for info output only. \let\footnotestyle=\comment -\let\ptexfootnote=\footnote - {\catcode `\@=11 % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% \let\indent=\ptexindent + \let\noindent=\ptexnoindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % @@ -6222,17 +6373,12 @@ % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. % -% Oh yes, they do; otherwise, @ifset and anything else that uses -% \parseargline fail inside footnotes because the tokens are fixed when +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % -% The start of the footnote looks usually like this: -\gdef\startfootins{\insert\footins\bgroup} -% -% ... but this macro is redefined inside @multitable. -% \gdef\dofootnote{% - \startfootins + \insert\footins\bgroup % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. @@ -6268,40 +6414,66 @@ } }%end \catcode `\@=11 -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarily, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. % -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi } -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % -\def\finalout{\overfullrule=0pt} +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + % @image. We use the macros from epsf.tex to support this. % If epsf.tex is not installed and @image is used, we complain. @@ -6311,12 +6483,12 @@ % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else - \closein 1 % Do not bother showing banner with epsf.tex v2.7k (available in % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi +\closein 1 % % We will only complain once about lack of epsf.tex. \newif\ifwarnednoepsf @@ -6355,7 +6527,7 @@ % above and below. \nobreak\vskip\parskip \nobreak - \line\bgroup\hss + \line\bgroup \fi % % Output the image. @@ -6368,10 +6540,275 @@ \epsfbox{#1.eps}% \fi % - \ifimagevmode \hss \egroup \bigbreak \fi % space after the image + \ifimagevmode \egroup \bigbreak \fi % space after the image \endgroup} +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \thissection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\thissection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \thissection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + \message{localization,} % and i18n. @@ -6380,19 +6817,17 @@ % properly. Single argument is the language abbreviation. % It would be nice if we could set up a hyphenation file here. % -\def\documentlanguage{\parsearg\dodocumentlanguage} -\def\dodocumentlanguage#1{% +\parseargdef\documentlanguage{% \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. - \openin 1 txi-#1.tex - \ifeof1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% - \let\temp = \relax - \else - \def\temp{\input txi-#1.tex }% - \fi - \temp + % Read the file if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 \endgroup } \newhelp\nolanghelp{The given language definition file cannot be found or @@ -6437,9 +6872,9 @@ \fi } -% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) -% physical page width. +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. % % We also call \setleading{\textleading}, so the caller should define % \textleading. The caller should also set \parskip. @@ -6486,7 +6921,7 @@ {11in}{8.5in}% }} -% Use @smallbook to reset parameters for 7x9.5 (or so) format. +% Use @smallbook to reset parameters for 7x9.25 trim size. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt \textleading = 12pt @@ -6503,6 +6938,24 @@ \defbodyindent = .5cm }} +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% + % + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm +}} + % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt @@ -6575,8 +7028,7 @@ % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. % -\def\pagesizes{\parsearg\pagesizesxxx} -\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 @@ -6623,8 +7075,8 @@ \def\normalplus{+} \def\normaldollar{$}%$ font-lock fix -% This macro is used to make a character print one way in ttfont -% where it can probably just be output, and another way in other fonts, +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, % where something hairier probably needs to be done. % % #1 is what to print if we are indeed using \tt; #2 is what to print @@ -6656,6 +7108,7 @@ \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ % Subroutine for the previous macro. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } @@ -6672,46 +7125,49 @@ \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix -% Set up an active definition for =, but don't enable it most of the time. -{\catcode`\==\active -\global\def={{\tt \char 61}}} - -\catcode`+=\active -\catcode`\_=\active - % If a .fmt file is being used, characters that might appear in a file % name cannot be active until we have parsed the command line. % So turn them off again, and have \everyjob (or @setfilename) turn them on. % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} -\catcode`\@=0 - -% \rawbackslashxx outputs one backslash character in current font, -% as in \char`\\. -\global\chardef\rawbackslashxx=`\\ - -% \rawbackslash defines an active \ to do \rawbackslashxx. -% \otherbackslash defines an active \ to be a literal `\' character with -% catcode other. -{\catcode`\\=\active - @gdef@rawbackslash{@let\=@rawbackslashxx} - @gdef@otherbackslash{@let\=@realbackslash} +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash } -% \realbackslash is an actual character `\' with catcode other. -{\catcode`\\=\other @gdef@realbackslash{\}} +\catcode`\@=0 -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\rawbackslashxx}} +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. \catcode`\\=\active +@def@normalbackslash{{@tt@backslashcurfont}} +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. -@def@turnoffactive{% +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +@gdef@rawbackslash{@let\=@backslashcurfont} +@gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. +% +@def@normalturnoffactive{% + @let\=@normalbackslash @let"=@normaldoublequote - @let\=@realbackslash @let~=@normaltilde @let^=@normalcaret @let_=@normalunderscore @@ -6720,14 +7176,9 @@ @let>=@normalgreater @let+=@normalplus @let$=@normaldollar %$ font-lock fix + @unsepspaces } -% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. (Thus, \ is not expandable when this is in -% effect.) -% -@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} - % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @otherifyactive @@ -6740,9 +7191,9 @@ @global@let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix +% the first `\' in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. -% Also back turn on active characters that might appear in the input +% Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. % @gdef@fixbackslash{% @@ -6759,10 +7210,6 @@ @catcode`@# = @other @catcode`@% = @other -@c Set initial fonts. -@textfonts -@rm - @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) @@ -6772,6 +7219,8 @@ @c time-stamp-end: "}" @c End: +@c vim:sw=2: + @ignore - arch-tag: 53261dd3-7df7-4ec3-9d90-af7a955d3c87 + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 @end ignore From 458811e2b43429db40be15c66c6b56c0075725ac Mon Sep 17 00:00:00 2001 From: "Robert J. Chassell" Date: Mon, 21 Aug 2006 14:39:46 +0000 Subject: [PATCH 291/361] lispintro/texinfo.tex: changed to version 2006-02-13.16 to enable a DVI build using the more recent versions of TeX. --- lispintro/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lispintro/ChangeLog b/lispintro/ChangeLog index d2316d59aa6..67456b833a9 100644 --- a/lispintro/ChangeLog +++ b/lispintro/ChangeLog @@ -1,3 +1,8 @@ +2006-08-21 Robert J. Chassell + + * lispintro/texinfo.tex: changed to version 2006-02-13.16 + to enable a DVI build using the more recent versions of TeX. + 2006-05-25 David Kastrup * emacs-lisp-intro.texi (setcar): replace an antelope rather than From 7d30b59000ba3b9b5e22045515c4a030ca382707 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 21 Aug 2006 14:58:31 +0000 Subject: [PATCH 292/361] Changes from arch/CVS synchronization --- lispintro/texinfo.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lispintro/texinfo.tex b/lispintro/texinfo.tex index dddd0140ff0..a77ed16f93b 100644 --- a/lispintro/texinfo.tex +++ b/lispintro/texinfo.tex @@ -7222,5 +7222,5 @@ @c vim:sw=2: @ignore - arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 + arch-tag: 53261dd3-7df7-4ec3-9d90-af7a955d3c87 @end ignore From 2476f3153d0ea6da997e743a0775c9b9974c4cc3 Mon Sep 17 00:00:00 2001 From: "Robert J. Chassell" Date: Mon, 21 Aug 2006 18:47:35 +0000 Subject: [PATCH 293/361] * emacs-lisp-intro.texi: deleted in directory copy of texinfo.tex and pointed towards ../man/texinfo.tex so only one file needs updating. Added comment of what to do when building on own. --- lispintro/ChangeLog | 6 +++++- lispintro/emacs-lisp-intro.texi | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lispintro/ChangeLog b/lispintro/ChangeLog index 67456b833a9..98617568720 100644 --- a/lispintro/ChangeLog +++ b/lispintro/ChangeLog @@ -1,6 +1,10 @@ 2006-08-21 Robert J. Chassell - * lispintro/texinfo.tex: changed to version 2006-02-13.16 + * emacs-lisp-intro.texi: deleted in directory copy of texinfo.tex + and pointed towards ../man/texinfo.tex so only one file + needs updating. Added comment of what to do when building on own. + + * texinfo.tex: changed to version 2006-02-13.16 to enable a DVI build using the more recent versions of TeX. 2006-05-25 David Kastrup diff --git a/lispintro/emacs-lisp-intro.texi b/lispintro/emacs-lisp-intro.texi index 5d513256daf..cb04acc2062 100644 --- a/lispintro/emacs-lisp-intro.texi +++ b/lispintro/emacs-lisp-intro.texi @@ -1,4 +1,5 @@ -\input texinfo @c -*-texinfo-*- +\input ../man/texinfo @c -*-texinfo-*- +@c change above to \input texinfo if building on own. @comment %**start of header @setfilename ../info/eintr @c setfilename emacs-lisp-intro.info From c7025fef3924ad9f33d342a79bf34e7583683c53 Mon Sep 17 00:00:00 2001 From: "Robert J. Chassell" Date: Mon, 21 Aug 2006 19:04:39 +0000 Subject: [PATCH 294/361] texinfo.tex: deleted file and pointed emacs-lisp-intro.texi towards ../man/texinfo.tex --- lispintro/texinfo.tex | 7226 ----------------------------------------- 1 file changed, 7226 deletions(-) delete mode 100644 lispintro/texinfo.tex diff --git a/lispintro/texinfo.tex b/lispintro/texinfo.tex deleted file mode 100644 index a77ed16f93b..00000000000 --- a/lispintro/texinfo.tex +++ /dev/null @@ -1,7226 +0,0 @@ -% texinfo.tex -- TeX macros to handle Texinfo files. -% -% Load plain if necessary, i.e., if running under initex. -\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi -% -\def\texinfoversion{2006-02-13.16} -% -% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, -% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free -% Software Foundation, Inc. -% -% This texinfo.tex file is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License as -% published by the Free Software Foundation; either version 2, or (at -% your option) any later version. -% -% This texinfo.tex file is distributed in the hope that it will be -% useful, but WITHOUT ANY WARRANTY; without even the implied warranty -% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -% General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with this texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -% Boston, MA 02110-1301, USA. -% -% As a special exception, when this file is read by TeX when processing -% a Texinfo source document, you may use the result without -% restriction. (This has been our intent since Texinfo was invented.) -% -% Please try the latest version of texinfo.tex before submitting bug -% reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or -% ftp://tug.org/tex/texinfo.tex -% (and all CTAN mirrors, see http://www.ctan.org). -% The texinfo.tex in any given distribution could well be out -% of date, so if that's what you're using, please check. -% -% Send bug reports to bug-texinfo@gnu.org. Please include including a -% complete document in each bug report with which we can reproduce the -% problem. Patches are, of course, greatly appreciated. -% -% To process a Texinfo manual with TeX, it's most reliable to use the -% texi2dvi shell script that comes with the distribution. For a simple -% manual foo.texi, however, you can get away with this: -% tex foo.texi -% texindex foo.?? -% tex foo.texi -% tex foo.texi -% dvips foo.dvi -o # or whatever; this makes foo.ps. -% The extra TeX runs get the cross-reference information correct. -% Sometimes one run after texindex suffices, and sometimes you need more -% than two; texi2dvi does it as many times as necessary. -% -% It is possible to adapt texinfo.tex for other languages, to some -% extent. You can get the existing language-specific files from the -% full Texinfo distribution. -% -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. - - -\message{Loading texinfo [version \texinfoversion]:} - -% If in a .fmt file, print the version number -% and turn on active characters that we couldn't do earlier because -% they might have appeared in the input file name. -\everyjob{\message{[Texinfo version \texinfoversion]}% - \catcode`+=\active \catcode`\_=\active} - -\message{Basics,} -\chardef\other=12 - -% We never want plain's \outer definition of \+ in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - -% Save some plain tex macros whose names we will redefine. -\let\ptexb=\b -\let\ptexbullet=\bullet -\let\ptexc=\c -\let\ptexcomma=\, -\let\ptexdot=\. -\let\ptexdots=\dots -\let\ptexend=\end -\let\ptexequiv=\equiv -\let\ptexexclam=\! -\let\ptexfootnote=\footnote -\let\ptexgtr=> -\let\ptexhat=^ -\let\ptexi=\i -\let\ptexindent=\indent -\let\ptexinsert=\insert -\let\ptexlbrace=\{ -\let\ptexless=< -\let\ptexnewwrite\newwrite -\let\ptexnoindent=\noindent -\let\ptexplus=+ -\let\ptexrbrace=\} -\let\ptexslash=\/ -\let\ptexstar=\* -\let\ptext=\t - -% If this character appears in an error message or help string, it -% starts a new line in the output. -\newlinechar = `^^J - -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. -% -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Pre-3.0. -\else - \def\linenumber{l.\the\inputlineno:\space} -\fi - -% Set up fixed words for English if not already set. -\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi -\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi -\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi -\ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi -\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi -\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi -\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi -\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi -\ifx\putwordof\undefined \gdef\putwordof{of}\fi -\ifx\putwordon\undefined \gdef\putwordon{on}\fi -\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi -\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi -\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi -\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi -\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi -\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi -\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi -% -\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi -\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi -\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi -\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi -\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi -\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi -\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi -\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi -\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi -\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi -\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi -\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi -% -\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi -\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi -\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi -\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi -\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi - -% Since the category of space is not known, we have to be careful. -\chardef\spacecat = 10 -\def\spaceisspace{\catcode`\ =\spacecat} - -% Ignore a token. -% -\def\gobble#1{} - -% The following is used inside several \edef's. -\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} - -% Hyphenation fixes. -\hyphenation{ - Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script - ap-pen-dix bit-map bit-maps - data-base data-bases eshell fall-ing half-way long-est man-u-script - man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm - par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces - spell-ing spell-ings - stand-alone strong-est time-stamp time-stamps which-ever white-space - wide-spread wrap-around -} - -% Margin to add to right of even pages, to left of odd pages. -\newdimen\bindingoffset -\newdimen\normaloffset -\newdimen\pagewidth \newdimen\pageheight - -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} - -% Sometimes it is convenient to have everything in the transcript file -% and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. We also make -% some effort to order the tracing commands to reduce output in the log -% file; cf. trace.sty in LaTeX. -% -\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\def\loggingall{% - \tracingstats2 - \tracingpages1 - \tracinglostchars2 % 2 gives us more in etex - \tracingparagraphs1 - \tracingoutput1 - \tracingmacros2 - \tracingrestores1 - \showboxbreadth\maxdimen \showboxdepth\maxdimen - \ifx\eTeXversion\undefined\else % etex gives us more logging - \tracingscantokens1 - \tracingifs1 - \tracinggroups1 - \tracingnesting2 - \tracingassigns1 - \fi - \tracingcommands3 % 3 gives us more in etex - \errorcontextlines16 -}% - -% add check for \lastpenalty to plain's definitions. If the last thing -% we did was a \nobreak, we don't want to insert more space. -% -\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount - \removelastskip\penalty-50\smallskip\fi\fi} -\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount - \removelastskip\penalty-100\medskip\fi\fi} -\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount - \removelastskip\penalty-200\bigskip\fi\fi} - -% For @cropmarks command. -% Do @cropmarks to get crop marks. -% -\newif\ifcropmarks -\let\cropmarks = \cropmarkstrue -% -% Dimensions to add cropmarks at corners. -% Added by P. A. MacKay, 12 Nov. 1986 -% -\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines -\newdimen\cornerlong \cornerlong=1pc -\newdimen\cornerthick \cornerthick=.3pt -\newdimen\topandbottommargin \topandbottommargin=.75in - -% Main output routine. -\chardef\PAGE = 255 -\output = {\onepageout{\pagecontents\PAGE}} - -\newbox\headlinebox -\newbox\footlinebox - -% \onepageout takes a vbox as an argument. Note that \pagecontents -% does insertions, but you have to call it yourself. -\def\onepageout#1{% - \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi - % - \ifodd\pageno \advance\hoffset by \bindingoffset - \else \advance\hoffset by -\bindingoffset\fi - % - % Do this outside of the \shipout so @code etc. will be expanded in - % the headline as they should be, not taken literally (outputting ''code). - \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% - \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% - % - {% - % Have to do this stuff outside the \shipout because we want it to - % take effect in \write's, yet the group defined by the \vbox ends - % before the \shipout runs. - % - \indexdummies % don't expand commands in the output. - \normalturnoffactive % \ in index entries must not stay \, e.g., if - % the page break happens to be in the middle of an example. - % We don't want .vr (or whatever) entries like this: - % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} - % "\acronym" won't work when it's read back in; - % it needs to be - % {\code {{\tt \backslashcurfont }acronym} - \shipout\vbox{% - % Do this early so pdf references go to the beginning of the page. - \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi - % - \ifcropmarks \vbox to \outervsize\bgroup - \hsize = \outerhsize - \vskip-\topandbottommargin - \vtop to0pt{% - \line{\ewtop\hfil\ewtop}% - \nointerlineskip - \line{% - \vbox{\moveleft\cornerthick\nstop}% - \hfill - \vbox{\moveright\cornerthick\nstop}% - }% - \vss}% - \vskip\topandbottommargin - \line\bgroup - \hfil % center the page within the outer (page) hsize. - \ifodd\pageno\hskip\bindingoffset\fi - \vbox\bgroup - \fi - % - \unvbox\headlinebox - \pagebody{#1}% - \ifdim\ht\footlinebox > 0pt - % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) - % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip - \unvbox\footlinebox - \fi - % - \ifcropmarks - \egroup % end of \vbox\bgroup - \hfil\egroup % end of (centering) \line\bgroup - \vskip\topandbottommargin plus1fill minus1fill - \boxmaxdepth = \cornerthick - \vbox to0pt{\vss - \line{% - \vbox{\moveleft\cornerthick\nsbot}% - \hfill - \vbox{\moveright\cornerthick\nsbot}% - }% - \nointerlineskip - \line{\ewbot\hfil\ewbot}% - }% - \egroup % \vbox from first cropmarks clause - \fi - }% end of \shipout\vbox - }% end of group with \indexdummies - \advancepageno - \ifnum\outputpenalty>-20000 \else\dosupereject\fi -} - -\newinsert\margin \dimen\margin=\maxdimen - -\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} -{\catcode`\@ =11 -\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi -% marginal hacks, juha@viisa.uucp (Juha Takala) -\ifvoid\margin\else % marginal info is present - \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 -\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi -\ifr@ggedbottom \kern-\dimen@ \vfil \fi} -} - -% Here are the rules for the cropmarks. Note that they are -% offset so that the space between them is truly \outerhsize or \outervsize -% (P. A. MacKay, 12 November, 1986) -% -\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} -\def\nstop{\vbox - {\hrule height\cornerthick depth\cornerlong width\cornerthick}} -\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} -\def\nsbot{\vbox - {\hrule height\cornerlong depth\cornerthick width\cornerthick}} - -% Parse an argument, then pass it to #1. The argument is the rest of -% the input line (except we remove a trailing comment). #1 should be a -% macro which expects an ordinary undelimited TeX argument. -% -\def\parsearg{\parseargusing{}} -\def\parseargusing#1#2{% - \def\next{#2}% - \begingroup - \obeylines - \spaceisspace - #1% - \parseargline\empty% Insert the \empty token, see \finishparsearg below. -} - -{\obeylines % - \gdef\parseargline#1^^M{% - \endgroup % End of the group started in \parsearg. - \argremovecomment #1\comment\ArgTerm% - }% -} - -% First remove any @comment, then any @c comment. -\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} -\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} - -% Each occurence of `\^^M' or `\^^M' is replaced by a single space. -% -% \argremovec might leave us with trailing space, e.g., -% @end itemize @c foo -% This space token undergoes the same procedure and is eventually removed -% by \finishparsearg. -% -\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} -\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} -\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% - \def\temp{#3}% - \ifx\temp\empty - % We cannot use \next here, as it holds the macro to run; - % thus we reuse \temp. - \let\temp\finishparsearg - \else - \let\temp\argcheckspaces - \fi - % Put the space token in: - \temp#1 #3\ArgTerm -} - -% If a _delimited_ argument is enclosed in braces, they get stripped; so -% to get _exactly_ the rest of the line, we had to prevent such situation. -% We prepended an \empty token at the very beginning and we expand it now, -% just before passing the control to \next. -% (Similarily, we have to think about #3 of \argcheckspacesY above: it is -% either the null string, or it ends with \^^M---thus there is no danger -% that a pair of braces would be stripped. -% -% But first, we have to remove the trailing space token. -% -\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} - -% \parseargdef\foo{...} -% is roughly equivalent to -% \def\foo{\parsearg\Xfoo} -% \def\Xfoo#1{...} -% -% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my -% favourite TeX trick. --kasal, 16nov03 - -\def\parseargdef#1{% - \expandafter \doparseargdef \csname\string#1\endcsname #1% -} -\def\doparseargdef#1#2{% - \def#2{\parsearg#1}% - \def#1##1% -} - -% Several utility definitions with active space: -{ - \obeyspaces - \gdef\obeyedspace{ } - - % Make each space character in the input produce a normal interword - % space in the output. Don't allow a line break at this space, as this - % is used only in environments like @example, where each line of input - % should produce a line of output anyway. - % - \gdef\sepspaces{\obeyspaces\let =\tie} - - % If an index command is used in an @example environment, any spaces - % therein should become regular spaces in the raw index file, not the - % expansion of \tie (\leavevmode \penalty \@M \ ). - \gdef\unsepspaces{\let =\space} -} - - -\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} - -% Define the framework for environments in texinfo.tex. It's used like this: -% -% \envdef\foo{...} -% \def\Efoo{...} -% -% It's the responsibility of \envdef to insert \begingroup before the -% actual body; @end closes the group after calling \Efoo. \envdef also -% defines \thisenv, so the current environment is known; @end checks -% whether the environment name matches. The \checkenv macro can also be -% used to check whether the current environment is the one expected. -% -% Non-false conditionals (@iftex, @ifset) don't fit into this, so they -% are not treated as enviroments; they don't open a group. (The -% implementation of @end takes care not to call \endgroup in this -% special case.) - - -% At runtime, environments start with this: -\def\startenvironment#1{\begingroup\def\thisenv{#1}} -% initialize -\let\thisenv\empty - -% ... but they get defined via ``\envdef\foo{...}'': -\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} -\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} - -% Check whether we're in the right environment: -\def\checkenv#1{% - \def\temp{#1}% - \ifx\thisenv\temp - \else - \badenverr - \fi -} - -% Evironment mismatch, #1 expected: -\def\badenverr{% - \errhelp = \EMsimple - \errmessage{This command can appear only \inenvironment\temp, - not \inenvironment\thisenv}% -} -\def\inenvironment#1{% - \ifx#1\empty - out of any environment% - \else - in environment \expandafter\string#1% - \fi -} - -% @end foo executes the definition of \Efoo. -% But first, it executes a specialized version of \checkenv -% -\parseargdef\end{% - \if 1\csname iscond.#1\endcsname - \else - % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 - \expandafter\checkenv\csname#1\endcsname - \csname E#1\endcsname - \endgroup - \fi -} - -\newhelp\EMsimple{Press RETURN to continue.} - - -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce \{ and \} commands for indices, - % and @{ and @} for the aux/toc files. - \catcode`\{ = \other \catcode`\} = \other - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\! = 0 \catcode`\\ = \other - !gdef!lbracecmd[\{]% - !gdef!rbracecmd[\}]% - !gdef!lbraceatcmd[@{]% - !gdef!rbraceatcmd[@}]% -!endgroup - -% @comma{} to avoid , parsing problems. -\let\comma = , - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown @ordf @ordm -% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} -\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} -\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% The \TeX{} logo, as in plain, but resetting the spacing so that a -% period following counts as ending a sentence. (Idea found in latex.) -% -\edef\TeX{\TeX \spacefactor=1000 } - -% @LaTeX{} logo. Not quite the same results as the definition in -% latex.ltx, since we use a different font for the raised A; it's most -% convenient for us to use an explicitly smaller font, rather than using -% the \scriptstyle font (since we don't reset \scriptstyle and -% \scriptscriptstyle). -% -\def\LaTeX{% - L\kern-.36em - {\setbox0=\hbox{T}% - \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% - \kern-.15em - \TeX -} - -% Be sure we're in horizontal mode when doing a tie, since we make space -% equivalent to this in @example-like environments. Otherwise, a space -% at the beginning of a line will start with \penalty -- and -% since \penalty is valid in vertical mode, we'd end up putting the -% penalty on the vertical list instead of in the new paragraph. -{\catcode`@ = 11 - % Avoid using \@M directly, because that causes trouble - % if the definition is written into an index file. - \global\let\tiepenalty = \@M - \gdef\tie{\leavevmode\penalty\tiepenalty\ } -} - -% @: forces normal size whitespace following. -\def\:{\spacefactor=1000 } - -% @* forces a line break. -\def\*{\hfil\break\hbox{}\ignorespaces} - -% @/ allows a line break. -\let\/=\allowbreak - -% @. is an end-of-sentence period. -\def\.{.\spacefactor=\endofsentencespacefactor\space} - -% @! is an end-of-sentence bang. -\def\!{!\spacefactor=\endofsentencespacefactor\space} - -% @? is an end-of-sentence query. -\def\?{?\spacefactor=\endofsentencespacefactor\space} - -% @frenchspacing on|off says whether to put extra space after punctuation. -% -\def\onword{on} -\def\offword{off} -% -\parseargdef\frenchspacing{% - \def\temp{#1}% - \ifx\temp\onword \plainfrenchspacing - \else\ifx\temp\offword \plainnonfrenchspacing - \else - \errhelp = \EMsimple - \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% - \fi\fi -} - -% @w prevents a word break. Without the \leavevmode, @w at the -% beginning of a paragraph, when TeX is still in vertical mode, would -% produce a whole line of output instead of starting the paragraph. -\def\w#1{\leavevmode\hbox{#1}} - -% @group ... @end group forces ... to be all on one page, by enclosing -% it in a TeX vbox. We use \vtop instead of \vbox to construct the box -% to keep its height that of a normal line. According to the rules for -% \topskip (p.114 of the TeXbook), the glue inserted is -% max (\topskip - \ht (first item), 0). If that height is large, -% therefore, no glue is inserted, and the space between the headline and -% the text is small, which looks bad. -% -% Another complication is that the group might be very large. This can -% cause the glue on the previous page to be unduly stretched, because it -% does not have much material. In this case, it's better to add an -% explicit \vfill so that the extra space is at the bottom. The -% threshold for doing this is if the group is more than \vfilllimit -% percent of a page (\vfilllimit can be changed inside of @tex). -% -\newbox\groupbox -\def\vfilllimit{0.7} -% -\envdef\group{% - \ifnum\catcode`\^^M=\active \else - \errhelp = \groupinvalidhelp - \errmessage{@group invalid in context where filling is enabled}% - \fi - \startsavinginserts - % - \setbox\groupbox = \vtop\bgroup - % Do @comment since we are called inside an environment such as - % @example, where each end-of-line in the input causes an - % end-of-line in the output. We don't want the end-of-line after - % the `@group' to put extra space in the output. Since @group - % should appear on a line by itself (according to the Texinfo - % manual), we don't worry about eating any user text. - \comment -} -% -% The \vtop produces a box with normal height and large depth; thus, TeX puts -% \baselineskip glue before it, and (when the next line of text is done) -% \lineskip glue after it. Thus, space below is not quite equal to space -% above. But it's pretty close. -\def\Egroup{% - % To get correct interline space between the last line of the group - % and the first line afterwards, we have to propagate \prevdepth. - \endgraf % Not \par, as it may have been set to \lisppar. - \global\dimen1 = \prevdepth - \egroup % End the \vtop. - % \dimen0 is the vertical size of the group's box. - \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox - % \dimen2 is how much space is left on the page (more or less). - \dimen2 = \pageheight \advance\dimen2 by -\pagetotal - % if the group doesn't fit on the current page, and it's a big big - % group, force a page break. - \ifdim \dimen0 > \dimen2 - \ifdim \pagetotal < \vfilllimit\pageheight - \page - \fi - \fi - \box\groupbox - \prevdepth = \dimen1 - \checkinserts -} -% -% TeX puts in an \escapechar (i.e., `@') at the beginning of the help -% message, so this ends up printing `@group can only ...'. -% -\newhelp\groupinvalidhelp{% -group can only be used in environments such as @example,^^J% -where each line of input produces a line of output.} - -% @need space-in-mils -% forces a page break if there is not space-in-mils remaining. - -\newdimen\mil \mil=0.001in - -% Old definition--didn't work. -%\parseargdef\need{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - -\parseargdef\need{% - % Ensure vertical mode, so we don't make a big box in the middle of a - % paragraph. - \par - % - % If the @need value is less than one line space, it's useless. - \dimen0 = #1\mil - \dimen2 = \ht\strutbox - \advance\dimen2 by \dp\strutbox - \ifdim\dimen0 > \dimen2 - % - % Do a \strut just to make the height of this box be normal, so the - % normal leading is inserted relative to the preceding line. - % And a page break here is fine. - \vtop to #1\mil{\strut\vfil}% - % - % TeX does not even consider page breaks if a penalty added to the - % main vertical list is 10000 or more. But in order to see if the - % empty box we just added fits on the page, we must make it consider - % page breaks. On the other hand, we don't want to actually break the - % page after the empty box. So we use a penalty of 9999. - % - % There is an extremely small chance that TeX will actually break the - % page at this \penalty, if there are no other feasible breakpoints in - % sight. (If the user is using lots of big @group commands, which - % almost-but-not-quite fill up a page, TeX will have a hard time doing - % good page breaking, for example.) However, I could not construct an - % example where a page broke at this \penalty; if it happens in a real - % document, then we can reconsider our strategy. - \penalty9999 - % - % Back up by the size of the box, whether we did a page break or not. - \kern -#1\mil - % - % Do not allow a page break right after this kern. - \nobreak - \fi -} - -% @br forces paragraph break (and is undocumented). - -\let\br = \par - -% @page forces the start of a new page. -% -\def\page{\par\vfill\supereject} - -% @exdent text.... -% outputs text on separate line in roman font, starting at standard page margin - -% This records the amount of indent in the innermost environment. -% That's how much \exdent should take out. -\newskip\exdentamount - -% This defn is used inside fill environments such as @defun. -\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} - -% This defn is used inside nofill environments such as @example. -\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount - \leftline{\hskip\leftskip{\rm#1}}}} - -% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current -% paragraph. For more general purposes, use the \margin insertion -% class. WHICH is `l' or `r'. -% -\newskip\inmarginspacing \inmarginspacing=1cm -\def\strutdepth{\dp\strutbox} -% -\def\doinmargin#1#2{\strut\vadjust{% - \nobreak - \kern-\strutdepth - \vtop to \strutdepth{% - \baselineskip=\strutdepth - \vss - % if you have multiple lines of stuff to put here, you'll need to - % make the vbox yourself of the appropriate size. - \ifx#1l% - \llap{\ignorespaces #2\hskip\inmarginspacing}% - \else - \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% - \fi - \null - }% -}} -\def\inleftmargin{\doinmargin l} -\def\inrightmargin{\doinmargin r} -% -% @inmargin{TEXT [, RIGHT-TEXT]} -% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; -% else use TEXT for both). -% -\def\inmargin#1{\parseinmargin #1,,\finish} -\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \def\lefttext{#1}% have both texts - \def\righttext{#2}% - \else - \def\lefttext{#1}% have only one text - \def\righttext{#1}% - \fi - % - \ifodd\pageno - \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin - \else - \def\temp{\inleftmargin\lefttext}% - \fi - \temp -} - -% @include file insert text of that file as input. -% -\def\include{\parseargusing\filenamecatcodes\includezzz} -\def\includezzz#1{% - \pushthisfilestack - \def\thisfile{#1}% - {% - \makevalueexpandable - \def\temp{\input #1 }% - \expandafter - }\temp - \popthisfilestack -} -\def\filenamecatcodes{% - \catcode`\\=\other - \catcode`~=\other - \catcode`^=\other - \catcode`_=\other - \catcode`|=\other - \catcode`<=\other - \catcode`>=\other - \catcode`+=\other - \catcode`-=\other -} - -\def\pushthisfilestack{% - \expandafter\pushthisfilestackX\popthisfilestack\StackTerm -} -\def\pushthisfilestackX{% - \expandafter\pushthisfilestackY\thisfile\StackTerm -} -\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% - \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% -} - -\def\popthisfilestack{\errthisfilestackempty} -\def\errthisfilestackempty{\errmessage{Internal error: - the stack of filenames is empty.}} - -\def\thisfile{} - -% @center line -% outputs that line, centered. -% -\parseargdef\center{% - \ifhmode - \let\next\centerH - \else - \let\next\centerV - \fi - \next{\hfil \ignorespaces#1\unskip \hfil}% -} -\def\centerH#1{% - {% - \hfil\break - \advance\hsize by -\leftskip - \advance\hsize by -\rightskip - \line{#1}% - \break - }% -} -\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} - -% @sp n outputs n lines of vertical space - -\parseargdef\sp{\vskip #1\baselineskip} - -% @comment ...line which is ignored... -% @c is the same as @comment -% @ignore ... @end ignore is another way to write a comment - -\def\comment{\begingroup \catcode`\^^M=\other% -\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% -\commentxxx} -{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - -\let\c=\comment - -% @paragraphindent NCHARS -% We'll use ems for NCHARS, close enough. -% NCHARS can also be the word `asis' or `none'. -% We cannot feasibly implement @paragraphindent asis, though. -% -\def\asisword{asis} % no translation, these are keywords -\def\noneword{none} -% -\parseargdef\paragraphindent{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \defaultparindent = 0pt - \else - \defaultparindent = #1em - \fi - \fi - \parindent = \defaultparindent -} - -% @exampleindent NCHARS -% We'll use ems for NCHARS like @paragraphindent. -% It seems @exampleindent asis isn't necessary, but -% I preserve it to make it similar to @paragraphindent. -\parseargdef\exampleindent{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \lispnarrowing = 0pt - \else - \lispnarrowing = #1em - \fi - \fi -} - -% @firstparagraphindent WORD -% If WORD is `none', then suppress indentation of the first paragraph -% after a section heading. If WORD is `insert', then do indent at such -% paragraphs. -% -% The paragraph indentation is suppressed or not by calling -% \suppressfirstparagraphindent, which the sectioning commands do. -% We switch the definition of this back and forth according to WORD. -% By default, we suppress indentation. -% -\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} -\def\insertword{insert} -% -\parseargdef\firstparagraphindent{% - \def\temp{#1}% - \ifx\temp\noneword - \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent - \else\ifx\temp\insertword - \let\suppressfirstparagraphindent = \relax - \else - \errhelp = \EMsimple - \errmessage{Unknown @firstparagraphindent option `\temp'}% - \fi\fi -} - -% Here is how we actually suppress indentation. Redefine \everypar to -% \kern backwards by \parindent, and then reset itself to empty. -% -% We also make \indent itself not actually do anything until the next -% paragraph. -% -\gdef\dosuppressfirstparagraphindent{% - \gdef\indent{% - \restorefirstparagraphindent - \indent - }% - \gdef\noindent{% - \restorefirstparagraphindent - \noindent - }% - \global\everypar = {% - \kern -\parindent - \restorefirstparagraphindent - }% -} - -\gdef\restorefirstparagraphindent{% - \global \let \indent = \ptexindent - \global \let \noindent = \ptexnoindent - \global \everypar = {}% -} - - -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math outputs its argument in math mode. -% -% One complication: _ usually means subscripts, but it could also mean -% an actual _ character, as in @math{@var{some_variable} + 1}. So make -% _ active, and distinguish by seeing if the current family is \slfam, -% which is what @var uses. -{ - \catcode`\_ = \active - \gdef\mathunderscore{% - \catcode`\_=\active - \def_{\ifnum\fam=\slfam \_\else\sb\fi}% - } -} -% Another complication: we want \\ (and @\) to output a \ character. -% FYI, plain.tex uses \\ as a temporary control sequence (why?), but -% this is not advertised and we don't care. Texinfo does not -% otherwise define @\. -% -% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. -\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} -% -\def\math{% - \tex - \mathunderscore - \let\\ = \mathbackslash - \mathactive - $\finishmath -} -\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. - -% Some active characters (such as <) are spaced differently in math. -% We have to reset their definitions in case the @math was an argument -% to a command which sets the catcodes (such as @item or @section). -% -{ - \catcode`^ = \active - \catcode`< = \active - \catcode`> = \active - \catcode`+ = \active - \gdef\mathactive{% - \let^ = \ptexhat - \let< = \ptexless - \let> = \ptexgtr - \let+ = \ptexplus - } -} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{$\ptexbullet$} -\def\minus{$-$} - -% @dots{} outputs an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil - .\hfil.\hfil.% - \hskip 0pt plus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \dots - \spacefactor=\endofsentencespacefactor -} - -% @comma{} is so commas can be inserted into text without messing up -% Texinfo's parsing. -% -\let\comma = , - -% @refill is a no-op. -\let\refill=\relax - -% If working on a large document in chapters, it is convenient to -% be able to disable indexing, cross-referencing, and contents, for test runs. -% This is done with @novalidate (before @setfilename). -% -\newif\iflinks \linkstrue % by default we want the aux files. -\let\novalidate = \linksfalse - -% @setfilename is done at the beginning of every texinfo file. -% So open here the files we need to have open while reading the input. -% This makes it possible to make a .fmt file for texinfo. -\def\setfilename{% - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \iflinks - \tryauxfile - % Open the new aux file. TeX will close it automatically at exit. - \immediate\openout\auxfile=\jobname.aux - \fi % \openindices needs to do some work in any case. - \openindices - \let\setfilename=\comment % Ignore extra @setfilename cmds. - % - % If texinfo.cnf is present on the system, read it. - % Useful for site-wide @afourpaper, etc. - \openin 1 texinfo.cnf - \ifeof 1 \else \input texinfo.cnf \fi - \closein 1 - % - \comment % Ignore the actual filename. -} - -% Called from \setfilename. -% -\def\openindices{% - \newindex{cp}% - \newcodeindex{fn}% - \newcodeindex{vr}% - \newcodeindex{tp}% - \newcodeindex{ky}% - \newcodeindex{pg}% -} - -% @bye. -\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} - - -\message{pdf,} -% adobe `portable' document format -\newcount\tempnum -\newcount\lnkcount -\newtoks\filename -\newcount\filenamelength -\newcount\pgn -\newtoks\toksA -\newtoks\toksB -\newtoks\toksC -\newtoks\toksD -\newbox\boxA -\newcount\countA -\newif\ifpdf -\newif\ifpdfmakepagedest - -% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 -% can be set). So we test for \relax and 0 as well as \undefined, -% borrowed from ifpdf.sty. -\ifx\pdfoutput\undefined -\else - \ifx\pdfoutput\relax - \else - \ifcase\pdfoutput - \else - \pdftrue - \fi - \fi -\fi - -% PDF uses PostScript string constants for the names of xref targets, -% for display in the outlines, and in other places. Thus, we have to -% double any backslashes. Otherwise, a name like "\node" will be -% interpreted as a newline (\n), followed by o, d, e. Not good. -% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html -% (and related messages, the final outcome is that it is up to the TeX -% user to double the backslashes and otherwise make the string valid, so -% that's what we do). - -% double active backslashes. -% -{\catcode`\@=0 \catcode`\\=\active - @gdef@activebackslashdouble{% - @catcode`@\=@active - @let\=@doublebackslash} -} - -% To handle parens, we must adopt a different approach, since parens are -% not active characters. hyperref.dtx (which has the same problem as -% us) handles it with this amazing macro to replace tokens. I've -% tinkered with it a little for texinfo, but it's definitely from there. -% -% #1 is the tokens to replace. -% #2 is the replacement. -% #3 is the control sequence with the string. -% -\def\HyPsdSubst#1#2#3{% - \def\HyPsdReplace##1#1##2\END{% - ##1% - \ifx\\##2\\% - \else - #2% - \HyReturnAfterFi{% - \HyPsdReplace##2\END - }% - \fi - }% - \xdef#3{\expandafter\HyPsdReplace#3#1\END}% -} -\long\def\HyReturnAfterFi#1\fi{\fi#1} - -% #1 is a control sequence in which to do the replacements. -\def\backslashparens#1{% - \xdef#1{#1}% redefine it as its expansion; the definition is simply - % \lastnode when called from \setref -> \pdfmkdest. - \HyPsdSubst{(}{\realbackslash(}{#1}% - \HyPsdSubst{)}{\realbackslash)}{#1}% -} - -\ifpdf - \input pdfcolor - \pdfcatalog{/PageMode /UseOutlines}% - \def\dopdfimage#1#2#3{% - \def\imagewidth{#2}% - \def\imageheight{#3}% - % without \immediate, pdftex seg faults when the same image is - % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) - \ifnum\pdftexversion < 14 - \immediate\pdfimage - \else - \immediate\pdfximage - \fi - \ifx\empty\imagewidth\else width \imagewidth \fi - \ifx\empty\imageheight\else height \imageheight \fi - \ifnum\pdftexversion<13 - #1.pdf% - \else - {#1.pdf}% - \fi - \ifnum\pdftexversion < 14 \else - \pdfrefximage \pdflastximage - \fi} - \def\pdfmkdest#1{{% - % We have to set dummies so commands such as @code, and characters - % such as \, aren't expanded when present in a section title. - \atdummies - \activebackslashdouble - \def\pdfdestname{#1}% - \backslashparens\pdfdestname - \pdfdest name{\pdfdestname} xyz% - }}% - % - % used to mark target names; must be expandable. - \def\pdfmkpgn#1{#1}% - % - \let\linkcolor = \Blue % was Cyan, but that seems light? - \def\endlink{\Black\pdfendlink} - % Adding outlines to PDF; macros for calculating structure of outlines - % come from Petr Olsak - \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% - \else \csname#1\endcsname \fi} - \def\advancenumber#1{\tempnum=\expnumber{#1}\relax - \advance\tempnum by 1 - \expandafter\xdef\csname#1\endcsname{\the\tempnum}} - % - % #1 is the section text, which is what will be displayed in the - % outline by the pdf viewer. #2 is the pdf expression for the number - % of subentries (or empty, for subsubsections). #3 is the node text, - % which might be empty if this toc entry had no corresponding node. - % #4 is the page number - % - \def\dopdfoutline#1#2#3#4{% - % Generate a link to the node text if that exists; else, use the - % page number. We could generate a destination for the section - % text in the case where a section has no node, but it doesn't - % seem worth the trouble, since most documents are normally structured. - \def\pdfoutlinedest{#3}% - \ifx\pdfoutlinedest\empty - \def\pdfoutlinedest{#4}% - \else - % Doubled backslashes in the name. - {\activebackslashdouble \xdef\pdfoutlinedest{#3}% - \backslashparens\pdfoutlinedest}% - \fi - % - % Also double the backslashes in the display string. - {\activebackslashdouble \xdef\pdfoutlinetext{#1}% - \backslashparens\pdfoutlinetext}% - % - \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% - } - % - \def\pdfmakeoutlines{% - \begingroup - % Thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % - % Read toc silently, to get counts of subentries for \pdfoutline. - \def\numchapentry##1##2##3##4{% - \def\thischapnum{##2}% - \def\thissecnum{0}% - \def\thissubsecnum{0}% - }% - \def\numsecentry##1##2##3##4{% - \advancenumber{chap\thischapnum}% - \def\thissecnum{##2}% - \def\thissubsecnum{0}% - }% - \def\numsubsecentry##1##2##3##4{% - \advancenumber{sec\thissecnum}% - \def\thissubsecnum{##2}% - }% - \def\numsubsubsecentry##1##2##3##4{% - \advancenumber{subsec\thissubsecnum}% - }% - \def\thischapnum{0}% - \def\thissecnum{0}% - \def\thissubsecnum{0}% - % - % use \def rather than \let here because we redefine \chapentry et - % al. a second time, below. - \def\appentry{\numchapentry}% - \def\appsecentry{\numsecentry}% - \def\appsubsecentry{\numsubsecentry}% - \def\appsubsubsecentry{\numsubsubsecentry}% - \def\unnchapentry{\numchapentry}% - \def\unnsecentry{\numsecentry}% - \def\unnsubsecentry{\numsubsecentry}% - \def\unnsubsubsecentry{\numsubsubsecentry}% - \readdatafile{toc}% - % - % Read toc second time, this time actually producing the outlines. - % The `-' means take the \expnumber as the absolute number of - % subentries, which we calculated on our first read of the .toc above. - % - % We use the node names as the destinations. - \def\numchapentry##1##2##3##4{% - \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% - \def\numsecentry##1##2##3##4{% - \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% - \def\numsubsecentry##1##2##3##4{% - \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% - \def\numsubsubsecentry##1##2##3##4{% count is always zero - \dopdfoutline{##1}{}{##3}{##4}}% - % - % PDF outlines are displayed using system fonts, instead of - % document fonts. Therefore we cannot use special characters, - % since the encoding is unknown. For example, the eogonek from - % Latin 2 (0xea) gets translated to a | character. Info from - % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. - % - % xx to do this right, we have to translate 8-bit characters to - % their "best" equivalent, based on the @documentencoding. Right - % now, I guess we'll just let the pdf reader have its way. - \indexnofonts - \setupdatafile - \catcode`\\=\active \otherbackslash - \input \jobname.toc - \endgroup - } - % - \def\skipspaces#1{\def\PP{#1}\def\D{|}% - \ifx\PP\D\let\nextsp\relax - \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% - \advance\filenamelength by 1 - \fi - \fi - \nextsp} - \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} - \ifnum\pdftexversion < 14 - \let \startlink \pdfannotlink - \else - \let \startlink \pdfstartlink - \fi - % make a live url in pdf output. - \def\pdfurl#1{% - \begingroup - % it seems we really need yet another set of dummies; have not - % tried to figure out what each command should do in the context - % of @url. for now, just make @/ a no-op, that's the only one - % people have actually reported a problem with. - % - \normalturnoffactive - \def\@{@}% - \let\/=\empty - \makevalueexpandable - \leavevmode\Red - \startlink attr{/Border [0 0 0]}% - user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - \endgroup} - \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} - \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} - \def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS|\relax - \ifx\first0\adn0 - \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 - \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 - \else - \ifnum0=\countA\else\makelink\fi - \ifx\first.\let\next=\done\else - \let\next=\maketoks - \addtokens{\toksB}{\the\toksD} - \ifx\first,\addtokens{\toksB}{\space}\fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next} - \def\makelink{\addtokens{\toksB}% - {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} - \def\pdflink#1{% - \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} - \linkcolor #1\endlink} - \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\else - \let\pdfmkdest = \gobble - \let\pdfurl = \gobble - \let\endlink = \relax - \let\linkcolor = \relax - \let\pdfmakeoutlines = \relax -\fi % \ifx\pdfoutput - - -\message{fonts,} - -% Change the current font style to #1, remembering it in \curfontstyle. -% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in -% italics, not bold italics. -% -\def\setfontstyle#1{% - \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. - \csname ten#1\endcsname % change the current font -} - -% Select #1 fonts with the current style. -% -\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} - -\def\rm{\fam=0 \setfontstyle{rm}} -\def\it{\fam=\itfam \setfontstyle{it}} -\def\sl{\fam=\slfam \setfontstyle{sl}} -\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} -\def\tt{\fam=\ttfam \setfontstyle{tt}} - -% Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf. -\newfam\sffam -\def\sf{\fam=\sffam \setfontstyle{sf}} -\let\li = \sf % Sometimes we call it \li, not \sf. - -% We don't need math for this font style. -\def\ttsl{\setfontstyle{ttsl}} - -% Default leading. -\newdimen\textleading \textleading = 13.2pt - -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. -% -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} -% -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% -} - -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} - -% Use cm as the default font prefix. -% To specify the font prefix, you must define \fontprefix -% before you read in texinfo.tex. -\ifx\fontprefix\undefined -\def\fontprefix{cm} -\fi -% Support font families that don't use the same naming scheme as CM. -\def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold -\def\bfshape{b} -\def\bxshape{bx} -\def\ttshape{tt} -\def\ttbshape{tt} -\def\ttslshape{sltt} -\def\itshape{ti} -\def\itbshape{bxti} -\def\slshape{sl} -\def\slbshape{bxsl} -\def\sfshape{ss} -\def\sfbshape{ss} -\def\scshape{csc} -\def\scbshape{csc} - -% Text fonts (11.2pt, magstep1). -\def\textnominalsize{11pt} -\edef\mainmagstep{\magstephalf} -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} -\font\texti=cmmi10 scaled \mainmagstep -\font\textsy=cmsy10 scaled \mainmagstep - -% A few fonts for @defun names and args. -\setfont\defbf\bfshape{10}{\magstep1} -\setfont\deftt\ttshape{10}{\magstep1} -\setfont\defttsl\ttslshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} - -% Fonts for indices, footnotes, small examples (9pt). -\def\smallnominalsize{9pt} -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} -\font\smalli=cmmi9 -\font\smallsy=cmsy9 - -% Fonts for small examples (8pt). -\def\smallernominalsize{8pt} -\setfont\smallerrm\rmshape{8}{1000} -\setfont\smallertt\ttshape{8}{1000} -\setfont\smallerbf\bfshape{10}{800} -\setfont\smallerit\itshape{8}{1000} -\setfont\smallersl\slshape{8}{1000} -\setfont\smallersf\sfshape{8}{1000} -\setfont\smallersc\scshape{10}{800} -\setfont\smallerttsl\ttslshape{10}{800} -\font\smalleri=cmmi8 -\font\smallersy=cmsy8 - -% Fonts for title page (20.4pt): -\def\titlenominalsize{20pt} -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} -\let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} -\font\titlei=cmmi12 scaled \magstep3 -\font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} -\def\authortt{\sectt} - -% Chapter (and unnumbered) fonts (17.28pt). -\def\chapnominalsize{17pt} -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} -\let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} -\font\chapi=cmmi12 scaled \magstep2 -\font\chapsy=cmsy10 scaled \magstep3 - -% Section fonts (14.4pt). -\def\secnominalsize{14pt} -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} -\let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} -\font\seci=cmmi12 scaled \magstep1 -\font\secsy=cmsy10 scaled \magstep2 - -% Subsection fonts (13.15pt). -\def\ssecnominalsize{13pt} -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} -\let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{1315} -\font\sseci=cmmi12 scaled \magstephalf -\font\ssecsy=cmsy10 scaled 1315 - -% Reduced fonts for @acro in text (10pt). -\def\reducednominalsize{10pt} -\setfont\reducedrm\rmshape{10}{1000} -\setfont\reducedtt\ttshape{10}{1000} -\setfont\reducedbf\bfshape{10}{1000} -\setfont\reducedit\itshape{10}{1000} -\setfont\reducedsl\slshape{10}{1000} -\setfont\reducedsf\sfshape{10}{1000} -\setfont\reducedsc\scshape{10}{1000} -\setfont\reducedttsl\ttslshape{10}{1000} -\font\reducedi=cmmi10 -\font\reducedsy=cmsy10 - -% In order for the font changes to affect most math symbols and letters, -% we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts except -% in the main text, we don't bother to reset \scriptfont and -% \scriptscriptfont (which would also require loading a lot more fonts). -% -\def\resetmathfonts{% - \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy - \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf - \textfont\ttfam=\tentt \textfont\sffam=\tensf -} - -% The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this because \STYLE needs to also set the -% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire -% \tenSTYLE to set the current font. -% -% Each font-changing command also sets the names \lsize (one size lower) -% and \lllsize (three sizes lower). These relative commands are used in -% the LaTeX logo and acronyms. -% -% This all needs generalizing, badly. -% -\def\textfonts{% - \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl - \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy - \let\tenttsl=\textttsl - \def\curfontsize{text}% - \def\lsize{reduced}\def\lllsize{smaller}% - \resetmathfonts \setleading{\textleading}} -\def\titlefonts{% - \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl - \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc - \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy - \let\tenttsl=\titlettsl - \def\curfontsize{title}% - \def\lsize{chap}\def\lllsize{subsec}% - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} -\def\chapfonts{% - \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl - \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy - \let\tenttsl=\chapttsl - \def\curfontsize{chap}% - \def\lsize{sec}\def\lllsize{text}% - \resetmathfonts \setleading{19pt}} -\def\secfonts{% - \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl - \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy - \let\tenttsl=\secttsl - \def\curfontsize{sec}% - \def\lsize{subsec}\def\lllsize{reduced}% - \resetmathfonts \setleading{16pt}} -\def\subsecfonts{% - \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl - \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy - \let\tenttsl=\ssecttsl - \def\curfontsize{ssec}% - \def\lsize{text}\def\lllsize{small}% - \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts -\def\reducedfonts{% - \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl - \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc - \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy - \let\tenttsl=\reducedttsl - \def\curfontsize{reduced}% - \def\lsize{small}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallfonts{% - \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl - \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc - \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy - \let\tenttsl=\smallttsl - \def\curfontsize{small}% - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallerfonts{% - \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl - \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc - \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy - \let\tenttsl=\smallerttsl - \def\curfontsize{smaller}% - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{9.5pt}} - -% Set the fonts to use with the @small... environments. -\let\smallexamplefonts = \smallfonts - -% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample -% can fit this many characters: -% 8.5x11=86 smallbook=72 a4=90 a5=69 -% If we use \scriptfonts (8pt), then we can fit this many characters: -% 8.5x11=90+ smallbook=80 a4=90+ a5=77 -% For me, subjectively, the few extra characters that fit aren't worth -% the additional smallness of 8pt. So I'm making the default 9pt. -% -% By the way, for comparison, here's what fits with @example (10pt): -% 8.5x11=71 smallbook=60 a4=75 a5=58 -% -% I wish the USA used A4 paper. -% --karl, 24jan03. - - -% Set up the default fonts, so we can use them for creating boxes. -% -\textfonts \rm - -% Define these so they can be easily changed for other fonts. -\def\angleleft{$\langle$} -\def\angleright{$\rangle$} - -% Count depth in font-changes, for error checks -\newcount\fontdepth \fontdepth=0 - -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 -\setfont\shortcontsl\slshape{12}{1000} -\setfont\shortconttt\ttshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else - \ptexslash\fi\fi\fi} -\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally uses \ttsl. -% @var is set to this for defun arguments. -\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally use \sl. We never want -% ttsl for book titles, do we? -\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} - -\let\i=\smartitalic -\let\slanted=\smartslanted -\let\var=\smartslanted -\let\dfn=\smartslanted -\let\emph=\smartitalic - -% @b, explicit bold. -\def\b#1{{\bf #1}} -\let\strong=\b - -% @sansserif, explicit sans. -\def\sansserif#1{{\sf #1}} - -% We can't just use \exhyphenpenalty, because that only has effect at -% the end of a paragraph. Restore normal hyphenation at the end of the -% group within which \nohyphenation is presumably called. -% -\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} -\def\restorehyphenation{\hyphenchar\font = `- } - -% Set sfcode to normal for the chars that usually have another value. -% Can't use plain's \frenchspacing because it uses the `\x notation, and -% sometimes \x has an active definition that messes things up. -% -\chardef\colonChar = `\: -\chardef\commaChar = `\, -\chardef\dotChar = `\. -\chardef\exclamChar= `\! -\chardef\questChar = `\? -\chardef\semiChar = `\; -% -\catcode`@=11 - \def\plainfrenchspacing{% - \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m - \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m - \def\endofsentencespacefactor{1000}% for @. and friends - } - \def\plainnonfrenchspacing{% - \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 - \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 - \def\endofsentencespacefactor{3000}% for @. and friends - } -\catcode`@=\other -\def\endofsentencespacefactor{3000}% default - -\def\t#1{% - {\tt \rawbackslash \plainfrenchspacing #1}% - \null -} -\def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} -\font\keysy=cmsy9 -\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} -\def\ctrl #1{{\tt \rawbackslash \hat}#1} - -% @file, @option are the same as @samp. -\let\file=\samp -\let\option=\samp - -% @code is a modification of @t, -% which makes spaces the same size as normal in the surrounding text. -\def\tclose#1{% - {% - % Change normal interword space to be same as for the current font. - \spaceskip = \fontdimen2\font - % - % Switch to typewriter. - \tt - % - % But `\ ' produces the large typewriter interword space. - \def\ {{\spaceskip = 0pt{} }}% - % - % Turn off hyphenation. - \nohyphenation - % - \rawbackslash - \plainfrenchspacing - #1% - }% - \null -} - -% We *must* turn on hyphenation at `-' and `_' in @code. -% Otherwise, it is too hard to avoid overfull hboxes -% in the Emacs manual, the Library manual, etc. - -% Unfortunately, TeX uses one parameter (\hyphenchar) to control -% both hyphenation at - and hyphenation within words. -% We must therefore turn them both off (\tclose does that) -% and arrange explicitly to hyphenate at a dash. -% -- rms. -{ - \catcode`\-=\active - \catcode`\_=\active - % - \global\def\code{\begingroup - \catcode`\-=\active \catcode`\_=\active - \ifallowcodebreaks - \let-\codedash - \let_\codeunder - \else - \let-\realdash - \let_\realunder - \fi - \codex - } -} - -\def\realdash{-} -\def\codedash{-\discretionary{}{}{}} -\def\codeunder{% - % this is all so @math{@code{var_name}+1} can work. In math mode, _ - % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) - % will therefore expand the active definition of _, which is us - % (inside @code that is), therefore an endless loop. - \ifusingtt{\ifmmode - \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. - \else\normalunderscore \fi - \discretionary{}{}{}}% - {\_}% -} -\def\codex #1{\tclose{#1}\endgroup} - -% An additional complication: the above will allow breaks after, e.g., -% each of the four underscores in __typeof__. This is undesirable in -% some manuals, especially if they don't have long identifiers in -% general. @allowcodebreaks provides a way to control this. -% -\newif\ifallowcodebreaks \allowcodebreakstrue - -\def\keywordtrue{true} -\def\keywordfalse{false} - -\parseargdef\allowcodebreaks{% - \def\txiarg{#1}% - \ifx\txiarg\keywordtrue - \allowcodebreakstrue - \else\ifx\txiarg\keywordfalse - \allowcodebreaksfalse - \else - \errhelp = \EMsimple - \errmessage{Unknown @allowcodebreaks option `\txiarg'}% - \fi\fi -} - -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\parseargdef\kbdinputstyle{% - \def\txiarg{#1}% - \ifx\txiarg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\txiarg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\txiarg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \else - \errhelp = \EMsimple - \errmessage{Unknown @kbdinputstyle option `\txiarg'}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is `distinct.' -\kbdinputstyle distinct - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. -\let\indicateurl=\code -\let\env=\code -\let\command=\code - -% @uref (abbreviation for `urlref') takes an optional (comma-separated) -% second argument specifying the text to display and an optional third -% arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup - \unsepspaces - \pdfurl{#1}% - \setbox0 = \hbox{\ignorespaces #3}% - \ifdim\wd0 > 0pt - \unhbox0 % third arg given, show only that - \else - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \ifpdf - \unhbox0 % PDF: 2nd arg given, show only it - \else - \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url - \fi - \else - \code{#1}% only url given, so show it - \fi - \fi - \endlink -\endgroup} - -% @url synonym for @uref, since that's how everyone uses it. -% -\let\url=\uref - -% rms does not like angle brackets --karl, 17may97. -% So now @email is just like @uref, unless we are pdf. -% -%\def\email#1{\angleleft{\tt #1}\angleright} -\ifpdf - \def\email#1{\doemail#1,,\finish} - \def\doemail#1,#2,#3\finish{\begingroup - \unsepspaces - \pdfurl{mailto:#1}% - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi - \endlink - \endgroup} -\else - \let\email=\uref -\fi - -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } - -% Typeset a dimension, e.g., `in' or `pt'. The only reason for the -% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. -% -\def\dmn#1{\thinspace #1} - -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - -% @l was never documented to mean ``switch to the Lisp font'', -% and it is not used as such in any manual I can find. We need it for -% Polish suppressed-l. --karl, 22sep96. -%\def\l#1{{\li #1}\null} - -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - -% @acronym for "FBI", "NATO", and the like. -% We print this one point size smaller, since it's intended for -% all-uppercase. -% -\def\acronym#1{\doacronym #1,,\finish} -\def\doacronym#1,#2,#3\finish{% - {\selectfonts\lsize #1}% - \def\temp{#2}% - \ifx\temp\empty \else - \space ({\unsepspaces \ignorespaces \temp \unskip})% - \fi -} - -% @abbr for "Comput. J." and the like. -% No font change, but don't do end-of-sentence spacing. -% -\def\abbr#1{\doabbr #1,,\finish} -\def\doabbr#1,#2,#3\finish{% - {\plainfrenchspacing #1}% - \def\temp{#2}% - \ifx\temp\empty \else - \space ({\unsepspaces \ignorespaces \temp \unskip})% - \fi -} - -% @pounds{} is a sterling sign, which Knuth put in the CM italic font. -% -\def\pounds{{\it\$}} - -% @euro{} comes from a separate font, depending on the current style. -% We use the free feym* fonts from the eurosym package by Henrik -% Theiling, which support regular, slanted, bold and bold slanted (and -% "outlined" (blackboard board, sort of) versions, which we don't need). -% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. -% -% Although only regular is the truly official Euro symbol, we ignore -% that. The Euro is designed to be slightly taller than the regular -% font height. -% -% feymr - regular -% feymo - slanted -% feybr - bold -% feybo - bold slanted -% -% There is no good (free) typewriter version, to my knowledge. -% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. -% Hmm. -% -% Also doesn't work in math. Do we need to do math with euro symbols? -% Hope not. -% -% -\def\euro{{\eurofont e}} -\def\eurofont{% - % We set the font at each command, rather than predefining it in - % \textfonts and the other font-switching commands, so that - % installations which never need the symbol don't have to have the - % font installed. - % - % There is only one designed size (nominal 10pt), so we always scale - % that to the current nominal size. - % - % By the way, simply using "at 1em" works for cmr10 and the like, but - % does not work for cmbx10 and other extended/shrunken fonts. - % - \def\eurosize{\csname\curfontsize nominalsize\endcsname}% - % - \ifx\curfontstyle\bfstylename - % bold: - \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize - \else - % regular: - \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize - \fi - \thiseurofont -} - -% @registeredsymbol - R in a circle. The font for the R should really -% be smaller yet, but lllsize is the best we can do for now. -% Adapted from the plain.tex definition of \copyright. -% -\def\registeredsymbol{% - $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% - \hfil\crcr\Orb}}% - }$% -} - -% Laurent Siebenmann reports \Orb undefined with: -% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 -% so we'll define it if necessary. -% -\ifx\Orb\undefined -\def\Orb{\mathhexbox20D} -\fi - - -\message{page headings,} - -\newskip\titlepagetopglue \titlepagetopglue = 1.5in -\newskip\titlepagebottomglue \titlepagebottomglue = 2pc - -% First the title page. Must do @settitle before @titlepage. -\newif\ifseenauthor -\newif\iffinishedtitlepage - -% Do an implicit @contents or @shortcontents after @end titlepage if the -% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. -% -\newif\ifsetcontentsaftertitlepage - \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue -\newif\ifsetshortcontentsaftertitlepage - \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue - -\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} - -\envdef\titlepage{% - % Open one extra group, as we want to close it in the middle of \Etitlepage. - \begingroup - \parindent=0pt \textfonts - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - \let\page = \oldpage - \page - \null - }% -} - -\def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - % - % Need this before the \...aftertitlepage checks so that if they are - % in effect the toc pages will come out with page numbers. - \HEADINGSon - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi -} - -\def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue -} - -%%% Macros to be used within @titlepage: - -\let\subtitlerm=\tenrm -\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} - -\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines - \let\tt=\authortt} - -\parseargdef\title{% - \checkenv\titlepage - \leftline{\titlefonts\rm #1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt -} - -\parseargdef\subtitle{% - \checkenv\titlepage - {\subtitlefont \rightline{#1}}% -} - -% @author should come last, but may come many times. -% It can also be used inside @quotation. -% -\parseargdef\author{% - \def\temp{\quotation}% - \ifx\thisenv\temp - \def\quotationauthor{#1}% printed in \Equotation. - \else - \checkenv\titlepage - \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi - {\authorfont \leftline{#1}}% - \fi -} - - -%%% Set up page headings and footings. - -\let\thispage=\folio - -\newtoks\evenheadline % headline on even pages -\newtoks\oddheadline % headline on odd pages -\newtoks\evenfootline % footline on even pages -\newtoks\oddfootline % footline on odd pages - -% Now make TeX use those variables -\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline - \else \the\evenheadline \fi}} -\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline - \else \the\evenfootline \fi}\HEADINGShook} -\let\HEADINGShook=\relax - -% Commands to set those variables. -% For example, this is what @headings on does -% @evenheading @thistitle|@thispage|@thischapter -% @oddheading @thischapter|@thispage|@thistitle -% @evenfooting @thisfile|| -% @oddfooting ||@thisfile - - -\def\evenheading{\parsearg\evenheadingxxx} -\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} -\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\def\oddheading{\parsearg\oddheadingxxx} -\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} -\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} -\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\def\oddfooting{\parsearg\oddfootingxxx} -\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} -\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% - \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% - % - % Leave some space for the footline. Hopefully ok to assume - % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip -} - -\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} - - -% @headings double turns headings on for double-sided printing. -% @headings single turns headings on for single-sided printing. -% @headings off turns them off. -% @headings on same as @headings double, retained for compatibility. -% @headings after turns on double-sided headings after this page. -% @headings doubleafter turns on double-sided headings after this page. -% @headings singleafter turns on single-sided headings after this page. -% By default, they are off at the start of a document, -% and turned `on' after @end titlepage. - -\def\headings #1 {\csname HEADINGS#1\endcsname} - -\def\HEADINGSoff{% -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff -% When we turn headings on, set the page number to 1. -% For double-sided printing, put current file name in lower left corner, -% chapter name on inside top of right hand pages, document -% title on inside top of left hand pages, and page numbers on outside top -% edge of all pages. -\def\HEADINGSdouble{% -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} -\let\contentsalignmacro = \chappager - -% For single-sided printing, chapter title goes across top left of page, -% page number on top right. -\def\HEADINGSsingle{% -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} -\def\HEADINGSon{\HEADINGSdouble} - -\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} -\let\HEADINGSdoubleafter=\HEADINGSafter -\def\HEADINGSdoublex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} - -\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} -\def\HEADINGSsinglex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} - -% Subroutines used in generating headings -% This produces Day Month Year style of output. -% Only define if not already defined, in case a txi-??.tex file has set -% up a different format (e.g., txi-cs.tex does this). -\ifx\today\undefined -\def\today{% - \number\day\space - \ifcase\month - \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr - \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug - \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec - \fi - \space\number\year} -\fi - -% @settitle line... specifies the title of the document, for headings. -% It generates no output of its own. -\def\thistitle{\putwordNoTitle} -\def\settitle{\parsearg{\gdef\thistitle}} - - -\message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x). - -% default indentation of table text -\newdimen\tableindent \tableindent=.8in -% default indentation of @itemize and @enumerate text -\newdimen\itemindent \itemindent=.3in -% margin between end of table item and start of table text. -\newdimen\itemmargin \itemmargin=.1in - -% used internally for \itemindent minus \itemmargin -\newdimen\itemmax - -% Note @table, @ftable, and @vtable define @item, @itemx, etc., with -% these defs. -% They also define \itemindex -% to index the item name in whatever manner is desired (perhaps none). - -\newif\ifitemxneedsnegativevskip - -\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} - -\def\internalBitem{\smallbreak \parsearg\itemzzz} -\def\internalBitemx{\itemxpar \parsearg\itemzzz} - -\def\itemzzz #1{\begingroup % - \advance\hsize by -\rightskip - \advance\hsize by -\tableindent - \setbox0=\hbox{\itemindicate{#1}}% - \itemindex{#1}% - \nobreak % This prevents a break before @itemx. - % - % If the item text does not fit in the space we have, put it on a line - % by itself, and do not allow a page break either before or after that - % line. We do not start a paragraph here because then if the next - % command is, e.g., @kindex, the whatsit would get put into the - % horizontal list on a line by itself, resulting in extra blank space. - \ifdim \wd0>\itemmax - % - % Make this a paragraph so we get the \parskip glue and wrapping, - % but leave it ragged-right. - \begingroup - \advance\leftskip by-\tableindent - \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil - \leavevmode\unhbox0\par - \endgroup - % - % We're going to be starting a paragraph, but we don't want the - % \parskip glue -- logically it's part of the @item we just started. - \nobreak \vskip-\parskip - % - % Stop a page break at the \parskip glue coming up. However, if - % what follows is an environment such as @example, there will be no - % \parskip glue; then the negative vskip we just inserted would - % cause the example and the item to crash together. So we use this - % bizarre value of 10001 as a signal to \aboveenvbreak to insert - % \parskip glue after all. Section titles are handled this way also. - % - \penalty 10001 - \endgroup - \itemxneedsnegativevskipfalse - \else - % The item text fits into the space. Start a paragraph, so that the - % following text (if any) will end up on the same line. - \noindent - % Do this with kerns and \unhbox so that if there is a footnote in - % the item text, it can migrate to the main vertical list and - % eventually be printed. - \nobreak\kern-\tableindent - \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 - \unhbox0 - \nobreak\kern\dimen0 - \endgroup - \itemxneedsnegativevskiptrue - \fi -} - -\def\item{\errmessage{@item while not in a list environment}} -\def\itemx{\errmessage{@itemx while not in a list environment}} - -% @table, @ftable, @vtable. -\envdef\table{% - \let\itemindex\gobble - \tablecheck{table}% -} -\envdef\ftable{% - \def\itemindex ##1{\doind {fn}{\code{##1}}}% - \tablecheck{ftable}% -} -\envdef\vtable{% - \def\itemindex ##1{\doind {vr}{\code{##1}}}% - \tablecheck{vtable}% -} -\def\tablecheck#1{% - \ifnum \the\catcode`\^^M=\active - \endgroup - \errmessage{This command won't work in this context; perhaps the problem is - that we are \inenvironment\thisenv}% - \def\next{\doignore{#1}}% - \else - \let\next\tablex - \fi - \next -} -\def\tablex#1{% - \def\itemindicate{#1}% - \parsearg\tabley -} -\def\tabley#1{% - {% - \makevalueexpandable - \edef\temp{\noexpand\tablez #1\space\space\space}% - \expandafter - }\temp \endtablez -} -\def\tablez #1 #2 #3 #4\endtablez{% - \aboveenvbreak - \ifnum 0#1>0 \advance \leftskip by #1\mil \fi - \ifnum 0#2>0 \tableindent=#2\mil \fi - \ifnum 0#3>0 \advance \rightskip by #3\mil \fi - \itemmax=\tableindent - \advance \itemmax by -\itemmargin - \advance \leftskip by \tableindent - \exdentamount=\tableindent - \parindent = 0pt - \parskip = \smallskipamount - \ifdim \parskip=0pt \parskip=2pt \fi - \let\item = \internalBitem - \let\itemx = \internalBitemx -} -\def\Etable{\endgraf\afterenvbreak} -\let\Eftable\Etable -\let\Evtable\Etable -\let\Eitemize\Etable -\let\Eenumerate\Etable - -% This is the counter used by @enumerate, which is really @itemize - -\newcount \itemno - -\envdef\itemize{\parsearg\doitemize} - -\def\doitemize#1{% - \aboveenvbreak - \itemmax=\itemindent - \advance\itemmax by -\itemmargin - \advance\leftskip by \itemindent - \exdentamount=\itemindent - \parindent=0pt - \parskip=\smallskipamount - \ifdim\parskip=0pt \parskip=2pt \fi - \def\itemcontents{#1}% - % @itemize with no arg is equivalent to @itemize @bullet. - \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi - \let\item=\itemizeitem -} - -% Definition of @item while inside @itemize and @enumerate. -% -\def\itemizeitem{% - \advance\itemno by 1 % for enumerations - {\let\par=\endgraf \smallbreak}% reasonable place to break - {% - % If the document has an @itemize directly after a section title, a - % \nobreak will be last on the list, and \sectionheading will have - % done a \vskip-\parskip. In that case, we don't want to zero - % parskip, or the item text will crash with the heading. On the - % other hand, when there is normal text preceding the item (as there - % usually is), we do want to zero parskip, or there would be too much - % space. In that case, we won't have a \nobreak before. At least - % that's the theory. - \ifnum\lastpenalty<10000 \parskip=0in \fi - \noindent - \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% - \vadjust{\penalty 1200}}% not good to break after first line of item. - \flushcr -} - -% \splitoff TOKENS\endmark defines \first to be the first token in -% TOKENS, and \rest to be the remainder. -% -\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% - -% Allow an optional argument of an uppercase letter, lowercase letter, -% or number, to specify the first label in the enumerated list. No -% argument is the same as `1'. -% -\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} -\def\enumeratey #1 #2\endenumeratey{% - % If we were given no argument, pretend we were given `1'. - \def\thearg{#1}% - \ifx\thearg\empty \def\thearg{1}\fi - % - % Detect if the argument is a single token. If so, it might be a - % letter. Otherwise, the only valid thing it can be is a number. - % (We will always have one token, because of the test we just made. - % This is a good thing, since \splitoff doesn't work given nothing at - % all -- the first parameter is undelimited.) - \expandafter\splitoff\thearg\endmark - \ifx\rest\empty - % Only one token in the argument. It could still be anything. - % A ``lowercase letter'' is one whose \lccode is nonzero. - % An ``uppercase letter'' is one whose \lccode is both nonzero, and - % not equal to itself. - % Otherwise, we assume it's a number. - % - % We need the \relax at the end of the \ifnum lines to stop TeX from - % continuing to look for a . - % - \ifnum\lccode\expandafter`\thearg=0\relax - \numericenumerate % a number (we hope) - \else - % It's a letter. - \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax - \lowercaseenumerate % lowercase letter - \else - \uppercaseenumerate % uppercase letter - \fi - \fi - \else - % Multiple tokens in the argument. We hope it's a number. - \numericenumerate - \fi -} - -% An @enumerate whose labels are integers. The starting integer is -% given in \thearg. -% -\def\numericenumerate{% - \itemno = \thearg - \startenumeration{\the\itemno}% -} - -% The starting (lowercase) letter is in \thearg. -\def\lowercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more lowercase letters in @enumerate; get a bigger - alphabet}% - \fi - \char\lccode\itemno - }% -} - -% The starting (uppercase) letter is in \thearg. -\def\uppercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more uppercase letters in @enumerate; get a bigger - alphabet} - \fi - \char\uccode\itemno - }% -} - -% Call \doitemize, adding a period to the first argument and supplying the -% common last two arguments. Also subtract one from the initial value in -% \itemno, since @item increments \itemno. -% -\def\startenumeration#1{% - \advance\itemno by -1 - \doitemize{#1.}\flushcr -} - -% @alphaenumerate and @capsenumerate are abbreviations for giving an arg -% to @enumerate. -% -\def\alphaenumerate{\enumerate{a}} -\def\capsenumerate{\enumerate{A}} -\def\Ealphaenumerate{\Eenumerate} -\def\Ecapsenumerate{\Eenumerate} - - -% @multitable macros -% Amy Hendrickson, 8/18/94, 3/6/96 -% -% @multitable ... @end multitable will make as many columns as desired. -% Contents of each column will wrap at width given in preamble. Width -% can be specified either with sample text given in a template line, -% or in percent of \hsize, the current width of text on page. - -% Table can continue over pages but will only break between lines. - -% To make preamble: -% -% Either define widths of columns in terms of percent of \hsize: -% @multitable @columnfractions .25 .3 .45 -% @item ... -% -% Numbers following @columnfractions are the percent of the total -% current hsize to be used for each column. You may use as many -% columns as desired. - - -% Or use a template: -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item ... -% using the widest term desired in each column. - -% Each new table line starts with @item, each subsequent new column -% starts with @tab. Empty columns may be produced by supplying @tab's -% with nothing between them for as many times as empty columns are needed, -% ie, @tab@tab@tab will produce two empty columns. - -% @item, @tab do not need to be on their own lines, but it will not hurt -% if they are. - -% Sample multitable: - -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff -% @tab Many paragraphs of text may be used in any column. -% -% They will wrap at the width determined by the template. -% @item@tab@tab This will be in third column. -% @end multitable - -% Default dimensions may be reset by user. -% @multitableparskip is vertical space between paragraphs in table. -% @multitableparindent is paragraph indent in table. -% @multitablecolmargin is horizontal space to be left between columns. -% @multitablelinespace is space to leave between table items, baseline -% to baseline. -% 0pt means it depends on current normal line spacing. -% -\newskip\multitableparskip -\newskip\multitableparindent -\newdimen\multitablecolspace -\newskip\multitablelinespace -\multitableparskip=0pt -\multitableparindent=6pt -\multitablecolspace=12pt -\multitablelinespace=0pt - -% Macros used to set up halign preamble: -% -\let\endsetuptable\relax -\def\xendsetuptable{\endsetuptable} -\let\columnfractions\relax -\def\xcolumnfractions{\columnfractions} -\newif\ifsetpercent - -% #1 is the @columnfraction, usually a decimal number like .5, but might -% be just 1. We just use it, whatever it is. -% -\def\pickupwholefraction#1 {% - \global\advance\colcount by 1 - \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% - \setuptable -} - -\newcount\colcount -\def\setuptable#1{% - \def\firstarg{#1}% - \ifx\firstarg\xendsetuptable - \let\go = \relax - \else - \ifx\firstarg\xcolumnfractions - \global\setpercenttrue - \else - \ifsetpercent - \let\go\pickupwholefraction - \else - \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a - % separator; typically that is always in the input, anyway. - \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% - \fi - \fi - \ifx\go\pickupwholefraction - % Put the argument back for the \pickupwholefraction call, so - % we'll always have a period there to be parsed. - \def\go{\pickupwholefraction#1}% - \else - \let\go = \setuptable - \fi% - \fi - \go -} - -% multitable-only commands. -% -% @headitem starts a heading row, which we typeset in bold. -% Assignments have to be global since we are inside the implicit group -% of an alignment entry. Note that \everycr resets \everytab. -\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% -% -% A \tab used to include \hskip1sp. But then the space in a template -% line is not enough. That is bad. So let's go back to just `&' until -% we encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{\checkenv\multitable &\the\everytab}% - -% @multitable ... @end multitable definitions: -% -\newtoks\everytab % insert after every tab. -% -\envdef\multitable{% - \vskip\parskip - \startsavinginserts - % - % @item within a multitable starts a normal row. - % We use \def instead of \let so that if one of the multitable entries - % contains an @itemize, we don't choke on the \item (seen as \crcr aka - % \endtemplate) expanding \doitemize. - \def\item{\crcr}% - % - \tolerance=9500 - \hbadness=9500 - \setmultitablespacing - \parskip=\multitableparskip - \parindent=\multitableparindent - \overfullrule=0pt - \global\colcount=0 - % - \everycr = {% - \noalign{% - \global\everytab={}% - \global\colcount=0 % Reset the column counter. - % Check for saved footnotes, etc. - \checkinserts - % Keeps underfull box messages off when table breaks over pages. - %\filbreak - % Maybe so, but it also creates really weird page breaks when the - % table breaks over pages. Wouldn't \vfil be better? Wait until the - % problem manifests itself, so it can be fixed for real --karl. - }% - }% - % - \parsearg\domultitable -} -\def\domultitable#1{% - % To parse everything between @multitable and @item: - \setuptable#1 \endsetuptable - % - % This preamble sets up a generic column definition, which will - % be used as many times as user calls for columns. - % \vtop will set a single line and will also let text wrap and - % continue for many paragraphs if desired. - \halign\bgroup &% - \global\advance\colcount by 1 - \multistrut - \vtop{% - % Use the current \colcount to find the correct column width: - \hsize=\expandafter\csname col\the\colcount\endcsname - % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. - \rightskip=0pt - \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip - \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace - \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively - % marking characters. - \noindent\ignorespaces##\unskip\multistrut - }\cr -} -\def\Emultitable{% - \crcr - \egroup % end the \halign - \global\setpercentfalse -} - -\def\setmultitablespacing{% - \def\multistrut{\strut}% just use the standard line spacing - % - % Compute \multitablelinespace (if not defined by user) for use in - % \multitableparskip calculation. We used define \multistrut based on - % this, but (ironically) that caused the spacing to be off. - % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. -\ifdim\multitablelinespace=0pt -\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip -\global\advance\multitablelinespace by-\ht0 -\fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. -\ifdim\multitableparskip>\multitablelinespace -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi% -\ifdim\multitableparskip=0pt -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi} - - -\message{conditionals,} - -% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, -% @ifnotxml always succeed. They currently do nothing; we don't -% attempt to check whether the conditionals are properly nested. But we -% have to remember that they are conditionals, so that @end doesn't -% attempt to close an environment group. -% -\def\makecond#1{% - \expandafter\let\csname #1\endcsname = \relax - \expandafter\let\csname iscond.#1\endcsname = 1 -} -\makecond{iftex} -\makecond{ifnotdocbook} -\makecond{ifnothtml} -\makecond{ifnotinfo} -\makecond{ifnotplaintext} -\makecond{ifnotxml} - -% Ignore @ignore, @ifhtml, @ifinfo, and the like. -% -\def\direntry{\doignore{direntry}} -\def\documentdescription{\doignore{documentdescription}} -\def\docbook{\doignore{docbook}} -\def\html{\doignore{html}} -\def\ifdocbook{\doignore{ifdocbook}} -\def\ifhtml{\doignore{ifhtml}} -\def\ifinfo{\doignore{ifinfo}} -\def\ifnottex{\doignore{ifnottex}} -\def\ifplaintext{\doignore{ifplaintext}} -\def\ifxml{\doignore{ifxml}} -\def\ignore{\doignore{ignore}} -\def\menu{\doignore{menu}} -\def\xml{\doignore{xml}} - -% Ignore text until a line `@end #1', keeping track of nested conditionals. -% -% A count to remember the depth of nesting. -\newcount\doignorecount - -\def\doignore#1{\begingroup - % Scan in ``verbatim'' mode: - \obeylines - \catcode`\@ = \other - \catcode`\{ = \other - \catcode`\} = \other - % - % Make sure that spaces turn into tokens that match what \doignoretext wants. - \spaceisspace - % - % Count number of #1's that we've seen. - \doignorecount = 0 - % - % Swallow text until we reach the matching `@end #1'. - \dodoignore{#1}% -} - -{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. - \obeylines % - % - \gdef\dodoignore#1{% - % #1 contains the command name as a string, e.g., `ifinfo'. - % - % Define a command to find the next `@end #1'. - \long\def\doignoretext##1^^M@end #1{% - \doignoretextyyy##1^^M@#1\_STOP_}% - % - % And this command to find another #1 command, at the beginning of a - % line. (Otherwise, we would consider a line `@c @ifset', for - % example, to count as an @ifset for nesting.) - \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% - % - % And now expand that command. - \doignoretext ^^M% - }% -} - -\def\doignoreyyy#1{% - \def\temp{#1}% - \ifx\temp\empty % Nothing found. - \let\next\doignoretextzzz - \else % Found a nested condition, ... - \advance\doignorecount by 1 - \let\next\doignoretextyyy % ..., look for another. - % If we're here, #1 ends with ^^M\ifinfo (for example). - \fi - \next #1% the token \_STOP_ is present just after this macro. -} - -% We have to swallow the remaining "\_STOP_". -% -\def\doignoretextzzz#1{% - \ifnum\doignorecount = 0 % We have just found the outermost @end. - \let\next\enddoignore - \else % Still inside a nested condition. - \advance\doignorecount by -1 - \let\next\doignoretext % Look for the next @end. - \fi - \next -} - -% Finish off ignored text. -{ \obeylines% - % Ignore anything after the last `@end #1'; this matters in verbatim - % environments, where otherwise the newline after an ignored conditional - % would result in a blank line in the output. - \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% -} - - -% @set VAR sets the variable VAR to an empty value. -% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. -% -% Since we want to separate VAR from REST-OF-LINE (which might be -% empty), we can't just use \parsearg; we have to insert a space of our -% own to delimit the rest of the line, and then take it out again if we -% didn't need it. -% We rely on the fact that \parsearg sets \catcode`\ =10. -% -\parseargdef\set{\setyyy#1 \endsetyyy} -\def\setyyy#1 #2\endsetyyy{% - {% - \makevalueexpandable - \def\temp{#2}% - \edef\next{\gdef\makecsname{SET#1}}% - \ifx\temp\empty - \next{}% - \else - \setzzz#2\endsetzzz - \fi - }% -} -% Remove the trailing space \setxxx inserted. -\def\setzzz#1 \endsetzzz{\next{#1}} - -% @clear VAR clears (i.e., unsets) the variable VAR. -% -\parseargdef\clear{% - {% - \makevalueexpandable - \global\expandafter\let\csname SET#1\endcsname=\relax - }% -} - -% @value{foo} gets the text saved in variable foo. -\def\value{\begingroup\makevalueexpandable\valuexxx} -\def\valuexxx#1{\expandablevalue{#1}\endgroup} -{ - \catcode`\- = \active \catcode`\_ = \active - % - \gdef\makevalueexpandable{% - \let\value = \expandablevalue - % We don't want these characters active, ... - \catcode`\-=\other \catcode`\_=\other - % ..., but we might end up with active ones in the argument if - % we're called from @code, as @code{@value{foo-bar_}}, though. - % So \let them to their normal equivalents. - \let-\realdash \let_\normalunderscore - } -} - -% We have this subroutine so that we can handle at least some @value's -% properly in indexes (we call \makevalueexpandable in \indexdummies). -% The command has to be fully expandable (if the variable is set), since -% the result winds up in the index file. This means that if the -% variable's value contains other Texinfo commands, it's almost certain -% it will fail (although perhaps we could fix that with sufficient work -% to do a one-level expansion on the result, instead of complete). -% -\def\expandablevalue#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - {[No value for ``#1'']}% - \message{Variable `#1', used in @value, is not set.}% - \else - \csname SET#1\endcsname - \fi -} - -% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined -% with @set. -% -% To get special treatment of `@end ifset,' call \makeond and the redefine. -% -\makecond{ifset} -\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} -\def\doifset#1#2{% - {% - \makevalueexpandable - \let\next=\empty - \expandafter\ifx\csname SET#2\endcsname\relax - #1% If not set, redefine \next. - \fi - \expandafter - }\next -} -\def\ifsetfail{\doignore{ifset}} - -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been -% defined with @set, or has been undefined with @clear. -% -% The `\else' inside the `\doifset' parameter is a trick to reuse the -% above code: if the variable is not set, do nothing, if it is set, -% then redefine \next to \ifclearfail. -% -\makecond{ifclear} -\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} -\def\ifclearfail{\doignore{ifclear}} - -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory=\comment - -% @defininfoenclose. -\let\definfoenclose=\comment - - -\message{indexing,} -% Index generation facilities - -% Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within macros and \if's. -\edef\newwrite{\makecsname{ptexnewwrite}} - -% \newindex {foo} defines an index named foo. -% It automatically defines \fooindex such that -% \fooindex ...rest of line... puts an entry in the index foo. -% It also defines \fooindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is foo. -% The name of an index should be no more than 2 characters long -% for the sake of vms. -% -\def\newindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 % Open the file - \fi - \expandafter\xdef\csname#1index\endcsname{% % Define @#1index - \noexpand\doindex{#1}} -} - -% @defindex foo == \newindex{foo} -% -\def\defindex{\parsearg\newindex} - -% Define @defcodeindex, like @defindex except put all entries in @code. -% -\def\defcodeindex{\parsearg\newcodeindex} -% -\def\newcodeindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 - \fi - \expandafter\xdef\csname#1index\endcsname{% - \noexpand\docodeindex{#1}}% -} - - -% @synindex foo bar makes index foo feed into index bar. -% Do this instead of @defindex foo if you don't want it as a separate index. -% -% @syncodeindex foo bar similar, but put all entries made for index foo -% inside @code. -% -\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} -\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} - -% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), -% #3 the target index (bar). -\def\dosynindex#1#2#3{% - % Only do \closeout if we haven't already done it, else we'll end up - % closing the target index. - \expandafter \ifx\csname donesynindex#2\endcsname \undefined - % The \closeout helps reduce unnecessary open files; the limit on the - % Acorn RISC OS is a mere 16 files. - \expandafter\closeout\csname#2indfile\endcsname - \expandafter\let\csname\donesynindex#2\endcsname = 1 - \fi - % redefine \fooindfile: - \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname - \expandafter\let\csname#2indfile\endcsname=\temp - % redefine \fooindex: - \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% -} - -% Define \doindex, the driver for all \fooindex macros. -% Argument #1 is generated by the calling \fooindex macro, -% and it is "foo", the name of the index. - -% \doindex just uses \parsearg; it calls \doind for the actual work. -% This is because \doind is more useful to call from other macros. - -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. - -\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} -\def\singleindexer #1{\doind{\indexname}{#1}} - -% like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} -\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} - -% Take care of Texinfo commands that can appear in an index entry. -% Since there are some commands we want to expand, and others we don't, -% we have to laboriously prevent expansion for those that we don't. -% -\def\indexdummies{% - \escapechar = `\\ % use backslash in output files. - \def\@{@}% change to @@ when we switch to @ as escape char in index files. - \def\ {\realbackslash\space }% - % Need these in case \tex is in effect and \{ is a \delimiter again. - % But can't use \lbracecmd and \rbracecmd because texindex assumes - % braces and backslashes are used only as delimiters. - \let\{ = \mylbrace - \let\} = \myrbrace - % - % Do the redefinitions. - \commondummies -} - -% For the aux and toc files, @ is the escape character. So we want to -% redefine everything using @ as the escape character (instead of -% \realbackslash, still used for index files). When everything uses @, -% this will be simpler. -% -\def\atdummies{% - \def\@{@@}% - \def\ {@ }% - \let\{ = \lbraceatcmd - \let\} = \rbraceatcmd - % - % Do the redefinitions. - \commondummies - \otherbackslash -} - -% Called from \indexdummies and \atdummies. -% -\def\commondummies{% - % - % \definedummyword defines \#1 as \string\#1\space, thus effectively - % preventing its expansion. This is used only for control% words, - % not control letters, because the \space would be incorrect for - % control characters, but is needed to separate the control word - % from whatever follows. - % - % For control letters, we have \definedummyletter, which omits the - % space. - % - % These can be used both for control words that take an argument and - % those that do not. If it is followed by {arg} in the input, then - % that will dutifully get written to the index (or wherever). - % - \def\definedummyword ##1{\def##1{\string##1\space}}% - \def\definedummyletter##1{\def##1{\string##1}}% - \let\definedummyaccent\definedummyletter - % - \commondummiesnofonts - % - \definedummyletter\_% - % - % Non-English letters. - \definedummyword\AA - \definedummyword\AE - \definedummyword\L - \definedummyword\OE - \definedummyword\O - \definedummyword\aa - \definedummyword\ae - \definedummyword\l - \definedummyword\oe - \definedummyword\o - \definedummyword\ss - \definedummyword\exclamdown - \definedummyword\questiondown - \definedummyword\ordf - \definedummyword\ordm - % - % Although these internal commands shouldn't show up, sometimes they do. - \definedummyword\bf - \definedummyword\gtr - \definedummyword\hat - \definedummyword\less - \definedummyword\sf - \definedummyword\sl - \definedummyword\tclose - \definedummyword\tt - % - \definedummyword\LaTeX - \definedummyword\TeX - % - % Assorted special characters. - \definedummyword\bullet - \definedummyword\comma - \definedummyword\copyright - \definedummyword\registeredsymbol - \definedummyword\dots - \definedummyword\enddots - \definedummyword\equiv - \definedummyword\error - \definedummyword\euro - \definedummyword\expansion - \definedummyword\minus - \definedummyword\pounds - \definedummyword\point - \definedummyword\print - \definedummyword\result - % - % We want to disable all macros so that they are not expanded by \write. - \macrolist - % - \normalturnoffactive - % - % Handle some cases of @value -- where it does not contain any - % (non-fully-expandable) commands. - \makevalueexpandable -} - -% \commondummiesnofonts: common to \commondummies and \indexnofonts. -% -\def\commondummiesnofonts{% - % Control letters and accents. - \definedummyletter\!% - \definedummyaccent\"% - \definedummyaccent\'% - \definedummyletter\*% - \definedummyaccent\,% - \definedummyletter\.% - \definedummyletter\/% - \definedummyletter\:% - \definedummyaccent\=% - \definedummyletter\?% - \definedummyaccent\^% - \definedummyaccent\`% - \definedummyaccent\~% - \definedummyword\u - \definedummyword\v - \definedummyword\H - \definedummyword\dotaccent - \definedummyword\ringaccent - \definedummyword\tieaccent - \definedummyword\ubaraccent - \definedummyword\udotaccent - \definedummyword\dotless - % - % Texinfo font commands. - \definedummyword\b - \definedummyword\i - \definedummyword\r - \definedummyword\sc - \definedummyword\t - % - % Commands that take arguments. - \definedummyword\acronym - \definedummyword\cite - \definedummyword\code - \definedummyword\command - \definedummyword\dfn - \definedummyword\emph - \definedummyword\env - \definedummyword\file - \definedummyword\kbd - \definedummyword\key - \definedummyword\math - \definedummyword\option - \definedummyword\pxref - \definedummyword\ref - \definedummyword\samp - \definedummyword\strong - \definedummyword\tie - \definedummyword\uref - \definedummyword\url - \definedummyword\var - \definedummyword\verb - \definedummyword\w - \definedummyword\xref -} - -% \indexnofonts is used when outputting the strings to sort the index -% by, and when constructing control sequence names. It eliminates all -% control sequences and just writes whatever the best ASCII sort string -% would be for a given command (usually its argument). -% -\def\indexnofonts{% - % Accent commands should become @asis. - \def\definedummyaccent##1{\let##1\asis}% - % We can just ignore other control letters. - \def\definedummyletter##1{\let##1\empty}% - % Hopefully, all control words can become @asis. - \let\definedummyword\definedummyaccent - % - \commondummiesnofonts - % - % Don't no-op \tt, since it isn't a user-level command - % and is used in the definitions of the active chars like <, >, |, etc. - % Likewise with the other plain tex font commands. - %\let\tt=\asis - % - \def\ { }% - \def\@{@}% - % how to handle braces? - \def\_{\normalunderscore}% - % - % Non-English letters. - \def\AA{AA}% - \def\AE{AE}% - \def\L{L}% - \def\OE{OE}% - \def\O{O}% - \def\aa{aa}% - \def\ae{ae}% - \def\l{l}% - \def\oe{oe}% - \def\o{o}% - \def\ss{ss}% - \def\exclamdown{!}% - \def\questiondown{?}% - \def\ordf{a}% - \def\ordm{o}% - % - \def\LaTeX{LaTeX}% - \def\TeX{TeX}% - % - % Assorted special characters. - % (The following {} will end up in the sort string, but that's ok.) - \def\bullet{bullet}% - \def\comma{,}% - \def\copyright{copyright}% - \def\registeredsymbol{R}% - \def\dots{...}% - \def\enddots{...}% - \def\equiv{==}% - \def\error{error}% - \def\euro{euro}% - \def\expansion{==>}% - \def\minus{-}% - \def\pounds{pounds}% - \def\point{.}% - \def\print{-|}% - \def\result{=>}% - % - % We need to get rid of all macros, leaving only the arguments (if present). - % Of course this is not nearly correct, but it is the best we can do for now. - % makeinfo does not expand macros in the argument to @deffn, which ends up - % writing an index entry, and texindex isn't prepared for an index sort entry - % that starts with \. - % - % Since macro invocations are followed by braces, we can just redefine them - % to take a single TeX argument. The case of a macro invocation that - % goes to end-of-line is not handled. - % - \macrolist -} - -\let\indexbackslash=0 %overridden during \printindex. -\let\SETmarginindex=\relax % put index entries in margin (undocumented)? - -% Most index entries go through here, but \dosubind is the general case. -% #1 is the index name, #2 is the entry text. -\def\doind#1#2{\dosubind{#1}{#2}{}} - -% Workhorse for all \fooindexes. -% #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% empty if called from \doind, as we usually are (the main exception -% is with most defuns, which call us directly). -% -\def\dosubind#1#2#3{% - \iflinks - {% - % Store the main index entry text (including the third arg). - \toks0 = {#2}% - % If third arg is present, precede it with a space. - \def\thirdarg{#3}% - \ifx\thirdarg\empty \else - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - \edef\writeto{\csname#1indfile\endcsname}% - % - \ifvmode - \dosubindsanitize - \else - \dosubindwrite - \fi - }% - \fi -} - -% Write the entry in \toks0 to the index file: -% -\def\dosubindwrite{% - % Put the index entry in the margin if desired. - \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% - \fi - % - % Remember, we are within a group. - \indexdummies % Must do this here, since \bf, etc expand at this stage - \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - % Process the index entry with all font commands turned off, to - % get the string to sort by. - {\indexnofonts - \edef\temp{\the\toks0}% need full expansion - \xdef\indexsorttmp{\temp}% - }% - % - % Set up the complete index entry, with both the sort key and - % the original text, including any font commands. We write - % three arguments to \entry to the .?? file (four in the - % subentry case), texindex reduces to two when writing the .??s - % sorted result. - \edef\temp{% - \write\writeto{% - \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% - }% - \temp -} - -% Take care of unwanted page breaks: -% -% If a skip is the last thing on the list now, preserve it -% by backing up by \lastskip, doing the \write, then inserting -% the skip again. Otherwise, the whatsit generated by the -% \write will make \lastskip zero. The result is that sequences -% like this: -% @end defun -% @tindex whatever -% @defun ... -% will have extra space inserted, because the \medbreak in the -% start of the @defun won't see the skip inserted by the @end of -% the previous defun. -% -% But don't do any of this if we're not in vertical mode. We -% don't want to do a \vskip and prematurely end a paragraph. -% -% Avoid page breaks due to these extra skips, too. -% -% But wait, there is a catch there: -% We'll have to check whether \lastskip is zero skip. \ifdim is not -% sufficient for this purpose, as it ignores stretch and shrink parts -% of the skip. The only way seems to be to check the textual -% representation of the skip. -% -% The following is almost like \def\zeroskipmacro{0.0pt} except that -% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). -% -\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} -% -% ..., ready, GO: -% -\def\dosubindsanitize{% - % \lastskip and \lastpenalty cannot both be nonzero simultaneously. - \skip0 = \lastskip - \edef\lastskipmacro{\the\lastskip}% - \count255 = \lastpenalty - % - % If \lastskip is nonzero, that means the last item was a - % skip. And since a skip is discardable, that means this - % -\skip0 glue we're inserting is preceded by a - % non-discardable item, therefore it is not a potential - % breakpoint, therefore no \nobreak needed. - \ifx\lastskipmacro\zeroskipmacro - \else - \vskip-\skip0 - \fi - % - \dosubindwrite - % - \ifx\lastskipmacro\zeroskipmacro - % If \lastskip was zero, perhaps the last item was a penalty, and - % perhaps it was >=10000, e.g., a \nobreak. In that case, we want - % to re-insert the same penalty (values >10000 are used for various - % signals); since we just inserted a non-discardable item, any - % following glue (such as a \parskip) would be a breakpoint. For example: - % - % @deffn deffn-whatever - % @vindex index-whatever - % Description. - % would allow a break between the index-whatever whatsit - % and the "Description." paragraph. - \ifnum\count255>9999 \penalty\count255 \fi - \else - % On the other hand, if we had a nonzero \lastskip, - % this make-up glue would be preceded by a non-discardable item - % (the whatsit from the \write), so we must insert a \nobreak. - \nobreak\vskip\skip0 - \fi -} - -% The index entry written in the file actually looks like -% \entry {sortstring}{page}{topic} -% or -% \entry {sortstring}{page}{topic}{subtopic} -% The texindex program reads in these files and writes files -% containing these kinds of lines: -% \initial {c} -% before the first topic whose initial is c -% \entry {topic}{pagelist} -% for a topic that is used without subtopics -% \primary {topic} -% for the beginning of a topic that is used with subtopics -% \secondary {subtopic}{pagelist} -% for each subtopic. - -% Define the user-accessible indexing commands -% @findex, @vindex, @kindex, @cindex. - -\def\findex {\fnindex} -\def\kindex {\kyindex} -\def\cindex {\cpindex} -\def\vindex {\vrindex} -\def\tindex {\tpindex} -\def\pindex {\pgindex} - -\def\cindexsub {\begingroup\obeylines\cindexsub} -{\obeylines % -\gdef\cindexsub "#1" #2^^M{\endgroup % -\dosubind{cp}{#2}{#1}}} - -% Define the macros used in formatting output of the sorted index material. - -% @printindex causes a particular index (the ??s file) to get printed. -% It does not print any chapter heading (usually an @unnumbered). -% -\parseargdef\printindex{\begingroup - \dobreak \chapheadingskip{10000}% - % - \smallfonts \rm - \tolerance = 9500 - \everypar = {}% don't want the \kern\-parindent from indentation suppression. - % - % See if the index file exists and is nonempty. - % Change catcode of @ here so that if the index file contains - % \initial {@} - % as its first line, TeX doesn't complain about mismatched braces - % (because it thinks @} is a control sequence). - \catcode`\@ = 11 - \openin 1 \jobname.#1s - \ifeof 1 - % \enddoublecolumns gets confused if there is no text in the index, - % and it loses the chapter title and the aux file entries for the - % index. The easiest way to prevent this problem is to make sure - % there is some text. - \putwordIndexNonexistent - \else - % - % If the index file exists but is empty, then \openin leaves \ifeof - % false. We have to make TeX try to read something from the file, so - % it can discover if there is anything in it. - \read 1 to \temp - \ifeof 1 - \putwordIndexIsEmpty - \else - % Index files are almost Texinfo source, but we use \ as the escape - % character. It would be better to use @, but that's too big a change - % to make right now. - \def\indexbackslash{\backslashcurfont}% - \catcode`\\ = 0 - \escapechar = `\\ - \begindoublecolumns - \input \jobname.#1s - \enddoublecolumns - \fi - \fi - \closein 1 -\endgroup} - -% These macros are used by the sorted index file itself. -% Change them to control the appearance of the index. - -\def\initial#1{{% - % Some minor font changes for the special characters. - \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt - % - % Remove any glue we may have, we'll be inserting our own. - \removelastskip - % - % We like breaks before the index initials, so insert a bonus. - \nobreak - \vskip 0pt plus 3\baselineskip - \penalty 0 - \vskip 0pt plus -3\baselineskip - % - % Typeset the initial. Making this add up to a whole number of - % baselineskips increases the chance of the dots lining up from column - % to column. It still won't often be perfect, because of the stretch - % we need before each entry, but it's better. - % - % No shrink because it confuses \balancecolumns. - \vskip 1.67\baselineskip plus .5\baselineskip - \leftline{\secbf #1}% - % Do our best not to break after the initial. - \nobreak - \vskip .33\baselineskip plus .1\baselineskip -}} - -% \entry typesets a paragraph consisting of the text (#1), dot leaders, and -% then page number (#2) flushed to the right margin. It is used for index -% and table of contents entries. The paragraph is indented by \leftskip. -% -% A straightforward implementation would start like this: -% \def\entry#1#2{... -% But this frozes the catcodes in the argument, and can cause problems to -% @code, which sets - active. This problem was fixed by a kludge--- -% ``-'' was active throughout whole index, but this isn't really right. -% -% The right solution is to prevent \entry from swallowing the whole text. -% --kasal, 21nov03 -\def\entry{% - \begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing - % columns. - \vskip 0pt plus1pt - % - % Swallow the left brace of the text (first parameter): - \afterassignment\doentry - \let\temp = -} -\def\doentry{% - \bgroup % Instead of the swallowed brace. - \noindent - \aftergroup\finishentry - % And now comes the text of the entry. -} -\def\finishentry#1{% - % #1 is the page number. - % - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#1}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd - \ % - \else - % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. - % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ifpdf - \pdfgettoks#1.% - \ \the\toksA - \else - \ #1% - \fi - \fi - \par - \endgroup -} - -% Like \dotfill except takes at least 1 em. -\def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} - -\def\primary #1{\line{#1\hfil}} - -\newskip\secondaryindent \secondaryindent=0.5cm -\def\secondary#1#2{{% - \parfillskip=0in - \parskip=0in - \hangindent=1in - \hangafter=1 - \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill - \ifpdf - \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. - \else - #2 - \fi - \par -}} - -% Define two-column mode, which we use to typeset indexes. -% Adapted from the TeXbook, page 416, which is to say, -% the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 - -\newbox\partialpage -\newdimen\doublecolumnhsize - -\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns - % Grab any single-column material above us. - \output = {% - % - % Here is a possibility not foreseen in manmac: if we accumulate a - % whole lot of material, we might end up calling this \output - % routine twice in a row (see the doublecol-lose test, which is - % essentially a couple of indexes with @setchapternewpage off). In - % that case we just ship out what is in \partialpage with the normal - % output routine. Generally, \partialpage will be empty when this - % runs and this will be a no-op. See the indexspread.tex test case. - \ifvoid\partialpage \else - \onepageout{\pagecontents\partialpage}% - \fi - % - \global\setbox\partialpage = \vbox{% - % Unvbox the main output page. - \unvbox\PAGE - \kern-\topskip \kern\baselineskip - }% - }% - \eject % run that output routine to set \partialpage - % - % Use the double-column output routine for subsequent pages. - \output = {\doublecolumnout}% - % - % Change the page size parameters. We could do this once outside this - % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 - % format, but then we repeat the same computation. Repeating a couple - % of assignments once per index is clearly meaningless for the - % execution time, so we may as well do it in one place. - % - % First we halve the line length, less a little for the gutter between - % the columns. We compute the gutter based on the line length, so it - % changes automatically with the paper format. The magic constant - % below is chosen so that the gutter has the same value (well, +-<1pt) - % as it did when we hard-coded it. - % - % We put the result in a separate register, \doublecolumhsize, so we - % can restore it in \pagesofar, after \hsize itself has (potentially) - % been clobbered. - % - \doublecolumnhsize = \hsize - \advance\doublecolumnhsize by -.04154\hsize - \divide\doublecolumnhsize by 2 - \hsize = \doublecolumnhsize - % - % Double the \vsize as well. (We don't need a separate register here, - % since nobody clobbers \vsize.) - \vsize = 2\vsize -} - -% The double-column output routine for all double-column pages except -% the last. -% -\def\doublecolumnout{% - \splittopskip=\topskip \splitmaxdepth=\maxdepth - % Get the available space for the double columns -- the normal - % (undoubled) page height minus any material left over from the - % previous page. - \dimen@ = \vsize - \divide\dimen@ by 2 - \advance\dimen@ by -\ht\partialpage - % - % box0 will be the left-hand column, box2 the right. - \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ - \onepageout\pagesofar - \unvbox255 - \penalty\outputpenalty -} -% -% Re-output the contents of the output page -- any previous material, -% followed by the two boxes we just split, in box0 and box2. -\def\pagesofar{% - \unvbox\partialpage - % - \hsize = \doublecolumnhsize - \wd0=\hsize \wd2=\hsize - \hbox to\pagewidth{\box0\hfil\box2}% -} -% -% All done with double columns. -\def\enddoublecolumns{% - \output = {% - % Split the last of the double-column material. Leave it on the - % current page, no automatic page break. - \balancecolumns - % - % If we end up splitting too much material for the current page, - % though, there will be another page break right after this \output - % invocation ends. Having called \balancecolumns once, we do not - % want to call it again. Therefore, reset \output to its normal - % definition right away. (We hope \balancecolumns will never be - % called on to balance too much material, but if it is, this makes - % the output somewhat more palatable.) - \global\output = {\onepageout{\pagecontents\PAGE}}% - }% - \eject - \endgroup % started in \begindoublecolumns - % - % \pagegoal was set to the doubled \vsize above, since we restarted - % the current page. We're now back to normal single-column - % typesetting, so reset \pagegoal to the normal \vsize (after the - % \endgroup where \vsize got restored). - \pagegoal = \vsize -} -% -% Called at the end of the double column material. -\def\balancecolumns{% - \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. - \dimen@ = \ht0 - \advance\dimen@ by \topskip - \advance\dimen@ by-\baselineskip - \divide\dimen@ by 2 % target to split to - %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% - \splittopskip = \topskip - % Loop until we get a decent breakpoint. - {% - \vbadness = 10000 - \loop - \global\setbox3 = \copy0 - \global\setbox1 = \vsplit3 to \dimen@ - \ifdim\ht3>\dimen@ - \global\advance\dimen@ by 1pt - \repeat - }% - %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% - % - \pagesofar -} -\catcode`\@ = \other - - -\message{sectioning,} -% Chapters, sections, etc. - -% \unnumberedno is an oxymoron, of course. But we count the unnumbered -% sections so that we can refer to them unambiguously in the pdf -% outlines by their "section number". We avoid collisions with chapter -% numbers by starting them at 10000. (If a document ever has 10000 -% chapters, we're in trouble anyway, I'm sure.) -\newcount\unnumberedno \unnumberedno = 10000 -\newcount\chapno -\newcount\secno \secno=0 -\newcount\subsecno \subsecno=0 -\newcount\subsubsecno \subsubsecno=0 - -% This counter is funny since it counts through charcodes of letters A, B, ... -\newcount\appendixno \appendixno = `\@ -% -% \def\appendixletter{\char\the\appendixno} -% We do the following ugly conditional instead of the above simple -% construct for the sake of pdftex, which needs the actual -% letter in the expansion, not just typeset. -% -\def\appendixletter{% - \ifnum\appendixno=`A A% - \else\ifnum\appendixno=`B B% - \else\ifnum\appendixno=`C C% - \else\ifnum\appendixno=`D D% - \else\ifnum\appendixno=`E E% - \else\ifnum\appendixno=`F F% - \else\ifnum\appendixno=`G G% - \else\ifnum\appendixno=`H H% - \else\ifnum\appendixno=`I I% - \else\ifnum\appendixno=`J J% - \else\ifnum\appendixno=`K K% - \else\ifnum\appendixno=`L L% - \else\ifnum\appendixno=`M M% - \else\ifnum\appendixno=`N N% - \else\ifnum\appendixno=`O O% - \else\ifnum\appendixno=`P P% - \else\ifnum\appendixno=`Q Q% - \else\ifnum\appendixno=`R R% - \else\ifnum\appendixno=`S S% - \else\ifnum\appendixno=`T T% - \else\ifnum\appendixno=`U U% - \else\ifnum\appendixno=`V V% - \else\ifnum\appendixno=`W W% - \else\ifnum\appendixno=`X X% - \else\ifnum\appendixno=`Y Y% - \else\ifnum\appendixno=`Z Z% - % The \the is necessary, despite appearances, because \appendixletter is - % expanded while writing the .toc file. \char\appendixno is not - % expandable, thus it is written literally, thus all appendixes come out - % with the same letter (or @) in the toc without it. - \else\char\the\appendixno - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -% However, they are not reliable, because we don't use marks. -\def\thischapter{} -\def\thissection{} - -\newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count - -% @raisesections: treat @section as chapter, @subsection as section, etc. -\def\raisesections{\global\advance\secbase by -1} -\let\up=\raisesections % original BFox name - -% @lowersections: treat @chapter as section, @section as subsection, etc. -\def\lowersections{\global\advance\secbase by 1} -\let\down=\lowersections % original BFox name - -% we only have subsub. -\chardef\maxseclevel = 3 -% -% A numbered section within an unnumbered changes to unnumbered too. -% To achive this, remember the "biggest" unnum. sec. we are currently in: -\chardef\unmlevel = \maxseclevel -% -% Trace whether the current chapter is an appendix or not: -% \chapheadtype is "N" or "A", unnumbered chapters are ignored. -\def\chapheadtype{N} - -% Choose a heading macro -% #1 is heading type -% #2 is heading level -% #3 is text for heading -\def\genhead#1#2#3{% - % Compute the abs. sec. level: - \absseclevel=#2 - \advance\absseclevel by \secbase - % Make sure \absseclevel doesn't fall outside the range: - \ifnum \absseclevel < 0 - \absseclevel = 0 - \else - \ifnum \absseclevel > 3 - \absseclevel = 3 - \fi - \fi - % The heading type: - \def\headtype{#1}% - \if \headtype U% - \ifnum \absseclevel < \unmlevel - \chardef\unmlevel = \absseclevel - \fi - \else - % Check for appendix sections: - \ifnum \absseclevel = 0 - \edef\chapheadtype{\headtype}% - \else - \if \headtype A\if \chapheadtype N% - \errmessage{@appendix... within a non-appendix chapter}% - \fi\fi - \fi - % Check for numbered within unnumbered: - \ifnum \absseclevel > \unmlevel - \def\headtype{U}% - \else - \chardef\unmlevel = 3 - \fi - \fi - % Now print the heading: - \if \headtype U% - \ifcase\absseclevel - \unnumberedzzz{#3}% - \or \unnumberedseczzz{#3}% - \or \unnumberedsubseczzz{#3}% - \or \unnumberedsubsubseczzz{#3}% - \fi - \else - \if \headtype A% - \ifcase\absseclevel - \appendixzzz{#3}% - \or \appendixsectionzzz{#3}% - \or \appendixsubseczzz{#3}% - \or \appendixsubsubseczzz{#3}% - \fi - \else - \ifcase\absseclevel - \chapterzzz{#3}% - \or \seczzz{#3}% - \or \numberedsubseczzz{#3}% - \or \numberedsubsubseczzz{#3}% - \fi - \fi - \fi - \suppressfirstparagraphindent -} - -% an interface: -\def\numhead{\genhead N} -\def\apphead{\genhead A} -\def\unnmhead{\genhead U} - -% @chapter, @appendix, @unnumbered. Increment top-level counter, reset -% all lower-level sectioning counters to zero. -% -% Also set \chaplevelprefix, which we prepend to @float sequence numbers -% (e.g., figures), q.v. By default (before any chapter), that is empty. -\let\chaplevelprefix = \empty -% -\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz#1{% - % section resetting is \global in case the chapter is in a group, such - % as an @include file. - \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 - \global\advance\chapno by 1 - % - % Used for \float. - \gdef\chaplevelprefix{\the\chapno.}% - \resetallfloatnos - % - \message{\putwordChapter\space \the\chapno}% - % - % Write the actual heading. - \chapmacro{#1}{Ynumbered}{\the\chapno}% - % - % So @section and the like are numbered underneath this chapter. - \global\let\section = \numberedsec - \global\let\subsection = \numberedsubsec - \global\let\subsubsection = \numberedsubsubsec -} - -\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz#1{% - \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 - \global\advance\appendixno by 1 - \gdef\chaplevelprefix{\appendixletter.}% - \resetallfloatnos - % - \def\appendixnum{\putwordAppendix\space \appendixletter}% - \message{\appendixnum}% - % - \chapmacro{#1}{Yappendix}{\appendixletter}% - % - \global\let\section = \appendixsec - \global\let\subsection = \appendixsubsec - \global\let\subsubsection = \appendixsubsubsec -} - -\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz#1{% - \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 - \global\advance\unnumberedno by 1 - % - % Since an unnumbered has no number, no prefix for figures. - \global\let\chaplevelprefix = \empty - \resetallfloatnos - % - % This used to be simply \message{#1}, but TeX fully expands the - % argument to \message. Therefore, if #1 contained @-commands, TeX - % expanded them. For example, in `@unnumbered The @cite{Book}', TeX - % expanded @cite (which turns out to cause errors because \cite is meant - % to be executed, not expanded). - % - % Anyway, we don't want the fully-expanded definition of @cite to appear - % as a result of the \message, we just want `@cite' itself. We use - % \the to achieve this: TeX expands \the only once, - % simply yielding the contents of . (We also do this for - % the toc entries.) - \toks0 = {#1}% - \message{(\the\toks0)}% - % - \chapmacro{#1}{Ynothing}{\the\unnumberedno}% - % - \global\let\section = \unnumberedsec - \global\let\subsection = \unnumberedsubsec - \global\let\subsubsection = \unnumberedsubsubsec -} - -% @centerchap is like @unnumbered, but the heading is centered. -\outer\parseargdef\centerchap{% - % Well, we could do the following in a group, but that would break - % an assumption that \chapmacro is called at the outermost level. - % Thus we are safer this way: --kasal, 24feb04 - \let\centerparametersmaybe = \centerparameters - \unnmhead0{#1}% - \let\centerparametersmaybe = \relax -} - -% @top is like @unnumbered. -\let\top\unnumbered - -% Sections. -\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz -\def\seczzz#1{% - \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 - \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% -} - -\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz#1{% - \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 - \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% -} -\let\appendixsec\appendixsection - -\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz#1{% - \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 - \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% -} - -% Subsections. -\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz#1{% - \global\subsubsecno=0 \global\advance\subsecno by 1 - \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% -} - -\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz#1{% - \global\subsubsecno=0 \global\advance\subsecno by 1 - \sectionheading{#1}{subsec}{Yappendix}% - {\appendixletter.\the\secno.\the\subsecno}% -} - -\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz#1{% - \global\subsubsecno=0 \global\advance\subsecno by 1 - \sectionheading{#1}{subsec}{Ynothing}% - {\the\unnumberedno.\the\secno.\the\subsecno}% -} - -% Subsubsections. -\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz#1{% - \global\advance\subsubsecno by 1 - \sectionheading{#1}{subsubsec}{Ynumbered}% - {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% -} - -\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz#1{% - \global\advance\subsubsecno by 1 - \sectionheading{#1}{subsubsec}{Yappendix}% - {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% -} - -\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz#1{% - \global\advance\subsubsecno by 1 - \sectionheading{#1}{subsubsec}{Ynothing}% - {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% -} - -% These macros control what the section commands do, according -% to what kind of chapter we are in (ordinary, appendix, or unnumbered). -% Define them by default for a numbered chapter. -\let\section = \numberedsec -\let\subsection = \numberedsubsec -\let\subsubsection = \numberedsubsubsec - -% Define @majorheading, @heading and @subheading - -% NOTE on use of \vbox for chapter headings, section headings, and such: -% 1) We use \vbox rather than the earlier \line to permit -% overlong headings to fold. -% 2) \hyphenpenalty is set to 10000 because hyphenation in a -% heading is obnoxious; this forbids it. -% 3) Likewise, headings look best if no \parindent is used, and -% if justification is not attempted. Hence \raggedright. - - -\def\majorheading{% - {\advance\chapheadingskip by 10pt \chapbreak }% - \parsearg\chapheadingzzz -} - -\def\chapheading{\chapbreak \parsearg\chapheadingzzz} -\def\chapheadingzzz#1{% - {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}% - \bigskip \par\penalty 200\relax - \suppressfirstparagraphindent -} - -% @heading, @subheading, @subsubheading. -\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} - \suppressfirstparagraphindent} -\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} - \suppressfirstparagraphindent} -\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} - \suppressfirstparagraphindent} - -% These macros generate a chapter, section, etc. heading only -% (including whitespace, linebreaking, etc. around it), -% given all the information in convenient, parsed form. - -%%% Args are the skip and penalty (usually negative) -\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} - -%%% Define plain chapter starts, and page on/off switching for it -% Parameter controlling skip before chapter headings (if needed) - -\newskip\chapheadingskip - -\def\chapbreak{\dobreak \chapheadingskip {-4000}} -\def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} - -\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} - -\def\CHAPPAGoff{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chapbreak -\global\let\pagealignmacro=\chappager} - -\def\CHAPPAGon{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chappager -\global\let\pagealignmacro=\chappager -\global\def\HEADINGSon{\HEADINGSsingle}} - -\def\CHAPPAGodd{% -\global\let\contentsalignmacro = \chapoddpage -\global\let\pchapsepmacro=\chapoddpage -\global\let\pagealignmacro=\chapoddpage -\global\def\HEADINGSon{\HEADINGSdouble}} - -\CHAPPAGon - -% Chapter opening. -% -% #1 is the text, #2 is the section type (Ynumbered, Ynothing, -% Yappendix, Yomitfromtoc), #3 the chapter number. -% -% To test against our argument. -\def\Ynothingkeyword{Ynothing} -\def\Yomitfromtockeyword{Yomitfromtoc} -\def\Yappendixkeyword{Yappendix} -% -\def\chapmacro#1#2#3{% - \pchapsepmacro - {% - \chapfonts \rm - % - % Have to define \thissection before calling \donoderef, because the - % xref code eventually uses it. On the other hand, it has to be called - % after \pchapsepmacro, or the headline will change too soon. - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% - % - % Only insert the separating space if we have a chapter/appendix - % number, and don't print the unnumbered ``number''. - \def\temptype{#2}% - \ifx\temptype\Ynothingkeyword - \setbox0 = \hbox{}% - \def\toctype{unnchap}% - \gdef\thischapter{#1}% - \else\ifx\temptype\Yomitfromtockeyword - \setbox0 = \hbox{}% contents like unnumbered, but no toc entry - \def\toctype{omit}% - \gdef\thischapter{}% - \else\ifx\temptype\Yappendixkeyword - \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% - \def\toctype{app}% - % We don't substitute the actual chapter name into \thischapter - % because we don't want its macros evaluated now. And we don't - % use \thissection because that changes with each section. - % - \xdef\thischapter{\putwordAppendix{} \appendixletter: - \noexpand\thischaptername}% - \else - \setbox0 = \hbox{#3\enspace}% - \def\toctype{numchap}% - \xdef\thischapter{\putwordChapter{} \the\chapno: - \noexpand\thischaptername}% - \fi\fi\fi - % - % Write the toc entry for this chapter. Must come before the - % \donoderef, because we include the current node name in the toc - % entry, and \donoderef resets it to empty. - \writetocentry{\toctype}{#1}{#3}% - % - % For pdftex, we have to write out the node definition (aka, make - % the pdfdest) after any page break, but before the actual text has - % been typeset. If the destination for the pdf outline is after the - % text, then jumping from the outline may wind up with the text not - % being visible, for instance under high magnification. - \donoderef{#2}% - % - % Typeset the actual heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent=\wd0 \centerparametersmaybe - \unhbox0 #1\par}% - }% - \nobreak\bigskip % no page break after a chapter title - \nobreak -} - -% @centerchap -- centered and unnumbered. -\let\centerparametersmaybe = \relax -\def\centerparameters{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt -} - - -% I don't think this chapter style is supported any more, so I'm not -% updating it with the new noderef stuff. We'll see. --karl, 11aug03. -% -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} -% -\def\unnchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak -} -\def\chfopen #1#2{\chapoddpage {\chapfonts -\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% -\par\penalty 5000 % -} -\def\centerchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak -} -\def\CHAPFopen{% - \global\let\chapmacro=\chfopen - \global\let\centerchapmacro=\centerchfopen} - - -% Section titles. These macros combine the section number parts and -% call the generic \sectionheading to do the printing. -% -\newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip{-1000}} - -% Subsection titles. -\newskip\subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} - -% Subsubsection titles. -\def\subsubsecheadingskip{\subsecheadingskip} -\def\subsubsecheadingbreak{\subsecheadingbreak} - - -% Print any size, any type, section title. -% -% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is -% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the -% section number. -% -\def\sectionheading#1#2#3#4{% - {% - % Switch to the right set of fonts. - \csname #2fonts\endcsname \rm - % - % Insert space above the heading. - \csname #2headingbreak\endcsname - % - % Only insert the space after the number if we have a section number. - \def\sectionlevel{#2}% - \def\temptype{#3}% - % - \ifx\temptype\Ynothingkeyword - \setbox0 = \hbox{}% - \def\toctype{unn}% - \gdef\thissection{#1}% - \else\ifx\temptype\Yomitfromtockeyword - % for @headings -- no section number, don't include in toc, - % and don't redefine \thissection. - \setbox0 = \hbox{}% - \def\toctype{omit}% - \let\sectionlevel=\empty - \else\ifx\temptype\Yappendixkeyword - \setbox0 = \hbox{#4\enspace}% - \def\toctype{app}% - \gdef\thissection{#1}% - \else - \setbox0 = \hbox{#4\enspace}% - \def\toctype{num}% - \gdef\thissection{#1}% - \fi\fi\fi - % - % Write the toc entry (before \donoderef). See comments in \chapmacro. - \writetocentry{\toctype\sectionlevel}{#1}{#4}% - % - % Write the node reference (= pdf destination for pdftex). - % Again, see comments in \chapmacro. - \donoderef{#3}% - % - % Interline glue will be inserted when the vbox is completed. - % That glue will be a valid breakpoint for the page, since it'll be - % preceded by a whatsit (usually from the \donoderef, or from the - % \writetocentry if there was no node). We don't want to allow that - % break, since then the whatsits could end up on page n while the - % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. - \nobreak - % - % Output the actual section heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent=\wd0 % zero if no section number - \unhbox0 #1}% - }% - % Add extra space after the heading -- half of whatever came above it. - % Don't allow stretch, though. - \kern .5 \csname #2headingskip\endcsname - % - % Do not let the kern be a potential breakpoint, as it would be if it - % was followed by glue. - \nobreak - % - % We'll almost certainly start a paragraph next, so don't let that - % glue accumulate. (Not a breakpoint because it's preceded by a - % discardable item.) - \vskip-\parskip - % - % This is purely so the last item on the list is a known \penalty > - % 10000. This is so \startdefun can avoid allowing breakpoints after - % section headings. Otherwise, it would insert a valid breakpoint between: - % - % @section sec-whatever - % @deffn def-whatever - \penalty 10001 -} - - -\message{toc,} -% Table of contents. -\newwrite\tocfile - -% Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. -% -% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} -% We append the current node name (if any) and page number as additional -% arguments for the \{chap,sec,...}entry macros which will eventually -% read this. The node name is used in the pdf outlines as the -% destination to jump to. -% -% We open the .toc file for writing here instead of at @setfilename (or -% any other fixed time) so that @contents can be anywhere in the document. -% But if #1 is `omit', then we don't do anything. This is used for the -% table of contents chapter openings themselves. -% -\newif\iftocfileopened -\def\omitkeyword{omit}% -% -\def\writetocentry#1#2#3{% - \edef\writetoctype{#1}% - \ifx\writetoctype\omitkeyword \else - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue - \fi - % - \iflinks - {\atdummies - \edef\temp{% - \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% - \temp - }% - \fi - \fi - % - % Tell \shipout to create a pdf destination on each page, if we're - % writing pdf. These are used in the table of contents. We can't - % just write one on every page because the title pages are numbered - % 1 and 2 (the page numbers aren't printed), and so are the first - % two pages of the document. Thus, we'd have two destinations named - % `1', and two named `2'. - \ifpdf \global\pdfmakepagedesttrue \fi -} - - -% These characters do not print properly in the Computer Modern roman -% fonts, so we must take special care. This is more or less redundant -% with the Texinfo input format setup at the end of this file. -% -\def\activecatcodes{% - \catcode`\"=\active - \catcode`\$=\active - \catcode`\<=\active - \catcode`\>=\active - \catcode`\\=\active - \catcode`\^=\active - \catcode`\_=\active - \catcode`\|=\active - \catcode`\~=\active -} - - -% Read the toc file, which is essentially Texinfo input. -\def\readtocfile{% - \setupdatafile - \activecatcodes - \input \jobname.toc -} - -\newskip\contentsrightmargin \contentsrightmargin=1in -\newcount\savepageno -\newcount\lastnegativepageno \lastnegativepageno = -1 - -% Prepare to read what we've written to \tocfile. -% -\def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund - \contentsalignmacro - \immediate\closeout\tocfile - % - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \def\thischapter{}% - \chapmacro{#1}{Yomitfromtoc}{}% - % - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. - % - % Roman numerals for page numbers. - \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi -} - - -% Normal (long) toc. -\def\contents{% - \startcontents{\putwordTOC}% - \openin 1 \jobname.toc - \ifeof 1 \else - \readtocfile - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \ifeof 1 \else - \pdfmakeoutlines - \fi - \closein 1 - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno -} - -% And just the chapters. -\def\summarycontents{% - \startcontents{\putwordShortTOC}% - % - \let\numchapentry = \shortchapentry - \let\appentry = \shortchapentry - \let\unnchapentry = \shortunnchapentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf - \let\sl=\shortcontsl \let\tt=\shortconttt - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\numsecentry##1##2##3##4{} - \let\appsecentry = \numsecentry - \let\unnsecentry = \numsecentry - \let\numsubsecentry = \numsecentry - \let\appsubsecentry = \numsecentry - \let\unnsubsecentry = \numsecentry - \let\numsubsubsecentry = \numsecentry - \let\appsubsubsecentry = \numsecentry - \let\unnsubsubsecentry = \numsecentry - \openin 1 \jobname.toc - \ifeof 1 \else - \readtocfile - \fi - \closein 1 - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno -} -\let\shortcontents = \summarycontents - -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g., `A' for an appendix, or `3' for a chapter. -% -\def\shortchaplabel#1{% - % This space should be enough, since a single number is .5em, and the - % widest letter (M) is 1em, at least in the Computer Modern fonts. - % But use \hss just in case. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) - % - % We'd like to right-justify chapter numbers, but that looks strange - % with appendix letters. And right-justifying numbers and - % left-justifying letters looks strange when there is less than 10 - % chapters. Have to read the whole toc once to know how many chapters - % there are before deciding ... - \hbox to 1em{#1\hss}% -} - -% These macros generate individual entries in the table of contents. -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... - -% Chapters, in the main contents. -\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} -% -% Chapters, in the short toc. -% See comments in \dochapentry re vbox and related settings. -\def\shortchapentry#1#2#3#4{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% -} - -% Appendices, in the main contents. -% Need the word Appendix, and a fixed-size box. -% -\def\appendixbox#1{% - % We use M since it's probably the widest letter. - \setbox0 = \hbox{\putwordAppendix{} M}% - \hbox to \wd0{\putwordAppendix{} #1\hss}} -% -\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} - -% Unnumbered chapters. -\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} -\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} - -% Sections. -\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} -\let\appsecentry=\numsecentry -\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} - -% Subsections. -\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} -\let\appsubsecentry=\numsubsecentry -\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} - -% And subsubsections. -\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} -\let\appsubsubsecentry=\numsubsubsecentry -\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} - -% This parameter controls the indentation of the various levels. -% Same as \defaultparindent. -\newdimen\tocindent \tocindent = 15pt - -% Now for the actual typesetting. In all these, #1 is the text and #2 is the -% page number. -% -% If the toc has to be broken over pages, we want it to be at chapters -% if at all possible; hence the \penalty. -\def\dochapentry#1#2{% - \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip - \begingroup - \chapentryfonts - \tocentry{#1}{\dopageno\bgroup#2\egroup}% - \endgroup - \nobreak\vskip .25\baselineskip plus.1\baselineskip -} - -\def\dosecentry#1#2{\begingroup - \secentryfonts \leftskip=\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsecentry#1#2{\begingroup - \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsubsecentry#1#2{\begingroup - \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -% We use the same \entry macro as for the index entries. -\let\tocentry = \entry - -% Space between chapter (or whatever) number and the title. -\def\labelspace{\hskip1em \relax} - -\def\dopageno#1{{\rm #1}} -\def\doshortpageno#1{{\rm #1}} - -\def\chapentryfonts{\secfonts \rm} -\def\secentryfonts{\textfonts} -\def\subsecentryfonts{\textfonts} -\def\subsubsecentryfonts{\textfonts} - - -\message{environments,} -% @foo ... @end foo. - -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -% -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% The @error{} command. -% Adapted from the TeXbook's \boxit. -% -\newbox\errorbox -% -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} -% -\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{% - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} -% -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. -% One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. - -\envdef\tex{% - \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 - \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie - \catcode `\%=14 - \catcode `\+=\other - \catcode `\"=\other - \catcode `\|=\other - \catcode `\<=\other - \catcode `\>=\other - \escapechar=`\\ - % - \let\b=\ptexb - \let\bullet=\ptexbullet - \let\c=\ptexc - \let\,=\ptexcomma - \let\.=\ptexdot - \let\dots=\ptexdots - \let\equiv=\ptexequiv - \let\!=\ptexexclam - \let\i=\ptexi - \let\indent=\ptexindent - \let\noindent=\ptexnoindent - \let\{=\ptexlbrace - \let\+=\tabalign - \let\}=\ptexrbrace - \let\/=\ptexslash - \let\*=\ptexstar - \let\t=\ptext - \let\frenchspacing=\plainfrenchspacing - % - \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% - \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% - \def\@{@}% -} -% There is no need to define \Etex. - -% Define @lisp ... @end lisp. -% @lisp environment forms a group so it can rebind things, -% including the definition of @end lisp (which normally is erroneous). - -% Amount to narrow the margins by for @lisp. -\newskip\lispnarrowing \lispnarrowing=0.4in - -% This is the definition that ^^M gets inside @lisp, @example, and other -% such environments. \null is better than a space, since it doesn't -% have any width. -\def\lisppar{\null\endgraf} - -% This space is always present above and below environments. -\newskip\envskipamount \envskipamount = 0pt - -% Make spacing and below environment symmetrical. We use \parskip here -% to help in doing that, since in @example-like environments \parskip -% is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip. -% -\def\aboveenvbreak{{% - % =10000 instead of <10000 because of a special case in \itemzzz and - % \sectionheading, q.v. - \ifnum \lastpenalty=10000 \else - \advance\envskipamount by \parskip - \endgraf - \ifdim\lastskip<\envskipamount - \removelastskip - % it's not a good place to break if the last penalty was \nobreak - % or better ... - \ifnum\lastpenalty<10000 \penalty-50 \fi - \vskip\envskipamount - \fi - \fi -}} - -\let\afterenvbreak = \aboveenvbreak - -% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will -% also clear it, so that its embedded environments do the narrowing again. -\let\nonarrowing=\relax - -% @cartouche ... @end cartouche: draw rectangle w/rounded corners around -% environment contents. -\font\circle=lcircle10 -\newdimen\circthick -\newdimen\cartouter\newdimen\cartinner -\newskip\normbskip\newskip\normpskip\newskip\normlskip -\circthick=\fontdimen8\circle -% -\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth -\def\ctr{{\hskip 6pt\circle\char'010}} -\def\cbl{{\circle\char'012\hskip -6pt}} -\def\cbr{{\hskip 6pt\circle\char'011}} -\def\carttop{\hbox to \cartouter{\hskip\lskip - \ctl\leaders\hrule height\circthick\hfil\ctr - \hskip\rskip}} -\def\cartbot{\hbox to \cartouter{\hskip\lskip - \cbl\leaders\hrule height\circthick\hfil\cbr - \hskip\rskip}} -% -\newskip\lskip\newskip\rskip - -\envdef\cartouche{% - \ifhmode\par\fi % can't be in the midst of a paragraph. - \startsavinginserts - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt % we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either - % side, and for 6pt waste from - % each corner char, and rule thickness - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing = t% - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \kern3pt - \hsize=\cartinner - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip - \comment % For explanation, see the end of \def\group. -} -\def\Ecartouche{% - \ifhmode\par\fi - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup - \checkinserts -} - - -% This macro is called at the beginning of all the @example variants, -% inside a group. -\def\nonfillstart{% - \aboveenvbreak - \hfuzz = 12pt % Don't be fussy - \sepspaces % Make spaces be word-separators rather than space tokens. - \let\par = \lisppar % don't ignore blank lines - \obeylines % each line of input is a line of output - \parskip = 0pt - \parindent = 0pt - \emergencystretch = 0pt % don't try to avoid overfull boxes - \ifx\nonarrowing\relax - \advance \leftskip by \lispnarrowing - \exdentamount=\lispnarrowing - \else - \let\nonarrowing = \relax - \fi - \let\exdent=\nofillexdent -} - -% If you want all examples etc. small: @set dispenvsize small. -% If you want even small examples the full size: @set dispenvsize nosmall. -% This affects the following displayed environments: -% @example, @display, @format, @lisp -% -\def\smallword{small} -\def\nosmallword{nosmall} -\let\SETdispenvsize\relax -\def\setnormaldispenv{% - \ifx\SETdispenvsize\smallword - \smallexamplefonts \rm - \fi -} -\def\setsmalldispenv{% - \ifx\SETdispenvsize\nosmallword - \else - \smallexamplefonts \rm - \fi -} - -% We often define two environments, @foo and @smallfoo. -% Let's do it by one command: -\def\makedispenv #1#2{ - \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} - \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} - \expandafter\let\csname E#1\endcsname \afterenvbreak - \expandafter\let\csname Esmall#1\endcsname \afterenvbreak -} - -% Define two synonyms: -\def\maketwodispenvs #1#2#3{ - \makedispenv{#1}{#3} - \makedispenv{#2}{#3} -} - -% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. -% -% @smallexample and @smalllisp: use smaller fonts. -% Originally contributed by Pavel@xerox. -% -\maketwodispenvs {lisp}{example}{% - \nonfillstart - \tt - \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return -} - -% @display/@smalldisplay: same as @lisp except keep current font. -% -\makedispenv {display}{% - \nonfillstart - \gobble -} - -% @format/@smallformat: same as @display except don't narrow margins. -% -\makedispenv{format}{% - \let\nonarrowing = t% - \nonfillstart - \gobble -} - -% @flushleft: same as @format, but doesn't obey \SETdispenvsize. -\envdef\flushleft{% - \let\nonarrowing = t% - \nonfillstart - \gobble -} -\let\Eflushleft = \afterenvbreak - -% @flushright. -% -\envdef\flushright{% - \let\nonarrowing = t% - \nonfillstart - \advance\leftskip by 0pt plus 1fill - \gobble -} -\let\Eflushright = \afterenvbreak - - -% @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. We keep \parskip nonzero in general, since -% we're doing normal filling. So, when using \aboveenvbreak and -% \afterenvbreak, temporarily make \parskip 0. -% -\envdef\quotation{% - {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \parindent=0pt - % - % @cartouche defines \nonarrowing to inhibit narrowing at next level down. - \ifx\nonarrowing\relax - \advance\leftskip by \lispnarrowing - \advance\rightskip by \lispnarrowing - \exdentamount = \lispnarrowing - \else - \let\nonarrowing = \relax - \fi - \parsearg\quotationlabel -} - -% We have retained a nonzero parskip for the environment, since we're -% doing normal filling. -% -\def\Equotation{% - \par - \ifx\quotationauthor\undefined\else - % indent a bit. - \leftline{\kern 2\leftskip \sl ---\quotationauthor}% - \fi - {\parskip=0pt \afterenvbreak}% -} - -% If we're given an argument, typeset it in bold with a colon after. -\def\quotationlabel#1{% - \def\temp{#1}% - \ifx\temp\empty \else - {\bf #1: }% - \fi -} - - -% LaTeX-like @verbatim...@end verbatim and @verb{...} -% If we want to allow any as delimiter, -% we need the curly braces so that makeinfo sees the @verb command, eg: -% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org -% -% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. -% -% [Knuth] p.344; only we need to do the other characters Texinfo sets -% active too. Otherwise, they get lost as the first character on a -% verbatim line. -\def\dospecials{% - \do\ \do\\\do\{\do\}\do\$\do\&% - \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% - \do\<\do\>\do\|\do\@\do+\do\"% -} -% -% [Knuth] p. 380 -\def\uncatcodespecials{% - \def\do##1{\catcode`##1=\other}\dospecials} -% -% [Knuth] pp. 380,381,391 -% Disable Spanish ligatures ?` and !` of \tt font -\begingroup - \catcode`\`=\active\gdef`{\relax\lq} -\endgroup -% -% Setup for the @verb command. -% -% Eight spaces for a tab -\begingroup - \catcode`\^^I=\active - \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} -\endgroup -% -\def\setupverb{% - \tt % easiest (and conventionally used) font for verbatim - \def\par{\leavevmode\endgraf}% - \catcode`\`=\active - \tabeightspaces - % Respect line breaks, - % print special symbols as themselves, and - % make each space count - % must do in this order: - \obeylines \uncatcodespecials \sepspaces -} - -% Setup for the @verbatim environment -% -% Real tab expansion -\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount -% -\def\starttabbox{\setbox0=\hbox\bgroup} -\begingroup - \catcode`\^^I=\active - \gdef\tabexpand{% - \catcode`\^^I=\active - \def^^I{\leavevmode\egroup - \dimen0=\wd0 % the width so far, or since the previous tab - \divide\dimen0 by\tabw - \multiply\dimen0 by\tabw % compute previous multiple of \tabw - \advance\dimen0 by\tabw % advance to next multiple of \tabw - \wd0=\dimen0 \box0 \starttabbox - }% - } -\endgroup -\def\setupverbatim{% - \let\nonarrowing = t% - \nonfillstart - % Easiest (and conventionally used) font for verbatim - \tt - \def\par{\leavevmode\egroup\box0\endgraf}% - \catcode`\`=\active - \tabexpand - % Respect line breaks, - % print special symbols as themselves, and - % make each space count - % must do in this order: - \obeylines \uncatcodespecials \sepspaces - \everypar{\starttabbox}% -} - -% Do the @verb magic: verbatim text is quoted by unique -% delimiter characters. Before first delimiter expect a -% right brace, after last delimiter expect closing brace: -% -% \def\doverb'{'#1'}'{#1} -% -% [Knuth] p. 382; only eat outer {} -\begingroup - \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other - \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] -\endgroup -% -\def\verb{\begingroup\setupverb\doverb} -% -% -% Do the @verbatim magic: define the macro \doverbatim so that -% the (first) argument ends when '@end verbatim' is reached, ie: -% -% \def\doverbatim#1@end verbatim{#1} -% -% For Texinfo it's a lot easier than for LaTeX, -% because texinfo's \verbatim doesn't stop at '\end{verbatim}': -% we need not redefine '\', '{' and '}'. -% -% Inspired by LaTeX's verbatim command set [latex.ltx] -% -\begingroup - \catcode`\ =\active - \obeylines % - % ignore everything up to the first ^^M, that's the newline at the end - % of the @verbatim input line itself. Otherwise we get an extra blank - % line in the output. - \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% - % We really want {...\end verbatim} in the body of the macro, but - % without the active space; thus we have to use \xdef and \gobble. -\endgroup -% -\envdef\verbatim{% - \setupverbatim\doverbatim -} -\let\Everbatim = \afterenvbreak - - -% @verbatiminclude FILE - insert text of file in verbatim environment. -% -\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} -% -\def\doverbatiminclude#1{% - {% - \makevalueexpandable - \setupverbatim - \input #1 - \afterenvbreak - }% -} - -% @copying ... @end copying. -% Save the text away for @insertcopying later. -% -% We save the uninterpreted tokens, rather than creating a box. -% Saving the text in a box would be much easier, but then all the -% typesetting commands (@smallbook, font changes, etc.) have to be done -% beforehand -- and a) we want @copying to be done first in the source -% file; b) letting users define the frontmatter in as flexible order as -% possible is very desirable. -% -\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} -\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} -% -\def\insertcopying{% - \begingroup - \parindent = 0pt % paragraph indentation looks wrong on title page - \scanexp\copyingtext - \endgroup -} - -\message{defuns,} -% @defun etc. - -\newskip\defbodyindent \defbodyindent=.4in -\newskip\defargsindent \defargsindent=50pt -\newskip\deflastargmargin \deflastargmargin=18pt - -% Start the processing of @deffn: -\def\startdefun{% - \ifnum\lastpenalty<10000 - \medbreak - \else - % If there are two @def commands in a row, we'll have a \nobreak, - % which is there to keep the function description together with its - % header. But if there's nothing but headers, we need to allow a - % break somewhere. Check specifically for penalty 10002, inserted - % by \defargscommonending, instead of 10000, since the sectioning - % commands also insert a nobreak penalty, and we don't want to allow - % a break between a section heading and a defun. - % - \ifnum\lastpenalty=10002 \penalty2000 \fi - % - % Similarly, after a section heading, do not allow a break. - % But do insert the glue. - \medskip % preceded by discardable penalty, so not a breakpoint - \fi - % - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent -} - -\def\dodefunx#1{% - % First, check whether we are in the right environment: - \checkenv#1% - % - % As above, allow line break if we have multiple x headers in a row. - % It's not a great place, though. - \ifnum\lastpenalty=10002 \penalty3000 \fi - % - % And now, it's time to reuse the body of the original defun: - \expandafter\gobbledefun#1% -} -\def\gobbledefun#1\startdefun{} - -% \printdefunline \deffnheader{text} -% -\def\printdefunline#1#2{% - \begingroup - % call \deffnheader: - #1#2 \endheader - % common ending: - \interlinepenalty = 10000 - \advance\rightskip by 0pt plus 1fil - \endgraf - \nobreak\vskip -\parskip - \penalty 10002 % signal to \startdefun and \dodefunx - % Some of the @defun-type tags do not enable magic parentheses, - % rendering the following check redundant. But we don't optimize. - \checkparencounts - \endgroup -} - -\def\Edefun{\endgraf\medbreak} - -% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; -% the only thing remainnig is to define \deffnheader. -% -\def\makedefun#1{% - \expandafter\let\csname E#1\endcsname = \Edefun - \edef\temp{\noexpand\domakedefun - \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% - \temp -} - -% \domakedefun \deffn \deffnx \deffnheader -% -% Define \deffn and \deffnx, without parameters. -% \deffnheader has to be defined explicitly. -% -\def\domakedefun#1#2#3{% - \envdef#1{% - \startdefun - \parseargusing\activeparens{\printdefunline#3}% - }% - \def#2{\dodefunx#1}% - \def#3% -} - -%%% Untyped functions: - -% @deffn category name args -\makedefun{deffn}{\deffngeneral{}} - -% @deffn category class name args -\makedefun{defop}#1 {\defopon{#1\ \putwordon}} - -% \defopon {category on}class name args -\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } - -% \deffngeneral {subind}category name args -% -\def\deffngeneral#1#2 #3 #4\endheader{% - % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. - \dosubind{fn}{\code{#3}}{#1}% - \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% -} - -%%% Typed functions: - -% @deftypefn category type name args -\makedefun{deftypefn}{\deftypefngeneral{}} - -% @deftypeop category class type name args -\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} - -% \deftypeopon {category on}class type name args -\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } - -% \deftypefngeneral {subind}category type name args -% -\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% - \dosubind{fn}{\code{#4}}{#1}% - \defname{#2}{#3}{#4}\defunargs{#5\unskip}% -} - -%%% Typed variables: - -% @deftypevr category type var args -\makedefun{deftypevr}{\deftypecvgeneral{}} - -% @deftypecv category class type var args -\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} - -% \deftypecvof {category of}class type var args -\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } - -% \deftypecvgeneral {subind}category type var args -% -\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% - \dosubind{vr}{\code{#4}}{#1}% - \defname{#2}{#3}{#4}\defunargs{#5\unskip}% -} - -%%% Untyped variables: - -% @defvr category var args -\makedefun{defvr}#1 {\deftypevrheader{#1} {} } - -% @defcv category class var args -\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} - -% \defcvof {category of}class var args -\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } - -%%% Type: -% @deftp category name args -\makedefun{deftp}#1 #2 #3\endheader{% - \doind{tp}{\code{#2}}% - \defname{#1}{}{#2}\defunargs{#3\unskip}% -} - -% Remaining @defun-like shortcuts: -\makedefun{defun}{\deffnheader{\putwordDeffunc} } -\makedefun{defmac}{\deffnheader{\putwordDefmac} } -\makedefun{defspec}{\deffnheader{\putwordDefspec} } -\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } -\makedefun{defvar}{\defvrheader{\putwordDefvar} } -\makedefun{defopt}{\defvrheader{\putwordDefopt} } -\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } -\makedefun{defmethod}{\defopon\putwordMethodon} -\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} -\makedefun{defivar}{\defcvof\putwordInstanceVariableof} -\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} - -% \defname, which formats the name of the @def (not the args). -% #1 is the category, such as "Function". -% #2 is the return type, if any. -% #3 is the function name. -% -% We are followed by (but not passed) the arguments, if any. -% -\def\defname#1#2#3{% - % Get the values of \leftskip and \rightskip as they were outside the @def... - \advance\leftskip by -\defbodyindent - % - % How we'll format the type name. Putting it in brackets helps - % distinguish it from the body text that may end up on the next line - % just below it. - \def\temp{#1}% - \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} - % - % Figure out line sizes for the paragraph shape. - % The first line needs space for \box0; but if \rightskip is nonzero, - % we need only space for the part of \box0 which exceeds it: - \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip - % The continuations: - \dimen2=\hsize \advance\dimen2 by -\defargsindent - % (plain.tex says that \dimen1 should be used only as global.) - \parshape 2 0in \dimen0 \defargsindent \dimen2 - % - % Put the type name to the right margin. - \noindent - \hbox to 0pt{% - \hfil\box0 \kern-\hsize - % \hsize has to be shortened this way: - \kern\leftskip - % Intentionally do not respect \rightskip, since we need the space. - }% - % - % Allow all lines to be underfull without complaint: - \tolerance=10000 \hbadness=10000 - \exdentamount=\defbodyindent - {% - % defun fonts. We use typewriter by default (used to be bold) because: - % . we're printing identifiers, they should be in tt in principle. - % . in languages with many accents, such as Czech or French, it's - % common to leave accents off identifiers. The result looks ok in - % tt, but exceedingly strange in rm. - % . we don't want -- and --- to be treated as ligatures. - % . this still does not fix the ?` and !` ligatures, but so far no - % one has made identifiers using them :). - \df \tt - \def\temp{#2}% return value type - \ifx\temp\empty\else \tclose{\temp} \fi - #3% output function name - }% - {\rm\enskip}% hskip 0.5 em of \tenrm - % - \boldbrax - % arguments will be output next, if any. -} - -% Print arguments in slanted roman (not ttsl), inconsistently with using -% tt for the name. This is because literal text is sometimes needed in -% the argument list (groff manual), and ttsl and tt are not very -% distinguishable. Prevent hyphenation at `-' chars. -% -\def\defunargs#1{% - % use sl by default (not ttsl), - % tt for the names. - \df \sl \hyphenchar\font=0 - % - % On the other hand, if an argument has two dashes (for instance), we - % want a way to get ttsl. Let's try @var for that. - \let\var=\ttslanted - #1% - \sl\hyphenchar\font=45 -} - -% We want ()&[] to print specially on the defun line. -% -\def\activeparens{% - \catcode`\(=\active \catcode`\)=\active - \catcode`\[=\active \catcode`\]=\active - \catcode`\&=\active -} - -% Make control sequences which act like normal parenthesis chars. -\let\lparen = ( \let\rparen = ) - -% Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. -{ - \activeparens - \global\let(=\lparen \global\let)=\rparen - \global\let[=\lbrack \global\let]=\rbrack - \global\let& = \& - - \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} - \gdef\magicamp{\let&=\amprm} -} - -\newcount\parencount - -% If we encounter &foo, then turn on ()-hacking afterwards -\newif\ifampseen -\def\amprm#1 {\ampseentrue{\bf\ }} - -\def\parenfont{% - \ifampseen - % At the first level, print parens in roman, - % otherwise use the default font. - \ifnum \parencount=1 \rm \fi - \else - % The \sf parens (in \boldbrax) actually are a little bolder than - % the contained text. This is especially needed for [ and ] . - \sf - \fi -} -\def\infirstlevel#1{% - \ifampseen - \ifnum\parencount=1 - #1% - \fi - \fi -} -\def\bfafterword#1 {#1 \bf} - -\def\opnr{% - \global\advance\parencount by 1 - {\parenfont(}% - \infirstlevel \bfafterword -} -\def\clnr{% - {\parenfont)}% - \infirstlevel \sl - \global\advance\parencount by -1 -} - -\newcount\brackcount -\def\lbrb{% - \global\advance\brackcount by 1 - {\bf[}% -} -\def\rbrb{% - {\bf]}% - \global\advance\brackcount by -1 -} - -\def\checkparencounts{% - \ifnum\parencount=0 \else \badparencount \fi - \ifnum\brackcount=0 \else \badbrackcount \fi -} -\def\badparencount{% - \errmessage{Unbalanced parentheses in @def}% - \global\parencount=0 -} -\def\badbrackcount{% - \errmessage{Unbalanced square braces in @def}% - \global\brackcount=0 -} - - -\message{macros,} -% @macro. - -% To do this right we need a feature of e-TeX, \scantokens, -% which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined - \newwrite\macscribble - \def\scantokens#1{% - \toks0={#1}% - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{\the\toks0}% - \immediate\closeout\macscribble - \input \jobname.tmp - } -\fi - -\def\scanmacro#1{% - \begingroup - \newlinechar`\^^M - \let\xeatspaces\eatspaces - % Undo catcode changes of \startcontents and \doprintindex - % When called from @insertcopying or (short)caption, we need active - % backslash to get it printed correctly. Previously, we had - % \catcode`\\=\other instead. We'll see whether a problem appears - % with macro expansion. --kasal, 19aug04 - \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ - % ... and \example - \spaceisspace - % - % Append \endinput to make sure that TeX does not see the ending newline. - % - % I've verified that it is necessary both for e-TeX and for ordinary TeX - % --kasal, 29nov03 - \scantokens{#1\endinput}% - \endgroup -} - -\def\scanexp#1{% - \edef\temp{\noexpand\scanmacro{#1}}% - \temp -} - -\newcount\paramno % Count of parameters -\newtoks\macname % Macro name -\newif\ifrecursive % Is it recursive? - -% List of all defined macros in the form -% \definedummyword\macro1\definedummyword\macro2... -% Currently is also contains all @aliases; the list can be split -% if there is a need. -\def\macrolist{} - -% Add the macro to \macrolist -\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} -\def\addtomacrolistxxx#1{% - \toks0 = \expandafter{\macrolist\definedummyword#1}% - \xdef\macrolist{\the\toks0}% -} - -% Utility routines. -% This does \let #1 = #2, with \csnames; that is, -% \let \csname#1\endcsname = \csname#2\endcsname -% (except of course we have to play expansion games). -% -\def\cslet#1#2{% - \expandafter\let - \csname#1\expandafter\endcsname - \csname#2\endcsname -} - -% Trim leading and trailing spaces off a string. -% Concepts from aro-bend problem 15 (see CTAN). -{\catcode`\@=11 -\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} -\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} -\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} -\def\unbrace#1{#1} -\unbrace{\gdef\trim@@@ #1 } #2@{#1} -} - -% Trim a single trailing ^^M off a string. -{\catcode`\^^M=\other \catcode`\Q=3% -\gdef\eatcr #1{\eatcra #1Q^^MQ}% -\gdef\eatcra#1^^MQ{\eatcrb#1Q}% -\gdef\eatcrb#1Q#2Q{#1}% -} - -% Macro bodies are absorbed as an argument in a context where -% all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - -% It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro -% body, and then making it the \newlinechar in \scanmacro. - -\def\scanctxt{% - \catcode`\"=\other - \catcode`\+=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\@=\other - \catcode`\^=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\~=\other -} - -\def\scanargctxt{% - \scanctxt - \catcode`\\=\other - \catcode`\^^M=\other -} - -\def\macrobodyctxt{% - \scanctxt - \catcode`\{=\other - \catcode`\}=\other - \catcode`\^^M=\other - \usembodybackslash -} - -\def\macroargctxt{% - \scanctxt - \catcode`\\=\other -} - -% \mbodybackslash is the definition of \ in @macro bodies. -% It maps \foo\ => \csname macarg.foo\endcsname => #N -% where N is the macro parameter number. -% We define \csname macarg.\endcsname to be \realbackslash, so -% \\ in macro replacement text gets you a backslash. - -{\catcode`@=0 @catcode`@\=@active - @gdef@usembodybackslash{@let\=@mbodybackslash} - @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} -} -\expandafter\def\csname macarg.\endcsname{\realbackslash} - -\def\macro{\recursivefalse\parsearg\macroxxx} -\def\rmacro{\recursivetrue\parsearg\macroxxx} - -\def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist - \ifx\argl\empty % no arguments - \paramno=0% - \else - \expandafter\parsemargdef \argl;% - \fi - \if1\csname ismacro.\the\macname\endcsname - \message{Warning: redefining \the\macname}% - \else - \expandafter\ifx\csname \the\macname\endcsname \relax - \else \errmessage{Macro name \the\macname\space already defined}\fi - \global\cslet{macsave.\the\macname}{\the\macname}% - \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% - \addtomacrolist{\the\macname}% - \fi - \begingroup \macrobodyctxt - \ifrecursive \expandafter\parsermacbody - \else \expandafter\parsemacbody - \fi} - -\parseargdef\unmacro{% - \if1\csname ismacro.#1\endcsname - \global\cslet{#1}{macsave.#1}% - \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist: - \begingroup - \expandafter\let\csname#1\endcsname \relax - \let\definedummyword\unmacrodo - \xdef\macrolist{\macrolist}% - \endgroup - \else - \errmessage{Macro #1 not defined}% - \fi -} - -% Called by \do from \dounmacro on each macro. The idea is to omit any -% macro definitions that have been changed to \relax. -% -\def\unmacrodo#1{% - \ifx #1\relax - % remove this - \else - \noexpand\definedummyword \noexpand#1% - \fi -} - -% This makes use of the obscure feature that if the last token of a -% is #, then the preceding argument is delimited by -% an opening brace, and that opening brace is not consumed. -\def\getargs#1{\getargsxxx#1{}} -\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} -\def\getmacargs#1{\def\argl{#1}} - -% Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. -% That gets used by \mbodybackslash (above). - -% We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something -% unexpandable, insert that wherever you need a #, and then redefine -% it to # just before using the token list produced. -% -% The same technique is used to protect \eatspaces till just before -% the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} -\def\parsemargdefxxx#1,{% - \if#1;\let\next=\relax - \else \let\next=\parsemargdefxxx - \advance\paramno by 1% - \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname - {\xeatspaces{\hash\the\paramno}}% - \edef\paramlist{\paramlist\hash\the\paramno,}% - \fi\next} - -% These two commands read recursive and nonrecursive macro bodies. -% (They're different since rec and nonrec macros end differently.) - -\long\def\parsemacbody#1@end macro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% -\long\def\parsermacbody#1@end rmacro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% - -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. -% Much magic with \expandafter here. -% \xdef is used so that macro definitions will survive the file -% they're defined in; @include reads the file inside a group. -\def\defmacro{% - \let\hash=##% convert placeholders to macro parameter chars - \ifrecursive - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\temp}}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% - \fi - \else - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \fi - \fi} - -\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} - -% \braceorline decides whether the next nonwhitespace character is a -% {. If so it reads up to the closing }, if not, it reads the whole -% line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} -\def\braceorlinexxx{% - \ifx\nchar\bgroup\else - \expandafter\parsearg - \fi \next} - - -% @alias. -% We need some trickery to remove the optional spaces around the equal -% sign. Just make them active and then expand them all to nothing. -\def\alias{\parseargusing\obeyspaces\aliasxxx} -\def\aliasxxx #1{\aliasyyy#1\relax} -\def\aliasyyy #1=#2\relax{% - {% - \expandafter\let\obeyedspace=\empty - \addtomacrolist{#1}% - \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% - }% - \next -} - - -\message{cross references,} - -\newwrite\auxfile - -\newif\ifhavexrefs % True if xref values are known. -\newif\ifwarnedxrefs % True if we warned once that they aren't known. - -% @inforef is relatively simple. -\def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, - node \samp{\ignorespaces#1{}}} - -% @node's only job in TeX is to define \lastnode, which is used in -% cross-references. The @node line might or might not have commas, and -% might or might not have spaces before the first comma, like: -% @node foo , bar , ... -% We don't want such trailing spaces in the node name. -% -\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} -% -% also remove a trailing comma, in case of something like this: -% @node Help-Cross, , , Cross-refs -\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} -\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} - -\let\nwnode=\node -\let\lastnode=\empty - -% Write a cross-reference definition for the current node. #1 is the -% type (Ynumbered, Yappendix, Ynothing). -% -\def\donoderef#1{% - \ifx\lastnode\empty\else - \setref{\lastnode}{#1}% - \global\let\lastnode=\empty - \fi -} - -% @anchor{NAME} -- define xref target at arbitrary point. -% -\newcount\savesfregister -% -\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} -\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} -\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} - -% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an -% anchor), which consists of three parts: -% 1) NAME-title - the current sectioning name taken from \thissection, -% or the anchor name. -% 2) NAME-snt - section number and type, passed as the SNT arg, or -% empty for anchors. -% 3) NAME-pg - the page number. -% -% This is called from \donoderef, \anchor, and \dofloat. In the case of -% floats, there is an additional part, which is not written here: -% 4) NAME-lof - the text as it should appear in a @listoffloats. -% -\def\setref#1#2{% - \pdfmkdest{#1}% - \iflinks - {% - \atdummies % preserve commands, but don't expand them - \edef\writexrdef##1##2{% - \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef - ##1}{##2}}% these are parameters of \writexrdef - }% - \toks0 = \expandafter{\thissection}% - \immediate \writexrdef{title}{\the\toks0 }% - \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. - \writexrdef{pg}{\folio}% will be written later, during \shipout - }% - \fi -} - -% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is -% the node name, #2 the name of the Info cross-reference, #3 the printed -% node name, #4 the name of the Info file, #5 the name of the printed -% manual. All but the node name can be omitted. -% -\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} -\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} -\def\ref#1{\xrefX[#1,,,,,,,]} -\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup - \unsepspaces - \def\printedmanual{\ignorespaces #5}% - \def\printedrefname{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual\unskip}% - \setbox0=\hbox{\printedrefname\unskip}% - \ifdim \wd0 = 0pt - % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. - \def\printedrefname{\ignorespaces #1}% - \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. - \def\printedrefname{\ignorespaces #1}% - \else - \ifhavexrefs - % We know the real title if we have the xref values. - \def\printedrefname{\refx{#1-title}{}}% - \else - % Otherwise just copy the Info node name. - \def\printedrefname{\ignorespaces #1}% - \fi% - \fi - \fi - \fi - % - % Make link in pdf output. - \ifpdf - \leavevmode - \getfilename{#4}% - {\turnoffactive - % See comments at \activebackslashdouble. - {\activebackslashdouble \xdef\pdfxrefdest{#1}% - \backslashparens\pdfxrefdest}% - % - \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{\pdfxrefdest}% - \else - \startlink attr{/Border [0 0 0]}% - goto name{\pdfmkpgn{\pdfxrefdest}}% - \fi - }% - \linkcolor - \fi - % - % Float references are printed completely differently: "Figure 1.2" - % instead of "[somenode], p.3". We distinguish them by the - % LABEL-title being set to a magic string. - {% - % Have to otherify everything special to allow the \csname to - % include an _ in the xref name, etc. - \indexnofonts - \turnoffactive - \expandafter\global\expandafter\let\expandafter\Xthisreftitle - \csname XR#1-title\endcsname - }% - \iffloat\Xthisreftitle - % If the user specified the print name (third arg) to the ref, - % print it instead of our usual "Figure 1.2". - \ifdim\wd0 = 0pt - \refx{#1-snt}{}% - \else - \printedrefname - \fi - % - % if the user also gave the printed manual name (fifth arg), append - % "in MANUALNAME". - \ifdim \wd1 > 0pt - \space \putwordin{} \cite{\printedmanual}% - \fi - \else - % node/anchor (non-float) references. - % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifdim \wd1 > 0pt - \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% - \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\turnoffactive - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi - }% - % output the `[mynode]' via a macro so it can be overridden. - \xrefprintnodename\printedrefname - % - % But we always want a comma and a space: - ,\space - % - % output the `page 3'. - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - \fi - \fi - \endlink -\endgroup} - -% This macro is called from \xrefX for the `[nodename]' part of xref -% output. It's a separate macro only so it can be changed more easily, -% since square brackets don't work well in some documents. Particularly -% one that Bob is working on :). -% -\def\xrefprintnodename#1{[#1]} - -% Things referred to by \setref. -% -\def\Ynothing{} -\def\Yomitfromtoc{} -\def\Ynumbered{% - \ifnum\secno=0 - \putwordChapter@tie \the\chapno - \else \ifnum\subsecno=0 - \putwordSection@tie \the\chapno.\the\secno - \else \ifnum\subsubsecno=0 - \putwordSection@tie \the\chapno.\the\secno.\the\subsecno - \else - \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno - \fi\fi\fi -} -\def\Yappendix{% - \ifnum\secno=0 - \putwordAppendix@tie @char\the\appendixno{}% - \else \ifnum\subsecno=0 - \putwordSection@tie @char\the\appendixno.\the\secno - \else \ifnum\subsubsecno=0 - \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno - \else - \putwordSection@tie - @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno - \fi\fi\fi -} - -% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. -% If its value is nonempty, SUFFIX is output afterward. -% -\def\refx#1#2{% - {% - \indexnofonts - \otherbackslash - \expandafter\global\expandafter\let\expandafter\thisrefX - \csname XR#1\endcsname - }% - \ifx\thisrefX\relax - % If not defined, say something at least. - \angleleft un\-de\-fined\angleright - \iflinks - \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% - \else - \ifwarnedxrefs\else - \global\warnedxrefstrue - \message{Cross reference values unknown; you must run TeX again.}% - \fi - \fi - \fi - \else - % It's defined, so just use it. - \thisrefX - \fi - #2% Output the suffix in any case. -} - -% This is the macro invoked by entries in the aux file. Usually it's -% just a \def (we prepend XR to the control sequence name to avoid -% collisions). But if this is a float type, we have more work to do. -% -\def\xrdef#1#2{% - \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. - % - % Was that xref control sequence that we just defined for a float? - \expandafter\iffloat\csname XR#1\endcsname - % it was a float, and we have the (safe) float type in \iffloattype. - \expandafter\let\expandafter\floatlist - \csname floatlist\iffloattype\endcsname - % - % Is this the first time we've seen this float type? - \expandafter\ifx\floatlist\relax - \toks0 = {\do}% yes, so just \do - \else - % had it before, so preserve previous elements in list. - \toks0 = \expandafter{\floatlist\do}% - \fi - % - % Remember this xref in the control sequence \floatlistFLOATTYPE, - % for later use in \listoffloats. - \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% - \fi -} - -% Read the last existing aux file, if any. No error if none exists. -% -\def\tryauxfile{% - \openin 1 \jobname.aux - \ifeof 1 \else - \readdatafile{aux}% - \global\havexrefstrue - \fi - \closein 1 -} - -\def\setupdatafile{% - \catcode`\^^@=\other - \catcode`\^^A=\other - \catcode`\^^B=\other - \catcode`\^^C=\other - \catcode`\^^D=\other - \catcode`\^^E=\other - \catcode`\^^F=\other - \catcode`\^^G=\other - \catcode`\^^H=\other - \catcode`\^^K=\other - \catcode`\^^L=\other - \catcode`\^^N=\other - \catcode`\^^P=\other - \catcode`\^^Q=\other - \catcode`\^^R=\other - \catcode`\^^S=\other - \catcode`\^^T=\other - \catcode`\^^U=\other - \catcode`\^^V=\other - \catcode`\^^W=\other - \catcode`\^^X=\other - \catcode`\^^Z=\other - \catcode`\^^[=\other - \catcode`\^^\=\other - \catcode`\^^]=\other - \catcode`\^^^=\other - \catcode`\^^_=\other - % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. - % in xref tags, i.e., node names. But since ^^e4 notation isn't - % supported in the main text, it doesn't seem desirable. Furthermore, - % that is not enough: for node names that actually contain a ^ - % character, we would end up writing a line like this: 'xrdef {'hat - % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first - % argument, and \hat is not an expandable control sequence. It could - % all be worked out, but why? Either we support ^^ or we don't. - % - % The other change necessary for this was to define \auxhat: - % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter - % and then to call \auxhat in \setq. - % - \catcode`\^=\other - % - % Special characters. Should be turned off anyway, but... - \catcode`\~=\other - \catcode`\[=\other - \catcode`\]=\other - \catcode`\"=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\$=\other - \catcode`\#=\other - \catcode`\&=\other - \catcode`\%=\other - \catcode`+=\other % avoid \+ for paranoia even though we've turned it off - % - % This is to support \ in node names and titles, since the \ - % characters end up in a \csname. It's easier than - % leaving it active and making its active definition an actual \ - % character. What I don't understand is why it works in the *value* - % of the xrdef. Seems like it should be a catcode12 \, and that - % should not typeset properly. But it works, so I'm moving on for - % now. --karl, 15jan04. - \catcode`\\=\other - % - % Make the characters 128-255 be printing characters. - {% - \count1=128 - \def\loop{% - \catcode\count1=\other - \advance\count1 by 1 - \ifnum \count1<256 \loop \fi - }% - }% - % - % @ is our escape character in .aux files, and we need braces. - \catcode`\{=1 - \catcode`\}=2 - \catcode`\@=0 -} - -\def\readdatafile#1{% -\begingroup - \setupdatafile - \input\jobname.#1 -\endgroup} - -\message{insertions,} -% including footnotes. - -\newcount \footnoteno - -% The trailing space in the following definition for supereject is -% vital for proper filling; pages come out unaligned when you do a -% pagealignmacro call if that space before the closing brace is -% removed. (Generally, numeric constants should always be followed by a -% space to prevent strange expansion errors.) -\def\supereject{\par\penalty -20000\footnoteno =0 } - -% @footnotestyle is meaningful for info output only. -\let\footnotestyle=\comment - -{\catcode `\@=11 -% -% Auto-number footnotes. Otherwise like plain. -\gdef\footnote{% - \let\indent=\ptexindent - \let\noindent=\ptexnoindent - \global\advance\footnoteno by \@ne - \edef\thisfootno{$^{\the\footnoteno}$}% - % - % In case the footnote comes at the end of a sentence, preserve the - % extra spacing after we do the footnote number. - \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi - % - % Remove inadvertent blank space before typesetting the footnote number. - \unskip - \thisfootno\@sf - \dofootnote -}% - -% Don't bother with the trickery in plain.tex to not require the -% footnote text as a parameter. Our footnotes don't need to be so general. -% -% Oh yes, they do; otherwise, @ifset (and anything else that uses -% \parseargline) fails inside footnotes because the tokens are fixed when -% the footnote is read. --karl, 16nov96. -% -\gdef\dofootnote{% - \insert\footins\bgroup - % We want to typeset this text as a normal paragraph, even if the - % footnote reference occurs in (for example) a display environment. - % So reset some parameters. - \hsize=\pagewidth - \interlinepenalty\interfootnotelinepenalty - \splittopskip\ht\strutbox % top baseline for broken footnotes - \splitmaxdepth\dp\strutbox - \floatingpenalty\@MM - \leftskip\z@skip - \rightskip\z@skip - \spaceskip\z@skip - \xspaceskip\z@skip - \parindent\defaultparindent - % - \smallfonts \rm - % - % Because we use hanging indentation in footnotes, a @noindent appears - % to exdent this text, so make it be a no-op. makeinfo does not use - % hanging indentation so @noindent can still be needed within footnote - % text after an @example or the like (not that this is good style). - \let\noindent = \relax - % - % Hang the footnote text off the number. Use \everypar in case the - % footnote extends for more than one paragraph. - \everypar = {\hang}% - \textindent{\thisfootno}% - % - % Don't crash into the line above the footnote text. Since this - % expands into a box, it must come within the paragraph, lest it - % provide a place where TeX can split the footnote. - \footstrut - \futurelet\next\fo@t -} -}%end \catcode `\@=11 - -% In case a @footnote appears in a vbox, save the footnote text and create -% the real \insert just after the vbox finished. Otherwise, the insertion -% would be lost. -% Similarily, if a @footnote appears inside an alignment, save the footnote -% text to a box and make the \insert when a row of the table is finished. -% And the same can be done for other insert classes. --kasal, 16nov03. - -% Replace the \insert primitive by a cheating macro. -% Deeper inside, just make sure that the saved insertions are not spilled -% out prematurely. -% -\def\startsavinginserts{% - \ifx \insert\ptexinsert - \let\insert\saveinsert - \else - \let\checkinserts\relax - \fi -} - -% This \insert replacement works for both \insert\footins{foo} and -% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. -% -\def\saveinsert#1{% - \edef\next{\noexpand\savetobox \makeSAVEname#1}% - \afterassignment\next - % swallow the left brace - \let\temp = -} -\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} -\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} - -\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} - -\def\placesaveins#1{% - \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname - {\box#1}% -} - -% eat @SAVE -- beware, all of them have catcode \other: -{ - \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) - \gdef\gobblesave @SAVE{} -} - -% initialization: -\def\newsaveins #1{% - \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% - \next -} -\def\newsaveinsX #1{% - \csname newbox\endcsname #1% - \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts - \checksaveins #1}% -} - -% initialize: -\let\checkinserts\empty -\newsaveins\footins -\newsaveins\margin - - -% @image. We use the macros from epsf.tex to support this. -% If epsf.tex is not installed and @image is used, we complain. -% -% Check for and read epsf.tex up front. If we read it only at @image -% time, we might be inside a group, and then its definitions would get -% undone and the next image would fail. -\openin 1 = epsf.tex -\ifeof 1 \else - % Do not bother showing banner with epsf.tex v2.7k (available in - % doc/epsf.tex and on ctan). - \def\epsfannounce{\toks0 = }% - \input epsf.tex -\fi -\closein 1 -% -% We will only complain once about lack of epsf.tex. -\newif\ifwarnednoepsf -\newhelp\noepsfhelp{epsf.tex must be installed for images to - work. It is also included in the Texinfo distribution, or you can get - it from ftp://tug.org/tex/epsf.tex.} -% -\def\image#1{% - \ifx\epsfbox\undefined - \ifwarnednoepsf \else - \errhelp = \noepsfhelp - \errmessage{epsf.tex not found, images will be ignored}% - \global\warnednoepsftrue - \fi - \else - \imagexxx #1,,,,,\finish - \fi -} -% -% Arguments to @image: -% #1 is (mandatory) image filename; we tack on .eps extension. -% #2 is (optional) width, #3 is (optional) height. -% #4 is (ignored optional) html alt text. -% #5 is (ignored optional) extension. -% #6 is just the usual extra ignored arg for parsing this stuff. -\newif\ifimagevmode -\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup - \catcode`\^^M = 5 % in case we're inside an example - \normalturnoffactive % allow _ et al. in names - % If the image is by itself, center it. - \ifvmode - \imagevmodetrue - \nobreak\bigskip - % Usually we'll have text after the image which will insert - % \parskip glue, so insert it here too to equalize the space - % above and below. - \nobreak\vskip\parskip - \nobreak - \line\bgroup - \fi - % - % Output the image. - \ifpdf - \dopdfimage{#1}{#2}{#3}% - \else - % \epsfbox itself resets \epsf?size at each figure. - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi - \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi - \epsfbox{#1.eps}% - \fi - % - \ifimagevmode \egroup \bigbreak \fi % space after the image -\endgroup} - - -% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, -% etc. We don't actually implement floating yet, we always include the -% float "here". But it seemed the best name for the future. -% -\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} - -% There may be a space before second and/or third parameter; delete it. -\def\eatcommaspace#1, {#1,} - -% #1 is the optional FLOATTYPE, the text label for this float, typically -% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, -% this float will not be numbered and cannot be referred to. -% -% #2 is the optional xref label. Also must be present for the float to -% be referable. -% -% #3 is the optional positioning argument; for now, it is ignored. It -% will somehow specify the positions allowed to float to (here, top, bottom). -% -% We keep a separate counter for each FLOATTYPE, which we reset at each -% chapter-level command. -\let\resetallfloatnos=\empty -% -\def\dofloat#1,#2,#3,#4\finish{% - \let\thiscaption=\empty - \let\thisshortcaption=\empty - % - % don't lose footnotes inside @float. - % - % BEWARE: when the floats start float, we have to issue warning whenever an - % insert appears inside a float which could possibly float. --kasal, 26may04 - % - \startsavinginserts - % - % We can't be used inside a paragraph. - \par - % - \vtop\bgroup - \def\floattype{#1}% - \def\floatlabel{#2}% - \def\floatloc{#3}% we do nothing with this yet. - % - \ifx\floattype\empty - \let\safefloattype=\empty - \else - {% - % the floattype might have accents or other special characters, - % but we need to use it in a control sequence name. - \indexnofonts - \turnoffactive - \xdef\safefloattype{\floattype}% - }% - \fi - % - % If label is given but no type, we handle that as the empty type. - \ifx\floatlabel\empty \else - % We want each FLOATTYPE to be numbered separately (Figure 1, - % Table 1, Figure 2, ...). (And if no label, no number.) - % - \expandafter\getfloatno\csname\safefloattype floatno\endcsname - \global\advance\floatno by 1 - % - {% - % This magic value for \thissection is output by \setref as the - % XREFLABEL-title value. \xrefX uses it to distinguish float - % labels (which have a completely different output format) from - % node and anchor labels. And \xrdef uses it to construct the - % lists of floats. - % - \edef\thissection{\floatmagic=\safefloattype}% - \setref{\floatlabel}{Yfloat}% - }% - \fi - % - % start with \parskip glue, I guess. - \vskip\parskip - % - % Don't suppress indentation if a float happens to start a section. - \restorefirstparagraphindent -} - -% we have these possibilities: -% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap -% @float Foo,lbl & no caption: Foo 1.1 -% @float Foo & @caption{Cap}: Foo: Cap -% @float Foo & no caption: Foo -% @float ,lbl & Caption{Cap}: 1.1: Cap -% @float ,lbl & no caption: 1.1 -% @float & @caption{Cap}: Cap -% @float & no caption: -% -\def\Efloat{% - \let\floatident = \empty - % - % In all cases, if we have a float type, it comes first. - \ifx\floattype\empty \else \def\floatident{\floattype}\fi - % - % If we have an xref label, the number comes next. - \ifx\floatlabel\empty \else - \ifx\floattype\empty \else % if also had float type, need tie first. - \appendtomacro\floatident{\tie}% - \fi - % the number. - \appendtomacro\floatident{\chaplevelprefix\the\floatno}% - \fi - % - % Start the printed caption with what we've constructed in - % \floatident, but keep it separate; we need \floatident again. - \let\captionline = \floatident - % - \ifx\thiscaption\empty \else - \ifx\floatident\empty \else - \appendtomacro\captionline{: }% had ident, so need a colon between - \fi - % - % caption text. - \appendtomacro\captionline{\scanexp\thiscaption}% - \fi - % - % If we have anything to print, print it, with space before. - % Eventually this needs to become an \insert. - \ifx\captionline\empty \else - \vskip.5\parskip - \captionline - % - % Space below caption. - \vskip\parskip - \fi - % - % If have an xref label, write the list of floats info. Do this - % after the caption, to avoid chance of it being a breakpoint. - \ifx\floatlabel\empty \else - % Write the text that goes in the lof to the aux file as - % \floatlabel-lof. Besides \floatident, we include the short - % caption if specified, else the full caption if specified, else nothing. - {% - \atdummies - % - % since we read the caption text in the macro world, where ^^M - % is turned into a normal character, we have to scan it back, so - % we don't write the literal three characters "^^M" into the aux file. - \scanexp{% - \xdef\noexpand\gtemp{% - \ifx\thisshortcaption\empty - \thiscaption - \else - \thisshortcaption - \fi - }% - }% - \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident - \ifx\gtemp\empty \else : \gtemp \fi}}% - }% - \fi - \egroup % end of \vtop - % - % place the captured inserts - % - % BEWARE: when the floats start floating, we have to issue warning - % whenever an insert appears inside a float which could possibly - % float. --kasal, 26may04 - % - \checkinserts -} - -% Append the tokens #2 to the definition of macro #1, not expanding either. -% -\def\appendtomacro#1#2{% - \expandafter\def\expandafter#1\expandafter{#1#2}% -} - -% @caption, @shortcaption -% -\def\caption{\docaption\thiscaption} -\def\shortcaption{\docaption\thisshortcaption} -\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} -\def\defcaption#1#2{\egroup \def#1{#2}} - -% The parameter is the control sequence identifying the counter we are -% going to use. Create it if it doesn't exist and assign it to \floatno. -\def\getfloatno#1{% - \ifx#1\relax - % Haven't seen this figure type before. - \csname newcount\endcsname #1% - % - % Remember to reset this floatno at the next chap. - \expandafter\gdef\expandafter\resetallfloatnos - \expandafter{\resetallfloatnos #1=0 }% - \fi - \let\floatno#1% -} - -% \setref calls this to get the XREFLABEL-snt value. We want an @xref -% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we -% first read the @float command. -% -\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% - -% Magic string used for the XREFLABEL-title value, so \xrefX can -% distinguish floats from other xref types. -\def\floatmagic{!!float!!} - -% #1 is the control sequence we are passed; we expand into a conditional -% which is true if #1 represents a float ref. That is, the magic -% \thissection value which we \setref above. -% -\def\iffloat#1{\expandafter\doiffloat#1==\finish} -% -% #1 is (maybe) the \floatmagic string. If so, #2 will be the -% (safe) float type for this float. We set \iffloattype to #2. -% -\def\doiffloat#1=#2=#3\finish{% - \def\temp{#1}% - \def\iffloattype{#2}% - \ifx\temp\floatmagic -} - -% @listoffloats FLOATTYPE - print a list of floats like a table of contents. -% -\parseargdef\listoffloats{% - \def\floattype{#1}% floattype - {% - % the floattype might have accents or other special characters, - % but we need to use it in a control sequence name. - \indexnofonts - \turnoffactive - \xdef\safefloattype{\floattype}% - }% - % - % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. - \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax - \ifhavexrefs - % if the user said @listoffloats foo but never @float foo. - \message{\linenumber No `\safefloattype' floats to list.}% - \fi - \else - \begingroup - \leftskip=\tocindent % indent these entries like a toc - \let\do=\listoffloatsdo - \csname floatlist\safefloattype\endcsname - \endgroup - \fi -} - -% This is called on each entry in a list of floats. We're passed the -% xref label, in the form LABEL-title, which is how we save it in the -% aux file. We strip off the -title and look up \XRLABEL-lof, which -% has the text we're supposed to typeset here. -% -% Figures without xref labels will not be included in the list (since -% they won't appear in the aux file). -% -\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} -\def\listoffloatsdoentry#1-title\finish{{% - % Can't fully expand XR#1-lof because it can contain anything. Just - % pass the control sequence. On the other hand, XR#1-pg is just the - % page number, and we want to fully expand that so we can get a link - % in pdf output. - \toksA = \expandafter{\csname XR#1-lof\endcsname}% - % - % use the same \entry macro we use to generate the TOC and index. - \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% - \writeentry -}} - -\message{localization,} -% and i18n. - -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. -% -\parseargdef\documentlanguage{% - \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. - \openin 1 txi-#1.tex - \ifeof 1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% - \else - \input txi-#1.tex - \fi - \closein 1 - \endgroup -} -\newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - - -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment - - -% Page size parameters. -% -\newdimen\defaultparindent \defaultparindent = 15pt - -\chapheadingskip = 15pt plus 4pt minus 2pt -\secheadingskip = 12pt plus 3pt minus 2pt -\subsecheadingskip = 9pt plus 2pt minus 2pt - -% Prevent underfull vbox error messages. -\vbadness = 10000 - -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 - -% Following George Bush, just get rid of widows and orphans. -\widowpenalty=10000 -\clubpenalty=10000 - -% Use TeX 3.0's \emergencystretch to help line breaking, but if we're -% using an old version of TeX, don't do anything. We want the amount of -% stretch added to depend on the line length, hence the dependence on -% \hsize. We call this whenever the paper size is set. -% -\def\setemergencystretch{% - \ifx\emergencystretch\thisisundefined - % Allow us to assign to \emergencystretch anyway. - \def\emergencystretch{\dimen0}% - \else - \emergencystretch = .15\hsize - \fi -} - -% Parameters in order: 1) textheight; 2) textwidth; -% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; -% 7) physical page height; 8) physical page width. -% -% We also call \setleading{\textleading}, so the caller should define -% \textleading. The caller should also set \parskip. -% -\def\internalpagesizes#1#2#3#4#5#6#7#8{% - \voffset = #3\relax - \topskip = #6\relax - \splittopskip = \topskip - % - \vsize = #1\relax - \advance\vsize by \topskip - \outervsize = \vsize - \advance\outervsize by 2\topandbottommargin - \pageheight = \vsize - % - \hsize = #2\relax - \outerhsize = \hsize - \advance\outerhsize by 0.5in - \pagewidth = \hsize - % - \normaloffset = #4\relax - \bindingoffset = #5\relax - % - \ifpdf - \pdfpageheight #7\relax - \pdfpagewidth #8\relax - \fi - % - \setleading{\textleading} - % - \parindent = \defaultparindent - \setemergencystretch -} - -% @letterpaper (the default). -\def\letterpaper{{\globaldefs = 1 - \parskip = 3pt plus 2pt minus 1pt - \textleading = 13.2pt - % - % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}% - {\voffset}{.25in}% - {\bindingoffset}{36pt}% - {11in}{8.5in}% -}} - -% Use @smallbook to reset parameters for 7x9.25 trim size. -\def\smallbook{{\globaldefs = 1 - \parskip = 2pt plus 1pt - \textleading = 12pt - % - \internalpagesizes{7.5in}{5in}% - {\voffset}{.25in}% - {\bindingoffset}{16pt}% - {9.25in}{7in}% - % - \lispnarrowing = 0.3in - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \defbodyindent = .5cm -}} - -% Use @smallerbook to reset parameters for 6x9 trim size. -% (Just testing, parameters still in flux.) -\def\smallerbook{{\globaldefs = 1 - \parskip = 1.5pt plus 1pt - \textleading = 12pt - % - \internalpagesizes{7.4in}{4.8in}% - {-.2in}{-.4in}% - {0pt}{14pt}% - {9in}{6in}% - % - \lispnarrowing = 0.25in - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \defbodyindent = .4cm -}} - -% Use @afourpaper to print on European A4 paper. -\def\afourpaper{{\globaldefs = 1 - \parskip = 3pt plus 2pt minus 1pt - \textleading = 13.2pt - % - % Double-side printing via postscript on Laserjet 4050 - % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. - % To change the settings for a different printer or situation, adjust - % \normaloffset until the front-side and back-side texts align. Then - % do the same for \bindingoffset. You can set these for testing in - % your texinfo source file like this: - % @tex - % \global\normaloffset = -6mm - % \global\bindingoffset = 10mm - % @end tex - \internalpagesizes{51\baselineskip}{160mm} - {\voffset}{\hoffset}% - {\bindingoffset}{44pt}% - {297mm}{210mm}% - % - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \defbodyindent = 5mm -}} - -% Use @afivepaper to print on European A5 paper. -% From romildo@urano.iceb.ufop.br, 2 July 2000. -% He also recommends making @example and @lisp be small. -\def\afivepaper{{\globaldefs = 1 - \parskip = 2pt plus 1pt minus 0.1pt - \textleading = 12.5pt - % - \internalpagesizes{160mm}{120mm}% - {\voffset}{\hoffset}% - {\bindingoffset}{8pt}% - {210mm}{148mm}% - % - \lispnarrowing = 0.2in - \tolerance = 800 - \hfuzz = 1.2pt - \contentsrightmargin = 0pt - \defbodyindent = 2mm - \tableindent = 12mm -}} - -% A specific text layout, 24x15cm overall, intended for A4 paper. -\def\afourlatex{{\globaldefs = 1 - \afourpaper - \internalpagesizes{237mm}{150mm}% - {\voffset}{4.6mm}% - {\bindingoffset}{7mm}% - {297mm}{210mm}% - % - % Must explicitly reset to 0 because we call \afourpaper. - \globaldefs = 0 -}} - -% Use @afourwide to print on A4 paper in landscape format. -\def\afourwide{{\globaldefs = 1 - \afourpaper - \internalpagesizes{241mm}{165mm}% - {\voffset}{-2.95mm}% - {\bindingoffset}{7mm}% - {297mm}{210mm}% - \globaldefs = 0 -}} - -% @pagesizes TEXTHEIGHT[,TEXTWIDTH] -% Perhaps we should allow setting the margins, \topskip, \parskip, -% and/or leading, also. Or perhaps we should compute them somehow. -% -\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} -\def\pagesizesyyy#1,#2,#3\finish{{% - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi - \globaldefs = 1 - % - \parskip = 3pt plus 2pt minus 1pt - \setleading{\textleading}% - % - \dimen0 = #1 - \advance\dimen0 by \voffset - % - \dimen2 = \hsize - \advance\dimen2 by \normaloffset - % - \internalpagesizes{#1}{\hsize}% - {\voffset}{\normaloffset}% - {\bindingoffset}{44pt}% - {\dimen0}{\dimen2}% -}} - -% Set default to letter. -% -\letterpaper - - -\message{and turning on texinfo input format.} - -% Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$}%$ font-lock fix - -% This macro is used to make a character print one way in \tt -% (where it can probably be output as-is), and another way in other fonts, -% where something hairier probably needs to be done. -% -% #1 is what to print if we are indeed using \tt; #2 is what to print -% otherwise. Since all the Computer Modern typewriter fonts have zero -% interword stretch (and shrink), and it is reasonable to expect all -% typewriter fonts to have this, we can check that font parameter. -% -\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} - -% Same as above, but check for italic font. Actually this also catches -% non-italic slanted fonts since it is impossible to distinguish them from -% italic fonts. But since this is only used by $ and it uses \sl anyway -% this is not a problem. -\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} - -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary). -% Most of these we simply print from the \tt font, but for some, we can -% use math or other variants that look better in normal text. - -\catcode`\"=\active -\def\activedoublequote{{\tt\char34}} -\let"=\activedoublequote -\catcode`\~=\active -\def~{{\tt\char126}} -\chardef\hat=`\^ -\catcode`\^=\active -\def^{{\tt \hat}} - -\catcode`\_=\active -\def_{\ifusingtt\normalunderscore\_} -\let\realunder=_ -% Subroutine for the previous macro. -\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } - -\catcode`\|=\active -\def|{{\tt\char124}} -\chardef \less=`\< -\catcode`\<=\active -\def<{{\tt \less}} -\chardef \gtr=`\> -\catcode`\>=\active -\def>{{\tt \gtr}} -\catcode`\+=\active -\def+{{\tt \char 43}} -\catcode`\$=\active -\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix - -% If a .fmt file is being used, characters that might appear in a file -% name cannot be active until we have parsed the command line. -% So turn them off again, and have \everyjob (or @setfilename) turn them on. -% \otherifyactive is called near the end of this file. -\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} - -% Used sometimes to turn off (effectively) the active characters even after -% parsing them. -\def\turnoffactive{% - \normalturnoffactive - \otherbackslash -} - -\catcode`\@=0 - -% \backslashcurfont outputs one backslash character in current font, -% as in \char`\\. -\global\chardef\backslashcurfont=`\\ -\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work - -% \realbackslash is an actual character `\' with catcode other, and -% \doublebackslash is two of them (for the pdf outlines). -{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} - -% In texinfo, backslash is an active character; it prints the backslash -% in fixed width font. -\catcode`\\=\active -@def@normalbackslash{{@tt@backslashcurfont}} -% On startup, @fixbackslash assigns: -% @let \ = @normalbackslash - -% \rawbackslash defines an active \ to do \backslashcurfont. -% \otherbackslash defines an active \ to be a literal `\' character with -% catcode other. -@gdef@rawbackslash{@let\=@backslashcurfont} -@gdef@otherbackslash{@let\=@realbackslash} - -% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. -% -@def@normalturnoffactive{% - @let\=@normalbackslash - @let"=@normaldoublequote - @let~=@normaltilde - @let^=@normalcaret - @let_=@normalunderscore - @let|=@normalverticalbar - @let<=@normalless - @let>=@normalgreater - @let+=@normalplus - @let$=@normaldollar %$ font-lock fix - @unsepspaces -} - -% Make _ and + \other characters, temporarily. -% This is canceled by @fixbackslash. -@otherifyactive - -% If a .fmt file is being used, we don't want the `\input texinfo' to show up. -% That is what \eatinput is for; after that, the `\' should revert to printing -% a backslash. -% -@gdef@eatinput input texinfo{@fixbackslash} -@global@let\ = @eatinput - -% On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\' in the file would cause an error. This macro tries to fix -% that, assuming it is called before the first `\' could plausibly occur. -% Also turn back on active characters that might appear in the input -% file name, in case not using a pre-dumped format. -% -@gdef@fixbackslash{% - @ifx\@eatinput @let\ = @normalbackslash @fi - @catcode`+=@active - @catcode`@_=@active -} - -% Say @foo, not \foo, in error messages. -@escapechar = `@@ - -% These look ok in all fonts, so just make them not special. -@catcode`@& = @other -@catcode`@# = @other -@catcode`@% = @other - - -@c Local variables: -@c eval: (add-hook 'write-file-hooks 'time-stamp) -@c page-delimiter: "^\\\\message" -@c time-stamp-start: "def\\\\texinfoversion{" -@c time-stamp-format: "%:y-%02m-%02d.%02H" -@c time-stamp-end: "}" -@c End: - -@c vim:sw=2: - -@ignore - arch-tag: 53261dd3-7df7-4ec3-9d90-af7a955d3c87 -@end ignore From b2f5a4ac93608d9a51ddbd08c3f825d4cedfeb04 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 21 Aug 2006 23:06:09 +0000 Subject: [PATCH 295/361] (gdb-frame-memory-buffer): Make frame a bit wider and remove fringes to fit initial output on line. --- lisp/progmodes/gdb-ui.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index ff16daf6436..bbd23b9fad0 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -315,7 +315,7 @@ Also display the main routine in the disassembly buffer if present." "Nil means just pop up the GUD buffer unless `gdb-show-main' is t. In this case it starts with two windows: one displaying the GUD buffer and the other with the source file with the main routine -of the inferior. Non-nil means display the layout shown for +of the debugged program. Non-nil means display the layout shown for `gdba'." :type 'boolean :group 'gud @@ -2638,8 +2638,11 @@ corresponding to the mode line clicked." (defun gdb-frame-memory-buffer () "Display memory contents in a new frame." (interactive) - (let ((special-display-regexps (append special-display-regexps '(".*"))) - (special-display-frame-alist gdb-frame-parameters)) + (let* ((special-display-regexps (append special-display-regexps '(".*"))) + (special-display-frame-alist + (cons '(left-fringe . 0) + (cons '(right-fringe . 0) + (cons '(width . 83) gdb-frame-parameters))))) (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) @@ -3584,7 +3587,7 @@ in_scope=\"\\(.*?\\)\".*?}") value)) (insert (concat name "\t" (nth 1 local) - "\t" (nth 2 local) "\n"))) + "\t" value "\n"))) (set-window-start window start) (set-window-point window p)))))))) From 7d14463c7d9701bf6a284325bf6f5b7ce23834a0 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 21 Aug 2006 23:07:34 +0000 Subject: [PATCH 296/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ man/ChangeLog | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cbde1434030..ecc660373fb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-22 Nick Roberts + + * progmodes/gdb-ui.el (gdb-frame-memory-buffer): Make frame + a bit wider and remove fringes to fit initial output on line. + 2006-08-21 Richard Stallman * whitespace.el (whitespace-cleanup): Doc fix. diff --git a/man/ChangeLog b/man/ChangeLog index fd07fa7f05f..cb598a9cfac 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-08-22 Nick Roberts + + * building.texi (Other GDB-UI Buffers): Describe how to edit + a value in the locals buffer. + 2006-08-21 Richard Stallman * search.texi (Basic Isearch): Add `isearch' index entry. From b1333d4fbedcbac9623acdba934de3c5540aec94 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Mon, 21 Aug 2006 23:07:55 +0000 Subject: [PATCH 297/361] (Other GDB-UI Buffers): Describe how to edit a value in the locals buffer. --- man/building.texi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/man/building.texi b/man/building.texi index 68aeb023b76..01cdf88fe39 100644 --- a/man/building.texi +++ b/man/building.texi @@ -1028,7 +1028,8 @@ as are the commands to send signals to the debugged program. @item Locals Buffer The locals buffer displays the values of local variables of the current frame for simple data types (@pxref{Frame Info, Frame Info, -Information on a frame, gdb, The GNU debugger}). +Information on a frame, gdb, The GNU debugger}). Press @key{RET} or +click @kbd{Mouse-2} on the value if you want to edit it. Arrays and structures display their type only. With GDB 6.4 or later, move point to their name and press @key{RET}, or alternatively click @@ -1040,7 +1041,7 @@ of GDB, use @kbd{Mouse-2} or @key{RET} on the type description @findex toggle-gdb-all-registers The registers buffer displays the values held by the registers (@pxref{Registers,,, gdb, The GNU debugger}). Press @key{RET} or -click @kbd{Mouse-2} on a register if you want to change its value. +click @kbd{Mouse-2} on a register if you want to edit its value. With GDB 6.4 or later, recently changed register values display with @code{font-lock-warning-face}. With earlier versions of GDB, you can press @key{SPC} to toggle the display of floating point registers From 8ec94c16aefbc14e239c52ca594d9a0da31f2285 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 22 Aug 2006 01:35:45 +0000 Subject: [PATCH 298/361] (blink-cursor-end): Only ignore the error we care about. (blink-cursor-mode): Use blink-cursor-end to simplify the code. --- lisp/ChangeLog | 11 ++++++--- lisp/frame.el | 67 +++++++++++++++++++++++--------------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ecc660373fb..22137ebccf2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,7 +2,12 @@ * progmodes/gdb-ui.el (gdb-frame-memory-buffer): Make frame a bit wider and remove fringes to fit initial output on line. - + +2006-08-21 Stefan Monnier + + * frame.el (blink-cursor-end): Only ignore the error we care about. + (blink-cursor-mode): Use blink-cursor-end to simplify the code. + 2006-08-21 Richard Stallman * whitespace.el (whitespace-cleanup): Doc fix. @@ -16,8 +21,8 @@ (rcirc-mode): Preserve the value of `rcirc-urls' across connections. Setup scroll function. (rcirc-scroll-to-bottom): New function. - (rcirc-print): Use nick syntax around regexp work. Notice - dim-nicks speaking only if they say our nick. + (rcirc-print): Use nick syntax around regexp work. + Notice dim-nicks speaking only if they say our nick. (rcirc-update-activity-string): Do not show the modeline indicator if there are no live rcirc processes. (rcirc-cmd-ignore): Ignore case. diff --git a/lisp/frame.el b/lisp/frame.el index 873cec6c783..368cab3aed7 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1253,38 +1253,6 @@ The function `blink-cursor-start' is called when the timer fires.") This timer calls `blink-cursor-timer-function' every `blink-cursor-interval' seconds.") -(define-minor-mode blink-cursor-mode - "Toggle blinking cursor mode. -With a numeric argument, turn blinking cursor mode on iff ARG is positive. -When blinking cursor mode is enabled, the cursor of the selected -window blinks. - -Note that this command is effective only when Emacs -displays through a window system, because then Emacs does its own -cursor display. On a text-only terminal, this is not implemented." - :init-value (not (or noninteractive - no-blinking-cursor - (eq system-type 'ms-dos) - (not (memq window-system '(x w32 mac))))) - :initialize 'custom-initialize-safe-default - :group 'cursor - :global t - (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer)) - (if blink-cursor-timer (cancel-timer blink-cursor-timer)) - (setq blink-cursor-idle-timer nil - blink-cursor-timer nil) - (if blink-cursor-mode - (progn - ;; Hide the cursor. - ;;(internal-show-cursor nil nil) - (setq blink-cursor-idle-timer - (run-with-idle-timer blink-cursor-delay - blink-cursor-delay - 'blink-cursor-start))) - (internal-show-cursor nil t))) - -(define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1") - (defun blink-cursor-start () "Timer function called from the timer `blink-cursor-idle-timer'. This starts the timer `blink-cursor-timer', which makes the cursor blink @@ -1310,11 +1278,38 @@ When run, it cancels the timer `blink-cursor-timer' and removes itself as a pre-command hook." (remove-hook 'pre-command-hook 'blink-cursor-end) (internal-show-cursor nil t) - (condition-case nil - (cancel-timer blink-cursor-timer) - (error nil)) - (setq blink-cursor-timer nil)) + (when blink-cursor-timer + (cancel-timer blink-cursor-timer) + (setq blink-cursor-timer nil))) +(define-minor-mode blink-cursor-mode + "Toggle blinking cursor mode. +With a numeric argument, turn blinking cursor mode on iff ARG is positive. +When blinking cursor mode is enabled, the cursor of the selected +window blinks. + +Note that this command is effective only when Emacs +displays through a window system, because then Emacs does its own +cursor display. On a text-only terminal, this is not implemented." + :init-value (not (or noninteractive + no-blinking-cursor + (eq system-type 'ms-dos) + (not (memq window-system '(x w32 mac))))) + :initialize 'custom-initialize-safe-default + :group 'cursor + :global t + (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer)) + (setq blink-cursor-idle-timer nil) + (blink-cursor-end) + (when blink-cursor-mode + ;; Hide the cursor. + ;;(internal-show-cursor nil nil) + (setq blink-cursor-idle-timer + (run-with-idle-timer blink-cursor-delay + blink-cursor-delay + 'blink-cursor-start)))) + +(define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1") ;; Hourglass pointer From 1867217a61f67cb32ea9e1808daa313b9fad21df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Tue, 22 Aug 2006 06:14:45 +0000 Subject: [PATCH 299/361] * x-dnd.el (x-dnd-drop-data): Don't call goto-char if mouse-yank-at-point is non-nil. --- lisp/ChangeLog | 5 +++++ lisp/x-dnd.el | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 22137ebccf2..b4407a951a3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-22 Jorgen Schaefer (tiny change) + + * x-dnd.el (x-dnd-drop-data): Don't call goto-char if + mouse-yank-at-point is non-nil. + 2006-08-22 Nick Roberts * progmodes/gdb-ui.el (gdb-frame-memory-buffer): Make frame diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index 81fe9a8e868..c229b0868e4 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el @@ -325,7 +325,8 @@ nil if not." ;; If dropping in an ordinary window which we could use, ;; let dnd-open-file-other-window specify what to do. (progn - (goto-char (posn-point (event-start event))) + (when (not mouse-yank-at-point) + (goto-char (posn-point (event-start event)))) (funcall handler window action data)) ;; If we can't display the file here, ;; make a new window for it. From 38babc072d6104b73f5a93a736edd0f232f4a10e Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Tue, 22 Aug 2006 09:25:59 +0000 Subject: [PATCH 300/361] 2006-08-22 Stefan Monnier (Fset_buffer_multibyte): Record proper undo entry. --- src/buffer.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 3502afc9bf0..07d0f676aa2 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2115,10 +2115,11 @@ current buffer is cleared. */) { struct Lisp_Marker *tail, *markers; struct buffer *other; - int undo_enabled_p = !EQ (current_buffer->undo_list, Qt); int begv, zv; int narrowed = (BEG != BEGV || Z != ZV); int modified_p = !NILP (Fbuffer_modified_p (Qnil)); + Lisp_Object old_undo = current_buffer->undo_list; + struct gcpro gcpro1; if (current_buffer->base_buffer) error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); @@ -2127,10 +2128,11 @@ current buffer is cleared. */) if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) return flag; - /* It would be better to update the list, - but this is good enough for now. */ - if (undo_enabled_p) - current_buffer->undo_list = Qt; + GCPRO1 (old_undo); + + /* Don't record these buffer changes. We will put a special undo entry + instead. */ + current_buffer->undo_list = Qt; /* If the cached position is for this buffer, clear it out. */ clear_charpos_cache (current_buffer); @@ -2330,8 +2332,18 @@ current buffer is cleared. */) set_intervals_multibyte (1); } - if (undo_enabled_p) - current_buffer->undo_list = Qnil; + if (!EQ (old_undo, Qt)) + { + /* Represent all the above changes by a special undo entry. */ + extern Lisp_Object Qapply; + Lisp_Object args[3]; + args[0] = Qapply; + args[1] = intern ("set-buffer-multibyte"); + args[2] = NILP (flag) ? Qt : Qnil; + current_buffer->undo_list = Fcons (Flist (3, args), old_undo); + } + + UNGCPRO; /* Changing the multibyteness of a buffer means that all windows showing that buffer must be updated thoroughly. */ From 7e1de68d272078455b1b67e44b143460ec8fe4c5 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Tue, 22 Aug 2006 09:45:04 +0000 Subject: [PATCH 301/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ src/ChangeLog | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b4407a951a3..bc9d6f939a1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-22 Kim F. Storm + + * ido.el (ido-set-matches-1): Fix full matching for subdirs. + Add suffix matching for subdirs. + 2006-08-22 Jorgen Schaefer (tiny change) * x-dnd.el (x-dnd-drop-data): Don't call goto-char if diff --git a/src/ChangeLog b/src/ChangeLog index a299d7c603f..380675945cb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-22 Stefan Monnier + + * buffer.c (Fset_buffer_multibyte): Record proper undo entry. + 2006-08-21 Jan Dj,Ad(Brv * keyboard.c: Clarify difference between in_sighandler and From 5444f27889811e4c8fb9ebc7d8dd931fba58044b Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Tue, 22 Aug 2006 09:45:13 +0000 Subject: [PATCH 302/361] (ido-set-matches-1): Fix full matching for subdirs. Add suffix matching for subdirs. --- lisp/ido.el | 68 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/lisp/ido.el b/lisp/ido.el index be1cba62f27..2d531728b67 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1840,6 +1840,7 @@ If INITIAL is non-nil, it specifies the initial input string." (and d (cdr d))))))) (if (member ido-default-item ido-ignore-item-temp-list) (setq ido-default-item nil)) + (ido-trace "new default" ido-default-item) (setq ido-set-default-item nil)) (if ido-process-ignore-lists-inhibit @@ -3528,37 +3529,40 @@ for first matching file." (let* ((case-fold-search ido-case-fold) (slash (and (not ido-enable-prefix) (ido-final-slash ido-text))) (text (if slash (substring ido-text 0 -1) ido-text)) - (rexq (concat (if ido-enable-regexp text (regexp-quote text)) (if slash ".*/" ""))) + (rex0 (if ido-enable-regexp text (regexp-quote text))) + (rexq (concat rex0 (if slash ".*/" ""))) (re (if ido-enable-prefix (concat "\\`" rexq) rexq)) - (full-re (and do-full (not ido-enable-regexp) (not (string-match "\$\\'" re)) - (concat "\\`" re "\\'"))) + (full-re (and do-full (not ido-enable-regexp) (not (string-match "\$\\'" rex0)) + (concat "\\`" rex0 (if slash "/" "") "\\'"))) + (suffix-re (and do-full slash + (not ido-enable-regexp) (not (string-match "\$\\'" rex0)) + (concat rex0 "/\\'"))) (prefix-re (and full-re (not ido-enable-prefix) (concat "\\`" rexq))) (non-prefix-dot (or (not ido-enable-dot-prefix) (not ido-process-ignore-lists) ido-enable-prefix (= (length ido-text) 0))) - - full-matches - prefix-matches - matches) + full-matches suffix-matches prefix-matches matches) (setq ido-incomplete-regexp nil) (condition-case error (mapcar (lambda (item) (let ((name (ido-name item))) - (if (and (or non-prefix-dot - (if (= (aref ido-text 0) ?.) - (= (aref name 0) ?.) - (/= (aref name 0) ?.))) - (string-match re name)) - (cond - ((and full-re (string-match full-re name)) - (setq full-matches (cons item full-matches))) - ((and prefix-re (string-match prefix-re name)) - (setq prefix-matches (cons item prefix-matches))) - (t (setq matches (cons item matches)))))) - t) + (if (and (or non-prefix-dot + (if (= (aref ido-text 0) ?.) + (= (aref name 0) ?.) + (/= (aref name 0) ?.))) + (string-match re name)) + (cond + ((and full-re (string-match full-re name)) + (setq full-matches (cons item full-matches))) + ((and suffix-re (string-match suffix-re name)) + (setq suffix-matches (cons item suffix-matches))) + ((and prefix-re (string-match prefix-re name)) + (setq prefix-matches (cons item prefix-matches))) + (t (setq matches (cons item matches)))))) + t) items) (invalid-regexp (setq ido-incomplete-regexp t @@ -3566,10 +3570,15 @@ for first matching file." ;; special-case single match, and handle appropriately ;; elsewhere. matches (cdr error)))) - (if prefix-matches - (setq matches (nconc prefix-matches matches))) - (if full-matches - (setq matches (nconc full-matches matches))) + (when prefix-matches + (ido-trace "prefix match" prefix-matches) + (setq matches (nconc prefix-matches matches))) + (when suffix-matches + (ido-trace "suffix match" (list text suffix-re suffix-matches)) + (setq matches (nconc suffix-matches matches))) + (when full-matches + (ido-trace "full match" (list text full-re full-matches)) + (setq matches (nconc full-matches matches))) (when (and (null matches) ido-enable-flex-matching (> (length ido-text) 1) @@ -4096,12 +4105,13 @@ For details of keybindings, do `\\[describe-function] ido-find-file'." try-single-dir-match refresh) - (ido-trace "\nexhibit" this-command) - (ido-trace "dir" ido-current-directory) - (ido-trace "contents" contents) - (ido-trace "list" ido-cur-list) - (ido-trace "matches" ido-matches) - (ido-trace "rescan" ido-rescan) + (when ido-trace-enable + (ido-trace "\nexhibit" this-command) + (ido-trace "dir" ido-current-directory) + (ido-trace "contents" contents) + (ido-trace "list" ido-cur-list) + (ido-trace "matches" ido-matches) + (ido-trace "rescan" ido-rescan)) (save-excursion (goto-char (point-max)) From 6b4d876273771721eb291850f5b285151a0e56fe Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Tue, 22 Aug 2006 21:31:50 +0000 Subject: [PATCH 303/361] *** empty log message *** --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 380675945cb..59bd13f0daf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-22 Kim F. Storm + + * xdisp.c (update_tool_bar): Redisplay toolbar also when only + number of items changes. + 2006-08-22 Stefan Monnier * buffer.c (Fset_buffer_multibyte): Record proper undo entry. From 462eca8fcf4d5d6b12e7d3d974e45a6a2e03ce1f Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Tue, 22 Aug 2006 21:32:04 +0000 Subject: [PATCH 304/361] (update_tool_bar): Redisplay toolbar also when only number of items changes. --- src/xdisp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index 9911f47c2a4..640f7006dd1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9391,7 +9391,8 @@ update_tool_bar (f, save_match_data) &new_n_tool_bar); /* Redisplay the tool-bar if we changed it. */ - if (NILP (Fequal (new_tool_bar, f->tool_bar_items))) + if (new_n_tool_bar != f->n_tool_bar_items + || NILP (Fequal (new_tool_bar, f->tool_bar_items))) { /* Redisplay that happens asynchronously due to an expose event may access f->tool_bar_items. Make sure we update both From 1c059100a12b7cba32fcece9ed08f34be4de3513 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Wed, 23 Aug 2006 03:09:36 +0000 Subject: [PATCH 305/361] *** empty log message *** --- lisp/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bc9d6f939a1..4d88bd8ad37 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-23 Nick Roberts + + * progmodes/gdb-ui.el (gdb-starting): Reset gdb-signalled to nil. + 2006-08-22 Kim F. Storm * ido.el (ido-set-matches-1): Fix full matching for subdirs. From 31af85eb57dfcee6388145da89059198e0171573 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Wed, 23 Aug 2006 03:10:02 +0000 Subject: [PATCH 306/361] (gdb-starting): Reset gdb-signalled to nil. --- lisp/progmodes/gdb-ui.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index bbd23b9fad0..f45bb2fe524 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -1290,6 +1290,7 @@ not GDB." (progn (setq gud-running t) (setq gdb-inferior-status "running") + (setq gdb-signalled nil) (gdb-force-mode-line-update (propertize gdb-inferior-status 'face font-lock-type-face)) (gdb-remove-text-properties) From c4f7363c1088c7558b0101d2c1b64d7c0e76dc38 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Wed, 23 Aug 2006 10:07:29 +0000 Subject: [PATCH 307/361] *** empty log message *** --- lisp/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4d88bd8ad37..3c795b0855e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-23 Carsten Dominik + + * textmodes/org.el (org-follow-gnus-link): Make sure the dedicated + gnus frame is selected. + 2006-08-23 Nick Roberts * progmodes/gdb-ui.el (gdb-starting): Reset gdb-signalled to nil. From 90bb892d7c65ab2d1fe359ad247be0cabc1031cc Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Wed, 23 Aug 2006 10:07:42 +0000 Subject: [PATCH 308/361] (org-follow-gnus-link): Make sure the dedicated gnus frame is selected. --- lisp/textmodes/org.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index 1fcac6855d9..ecbcd86d043 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el @@ -9467,6 +9467,7 @@ onto the ring." "Follow a Gnus link to GROUP and ARTICLE." (require 'gnus) (funcall (cdr (assq 'gnus org-link-frame-setup))) + (if gnus-other-frame-object (select-frame gnus-other-frame-object)) (if group (gnus-fetch-group group)) (if article (or (gnus-summary-goto-article article nil 'force) From 4a7499a9aeb41ac0e63d6e0921536eb91871f3a7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 23 Aug 2006 10:49:26 +0000 Subject: [PATCH 309/361] *** empty log message *** --- etc/TODO | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/TODO b/etc/TODO index 9256175c01e..0c807662ae1 100644 --- a/etc/TODO +++ b/etc/TODO @@ -125,6 +125,9 @@ current buffer. ** Internationalize Emacs's messages. +** Set up a facility to save backtraces when errors happen during +specified filters, specified timers, and specified hooks. + ** Install mmc@maruska.dyndns.org's no-flicker change. ** Add a "current vertical pixel level" value that goes with point, From f984fd2b02e37c0cb591b002b250bd3285632cde Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Wed, 23 Aug 2006 12:16:28 +0000 Subject: [PATCH 310/361] Fix whitespace. --- lisp/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3c795b0855e..388cde63799 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -12,7 +12,7 @@ * ido.el (ido-set-matches-1): Fix full matching for subdirs. Add suffix matching for subdirs. -2006-08-22 Jorgen Schaefer (tiny change) +2006-08-22 Jorgen Schaefer (tiny change) * x-dnd.el (x-dnd-drop-data): Don't call goto-char if mouse-yank-at-point is non-nil. From 6e85b03c8de230400799127e3a83581c5970f0dc Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Wed, 23 Aug 2006 16:19:11 +0000 Subject: [PATCH 311/361] * startup.el (fancy-splash-head): Give instructions for dismissing the splash screen for default startup too. (display-startup-echo-area-message, fancy-splash-screens) (use-fancy-splash-screens-p): New arg hide-on-input. If nil, show all splash text at once and keep the splash buffer around. (command-line-1): Give display-startup-echo-area-message a t arg. --- lisp/ChangeLog | 9 +++ lisp/startup.el | 160 +++++++++++++++++++++++++++++------------------- 2 files changed, 105 insertions(+), 64 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 388cde63799..4e54ecc5f2e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2006-08-23 Chong Yidong + + * startup.el (fancy-splash-head): Give instructions for dismissing + the splash screen for default startup too. + (display-startup-echo-area-message, fancy-splash-screens) + (use-fancy-splash-screens-p): New arg hide-on-input. If nil, show + all splash text at once and keep the splash buffer around. + (command-line-1): Give display-startup-echo-area-message a t arg. + 2006-08-23 Carsten Dominik * textmodes/org.el (org-follow-gnus-link): Make sure the dedicated diff --git a/lisp/startup.el b/lisp/startup.el index cb6048728ab..9cff91077b0 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1265,11 +1265,16 @@ where FACE is a valid face specification, as it can be used with "GNU Emacs is one component of the GNU/Linux operating system." "GNU Emacs is one component of the GNU operating system.")) (insert "\n") - (unless (equal (buffer-name fancy-splash-outer-buffer) "*scratch*") - (fancy-splash-insert :face 'variable-pitch - (substitute-command-keys - "Type \\[recenter] to begin editing your file.\n")))) - + (if fancy-splash-outer-buffer + (fancy-splash-insert + :face 'variable-pitch + (substitute-command-keys + (concat + "Type \\[recenter] to begin editing" + (if (equal (buffer-name fancy-splash-outer-buffer) + "*scratch*") + ".\n" + " your file.\n")))))) (defun fancy-splash-tail () "Insert the tail part of the splash screen into the current buffer." @@ -1339,47 +1344,65 @@ mouse." (throw 'exit nil)) -(defun fancy-splash-screens () +(defun fancy-splash-screens (&optional hide-on-input) "Display fancy splash screens when Emacs starts." (setq fancy-splash-help-echo (startup-echo-area-message)) - (let ((old-hourglass display-hourglass) - (fancy-splash-outer-buffer (current-buffer)) - splash-buffer - (old-minor-mode-map-alist minor-mode-map-alist) - (old-emulation-mode-map-alists emulation-mode-map-alists) - (frame (fancy-splash-frame)) - timer) - (save-selected-window - (select-frame frame) - (switch-to-buffer "GNU Emacs") - (setq tab-width 20) - (setq splash-buffer (current-buffer)) - (catch 'stop-splashing - (unwind-protect - (let ((map (make-sparse-keymap))) - (use-local-map map) - (define-key map [switch-frame] 'ignore) - (define-key map [t] 'fancy-splash-default-action) - (define-key map [mouse-movement] 'ignore) - (define-key map [mode-line t] 'ignore) - (setq cursor-type nil - display-hourglass nil - minor-mode-map-alist nil - emulation-mode-map-alists nil - buffer-undo-list t - mode-line-format (propertize "---- %b %-" - 'face 'mode-line-buffer-id) - fancy-splash-stop-time (+ (float-time) - fancy-splash-max-time) - timer (run-with-timer 0 fancy-splash-delay - #'fancy-splash-screens-1 - splash-buffer)) - (recursive-edit)) - (cancel-timer timer) - (setq display-hourglass old-hourglass - minor-mode-map-alist old-minor-mode-map-alist - emulation-mode-map-alists old-emulation-mode-map-alists) - (kill-buffer splash-buffer)))))) + (if hide-on-input + (let ((old-hourglass display-hourglass) + (fancy-splash-outer-buffer (current-buffer)) + splash-buffer + (old-minor-mode-map-alist minor-mode-map-alist) + (old-emulation-mode-map-alists emulation-mode-map-alists) + (frame (fancy-splash-frame)) + timer) + (save-selected-window + (select-frame frame) + (switch-to-buffer "GNU Emacs") + (setq tab-width 20) + (setq splash-buffer (current-buffer)) + (catch 'stop-splashing + (unwind-protect + (let ((map (make-sparse-keymap))) + (use-local-map map) + (define-key map [switch-frame] 'ignore) + (define-key map [t] 'fancy-splash-default-action) + (define-key map [mouse-movement] 'ignore) + (define-key map [mode-line t] 'ignore) + (setq cursor-type nil + display-hourglass nil + minor-mode-map-alist nil + emulation-mode-map-alists nil + buffer-undo-list t + mode-line-format (propertize "---- %b %-" + 'face 'mode-line-buffer-id) + fancy-splash-stop-time (+ (float-time) + fancy-splash-max-time) + timer (run-with-timer 0 fancy-splash-delay + #'fancy-splash-screens-1 + splash-buffer)) + (recursive-edit)) + (cancel-timer timer) + (setq display-hourglass old-hourglass + minor-mode-map-alist old-minor-mode-map-alist + emulation-mode-map-alists old-emulation-mode-map-alists) + (kill-buffer splash-buffer))))) + ;; If hide-on-input is non-nil, don't hide the buffer on input. + (if (or (window-minibuffer-p) + (window-dedicated-p (selected-window))) + (pop-to-buffer (current-buffer)) + (switch-to-buffer "GNU Emacs")) + (erase-buffer) + (if pure-space-overflow + (insert "\ +Warning Warning!!! Pure space overflow !!!Warning Warning +\(See the node Pure Storage in the Lisp manual for details.)\n")) + (let (fancy-splash-outer-buffer) + (fancy-splash-head) + (dolist (text fancy-splash-text) + (apply #'fancy-splash-insert text)) + (fancy-splash-tail) + (set-buffer-modified-p nil) + (goto-char (point-min))))) (defun fancy-splash-frame () "Return the frame to use for the fancy splash screen. @@ -1410,14 +1433,16 @@ we put it on this frame." (> window-height (+ image-height 19))))))) -(defun normal-splash-screen () +(defun normal-splash-screen (&optional hide-on-input) "Display splash screen when Emacs starts." (let ((prev-buffer (current-buffer))) (unwind-protect (with-current-buffer (get-buffer-create "GNU Emacs") + (erase-buffer) (set (make-local-variable 'tab-width) 8) - (set (make-local-variable 'mode-line-format) - (propertize "---- %b %-" 'face 'mode-line-buffer-id)) + (if hide-on-input + (set (make-local-variable 'mode-line-format) + (propertize "---- %b %-" 'face 'mode-line-buffer-id))) (if pure-space-overflow (insert "\ @@ -1433,9 +1458,13 @@ Warning Warning!!! Pure space overflow !!!Warning Warning ", one component of the GNU/Linux operating system.\n" ", a part of the GNU operating system.\n")) - (unless (equal (buffer-name prev-buffer) "*scratch*") - (insert (substitute-command-keys - "\nType \\[recenter] to begin editing your file.\n"))) + (if hide-on-input + (insert (substitute-command-keys + (concat + "\nType \\[recenter] to begin editing" + (if (equal (buffer-name prev-buffer) "*scratch*") + ".\n" + " your file.\n"))))) (if (display-mouse-p) ;; The user can use the mouse to activate menus @@ -1549,17 +1578,20 @@ Type \\[describe-distribution] for information on getting the latest version.")) ;; Display the input that we set up in the buffer. (set-buffer-modified-p nil) (goto-char (point-min)) - (if (or (window-minibuffer-p) - (window-dedicated-p (selected-window))) - ;; There's no point is using pop-to-buffer since creating - ;; a new frame will generate enough events that the - ;; subsequent `sit-for' will immediately return anyway. - nil ;; (pop-to-buffer (current-buffer)) - (save-window-excursion - (switch-to-buffer (current-buffer)) - (sit-for 120)))) + (if (or (window-minibuffer-p) + (window-dedicated-p (selected-window))) + ;; If hide-on-input is nil, creating a new frame will + ;; generate enough events that the subsequent `sit-for' + ;; will immediately return anyway. + (pop-to-buffer (current-buffer)) + (if hide-on-input + (save-window-excursion + (switch-to-buffer (current-buffer)) + (sit-for 120)) + (switch-to-buffer (current-buffer))))) ;; Unwind ... ensure splash buffer is killed - (kill-buffer "GNU Emacs")))) + (if hide-on-input + (kill-buffer "GNU Emacs"))))) (defun startup-echo-area-message () @@ -1575,14 +1607,14 @@ Type \\[describe-distribution] for information on getting the latest version.")) (message "%s" (startup-echo-area-message)))) -(defun display-splash-screen () +(defun display-splash-screen (&optional hide-on-input) "Display splash screen according to display. Fancy splash screens are used on graphic displays, normal otherwise." (interactive) (if (use-fancy-splash-screens-p) - (fancy-splash-screens) - (normal-splash-screen))) + (fancy-splash-screens hide-on-input) + (normal-splash-screen hide-on-input))) (defun command-line-1 (command-line-args-left) @@ -1885,7 +1917,7 @@ normal otherwise." ;; If user typed input during all that work, ;; abort the startup screen. Otherwise, display it now. (unless (input-pending-p) - (display-splash-screen)))) + (display-splash-screen t)))) (defun command-line-normalize-file-name (file) From dc6cc05f5c36bfc65379f3fa25267669402635ca Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Wed, 23 Aug 2006 16:36:24 +0000 Subject: [PATCH 312/361] * custom.texi (Init File): Reference Find Init to avoid "home directory" confusion. --- man/ChangeLog | 5 +++++ man/custom.texi | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/man/ChangeLog b/man/ChangeLog index cb598a9cfac..69ed7f0a9fd 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-08-23 Chong Yidong + + * custom.texi (Init File): Reference Find Init to avoid "home + directory" confusion. + 2006-08-22 Nick Roberts * building.texi (Other GDB-UI Buffers): Describe how to edit diff --git a/man/custom.texi b/man/custom.texi index dbe2a1b328c..682cb5b9310 100644 --- a/man/custom.texi +++ b/man/custom.texi @@ -2063,9 +2063,8 @@ Reference Manual}. @cindex rebinding keys, permanently @cindex startup (init file) - When Emacs is started, it normally loads a Lisp program from the -file @file{.emacs} or @file{.emacs.el} in your home directory -(see @ref{General Variables, HOME}, if you don't know where that is). + When Emacs is started, it normally loads a Lisp program from the file +@file{.emacs} or @file{.emacs.el} in your home directory (@pxref{Find Init}). We call this file your @dfn{init file} because it specifies how to initialize Emacs for you. You can use the command line switch @samp{-q} to prevent loading your init file, and @samp{-u} (or From 74b770deae14252f357519061f630a47b11cb3cb Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Wed, 23 Aug 2006 23:22:53 +0000 Subject: [PATCH 313/361] *** empty log message *** --- lisp/ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4e54ecc5f2e..ee84d69391f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2006-08-24 Kim F. Storm + + * progmodes/grep.el (grep-find-use-xargs): Use explicit value `exec' + to mean "use find -exec"; nil now unambiguously means auto-detect. + (grep-compute-defaults): Set grep-find-use-xargs to `exec' if not `gnu'. + Use shell-quote-argument to build grep-find-command and grep-find-template. + (rgrep): Use shell-quote-argument to properly quote arguments to find. + Reported by Tom Seddon. + 2006-08-23 Chong Yidong * startup.el (fancy-splash-head): Give instructions for dismissing From 84d797c949018ef7f6d1289f45ca02f5e3ea1ed6 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Wed, 23 Aug 2006 23:23:02 +0000 Subject: [PATCH 314/361] (grep-find-use-xargs): Use explicit value `exec' to mean "use find -exec"; nil now unambiguously means auto-detect. (grep-compute-defaults): Set grep-find-use-xargs to `exec' if not `gnu'. Use shell-quote-argument to build grep-find-command and grep-find-template. (rgrep): Use shell-quote-argument to properly quote arguments to find. Reported by Tom Seddon. --- lisp/progmodes/grep.el | 58 +++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index a939d54b3c9..48692f9742f 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -335,7 +335,7 @@ This variable's value takes effect when `grep-compute-defaults' is called.") (defvar grep-find-use-xargs nil "Whether \\[grep-find] uses the `xargs' utility by default. -If nil, it uses `find -exec'; if `gnu', it uses `find -print0' and `xargs -0'; +If `exec', it uses `find -exec'; if `gnu', it uses `find -print0' and `xargs -0'; if not nil and not `gnu', it uses `find -print' and `xargs'. This variable's value takes effect when `grep-compute-defaults' is called.") @@ -419,21 +419,29 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." (format "%s %s " grep-program grep-options))) (unless grep-find-use-xargs (setq grep-find-use-xargs - (if (and - (grep-probe find-program `(nil nil nil ,null-device "-print0")) - (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo"))) - 'gnu))) + (cond + ((and + (grep-probe find-program `(nil nil nil ,null-device "-print0")) + (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo"))) + 'gnu) + (t + 'exec)))) (unless grep-find-command (setq grep-find-command (cond ((eq grep-find-use-xargs 'gnu) (format "%s . -type f -print0 | xargs -0 -e %s" find-program grep-command)) - (grep-find-use-xargs + ((eq grep-find-use-xargs 'exec) + (let ((cmd0 (format "%s . -type f -exec %s" + find-program grep-command))) + (cons + (format "%s {} %s %s" + cmd0 null-device + (shell-quote-argument ";")) + (1+ (length cmd0))))) + (t (format "%s . -type f -print | xargs %s" - find-program grep-command)) - (t (cons (format "%s . -type f -exec %s {} %s \\;" - find-program grep-command null-device) - (+ 22 (length grep-command))))))) + find-program grep-command))))) (unless grep-find-template (setq grep-find-template (let ((gcmd (format "%s %s " @@ -441,11 +449,13 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." (cond ((eq grep-find-use-xargs 'gnu) (format "%s . -type f -print0 | xargs -0 -e %s" find-program gcmd)) - (grep-find-use-xargs + ((eq grep-find-use-xargs 'exec) + (format "%s . -type f -exec %s {} %s %s" + find-program gcmd null-device + (shell-quote-argument ";"))) + (t (format "%s . -type f -print | xargs %s" - find-program gcmd)) - (t (format "%s . -type f -exec %s {} %s \\;" - find-program gcmd null-device)))))))) + find-program gcmd)))))))) (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) (setq grep-highlight-matches (with-temp-buffer @@ -736,18 +746,26 @@ This command shares argument histories with \\[lgrep] and \\[grep-find]." (let ((command (grep-expand-template grep-find-template regexp - (concat "\\( -name " + (concat (shell-quote-argument "(") + " -name " (mapconcat #'shell-quote-argument (split-string files) " -o -name ") - " \\)") + " " + (shell-quote-argument ")")) dir (and grep-find-ignored-directories - (concat "\\( -path '*/" - (mapconcat #'identity + (concat (shell-quote-argument "(") + ;; we should use shell-quote-argument here + " -path " + (mapconcat #'(lambda (dir) + (shell-quote-argument + (concat "*/" dir))) grep-find-ignored-directories - "' -o -path '*/") - "' \\) -prune -o "))))) + " -o -path ") + " " + (shell-quote-argument ")") + " -prune -o "))))) (when command (if current-prefix-arg (setq command From fa4637560c2aaf88b00a843acf6b5290e0730be7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 24 Aug 2006 18:45:29 +0000 Subject: [PATCH 315/361] Remove * in defcustoms's docstrings. --- lisp/tumme.el | 68 +++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/lisp/tumme.el b/lisp/tumme.el index 3bd1d41886e..788a29958a8 100644 --- a/lisp/tumme.el +++ b/lisp/tumme.el @@ -172,12 +172,12 @@ :group 'multimedia) (defcustom tumme-dir "~/.emacs.d/tumme/" - "*Directory where thumbnail images are stored." + "Directory where thumbnail images are stored." :type 'string :group 'tumme) (defcustom tumme-thumbnail-storage 'use-tumme-dir - "*How to store tumme's thumbnail files. + "How to store tumme's thumbnail files. Tumme can store thumbnail files in one of two ways and this is controlled by this variable. \"Use tumme dir\" means that the thumbnails are stored in a central directory. \"Per directory\" @@ -193,17 +193,17 @@ that allows sharing of thumbnails across different programs." :group 'tumme) (defcustom tumme-db-file "~/.emacs.d/tumme/.tumme_db" - "*Database file where file names and their associated tags are stored." + "Database file where file names and their associated tags are stored." :type 'string :group 'tumme) (defcustom tumme-temp-image-file "~/.emacs.d/tumme/.tumme_temp" - "*Name of temporary image file used by various commands." + "Name of temporary image file used by various commands." :type 'string :group 'tumme) (defcustom tumme-gallery-dir "~/.emacs.d/tumme/.tumme_gallery" - "*Directory to store generated gallery html pages. + "Directory to store generated gallery html pages. This path needs to be \"shared\" to the public so that it can access the index.html page that tumme creates." :type 'string @@ -211,7 +211,7 @@ the index.html page that tumme creates." (defcustom tumme-gallery-image-root-url "http://your.own.server/tummepics" - "*URL where the full size images are to be found. + "URL where the full size images are to be found. Note that this path has to be configured in your web server. Tumme expects to find pictures in this directory." :type 'string @@ -219,7 +219,7 @@ expects to find pictures in this directory." (defcustom tumme-gallery-thumb-image-root-url "http://your.own.server/tummethumbs" - "*URL where the thumbnail images are to be found. + "URL where the thumbnail images are to be found. Note that this path has to be configured in your web server. Tumme expects to find pictures in this directory." :type 'string @@ -227,14 +227,14 @@ expects to find pictures in this directory." (defcustom tumme-cmd-create-thumbnail-program "convert" - "*Executable used to create thumbnail. + "Executable used to create thumbnail. Used together with `tumme-cmd-create-thumbnail-options'." :type 'string :group 'tumme) (defcustom tumme-cmd-create-thumbnail-options "%p -size %wx%h \"%f\" -resize %wx%h +profile \"*\" jpeg:\"%t\"" - "*Format of command used to create thumbnail image. + "Format of command used to create thumbnail image. Available options are %p which is replaced by `tumme-cmd-create-thumbnail-program', %w which is replaced by `tumme-thumb-width', %h which is replaced by `tumme-thumb-height', @@ -245,14 +245,14 @@ which is replaced by the file name of the thumbnail file." (defcustom tumme-cmd-create-temp-image-program "convert" - "*Executable used to create temporary image. + "Executable used to create temporary image. Used together with `tumme-cmd-create-temp-image-options'." :type 'string :group 'tumme) (defcustom tumme-cmd-create-temp-image-options "%p -size %wx%h \"%f\" -resize %wx%h +profile \"*\" jpeg:\"%t\"" - "*Format of command used to create temporary image for display window. + "Format of command used to create temporary image for display window. Available options are %p which is replaced by `tumme-cmd-create-temp-image-program', %w and %h which is replaced by the calculated max size for width and height in the image display window, @@ -262,13 +262,13 @@ is replaced by the file name of the temporary file." :group 'tumme) (defcustom tumme-cmd-pngnq-program (executable-find "pngnq") - "*The file name of the `pngnq' program. + "The file name of the `pngnq' program. It quantizes colors of PNG images down to 256 colors." :type '(choice (const :tag "Not Set" nil) string) :group 'tumme) (defcustom tumme-cmd-pngcrush-program (executable-find "pngcrush") - "*The file name of the `pngcrush' program. + "The file name of the `pngcrush' program. It optimizes the compression of PNG images. Also it adds PNG textual chunks with the information required by the Thumbnail Managing Standard." :type '(choice (const :tag "Not Set" nil) string) @@ -305,20 +305,20 @@ with the information required by the Thumbnail Managing Standard." "-text b \"Thumb::URI\" \"file://%f\" " "%q %t" " ; rm %q"))) - "*Command to create thumbnails according to the Thumbnail Managing Standard." + "Command to create thumbnails according to the Thumbnail Managing Standard." :type 'string :group 'tumme) (defcustom tumme-cmd-rotate-thumbnail-program "mogrify" - "*Executable used to rotate thumbnail. + "Executable used to rotate thumbnail. Used together with `tumme-cmd-rotate-thumbnail-options'." :type 'string :group 'tumme) (defcustom tumme-cmd-rotate-thumbnail-options "%p -rotate %d \"%t\"" - "*Format of command used to rotate thumbnail image. + "Format of command used to rotate thumbnail image. Available options are %p which is replaced by `tumme-cmd-rotate-thumbnail-program', %d which is replaced by the number of (positive) degrees to rotate the image, normally 90 or 270 @@ -329,14 +329,14 @@ of the thumbnail file." (defcustom tumme-cmd-rotate-original-program "jpegtran" - "*Executable used to rotate original image. + "Executable used to rotate original image. Used together with `tumme-cmd-rotate-original-options'." :type 'string :group 'tumme) (defcustom tumme-cmd-rotate-original-options "%p -rotate %d -copy all \"%o\" > %t" - "*Format of command used to rotate original image. + "Format of command used to rotate original image. Available options are %p which is replaced by `tumme-cmd-rotate-original-program', %d which is replaced by the number of (positive) degrees to rotate the image, normally 90 or @@ -348,7 +348,7 @@ original image file name and %t which is replaced by (defcustom tumme-temp-rotate-image-file "~/.emacs.d/tumme/.tumme_rotate_temp" - "*Temporary file for rotate operations." + "Temporary file for rotate operations." :type 'string :group 'tumme) @@ -361,14 +361,14 @@ original file with `tumme-temp-rotate-image-file'." (defcustom tumme-cmd-write-exif-data-program "exiftool" - "*Program used to write EXIF data to image. + "Program used to write EXIF data to image. Used together with `tumme-cmd-write-exif-data-options'." :type 'string :group 'tumme) (defcustom tumme-cmd-write-exif-data-options "%p -%t=\"%v\" \"%f\"" - "*Format of command used to write EXIF data. + "Format of command used to write EXIF data. Available options are %p which is replaced by `tumme-cmd-write-exif-data-program', %f which is replaced by the image file name, %t which is replaced by the tag name and %v @@ -378,14 +378,14 @@ which is replaced by the tag value." (defcustom tumme-cmd-read-exif-data-program "exiftool" - "*Program used to read EXIF data to image. + "Program used to read EXIF data to image. Used together with `tumme-cmd-read-exif-data-program-options'." :type 'string :group 'tumme) (defcustom tumme-cmd-read-exif-data-options "%p -s -s -s -%t \"%f\"" - "*Format of command used to read EXIF data. + "Format of command used to read EXIF data. Available options are %p which is replaced by `tumme-cmd-write-exif-data-options', %f which is replaced by the image file name and %t which is replaced by the tag name." @@ -394,7 +394,7 @@ by the image file name and %t which is replaced by the tag name." (defcustom tumme-gallery-hidden-tags (list "private" "hidden" "pending") - "*List of \"hidden\" tags. + "List of \"hidden\" tags. Used by `tumme-gallery-generate' to leave out \"hidden\" images." :type '(repeat string) :group 'tumme) @@ -416,18 +416,18 @@ This is the default size for both `tumme-thumb-width' and `tumme-thumb-height'." :group 'tumme) (defcustom tumme-thumb-relief 2 - "*Size of button-like border around thumbnails." + "Size of button-like border around thumbnails." :type 'integer :group 'tumme) (defcustom tumme-thumb-margin 2 - "*Size of the margin around thumbnails. + "Size of the margin around thumbnails. This is where you see the cursor." :type 'integer :group 'tumme) (defcustom tumme-line-up-method 'dynamic - "*Default method for line-up of thumbnails in thumbnail buffer. + "Default method for line-up of thumbnails in thumbnail buffer. Used by `tumme-display-thumbs' and other functions that needs to line-up thumbnails. Dynamic means to use the available width of the window containing the thumbnail buffer, Fixed means to use @@ -441,19 +441,19 @@ line-up means that no automatic line-up will be done." :group 'tumme) (defcustom tumme-thumbs-per-row 3 - "*Number of thumbnails to display per row in thumb buffer." + "Number of thumbnails to display per row in thumb buffer." :type 'integer :group 'tumme) (defcustom tumme-display-window-width-correction 1 - "*Number to be used to correct image display window width. + "Number to be used to correct image display window width. Change if the default (1) does not work (i.e. if the image does not completely fit)." :type 'integer :group 'tumme) (defcustom tumme-display-window-height-correction 0 - "*Number to be used to correct image display window height. + "Number to be used to correct image display window height. Change if the default (0) does not work (i.e. if the image does not completely fit)." :type 'integer @@ -487,7 +487,7 @@ dired and you might want to turn it off." :group 'tumme) (defcustom tumme-display-properties-format "%b: %f (%t): %c" - "*Display format for thumbnail properties. + "Display format for thumbnail properties. %b is replaced with associated dired buffer name, %f with file name \(without path) of original image file, %t with the list of tags and %c with the comment." @@ -500,20 +500,20 @@ with the comment." (cond ((executable-find "display")) ((executable-find "xli")) ((executable-find "qiv") "qiv -t")) - "*Name of external viewer. + "Name of external viewer. Including parameters. Used when displaying original image from `tumme-thumbnail-mode'." :type 'string :group 'tumme) (defcustom tumme-main-image-directory "~/pics/" - "*Name of main image directory, if any. + "Name of main image directory, if any. Used by `tumme-copy-with-exif-file-name'." :type 'string :group 'tumme) (defcustom tumme-show-all-from-dir-max-files 50 - "*Maximum number of files to show using `tumme-show-all-from-dir'. + "Maximum number of files to show using `tumme-show-all-from-dir'. before warning the user." :type 'integer :group 'tumme) From 6410aac93b73dae0e18f1df7c25fc945a33549bd Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Thu, 24 Aug 2006 20:40:26 +0000 Subject: [PATCH 316/361] *** empty log message *** --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 59bd13f0daf..1f570e15a07 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-25 Nick Roberts + + * buffer.c (Fswitch_to_buffer): Move buffer to front of + buffer-alist if necessary. + 2006-08-22 Kim F. Storm * xdisp.c (update_tool_bar): Redisplay toolbar also when only From fab45703d34ca5c8c0adea32a1731bc8b73d77db Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Thu, 24 Aug 2006 20:40:53 +0000 Subject: [PATCH 317/361] (Fswitch_to_buffer): Move buffer to front of buffer-alist if necessary. --- src/buffer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 07d0f676aa2..f6c45852b51 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1684,9 +1684,13 @@ the window-buffer correspondences. */) char *err; if (EQ (buffer, Fwindow_buffer (selected_window))) - /* Basically a NOP. Avoid signalling an error if the selected window - is dedicated, or a minibuffer, ... */ - return Fset_buffer (buffer); + { + if (NILP (norecord) && !EQ (buffer, XCDR (XCAR (Vbuffer_alist)))) + record_buffer (buffer); + /* Basically a NOP. Avoid signalling an error if the selected window + is dedicated, or a minibuffer, ... */ + return Fset_buffer (buffer); + } err = no_switch_window (selected_window); if (err) error (err); From daa0e79b0a84b14d29a033d5e005ea186e5b1d6a Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Thu, 24 Aug 2006 20:51:17 +0000 Subject: [PATCH 318/361] (overline_margin): New variable. (x_produce_glyphs): Use it. (syms_of_xdisp): DEFVAR_INT it. --- src/xdisp.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 640f7006dd1..4144cf51f6a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -710,6 +710,10 @@ Lisp_Object Vresize_mini_windows; struct buffer *displayed_buffer; +/* Space between overline and text. */ + +EMACS_INT overline_margin; + /* Value returned from text property handlers (see below). */ enum prop_handled @@ -20357,7 +20361,7 @@ x_produce_glyphs (it) /* If face has an overline, add the height of the overline (1 pixel) and a 1 pixel margin to the character height. */ if (face->overline_p) - it->ascent += 2; + it->ascent += overline_margin; if (it->constrain_row_ascent_descent_p) { @@ -20559,7 +20563,7 @@ x_produce_glyphs (it) /* If face has an overline, add the height of the overline (1 pixel) and a 1 pixel margin to the character height. */ if (face->overline_p) - it->ascent += 2; + it->ascent += overline_margin; take_vertical_position_into_account (it); @@ -20834,7 +20838,7 @@ x_produce_glyphs (it) /* If face has an overline, add the height of the overline (1 pixel) and a 1 pixel margin to the character height. */ if (face->overline_p) - it->ascent += 2; + it->ascent += overline_margin; take_vertical_position_into_account (it); @@ -24110,6 +24114,12 @@ whose contents depend on various data. */); doc: /* Inhibit try_cursor_movement display optimization. */); inhibit_try_cursor_movement = 0; #endif /* GLYPH_DEBUG */ + + DEFVAR_INT ("overline-margin", &overline_margin, + doc: /* *Space between overline and text, in pixels. +The default value is 2: the height of the overline (1 pixel) plus 1 pixel +margin to the caracter height. */); + overline_margin = 2; } From 30f27523567516a324d042e10bde5dd14d7da90f Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Thu, 24 Aug 2006 20:52:00 +0000 Subject: [PATCH 319/361] (x_underline_at_descent_line): New variable. (syms_of_xterm): DEFVAR_BOOL it. (x_draw_glyph_string): Use it. Draw underline and overline up to the end of line if the face extends to the end of line. --- src/macterm.c | 8 ++++---- src/w32term.c | 36 +++++++++++++++++++++++++++--------- src/xterm.c | 51 +++++++++++++++++++++++++++++++++------------------ 3 files changed, 64 insertions(+), 31 deletions(-) diff --git a/src/macterm.c b/src/macterm.c index 97e3b743469..04b55d9fa80 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -3679,14 +3679,14 @@ x_draw_glyph_string (s) if (s->face->underline_defaulted_p) mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy, - s->width, h); + s->background_width, h); else { XGCValues xgcv; XGetGCValues (s->display, s->gc, GCForeground, &xgcv); XSetForeground (s->display, s->gc, s->face->underline_color); mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy, - s->width, h); + s->background_width, h); XSetForeground (s->display, s->gc, xgcv.foreground); } } @@ -3698,14 +3698,14 @@ x_draw_glyph_string (s) if (s->face->overline_color_defaulted_p) mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy, - s->width, h); + s->background_width, h); else { XGCValues xgcv; XGetGCValues (s->display, s->gc, GCForeground, &xgcv); XSetForeground (s->display, s->gc, s->face->overline_color); mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy, - s->width, h); + s->background_width, h); XSetForeground (s->display, s->gc, xgcv.foreground); } } diff --git a/src/w32term.c b/src/w32term.c index 5e33c3af7b9..93a697bbd8c 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -91,6 +91,10 @@ static Lisp_Object last_window; (Not yet supported, see TODO in x_draw_glyph_string.) */ int x_use_underline_position_properties; +/* Non-zero means to draw the underline at the same place as the descent line. */ + +int x_underline_at_descent_line; + extern unsigned int msh_mousewheel; extern void free_frame_menubar (); @@ -2509,21 +2513,27 @@ x_draw_glyph_string (s) && (s->font->bdf || !s->font->tm.tmUnderlined)) { unsigned long h = 1; - unsigned long dy = s->height - h; + unsigned long dy = 0; - /* TODO: Use font information for positioning and thickness - of underline. See OUTLINETEXTMETRIC, and xterm.c. - Note: If you make this work, don't forget to change the - doc string of x-use-underline-position-properties below. */ + if (x_underline_at_descent_line) + dy = s->height - h; + else + { + /* TODO: Use font information for positioning and thickness of + underline. See OUTLINETEXTMETRIC, and xterm.c. Note: If + you make this work, don't forget to change the doc string of + x-use-underline-position-properties below. */ + dy = s->height - h; + } if (s->face->underline_defaulted_p) { w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, - s->y + dy, s->width, 1); + s->y + dy, s->background_width, 1); } else { w32_fill_area (s->f, s->hdc, s->face->underline_color, s->x, - s->y + dy, s->width, 1); + s->y + dy, s->background_width, 1); } } @@ -2535,12 +2545,12 @@ x_draw_glyph_string (s) if (s->face->overline_color_defaulted_p) { w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, - s->y + dy, s->width, h); + s->y + dy, s->background_width, h); } else { w32_fill_area (s->f, s->hdc, s->face->overline_color, s->x, - s->y + dy, s->width, h); + s->y + dy, s->background_width, h); } } @@ -6510,6 +6520,14 @@ to 4.1, set this to nil. NOTE: Not supported on MS-Windows yet. */); x_use_underline_position_properties = 0; + DEFVAR_BOOL ("x-underline-at-descent-line", + &x_underline_at_descent_line, + doc: /* *Non-nil means to draw the underline at the same place as the descent line. +nil means to draw the underline according to the value of the variable +`x-use-underline-position-properties', which is usually at the baseline +level. The default value is nil. */); + x_underline_at_descent_line = 0; + DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, doc: /* If not nil, Emacs uses toolkit scroll bars. */); Vx_toolkit_scroll_bars = Qt; diff --git a/src/xterm.c b/src/xterm.c index 9cea615ca1e..c2cf2721881 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -182,6 +182,10 @@ static Lisp_Object last_window; int x_use_underline_position_properties; +/* Non-zero means to draw the underline at the same place as the descent line. */ + +int x_underline_at_descent_line; + /* This is a chain of structures for all the X displays currently in use. */ @@ -2685,32 +2689,35 @@ x_draw_glyph_string (s) if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h)) h = 1; - /* Get the underline position. This is the recommended - vertical offset in pixels from the baseline to the top of - the underline. This is a signed value according to the - specs, and its default is - - ROUND ((maximum descent) / 2), with - ROUND(x) = floor (x + 0.5) */ - - if (x_use_underline_position_properties - && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem)) - y = s->ybase + (long) tem; - else if (s->face->font) - y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; - else + if (x_underline_at_descent_line) y = s->y + s->height - h; + else + { + /* Get the underline position. This is the recommended + vertical offset in pixels from the baseline to the top of + the underline. This is a signed value according to the + specs, and its default is + + ROUND ((maximum descent) / 2), with + ROUND(x) = floor (x + 0.5) */ + + if (x_use_underline_position_properties + && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem)) + y = s->ybase + (long) tem; + else if (s->face->font) + y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; + } if (s->face->underline_defaulted_p) XFillRectangle (s->display, s->window, s->gc, - s->x, y, s->width, h); + s->x, y, s->background_width, h); else { XGCValues xgcv; XGetGCValues (s->display, s->gc, GCForeground, &xgcv); XSetForeground (s->display, s->gc, s->face->underline_color); XFillRectangle (s->display, s->window, s->gc, - s->x, y, s->width, h); + s->x, y, s->background_width, h); XSetForeground (s->display, s->gc, xgcv.foreground); } } @@ -2722,14 +2729,14 @@ x_draw_glyph_string (s) if (s->face->overline_color_defaulted_p) XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy, - s->width, h); + s->background_width, h); else { XGCValues xgcv; XGetGCValues (s->display, s->gc, GCForeground, &xgcv); XSetForeground (s->display, s->gc, s->face->overline_color); XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy, - s->width, h); + s->background_width, h); XSetForeground (s->display, s->gc, xgcv.foreground); } } @@ -10979,6 +10986,14 @@ UNDERLINE_POSITION font properties, for example 7x13 on XFree prior to 4.1, set this to nil. */); x_use_underline_position_properties = 1; + DEFVAR_BOOL ("x-underline-at-descent-line", + &x_underline_at_descent_line, + doc: /* *Non-nil means to draw the underline at the same place as the descent line. +nil means to draw the underline according to the value of the variable +`x-use-underline-position-properties', which is usually at the baseline +level. The default value is nil. */); + x_underline_at_descent_line = 0; + DEFVAR_BOOL ("x-mouse-click-focus-ignore-position", &x_mouse_click_focus_ignore_position, doc: /* Non-nil means that a mouse click to focus a frame does not move point. From 03c25271aa096026666cf006198681a87d8ac27c Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Thu, 24 Aug 2006 20:52:54 +0000 Subject: [PATCH 320/361] (all): Add `overline-margin' and `x-underline-at-descent-line'. --- lisp/cus-start.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 8b68ede83a1..1fa91414ef9 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -360,6 +360,7 @@ since it could result in memory overflow and make Emacs crash." (other :tag "Unlimited" t))) (unibyte-display-via-language-environment mule boolean) (blink-cursor-alist cursor alist "22.1") + (overline-margin display integer "22.1") ;; xfaces.c (scalable-fonts-allowed display boolean) ;; xfns.c @@ -371,6 +372,7 @@ since it could result in memory overflow and make Emacs crash." ;; xterm.c (mouse-autoselect-window display boolean "21.3") (x-use-underline-position-properties display boolean "21.3") + (x-underline-at-descent-line display boolean "22.1") (x-stretch-cursor display boolean "21.1"))) this symbol group type standard version native-p ;; This function turns a value From 8d8dafebb36347734c5f81f8154d0749ca16bfaf Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Thu, 24 Aug 2006 21:18:13 +0000 Subject: [PATCH 321/361] *** empty log message *** --- etc/NEWS | 7 +++++++ lisp/ChangeLog | 5 +++++ src/ChangeLog | 18 +++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 4b8f564a042..aefb11ccb2d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -839,6 +839,13 @@ The variable `automatic-hscrolling' was renamed to the window now works sensibly, by automatically adjusting the window's vscroll property. +*** New customize option `overline-margin' controls the space between +overline and text. + +*** New variable `x-underline-at-descent-line' controls the relative +position of the underline. When set, it overrides the +`x-use-underline-position-properties' variables. + +++ *** The new face `mode-line-inactive' is used to display the mode line of non-selected windows. The `mode-line' face is now used to display diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ee84d69391f..72a1bed4397 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-24 Francesc Rocher + + * cus-start.el (all): Add `overline-margin' and + `x-underline-at-descent-line'. + 2006-08-24 Kim F. Storm * progmodes/grep.el (grep-find-use-xargs): Use explicit value `exec' diff --git a/src/ChangeLog b/src/ChangeLog index 1f570e15a07..cc87d69e070 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,20 @@ -2006-08-25 Nick Roberts +2006-08-24 Francesc Rocher + + * xdisp.c (overline_margin): New variable. + (x_produce_glyphs): Use it. + (syms_of_xdisp): DEFVAR_INT it. + + * xterm.c (x_underline_at_descent_line): New variable. + (syms_of_xterm): DEFVAR_BOOL it. + (x_draw_glyph_string): Use it. + Draw underline and overline up to the end of line if the face + extends to the end of line. + + * macterm.c: Likewise. + + * w32term.c: Likewise. + +2006-08-24 Nick Roberts * buffer.c (Fswitch_to_buffer): Move buffer to front of buffer-alist if necessary. From 1063efe807c0195c62f2dc22bcc78c61cf25c376 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 24 Aug 2006 23:40:00 +0000 Subject: [PATCH 322/361] * emacs-lisp/timer.el (timer-set-idle-time, run-with-idle-timer): Accept internal time format for SECS arg. (timer-relative-time): Doc fix. * jit-lock.el: "Stealth fontification by requeuing timers" patch, adapted from Martin Rudalics. (jit-lock-stealth-repeat-timer, jit-lock-stealth-buffers): New vars. (jit-lock-mode): Create jit-lock-stealth-repeat-timer. (jit-lock-stealth-fontify): Reschedule as a idle timer instead of using sit-for. --- lisp/ChangeLog | 13 +++++ lisp/emacs-lisp/timer.el | 21 +++++-- lisp/jit-lock.el | 117 +++++++++++++++++++-------------------- 3 files changed, 84 insertions(+), 67 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 72a1bed4397..554274a2544 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2006-08-24 Chong Yidong + + * emacs-lisp/timer.el (timer-set-idle-time, run-with-idle-timer): + Accept internal time format for SECS arg. + (timer-relative-time): Doc fix. + + * jit-lock.el: "Stealth fontification by requeuing timers" patch, + adapted from Martin Rudalics. + (jit-lock-stealth-repeat-timer, jit-lock-stealth-buffers): New vars. + (jit-lock-mode): Create jit-lock-stealth-repeat-timer. + (jit-lock-stealth-fontify): Reschedule as a idle timer instead of + using sit-for. + 2006-08-24 Francesc Rocher * cus-start.el (all): Add `overline-margin' and diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index ed85bc765f7..82eac50c874 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -60,14 +60,22 @@ fire repeatedly that many seconds apart." (defun timer-set-idle-time (timer secs &optional repeat) "Set the trigger idle time of TIMER to SECS. +SECS may be an integer, floating point number, or the internal +time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'. If optional third argument REPEAT is non-nil, make the timer fire each time Emacs is idle for that many seconds." (or (timerp timer) (error "Invalid timer")) - (aset timer 1 0) - (aset timer 2 0) - (aset timer 3 0) - (timer-inc-time timer secs) + (if (consp secs) + (progn (aset timer 1 (car secs)) + (aset timer 2 (if (consp (cdr secs)) (car (cdr secs)) (cdr secs))) + (aset timer 3 (or (and (consp (cdr secs)) (consp (cdr (cdr secs))) + (nth 2 secs)) + 0))) + (aset timer 1 0) + (aset timer 2 0) + (aset timer 3 0) + (timer-inc-time timer secs)) (aset timer 4 repeat) timer) @@ -104,7 +112,7 @@ of SECS seconds since the epoch. SECS may be a fraction." (defun timer-relative-time (time secs &optional usecs) "Advance TIME by SECS seconds and optionally USECS microseconds. -SECS may be a fraction." +SECS may be either an integer or a floating point number." (let ((high (car time)) (low (if (consp (cdr time)) (nth 1 time) (cdr time))) (micro (if (numberp (car-safe (cdr-safe (cdr time)))) @@ -412,7 +420,8 @@ This function is for compatibility; see also `run-with-timer'." (defun run-with-idle-timer (secs repeat function &rest args) "Perform an action the next time Emacs is idle for SECS seconds. The action is to call FUNCTION with arguments ARGS. -SECS may be an integer or a floating point number. +SECS may be an integer, a floating point number, or the internal +time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'. If Emacs is currently idle, and has been idle for N seconds (N < SECS), then it will call FUNCTION in SECS - N seconds from now. diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index 606cd1e0b84..89959ad8525 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -171,6 +171,8 @@ If nil, contextual fontification is disabled.") (defvar jit-lock-stealth-timer nil "Timer for stealth fontification in Just-in-time Lock mode.") +(defvar jit-lock-stealth-repeat-timer nil + "Timer for repeated stealth fontification in Just-in-time Lock mode.") (defvar jit-lock-context-timer nil "Timer for context fontification in Just-in-time Lock mode.") (defvar jit-lock-defer-timer nil @@ -178,6 +180,8 @@ If nil, contextual fontification is disabled.") (defvar jit-lock-defer-buffers nil "List of buffers with pending deferred fontification.") +(defvar jit-lock-stealth-buffers nil + "List of buffers that are being fontified stealthily.") ;;; JIT lock mode @@ -225,6 +229,13 @@ the variable `jit-lock-stealth-nice'." (run-with-idle-timer jit-lock-stealth-time t 'jit-lock-stealth-fontify))) + ;; Create, but do not activate, the idle timer for repeated + ;; stealth fontification. + (when (and jit-lock-stealth-time (null jit-lock-stealth-repeat-timer)) + (setq jit-lock-stealth-repeat-timer (timer-create)) + (timer-set-function jit-lock-stealth-repeat-timer + 'jit-lock-stealth-fontify '(t))) + ;; Init deferred fontification timer. (when (and jit-lock-defer-time (null jit-lock-defer-timer)) (setq jit-lock-defer-timer @@ -443,71 +454,55 @@ Value is nil if there is nothing more to fontify." (t next)))) result)))) - -(defun jit-lock-stealth-fontify () +(defun jit-lock-stealth-fontify (&optional repeat) "Fontify buffers stealthily. -This functions is called after Emacs has been idle for -`jit-lock-stealth-time' seconds." - ;; I used to check `inhibit-read-only' here, but I can't remember why. -stef +This function is called repeatedly after Emacs has become idle for +`jit-lock-stealth-time' seconds. Optional argument REPEAT is expected +non-nil in a repeated invocation of this function." + ;; Cancel timer for repeated invocations. + (unless repeat + (cancel-timer jit-lock-stealth-repeat-timer)) (unless (or executing-kbd-macro memory-full - (window-minibuffer-p (selected-window))) - (let ((buffers (buffer-list)) - (outer-buffer (current-buffer)) + (window-minibuffer-p (selected-window)) + ;; For first invocation set up `jit-lock-stealth-buffers'. + ;; In repeated invocations it's already been set up. + (null (if repeat + jit-lock-stealth-buffers + (setq jit-lock-stealth-buffers (buffer-list))))) + (let ((buffer (car jit-lock-stealth-buffers)) + (delay 0) minibuffer-auto-raise - message-log-max) - (with-local-quit - (while (and buffers (not (input-pending-p))) - (with-current-buffer (pop buffers) - (when jit-lock-mode - ;; This is funny. Calling sit-for with 3rd arg non-nil - ;; so that it doesn't redisplay, internally calls - ;; wait_reading_process_input also with a parameter - ;; saying "don't redisplay." Since this function here - ;; is called periodically, this effectively leads to - ;; process output not being redisplayed at all because - ;; redisplay_internal is never called. (That didn't - ;; work in the old redisplay either.) So, we learn that - ;; we mustn't call sit-for that way here. But then, we - ;; have to be cautious not to call sit-for in a widened - ;; buffer, since this could display hidden parts of that - ;; buffer. This explains the seemingly weird use of - ;; save-restriction/widen here. - - (with-temp-message (if jit-lock-stealth-verbose - (concat "JIT stealth lock " - (buffer-name))) - - ;; In the following code, the `sit-for' calls cause a - ;; redisplay, so it's required that the - ;; buffer-modified flag of a buffer that is displayed - ;; has the right value---otherwise the mode line of - ;; an unmodified buffer would show a `*'. - (let (start - (nice (or jit-lock-stealth-nice 0)) - (point (point-min))) - (while (and (setq start - (jit-lock-stealth-chunk-start point)) - ;; In case sit-for runs any timers, - ;; give them the expected current buffer. - (with-current-buffer outer-buffer - (sit-for nice))) - - ;; fontify a block. - (jit-lock-fontify-now start (+ start jit-lock-chunk-size)) - ;; If stealth jit-locking is done backwards, this leads to - ;; excessive O(n^2) refontification. -stef - ;; (when (>= jit-lock-context-unfontify-pos start) - ;; (setq jit-lock-context-unfontify-pos end)) - - ;; Wait a little if load is too high. - (when (and jit-lock-stealth-load - (> (car (load-average)) jit-lock-stealth-load)) - ;; In case sit-for runs any timers, - ;; give them the expected current buffer. - (with-current-buffer outer-buffer - (sit-for (or jit-lock-stealth-time 30)))))))))))))) - + message-log-max + start) + (if (and jit-lock-stealth-load + (> (car (load-average)) jit-lock-stealth-load)) + ;; Wait a little if load is too high. + (setq delay jit-lock-stealth-time) + (if (buffer-live-p buffer) + (with-current-buffer buffer + (if (and jit-lock-mode + (setq start (jit-lock-stealth-chunk-start (point)))) + ;; Fontify one block of at most `jit-lock-chunk-size' + ;; characters. + (with-temp-message (if jit-lock-stealth-verbose + (concat "JIT stealth lock " + (buffer-name))) + (jit-lock-fontify-now start + (+ start jit-lock-chunk-size)) + ;; Run again after `jit-lock-stealth-nice' seconds. + (setq delay (or jit-lock-stealth-nice 0))) + ;; Nothing to fontify here. Remove this buffer from + ;; `jit-lock-stealth-buffers' and run again immediately. + (setq jit-lock-stealth-buffers (cdr jit-lock-stealth-buffers)))) + ;; Buffer is no longer live. Remove it from + ;; `jit-lock-stealth-buffers' and run again immediately. + (setq jit-lock-stealth-buffers (cdr jit-lock-stealth-buffers)))) + ;; Call us again. + (when jit-lock-stealth-buffers + (timer-set-idle-time jit-lock-stealth-repeat-timer (current-idle-time)) + (timer-inc-time jit-lock-stealth-repeat-timer delay) + (timer-activate-when-idle jit-lock-stealth-repeat-timer t))))) ;;; Deferred fontification. From 6c5d6b6ce728bd25f6e72bfe8124059d6ded0744 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Fri, 25 Aug 2006 02:15:02 +0000 Subject: [PATCH 323/361] Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 126-127) - Merge from emacs--devo--0 - Update from CVS 2006-08-23 Andreas Seltenreich [ Backported bug fix from No Gnus. ] * lisp/gnus/gnus.el (gnus-find-method-for-group): On killed/unknown groups, try looking up the method using GROUP's prefix before inventing a new one. It is used on killed/unknown groups in various places where returning an all-new method isn't expected by the caller. * lisp/gnus/gnus-util.el (gnus-group-server): Copy required macro from No Gnus. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-410 --- lisp/gnus/ChangeLog | 11 +++++++++++ lisp/gnus/gnus-util.el | 11 +++++++++++ lisp/gnus/gnus.el | 9 +++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 6ddd513610a..6927e3bfbac 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,14 @@ +2006-08-23 Andreas Seltenreich + + [ Backported bug fix from No Gnus. ] + + * gnus.el (gnus-find-method-for-group): On killed/unknown groups, try + looking up the method using GROUP's prefix before inventing a new one. + It is used on killed/unknown groups in various places where returning + an all-new method isn't expected by the caller. + + * gnus-util.el (gnus-group-server): Copy required macro from No Gnus. + 2006-08-13 Romain Francoise * mm-extern.el (mm-extern-mail-server): End `y-or-n-p' prompt with a diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 6b525fc490c..6f706fabce5 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -607,6 +607,17 @@ If N, return the Nth ancestor instead." (substring gname (match-end 0)) gname))) +(defmacro gnus-group-server (group) + "Find the server name of a foreign newsgroup. +For example, (gnus-group-server \"nnimap+yxa:INBOX.foo\") would +yield \"nnimap:yxa\"." + `(let ((gname ,group)) + (if (string-match "^\\([^:+]+\\)\\(?:\\+\\([^:]*\\)\\)?:" gname) + (format "%s:%s" (match-string 1 gname) (or + (match-string 2 gname) + "")) + (format "%s:%s" (car gnus-select-method) (cadr gnus-select-method))))) + (defun gnus-make-sort-function (funs) "Return a composite sort condition based on the functions in FUNS." (cond diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 7a04c61151a..8554b1332f1 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -4079,8 +4079,13 @@ If NEWSGROUP is nil, return the global kill file name instead." (or gnus-override-method (and (not group) gnus-select-method) - (and (not (gnus-group-entry group)) ;; a new group - (gnus-group-name-to-method group)) + (and (not (gnus-group-entry group)) + ;; Killed or otherwise unknown group. + (or + ;; If we know a virtual server by that name, return its method. + (gnus-server-to-method (gnus-group-server group)) + ;; Guess a new method as last resort. + (gnus-group-name-to-method group))) (let ((info (or info (gnus-get-info group))) method) (if (or (not info) From fda9748457d804a6e46ebc7054f0976aed516e71 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 25 Aug 2006 02:58:08 +0000 Subject: [PATCH 324/361] * os.texi (Timers): Avoid waiting inside timers. --- lispref/ChangeLog | 4 ++++ lispref/os.texi | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 12528d35e55..50c945e3b11 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,7 @@ +2006-08-24 Chong Yidong + + * os.texi (Timers): Avoid waiting inside timers. + 2006-08-21 Lute Kamstra * Makefile.in: Use ../man/texinfo.tex to build elisp.dvi. diff --git a/lispref/os.texi b/lispref/os.texi index d227cf92bcf..b5522dc2a98 100644 --- a/lispref/os.texi +++ b/lispref/os.texi @@ -1394,6 +1394,13 @@ both before and after changing the buffer, to separate the timer's changes from user commands' changes and prevent a single undo entry from growing to be quite large. + Timer functions should also avoid calling functions that cause Emacs +to wait, such as @code{sit-for} (@pxref{Waiting}). This can lead to +unpredictable effects, since other timers (or even the same timer) can +run while waiting. If a timer function needs to perform an action +after a certain time has elapsed, it can do this by scheduling a new +timer. + If a timer function calls functions that can change the match data, it should save and restore the match data. @xref{Saving Match Data}. From 11f56bbcfee486e60d33c9d18d0ca9a01ebbaa6d Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Aug 2006 07:47:12 +0000 Subject: [PATCH 325/361] (sxhash_string): Rotate properly; don't lose bits. --- src/fns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fns.c b/src/fns.c index ca4a098878a..228d48049f0 100644 --- a/src/fns.c +++ b/src/fns.c @@ -5027,7 +5027,7 @@ sxhash_string (ptr, len) c = *p++; if (c >= 0140) c -= 40; - hash = ((hash << 3) + (hash >> 28) + c); + hash = ((hash << 4) + (hash >> 28) + c); } return hash & INTMASK; From 73c24ae8e82a9144264b768a18e76765263c10df Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Aug 2006 07:51:46 +0000 Subject: [PATCH 326/361] (Idle Timers): run-with-idle-timer allows Lisp time value. Add xref. --- lispref/os.texi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lispref/os.texi b/lispref/os.texi index b5522dc2a98..f6682548e5b 100644 --- a/lispref/os.texi +++ b/lispref/os.texi @@ -1500,7 +1500,8 @@ work just like ordinary timers. @deffn Command run-with-idle-timer secs repeat function &rest args Set up a timer which runs when Emacs has been idle for @var{secs} seconds. The value of @var{secs} may be an integer or a floating point -number. +number; a value of the type returned by @code{current-idle-time} +is also allowed. If @var{repeat} is @code{nil}, the timer runs just once, the first time Emacs remains idle for a long enough time. More often @var{repeat} is @@ -1508,7 +1509,7 @@ non-@code{nil}, which means to run the timer @emph{each time} Emacs remains idle for @var{secs} seconds. The function @code{run-with-idle-timer} returns a timer value which you -can use in calling @code{cancel-timer} (see below). +can use in calling @code{cancel-timer} (@pxref{Timers}). @end deffn @cindex idleness From 3e04a8fc9f8cdab42552c658713e12e2ebc74bc2 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Aug 2006 07:51:57 +0000 Subject: [PATCH 327/361] *** empty log message *** --- lispref/ChangeLog | 5 +++++ src/ChangeLog | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 50c945e3b11..ca648380cc4 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,8 @@ +2006-08-25 Richard Stallman + + * os.texi (Idle Timers): run-with-idle-timer allows Lisp time value. + Add xref. + 2006-08-24 Chong Yidong * os.texi (Timers): Avoid waiting inside timers. diff --git a/src/ChangeLog b/src/ChangeLog index cc87d69e070..b585c06c1c0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-25 Richard Stallman + + * fns.c (sxhash_string): Rotate properly; don't lose bits. + 2006-08-24 Francesc Rocher * xdisp.c (overline_margin): New variable. From 16fb6ded70ae47140bb21b06da62f2f85a414019 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 25 Aug 2006 10:05:41 +0000 Subject: [PATCH 328/361] *** empty log message *** --- src/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index b585c06c1c0..bcb576f1fa0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-25 Kim F. Storm + + * keyboard.c (Fcurrent_idle_time): Simplify. + 2006-08-25 Richard Stallman * fns.c (sxhash_string): Rotate properly; don't lose bits. From 966949b00f0515e586645cee56d42a14dac4f9fc Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 25 Aug 2006 10:05:50 +0000 Subject: [PATCH 329/361] (Fcurrent_idle_time): Simplify. --- src/keyboard.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 0d13743f8b5..abf57937966 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4570,19 +4570,16 @@ The microsecond count is zero on systems that do not provide resolution finer than a second. */) () { - EMACS_TIME now, idleness_now; - Lisp_Object result[3]; - - EMACS_GET_TIME (now); if (! EMACS_TIME_NEG_P (timer_idleness_start_time)) { + EMACS_TIME now, idleness_now; + + EMACS_GET_TIME (now); EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time); - XSETINT (result[0], (EMACS_SECS (idleness_now) >> 16) & 0xffff); - XSETINT (result[1], (EMACS_SECS (idleness_now) >> 0) & 0xffff); - XSETINT (result[2], EMACS_USECS (idleness_now)); - - return Flist (3, result); + return list3 (make_number ((EMACS_SECS (idleness_now) >> 16) & 0xffff), + make_number ((EMACS_SECS (idleness_now) >> 0) & 0xffff), + make_number (EMACS_USECS (idleness_now))); } return Qnil; From 83f49acbc0d4062538c350564266813d0254bc5d Mon Sep 17 00:00:00 2001 From: Michael Kifer Date: Fri, 25 Aug 2006 16:06:57 +0000 Subject: [PATCH 330/361] 2006-08-25 Michael Kifer * viper.el (viper-set-hooks): use frame bindings for viper-vi-state-cursor-color. (viper-non-hook-settings): don't set default mode-line-buffer-identification. * viper-util.el (viper-set-cursor-color-according-to-state): new function. (viper-set-cursor-color-according-to-state, viper-get-saved-cursor-color-in-replace-mode, viper-get-saved-cursor-color-in-insert-mode): make conditional on viper-emacs-state-cursor-color. * viper-cmd.el (viper-envelop-ESC-key): bug fix. (viper-undo): use point if undo-beg-posn is nil. (viper-insert-state-post-command-sentinel,viper-change-state-to-emacs, viper-after-change-undo-hook): don't use viper-emacs-state-cursor-color by default. (viper-undo): more sensible positioning after undo. * viper-ex.el (ex-splice-args-in-1-letr-cmd): got rid of caddr. (viper-emacs-state-cursor-color): default to nil, since this feature doesn't work well yet. * ediff-mult.el (ediff-intersect-directories, ediff-get-directory-files-under-revision, ediff-dir-diff-copy-file): always expand filenames. --- lisp/ChangeLog | 29 +++++++++++++ lisp/ediff-mult.el | 13 +++--- lisp/emulation/viper-cmd.el | 81 +++++++++++++++++++++--------------- lisp/emulation/viper-ex.el | 8 ++-- lisp/emulation/viper-init.el | 5 ++- lisp/emulation/viper-util.el | 27 ++++++++---- lisp/emulation/viper.el | 19 ++++----- 7 files changed, 121 insertions(+), 61 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 554274a2544..ffaf73d86d1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,32 @@ +2006-08-25 Michael Kifer + + * viper.el (viper-set-hooks): use frame bindings for + viper-vi-state-cursor-color. + (viper-non-hook-settings): don't set default + mode-line-buffer-identification. + + * viper-util.el (viper-set-cursor-color-according-to-state): new + function. + (viper-set-cursor-color-according-to-state, + viper-get-saved-cursor-color-in-replace-mode, + viper-get-saved-cursor-color-in-insert-mode): make conditional on + viper-emacs-state-cursor-color. + + * viper-cmd.el (viper-envelop-ESC-key): bug fix. + (viper-undo): use point if undo-beg-posn is nil. + (viper-insert-state-post-command-sentinel,viper-change-state-to-emacs, + viper-after-change-undo-hook): don't use + viper-emacs-state-cursor-color by default. + (viper-undo): more sensible positioning after undo. + + * viper-ex.el (ex-splice-args-in-1-letr-cmd): got rid of caddr. + (viper-emacs-state-cursor-color): default to nil, since this feature + doesn't work well yet. + + * ediff-mult.el (ediff-intersect-directories, + ediff-get-directory-files-under-revision, ediff-dir-diff-copy-file): + always expand filenames. + 2006-08-24 Chong Yidong * emacs-lisp/timer.el (timer-set-idle-time, run-with-idle-timer): diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el index 71859a5d4c5..b33ad7c1859 100644 --- a/lisp/ediff-mult.el +++ b/lisp/ediff-mult.el @@ -648,8 +648,8 @@ behavior." (mapcar (lambda (elt) (ediff-make-new-meta-list-element - (concat auxdir1 elt) - (concat auxdir2 elt) + (expand-file-name (concat auxdir1 elt)) + (expand-file-name (concat auxdir2 elt)) (if lis3 (progn ;; The following is done because: In merging with @@ -660,7 +660,7 @@ behavior." ;; the second case, we insert nil. (setq elt (ediff-add-slash-if-directory auxdir3 elt)) (if (file-exists-p (concat auxdir3 elt)) - (concat auxdir3 elt)))))) + (expand-file-name (concat auxdir3 elt))))))) common))) ;; return result (cons common-part difflist) @@ -716,7 +716,7 @@ behavior." auxdir1 nil nil merge-autostore-dir nil) (mapcar (lambda (elt) (ediff-make-new-meta-list-element - (concat auxdir1 elt) nil nil)) + (expand-file-name (concat auxdir1 elt)) nil nil)) common)) )) @@ -1338,7 +1338,10 @@ Useful commands: ;; update ediff-meta-list by direct modification (nconc meta-list (list (ediff-make-new-meta-list-element - otherfile1 otherfile2 otherfile3))) + (expand-file-name otherfile1) + (expand-file-name otherfile2) + (if otherfile3 + (expand-file-name otherfile3))))) ) (ediff-update-meta-buffer meta-buf 'must-redraw) )) diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 0dce3b94ff0..af757a2a55c 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -46,6 +46,8 @@ (defvar mark-even-if-inactive) (defvar init-message) (defvar initial) +(defvar undo-beg-posn) +(defvar undo-end-posn) ;; loading happens only in non-interactive compilation ;; in order to spare non-viperized emacs from being viperized @@ -196,7 +198,7 @@ (viper-save-cursor-color 'before-insert-mode)) ;; set insert mode cursor color (viper-change-cursor-color viper-insert-state-cursor-color))) - (if (eq viper-current-state 'emacs-state) + (if (and viper-emacs-state-cursor-color (eq viper-current-state 'emacs-state)) (let ((has-saved-cursor-color-in-emacs-mode (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) (or has-saved-cursor-color-in-emacs-mode @@ -722,12 +724,13 @@ (viper-set-replace-overlay (point-min) (point-min))) (viper-hide-replace-overlay) - (let ((has-saved-cursor-color-in-emacs-mode - (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) - (or has-saved-cursor-color-in-emacs-mode - (string= (viper-get-cursor-color) viper-emacs-state-cursor-color) - (viper-save-cursor-color 'before-emacs-mode)) - (viper-change-cursor-color viper-emacs-state-cursor-color)) + (if viper-emacs-state-cursor-color + (let ((has-saved-cursor-color-in-emacs-mode + (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) + (or has-saved-cursor-color-in-emacs-mode + (string= (viper-get-cursor-color) viper-emacs-state-cursor-color) + (viper-save-cursor-color 'before-emacs-mode)) + (viper-change-cursor-color viper-emacs-state-cursor-color))) (viper-change-state 'emacs-state) @@ -1030,10 +1033,13 @@ as a Meta key and any number of multiple escapes is allowed." (inhibit-quit t)) (if (viper-ESC-event-p event) (progn - ;; Emacs 22.50.8 introduced a bug, which makes even a single ESC into - ;; a fast keyseq. To guard against this, we added a check if there - ;; are other events as well - (if (and (viper-fast-keysequence-p) unread-command-events) + ;; Some versions of Emacs (eg., 22.50.8 have a bug, which makes even + ;; a single ESC into ;; a fast keyseq. To guard against this, we + ;; added a check if there are other events as well. Keep the next + ;; line for the next time the bug reappears, so that will remember to + ;; report it. + ;;(if (and (viper-fast-keysequence-p) unread-command-events) + (if (viper-fast-keysequence-p) ;; for Emacsen without the above bug (progn (let (minor-mode-map-alist emulation-mode-map-alists) (viper-set-unread-command-events event) @@ -1744,12 +1750,14 @@ invokes the command before that, etc." ;; Hook used in viper-undo (defun viper-after-change-undo-hook (beg end len) - (setq undo-beg-posn beg - undo-end-posn (or end beg)) - ;; some other hooks may be changing various text properties in - ;; the buffer in response to 'undo'; so remove this hook to avoid - ;; its repeated invocation - (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local)) + (if undo-in-progress + (setq undo-beg-posn beg + undo-end-posn (or end beg)) + ;; some other hooks may be changing various text properties in + ;; the buffer in response to 'undo'; so remove this hook to avoid + ;; its repeated invocation + (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local) + )) (defun viper-undo () "Undo previous change." @@ -1764,25 +1772,29 @@ invokes the command before that, etc." (undo-start) (undo-more 2) - (setq undo-beg-posn (or undo-beg-posn before-undo-pt) - undo-end-posn (or undo-end-posn undo-beg-posn)) + ;;(setq undo-beg-posn (or undo-beg-posn (point)) + ;; undo-end-posn (or undo-end-posn (point))) + ;;(setq undo-beg-posn (or undo-beg-posn before-undo-pt) + ;; undo-end-posn (or undo-end-posn undo-beg-posn)) - (goto-char undo-beg-posn) - (sit-for 0) - (if (and viper-keep-point-on-undo - (pos-visible-in-window-p before-undo-pt)) + (if (and undo-beg-posn undo-end-posn) (progn - (push-mark (point-marker) t) - (viper-sit-for-short 300) - (goto-char undo-end-posn) - (viper-sit-for-short 300) - (if (and (> (viper-chars-in-region undo-beg-posn before-undo-pt) 1) - (> (viper-chars-in-region undo-end-posn before-undo-pt) 1)) - (goto-char before-undo-pt) - (goto-char undo-beg-posn))) - (push-mark before-undo-pt t)) + (goto-char undo-beg-posn) + (sit-for 0) + (if (and viper-keep-point-on-undo + (pos-visible-in-window-p before-undo-pt)) + (progn + (push-mark (point-marker) t) + (viper-sit-for-short 300) + (goto-char undo-end-posn) + (viper-sit-for-short 300) + (if (pos-visible-in-window-p undo-beg-posn) + (goto-char before-undo-pt) + (goto-char undo-beg-posn))) + (push-mark before-undo-pt t)) + )) + (if (and (eolp) (not (bolp))) (backward-char 1)) - ;;(if (not modified) (set-buffer-modified-p t)) ) (setq this-command 'viper-undo)) @@ -3952,7 +3964,8 @@ Null string will repeat previous search." (let ((val (viper-p-val arg)) (com (viper-getcom arg)) debug-on-error) - (if (null viper-s-string) (error viper-NoPrevSearch)) + (if (or (null viper-s-string) (string= viper-s-string "")) + (error viper-NoPrevSearch)) (viper-search viper-s-string viper-s-forward arg) (if com (progn diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index e2824246fad..f9f08034582 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el @@ -208,12 +208,12 @@ ;; If this is a one-letter magic command, splice in args. (defun ex-splice-args-in-1-letr-cmd (key list) - (let ((onelet (ex-cmd-is-one-letter (assoc (substring key 0 1) list)))) - (if onelet + (let ((oneletter (ex-cmd-is-one-letter (assoc (substring key 0 1) list)))) + (if oneletter (list key - (append (cadr onelet) + (append (cadr oneletter) (if (< 1 (length key)) (list (substring key 1)))) - (caddr onelet))) + (car (cdr (cdr oneletter))) )) )) diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 80938b0282a..465f6e5cfb8 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -434,7 +434,10 @@ delete the text being replaced, as in standard Vi." (if (fboundp 'make-variable-frame-local) (make-variable-frame-local 'viper-insert-state-cursor-color)) -(defcustom viper-emacs-state-cursor-color "Magenta" +;; viper-emacs-state-cursor-color doesn't work well. Causes cursor colors to be +;; confused in some cases. So, this var is nulled for now. +;; (defcustom viper-emacs-state-cursor-color "Magenta" +(defcustom viper-emacs-state-cursor-color nil "Cursor color when Viper is in emacs state." :type 'string :group 'viper) diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 252088a476d..fe179be9cd1 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -137,10 +137,10 @@ (x-display-color-p) ; emacs )) -(defsubst viper-get-cursor-color () +(defun viper-get-cursor-color (&optional frame) (viper-cond-compile-for-xemacs-or-emacs (color-instance-name - (frame-property (selected-frame) 'cursor-color)) ; xemacs + (frame-property (or frame (selected-frame)) 'cursor-color)) ; xemacs (cdr (assoc 'cursor-color (frame-parameters))) ; emacs )) @@ -152,18 +152,31 @@ ;; cursor colors -(defun viper-change-cursor-color (new-color) +(defun viper-change-cursor-color (new-color &optional frame) (if (and (viper-window-display-p) (viper-color-display-p) (stringp new-color) (viper-color-defined-p new-color) (not (string= new-color (viper-get-cursor-color)))) (viper-cond-compile-for-xemacs-or-emacs (set-frame-property - (selected-frame) 'cursor-color (make-color-instance new-color)) + (or frame (selected-frame)) + 'cursor-color (make-color-instance new-color)) (modify-frame-parameters - (selected-frame) (list (cons 'cursor-color new-color))) + (or frame (selected-frame)) + (list (cons 'cursor-color new-color))) ) )) +(defun viper-set-cursor-color-according-to-state (&optional frame) + (cond ((eq viper-current-state 'replace-state) + (viper-change-cursor-color viper-replace-state-cursor-color frame)) + ((and (eq viper-current-state 'emacs-state) + viper-emacs-state-cursor-color) + (viper-change-cursor-color viper-emacs-state-cursor-color frame)) + ((eq viper-current-state 'insert-state) + (viper-change-cursor-color viper-insert-state-cursor-color frame)) + (t + (viper-change-cursor-color viper-vi-state-cursor-color frame)))) + ;; By default, saves current frame cursor color in the ;; viper-saved-cursor-color-in-replace-mode property of viper-replace-overlay (defun viper-save-cursor-color (before-which-mode) @@ -191,7 +204,7 @@ (if viper-emacs-p 'frame-parameter 'frame-property) (selected-frame) 'viper-saved-cursor-color-in-replace-mode) - (if (eq viper-current-state 'emacs-mode) + (if (and (eq viper-current-state 'emacs-mode) viper-emacs-state-cursor-color) viper-emacs-state-cursor-color viper-vi-state-cursor-color))) @@ -201,7 +214,7 @@ (if viper-emacs-p 'frame-parameter 'frame-property) (selected-frame) 'viper-saved-cursor-color-in-insert-mode) - (if (eq viper-current-state 'emacs-mode) + (if (and (eq viper-current-state 'emacs-mode) viper-emacs-state-cursor-color) viper-emacs-state-cursor-color viper-vi-state-cursor-color))) diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index 8f858526da3..0ba7bdd041a 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -534,10 +534,6 @@ If Viper is enabled, turn it off. Otherwise, turn it on." (defun viper-mode () "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'." (interactive) - (if (null viper-vi-state-cursor-color) - (modify-frame-parameters - (selected-frame) - (list (cons 'viper-vi-state-cursor-color (viper-get-cursor-color))))) (if (not noninteractive) (progn ;; if the user requested viper-mode explicitly @@ -618,7 +614,8 @@ This startup message appears whenever you load Viper, unless you type `y' now." (or (memq major-mode viper-emacs-state-mode-list) ; don't switch to Vi (memq major-mode viper-insert-state-mode-list) ; don't switch - (viper-change-state-to-vi))))) + (viper-change-state-to-vi)) + ))) ;; Apply a little heuristic to invoke vi state on major-modes @@ -862,8 +859,11 @@ It also can't undo some Viper settings." ;; info about the display and windows until emacs initialization is complete ;; So do it via the window-setup-hook (add-hook 'window-setup-hook - '(lambda () - (setq viper-vi-state-cursor-color (viper-get-cursor-color)))) + '(lambda () + (modify-frame-parameters + (selected-frame) + (list (cons 'viper-vi-state-cursor-color + (viper-get-cursor-color)))))) ;; Tell vc-diff to put *vc* in Vi mode (if (featurep 'vc) @@ -903,7 +903,6 @@ It also can't undo some Viper settings." (defadvice set-cursor-color (after viper-set-cursor-color-ad activate) "Change cursor color in VI state." - ;;(setq viper-vi-state-cursor-color (ad-get-arg 0)) (modify-frame-parameters (selected-frame) (list (cons 'viper-vi-state-cursor-color (ad-get-arg 0)))) @@ -1008,8 +1007,8 @@ It also can't undo some Viper settings." ;; these are primarily advices and Vi-ish variable settings (defun viper-non-hook-settings () - ;; Viper changes the default mode-line-buffer-identification - (setq-default mode-line-buffer-identification '(" %b")) + ;;;; Viper changes the default mode-line-buffer-identification + ;;(setq-default mode-line-buffer-identification '(" %b")) ;; setup emacs-supported vi-style feel (setq next-line-add-newlines nil From 288b9df9b92498d07c024e9cd56e0b4ce28a1bf7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Aug 2006 20:27:58 +0000 Subject: [PATCH 331/361] Give priority to graphical terminals over text terminals regarding C-z. --- etc/TUTORIAL | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/etc/TUTORIAL b/etc/TUTORIAL index 630cc4f9765..63e5d601fed 100644 --- a/etc/TUTORIAL +++ b/etc/TUTORIAL @@ -644,18 +644,18 @@ session--this is the command C-x C-c. (Do not worry about losing changes you have made; C-x C-c offers to save each changed file before it kills the Emacs.) +If you are using a graphical display that supports multiple +applications in parallel, you don't need any special command to move +from Emacs to another application. You can do this with the mouse or +with window manager commands. However, if you're using a text +terminal which can only show one application at a time, you need to +"suspend" Emacs to move to any other program. + C-z is the command to exit Emacs *temporarily*--so that you can go -back to the same Emacs session afterward. - -On systems which allow it, C-z "suspends" Emacs; that is, it returns -to the shell but does not destroy the Emacs. In the most common -shells, you can resume Emacs with the `fg' command or with `%emacs'. - -On systems which do not implement suspending, C-z creates a subshell -running under Emacs to give you the chance to run other programs and -return to Emacs afterward; it does not truly "exit" from Emacs. In -this case, the shell command `exit' is the usual way to get back to -Emacs from the subshell. +back to the same Emacs session afterward. When Emacs is running on a +text terminal, C-z "suspends" Emacs; that is, it returns to the shell +but does not destroy the Emacs. In the most common shells, you can +resume Emacs with the `fg' command or with `%emacs'. The time to use C-x C-c is when you are about to log out. It's also the right thing to use to exit an Emacs invoked under mail handling From 5586939c0ea880899c93302e1180ffca36a22319 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Aug 2006 20:30:17 +0000 Subject: [PATCH 332/361] (kmacro-repeat-on-last-key): Doc fix. --- lisp/kmacro.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/kmacro.el b/lisp/kmacro.el index d3db76fcc8a..2d1f5f33847 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -409,7 +409,7 @@ Optional arg EMPTY is message to print if no macros are defined." (defun kmacro-repeat-on-last-key (keys) - "Process kmacro commands keys immidiately after cycling the ring." + "Process kmacro commands keys immediately after cycling the ring." (setq keys (vconcat keys)) (let ((n (1- (length keys))) cmd done repeat) From 7167d4092a9bc6e07a69ae3de4de3da7b138b688 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Aug 2006 20:33:24 +0000 Subject: [PATCH 333/361] (Incremental Search): Move index entries. --- man/search.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/search.texi b/man/search.texi index ef83260ed35..ac11e58b268 100644 --- a/man/search.texi +++ b/man/search.texi @@ -33,6 +33,8 @@ asks interactively which occurrences to replace. @node Incremental Search @section Incremental Search +@cindex incremental search +@cindex isearch An incremental search begins searching as soon as you type the first character of the search string. As you type in the search string, Emacs @@ -63,8 +65,6 @@ Incremental search backward (@code{isearch-backward}). @node Basic Isearch @subsection Basics of Incremental Search -@cindex incremental search -@cindex isearch @kindex C-s @findex isearch-forward From d0f891a742ddf5104188a26b9e02211735b9d5a5 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 25 Aug 2006 20:44:49 +0000 Subject: [PATCH 334/361] (url-file-local-copy): Tell url-copy-file that the dest file will already exist. --- lisp/url/ChangeLog | 5 +++++ lisp/url/url-handlers.el | 2 +- src/ChangeLog | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 2bbe6085be4..e4b54f9fc92 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,8 @@ +2006-08-25 Stefan Monnier + + * url-handlers.el (url-file-local-copy): Tell url-copy-file that the + dest file will already exist. + 2006-07-31 Stefan Monnier * url-util.el (url-hexify-string): Only utf-8 encode if it's diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index 6c6d85a1e03..97d10003620 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -213,7 +213,7 @@ A prefix arg makes KEEP-TIME non-nil." Returns the name of the local copy, or nil, if FILE is directly accessible." (let ((filename (make-temp-file "url"))) - (url-copy-file url filename) + (url-copy-file url filename 'ok-if-already-exists) filename)) (defun url-insert (buffer &optional beg end) diff --git a/src/ChangeLog b/src/ChangeLog index bcb576f1fa0..e55a8a8b9e3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -868,8 +868,8 @@ 2006-06-14 Chong Yidong - * xdisp.c (back_to_previous_visible_line_start): Reset - it->continuation_lines_width. + * xdisp.c (back_to_previous_visible_line_start): + Reset it->continuation_lines_width. 2006-06-14 Richard Stallman @@ -940,8 +940,8 @@ 2006-06-06 YAMAMOTO Mitsuharu - * macterm.c [USE_MAC_TSM] (mac_handle_text_input_event): Exclude - 0x7f from ASCII range. + * macterm.c [USE_MAC_TSM] (mac_handle_text_input_event): + Exclude 0x7f from ASCII range. 2006-06-05 Jason Rumney From fcdd0559e3483cef31be70cfa3495cfdd34de299 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Aug 2006 21:08:35 +0000 Subject: [PATCH 335/361] (Exiting): Rewrite to give graphical displays priority over text terminals. --- man/entering.texi | 56 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/man/entering.texi b/man/entering.texi index bef6a5a4db0..dca85d44812 100644 --- a/man/entering.texi +++ b/man/entering.texi @@ -69,20 +69,19 @@ already running Emacs. @xref{Emacs Server}. @cindex leaving Emacs @cindex quitting Emacs - There are two commands for exiting Emacs, and three kinds of exiting: -@dfn{suspending} Emacs, @dfn{Iconifying} Emacs, and @dfn{killing} -Emacs. + There are two commands for exiting Emacs, and three kinds of +exiting: @dfn{iconifying} Emacs, @dfn{suspending} Emacs, and +@dfn{killing} Emacs. + + @dfn{Iconifying} means replacing the Emacs frame with a small box or +``icon'' on the screen. This is the usual way to exit Emacs when +you're using a graphical display---if you bother to ``exit'' at all. +(Just switching to another application is usually sufficient.) @dfn{Suspending} means stopping Emacs temporarily and returning -control to its parent process (usually a shell), allowing you to resume -editing later in the same Emacs job, with the same buffers, same kill -ring, same undo history, and so on. This is the usual way to exit Emacs -when running on a text terminal. - - @dfn{Iconifying} means replacing the Emacs frame with a small box -somewhere on the screen. This is the usual way to exit Emacs when you're -using a graphics terminal---if you bother to ``exit'' at all. (Just switching -to another application is usually sufficient.) +control to its parent process (usually a shell), allowing you to +resume editing later in the same Emacs job. This is the usual way to +exit Emacs when running it on a text terminal. @dfn{Killing} Emacs means destroying the Emacs job. You can run Emacs again later, but you will get a fresh Emacs; there is no way to resume @@ -97,12 +96,18 @@ Kill Emacs (@code{save-buffers-kill-emacs}). @end table @kindex C-z -@findex suspend-emacs - To suspend or iconify Emacs, type @kbd{C-z} (@code{suspend-emacs}). -On text terminals, this suspends Emacs. On graphical displays, -it iconifies the Emacs frame. +@findex iconify-or-deiconify-frame + On graphical displays, @kbd{C-z} runs the command +@code{iconify-or-deiconify-frame}, which temporarily iconifies (or +``minimizes'') the selected Emacs frame (@pxref{Frames}). You can +then use the window manager to select some other application. (You +could select another application without iconifying Emacs first, but +getting the Emacs frame out of the way can make it more convenient to +find the other application.) - Suspending Emacs takes you back to the shell from which you invoked +@findex suspend-emacs + On a text terminal, @kbd{C-z} runs the command @code{suspend-emacs}. +Suspending Emacs takes you back to the shell from which you invoked Emacs. You can resume Emacs with the shell command @command{%emacs} in most common shells. On systems that don't support suspending programs, @kbd{C-z} starts an inferior shell that communicates @@ -112,19 +117,12 @@ subshell. (The way to do that is probably with @kbd{C-d} or systems, you can only get back to the shell from which Emacs was run (to log out, for example) when you kill Emacs. +@vindex cannot-suspend Suspending can fail if you run Emacs under a shell that doesn't -support suspending programs, even if the system itself does support -it. In such a case, you can set the variable @code{cannot-suspend} to -a non-@code{nil} value to force @kbd{C-z} to start an inferior shell. -(One might also describe Emacs's parent shell as ``inferior'' for -failing to support job control properly, but that is a matter of -taste.) - - On graphical displays, @kbd{C-z} has a different meaning: it runs -the command @code{iconify-or-deiconify-frame}, which temporarily -iconifies (or ``minimizes'') the selected Emacs frame -(@pxref{Frames}). Then you can use the window manager to get back to -a shell window. +support suspendion of its subjobs, even if the system itself does +support it. In such a case, you can set the variable +@code{cannot-suspend} to a non-@code{nil} value to force @kbd{C-z} to +start an inferior shell. @kindex C-x C-c @findex save-buffers-kill-emacs From f9de7738112d70ce46ceded87bba3616c04553bb Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Aug 2006 21:08:44 +0000 Subject: [PATCH 336/361] *** empty log message *** --- admin/FOR-RELEASE | 15 ++++++++++++++- etc/ChangeLog | 5 +++++ lisp/ChangeLog | 4 ++++ man/ChangeLog | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index f0055d2a723..13c6e13bac5 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -29,7 +29,9 @@ Reminders sent out on 2006-06-08. ** Send an email to the various distributions, including the GNOME and KDE projects, to use the new Emacs icons in etc/images/icons. -* BUGS +* WINDOWS SUPPORT BUGS. +These don't need to be fixed to start pretest, but we call the +attention of Windows users to fixing them. ** Markus Gritsch's report about Emacs looping on Windoze with the following .emacs file, and then reduce Emacs frame width to "something quite narrow": @@ -39,10 +41,21 @@ and KDE projects, to use the new Emacs icons in etc/images/icons. '(hscroll-step 1) ) +** Drew Adams 12 Aug bug rpt: overlay display artifact: trace left behind +Windows only bug. + +* BUGS + +** Milan Zamazal's Aug 23 bug report about crashes with certain fonts. + +** C-g fails to interrupt accept-process-output in Gnus. + ** Implement buffer-chars-modified-tick. ** henman@it.to-be.co.jp 09 Aug 2006: ispell.el problem. +** Make key-binding use the maps specified by positions given in the events. + * DOCUMENTATION diff --git a/etc/ChangeLog b/etc/ChangeLog index 42d04fc2e7c..100460e9b93 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,8 @@ +2006-08-25 Richard Stallman + + * TUTORIAL: Give priority to graphical terminals over text terminals + regarding C-z. + 2006-08-21 Sun Yijiang * TUTORIAL.cn: Sync with the latest TUTORIAL. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ffaf73d86d1..fd1a37e0dcb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-08-25 Richard Stallman + + * kmacro.el (kmacro-repeat-on-last-key): Doc fix. + 2006-08-25 Michael Kifer * viper.el (viper-set-hooks): use frame bindings for diff --git a/man/ChangeLog b/man/ChangeLog index 69ed7f0a9fd..280c223acf6 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,10 @@ +2006-08-25 Richard Stallman + + * entering.texi (Exiting): Rewrite to give graphical displays + priority over text terminals. + + * search.texi (Incremental Search): Move index entries. + 2006-08-23 Chong Yidong * custom.texi (Init File): Reference Find Init to avoid "home From 611ac52147a4682f0c8befc8483dc095966d3fbf Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Aug 2006 21:10:26 +0000 Subject: [PATCH 337/361] (Fswitch_to_buffer): Fix previous change. --- src/buffer.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index f6c45852b51..81ea51b357a 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1685,10 +1685,15 @@ the window-buffer correspondences. */) if (EQ (buffer, Fwindow_buffer (selected_window))) { - if (NILP (norecord) && !EQ (buffer, XCDR (XCAR (Vbuffer_alist)))) + /* Basically a NOP. Avoid signalling an error in the case where + the selected window is dedicated, or a minibuffer. */ + + /* But do put this buffer at the front of the buffer list, + unless that has been inhibited. Note that even if + BUFFER is at the front of the main buffer-list already, + we still want to move it to the front of the frame's buffer list. */ + if (NILP (norecord)) record_buffer (buffer); - /* Basically a NOP. Avoid signalling an error if the selected window - is dedicated, or a minibuffer, ... */ return Fset_buffer (buffer); } From f8a7bf170c03a3a97f558fa8569e7d15c7af9a20 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 25 Aug 2006 22:01:04 +0000 Subject: [PATCH 338/361] *** empty log message *** --- man/ChangeLog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/man/ChangeLog b/man/ChangeLog index 280c223acf6..ee0dac8359c 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2006-08-25 Kim F. Storm + + * display.texi (Display Custom): Add variables overline-margin + and x-underline-at-descent-line. + 2006-08-25 Richard Stallman * entering.texi (Exiting): Rewrite to give graphical displays @@ -32,7 +37,7 @@ 2006-08-15 Carsten Dominik * org.texi (Installation, Activation): Split from Installation and - Activation. + Activation. (Clocking work time): Documented new features. 2006-08-15 Nick Roberts From 0304d18be9b1f2711c31fdb9f1b6a5e8c8af84e6 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 25 Aug 2006 22:01:34 +0000 Subject: [PATCH 339/361] (Display Custom): Add variables overline-margin and x-underline-at-descent-line. --- man/display.texi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/man/display.texi b/man/display.texi index 57276ac7557..2a0abd4bef6 100644 --- a/man/display.texi +++ b/man/display.texi @@ -1215,6 +1215,17 @@ page for other output. On such terminals, you might want to set the variable assume, when resumed, that the screen page it is using still contains what Emacs last wrote there. +@vindex overline-margin + On graphical display, this variables specifies the number of pixes +the overline is shown above the text. The value includes the height of +the overline itself (1 pixel). The default value is 2 pixels. + +@vindex x-underline-at-descent-line + On graphical display, the underline is normally drawn at the +baseline level of the font. If @code{x-underline-at-descent-line} is +non-@code{nil}, the underline is drawn at the same position as the +font's decent line. + @ignore arch-tag: 2219f910-2ff0-4521-b059-1bd231a536c4 @end ignore From 1c1095bfeb058341c89db46606daa23a5cc95058 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 25 Aug 2006 22:49:14 +0000 Subject: [PATCH 340/361] (python-preoutput-skip-next-prompt): New var. (python-preoutput-continuation): Remove. (python-preoutput-filter): Simplify correspondingly. Remove handling of _emacs_ok. Make sure we skip _emacs_out's prompts. Loop around to catch embedded _emacs_out output. (run-python): Send the import&print command on a single line. (python-send-command): Send command&print on a single line. (python-send-string): Only add double \n if needed. (python-send-receive): Loop until the result comes. (python-mode-running): Defvar it. (python-setup-brm): Remove unused var `menu'. Only bind py-mode-map and `features' around brm-init. (python-calculate-indentation): Remove unused var `point'. (python-beginning-of-defun): Remove unused var `def-line'. --- lisp/ChangeLog | 62 +++++++---- lisp/progmodes/python.el | 234 +++++++++++++++++++++------------------ 2 files changed, 166 insertions(+), 130 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fd1a37e0dcb..eacc773d434 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,36 +1,56 @@ +2006-08-25 Stefan Monnier + + * progmodes/python.el (python-preoutput-skip-next-prompt): New var. + (python-preoutput-continuation): Remove. + (python-preoutput-filter): Simplify correspondingly. + Remove handling of _emacs_ok. Make sure we skip _emacs_out's prompts. + Loop around to catch embedded _emacs_out output. + (run-python): Send the import&print command on a single line. + (python-send-command): Send command&print on a single line. + (python-send-string): Only add double \n if needed. + (python-send-receive): Loop until the result comes. + (python-mode-running): Defvar it. + (python-setup-brm): Remove unused var `menu'. + Only bind py-mode-map and `features' around brm-init. + (python-calculate-indentation): Remove unused var `point'. + (python-beginning-of-defun): Remove unused var `def-line'. + 2006-08-25 Richard Stallman * kmacro.el (kmacro-repeat-on-last-key): Doc fix. 2006-08-25 Michael Kifer - - * viper.el (viper-set-hooks): use frame bindings for + + * viper.el (viper-set-hooks): Use frame bindings for viper-vi-state-cursor-color. - (viper-non-hook-settings): don't set default + (viper-non-hook-settings): Don't set default mode-line-buffer-identification. - - * viper-util.el (viper-set-cursor-color-according-to-state): new - function. - (viper-set-cursor-color-according-to-state, - viper-get-saved-cursor-color-in-replace-mode, - viper-get-saved-cursor-color-in-insert-mode): make conditional on + + * viper-util.el (viper-set-cursor-color-according-to-state): New fun. + (viper-set-cursor-color-according-to-state) + (viper-get-saved-cursor-color-in-replace-mode) + (viper-get-saved-cursor-color-in-insert-mode): Make conditional on viper-emacs-state-cursor-color. - - * viper-cmd.el (viper-envelop-ESC-key): bug fix. - (viper-undo): use point if undo-beg-posn is nil. - (viper-insert-state-post-command-sentinel,viper-change-state-to-emacs, - viper-after-change-undo-hook): don't use + + * viper-cmd.el (viper-envelop-ESC-key): Bug fix. + (viper-undo): Use point if undo-beg-posn is nil. + (viper-insert-state-post-command-sentinel, viper-change-state-to-emacs) + (viper-after-change-undo-hook): Don't use viper-emacs-state-cursor-color by default. - (viper-undo): more sensible positioning after undo. - - * viper-ex.el (ex-splice-args-in-1-letr-cmd): got rid of caddr. - (viper-emacs-state-cursor-color): default to nil, since this feature + (viper-undo): More sensible positioning after undo. + + * viper-ex.el (ex-splice-args-in-1-letr-cmd): Get rid of caddr. + (viper-emacs-state-cursor-color): Default to nil, since this feature doesn't work well yet. - * ediff-mult.el (ediff-intersect-directories, - ediff-get-directory-files-under-revision, ediff-dir-diff-copy-file): + * ediff-mult.el (ediff-intersect-directories) + (ediff-get-directory-files-under-revision, ediff-dir-diff-copy-file): always expand filenames. - + +2006-08-24 Stefan Monnier + + * tumme.el: Remove * in defcustoms's docstrings. + 2006-08-24 Chong Yidong * emacs-lisp/timer.el (timer-set-idle-time, run-with-idle-timer): diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 8a7b0537516..a7942c603f3 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -65,6 +65,7 @@ ;;; Code: (eval-when-compile + (require 'cl) (require 'compile) (require 'comint)) @@ -547,40 +548,39 @@ Set `python-indent' locally to the value guessed." ((looking-at (rx (0+ space) (syntax comment-start) (not (any " \t\n")))) ; non-indentable comment (current-indentation)) - (t (let ((point (point))) - (if python-honour-comment-indentation - ;; Back over whitespace, newlines, non-indentable comments. - (catch 'done - (while t - (if (cond ((bobp)) - ;; not at comment start - ((not (forward-comment -1)) - (python-beginning-of-statement) - t) - ;; trailing comment - ((/= (current-column) (current-indentation)) - (python-beginning-of-statement) - t) - ;; indentable comment like python-mode.el - ((and (looking-at (rx (syntax comment-start) - (or space line-end))) - (/= 0 (current-column))))) - (throw 'done t))))) - (python-indentation-levels) - ;; Prefer to indent comments with an immediately-following - ;; statement, e.g. - ;; ... - ;; # ... - ;; def ... - (when (and (> python-indent-list-length 1) - (python-comment-line-p)) - (forward-line) - (unless (python-comment-line-p) - (let ((elt (assq (current-indentation) python-indent-list))) - (setq python-indent-list - (nconc (delete elt python-indent-list) - (list elt)))))) - (caar (last python-indent-list)))))))) + (t (if python-honour-comment-indentation + ;; Back over whitespace, newlines, non-indentable comments. + (catch 'done + (while t + (if (cond ((bobp)) + ;; not at comment start + ((not (forward-comment -1)) + (python-beginning-of-statement) + t) + ;; trailing comment + ((/= (current-column) (current-indentation)) + (python-beginning-of-statement) + t) + ;; indentable comment like python-mode.el + ((and (looking-at (rx (syntax comment-start) + (or space line-end))) + (/= 0 (current-column))))) + (throw 'done t))))) + (python-indentation-levels) + ;; Prefer to indent comments with an immediately-following + ;; statement, e.g. + ;; ... + ;; # ... + ;; def ... + (when (and (> python-indent-list-length 1) + (python-comment-line-p)) + (forward-line) + (unless (python-comment-line-p) + (let ((elt (assq (current-indentation) python-indent-list))) + (setq python-indent-list + (nconc (delete elt python-indent-list) + (list elt)))))) + (caar (last python-indent-list))))))) ;;;; Cycling through the possible indentations with successive TABs. @@ -755,13 +755,13 @@ reached start of buffer." (let ((ci (current-indentation)) (def-re (rx line-start (0+ space) (or "def" "class") (1+ space) (group (1+ (or word (syntax symbol)))))) - found lep def-line) + found lep) ;; def-line (if (python-comment-line-p) (setq ci most-positive-fixnum)) (while (and (not (bobp)) (not found)) ;; Treat bol at beginning of function as outside function so ;; that successive C-M-a makes progress backwards. - (setq def-line (looking-at def-re)) + ;;(setq def-line (looking-at def-re)) (unless (bolp) (end-of-line)) (setq lep (line-end-position)) (if (and (re-search-backward def-re nil 'move) @@ -773,7 +773,7 @@ reached start of buffer." ;; Not sure why it was like this -- fails in case of ;; last internal function followed by first ;; non-def statement of the main body. -;; (and def-line (= in ci)) + ;;(and def-line (= in ci)) (= in ci) (< in ci))) (not (python-in-string/comment))) @@ -1250,47 +1250,57 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." (defvar python-preoutput-result nil "Data from last `_emacs_out' line seen by the preoutput filter.") -(defvar python-preoutput-continuation nil - "If non-nil, funcall this when `python-preoutput-filter' sees `_emacs_ok'.") - (defvar python-preoutput-leftover nil) +(defvar python-preoutput-skip-next-prompt nil) ;; Using this stops us getting lines in the buffer like ;; >>> ... ... >>> -;; Also look for (and delete) an `_emacs_ok' string and call -;; `python-preoutput-continuation' if we get it. (defun python-preoutput-filter (s) "`comint-preoutput-filter-functions' function: ignore prompts not at bol." (when python-preoutput-leftover (setq s (concat python-preoutput-leftover s)) (setq python-preoutput-leftover nil)) - (cond ((and (string-match (rx string-start (repeat 3 (any ".>")) - " " string-end) - s) - (/= (let ((inhibit-field-text-motion t)) - (line-beginning-position)) - (point))) - ;; The need for this seems to be system-dependent: - ;; What is this all about, exactly? --Stef - ;; (if (and (eq ?. (aref s 0))) - ;; (accept-process-output (get-buffer-process (current-buffer)) 1)) - "") - ((string= s "_emacs_ok\n") - (when python-preoutput-continuation - (funcall python-preoutput-continuation) - (setq python-preoutput-continuation nil)) - "") - ((string-match "_emacs_out \\(.*\\)\n" s) - (setq python-preoutput-result (match-string 1 s)) - "") - ((string-match ".*\n" s) - s) - ((or (eq t (compare-strings s nil nil "_emacs_ok\n" nil (length s))) - (let ((end (min (length "_emacs_out ") (length s)))) - (eq t (compare-strings s nil end "_emacs_out " nil end)))) - (setq python-preoutput-leftover s) - "") - (t s))) + (let ((start 0) + (res "")) + ;; First process whole lines. + (while (string-match "\n" s start) + (let ((line (substring s start (setq start (match-end 0))))) + ;; Skip prompt if needed. + (when (and python-preoutput-skip-next-prompt + (string-match comint-prompt-regexp line)) + (setq python-preoutput-skip-next-prompt nil) + (setq line (substring line (match-end 0)))) + ;; Recognize special _emacs_out lines. + (if (and (string-match "\\`_emacs_out \\(.*\\)\n\\'" line) + (local-variable-p 'python-preoutput-result)) + (progn + (setq python-preoutput-result (match-string 1 line)) + (set (make-local-variable 'python-preoutput-skip-next-prompt) t)) + (setq res (concat res line))))) + ;; Then process the remaining partial line. + (unless (zerop start) (setq s (substring s start))) + (cond ((and (string-match comint-prompt-regexp s) + ;; Drop this prompt if it follows an _emacs_out... + (or python-preoutput-skip-next-prompt + ;; ... or if it's not gonna be inserted at BOL. + ;; Maybe we could be more selective here. + (if (zerop (length res)) + (not (bolp)) + (string-match res ".\\'")))) + ;; The need for this seems to be system-dependent: + ;; What is this all about, exactly? --Stef + ;; (if (and (eq ?. (aref s 0))) + ;; (accept-process-output (get-buffer-process (current-buffer)) 1)) + (setq python-preoutput-skip-next-prompt nil) + res) + ((let ((end (min (length "_emacs_out ") (length s)))) + (eq t (compare-strings s nil end "_emacs_out " nil end))) + ;; The leftover string is a prefix of _emacs_out so we don't know + ;; yet whether it's an _emacs_out or something else: wait until we + ;; get more output so we can resolve this ambiguity. + (set (make-local-variable 'python-preoutput-leftover) s) + res) + (t (concat res s))))) (autoload 'comint-check-proc "comint") @@ -1342,9 +1352,8 @@ buffer for a list of commands.)" ;; file. The code might be inline here, but there's enough that it ;; seems worth putting in a separate file, and it's probably cleaner ;; to put it in a module. - (python-send-string "import emacs") ;; Ensure we're at a prompt before doing anything else. - (python-send-receive "print '_emacs_out ()'") + (python-send-receive "import emacs; print '_emacs_out ()'") ;; Without this, help output goes into the inferior python buffer if ;; the process isn't already running. (sit-for 1 t) ;Should we use accept-process-output instead? --Stef @@ -1358,13 +1367,14 @@ buffer for a list of commands.)" ;; commands having set up such a state. (defun python-send-command (command) - "Like `python-send-string' but resets `compilation-shell-minor-mode'." + "Like `python-send-string' but resets `compilation-shell-minor-mode'. +COMMAND should be a single statement." + (assert (not (string-match "\n" command))) (let ((end (marker-position (process-mark (python-proc))))) (with-current-buffer python-buffer (goto-char (point-max))) (compilation-forget-errors) - (python-send-string command) ;; Must wait until this has completed before re-setting variables below. - (python-send-receive "print '_emacs_out ()'") + (python-send-receive (concat command "; print '_emacs_out ()'")) (with-current-buffer python-buffer (set-marker compilation-parsing-end end) (setq compilation-last-buffer (current-buffer))))) @@ -1409,7 +1419,11 @@ buffer for a list of commands.)" "Evaluate STRING in inferior Python process." (interactive "sPython command: ") (comint-send-string (python-proc) string) - (comint-send-string (python-proc) "\n\n")) + (comint-send-string (python-proc) + ;; If the string is single-line or if it ends with \n, + ;; only add a single \n, otherwise add 2, so as to + ;; make sure we terminate the multiline instruction. + (if (string-match "\n.+\\'" string) "\n\n" "\n"))) (defun python-send-buffer () "Send the current buffer to the inferior Python process." @@ -1561,14 +1575,15 @@ will." (defun python-send-receive (string) "Send STRING to inferior Python (if any) and return result. -The result is what follows `_emacs_out' in the output (or nil)." +The result is what follows `_emacs_out' in the output." (let ((proc (python-proc))) (python-send-string string) - (setq python-preoutput-result nil) + (set (make-local-variable 'python-preoutput-result) nil) (while (progn (accept-process-output proc 5) - python-preoutput-leftover)) - python-preoutput-result)) + (null python-preoutput-result))) + (prog1 python-preoutput-result + (kill-local-variable 'python-preoutput-result)))) ;; Fixme: Is there anything reasonable we can do with random methods? ;; (Currently only works with functions.) @@ -2078,36 +2093,35 @@ without confirmation." (unless (fboundp 'brm-rename) (pymacs-load "bikeemacs" "brm-") ; first line of normal recipe (let ((py-mode-map (make-sparse-keymap)) ; it assumes this - (features (cons 'python-mode features)) ; and requires this - menu) - (brm-init) ; second line of normal recipe - (remove-hook 'python-mode-hook ; undo this from `brm-init' - '(lambda () (easy-menu-add brm-menu))) - (easy-menu-define - python-brm-menu python-mode-map - "Bicycle Repair Man" - '("BicycleRepairMan" - :help "Interface to navigation and refactoring tool" - "Queries" - ["Find References" brm-find-references - :help "Find references to name at point in compilation buffer"] - ["Find Definition" brm-find-definition - :help "Find definition of name at point"] - "-" - "Refactoring" - ["Rename" brm-rename - :help "Replace name at point with a new name everywhere"] - ["Extract Method" brm-extract-method - :active (and mark-active (not buffer-read-only)) - :help "Replace statements in region with a method"] - ["Extract Local Variable" brm-extract-local-variable - :active (and mark-active (not buffer-read-only)) - :help "Replace expression in region with an assignment"] - ["Inline Local Variable" brm-inline-local-variable - :help - "Substitute uses of variable at point with its definition"] - ;; Fixme: Should check for anything to revert. - ["Undo Last Refactoring" brm-undo :help ""])))) + (features (cons 'python-mode features))) ; and requires this + (brm-init)) ; second line of normal recipe + (remove-hook 'python-mode-hook ; undo this from `brm-init' + '(lambda () (easy-menu-add brm-menu))) + (easy-menu-define + python-brm-menu python-mode-map + "Bicycle Repair Man" + '("BicycleRepairMan" + :help "Interface to navigation and refactoring tool" + "Queries" + ["Find References" brm-find-references + :help "Find references to name at point in compilation buffer"] + ["Find Definition" brm-find-definition + :help "Find definition of name at point"] + "-" + "Refactoring" + ["Rename" brm-rename + :help "Replace name at point with a new name everywhere"] + ["Extract Method" brm-extract-method + :active (and mark-active (not buffer-read-only)) + :help "Replace statements in region with a method"] + ["Extract Local Variable" brm-extract-local-variable + :active (and mark-active (not buffer-read-only)) + :help "Replace expression in region with an assignment"] + ["Inline Local Variable" brm-inline-local-variable + :help + "Substitute uses of variable at point with its definition"] + ;; Fixme: Should check for anything to revert. + ["Undo Last Refactoring" brm-undo :help ""]))) (error (error "Bicyclerepairman setup failed: %s" data)))) ;;;; Modes. @@ -2131,6 +2145,8 @@ without confirmation." (add-hook 'post-command-hook 'python-abbrev-pc-hook nil t)) (modify-syntax-entry ?/ "w" python-abbrev-syntax-table) +(defvar python-mode-running) ;Dynamically scoped var. + ;;;###autoload (define-derived-mode python-mode fundamental-mode "Python" "Major mode for editing Python files. From d489b9c5be7c4c8ccfa5a0f4a411bd891faaa663 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 25 Aug 2006 23:32:17 +0000 Subject: [PATCH 341/361] *** empty log message *** --- src/ChangeLog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index e55a8a8b9e3..ac1ac8b53b3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2006-08-26 Kim F. Storm + + * buffer.c (Fset_buffer_multibyte): + * editfns.c (Fcurrent_time, Fget_internal_run_time): + * macfns.c (Fxw_color_values): + * w32fns.c (Fxw_color_values): + * xfns.c (Fxw_color_values): Simplify; use list3. + + * fileio.c (Fmake_directory_internal, Fdelete_directory) + (Fdelete_file): Simplify; use list1. + (Frename_file, Fadd_name_to_file, Fmake_symbolic_link): + Simplify; remove NO_ARG_ARRAY stuff, use list2. + 2006-08-25 Kim F. Storm * keyboard.c (Fcurrent_idle_time): Simplify. From a508663b2687133cd711ef801be11e0f299b5d9c Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 25 Aug 2006 23:33:04 +0000 Subject: [PATCH 342/361] (Fxw_color_values): Simplify; use list3. --- src/macfns.c | 11 +++-------- src/w32fns.c | 17 ++++++----------- src/xfns.c | 11 +++-------- 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/macfns.c b/src/macfns.c index 494d6ec1da3..a72cd66cdce 100644 --- a/src/macfns.c +++ b/src/macfns.c @@ -2876,14 +2876,9 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, CHECK_STRING (color); if (mac_defined_color (f, SDATA (color), &foo, 0)) - { - Lisp_Object rgb[3]; - - rgb[0] = make_number (foo.red); - rgb[1] = make_number (foo.green); - rgb[2] = make_number (foo.blue); - return Flist (3, rgb); - } + return list3 (make_number (foo.red), + make_number (foo.green), + make_number (foo.blue)); else return Qnil; } diff --git a/src/w32fns.c b/src/w32fns.c index e1cae4f3eb4..8c6a60d47bf 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6355,17 +6355,12 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, CHECK_STRING (color); if (w32_defined_color (f, SDATA (color), &foo, 0)) - { - Lisp_Object rgb[3]; - - rgb[0] = make_number ((GetRValue (foo.pixel) << 8) - | GetRValue (foo.pixel)); - rgb[1] = make_number ((GetGValue (foo.pixel) << 8) - | GetGValue (foo.pixel)); - rgb[2] = make_number ((GetBValue (foo.pixel) << 8) - | GetBValue (foo.pixel)); - return Flist (3, rgb); - } + return list3 (make_number ((GetRValue (foo.pixel) << 8) + | GetRValue (foo.pixel)), + make_number ((GetGValue (foo.pixel) << 8) + | GetGValue (foo.pixel)), + make_number ((GetBValue (foo.pixel) << 8) + | GetBValue (foo.pixel))); else return Qnil; } diff --git a/src/xfns.c b/src/xfns.c index 47916fccb71..8071ff1c4e6 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3475,14 +3475,9 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, CHECK_STRING (color); if (x_defined_color (f, SDATA (color), &foo, 0)) - { - Lisp_Object rgb[3]; - - rgb[0] = make_number (foo.red); - rgb[1] = make_number (foo.green); - rgb[2] = make_number (foo.blue); - return Flist (3, rgb); - } + return list3 (make_number (foo.red), + make_number (foo.green), + make_number (foo.blue)); else return Qnil; } From a9f2aeaeed9c9135c27e5abce0051b30d1467089 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 25 Aug 2006 23:33:12 +0000 Subject: [PATCH 343/361] (Fmake_directory_internal, Fdelete_directory) (Fdelete_file): Simplify; use list1. (Frename_file, Fadd_name_to_file, Fmake_symbolic_link): Simplify; remove NO_ARG_ARRAY stuff, use list2. --- src/fileio.c | 43 ++++++------------------------------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 4a39e7ffa19..fa7a2d0cd85 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2648,7 +2648,7 @@ DEFUN ("make-directory-internal", Fmake_directory_internal, #else if (mkdir (dir, 0777) != 0) #endif - report_file_error ("Creating directory", Flist (1, &directory)); + report_file_error ("Creating directory", list1 (directory)); return Qnil; } @@ -2674,7 +2674,7 @@ DEFUN ("delete-directory", Fdelete_directory, Sdelete_directory, 1, 1, "FDelete dir = SDATA (encoded_dir); if (rmdir (dir) != 0) - report_file_error ("Removing directory", Flist (1, &directory)); + report_file_error ("Removing directory", list1 (directory)); return Qnil; } @@ -2705,7 +2705,7 @@ If file has multiple names, it continues to exist with the other names. */) encoded_file = ENCODE_FILE (filename); if (0 > unlink (SDATA (encoded_file))) - report_file_error ("Removing old name", Flist (1, &filename)); + report_file_error ("Removing old name", list1 (filename)); return Qnil; } @@ -2739,9 +2739,6 @@ This is what happens in interactive use with M-x. */) (file, newname, ok_if_already_exists) Lisp_Object file, newname, ok_if_already_exists; { -#ifdef NO_ARG_ARRAY - Lisp_Object args[2]; -#endif Lisp_Object handler; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; Lisp_Object encoded_file, encoded_newname, symlink_target; @@ -2810,15 +2807,7 @@ This is what happens in interactive use with M-x. */) Fdelete_file (file); } else -#ifdef NO_ARG_ARRAY - { - args[0] = file; - args[1] = newname; - report_file_error ("Renaming", Flist (2, args)); - } -#else - report_file_error ("Renaming", Flist (2, &file)); -#endif + report_file_error ("Renaming", list2 (file, newname)); } UNGCPRO; return Qnil; @@ -2834,9 +2823,6 @@ This is what happens in interactive use with M-x. */) (file, newname, ok_if_already_exists) Lisp_Object file, newname, ok_if_already_exists; { -#ifdef NO_ARG_ARRAY - Lisp_Object args[2]; -#endif Lisp_Object handler; Lisp_Object encoded_file, encoded_newname; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -2876,15 +2862,7 @@ This is what happens in interactive use with M-x. */) unlink (SDATA (newname)); if (0 > link (SDATA (encoded_file), SDATA (encoded_newname))) - { -#ifdef NO_ARG_ARRAY - args[0] = file; - args[1] = newname; - report_file_error ("Adding new name", Flist (2, args)); -#else - report_file_error ("Adding new name", Flist (2, &file)); -#endif - } + report_file_error ("Adding new name", list2 (file, newname)); UNGCPRO; return Qnil; @@ -2902,9 +2880,6 @@ This happens for interactive use with M-x. */) (filename, linkname, ok_if_already_exists) Lisp_Object filename, linkname, ok_if_already_exists; { -#ifdef NO_ARG_ARRAY - Lisp_Object args[2]; -#endif Lisp_Object handler; Lisp_Object encoded_filename, encoded_linkname; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -2960,13 +2935,7 @@ This happens for interactive use with M-x. */) } } -#ifdef NO_ARG_ARRAY - args[0] = filename; - args[1] = linkname; - report_file_error ("Making symbolic link", Flist (2, args)); -#else - report_file_error ("Making symbolic link", Flist (2, &filename)); -#endif + report_file_error ("Making symbolic link", list2 (filename, linkname)); } UNGCPRO; return Qnil; From 799734b06388430cca13e5933fa57d782b7b1435 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 25 Aug 2006 23:33:30 +0000 Subject: [PATCH 344/361] (Fcurrent_time, Fget_internal_run_time): Simplify; use list3. --- src/editfns.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/editfns.c b/src/editfns.c index 8ac61f3d006..c43528c4863 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1435,14 +1435,11 @@ resolution finer than a second. */) () { EMACS_TIME t; - Lisp_Object result[3]; EMACS_GET_TIME (t); - XSETINT (result[0], (EMACS_SECS (t) >> 16) & 0xffff); - XSETINT (result[1], (EMACS_SECS (t) >> 0) & 0xffff); - XSETINT (result[2], EMACS_USECS (t)); - - return Flist (3, result); + return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff), + make_number ((EMACS_SECS (t) >> 0) & 0xffff), + make_number (EMACS_USECS (t))); } DEFUN ("get-internal-run-time", Fget_internal_run_time, Sget_internal_run_time, @@ -1460,7 +1457,6 @@ systems that do not provide resolution finer than a second. */) { #ifdef HAVE_GETRUSAGE struct rusage usage; - Lisp_Object result[3]; int secs, usecs; if (getrusage (RUSAGE_SELF, &usage) < 0) @@ -1476,11 +1472,9 @@ systems that do not provide resolution finer than a second. */) secs++; } - XSETINT (result[0], (secs >> 16) & 0xffff); - XSETINT (result[1], (secs >> 0) & 0xffff); - XSETINT (result[2], usecs); - - return Flist (3, result); + return list3 (make_number ((secs >> 16) & 0xffff), + make_number ((secs >> 0) & 0xffff), + make_number (usecs)); #else return Fcurrent_time (); #endif From 8929fd8784f3029494d04fef6896247385c9d6c0 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 25 Aug 2006 23:33:44 +0000 Subject: [PATCH 345/361] (Fset_buffer_multibyte): Simplify; use list3. --- src/buffer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 81ea51b357a..863b217d2b4 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2345,11 +2345,10 @@ current buffer is cleared. */) { /* Represent all the above changes by a special undo entry. */ extern Lisp_Object Qapply; - Lisp_Object args[3]; - args[0] = Qapply; - args[1] = intern ("set-buffer-multibyte"); - args[2] = NILP (flag) ? Qt : Qnil; - current_buffer->undo_list = Fcons (Flist (3, args), old_undo); + current_buffer->undo_list = Fcons (list3 (Qapply, + intern ("set-buffer-multibyte"), + NILP (flag) ? Qt : Qnil), + old_undo); } UNGCPRO; From 76667462a2ff4e447891dda32122e108e2a39ac2 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 25 Aug 2006 23:40:38 +0000 Subject: [PATCH 346/361] Remove * in defcustoms. (defgroup checkdoc): Move to beginning. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/checkdoc.el | 34 ++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index eacc773d434..42b27ff66bf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2006-08-25 Stefan Monnier + * emacs-lisp/checkdoc.el: Remove * in defcustoms. + (defgroup checkdoc): Move to beginning. + * progmodes/python.el (python-preoutput-skip-next-prompt): New var. (python-preoutput-continuation): Remove. (python-preoutput-filter): Simplify correspondingly. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index bbeea5d703d..68603c905a5 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -193,8 +193,14 @@ (defvar compilation-error-regexp-alist) (defvar compilation-mode-font-lock-keywords) +(defgroup checkdoc nil + "Support for doc string checking in Emacs Lisp." + :prefix "checkdoc" + :group 'lisp + :version "20.3") + (defcustom checkdoc-autofix-flag 'semiautomatic - "*Non-nil means attempt auto-fixing of doc strings. + "Non-nil means attempt auto-fixing of doc strings. If this value is the symbol `query', then the user is queried before any change is made. If the value is `automatic', then all changes are made without asking unless the change is very-complex. If the value @@ -208,37 +214,39 @@ The value `never' is the same as nil, never ask or change anything." (other :tag "semiautomatic" semiautomatic))) (defcustom checkdoc-bouncy-flag t - "*Non-nil means to \"bounce\" to auto-fix locations. + "Non-nil means to \"bounce\" to auto-fix locations. Setting this to nil will silently make fixes that require no user interaction. See `checkdoc-autofix-flag' for auto-fixing details." :group 'checkdoc :type 'boolean) (defcustom checkdoc-force-docstrings-flag t - "*Non-nil means that all checkable definitions should have documentation. + "Non-nil means that all checkable definitions should have documentation. Style guide dictates that interactive functions MUST have documentation, and that it's good but not required practice to make non user visible items have doc strings." :group 'checkdoc :type 'boolean) +(put 'checkdoc-force-docstrings-flag 'safe-local-variable 'booleanp) (defcustom checkdoc-force-history-flag t - "*Non-nil means that files should have a History section or ChangeLog file. + "Non-nil means that files should have a History section or ChangeLog file. This helps document the evolution of, and recent changes to, the package." :group 'checkdoc :type 'boolean) (defcustom checkdoc-permit-comma-termination-flag nil - "*Non-nil means the first line of a docstring may end with a comma. + "Non-nil means the first line of a docstring may end with a comma. Ordinarily, a full sentence is required. This may be misleading when there is a substantial caveat to the one-line description -- the comma should be used when the first part could stand alone as a sentence, but it indicates that a modifying clause follows." :group 'checkdoc :type 'boolean) +(put 'checkdoc-permit-comma-termination-flag 'safe-local-variable 'booleanp) (defcustom checkdoc-spellcheck-documentation-flag nil - "*Non-nil means run Ispell on text based on value. + "Non-nil means run Ispell on text based on value. This is automatically set to nil if Ispell does not exist on your system. Possible values are: @@ -259,14 +267,14 @@ system. Possible values are: "List of words that are correct when spell-checking Lisp documentation.") (defcustom checkdoc-max-keyref-before-warn 10 - "*The number of \\ [command-to-keystroke] tokens allowed in a doc string. + "The number of \\ [command-to-keystroke] tokens allowed in a doc string. Any more than this and a warning is generated suggesting that the construct \\ {keymap} be used instead." :group 'checkdoc :type 'integer) (defcustom checkdoc-arguments-in-order-flag t - "*Non-nil means warn if arguments appear out of order. + "Non-nil means warn if arguments appear out of order. Setting this to nil will mean only checking that all the arguments appear in the proper form in the documentation, not that they are in the same order as they appear in the argument list. No mention is @@ -298,7 +306,7 @@ problem discovered. This is useful for adding additional checks.") A search leaves the cursor in front of the parameter list.") (defcustom checkdoc-verb-check-experimental-flag t - "*Non-nil means to attempt to check the voice of the doc string. + "Non-nil means to attempt to check the voice of the doc string. This check keys off some words which are commonly misused. See the variable `checkdoc-common-verbs-wrong-voice' if you wish to add your own." :group 'checkdoc @@ -2633,12 +2641,6 @@ function called to create the messages." (setq checkdoc-pending-errors nil) nil))) -(defgroup checkdoc nil - "Support for doc string checking in Emacs Lisp." - :prefix "checkdoc" - :group 'lisp - :version "20.3") - (custom-add-option 'emacs-lisp-mode-hook (lambda () (checkdoc-minor-mode 1))) @@ -2650,5 +2652,5 @@ function called to create the messages." (provide 'checkdoc) -;;; arch-tag: c49a7ec8-3bb7-46f2-bfbc-d5f26e033b26 +;; arch-tag: c49a7ec8-3bb7-46f2-bfbc-d5f26e033b26 ;;; checkdoc.el ends here From 854fa43e14f5c90333189bf895930c39aeaae662 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sat, 26 Aug 2006 11:49:35 +0000 Subject: [PATCH 347/361] Whitespace fix. --- lisp/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 42b27ff66bf..e1ee2324b00 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -45,7 +45,7 @@ * viper-ex.el (ex-splice-args-in-1-letr-cmd): Get rid of caddr. (viper-emacs-state-cursor-color): Default to nil, since this feature doesn't work well yet. - + * ediff-mult.el (ediff-intersect-directories) (ediff-get-directory-files-under-revision, ediff-dir-diff-copy-file): always expand filenames. From 426348643ad31779a4a50d86e702faf8e479b09d Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 26 Aug 2006 14:39:16 +0000 Subject: [PATCH 348/361] (python-send-receive): Wait in the process's buffer so as to check the right buffer-local variables. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/python.el | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e1ee2324b00..f9dae73fefa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-26 Stefan Monnier + + * progmodes/python.el (python-send-receive): Wait in the + process's buffer so as to check the right buffer-local variables. + 2006-08-25 Stefan Monnier * emacs-lisp/checkdoc.el: Remove * in defcustoms. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a7942c603f3..c38a6e82f83 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1576,14 +1576,15 @@ will." (defun python-send-receive (string) "Send STRING to inferior Python (if any) and return result. The result is what follows `_emacs_out' in the output." + (python-send-string string) (let ((proc (python-proc))) - (python-send-string string) - (set (make-local-variable 'python-preoutput-result) nil) - (while (progn - (accept-process-output proc 5) - (null python-preoutput-result))) - (prog1 python-preoutput-result - (kill-local-variable 'python-preoutput-result)))) + (with-current-buffer (process-buffer proc) + (set (make-local-variable 'python-preoutput-result) nil) + (while (progn + (accept-process-output proc 5) + (null python-preoutput-result))) + (prog1 python-preoutput-result + (kill-local-variable 'python-preoutput-result))))) ;; Fixme: Is there anything reasonable we can do with random methods? ;; (Currently only works with functions.) From 4442ec0d0dcc53489b071872800095a299559fba Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:08:07 +0000 Subject: [PATCH 349/361] (mac-apple-event-map): Rename hicommand to hi-command. (mac-dnd-drop-data): Apply 2006-08-22 change for x-dnd-drop-data. (special-event-map): Apply 2006-08-16 change for x-win.el. --- lisp/term/mac-win.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index f1f66b1d4df..538aa09b2c5 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el @@ -1539,7 +1539,7 @@ in `selection-converter-alist', which see." (put 'autosave-now 'mac-apple-event-id "asav") ; kAEAutosaveNow ;; kAEInternetEventClass (put 'get-url 'mac-apple-event-id "GURL") ; kAEGetURL -;; Converted HICommand events +;; Converted HI command events (put 'about 'mac-apple-event-id "abou") ; kHICommandAbout (defmacro mac-event-spec (event) @@ -1739,7 +1739,7 @@ Currently the `mailto' scheme is supported." (define-key mac-apple-event-map [internet-event get-url] 'mac-ae-get-url) -(define-key mac-apple-event-map [hicommand about] 'display-splash-screen) +(define-key mac-apple-event-map [hi-command about] 'display-splash-screen) ;;; Converted Carbon Events (defun mac-handle-toolbar-switch-mode (event) @@ -2208,7 +2208,8 @@ See also `mac-dnd-known-types'." ;; If dropping in an ordinary window which we could use, ;; let dnd-open-file-other-window specify what to do. (progn - (goto-char (posn-point (event-start event))) + (when (not mouse-yank-at-point) + (goto-char (posn-point (event-start event)))) (funcall handler window action data)) ;; If we can't display the file here, ;; make a new window for it. @@ -2561,8 +2562,8 @@ ascii:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman") ;; Initiate drag and drop -(global-set-key [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) -(global-set-key [M-drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) +(define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) +(define-key special-event-map [M-drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) ;;;; Non-toolkit Scroll bars From f3c4a0e1d28dcf59bf9b59ba040b361ad44adad3 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:08:31 +0000 Subject: [PATCH 350/361] (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Undo previous change. Move mutex lock/unlock operations inside BLOCK_INPUT. --- src/alloc.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 192b974196f..2fd50009649 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -130,27 +130,17 @@ static pthread_mutex_t alloc_mutex; #define BLOCK_INPUT_ALLOC \ do \ { \ - if (!in_sighandler) \ - { \ - pthread_mutex_lock (&alloc_mutex); \ - if (pthread_self () == main_thread) \ - BLOCK_INPUT; \ - else \ - sigblock (sigmask (SIGIO)); \ - } \ + if (pthread_self () == main_thread) \ + BLOCK_INPUT; \ + pthread_mutex_lock (&alloc_mutex); \ } \ while (0) #define UNBLOCK_INPUT_ALLOC \ do \ { \ - if (!in_sighandler) \ - { \ - pthread_mutex_unlock (&alloc_mutex); \ - if (pthread_self () == main_thread) \ - UNBLOCK_INPUT; \ - else \ - sigunblock (sigmask (SIGIO)); \ - } \ + pthread_mutex_unlock (&alloc_mutex); \ + if (pthread_self () == main_thread) \ + UNBLOCK_INPUT; \ } \ while (0) From d15b573ed5740f4b0f4803a1387668c4f540d88c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:08:39 +0000 Subject: [PATCH 351/361] (directory_files_internal_unwind, directory_files_internal) (file_name_completion): Add BLOCK_INPUT around opendir/closedir. --- src/dired.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/dired.c b/src/dired.c index 17a80a3ce4b..b469d682c41 100644 --- a/src/dired.c +++ b/src/dired.c @@ -134,7 +134,9 @@ directory_files_internal_unwind (dh) Lisp_Object dh; { DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; + BLOCK_INPUT; closedir (d); + UNBLOCK_INPUT; return Qnil; } @@ -196,7 +198,9 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format) /* Now *bufp is the compiled form of MATCH; don't call anything which might compile a new regexp until we're done with the loop! */ + BLOCK_INPUT; d = opendir (SDATA (dirfilename)); + UNBLOCK_INPUT; if (d == NULL) report_file_error ("Opening directory", Fcons (directory, Qnil)); @@ -321,7 +325,9 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format) } } + BLOCK_INPUT; closedir (d); + UNBLOCK_INPUT; /* Discard the unwind protect. */ specpdl_ptr = specpdl + count; @@ -508,7 +514,9 @@ file_name_completion (file, dirname, all_flag, ver_flag) { int inner_count = SPECPDL_INDEX (); + BLOCK_INPUT; d = opendir (SDATA (Fdirectory_file_name (encoded_dir))); + UNBLOCK_INPUT; if (!d) report_file_error ("Opening directory", Fcons (dirname, Qnil)); From edc52b3fa1c83b8bab4004b4721cad9afb0563aa Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:08:54 +0000 Subject: [PATCH 352/361] [TARGET_API_MAC_CARBON] (image_load_qt_1): Use ComponentResult instead of OSErr. --- src/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/image.c b/src/image.c index 70ffabc1937..dac896137c3 100644 --- a/src/image.c +++ b/src/image.c @@ -2396,7 +2396,7 @@ image_load_qt_1 (f, img, type, fss, dh) FSSpec *fss; Handle dh; { - OSErr err; + ComponentResult err; GraphicsImportComponent gi; Rect rect; int width, height; From cc4d4639cfd7491eafb5e2e815bf3bf6382e3d2f Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:09:06 +0000 Subject: [PATCH 353/361] (in_sighandler): Remove variable. (Fcurrent_idle_time): Add missing `doc:'. (input_available_signal, init_keyboard): Undo previous change. --- src/keyboard.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index abf57937966..662aacf91a6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -100,14 +100,6 @@ int interrupt_input_pending; /* File descriptor to use for input. */ extern int input_fd; -/* Nonzero if we are executing from the SIGIO signal handler. - The difference between in_sighandler and handling_signal is that - in_sighandler is only set when executing in a signal handler. - handling_signal may be set even if not executing in a signal handler, for - example when reinvoke_input_signal is called from UNBLOCK_INPUT, or - when Emacs is compiled with SYNC_INPUT defined. */ -int in_sighandler; - #ifdef HAVE_WINDOW_SYSTEM /* Make all keyboard buffers much bigger when using X windows. */ #ifdef MAC_OS8 @@ -4560,7 +4552,7 @@ timer_check (do_it_now) } DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0, - /* Return the current length of Emacs idleness. + doc: /* Return the current length of Emacs idleness. The value is returned as a list of three integers. The first has the most significant 16 bits of the seconds, while the second has the least significant 16 bits. The third integer gives the microsecond @@ -6977,8 +6969,6 @@ input_available_signal (signo) SIGNAL_THREAD_CHECK (signo); #endif - in_sighandler = 1; - if (input_available_clear_time) EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); @@ -6990,7 +6980,6 @@ input_available_signal (signo) sigfree (); #endif errno = old_errno; - in_sighandler = 0; } #endif /* SIGIO */ @@ -10858,7 +10847,6 @@ init_keyboard () do_mouse_tracking = Qnil; #endif input_pending = 0; - in_sighandler = 0; /* This means that command_loop_1 won't try to select anything the first time through. */ From 07927df07d03dedf59450771f0353b7795121ebe Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:09:14 +0000 Subject: [PATCH 354/361] (in_sighandler): Remove extern. --- src/keyboard.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/keyboard.h b/src/keyboard.h index f8d8f789c08..96ac7d2e856 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -190,9 +190,6 @@ extern EMACS_INT num_nonmacro_input_events; /* Nonzero means polling for input is temporarily suppressed. */ extern int poll_suppress_count; -/* Nonzero if we are executing from the SIGIO signal handler. */ -extern int in_sighandler; - /* Keymap mapping ASCII function key sequences onto their preferred forms. Initialized by the terminal-specific lisp files. */ extern Lisp_Object Vfunction_key_map; From 270e593abdc765781c7cfe221e57eadb11ec3f00 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:09:23 +0000 Subject: [PATCH 355/361] (create_apple_event_from_event_ref, select) (Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator) (Fmac_set_file_type, cfstring_create_normalized) (mac_get_system_locale, select_and_poll_event, sys_select): Use OSStatus instead of OSErr. --- src/mac.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mac.c b/src/mac.c index 4652757fab3..67fd5e4f5e0 100644 --- a/src/mac.c +++ b/src/mac.c @@ -831,7 +831,7 @@ create_apple_event (class, id, result) return err; } -OSErr +OSStatus create_apple_event_from_event_ref (event, num_params, names, types, result) EventRef event; UInt32 num_params; @@ -839,7 +839,7 @@ create_apple_event_from_event_ref (event, num_params, names, types, result) EventParamType *types; AppleEvent *result; { - OSErr err; + OSStatus err; UInt32 i, size; CFStringRef string; CFDataRef data; @@ -2424,7 +2424,7 @@ select (n, rfds, wfds, efds, timeout) SELECT_TYPE *efds; struct timeval *timeout; { - OSErr err; + OSStatus err; #if TARGET_API_MAC_CARBON EventTimeout timeout_sec = (timeout @@ -4192,7 +4192,7 @@ DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1, (filename) Lisp_Object filename; { - OSErr status; + OSStatus status; #ifdef MAC_OSX FSRef fref; #else @@ -4246,7 +4246,7 @@ DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0, (filename) Lisp_Object filename; { - OSErr status; + OSStatus status; #ifdef MAC_OSX FSRef fref; #else @@ -4302,7 +4302,7 @@ assumed. Return non-nil if successful. */) (filename, code) Lisp_Object filename, code; { - OSErr status; + OSStatus status; #ifdef MAC_OSX FSRef fref; #else @@ -4362,7 +4362,7 @@ CODE must be a 4-character string. Return non-nil if successful. */) (filename, code) Lisp_Object filename, code; { - OSErr status; + OSStatus status; #ifdef MAC_OSX FSRef fref; #else @@ -4775,7 +4775,7 @@ cfstring_create_normalized (str, symbol) UnicodeMapping map; CFIndex length; UniChar *in_text, *buffer = NULL, *out_buf = NULL; - OSErr err = noErr; + OSStatus err = noErr; ByteCount out_read, out_size, out_len; map.unicodeEncoding = CreateTextEncoding (kTextEncodingUnicodeDefault, @@ -4910,7 +4910,7 @@ On successful conversion, return the result string, else return nil. */) static Lisp_Object mac_get_system_locale () { - OSErr err; + OSStatus err; LangCode lang; RegionCode region; LocaleRef locale; @@ -4987,7 +4987,7 @@ select_and_poll_event (n, rfds, wfds, efds, timeout) struct timeval *timeout; { int r; - OSErr err; + OSStatus err; r = select (n, rfds, wfds, efds, timeout); if (r != -1) @@ -5017,7 +5017,7 @@ sys_select (n, rfds, wfds, efds, timeout) SELECT_TYPE *efds; struct timeval *timeout; { - OSErr err; + OSStatus err; int i, r; EMACS_TIME select_timeout; From 3bb4025e9f085bd0e541ef57122ddbe5590965d0 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:09:33 +0000 Subject: [PATCH 356/361] [TARGET_API_MAC_CARBON] (mac_update_proxy_icon): Don't use FRAME_FILE_NAME. Use (FS)UpdateAlias. (Fx_create_frame): Apply 2006-07-03 for xfns.c. --- src/macfns.c | 89 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/src/macfns.c b/src/macfns.c index a72cd66cdce..faf4bc01a6a 100644 --- a/src/macfns.c +++ b/src/macfns.c @@ -1945,63 +1945,80 @@ static void mac_update_proxy_icon (f) struct frame *f; { + OSStatus err; Lisp_Object file_name = XBUFFER (XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer)->filename; Window w = FRAME_MAC_WINDOW (f); - - if (FRAME_FILE_NAME (f) == NULL && !STRINGP (file_name)) - return; - if (FRAME_FILE_NAME (f) && STRINGP (file_name) - && strcmp (FRAME_FILE_NAME (f), SDATA (file_name)) == 0) - return; - - if (FRAME_FILE_NAME (f)) - { - xfree (FRAME_FILE_NAME (f)); - FRAME_FILE_NAME (f) = NULL; - } + AliasHandle alias = NULL; BLOCK_INPUT; + err = GetWindowProxyAlias (w, &alias); + if (err == errWindowDoesNotHaveProxy && !STRINGP (file_name)) + goto out; + if (STRINGP (file_name)) { - OSStatus err; AEDesc desc; +#ifdef MAC_OSX + FSRef fref; +#else + FSSpec fss; +#endif + Boolean changed; Lisp_Object encoded_file_name = ENCODE_FILE (file_name); -#ifdef MAC_OS8 - SetPortWindowPort (w); -#endif +#ifdef MAC_OSX err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name), - SBYTES (encoded_file_name), typeAlias, &desc); + SBYTES (encoded_file_name), typeFSRef, &desc); +#else + SetPortWindowPort (w); + err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name), + SBYTES (encoded_file_name), typeFSS, &desc); +#endif if (err == noErr) { - Size size = AEGetDescDataSize (&desc); - AliasHandle alias = (AliasHandle) NewHandle (size); - - if (alias == NULL) - err = memFullErr; - else - { - HLock ((Handle) alias); - err = AEGetDescData (&desc, *alias, size); - HUnlock ((Handle) alias); - if (err == noErr) - err = SetWindowProxyAlias (w, alias); - DisposeHandle ((Handle) alias); - } +#ifdef MAC_OSX + err = AEGetDescData (&desc, &fref, sizeof (FSRef)); +#else + err = AEGetDescData (&desc, &fss, sizeof (FSSpec)); +#endif AEDisposeDesc (&desc); } if (err == noErr) { - FRAME_FILE_NAME (f) = xmalloc (SBYTES (file_name) + 1); - strcpy (FRAME_FILE_NAME (f), SDATA (file_name)); + if (alias) + { +#ifdef MAC_OSX + err = FSUpdateAlias (NULL, &fref, alias, &changed); +#else + err = UpdateAlias (NULL, &fss, alias, &changed); +#endif + } + if (err != noErr || alias == NULL) + { + if (alias) + DisposeHandle ((Handle) alias); +#ifdef MAC_OSX + err = FSNewAliasMinimal (&fref, &alias); +#else + err = NewAliasMinimal (&fss, &alias); +#endif + changed = true; + } } + if (err == noErr) + if (changed) + err = SetWindowProxyAlias (w, alias); } - if (FRAME_FILE_NAME (f) == NULL) + if (alias) + DisposeHandle ((Handle) alias); + + if (err != noErr || !STRINGP (file_name)) RemoveWindowProxy (w); + out: UNBLOCK_INPUT; } #endif @@ -2566,7 +2583,6 @@ This function is an internal primitive--use `make-frame' instead. */) f->output_data.mac = (struct mac_output *) xmalloc (sizeof (struct mac_output)); bzero (f->output_data.mac, sizeof (struct mac_output)); FRAME_FONTSET (f) = -1; - record_unwind_protect (unwind_create_frame, frame); f->icon_name = mac_get_arg (parms, Qicon_name, "iconName", "Title", RES_TYPE_STRING); @@ -2574,6 +2590,9 @@ This function is an internal primitive--use `make-frame' instead. */) f->icon_name = Qnil; /* FRAME_MAC_DISPLAY_INFO (f) = dpyinfo; */ + + /* With FRAME_MAC_DISPLAY_INFO set up, this unwind-protect is safe. */ + record_unwind_protect (unwind_create_frame, frame); #if GLYPH_DEBUG image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; dpyinfo_refcount = dpyinfo->reference_count; From 31f93085857c71413081acc06c4254cb1fca647f Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:09:41 +0000 Subject: [PATCH 357/361] (get_scrap_from_symbol, clear_scrap, put_scrap_string) (put_scrap_private_timestamp, scrap_has_target_type, get_scrap_string) (get_scrap_private_timestamp, get_scrap_target_type_list) (x_own_selection, x_get_foreign_selection) (Fx_disown_selection_internal, Fx_selection_owner_p) (Fx_selection_exists_p): Use OSStatus instead of OSErr. --- src/macselect.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/macselect.c b/src/macselect.c index 67a28cf9e64..fd72bd3cb14 100644 --- a/src/macselect.c +++ b/src/macselect.c @@ -31,15 +31,15 @@ typedef int ScrapRef; typedef ResType ScrapFlavorType; #endif /* !TARGET_API_MAC_CARBON */ -static OSErr get_scrap_from_symbol P_ ((Lisp_Object, int, ScrapRef *)); +static OSStatus get_scrap_from_symbol P_ ((Lisp_Object, int, ScrapRef *)); static ScrapFlavorType get_flavor_type_from_symbol P_ ((Lisp_Object)); static int valid_scrap_target_type_p P_ ((Lisp_Object)); -static OSErr clear_scrap P_ ((ScrapRef *)); -static OSErr put_scrap_string P_ ((ScrapRef, Lisp_Object, Lisp_Object)); -static OSErr put_scrap_private_timestamp P_ ((ScrapRef, unsigned long)); +static OSStatus clear_scrap P_ ((ScrapRef *)); +static OSStatus put_scrap_string P_ ((ScrapRef, Lisp_Object, Lisp_Object)); +static OSStatus put_scrap_private_timestamp P_ ((ScrapRef, unsigned long)); static ScrapFlavorType scrap_has_target_type P_ ((ScrapRef, Lisp_Object)); static Lisp_Object get_scrap_string P_ ((ScrapRef, Lisp_Object)); -static OSErr get_scrap_private_timestamp P_ ((ScrapRef, unsigned long *)); +static OSStatus get_scrap_private_timestamp P_ ((ScrapRef, unsigned long *)); static Lisp_Object get_scrap_target_type_list P_ ((ScrapRef)); static void x_own_selection P_ ((Lisp_Object, Lisp_Object)); static Lisp_Object x_get_local_selection P_ ((Lisp_Object, Lisp_Object, int)); @@ -108,13 +108,13 @@ static Lisp_Object Vmac_service_selection; reference is set to *SCRAP, and it becomes NULL if there's no corresponding scrap. Clear the scrap if CLEAR_P is non-zero. */ -static OSErr +static OSStatus get_scrap_from_symbol (sym, clear_p, scrap) Lisp_Object sym; int clear_p; ScrapRef *scrap; { - OSErr err = noErr; + OSStatus err = noErr; Lisp_Object str = Fget (sym, Qmac_scrap_name); if (!STRINGP (str)) @@ -172,7 +172,7 @@ valid_scrap_target_type_p (sym) /* Clear the scrap whose reference is *SCRAP. */ -static INLINE OSErr +static INLINE OSStatus clear_scrap (scrap) ScrapRef *scrap; { @@ -190,7 +190,7 @@ clear_scrap (scrap) /* Put Lisp String STR to the scrap SCRAP. The target type is specified by TYPE. */ -static OSErr +static OSStatus put_scrap_string (scrap, type, str) ScrapRef scrap; Lisp_Object type, str; @@ -211,7 +211,7 @@ put_scrap_string (scrap, type, str) /* Put TIMESTAMP to the scrap SCRAP. The timestamp is used for checking if the scrap is owned by the process. */ -static INLINE OSErr +static INLINE OSStatus put_scrap_private_timestamp (scrap, timestamp) ScrapRef scrap; unsigned long timestamp; @@ -233,7 +233,7 @@ scrap_has_target_type (scrap, type) ScrapRef scrap; Lisp_Object type; { - OSErr err; + OSStatus err; ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type); if (flavor_type) @@ -264,7 +264,7 @@ get_scrap_string (scrap, type) ScrapRef scrap; Lisp_Object type; { - OSErr err; + OSStatus err; Lisp_Object result = Qnil; ScrapFlavorType flavor_type = get_flavor_type_from_symbol (type); #if TARGET_API_MAC_CARBON @@ -310,12 +310,12 @@ get_scrap_string (scrap, type) /* Get timestamp from the scrap SCRAP and set to *TIMPSTAMP. */ -static OSErr +static OSStatus get_scrap_private_timestamp (scrap, timestamp) ScrapRef scrap; unsigned long *timestamp; { - OSErr err = noErr; + OSStatus err = noErr; #if TARGET_API_MAC_CARBON ScrapFlavorFlags flags; @@ -365,7 +365,7 @@ get_scrap_target_type_list (scrap) { Lisp_Object result = Qnil, rest, target_type; #if TARGET_API_MAC_CARBON - OSErr err; + OSStatus err; UInt32 count, i, type; ScrapFlavorInfo *flavor_info = NULL; Lisp_Object strings = Qnil; @@ -425,7 +425,7 @@ static void x_own_selection (selection_name, selection_value) Lisp_Object selection_name, selection_value; { - OSErr err; + OSStatus err; ScrapRef scrap; struct gcpro gcpro1, gcpro2; Lisp_Object rest, handler_fn, value, type; @@ -671,7 +671,7 @@ static Lisp_Object x_get_foreign_selection (selection_symbol, target_type, time_stamp) Lisp_Object selection_symbol, target_type, time_stamp; { - OSErr err; + OSStatus err; ScrapRef scrap; Lisp_Object result = Qnil; @@ -765,7 +765,7 @@ Disowning it means there is no such selection. */) Lisp_Object selection; Lisp_Object time; { - OSErr err; + OSStatus err; ScrapRef scrap; Lisp_Object local_selection_data; @@ -828,7 +828,7 @@ and t is the same as `SECONDARY'. */) (selection) Lisp_Object selection; { - OSErr err; + OSStatus err; ScrapRef scrap; Lisp_Object result = Qnil, local_selection_data; @@ -873,7 +873,7 @@ and t is the same as `SECONDARY'. */) (selection) Lisp_Object selection; { - OSErr err; + OSStatus err; ScrapRef scrap; Lisp_Object result = Qnil, rest; @@ -931,7 +931,7 @@ struct suspended_ae_info struct suspended_ae_info *next; }; -/* List of deferred apple events at the startup time. */ +/* List of apple events deferred at the startup time. */ static struct suspended_ae_info *deferred_apple_events = NULL; /* List of suspended apple events, in order of expiration_tick. */ From 3e7424f76a790845e4972f77e936264d631cb706 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:09:52 +0000 Subject: [PATCH 358/361] (mac_draw_string_common, mac_query_char_extents) (x_iconify_frame, XLoadQueryFont, install_window_handler) (mac_handle_command_event, init_command_handler, init_menu_bar): Use OSStatus instead of OSErr. (x_free_frame_resources) [TARGET_API_MAC_CARBON]: Don't use FRAME_FILE_NAME. (x_query_font): Apply 2006-08-04 change for xterm.c. (Qhi_command): Rename from Qhicommand. All uses changed. --- src/macterm.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/src/macterm.c b/src/macterm.c index 04b55d9fa80..a5369eb1667 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -902,7 +902,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) #if USE_ATSUI if (GC_FONT (gc)->mac_style) { - OSErr err; + OSStatus err; ATSUTextLayout text_layout; xassert (bytes_per_char == 2); @@ -1129,7 +1129,7 @@ mac_draw_image_string_16 (f, gc, x, y, buf, nchars, bg_width) the font of the current graphics port. If CG_GLYPH is not NULL, *CG_GLYPH is set to the glyph ID or 0 if it cannot be obtained. */ -static OSErr +static OSStatus mac_query_char_extents (style, c, font_ascent_return, font_descent_return, overall_return, cg_glyph) @@ -1147,7 +1147,7 @@ mac_query_char_extents (style, c, void *cg_glyph; #endif { - OSErr err = noErr; + OSStatus err = noErr; int width; Rect char_bounds; @@ -1193,7 +1193,7 @@ mac_query_char_extents (style, c, #if USE_CG_TEXT_DRAWING if (err == noErr && cg_glyph) { - OSErr err1; + OSStatus err1; ATSUGlyphInfoArray glyph_info_array; ByteCount count = sizeof (ATSUGlyphInfoArray); @@ -6314,7 +6314,7 @@ void x_iconify_frame (f) struct frame *f; { - OSErr err; + OSStatus err; /* A deactivate event does not occur when the last visible frame is iconified. So if we clear the highlight here, it will not be @@ -6378,11 +6378,6 @@ x_free_frame_resources (f) if (FRAME_SIZE_HINTS (f)) xfree (FRAME_SIZE_HINTS (f)); -#if TARGET_API_MAC_CARBON - if (FRAME_FILE_NAME (f)) - xfree (FRAME_FILE_NAME (f)); -#endif - xfree (f->output_data.mac); f->output_data.mac = NULL; @@ -7200,7 +7195,7 @@ init_font_name_table () if (!NILP (assq_no_quit (make_number (kTextEncodingMacUnicode), text_encoding_info_alist))) { - OSErr err; + OSStatus err; struct Lisp_Hash_Table *h; unsigned hash_code; ItemCount nfonts, i; @@ -7782,7 +7777,7 @@ XLoadQueryFont (Display *dpy, char *fontname) #if USE_ATSUI if (strcmp (charset, "iso10646-1") == 0) /* XXX */ { - OSErr err; + OSStatus err; ATSUAttributeTag tags[] = {kATSUFontTag, kATSUSizeTag, kATSUQDBoldfaceTag, kATSUQDItalicTag}; ByteCount sizes[] = {sizeof (ATSUFontID), sizeof (Fixed), @@ -7865,7 +7860,7 @@ XLoadQueryFont (Display *dpy, char *fontname) #if USE_ATSUI if (font->mac_style) { - OSErr err; + OSStatus err; UniChar c; font->min_byte1 = 0; @@ -8344,8 +8339,8 @@ x_query_font (f, fontname) for (i = 0; i < dpyinfo->n_fonts; i++) if (dpyinfo->font_table[i].name - && (!strcmp (dpyinfo->font_table[i].name, fontname) - || !strcmp (dpyinfo->font_table[i].full_name, fontname))) + && (!xstricmp (dpyinfo->font_table[i].name, fontname) + || !xstricmp (dpyinfo->font_table[i].full_name, fontname))) return (dpyinfo->font_table + i); return NULL; } @@ -8539,7 +8534,7 @@ Point saved_menu_event_location; /* Apple Events */ #if USE_CARBON_EVENTS -static Lisp_Object Qhicommand; +static Lisp_Object Qhi_command; #ifdef MAC_OSX extern Lisp_Object Qwindow; static Lisp_Object Qtoolbar_switch_mode; @@ -8581,7 +8576,7 @@ static Lisp_Object Qservice, Qpaste, Qperform; static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, EventRef, void *); #endif -OSErr install_window_handler (WindowPtr); +OSStatus install_window_handler (WindowPtr); extern void init_emacs_passwd_dir (); extern int emacs_main (int, char **, char **); @@ -9382,15 +9377,15 @@ mac_handle_command_event (next_handler, event, data) if (err != noErr || command.commandID == 0) return eventNotHandledErr; - /* A HICommand event is mapped to an Apple event whose event class - symbol is `hicommand' and event ID is its command ID. */ + /* A HI command event is mapped to an Apple event whose event class + symbol is `hi-command' and event ID is its command ID. */ err = mac_store_event_ref_as_apple_event (0, command.commandID, - Qhicommand, Qnil, + Qhi_command, Qnil, event, num_params, names, types); return err == noErr ? noErr : eventNotHandledErr; } -static OSErr +static OSStatus init_command_handler () { EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}}; @@ -9891,11 +9886,11 @@ mac_store_service_event (event) #endif /* USE_CARBON_EVENTS */ -OSErr +OSStatus install_window_handler (window) WindowPtr window; { - OSErr err = noErr; + OSStatus err = noErr; #if USE_CARBON_EVENTS EventTypeSpec specs_window[] = {{kEventClassWindow, kEventWindowUpdate}, @@ -11329,7 +11324,7 @@ static void init_menu_bar () { #ifdef MAC_OSX - OSErr err; + OSStatus err; MenuRef menu; MenuItemIndex menu_index; @@ -11512,7 +11507,7 @@ syms_of_macterm () Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); #if USE_CARBON_EVENTS - Qhicommand = intern ("hicommand"); staticpro (&Qhicommand); + Qhi_command = intern ("hi-command"); staticpro (&Qhi_command); #ifdef MAC_OSX Qtoolbar_switch_mode = intern ("toolbar-switch-mode"); staticpro (&Qtoolbar_switch_mode); From b2aad248ba4625b6f3ca7b7e36f7e0d25fed8b7b Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:10:03 +0000 Subject: [PATCH 359/361] (struct mac_output) [TARGET_API_MAC_CARBON]: Remove member file_name. (FRAME_FILE_NAME): Remove macro. (install_window_handler, create_apple_event_from_event_ref): Return OSStatus instead of OSErr. --- src/macterm.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/macterm.h b/src/macterm.h index 55bf583c214..945dbf3af57 100644 --- a/src/macterm.h +++ b/src/macterm.h @@ -335,11 +335,6 @@ struct mac_output { /* Hints for the size and the position of a window. */ XSizeHints *size_hints; -#if TARGET_API_MAC_CARBON - /* File name for the proxy icon of this frame. Might be NULL. */ - char *file_name; -#endif - #if USE_CG_DRAWING /* Quartz 2D graphics context. */ CGContextRef cg_context; @@ -365,8 +360,6 @@ typedef struct mac_output mac_output; #define FRAME_SIZE_HINTS(f) ((f)->output_data.mac->size_hints) -#define FRAME_FILE_NAME(f) ((f)->output_data.mac->file_name) - /* This gives the mac_display_info structure for the display F is on. */ #define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info) #define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info) @@ -634,7 +627,7 @@ extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); extern int mac_font_panel_visible_p P_ ((void)); extern OSStatus mac_show_hide_font_panel P_ ((void)); extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int)); -extern OSErr install_window_handler P_ ((WindowPtr)); +extern OSStatus install_window_handler P_ ((WindowPtr)); extern void remove_window_handler P_ ((WindowPtr)); extern void do_menu_choice P_ ((SInt32)); extern OSStatus mac_post_mouse_moved_event P_ ((void)); @@ -675,10 +668,10 @@ extern void mac_clear_font_name_table P_ ((void)); extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *)); extern OSErr mac_ae_put_lisp P_ ((AEDescList *, UInt32, Lisp_Object)); #if TARGET_API_MAC_CARBON -extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32, - EventParamName *, - EventParamType *, - AppleEvent *)); +extern OSStatus create_apple_event_from_event_ref P_ ((EventRef, UInt32, + EventParamName *, + EventParamType *, + AppleEvent *)); extern OSErr create_apple_event_from_drag_ref P_ ((DragRef, UInt32, FlavorType *, AppleEvent *)); From eb411049435acd5469021b64ce3f59c4ac05f491 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 27 Aug 2006 07:10:26 +0000 Subject: [PATCH 360/361] *** empty log message *** --- lisp/ChangeLog | 6 ++++++ src/ChangeLog | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f9dae73fefa..2d203896066 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-27 YAMAMOTO Mitsuharu + + * term/mac-win.el (mac-apple-event-map): Rename hicommand to hi-command. + (mac-dnd-drop-data): Apply 2006-08-22 change for x-dnd-drop-data. + (special-event-map): Apply 2006-08-16 change for x-win.el. + 2006-08-26 Stefan Monnier * progmodes/python.el (python-send-receive): Wait in the diff --git a/src/ChangeLog b/src/ChangeLog index ac1ac8b53b3..c7a065c091e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,52 @@ +2006-08-27 YAMAMOTO Mitsuharu + + * alloc.c (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Undo previous + change. Move mutex lock/unlock operations inside BLOCK_INPUT. + + * dired.c (directory_files_internal_unwind, directory_files_internal) + (file_name_completion): Add BLOCK_INPUT around opendir/closedir. + + * image.c [MAC_OS] (image_load_qt_1): Use ComponentResult instead + of OSErr. + + * keyboard.c (in_sighandler): Remove variable. + (Fcurrent_idle_time): Add missing `doc:'. + (input_available_signal, init_keyboard): Undo previous change. + + * keyboard.h (in_sighandler): Remove extern. + + * mac.c (create_apple_event_from_event_ref, select) + (Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator) + (Fmac_set_file_type, cfstring_create_normalized) + (mac_get_system_locale, select_and_poll_event, sys_select): Use + OSStatus instead of OSErr. + + * macfns.c [TARGET_API_MAC_CARBON] (mac_update_proxy_icon): Don't + use FRAME_FILE_NAME. Use (FS)UpdateAlias. + (Fx_create_frame): Apply 2006-07-03 for xfns.c. + + * macselect.c (get_scrap_from_symbol, clear_scrap, put_scrap_string) + (put_scrap_private_timestamp, scrap_has_target_type, get_scrap_string) + (get_scrap_private_timestamp, get_scrap_target_type_list) + (x_own_selection, x_get_foreign_selection) + (Fx_disown_selection_internal, Fx_selection_owner_p) + (Fx_selection_exists_p): Use OSStatus instead of OSErr. + + * macterm.c (mac_draw_string_common, mac_query_char_extents) + (x_iconify_frame, XLoadQueryFont, install_window_handler) + (mac_handle_command_event, init_command_handler, init_menu_bar): + Use OSStatus instead of OSErr. + (x_free_frame_resources) [TARGET_API_MAC_CARBON]: Don't use + FRAME_FILE_NAME. + (x_query_font): Apply 2006-08-04 change for xterm.c. + (Qhi_command): Rename from Qhicommand. All uses changed. + + * macterm.h (struct mac_output) [TARGET_API_MAC_CARBON]: Remove member + file_name. + (FRAME_FILE_NAME): Remove macro. + (install_window_handler, create_apple_event_from_event_ref): + Return OSStatus instead of OSErr. + 2006-08-26 Kim F. Storm * buffer.c (Fset_buffer_multibyte): From 7a210b69c7f92650c524766d1b9d3f3eefdd67c7 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Sun, 27 Aug 2006 10:42:40 +0000 Subject: [PATCH 361/361] Miscellaneous tq-related fixes. * lisp/emacs-lisp/tq.el: Small grammar fix in comments. (tq-enqueue): Check for existence of queue rather than the head queue item's question, which was a no-op. (tq-filter, tq-process-buffer): Make sure the process buffer exists before making it the current buffer. * lispref/processes.texi (Transaction Queues): Remove stray quote character. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-411 Creator: Michael Olson --- lisp/ChangeLog | 8 ++++++ lisp/emacs-lisp/tq.el | 60 ++++++++++++++++++++++-------------------- lispref/ChangeLog | 5 ++++ lispref/processes.texi | 2 +- 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2d203896066..187f2ff3fae 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2006-08-27 Michael Olson + + * emacs-lisp/tq.el: Small grammar fix in comments. + (tq-enqueue): Check for existence of queue rather than the + head queue item's question, which was a no-op. + (tq-filter, tq-process-buffer): Make sure the process buffer + exists before making it the current buffer. + 2006-08-27 YAMAMOTO Mitsuharu * term/mac-win.el (mac-apple-event-map): Rename hicommand to hi-command. diff --git a/lisp/emacs-lisp/tq.el b/lisp/emacs-lisp/tq.el index 2126d7663fc..1e1e143f0f0 100644 --- a/lisp/emacs-lisp/tq.el +++ b/lisp/emacs-lisp/tq.el @@ -66,7 +66,7 @@ ;; regexp: regular expression that matches the end of a response from ;; the process (defun tq-queue-head-regexp (tq) (car (cdr (car (tq-queue tq))))) -;; closure: additional data to pass to function +;; closure: additional data to pass to the function (defun tq-queue-head-closure (tq) (car (cdr (cdr (car (tq-queue tq)))))) ;; fn: function to call upon receiving a complete response from the ;; process @@ -119,7 +119,7 @@ If DELAY-QUESTION is non-nil, delay sending this question until the process has finished replying to any previous questions. This produces more reliable results with some processes." (let ((sendp (or (not delay-question) - (not (tq-queue-head-question tq))))) + (not (tq-queue tq))))) (tq-queue-add tq (unless sendp question) regexp closure fn) (when sendp (process-send-string (tq-process tq) question)))) @@ -131,35 +131,39 @@ This produces more reliable results with some processes." (defun tq-filter (tq string) "Append STRING to the TQ's buffer; then process the new data." - (with-current-buffer (tq-buffer tq) - (goto-char (point-max)) - (insert string) - (tq-process-buffer tq))) + (let ((buffer (tq-buffer tq))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (goto-char (point-max)) + (insert string) + (tq-process-buffer tq))))) (defun tq-process-buffer (tq) "Check TQ's buffer for the regexp at the head of the queue." - (set-buffer (tq-buffer tq)) - (if (= 0 (buffer-size)) () - (if (tq-queue-empty tq) - (let ((buf (generate-new-buffer "*spurious*"))) - (copy-to-buffer buf (point-min) (point-max)) - (delete-region (point-min) (point)) - (pop-to-buffer buf nil) - (error "Spurious communication from process %s, see buffer %s" - (process-name (tq-process tq)) - (buffer-name buf))) - (goto-char (point-min)) - (if (re-search-forward (tq-queue-head-regexp tq) nil t) - (let ((answer (buffer-substring (point-min) (point)))) - (delete-region (point-min) (point)) - (unwind-protect - (condition-case nil - (funcall (tq-queue-head-fn tq) - (tq-queue-head-closure tq) - answer) - (error nil)) - (tq-queue-pop tq)) - (tq-process-buffer tq)))))) + (let ((buffer (tq-buffer tq))) + (when (buffer-live-p buffer) + (set-buffer buffer) + (if (= 0 (buffer-size)) () + (if (tq-queue-empty tq) + (let ((buf (generate-new-buffer "*spurious*"))) + (copy-to-buffer buf (point-min) (point-max)) + (delete-region (point-min) (point)) + (pop-to-buffer buf nil) + (error "Spurious communication from process %s, see buffer %s" + (process-name (tq-process tq)) + (buffer-name buf))) + (goto-char (point-min)) + (if (re-search-forward (tq-queue-head-regexp tq) nil t) + (let ((answer (buffer-substring (point-min) (point)))) + (delete-region (point-min) (point)) + (unwind-protect + (condition-case nil + (funcall (tq-queue-head-fn tq) + (tq-queue-head-closure tq) + answer) + (error nil)) + (tq-queue-pop tq)) + (tq-process-buffer tq)))))))) (provide 'tq) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index ca648380cc4..cc3ccac3c7a 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,8 @@ +2006-08-27 Michael Olson + + * processes.texi (Transaction Queues): Remove stray quote + character. + 2006-08-25 Richard Stallman * os.texi (Idle Timers): run-with-idle-timer allows Lisp time value. diff --git a/lispref/processes.texi b/lispref/processes.texi index a6f43cfa95d..f957ebcac4b 100644 --- a/lispref/processes.texi +++ b/lispref/processes.texi @@ -1520,7 +1520,7 @@ text at the end of the entire answer, but nothing before; that's how If the argument @var{delay-question} is non-nil, delay sending this question until the process has finished replying to any previous -questions. This produces more reliable results with some processes." +questions. This produces more reliable results with some processes. The return value of @code{tq-enqueue} itself is not meaningful. @end defun