unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 32817@debbugs.gnu.org
Subject: bug#32817: 27.0.50; Dotted pair syntax for directory-local variables
Date: Tue, 25 Sep 2018 22:41:51 +0300	[thread overview]
Message-ID: <87mus5e54w.fsf@mail.linkov.net> (raw)
In-Reply-To: <87fa2b5f-48b3-703b-9b0b-43dc454759b8@orcon.net.nz> (Phil Sainty's message of "Wed, 26 Sep 2018 00:10:06 +1200")

>> +(defun add-dir-local-variables-to-string (variables)
>
> `add-dir-local-variables-to-string' is quite a confusing name.
> It makes it sound like the dir-local variables will be added to
> a string (which doesn't make a lot of sense), when it's actually
> formatting all of the dir-locals *as* a string.
>
> This is on account of the "add-" prefix, which I think is unnecessary
> -- the functionality isn't really tied to `add-dir-local-variable';
> it would work regardless of where its argument came from.
>
> `dir-locals-to-string' seems a better name to me, and is consistent
> with other dir-locals-* functions.

My intention was to use this prefix to add the new function
to the add-dir-local-variable* namespace.  But I agree that
dir-locals-* is more suitable, so I renamed the function.

>> +  (format "(%s)" (mapconcat
>> +                  (lambda (mode-variable)
>
> "mode-variables" (plural), I think.

Fixed as well.

>> +                    (format "(%S . %s)"
>> +                            (car mode-variable)
>> +                            (format "(%s)" (mapconcat
>> +                                            (lambda (variable-value)
>> +                                              (format "(%s . %S)"
>> +                                                      (car variable-value)
>
> Why is the variable symbol "%s" when the mode symbol was "%S" ?

The mode symbol is "%S" to support string values of a subdirectory like
"src/imported" in the example in (info "(emacs) Directory Variables")
But admittedly add-dir-local-variable doesn't support adding 3 levels
subdirectory-mode-variables anyway, it could be used only to create
an initial subdirectory-variable-value to allow the user adding mode
manually.  But for any case I changed the variable symbol "%s" to "%S".





  reply	other threads:[~2018-09-25 19:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-23 23:14 bug#32817: 27.0.50; Dotted pair syntax for directory-local variables Juri Linkov
2018-09-25 12:10 ` Phil Sainty
2018-09-25 19:41   ` Juri Linkov [this message]
2018-09-26 15:01     ` Phil Sainty
2018-09-26 15:50       ` Eli Zaretskii
2018-09-27  0:09         ` Juri Linkov
2018-09-27  6:47           ` Eli Zaretskii

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=87mus5e54w.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=32817@debbugs.gnu.org \
    --cc=psainty@orcon.net.nz \
    /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).