diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2005-04-04 16:43:15 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2005-04-04 16:43:15 +0000 |
commit | ee00ea6e18c2aeae86e262fae703f67f4705032a (patch) | |
tree | 9e7fc6bfb33de2b2f861589a2f7674ad35de85a8 /lisp/emacs-lisp | |
parent | 4a932511428a2b61ec51deebd6e16ec1efbda800 (diff) | |
parent | 8c6ef2ca34c444c1dea1f11b999b4b2ec16cdea3 (diff) | |
download | emacs-ee00ea6e18c2aeae86e262fae703f67f4705032a.tar.gz emacs-ee00ea6e18c2aeae86e262fae703f67f4705032a.tar.bz2 emacs-ee00ea6e18c2aeae86e262fae703f67f4705032a.zip |
Merged from miles@gnu.org--gnu-2005 (patch 45-55, 214-231)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-214
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-215
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-216
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-217
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-218
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-219
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-220
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-221
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-222
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-223
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-224
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-225
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-226
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-227
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-228
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-229
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-230
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-231
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-45
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-46
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-47
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-48
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-49
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-50
Update from CVS: texi Makefile.in CVS keyw cruft
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-51
Update from CVS: ChangeLog tweaks
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-52
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-53
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-54
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-55
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-324
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/autoload.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/debug.el | 100 | ||||
-rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 16 | ||||
-rw-r--r-- | lisp/emacs-lisp/eldoc.el | 5 |
4 files changed, 70 insertions, 53 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 0a75a43827e..68d1287d98c 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -72,7 +72,7 @@ or macro definition or a defcustom)." (let ((car (car-safe form)) expand) (cond ;; For complex cases, try again on the macro-expansion. - ((and (memq car '(easy-mmode-define-global-mode + ((and (memq car '(easy-mmode-define-global-mode define-global-minor-mode easy-mmode-define-minor-mode define-minor-mode)) (setq expand (let ((load-file-name file)) (macroexpand form))) (eq (car expand) 'progn) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 1e45439658c..2149cba8720 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -632,24 +632,31 @@ which must be written in Lisp, not predefined. Use \\[cancel-debug-on-entry] to cancel the effect of this command. Redefining FUNCTION also cancels it." (interactive "aDebug on entry (to function): ") - ;; Handle a function that has been aliased to some other function. - (if (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)) + (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)) (subrp (symbol-function function))) - ;; Create a wrapper in which we can then add the necessary debug call. + ;; 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) - debug-on-entry-args)))) - (or (consp (symbol-function function)) - (debug-convert-byte-code function)) - (or (consp (symbol-function function)) - (error "Definition of %s is not a list" 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. + (load (cadr (symbol-function function)) nil noninteractive nil t)) + (when (or (not (consp (symbol-function function))) + (and (eq (car (symbol-function function)) 'macro) + (not (consp (cdr (symbol-function function)))))) + ;; The function is byte-compiled. Create a wrapper in which + ;; we can add the debug call. + (debug-convert-byte-code function))) + (unless (consp (symbol-function function)) + (error "Definition of %s is not a list" function)) (fset function (debug-on-entry-1 function t)) - (or (memq function debug-function-list) - (push function debug-function-list)) + (unless (memq function debug-function-list) + (push function debug-function-list)) function) ;;;###autoload @@ -664,45 +671,52 @@ If argument is nil or an empty string, cancel for all functions." (if name (intern name))))) (if (and function (not (string= function ""))) (progn - (let ((f (debug-on-entry-1 function nil))) + (let ((defn (debug-on-entry-1 function nil))) (condition-case nil - (if (and (equal (nth 1 f) '(&rest debug-on-entry-args)) - (eq (car (nth 3 f)) 'apply)) - ;; `f' is a wrapper introduced in debug-on-entry. - ;; Get rid of it since we don't need it any more. - (setq f (nth 1 (nth 1 (nth 3 f))))) + (when (and (equal (nth 1 defn) '(&rest debug-on-entry-args)) + (eq (car (nth 3 defn)) 'apply)) + ;; `defn' is a wrapper introduced in debug-on-entry. + ;; Get rid of it since we don't need it any more. + (setq defn (nth 1 (nth 1 (nth 3 defn))))) (error nil)) - (fset function f)) + (fset function defn)) (setq debug-function-list (delq function debug-function-list)) function) (message "Cancelling debug-on-entry for all functions") (mapcar 'cancel-debug-on-entry debug-function-list))) (defun debug-convert-byte-code (function) - (let ((defn (symbol-function function))) - (if (not (consp defn)) - ;; Assume a compiled code object. - (let* ((contents (append defn nil)) - (body - (list (list 'byte-code (nth 1 contents) - (nth 2 contents) (nth 3 contents))))) - (if (nthcdr 5 contents) - (setq body (cons (list 'interactive (nth 5 contents)) body))) - (if (nth 4 contents) - ;; Use `documentation' here, to get the actual string, - ;; in case the compiled function has a reference - ;; to the .elc file. - (setq body (cons (documentation function) body))) - (fset function (cons 'lambda (cons (car contents) body))))))) + (let* ((defn (symbol-function function)) + (macro (eq (car-safe defn) 'macro))) + (when macro (setq defn (cdr defn))) + (unless (consp defn) + ;; Assume a compiled code object. + (let* ((contents (append defn nil)) + (body + (list (list 'byte-code (nth 1 contents) + (nth 2 contents) (nth 3 contents))))) + (if (nthcdr 5 contents) + (setq body (cons (list 'interactive (nth 5 contents)) body))) + (if (nth 4 contents) + ;; Use `documentation' here, to get the actual string, + ;; in case the compiled function has a reference + ;; to the .elc file. + (setq body (cons (documentation function) body))) + (setq defn (cons 'lambda (cons (car contents) body)))) + (when macro (setq defn (cons 'macro defn))) + (fset function defn)))) (defun debug-on-entry-1 (function flag) (let* ((defn (symbol-function function)) (tail defn)) - (if (subrp tail) - (error "%s is a built-in function" function) - (if (eq (car tail) 'macro) (setq tail (cdr tail))) - (if (eq (car tail) 'lambda) (setq tail (cdr tail)) - (error "%s not user-defined Lisp function" function)) + (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. + ;; When we try to clear debug-on-entry, we are now done. + (when flag + (error "%s is not a user-defined Lisp function" function)) + (setq tail (cdr tail)) ;; Skip the docstring. (when (and (stringp (cadr tail)) (cddr tail)) (setq tail (cdr tail))) @@ -713,8 +727,8 @@ If argument is nil or an empty string, cancel for all functions." ;; Add/remove debug statement as needed. (if flag (setcdr tail (cons '(implement-debug-on-entry) (cdr tail))) - (setcdr tail (cddr tail)))) - defn))) + (setcdr tail (cddr tail))))) + defn)) (defun debugger-list-functions () "Display a list of all the functions now set to debug on entry." diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index b6b91710ed4..a96b1741139 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -1,6 +1,7 @@ ;;; easy-mmode.el --- easy definition for major and minor modes -;; Copyright (C) 1997,2000,01,02,03,2004 Free Software Foundation, Inc. +;; Copyright (C) 1997, 2000, 2001, 2002, 2003, 2004, 2005 +;; Free Software Foundation, Inc. ;; Author: Georges Brun-Cottan <Georges.Brun-Cottan@inria.fr> ;; Maintainer: Stefan Monnier <monnier@gnu.org> @@ -152,8 +153,8 @@ For example, you could write (unless group ;; We might as well provide a best-guess default group. (setq group - `(:group ',(or (custom-current-group) - (intern (replace-regexp-in-string + `(:group (or (custom-current-group) + ',(intern (replace-regexp-in-string "-mode\\'" "" mode-name)))))) `(progn @@ -253,8 +254,9 @@ With zero or negative ARG turn mode off. ;;; ;;;###autoload -(defmacro easy-mmode-define-global-mode (global-mode mode turn-on - &rest keys) +(defalias 'easy-mmode-define-global-mode 'define-global-minor-mode) +;;;###autoload +(defmacro define-global-minor-mode (global-mode mode turn-on &rest keys) "Make GLOBAL-MODE out of the buffer-local minor MODE. 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. @@ -278,8 +280,8 @@ KEYS is a list of CL-style keyword arguments: (unless group ;; We might as well provide a best-guess default group. (setq group - `(:group ',(or (custom-current-group) - (intern (replace-regexp-in-string + `(:group (or (custom-current-group) + ',(intern (replace-regexp-in-string "-mode\\'" "" (symbol-name mode))))))) `(progn diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index bc868759d92..f31dafb7b11 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -1,6 +1,7 @@ ;;; eldoc.el --- show function arglist or variable docstring in echo area -;; Copyright (C) 1996, 97, 98, 99, 2000, 2003 Free Software Foundation, Inc. +;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2003, 2005 +;; Free Software Foundation, Inc. ;; Author: Noah Friedman <friedman@splode.com> ;; Maintainer: friedman@splode.com @@ -150,7 +151,7 @@ If point is over a documented variable, print that variable's docstring instead. With prefix ARG, turn ElDoc mode on if and only if ARG is positive." - nil eldoc-minor-mode-string nil + :group 'eldoc :lighter eldoc-minor-mode-string (setq eldoc-last-message nil) (if eldoc-mode (progn |