Function: org-info-description-as-command
org-info-description-as-command is a byte-compiled function defined in
ol-info.el.gz.
Signature
(org-info-description-as-command LINK DESC)
Documentation
Return an Info link description that can be evaluated as a command.
For the following LINK
"info:elisp#Non-ASCII in Strings"
the result is
info "(elisp) Non-ASCII in Strings"
that may be executed as shell command or evaluated by
M-: (eval-expression) (wrapped with parenthesis) to read the manual
in Emacs.
Calling convention is similar to org-link-make-description-function.
DESC has higher priority and returned when it is both non-nil and
non-empty. If LINK is not an Info link, DESC is returned.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ol-info.el.gz
(defun org-info-description-as-command (link desc)
"Return an Info link description that can be evaluated as a command.
For the following LINK
\"info:elisp#Non-ASCII in Strings\"
the result is
info \"(elisp) Non-ASCII in Strings\"
that may be executed as shell command or evaluated by
\\[eval-expression] (wrapped with parenthesis) to read the manual
in Emacs.
Calling convention is similar to `org-link-make-description-function'.
DESC has higher priority and returned when it is both non-nil and
non-empty. If LINK is not an Info link, DESC is returned."
(let* ((prefix "info:")
(need-file-node (and (not (org-string-nw-p desc))
(string-prefix-p prefix link))))
(pcase (and need-file-node
(org-info--link-file-node (org-unbracket-string prefix "" link)))
;; Unlike (info "dir"), "info dir" shell command opens "(coreutils)dir invocation".
(`("dir" . "Top") "info \"(dir)\"")
(`(,file . "Top") (format "info %s" file))
(`(,file . ,node) (format "info \"(%s) %s\"" file node))
(_ desc))))