From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: batkins57@gmail.com Newsgroups: gmane.emacs.help Subject: Re: Keybindings and minor modes Date: 29 Dec 2005 14:02:13 -0800 Organization: http://groups.google.com Message-ID: <1135893732.998583.229270@g49g2000cwa.googlegroups.com> References: <1135822695.537535.182680@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1135893904 3832 80.91.229.2 (29 Dec 2005 22:05:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 29 Dec 2005 22:05:04 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 29 23:05:02 2005 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Es5tH-0005km-NH for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Dec 2005 23:04:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Es5ue-00084N-OK for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Dec 2005 17:06:20 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!g49g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-NNTP-Posting-Host: 68.44.72.70 Original-X-Trace: posting.google.com 1135893742 16245 127.0.0.1 (29 Dec 2005 22:02:22 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 29 Dec 2005 22:02:22 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051005 Firefox/1.0.7,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g49g2000cwa.googlegroups.com; posting-host=68.44.72.70; posting-account=RQyFAQ0AAAAIiTCD-QkZwj2n8DsgdVTY Original-Xref: shelby.stanford.edu gnu.emacs.help:136678 Original-To: help-gnu-emacs@gnu.org 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:32297 Archived-At: Kevin Rodgers wrote: > batkins57@gmail.com wrote: > I'll admit, I don't understand the point of calling > (self-insert-command 0). self-insert-command requires an argument, so as a special case, I have to call it with a 0; I can't simply do (funcall 'self-insert-commnand). > > Perhaps a better approach altogether would be to add a pre-command-hook > that would check the key that was used to invoke it: > > (defun ehinter-pre-command-hook () > "Run `ehinter-hint' in Ehinter Minor Mode, when invoked via SPC, TAB, > or RET." > (when (and ehinter-mode > (let ((key (this-single-command-keys))) > (and (= (length key 1)) > (member (aref key 0) '(? ?\t ?\r))))) ; SPC, TAB, > or RET > (ehinter-hint))) > > (add-hook 'pre-command-hook 'ehinter-pre-command-hook) > > Then the ehinter-mode function just needs to set or unset the > buffer-local ehinter-mode variable. > > You could tweak that to have the ehinter-mode function add or remove > ehinter-pre-command-hook from the buffer-local pre-command-hook, to > avoid affecting other buffers. > > -- > Kevin Rodgers I got a neat solution from the folks on emacs-devel. Stefan Monnier suggested the following: (call-interactively (let ((ehinter-mode nil)) (key-binding (this-command-keys)))) Bill