diff options
| author | Noam Postavsky | 2020-09-25 13:39:24 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-09-25 13:39:24 +0200 |
| commit | 9fd9c9c2c00a95640b32b63dc20041ec6d512f0b (patch) | |
| tree | 709729fce8836de1684887723fd020784e1b9694 | |
| parent | 830e876d94a8cfc5a516e7fcd867525754508cf3 (diff) | |
| download | emacs-9fd9c9c2c00a95640b32b63dc20041ec6d512f0b.tar.gz emacs-9fd9c9c2c00a95640b32b63dc20041ec6d512f0b.zip | |
Make the Man completion code work better if man -k fails
* lisp/man.el (Man-completion-table): Check the return code for
"man -k" and assume it failed if there's a non-zero exit code
(bug#16722).
| -rw-r--r-- | lisp/man.el | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/man.el b/lisp/man.el index 5ee60cae9f3..bd55d7eff06 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -927,15 +927,18 @@ foo(sec)[, bar(sec) [, ...]] [other stuff] - description" | |||
| 927 | ;; run differently in Man-getpage-in-background, an error | 927 | ;; run differently in Man-getpage-in-background, an error |
| 928 | ;; here may not necessarily mean that we'll also get an | 928 | ;; here may not necessarily mean that we'll also get an |
| 929 | ;; error later. | 929 | ;; error later. |
| 930 | (ignore-errors | 930 | (when (eq 0 |
| 931 | (call-process manual-program nil '(t nil) nil | 931 | (ignore-errors |
| 932 | "-k" (concat (when (or Man-man-k-use-anchor | 932 | (call-process |
| 933 | (string-equal prefix "")) | 933 | manual-program nil '(t nil) nil |
| 934 | "^") | 934 | "-k" (concat (when (or Man-man-k-use-anchor |
| 935 | prefix)))) | 935 | (string-equal prefix "")) |
| 936 | (setq table (Man-parse-man-k))) | 936 | "^") |
| 937 | prefix)))) | ||
| 938 | (setq table (Man-parse-man-k))))) | ||
| 937 | ;; Cache the table for later reuse. | 939 | ;; Cache the table for later reuse. |
| 938 | (setq Man-completion-cache (cons prefix table))) | 940 | (when table |
| 941 | (setq Man-completion-cache (cons prefix table)))) | ||
| 939 | ;; The table may contain false positives since the match is made | 942 | ;; The table may contain false positives since the match is made |
| 940 | ;; by "man -k" not just on the manpage's name. | 943 | ;; by "man -k" not just on the manpage's name. |
| 941 | (if section | 944 | (if section |