X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/194959c7004fd196285029efca0ace1f5401a851..d365421f859f6c88e3dc4b610c87adaef3cb099c:/lisp/help.el diff --git a/lisp/help.el b/lisp/help.el index e45061536a..c3dfc518aa 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -621,7 +621,9 @@ It can also be nil, if the definition is not associated with any file." (vectorp def)) "a keyboard macro") ((subrp def) - (concat beg "built-in function")) + (if (eq 'unevalled (cdr (subr-arity def))) + (concat beg "special form") + (concat beg "built-in function"))) ((byte-code-function-p def) (concat beg "compiled Lisp function")) ((symbolp def) @@ -716,19 +718,35 @@ It can also be nil, if the definition is not associated with any file." (if doc (progn (terpri) (princ doc) - (with-current-buffer standard-output - (beginning-of-line) - ;; Builtins get the calling sequence at the end of - ;; the doc string. Move it to the same place as - ;; for other functions. - (when (looking-at (format "(%S[ )]" function)) - (let ((start (point-marker))) - (goto-char (point-min)) - (forward-paragraph) - (insert-buffer-substring (current-buffer) start) - (insert ?\n) - (delete-region (1- start) (point-max)) - (goto-char (point-max))))) + (if (subrp (symbol-function function)) + (with-current-buffer standard-output + (beginning-of-line) + ;; Builtins get the calling sequence at the end of + ;; the doc string. Move it to the same place as + ;; for other functions. + + ;; In cases where `function' has been fset to a + ;; subr we can't search for function's name in + ;; the doc string. Kluge round that using the + ;; printed representation. The arg list then + ;; shows the wrong function name, but that + ;; might be a useful hint. + (let* ((rep (prin1-to-string def)) + (name (progn + (string-match " \\([^ ]+\\)>$" rep) + (match-string 1 rep)))) + (if (looking-at (format "(%s[ )]" name)) + (let ((start (point-marker))) + (goto-char (point-min)) + (forward-paragraph) + (insert-buffer-substring (current-buffer) start) + (insert ?\n) + (delete-region (1- start) (point-max))) + (goto-char (point-min)) + (forward-paragraph) + (insert + "[Missing arglist. Please make a bug report.]\n"))) + (goto-char (point-max)))) (help-setup-xref (list #'describe-function function) interactive-p)) (princ "not documented"))))) @@ -829,13 +847,16 @@ Returns the documentation as a string, also." (set-buffer standard-output) (if (> (count-lines (point-min) (point-max)) 10) (progn + ;; Note that setting the syntax table like below + ;; makes forward-sexp move over a `'s' at the end + ;; of a symbol. (set-syntax-table emacs-lisp-mode-syntax-table) (goto-char (point-min)) (if valvoid (forward-line 1) (forward-sexp 1) (delete-region (point) (progn (end-of-line) (point))) - (insert "'s value is shown below.\n\n") + (insert " value is shown below.\n\n") (save-excursion (insert "\n\nValue:")))))) (princ "Documentation:")