help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Avoiding Ctrl


From: Oliver Scholz
Subject: Re: Avoiding Ctrl
Date: Wed, 28 Mar 2012 19:21:06 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

[...]
> Actually, emulation-mode-map-alists is a list of alists (hence the `s' at
> the end of its name), so you'll need extra parens.

Silly me. That seems to work well. Though, rebinding TAB that way makes
me notice how often I instinctively rely on it for completion. I think I
have to explore all the different options for a while. All this gets me
started, thank you.

Right now I'm looking in earnest into emacs-specific modal editing. I
hacked a quick first experiment together, using `emulation-mode-map'. I
see now what the problem with ESC was that I seemed to remember: M-<key>
is translated to ESC <key> on a console. :-( Viper-mode has a
workaround, but the code looks as if it has caused a lot of grey hair
for somebody. Also, I can't seem to change either cursor-type or face on
the console, which would be important for visual feedback. In other
words: ironically, all this is far easier to implement for X. Anyways,
I'll look into it.

One thing, though: I don't quite get how keymaps and local variables
work in the minibuffer:

(defvar test-map
  (let ((map (make-sparse-keymap)))
    (define-key map [?#] (lambda ()
                           (interactive)
                           (message "Whohoo!")))
    map))

(defvar test-mode nil)

(defvar test-map-alist
  `((test-mode . ,test-map)))

(defun test-change-mode-in-minibuffer ()
  (when (minibufferp)
    (set (make-local-variable 'test-mode) t)))

(add-to-list 'emulation-mode-map-alists test-map-alist)

(add-hook 'after-change-major-mode-hook #'test-change-mode-in-minibuffer)


I would expect this to echo "Whohoo!", each time I press `#' in the
minibuffer. But it doesn't. I'd not be surprised, if the minibuffer
would treat buffer local variables in a special way, but how exactly
and how could I make this example work?


    Oliver
-- 
26 Thermidor an 219 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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