unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martyhiatt@riseup.net
To: 69457@debbugs.gnu.org
Subject: bug#69457: unable to place two menu-choice widgets on same line
Date: Wed, 28 Feb 2024 14:26:35 +0100	[thread overview]
Message-ID: <5f95b89c-f8ee-4615-a856-aeb8deef0f8b@riseup.net> (raw)

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





             reply	other threads:[~2024-02-28 13:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 13:26 martyhiatt [this message]
2024-02-28 23:50 ` bug#69457: unable to place two menu-choice widgets on same line Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-29  0:11   ` Mauro Aranda
2024-02-29  0:17 ` Mauro Aranda
2024-02-29 10:37   ` martyhiatt
2024-02-29 15:24     ` Mauro Aranda

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=5f95b89c-f8ee-4615-a856-aeb8deef0f8b@riseup.net \
    --to=martyhiatt@riseup.net \
    --cc=69457@debbugs.gnu.org \
    /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).