add tunable for using either man or woman
This commit is contained in:
parent
5b6898630d
commit
ac11adf599
18
systemd.el
18
systemd.el
@ -57,6 +57,13 @@
|
|||||||
(string :tag "Semicolon" ";"))
|
(string :tag "Semicolon" ";"))
|
||||||
:group 'systemd)
|
:group 'systemd)
|
||||||
|
|
||||||
|
(defcustom systemd-man-function 'man
|
||||||
|
"Pager to use for system manual pages."
|
||||||
|
:type '(radio (function-item man)
|
||||||
|
(function-item woman)
|
||||||
|
(function :tag "Other function"))
|
||||||
|
:group 'systemd)
|
||||||
|
|
||||||
(defcustom systemd-use-company-p t
|
(defcustom systemd-use-company-p t
|
||||||
"Whether to use `company-mode' for completion, if available."
|
"Whether to use `company-mode' for completion, if available."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
@ -106,6 +113,13 @@ as a list of strings, otherwise nil."
|
|||||||
(when string
|
(when string
|
||||||
(split-string string))))
|
(split-string string))))
|
||||||
|
|
||||||
|
(defun systemd-doc-man (page)
|
||||||
|
"Open a manual page with `systemd-man-function'."
|
||||||
|
(pcase (symbol-name systemd-man-function)
|
||||||
|
("woman" (woman (replace-regexp-in-string "([[:alnum:]]+)" "" page)))
|
||||||
|
("man" (man page))
|
||||||
|
(_ (apply 'systemd-man-function page))))
|
||||||
|
|
||||||
(defun systemd-doc-open (url)
|
(defun systemd-doc-open (url)
|
||||||
"Open URL. Interactively completes the documentation in the
|
"Open URL. Interactively completes the documentation in the
|
||||||
current unit file, defaulting to the link under point, if any."
|
current unit file, defaulting to the link under point, if any."
|
||||||
@ -120,7 +134,7 @@ current unit file, defaulting to the link under point, if any."
|
|||||||
(let ((link (url-generic-parse-url url)))
|
(let ((link (url-generic-parse-url url)))
|
||||||
(pcase (url-type link)
|
(pcase (url-type link)
|
||||||
("file" (find-file (url-filename link)))
|
("file" (find-file (url-filename link)))
|
||||||
("man" (url-man link))
|
("man" (systemd-doc-man (url-filename link)))
|
||||||
("info" (url-info link))
|
("info" (url-info link))
|
||||||
((or "http" "https") (funcall systemd-browse-url-function url))
|
((or "http" "https") (funcall systemd-browse-url-function url))
|
||||||
(_ (user-error "Invalid link")))))
|
(_ (user-error "Invalid link")))))
|
||||||
@ -128,7 +142,7 @@ current unit file, defaulting to the link under point, if any."
|
|||||||
(defun systemd-doc-directives ()
|
(defun systemd-doc-directives ()
|
||||||
"Open systemd.directives(7)"
|
"Open systemd.directives(7)"
|
||||||
(interactive)
|
(interactive)
|
||||||
(man "systemd.directives(7)"))
|
(systemd-doc-man "systemd.directives(7)"))
|
||||||
|
|
||||||
(defvar systemd-mode-syntax-table
|
(defvar systemd-mode-syntax-table
|
||||||
(let ((table (make-syntax-table)))
|
(let ((table (make-syntax-table)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user