summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2012-06-11 16:35:00 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2012-06-11 16:35:00 -0400
commit71adb94b713138836225744c8ed9281b558e2c51 (patch)
treead614df00327a48008f751e1e54dc1c9c7d98b2c /lisp/help-fns.el
parenta66744021faeb2ce105b1001a380c4a46384c5f4 (diff)
downloademacs-71adb94b713138836225744c8ed9281b558e2c51.tar.gz
Fix compiler-expansion of CL's cXXr functions.
* emacs-lisp/cl-lib.el (cl--defalias): New function. (cl-values, cl-values-list, cl-copy-seq, cl-svref, cl-first) (cl-second, cl-rest, cl-endp, cl-third, cl-fourth): Use it. (cl-plusp, cl-minusp, cl-fifth, cl-sixth, cl-seventh, cl-eighth) (cl-ninth, cl-tenth): Mark them as inlinable. (cl-caaar, cl-caadr, cl-cadar, cl-caddr, cl-cdaar, cl-cdadr) (cl-cddar, cl-cdddr, cl-caaaar, cl-caaadr, cl-caadar, cl-caaddr) (cl-cadaar, cl-cadadr, cl-caddar, cl-cadddr, cl-cdaaar, cl-cdaadr) (cl-cdadar, cl-cdaddr, cl-cddaar, cl-cddadr, cl-cdddar, cl-cddddr): Add a compiler-macro declaration to use cl--compiler-macro-cXXr. (cl-list*, cl-adjoin): Don't put an autoload manually. * emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin) (cl--compiler-macro-list*): Add autoload cookie. (cl--compiler-macro-cXXr): New function. * help-fns.el (help-fns--compiler-macro): New function extracted from describe-function-1; follow aliases and use `compiler-macro' property. (describe-function-1): Use it. Fixes: debbugs:11673
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el36
1 files changed, 22 insertions, 14 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 357bc6a77f6..72b494f9800 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -380,6 +380,27 @@ suitable file is found, return nil."
(declare-function ad-get-advice-info "advice" (function))
+(defun help-fns--compiler-macro (function)
+ (let ((handler nil))
+ ;; FIXME: Copied from macroexp.el.
+ (while (and (symbolp function)
+ (not (setq handler (get function 'compiler-macro)))
+ (fboundp function))
+ ;; Follow the sequence of aliases.
+ (setq function (symbol-function function)))
+ (when handler
+ (princ "This function has a compiler macro")
+ (let ((lib (get function 'compiler-macro-file)))
+ ;; FIXME: rather than look at the compiler-macro-file property,
+ ;; just look at `handler' itself.
+ (when (stringp lib)
+ (princ (format " in `%s'" lib))
+ (with-current-buffer standard-output
+ (save-excursion
+ (re-search-backward "`\\([^`']+\\)'" nil t)
+ (help-xref-button 1 'help-function-cmacro function lib)))))
+ (princ ".\n\n"))))
+
;;;###autoload
(defun describe-function-1 (function)
(let* ((advised (and (symbolp function) (featurep 'advice)
@@ -509,20 +530,7 @@ suitable file is found, return nil."
(fill-region-as-paragraph pt2 (point))
(unless (looking-back "\n\n")
(terpri)))))
- ;; Note that list* etc do not get this property until
- ;; cl--hack-byte-compiler runs, after bytecomp is loaded.
- (when (and (symbolp function)
- (eq (get function 'byte-compile)
- 'cl-byte-compile-compiler-macro))
- (princ "This function has a compiler macro")
- (let ((lib (get function 'compiler-macro-file)))
- (when (stringp lib)
- (princ (format " in `%s'" lib))
- (with-current-buffer standard-output
- (save-excursion
- (re-search-backward "`\\([^`']+\\)'" nil t)
- (help-xref-button 1 'help-function-cmacro function lib)))))
- (princ ".\n\n"))
+ (help-fns--compiler-macro function)
(let* ((advertised (gethash def advertised-signature-table t))
(arglist (if (listp advertised)
advertised (help-function-arglist def)))