From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Wrong common substring highlighted in Completion buffer Date: Mon, 12 Dec 2005 09:43:05 +0200 Organization: JURTA Message-ID: <87oe3mopb6.fsf@jurta.org> References: <87vexx1r63.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1134378446 29331 80.91.229.2 (12 Dec 2005 09:07:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 12 Dec 2005 09:07:26 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 12 10:07:25 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EljdD-0000Kc-Cc for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2005 10:06:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eljaw-0006Gl-8D for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2005 04:03:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EliZR-0001ga-Mf for emacs-devel@gnu.org; Mon, 12 Dec 2005 02:58:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EliZO-0001e3-Pe for emacs-devel@gnu.org; Mon, 12 Dec 2005 02:58:04 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EliZN-0001dD-I8 for emacs-devel@gnu.org; Mon, 12 Dec 2005 02:58:02 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Eliau-0002IG-FK; Mon, 12 Dec 2005 02:59:37 -0500 Original-Received: from mail.neti.ee (80-235-33-123-dsl.mus.estpak.ee [80.235.33.123]) by Relayhost1.neti.ee (Postfix) with ESMTP id 110AC16C9; Mon, 12 Dec 2005 09:57:32 +0200 (EET) Original-To: rms@gnu.org In-Reply-To: (Richard M. Stallman's message of "Sun, 11 Dec 2005 00:02:43 -0500") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:47530 Archived-At: > 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/