Vimpulse bug report: vimpulse-end-of-previous-word fails on punctuation

Elena egarrulo at gmail.com
Sat Dec 18 02:51:27 CET 2010


Vegard Øye <vegard_oye <at> hotmail.com> writes:

> 
> On 2010-12-15 00:31, Elena wrote:
> 
> > I've found a bug into `vimpulse-end-of-previous-word', which is
> > bound to "gb". ... If I hit "gb", point does not move.
> 
> Should be fixed in commit bd05f05 -- refresh your repository with
> "git pull".
> 

Hi Vegard,

fixed.  Thanks.

I think the function should have been named vimpulse-end-of-previous-*W*ord (and
bound to "gE" instead of "gb"  if your intention were to mirror Vim).

Speaking of Vim, it has a "ge" command too, which moves to end of previous word
(not Word).  Could we have a such a command in Vimpulse too?  I've tried
implementing it, based on your code, but my implementation is buggy.  Would you
please look at it?  Here it is (comments show my understanding of how function
works):

(defun my-vimpulse-beginning-of-word-p ()
	(or (bobp)
		(save-excursion
			(cond ((viper-looking-at-alpha)
				   (backward-char)
				   (not (viper-looking-at-alpha)))
				  ((not (viper-looking-at-alphasep))
				   (backward-char)
				   (viper-looking-at-alphasep))))))

(defun my-vimpulse-end-of-previous-word (arg)
	"Move point to end of previous word."
	(interactive "P")
	(viper-leave-region-active)
	(let ((val (viper-p-val arg))
		  (com (viper-getcom arg)))
		(when com
			(viper-move-marker-locally 'viper-com-point (point)))
		;; We must start at the beginning of current word,
		;; otherwise the following backward-word will
		;; not work.
		(unless (my-vimpulse-beginning-of-word-p)
			(viper-backward-word 1))
		;; Skip line boundaries.
		(when (bolp)
			(skip-syntax-backward " >"))
		;; Go to beginning of previous word.
		(viper-backward-word val)
		;; If current word is one character long (for instance:
		;; punctuation), we are at the end of the word already.
		(unless (viper-end-of-word-p)
			(let (viper-com-point)
				(viper-end-of-word '(1 . ?r))))
		(if com
			(viper-execute-com 'viper-end-of-word val com)
			(backward-char))))








More information about the implementations-list mailing list