Subject: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el

From: Johan Claesson <[email-masked]>
Date: Wed, 05 Sep 2012 18:23:01 +0200

Maybe the following is cleaner.

		      ;; Ignore these files.
		      (member file '("subdirs" "leim-list"))
                      (string= file (file-name-sans-extension dir-locals-file)))

Regards,

/Johan

Johan Claesson <[email-masked]> writes:

> Hi,
>
> A minor suggestion for shadow.el.  list-load-path-shadows will detect
> if there are two lisp files with the same name in the load-path.  Such
> a clash could cause problems for normal lisp files.  But i think it is
> normal to have multiple .dir-locals.el files spread across the
> load-path.  In order to avoid false warnings list-load-path-shadows
> could ignore the special file name .dir-locals.el.
>
> If you agree with this change it may be implemented by adding
> ".dir-locals" to the ignore list at line 118 of shadow.el:
>
> 		      ;; Ignore these files.
> 		      (member file '("subdirs" "leim-list" ".dir-locals")))
>
> The following test case creates two temporary directories and puts
> empty .dir-locals.el files in them.  It currently returns
> "/tmp/dir1-28571pXx/.dir-locals hides /tmp/dir2-28571bhA/.dir-locals".
>
> (let* ((dir1 (make-temp-file "/tmp/dir1-" t))
>        (dir2 (make-temp-file "/tmp/dir2-" t)))
>   (require 'shadow)
>   (write-region "" nil (concat dir1 "/.dir-locals.el"))
>   (write-region "" nil (concat dir2 "/.dir-locals.el"))
>   (let* ((load-path (list dir1 dir2))
> 	 (shadows (list-load-path-shadows t)))
>     (delete-directory dir1 t)
>     (delete-directory dir2 t)
>     shadows))
>
> Regards,
>
> /Johan
>
>
>
> In GNU Emacs 24.2.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)
>  of 2012-09-03 on goblin
> Windowing system distributor `The X.Org Foundation', version 11.0.11203000
> Configured using:
>  `configure '--prefix=/home/jcl/usr' '--without-toolkit-scroll-bars'
>  '-C' '--disable-maintainer-mode' '--without-compress-info''
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: en_US.UTF-8
>   value of $XMODIFIERS: nil
>   locale-coding-system: utf-8-unix
>   default enable-multibyte-characters: t
>
> Major mode: Summary
>
> Minor modes in effect:
>   erc-list-mode: t
>   erc-menu-mode: t
>   erc-autojoin-mode: t
>   erc-ring-mode: t
>   erc-networks-mode: t
>   erc-pcomplete-mode: t
>   erc-track-mode: t
>   erc-track-minor-mode: t
>   erc-match-mode: t
>   erc-button-mode: t
>   erc-fill-mode: t
>   erc-stamp-mode: t
>   erc-netsplit-mode: t
>   erc-irccontrols-mode: t
>   erc-noncommands-mode: t
>   erc-move-to-prompt-mode: t
>   erc-readonly-mode: t
>   display-time-mode: t
>   global-cwarn-mode: t
>   which-function-mode: t
>   icomplete-mode: t
>   minibuffer-depth-indicate-mode: t
>   diff-auto-refine-mode: t
>   shell-dirtrack-mode: t
>   ido-everywhere: t
>   electric-layout-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC 
> SPC SPC SPC SPC [ [ [ [ [ [ C-1 C-1 p s SPC - e f SPC 
> | S-SPC g r e p SPC s e n d m a i l <return> M-x p 
> r o c e d <return> M-1 T C-s e m a c s C-s C-a C-s 
> C-s C-s C-s <C-home> C-s s e n d <home> F C-g f a l 
> <tab> <return> C-s C-s m a i l C-s C-a q <C-tab> <M-next> 
> <return> <return> <return> <return> C-q i q p p p C-q 
> i M-g n C-v M-v ! q g p p p p <return> q C-q i M-g 
> C-1 C-1 <return> <return> C-x C-f i n s t a l l e m 
> <return> C-s b z e C-s <backspace> <backspace> r C-s 
> C-s C-s C-s C-s C-a C-l C-1 C-1 c d <return> c d SPC 
> b u i <tab> t r <tab> <return> b z r SPC p u l l <return> 
> C-1 C-2 <return> <return> f i n d SPC . SPC - n a m 
> e SPC s h a d o w . e l <return> C-s <up> <left> <left> 
> C-x C-f C-f C-g C-x C-S-f <return> C-s i g n o r e 
> C-a C-1 C-1 C-q C-q <return> C-1 C-r <up> <up> C-1 
> C-r <home> C-s d i r - <home> C-x s M-x e m a c s - 
> <backspace> <backspace> <backspace> <backspace> <backspace> 
> <backspace> r e p o r C-g C-q i M-g n n C-p C-p C-p 
> B B u l f <return> C-n E M-x r e p o r t = e m <backspace> 
> <backspace> <backspace> - e m <tab> b <tab> <retur
> n>
>
> Recent messages:
> Expiring articles...done
> Reading incoming mail from file... [2 times]
> Wrote /home/jcl/mail/erlang-questions/13282
> Wrote /home/jcl/mail/emacs-devel/14561
> Wrote /home/jcl/mail/inbox/7063
> Wrote /home/jcl/mail/inbox/7064
> nnml: Reading incoming mail (4 new)...done
> Copying to ulfc: (7051)...
> Wrote /home/jcl/mail/ulfc/60
> Quit
>
> Load-path shadows:
> None found.
>
> Features:
> (vc-bzr emacsbug shadow w3m-lnum w3m-bookmark w3m-tabmenu w3m-session
> w3m-cookie w3m-form chistory rx desktop etags jcl-wesnoth-init
> wesnoth-mode wesnoth-wml-data wesnoth-update tabify hippie-exp dabbrev
> url-handlers gnus-draft gnus-fun flow-fill python-21 python cl-specs
> edebug mailalias cal-iso cal-move sort gnus-cite mail-extr gnus-bcklg
> gnus-async vc-git nnrss xml mm-url misearch multi-isearch add-log
> gnus-dired url-cache url-http url-gw url-auth erc-menu erc-join erc-ring
> erc-networks erc-pcomplete erc-track erc-match erc-button erc-fill
> erc-stamp erc-netsplit erc-goodies erc erc-backend erc-compat
> jcl-replace jcl-ruby jcl-sl w3m-load jcl-w3m w3m-search jcl-work-buffer
> w3m-type-ahead jcl-games jcl-text-translator-init text-translator
> text-translator-window text-translator-vars text-translator-sites
> jcl-muse htmlize-hack htmlize muse-latex muse-html muse-xml-common
> muse-colors cus-edit cus-start cus-load muse-publish muse-project
> muse-protocols muse-regexps derived muse muse-nested-tags muse-mode
> jcl-dictem-init dictem jcl-yaoddmuse yaoddmuse-extension w3m doc-view
> jka-compr image-mode timezone w3m-hist w3m-fb bookmark-w3m w3m-ems
> w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util yaoddmuse url
> url-proxy url-privacy url-expand url-methods url-history url-cookie
> url-util url-parse url-vars skeleton sgml-mode smiley network-stream tls
> jcl-stumpwm autorevert jcl-slime slime-fancy slime-fontifying-fu
> slime-package-fu slime-references slime-scratch slime-presentations
> slime-fuzzy slime-fancy-inspector slime-c-p-c slime-editing-commands
> slime-autodoc slime-parse slime-repl slime apropos hyperspec browse-url
> find-lisp eldoc time eldoc-eval-autoloads muse-autoloads
> svg-clock-autoloads package tabulated-list jcl-renegade-goblin
> jcl-home-boot mule-util flyspell qp parse-time gnus-ml nndraft nnmh
> nnfolder nnml gnus-agent gnus-srvr gnus-score score-mode nnvirtual
> gnus-msg gnus-art mm-uu mml2015 epg-config mm-view mml-smime smime dig
> nntp gnus-cache jcl-gnus-init jcl-gnus gnus-sum nnoo gnus-group
> gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range
> gnus-win mailcap starttls smtpmail sendmail message rfc822 mml mml-sec
> mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
> ietf-drums mailabbrev gmm-utils mailheader gnus gnus-ems nnheader
> mail-utils wid-edit jcl-goblin fuzzy-match jcl-load-beta jcl-torrent
> text-translator-load jcl-calendar-init appt jcl-calendar holidays
> hol-loaddefs diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
> jcl-emms-init emms-playing-time emms-mode-line emms-cache
> emms-info-ogginfo emms-info-mp3info emms-info later-do
> emms-playlist-mode emms-player-vlc emms-player-mplayer
> emms-player-simple emms-source-playlist emms-source-file emms-setup emms
> emms-compat jcl-erc-init jcl-file-cache-init jcl-grep-sbg sbg
> jcl-ido-init jcl-eel bindat jcl-dired dired-x dired-details wdired
> dired-aux jcl-register-init jcl-command-subset-init jcl-generic
> generic-x jcl-erlang-init jcl-erlang distel-ie edb patmatch erl-service
> derl erlext epmd net-fsm erl distel erlang man erlang-eunit jcl-safe
> jcl-abbrev-init jcl-swedish-postfix quail help-mode jcl-term time-stamp
> ange-ftp jcl-face hl-line jcl-modes-init jcl-rfc rfcview view goto-addr
> proced table picture inf-ruby ruby-mode sh-script noutline outline
> hideshow cwarn jcl-imenu jcl-global-init which-func imenu winner
> thingatpt paren mic-paren printing ps-print ps-def lpr icomplete ispell
> uniquify mb-depth midnight whitespace ffap saveplace jcl-keys-init
> diff-mode easy-mmode term disp-table ehelp kmacro tramp tramp-compat
> auth-source eieio assoc gnus-util mm-util mail-prsvr password-cache
> shell pcomplete format-spec tramp-loaddefs windmove jcl-keys
> jcl-load-functions jcl-file-cache ert find-func ewoc debug filecache
> jcl-elisp hi-lock jcl-register jcl-grep grep compile jcl-command-subset
> ido jcl-emacsclient jcl-duff jcl-template-init jcl-template jcl-motion
> jcl-windows jcl-recommended jcl-site-start jcl-erlang-log bookmark pp
> jcl-ediff byte-opt warnings bytecomp byte-compile cconv macroexp
> jcl-misc newcomment jcl-compile ediff-merg ediff-diff ediff-wind
> ediff-help ediff-util ediff-mult ediff-init ediff fpl electric cc-mode
> cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
> cc-defs erlang-start clearcase tq reporter executable dired comint
> regexp-opt ansi-color ring info easymenu jcl-times-init advice help-fns
> advice-preload jcl-times jcl-util server cl jcl-load-path time-date
> tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
> dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow
> timer select scroll-bar mouse jit-lock font-lock syntax facemenu
> font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
> thai tai-viet lao korean japanese hebrew greek romanian slovak czech
> european ethiopic indian cyrillic chinese case-table epa-hook
> jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
> cus-face files text-properties overlay sha1 md5 base64 format env
> code-pages mule custom widget hashtable-print-readable backquote
> make-network-process dbusbind dynamic-setting system-font-setting
> font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)