diff options
author | stardiviner <numbchild@gmail.com> | 2020-08-14 12:37:42 +0800 |
---|---|---|
committer | Bastien <bzg@gnu.org> | 2020-09-05 10:05:01 +0200 |
commit | 3b10ffc3624d740a4ef71021c286fac11214b8b7 (patch) | |
tree | be3f2e5bc45bae929b91d8dfe523fd4c13f1b5e0 | |
parent | 47105413657dd4986c2402b6250f06e56530b644 (diff) | |
download | org-mode-3b10ffc3624d740a4ef71021c286fac11214b8b7.tar.gz |
ol-man.el: Add searching support in man page buffer
* contrib/lisp/ol-man.el (org-man-open): Support auto searching man page
buffer with search-forward.
-rw-r--r-- | contrib/lisp/ol-man.el | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/lisp/ol-man.el b/contrib/lisp/ol-man.el index 5cb7e01..b21ed9e 100644 --- a/contrib/lisp/ol-man.el +++ b/contrib/lisp/ol-man.el @@ -37,8 +37,17 @@ (defun org-man-open (path _) "Visit the manpage on PATH. -PATH should be a topic that can be thrown at the man command." - (funcall org-man-command path)) +PATH should be a topic that can be thrown at the man command. +If PATH contains extra ::STRING which will use `occur' to search +matched strings in man buffer." + (string-match "\\(.*?\\)\\(?:::\\(.*\\)\\)?$" path) + (let* ((command (match-string 1 path)) + (search (match-string 2 path))) + (funcall org-man-command command) + (when search + (with-current-buffer (concat "*Man " command "*") + (goto-char (point-min)) + (search-forward search))))) (defun org-man-store-link () "Store a link to a README file." |