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: making change of tool-bar entry persistent Date: Tue, 25 May 2010 00:23:57 -0600 Message-ID: References: <7A9A5E4F-DE42-449C-B94B-1966BBD90E46@nf.mpg.de> 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 1274768701 7378 80.91.229.12 (25 May 2010 06:25:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 25 May 2010 06:25:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 25 08:24:59 2010 connect(): No such file or directory 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 1OGnZR-0004v4-U6 for geh-help-gnu-emacs@m.gmane.org; Tue, 25 May 2010 08:24:58 +0200 Original-Received: from localhost ([127.0.0.1]:42402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGnZR-00027G-6Q for geh-help-gnu-emacs@m.gmane.org; Tue, 25 May 2010 02:24:57 -0400 Original-Received: from [140.186.70.92] (port=48888 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGnYl-000273-9U for help-gnu-emacs@gnu.org; Tue, 25 May 2010 02:24:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGnYk-0000RA-3s for help-gnu-emacs@gnu.org; Tue, 25 May 2010 02:24:15 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:57831) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGnYj-0000Qt-Up for help-gnu-emacs@gnu.org; Tue, 25 May 2010 02:24:14 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OGnYg-0004dj-9z for help-gnu-emacs@gnu.org; Tue, 25 May 2010 08:24:10 +0200 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 ; Tue, 25 May 2010 08:24:10 +0200 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 ; Tue, 25 May 2010 08:24:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 33 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.24 (Macintosh/20100228) In-Reply-To: <7A9A5E4F-DE42-449C-B94B-1966BBD90E46@nf.mpg.de> 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:73763 Archived-At: Stefan Vollmar wrote: > Hallo, > > I want to re-define what happends when an exising toolbar icon is > pressed. In the Emacs documentation I found an example similar to > this: > > (define-key > global-map > [tool-bar new-file] > '(menu-item "New Buffer" my-new-buffer > :image (image :type xpm :file "new.xpm"))) > > Executing this code in Emacs 23.2 this will indeed show the desired > effect - but only for about 2 seconds: the tool-bar is then > automatically redrawn and behaves as before. How can I modify an > existing toolbar so that the change is persistent? -- Variable: tool-bar-map By default, the global map binds `[tool-bar]' as follows: (global-set-key [tool-bar] '(menu-item "tool bar" ignore :filter (lambda (ignore) tool-bar-map))) Thus the tool bar map is derived dynamically from the value of variable `tool-bar-map' and you should normally adjust the default (global) tool bar by changing that map. Major modes may replace the global bar completely by making `tool-bar-map' buffer-local and set to a keymap containing only the desired items. Info mode provides an example. -- Kevin Rodgers Denver, Colorado, USA