GNU bug report logs -
#69457
unable to place two menu-choice widgets on same line
Previous Next
Reported by: martyhiatt <at> riseup.net
Date: Wed, 28 Feb 2024 15:25:02 UTC
Severity: normal
Tags: notabug
Done: Mauro Aranda <maurooaranda <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69457 in the body.
You can then email your comments to 69457 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69457
; Package
emacs
.
(Wed, 28 Feb 2024 15:25:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
martyhiatt <at> riseup.net
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 28 Feb 2024 15:25:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
hi emacs,
not sure if this is a bug or not, i'm a widget novice, but i'd like to place two or more menu-choice widgets on the same line and am unable to. some other widgets do not enforce a newline after them, as can be seen from the example code in the emacs widgets manual.
is it possible to have multiple menu-choice widgets on the one line? if the current library doesn't allow it, would someone know how/where i might patch it?
i also noticed that i cant place any annotation string following the menu widgets displayed value (see the commented argument to the :format function below, if included the binding appears after a newline). i did some poking around and realized it is the one issue.
i'm not sure, but i suspect the issue is with the rendering of the item widget (the children), not the menu-choice widget.
some example code i have:
(defun lem-ui-return-item-widgets (list)
"Return a list of item widgets for each item, a string, in LIST."
(cl-loop for x in list
collect `(choice-item :value ,x)))
(defun lem-ui-widget-format (str &optional binding)
"Return a widget format string for STR, its name.
BINDING is a string of a keybinding to cycle the widget's value."
(concat "%[" (propertize str
'face 'lem-ui-widget-face
'lem-tab-stop t)
"%]: %v"
binding))
;; then within a buffer display function:
(widget-create 'menu-choice
:tag "Listing"
:value type
:args (lem-ui-return-item-widgets lem-listing-types)
:help-echo "Select a listing type"
:format (lem-ui-widget-format "Listing") ; "C-c C-c")
:notify (lem-ui-widget-notify-fun :sort))
(widget-create 'menu-choice
:tag "Sort"
:value sort
:args (lem-ui-return-item-widgets lem-sort-types)
:help-echo "Select a sort type"
:format (lem-ui-widget-format "Sort") ; "C-c C-s")
:notify (lem-ui-widget-notify-fun :listing-type))
(lem-widget-minor-mode)
the two widgets appear on separate lines.
also asked on online, to no avail: https://emacs.stackexchange.com/questions/80453/avoid-newlines-after-menu-choice-widget-and-or-after-v
regards,
marty
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69457
; Package
emacs
.
(Wed, 28 Feb 2024 23:51:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 69457 <at> debbugs.gnu.org (full text, mbox):
martyhiatt <at> riseup.net writes:
> is it possible to have multiple menu-choice widgets on the one line?
In my experience placing several widgets at the same line is indeed
sometimes not possible for one-lined widgets, even it should be possible
in theory.
> if the current library doesn't allow it, would someone know how/where
> i might patch it?
It might be that it is not trivial to change that because those widgets
rely on the final line break. I remember that once I tried to work
around that, and other things broke.
Who was our expert for widgets - was that you, Mauro?
Thx,
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69457
; Package
emacs
.
(Thu, 29 Feb 2024 00:14:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 69457 <at> debbugs.gnu.org (full text, mbox):
On 28/2/24 20:50, Michael Heerdegen via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
> martyhiatt <at> riseup.net writes:
>
>> is it possible to have multiple menu-choice widgets on the one line?
>
> In my experience placing several widgets at the same line is indeed
> sometimes not possible for one-lined widgets, even it should be possible
> in theory.
>
>> if the current library doesn't allow it, would someone know how/where
>> i might patch it?
>
> It might be that it is not trivial to change that because those widgets
> rely on the final line break. I remember that once I tried to work
> around that, and other things broke.
>
> Who was our expert for widgets - was that you, Mauro?
>
>
> Thx,
>
> Michael.
>
Thanks for CCing me Michael. I'll take a look.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69457
; Package
emacs
.
(Thu, 29 Feb 2024 00:28:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 69457 <at> debbugs.gnu.org (full text, mbox):
On 28/2/24 10:26, martyhiatt <at> riseup.net wrote:
> hi emacs,
>
> not sure if this is a bug or not, i'm a widget novice, but i'd like to
> place two or more menu-choice widgets on the same line and am unable to.
> some other widgets do not enforce a newline after them, as can be seen
> from the example code in the emacs widgets manual.
> is it possible to have multiple menu-choice widgets on the one line? if
> the current library doesn't allow it, would someone know how/where i
> might patch it?
I think it should be possible.
> i also noticed that i cant place any annotation string following the
> menu widgets displayed value (see the commented argument to the :format
> function below, if included the binding appears after a newline). i did
> some poking around and realized it is the one issue.
>
> i'm not sure, but i suspect the issue is with the rendering of the item
> widget (the children), not the menu-choice widget.
Yes, you need to control the :format for the choices to accomplish this,
at least.
> some example code i have:
>
> (defun lem-ui-return-item-widgets (list)
> "Return a list of item widgets for each item, a string, in LIST."
> (cl-loop for x in list
> collect `(choice-item :value ,x)))
So, how about adding something like:
:format "%[%t%] "
here?
Did you try that?
> (defun lem-ui-widget-format (str &optional binding)
> "Return a widget format string for STR, its name.
> BINDING is a string of a keybinding to cycle the widget's value."
> (concat "%[" (propertize str
> 'face 'lem-ui-widget-face
> 'lem-tab-stop t)
> "%]: %v"
> binding))
>
> ;; then within a buffer display function:
> (widget-create 'menu-choice
> :tag "Listing"
> :value type
> :args (lem-ui-return-item-widgets lem-listing-types)
> :help-echo "Select a listing type"
> :format (lem-ui-widget-format "Listing") ; "C-c C-c")
What's the intention with the "C-c C-c"? Could it go at the end of the
:format suggestion I gave above?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69457
; Package
emacs
.
(Thu, 29 Feb 2024 14:28:05 GMT)
Full text and
rfc822 format available.
Message #17 received at 69457 <at> debbugs.gnu.org (full text, mbox):
hi mauro,
thanks a lot for your response.
On 2/29/24 01:17, Mauro Aranda wrote:
> Yes, you need to control the :format for the choices to accomplish this, at least.
>
>> some example code i have:
>>
>> (defun lem-ui-return-item-widgets (list)
>> "Return a list of item widgets for each item, a string, in LIST."
>> (cl-loop for x in list
>> collect `(choice-item :value ,x)))
>
> So, how about adding something like:
> :format "%[%t%] "
> here?
>
> Did you try that?
thanks a lot, this works. i see now i had been shedding tears fighting with the menu-choice :format, not realizing i needed to wrangle the children elements instead. glad i asked the widget expert. %v also seems to work here, right?
>
>> (defun lem-ui-widget-format (str &optional binding)
>> "Return a widget format string for STR, its name.
>> BINDING is a string of a keybinding to cycle the widget's value."
>> (concat "%[" (propertize str
>> 'face 'lem-ui-widget-face
>> 'lem-tab-stop t)
>> "%]: %v"
>> binding))
>>
>> ;; then within a buffer display function:
>> (widget-create 'menu-choice
>> :tag "Listing"
>> :value type
>> :args (lem-ui-return-item-widgets lem-listing-types)
>> :help-echo "Select a listing type"
>> :format (lem-ui-widget-format "Listing") ; "C-c C-c")
>
> What's the intention with the "C-c C-c"? Could it go at the end of the :format suggestion I gave above?
yes, with the above :format it should work.
thanks again for chiming in and helping me out!
marty
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69457
; Package
emacs
.
(Thu, 29 Feb 2024 15:26:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 69457 <at> debbugs.gnu.org (full text, mbox):
tags 69457 notabug
close 69457
quit
martyhiatt <at> riseup.net writes:
>> Yes, you need to control the :format for the choices to accomplish
>> this, at least.
>>
>>> some example code i have:
>>>
>>> (defun lem-ui-return-item-widgets (list)
>>> "Return a list of item widgets for each item, a string, in LIST."
>>> (cl-loop for x in list
>>> collect `(choice-item :value ,x)))
>> So, how about adding something like:
>> :format "%[%t%] "
>> here?
>> Did you try that?
>
> thanks a lot, this works. i see now i had been shedding tears fighting
> with the menu-choice :format, not realizing i needed to wrangle the
> children elements instead. glad i asked the widget expert. %v also
> seems to work here, right?
I'm glad it worked. %v should work too, depends on what you need.
>>> ;; then within a buffer display function:
>>> (widget-create 'menu-choice
>>> :tag "Listing"
>>> :value type
>>> :args (lem-ui-return-item-widgets
lem-listing-types)
>>> :help-echo "Select a listing type"
>>> :format (lem-ui-widget-format "Listing") ;
"C-c C-c")
>> What's the intention with the "C-c C-c"? Could it go at the end of
>> the :format suggestion I gave above?
>
> yes, with the above :format it should work.
>
> thanks again for chiming in and helping me out!
You're welcome. It seems there's nothing more to do with this bug
report, so I'm marking it as notabug and closing it.
Feel free to reach me if you need further help.
Added tag(s) notabug.
Request was from
Mauro Aranda <maurooaranda <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 29 Feb 2024 15:26:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
69457 <at> debbugs.gnu.org and martyhiatt <at> riseup.net
Request was from
Mauro Aranda <maurooaranda <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 29 Feb 2024 15:26:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 29 Mar 2024 11:24:12 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 138 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.