]> git.eshelyaron.com Git - emacs.git/commitdiff
(mouse-skip-word): If point is at word constituent
authorKenichi Handa <handa@m17n.org>
Thu, 30 Jul 1998 01:34:38 +0000 (01:34 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 30 Jul 1998 01:34:38 +0000 (01:34 +0000)
characters, pay attention to word-separating-categories by using
forward-word instead of skip-syntax-forward/backward.

lisp/mouse.el

index 1902db0a32d433d0b2c14da990777487456e4d84..be760126499b0124d3466bc3e262b149c439d31c 100644 (file)
@@ -639,7 +639,18 @@ remains active.  Otherwise, it remains until the next input event."
 If DIR is positive skip forward; if negative, skip backward."
   (let* ((char (following-char))
         (syntax (char-to-string (char-syntax char))))
-    (cond ((or (string= syntax "w") (string= syntax " "))
+    (cond ((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 simularte the original behaviour 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)))