From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#68692: 29.1; File-local variable storage for strings with newlines Date: Wed, 24 Jan 2024 19:31:54 +0200 Message-ID: <86y1ced4dx.fsf@gnu.org> References: <87il3ir6j8.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2641"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68692@debbugs.gnu.org To: Karthik Chikmagalur Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 24 18:33:25 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rSh7s-0000QP-2L for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Jan 2024 18:33:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSh7W-0000ml-JX; Wed, 24 Jan 2024 12:33:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSh7S-0000mH-Pb for bug-gnu-emacs@gnu.org; Wed, 24 Jan 2024 12:33:00 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSh7Q-00018r-MC for bug-gnu-emacs@gnu.org; Wed, 24 Jan 2024 12:32:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rSh7V-0006Nb-JE for bug-gnu-emacs@gnu.org; Wed, 24 Jan 2024 12:33:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Jan 2024 17:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68692 X-GNU-PR-Package: emacs Original-Received: via spool by 68692-submit@debbugs.gnu.org id=B68692.170611753224451 (code B ref 68692); Wed, 24 Jan 2024 17:33:01 +0000 Original-Received: (at 68692) by debbugs.gnu.org; 24 Jan 2024 17:32:12 +0000 Original-Received: from localhost ([127.0.0.1]:46530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSh6h-0006MI-Jd for submit@debbugs.gnu.org; Wed, 24 Jan 2024 12:32:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41216) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSh6g-0006M4-9i for 68692@debbugs.gnu.org; Wed, 24 Jan 2024 12:32:10 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSh6U-0000tp-SP; Wed, 24 Jan 2024 12:31:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=+k6aigZHh6OKdL4FpjuyS1Ftmdp1yPWJpVfn7Kh1Jts=; b=Juf+YEI4slqjyJi7gD+q gk8E6gIO15jwb3U2U53qRFwAgHuSoMXySzDsToz2qCwfcY86VB0IPGK4NErJ+tnLBc9dZi2ptM15A yLJU9ry3H9ju11kyBvSF2NLd9GPfFU4vfwoH94GDLPXVLQ8/LNN+k7ALS/LLiu+fpPsg09otHftpC 3ZREE2Odewnj/8qeTGw2uBC9edS8rqW2XuwmRKHzbG/2yQJERU4MijjJHwPnlf9ERIOzV5nvgulTu A/W5PsCLgoj/fJYZ+5AMrk0G8TD0OpfnJQnjUcdX0qLTd5JgdDATyP6wTtHuZskzCklqNG/e/P+Su NYmV1kIpcsS9hQ==; In-Reply-To: <87il3ir6j8.fsf@gmail.com> (message from Karthik Chikmagalur on Wed, 24 Jan 2024 09:21:47 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:278808 Archived-At: > From: Karthik Chikmagalur > Date: Wed, 24 Jan 2024 09:21:47 -0800 > > > Storing file-local variables whose values are strings that include > newlines triggers an error when the file is opened. That's because you violated the supported format. > The buffer test.txt now looks like this: > > --8<---------------cut here---------------start------------->8--- > Some text > > ;; Local Variables: > ;; testvar: "Data on > two lines" > ;; End: > --8<---------------cut here---------------end--------------->8--- > > Saving and killing test.txt and repopening it causes the error: > > --8<---------------cut here---------------start------------->8--- > File mode specification error: (user-error Local variables entry is missing the prefix) > --8<---------------cut here---------------end--------------->8--- > > Turning on toggle-debug-on-error does not produce a backtrace. > > Is it not possible to store strings with newlines as the values of > file-local variables? The elisp manual makes no mention of this > limitation in the file-local vars section -- perhaps I missed something? I think you missed this part in the Emacs user manual: A local variables list starts with a line containing the string ‘Local Variables:’, and ends with a line containing the string ‘End:’. In between come the variable names and values, one set per line, like this: /* Local Variables: */ /* mode: c */ /* comment-column: 0 */ /* End: */ In this example, each line starts with the prefix ‘/*’ and ends with the suffix ‘*/’. Note the last sentence. 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.