all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Derek Davies <ddavies@ddavies.net>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: What's up with widgets?
Date: Fri, 28 Jan 2022 10:37:39 -0500	[thread overview]
Message-ID: <87o83veurg.fsf@ddavies.net> (raw)


Hello!

I keep running into issues using widgets (wid-edit.el, etc) in my projects.

I give one example, involving the toggle widget, but it seems like I
run into unexpected behavior very often, depending on the widget I'm
trying to use.  It feels to me like there is inconsistency around the
use of at lease some keywords that are shared between widget types.

The other thing is that the info page seems categorical and detailed,
but with many details missing.  It would be fine if there were more examples and/or blog posts
available at large, but I can't find much when searching the web.

The example below does not toggle for me and I get a message about "read only" when I press ret on the toggle value.  If I remove the :format keyword the value appears and is togglable.  How do I display a field label like I do with editable-field or most of the other widgets I've used?

Is it just me or do others experience this too?  Wondering how much
inconsistency/missing doc there might be, or if it's ignorance on my part.

Thanks very much!
Derek


If it's not just me, I would like to work on the doc or widget code so that it's easier to use the widget library in user projects.  Otherwise, would just apprechiate knowing what I'm missing :)

;; -*-  lexical-binding: t; -*-


(require 'subr-x)
(require 'widget)
(eval-when-compile
  (require 'wid-edit))

(define-widget 'tog-wid 'group
  ""
  :format " %v"
  :entry-format " %v"
  :args '((editable-field
           :tag "Limit"
	   :format " %t %v\n")
          (toggle
           :tag "Threads"
           :format " %t %v")))

(defvar tog-buffer "*TOG*")

(defun tog-form ()
  (interactive)
  (switch-to-buffer tog-buffer)
  (kill-all-local-variables)
  (let ((inhibit-read-only t))
    (erase-buffer)
    (remove-overlays))
  (widget-create 'tog-wid)
  (use-local-map widget-keymap)
  (widget-setup))

;; End



             reply	other threads:[~2022-01-28 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 15:37 Derek Davies [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-01-28 18:15 What's up with widgets? 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o83veurg.fsf@ddavies.net \
    --to=ddavies@ddavies.net \
    --cc=emacs-devel@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 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.