From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Button widget keymap conflicting with major mode. Date: Tue, 23 Feb 2010 21:29:11 -0700 Message-ID: References: <87ocjj44g7.fsf@telefonica.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1266986224 14006 80.91.229.12 (24 Feb 2010 04:37:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 24 Feb 2010 04:37:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 24 05:37:00 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nk8zc-000457-3y for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Feb 2010 05:37:00 +0100 Original-Received: from localhost ([127.0.0.1]:37765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nk8sc-0002C8-06 for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Feb 2010 23:29:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nk8sG-0002C2-MO for help-gnu-emacs@gnu.org; Tue, 23 Feb 2010 23:29:24 -0500 Original-Received: from [140.186.70.92] (port=51948 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nk8sF-0002Bu-0a for help-gnu-emacs@gnu.org; Tue, 23 Feb 2010 23:29:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nk8sE-0000sU-BZ for help-gnu-emacs@gnu.org; Tue, 23 Feb 2010 23:29:23 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:56203) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nk8sE-0000sI-4E for help-gnu-emacs@gnu.org; Tue, 23 Feb 2010 23:29:22 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Nk8sC-0001p8-He for help-gnu-emacs@gnu.org; Wed, 24 Feb 2010 05:29:20 +0100 Original-Received: from c-71-237-24-138.hsd1.co.comcast.net ([71.237.24.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Feb 2010 05:29:20 +0100 Original-Received: from kevin.d.rodgers by c-71-237-24-138.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Feb 2010 05:29:20 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 35 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-71-237-24-138.hsd1.co.comcast.net User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72087 Archived-At: 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