diff options
| author | Lars Ingebrigtsen | 2019-09-30 08:57:45 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-09-30 08:57:45 +0200 |
| commit | 13b9f6b6a06b5d8548ed2ee2f835605fefef0571 (patch) | |
| tree | cb4f61de65a1055ca8bdde3ac014437f57a5c36a | |
| parent | 5d33839c3fc40308cd29dbd0991888ead81fbfa7 (diff) | |
| download | emacs-13b9f6b6a06b5d8548ed2ee2f835605fefef0571.tar.gz emacs-13b9f6b6a06b5d8548ed2ee2f835605fefef0571.zip | |
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.
| -rw-r--r-- | lisp/menu-bar.el | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 389234e9751..19122125c53 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -1761,15 +1761,28 @@ key, a click, or a menu-item")) | |||
| 1761 | (interactive) | 1761 | (interactive) |
| 1762 | (info "(emacs)Glossary")) | 1762 | (info "(emacs)Glossary")) |
| 1763 | 1763 | ||
| 1764 | (defun emacs-index--prompt () | ||
| 1765 | (let* ((default (thing-at-point 'sexp)) | ||
| 1766 | (topic | ||
| 1767 | (read-from-minibuffer | ||
| 1768 | (format "Subject to look up%s: " | ||
| 1769 | (if default | ||
| 1770 | (format " (default \"%s\")" default) | ||
| 1771 | "")) | ||
| 1772 | nil nil nil nil default))) | ||
| 1773 | (list (if (zerop (length topic)) | ||
| 1774 | default | ||
| 1775 | topic)))) | ||
| 1776 | |||
| 1764 | (defun emacs-index-search (topic) | 1777 | (defun emacs-index-search (topic) |
| 1765 | "Look up TOPIC in the indices of the Emacs User Manual." | 1778 | "Look up TOPIC in the indices of the Emacs User Manual." |
| 1766 | (interactive "sSubject to look up: ") | 1779 | (interactive (emacs-index--prompt)) |
| 1767 | (info "emacs") | 1780 | (info "emacs") |
| 1768 | (Info-index topic)) | 1781 | (Info-index topic)) |
| 1769 | 1782 | ||
| 1770 | (defun elisp-index-search (topic) | 1783 | (defun elisp-index-search (topic) |
| 1771 | "Look up TOPIC in the indices of the Emacs Lisp Reference Manual." | 1784 | "Look up TOPIC in the indices of the Emacs Lisp Reference Manual." |
| 1772 | (interactive "sSubject to look up: ") | 1785 | (interactive (emacs-index--prompt)) |
| 1773 | (info "elisp") | 1786 | (info "elisp") |
| 1774 | (Info-index topic)) | 1787 | (Info-index topic)) |
| 1775 | 1788 | ||