* bug#4902: 23.1; directory-abbrev-alist is not handled early enough @ 2009-11-10 17:54 David Biesack 2009-11-10 19:35 ` Stefan Monnier 0 siblings, 1 reply; 12+ messages in thread From: David Biesack @ 2009-11-10 17:54 UTC (permalink / raw) To: bug-gnu-emacs@gnu.org Start emacs -q on a Windows system In *scratch* buffer, evaluate (setq directory-abbrev-alist '(("^/mount/" . "//uncpath/mount/"))) Even after setting this value, it is not honored on Windows. Lower level functions appear to ignore directory-abbrev-alist, so find-file and find-file-noselect etc. end up with "true" filenames that contain drive letters: (file-truename "/mount/somefile.x") => "c:/mount/somefile.x" (expand-file-name "/mount/somefile.x") => "c:/mount/somefile.x" (c:/mount does not exist, but //uncpath/mount/ does) In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30 on SOFT-MJASON Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (4.4)' 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: ENU value of $XMODIFIERS: nil locale-coding-system: cp1252 default-enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: <help-echo> <help-echo> <help-echo> <down-mouse-1> <mouse-1> C-x b <return> C-y C-p C-p C-p C-p C-p C-p C-p C-p C-p C-e M-x e v a - <backspace> l - p r i SPC SPC <return> q <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> C-j SPC q SPC SPC SPC ( C-b ' C-n C-b <backspace> SPC SPC SPC C-n C-n C-p C-a SPC SPC C-e ) M-x e v a l - p r SPC <return> C-p C-k C-p C-e M-x e v a l - p r SPC SPC SPC <return> C-n <down-mouse-1> <mouse-1> C-x h C-w <down-mouse-1> <mouse-1> C-y C-p C-p C-p C-p C-p C-p C-p C-p C-p C-e M-x e v a l - c SPC SPC SPC <return> C-n C-n C-n C-a C-k C-p C-e M-x e v a l - p r SPC <return> C-n C-k C-k C-e M-x e v a l - p r SPC SPC <return> C-k C-k C-k C-k C-k C-SPC C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-w M-x r e p o r t - e SPC SPC SPC <return> Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Mark set Entering debugger... Back to top level. Entering debugger... Back to top level. ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-10 17:54 bug#4902: 23.1; directory-abbrev-alist is not handled early enough David Biesack @ 2009-11-10 19:35 ` Stefan Monnier 2009-11-10 19:52 ` David J. Biesack 0 siblings, 1 reply; 12+ messages in thread From: Stefan Monnier @ 2009-11-10 19:35 UTC (permalink / raw) To: David Biesack; +Cc: 4902 > (setq directory-abbrev-alist '(("^/mount/" . "//uncpath/mount/"))) > Even after setting this value, it is not honored on Windows. > Lower level functions appear to ignore directory-abbrev-alist, > so find-file and find-file-noselect etc. end up with "true" filenames that > contain drive letters: > (file-truename "/mount/somefile.x") > => "c:/mount/somefile.x" file-truename does not use directory-abbrev-alist. Only abbreviate-file-name does. Stefan ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-10 19:35 ` Stefan Monnier @ 2009-11-10 19:52 ` David J. Biesack 2009-11-10 21:02 ` Stefan Monnier 0 siblings, 1 reply; 12+ messages in thread From: David J. Biesack @ 2009-11-10 19:52 UTC (permalink / raw) To: Stefan Monnier; +Cc: 4902 > From: Stefan Monnier <monnier@IRO.UMontreal.CA> > CC: <4902@emacsbugs.donarmstrong.com> > Date: Tue, 10 Nov 2009 14:35:54 -0500 > > > (setq directory-abbrev-alist '(("^/mount/" . "//uncpath/mount/"))) > > > Even after setting this value, it is not honored on Windows. > > Lower level functions appear to ignore directory-abbrev-alist, > > so find-file and find-file-noselect etc. end up with "true" filenames that > > contain drive letters: > > > (file-truename "/mount/somefile.x") > > => "c:/mount/somefile.x" > > file-truename does not use directory-abbrev-alist. > Only abbreviate-file-name does. Perhaps that is why it is a bug :-) For example, if the path /mount/somefile.x shows up in RMAIL or in a source file, I want to do find-file-at-point on that path. When I do, Emacs tries to open c:/mount/somefile.x instead. In other words, I does not matter what low level function uses directory-abbrev-alist and which don't, but the net effect is find-file-at-point and other functions (filemenu http://www.eskimo.com/~seldon/filemenu.el) which use find-file or find-file-noselect do *not* use directory-abbrev-alist when the doc string implies (to me) that they should. My hack workaround is to add a new hook to find-file-not-found-hooks which should not be necessary. -- David J. Biesack, SAS SAS Campus Dr. Cary, NC 27513 www.sas.com (919) 531-7771 ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-10 19:52 ` David J. Biesack @ 2009-11-10 21:02 ` Stefan Monnier 2009-11-10 21:29 ` David J. Biesack 0 siblings, 1 reply; 12+ messages in thread From: Stefan Monnier @ 2009-11-10 21:02 UTC (permalink / raw) To: David J. Biesack; +Cc: 4902 > For example, if the path /mount/somefile.x shows up in RMAIL > or in a source file, I want to do find-file-at-point > on that path. When I do, Emacs tries to open c:/mount/somefile.x > instead. As the docstring of directory-abbrev-alist says: FROM and TO should be equivalent names, which refer to the same directory. So the feature you want is not the feature provided by directory-abbrev-alist :-( Maybe we could change the code so as to expand the scope of directory-abbrev-alist to include your situation, but I'm not actually sure that's a good idea, because it doesn't seem clear exactly when that rewrite should take place. Maybe if you give us a bit more context to your problem, we can come up with a better solution. For starters explain to us: if the system doesn't have a "/mount" directory, why does it show up in source files, email, and filemenu? Stefan ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-10 21:02 ` Stefan Monnier @ 2009-11-10 21:29 ` David J. Biesack 2009-11-11 4:11 ` Eli Zaretskii 2009-11-11 14:52 ` Stefan Monnier 0 siblings, 2 replies; 12+ messages in thread From: David J. Biesack @ 2009-11-10 21:29 UTC (permalink / raw) To: Stefan Monnier; +Cc: 4902 > From: Stefan Monnier <monnier@IRO.UMontreal.CA> > CC: <4902@emacsbugs.donarmstrong.com> > Date: Tue, 10 Nov 2009 16:02:26 -0500 > > > For example, if the path /mount/somefile.x shows up in RMAIL > > or in a source file, I want to do find-file-at-point > > on that path. When I do, Emacs tries to open c:/mount/somefile.x > > instead. > > As the docstring of directory-abbrev-alist says: > > FROM and TO should be equivalent names, which refer to the > same directory. > > So the feature you want is not the feature provided by > directory-abbrev-alist :-( :-( > Maybe we could change the code so as to expand the scope of > directory-abbrev-alist to include your situation, but I'm not actually > sure that's a good idea, because it doesn't seem clear exactly when that > rewrite should take place. > > Maybe if you give us a bit more context to your problem, we can come up > with a better solution. > For starters explain to us: if the system doesn't have a "/mount" > directory, why does it show up in source files, email, and filemenu? Sure, here is my context. Our source code, doc, tools, etc is stored on netapps. We split development between Linux and Windows. For the most part, source filenames are passed around or mentioned in doc or email reports etc. using Unix paths: /sas/dev/mva-v930/tkacl for example. On Windows, these paths are available via Samba and UNC paths etc. as //dntsrc/sas/dev/mva-v930/tkacl . For example, we run builds from Windows but they run remotely on Unix and therefore all compiler messages refer to the files via the Unix names, and different hosts do different mangling of the names. But when I see a path in a source file or email it is almost always in Unix format. Similarly, our network login directories are on the netapps, for example, my "home" directory is /u/sasdjb , but that is only available from Windows via a UNC path, //dntsrc/u/sasdjb or or //sashq/too/u/sasdjb or /nfs/sanyo/vol/vol2/u22/sasdjb or via a mapped network drive, u:/ Obviously, there are too many different names for the same file, and I want Emacs to normalize all files to a canonical form; i.e. all the variations of my network home should be normalized to u:/ and so forth. directory-abbrev-alist: '(("^//dntsrc/u/sasdjb" . "u:") ("^/u/sasdjb" . "u:") ("^//sashq/root/u/sasdjb" . "u:") ("^/nfs/sanyo/vol/vol2/u22/sasdjb" . "u:/") ("^//sashq/root/u/sasdjb" . "u:") ("^/sas/" . "//dntsrc/sas/") ("^/sasgen" . "//dntsrc/sasgen/")) If I'm running Emacs on Linux, I would normalize all these variations the other way: directory-abbrev-alist: '(("^//dntsrc/u/sasdjb" . "/u/sasdjb") ("^u:" . "/u/sasdjb") ("^//sashq/root/u/sasdjb" . "/u/sasdjb") ("^/nfs/sanyo/vol/vol2/u22/sasdjb" . "/u/sasdjb") ("^//sashq/root/u/sasdjb" . "/u/sasdjb") ("^//dntsrc/sas/" . "/sas/") ("^//dntsrc/sasgen/" . "/sasgen")) There are many ways in which I can open files in Emacs C-x C-f filemenu http://www.eskimo.com/~seldon/filemenu.el find-file-at-point gud/gdb compile/next-error and probably 5 or 6 other ways, and I'd like them to all honor directory-abbrev-alist > Stefan -- David J. Biesack, SAS SAS Campus Dr. Cary, NC 27513 www.sas.com (919) 531-7771 ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-10 21:29 ` David J. Biesack @ 2009-11-11 4:11 ` Eli Zaretskii 2009-11-11 12:47 ` David J. Biesack 2009-11-11 14:52 ` Stefan Monnier 1 sibling, 1 reply; 12+ messages in thread From: Eli Zaretskii @ 2009-11-11 4:11 UTC (permalink / raw) To: David J. Biesack, 4902; +Cc: monnier > Date: Tue, 10 Nov 2009 16:29:36 -0500 > From: "David J. Biesack" <David.Biesack@sas.com> > Cc: 4902@emacsbugs.donarmstrong.com > > Obviously, there are too many different names for the same file, > and I want Emacs to normalize all files to a canonical > form; i.e. all the variations of my network home should > be normalized to u:/ and so forth. > > directory-abbrev-alist: > > '(("^//dntsrc/u/sasdjb" . "u:") > ("^/u/sasdjb" . "u:") > ("^//sashq/root/u/sasdjb" . "u:") > ("^/nfs/sanyo/vol/vol2/u22/sasdjb" . "u:/") > ("^//sashq/root/u/sasdjb" . "u:") > ("^/sas/" . "//dntsrc/sas/") > ("^/sasgen" . "//dntsrc/sasgen/")) > > If I'm running Emacs on Linux, I would normalize all > these variations the other way: > > directory-abbrev-alist: > > '(("^//dntsrc/u/sasdjb" . "/u/sasdjb") > ("^u:" . "/u/sasdjb") > ("^//sashq/root/u/sasdjb" . "/u/sasdjb") > ("^/nfs/sanyo/vol/vol2/u22/sasdjb" . "/u/sasdjb") > ("^//sashq/root/u/sasdjb" . "/u/sasdjb") > ("^//dntsrc/sas/" . "/sas/") > ("^//dntsrc/sasgen/" . "/sasgen")) So you are trying to solve in Emacs a problem that is not for Emacs to solve. You are trying to emulate a symlink using Emacs features that are not at all intended for such a use. Personally, I don't think this problem even should be solved in Emacs. You still have other tools which need to see the correct file name, so any mapping Emacs does internally will never be sufficient. About the only thing I can suggest is to run with the drive u: being the current drive. Then /foo/bar on both Windows and Unix will refer to the same place, and you don't need any mapping at all. If that doesn't help for some reason, I think you need to solve your problem in an entirely different manner. ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-11 4:11 ` Eli Zaretskii @ 2009-11-11 12:47 ` David J. Biesack 2009-11-11 18:35 ` Eli Zaretskii 0 siblings, 1 reply; 12+ messages in thread From: David J. Biesack @ 2009-11-11 12:47 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 4902, monnier > Date: Wed, 11 Nov 2009 06:11:54 +0200 > From: Eli Zaretskii <eliz@gnu.org> > CC: <monnier@IRO.UMontreal.CA> > > > Date: Tue, 10 Nov 2009 16:29:36 -0500 > > From: "David J. Biesack" <David.Biesack@sas.com> > > Cc: 4902@emacsbugs.donarmstrong.com > > > > Obviously, there are too many different names for the same file, > > and I want Emacs to normalize all files to a canonical > > form > So you are trying to solve in Emacs a problem that is not for Emacs to > solve. You are trying to emulate a symlink using Emacs features that > are not at all intended for such a use. I could not disagree more. Emacs is and has been my primary operating environment for my job; it is my primary tool for working with all of the files on our network. We're a big organization (10,000 people) and there are many different and independent servers and configurations that I must integrate, and Emacs is my only hope. If you choose to not allow Emacs proper to assist, I'll just go it alone. But other people around the world have to deal with networks and file aliases;; I'd rather see Emacs help all of us. > Personally, I don't think this problem even should be solved in > Emacs. You still have other tools which need to see the correct file > name, so any mapping Emacs does internally will never be sufficient. Some progress is better than no progress. > About the only thing I can suggest is to run with the drive u: being > the current drive. Then /foo/bar on both Windows and Unix will refer > to the same place, and you don't need any mapping at all. that still won't work for Unix network paths that are not mapped in U: > If that doesn't help for some reason, I think you need to solve your > problem in an entirely different manner. so I will. -- David J. Biesack, SAS SAS Campus Dr. Cary, NC 27513 www.sas.com (919) 531-7771 ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-11 12:47 ` David J. Biesack @ 2009-11-11 18:35 ` Eli Zaretskii 2009-11-11 20:57 ` David J. Biesack 0 siblings, 1 reply; 12+ messages in thread From: Eli Zaretskii @ 2009-11-11 18:35 UTC (permalink / raw) To: David J. Biesack; +Cc: 4902 > Date: Wed, 11 Nov 2009 07:47:36 -0500 > From: "David J. Biesack" <David.Biesack@sas.com> > CC: 4902@emacsbugs.donarmstrong.com, monnier@IRO.UMontreal.CA > > > About the only thing I can suggest is to run with the drive u: being > > the current drive. Then /foo/bar on both Windows and Unix will refer > > to the same place, and you don't need any mapping at all. > > that still won't work for Unix network paths that are not mapped in U: What prevents you from mapping them all to U: ? ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-11 18:35 ` Eli Zaretskii @ 2009-11-11 20:57 ` David J. Biesack 0 siblings, 0 replies; 12+ messages in thread From: David J. Biesack @ 2009-11-11 20:57 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 4902 > Date: Wed, 11 Nov 2009 20:35:23 +0200 > From: Eli Zaretskii <eliz@gnu.org> > CC: <4902@emacsbugs.donarmstrong.com>, <monnier@IRO.UMontreal.CA> > > > Date: Wed, 11 Nov 2009 07:47:36 -0500 > > From: "David J. Biesack" <David.Biesack@sas.com> > > CC: 4902@emacsbugs.donarmstrong.com, monnier@IRO.UMontreal.CA > > > > > About the only thing I can suggest is to run with the drive u: being > > > the current drive. Then /foo/bar on both Windows and Unix will refer > > > to the same place, and you don't need any mapping at all. > > > > that still won't work for Unix network paths that are not mapped in U: > > What prevents you from mapping them all to U: ? There are dozens if not hundreds of them. U: is mapped (by our IT department) to our Unix login (Unix/User, hence U:) directory. Other things are not our login directories and it would be wrong to map them there. Similarly, we would not want to require each user to duplicate a bunch of drive mappings on their desktops (or symlinks in their unix login directories) Thus, We use UNC paths for these other locations. For example, I would access your login at \\sashq\root\u\eliz whereas it would be U:\ for your, and you would see mine at \\sashq\root\u\sasdjb This has all evolved over a period of years... -- David J. Biesack, SAS SAS Campus Dr. Cary, NC 27513 www.sas.com (919) 531-7771 ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-10 21:29 ` David J. Biesack 2009-11-11 4:11 ` Eli Zaretskii @ 2009-11-11 14:52 ` Stefan Monnier 2009-11-11 19:41 ` David J. Biesack 2019-11-02 5:21 ` Stefan Kangas 1 sibling, 2 replies; 12+ messages in thread From: Stefan Monnier @ 2009-11-11 14:52 UTC (permalink / raw) To: David J. Biesack; +Cc: 4902 > Obviously, there are too many different names for the same file, > and I want Emacs to normalize all files to a canonical > form; i.e. all the variations of my network home should > be normalized to u:/ and so forth. > directory-abbrev-alist: > '(("^//dntsrc/u/sasdjb" . "u:") > ("^/u/sasdjb" . "u:") > ("^//sashq/root/u/sasdjb" . "u:") > ("^/nfs/sanyo/vol/vol2/u22/sasdjb" . "u:/") > ("^//sashq/root/u/sasdjb" . "u:") > ("^/sas/" . "//dntsrc/sas/") > ("^/sasgen" . "//dntsrc/sasgen/")) The way I see it, the problem really is in the way you organize and use your naming structure. So "the right solution" would be a combination of discipline, conventions, and symlinks to sort out this mess and make sure that you see much fewer variations of filenames and that all the ones you see work everywhere (via symlinks, for example). Now, I understand this may not be practically feasible for you, but I think that changing Emacs to accomodate this particular situation is a bit hard to justify. OTOH, Emacs does provide enough hooks already for you to be able to make it work, I think. The hook you want is file-name-handler-alist. The only problem with it, is that it's very powerful and quite a bit trickier to use than directory-abbrev-alist. You could try the code below (guaranteed 100% untested). Stefan (defvar djb-filemess-remappings '(("\\`/\\(/dntsrc/u\\|u\\|/sashq/root/u\\|nfs/sanyo/vol/vol2/u22\\)/sasdjb" . "u:") ("\\`/\\(sas\\(gen\\)?\\)/" . "//dntsrc/\\1/"))) (defun djb-filemess-run-real-handler (operation args) (let ((inhibit-file-name-handlers (cons 'djb-filemess-handler (and (eq inhibit-file-name-operation operation) inhibit-file-name-handlers))) (inhibit-file-name-operation operation)) (apply operation args)))) (defun djb-filemess-handler (operation &rest args) (let ((fn (get operation 'djb-filemess-handler))) (if fn (funcall fn operation args) (djb-filemess-run-real-handler operation args)))) (defun djb-filemess-remap-1 (operation args) (let ((file (car args)) (remappings djb-filemess-remappings) newfile) (while (and (null newfile) remappings) (if (string-match (caar remappings) file) (setq newfile (replace-match (cdar remappings) t nil file)) (setq remappings (cdr remappings)))) (djb-filemess-run-real-handler operation (cons (or newfile file) (cdr args))))) (put 'expand-file-name 'djb-filemess-handler 'djb-filemess-remap-1) (put 'substitute-in-file-name 'djb-filemess-handler 'djb-filemess-remap-1) (dolist (remapping djb-filemess-remappings) (push (cons (car remapping) 'djb-filemess-handler) file-name-handler-alist)) ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-11 14:52 ` Stefan Monnier @ 2009-11-11 19:41 ` David J. Biesack 2019-11-02 5:21 ` Stefan Kangas 1 sibling, 0 replies; 12+ messages in thread From: David J. Biesack @ 2009-11-11 19:41 UTC (permalink / raw) To: Stefan Monnier; +Cc: 4902 Eli and Stefan; Thanks for you assistance. I really appreciate the time you've spent investigating this. Obviously, the file naming structure is far beyond my control and not something I can or want to change (it would break far too many tools and processes). Suffice it to say, it's something I have to live with. I was able to achieve what I want with (defadvice find-file-noselect (before find-file-noselect-apply-abbreviations (filename &optional nowarn rawfile wildcards) activate) ;; normalize the file via (customize-variable 'directory-abbrev-alist) ;; *before* find-file-noselect calls (expand-file-name filename) ;; which puts C: at the front of paths. (ad-set-arg 0 (abbreviate-file-name filename)) ) and calling abbreviate-file-name in a couple other functions I use (my own version of find-file-at-point etc.) At least, so far it is working as I expect. I was aware of file-name-handler-alist from looking through cygwin-mount and had considered that but it seemed complicated. I'll save the following suggestion and install it if my own customizations prove insufficient. djb > From: Stefan Monnier <monnier@iro.umontreal.ca> > CC: <4902@emacsbugs.donarmstrong.com> > Date: Wed, 11 Nov 2009 09:52:19 -0500 > > > Obviously, there are too many different names for the same file, > > and I want Emacs to normalize all files to a canonical > > form; i.e. all the variations of my network home should > > be normalized to u:/ and so forth. > > > directory-abbrev-alist: > > > '(("^//dntsrc/u/sasdjb" . "u:") > > ("^/u/sasdjb" . "u:") > > ("^//sashq/root/u/sasdjb" . "u:") > > ("^/nfs/sanyo/vol/vol2/u22/sasdjb" . "u:/") > > ("^//sashq/root/u/sasdjb" . "u:") > > ("^/sas/" . "//dntsrc/sas/") > > ("^/sasgen" . "//dntsrc/sasgen/")) > > The way I see it, the problem really is in the way you organize and use > your naming structure. So "the right solution" would be a combination > of discipline, conventions, and symlinks to sort out this mess and make > sure that you see much fewer variations of filenames and that all the > ones you see work everywhere (via symlinks, for example). > > Now, I understand this may not be practically feasible for you, but > I think that changing Emacs to accomodate this particular situation is > a bit hard to justify. > > OTOH, Emacs does provide enough hooks already for you to be able to make > it work, I think. The hook you want is file-name-handler-alist. > The only problem with it, is that it's very powerful and quite a bit > trickier to use than directory-abbrev-alist. > > You could try the code below (guaranteed 100% untested). > > > Stefan > > > (defvar djb-filemess-remappings > '(("\\`/\\(/dntsrc/u\\|u\\|/sashq/root/u\\|nfs/sanyo/vol/vol2/u22\\)/sasdjb" > . "u:") > ("\\`/\\(sas\\(gen\\)?\\)/" . "//dntsrc/\\1/"))) > > (defun djb-filemess-run-real-handler (operation args) > (let ((inhibit-file-name-handlers > (cons 'djb-filemess-handler > (and (eq inhibit-file-name-operation operation) > inhibit-file-name-handlers))) > (inhibit-file-name-operation operation)) > (apply operation args)))) > > (defun djb-filemess-handler (operation &rest args) > (let ((fn (get operation 'djb-filemess-handler))) > (if fn (funcall fn operation args) > (djb-filemess-run-real-handler operation args)))) > > (defun djb-filemess-remap-1 (operation args) > (let ((file (car args)) > (remappings djb-filemess-remappings) > newfile) > (while (and (null newfile) remappings) > (if (string-match (caar remappings) file) > (setq newfile (replace-match (cdar remappings) t nil file)) > (setq remappings (cdr remappings)))) > (djb-filemess-run-real-handler operation > (cons (or newfile file) (cdr args))))) > > (put 'expand-file-name 'djb-filemess-handler 'djb-filemess-remap-1) > (put 'substitute-in-file-name 'djb-filemess-handler 'djb-filemess-remap-1) > > (dolist (remapping djb-filemess-remappings) > (push (cons (car remapping) 'djb-filemess-handler) > file-name-handler-alist)) > > > -- David J. Biesack, SAS SAS Campus Dr. Cary, NC 27513 www.sas.com (919) 531-7771 ^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#4902: 23.1; directory-abbrev-alist is not handled early enough 2009-11-11 14:52 ` Stefan Monnier 2009-11-11 19:41 ` David J. Biesack @ 2019-11-02 5:21 ` Stefan Kangas 1 sibling, 0 replies; 12+ messages in thread From: Stefan Kangas @ 2019-11-02 5:21 UTC (permalink / raw) To: Stefan Monnier; +Cc: 4902, David J. Biesack tags 4902 + wontfix close 4902 thanks Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Obviously, there are too many different names for the same file, >> and I want Emacs to normalize all files to a canonical >> form; i.e. all the variations of my network home should >> be normalized to u:/ and so forth. > >> directory-abbrev-alist: > >> '(("^//dntsrc/u/sasdjb" . "u:") >> ("^/u/sasdjb" . "u:") >> ("^//sashq/root/u/sasdjb" . "u:") >> ("^/nfs/sanyo/vol/vol2/u22/sasdjb" . "u:/") >> ("^//sashq/root/u/sasdjb" . "u:") >> ("^/sas/" . "//dntsrc/sas/") >> ("^/sasgen" . "//dntsrc/sasgen/")) > > The way I see it, the problem really is in the way you organize and use > your naming structure. So "the right solution" would be a combination > of discipline, conventions, and symlinks to sort out this mess and make > sure that you see much fewer variations of filenames and that all the > ones you see work everywhere (via symlinks, for example). > > Now, I understand this may not be practically feasible for you, but > I think that changing Emacs to accomodate this particular situation is > a bit hard to justify. That was ten years ago. It seems like the OP found a solution to his problem, and according to what Stefan writes above, we don't want to change anything in Emacs here. I'm therefore closing this as wontfix. If that's incorrect, please reopen the bug report. Best regards, Stefan Kangas ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-11-02 5:21 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-11-10 17:54 bug#4902: 23.1; directory-abbrev-alist is not handled early enough David Biesack 2009-11-10 19:35 ` Stefan Monnier 2009-11-10 19:52 ` David J. Biesack 2009-11-10 21:02 ` Stefan Monnier 2009-11-10 21:29 ` David J. Biesack 2009-11-11 4:11 ` Eli Zaretskii 2009-11-11 12:47 ` David J. Biesack 2009-11-11 18:35 ` Eli Zaretskii 2009-11-11 20:57 ` David J. Biesack 2009-11-11 14:52 ` Stefan Monnier 2009-11-11 19:41 ` David J. Biesack 2019-11-02 5:21 ` Stefan Kangas
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.