From: Juri Linkov <juri@linkov.net>
To: Mauro Aranda <maurooaranda@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 66663@debbugs.gnu.org
Subject: bug#66663: 30.0.50; Allow dir locals file selection in *-dir-local-variable functions
Date: Sat, 21 Oct 2023 21:21:17 +0300 [thread overview]
Message-ID: <86zg0bu99e.fsf@mail.linkov.net> (raw)
In-Reply-To: <a7797f9d-6d33-4fb1-bbf1-049676882f42@gmail.com> (Mauro Aranda's message of "Sat, 21 Oct 2023 11:06:28 -0300")
> I reworked the patch to implement that UI instead. Patch attached.
Thanks, some comments:
> +(defun read-dir-locals-file ()
> + "Read a dir-locals filename using completion.
> +Intended to be used in the `interactive' spec of `add-dir-local-variable',
> +`delete-dir-local-variable' and `copy-file-locals-to-dir-locals'.
> +
> +Returns the filename, expanded."
> + (expand-file-name
> + (read-file-name "File" nil nil
The prompt needs a colon.
> + (lambda (fname)
> + (member (file-name-nondirectory fname)
> + (list dir-locals-file
> + (replace-regexp-in-string
> + ".el$" "-2.el" dir-locals-file))))
> + dir-locals-file)))
This needs to be run in the project's root directory
where the dir-locals file is saved. Probably it's not easy
to find the root without using project.el. But when one of the
files already exists (either .dir-locals.el or .dir-locals-2.el),
then better to use the directory of the existing file by default.
next prev parent reply other threads:[~2023-10-21 18:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-21 12:08 bug#66663: 30.0.50; Allow dir locals file selection in *-dir-local-variable functions Mauro Aranda
2023-10-21 12:16 ` Mauro Aranda
2023-10-21 12:45 ` Eli Zaretskii
2023-10-21 13:49 ` Mauro Aranda
2023-10-21 14:06 ` Mauro Aranda
2023-10-21 18:21 ` Juri Linkov [this message]
2023-10-21 22:10 ` Mauro Aranda
2023-10-22 17:55 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86zg0bu99e.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=66663@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=maurooaranda@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).