[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding String to Beginning of Lines
From: |
Michael Heerdegen |
Subject: |
Re: Adding String to Beginning of Lines |
Date: |
Tue, 10 Nov 2020 19:03:49 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Christopher Dimech <dimech@gmx.com> writes:
> Have tried to add a keybinding for the function, but after pressing
> the keyseq, I am getting "H-z is undefined".
>
> (define-key emacs-lisp-mode-hook (kbd "H-z") 'rec-field-nwltok)
Yeah, because it's, ehm, nonsense.
You want to bind your key in a keymap, and do that in the hook, e.g.
(add-hook 'emacs-lisp-mode-hook
(defun my-emacs-lisp-mode-hook-fun ()
(define-key emacs-lisp-mode-map (kbd "H-z") #'rec-field-nwltok)))
Hooks contain functions. I use to use named functions because lambdas
cannot be identified should you reload your piece of code and thus get
added multiple times. If you don't care (i.e. if you know for sure you
don't reload your init file) a lambda also works.
Regards,
Michael.
- Re: Adding String to Beginning of Lines, (continued)
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines,
Michael Heerdegen <=
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Jean Louis, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Jean Louis, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10