From cb3dc484da30271c42bf64bc5cd07ef97796907d Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Wed, 5 Apr 2017 08:29:34 +0100 Subject: Rename Usage to Signature Avoid confusion with References --- helpful.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/helpful.el b/helpful.el index e43f859..9d6a9ad 100644 --- a/helpful.el +++ b/helpful.el @@ -186,8 +186,9 @@ state of the current symbol." (--map (helpful--position-head buf it) positions)))) (erase-buffer) (insert - (format "Usage: %s\n\n" (helpful--usage helpful--sym)) - (helpful--heading "Documentation\n") + (helpful--heading "Signature\n") + (helpful--signature helpful--sym) + (helpful--heading "\n\nDocumentation\n") (or (helpful--docstring helpful--sym) "No docstring.") (helpful--heading "\n\nSymbol Properties\n") @@ -223,16 +224,16 @@ state of the current symbol." arg-str (s-upcase arg-str)))) -(defun helpful--usage (sym) - "Get the usage for SYM, as a string. +(defun helpful--signature (sym) + "Get the signature for function SYM, as a string. For example, \"(some-func FOO &optional BAR)\"." - (let (docstring-usage - source-usage) + (let (docstring-sig + source-sig) ;; Get the usage from the function definition. (let ((formatted-args (-map #'helpful--format-argument (help-function-arglist sym)))) - (setq source-usage + (setq source-sig (if formatted-args (format "(%s %s)" sym (s-join " " formatted-args)) @@ -241,9 +242,9 @@ For example, \"(some-func FOO &optional BAR)\"." ;; If the docstring ends with (fn FOO BAR), extract that. (-when-let (docstring (documentation sym)) (-when-let (docstring-with-usage (help-split-fundoc docstring sym)) - (setq docstring-usage (car docstring-with-usage)))) + (setq docstring-sig (car docstring-with-usage)))) - (or docstring-usage source-usage))) + (or docstring-sig source-sig))) ;; TODO: propertize arguments and add links to `foo' and Info mentions. ;; TODO: add button for searching the manual. -- cgit v1.0