From: Teemu Likonen <tlikonen@iki.fi>
To: help-gnu-emacs@gnu.org
Subject: Re: key map entry for shift-return?
Date: Wed, 08 Jul 2009 15:17:24 +0300 [thread overview]
Message-ID: <8763e34be3.fsf@iki.fi> (raw)
In-Reply-To: mailman.2060.1247053882.2239.help-gnu-emacs@gnu.org
On 2009-07-08 12:51 (+0100), Chris Withers wrote:
> Peter Dyballa wrote:
>> So you can use:
>>
>> (global-set-key [S-return] 'some-function)
>
> Well, I now have the following in my .emacs:
>
> (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map
> "\C-m" 'newline-and-indent)))
>
> (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map
> "S-return" 'newline)))
That's not good practice. You should write your python-mode settings to
a single hook function and add function's "name" to the
python-mode-hook. For example, put these lines in your .emacs file:
(add-hook 'python-mode-hook 'my-python-mode-hook)
(defun my-python-mode-hook ()
(define-key python-mode-map "\C-m" 'newline-and-indent)
(define-key python-mode-map [S-return] 'newline))
Now if you need to change the settings you can just edit the function
and evaluate it with C-M-x.
(Note that python-mode-hook is a variable which may contain your
previous hook experiments "(lambda ...)" if you haven't restarted your
Emacs session. You should set the variable to nil before evaluating the
above code or you can just restart Emacs.)
> The first one works, the second one doesn't. What did I do wrong?
Note that I used [S-return], not "S-return". See Peter's message once
again.
next prev parent reply other threads:[~2009-07-08 12:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-08 9:31 key map entry for shift-return? Chris Withers
2009-07-08 9:51 ` Peter Dyballa
2009-07-08 9:53 ` Chris Withers
2009-07-08 11:08 ` Peter Dyballa
2009-07-08 11:51 ` Chris Withers
2009-07-08 12:42 ` Peter Dyballa
2009-07-08 13:39 ` Chris Withers
2009-07-08 14:49 ` Peter Dyballa
[not found] ` <mailman.2060.1247053882.2239.help-gnu-emacs@gnu.org>
2009-07-08 12:17 ` Teemu Likonen [this message]
[not found] ` <mailman.2052.1247046795.2239.help-gnu-emacs@gnu.org>
2009-07-09 7:28 ` Alan Mackenzie
[not found] <mailman.2050.1247045493.2239.help-gnu-emacs@gnu.org>
2009-07-09 12:34 ` Xah Lee
2009-07-09 13:51 ` Alan Mackenzie
2009-07-09 14:27 ` Miles Bader
2009-07-09 16:01 ` Xah Lee
2009-07-09 17:21 ` despen
2009-07-09 17:56 ` Xah Lee
2009-07-09 20:48 ` despen
2009-07-09 18:02 ` Alan Mackenzie
2009-07-09 21:19 ` Peter Dyballa
[not found] ` <mailman.2177.1247174372.2239.help-gnu-emacs@gnu.org>
2009-07-09 22:14 ` Alan Mackenzie
2009-07-10 1:24 ` Miles Bader
2009-07-10 8:01 ` Alan Mackenzie
2009-07-10 10:14 ` Miles Bader
2009-07-10 12:45 ` Alan Mackenzie
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=8763e34be3.fsf@iki.fi \
--to=tlikonen@iki.fi \
--cc=help-gnu-emacs@gnu.org \
/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.