Package: emacs;
Reported by: Johan Claesson <johanclaesson <at> bredband.net>
Date: Wed, 5 Sep 2012 15:54:02 UTC
Severity: minor
Tags: patch
Found in version 24.2
Fixed in version 24.4
Done: Glenn Morris <rgm <at> gnu.org>
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 12357 in the body.
You can then email your comments to 12357 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
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Wed, 05 Sep 2012 15:54:02 GMT) Full text and rfc822 format available.Johan Claesson <johanclaesson <at> bredband.net>
:bug-gnu-emacs <at> gnu.org
.
(Wed, 05 Sep 2012 15:54:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: bug-gnu-emacs <at> gnu.org Subject: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Wed, 05 Sep 2012 15:38:56 +0200
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)
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Wed, 05 Sep 2012 16:24:02 GMT) Full text and rfc822 format available.Message #8 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el 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 <johanclaesson <at> bredband.net> 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)
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Sat, 08 Sep 2012 01:14:01 GMT) Full text and rfc822 format available.Message #11 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Glenn Morris <rgm <at> gnu.org> To: Johan Claesson <johanclaesson <at> bredband.net> Cc: 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Fri, 07 Sep 2012 21:13:32 -0400
Johan Claesson wrote: > 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. I think you are right, but if any one given directory has more than one dir-locals file above it in the directory tree, then the "lowest" one does indeed shadow all the "higher" ones. So it might be good to still report such cases?
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Sat, 08 Sep 2012 14:09:02 GMT) Full text and rfc822 format available.Message #14 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: Glenn Morris <rgm <at> gnu.org> Cc: 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Sat, 08 Sep 2012 16:08:03 +0200
I did not think about that kind of shadowing. I agree that would also be nice to have reported. But i think it is a different thing. Also it could be that the user wants the lower dir-locals file to shadow the higher one. But i guess no user wants one lisp file to shadow another in the load-path. Maybe a separate command could search for dir-local files shadowing other dir-local files for a given directory or list of directories. (I could submit such a function.) I usually run list-load-path-shadows in the same go as compiling my elisp directory and just like it is nice to have no compiler warnings it is nice to have no shadow warnings. Regards, /Johan Glenn Morris <rgm <at> gnu.org> writes: > Johan Claesson wrote: > >> 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. > > I think you are right, but if any one given directory has more than one > dir-locals file above it in the directory tree, then the "lowest" one > does indeed shadow all the "higher" ones. So it might be good to still > report such cases?
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Sun, 16 Sep 2012 18:59:02 GMT) Full text and rfc822 format available.Message #17 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: Glenn Morris <rgm <at> gnu.org> Cc: 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Sun, 16 Sep 2012 20:56:39 +0200
A command to search for .dir-local.el shadows could look something like below. Let me know if a polished version of the code below would be useful. I should probably clarify that this was not at all what i had in mind when writing this bug report/suggestion in the first place :). I would be happy if just the list-load-path-shadows command would ignore .dir-locals.el files. (defun list-load-path-dir-locals-shadows () (interactive) (dir-locals-shadows load-path)) (defun dir-locals-shadows (path) (when (stringp path) (setq path (list path))) (with-current-buffer (get-buffer-create "*Dir-Locals-Shadows*") (erase-buffer) (dolist (dir path) (dir-locals-shadows-aux dir (dir-locals-find-file (file-name-as-directory dir)))) (if (> (point-max) (point-min)) (display-buffer (current-buffer)) (kill-buffer (current-buffer)) (message "No dir-local shadows found.")))) (defun dir-locals-class-name (class) (if (stringp class) class (if (file-name-directory (symbol-name (cadr class))) (concat (car class) dir-locals-file) (format "%s%s (class %s)" (car class) dir-locals-file (cadr class))))) (defun dir-locals-shadows-aux (dir locals) (dolist (file (directory-files dir nil nil t)) (let ((subdir (expand-file-name file dir))) (when (and (file-directory-p subdir) (not (or (string-equal file ".") (string-equal file "..") (file-symlink-p subdir)))) (let ((subdir-locals (dir-locals-find-file (file-name-as-directory subdir)))) (and locals (not (equal locals subdir-locals)) (insert (format "%s shadows %s\n" (dir-locals-class-name subdir-locals) (dir-locals-class-name locals)))) (dir-locals-shadows-aux subdir subdir-locals)))))) Regards, /Johan Johan Claesson <johanclaesson <at> bredband.net> writes: > I did not think about that kind of shadowing. I agree that would also > be nice to have reported. But i think it is a different thing. Also > it could be that the user wants the lower dir-locals file to shadow the > higher one. But i guess no user wants one lisp file to shadow another > in the load-path. > > Maybe a separate command could search for dir-local files shadowing > other dir-local files for a given directory or list of directories. > (I could submit such a function.) > > I usually run list-load-path-shadows in the same go as compiling my > elisp directory and just like it is nice to have no compiler warnings it > is nice to have no shadow warnings. > > Regards, > > /Johan > > > Glenn Morris <rgm <at> gnu.org> writes: > >> Johan Claesson wrote: >> >>> 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. >> >> I think you are right, but if any one given directory has more than one >> dir-locals file above it in the directory tree, then the "lowest" one >> does indeed shadow all the "higher" ones. So it might be good to still >> report such cases?
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Wed, 26 Feb 2014 08:50:02 GMT) Full text and rfc822 format available.Message #20 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Xue Fuqiao <xfq <at> gnu.org> To: 12357 <at> debbugs.gnu.org Cc: Glenn Morris <rgm <at> gnu.org>, Johan Claesson <johanclaesson <at> bredband.net> Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Wed, 26 Feb 2014 16:49:22 +0800
Johan Claesson <johanclaesson <at> bredband.net> writes: > A command to search for .dir-local.el shadows could look something like > below. Looks fine to me. I made a patch (and tested it). Any comments? (I haven't written the documentation/ChangeLog/NEWS yet.) === modified file 'lisp/emacs-lisp/shadow.el' --- lisp/emacs-lisp/shadow.el 2014-01-01 07:43:34 +0000 +++ lisp/emacs-lisp/shadow.el 2014-02-26 08:38:54 +0000 @@ -115,7 +115,8 @@ ;; FILE now contains the current file name, with no suffix. (unless (or (member file files-seen-this-dir) ;; Ignore these files. - (member file '("subdirs" "leim-list"))) + (member file '("subdirs" "leim-list")) + (string= file (file-name-sans-extension dir-locals-file))) ;; File has not been seen yet in this directory. ;; This test prevents us declaring that XXX.el shadows ;; XXX.elc (or vice-versa) when they are in the same directory. @@ -281,6 +282,49 @@ (forward-line 1)) (message "%s" msg))))))) + + +(defun list-load-path-dir-locals-shadows () + "Display a list of dir-local files that shadow other files." + (interactive) + (dir-locals-shadows load-path)) + +(defun dir-locals-shadows (path) + "Display a list of dir-local files that shadow other files under PATH." + (when (stringp path) + (setq path (list path))) + (with-current-buffer (get-buffer-create "*Dir-Locals-Shadows*") + (erase-buffer) + (dolist (dir path) + (dir-locals-shadows-1 dir (dir-locals-find-file (file-name-as-directory dir)))) + (if (> (point-max) (point-min)) + (display-buffer (current-buffer)) + (kill-buffer (current-buffer)) + (message "No dir-local shadows found.")))) + +(defun dir-locals-class-name (class) + (if (stringp class) + class + (if (file-name-directory (symbol-name (cadr class))) + (concat (car class) dir-locals-file) + (format "%s%s (class %s)" (car class) dir-locals-file (cadr class))))) + +(defun dir-locals-shadows-1 (dir locals) + "Auxiliary function for `dir-locals-shadows'." + (dolist (file (directory-files dir nil nil 'no-sort)) + (let ((subdir (expand-file-name file dir))) + (when (and (file-directory-p subdir) + (not (or (string-equal file ".") + (string-equal file "..") + (file-symlink-p subdir)))) + (let ((subdir-locals (dir-locals-find-file (file-name-as-directory subdir)))) + (and locals + (not (equal locals subdir-locals)) + (insert (format "%s shadows %s\n" + (dir-locals-class-name subdir-locals) + (dir-locals-class-name locals)))) + (dir-locals-shadows-1 subdir subdir-locals)))))) + (provide 'shadow) ;;; shadow.el ends here -- http://www.gnu.org/software/emacs/
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Sun, 02 Mar 2014 22:15:02 GMT) Full text and rfc822 format available.Message #23 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: Xue Fuqiao <xfq <at> gnu.org> Cc: Glenn Morris <rgm <at> gnu.org>, 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Sun, 02 Mar 2014 23:14:30 +0100
[Message part 1 (text/plain, inline)]
Great. Attached is a loading.texi patch that just add to the description of list-load-path-shadows that it will not report .dir-locals.el files. Do you think there should be a @deffn entry for list-load-path-dir-locals-shadows as well? Also attached is a shadow.el patch with the following changes: 1. Some more doc string text. 2. list-load-path-dir-locals-shadows uses the same button making code as list-load-path-shadows. 3. Inherit the major mode from special-mode instead of fundamental-mode to get quit on ?q etc. 4. Also bind forward-button to tab in this mode. And backward-button to backtab. 5. It will not bail out on an invalid directory in load-path any more (i happened to have some invalid directories in load-path while testing this :) ). Regards, /Johan
[loading.texi.diff (text/x-diff, inline)]
=== modified file 'doc/lispref/loading.texi' --- old/doc/lispref/loading.texi 2014-01-01 07:43:34 +0000 +++ new/doc/lispref/loading.texi 2014-03-02 21:39:14 +0000 @@ -411,12 +411,19 @@ directory. Such a situation might indicate a problem in the way Emacs was installed. +Files named @file{.dir-locals.el} are not reported by this command. +These files specify directory local variables, see @ref{Directory +Local Variables}. It is normal that it exists multiple files with +this name. + When called from Lisp, this function prints a message listing the shadowed files, instead of displaying them in a buffer. If the optional argument @code{stringp} is non-@code{nil}, it instead returns the shadowed files as a string. @end deffn + + @node Loading Non-ASCII @section Loading Non-@acronym{ASCII} Characters
[shadow.el.diff (text/x-diff, inline)]
=== modified file 'lisp/emacs-lisp/shadow.el' --- old/lisp/emacs-lisp/shadow.el 2014-01-01 07:43:34 +0000 +++ new/lisp/emacs-lisp/shadow.el 2014-03-02 22:06:37 +0000 @@ -115,7 +115,8 @@ ;; FILE now contains the current file name, with no suffix. (unless (or (member file files-seen-this-dir) ;; Ignore these files. - (member file '("subdirs" "leim-list"))) + (member file '("subdirs" "leim-list")) + (string= file (file-name-sans-extension dir-locals-file))) ;; File has not been seen yet in this directory. ;; This test prevents us declaring that XXX.el shadows ;; XXX.elc (or vice-versa) when they are in the same directory. @@ -169,20 +170,27 @@ . (1 font-lock-warning-face))) "Keywords to highlight in `load-path-shadows-mode'.") -(define-derived-mode load-path-shadows-mode fundamental-mode "LP-Shadows" +(define-derived-mode load-path-shadows-mode special-mode "LP-Shadows" "Major mode for load-path shadows buffer." (set (make-local-variable 'font-lock-defaults) '((load-path-shadows-font-lock-keywords))) (setq buffer-undo-list t buffer-read-only t)) +(let ((map (make-sparse-keymap))) + (define-key map [tab] 'forward-button) + (define-key map [backtab] 'backward-button) + (setq load-path-shadows-mode-map map)) + ;; TODO use text-properties instead, a la dired. (require 'button) (define-button-type 'load-path-shadows-find-file 'follow-link t -;; 'face 'default 'action (lambda (button) - (let ((file (concat (button-get button 'shadow-file) ".el"))) + (let* ((shadow-file (button-get button 'shadow-file)) + (file (if (equal (file-name-extension shadow-file) "el") + shadow-file + (concat shadow-file ".el")))) (or (file-exists-p file) (setq file (concat file ".gz"))) (if (file-readable-p file) @@ -190,6 +198,20 @@ (error "Cannot read file")))) 'help-echo "mouse-2, RET: find this file") +(defun load-path-shadows-make-buttons () + "Create buttons for `load-path-shadows-mode'." + (let ((inhibit-read-only t)) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "\\(^.*\\) hides \\(.*$\\)" + nil t) + (dotimes (i 2) + (make-button (match-beginning (1+ i)) + (match-end (1+ i)) + 'type 'load-path-shadows-find-file + 'shadow-file + (match-string (1+ i)))))))) + ;;;###autoload (defun list-load-path-shadows (&optional stringp) @@ -231,6 +253,11 @@ XXX.elc in an early directory (that does not contain XXX.el) is considered to shadow a later file XXX.el, and vice-versa. +Files named .dir-locals.el are not reported by this command. +These files specify directory local variables. It is normal that +it exists multiple files with this name. But see the command +`list-load-path-dir-locals-shadows'. + Shadowings are located by calling the (non-interactive) companion function, `load-path-shadows-find'." (interactive) @@ -257,14 +284,7 @@ (erase-buffer) (insert string) (insert msg "\n") - (while (re-search-backward "\\(^.*\\) hides \\(.*$\\)" - nil t) - (dotimes (i 2) - (make-button (match-beginning (1+ i)) - (match-end (1+ i)) - 'type 'load-path-shadows-find-file - 'shadow-file - (match-string (1+ i))))) + (load-path-shadows-make-buttons) (goto-char (point-max))))) ;; We are non-interactive, print shadows via message. (unless (zerop n) @@ -281,6 +301,64 @@ (forward-line 1)) (message "%s" msg))))))) + + + + +(defun list-load-path-dir-locals-shadows () + "Display a list of dir-local files that shadow other such files. + +A .dir-locals.el file will shadow any other such file higher up +in the directory tree. Sometimes this is what you want, +sometimes it is not. This command will show all such shadowing +in the current `load-path'. + +This command complements the command `list-load-path-shadows'. +" + (interactive) + (dir-locals-shadows load-path)) + +(defun dir-locals-shadows (path) + "Display a list of dir-local files that shadow other files under PATH." + (when (stringp path) + (setq path (list path))) + (with-current-buffer (get-buffer-create "*Dir-Locals-Shadows*") + (let ((inhibit-read-only t)) + (erase-buffer) + (dolist (dir path) + (if (file-directory-p dir) + (dir-locals-shadows-1 dir (dir-locals-find-file (file-name-as-directory dir))) + (insert (format "invalid dir %s\n" dir))))) + (load-path-shadows-mode) + (load-path-shadows-make-buttons) + (if (> (point-max) (point-min)) + (display-buffer (current-buffer)) + (kill-buffer (current-buffer)) + (message "No dir-local shadows found.")))) + +(defun dir-locals-class-name (class) + (if (stringp class) + class + (if (file-name-directory (symbol-name (cadr class))) + (concat (car class) dir-locals-file) + (format "%s%s (class %s)" (car class) dir-locals-file (cadr class))))) + +(defun dir-locals-shadows-1 (dir locals) + "Auxiliary function for `dir-locals-shadows'." + (dolist (file (directory-files dir nil nil 'no-sort)) + (let ((subdir (expand-file-name file dir))) + (when (and (file-directory-p subdir) + (not (or (string-equal file ".") + (string-equal file "..") + (file-symlink-p subdir)))) + (let ((subdir-locals (dir-locals-find-file (file-name-as-directory subdir)))) + (and locals + (not (equal locals subdir-locals)) + (insert (format "%s hides %s\n" + (dir-locals-class-name subdir-locals) + (dir-locals-class-name locals)))) + (dir-locals-shadows-1 subdir subdir-locals)))))) + (provide 'shadow) ;;; shadow.el ends here
[Message part 4 (text/plain, inline)]
Xue Fuqiao <xfq <at> gnu.org> writes: > Johan Claesson <johanclaesson <at> bredband.net> writes: > >> A command to search for .dir-local.el shadows could look something like >> below. > > Looks fine to me. I made a patch (and tested it). Any comments? > > (I haven't written the documentation/ChangeLog/NEWS yet.) > > === modified file 'lisp/emacs-lisp/shadow.el' > --- lisp/emacs-lisp/shadow.el 2014-01-01 07:43:34 +0000 > +++ lisp/emacs-lisp/shadow.el 2014-02-26 08:38:54 +0000 > @@ -115,7 +115,8 @@ > ;; FILE now contains the current file name, with no suffix. > (unless (or (member file files-seen-this-dir) > ;; Ignore these files. > - (member file '("subdirs" "leim-list"))) > + (member file '("subdirs" "leim-list")) > + (string= file (file-name-sans-extension dir-locals-file))) > ;; File has not been seen yet in this directory. > ;; This test prevents us declaring that XXX.el shadows > ;; XXX.elc (or vice-versa) when they are in the same directory. > @@ -281,6 +282,49 @@ > (forward-line 1)) > (message "%s" msg))))))) > > + > + > +(defun list-load-path-dir-locals-shadows () > + "Display a list of dir-local files that shadow other files." > + (interactive) > + (dir-locals-shadows load-path)) > + > +(defun dir-locals-shadows (path) > + "Display a list of dir-local files that shadow other files under PATH." > + (when (stringp path) > + (setq path (list path))) > + (with-current-buffer (get-buffer-create "*Dir-Locals-Shadows*") > + (erase-buffer) > + (dolist (dir path) > + (dir-locals-shadows-1 dir (dir-locals-find-file (file-name-as-directory dir)))) > + (if (> (point-max) (point-min)) > + (display-buffer (current-buffer)) > + (kill-buffer (current-buffer)) > + (message "No dir-local shadows found.")))) > + > +(defun dir-locals-class-name (class) > + (if (stringp class) > + class > + (if (file-name-directory (symbol-name (cadr class))) > + (concat (car class) dir-locals-file) > + (format "%s%s (class %s)" (car class) dir-locals-file (cadr class))))) > + > +(defun dir-locals-shadows-1 (dir locals) > + "Auxiliary function for `dir-locals-shadows'." > + (dolist (file (directory-files dir nil nil 'no-sort)) > + (let ((subdir (expand-file-name file dir))) > + (when (and (file-directory-p subdir) > + (not (or (string-equal file ".") > + (string-equal file "..") > + (file-symlink-p subdir)))) > + (let ((subdir-locals (dir-locals-find-file (file-name-as-directory subdir)))) > + (and locals > + (not (equal locals subdir-locals)) > + (insert (format "%s shadows %s\n" > + (dir-locals-class-name subdir-locals) > + (dir-locals-class-name locals)))) > + (dir-locals-shadows-1 subdir subdir-locals)))))) > + > (provide 'shadow) > > ;;; shadow.el ends here
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Sun, 02 Mar 2014 22:38:02 GMT) Full text and rfc822 format available.Message #26 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Xue Fuqiao <xfq <at> gnu.org> To: Johan Claesson <johanclaesson <at> bredband.net> Cc: Xue Fuqiao <xfq <at> gnu.org>, Glenn Morris <rgm <at> gnu.org>, 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Mon, 03 Mar 2014 06:36:55 +0800
Johan Claesson <johanclaesson <at> bredband.net> writes: > Do you think there should be a @deffn entry for > list-load-path-dir-locals-shadows as well? I think so. -- http://www.gnu.org/software/emacs/
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Tue, 04 Mar 2014 22:30:01 GMT) Full text and rfc822 format available.Message #29 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: Xue Fuqiao <xfq <at> gnu.org> Cc: Glenn Morris <rgm <at> gnu.org>, 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Tue, 04 Mar 2014 23:29:24 +0100
[Message part 1 (text/plain, inline)]
Ok, that is added to the loading.texi patch. Also list-load-path-dir-locals-shadows was renamed to list-dir-locals-shadows. An argument PATH was added since it makes sense to run this on other directories than load-path. And the argument STRINGP was added to align with list-load-path-shadows. NEWS suggestion: ** `list-load-path-shadows' no longer reports .dir-locals.el files. A .dir-locals.el file may shadow another .dir-locals.el file but not in the same sense as in `list-load-path-shadows'. A new command `list-dir-locals-shadows' is introduced. It detect shadows of .dir-locals.el files in a way that make sense for this type of files. ChangeLog suggestion: * emacs-lisp/shadows.el (load-path-shadows-find): Do not report .dir-locals.el files. (list-dir-locals-shadows): New command that reports shadows of .dir-locals.el in a way that make sense for that type of file. (dir-locals-shadows-find, dir-locals-shadows-find-1) (dir-locals-class-name, dir-locals-shadows-display): Auxiliary functions for list-dir-locals-shadows. Regards, /Johan
[shadow.el.diff (text/x-diff, inline)]
=== modified file 'lisp/emacs-lisp/shadow.el' --- old/lisp/emacs-lisp/shadow.el 2014-01-01 07:43:34 +0000 +++ new/lisp/emacs-lisp/shadow.el 2014-03-04 22:26:00 +0000 @@ -115,7 +115,8 @@ ;; FILE now contains the current file name, with no suffix. (unless (or (member file files-seen-this-dir) ;; Ignore these files. - (member file '("subdirs" "leim-list"))) + (member file '("subdirs" "leim-list")) + (string= file (file-name-sans-extension dir-locals-file))) ;; File has not been seen yet in this directory. ;; This test prevents us declaring that XXX.el shadows ;; XXX.elc (or vice-versa) when they are in the same directory. @@ -169,20 +170,27 @@ . (1 font-lock-warning-face))) "Keywords to highlight in `load-path-shadows-mode'.") -(define-derived-mode load-path-shadows-mode fundamental-mode "LP-Shadows" +(define-derived-mode load-path-shadows-mode special-mode "LP-Shadows" "Major mode for load-path shadows buffer." (set (make-local-variable 'font-lock-defaults) '((load-path-shadows-font-lock-keywords))) (setq buffer-undo-list t buffer-read-only t)) +(let ((map (make-sparse-keymap))) + (define-key map [tab] 'forward-button) + (define-key map [backtab] 'backward-button) + (setq load-path-shadows-mode-map map)) + ;; TODO use text-properties instead, a la dired. (require 'button) (define-button-type 'load-path-shadows-find-file 'follow-link t -;; 'face 'default 'action (lambda (button) - (let ((file (concat (button-get button 'shadow-file) ".el"))) + (let* ((shadow-file (button-get button 'shadow-file)) + (file (if (equal (file-name-extension shadow-file) "el") + shadow-file + (concat shadow-file ".el")))) (or (file-exists-p file) (setq file (concat file ".gz"))) (if (file-readable-p file) @@ -190,6 +198,21 @@ (error "Cannot read file")))) 'help-echo "mouse-2, RET: find this file") +(defun load-path-shadows-make-buttons () + "Create buttons for `load-path-shadows-mode'." + (let ((inhibit-read-only t)) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "\\(^.*\\) hides \\(.*$\\)" + nil t) + (dotimes (i 2) + (let ((file (match-string (1+ i)))) + (when (file-exists-p file) + (make-button (match-beginning (1+ i)) + (match-end (1+ i)) + 'type 'load-path-shadows-find-file + 'shadow-file file)))))))) + ;;;###autoload (defun list-load-path-shadows (&optional stringp) @@ -231,6 +254,11 @@ XXX.elc in an early directory (that does not contain XXX.el) is considered to shadow a later file XXX.el, and vice-versa. +Files named .dir-locals.el are not reported by this command. +These files specify directory local variables. It is normal that +it exists multiple files with this name. But see the command +`list-dir-locals-shadows'. + Shadowings are located by calling the (non-interactive) companion function, `load-path-shadows-find'." (interactive) @@ -257,14 +285,7 @@ (erase-buffer) (insert string) (insert msg "\n") - (while (re-search-backward "\\(^.*\\) hides \\(.*$\\)" - nil t) - (dotimes (i 2) - (make-button (match-beginning (1+ i)) - (match-end (1+ i)) - 'type 'load-path-shadows-find-file - 'shadow-file - (match-string (1+ i))))) + (load-path-shadows-make-buttons) (goto-char (point-max))))) ;; We are non-interactive, print shadows via message. (unless (zerop n) @@ -281,6 +302,93 @@ (forward-line 1)) (message "%s" msg))))))) + + + +;;;###autoload +(defun list-dir-locals-shadows (&optional stringp path) + "Display a list of .dir-locals.el files that shadow other such files. + +A .dir-locals.el file will shadow any other such file higher up +in the directory tree. Sometimes this is what you want, +sometimes it is not. + +If the optional argument STRINGP is non-nil, returns any shadows +as a string. Otherwise, if interactive shows any shadows in a +`*Dir-Locals-Shadows*' buffer; else print a message listing any +shadows. + +The optional argument PATH is the directory or list of +directories to examine. It defaults to the value of `load-path'. + +This command complements the command `list-load-path-shadows'." + (interactive) + (unless path + (setq path load-path)) + (let ((string (dir-locals-shadows-find path))) + (if stringp + string + (if (zerop (length string)) + (message "No dir-local shadows found.") + (if (called-interactively-p 'interactive) + (dir-locals-shadows-display string) + (message "Dir-locals shadows:\n%s" string)))))) + +(defun dir-locals-shadows-find (path) + "Return a string of .dir-locals.el files that shadows other such files. + +The argument PATH is the directory or list of directories to +examine. + +A .dir-locals.el file will shadow any other such file higher up +in the directory tree. Sometimes this is what you want, +sometimes it is not." + (when (stringp path) + (setq path (list path))) + (with-temp-buffer + (dolist (dir path) + (if (file-directory-p dir) + (dir-locals-shadows-find-1 dir (dir-locals-find-file (file-name-as-directory dir))) + (insert (format "Invalid dir %s\n" dir)))) + (buffer-string))) + +(defun dir-locals-shadows-find-1 (dir locals) + "Auxiliary function for `dir-locals-shadows-find'." + (dolist (file (directory-files dir nil nil 'no-sort)) + (let ((subdir (expand-file-name file dir))) + (when (and (file-directory-p subdir) + (not (or (string-equal file ".") + (string-equal file "..") + (file-symlink-p subdir)))) + (let ((subdir-locals (dir-locals-find-file (file-name-as-directory subdir)))) + (and locals + (not (equal locals subdir-locals)) + (insert (format "%s hides %s\n" + (dir-locals-class-name subdir-locals) + (dir-locals-class-name locals)))) + (dir-locals-shadows-find-1 subdir subdir-locals)))))) + +(defun dir-locals-class-name (class) + "Returns a describing string for directory-local class CLASS. + +CLASS is a values returned from `dir-locals-find-file'. It +can be a string or a list. See that function for details." + (if (stringp class) + class + (if (file-name-directory (symbol-name (cadr class))) + (concat (car class) dir-locals-file) + (format "%s (class %s)" (car class) (cadr class))))) + +(defun dir-locals-shadows-display (string) + "Display the dir-locals shadows STRING in a buffer." + (with-current-buffer (get-buffer-create "*Dir-Locals-Shadows*") + (load-path-shadows-mode) + (let ((inhibit-read-only t)) + (erase-buffer) + (insert string) + (load-path-shadows-make-buttons) + (display-buffer (current-buffer))))) + (provide 'shadow) ;;; shadow.el ends here
[loading.texi.diff (text/x-diff, inline)]
=== modified file 'doc/lispref/loading.texi' --- old/doc/lispref/loading.texi 2014-01-01 07:43:34 +0000 +++ new/doc/lispref/loading.texi 2014-03-04 22:12:52 +0000 @@ -411,12 +411,35 @@ directory. Such a situation might indicate a problem in the way Emacs was installed. +Files named @file{.dir-locals.el} are not reported by this command. +These files specify directory local variables, see @ref{Directory +Local Variables}. It is normal that it exists multiple files with +this name. But see the command @code{list-dir-locals-shadows} +below. + When called from Lisp, this function prints a message listing the shadowed files, instead of displaying them in a buffer. If the -optional argument @code{stringp} is non-@code{nil}, it instead returns +optional argument @var{stringp} is non-@code{nil}, it instead returns the shadowed files as a string. @end deffn +@deffn Command list-dir-locals-shadows &optional stringp path +This command displays a list of @file{.dir-locals.el} files that shadow other +such files. + +A @file{.dir-locals.el} file will shadow any other such file higher up +in the directory tree. Sometimes this is what you want, +sometimes it is not. + +If the optional argument @var{stringp} is non-@code{nil}, returns any +shadows as a string. Otherwise, if interactive shows any shadows in a +buffer; else prints a message listing any shadows. + +The optional argument @var{path} is the directory or list of directories +to examine. It defaults to the value of @code{load-path}. +@end deffn + + @node Loading Non-ASCII @section Loading Non-@acronym{ASCII} Characters
[Message part 4 (text/plain, inline)]
Xue Fuqiao <xfq <at> gnu.org> writes: > Johan Claesson <johanclaesson <at> bredband.net> writes: > >> Do you think there should be a @deffn entry for >> list-load-path-dir-locals-shadows as well? > > I think so.
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Wed, 05 Mar 2014 00:55:01 GMT) Full text and rfc822 format available.Message #32 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Leo Liu <sdl.web <at> gmail.com> To: Johan Claesson <johanclaesson <at> bredband.net> Cc: 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Wed, 05 Mar 2014 08:54:15 +0800
On 2014-03-05 06:29 +0800, Johan Claesson wrote: > * emacs-lisp/shadows.el (load-path-shadows-find): Do not report > .dir-locals.el files. > (list-dir-locals-shadows): New command that reports shadows of > .dir-locals.el in a way that make sense for that type of file. > (dir-locals-shadows-find, dir-locals-shadows-find-1) > (dir-locals-class-name, dir-locals-shadows-display): Auxiliary > functions for list-dir-locals-shadows. I am not too sure what problems are solved by the change. In the case of list-load-path-shadows, it should print anything when in doubt since false positives can be helpful. So it is not entirely wrong to report .dir-locals.el. Use .dir-locals.el in a child directory to shadow parent directory isn't uncommon practice. In future we might even make it capable of inheriting settings in parent directory. So I am not even sure the use case of listing .dir-locals files (defaulting to the load-path)?? Leo
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Wed, 05 Mar 2014 07:10:01 GMT) Full text and rfc822 format available.Message #35 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Wed, 05 Mar 2014 08:09:20 +0100
Well i would like the false positives to go away. That is the problem this attempts to fix. How about a defvar load-path-shadows-report-dir-locals instead? It would of course be true by default to preserve legacy behaviour. Regards, /Johan Leo Liu <sdl.web <at> gmail.com> writes: > On 2014-03-05 06:29 +0800, Johan Claesson wrote: >> * emacs-lisp/shadows.el (load-path-shadows-find): Do not report >> .dir-locals.el files. >> (list-dir-locals-shadows): New command that reports shadows of >> .dir-locals.el in a way that make sense for that type of file. >> (dir-locals-shadows-find, dir-locals-shadows-find-1) >> (dir-locals-class-name, dir-locals-shadows-display): Auxiliary >> functions for list-dir-locals-shadows. > > I am not too sure what problems are solved by the change. > > In the case of list-load-path-shadows, it should print anything when in > doubt since false positives can be helpful. So it is not entirely wrong > to report .dir-locals.el. > > Use .dir-locals.el in a child directory to shadow parent directory isn't > uncommon practice. In future we might even make it capable of inheriting > settings in parent directory. So I am not even sure the use case of > listing .dir-locals files (defaulting to the load-path)?? > > Leo
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Wed, 05 Mar 2014 07:26:01 GMT) Full text and rfc822 format available.Message #38 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: Leo Liu <sdl.web <at> gmail.com> Cc: Xue Fuqiao <xfq <at> gnu.org>, 12357 <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Wed, 05 Mar 2014 08:25:03 +0100
Well i would like the false positives to go away. That is the problem this attempts to fix. How about a defvar load-path-shadows-report-dir-locals instead? It would of course be true by default to preserve legacy behaviour. I agree that list-dir-locals-shadows is not very useful. It was written only to motivate that list-load-path-shadows should not report .dir-locals.el. Regards, /Johan Leo Liu <sdl.web <at> gmail.com> writes: > On 2014-03-05 06:29 +0800, Johan Claesson wrote: >> * emacs-lisp/shadows.el (load-path-shadows-find): Do not report >> .dir-locals.el files. >> (list-dir-locals-shadows): New command that reports shadows of >> .dir-locals.el in a way that make sense for that type of file. >> (dir-locals-shadows-find, dir-locals-shadows-find-1) >> (dir-locals-class-name, dir-locals-shadows-display): Auxiliary >> functions for list-dir-locals-shadows. > > I am not too sure what problems are solved by the change. > > In the case of list-load-path-shadows, it should print anything when in > doubt since false positives can be helpful. So it is not entirely wrong > to report .dir-locals.el. > > Use .dir-locals.el in a child directory to shadow parent directory isn't > uncommon practice. In future we might even make it capable of inheriting > settings in parent directory. So I am not even sure the use case of > listing .dir-locals files (defaulting to the load-path)?? > > Leo
Glenn Morris <rgm <at> gnu.org>
:Johan Claesson <johanclaesson <at> bredband.net>
:Message #43 received at 12357-done <at> debbugs.gnu.org (full text, mbox):
From: Glenn Morris <rgm <at> gnu.org> To: 12357-done <at> debbugs.gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Wed, 05 Mar 2014 21:07:57 -0500
Version: 24.4 On reflection, I think you were right from the start, and that this command should simply ignore dir-locals, since they are not looked up via load-path anyway. So I made that change. Sorry for the delay. I do not think that a specialized command for dealing with dir-locals is required. (We should add inheritance so it's not an issue.)
bug-gnu-emacs <at> gnu.org
:bug#12357
; Package emacs
.
(Thu, 06 Mar 2014 22:00:03 GMT) Full text and rfc822 format available.Message #46 received at 12357 <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: 12357 <at> debbugs.gnu.org Cc: rgm <at> gnu.org Subject: Re: bug#12357: 24.2; list-load-path-shadow should ignore .dir-locals.el Date: Thu, 06 Mar 2014 22:58:59 +0100
Good, thanks. I totally agree that is all that is needed for this minor issue. Regards, /Johan Glenn Morris <rgm <at> gnu.org> writes: > Version: 24.4 > > On reflection, I think you were right from the start, and that this > command should simply ignore dir-locals, since they are not looked up > via load-path anyway. So I made that change. Sorry for the delay. > I do not think that a specialized command for dealing with dir-locals > is required. (We should add inheritance so it's not an issue.)
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Fri, 04 Apr 2014 11:24:08 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.