The following code:
- defines a major mode
my-mode
whereC-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 widget-keymap))
(define-key map (kbd "C-d") (lambda () (interactive) (message "Ctrl D")))
map))
(define-derived-mode my-mode nil "My")
;; Open my-mode buffer and insert editable field
(let ((buf (get-buffer-create "*buf*")))
(with-current-buffer buf
(my-mode)
(widget-create 'editable-field
:format "Field 1: %v ")
(widget-setup))
(switch-to-buffer buf))
My problem is that, C-d
binding works only outside the editable field.
How can I make it work inside the field too?