[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to configure Emacs to autoload modes?

From: Peter Wu
Subject: Re: How to configure Emacs to autoload modes?
Date: Fri, 21 Feb 2003 17:20:03 +0800

Lucas wrote:

> Un beau jour, Peter Wu <> nous a dit:
>> Hello,
>> I downloaded the python-mode.el to lisp dir and did the
>> byte-compile-file successsfully. I need to add the following line in
>> my .emacs file so that when I open or new a Python file, Emacs will
>> load the python-mode for me.
>> ;; Load python-mode
>> (autoload 'python-mode "python-mode" "Python editing mode" t)
>> (setq auto-mode-alist (append '(("\\.py$" . python-mode))
>> auto-mode-alist))
>> However, I notice that if I create a XML or Perl file, I don't need to
>> add some similar code in the .emacs file and Emacs can do the job
>> correctly. I think there must be some settings that configure Emacs to
>> offer such functionality. Can anyone show me how to do this? Thanks!
> I think that it's because Emacs knows some modes and extensions natively
> (it's the same thing for C, and others).
> It is built with that support, maybe you can rebuild Emacs to natively
> add support to Python ?

I tried to build that support by updating the files.el and loaddefs.el but
no luck. I opened the python-mode.el and M-x update-file-autoloads. I saw
it wrote the loaddefs.el successfully. If I open that file, I do see the
python-mode in it.

Also, i tried to edit the files.el file, like this:

(defvar auto-mode-alist
   (lambda (elt)
     (cons (purecopy (car elt)) (cdr elt)))
   '(("\\.te?xt\\'" . text-mode)
     ("\\.c\\'" . c-mode)
     ("\\.h\\'" . c-mode)
     ("\\.py\\'" . python-mode)

Am I on the right track?

Cheers, Peter

reply via email to

[Prev in Thread] Current Thread [Next in Thread]