4

我可以在终端中查看man页面:info

信息 pthread_create

info但是,在 Emacs 中是不可能的,即使使用info-aproposor也是如此info-menu

4

3 回答 3

4

编辑:似乎后备不在Info-mode.

接下来是一个变通方法应用advice。它不能完美地工作,但围绕缺少的功能;-)。

Info-goto-node它为(in Info-modebound to g) 和 for Info-menu(in Info-modebound to )定义了一个后备m。此外,它还向info-apropos.

(require 'woman)

(defun Info-man-completion (_caller _info string predicate action)
  "Add man entries to info completion."
  ;; prepare woman:
  (unless (and woman-expanded-directory-path woman-topic-all-completions)
    (setq woman-expanded-directory-path
      (woman-expand-directory-path woman-manpath woman-path)
      woman-topic-all-completions
      (woman-topic-all-completions woman-expanded-directory-path)))
  ;; do completions:
  (cond
   ((null action) ;; try-completion
    ;; shortest wins
    (let ((_man (try-completion string woman-topic-all-completions)))
      (cond
       ((eq _info t)
    t)
       ((eq _man t)
    t)
       ((and (stringp _info) (stringp _man))
    (if (> (length _info) (length _man))
        _man
      _info))
       ((stringp _info)
    _info)
       (t _man)
       )))
   ((eq action t) ;; all-completions
    (let ((_man (all-completions string woman-topic-all-completions)))
      (append _info _man)
      ))
   ((eq action 'lambda) ;; test-completion
    (try-completion string _caller))
   ((eq action 'metadata) ;; state of current completion
    '(metadata) ;; no specification
    )))

;; args: string predicate code
(defadvice Info-read-node-name-1 (around man activate)
  "Add man entries to info completion."
  (setq ad-return-value (apply 'Info-man-completion 'Info-read-node-name-1 ad-do-it (ad-get-args 0))))

;;
(defadvice Info-complete-menu-item (around man activate)
  "Add man entries to info completion."
  (setq ad-return-value (apply 'Info-man-completion 'Info-complete-menu-item ad-do-it (ad-get-args 0))))

(defadvice Info-goto-node (around man activate)
  "If no info node is found for string lookup and show man entry."
  (condition-case err
      ad-do-it
    (user-error
     (let ((err-str (car-safe (cdr err))))
       (if (and (stringp err-str)
        (string-match "No such node or anchor:" err-str))
         (man (ad-get-arg 0))
     (signal 'user-error err-str)
     )))))

(defadvice Info-menu (around man activate)
  "If no info menu entry is found for string lookup and show man entry."
  (condition-case err
      ad-do-it
    (user-error
     (let ((err-str (car-safe (cdr err))))
       (if (and (stringp err-str)
        (string-match "No such item in menu" err-str))
         (man (ad-get-arg 0))
     (signal 'user-error err-str)
     )))))

(defadvice Info-apropos-find-node (after man activate)
  "Add man appropos to info appropos."
  (let (item)
    (goto-char (point-max))
    (let ((inhibit-read-only t))
      (insert "\nMatches found by man-apropos\n\n")
      (let ((beg (point))
        (nodeinfo (assoc nodename Info-apropos-nodes)))
        (if nodeinfo
        (let ((search-string (nth 1 nodeinfo)))
          (call-process "apropos" nil t t search-string)
          (goto-char beg)
          (while (re-search-forward "^\\(\\(?:[[:alnum:]]\\|\\s_\\)+\\)\\(?:[[:blank:]]+\\[\\]\\)?\\([[:blank:]]+([[:alnum:]]+)\\)[[:blank:]]+-[[:blank:]]+\\(.*\\)$" nil t)
            (replace-match (replace-regexp-in-string "\\\\" "\\\\\\\\" (format "* %-38s.%s"
                                               (format "%s:" (match-string 1))
                                               (concat (match-string 1) (match-string 2))
                                               (match-string 3))))))
          (man nodename)
          )))))

信息给出节点不可用的错误。此后,如果有手册页,则会显示手册页。

于 2014-01-02T11:52:38.160 回答
1

[已编辑]

EmacsWikiiman

使用 InfoMode 打开信息格式手册或使用 ManMode 打开手册页。

它链接到作者的网站: http ://homepage1.nifty.com/bmonkey/emacs/elisp/iman.el

于 2014-01-02T04:24:52.197 回答
0

找到M-x woman MANPAGE RET了从 Emacs 内部调用联机帮助页的最方便的方法。

于 2014-01-02T08:17:44.043 回答