help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: viper and py-electric-backspace


From: Kevin Rodgers
Subject: Re: viper and py-electric-backspace
Date: Mon, 06 Oct 2003 11:49:32 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Sean Richards wrote:

I need some help getting viper to play nice with python-mode. How do I
get backspace to call py-electric-backspace when I am using viper as
well? When in insert mode C-h k on backspace gives 'viper-backward-char'
as the function it is mapped to. So I think I need to use a defadvice
around viper-backward-char. Something like ...

(defadvice viper-backward-char (around my-viper-py-backspace activate)
  (if (check if we are in python-mode)
      (py-electric-backspace someargument)
   ad-do-it))

OK so I am not sure how to check what the buffer mode is. Use mode-name
or something better? And the argument to py-electric-backspace? Am I on
the right track or completely lost?

(eq major-mode 'python-mode)


someargument should probably be current-prefix-arg.


But looking at viper-keym.el, you probably ought to do this instead:

(add-hook 'python-mode-hook
          (lambda ()
            (define-key viper-vi-user-local-map [backspace]
              'py-electric-backspace)))

--
Kevin Rodgers



reply via email to

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