unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* enter key behaviour
@ 2009-06-12 20:38 prad
  2009-06-14  6:10 ` Bernardo
  0 siblings, 1 reply; 6+ messages in thread
From: prad @ 2009-06-12 20:38 UTC (permalink / raw)
  To: help-gnu-emacs mailing list

in sh and php modes, pushing the enterkey takes you to the beginning of
the line, while C-j puts you at the beginning of the indent.

however, in python-mode (at least the one i have on archlinux),
enterkey and C-j both take you to beginning of the indent.

is this something i can change using emacs customizations (if so,
where?), or should i try to edit the python-mode script?

-- 
In friendship,
prad

                                      ... with you on your journey
Towards Freedom
http://www.towardsfreedom.com (website)
Information, Inspiration, Imagination - truly a site for soaring I's




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enter key behaviour
  2009-06-12 20:38 enter key behaviour prad
@ 2009-06-14  6:10 ` Bernardo
  2009-06-14  6:16   ` Bernardo
  0 siblings, 1 reply; 6+ messages in thread
From: Bernardo @ 2009-06-14  6:10 UTC (permalink / raw)
  To: help-gnu-emacs mailing list

prad said the following on 13/06/09 06:38:
> in sh and php modes, pushing the enterkey takes you to the beginning of
> the line, while C-j puts you at the beginning of the indent.
> 
> however, in python-mode (at least the one i have on archlinux),
> enterkey and C-j both take you to beginning of the indent.
> 
> is this something i can change using emacs customizations (if so,
> where?), or should i try to edit the python-mode script?
> 

C-h <yourKey>  will tell you what the key is bound to
there are a few ways to rebind it to something else:
* define-key
* local-set-key
* global-set-key

for more info see
  M-: (info "(Emacs)Key Bindings")




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enter key behaviour
  2009-06-14  6:10 ` Bernardo
@ 2009-06-14  6:16   ` Bernardo
  2009-06-14  7:43     ` prad
  0 siblings, 1 reply; 6+ messages in thread
From: Bernardo @ 2009-06-14  6:16 UTC (permalink / raw)
  Cc: help-gnu-emacs mailing list



Bernardo said the following on 14/06/09 16:10:
> 
> C-h <yourKey>  will tell you what the key is bound to
make this C-h k <yourKey>
e.g. C-h k RET




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enter key behaviour
  2009-06-14  6:16   ` Bernardo
@ 2009-06-14  7:43     ` prad
  2009-06-15  7:36       ` Bernardo
  0 siblings, 1 reply; 6+ messages in thread
From: prad @ 2009-06-14  7:43 UTC (permalink / raw)
  To: help-gnu-emacs

On Sun, 14 Jun 2009 16:16:41 +1000
Bernardo <bernardo.bacic@pobox.com> wrote:

> e.g. C-h k RET
>
thank you bernado!
i used the above and found that in python-mode the key is bound to
newline-and-indent, but the rest of the time it is not because
simple.el is used instead of python-mode.el

so i just commented out this line
(define-key py-mode-map "\C-m" 'py-newline-and-indent)
in the python-mode.el file to get the desired behavior.

-- 
In friendship,
prad

                                      ... with you on your journey
Towards Freedom
http://www.towardsfreedom.com (website)
Information, Inspiration, Imagination - truly a site for soaring I's






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enter key behaviour
  2009-06-14  7:43     ` prad
@ 2009-06-15  7:36       ` Bernardo
  2009-06-15 19:05         ` prad
  0 siblings, 1 reply; 6+ messages in thread
From: Bernardo @ 2009-06-15  7:36 UTC (permalink / raw)
  To: help-gnu-emacs



prad said the following on 14/06/09 17:43:
> On Sun, 14 Jun 2009 16:16:41 +1000
>> 
> so i just commented out this line
> (define-key py-mode-map "\C-m" 'py-newline-and-indent)
> in the python-mode.el file to get the desired behavior.
> 
there's nothing from stopping you do it that way, but if you share your 
PC with other users, or if you don't want your changes to be clobbered 
when you upgrade GNU Emacs/python-mode it may be better to put 
customisations into your init (.emacs) file

probably something along the lines (not tested):

(add-hook 'python-mode-hook
   (lambda ()
     (define-key py-mode-map "\C-m" 'newline))) ; or the function you want

also, as an alternative to "\C-m" have a look at the kbd macro
(kbd "C-m")

C-h f kbd RET




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enter key behaviour
  2009-06-15  7:36       ` Bernardo
@ 2009-06-15 19:05         ` prad
  0 siblings, 0 replies; 6+ messages in thread
From: prad @ 2009-06-15 19:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Mon, 15 Jun 2009 17:36:48 +1000
Bernardo <bernardo.bacic@pobox.com> wrote:

> it may be better to put 
> customisations into your init (.emacs) file
>
ah this is excellent bernardo!
it's what i originally wanted to do but wasn't sure how to.
your code worked perfectly:
(add-hook 'python-mode-hook
   (lambda ()
     (define-key py-mode-map "\C-m" 'newline))) 

i was trying the define-key ... portion in my .emacs file and of course
it kept being overwritten by python-mode.

so i need to learn elisp properly and have found a good source for it.
thank you.

-- 
In friendship,
prad

                                      ... with you on your journey
Towards Freedom
http://www.towardsfreedom.com (website)
Information, Inspiration, Imagination - truly a site for soaring I's






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-15 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-12 20:38 enter key behaviour prad
2009-06-14  6:10 ` Bernardo
2009-06-14  6:16   ` Bernardo
2009-06-14  7:43     ` prad
2009-06-15  7:36       ` Bernardo
2009-06-15 19:05         ` prad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).