Python and Emacs

2002-05-21 Thread Jérôme Marant

Hi,

  I'm sorry, this may be a bit off topic but I don't really know
  where I can post this question.

  I'm a bit annoyed with Emacs when editing Python programs because
  Emacs always replaces TABs with spaces ; this wouldn't bother me if
  Emacs was the only editor in the world. But when you share programs
  with others, it is better to have real TABs instead of spaces.
  I know about the "C-q TAB" but I don't want to use it every time
  I want automatic indentation. 

  Does anyone know how to achieve this?

  Thanks in advance.

-- 
Jérôme Marant

http://marant.org


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Python and Emacs

2002-05-21 Thread Ron Johnson
On Tue, 2002-05-21 at 15:27, Jérôme Marant wrote:
[snip]
>   I'm a bit annoyed with Emacs when editing Python programs because
>   Emacs always replaces TABs with spaces ; this wouldn't bother me if
>   Emacs was the only editor in the world. But when you share programs
>   with others, it is better to have real TABs instead of spaces.

This is amusing: I think exactly the opposite, since I indent
every 4 columns, and if \t were set to 4, then when less'ing
the file, it would look differently that it does in the editor...

-- 
+-+
| Ron Johnson, Jr.Home: [EMAIL PROTECTED] |
| Jefferson, LA  USA  http://ronandheather.dhs.org:81 |
| |
| "I have created a government of whirled peas..."|
|   Maharishi Mahesh Yogi, 12-May-2002,   |
!   CNN, Larry King Live  |
+-+


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Python and Emacs

2002-05-21 Thread Jérôme Marant
Ron Johnson <[EMAIL PROTECTED]> writes:

> On Tue, 2002-05-21 at 15:27, Jérôme Marant wrote:
> [snip]
>>   I'm a bit annoyed with Emacs when editing Python programs because
>>   Emacs always replaces TABs with spaces ; this wouldn't bother me if
>>   Emacs was the only editor in the world. But when you share programs
>>   with others, it is better to have real TABs instead of spaces.
>
> This is amusing: I think exactly the opposite, since I indent
> every 4 columns, and if \t were set to 4, then when less'ing
> the file, it would look differently that it does in the editor...

  That's right but Emacs should be able to adapt. As I said, I
  would be happy to choose any of both, if I could ...

  Do you have a solution?

-- 
Jérôme Marant

http://marant.org


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Python and Emacs

2002-05-21 Thread Ron Johnson
On Tue, 2002-05-21 at 16:09, Jérôme Marant wrote:
> Ron Johnson <[EMAIL PROTECTED]> writes:
> 
> > On Tue, 2002-05-21 at 15:27, Jérôme Marant wrote:
> > [snip]
> >>   I'm a bit annoyed with Emacs when editing Python programs because
> >>   Emacs always replaces TABs with spaces ; this wouldn't bother me if
> >>   Emacs was the only editor in the world. But when you share programs
> >>   with others, it is better to have real TABs instead of spaces.
> >
> > This is amusing: I think exactly the opposite, since I indent
> > every 4 columns, and if \t were set to 4, then when less'ing
> > the file, it would look differently that it does in the editor...
> 
>   That's right but Emacs should be able to adapt. As I said, I
>   would be happy to choose any of both, if I could ...
> 
>   Do you have a solution?

Yeah: use vim!  However, if you insist on using emacsOS, sorry,
can't help...
 
-- 
+-+
| Ron Johnson, Jr.Home: [EMAIL PROTECTED] |
| Jefferson, LA  USA  http://ronandheather.dhs.org:81 |
| |
| "I have created a government of whirled peas..."|
|   Maharishi Mahesh Yogi, 12-May-2002,   |
!   CNN, Larry King Live  |
+-+


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Python and Emacs

2002-05-21 Thread Chris Lawrence
On May 21, Jérôme Marant wrote:
>   I'm sorry, this may be a bit off topic but I don't really know
>   where I can post this question.
> 
>   I'm a bit annoyed with Emacs when editing Python programs because
>   Emacs always replaces TABs with spaces ; this wouldn't bother me if
>   Emacs was the only editor in the world. But when you share programs
>   with others, it is better to have real TABs instead of spaces.
>   I know about the "C-q TAB" but I don't want to use it every time
>   I want automatic indentation. 
> 
>   Does anyone know how to achieve this?

When you're done editing...

C-x h
M-x tabify

Of course, we all know that using tabs in Python code is Evil. :-)


Chris
-- 
Chris Lawrence <[EMAIL PROTECTED]> - http://www.lordsutch.com/chris/

Instructor and Ph.D. Candidate, Political Science, Univ. of Mississippi
208 Deupree Hall - 662-915-5765


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Python and Emacs

2002-05-21 Thread Jérôme Marant
Ron Johnson <[EMAIL PROTECTED]> writes:

>>   Do you have a solution?
>
> Yeah: use vim!  However, if you insist on using emacsOS, sorry,
> can't help...

  Using Vim? Emacs modes are not just syntax highlightings you know ;-)
  I would call it a functional regression :-)

  You're a troll!

  Cheers,

-- 
Jérôme Marant

http://marant.org


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Python and Emacs

2002-05-21 Thread Federico Di Gregorio
Il mar, 2002-05-21 alle 22:27, Jérôme Marant ha scritto:
> 
> Hi,
> 
>   I'm sorry, this may be a bit off topic but I don't really know
>   where I can post this question.
> 
>   I'm a bit annoyed with Emacs when editing Python programs because
>   Emacs always replaces TABs with spaces ; this wouldn't bother me if
>   Emacs was the only editor in the world. But when you share programs
>   with others, it is better to have real TABs instead of spaces.
>   I know about the "C-q TAB" but I don't want to use it every time
>   I want automatic indentation. 
> 
>   Does anyone know how to achieve this?

from the emacs manual:

   Emacs normally uses both tabs and spaces to indent lines.  If you
prefer, all indentation can be made from spaces only.  To request this,
set `indent-tabs-mode' to `nil'.  This is a per-buffer variable, so
altering the variable affects only the current buffer, but there is a
default value which you can change as well.  *Note Locals::.

   There are also commands to convert tabs to spaces or vice versa,
always preserving the columns of all nonblank text.  `M-x tabify' scans
the region for sequences of spaces, and converts sequences of at least
three spaces to tabs if that can be done without changing indentation.
`M-x untabify' changes all tabs in the region to appropriate numbers of
spaces.

-- 
Federico Di Gregorio
Debian GNU/Linux Developer & Italian Press Contact[EMAIL PROTECTED]
INIT.D Developer   [EMAIL PROTECTED]
   God is real. Unless declared integer. -- Anonymous FORTRAN programmer


signature.asc
Description: PGP signature


Re: Python and Emacs

2002-05-21 Thread Jérôme Marant
Chris Lawrence <[EMAIL PROTECTED]> writes:

> On May 21, Jérôme Marant wrote:
>>   I'm sorry, this may be a bit off topic but I don't really know
>>   where I can post this question.
>> 
>>   I'm a bit annoyed with Emacs when editing Python programs because
>>   Emacs always replaces TABs with spaces ; this wouldn't bother me if
>>   Emacs was the only editor in the world. But when you share programs
>>   with others, it is better to have real TABs instead of spaces.
>>   I know about the "C-q TAB" but I don't want to use it every time
>>   I want automatic indentation. 
>> 
>>   Does anyone know how to achieve this?
>
> When you're done editing...
>
> C-x h
> M-x tabify

  Sounds nice to me ;-) Thanks.

> Of course, we all know that using tabs in Python code is Evil. :-)

  Sure. Now, you make me think that sharing code with Vimers is
  Evil too. I wouldn't need such a trick ;-)

  Cheers,

-- 
Jérôme Marant

http://marant.org


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Python and Emacs

2002-05-21 Thread Florent Rougon
[EMAIL PROTECTED] (Jérôme Marant) wrote:

> Hi,

Hi,

>   I'm sorry, this may be a bit off topic but I don't really know
>   where I can post this question.

fr.comp.applications.emacs would be quite OK. ;-)

>   I'm a bit annoyed with Emacs when editing Python programs because
>   Emacs always replaces TABs with spaces ; this wouldn't bother me if
>   Emacs was the only editor in the world. But when you share programs
>   with others, it is better to have real TABs instead of spaces.
>   I know about the "C-q TAB" but I don't want to use it every time
>   I want automatic indentation. 
>
>   Does anyone know how to achieve this?

I *hate* tabs in files, but here it goes...

(add-hook 'python-mode-hook #'(lambda ()
(local-set-key "\t"
   #'(lambda ()
   (interactive)
   (insert "\t")

Please, don't spread this two much... nice Python code with ugly tabs
makes me depressed. :)

-- 
Florent


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Python and Emacs

2002-05-21 Thread Jérôme Marant
Federico Di Gregorio <[EMAIL PROTECTED]> writes:

>>   Does anyone know how to achieve this?
>
> from the emacs manual:
>
>Emacs normally uses both tabs and spaces to indent lines.  If you
> prefer, all indentation can be made from spaces only.  To request this,
> set `indent-tabs-mode' to `nil'.  This is a per-buffer variable, so
> altering the variable affects only the current buffer, but there is a
> default value which you can change as well.  *Note Locals::.

  Hmm. I recall now that I can use emacs variables in comments (!)

>
>There are also commands to convert tabs to spaces or vice versa,
> always preserving the columns of all nonblank text.  `M-x tabify' scans
> the region for sequences of spaces, and converts sequences of at least
> three spaces to tabs if that can be done without changing indentation.
> `M-x untabify' changes all tabs in the region to appropriate numbers of
> spaces.

  Thx.

  Cheers,

-- 
Jérôme Marant

http://marant.org


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Python and Emacs

2002-05-21 Thread Jérôme Marant
Florent Rougon <[EMAIL PROTECTED]> writes:

> [EMAIL PROTECTED] (Jérôme Marant) wrote:
>
>> Hi,
>
> Hi,
>
>>   I'm sorry, this may be a bit off topic but I don't really know
>>   where I can post this question.
>
> fr.comp.applications.emacs would be quite OK. ;-)

  Sorry, I'm not using Usenet at all.

>
>>   I'm a bit annoyed with Emacs when editing Python programs because
>>   Emacs always replaces TABs with spaces ; this wouldn't bother me if
>>   Emacs was the only editor in the world. But when you share programs
>>   with others, it is better to have real TABs instead of spaces.
>>   I know about the "C-q TAB" but I don't want to use it every time
>>   I want automatic indentation. 
>>
>>   Does anyone know how to achieve this?
>
> I *hate* tabs in files, but here it goes...

  I don't really care as long as Emacs can handle it transparently.

> (add-hook 'python-mode-hook #'(lambda ()
> (local-set-key "\t"
>#'(lambda ()
>(interactive)
>(insert "\t")
>
> Please, don't spread this two much... nice Python code with ugly tabs
> makes me depressed. :)

  This solution looks nice too compared to what was proposed here
  previously.

  Thanks.

  Cheers,

-- 
Jérôme Marant

http://marant.org


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]