branch: elpa/boxquote
commit 3da429f64d56a4c717c3d232934e406012bc6336
Author: Dave Pearson <[email protected]>
Commit: Dave Pearson <[email protected]>
Rewrite boxquote-describe-variable
No more dumpster-diving the input history just to get the variable name.
See #3 for more information.
---
boxquote.el | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/boxquote.el b/boxquote.el
index 1c1725161d..619ace8a61 100644
--- a/boxquote.el
+++ b/boxquote.el
@@ -426,17 +426,20 @@ ITEM is a function for retrieving the item to get help
on."
(boxquote-title (format boxquote-describe-function-title-format function)))
;;;###autoload
-(defun boxquote-describe-variable ()
+(defun boxquote-describe-variable (variable)
"Call `describe-variable' and boxquote the output into the current buffer."
- (interactive)
- (boxquote-quote-help-buffer
- #'(lambda ()
- (call-interactively #'describe-variable))
- boxquote-describe-variable-title-format
- #'(lambda ()
- (car (if (boxquote-xemacs-p)
- (symbol-value 'variable-history)
- minibuffer-history)))))
+ (interactive
+ (list
+ (completing-read "Describe variable: " obarray
+ #'(lambda (v)
+ (or (get v 'variable-documentation)
+ (and (boundp v) (not (keywordp v)))))
+ t nil nil)))
+ (boxquote-text
+ (save-window-excursion
+ (substring-no-properties
+ (describe-variable (intern variable)))))
+ (boxquote-title (format boxquote-describe-variable-title-format variable)))
;;;###autoload
(defun boxquote-describe-key (key)