[Novice]enabling python-mode

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Novice]enabling python-mode

Saurabh Agrawal-5
Hi,

I have just started picking up both the python language and emacs. So I am new to both arenas (thought not new to computers and programming using IDEs).

I have downloaded python-mode.el from launchpad and have placed it in folder Program Files\emacs\emacs-22.3\lisp\progmodes.

After that I compiled it to byte code, using emacs' built in compiler.

I have got a python-mode.elc, as a result.

Now I am able to do M-x python-mode and I get a (Python) status on the mode-line.

However, it is not auto-indenting. Also shouldn't it say (Python-mode) on the mode-line?

I am not able to find any tutorial for this. Does there exist one?

Thanks a lot for reading such basic questions.

Regards,

Saurabh Agrawal.

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: [Novice]enabling python-mode

Skip Montanaro-3

    Saurabh> Now I am able to do M-x python-mode and I get a (Python) status
    Saurabh> on the mode-line.

    Saurabh> However, it is not auto-indenting. Also shouldn't it say
    Saurabh> (Python-mode) on the mode-line?

You are probably still getting the python.el python mode which comes with
GNU Emacs.  To see if this is so you can execute

    M-x find-function RET python-mode RET

then see what the name of the file it pops up is.  I'm pretty sure it will
be named "python.el".

I'm not enough of a Emacs Lisp whiz to provide a solution with 100%
confidence, but here's what I'd try:

    * Inside a running Emacs execute

        M-x load-library RET python-mode RET

      This should enable the python-mode project's version of python mode
      for the current session.  If this fails, python-mode.el is not on your
      load-path.  Either move it or extend load-path.

    * Add

        (load-library "python-mode")

      To your ~/.xemacs file.  This should enable python-mode.el for all
      sessions.

    Saurabh> I am not able to find any tutorial for this. Does there exist
    Saurabh> one?

Not really.  Try:

       C-h f python-mode RET

or while visiting a Python file (and the python-mode you desire is active),
try:

      C-h m

--
Skip Montanaro - [hidden email] - http://smontanaro.dyndns.org/
_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: [Novice]enabling python-mode

Saurabh Agrawal-5
Hi Skip,

Thanks for replying.

 
You are probably still getting the python.el python mode which comes with
GNU Emacs.  To see if this is so you can execute

   M-x find-function RET python-mode RET

then see what the name of the file it pops up is.  I'm pretty sure it will
be named "python.el".

Yup, you are right here. It does throw up python.el.

 


I'm not enough of a Emacs Lisp whiz to provide a solution with 100%
confidence, but here's what I'd try:

   * Inside a running Emacs execute

       M-x load-library RET python-mode RET

     This should enable the python-mode project's version of python mode
     for the current session.  If this fails, python-mode.el is not on your
     load-path.  Either move it or extend load-path


This shows "Loading python-mode...done". But there is no change in the mode line. :(

Any idea what am I getting wrong?

Sorry again for bothering you with such basic stuff.

Saurabh.

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: [Novice]enabling python-mode

Skip Montanaro-3

    >> * Inside a running Emacs execute
    >>
    >> M-x load-library RET python-mode RET
    >>
    >> This should enable the python-mode project's version of python mode
    >> for the current session.  If this fails, python-mode.el is not on
    >> your load-path.  Either move it or extend load-path

    Saurabh> This shows "Loading python-mode...done". But there is no change
    Saurabh> in the mode line. :(

Have you tried reloading the file?

    C-x C-v RET

What about if you do this in a fresh Emacs session before loading any Python
files?

--
Skip Montanaro - [hidden email] - http://smontanaro.dyndns.org/
_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: [Novice]enabling python-mode

Saurabh Agrawal-5
Thanks Skip,

The indentation is now automatic.

But how will I come to know whether I am using python-mode.el or the default python.el, as the mode-line still says (Python)?

Regads,
Saurabh



On Sat, Dec 6, 2008 at 1:25 AM, <[hidden email]> wrote:

   >> * Inside a running Emacs execute
   >>
   >> M-x load-library RET python-mode RET
   >>
   >> This should enable the python-mode project's version of python mode
   >> for the current session.  If this fails, python-mode.el is not on
   >> your load-path.  Either move it or extend load-path

   Saurabh> This shows "Loading python-mode...done". But there is no change
   Saurabh> in the mode line. :(

Have you tried reloading the file?

   C-x C-v RET

What about if you do this in a fresh Emacs session before loading any Python
files?


_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: [Novice]enabling python-mode

Andreas Röhler-2
M-x describe-function python-mode

displays the file-name, where python-mode resides.

Regards

Andreas Röhler


Saurabh Agrawal wrote:

> Thanks Skip,
>
> The indentation is now automatic.
>
> But how will I come to know whether I am using python-mode.el or the
> default python.el, as the mode-line still says (Python)?
>
> Regads,
> Saurabh
>
>
>
> On Sat, Dec 6, 2008 at 1:25 AM, <[hidden email] <mailto:[hidden email]>>
> wrote:
>
>
>        >> * Inside a running Emacs execute
>        >>
>        >> M-x load-library RET python-mode RET
>        >>
>        >> This should enable the python-mode project's version of python
>     mode
>        >> for the current session.  If this fails, python-mode.el is not on
>        >> your load-path.  Either move it or extend load-path
>
>        Saurabh> This shows "Loading python-mode...done". But there is no
>     change
>        Saurabh> in the mode line. :(
>
>     Have you tried reloading the file?
>
>        C-x C-v RET
>
>     What about if you do this in a fresh Emacs session before loading
>     any Python
>     files?
>
>     --
>     Skip Montanaro - [hidden email] <mailto:[hidden email]> -
>     http://smontanaro.dyndns.org/
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Python-mode mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/python-mode

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: [Novice]enabling python-mode

Saurabh Agrawal-5


On Sat, Dec 6, 2008 at 1:38 PM, Andreas Roehler <[hidden email]> wrote:
M-x describe-function python-mode

displays the file-name, where python-mode resides.

Regards

Andreas Röhler


Yup, the first line of description is the following:

python-mode is an interactive compiled Lisp function in `python-mode.el'.

So I guess, now the function is up and running, right? :)

Regards and thanks for all the help,

Saurabh.


_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: [Novice]enabling python-mode

Skip Montanaro-3
In reply to this post by Saurabh Agrawal-5

    Saurabh> But how will I come to know whether I am using python-mode.el
    Saurabh> or the default python.el, as the mode-line still says (Python)?

Here are a few ways:

    * When moving past an identifier_with_underscores using M-f or M-b does
      it stop at each underscore or jump over the entire identifier?  If it
      jumps over the entire identifier you are using python-mode.el

    * Executing

        M-x py-version RET

      will work in the python-mode project's python mode and give you a
      response like 4.NN or 5.0.0.  It will fail with the GNU Emacs python
      mode.  It doesn't appear that the GNU Emacs python mode defines any
      kind of version.

    * Public commands and functions are prefixed with "python-" in the GNU
      Emacs python mode.  They are prefixed with "py-" in the python-mode
      project's python mode.  Executing

        C-h a ^py- RET

      will distinguish the two.

I could go on, but I won't belabor the point any more. ;-)

--
Skip Montanaro - [hidden email] - http://smontanaro.dyndns.org/
_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: [Novice]enabling python-mode

Eric S. Johansson
[hidden email] wrote:
>     Saurabh> But how will I come to know whether I am using python-mode.el
>     Saurabh> or the default python.el, as the mode-line still says (Python)?
>
> Here are a few ways:
>

I can tell because the menu bar has the menu item IM-python for python-mode.
_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode