[Top][All Lists]

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

Re: Button widget keymap conflicting with major mode.

From: Kevin Rodgers
Subject: Re: Button widget keymap conflicting with major mode.
Date: Tue, 23 Feb 2010 21:29:11 -0700
User-agent: Thunderbird (Macintosh/20090812)

Drew Adams wrote:
A read-only buffer has a major mode which defines bindings for RET and
other keys which are also used by button widgets created by

(widget-create 'push-button ...

The bindings for the major mode override the button bindings (it is not possible to user RET when the point is on the
button for invoking it). I can make the button work with
(use-local-map widget-keymap), but then the bindings for
the major mode are gone.

Is there a way for RET invoking the button when the point is over it and invoke the major mode binding otherwise?

Using Emacs 23.1.

`keymap' text property would be one way.

See node `Special Properties' of the Elisp manual.

WIBNI widget-create took a :keymap keyword so you could specify
widget-keymap as its value?

Otherwise, I guess you have to do something like:

(let* ((push-button (widget-create 'push-button ...))
       (button-overlay (widget-get push-button :button-overlay)))
  (overlay-put button-overlay 'keymap widget-keymap))

Or maybe local-map would be the appropriate property for this purpose.

Kevin Rodgers
Denver, Colorado, USA

reply via email to

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