emacs for OS X

T

Tuxtrax

Hi all

My editor of choice on linux for python, bar none, is xemacs. I love the
python mode that detects a python file and handles indentation and
coloration for me automagically.

I have been using a powerbook for a while now, and I finally found emacs
for aqua in OS X Jaguar (10.2.8). I downloaded it from porkrind.com. The
version of emacs is 21.3 I believe. Anyway, not only does it *not*
detect python files automatically, but it tries to use fundamental mode
to handle them which is a pain in the ass. I want my coloring and
indentation back, damn it all!

I found python-mode.el in the python distribution folder, but not only
do I have no clue as to what to do with it, I can't find an emacs folder
or a .emac file. Just the emac program. Any help with this would be
greatly appreciated. If you have overcome this yourself I especially
want to hear from you.

In other news.....

I have a code question for you all. This one is a real trip. I am trying
to use NNTPLIB to download just the message numbers and "from" fields
for any specified number of messages I want, from 1 to 10,000. So far so
good. But when I play by the rules, I get unpredictable results. If I
ask for 20 from headers I get one. If I ask for 500, I get a couple. If
I ask for 6000, one time I might get 500, the next time I might get
2,300. It is very frustrating. Here is the code soundbite:

response, number_of_messages, first_available_message,
last_available_message, groupname = n.group(newsgroup)

###############
# Do we need to create run time files from server download?
# This section takes care of it if it needs to be done.

if dbuild_flag == 1 or fexist(database_shelve+".db") == 0:

# Retrieve and print From: information
# The NNTPlib xhdr routine returns a list of nested sublists. Each
# sulist contains a pair - message number, requested header in string
# form.

message_request = getinput("\nHow many posts should I be interested
in? [max 10,000]")

if int(message_request) > int(number_of_messages):
print "\nRequest exceeds current available message count.
Adjusting to %s posts" % number_of_messages
message_request = number_of_messages
elif int(message_request) > 10000:
print "\nRequest exceeds program capacity. Assuming max of 10,000
posts, and continuing ...."
message_request = "10000"


last_message = str(int(first_available_message) +
int(message_request))

stringrequest = first_available_message+"-"+last_message

print "\nRetrieving list of first %s newsgroup participants" %
message_request
print "\nI'm working ..............."

# This is what should work reliably and is not:

response, poster = n.xhdr("from", stringrequest)

##################

Now when I make my xhdr request using the full range of messages as told
to me by:

response, number_of_messages, first_available_message,
last_available_message, groupname = n.group(newsgroup)

by changing:

stringrequest = first_available_message+"-"+last_message

to:

stringrequest = first_available_message+"-"+last_available_message

I get reliable results every time. Anyone care to help me on this one?
It simply makes no sense that I should be able to get reliable results
only when I ask for all 48,000 "from" message headers available from my
newsgroup of choice. I have verified, by the way, that last_message is a
properly formed string in the format needed by xhdr.

thanks, and best regards,

Mathew
 
W

Wezzy

Tuxtrax said:
Hi all

My editor of choice on linux for python, bar none, is xemacs. I love the
python mode that detects a python file and handles indentation and
coloration for me automagically.

I have been using a powerbook for a while now, and I finally found emacs
for aqua in OS X Jaguar (10.2.8). I downloaded it from porkrind.com. The
version of emacs is 21.3 I believe. Anyway, not only does it *not*
detect python files automatically, but it tries to use fundamental mode
to handle them which is a pain in the ass. I want my coloring and
indentation back, damn it all!

I found python-mode.el in the python distribution folder, but not only
do I have no clue as to what to do with it, I can't find an emacs folder
or a .emac file. Just the emac program. Any help with this would be
greatly appreciated. If you have overcome this yourself I especially
want to hear from you.

In other news.....

I use Emacs with Panther but i think that the situation is the same.
Download python-mode from python.org:
http://www.python.org/emacs/python-mode/python-mode.el

Compile the file

Move both file where emacs can find them

Open Terminal
The .emacs file is into your home folder (tipically /Users/<youid>) so
when you open terminal you are already in the right place

add the following lines to your .emacs file :

(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)
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)

(i've found this code in www.python.org)

Now when you try to open a .py file emacs loads python-mode
Hope this helps
 
S

Skip Montanaro

Tuxtrax> I found python-mode.el in the python distribution folder, but
Tuxtrax> not only do I have no clue as to what to do with it, I can't
Tuxtrax> find an emacs folder or a .emac file. Just the emac
Tuxtrax> program. Any help with this would be greatly appreciated. If
Tuxtrax> you have overcome this yourself I especially want to hear from
Tuxtrax> you.

Stick it in a directory in your Emacs load-path and byte-compile it. C-h v
load-path RET will show you what your load-path is. M-x byte-compile-file
RET will prompt you for a file to compile. Respond with the full path to
your copy of python-mode.el. Finally, associate .py files with python-mode
by adding something like

(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))

to your ~/.xemacs (or ~/.xemacs/init.el, depending on XEmacs version) file.

Skip
 
S

Skip Montanaro

Wezzy> Download python-mode from python.org:
Wezzy> http://www.python.org/emacs/python-mode/python-mode.el

Ancient, ancient, ancient!

Pop up a level to

http://www.python.org/emacs/python-mode/

and you'll read:

The current release of python-mode.el is no longer maintained on this
website. Check the python-mode project on Sourceforge instead.

The version you referred to (which I don't think is any longer linked to
from the website) is 4.6. The current version is 4.54.

Skip
 
W

Wezzy

Skip Montanaro said:
Wezzy> Download python-mode from python.org:
Wezzy> http://www.python.org/emacs/python-mode/python-mode.el

Ancient, ancient, ancient!

Pop up a level to

http://www.python.org/emacs/python-mode/

and you'll read:

The current release of python-mode.el is no longer maintained on this
website. Check the python-mode project on Sourceforge instead.

Today when i post my message i've opened
http://www.python.org/emacs/python-mode/ and followed the link to sf.net
but the project hasn't released any file yet, so i've posted the url to
the www.python.org version that is still online.
The version you referred to (which I don't think is any longer linked to
from the website) is 4.6. The current version is 4.54.

i've downloaded python-mode.el few time ago so i didn't know that there
are new versions, thanks for this info. (Anyway the old one is still
online)
 
S

Skip Montanaro

Wezzy> Today when i post my message i've opened
Wezzy> http://www.python.org/emacs/python-mode/ and followed the link to
Wezzy> sf.net but the project hasn't released any file yet, so i've
Wezzy> posted the url to the www.python.org version that is still
Wezzy> online.

You've shamed me into releasing the single file which is part of the
project. The new release is "barking-up-the-wrong-tree". If we get more
formal with the releases perhaps I'll adopt a numeric release schedule.

Wezzy> (Anyway the old one is still online)

I'll see about deleting it.

Skip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top