unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
@ 2020-06-17  3:23 ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-06-17 21:20 ` Juri Linkov
                   ` (3 more replies)
  0 siblings, 4 replies; 34+ messages in thread
From: ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-06-17  3:23 UTC (permalink / raw)
  To: 41905


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

Hello,

This patch changes custom-unlispify-menu-entry to display symbols names with the "display" text property, but to keep the symbol name underneath. This is good when using try-expand-dabbrev-all-buffers, such as when writing the init file.

Thank you.

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

[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 479 bytes --]

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 1ec2708550..f5d0c69894 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -561,7 +561,8 @@ custom-unlispify-menu-entry
 	   (unless no-suffix
 	     (goto-char (point-max))
 	     (insert "..."))
-	   (buffer-string)))))
+	   (propertize (symbol-name symbol)
+                       'display (buffer-string))))))
 
 (defcustom custom-unlispify-tag-names t
   "Display tag names as words instead of symbols if non-nil."

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-06-17  3:23 bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-06-17 21:20 ` Juri Linkov
  2020-06-18 22:44   ` Juri Linkov
  2020-09-05 12:00 ` Mauro Aranda
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 34+ messages in thread
From: Juri Linkov @ 2020-06-17 21:20 UTC (permalink / raw)
  To: 41905; +Cc: ej32u

> This patch changes custom-unlispify-menu-entry to display symbols names
> with the "display" text property, but to keep the symbol name underneath.
> This is good when using try-expand-dabbrev-all-buffers, such as when
> writing the init file.

Thanks, this is a nice idea.  Your patch allows to copy the symbol by M-w
and paste into a program as a symbol.  The same idea should be used
in 'describe-mode' (C-h m) as well where mode names should be symbols
underneath displayed capitalized strings.





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-06-17 21:20 ` Juri Linkov
@ 2020-06-18 22:44   ` Juri Linkov
  0 siblings, 0 replies; 34+ messages in thread
From: Juri Linkov @ 2020-06-18 22:44 UTC (permalink / raw)
  To: 41905; +Cc: ej32u

>> This patch changes custom-unlispify-menu-entry to display symbols names
>> with the "display" text property, but to keep the symbol name underneath.
>> This is good when using try-expand-dabbrev-all-buffers, such as when
>> writing the init file.
>
> Thanks, this is a nice idea.  Your patch allows to copy the symbol by M-w
> and paste into a program as a symbol.

But what happens when a variable name is expanded in the customization buffer?
(expanded in the sense that the down arrow is displayed before it)
It seems the name displayed as a symbol, not as a human-readable string.





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-06-17  3:23 bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-06-17 21:20 ` Juri Linkov
@ 2020-09-05 12:00 ` Mauro Aranda
  2020-09-05 12:13   ` Lars Ingebrigtsen
  2020-09-05 12:12 ` Lars Ingebrigtsen
  2020-09-05 12:50 ` Mauro Aranda
  3 siblings, 1 reply; 34+ messages in thread
From: Mauro Aranda @ 2020-09-05 12:00 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 41905, ej32u


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

Juri Linkov <juri@linkov.net> writes:

>>> This patch changes custom-unlispify-menu-entry to display symbols names
>>> with the "display" text property, but to keep the symbol name
underneath.
>>> This is good when using try-expand-dabbrev-all-buffers, such as when
>>> writing the init file.
>>
>> Thanks, this is a nice idea.  Your patch allows to copy the symbol by M-w
>> and paste into a program as a symbol.
>
> But what happens when a variable name is expanded in the customization
buffer?
> (expanded in the sense that the down arrow is displayed before it)
> It seems the name displayed as a symbol, not as a human-readable string.

Hello Juri.

I think the problem you see is easily fixed with the attached patch.

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

[-- Attachment #2: 0001-Improve-call-to-widget-create-child-and-convert-in-c.patch --]
[-- Type: text/x-patch, Size: 799 bytes --]

From ea2b85184b7e4fde1cf3e3ba680095177ffed29a Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Fri, 4 Sep 2020 18:48:27 -0300
Subject: [PATCH] Improve call to widget-create-child-and-convert in cus-edit

* lisp/cus-edit.el (custom-variable-value-create): Pass tag as the
  :tag property value.
---
 lisp/cus-edit.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 23ceb3a857..7153ba40e1 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -2685,7 +2685,7 @@ custom-variable-value-create
 		    :sample-face (if obsolete
 				     'custom-variable-obsolete
 				   'custom-variable-tag)
-		    tag)
+		    :tag tag)
 		   buttons)
 	     (push (widget-create-child-and-convert
 		    widget type
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-06-17  3:23 bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-06-17 21:20 ` Juri Linkov
  2020-09-05 12:00 ` Mauro Aranda
@ 2020-09-05 12:12 ` Lars Ingebrigtsen
  2020-09-05 12:50 ` Mauro Aranda
  3 siblings, 0 replies; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 12:12 UTC (permalink / raw)
  To: ej32u; +Cc: 41905

ej32u@protonmail.com writes:

> This patch changes custom-unlispify-menu-entry to display symbols
> names with the "display" text property, but to keep the symbol name
> underneath. This is good when using try-expand-dabbrev-all-buffers,
> such as when writing the init file.

Makes sense to me, so I've applied this to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 12:00 ` Mauro Aranda
@ 2020-09-05 12:13   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 12:13 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u, Juri Linkov

Mauro Aranda <maurooaranda@gmail.com> writes:

> I think the problem you see is easily fixed with the attached patch.

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-06-17  3:23 bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
                   ` (2 preceding siblings ...)
  2020-09-05 12:12 ` Lars Ingebrigtsen
@ 2020-09-05 12:50 ` Mauro Aranda
  2020-09-05 12:56   ` Lars Ingebrigtsen
  3 siblings, 1 reply; 34+ messages in thread
From: Mauro Aranda @ 2020-09-05 12:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, ej32u

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> ej32u@protonmail.com writes:
>
>> This patch changes custom-unlispify-menu-entry to display symbols
>> names with the "display" text property, but to keep the symbol name
>> underneath. This is good when using try-expand-dabbrev-all-buffers,
>> such as when writing the init file.
>
> Makes sense to me, so I've applied this to Emacs 28.

I think this change broke `C-h S' in Custom buffers:
emacs -Q
M-x customize-option RET fill-column
Put point in Fill Column
C-h S
You get prompted with: Describe symbol (default Hide-fill-column), which
is of course undocumented.
Before, the prompt was:
Describe symbol (default Fill-Column), and typing RET would open an Info
buffer without problems.

I'm not saying the change is bad.  I was just trying to see if this
change will fulfill the request in Bug#400, and I guess it does: C-h v
seems to work just fine, but I guess info-lookup-guess-custom-symbol
wasn't ready for the change.

[-- Attachment #2: Type: text/html, Size: 1219 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 12:50 ` Mauro Aranda
@ 2020-09-05 12:56   ` Lars Ingebrigtsen
  2020-09-05 13:08     ` Mauro Aranda
  0 siblings, 1 reply; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 12:56 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

Mauro Aranda <maurooaranda@gmail.com> writes:

>>> This patch changes custom-unlispify-menu-entry to display symbols
>>> names with the "display" text property, but to keep the symbol name
>>> underneath. This is good when using try-expand-dabbrev-all-buffers,
>>> such as when writing the init file.
>>
>> Makes sense to me, so I've applied this to Emacs 28.
>
> I think this change broke `C-h S' in Custom buffers:

[...]

> I'm not saying the change is bad.  I was just trying to see if this
> change will fulfill the request in Bug#400, and I guess it does: C-h v
> seems to work just fine, but I guess info-lookup-guess-custom-symbol
> wasn't ready for the change.

Nope.  Would fixing info-lookup-guess-custom-symbol here be a lot of work?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 12:56   ` Lars Ingebrigtsen
@ 2020-09-05 13:08     ` Mauro Aranda
  2020-09-05 13:12       ` Mauro Aranda
  2020-09-05 13:24       ` Lars Ingebrigtsen
  0 siblings, 2 replies; 34+ messages in thread
From: Mauro Aranda @ 2020-09-05 13:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, ej32u

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes:

>> I'm not saying the change is bad.  I was just trying to see if this
>> change will fulfill the request in Bug#400, and I guess it does: C-h v
>> seems to work just fine, but I guess info-lookup-guess-custom-symbol
>> wasn't ready for the change.
>
> Nope.  Would fixing info-lookup-guess-custom-symbol here be a lot of work?

I'm guessing no, because it shouldn't have to guess anymore...but I'm
not familiar with it.

[-- Attachment #2: Type: text/html, Size: 719 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 13:08     ` Mauro Aranda
@ 2020-09-05 13:12       ` Mauro Aranda
  2020-09-05 13:24       ` Lars Ingebrigtsen
  1 sibling, 0 replies; 34+ messages in thread
From: Mauro Aranda @ 2020-09-05 13:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, ej32u

[-- Attachment #1: Type: text/plain, Size: 724 bytes --]

Mauro Aranda <maurooaranda@gmail.com> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Mauro Aranda <maurooaranda@gmail.com> writes:
>
>>> I'm not saying the change is bad.  I was just trying to see if this
>>> change will fulfill the request in Bug#400, and I guess it does: C-h v
>>> seems to work just fine, but I guess info-lookup-guess-custom-symbol
>>> wasn't ready for the change.
>>
>> Nope.  Would fixing info-lookup-guess-custom-symbol here be a lot of
work?
>
> I'm guessing no, because it shouldn't have to guess anymore...but I'm
> not familiar with it.

I did the obvious: commented out the :parse-rule line in
info-lookup-maybe-add-help for the :mode 'Custom-mode, and looks like
its working again.

[-- Attachment #2: Type: text/html, Size: 1040 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 13:08     ` Mauro Aranda
  2020-09-05 13:12       ` Mauro Aranda
@ 2020-09-05 13:24       ` Lars Ingebrigtsen
  2020-09-05 13:48         ` Mauro Aranda
  1 sibling, 1 reply; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 13:24 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

Mauro Aranda <maurooaranda@gmail.com> writes:

>> Nope.  Would fixing info-lookup-guess-custom-symbol here be a lot of work?
>
> I'm guessing no, because it shouldn't have to guess anymore...but I'm
> not familiar with it.

Actually...  Is this a regression?  I just tried this in Emacs 27, and
`C-h S' on "Fill Column" there asks me:


[-- Attachment #2: Type: image/png, Size: 9593 bytes --]

[-- Attachment #3: Type: text/plain, Size: 665 bytes --]


Which doesn't exist.

After the patch, it says "Hide-fill-column", which doesn't exist either,
but which is basically the same bug -- which is that there's an
invisible string "Hide" before the "Fill Column".

Hm...  Oh!  If I move point into "Fill Column", then it guesses
correctly, but if point is at the "F", then it includes the invisible
"Hide".

The design choices taken in the library here are pretty odd --
transforming symbols to readable forms and then "guessing" to transform
them back, instead of just stashing the real data for easy retrieval...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 13:24       ` Lars Ingebrigtsen
@ 2020-09-05 13:48         ` Mauro Aranda
  2020-09-05 13:52           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 34+ messages in thread
From: Mauro Aranda @ 2020-09-05 13:48 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, ej32u

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> After the patch, it says "Hide-fill-column", which doesn't exist either,
> but which is basically the same bug -- which is that there's an
> invisible string "Hide" before the "Fill Column".
>
> Hm...  Oh!  If I move point into "Fill Column", then it guesses
> correctly, but if point is at the "F", then it includes the invisible
> "Hide".

You are right.  So this patch didn't break `C-h S' at all, it just made
the bug a lot more visible.

Anyway, my lightly testing shows that perhaps relying on the :regexp and
not providing :parse-rule could be enough.

[-- Attachment #2: Type: text/html, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 13:48         ` Mauro Aranda
@ 2020-09-05 13:52           ` Lars Ingebrigtsen
  2020-09-05 14:16             ` Mauro Aranda
  0 siblings, 1 reply; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 13:52 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

Mauro Aranda <maurooaranda@gmail.com> writes:

> You are right.  So this patch didn't break `C-h S' at all, it just made
> the bug a lot more visible.
>
> Anyway, my lightly testing shows that perhaps relying on the :regexp and
> not providing :parse-rule could be enough.

Could you whip up a patch for that?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 13:52           ` Lars Ingebrigtsen
@ 2020-09-05 14:16             ` Mauro Aranda
  2020-09-05 14:36               ` Lars Ingebrigtsen
  2020-09-05 15:07               ` Drew Adams
  0 siblings, 2 replies; 34+ messages in thread
From: Mauro Aranda @ 2020-09-05 14:16 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, ej32u


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

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes:
>
>> You are right.  So this patch didn't break `C-h S' at all, it just made
>> the bug a lot more visible.
>>
>> Anyway, my lightly testing shows that perhaps relying on the :regexp and
>> not providing :parse-rule could be enough.
>
> Could you whip up a patch for that?

Sure, here is the patch I'm running with

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

[-- Attachment #2: 0001-info-lookup-symbol-Fix-the-suggested-default-value-i.patch --]
[-- Type: text/x-patch, Size: 1344 bytes --]

From 54f6295b9180f10216835fbeb91d26031179e93f Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Sat, 5 Sep 2020 11:06:36 -0300
Subject: [PATCH] info-lookup-symbol: Fix the suggested default value in Custom
 buffers

* lisp/info-look.el (info-lookup-maybe-add-help 'Custom-mode): Don't
pass info-lookup-guess-custom-symbol as the :parse-rule, since we
don't need it anymore.  (Bug#41905)
(info-lookup-guess-custom-symbol): Now unused, mark as obsolete.
---
 lisp/info-look.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/info-look.el b/lisp/info-look.el
index 4e379cadef..701a7e6014 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -648,6 +648,9 @@ info-lookup-guess-custom-symbol
 		     (> end beg)))
 	    (buffer-substring-no-properties beg end)))))
     (error nil)))
+;; We don't need this anymore, because now Custom inserts the unlispified name
+;; in the buffer.  (Bug#41905)
+(make-obsolete 'info-lookup-guess-custom-symbol nil "28.1")
 
 (defun info-lookup-guess-gdb-script-symbol ()
   "Get symbol at point in GDB script buffers."
@@ -1065,7 +1068,6 @@ info-complete
  :mode 'Custom-mode
  :ignore-case t
  :regexp "[^][()`'‘’,:\" \t\n]+"
- :parse-rule 'info-lookup-guess-custom-symbol
  :other-modes '(emacs-lisp-mode))
 
 (info-lookup-maybe-add-help
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 14:16             ` Mauro Aranda
@ 2020-09-05 14:36               ` Lars Ingebrigtsen
  2020-09-05 14:58                 ` Mauro Aranda
  2020-09-05 15:07               ` Drew Adams
  1 sibling, 1 reply; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 14:36 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

[-- Attachment #1: Type: text/plain, Size: 176 bytes --]

Mauro Aranda <maurooaranda@gmail.com> writes:

> Sure, here is the patch I'm running with

Thanks, that makes C-h S use the correct string.  However, the prompt is
confusing:


[-- Attachment #2: Type: image/png, Size: 9571 bytes --]

[-- Attachment #3: Type: text/plain, Size: 257 bytes --]


Because it's using the string from the buffer...  including the 'display
text property.  Perhaps it should strip all text properties before being
used?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 14:36               ` Lars Ingebrigtsen
@ 2020-09-05 14:58                 ` Mauro Aranda
  2020-09-05 15:08                   ` Lars Ingebrigtsen
  2020-09-05 15:20                   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 34+ messages in thread
From: Mauro Aranda @ 2020-09-05 14:58 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, ej32u


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

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes:
>
>> Sure, here is the patch I'm running with
>
> Thanks, that makes C-h S use the correct string.  However, the prompt is
> confusing:

[...]

> Because it's using the string from the buffer...  including the 'display
> text property.  Perhaps it should strip all text properties before being
> used?

Then I guess we must change info-lookup-interactive-arguments to do that.

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

[-- Attachment #2: 0001-info-lookup-symbol-Fix-the-suggested-default-value-i.patch --]
[-- Type: text/x-patch, Size: 1961 bytes --]

From 1937e2d0119c692683c01eded8585ccafba5349c Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Sat, 5 Sep 2020 11:06:36 -0300
Subject: [PATCH] info-lookup-symbol: Fix the suggested default value in Custom
 buffers

* lisp/info-look.el (info-lookup-maybe-add-help 'Custom-mode): Don't
pass info-lookup-guess-custom-symbol as the :parse-rule, since we
don't need it anymore.  (Bug#41905)
(info-lookup-guess-custom-symbol): Now unused, mark as obsolete.
(info-lookup-interactive-arguments): Get rid of text properties before
passing the default value to completing-read.
---
 lisp/info-look.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/info-look.el b/lisp/info-look.el
index 4e379cadef..76c39bcd86 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -298,7 +298,8 @@ info-lookup-interactive-arguments
 	 (enable-recursive-minibuffers t)
 	 (value (completing-read
 		 (if default
-		     (format "Describe %s (default %s): " topic default)
+                     (progn (set-text-properties 0 (length default) nil default)
+		            (format "Describe %s (default %s): " topic default))
 		   (format "Describe %s: " topic))
 		 completions nil nil nil 'info-lookup-history default)))
     (list (if (equal value "") default value) mode)))
@@ -648,6 +649,9 @@ info-lookup-guess-custom-symbol
 		     (> end beg)))
 	    (buffer-substring-no-properties beg end)))))
     (error nil)))
+;; We don't need this anymore, because now Custom inserts the unlispified name
+;; in the buffer.  (Bug#41905)
+(make-obsolete 'info-lookup-guess-custom-symbol nil "28.1")
 
 (defun info-lookup-guess-gdb-script-symbol ()
   "Get symbol at point in GDB script buffers."
@@ -1065,7 +1069,6 @@ info-complete
  :mode 'Custom-mode
  :ignore-case t
  :regexp "[^][()`'‘’,:\" \t\n]+"
- :parse-rule 'info-lookup-guess-custom-symbol
  :other-modes '(emacs-lisp-mode))
 
 (info-lookup-maybe-add-help
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 14:16             ` Mauro Aranda
  2020-09-05 14:36               ` Lars Ingebrigtsen
@ 2020-09-05 15:07               ` Drew Adams
  2020-09-05 15:31                 ` Mauro Aranda
  1 sibling, 1 reply; 34+ messages in thread
From: Drew Adams @ 2020-09-05 15:07 UTC (permalink / raw)
  To: Mauro Aranda, Lars Ingebrigtsen; +Cc: 41905, ej32u

> Sure, here is the patch I'm running with

Isn't this comment part of the patch wrong?

+;; We don't need this anymore, because now Custom inserts the unlispified name
+;; in the buffer.  (Bug#41905)


Isn't the fix that it now inserts the _lispified_ name?

____


Anyway, thanks to all for working on this bug.

  - OP for bug #400





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 14:58                 ` Mauro Aranda
@ 2020-09-05 15:08                   ` Lars Ingebrigtsen
  2020-09-05 15:20                   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 15:08 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

Mauro Aranda <maurooaranda@gmail.com> writes:

> Then I guess we must change info-lookup-interactive-arguments to do that.

Thanks; applied to Emacs 28 with one small change:

> -		     (format "Describe %s (default %s): " topic default)
> +                     (progn (set-text-properties 0 (length default) nil default)
> +		            (format "Describe %s (default %s): " topic default))

I changed this to use substring-no-properties instead of
set-text-properties.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 14:58                 ` Mauro Aranda
  2020-09-05 15:08                   ` Lars Ingebrigtsen
@ 2020-09-05 15:20                   ` Lars Ingebrigtsen
  2020-09-05 15:27                     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 15:20 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

After all that work, I think we'll have to revert this, anyway.  The
string returned here isn't just used in the buffers themselves, but also
in the buffer names, so this fails:

(ert-deftest so-long-tests-customize ()
  "Test the `so-long-customize' command."
  (so-long-customize)
  (should (string= (buffer-name) "*Customize Group: So Long*")))

*sigh*

Or...  we could work some more on this to fix these use cases.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 15:20                   ` Lars Ingebrigtsen
@ 2020-09-05 15:27                     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 15:27 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Or...  we could work some more on this to fix these use cases.

Looking more at this, I think returning a 'display string here is just
wrong in most use cases, so I've reverted the patch (and Mauro's
follow-up patch that fixed some issues with the patch).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 15:07               ` Drew Adams
@ 2020-09-05 15:31                 ` Mauro Aranda
  2020-09-05 16:37                   ` Lars Ingebrigtsen
  2020-09-06 12:17                   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 34+ messages in thread
From: Mauro Aranda @ 2020-09-05 15:31 UTC (permalink / raw)
  To: Drew Adams; +Cc: Lars Ingebrigtsen, 41905, ej32u

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

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

>> Sure, here is the patch I'm running with
>
> Isn't this comment part of the patch wrong?
>
> +;; We don't need this anymore, because now Custom inserts the
unlispified name
> +;; in the buffer.  (Bug#41905)
>
>
> Isn't the fix that it now inserts the _lispified_ name?
>

Yes, it was wrong, thank you.  But this was reverted, so it's all moot now.

>
> Anyway, thanks to all for working on this bug.
>
>   - OP for bug #400

Looks like we're back to where we started, though :-(

[-- Attachment #2: Type: text/html, Size: 729 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 15:31                 ` Mauro Aranda
@ 2020-09-05 16:37                   ` Lars Ingebrigtsen
  2020-09-06 12:17                   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-05 16:37 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

Mauro Aranda <maurooaranda@gmail.com> writes:

> Looks like we're back to where we started, though :-(

Yup.

I think the solution here is to stash the data needed somewhere so that
we don't need to guessing round trip.

The most obvious place to stash the data is in the string itself, so
custom-unlispify-tag-name should just put a 'data text property on the
unlispified string (with the symbol), and then the relevant functions
should use that instead of looking at the buffer text.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-05 15:31                 ` Mauro Aranda
  2020-09-05 16:37                   ` Lars Ingebrigtsen
@ 2020-09-06 12:17                   ` Lars Ingebrigtsen
  2020-09-06 12:35                     ` Mauro Aranda
  1 sibling, 1 reply; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-06 12:17 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

I've now taken another whack at this (but storing the actual symbol), and
`C-h S' now works better than before, and no tests are failing.  I'm not
quite sure whether the change here will spill over into Emacs Lisp mode,
but some testing seems to say that it won't...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-06 12:17                   ` Lars Ingebrigtsen
@ 2020-09-06 12:35                     ` Mauro Aranda
  2020-09-06 12:39                       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 34+ messages in thread
From: Mauro Aranda @ 2020-09-06 12:35 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, ej32u


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

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I've now taken another whack at this (but storing the actual symbol), and
> `C-h S' now works better than before, and no tests are failing.  I'm not
> quite sure whether the change here will spill over into Emacs Lisp mode,
> but some testing seems to say that it won't...

What I liked about the 'display approach is that it didn't seem to
require changes in the describe-* commands to work...

So I thought we could perhaps limit the places where we propertize the
string, and I came up with the attached patch.  But if you still think
it is the wrong way to do it, or if you like your changes better, I
promise I won't insist.

Note that with my patch, we'd still need the info-lookup patch from
yesterday.

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

[-- Attachment #2: 0001-Show-tag-of-options-and-groups-unlispified-keep-lisp.patch --]
[-- Type: text/x-patch, Size: 6200 bytes --]

From 6001bb3826e1ec084dcd8ba15b3cb03d83c0f2f9 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Sat, 5 Sep 2020 19:06:06 -0300
Subject: [PATCH] Show tag of options and groups unlispified, keep lispified
 names underneath

* lisp/cus-edit.el (custom-unlispify-tag-name): Add an optional
argument, to control whether to add a 'display text property to the
returned string.  With this, Custom can display the tag as an
unlispified name of an user option or a group, while keeping the
lispified name in the buffer, so commands like describe-variable can
pick it up as the default value.  (Bug#41905) (Bug#400)
(custom-buffer-create-internal, customize-browse)
(custom-add-parent-links, custom-group-value-create): Change the
call to custom-unlispify-tag-name accordingly, since now we pass a
propertized string as the :tag value of the widget.

* test/lisp/custom-test.el (custom-test-unlispify-tag-name-propertizing):
New test, to test for this feature.
---
 lisp/cus-edit.el          | 28 ++++++++++++++++++----------
 test/lisp/custom-tests.el | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 7153ba40e1..06622631f7 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -568,10 +568,18 @@ custom-unlispify-tag-names
   :group 'custom-buffer
   :type 'boolean)
 
-(defun custom-unlispify-tag-name (symbol)
-  "Convert SYMBOL into a menu entry."
-  (let ((custom-unlispify-menu-entries custom-unlispify-tag-names))
-    (custom-unlispify-menu-entry symbol t)))
+(defun custom-unlispify-tag-name (symbol &optional propertizep)
+  "Return a string representing SYMBOL as a tag name.
+
+With PROPERTIZEP non-nil, the string that represents SYMBOL has a 'display text
+property whose value is the return value of `custom-unlispify-menu-entry'.
+The value of the 'display text property depends on the user option
+`custom-unlispify-tag-names'."
+  (let* ((custom-unlispify-menu-entries custom-unlispify-tag-names)
+         (str (custom-unlispify-menu-entry symbol t)))
+    (if propertizep
+        (propertize (symbol-name symbol) 'display str)
+      str)))
 
 (defun custom-prefix-add (symbol prefixes)
   "Add SYMBOL to list of ignored PREFIXES."
@@ -1708,7 +1716,7 @@ custom-buffer-create-internal
 				     :documentation-shown t
 				     :custom-state 'unknown
 				     :tag (custom-unlispify-tag-name
-					   (nth 0 entry))
+                                           (nth 0 entry) t)
 				     :value (nth 0 entry)))
 		    options)
 	  (let ((count 0)
@@ -1719,7 +1727,7 @@ custom-buffer-create-internal
 				   (floor (* 100.0 count) length))
 			  (widget-create (nth 1 entry)
 					 :tag (custom-unlispify-tag-name
-					       (nth 0 entry))
+                                               (nth 0 entry) t)
 					 :value (nth 0 entry))
 			(setq count (1+ count))
 			(unless (eq (preceding-char) ?\n)
@@ -1781,7 +1789,7 @@ customize-browse
     (widget-create 'custom-group
 		   :custom-last t
 		   :custom-state 'unknown
-		   :tag (custom-unlispify-tag-name group)
+		   :tag (custom-unlispify-tag-name group t)
 		   :value group))
   (widget-setup)
   (goto-char (point-min)))
@@ -2355,7 +2363,7 @@ custom-add-parent-links
 		  (insert " ")
 		  (push (widget-create-child-and-convert
 			 widget 'custom-group-link
-			 :tag (custom-unlispify-tag-name symbol)
+			 :tag (custom-unlispify-tag-name symbol t)
 			 symbol)
 			buttons)
 		  (setq parents (cons symbol parents)))))
@@ -4174,7 +4182,7 @@ custom-group-value-create
 		 (push (widget-create-child-and-convert
 			widget (nth 1 entry)
 			:group widget
-			:tag (custom-unlispify-tag-name (nth 0 entry))
+			:tag (custom-unlispify-tag-name (nth 0 entry) t)
 			:custom-prefixes custom-prefix-list
 			:custom-level (1+ level)
 			:custom-last (null members)
@@ -4297,7 +4305,7 @@ custom-group-value-create
 		 (push (widget-create-child-and-convert
 			widget type
 			:group widget
-			:tag (custom-unlispify-tag-name sym)
+			:tag (custom-unlispify-tag-name sym t)
 			:custom-prefixes custom-prefix-list
 			:custom-level (1+ level)
 			:value sym)
diff --git a/test/lisp/custom-tests.el b/test/lisp/custom-tests.el
index 7853c84bb6..d061315714 100644
--- a/test/lisp/custom-tests.el
+++ b/test/lisp/custom-tests.el
@@ -145,4 +145,37 @@ custom-test-show-comment-preserves-changes
                                (widget-apply field :value-to-internal origvalue)
                                "bar"))))))
 
+(ert-deftest custom-test-unlispify-tag-name-propertizing ()
+  "Test that propertizing tag name for variables and faces works as intended."
+  ;; Customize a group that has a dash.
+  ;; The buffer name should have the group name unlispified.
+  (customize-group 'custom-browse)
+  (should (string= (buffer-name) "*Customize Group: Custom Browse*"))
+  ;; Advance to the group tag.
+  (search-forward (get 'custom-browse 'group-documentation))
+  (beginning-of-line)
+  ;; The display property should be the group name unlispified.
+  (should (string= (get-text-property (point) 'display) "Custom Browse"))
+  ;; And we should be able to detect a symbol at point, the group name,
+  ;; lispified.
+  (should (eq (symbol-at-point) 'custom-browse))
+
+  ;; We use the first user option, for testing.
+  (let ((w (car (widget-get (car custom-options) :children))))
+    ;; The symbol name should be the same string stored in :tag, not counting
+    ;; text properties.
+    (should (string= (symbol-name (widget-get w :value))
+                     (widget-get w :tag)))
+    ;; And the 'display text property should be the unlispified symbol name.
+    (should (string= (custom-unlispify-tag-name (widget-get w :value))
+                     (get-text-property 0 'display (widget-get w :tag)))))
+
+  ;; Now try with a face.
+  (customize-face 'scroll-bar)
+  (let ((w (car custom-options)))
+    (should (string= (symbol-name (widget-get w :value))
+                     (widget-get w :tag)))
+    (should (string= (custom-unlispify-tag-name (widget-get w :value))
+                     (get-text-property 0 'display (widget-get w :tag))))))
+
 ;;; custom-tests.el ends here
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-06 12:35                     ` Mauro Aranda
@ 2020-09-06 12:39                       ` Lars Ingebrigtsen
  2020-09-06 12:54                         ` Mauro Aranda
  0 siblings, 1 reply; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-06 12:39 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 41905, ej32u

Mauro Aranda <maurooaranda@gmail.com> writes:

> What I liked about the 'display approach is that it didn't seem to
> require changes in the describe-* commands to work...

That is a good point, and it would make C-h v make work automatically.
But 'display properties are kinda awkward -- for one, the cursor moves
over them in a single skip, so they're a bit confusing in that respect.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-06 12:39                       ` Lars Ingebrigtsen
@ 2020-09-06 12:54                         ` Mauro Aranda
  2020-09-06 18:40                           ` Juri Linkov
  0 siblings, 1 reply; 34+ messages in thread
From: Mauro Aranda @ 2020-09-06 12:54 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, ej32u

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes:
>
>> What I liked about the 'display approach is that it didn't seem to
>> require changes in the describe-* commands to work...
>
> That is a good point, and it would make C-h v make work automatically.
> But 'display properties are kinda awkward -- for one, the cursor moves
> over them in a single skip, so they're a bit confusing in that respect.

Yes, that's true.  So...perhaps it's better to just ditch that idea.

[-- Attachment #2: Type: text/html, Size: 715 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-06 12:54                         ` Mauro Aranda
@ 2020-09-06 18:40                           ` Juri Linkov
  2020-09-07 18:22                             ` Juri Linkov
  0 siblings, 1 reply; 34+ messages in thread
From: Juri Linkov @ 2020-09-06 18:40 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: Lars Ingebrigtsen, 41905, ej32u

>>> What I liked about the 'display approach is that it didn't seem to
>>> require changes in the describe-* commands to work...
>>
>> That is a good point, and it would make C-h v make work automatically.
>> But 'display properties are kinda awkward -- for one, the cursor moves
>> over them in a single skip, so they're a bit confusing in that respect.
>
> Yes, that's true.  So...perhaps it's better to just ditch that idea.

Just display spaces over every '-' character (and upper-case letters
at word beginnings):

(concat (propertize "f" 'display "F")
        "ill"
        (propertize "-" 'display " ")
        (propertize "c" 'display "C")
        "olumn")





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-06 18:40                           ` Juri Linkov
@ 2020-09-07 18:22                             ` Juri Linkov
  2020-09-07 19:44                               ` Mauro Aranda
  2020-09-07 20:28                               ` Lars Ingebrigtsen
  0 siblings, 2 replies; 34+ messages in thread
From: Juri Linkov @ 2020-09-07 18:22 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: Lars Ingebrigtsen, 41905, ej32u

>>>> What I liked about the 'display approach is that it didn't seem to
>>>> require changes in the describe-* commands to work...
>>>
>>> That is a good point, and it would make C-h v make work automatically.
>>> But 'display properties are kinda awkward -- for one, the cursor moves
>>> over them in a single skip, so they're a bit confusing in that respect.
>>
>> Yes, that's true.  So...perhaps it's better to just ditch that idea.
>
> Just display spaces over every '-' character (and upper-case letters
> at word beginnings):
>
> (concat (propertize "f" 'display "F")
>         "ill"
>         (propertize "-" 'display " ")
>         (propertize "c" 'display "C")
>         "olumn")

Actually I meant not concat, but set-text-properties:

(let ((name "fill-column"))
 (set-text-properties 0 1 '(display "F") name)
 (set-text-properties 4 5 '(display " ") name)
 (set-text-properties 5 6 '(display "C") name)
 (insert name))





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-07 18:22                             ` Juri Linkov
@ 2020-09-07 19:44                               ` Mauro Aranda
  2020-09-07 20:28                               ` Lars Ingebrigtsen
  1 sibling, 0 replies; 34+ messages in thread
From: Mauro Aranda @ 2020-09-07 19:44 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Lars Ingebrigtsen, 41905, ej32u

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

Juri Linkov <juri@linkov.net> writes:

>>>>> What I liked about the 'display approach is that it didn't seem to
>>>>> require changes in the describe-* commands to work...
>>>>
>>>> That is a good point, and it would make C-h v make work automatically.
>>>> But 'display properties are kinda awkward -- for one, the cursor moves
>>>> over them in a single skip, so they're a bit confusing in that respect.
>>>
>>> Yes, that's true.  So...perhaps it's better to just ditch that idea.
>>
>> Just display spaces over every '-' character (and upper-case letters
>> at word beginnings):
>>
>> (concat (propertize "f" 'display "F")
>>         "ill"
>>         (propertize "-" 'display " ")
>>         (propertize "c" 'display "C")
>>         "olumn")
>
> Actually I meant not concat, but set-text-properties:
>
> (let ((name "fill-column"))
>  (set-text-properties 0 1 '(display "F") name)
>  (set-text-properties 4 5 '(display " ") name)
>  (set-text-properties 5 6 '(display "C") name)
>  (insert name))

I think that's a good idea.

[-- Attachment #2: Type: text/html, Size: 1553 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-07 18:22                             ` Juri Linkov
  2020-09-07 19:44                               ` Mauro Aranda
@ 2020-09-07 20:28                               ` Lars Ingebrigtsen
  2020-09-08 18:33                                 ` Juri Linkov
  2020-09-08 19:09                                 ` Juri Linkov
  1 sibling, 2 replies; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-07 20:28 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 41905, Mauro Aranda, ej32u

Juri Linkov <juri@linkov.net> writes:

>> (concat (propertize "f" 'display "F")
>>         "ill"
>>         (propertize "-" 'display " ")
>>         (propertize "c" 'display "C")
>>         "olumn")
>
> Actually I meant not concat, but set-text-properties:
>
> (let ((name "fill-column"))
>  (set-text-properties 0 1 '(display "F") name)
>  (set-text-properties 4 5 '(display " ") name)
>  (set-text-properties 5 6 '(display "C") name)
>  (insert name))

Why not concat?  I think the end result is the same?

Anyway, it's an intriguing idea.  It's perhaps possibly slightly
confusing, but it avoids the problems with a longer display string, and
it fixes the `C-h v' problem.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-07 20:28                               ` Lars Ingebrigtsen
@ 2020-09-08 18:33                                 ` Juri Linkov
  2020-09-08 20:50                                   ` Lars Ingebrigtsen
  2020-09-08 19:09                                 ` Juri Linkov
  1 sibling, 1 reply; 34+ messages in thread
From: Juri Linkov @ 2020-09-08 18:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, Mauro Aranda, ej32u

>>> (concat (propertize "f" 'display "F")
>>>         "ill"
>>>         (propertize "-" 'display " ")
>>>         (propertize "c" 'display "C")
>>>         "olumn")
>>
>> Actually I meant not concat, but set-text-properties:
>>
>> (let ((name "fill-column"))
>>  (set-text-properties 0 1 '(display "F") name)
>>  (set-text-properties 4 5 '(display " ") name)
>>  (set-text-properties 5 6 '(display "C") name)
>>  (insert name))
>
> Why not concat?  I think the end result is the same?

No difference, indeed :)  But set-text-properties is cleaner:
we have a string and add properties to it.





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-07 20:28                               ` Lars Ingebrigtsen
  2020-09-08 18:33                                 ` Juri Linkov
@ 2020-09-08 19:09                                 ` Juri Linkov
  2020-09-08 20:52                                   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 34+ messages in thread
From: Juri Linkov @ 2020-09-08 19:09 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 41905, Mauro Aranda, ej32u

>>> (concat (propertize "f" 'display "F")
>>>         "ill"
>>>         (propertize "-" 'display " ")
>>>         (propertize "c" 'display "C")
>>>         "olumn")
>>
>> Actually I meant not concat, but set-text-properties:
>>
>> (let ((name "fill-column"))
>>  (set-text-properties 0 1 '(display "F") name)
>>  (set-text-properties 4 5 '(display " ") name)
>>  (set-text-properties 5 6 '(display "C") name)
>>  (insert name))
>
> Why not concat?  I think the end result is the same?

Actually, you are right - destructive construction of strings is simpler:

(let* ((name (symbol-name 'fill-column))
       (text (replace-regexp-in-string
              "\\b[a-z]"
              (lambda (c) (propertize c 'display (upcase c)))
              (replace-regexp-in-string
	       "[-:/]+"
               (lambda (c) (propertize c 'display " "))
               name))))
  (insert text))





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-08 18:33                                 ` Juri Linkov
@ 2020-09-08 20:50                                   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-08 20:50 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 41905, Mauro Aranda, ej32u

Juri Linkov <juri@linkov.net> writes:

>>>> (concat (propertize "f" 'display "F")
>>>>         "ill"
>>>>         (propertize "-" 'display " ")
>>>>         (propertize "c" 'display "C")
>>>>         "olumn")
>>>
>>> Actually I meant not concat, but set-text-properties:
>>>
>>> (let ((name "fill-column"))
>>>  (set-text-properties 0 1 '(display "F") name)
>>>  (set-text-properties 4 5 '(display " ") name)
>>>  (set-text-properties 5 6 '(display "C") name)
>>>  (insert name))
>>
>> Why not concat?  I think the end result is the same?
>
> No difference, indeed :)  But set-text-properties is cleaner:
> we have a string and add properties to it.

Yeah, but that's what propertize does, too.  Only less verbosely.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

* bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath.
  2020-09-08 19:09                                 ` Juri Linkov
@ 2020-09-08 20:52                                   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 34+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-08 20:52 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 41905, Mauro Aranda, ej32u

Juri Linkov <juri@linkov.net> writes:

> Actually, you are right - destructive construction of strings is simpler:
>
> (let* ((name (symbol-name 'fill-column))
>        (text (replace-regexp-in-string
>               "\\b[a-z]"
>               (lambda (c) (propertize c 'display (upcase c)))
>               (replace-regexp-in-string
> 	       "[-:/]+"
>                (lambda (c) (propertize c 'display " "))
>                name))))
>   (insert text))

Makes sense to me.  Perhaps we should back out the fix I made here, and
add this one...  hm...  on the other hand, I think perhaps just doing
both is even better.  That is, do this to the prettified string, but
still add the 'data property.  So this would be a fix for bug#400.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2020-09-08 20:52 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-17  3:23 bug#41905: Small change: In Customize, display name with with spaces, but keep symbol name underneath ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-17 21:20 ` Juri Linkov
2020-06-18 22:44   ` Juri Linkov
2020-09-05 12:00 ` Mauro Aranda
2020-09-05 12:13   ` Lars Ingebrigtsen
2020-09-05 12:12 ` Lars Ingebrigtsen
2020-09-05 12:50 ` Mauro Aranda
2020-09-05 12:56   ` Lars Ingebrigtsen
2020-09-05 13:08     ` Mauro Aranda
2020-09-05 13:12       ` Mauro Aranda
2020-09-05 13:24       ` Lars Ingebrigtsen
2020-09-05 13:48         ` Mauro Aranda
2020-09-05 13:52           ` Lars Ingebrigtsen
2020-09-05 14:16             ` Mauro Aranda
2020-09-05 14:36               ` Lars Ingebrigtsen
2020-09-05 14:58                 ` Mauro Aranda
2020-09-05 15:08                   ` Lars Ingebrigtsen
2020-09-05 15:20                   ` Lars Ingebrigtsen
2020-09-05 15:27                     ` Lars Ingebrigtsen
2020-09-05 15:07               ` Drew Adams
2020-09-05 15:31                 ` Mauro Aranda
2020-09-05 16:37                   ` Lars Ingebrigtsen
2020-09-06 12:17                   ` Lars Ingebrigtsen
2020-09-06 12:35                     ` Mauro Aranda
2020-09-06 12:39                       ` Lars Ingebrigtsen
2020-09-06 12:54                         ` Mauro Aranda
2020-09-06 18:40                           ` Juri Linkov
2020-09-07 18:22                             ` Juri Linkov
2020-09-07 19:44                               ` Mauro Aranda
2020-09-07 20:28                               ` Lars Ingebrigtsen
2020-09-08 18:33                                 ` Juri Linkov
2020-09-08 20:50                                   ` Lars Ingebrigtsen
2020-09-08 19:09                                 ` Juri Linkov
2020-09-08 20:52                                   ` Lars Ingebrigtsen

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).