diff options
author | Daniel Xia <daniel.f.xia@gmail.com> | 2017-01-29 20:14:05 -0800 |
---|---|---|
committer | Daniel Xia <daniel.f.xia@gmail.com> | 2017-02-01 20:46:11 -0800 |
commit | 26f2e1e0e4281f63d1c3738492f507be027906c0 (patch) | |
tree | 7d1dba97010a5b0f3ec73d407a6dbff9f54dd668 /helm-man.el | |
parent | 74a0c4d17a970ebd2271453681d5633e55c3b00b (diff) |
Fix helm-man-woman in failures of man and woman
Changes:
- Pass absolute man file path to `man' without -l flag.
- When woman fails, the selected man section is retained. This fixes
the undesired behavior that only the topic is passed to `man' after
such a failure.
The rationale behind the first change is that in BSD, man has no -l
option. Since the file name passed to man is generated from a woman
helper function, it is extremely unlikely to resemble a page
name. (see Help on `man')
Diffstat (limited to 'helm-man.el')
-rw-r--r-- | helm-man.el | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/helm-man.el b/helm-man.el index 436c419f..146d975f 100644 --- a/helm-man.el +++ b/helm-man.el @@ -60,20 +60,18 @@ source.") (defun helm-man-default-action (candidate) "Default action for jumping to a woman or man page from helm." - (let ((wfiles (mapcar - 'car (woman-file-name-all-completions candidate)))) - (condition-case nil - (if (> (length wfiles) 1) - (let ((file (helm-comp-read - "ManFile: " wfiles :must-match t))) - (if (eq helm-man-or-woman-function 'Man-getpage-in-background) - (manual-entry (format helm-man-format-switches file)) - (woman-find-file file))) - (funcall helm-man-or-woman-function candidate)) - ;; If woman is unable to format correctly - ;; use man instead. - (error (kill-buffer) ; Kill woman buffer. - (Man-getpage-in-background candidate))))) + (let ((wfiles (mapcar #'car (woman-file-name-all-completions candidate)))) + (let ((file (if (> (length wfiles) 1) + (helm-comp-read "ManFile: " wfiles :must-match t) + (car wfiles)))) + (if (eq helm-man-or-woman-function 'Man-getpage-in-background) + (man file) + (condition-case nil + (woman-find-file file) + ;; If woman is unable to format correctly + ;; use man instead. + (error (kill-buffer) + (man file))))))) (defun helm-man--init () (require 'woman) |