* Python Mode, managing and converting TABS
@ 2014-05-28 19:13 Tim Johnson
2014-05-28 23:37 ` Stefan Monnier
0 siblings, 1 reply; 11+ messages in thread
From: Tim Johnson @ 2014-05-28 19:13 UTC (permalink / raw)
To: Emacs
I'm currently using
GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10 on
Ubuntu 12.04, but expect to have to also use --no-window-system
("console mode") on occassion.
I have used emacs extensively in the distant past (up 'til 2008), so
am re-acquainting myself with the system.
I have much legacy python code that has "hard tabs" and to meet
the python style guides, will have to be converted to "soft tabs".
I.E. TAB => " "
I also need to configure emacs so that TAB (or Ctrl-i) inserts four
spaces instead of the TAB character.
I currently have this in my .emacs [code]
(add-hook 'python-mode-hook
'(lambda ()
(turn-on-font-lock)
(setq default-tab-width 4)
(setq tab-width 4)
(imenu-add-menubar-index)
(setq imenu-sort-function 'imenu--sort-by-name)))
[/code]
I'd welcome any and all advice, pointers to previous discussion
would are solicited.
thanks
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
[not found] <mailman.2339.1401307161.1147.help-gnu-emacs@gnu.org>
@ 2014-05-28 21:17 ` Dan.Espen
2014-05-28 21:44 ` Tim Johnson
2014-06-02 19:33 ` Damien Wyart
1 sibling, 1 reply; 11+ messages in thread
From: Dan.Espen @ 2014-05-28 21:17 UTC (permalink / raw)
To: help-gnu-emacs
Tim Johnson <tim@akwebsoft.com> writes:
> I'm currently using
> GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10 on
> Ubuntu 12.04, but expect to have to also use --no-window-system
> ("console mode") on occassion.
>
> I have used emacs extensively in the distant past (up 'til 2008), so
> am re-acquainting myself with the system.
>
> I have much legacy python code that has "hard tabs" and to meet
> the python style guides, will have to be converted to "soft tabs".
> I.E. TAB => " "
>
> I also need to configure emacs so that TAB (or Ctrl-i) inserts four
> spaces instead of the TAB character.
>
> I currently have this in my .emacs [code]
> (add-hook 'python-mode-hook
> '(lambda ()
> (turn-on-font-lock)
> (setq default-tab-width 4)
> (setq tab-width 4)
> (imenu-add-menubar-index)
> (setq imenu-sort-function 'imenu--sort-by-name)))
>
> [/code]
>
> I'd welcome any and all advice, pointers to previous discussion
> would are solicited.
To remove tabs, make the whole buffer the region:
C-x h
then run untabify:
M-x untabify
--
Dan Espen
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
2014-05-28 21:17 ` Dan.Espen
@ 2014-05-28 21:44 ` Tim Johnson
0 siblings, 0 replies; 11+ messages in thread
From: Tim Johnson @ 2014-05-28 21:44 UTC (permalink / raw)
To: help-gnu-emacs
* Dan.Espen <despen@verizon.net> [140528 13:28]:
> Tim Johnson <tim@akwebsoft.com> writes:
>
> > I'm currently using
> > GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10 on
> > Ubuntu 12.04, but expect to have to also use --no-window-system
> > ("console mode") on occassion.
> >
> > I have used emacs extensively in the distant past (up 'til 2008), so
> > am re-acquainting myself with the system.
> >
> > I have much legacy python code that has "hard tabs" and to meet
> > the python style guides, will have to be converted to "soft tabs".
> > I.E. TAB => " "
> >
> > I also need to configure emacs so that TAB (or Ctrl-i) inserts four
> > spaces instead of the TAB character.
> >
> > I currently have this in my .emacs [code]
> > (add-hook 'python-mode-hook
> > '(lambda ()
> > (turn-on-font-lock)
> > (setq default-tab-width 4)
> > (setq tab-width 4)
> > (imenu-add-menubar-index)
> > (setq imenu-sort-function 'imenu--sort-by-name)))
> >
> > [/code]
> >
> > I'd welcome any and all advice, pointers to previous discussion
> > would are solicited.
>
> To remove tabs, make the whole buffer the region:
>
> C-x h
>
> then run untabify:
>
> M-x untabify
Thank you. That was very simple. I note from 'help that
'default-tab-width is obsolete.
cheers
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
2014-05-28 19:13 Python Mode, managing and converting TABS Tim Johnson
@ 2014-05-28 23:37 ` Stefan Monnier
2014-05-29 15:57 ` Tim Johnson
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2014-05-28 23:37 UTC (permalink / raw)
To: help-gnu-emacs
> (add-hook 'python-mode-hook
> '(lambda ()
Please don't quote your lambdas.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
2014-05-28 23:37 ` Stefan Monnier
@ 2014-05-29 15:57 ` Tim Johnson
2014-05-29 16:49 ` Stefan Monnier
0 siblings, 1 reply; 11+ messages in thread
From: Tim Johnson @ 2014-05-29 15:57 UTC (permalink / raw)
To: help-gnu-emacs
* Stefan Monnier <monnier@iro.umontreal.ca> [140528 15:42]:
> > (add-hook 'python-mode-hook
> > '(lambda ()
>
> Please don't quote your lambdas.
It is a misbehavior noted frequently in examples,
which I followed.
After reading your advice, I found
http://www.emacswiki.org/emacs/QuotedLambda
thanks
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
2014-05-29 15:57 ` Tim Johnson
@ 2014-05-29 16:49 ` Stefan Monnier
2014-05-29 17:51 ` Tim Johnson
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2014-05-29 16:49 UTC (permalink / raw)
To: help-gnu-emacs
>> Please don't quote your lambdas.
> It is a misbehavior noted frequently in examples,
> which I followed.
I know, which is why I try to bring it up whenever I see it, in the hope
that 10 years from now, there will be fewer such bad examples.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
2014-05-29 16:49 ` Stefan Monnier
@ 2014-05-29 17:51 ` Tim Johnson
0 siblings, 0 replies; 11+ messages in thread
From: Tim Johnson @ 2014-05-29 17:51 UTC (permalink / raw)
To: help-gnu-emacs
* Stefan Monnier <monnier@iro.umontreal.ca> [140529 09:01]:
> >> Please don't quote your lambdas.
> > It is a misbehavior noted frequently in examples,
> > which I followed.
>
> I know, which is why I try to bring it up whenever I see it, in the hope
> that 10 years from now, there will be fewer such bad examples.
I have been inspired to google "emacs best practices"
http://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html
and "elisp lint"
https://github.com/nschum/elisp-lint
regards
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
[not found] <mailman.2339.1401307161.1147.help-gnu-emacs@gnu.org>
2014-05-28 21:17 ` Dan.Espen
@ 2014-06-02 19:33 ` Damien Wyart
2014-06-03 15:20 ` Tim Johnson
[not found] ` <mailman.2841.1401808858.1147.help-gnu-emacs@gnu.org>
1 sibling, 2 replies; 11+ messages in thread
From: Damien Wyart @ 2014-06-02 19:33 UTC (permalink / raw)
To: help-gnu-emacs
* Tim Johnson <tim@akwebsoft.com> in gnu.emacs.help:
> I currently have this in my .emacs [code]
> (add-hook 'python-mode-hook
> '(lambda ()
> (turn-on-font-lock)
> (setq default-tab-width 4)
> (setq tab-width 4)
> (imenu-add-menubar-index)
> (setq imenu-sort-function 'imenu--sort-by-name)))
>
You might also want: (setq indent-tabs-mode nil)
--
DW
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
2014-06-02 19:33 ` Damien Wyart
@ 2014-06-03 15:20 ` Tim Johnson
[not found] ` <mailman.2841.1401808858.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 11+ messages in thread
From: Tim Johnson @ 2014-06-03 15:20 UTC (permalink / raw)
To: help-gnu-emacs
* Damien Wyart <damien.wyart@free.fr> [140602 11:43]:
> * Tim Johnson <tim@akwebsoft.com> in gnu.emacs.help:
> > I currently have this in my .emacs [code]
> > (add-hook 'python-mode-hook
> > '(lambda ()
> > (turn-on-font-lock)
> > (setq default-tab-width 4)
> > (setq tab-width 4)
> > (imenu-add-menubar-index)
> > (setq imenu-sort-function 'imenu--sort-by-name)))
> >
>
> You might also want: (setq indent-tabs-mode nil)
:) Done. Thanks.
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
[not found] ` <mailman.2841.1401808858.1147.help-gnu-emacs@gnu.org>
@ 2014-06-03 17:53 ` Damien Wyart
2014-06-04 23:49 ` Tim Johnson
0 siblings, 1 reply; 11+ messages in thread
From: Damien Wyart @ 2014-06-03 17:53 UTC (permalink / raw)
To: help-gnu-emacs
You might also want to try this mode: https://launchpad.net/python-mode/
instead of the one included in Emacs. For some aspects, it is more
powerful/confortable (YMMV)...
--
DW
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Python Mode, managing and converting TABS
2014-06-03 17:53 ` Damien Wyart
@ 2014-06-04 23:49 ` Tim Johnson
0 siblings, 0 replies; 11+ messages in thread
From: Tim Johnson @ 2014-06-04 23:49 UTC (permalink / raw)
To: help-gnu-emacs
* Damien Wyart <damien.wyart@free.fr> [140603 09:57]:
> You might also want to try this mode: https://launchpad.net/python-mode/
> instead of the one included in Emacs. For some aspects, it is more
> powerful/confortable (YMMV)...
I believe I may have used that years ago, it was a good choice
even then. Thanks for reminding me.
cheers
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-06-04 23:49 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-28 19:13 Python Mode, managing and converting TABS Tim Johnson
2014-05-28 23:37 ` Stefan Monnier
2014-05-29 15:57 ` Tim Johnson
2014-05-29 16:49 ` Stefan Monnier
2014-05-29 17:51 ` Tim Johnson
[not found] <mailman.2339.1401307161.1147.help-gnu-emacs@gnu.org>
2014-05-28 21:17 ` Dan.Espen
2014-05-28 21:44 ` Tim Johnson
2014-06-02 19:33 ` Damien Wyart
2014-06-03 15:20 ` Tim Johnson
[not found] ` <mailman.2841.1401808858.1147.help-gnu-emacs@gnu.org>
2014-06-03 17:53 ` Damien Wyart
2014-06-04 23:49 ` Tim Johnson
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).