(no subject)


Wed Apr 6 10:45:02 EDT 2005


#! rnews 4875
Newsgroups: comp.lang.python
Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <harry.g.george at boeing.com>
Subject: Re: Best editor?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <xqxll7wougu.fsf at cola2.ca.boeing.com>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 106
Sender: hgg9140 at cola2.ca.boeing.com
Organization: The Boeing Company
References: <1112725379.514651.66540 at l41g2000cwc.googlegroups.com>
Mime-Version: 1.0
Date: Wed, 6 Apr 2005 14:22:57 GMT
Xref: news.xs4all.nl comp.lang.python:371122

"ChinStrap" <caneff at gmail.com> writes:

> When not using the interactive prompt, what are you using? I keep
> hearing everyone say Emacs, but I can't understand it at all. I keep
> trying to learn and understand why so many seem to like it because I
> can't understand customization even without going through a hundred
> menus that might contain the thing I am looking for (or I could go
> learn another language just to customize!).
> 
> Personally I like SciTE, it has everything I think a midweight editor
> should: code folding, proper python support, nice colors out of the
> box, hotkey access to compile (I'm sure emacs does this, but I couldn't
> figure out for the life of me how), etc.
> 
> Opinions on what the best is? Or reading I could get to maybe sway me
> to Emacs (which has the major advantage of being on everyone's system).
> 

The key (as others have said) is to know your editor and be effective
with it.  As long as it can handle ASCII, does autoindent, and knows
tab-is-4-chars, then it is a viable choice.

Since you asked specifically about emacs, and whether or not it is
worthwhile...

I've used emacs for 15 years, and am still learning useful new tricks
at a rate of about one per 6 months.  But I've also found that the
essentials can be taught in a 2 hour session and mastered in about 2
weeks of use.  I've taught dozens of people using this "Essential
Emacs" approach.  

We find that emacs is for people who will be doing serious editing all
day long (e.g., programmers).  I like that comment from another
poster: "Emacs is a good place to live, but I wouldn't want to visit
there."

For people who will just be editing an occassional file (and no python
code), we recommend notepad or nedit.

Now then, how do we use emacs?

1. Proper setup is essential.  Assuming you have python-mode.el and
.elc in emacs's program-modes dir, then your .emacs needs:

;---python---------------------------
(load "python-mode")
(setq auto-mode-alist
      (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
      (cons '("python" . python-mode)
            interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
(add-hook 'python-mode-hook 'turn-on-font-lock)
(setq python-mode-hook 'python-initialise)
(defun python-initialise ()
  (interactive)
  (setq default-tab-width 4)
  (setq indent-tabs-mode nil)
)


2. I almost never use the interactive prompt.  There are people here
who do, but as soon as the script is more than a couple lines long, it
takes longer to reenter the code (even copy-and-paste) than to
edit-save-run a dummy batch script.  When I'm doing Extreme
Programming with such people, I insist on using a stopwatch and
checking which approach is more efficient -- they usually come over to
my approach.

3. I run emacs with split windows:
a) Edit the working code
b) Edit the unittest code
c) Run a shell script, where I (re)run the "go_test" script by doing
alt-p ret

In another frame (same emacs process, different frame) I keep the
oracle (known good) and test outputs in split windows, and maybe do
ediff-buffers on them if the deltas are not obvious.   

For each module under consideration (view or edit), I use a separate
emacs process in a similar manner.  In normal work, that means 1-4
emacs processes running, each with its own shell and own test cycles.

4. Elsewhere I'm running emacs rmail all day, and run emacs gnus several
times a day (like now).

5. When I do Extreme Programming, the other author(s) tend to be using
emacs, vim, or nedit.  We don't let people use notepad for python
becuause it doesn't know proper formatting.  IDE's tend to want to own
the whole show, which makes cross-tool Extreme Programming a pain.

As long as the other programmers have set their editors for
auto-indention and tab-is-4-chars, then we get along fine.  [I do
notice a sizeable delay when vim people search for the appropriate
shell windows, instead of having them in a (joined-at-the-hip) split
window.  This has more to do with bookkeeping than with editors per
se, but it is a data point.]

6. On IDE's and code-completion: If you are going to be typing the
same thing over and over, why not use a function, or maybe code
generation?

-- 
harry.g.george at boeing.com
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718



More information about the Python-list mailing list