summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2014-02-28 18:31:05 -0800
committerGlenn Morris <rgm@gnu.org>2014-02-28 18:31:05 -0800
commitb829360f5052d532a00f4693f9ca6494a348449e (patch)
tree4a69d121129eaabef08afa3cd76e6730387a20ce /lisp
parent5c410a9b800eeb93c58945dec0387697108ad5e2 (diff)
downloademacs-b829360f5052d532a00f4693f9ca6494a348449e.tar.gz
Replace some uses of obsolete argument of display-completion-list
* lisp/minibuffer.el (completion-hilit-commonality): Make `base-size' argument optional. Short-cut if `prefix-len' is 0. * lisp/comint.el (comint-dynamic-list-completions): Doc fix. * lisp/comint.el (comint-dynamic-list-completions): * lisp/filecache.el (file-cache-minibuffer-complete): * lisp/tempo.el (tempo-display-completions): * lisp/eshell/em-hist.el (eshell-list-history): Replace use of obsolete argument of display-completion-list. * lisp/tempo.el: Use utf-8 for author name.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/comint.el11
-rw-r--r--lisp/eshell/em-hist.el3
-rw-r--r--lisp/filecache.el4
-rw-r--r--lisp/minibuffer.el60
-rw-r--r--lisp/tempo.el16
6 files changed, 65 insertions, 40 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 97fef60ee8c..2da420c0015 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
+2014-03-01 Glenn Morris <rgm@gnu.org>
+
+ * minibuffer.el (completion-hilit-commonality):
+ Make `base-size' argument optional. Short-cut if `prefix-len' is 0.
+ * comint.el (comint-dynamic-list-completions): Doc fix.
+ * comint.el (comint-dynamic-list-completions):
+ * filecache.el (file-cache-minibuffer-complete):
+ * tempo.el (tempo-display-completions):
+ * eshell/em-hist.el (eshell-list-history):
+ Replace use of obsolete argument of display-completion-list.
+
2014-03-01 Juanma Barranquero <lekktu@gmail.com>
* icomplete.el (icomplete-completions):
diff --git a/lisp/comint.el b/lisp/comint.el
index 8faa5243a11..76b1d803877 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3274,8 +3274,12 @@ See also `comint-dynamic-complete-filename'."
(defun comint-dynamic-list-completions (completions &optional common-substring)
"Display a list of sorted COMPLETIONS.
-The meaning of COMMON-SUBSTRING is the same as in `display-completion-list'.
-Typing SPC flushes the completions buffer."
+Typing SPC flushes the completions buffer.
+
+The optional argument COMMON-SUBSTRING, if non-nil, should be a string
+specifying a common substring for adding the faces
+`completions-first-difference' and `completions-common-part' to
+the completions."
(let ((window (get-buffer-window "*Completions*" 0)))
(setq completions (sort completions 'string-lessp))
(if (and (eq last-command this-command)
@@ -3306,7 +3310,8 @@ Typing SPC flushes the completions buffer."
(setq comint-dynamic-list-completions-config
(current-window-configuration))
(with-output-to-temp-buffer "*Completions*"
- (display-completion-list completions common-substring))
+ (display-completion-list
+ (completion-hilit-commonality completions (length common-substring))))
(if (window-minibuffer-p)
(minibuffer-message "Type space to flush; repeat completion command to scroll")
(message "Type space to flush; repeat completion command to scroll")))
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index ec3cc8e1626..b721b5d8485 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -509,7 +509,8 @@ See also `eshell-read-history'."
;; Change "completion" to "history reference"
;; to make the display accurate.
(with-output-to-temp-buffer history-buffer
- (display-completion-list history prefix)
+ (display-completion-list
+ (completion-hilit-commonality history (length prefix)))
(set-buffer history-buffer)
(forward-line 3)
(while (search-backward "completion" nil 'move)
diff --git a/lisp/filecache.el b/lisp/filecache.el
index 802308b59c6..7d12517fcc3 100644
--- a/lisp/filecache.el
+++ b/lisp/filecache.el
@@ -613,7 +613,9 @@ the name is considered already unique; only the second substitution
(append completion-setup-hook
(list 'file-cache-completion-setup-function))))
(with-output-to-temp-buffer file-cache-completions-buffer
- (display-completion-list completion-list string))))
+ (display-completion-list
+ (completion-hilit-commonality completion-list
+ (length string))))))
(setq file-cache-string (file-cache-file-name completion-string))
(if (string= file-cache-string (minibuffer-contents))
(minibuffer-message file-cache-sole-match-message)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index c888721fb49..63e7e145d10 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1586,7 +1586,7 @@ less visible than normal, so that the differing parts are emphasized
by contrast.
See also the face `completions-first-difference'.")
-(defun completion-hilit-commonality (completions prefix-len base-size)
+(defun completion-hilit-commonality (completions prefix-len &optional base-size)
"Apply font-lock highlighting to a list of completions, COMPLETIONS.
PREFIX-LEN is an integer. BASE-SIZE is an integer or nil (meaning zero).
@@ -1597,34 +1597,36 @@ This adds the face `completions-common-part' to the first
It returns a list with font-lock properties applied to each element,
and with BASE-SIZE appended as the last element."
(when completions
- (let ((com-str-len (- prefix-len (or base-size 0))))
- (nconc
- (mapcar
- (lambda (elem)
- (let ((str
- ;; Don't modify the string itself, but a copy, since the
- ;; the string may be read-only or used for other purposes.
- ;; Furthermore, since `completions' may come from
- ;; display-completion-list, `elem' may be a list.
- (if (consp elem)
- (car (setq elem (cons (copy-sequence (car elem))
- (cdr elem))))
- (setq elem (copy-sequence elem)))))
- (font-lock-prepend-text-property
- 0
- ;; If completion-boundaries returns incorrect
- ;; values, all-completions may return strings
- ;; that don't contain the prefix.
- (min com-str-len (length str))
- 'face 'completions-common-part str)
- (if (> (length str) com-str-len)
- (font-lock-prepend-text-property com-str-len (1+ com-str-len)
- 'face
- 'completions-first-difference
- str)))
- elem)
- completions)
- base-size))))
+ (if (zerop prefix-len)
+ completions
+ (let ((com-str-len (- prefix-len (or base-size 0))))
+ (nconc
+ (mapcar
+ (lambda (elem)
+ (let ((str
+ ;; Don't modify the string itself, but a copy, since the
+ ;; the string may be read-only or used for other purposes.
+ ;; Furthermore, since `completions' may come from
+ ;; display-completion-list, `elem' may be a list.
+ (if (consp elem)
+ (car (setq elem (cons (copy-sequence (car elem))
+ (cdr elem))))
+ (setq elem (copy-sequence elem)))))
+ (font-lock-prepend-text-property
+ 0
+ ;; If completion-boundaries returns incorrect
+ ;; values, all-completions may return strings
+ ;; that don't contain the prefix.
+ (min com-str-len (length str))
+ 'face 'completions-common-part str)
+ (if (> (length str) com-str-len)
+ (font-lock-prepend-text-property com-str-len (1+ com-str-len)
+ 'face
+ 'completions-first-difference
+ str)))
+ elem)
+ completions)
+ base-size)))))
(defun display-completion-list (completions &optional common-substring)
"Display the list of completions, COMPLETIONS, using `standard-output'.
diff --git a/lisp/tempo.el b/lisp/tempo.el
index 9ff7a49146d..9b6cd75b313 100644
--- a/lisp/tempo.el
+++ b/lisp/tempo.el
@@ -2,9 +2,9 @@
;; Copyright (C) 1994-1995, 2001-2014 Free Software Foundation, Inc.
-;; Author: David K}gedal <davidk@lysator.liu.se>
+;; Author: David Kågedal <davidk@lysator.liu.se>
;; Created: 16 Feb 1994
-;; K}gedal's last version number: 1.2.4
+;; Kågedal's last version number: 1.2.4
;; Keywords: extensions, languages, tools
;; This file is part of GNU Emacs.
@@ -723,13 +723,13 @@ non-nil, a buffer containing possible completions is displayed."
(if tempo-leave-completion-buffer
(with-output-to-temp-buffer "*Completions*"
(display-completion-list
- (all-completions string tag-list)
- string))
+ (completion-hilit-commonality (all-completions string tag-list)
+ (length string))))
(save-window-excursion
(with-output-to-temp-buffer "*Completions*"
(display-completion-list
- (all-completions string tag-list)
- string))
+ (completion-hilit-commonality (all-completions string tag-list)
+ (length string))))
(sit-for 32767))))
;;;
@@ -763,3 +763,7 @@ space bar, and looks something like this:
(provide 'tempo)
;;; tempo.el ends here
+
+;; Local Variables:
+;; coding: utf-8
+;; End: