all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* python-mode changes in 22.3?
@ 2009-05-07 12:37 Chris Withers
  2009-05-12  9:17 ` Nikolaj Schumacher
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Withers @ 2009-05-07 12:37 UTC (permalink / raw)
  To: help-gnu-emacs

Hi All,

I've been using an antique version of python-mode for many years and 
have just made the lead to 22.3, which ships with python mode.

However, there are a few changes that are causing me problems:

- the comment/uncomment menu items on the python menu have vanished. How 
do I get these back?

- hitting return after, say, "def myfunc():" used to leave me at the 
right tab level. It no longer does. I have to hit tab. How do I get it 
so that I don't have to hit tab anymore, which is how it used to behave?

If there's a better list to ask about python-mode, please let me know!

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: python-mode changes in 22.3?
       [not found] <mailman.6798.1241705872.31690.help-gnu-emacs@gnu.org>
@ 2009-05-07 15:03 ` Anselm Helbig
  0 siblings, 0 replies; 8+ messages in thread
From: Anselm Helbig @ 2009-05-07 15:03 UTC (permalink / raw)
  To: help-gnu-emacs

Hi!

> I've been using an antique version of python-mode for many years and 
> have just made the lead to 22.3, which ships with python mode.
> 
> However, there are a few changes that are causing me problems:
> 
> - the comment/uncomment menu items on the python menu have vanished. How 
> do I get these back?
> 
> - hitting return after, say, "def myfunc():" used to leave me at the 
> right tab level. It no longer does. I have to hit tab. How do I get it 
> so that I don't have to hit tab anymore, which is how it used to behave?
> 
> If there's a better list to ask about python-mode, please let me know!

Emacs22 ships with it's own python-mode ("python.el") which is
different from "python-mode.el" (which comes with python). Read all
about it here:

  http://www.emacswiki.org/emacs/PythonMode

Maybe you just want to continue using Python's python-mode...

There also was a lengthy thread about this some days ago:

  http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/579cb1f09fb733d3#

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: python-mode changes in 22.3?
  2009-05-07 12:37 python-mode changes in 22.3? Chris Withers
@ 2009-05-12  9:17 ` Nikolaj Schumacher
  2009-05-12  9:25   ` Chris Withers
  0 siblings, 1 reply; 8+ messages in thread
From: Nikolaj Schumacher @ 2009-05-12  9:17 UTC (permalink / raw)
  To: Chris Withers; +Cc: help-gnu-emacs

Chris Withers <chris@simplistix.co.uk> wrote:

> - the comment/uncomment menu items on the python menu have vanished. How do I
> get these back?

You can be defining your own menu, but maybe you just want to start
using the universal comment commands, e.g. comment-or-uncomment-region.

> - hitting return after, say, "def myfunc():" used to leave me at the right tab
> level. It no longer does. I have to hit tab. How do I get it so that I don't
> have to hit tab anymore, which is how it used to behave?

Again, you can use the general Emacs mechanism for this.
By default, the <return> key is bound to `newline'.  You might want to
change it to `newline-and-indent'.

(global-set-key "\C-m" 'newline-and-indent)



regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: python-mode changes in 22.3?
  2009-05-12  9:17 ` Nikolaj Schumacher
@ 2009-05-12  9:25   ` Chris Withers
  2009-05-12 11:13     ` Nikolaj Schumacher
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Withers @ 2009-05-12  9:25 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

Nikolaj Schumacher wrote:
> Chris Withers <chris@simplistix.co.uk> wrote:
> 
>> - the comment/uncomment menu items on the python menu have vanished. How do I
>> get these back?
> 
> You can be defining your own menu, but maybe you just want to start
> using the universal comment commands, e.g. comment-or-uncomment-region.

I should have known this was possible really ;-)

Where can I find out how to do this?

(or if you're feeling generous..)

What do I put in my .emacs file to add two entries to the python menu:
- comment selected region
- uncomment selected region

That said, if we're adding menu items, how could I add one that 
basically did "shift region right", but twice?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: python-mode changes in 22.3?
  2009-05-12  9:25   ` Chris Withers
@ 2009-05-12 11:13     ` Nikolaj Schumacher
  2009-05-16 16:55       ` Customising the menu for python-mode Chris Withers
  0 siblings, 1 reply; 8+ messages in thread
From: Nikolaj Schumacher @ 2009-05-12 11:13 UTC (permalink / raw)
  To: Chris Withers; +Cc: help-gnu-emacs

Chris Withers <chris@simplistix.co.uk> wrote:

> Nikolaj Schumacher wrote:
>> Chris Withers <chris@simplistix.co.uk> wrote:
>>
>>> - the comment/uncomment menu items on the python menu have vanished. How do I
>>> get these back?
>>
>> You can be defining your own menu, but maybe you just want to start
>> using the universal comment commands, e.g. comment-or-uncomment-region.
>
> I should have known this was possible really ;-)
>
> Where can I find out how to do this?

I don't use the menus, only keys, so I can't do it for you.

Check out the Emacs manual
- 22.17.1.2 Extended Menu Items

I think they are extended the same way as binding commands to keys.

> That said, if we're adding menu items, how could I add one that basically did
> "shift region right", but twice?

First you need to write such a command. (Then bind the command to a
menu.)

(defun my-command-name ()
  (interactive)
  (call-interactively 'original-command-name)
  (call-interactively 'original-command-name))

You can find the original command name with C-h k <click on menu>.

regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Customising the menu for python-mode
  2009-05-12 11:13     ` Nikolaj Schumacher
@ 2009-05-16 16:55       ` Chris Withers
  2009-05-18 10:05         ` Nikolaj Schumacher
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Withers @ 2009-05-16 16:55 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

Nikolaj Schumacher wrote:
> Chris Withers <chris@simplistix.co.uk> wrote:
> 
>> Nikolaj Schumacher wrote:
>>> Chris Withers <chris@simplistix.co.uk> wrote:
>>>
>>>> - the comment/uncomment menu items on the python menu have vanished. How do I
>>>> get these back?
>>> You can be defining your own menu, but maybe you just want to start
>>> using the universal comment commands, e.g. comment-or-uncomment-region.
>> I should have known this was possible really ;-)
>>
>> Where can I find out how to do this?
> 
> I don't use the menus, only keys, so I can't do it for you.
> 
> Check out the Emacs manual
> - 22.17.1.2 Extended Menu Items

Fat lot of good that did me ;-)

I tried monkey-see-monkey-do-ing from python.el and so far have this in 
my .emacs file:

;; menu items
(defvar chris-mode-map
   (let ((map (make-sparse-keymap)))
     (easy-menu-define python-menu map "Python Mode menu"
       `("Python"
	:help "Python-specific Features"
	"-"
	["Comment" python-shift-left :active mark-active
	 :help "Comment"]
	["Uncomment" python-shift-right :active mark-active
	 :help "Uncomment"]))
     map))

Which, while it doesn't error, also does nothing.

What am I doing wrong?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Customising the menu for python-mode
  2009-05-16 16:55       ` Customising the menu for python-mode Chris Withers
@ 2009-05-18 10:05         ` Nikolaj Schumacher
  2009-05-25 15:52           ` Chris Withers
  0 siblings, 1 reply; 8+ messages in thread
From: Nikolaj Schumacher @ 2009-05-18 10:05 UTC (permalink / raw)
  To: Chris Withers; +Cc: help-gnu-emacs

Chris Withers <chris@simplistix.co.uk> wrote:

> ;; menu items
> (defvar chris-mode-map
>   (let ((map (make-sparse-keymap)))
>     (easy-menu-define python-menu map "Python Mode menu"
>       `("Python"
> 	:help "Python-specific Features"
> 	"-"
> 	["Comment" python-shift-left :active mark-active
> 	 :help "Comment"]
> 	["Uncomment" python-shift-right :active mark-active
> 	 :help "Uncomment"]))
>     map))
>
> Which, while it doesn't error, also does nothing.
>
> What am I doing wrong?

Nothing wrong, just not enough.  You've defined a keymap, but you also
need to activate it.

You can do it like this:

(define-minor-mode chris-mode
  "my menu mode"
  nil nil chris-mode-map)

And then enable `chris-mode'.

Of course you can also modify python-mode-map (or whatever it is called)
instead of creating your own map, so python-mode will take care of
activating the map.


regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Customising the menu for python-mode
  2009-05-18 10:05         ` Nikolaj Schumacher
@ 2009-05-25 15:52           ` Chris Withers
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Withers @ 2009-05-25 15:52 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

Nikolaj Schumacher wrote:
> Of course you can also modify python-mode-map (or whatever it is called)
> instead of creating your own map, so python-mode will take care of
> activating the map.

How do I do this? This sounds like what I'm after but my lisp foo is 
*very* weak...

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-05-25 15:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-07 12:37 python-mode changes in 22.3? Chris Withers
2009-05-12  9:17 ` Nikolaj Schumacher
2009-05-12  9:25   ` Chris Withers
2009-05-12 11:13     ` Nikolaj Schumacher
2009-05-16 16:55       ` Customising the menu for python-mode Chris Withers
2009-05-18 10:05         ` Nikolaj Schumacher
2009-05-25 15:52           ` Chris Withers
     [not found] <mailman.6798.1241705872.31690.help-gnu-emacs@gnu.org>
2009-05-07 15:03 ` python-mode changes in 22.3? Anselm Helbig

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.