This commit is contained in:
Mark Oteiza 2015-09-20 23:05:39 -04:00
parent 6071c2349c
commit 175d45fee6
2 changed files with 14 additions and 13 deletions

View File

@ -148,13 +148,13 @@
(systemd-company--setup-company enable)))
(defun systemd-company-section-p ()
"Return t if current line begins with \"[\", otherwise nil"
"Return t if current line begins with \"[\", otherwise nil."
(save-excursion
(beginning-of-line)
(looking-at "\\[")))
(defun systemd-company-network-p ()
"Return non-nil if `buffer-name' has a network-type extension, otherwise nil"
"Return non-nil if `buffer-name' has a network-type extension, otherwise nil."
(string-match "\\.\\(link\\|netdev\\|network\\)\\'" (buffer-name)))
(with-eval-after-load "company"

View File

@ -90,13 +90,13 @@
;; exec prefixes
("=\\(-@\\|@-\\|[@-]\\)"
1 'font-lock-negation-char-face))
"Default expressions to highlight in `systemd-mode'. See systemd.unit(5)
for details on unit file syntax.")
"Default expressions to highlight in `systemd-mode'.
See systemd.unit(5) for details on unit file syntax.")
(defun systemd-get-value (start)
"Joins lines in the key value starting at buffer position START,
possibly broken by a backslash, and returns a string containing
the value."
"Return the value of the key whose value begins at position START.
Lines ending in a backslash are concatenated with the next
according to systemd.unit(5)."
(let ((break "\\\\\n")
end)
(save-excursion
@ -107,8 +107,8 @@ the value."
(replace-regexp-in-string break " " (buffer-substring start end)))))
(defun systemd-doc-find ()
"Find the value of the unit's “Documentation” keys and return
as a list of strings, otherwise nil."
"Find the value of the unit's “Documentation” keys.
Return values in a list of strings, otherwise nil."
(let ((key "^Documentation=")
string)
(save-excursion
@ -119,15 +119,16 @@ as a list of strings, otherwise nil."
(remove "\\" (split-string string)))))
(defun systemd-doc-man (page)
"Open a manual page with `systemd-man-function'."
"Open a manual page 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)
"Open URL. Interactively completes the documentation in the
current unit file, defaulting to the link under point, if any."
"Prompt to open URL.
Interactively completes the documentation in the current unit
file, defaulting to the link under point, if any."
(interactive
(let* ((completion-cycle-threshold t)
(collection (systemd-doc-find))
@ -146,7 +147,7 @@ current unit file, defaulting to the link under point, if any."
(_ (user-error "Invalid link")))))
(defun systemd-doc-directives ()
"Open systemd.directives(7)"
"Open systemd.directives(7)."
(interactive)
(systemd-doc-man "systemd.directives(7)"))