[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp ChangeLog man.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] emacs/lisp ChangeLog man.el |
Date: |
Wed, 25 Nov 2009 03:51:04 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Stefan Monnier <monnier> 09/11/25 03:51:04
Modified files:
lisp : ChangeLog man.el
Log message:
(Man-completion-cache): New var.
(Man-completion-table): Use it.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16724&r2=1.16725
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/man.el?cvsroot=emacs&r1=1.187&r2=1.188
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16724
retrieving revision 1.16725
diff -u -b -r1.16724 -r1.16725
--- ChangeLog 25 Nov 2009 03:28:24 -0000 1.16724
+++ ChangeLog 25 Nov 2009 03:51:00 -0000 1.16725
@@ -1,5 +1,8 @@
2009-11-25 Stefan Monnier <address@hidden>
+ * man.el (Man-completion-cache): New var.
+ (Man-completion-table): Use it.
+
* vc.el (vc-print-log-internal): Make `limit' optional for better
compatibility (e.g. with vc-annotate.el).
Index: man.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/man.el,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -b -r1.187 -r1.188
--- man.el 24 Nov 2009 20:00:44 -0000 1.187
+++ man.el 25 Nov 2009 03:51:03 -0000 1.188
@@ -749,10 +749,17 @@
;;;###autoload
(defalias 'manual-entry 'man)
+(defvar Man-completion-cache nil
+ ;; On my machine, "man -k" is so fast that a cache makes no sense,
+ ;; but apparently that's not the case in all cases, so let's add a cache.
+ "Cache of completion table of the form (PREFIX . TABLE).")
+
(defun Man-completion-table (string pred action)
(cond
((memq action '(t nil))
- (let ((table '()))
+ (let ((table (cdr Man-completion-cache)))
+ (unless (and Man-completion-cache
+ (string-prefix-p (car Man-completion-cache) string))
(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
@@ -760,10 +767,13 @@
;; 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))
+ (call-process manual-program nil '(t nil) nil
+ "-k" (concat "^" string))
(goto-char (point-min))
(while (re-search-forward "^[^ \t\n]+" nil t)
(push (match-string 0) table)))
+ ;; Cache the table for later reuse.
+ (setq Man-completion-cache (cons string 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)))