Uwe Brauer writes:
>> Regarding Re: mark-word (forward and backward) many
words????; "Stephen J. Turnbull" <stephen(a)xemacs.org> adds:
> (defun mark-word-backward (&optional count)
> (interactive "p")
> (mark-something 'mark-word-backward
> (lambda (x)
> (and (mark)
> ;; this is tricky: if we get here, then
> ;; mark-something has already done (goto-char (mark))
> (= (mark) (point))
> (setq x (- x)))
> (backward-word x))
> count))
Cool, that works, thanks!
You're welcome!
BTW, I didn't do this at first because your requirements weren't clear
to me, and the code is mildly complex because of the direction
reversal handling. The key phrase was "I can't predict what repeating
the command will mark" which clued me in that the direction reversal
handling was important, then a bit of experiment led to the code above
(it took about five tries, actually).
Why not include it in the next release of simple.el?
Well, I'll think about it. But there are two problems. First, we'd
need to do the same for other backward motion commands. More
important, it's just not right. The right fix is to make
mark-something work as expected with commands whose default direction
is backwards.
Also, Shift-Control-Left does the right thing by default, so it's not
really necessary to make mark-word-backward work by default to get
this level of convenience.
What bothers me more is that mark-something commands don't mark the
whole object, they just mark forward or backward. I guess I'd want an
"outward" direction for mark-something, too. This may complicate the
issue quite a bit.
Posted to the tracker as issue732 (feature request).
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta