all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: "Aaron S. Hawley" <aaron.s.hawley@gmail.com>
Cc: 5955@debbugs.gnu.org
Subject: bug#5955: completions in M-x find-library include .elc files
Date: Mon, 26 Jul 2010 01:58:49 +0200	[thread overview]
Message-ID: <jwvsk37cdwn.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <jwvwrsje3dd.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 25 Jul 2010 22:03:13 +0200")

>>>>> "Stefan" == Stefan Monnier <monnier@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	other threads:[~2010-07-25 23:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16  2:28 bug#5955: completions in M-x find-library include .elc files Aaron S. Hawley
2010-07-23 22:59 ` Stefan Monnier
2010-07-25  0:44   ` Aaron S. Hawley
2010-07-25 20:03     ` Stefan Monnier
2010-07-25 23:58       ` Stefan Monnier [this message]
     [not found]         ` <AANLkTinVv=ZFF7u623bcg_ZHyVuG3SNYck8M60qZ-Fqx@mail.gmail.com>
2010-08-19 21:24           ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=jwvsk37cdwn.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=5955@debbugs.gnu.org \
    --cc=aaron.s.hawley@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.