unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: 7524@debbugs.gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#7524: 24.0.50; backquote converts newlines in strings to "\n"
Date: Thu, 22 Oct 2020 09:24:55 -0300	[thread overview]
Message-ID: <CABczVwc-=OBA_QaH16+9zrXUuKF9utkqKuCvNo83NVAeoVf44g@mail.gmail.com> (raw)
In-Reply-To: <9C4145152E1B4A9890C4A8DA520A51ED@us.oracle.com>


[-- Attachment #1.1: Type: text/plain, Size: 1255 bytes --]

tags 7524 patch
quit

"Drew Adams" <drew.adams@oracle.com> writes:

>> > (This is particularly messy when used in defcustom values.)
>>
>> I don't know what you're referring to.  I'll keep the bug
>> open for now, assuming that the defcustom issue will be
>> the actual bug.
>
> You're right of course about the chars "\n" and a ^J char in a Lisp
string.
>
> `defcustom' does different things in this regard, depending on the :type
(and
> whether there is a mismatch, but that's something else no doubt).
>
> See what the \n representation does, for example, with the file I sent to
> emacs-devel yesterday, thread "Variable behavior for `mouse-3' second
click at
> same spot".  Here's a direct URL to the file.
>
> http://www.emacswiki.org/emacs/mouse3.el
>
> Eval the defcustom for `mouse3-region-popup-submenus', then use `M-x
customize',
> and you'll see how messy (how wide) the display is.
>

If I understand this bug report correctly, the wishlist item is about
pretty printing restricted-sexp values, which makes sense to me.  Values
of the sexp widget already get pretty-printed, but not the values of the
restricted-sexp widget.

I attach a patch to pretty-print restricted sexp values too, by using the
same function that the sexp widget uses.

[-- Attachment #1.2: Type: text/html, Size: 1674 bytes --]

[-- Attachment #2: 0001-Pretty-print-restricted-sexp-values-too.patch --]
[-- Type: text/x-patch, Size: 926 bytes --]

From 0cf7d7537ccbf6b68f031e47775e220607aa191e Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Wed, 7 Oct 2020 20:02:04 -0300
Subject: [PATCH] Pretty print restricted sexp values too

* lisp/wid-edit.el (restricted-sexp widget): Use
widget-sexp-value-to-internal to pretty print the widget's value, when
it is a valid one.  (Bug#7524)
---
 lisp/wid-edit.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index c3366b62cd..009c6b4faf 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -3584,7 +3584,7 @@ 'restricted-sexp
   :match 'widget-restricted-sexp-match
   :value-to-internal (lambda (widget value)
 		       (if (widget-apply widget :match value)
-			   (prin1-to-string value)
+                           (widget-sexp-value-to-internal widget value)
 			 value)))
 
 (defun widget-restricted-sexp-match (widget value)
-- 
2.28.0


  parent reply	other threads:[~2020-10-22 12:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-01  6:10 bug#7524: 24.0.50; backquote converts newlines in strings to "\n" Drew Adams
2010-12-01 16:04 ` Stefan Monnier
2010-12-01 16:40   ` Drew Adams
2010-12-01 18:07     ` Stefan Monnier
2010-12-01 18:42       ` Drew Adams
2010-12-23 22:53       ` Drew Adams
2010-12-06 17:56     ` Stefan Monnier
2010-12-06 18:06       ` Drew Adams
2010-12-06 20:16         ` Stefan Monnier
2010-12-06 21:45           ` Drew Adams
2010-12-07  3:42             ` Stefan Monnier
2010-12-06 18:10       ` Drew Adams
2010-12-06 19:58         ` Lennart Borgman
2010-12-06 21:38           ` Drew Adams
2010-12-06 21:45             ` Lennart Borgman
2020-10-22 12:24 ` Mauro Aranda [this message]
2020-10-22 12:31   ` Lars Ingebrigtsen

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='CABczVwc-=OBA_QaH16+9zrXUuKF9utkqKuCvNo83NVAeoVf44g@mail.gmail.com' \
    --to=maurooaranda@gmail.com \
    --cc=7524@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).