comparison lisp/simple.el @ 56613:05c3cf703d59

(completion-root-regexp): New defvar. (completion-setup-function): Use it instead of a literal string.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 07 Aug 2004 16:45:24 +0000
parents f02b482121bc
children 486136b7f89c 1425b1df1da8 3fd4a5c21153
comparison
equal deleted inserted replaced
56612:f139a56bb0f0 56613:05c3cf703d59
4302 The idea of `completions-common-part' is that you can use it to 4302 The idea of `completions-common-part' is that you can use it to
4303 make the common parts less visible than normal, so that the rest 4303 make the common parts less visible than normal, so that the rest
4304 of the differing parts is, by contrast, slightly highlighted." 4304 of the differing parts is, by contrast, slightly highlighted."
4305 :group 'completion) 4305 :group 'completion)
4306 4306
4307 ;; This is for packages that need to bind it to a non-default regexp
4308 ;; in order to make the first-differing character highlight work
4309 ;; to their liking
4310 (defvar completion-root-regexp "^/"
4311 "Regexp to use in `completion-setup-function' to find the root directory.")
4312
4307 (defun completion-setup-function () 4313 (defun completion-setup-function ()
4308 (let ((mainbuf (current-buffer)) 4314 (let ((mainbuf (current-buffer))
4309 (mbuf-contents (minibuffer-contents))) 4315 (mbuf-contents (minibuffer-contents)))
4310 ;; When reading a file name in the minibuffer, 4316 ;; When reading a file name in the minibuffer,
4311 ;; set default-directory in the minibuffer 4317 ;; set default-directory in the minibuffer
4330 ;; last file name component. 4336 ;; last file name component.
4331 (setq completion-base-size 4337 (setq completion-base-size
4332 (with-current-buffer mainbuf 4338 (with-current-buffer mainbuf
4333 (save-excursion 4339 (save-excursion
4334 (goto-char (point-max)) 4340 (goto-char (point-max))
4335 (skip-chars-backward "^/") 4341 (skip-chars-backward completion-root-regexp)
4336 (- (point) (minibuffer-prompt-end))))) 4342 (- (point) (minibuffer-prompt-end)))))
4337 ;; Otherwise, in minibuffer, the whole input is being completed. 4343 ;; Otherwise, in minibuffer, the whole input is being completed.
4338 (if (minibufferp mainbuf) 4344 (if (minibufferp mainbuf)
4339 (setq completion-base-size 0))) 4345 (setq completion-base-size 0)))
4340 ;; Put faces on first uncommon characters and common parts. 4346 ;; Put faces on first uncommon characters and common parts.