GNU bug report logs - #68692
29.1; File-local variable storage for strings with newlines

Previous Next

Package: emacs;

Reported by: Karthik Chikmagalur <karthikchikmagalur <at> gmail.com>

Date: Wed, 24 Jan 2024 17:23:01 UTC

Severity: normal

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 68692-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Karthik Chikmagalur <karthikchikmagalur <at> gmail.com>
Cc: 68692-done <at> debbugs.gnu.org
Subject: Re: bug#68692: 29.1; File-local variable storage for strings with
 newlines
Date: Fri, 26 Jan 2024 10:03:34 +0200
[Please use Reply All when replying, to have the bug tracker CC'ed.]

> From: Karthik Chikmagalur <karthikchikmagalur <at> gmail.com>
> Date: Thu, 25 Jan 2024 19:14:43 -0800
> 
> Hello Eli,
> 
> Please close this bug, I read the local variables section of the elisp
> manual but missed the Emacs one.

I'm therefore closing this bug.

> However, I have a question now.
> 
> > The manual says a little after the above:
> >
> >                                                 If you want to split a
> >   long string value across multiple lines of the file, you can use
> >   backslash-newline, which is ignored in Lisp string constants; you should
> >   put the prefix and suffix on each line, even lines that start or end
> >   within the string, as they will be stripped off when processing the
> >   list.  Here is an example:
> >
> >        # Local Variables:
> >        # compile-command: "cc foo.c -Dfoo=bar -Dhack=whatever \
> >        #   -Dmumble=blaah"
> >        # End:
> >
> > Which I believe is what you are looking for.
> >
> > I don't think there's a bug in Emacs here.
> 
> Is there a programmatic way (using elisp) to insert a local variable
> value that is a string that extends over multiple lines, as in my
> original example?  I can write a helper function to replace newlines
> with backslash-newlines, but determining the right suffix to add at the
> end of each line is tricky.

We have add-file-local-variable and modify-file-local-variable -- did
you try any of them?  If they don't handle this case, we need to fix
them so they do.

> I am addressing this right now by let-binding `print-escape-newlines' to
> t around calls to `add-file-local-variable', but perhaps there is a
> better way.




This bug report was last modified 1 year and 175 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.