[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65120: 29.1; directory-abbrev-alist breaks various things when insid
From: |
Eli Zaretskii |
Subject: |
bug#65120: 29.1; directory-abbrev-alist breaks various things when inside an abbreviated directory |
Date: |
Thu, 10 Aug 2023 09:22:38 +0300 |
> From: Sean Allred <allred.sean@gmail.com>
> Cc: 65120@debbugs.gnu.org
> Date: Wed, 09 Aug 2023 18:31:50 -0500
>
> In the meantime, I think I'll create a new defcustom/defun pair:
>
> (defcustom directory-abbrev-display-alist
> nil
> "Like `directory-abbrev-alist', but for
> `abbreviate-file-name-for-display'.")
>
> (defun abbreviate-file-name-for-display (filename)
> "Like `abbreviate-file-name', but is not guaranteed to produce a
> functional path."
> (let ((directory-abbrev-alist (append directory-abbrev-display-alist
> directory-abbrev-alist)))
> (abbreviate-file-name filename)))
>
> ;; e.g.
> (let ((directory-abbrev-display-alist
> '(("C:/MegaCorpSource" . "@src"))))
> (abbreviate-file-name-for-display "C:/MegaCorpSource/foo"))
> => "@src/foo
>
> (Symbol names prefixed with my package prefix, of course.)
>
> If I get good mileage out of this, would this be the kind of thing I
> could submit a patch for? It turned out prettier than I was expecting.
> (I've already sorted out the FSF paperwork.)
Where and how would this "abbreviated-for-display" file names used in
Emacs?