diff options
| author | Erik Arvstedt <erik.arvstedt@gmail.com> | 2019-03-12 22:36:08 +0100 |
|---|---|---|
| committer | Wilfred Hughes <me@wilfred.me.uk> | 2019-06-22 19:54:53 +0100 |
| commit | b0cd36e8f0caaddeacb3933e6111842b6560d9c9 (patch) | |
| tree | f963ce64adb99069ce383dd8c9e6ea74a24a45de | |
| parent | 9a552f0c7c20eefae09a9283be98d56dc3e20fd8 (diff) | |
Show if a function is compiled
Include this info like in `describe-function`
| -rw-r--r-- | helpful.el | 52 |
1 files changed, 35 insertions, 17 deletions
@@ -1766,6 +1766,11 @@ OBJ may be a symbol or a compiled function object." (setq file-name (s-chop-suffix ".gz" file-name)) (help-fns--autoloaded-p sym file-name))) +(defun helpful--compiled-p (sym) + "Return non-nil if function SYM is byte-compiled" + (and (symbolp sym) + (byte-code-function-p (symbol-function sym)))) + (defun helpful--summary (sym callable-p buf pos) "Return a one sentence summary for SYM." (-let* ((primitive-p (helpful--primitive-p sym callable-p)) @@ -1804,6 +1809,11 @@ OBJ may be a symbol or a compiled function object." "autoloaded" 'helpful-info-button 'info-node "(elisp)Autoload")) + (compiled-button + (helpful--button + "compiled" + 'helpful-info-button + 'info-node "(elisp)Byte Compilation")) (buffer-local-button (helpful--button "buffer-local" @@ -1811,24 +1821,32 @@ OBJ may be a symbol or a compiled function object." 'info-node "(elisp)Buffer-Local Variables")) (autoloaded-p (and callable-p buf (helpful--autoloaded-p sym buf))) + (compiled-p + (and callable-p (helpful--compiled-p sym))) (description - (cond - (alias-p - (format "%s %s" - (if callable-p "a" "an") - alias-button)) - ((and callable-p (commandp sym) autoloaded-p) - (format "an %s, %s" interactive-button autoload-button)) - ((helpful--kbd-macro-p sym) "a") - ((and callable-p (commandp sym)) - (format "an %s" interactive-button)) - ((and callable-p autoloaded-p) - (format "an %s" autoload-button)) - ((and (not callable-p) - (local-variable-if-set-p sym)) - (format "a %s" buffer-local-button)) - (t - "a"))) + (concat + (cond + (alias-p + (format "%s %s" + (if callable-p "a" "an") + alias-button)) + ((and callable-p (commandp sym) autoloaded-p) + (format "an %s, %s" interactive-button autoload-button)) + ((helpful--kbd-macro-p sym) "a") + ((and callable-p (commandp sym)) + (format "an %s" interactive-button)) + ((and callable-p autoloaded-p) + (format "an %s" autoload-button)) + ((and (not callable-p) + (local-variable-if-set-p sym)) + (format "a %s" buffer-local-button)) + (t + "a")) + (if compiled-p + (format "%s %s" + (if (or (commandp sym) autoloaded-p) "," "") + compiled-button)) + "")) (kind (cond ((special-form-p sym) |
