From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: michael.cadilhac@lrde.org (=?iso-8859-1?Q?Micha=EBl?= Cadilhac) Newsgroups: gmane.emacs.devel Subject: ido with merged directories. Date: Fri, 08 Sep 2006 21:06:01 +0200 Organization: Epita/LRDE Message-ID: <87bqpqb2li.fsf@lrde.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0483903323==" X-Trace: sea.gmane.org 1157742378 12112 80.91.229.2 (8 Sep 2006 19:06:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Sep 2006 19:06:18 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 08 21:06:12 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GLlg2-0002Up-RH for ged-emacs-devel@m.gmane.org; Fri, 08 Sep 2006 21:06:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GLlg2-00037G-9P for ged-emacs-devel@m.gmane.org; Fri, 08 Sep 2006 15:06:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GLlfl-000358-Mx for emacs-devel@gnu.org; Fri, 08 Sep 2006 15:05:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GLlfj-00032i-9a for emacs-devel@gnu.org; Fri, 08 Sep 2006 15:05:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GLlfj-00032b-1s for emacs-devel@gnu.org; Fri, 08 Sep 2006 15:05:51 -0400 Original-Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GLlgN-0001aT-6E for emacs-devel@gnu.org; Fri, 08 Sep 2006 15:06:31 -0400 Original-Received: from mahaena.lrde.epita.fr ([192.168.101.66] helo=mahaena.lrde) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1GLlfe-0003J3-4w for emacs-devel@gnu.org; Fri, 08 Sep 2006 21:05:46 +0200 Original-To: emacs-devel@gnu.org Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVWPh+Tai+5r5YKBAEU CQQzGAtiq7gjAAACR0lEQVQ4jW2UzW7lIAyFzVW8BzTZX5DmCZLuU2H2pMXv/ypzbK7aSh2kRCRf /HNsE0q7Sg+RQ7JFKaqtrRNAl5AIIKe6D5DBqgbmUAe5hBI1wIRFAHjeM0RKtZi7XVVEpb0BSNfA IddChChT5DildSLWOWhY5IEItMnncZgFcUAc/5jjwCMsDosRNdfKPDTFEdVBW8C+RebDb4N5Orio RhM1+11IJyx0ng2+LryFHBMPDQDYHrY6IfGuU3ouiXTQNE8LIJDKOWpNxERTFrggQwRPd7USUsTW fJ0XbR3bdj5KgBYy4SACpxDeUYEUAzLmtJ1iIrD2gczPq8Qomjhsh/RjGIgKIO8p7NITjwlx7WID nsnQe5NeuTvoBpi8LX6vLLOh5icjOHqBypgnuSp7M+RE1agbQKHQr5E2z1WObhYW4gMqeGQL7joM jCf2DxSk5ApADSYHfFF4igNfJZL1z0GKP0FN02s4XiDXr7V5P94W6I9v8MfBOQDmfwAaVYt+x8Da v4DJvX8BAdin3Knm5yMZYAO4ABDkDniZLLfi4P40gP1F0TPGZOu0CGwA1lcowxwlGy6A9705mD0V jHCxwVZT/hYdRJVUGZNlx6l7ScQBTluof6Wj6bsPYlvpwoTvXFD9gHPn2TZPF3ntI2ecxVrW5MrV XiCie5EeNa7BlWu/HNSkprDUva163PHxAv5jyGV7gVzyAghSKOTnat85UIYFICXbD2NV9rRiv0BS tKQsg6OHH4A15F1WW+UHKHHa32h6aPnAm3/pUcWp+WYnTQAAAABJRU5ErkJggg== User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) 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:59579 Archived-At: --===============0483903323== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= ido makes the error of considering that `ido-matches' is always of the form '("a" "b" "c"). However, with merged directories, it could have the form '(("a" "b") "c"). This triggers many bugs. I can make a first try of a fix, but it is probably wrong and I think each modification should be carefully proofread. Thanks! --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: inline; filename=ido.patch Content-Transfer-Encoding: quoted-printable Index: lisp/ido.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /sources/emacs/emacs/lisp/ido.el,v retrieving revision 1.103 diff -c -r1.103 ido.el *** lisp/ido.el 5 Sep 2006 10:26:35 -0000 1.103 =2D-- lisp/ido.el 8 Sep 2006 18:51:22 -0000 *************** *** 1016,1022 **** "Stores the users strings when user hits M-b/M-f.") =20=20 (defvar ido-matches nil ! "List of files currently matching `ido-text'.") =20=20 (defvar ido-report-no-match t "Report [No Match] when no completions matches `ido-text'.") =2D-- 1016,1023 ---- "Stores the users strings when user hits M-b/M-f.") =20=20 (defvar ido-matches nil ! "List of files currently matching `ido-text'. ! The elements could be lists of directories on multiple directory choices.= ") =20=20 (defvar ido-report-no-match t "Report [No Match] when no completions matches `ido-text'.") *************** *** 1286,1291 **** =2D-- 1287,1298 ---- (insert (or sep "\n "))))) (insert "\n)\n"))) =20=20 + (defun ido-get-first-match () + ;; Get the first item in `ido-matches', supposed to be non-nil. + (if (listp (car ido-matches)) + (caar ido-matches) + (car ido-matches))) +=20 (defun ido-save-history () "Save ido history and cache information between sessions." (interactive) *************** *** 2052,2058 **** (null ido-matches)) ido-final-text ;; else take head of list ! (ido-name (car ido-matches)))) =20=20 (cond ((memq item '(buffer list)) =2D-- 2059,2065 ---- (null ido-matches)) ido-final-text ;; else take head of list ! (ido-name (ido-get-first-match)))) =20=20 (cond ((memq item '(buffer list)) *************** *** 2112,2118 **** (defun ido-edit-input () "Edit absolute file name entered so far with ido; terminate by RET." (interactive) ! (setq ido-text-init (if ido-matches (car ido-matches) ido-text)) (setq ido-exit 'edit) (exit-minibuffer)) =20=20 =2D-- 2119,2125 ---- (defun ido-edit-input () "Edit absolute file name entered so far with ido; terminate by RET." (interactive) ! (setq ido-text-init (if ido-matches (ido-get-first-match) ido-text)) (setq ido-exit 'edit) (exit-minibuffer)) =20=20 *************** *** 2426,2438 **** ((and (=3D 1 (length ido-matches)) (not (and ido-enable-tramp-completion (string-equal ido-current-directory "/") ! (string-match "..[@:]\\'" (car ido-matches))))) ;; only one choice, so select it. (if (not ido-confirm-unique-completion) (exit-minibuffer) (setq ido-rescan (not ido-enable-prefix)) (delete-region (minibuffer-prompt-end) (point)) ! (insert (car ido-matches)))) =20=20 (t ;; else there could be some completions (setq res ido-common-match-string) =2D-- 2433,2445 ---- ((and (=3D 1 (length ido-matches)) (not (and ido-enable-tramp-completion (string-equal ido-current-directory "/") ! (string-match "..[@:]\\'" (ido-get-first-match))))) ;; only one choice, so select it. (if (not ido-confirm-unique-completion) (exit-minibuffer) (setq ido-rescan (not ido-enable-prefix)) (delete-region (minibuffer-prompt-end) (point)) ! (insert (ido-get-first-match)))) =20=20 (t ;; else there could be some completions (setq res ido-common-match-string) *************** *** 2814,2820 **** "Use first matching item as input text." (interactive) (when ido-matches ! (setq ido-text-init (car ido-matches)) (setq ido-exit 'refresh) (exit-minibuffer))) =20=20 =2D-- 2821,2827 ---- "Use first matching item as input text." (interactive) (when ido-matches ! (setq ido-text-init (ido-get-first-match)) (setq ido-exit 'refresh) (exit-minibuffer))) =20=20 *************** *** 2828,2834 **** "Move to previous directory in file name, push first match on stack." (interactive) (if ido-matches ! (setq ido-text (car ido-matches))) (setq ido-exit 'push) (exit-minibuffer)) =20=20 =2D-- 2835,2841 ---- "Move to previous directory in file name, push first match on stack." (interactive) (if ido-matches ! (setq ido-text (ido-get-first-match))) (setq ido-exit 'push) (exit-minibuffer)) =20=20 *************** *** 3745,3751 **** "Kill the buffer at the head of `ido-matches'." (interactive) (let ((enable-recursive-minibuffers t) ! (buf (car ido-matches))) (when buf (kill-buffer buf) ;; Check if buffer still exists. =2D-- 3752,3758 ---- "Kill the buffer at the head of `ido-matches'." (interactive) (let ((enable-recursive-minibuffers t) ! (buf (ido-get-first-match))) (when buf (kill-buffer buf) ;; Check if buffer still exists. *************** *** 3760,3766 **** "Delete the file at the head of `ido-matches'." (interactive) (let ((enable-recursive-minibuffers t) ! (file (car ido-matches))) (if file (setq file (concat ido-current-directory file))) (when (and file =2D-- 3767,3773 ---- "Delete the file at the head of `ido-matches'." (interactive) (let ((enable-recursive-minibuffers t) ! (file (ido-get-first-match))) (if file (setq file (concat ido-current-directory file))) (when (and file *************** *** 3774,3780 **** ;; file could not be deleted (setq ido-rescan t) ;; else file was killed so remove name from list. ! (setq ido-cur-list (delq (car ido-matches) ido-cur-list)))))) =20=20 =20=20 ;;; VISIT CHOSEN BUFFER =2D-- 3781,3787 ---- ;; file could not be deleted (setq ido-rescan t) ;; else file was killed so remove name from list. ! (setq ido-cur-list (delq (ido-get-first-match) ido-cur-list)))))) =20=20 =20=20 ;;; VISIT CHOSEN BUFFER *************** *** 4202,4208 **** ((=3D (length contents) 2) "/") (ido-matches ! (concat ido-current-directory (car ido-matches))) (t (concat ido-current-directory (substring contents 0 -1))))) (setq ido-text-init (substring contents -1)) =2D-- 4209,4215 ---- ((=3D (length contents) 2) "/") (ido-matches ! (concat ido-current-directory (ido-get-first-match))) (t (concat ido-current-directory (substring contents 0 -1))))) (setq ido-text-init (substring contents -1)) *************** *** 4238,4249 **** ido-matches (or (eq ido-enter-matching-directory 'first) (null (cdr ido-matches))) ! (ido-final-slash (car ido-matches)) (or try-single-dir-match (eq ido-enter-matching-directory t))) ! (ido-trace "single match" (car ido-matches)) (ido-set-current-directory ! (concat ido-current-directory (car ido-matches))) (setq ido-exit 'refresh) (exit-minibuffer)) =20=20 =2D-- 4245,4256 ---- ido-matches (or (eq ido-enter-matching-directory 'first) (null (cdr ido-matches))) ! (ido-final-slash (ido-get-first-match)) (or try-single-dir-match (eq ido-enter-matching-directory t))) ! (ido-trace "single match" (ido-get-first-match)) (ido-set-current-directory ! (concat ido-current-directory (ido-get-first-match))) (setq ido-exit 'refresh) (exit-minibuffer)) =20=20 Index: lisp/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.10012 diff -c -0 -r1.10012 ChangeLog *** lisp/ChangeLog 7 Sep 2006 10:12:39 -0000 1.10012 =2D-- lisp/ChangeLog 8 Sep 2006 18:51:32 -0000 *************** *** 0 **** =2D-- 1,11 ---- + 2006-09-08 Micha=EBl Cadilhac +=20 + * ido.el (ido-get-first-match): New. Get the first element of + `ido-matches', even in case of merged directories. + (ido-matches): Document the fact that it can contain list of + directories. + (ido-read-internal, ido-edit-input, ido-complete) + (ido-take-first-match, ido-push-dir-first) + (ido-kill-buffer-at-head, ido-delete-file-at-head) + (ido-exhibit): Use `ido-get-first-match'. +=20 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable (To Kim: Oops, I made a mistake in the mail address of emacs-devel in the mail I sent you) =2D-=20 | Micha=EBl `Micha' Cadilhac | Si les religions etaient aussi tole= - | | Epita/LRDE Promo 2007 | rantes qu'elles le pretendent, il y = | | http://www.lrde.org/~cadilh_m | a longtemps qu'il n'y en aurait plus = | `-- - JID: micha@amessage.be --' -- Moustic - -= -' --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFFAb8ZZYNf4qobZ7kRAiF7AKDooRT5cjipoiLowRM3DanYuTIymQCfWwzn oqJjiwOtMk51IX+lr/92wD0= =/biG -----END PGP SIGNATURE----- --==-=-=-- --===============0483903323== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============0483903323==--