* viper and py-electric-backspace
@ 2003-10-06 9:29 Sean Richards
2003-10-06 17:49 ` Kevin Rodgers
0 siblings, 1 reply; 2+ messages in thread
From: Sean Richards @ 2003-10-06 9:29 UTC (permalink / raw)
Hi,
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?
Cheers, Sean
--
"Hver sin smak", sa vintapperen, han drakk mens de andre sloss.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: viper and py-electric-backspace
2003-10-06 9:29 viper and py-electric-backspace Sean Richards
@ 2003-10-06 17:49 ` Kevin Rodgers
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2003-10-06 17:49 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-06 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-06 9:29 viper and py-electric-backspace Sean Richards
2003-10-06 17:49 ` Kevin Rodgers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).