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

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

Re: Set keymap for buffer, not major mode for that buffer


From: Stefan Monnier
Subject: Re: Set keymap for buffer, not major mode for that buffer
Date: Mon, 10 Apr 2006 01:13:39 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Elisp manual says "If you change the current buffer's
> local map, that usually affects all buffers using the
> same major mode." [(info "(elisp)Changing Key Bindings")]

> Is it possible to set keymap for a buffer, but only
> affects the specific buffer using the same major mode?

Yes.  Before doing a `local-set-key', do the following:

   (let ((origmap (current-local-map))
         (newmap (make-sparse-keymap)))
     (set-keymap-parent newmap origmap)
     (use-local-map newmap))


-- Stefan


reply via email to

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