bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69457: unable to place two menu-choice widgets on same line


From: Mauro Aranda
Subject: bug#69457: unable to place two menu-choice widgets on same line
Date: Wed, 28 Feb 2024 21:17:23 -0300
User-agent: Mozilla Thunderbird

On 28/2/24 10:26, martyhiatt@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?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]