Am 23.10.2010 22:37, schrieb Uwe Brauer:
>> Regarding Re: mark-word (forward and backward) many
words????; "Stephen J. Turnbull"<stephen(a)xemacs.org> adds:
> 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.
Ok I see what was going on (my fault: in my setting Control
left was bound to other window) the default binding is
backward-word, now in XEmacs when you press also the shift
key the mark is set!
This *does not* work in GNU emacs, I think this an example
of a key difference between GNU emacs and XEmacs.
Andreas asked about this a while ago.
Ute
Hi,
to get the word under cursor marked always completely, you need still
something like
(unless (looking-at "\\>") (forward-word 1))
code below works with
GNU Emacs 23.1.1 (i586-suse-linux-gnu, GTK+ Version 2.20.1) of 2010-07-05
ie mark-something must get known too, but works afterwards.
Andreas
--
https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
https://code.launchpad.net/s-x-emacs-werkstatt/
::::::::::::::
(defun mark-word-backward (&optional count)
(interactive "p")
(unless (looking-at "\\>") (forward-word 1))
(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))
(defun mark-something (mark-fn movement-fn arg)
"internal function used by mark-sexp, mark-word, etc."
(let (newmark (pushp t))
(save-excursion
(if (and (eq last-command mark-fn) (mark))
;; Extend the previous state in the same direction:
(progn
(if (< (mark) (point)) (setq arg (- arg)))
(goto-char (mark))
(setq pushp nil)))
(funcall movement-fn arg)
(setq newmark (point)))
(if pushp
(push-mark newmark nil t)
;; Do not mess with the mark stack, but merely adjust the
previous state:
(set-mark newmark)
;; (activate-region)
)))
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta