aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2009-11-24 20:00:41 +0000
committerStefan Monnier2009-11-24 20:00:41 +0000
commitbb301b9aff1ccb7a28e4f9bae3adef3f03d2b3e4 (patch)
treefa1ef0424af9b7c300431641fe93433e4e552f24
parent35179414e41c6064b484854fbc01a9db6ce2a866 (diff)
downloademacs-bb301b9aff1ccb7a28e4f9bae3adef3f03d2b3e4.tar.gz
emacs-bb301b9aff1ccb7a28e4f9bae3adef3f03d2b3e4.zip
(Man-completion-table): New function.
(man): Use it.
-rw-r--r--lisp/ChangeLog26
-rw-r--r--lisp/man.el25
2 files changed, 38 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a145f4e7eb6..65e2dff9e2c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,11 @@
12009-11-24 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * man.el (Man-completion-table): New function.
4 (man): Use it.
5
12009-11-24 David Reitter <david.reitter@gmail.com> 62009-11-24 David Reitter <david.reitter@gmail.com>
2 7
3 * vc-git.el (vc-git-registered): use checkout directory (where 8 * vc-git.el (vc-git-registered): Use checkout directory (where
4 .git is) rather than the file's directory and a relative path spec 9 .git is) rather than the file's directory and a relative path spec
5 to work around a bug in git. 10 to work around a bug in git.
6 11
@@ -12,18 +17,18 @@
12 (eshell-parse-colon-path): New defun. 17 (eshell-parse-colon-path): New defun.
13 (eshell-file-attributes): Use `eshell-parse-colon-path'. 18 (eshell-file-attributes): Use `eshell-parse-colon-path'.
14 19
15 * eshell/esh-ext.el (eshell-search-path): Use 20 * eshell/esh-ext.el (eshell-search-path):
16 `eshell-parse-colon-path'. 21 Use `eshell-parse-colon-path'.
17 (eshell-remote-command): Remove argument HANDLER. 22 (eshell-remote-command): Remove argument HANDLER.
18 (eshell-external-command): Check for FTP remote connection. 23 (eshell-external-command): Check for FTP remote connection.
19 24
20 * eshell/esh-proc.el (eshell-gather-process-output): Use 25 * eshell/esh-proc.el (eshell-gather-process-output):
21 `file-truename', in order to start also symlinked files. Apply 26 Use `file-truename', in order to start also symlinked files.
22 `start-file-process' instead of `start-process'. Shorten `command' 27 Apply `start-file-process' instead of `start-process'.
23 to the local file name part. 28 Shorten `command' to the local file name part.
24 29
25 * eshell/em-cmpl.el (eshell-complete-commands-list): Use 30 * eshell/em-cmpl.el (eshell-complete-commands-list):
26 `eshell-parse-colon-path'. 31 Use `eshell-parse-colon-path'.
27 32
28 * eshell/em-unix.el (eshell/du): Check for FTP remote connection. 33 * eshell/em-unix.el (eshell/du): Check for FTP remote connection.
29 34
@@ -33,8 +38,7 @@
332009-11-24 Tassilo Horn <tassilo@member.fsf.org> 382009-11-24 Tassilo Horn <tassilo@member.fsf.org>
34 39
35 * doc-view.el (doc-view-mode): Switch off view-mode explicitly, 40 * doc-view.el (doc-view-mode): Switch off view-mode explicitly,
36 because it could be enabled automatically if view-read-only is 41 because it could be enabled automatically if view-read-only is non-nil.
37 non-nil.
38 42
392009-11-24 Michael Kifer <kifer@cs.stonybrook.edu> 432009-11-24 Michael Kifer <kifer@cs.stonybrook.edu>
40 44
diff --git a/lisp/man.el b/lisp/man.el
index d305d54dd43..5923b3909ee 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -749,6 +749,26 @@ POS defaults to `point'."
749;;;###autoload 749;;;###autoload
750(defalias 'manual-entry 'man) 750(defalias 'manual-entry 'man)
751 751
752(defun Man-completion-table (string pred action)
753 (cond
754 ((memq action '(t nil))
755 (let ((table '()))
756 (with-temp-buffer
757 ;; Actually for my `man' the arg is a regexp. Don't know how
758 ;; standard that is. Also, it's not clear what kind of
759 ;; regexp are accepted: under GNU/Linux it seems it's ERE-style,
760 ;; whereas under MacOSX it seems to be BRE-style and
761 ;; doesn't accept backslashes at all. Let's not bother to
762 ;; quote anything.
763 (call-process "man" nil '(t nil) nil "-k" (concat "^" string))
764 (goto-char (point-min))
765 (while (re-search-forward "^[^ \t\n]+" nil t)
766 (push (match-string 0) table)))
767 ;; The table may contain false positives since the match is made
768 ;; by "man -k" not just on the manpage's name.
769 (complete-with-action action table string pred)))
770 ((eq action 'lambda) t)
771 ((eq (car-safe action) 'boundaries) nil)))
752 772
753;;;###autoload 773;;;###autoload
754(defun man (man-args) 774(defun man (man-args)
@@ -765,12 +785,13 @@ all sections related to a subject, put something appropriate into the
765`Man-switches' variable, which see." 785`Man-switches' variable, which see."
766 (interactive 786 (interactive
767 (list (let* ((default-entry (Man-default-man-entry)) 787 (list (let* ((default-entry (Man-default-man-entry))
768 (input (read-string 788 (input (completing-read
769 (format "Manual entry%s" 789 (format "Manual entry%s"
770 (if (string= default-entry "") 790 (if (string= default-entry "")
771 ": " 791 ": "
772 (format " (default %s): " default-entry))) 792 (format " (default %s): " default-entry)))
773 nil 'Man-topic-history default-entry))) 793 'Man-completion-table
794 nil nil nil 'Man-topic-history default-entry)))
774 (if (string= input "") 795 (if (string= input "")
775 (error "No man args given") 796 (error "No man args given")
776 input)))) 797 input))))