[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/help-fns.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/help-fns.el |
Date: |
Mon, 19 Aug 2002 17:23:08 -0400 |
Index: emacs/lisp/help-fns.el
diff -c emacs/lisp/help-fns.el:1.22 emacs/lisp/help-fns.el:1.23
*** emacs/lisp/help-fns.el:1.22 Wed Aug 14 21:38:45 2002
--- emacs/lisp/help-fns.el Mon Aug 19 17:23:08 2002
***************
*** 162,183 ****
;; Return the text we displayed.
(buffer-string))))))
! (defun help-split-fundoc (doc &optional def)
"Split a function docstring DOC into the actual doc and the usage info.
! Return (USAGE . DOC) or nil if there's no usage info."
! ;; Builtins get the calling sequence at the end of the doc string.
;; 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.
(when doc
! (let* ((rep (prin1-to-string def))
(name (if (string-match " \\([^ ]+\\)>$" rep)
! (match-string 1 rep) rep)))
! (if (string-match (format "\n\n\\((\\(fn\\|%s\\)\\( .*\\)?)\\)\\'"
(regexp-quote name))
doc)
! (cons (match-string 1 doc)
(substring doc 0 (match-beginning 0)))))))
(defun help-function-arglist (def)
--- 162,186 ----
;; Return the text we displayed.
(buffer-string))))))
! (defun help-split-fundoc (doc def)
"Split a function docstring DOC into the actual doc and the usage info.
! Return (USAGE . DOC) or nil if there's no usage info.
! DEF is the function whose usage we're looking for in DOC."
! ;; Functions can get the calling sequence at the end of the doc string.
;; In cases where `function' has been fset to a subr we can't search for
! ;; function's name in the doc string so we use `fn' as the anonymous
! ;; function name instead.
(when doc
! (let* ((rep (prin1-to-string (indirect-function def)))
(name (if (string-match " \\([^ ]+\\)>$" rep)
! (match-string 1 rep) (prin1-to-string def))))
! (if (string-match (format "\n\n(\\(fn\\|%s\\)\\(\\( .*\\)?)\\)\\'"
(regexp-quote name))
doc)
! (cons (format "(%s%s"
! ;; Replace `fn' with the actual function name.
! (if (consp def) "anonymous" def)
! (match-string 2 doc))
(substring doc 0 (match-beginning 0)))))))
(defun help-function-arglist (def)
***************
*** 195,201 ****
(defun help-make-usage (function arglist)
(cons (if (symbolp function) function 'anonymous)
(mapcar (lambda (arg)
! (if (not (symbolp arg)) arg
(let ((name (symbol-name arg)))
(if (string-match "\\`&" name) arg
(intern (upcase name))))))
--- 198,209 ----
(defun help-make-usage (function arglist)
(cons (if (symbolp function) function 'anonymous)
(mapcar (lambda (arg)
! (if (not (symbolp arg))
! (if (and (consp arg) (symbolp (car arg)))
! ;; CL style default values for optional args.
! (cons (intern (upcase (symbol-name (car arg))))
! (cdr arg))
! arg)
(let ((name (symbol-name arg)))
(if (string-match "\\`&" name) arg
(intern (upcase name))))))
***************
*** 295,305 ****
(when (or remapped keys)
(princ ".")
(terpri))))
- ;; Handle symbols aliased to other symbols.
- (setq def (indirect-function def))
(let* ((arglist (help-function-arglist def))
(doc (documentation function))
! (usage (help-split-fundoc doc def)))
;; If definition is a keymap, skip arglist note.
(unless (keymapp def)
(princ (cond
--- 303,311 ----
(when (or remapped keys)
(princ ".")
(terpri))))
(let* ((arglist (help-function-arglist def))
(doc (documentation function))
! (usage (help-split-fundoc doc function)))
;; If definition is a keymap, skip arglist note.
(unless (keymapp def)
(princ (cond
***************
*** 312,318 ****
(setq fun (symbol-function fun))
(not (setq usage (help-split-fundoc
(documentation fun)
! def)))))
usage)
(car usage))
(t "[Missing arglist. Please make a bug report.]")))
--- 318,324 ----
(setq fun (symbol-function fun))
(not (setq usage (help-split-fundoc
(documentation fun)
! function)))))
usage)
(car usage))
(t "[Missing arglist. Please make a bug report.]")))
***************
*** 392,400 ****
(pp val)
(help-xref-on-pp from (point))
(if (< (point) (+ from 20))
! (save-excursion
! (goto-char from)
! (delete-char -1))))))
(terpri)
(when (local-variable-p variable)
(princ (format "Local in buffer %s; " (buffer-name)))
--- 398,404 ----
(pp val)
(help-xref-on-pp from (point))
(if (< (point) (+ from 20))
! (delete-region (1- from) from)))))
(terpri)
(when (local-variable-p variable)
(princ (format "Local in buffer %s; " (buffer-name)))