1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

(Man-completion-table): New function.

(man): Use it.
This commit is contained in:
Stefan Monnier 2009-11-24 20:00:41 +00:00
parent 35179414e4
commit bb301b9aff
2 changed files with 38 additions and 13 deletions

View File

@ -1,6 +1,11 @@
2009-11-24 Stefan Monnier <monnier@iro.umontreal.ca>
* man.el (Man-completion-table): New function.
(man): Use it.
2009-11-24 David Reitter <david.reitter@gmail.com> 2009-11-24 David Reitter <david.reitter@gmail.com>
* vc-git.el (vc-git-registered): use checkout directory (where * vc-git.el (vc-git-registered): Use checkout directory (where
.git is) rather than the file's directory and a relative path spec .git is) rather than the file's directory and a relative path spec
to work around a bug in git. to work around a bug in git.
@ -12,18 +17,18 @@
(eshell-parse-colon-path): New defun. (eshell-parse-colon-path): New defun.
(eshell-file-attributes): Use `eshell-parse-colon-path'. (eshell-file-attributes): Use `eshell-parse-colon-path'.
* eshell/esh-ext.el (eshell-search-path): Use * eshell/esh-ext.el (eshell-search-path):
`eshell-parse-colon-path'. Use `eshell-parse-colon-path'.
(eshell-remote-command): Remove argument HANDLER. (eshell-remote-command): Remove argument HANDLER.
(eshell-external-command): Check for FTP remote connection. (eshell-external-command): Check for FTP remote connection.
* eshell/esh-proc.el (eshell-gather-process-output): Use * eshell/esh-proc.el (eshell-gather-process-output):
`file-truename', in order to start also symlinked files. Apply Use `file-truename', in order to start also symlinked files.
`start-file-process' instead of `start-process'. Shorten `command' Apply `start-file-process' instead of `start-process'.
to the local file name part. Shorten `command' to the local file name part.
* eshell/em-cmpl.el (eshell-complete-commands-list): Use * eshell/em-cmpl.el (eshell-complete-commands-list):
`eshell-parse-colon-path'. Use `eshell-parse-colon-path'.
* eshell/em-unix.el (eshell/du): Check for FTP remote connection. * eshell/em-unix.el (eshell/du): Check for FTP remote connection.
@ -33,8 +38,7 @@
2009-11-24 Tassilo Horn <tassilo@member.fsf.org> 2009-11-24 Tassilo Horn <tassilo@member.fsf.org>
* doc-view.el (doc-view-mode): Switch off view-mode explicitly, * doc-view.el (doc-view-mode): Switch off view-mode explicitly,
because it could be enabled automatically if view-read-only is because it could be enabled automatically if view-read-only is non-nil.
non-nil.
2009-11-24 Michael Kifer <kifer@cs.stonybrook.edu> 2009-11-24 Michael Kifer <kifer@cs.stonybrook.edu>

View File

@ -749,6 +749,26 @@ POS defaults to `point'."
;;;###autoload ;;;###autoload
(defalias 'manual-entry 'man) (defalias 'manual-entry 'man)
(defun Man-completion-table (string pred action)
(cond
((memq action '(t nil))
(let ((table '()))
(with-temp-buffer
;; Actually for my `man' the arg is a regexp. Don't know how
;; standard that is. Also, it's not clear what kind of
;; regexp are accepted: under GNU/Linux it seems it's ERE-style,
;; whereas under MacOSX it seems to be BRE-style and
;; doesn't accept backslashes at all. Let's not bother to
;; quote anything.
(call-process "man" nil '(t nil) nil "-k" (concat "^" string))
(goto-char (point-min))
(while (re-search-forward "^[^ \t\n]+" nil t)
(push (match-string 0) table)))
;; The table may contain false positives since the match is made
;; by "man -k" not just on the manpage's name.
(complete-with-action action table string pred)))
((eq action 'lambda) t)
((eq (car-safe action) 'boundaries) nil)))
;;;###autoload ;;;###autoload
(defun man (man-args) (defun man (man-args)
@ -765,12 +785,13 @@ all sections related to a subject, put something appropriate into the
`Man-switches' variable, which see." `Man-switches' variable, which see."
(interactive (interactive
(list (let* ((default-entry (Man-default-man-entry)) (list (let* ((default-entry (Man-default-man-entry))
(input (read-string (input (completing-read
(format "Manual entry%s" (format "Manual entry%s"
(if (string= default-entry "") (if (string= default-entry "")
": " ": "
(format " (default %s): " default-entry))) (format " (default %s): " default-entry)))
nil 'Man-topic-history default-entry))) 'Man-completion-table
nil nil nil 'Man-topic-history default-entry)))
(if (string= input "") (if (string= input "")
(error "No man args given") (error "No man args given")
input)))) input))))