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: Fri, 26 Jan 2024 10:03:34 +0200 Message-ID: <86a5osbjxl.fsf@gnu.org> References: <87il3ir6j8.fsf@gmail.com> <86y1ced4dx.fsf@gnu.org> <877cjw3hwc.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10894"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68692-done@debbugs.gnu.org To: Karthik Chikmagalur Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 26 09:04:19 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 1rTHCE-0002c2-5F for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Jan 2024 09:04:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTHBu-0000uA-HD; Fri, 26 Jan 2024 03:03:58 -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 1rTHBs-0000tQ-Sf for bug-gnu-emacs@gnu.org; Fri, 26 Jan 2024 03:03:56 -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 1rTHBs-0004xO-Jq for bug-gnu-emacs@gnu.org; Fri, 26 Jan 2024 03:03:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTHBy-0005xM-JI for bug-gnu-emacs@gnu.org; Fri, 26 Jan 2024 03:04:02 -0500 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Jan 2024 08:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 68692 X-GNU-PR-Package: emacs Mail-Followup-To: 68692@debbugs.gnu.org, eliz@gnu.org, karthikchikmagalur@gmail.com Original-Received: via spool by 68692-done@debbugs.gnu.org id=D68692.170625623222877 (code D ref 68692); Fri, 26 Jan 2024 08:04:02 +0000 Original-Received: (at 68692-done) by debbugs.gnu.org; 26 Jan 2024 08:03:52 +0000 Original-Received: from localhost ([127.0.0.1]:50237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTHBo-0005wv-EL for submit@debbugs.gnu.org; Fri, 26 Jan 2024 03:03:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTHBm-0005wi-QU for 68692-done@debbugs.gnu.org; Fri, 26 Jan 2024 03:03:51 -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 1rTHBa-0004fj-AJ; Fri, 26 Jan 2024 03:03:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=M0omDk9j9Ci04z/jJ459qwg5Al74OQcYAM0MjBO6CnI=; b=sU9uF3zpnoAs jqZczeZXfRcuLEGlLklYTwBpCsZYHOIb0IkFc7Q6Hrwr2ZgF8jIotknZDWUpJYCHLbsrUv9GWdC2j KFNAow0nohHi9/E0pIZir69kpQEtG5h+vVPamCIKfsT2J1VVU/U8QhpU25ckq0xy3xFaBrsTamPeu nEAm/wBMNQZX1+gHxZvWI5yLyENbbBUtTVe/hP2vtfDzTqOA/rGdmmQloGfZdNotnWVHKrYSmdfu+ tfaMGuWlxUrjQlu0khboDgm1qEqowjQEwWdBZymcOaRdNoDnzhWKqCK6ZdahxFRCtwmAmOrabyMmx O2gbkRtIhRn2gFzymALKWA==; In-Reply-To: <877cjw3hwc.fsf@gmail.com> (message from Karthik Chikmagalur on Thu, 25 Jan 2024 19:14:43 -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:278904 Archived-At: [Please use Reply All when replying, to have the bug tracker CC'ed.] > From: Karthik Chikmagalur > 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.