branch: externals/consult commit c407a73b1377ebc76ef6e1104428868abb0e5926 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
consult-info: Use current manual if started from within *info* buffer Also populate the future history with the symbol at point. --- README.org | 7 +++++-- consult-info.el | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index 8894c6c9e7..8fc5ade9f6 100644 --- a/README.org +++ b/README.org @@ -343,8 +343,10 @@ their descriptions. #+findex: consult-man - =consult-man=: Find Unix man page, via Unix =apropos= or =man -k=. =consult-man= opens the selected man page using the Emacs =man= command. -- =consult-info=: Full text search through info pages. You may want to create your - own commands which search through a predefined set of info pages, for example: +- =consult-info=: Full text search through info pages. If the command is invoked + from within an ~*info*~ buffer, it will search through the current manual. You + may want to create your own commands which search through a predefined set of + info pages, for example: #+begin_src emacs-lisp (defun consult-info-emacs () "Search through Emacs info pages." @@ -775,6 +777,7 @@ configuration examples. ("C-c k" . consult-kmacro) ("C-c m" . consult-man) ("C-c i" . consult-info) + ([remap Info-search] . consult-info) ;; C-x bindings (ctl-x-map) ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command ("C-x b" . consult-buffer) ;; orig. switch-to-buffer diff --git a/consult-info.el b/consult-info.el index 2791d7039e..cc0fe3122b 100644 --- a/consult-info.el +++ b/consult-info.el @@ -127,7 +127,8 @@ (defun consult-info (&rest manuals) "Full text search through info MANUALS." (interactive - (progn + (if Info-current-file + (list (file-name-base Info-current-file)) (info-initialize) (completing-read-multiple "Info Manuals: " @@ -158,6 +159,7 @@ :history '(:input consult-info--history) :group #'consult-info--group :initial (consult--async-split-initial "") + :add-history (consult--async-split-thingatpt 'symbol) :lookup #'consult--lookup-member)) (dolist (buf buffers) (kill-buffer (cdr buf))))))