all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: batkins57@gmail.com
Subject: Re: Keybindings and minor modes
Date: 29 Dec 2005 14:02:13 -0800	[thread overview]
Message-ID: <1135893732.998583.229270@g49g2000cwa.googlegroups.com> (raw)
In-Reply-To: <mailman.20813.1135884349.20277.help-gnu-emacs@gnu.org>

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

  parent reply	other threads:[~2005-12-29 22:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-29  2:18 Keybindings and minor modes batkins57
2005-12-29 19:23 ` Kevin Rodgers
     [not found] ` <mailman.20813.1135884349.20277.help-gnu-emacs@gnu.org>
2005-12-29 22:02   ` batkins57 [this message]
2006-01-01 16:26     ` albrns
2006-01-01 16:27 ` albrns
  -- strict thread matches above, loose matches on Subject: below --
2005-12-29 15:52 Bill Atkins
2005-12-29 18:41 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1135893732.998583.229270@g49g2000cwa.googlegroups.com \
    --to=batkins57@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.