emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 13b9f6b: Make elisp- and emacs-index-search and def


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 13b9f6b: Make elisp- and emacs-index-search and default to the thing under point
Date: Mon, 30 Sep 2019 02:57:54 -0400 (EDT)

branch: master
commit 13b9f6b6a06b5d8548ed2ee2f835605fefef0571
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Make elisp- and emacs-index-search and default to the thing under point
    
    * lisp/menu-bar.el (elisp-index-search): Default to the thing
    under point interactively (bug#1119).
    (emacs-index-search): Ditto.
    (emacs-index--prompt): New helper function.
---
 lisp/menu-bar.el | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 389234e..1912212 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1761,15 +1761,28 @@ key, a click, or a menu-item"))
   (interactive)
   (info "(emacs)Glossary"))
 
+(defun emacs-index--prompt ()
+  (let* ((default (thing-at-point 'sexp))
+         (topic
+          (read-from-minibuffer
+           (format "Subject to look up%s: "
+                   (if default
+                       (format " (default \"%s\")" default)
+                     ""))
+           nil nil nil nil default)))
+    (list (if (zerop (length topic))
+              default
+            topic))))
+
 (defun emacs-index-search (topic)
   "Look up TOPIC in the indices of the Emacs User Manual."
-  (interactive "sSubject to look up: ")
+  (interactive (emacs-index--prompt))
   (info "emacs")
   (Info-index topic))
 
 (defun elisp-index-search (topic)
   "Look up TOPIC in the indices of the Emacs Lisp Reference Manual."
-  (interactive "sSubject to look up: ")
+  (interactive (emacs-index--prompt))
   (info "elisp")
   (Info-index topic))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]