unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: Wrong common substring highlighted in Completion buffer
Date: Mon, 12 Dec 2005 09:43:05 +0200	[thread overview]
Message-ID: <87oe3mopb6.fsf@jurta.org> (raw)
In-Reply-To: <E1ElJMB-0003rY-Op@fencepost.gnu.org> (Richard M. Stallman's message of "Sun, 11 Dec 2005 00:02:43 -0500")

> 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	other threads:[~2005-12-12  7:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-10 10:14 Wrong common substring highlighted in Completion buffer Juri Linkov
2005-12-11  5:02 ` Richard M. Stallman
2005-12-12  7:43   ` Juri Linkov [this message]
2005-12-13  3:15     ` Richard M. Stallman
2005-12-14  7:59       ` Juri Linkov
2005-12-15  2:07         ` Richard M. Stallman
2005-12-12  7:44   ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oe3mopb6.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).