emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrong common substring highlighted in Completion buffer


From: Juri Linkov
Subject: Re: Wrong common substring highlighted in Completion buffer
Date: Mon, 12 Dec 2005 09:43:05 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> Thanks.  Please install your fix.

This fix broke highlighting of file name completions (which didn't
work before anyway when point in not in the end of the minibuffer).
Since file completion is a special case, the following patch should
handle all cases of file name completions correctly.

Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.778
diff -c -r1.778 simple.el
*** lisp/simple.el      10 Dec 2005 01:12:25 -0000      1.778
--- lisp/simple.el      12 Dec 2005 07:42:50 -0000
***************
*** 4901,4916 ****
  ;; after the text of the completion list buffer is written.
  (defun completion-setup-function ()
    (let* ((mainbuf (current-buffer))
!          (mbuf-contents (minibuffer-contents))
           (common-string-length (length mbuf-contents)))
      ;; When reading a file name in the minibuffer,
      ;; set default-directory in the minibuffer
--- 4901,4916 ----
  ;; after the text of the completion list buffer is written.
  (defun completion-setup-function ()
    (let* ((mainbuf (current-buffer))
!          (mbuf-contents (or completion-common-substring 
(minibuffer-contents)))
           (common-string-length (length mbuf-contents)))
      ;; When reading a file name in the minibuffer,
      ;; set default-directory in the minibuffer
***************
*** 4941,4947 ****
                  ;; the start of the last file name component.
                (with-current-buffer mainbuf
                  (save-excursion
-                   (goto-char (point-max))
                    (skip-chars-backward completion-root-regexp)
                    (- (point) (minibuffer-prompt-end))))
                ;; Otherwise, in minibuffer, the whole input is being completed.
--- 4941,4946 ----
***************
*** 4960,4966 ****
        ;; Put faces on first uncommon characters and common parts.
        (when (or completion-common-substring completion-base-size)
          (setq common-string-length
!               (if completion-common-substring
                    (length completion-common-substring)
                  (- common-string-length completion-base-size)))
        (let ((element-start (point-min))
--- 4959,4966 ----
        ;; Put faces on first uncommon characters and common parts.
        (when (or completion-common-substring completion-base-size)
          (setq common-string-length
!               (if (and completion-common-substring
!                      (not minibuffer-completing-file-name))
                    (length completion-common-substring)
                  (- common-string-length completion-base-size)))
        (let ((element-start (point-min))

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]