all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Ken Brown <kbrown@cornell.edu>
Cc: 5845@debbugs.gnu.org
Subject: bug#5845: load-library vs. list-load-path-shadows
Date: Tue, 16 Jan 2018 16:32:11 -0500	[thread overview]
Message-ID: <CAM-tV-_LA+y5Kdw_PmbeNVZuOxuCNyBMMereaq4SoLmyi-gohg@mail.gmail.com> (raw)
In-Reply-To: <8162aa6c-e00a-199b-3572-e3e0a7d4cad7@cornell.edu>

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

On Tue, Jan 16, 2018 at 12:25 PM, Ken Brown <kbrown@cornell.edu> wrote:
> On 1/16/2018 10:54 AM, Noam Postavsky wrote:
>>
>> Should we just use case-insensitive compare for `windows-nt' systems?
>> The idea of using "the same heuristics" as `load' sounds nice, but as
>> far as I can tell, `load' just queries the file system directly. Doing
>> the same in `load-path-shadow-find' is far too slow (raises execution
>> time from 0.38s to 5.64s, and that's without any packages adding to
>> the load-path).
>
>
> Would it help to use file-name-case-insensitive-p?

Ah, good point. How about the attached?

[-- Attachment #2: v2-0001-Handle-case-insensitive-filenames-for-load-path-s.patch --]
[-- Type: application/octet-stream, Size: 2060 bytes --]

From acbdb32b0a1973ad3f9c361748d9aa3c461e2449 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Tue, 16 Jan 2018 16:26:56 -0500
Subject: [PATCH v2] Handle case-insensitive filenames for load-path shadows
 (Bug#5845)

* lisp/emacs-lisp/shadow.el (load-path-shadows-find): Check for
shadowing with case-insensitive matching for files of case-insensitive
directories (as determined by `file-name-case-insentive-p').
---
 lisp/emacs-lisp/shadow.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el
index 88a494f..6402695 100644
--- a/lisp/emacs-lisp/shadow.el
+++ b/lisp/emacs-lisp/shadow.el
@@ -78,6 +78,7 @@ load-path-shadows-find
 	shadows				; List of shadowings, to be returned.
 	files				; File names ever seen, with dirs.
 	dir				; The dir being currently scanned.
+	dir-case-sensitive              ; `file-name-case-insentive-p' for dir.
 	curr-files			; This dir's Emacs Lisp files.
 	orig-dir			; Where the file was first seen.
 	files-seen-this-dir		; Files seen so far in this dir.
@@ -104,6 +105,9 @@ load-path-shadows-find
 	     (message "Checking %d files in %s..." (length curr-files) dir))
 
 	(setq files-seen-this-dir nil)
+        ;; We assume that case sensitivity of a directory applies to
+        ;; its files.
+        (setq dir-case-sensitive (file-name-case-sensitive-p dir))
 
 	(dolist (file curr-files)
 
@@ -123,7 +127,9 @@ load-path-shadows-find
 	    ;; XXX.elc (or vice-versa) when they are in the same directory.
 	    (setq files-seen-this-dir (cons file files-seen-this-dir))
 
-	    (if (setq orig-dir (assoc file files))
+            (if (setq orig-dir (assoc file files
+                                      (unless dir-case-sensitive
+                                        (lambda (f1 f2) (eq (compare-strings f1 nil nil f2 nil nil t) t)))))
 		;; This file was seen before, we have a shadowing.
 		;; Report it unless the files are identical.
 		(let ((base1 (concat (cdr orig-dir) "/" file))
-- 
2.6.2.windows.1


  reply	other threads:[~2018-01-16 21:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05 11:03 load-library vs. list-load-path-shadows Juanma Barranquero
2010-04-05 13:57 ` Stefan Monnier
2010-04-06 13:36 ` bug#5845: " Juanma Barranquero
2010-04-06 14:40   ` Leo
2010-04-06 16:11     ` Juanma Barranquero
2018-01-16 15:54   ` Noam Postavsky
2018-01-16 17:25     ` Ken Brown
2018-01-16 21:32       ` Noam Postavsky [this message]
2018-01-17 15:37         ` Eli Zaretskii
2018-01-18 17:05           ` Noam Postavsky
2018-01-18 18:51             ` Eli Zaretskii
2018-01-18 19:39               ` Noam Postavsky
2018-01-18 20:46                 ` Eli Zaretskii
2018-01-18 21:40                   ` Noam Postavsky

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=CAM-tV-_LA+y5Kdw_PmbeNVZuOxuCNyBMMereaq4SoLmyi-gohg@mail.gmail.com \
    --to=npostavs@users.sourceforge.net \
    --cc=5845@debbugs.gnu.org \
    --cc=kbrown@cornell.edu \
    /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.