GNU bug report logs - #5955
completions in M-x find-library include .elc files

Previous Next

Package: emacs;

Reported by: "Aaron S. Hawley" <aaron.s.hawley <at> gmail.com>

Date: Fri, 16 Apr 2010 02:40:03 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5955 in the body.
You can then email your comments to 5955 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5955; Package emacs. (Fri, 16 Apr 2010 02:40:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Aaron S. Hawley" <aaron.s.hawley <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 16 Apr 2010 02:40:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Aaron S. Hawley" <aaron.s.hawley <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: completions in M-x find-library include .elc files
Date: Thu, 15 Apr 2010 22:28:57 -0400
Typing TAB or ? in M-x find-library shows .el and .elc files when it
probably should just be the name of the library without the extension.
 Appears that this is a general problem with
locate-file-completion-table in files.el.  It appears to put all files
in to the completion table without condition.  The fix is just
removing the first `push' operation.

=== modified file 'lisp/files.el'
--- lisp/files.el	2010-03-31 01:51:54 +0000
+++ lisp/files.el	2010-04-16 01:57:24 +0000
@@ -760,7 +760,6 @@
 	(when (file-directory-p dir)
 	  (dolist (file (file-name-all-completions
 			 string-file dir))
-	    (push file names)
 	    (when (string-match suffix file)
 	      (setq file (substring file 0 (match-beginning 0)))
               (push file names)))))

Hope this can get fixed.  I'd love to have the size of my
*completions* buffers reduced by a factor of 3!

Thanks for Emacs,
/a





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5955; Package emacs. (Fri, 23 Jul 2010 23:01:02 GMT) Full text and rfc822 format available.

Message #8 received at 5955 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Aaron S. Hawley" <aaron.s.hawley <at> gmail.com>
Cc: 5955 <at> debbugs.gnu.org
Subject: Re: bug#5955: completions in M-x find-library include .elc files
Date: Sat, 24 Jul 2010 00:59:59 +0200
> Typing TAB or ? in M-x find-library shows .el and .elc files when it
> probably should just be the name of the library without the extension.
>  Appears that this is a general problem with
> locate-file-completion-table in files.el.  It appears to put all files
> in to the completion table without condition.  The fix is just
> removing the first `push' operation.

I added the `push' because in load-library I often want to
select a particular file (i.e. either the .el or the .elc file).


        Stefan






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5955; Package emacs. (Sun, 25 Jul 2010 00:45:02 GMT) Full text and rfc822 format available.

Message #11 received at 5955 <at> debbugs.gnu.org (full text, mbox):

From: "Aaron S. Hawley" <aaron.s.hawley <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 5955 <at> debbugs.gnu.org
Subject: Re: bug#5955: completions in M-x find-library include .elc files
Date: Sat, 24 Jul 2010 20:44:13 -0400
On Fri, Jul 23, 2010 at 6:59 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> Typing TAB or ? in M-x find-library shows .el and .elc files when it
>> probably should just be the name of the library without the extension.
>
> I added the `push' because in load-library I often want to
> select a particular file (i.e. either the .el or the .elc file).

Doesn't M-x load-library and specifying no extension load the .elc?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5955; Package emacs. (Sun, 25 Jul 2010 23:15:02 GMT) Full text and rfc822 format available.

Message #14 received at 5955 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Aaron S. Hawley" <aaron.s.hawley <at> gmail.com>
Cc: 5955 <at> debbugs.gnu.org
Subject: Re: bug#5955: completions in M-x find-library include .elc files
Date: Sun, 25 Jul 2010 22:03:13 +0200
>>> Typing TAB or ? in M-x find-library shows .el and .elc files when it
>>> probably should just be the name of the library without the extension.
>> I added the `push' because in load-library I often want to
>> select a particular file (i.e. either the .el or the .elc file).
> Doesn't M-x load-library and specifying no extension load the .elc?

Usually, yes.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5955; Package emacs. (Sun, 25 Jul 2010 23:59:01 GMT) Full text and rfc822 format available.

Message #17 received at 5955 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Aaron S. Hawley" <aaron.s.hawley <at> gmail.com>
Cc: 5955 <at> debbugs.gnu.org
Subject: Re: bug#5955: completions in M-x find-library include .elc files
Date: Mon, 26 Jul 2010 01:58:49 +0200
>>>>> "Stefan" == Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>>>> Typing TAB or ? in M-x find-library shows .el and .elc files when it
>>>> probably should just be the name of the library without the extension.
>>> I added the `push' because in load-library I often want to
>>> select a particular file (i.e. either the .el or the .elc file).
>> Doesn't M-x load-library and specifying no extension load the .elc?

> Usually, yes.

BTW, please try the patch below, to see if you like the
resulting behavior.


        Stefan


=== modified file 'lisp/files.el'
--- lisp/files.el	2010-06-13 19:52:42 +0000
+++ lisp/files.el	2010-07-25 23:57:51 +0000
@@ -777,9 +777,12 @@
                (if x (1- (length x)) (length suffix))))))
    (t
     (let ((names nil)
+          (stripsuffix t)
 	  (suffix (concat (regexp-opt suffixes t) "\\'"))
 	  (string-dir (file-name-directory string))
           (string-file (file-name-nondirectory string)))
+      (while
+          (progn
       (dolist (dir dirs)
 	(unless dir
 	  (setq dir default-directory))
@@ -787,10 +790,15 @@
 	(when (file-directory-p dir)
 	  (dolist (file (file-name-all-completions
 			 string-file dir))
+                  (if (not (string-match suffix file))
 	    (push file names)
-	    (when (string-match suffix file)
+                    (unless stripsuffix (push file names))
 	      (setq file (substring file 0 (match-beginning 0)))
               (push file names)))))
+            ;; Remove duplicates of the first element.
+            (setq names (cons (car names) (delete (car names) (cdr names))))
+            (prog1 (and stripsuffix (= 1 (length names)))
+              (setq stripsuffix nil))))
       (completion-table-with-context
        string-dir names string-file pred action)))))
 





Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Thu, 19 Aug 2010 21:33:02 GMT) Full text and rfc822 format available.

Notification sent to "Aaron S. Hawley" <aaron.s.hawley <at> gmail.com>:
bug acknowledged by developer. (Thu, 19 Aug 2010 21:33:02 GMT) Full text and rfc822 format available.

Message #22 received at 5955-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Aaron S. Hawley" <aaron.s.hawley <at> gmail.com>
Subject: Re: bug#5955: completions in M-x find-library include .elc files
Date: Thu, 19 Aug 2010 23:24:29 +0200
>> BTW, please try the patch below, to see if you like the
>> resulting behavior.
> Interesting idea.  Show matches for more than one library without
> suffixes, but if there is only one match show the possible extensions.
> I'd say this is an improvement for users over the current behavior.

I've installed this change (well, a slightly different version).

> However, some libraries names are a prefix for another.  So really,

Yes, it's not perfect, but I think it's good enough.  I don't think it's
a clean enough behavior to warrant documenting.


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 17 Sep 2010 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.