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.
This commit is contained in:
parent
5c410a9b80
commit
b829360f50
6 changed files with 65 additions and 40 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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")))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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'.
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue