Function: mouse-skip-word
mouse-skip-word is a byte-compiled function defined in mouse.el.gz.
Signature
(mouse-skip-word DIR)
Documentation
Skip over word, over whitespace, or over identical punctuation.
If mouse-1-double-click-prefer-symbols is non-nil, skip over symbol.
If DIR is positive skip forward; if negative, skip backward.
Source Code
;; Defined in /usr/src/emacs/lisp/mouse.el.gz
;; Commands to handle xterm-style multiple clicks.
(defun mouse-skip-word (dir)
"Skip over word, over whitespace, or over identical punctuation.
If `mouse-1-double-click-prefer-symbols' is non-nil, skip over symbol.
If DIR is positive skip forward; if negative, skip backward."
(let* ((char (following-char))
(syntax-after-pt (syntax-class (syntax-after (point))))
(syntax (char-to-string
(if syntax-after-pt
(syntax-class-to-char syntax-after-pt)
;; Zero is what 'following-char' returns at EOB, so
;; we feed that to 'char-syntax' when 'syntax-class'
;; returns nil, which means we are at EOB.
(char-syntax ?\0))))
sym)
(cond ((and mouse-1-double-click-prefer-symbols
(setq sym (bounds-of-thing-at-point 'symbol)))
(goto-char (if (< dir 0)
(car sym)
(cdr sym))))
((string= syntax "w")
;; Here, we can't use skip-syntax-forward/backward because
;; they don't pay attention to word-separating-categories,
;; and thus they will skip over a true word boundary. So,
;; we simulate the original behavior by using forward-word.
(if (< dir 0)
(if (not (looking-at "\\<"))
(forward-word -1))
(if (or (looking-at "\\<") (not (looking-at "\\>")))
(forward-word 1))))
((string= syntax " ")
(if (< dir 0)
(skip-syntax-backward syntax)
(skip-syntax-forward syntax)))
((string= syntax "_")
(if (< dir 0)
(skip-syntax-backward "w_")
(skip-syntax-forward "w_")))
((< dir 0)
(while (and (not (bobp)) (= (preceding-char) char))
(forward-char -1)))
(t
(while (and (not (eobp)) (= (following-char) char))
(forward-char 1))))))