summaryrefslogtreecommitdiff
path: root/helm-man.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2013-09-11 15:14:25 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2013-09-11 15:14:25 +0200
commit3673dba34d2c8b0ba873b46bb5a79a946befc593 (patch)
tree9b789de0b176460db8b85211fbd2a01e18d3a002 /helm-man.el
parent1796c196bcd48917aa58c42ca3345ee3e5b475a3 (diff)
* helm-man.el (helm-man-or-woman-function): Issue #285 New user function.
(helm-man-default-action): Use it.
Diffstat (limited to 'helm-man.el')
-rw-r--r--helm-man.el36
1 files changed, 25 insertions, 11 deletions
diff --git a/helm-man.el b/helm-man.el
index 4c1be62b..f202e79b 100644
--- a/helm-man.el
+++ b/helm-man.el
@@ -24,6 +24,17 @@
(declare-function Man-getpage-in-background "man.el" (topic))
(declare-function helm-generic-sort-fn "helm-utils.el" (S1 S2))
+(defgroup helm-man nil
+ "Man and Woman applications for helm."
+ :group 'helm)
+
+(defcustom helm-man-or-woman-function 'Man-getpage-in-background
+ "Default command to display a man page."
+ :group 'helm-man
+ :type '(radio :tag "Preferred command to display a man page"
+ (const :tag "Man" Man-getpage-in-background)
+ (const :tag "Woman" woman)))
+
;; Internal
(defvar helm-man-pages nil
"All man pages on system.
@@ -32,17 +43,20 @@ 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 err
- (if (> (length wfiles) 1)
- (woman-find-file
- (helm-comp-read
- "ManFile: " wfiles :must-match t))
- (woman candidate))
- ;; If woman is unable to format correctly
- ;; use man instead.
- (error (kill-buffer) ; Kill woman buffer.
- (Man-getpage-in-background candidate)))))
+ (if (eq helm-man-or-woman-function 'Man-getpage-in-background)
+ (funcall helm-man-or-woman-function candidate)
+ (let ((wfiles (mapcar
+ 'car (woman-file-name-all-completions candidate))))
+ (condition-case err
+ (if (> (length wfiles) 1)
+ (woman-find-file
+ (helm-comp-read
+ "ManFile: " wfiles :must-match t))
+ (woman candidate))
+ ;; If woman is unable to format correctly
+ ;; use man instead.
+ (error (kill-buffer) ; Kill woman buffer.
+ (Man-getpage-in-background candidate))))))
(defvar helm-source-man-pages
'((name . "Manual Pages")