diff options
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/bindat.el | 7 | ||||
-rw-r--r-- | lisp/emacs-lisp/byte-run.el | 46 | ||||
-rw-r--r-- | lisp/emacs-lisp/debug.el | 82 | ||||
-rw-r--r-- | lisp/emacs-lisp/derived.el | 10 | ||||
-rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 81 | ||||
-rw-r--r-- | lisp/emacs-lisp/edebug.el | 43 | ||||
-rw-r--r-- | lisp/emacs-lisp/ewoc.el | 36 | ||||
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 3 | ||||
-rw-r--r-- | lisp/emacs-lisp/testcover.el | 18 |
9 files changed, 205 insertions, 121 deletions
diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index d8b4b4f6c19..7ed01e4bdea 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -85,7 +85,7 @@ ;; (items u8) ;; (fill 3) ;; (item repeat (items) -;; ((struct data-spec))))) +;; (struct data-spec)))) ;; ;; ;; A binary data representation may look like @@ -131,7 +131,7 @@ ;; | ( [FIELD] align LEN ) -- skip to next multiple of LEN bytes ;; | ( [FIELD] struct SPEC_NAME ) ;; | ( [FIELD] union TAG_VAL (TAG SPEC)... [(t SPEC)] ) -;; | ( [FIELD] repeat COUNT SPEC ) +;; | ( [FIELD] repeat COUNT ITEM... ) ;; -- In (eval EXPR), the value of the last field is available in ;; the dynamically bound variable `last'. @@ -151,7 +151,8 @@ ;; -- Note: 32 bit values may be limited by emacs' INTEGER ;; implementation limits. ;; -;; -- Example: bits 2 will map bytes 0x1c 0x28 to list (2 3 7 11 13) +;; -- Example: `bits 2' will unpack 0x28 0x1c to (2 3 4 11 13) +;; and 0x1c 0x28 to (3 5 10 11 12). ;; FIELD ::= ( eval EXPR ) -- use result as NAME ;; | NAME diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 7fc01901cfe..d3def79c8fb 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -100,23 +100,23 @@ The return value of this function is not used." (eval-and-compile (put ',name 'byte-optimizer 'byte-compile-inline-expand)))) -(defun make-obsolete (function new &optional when) - "Make the byte-compiler warn that FUNCTION is obsolete. -The warning will say that NEW should be used instead. -If NEW is a string, that is the `use instead' message. +(defun make-obsolete (obsolete-name current-name &optional when) + "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. +The warning will say that CURRENT-NAME should be used instead. +If CURRENT-NAME is a string, that is the `use instead' message. If provided, WHEN should be a string indicating when the function was first made obsolete, for example a date or a release number." (interactive "aMake function obsolete: \nxObsoletion replacement: ") - (let ((handler (get function 'byte-compile))) + (let ((handler (get obsolete-name 'byte-compile))) (if (eq 'byte-compile-obsolete handler) - (setq handler (nth 1 (get function 'byte-obsolete-info))) - (put function 'byte-compile 'byte-compile-obsolete)) - (put function 'byte-obsolete-info (list new handler when))) - function) + (setq handler (nth 1 (get obsolete-name 'byte-obsolete-info))) + (put obsolete-name 'byte-compile 'byte-compile-obsolete)) + (put obsolete-name 'byte-obsolete-info (list current-name handler when))) + obsolete-name) -(defmacro define-obsolete-function-alias (function new +(defmacro define-obsolete-function-alias (obsolete-name current-name &optional when docstring) - "Set FUNCTION's function definition to NEW and mark it obsolete. + "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete. \(define-obsolete-function-alias 'old-fun 'new-fun \"22.1\" \"old-fun's doc.\") @@ -127,13 +127,13 @@ is equivalent to the following two lines of code: See the docstrings of `defalias' and `make-obsolete' for more details." `(progn - (defalias ,function ,new ,docstring) - (make-obsolete ,function ,new ,when))) + (defalias ,obsolete-name ,current-name ,docstring) + (make-obsolete ,obsolete-name ,current-name ,when))) -(defun make-obsolete-variable (variable new &optional when) - "Make the byte-compiler warn that VARIABLE is obsolete. -The warning will say that NEW should be used instead. -If NEW is a string, that is the `use instead' message. +(defun make-obsolete-variable (obsolete-name current-name &optional when) + "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. +The warning will say that CURRENT-NAME should be used instead. +If CURRENT-NAME is a string, that is the `use instead' message. If provided, WHEN should be a string indicating when the variable was first made obsolete, for example a date or a release number." (interactive @@ -142,12 +142,12 @@ was first made obsolete, for example a date or a release number." (if (equal str "") (error "")) (intern str)) (car (read-from-string (read-string "Obsoletion replacement: "))))) - (put variable 'byte-obsolete-variable (cons new when)) - variable) + (put obsolete-name 'byte-obsolete-variable (cons current-name when)) + obsolete-name) -(defmacro define-obsolete-variable-alias (variable new +(defmacro define-obsolete-variable-alias (obsolete-name current-name &optional when docstring) - "Make VARIABLE a variable alias for NEW and mark it obsolete. + "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete. \(define-obsolete-variable-alias 'old-var 'new-var \"22.1\" \"old-var's doc.\") @@ -159,8 +159,8 @@ is equivalent to the following two lines of code: See the docstrings of `defvaralias' and `make-obsolete-variable' or Info node `(elisp)Variable Aliases' for more details." `(progn - (defvaralias ,variable ,new ,docstring) - (make-obsolete-variable ,variable ,new ,when))) + (defvaralias ,obsolete-name ,current-name ,docstring) + (make-obsolete-variable ,obsolete-name ,current-name ,when))) (defmacro dont-compile (&rest body) "Like `progn', but the body always runs interpreted (not compiled). diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 2149cba8720..0ee67355bf4 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -88,6 +88,8 @@ This is to optimize `debugger-make-xrefs'.") (defvar debugger-outer-standard-output) (defvar debugger-outer-inhibit-redisplay) (defvar debugger-outer-cursor-in-echo-area) +(defvar debugger-will-be-back nil + "Non-nil if we expect to get back in the debugger soon.") (defvar inhibit-debug-on-entry nil "Non-nil means that debug-on-entry is disabled.") @@ -97,6 +99,8 @@ This is to optimize `debugger-make-xrefs'.") This variable is used by `debugger-jump', `debugger-step-through', and `debugger-reenable' to temporarily disable debug-on-entry.") +(defvar inhibit-trace) ;Not yet implemented. + ;;;###autoload (setq debugger 'debug) ;;;###autoload @@ -121,6 +125,7 @@ first will be printed into the backtrace buffer." (get-buffer-create "*Backtrace*"))) (debugger-old-buffer (current-buffer)) (debugger-step-after-exit nil) + (debugger-will-be-back nil) ;; Don't keep reading from an executing kbd macro! (executing-kbd-macro nil) ;; Save the outer values of these vars for the `e' command @@ -178,7 +183,7 @@ first will be printed into the backtrace buffer." ;; Place an extra debug-on-exit for macro's. (when (eq 'lambda (car-safe (cadr (backtrace-frame 4)))) (backtrace-debug 5 t))) - (pop-to-buffer debugger-buffer) + (pop-to-buffer debugger-buffer) (debugger-mode) (debugger-setup-buffer debugger-args) (when noninteractive @@ -210,12 +215,23 @@ first will be printed into the backtrace buffer." ;; Still visible despite the save-window-excursion? Maybe it ;; it's in a pop-up frame. It would be annoying to delete and ;; recreate it every time the debugger stops, so instead we'll - ;; erase it and hide it but keep it alive. + ;; erase it (and maybe hide it) but keep it alive. (with-current-buffer debugger-buffer (erase-buffer) (fundamental-mode) (with-selected-window (get-buffer-window debugger-buffer 0) - (bury-buffer))) + (when (and (window-dedicated-p (selected-window)) + (not debugger-will-be-back)) + ;; If the window is not dedicated, burying the buffer + ;; will mean that the frame created for it is left + ;; around showing some random buffer, and next time we + ;; pop to the debugger buffer we'll create yet + ;; another frame. + ;; If debugger-will-be-back is non-nil, the frame + ;; would need to be de-iconified anyway immediately + ;; after when we re-enter the debugger, so iconifying it + ;; here would cause flashing. + (bury-buffer)))) (kill-buffer debugger-buffer)) (set-match-data debugger-outer-match-data))) ;; Put into effect the modified values of these variables @@ -307,7 +323,7 @@ That buffer should be current already." (save-excursion (set-buffer (or buffer (current-buffer))) (setq buffer (current-buffer)) - (let ((buffer-read-only nil) + (let ((inhibit-read-only t) (old-end (point-min)) (new-end (point-min))) ;; If we saved an old backtrace, find the common part ;; between the new and the old. @@ -377,6 +393,7 @@ Enter another debugger on next entry to eval, apply or funcall." (interactive) (setq debugger-step-after-exit t) (setq debugger-jumping-flag t) + (setq debugger-will-be-back t) (add-hook 'post-command-hook 'debugger-reenable) (message "Proceeding, will debug on next eval or call.") (exit-recursive-edit)) @@ -387,6 +404,12 @@ Enter another debugger on next entry to eval, apply or funcall." (unless debugger-may-continue (error "Cannot continue")) (message "Continuing.") + (save-excursion + ;; Check to see if we've flagged some frame for debug-on-exit, in which + ;; case we'll probably come back to the debugger soon. + (goto-char (point-min)) + (if (re-search-forward "^\\* " nil t) + (setq debugger-will-be-back t))) (exit-recursive-edit)) (defun debugger-return-value (val) @@ -397,6 +420,12 @@ will be used, such as in a debug on exit from a frame." (setq debugger-value val) (princ "Returning " t) (prin1 debugger-value) + (save-excursion + ;; Check to see if we've flagged some frame for debug-on-exit, in which + ;; case we'll probably come back to the debugger soon. + (goto-char (point-min)) + (if (re-search-forward "^\\* " nil t) + (setq debugger-will-be-back t))) (exit-recursive-edit)) (defun debugger-jump () @@ -406,6 +435,7 @@ will be used, such as in a debug on exit from a frame." (setq debugger-jumping-flag t) (add-hook 'post-command-hook 'debugger-reenable) (message "Continuing through this frame") + (setq debugger-will-be-back t) (exit-recursive-edit)) (defun debugger-reenable () @@ -454,7 +484,7 @@ Applies to the frame whose line point is on in the backtrace." (beginning-of-line) (backtrace-debug (debugger-frame-number) t) (if (= (following-char) ? ) - (let ((buffer-read-only nil)) + (let ((inhibit-read-only t)) (delete-char 1) (insert ?*))) (beginning-of-line)) @@ -470,7 +500,7 @@ Applies to the frame whose line point is on in the backtrace." (beginning-of-line) (backtrace-debug (debugger-frame-number) nil) (if (= (following-char) ?*) - (let ((buffer-read-only nil)) + (let ((inhibit-read-only t)) (delete-char 1) (insert ? ))) (beginning-of-line)) @@ -584,7 +614,7 @@ Applies to the frame whose line point is on in the backtrace." (terpri)) (with-current-buffer (get-buffer debugger-record-buffer) - (message "%s" + (message "%s" (buffer-substring (line-beginning-position 0) (line-end-position 0))))) @@ -626,22 +656,29 @@ functions to break on entry." ;;;###autoload (defun debug-on-entry (function) "Request FUNCTION to invoke debugger each time it is called. -If you tell the debugger to continue, FUNCTION's execution proceeds. -This works by modifying the definition of FUNCTION, -which must be written in Lisp, not predefined. + +When called interactively, prompt for FUNCTION in the minibuffer. + +This works by modifying the definition of FUNCTION. If you tell the +debugger to continue, FUNCTION's execution proceeds. If FUNCTION is a +normal function or a macro written in Lisp, you can also step through +its execution. FUNCTION can also be a primitive that is not a special +form, in which case stepping is not possible. Break-on-entry for +primitive functions only works when that function is called from Lisp. + Use \\[cancel-debug-on-entry] to cancel the effect of this command. Redefining FUNCTION also cancels it." (interactive "aDebug on entry (to function): ") - (when (and (subrp (symbol-function function)) + (when (and (subrp (symbol-function function)) (eq (cdr (subr-arity (symbol-function function))) 'unevalled)) (error "Function %s is a special form" function)) - (if (or (symbolp (symbol-function function)) + (if (or (symbolp (symbol-function function)) (subrp (symbol-function function))) ;; The function is built-in or aliased to another function. ;; Create a wrapper in which we can add the debug call. (fset function `(lambda (&rest debug-on-entry-args) ,(interactive-form (symbol-function function)) - (apply ',(symbol-function function) + (apply ',(symbol-function function) debug-on-entry-args))) (when (eq (car-safe (symbol-function function)) 'autoload) ;; The function is autoloaded. Load its real definition. @@ -662,14 +699,19 @@ Redefining FUNCTION also cancels it." ;;;###autoload (defun cancel-debug-on-entry (&optional function) "Undo effect of \\[debug-on-entry] on FUNCTION. -If argument is nil or an empty string, cancel for all functions." +If FUNCTION is nil, cancel debug-on-entry for all functions. +When called interactively, prompt for FUNCTION in the minibuffer. +To specify a nil argument interactively, exit with an empty minibuffer." (interactive (list (let ((name - (completing-read "Cancel debug on entry (to function): " - (mapcar 'symbol-name debug-function-list) - nil t nil))) - (if name (intern name))))) - (if (and function (not (string= function ""))) + (completing-read + "Cancel debug on entry to function (default: all functions): " + (mapcar 'symbol-name debug-function-list) nil t))) + (when name + (unless (string= name "") + (intern name)))))) + (if (and function + (not (string= function ""))) ; Pre 22.1 compatibility test. (progn (let ((defn (debug-on-entry-1 function nil))) (condition-case nil @@ -709,7 +751,7 @@ If argument is nil or an empty string, cancel for all functions." (defun debug-on-entry-1 (function flag) (let* ((defn (symbol-function function)) (tail defn)) - (when (eq (car-safe tail) 'macro) + (when (eq (car-safe tail) 'macro) (setq tail (cdr tail))) (if (not (eq (car-safe tail) 'lambda)) ;; Only signal an error when we try to set debug-on-entry. diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 5ba9c094355..943f052fc6d 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -1,5 +1,5 @@ ;;; derived.el --- allow inheritance of major modes -;;; (formerly mode-clone.el) +;; (formerly mode-clone.el) ;; Copyright (C) 1993, 1994, 1999, 2003 Free Software Foundation, Inc. @@ -221,6 +221,12 @@ See Info node `(elisp)Derived Modes' for more details." (get (quote ,parent) 'mode-class))) ; Set up maps and tables. (unless (keymap-parent ,map) + ;; It would probably be better to set the keymap's parent + ;; at the toplevel rather than inside the mode function, + ;; but this is not easy for at least the following reasons: + ;; - the parent (and its keymap) may not yet be loaded. + ;; - the parent's keymap name may be called something else + ;; than <parent>-mode-map. (set-keymap-parent ,map (current-local-map))) ,(when declare-syntax `(let ((parent (char-table-parent ,syntax))) @@ -440,5 +446,5 @@ Where the new table already has an entry, nothing is copied from the old one." (provide 'derived) -;;; arch-tag: 630be248-47d1-4f02-afa0-8207de0ebea0 +;; arch-tag: 630be248-47d1-4f02-afa0-8207de0ebea0 ;;; derived.el ends here diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 188dc172e07..a342f8a5530 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -183,13 +183,18 @@ Use the command `%s' to change this variable." pretty-name mode)) (let ((curfile (or (and (boundp 'byte-compile-current-file) byte-compile-current-file) - load-file-name))) - `(defcustom ,mode ,init-value - ,(format "Non-nil if %s is enabled. + load-file-name)) + base-doc-string) + (setq base-doc-string "Non-nil if %s is enabled. See the command `%s' for a description of this minor-mode. Setting this variable directly does not take effect; -use either \\[customize] or the function `%s'." - pretty-name mode mode) +use either \\[customize] or the function `%s'.") + (if (null body) + (setq base-doc-string "Non-nil if %s is enabled. +See the command `%s' for a description of this minor-mode.")) + + `(defcustom ,mode ,init-value + ,(format base-doc-string pretty-name mode mode) :set 'custom-set-minor-mode :initialize 'custom-initialize-default ,@group @@ -271,14 +276,26 @@ With zero or negative ARG turn mode off. TURN-ON is a function that will be called with no args in every buffer and that should try to turn MODE on if applicable for that buffer. KEYS is a list of CL-style keyword arguments: -:group to specify the custom group." +:group to specify the custom group. + +If MODE's set-up depends on the major mode in effect when it was +enabled, then disabling and reenabling MODE should make MODE work +correctly with the current major mode. This is important to +prevent problems with derived modes, that is, major modes that +call another major mode in their body." + (let* ((global-mode-name (symbol-name global-mode)) (pretty-name (easy-mmode-pretty-mode-name mode)) (pretty-global-name (easy-mmode-pretty-mode-name global-mode)) (group nil) (extra-args nil) - (buffers (intern (concat global-mode-name "-buffers"))) - (cmmh (intern (concat global-mode-name "-cmmh")))) + (MODE-buffers (intern (concat global-mode-name "-buffers"))) + (MODE-enable-in-buffers + (intern (concat global-mode-name "-enable-in-buffers"))) + (MODE-check-buffers + (intern (concat global-mode-name "-check-buffers"))) + (MODE-cmhh (intern (concat global-mode-name "-cmhh"))) + (MODE-major-mode (intern (concat (symbol-name mode) "-major-mode")))) ;; Check keys. (while (keywordp (car keys)) @@ -294,6 +311,8 @@ KEYS is a list of CL-style keyword arguments: "-mode\\'" "" (symbol-name mode)))))) `(progn + (defvar ,MODE-major-mode nil) + (make-variable-buffer-local ',MODE-major-mode) ;; The actual global minor-mode (define-minor-mode ,global-mode ,(format "Toggle %s in every buffer. @@ -306,10 +325,13 @@ in which `%s' turns it on." ;; Setup hook to handle future mode changes and new buffers. (if ,global-mode (progn - (add-hook 'after-change-major-mode-hook ',buffers) - (add-hook 'change-major-mode-hook ',cmmh)) - (remove-hook 'after-change-major-mode-hook ',buffers) - (remove-hook 'change-major-mode-hook ',cmmh)) + (add-hook 'after-change-major-mode-hook + ',MODE-enable-in-buffers) + (add-hook 'find-file-hook ',MODE-check-buffers) + (add-hook 'change-major-mode-hook ',MODE-cmhh)) + (remove-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers) + (remove-hook 'find-file-hook ',MODE-check-buffers) + (remove-hook 'change-major-mode-hook ',MODE-cmhh)) ;; Go through existing buffers. (dolist (buf (buffer-list)) @@ -321,22 +343,33 @@ in which `%s' turns it on." :autoload-end ;; List of buffers left to process. - (defvar ,buffers nil) + (defvar ,MODE-buffers nil) ;; The function that calls TURN-ON in each buffer. - (defun ,buffers () - (remove-hook 'post-command-hook ',buffers) - (while ,buffers - (let ((buf (pop ,buffers))) - (when (buffer-live-p buf) - (with-current-buffer buf (,turn-on)))))) - (put ',buffers 'definition-name ',global-mode) + (defun ,MODE-enable-in-buffers () + (dolist (buf ,MODE-buffers) + (when (buffer-live-p buf) + (with-current-buffer buf + (if ,mode + (unless (eq ,MODE-major-mode major-mode) + (,mode -1) + (,turn-on) + (setq ,MODE-major-mode major-mode)) + (,turn-on) + (setq ,MODE-major-mode major-mode)))))) + (put ',MODE-enable-in-buffers 'definition-name ',global-mode) + + (defun ,MODE-check-buffers () + (,MODE-enable-in-buffers) + (setq ,MODE-buffers nil) + (remove-hook 'post-command-hook ',MODE-check-buffers)) + (put ',MODE-check-buffers 'definition-name ',global-mode) ;; The function that catches kill-all-local-variables. - (defun ,cmmh () - (add-to-list ',buffers (current-buffer)) - (add-hook 'post-command-hook ',buffers)) - (put ',cmmh 'definition-name ',global-mode)))) + (defun ,MODE-cmhh () + (add-to-list ',MODE-buffers (current-buffer)) + (add-hook 'post-command-hook ',MODE-check-buffers)) + (put ',MODE-cmhh 'definition-name ',global-mode)))) ;;; ;;; easy-mmode-defmap diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 91ebda57001..54325c87b6d 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -80,7 +80,7 @@ using but only when you also use Edebug." ;;;###autoload (defcustom edebug-all-defs nil - "*If non-nil, evaluation of any defining forms will instrument for Edebug. + "*If non-nil, evaluating defining forms instruments for Edebug. This applies to `eval-defun', `eval-region', `eval-buffer', and `eval-current-buffer'. `eval-region' is also called by `eval-last-sexp', and `eval-print-last-sexp'. @@ -141,10 +141,10 @@ it." :group 'edebug) (defcustom edebug-initial-mode 'step - "*Initial execution mode for Edebug, if non-nil. If this variable -is non-@code{nil}, it specifies the initial execution mode for Edebug -when it is first activated. Possible values are step, next, go, -Go-nonstop, trace, Trace-fast, continue, and Continue-fast." + "*Initial execution mode for Edebug, if non-nil. +If this variable is non-nil, it specifies the initial execution mode +for Edebug when it is first activated. Possible values are step, next, +go, Go-nonstop, trace, Trace-fast, continue, and Continue-fast." :type '(choice (const step) (const next) (const go) (const Go-nonstop) (const trace) (const Trace-fast) (const continue) @@ -180,15 +180,15 @@ Use this with caution since it is not debugged." (defcustom edebug-print-length 50 - "*Default value of `print-length' to use while printing results in Edebug." + "*Default value of `print-length' for printing results in Edebug." :type 'integer :group 'edebug) (defcustom edebug-print-level 50 - "*Default value of `print-level' to use while printing results in Edebug." + "*Default value of `print-level' for printing results in Edebug." :type 'integer :group 'edebug) (defcustom edebug-print-circle t - "*Default value of `print-circle' to use while printing results in Edebug." + "*Default value of `print-circle' for printing results in Edebug." :type 'boolean :group 'edebug) @@ -3189,8 +3189,8 @@ The default is one second." (defun edebug-modify-breakpoint (flag &optional condition temporary) - "Modify the breakpoint for the form at point or after it according -to FLAG: set if t, clear if nil. Then move to that point. + "Modify the breakpoint for the form at point or after it. +Set it if FLAG is non-nil, clear it otherwise. Then move to that point. If CONDITION or TEMPORARY are non-nil, add those attributes to the breakpoint. " (let ((edebug-stop-point (edebug-find-stop-point))) @@ -3729,12 +3729,13 @@ Print result in minibuffer." (eval-expression-print-format (car values)))))) (defun edebug-eval-last-sexp () - "Evaluate sexp before point in the outside environment; value in minibuffer." + "Evaluate sexp before point in the outside environment. +Print value in minibuffer." (interactive) (edebug-eval-expression (edebug-last-sexp))) (defun edebug-eval-print-last-sexp () - "Evaluate sexp before point in the outside environment; insert the value. + "Evaluate sexp before point in outside environment; insert value. This prints the value into current buffer." (interactive) (let* ((edebug-form (edebug-last-sexp)) @@ -4014,20 +4015,19 @@ May only be called from within edebug-recursive-edit." (defvar edebug-eval-mode-map nil "Keymap for Edebug Eval mode. Superset of Lisp Interaction mode.") -(if edebug-eval-mode-map - nil - (setq edebug-eval-mode-map (copy-keymap lisp-interaction-mode-map)) +(unless edebug-eval-mode-map + (setq edebug-eval-mode-map (make-sparse-keymap)) + (set-keymap-parent edebug-eval-mode-map lisp-interaction-mode-map) (define-key edebug-eval-mode-map "\C-c\C-w" 'edebug-where) (define-key edebug-eval-mode-map "\C-c\C-d" 'edebug-delete-eval-item) (define-key edebug-eval-mode-map "\C-c\C-u" 'edebug-update-eval-list) (define-key edebug-eval-mode-map "\C-x\C-e" 'edebug-eval-last-sexp) - (define-key edebug-eval-mode-map "\C-j" 'edebug-eval-print-last-sexp) - ) + (define-key edebug-eval-mode-map "\C-j" 'edebug-eval-print-last-sexp)) (put 'edebug-eval-mode 'mode-class 'special) -(defun edebug-eval-mode () +(define-derived-mode edebug-eval-mode lisp-interaction-mode "Edebug Eval" "Mode for evaluation list buffer while in Edebug. In addition to all Interactive Emacs Lisp commands there are local and @@ -4039,12 +4039,7 @@ Eval list buffer commands: \\{edebug-eval-mode-map} Global commands prefixed by global-edebug-prefix: -\\{global-edebug-map} -" - (lisp-interaction-mode) - (setq major-mode 'edebug-eval-mode) - (setq mode-name "Edebug Eval") - (use-local-map edebug-eval-mode-map)) +\\{global-edebug-map}") ;;; Interface with standard debugger. diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el index a2cb4e9fe46..9f91dbab0e9 100644 --- a/lisp/emacs-lisp/ewoc.el +++ b/lisp/emacs-lisp/ewoc.el @@ -264,7 +264,7 @@ start position and the element DATA." (defun ewoc--delete-node-internal (ewoc node) "Delete a data string from EWOC. -Can not be used on the footer. Returns the wrapper that is deleted. +Can not be used on the footer. Return the wrapper that is deleted. The start-marker in the wrapper is set to nil, so that it doesn't consume any more resources." (let ((dll (ewoc--dll ewoc)) @@ -334,25 +334,27 @@ be inserted at the bottom of the ewoc." (defalias 'ewoc-data 'ewoc--node-data) (defun ewoc-enter-first (ewoc data) - "Enter DATA first in EWOC." + "Enter DATA first in EWOC. +Return the new node." (ewoc--set-buffer-bind-dll ewoc (ewoc-enter-after ewoc (ewoc--node-nth dll 0) data))) (defun ewoc-enter-last (ewoc data) - "Enter DATA last in EWOC." + "Enter DATA last in EWOC. +Return the new node." (ewoc--set-buffer-bind-dll ewoc (ewoc-enter-before ewoc (ewoc--node-nth dll -1) data))) (defun ewoc-enter-after (ewoc node data) "Enter a new element DATA after NODE in EWOC. -Returns the new NODE." +Return the new node." (ewoc--set-buffer-bind-dll ewoc (ewoc-enter-before ewoc (ewoc--node-next dll node) data))) (defun ewoc-enter-before (ewoc node data) "Enter a new element DATA before NODE in EWOC. -Returns the new NODE." +Return the new node." (ewoc--set-buffer-bind-dll ewoc (ewoc--node-enter-before node @@ -362,15 +364,15 @@ Returns the new NODE." (ewoc--node-start-marker node))))) (defun ewoc-next (ewoc node) - "Get the next node. -Returns nil if NODE is nil or the last element." + "Return the node in EWOC that follows NODE. +Return nil if NODE is nil or the last element." (when node (ewoc--filter-hf-nodes ewoc (ewoc--node-next (ewoc--dll ewoc) node)))) (defun ewoc-prev (ewoc node) - "Get the previous node. -Returns nil if NODE is nil or the first element." + "Return the node in EWOC that precedes NODE. +Return nil if NODE is nil or the first element." (when node (ewoc--filter-hf-nodes ewoc @@ -497,16 +499,16 @@ If the EWOC is empty, nil is returned." best-guess))))))) (defun ewoc-invalidate (ewoc &rest nodes) - "Refresh some elements. -The pretty-printer set for EWOC will be called for all NODES." + "Call EWOC's pretty-printer for each element in NODES. +Delete current text first, thus effecting a \"refresh\"." (ewoc--set-buffer-bind-dll ewoc (dolist (node nodes) (ewoc--refresh-node (ewoc--pretty-printer ewoc) node)))) (defun ewoc-goto-prev (ewoc arg) - "Move point to the ARGth previous element. + "Move point to the ARGth previous element in EWOC. Don't move if we are at the first element, or if EWOC is empty. -Returns the node we moved to." +Return the node we moved to." (ewoc--set-buffer-bind-dll-let* ewoc ((node (ewoc-locate ewoc (point)))) (when node @@ -522,8 +524,8 @@ Returns the node we moved to." (ewoc-goto-node ewoc node)))) (defun ewoc-goto-next (ewoc arg) - "Move point to the ARGth next element. -Returns the node (or nil if we just passed the last node)." + "Move point to the ARGth next element in EWOC. +Return the node (or nil if we just passed the last node)." (ewoc--set-buffer-bind-dll-let* ewoc ((node (ewoc-locate ewoc (point)))) (while (and node (> arg 0)) @@ -535,7 +537,7 @@ Returns the node (or nil if we just passed the last node)." (ewoc-goto-node ewoc node))) (defun ewoc-goto-node (ewoc node) - "Move point to NODE." + "Move point to NODE in EWOC." (ewoc--set-buffer-bind-dll ewoc (goto-char (ewoc--node-start-marker node)) (if goal-column (move-to-column goal-column)) @@ -586,7 +588,7 @@ remaining arguments will be passed to PREDICATE." (defun ewoc-buffer (ewoc) "Return the buffer that is associated with EWOC. -Returns nil if the buffer has been deleted." +Return nil if the buffer has been deleted." (let ((buf (ewoc--buffer ewoc))) (when (buffer-name buf) buf))) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index bb815481bf0..72924417109 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -129,6 +129,7 @@ (put 'defmacro 'doc-string-elt 3) (put 'defmacro* 'doc-string-elt 3) (put 'defsubst 'doc-string-elt 3) +(put 'defstruct 'doc-string-elt 2) (put 'define-skeleton 'doc-string-elt 2) (put 'define-derived-mode 'doc-string-elt 4) (put 'define-compilation-mode 'doc-string-elt 3) @@ -194,7 +195,7 @@ (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") (make-local-variable 'font-lock-comment-start-skip) ;; Font lock mode uses this only when it KNOWS a comment is starting. - (setq font-lock-comment-start-skip ";+ *") + (setq font-lock-comment-start-skip ";+ *") (make-local-variable 'comment-add) (setq comment-add 1) ;default to `;;' in comment-region (make-local-variable 'comment-column) diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el index f77b1a00e2c..6b87d06cb0e 100644 --- a/lisp/emacs-lisp/testcover.el +++ b/lisp/emacs-lisp/testcover.el @@ -1,6 +1,6 @@ ;;;; testcover.el -- Visual code-coverage tool -;; Copyright (C) 2002 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2005 Free Software Foundation, Inc. ;; Author: Jonathan Yavner <jyavner@member.fsf.org> ;; Maintainer: Jonathan Yavner <jyavner@member.fsf.org> @@ -150,15 +150,19 @@ call to one of the `testcover-1value-functions'." 1-valued, no error if actually multi-valued." :group 'testcover) -(defface testcover-nohits-face +(defface testcover-nohits '((t (:background "DeepPink2"))) "Face for forms that had no hits during coverage test" :group 'testcover) +;; backward-compatibility alias +(put 'testcover-nohits-face 'face-alias 'testcover-nohits) -(defface testcover-1value-face +(defface testcover-1value '((t (:background "Wheat2"))) "Face for forms that always produced the same value during coverage test" :group 'testcover) +;; backward-compatibility alias +(put 'testcover-1value-face 'face-alias 'testcover-1value) ;;;========================================================================= @@ -477,8 +481,8 @@ same value during coverage testing." (defun testcover-mark (def) "Marks one DEF (a function or macro symbol) to highlight its contained forms that did not get completely tested during coverage tests. - A marking of testcover-nohits-face (default = red) indicates that the -form was never evaluated. A marking of testcover-1value-face + A marking with the face `testcover-nohits' (default = red) indicates that the +form was never evaluated. A marking using the `testcover-1value' face \(default = tan) indicates that the form always evaluated to the same value. The forms throw, error, and signal are not marked. They do not return and would always get a red mark. Some forms that always return the same @@ -506,8 +510,8 @@ eliminated by adding more test cases." (setq ov (make-overlay (1- j) j)) (overlay-put ov 'face (if (memq data '(unknown 1value)) - 'testcover-nohits-face - 'testcover-1value-face)))) + 'testcover-nohits + 'testcover-1value)))) (set-buffer-modified-p changed)))) (defun testcover-mark-all (&optional buffer) |