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

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

Re: Buffer specific binding


From: Ian Zimmerman
Subject: Re: Buffer specific binding
Date: Wed, 26 Aug 2015 11:34:38 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

On 2015-08-26 09:44 +0200, Tassilo Horn wrote:

>   (let ((map (make-sparse-keymap)))
>     (set-keymap-parent map (current-local-map))
>     (define-key map (kbd "C-c c")
>                 (lambda ()
>                   (interactive)
>                   (message "Hey there!")))
>     (use-local-map map))
> 
> I guess you can easily wrap that into some function
> `iz/define-buffer-local-keys' and then call that conveniently from a
> file local variable section:
> 
> ;; Local Variables:
> ;; eval: (iz/define-buffer-local-keys
> ;;         (kbd "C-c c") #'iz/do-this
> ;;         (kbd "C-c C") #'iz/do-that)
> ;; End:

Yes, this works great.  Thanks!

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




reply via email to

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