summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-03-11 15:04:22 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-03-11 15:04:22 -0500
commitba83908c4b7fda12991ae9073028a60da87c1fa2 (patch)
treef3ebf09f2af4f22ee21a3af2b184181c25d69bf6 /lisp/help-fns.el
parent9ace101ce2e22c85a4298f20702e9b79ae03ad1f (diff)
downloademacs-ba83908c4b7fda12991ae9073028a60da87c1fa2.tar.gz
Misc fixes, and use lexical-binding in more files.
* lisp/subr.el (letrec): New macro. (with-wrapper-hook): Move from lisp/simple.el and don't use CL. * simple.el (with-wrapper-hook): Move with-wrapper-hook to subr.el. * lisp/help-fns.el (help-function-arglist): Handle subroutines as well. (describe-variable): Use special-variable-p to filter completions. * lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Don't expand `declare' in defmacros. * lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form): Handle `declare'. * lisp/emacs-lisp/cl.el (pushnew): Silence unfixable warning. * lisp/emacs-lisp/cl-macs.el (defstruct, define-compiler-macro): Mark unused arg as unused. * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Use memq. * lisp/emacs-lisp/autoload.el (make-autoload): Don't assume the macro's first sexp is a list. (autoload-generate-file-autoloads): Improve error message. * lisp/emacs-lisp/advice.el (ad-arglist): Use help-function-arglist to understand the new byte-code arg format. * lisp/vc/smerge-mode.el: * lisp/vc/log-view.el: * lisp/vc/log-edit.el: * lisp/vc/cvs-status.el: * lisp/uniquify.el: * lisp/textmodes/css-mode.el: * lisp/textmodes/bibtex-style.el: * lisp/reveal.el: * lisp/newcomment.el: * lisp/emacs-lisp/smie.el: * lisp/abbrev.el: Use lexical-binding. * src/eval.c (Fprog1, Fprog2): Simplify and use XCDR/XCAR. (Fdefvar): Remove redundant SYMBOLP check. (Ffunctionp): Don't signal an error for undefined aliases. * doc/lispref/variables.texi (Converting to Lexical Binding): New node.
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el22
1 files changed, 19 insertions, 3 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 35f8c5e8e37..f81505c1cf1 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -124,6 +124,22 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"."
(nreverse arglist)))
((byte-code-function-p def) (aref def 0))
((eq (car-safe def) 'lambda) (nth 1 def))
+ ((subrp def)
+ (let ((arity (subr-arity def))
+ (arglist ()))
+ (dotimes (i (car arity))
+ (push (intern (concat "arg" (number-to-string (1+ i)))) arglist))
+ (cond
+ ((not (numberp (cdr arglist)))
+ (push '&rest arglist)
+ (push 'rest arglist))
+ ((< (car arity) (cdr arity))
+ (push '&optional arglist)
+ (dotimes (i (- (cdr arity) (car arity)))
+ (push (intern (concat "arg" (number-to-string
+ (+ 1 i (car arity)))))
+ arglist))))
+ (nreverse arglist)))
((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap)))
"[Arg list not available until function definition is loaded.]")
(t t)))
@@ -618,9 +634,9 @@ it is displayed along with the global value."
"Describe variable (default %s): " v)
"Describe variable: ")
obarray
- '(lambda (vv)
- (or (boundp vv)
- (get vv 'variable-documentation)))
+ (lambda (vv)
+ (or (special-variable-p vv)
+ (get vv 'variable-documentation)))
t nil nil
(if (symbolp v) (symbol-name v))))
(list (if (equal val "")