all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#52143: 29.0.50; Customize type `group' displays a hanging colon
@ 2021-11-27 13:10 Brahimi Saifullah
  2021-11-28 16:16 ` martin rudalics
  2021-11-29 15:53 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Brahimi Saifullah @ 2021-11-27 13:10 UTC (permalink / raw)
  To: 52143

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

Using a `group' widget type inside a `defcustom' form will result in a rather
ugly hanging colon when displayed in the Customize buffer: 

    (defcustom foo '(1 2 3) ""
      :type '(group integer integer integer))

    M-x customize-option foo


[-- Attachment #2: `group' widget -- current behavior --]
[-- Type: image/jpeg, Size: 8218 bytes --]

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


After some digging, I found related bugs #31309 and #33566, the latter which
introduced the current `:format' as a workaround to an error.
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31309
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33566

From what I gather: a colon is necessary, for whatever reason.  So having a
tag-less type, as `group' claims to be, is not possible through normal means.

What *is* possible, however, is hiding the colon with a display text property
(The following should go in `group's `define-widget' form, at wid-edit.el):

    :format (concat (propertize ":" 'display "") "%v")


[-- Attachment #4: `group' widget -- 1st proposal --]
[-- Type: image/jpeg, Size: 9344 bytes --]

[-- Attachment #5: Type: text/plain, Size: 79 bytes --]


Or with a newline:

    :format (concat (propertize ":" 'display "") "\n%v")


[-- Attachment #6: `group' widget -- 2nd proposal --]
[-- Type: image/jpeg, Size: 9251 bytes --]

[-- Attachment #7: Type: text/plain, Size: 715 bytes --]


Since the actual text remains unchanged, this should be harmless.  WDYT?

--------------------------------------------------------------------------------

This, of course, is merely polishing the workaround, the problem at its core
remains unchanged.  Though I am not yet privy to the inner working of Customize
and its widgets, all of this seems to stem from some questionable decisions at
`custom-variable-value-create'.

As someone mentioned in one of the linked bug reports that the widget code is
convoluted, I wonder, how well is this code understood? Or perhaps discussing
its behavior is pointless, if nobody can truly understand what the consequences
of righting these questionable decisions would be.



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

* bug#52143: 29.0.50; Customize type `group' displays a hanging colon
  2021-11-27 13:10 bug#52143: 29.0.50; Customize type `group' displays a hanging colon Brahimi Saifullah
@ 2021-11-28 16:16 ` martin rudalics
  2021-11-29 15:53 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: martin rudalics @ 2021-11-28 16:16 UTC (permalink / raw)
  To: Brahimi Saifullah, 52143

 >>From what I gather: a colon is necessary, for whatever reason.  So having a
 > tag-less type, as `group' claims to be, is not possible through normal means.

I don't know why 'group' should be "tag-less" (whatever that incurs)
and thus would simply use

(define-widget 'group 'default
   "A widget which groups other widgets inside."
   :convert-widget 'widget-types-convert-widget
   :copy 'widget-types-copy
   :tag "Group"
   :format "%{%t%}:\n%v"
   ...

But maybe there is a reason for the current specification.

martin





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

* bug#52143: 29.0.50; Customize type `group' displays a hanging colon
  2021-11-27 13:10 bug#52143: 29.0.50; Customize type `group' displays a hanging colon Brahimi Saifullah
  2021-11-28 16:16 ` martin rudalics
@ 2021-11-29 15:53 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-29 15:53 UTC (permalink / raw)
  To: Brahimi Saifullah; +Cc: 52143

Brahimi Saifullah <brahimi.saifullah@gmail.com> writes:

> Or with a newline:
>
>     :format (concat (propertize ":" 'display "") "\n%v")

I think that looks pretty good, so I've pushed it to Emacs 29.

martin rudalics <rudalics@gmx.at> writes:

>>>From what I gather: a colon is necessary, for whatever reason.  So having a
>> tag-less type, as `group' claims to be, is not possible through normal means.
>
> I don't know why 'group' should be "tag-less" (whatever that incurs)
> and thus would simply use
>
> (define-widget 'group 'default
>   "A widget which groups other widgets inside."
>   :convert-widget 'widget-types-convert-widget
>   :copy 'widget-types-copy
>   :tag "Group"
>   :format "%{%t%}:\n%v"
>   ...
>
> But maybe there is a reason for the current specification.

I'm guessing the reason is that they wanted to have the display less
cluttered?

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





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

end of thread, other threads:[~2021-11-29 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-27 13:10 bug#52143: 29.0.50; Customize type `group' displays a hanging colon Brahimi Saifullah
2021-11-28 16:16 ` martin rudalics
2021-11-29 15:53 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.