emacs-devel
[Top][All Lists]
Advanced

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

What's up with widgets?


From: Derek Davies
Subject: What's up with widgets?
Date: Fri, 28 Jan 2022 10:37:39 -0500
User-agent: mu4e 1.2.0; emacs 26.3

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 via email to

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