From 863666ebae563a9a83dd8bce54227dfd6f66987d Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 25 Sep 2012 13:33:43 +0800 Subject: [PATCH] Minor fixes for the function obsolescence feature. * lisp/help-fns.el (help-fns--obsolete): Handle macros properly. * lisp/subr.el (declare): Doc fix. --- lisp/ChangeLog | 6 ++++++ lisp/help-fns.el | 16 ++++++++++------ lisp/subr.el | 11 ++++++++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 375fea957c0..090a8bef4e9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-09-25 Chong Yidong + + * subr.el (declare): Doc fix. + + * help-fns.el (help-fns--obsolete): Handle macros properly. + 2012-09-25 Chong Yidong * bookmark.el (bookmark-jump-noselect): Use a declare form to mark diff --git a/lisp/help-fns.el b/lisp/help-fns.el index fa0484ff4e5..7dc7eebb061 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -488,13 +488,17 @@ suitable file is found, return nil." (insert "'.\n")))) (defun help-fns--obsolete (function) - (let* ((obsolete (and - ;; `function' might be a lambda construct. - (symbolp function) - (get function 'byte-obsolete-info))) + ;; Ignore lambda constructs, keyboard macros, etc. + (let* ((obsolete (and (symbolp function) + (get function 'byte-obsolete-info))) (use (car obsolete))) (when obsolete - (insert "\nThis function is obsolete") + (insert "\nThis " + (if (eq (car-safe (symbol-function 'with-current-buffer)) + 'macro) + "macro" + "function") + " is obsolete") (when (nth 2 obsolete) (insert (format " since %s" (nth 2 obsolete)))) (insert (cond ((stringp use) (concat ";\n" use)) @@ -611,7 +615,7 @@ FILE is the file where FUNCTION was probably defined." (fill-region-as-paragraph (save-excursion (goto-char pt1) (forward-line 0) (point)) (point))) (terpri)(terpri) - + (let* ((doc-raw (condition-case err (documentation function t) (error (format "No Doc! %S" err)))) diff --git a/lisp/subr.el b/lisp/subr.el index e5725b3b3fa..8dfe78d8c75 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -271,9 +271,14 @@ the return value (nil if RESULT is omitted). ,@(cdr (cdr spec)))))) (defmacro declare (&rest _specs) - "Do not evaluate any arguments and return nil. -Treated as a declaration when used at the right place in a -`defmacro' form. \(See Info anchor `(elisp)Definition of declare'.)" + "Do not evaluate any arguments, and return nil. +If a `declare' form appears as the first form in the body of a +`defun' or `defmacro' form, SPECS specifies various additional +information about the function or macro; these go into effect +during the evaluation of the `defun' or `defmacro' form. + +The possible values of SPECS are specified by +`defun-declarations-alist' and `macro-declarations-alist'." ;; FIXME: edebug spec should pay attention to defun-declarations-alist. nil) )) -- 2.39.2