Questions tagged [widget]

22 questions
9
votes
1 answer

Are there any libraries for input fields in Emacs?

Quite a few Emacs modes use (something like) forms: the customization interface is one of them, the Message mode (read: its header part) is another one; there are more of them, unfortunately not always very similar. By a "form" I mean here a buffer…
mbork
  • 1,647
  • 1
  • 13
  • 23
6
votes
1 answer

elisp widgets: Modifying an editable-field's value real time when changing another one

This is cross-post from Stack Overflow I have a simple widget setup: (setq gobgen-widget-name (widget-create 'editable-field :size 25 :format "Name: %v" :notify (lambda (widget…
GergelyPolonkai
  • 748
  • 5
  • 12
3
votes
2 answers

A custom type specification like “repeat,” but when there’s only one item, it’s inline

So, I’m trying to add Customize support to packages that use a lot of plists, and where the value of pretty much any option can be either a single item or a list. I could have every single plist option’s value-type wrapped in a choice between…
Tina Russell
  • 380
  • 2
  • 10
3
votes
1 answer

How does one define a widget of type editable-list with validation?

I create my widget with the following code: (widget-create 'editable-list :entry-format "%i %d %v" :value '("") '(editable-field :valid-regexp…
Łukasz Gruner
  • 1,008
  • 8
  • 16
2
votes
1 answer

Get widget at point

For example, I inserted many link widgets like this: (widget-create `(link :tag "Test link" :button-prefix "" :button-suffix "" :button-face nil :format…
Tu Do
  • 6,772
  • 20
  • 39
2
votes
0 answers

How to translate between custom choice type and widget items?

I have a custom variable (defcustom myvar .... :type '(choice (const :tag "foo" 1) ...)) and I need to map it to (widget-create ... '(item :tag "foo" :value 1) ...) Obviously I can write something like (mapcar…
sds
  • 5,928
  • 20
  • 39
2
votes
1 answer

Emacs Widget Library

Using this widget: (widget-create 'editable-field :size 4 :format "text1 %v text2") (widget-setup) I get the following output (where the underscores appear as a fillable grey area) text1 ____ text2 In general, when hitting Enter inside an editable…
antonio
  • 1,762
  • 12
  • 24
2
votes
1 answer

Define widget key bindings

The following code: defines a major mode my-mode where C-d binding is redefined; opens a my-mode buffer inserting an editable-field widget. (require 'widget) (require 'wid-edit) ;; Define my-mode mode (defvar my-mode-map (let ((map…
antonio
  • 1,762
  • 12
  • 24
2
votes
2 answers

Choosing files and directories from widgets

I'm looking for the most convenient way to set up a Customize options page to enter a set of directories and then select one of those directories and one file in the selected directory (if possible, without spelling out the implied extension). I'd…
1
vote
1 answer

When compiling Emacs on RHEL8 should I better bind to GTK3 or GTK2?

I am compiling Emacs 27.1 on a RHEL8 Linux box. This RHEL system is a remote system I log in from my Windows machine using MobaXterm (Personal Edition V12.1) on the Windows machine as X server. On this new-ish RHEL system GTk2 and GTK3 is…
halloleo
  • 1,215
  • 9
  • 23
1
vote
0 answers

Customize-like form

I'd like to create a form, like the one displayed by customize, in order to ask to the user some information. The form should let me provide a description, a default value, and eventually display a choice list when needed. The idea is that I don't…
tobiasBora
  • 405
  • 2
  • 12
1
vote
0 answers

'editable-field' widget is not playing nice with `widget-value-set'

When I evaluate the following form, (defun magithub-issue-form () (interactive) (with-current-buffer (generate-new-buffer "*magithub issue*") (switch-to-buffer-other-window (current-buffer)) (widget-value-set (widget-create…
Sean Allred
  • 6,861
  • 16
  • 85
1
vote
1 answer

How can I stop newlines from being entered in an editable-field widget?

I have the following widget: (widget-create 'editable-field :size 76 :format "Title: %v") However, when I create this widget and edit its value, I can use C-j to insert new lines. How can I restrict the widget to one line? Runnable code: (defun…
Sean Allred
  • 6,861
  • 16
  • 85
1
vote
0 answers

Emacs link widget gives the error "gui-get-primary-selection: No selection is available"

I am reading the The Emacs Widget Library. The library describes the widget properties in general and not per widget. So I'd like some more insights about the link widget properties and use. :notify property is a "function called each called each…
antonio
  • 1,762
  • 12
  • 24
0
votes
0 answers

Emacs widgets: editing problems with integer widget

If I try to set up a buffer with just one integer widget, I have a very hard time editing the field. The initial value seems stuck there and, if I try to edit it away I get a End of file during parsing error (obviously generated in the guts of the…
1
2