diff options
-rw-r--r-- | etc/NEWS | 5 | ||||
-rw-r--r-- | lisp/ChangeLog | 34 | ||||
-rw-r--r-- | lisp/emacs-lisp/re-builder.el | 15 | ||||
-rw-r--r-- | lisp/ibuffer.el | 15 | ||||
-rw-r--r-- | lisp/novice.el | 14 | ||||
-rw-r--r-- | lisp/simple.el | 8 | ||||
-rw-r--r-- | lisp/subr.el | 4 | ||||
-rw-r--r-- | lisp/wid-edit.el | 2 | ||||
-rw-r--r-- | lispref/ChangeLog | 45 | ||||
-rw-r--r-- | lispref/commands.texi | 183 | ||||
-rw-r--r-- | lispref/hooks.texi | 2 | ||||
-rw-r--r-- | lispref/minibuf.texi | 1 | ||||
-rw-r--r-- | lispref/objects.texi | 4 | ||||
-rw-r--r-- | lispref/os.texi | 14 | ||||
-rw-r--r-- | src/ChangeLog | 24 | ||||
-rw-r--r-- | src/fileio.c | 8 | ||||
-rw-r--r-- | src/keyboard.c | 13 | ||||
-rw-r--r-- | src/keymap.c | 6 | ||||
-rw-r--r-- | src/window.c | 2 |
19 files changed, 298 insertions, 101 deletions
@@ -2187,6 +2187,11 @@ configuration files. * Lisp Changes in Emacs 21.4 ++++ +** Both the variable and the function `disabled-command-hook' have +been renamed to `disabled-command-function'. The variable +`disabled-command-hook' has been kept as an obsolete alias. + ** Function `compute-motion' now calculates the usable window width if the WIDTH argument is nil. If the TOPOS argument is nil, the usable window height and width is used. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e12449df8e..31e414c2a4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,37 @@ +2004-08-08 John Paul Wallington <[email protected]> + + * ibuffer.el (define-ibuffer-column size): Use `string-to-number' + instead of `string-to-int'. + (define-ibuffer-column mode): Fix indentation. + +2004-08-08 Lars Hansen <[email protected]> + + * wid-edit.el (widget-sexp-validate): Allow whitespace after + expression. + +2004-08-08 Luc Teirlinck <[email protected]> + + * subr.el (global-unset-key, local-unset-key): Doc fixes. + + * novice.el (disabled-command-function): New variable renamed from + `disabled-command-hook'. + (disabled-command-hook): Keep the _variable_ as alias for + `disabled-command-function' and make obsolete. + (disabled-command-function): Function renamed from + `disabled-command-hook'. Adapt code to name change of the variable. + +2004-08-07 Satyaki Das <[email protected]> (tiny change) + + * simple.el (completion-root-regexp): New defvar. + (completion-setup-function): Use it instead of a literal string. + +2004-08-07 John Paul Wallington <[email protected]> + + * emacs-lisp/re-builder.el (reb-re-syntax): Add `rx' syntax. + (reb-lisp-mode): Require `rx' feature when `re-reb-syntax' is `rx'. + (reb-lisp-syntax-p, reb-change-syntax): `rx' is a Lisp syntax. + (reb-cook-regexp): Call `rx-to-string' when `re-reb-syntax' is `rx'. + 2004-08-04 Kenichi Handa <[email protected]> * international/encoded-kb.el (encoded-kbd-setup-keymap): Fix diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el index c6112c4a10..6eb1ffa2e5 100644 --- a/lisp/emacs-lisp/re-builder.el +++ b/lisp/emacs-lisp/re-builder.el @@ -135,6 +135,7 @@ Can either be `read', `string', `sregex' or `lisp-re'." (const :tag "String syntax" string) (const :tag "`sregex' syntax" sregex) (const :tag "`lisp-re' syntax" lisp-re) + (const :tag "`rx' syntax" rx) (value: string))) (defcustom reb-auto-match-limit 200 @@ -261,7 +262,9 @@ Except for Lisp syntax this is the same as `reb-regexp'.") (cond ((eq reb-re-syntax 'lisp-re) ; Pull in packages (require 'lisp-re)) ; as needed ((eq reb-re-syntax 'sregex) ; sregex is not autoloaded - (require 'sregex))) ; right now.. + (require 'sregex)) ; right now.. + ((eq reb-re-syntax 'rx) ; rx-to-string is autoloaded + (require 'rx))) ; require rx anyway (reb-mode-common)) ;; Use the same "\C-c" keymap as `reb-mode' and use font-locking from @@ -320,7 +323,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.") (defsubst reb-lisp-syntax-p () "Return non-nil if RE Builder uses a Lisp syntax." - (memq reb-re-syntax '(lisp-re sregex))) + (memq reb-re-syntax '(lisp-re sregex rx))) (defmacro reb-target-binding (symbol) "Return binding for SYMBOL in the RE Builder target buffer." @@ -466,10 +469,10 @@ Optional argument SYNTAX must be specified if called non-interactively." (list (intern (completing-read "Select syntax: " (mapcar (lambda (el) (cons (symbol-name el) 1)) - '(read string lisp-re sregex)) + '(read string lisp-re sregex rx)) nil t (symbol-name reb-re-syntax))))) - (if (memq syntax '(read string lisp-re sregex)) + (if (memq syntax '(read string lisp-re sregex rx)) (let ((buffer (get-buffer reb-buffer))) (setq reb-re-syntax syntax) (if buffer @@ -604,6 +607,8 @@ optional fourth argument FORCE is non-nil." (lre-compile-string (eval (car (read-from-string re))))) ((eq reb-re-syntax 'sregex) (apply 'sregex (eval (car (read-from-string re))))) + ((eq reb-re-syntax 'rx) + (rx-to-string (eval (car (read-from-string re))))) (t re))) (defun reb-update-regexp () @@ -670,7 +675,7 @@ If SUBEXP is non-nil mark only the corresponding sub-expressions." (overlay-put overlay 'priority i))) (setq i (1+ i)))))) (let ((count (if subexp submatches matches))) - (message"%s %smatch%s%s" + (message "%s %smatch%s%s" (if (= 0 count) "No" (int-to-string count)) (if subexp "subexpression " "") (if (= 1 count) "" "es") diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 140f299529..f013f8e3c7 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -1644,16 +1644,17 @@ If point is on a group name, this function operates on that group." (dolist (string column-strings) (setq total ;; like, ewww ... - (+ (float (string-to-int string)) + (+ (float (string-to-number string)) total))) (format "%.0f" total)))) (format "%s" (buffer-size))) -(define-ibuffer-column mode (:inline t - :props - ('mouse-face 'highlight - 'keymap ibuffer-mode-name-map - 'help-echo "mouse-2: filter by this mode")) +(define-ibuffer-column mode + (:inline t + :props + ('mouse-face 'highlight + 'keymap ibuffer-mode-name-map + 'help-echo "mouse-2: filter by this mode")) (format "%s" mode-name)) (define-ibuffer-column process @@ -2198,7 +2199,7 @@ Try to restore the previous window configuration iff `ibuffer-restore-window-config-on-quit' is non-nil." (interactive) (if ibuffer-restore-window-config-on-quit - (progn + (progn (bury-buffer) (unless (= (count-windows) 1) (set-window-configuration ibuffer-prev-window-config))) diff --git a/lisp/novice.el b/lisp/novice.el index 1cb8906648..ca9a06769d 100644 --- a/lisp/novice.el +++ b/lisp/novice.el @@ -1,6 +1,7 @@ ;;; novice.el --- handling of disabled commands ("novice mode") for Emacs -;; Copyright (C) 1985, 1986, 1987, 1994, 2002 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1987, 1994, 2002, 2004 +;; Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: internal, help @@ -36,12 +37,17 @@ ;; and the keys are returned by (this-command-keys). ;;;###autoload -(defvar disabled-command-hook 'disabled-command-hook +(defvar disabled-command-function 'disabled-command-function "Function to call to handle disabled commands. If nil, the feature is disabled, i.e., all commands work normally.") +(defvaralias 'disabled-command-hook 'disabled-command-function) +(make-obsolete-variable + 'disabled-command-hook + "use the variable `disabled-command-function' instead." "21.4") + ;;;###autoload -(defun disabled-command-hook (&rest ignore) +(defun disabled-command-function (&rest ignore) (let (char) (save-window-excursion (with-output-to-temp-buffer "*Help*" @@ -91,7 +97,7 @@ SPC to try the command just this once, but leave it disabled. (ding) (message "Please type y, n, ! or SPC (the space bar): ")))) (if (= char ?!) - (setq disabled-command-hook nil)) + (setq disabled-command-function nil)) (if (= char ?y) (if (and user-init-file (not (string= "" user-init-file)) diff --git a/lisp/simple.el b/lisp/simple.el index 9a7b7f245d..95f6ed864c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4308,6 +4308,12 @@ make the common parts less visible than normal, so that the rest of the differing parts is, by contrast, slightly highlighted." :group 'completion) +;; This is for packages that need to bind it to a non-default regexp +;; in order to make the first-differing character highlight work +;; to their liking +(defvar completion-root-regexp "^/" + "Regexp to use in `completion-setup-function' to find the root directory.") + (defun completion-setup-function () (let ((mainbuf (current-buffer)) (mbuf-contents (minibuffer-contents))) @@ -4336,7 +4342,7 @@ of the differing parts is, by contrast, slightly highlighted." (with-current-buffer mainbuf (save-excursion (goto-char (point-max)) - (skip-chars-backward "^/") + (skip-chars-backward completion-root-regexp) (- (point) (minibuffer-prompt-end))))) ;; Otherwise, in minibuffer, the whole input is being completed. (if (minibufferp mainbuf) diff --git a/lisp/subr.el b/lisp/subr.el index 2b329ef623..2833dd1061 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2316,13 +2316,13 @@ which in most cases is shared with all other buffers in the same major mode." (defun global-unset-key (key) "Remove global binding of KEY. -KEY is a string representing a sequence of keystrokes." +KEY is a string or vector representing a sequence of keystrokes." (interactive "kUnset key globally: ") (global-set-key key nil)) (defun local-unset-key (key) "Remove local binding of KEY. -KEY is a string representing a sequence of keystrokes." +KEY is a string or vector representing a sequence of keystrokes." (interactive "kUnset key locally: ") (if (current-local-map) (local-set-key key nil)) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 8029fb3d5a..05ef4b9565 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -3153,6 +3153,8 @@ It will read a directory name from the minibuffer when invoked." (setq err "Empty sexp -- use `nil'?") (unless (widget-apply widget :match (read (current-buffer))) (setq err (widget-get widget :type-error)))) + ;; Allow whitespace after expression. + (skip-syntax-forward "\\s-") (if (and (not (eobp)) (not err)) (setq err (format "Junk at end of expression: %s" diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 146f217386..5f4f890163 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,48 @@ +2004-08-08 Luc Teirlinck <[email protected]> + + * objects.texi (Character Type): Reposition `@anchor' to prevent + double space inside sentence in Info. + + * hooks.texi (Standard Hooks): `disabled-command-hook' has been + renamed to `disabled-command-function'. + * commands.texi (Key Sequence Input): Remove unnecessary anchor, + (Command Loop Info): Replace reference to it. + (Disabling Commands): `disabled-command-hook' has been renamed to + `disabled-command-function'. + +2004-08-07 Luc Teirlinck <[email protected]> + + * os.texi (Translating Input): Only non-prefix bindings in + `key-translation-map' override actual key bindings. Warn about + possible indirect effect of actual key bindings on non-prefix + bindings in `key-translation-map'. + +2004-08-06 Luc Teirlinck <[email protected]> + + * minibuf.texi (High-Level Completion): Add anchor for definition + of `read-variable'. + + * commands.texi: Various changes in addition to: + (Using Interactive): Clarify description of `interactive-form'. + (Interactive Call): Mention default for KEYS argument to + `call-interactively'. + (Command Loop Info): Clarify description of `this-command-keys'. + Mention KEEP-RECORD argument to `clear-this-command-keys'. + Value of `last-event-frame' can be `macro'. + (Repeat Events): `double-click-fuzz' is also used to distinguish + clicks and drags. + (Classifying Events): Clarify descriptions of `event-modifiers' + `event-basic-type' and `event-convert-list'. + (Accessing Events): `posn-timestamp' takes POSITION argument. + (Quoted Character Input): Clarify description of + `read-quoted-char' and fix example. + (Quitting): Add `with-local-quit'. + (Disabling Commands): Correct and clarify descriptions of + `enable-command' and `disable-command'. + Mention what happens if `disabled-command-hook' is nil. + (Keyboard Macros): Mention LOOPFUNC arg to `execute-kbd-macro'. + Describe `executing-kbd-macro' instead of obsolete `executing-macro'. + 2004-07-24 Luc Teirlinck <[email protected]> * frames.texi: Various changes in addition to: diff --git a/lispref/commands.texi b/lispref/commands.texi index 7a014080e8..796fc45f5f 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi @@ -1,6 +1,6 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. -@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 +@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004 @c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../info/commands @@ -119,7 +119,7 @@ controls the reading of arguments for an interactive call. This section describes how to write the @code{interactive} form that makes a Lisp function an interactively-callable command, and how to -examine a commands's @code{interactive} form. +examine a command's @code{interactive} form. @defspec interactive arg-descriptor @cindex argument descriptors @@ -235,12 +235,13 @@ string (starting with the first character that is not @samp{*} or @cindex examining the @code{interactive} form @defun interactive-form function -This function returns the @code{interactive} form of @var{function}. If -@var{function} is a command (@pxref{Interactive Call}), the value is a -list of the form @code{(interactive @var{spec})}, where @var{spec} is -the descriptor specification used by the command's @code{interactive} -form to compute the function's arguments. If @var{function} is not a -command, @code{interactive-form} returns @code{nil}. +This function returns the @code{interactive} form of @var{function}. +If @var{function} is an interactively callable function +(@pxref{Interactive Call}), the value is the command's +@code{interactive} form @code{(interactive @var{spec})}, which +specifies how to compute its arguments. Otherwise, the value is +@code{nil}. If @var{function} is a symbol, its function definition is +used. @end defun @node Interactive Codes @@ -416,8 +417,9 @@ the string.) Other characters that normally terminate a symbol (e.g., parentheses and brackets) do not do so here. Prompt. @item v -A variable declared to be a user option (i.e., satisfying the predicate -@code{user-variable-p}). @xref{High-Level Completion}. Existing, +A variable declared to be a user option (i.e., satisfying the +predicate @code{user-variable-p}). This reads the variable using +@code{read-variable}. @xref{Definition of read-variable}. Existing, Completion, Prompt. @item x @@ -528,10 +530,12 @@ realistic example of using @code{commandp}. @defun call-interactively command &optional record-flag keys This function calls the interactively callable function @var{command}, reading arguments according to its interactive calling specifications. -An error is signaled if @var{command} is not a function or if it cannot -be called interactively (i.e., is not a command). Note that keyboard -macros (strings and vectors) are not accepted, even though they are -considered commands, because they are not functions. +It returns whatever @var{command} returns. An error is signaled if +@var{command} is not a function or if it cannot be called +interactively (i.e., is not a command). Note that keyboard macros +(strings and vectors) are not accepted, even though they are +considered commands, because they are not functions. If @var{command} +is a symbol, then @code{call-interactively} uses its function definition. @cindex record command history If @var{record-flag} is non-@code{nil}, then this command and its @@ -541,6 +545,8 @@ an argument. @xref{Command History}. The argument @var{keys}, if given, specifies the sequence of events to supply if the command inquires which events were used to invoke it. +If @var{keys} is omitted or @code{nil}, the return value of +@code{this-command-keys} is used. @xref{Definition of this-command-keys}. @end defun @defun command-execute command &optional record-flag keys special @@ -551,7 +557,8 @@ callable function or a keyboard macro. A string or vector as @var{command} is executed with @code{execute-kbd-macro}. A function is passed to -@code{call-interactively}, along with the optional @var{record-flag}. +@code{call-interactively}, along with the optional @var{record-flag} +and @var{keys}. A symbol is handled by using its function definition in its place. A symbol with an @code{autoload} definition counts as a command if it was @@ -559,9 +566,6 @@ declared to stand for an interactively callable function. Such a definition is handled by loading the specified library and then rechecking the definition of the symbol. -The argument @var{keys}, if given, specifies the sequence of events to -supply if the command inquires which events were used to invoke it. - The argument @var{special}, if given, means to ignore the prefix argument and not clear it. This is used for executing special events (@pxref{Special Events}). @@ -741,10 +745,14 @@ was specified to run but remapped into another command. @end defvar @defun this-command-keys +@anchor{Definition of this-command-keys} This function returns a string or vector containing the key sequence that invoked the present command, plus any previous commands that -generated the prefix argument for this command. The value is a string -if all those events were characters. @xref{Input Events}. +generated the prefix argument for this command. However, if the +command has called @code{read-key-sequence}, it returns the last read +key sequence. @xref{Key Sequence Input}. The value is a string if +all events in the sequence were characters that fit in a string. +@xref{Input Events}. @example @group @@ -762,13 +770,13 @@ input events in a string (@pxref{Strings of Events}). @end defun @tindex clear-this-command-keys -@defun clear-this-command-keys +@defun clear-this-command-keys &optional keep-record This function empties out the table of events for -@code{this-command-keys} to return, and also empties the records that -the function @code{recent-keys} (@pxref{Recording Input}) will -subsequently return. This is useful after reading a password, to -prevent the password from echoing inadvertently as part of the next -command in certain cases. +@code{this-command-keys} to return. Unless @var{keep-record} is +non-@code{nil}, it also empties the records that the function +@code{recent-keys} (@pxref{Recording Input}) will subsequently return. +This is useful after reading a password, to prevent the password from +echoing inadvertently as part of the next command in certain cases. @end defun @defvar last-nonmenu-event @@ -809,6 +817,8 @@ Usually this is the frame that was selected when the event was generated, but if that frame has redirected input focus to another frame, the value is the frame to which the event was redirected. @xref{Input Focus}. + +If the last event came from a keyboard macro, the value is @code{macro}. @end defvar @node Adjusting Point @@ -1155,7 +1165,7 @@ the marginal areas, @var{position} has this form: @example (@var{window} @var{pos-or-area} (@var{x} . @var{y}) @var{timestamp} - @var{object} @var{text-pos} (@var{col} . @var{row}) + @var{object} @var{text-pos} (@var{col} . @var{row}) @var{image} (@var{dx} . @var{dy}) (@var{width} . @var{height})) @end example @@ -1387,22 +1397,25 @@ the value is 3 or greater. If @var{event} is an ordinary mouse event (not a repeat event), the value is 1. @end defun -@defvar double-click-fuzz +@defopt double-click-fuzz To generate repeat events, successive mouse button presses must be at approximately the same screen position. The value of @code{double-click-fuzz} specifies the maximum number of pixels the -mouse may be moved between two successive clicks to make a -double-click. -@end defvar +mouse may be moved (horizontally or vertically) between two successive +clicks to make a double-click. -@defvar double-click-time +This variable is also the threshold for motion of the mouse to count +as a drag. +@end defopt + +@defopt double-click-time To generate repeat events, the number of milliseconds between successive button presses must be less than the value of @code{double-click-time}. Setting @code{double-click-time} to @code{nil} disables multi-click detection entirely. Setting it to @code{t} removes the time limit; Emacs then detects multi-clicks by position only. -@end defvar +@end defopt @node Motion Events @subsection Motion Events @@ -1593,16 +1606,22 @@ This function returns a list of the modifiers that @var{event} has. The modifiers are symbols; they include @code{shift}, @code{control}, @code{meta}, @code{alt}, @code{hyper} and @code{super}. In addition, the modifiers list of a mouse event symbol always contains one of -@code{click}, @code{drag}, and @code{down}. +@code{click}, @code{drag}, and @code{down}. For double or triple +events, it also contains @code{double} or @code{triple}. -The argument @var{event} may be an entire event object, or just an event -type. +The argument @var{event} may be an entire event object, or just an +event type. If @var{event} is a symbol that has never been used in an +event that has been read as input in the current Emacs session, then +@code{event-modifiers} can return @code{nil}, even when @var{event} +actually has modifiers. Here are some examples: @example (event-modifiers ?a) @result{} nil +(event-modifiers ?A) + @result{} (shift) (event-modifiers ?\C-a) @result{} (control) (event-modifiers ?\C-%) @@ -1627,7 +1646,8 @@ but the event symbol name itself does not contain @samp{click}. @defun event-basic-type event This function returns the key or mouse button that @var{event} -describes, with all modifiers removed. For example: +describes, with all modifiers removed. The @var{event} argument is as +in @code{event-modifiers}. For example: @example (event-basic-type ?a) @@ -1656,7 +1676,8 @@ event. @defun event-convert-list list This function converts a list of modifier names and a basic event type -to an event type which specifies all of them. For example, +to an event type which specifies all of them. The basic event type +must be the last element of the list. For example, @example (event-convert-list '(control ?a)) @@ -1788,7 +1809,7 @@ is a buffer position, return the size of the character at that position. @cindex mouse event, timestamp @cindex timestamp of a mouse event -@defun posn-timestamp +@defun posn-timestamp position Return the timestamp in @var{position}. This is the time at which the event occurred, in milliseconds. @end defun @@ -2001,7 +2022,9 @@ for example, @code{describe-key} uses it to read the key to describe. This function reads a key sequence and returns it as a string or vector. It keeps reading events until it has accumulated a complete key sequence; that is, enough to specify a non-prefix command using the -currently active keymaps. +currently active keymaps. (Remember that a key sequence that starts +with a mouse event is read using the keymaps of the buffer in the +window that the mouse was in, not the current buffer.) If the events are all characters and all can fit in a string, then @code{read-key-sequence} returns a string (@pxref{Strings of Events}). @@ -2101,6 +2124,8 @@ from the terminal---not counting those generated by keyboard macros. The lowest level functions for command input are those that read a single event. +None of the three functions below suppresses quitting. + @defun read-event &optional prompt inherit-input-method This function reads and returns the next event of command input, waiting if necessary until an event is available. Events can come directly from @@ -2122,8 +2147,8 @@ If @code{cursor-in-echo-area} is non-@code{nil}, then @code{read-event} moves the cursor temporarily to the echo area, to the end of any message displayed there. Otherwise @code{read-event} does not move the cursor. -If @code{read-event} gets an event that is defined as a help character, in -some cases @code{read-event} processes the event directly without +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 @dfn{special events}, are also processed directly within @code{read-event} (@pxref{Special Events}). @@ -2235,7 +2260,10 @@ The command @code{quoted-insert} uses this function. This function is like @code{read-char}, except that if the first character read is an octal digit (0-7), it reads any number of octal digits (but stopping if a non-octal digit is found), and returns the -character represented by that numeric character code. +character represented by that numeric character code. If the +character that terminates the sequence of octal digits is @key{RET}, +it is discarded. Any other terminating character is used as input +after this function returns. Quitting is suppressed when the first character is read, so that the user can enter a @kbd{C-g}. @xref{Quitting}. @@ -2252,7 +2280,7 @@ is 127 in decimal). @group ---------- Echo Area ---------- -What character-@kbd{177} +What character @kbd{1 7 7}- ---------- Echo Area ---------- @result{} 127 @@ -2370,7 +2398,8 @@ during the sleep. @cindex special events Special events are handled at a very low level---as soon as they are read. The @code{read-event} function processes these events itself, and -never returns them. +never returns them. Instead, it keeps waiting for the first event +that is not special and returns that one. Events that are handled in this way do not echo, they are never grouped into key sequences, and they never appear in the value of @@ -2544,6 +2573,28 @@ is set to a value other than @code{nil}. If @code{inhibit-quit} is non-@code{nil}, then @code{quit-flag} has no special effect. @end defvar +@defmac with-local-quit forms@dots{} +This macro executes @var{forms} in sequence, but allows quitting, at +least locally, within @var{body} even if @code{inhibit-quit} was +non-@code{nil} outside this construct. It returns the value of the +last form in @var{forms}. + +If @code{inhibit-quit} is @code{nil} on entry to @code{with-local-quit}, +it only executes the @var{forms}, and setting @code{quit-flag} causes +a normal quit. However, if @code{inhibit-quit} is non-@code{nil} so +that ordinary quitting is delayed, a non-@code{nil} @code{quit-flag} +triggers a special kind of local quit. This ends the execution of +@var{forms} and exits the @code{with-local-quit} form with +@code{quit-flag} still non-@code{nil}, so that another (ordinary) quit +will happen as soon as that is allowed. If @code{quit-flag} is +already non-@code{nil} at the beginning of @var{forms}, the local quit +happens immediately and they don't execute at all. + +This macro is mainly useful in functions that can be called from +timers, @code{pre-command-hook}, @code{post-command-hook} and other +places where @code{inhibit-quit} is normally bound to @code{t}. +@end defmac + @deffn Command keyboard-quit This function signals the @code{quit} condition with @code{(signal 'quit nil)}. This is the same thing that quitting does. (See @code{signal} @@ -2844,25 +2895,28 @@ Disabling a command has no effect on calling it as a function from Lisp programs. @deffn Command enable-command command -Allow @var{command} to be executed without special confirmation from now -on, and (if the user confirms) alter the user's init file (@pxref{Init +Allow @var{command} (a symbol) to be executed without special +confirmation from now on, and alter the user's init file (@pxref{Init File}) so that this will apply to future sessions. @end deffn @deffn Command disable-command command Require special confirmation to execute @var{command} from now on, and -(if the user confirms) alter the user's init file so that this -will apply to future sessions. +alter the user's init file so that this will apply to future sessions. @end deffn -@defvar disabled-command-hook -When the user invokes a disabled command interactively, this normal hook -is run instead of the disabled command. The hook functions can use -@code{this-command-keys} to determine what the user typed to run the -command, and thus find the command itself. @xref{Hooks}. +@defvar disabled-command-function +The value of this variable should be a function. When the user +invokes a disabled command interactively, this function is called +instead of the disabled command. It can use @code{this-command-keys} +to determine what the user typed to run the command, and thus find the +command itself. + +The value may also be @code{nil}. Then all commands work normally, +even disabled ones. -By default, @code{disabled-command-hook} contains a function that asks -the user whether to proceed. +By default, the value is a function that asks the user whether to +proceed. @end defvar @node Command History @@ -2918,7 +2972,7 @@ representation of a keyboard macro is a string or vector containing the events. Don't confuse keyboard macros with Lisp macros (@pxref{Macros}). -@defun execute-kbd-macro kbdmacro &optional count +@defun execute-kbd-macro kbdmacro &optional count loopfunc This function executes @var{kbdmacro} as a sequence of events. If @var{kbdmacro} is a string or vector, then the events in it are executed exactly as if they had been input by the user. The sequence is @@ -2935,10 +2989,14 @@ many times. If @var{count} is omitted or @code{nil}, @var{kbdmacro} is executed once. If it is 0, @var{kbdmacro} is executed over and over until it encounters an error or a failing search. +If @var{loopfunc} is non-@code{nil}, it is a function that is called, +without arguments, prior to each iteration of the macro. If +@var{loopfunc} returns @code{nil}, then this stops execution of the macro. + @xref{Reading One Event}, for an example of using @code{execute-kbd-macro}. @end defun -@defvar executing-macro +@defvar executing-kbd-macro This variable contains the string or vector that defines the keyboard macro that is currently executing. It is @code{nil} if no macro is currently executing. A command can test this variable so as to behave @@ -2947,10 +3005,11 @@ yourself. @end defvar @defvar defining-kbd-macro -This variable indicates whether a keyboard macro is being defined. A -command can test this variable so as to behave differently while a macro -is being defined. The commands @code{start-kbd-macro} and -@code{end-kbd-macro} set this variable---do not set it yourself. +This variable is non-@code{nil} if and only if a keyboard macro is +being defined. A command can test this variable so as to behave +differently while a macro is being defined. The commands +@code{start-kbd-macro} and @code{end-kbd-macro} set this variable---do +not set it yourself. The variable is always local to the current terminal and cannot be buffer-local. @xref{Multiple Displays}. diff --git a/lispref/hooks.texi b/lispref/hooks.texi index 5c424bd8de..ad5d709e72 100644 --- a/lispref/hooks.texi +++ b/lispref/hooks.texi @@ -64,7 +64,7 @@ however, we have renamed all of those.) @item diary-display-hook @item diary-hook @item dired-mode-hook -@item disabled-command-hook +@item disabled-command-function @item echo-area-clear-hook @item edit-picture-hook @item electric-buffer-menu-mode-hook diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi index c0ee5c8588..7b762a654e 100644 --- a/lispref/minibuf.texi +++ b/lispref/minibuf.texi @@ -1118,6 +1118,7 @@ complete in the set of extant Lisp symbols, and it uses the @end defun @defun read-variable prompt &optional default +@anchor{Definition of read-variable} This function reads the name of a user variable and returns it as a symbol. diff --git a/lispref/objects.texi b/lispref/objects.texi index 7c8eff0629..e945f075e6 100644 --- a/lispref/objects.texi +++ b/lispref/objects.texi @@ -411,8 +411,8 @@ represents the shifted-control-o character. @cindex hyper characters @cindex super characters @cindex alt characters - The X Window System defines three other @anchor{modifier bits} -modifier bits that can be set + The X Window System defines three other +@anchor{modifier bits}modifier bits that can be set in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. (Case is significant in these prefixes.) Thus, @samp{?\H-\M-\A-x} represents diff --git a/lispref/os.texi b/lispref/os.texi index 3e1b93339a..42a0613bfe 100644 --- a/lispref/os.texi +++ b/lispref/os.texi @@ -1686,12 +1686,18 @@ finished; it receives the results of translation by @code{function-key-map}. @item -@code{key-translation-map} overrides actual key bindings. For example, -if @kbd{C-x f} has a 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. +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 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}. diff --git a/src/ChangeLog b/src/ChangeLog index 2b0c47862d..248d5daa92 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,27 @@ +2004-08-08 Luc Teirlinck <[email protected]> + + * keyboard.c: Declare Qdisabled_command_function instead of + Qdisabled_command_hook. + (Fcommand_execute): Use Qdisabled_command_function instead of + Qdisabled_command_hook. + (syms_of_keyboard): Ditto. + +2004-08-07 Luc Teirlinck <[email protected]> + + * keymap.c (Flocal_key_binding, Fglobal_key_binding) + (syms_of_keymap) <key-translation-map>: Doc fixes. + +2004-08-07 Stefan Monnier <[email protected]> + + * window.c (window_list_1): YAILOM. + + * fileio.c (make_temp_name): Handle multibyte prefixes. + +2004-08-06 Luc Teirlinck <[email protected]> + + * keyboard.c (syms_of_keyboard) <overriding-terminal-local-map>: + Doc fix. + 2004-08-03 Kenichi Handa <[email protected]> * coding.c (decode_coding_string): Adjust coding->consumed, and diff --git a/src/fileio.c b/src/fileio.c index a05d7689c1..180f6f9413 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -888,7 +888,7 @@ make_temp_name (prefix, base64_p) int base64_p; { Lisp_Object val; - int len; + int len, clen; int pid; unsigned char *p, *data; char pidbuf[20]; @@ -923,8 +923,10 @@ make_temp_name (prefix, base64_p) #endif } - len = SCHARS (prefix); - val = make_uninit_string (len + 3 + pidlen); + len = SBYTES (prefix); clen = SCHARS (prefix); + val = make_uninit_multibyte_string (clen + 3 + pidlen, len + 3 + pidlen); + if (!STRING_MULTIBYTE (prefix)) + STRING_SET_UNIBYTE (val); data = SDATA (val); bcopy(SDATA (prefix), data, len); p = data + len; diff --git a/src/keyboard.c b/src/keyboard.c index c84e5d7bed..d0b081e5cd 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -127,8 +127,8 @@ KBOARD the_only_kboard; #endif /* Non-nil disable property on a command means - do not execute it; call disabled-command-hook's value instead. */ -Lisp_Object Qdisabled, Qdisabled_command_hook; + do not execute it; call disabled-command-function's value instead. */ +Lisp_Object Qdisabled, Qdisabled_command_function; #define NUM_RECENT_KEYS (100) int recent_keys_index; /* Index for storing next element into recent_keys */ @@ -9736,9 +9736,9 @@ a special event, so ignore the prefix argument and don't clear it. */) tem = Fget (cmd, Qdisabled); if (!NILP (tem) && !NILP (Vrun_hooks)) { - tem = Fsymbol_value (Qdisabled_command_hook); + tem = Fsymbol_value (Qdisabled_command_function); if (!NILP (tem)) - return call1 (Vrun_hooks, Qdisabled_command_hook); + return call1 (Vrun_hooks, Qdisabled_command_function); } } @@ -10916,8 +10916,8 @@ syms_of_keyboard () Qtimer_event_handler = intern ("timer-event-handler"); staticpro (&Qtimer_event_handler); - Qdisabled_command_hook = intern ("disabled-command-hook"); - staticpro (&Qdisabled_command_hook); + Qdisabled_command_function = intern ("disabled-command-function"); + staticpro (&Qdisabled_command_function); Qself_insert_command = intern ("self-insert-command"); staticpro (&Qself_insert_command); @@ -11414,6 +11414,7 @@ The elements of the list are event types that may have menu bar bindings. */); doc: /* Per-terminal keymap that overrides all other local keymaps. If this variable is non-nil, it is used as a keymap instead of the buffer's local map, and the minor mode keymaps and text property keymaps. +It also overrides `overriding-local-map'. This variable is intended to let commands such as `universal-argument' set up a different keymap for reading the next command. */); diff --git a/src/keymap.c b/src/keymap.c index ee4f41de6b..e93a3f89fe 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1603,7 +1603,7 @@ is non-nil, `key-binding' returns the unmapped command. */) DEFUN ("local-key-binding", Flocal_key_binding, Slocal_key_binding, 1, 2, 0, doc: /* Return the binding for command KEYS in current local keymap only. -KEYS is a string, a sequence of keystrokes. +KEYS is a string or vector, a sequence of keystrokes. The binding is probably a symbol with a function definition. If optional argument ACCEPT-DEFAULT is non-nil, recognize default @@ -1622,7 +1622,7 @@ bindings; see the description of `lookup-key' for more details about this. */) DEFUN ("global-key-binding", Fglobal_key_binding, Sglobal_key_binding, 1, 2, 0, doc: /* Return the binding for command KEYS in current global keymap only. -KEYS is a string, a sequence of keystrokes. +KEYS is a string or vector, a sequence of keystrokes. The binding is probably a symbol with a function definition. This function's return values are the same as those of `lookup-key' \(which see). @@ -3752,7 +3752,7 @@ key, typing `ESC O P x' would return [f1 x]. */); DEFVAR_LISP ("key-translation-map", &Vkey_translation_map, doc: /* Keymap of key translations that can override keymaps. This keymap works like `function-key-map', but comes after that, -and applies even for keys that have ordinary bindings. */); +and its non-prefix bindings override ordinary bindings. */); Vkey_translation_map = Qnil; staticpro (&Vmouse_events); diff --git a/src/window.c b/src/window.c index 4baf9d371b..8a704bdc29 100644 --- a/src/window.c +++ b/src/window.c @@ -1830,7 +1830,7 @@ window_list_1 (window, minibuf, all_frames) rest = Fmemq (window, list); if (!NILP (rest) && !EQ (rest, list)) { - for (tail = list; XCDR (tail) != rest; tail = XCDR (tail)) + for (tail = list; !EQ (XCDR (tail), rest); tail = XCDR (tail)) ; XSETCDR (tail, Qnil); list = nconc2 (rest, list); |