* progmodes/subword.el (superword-mode): Use `forward-sexp' instead of `forward-symbol'.
authorTed Zlatanov <tzz@lifelogs.com>
Fri, 29 Mar 2013 13:24:19 +0000 (09:24 -0400)
committerTed Zlatanov <tzz@lifelogs.com>
Fri, 29 Mar 2013 13:24:19 +0000 (09:24 -0400)
lisp/ChangeLog
lisp/progmodes/subword.el

index a3ef9b2..1865491 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-29  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * progmodes/subword.el (superword-mode): Use `forward-sexp'
+       instead of `forward-symbol'.
+
 2013-03-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/edebug.el (edebug-mode): Make it a minor mode.
index 24abfa8..91c3a88 100644 (file)
@@ -154,7 +154,7 @@ as words.
   "Do the same as `forward-word' but on subwords.
 See the command `subword-mode' for a description of subwords.
 Optional argument ARG is the same as for `forward-word'."
-  (interactive "p")
+  (interactive "^p")
   (unless arg (setq arg 1))
   (cond
    ((< 0 arg)
@@ -168,16 +168,26 @@ Optional argument ARG is the same as for `forward-word'."
 
 (put 'subword-forward 'CUA 'move)
 
-(defalias 'subword-right 'subword-forward)
-
 (defun subword-backward (&optional arg)
   "Do the same as `backward-word' but on subwords.
 See the command `subword-mode' for a description of subwords.
 Optional argument ARG is the same as for `backward-word'."
-  (interactive "p")
+  (interactive "^p")
   (subword-forward (- (or arg 1))))
 
-(defalias 'subword-left 'subword-backward)
+(defun subword-right (&optional arg)
+  "Do the same as `right-word' but on subwords."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (subword-forward arg)
+    (subword-backward arg)))
+
+(defun subword-left (&optional arg)
+  "Do the same as `left-word' but on subwords."
+  (interactive "^p")
+  (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+      (subword-backward arg)
+    (subword-forward arg)))
 
 (defun subword-mark (arg)
   "Do the same as `mark-word' but on subwords.
@@ -299,7 +309,7 @@ edit them as words.
 ;;
 (defun subword-forward-internal ()
   (if superword-mode
-      (forward-symbol 1)
+      (forward-sexp 1)
     (if (and
          (save-excursion
            (let ((case-fold-search nil))
@@ -315,7 +325,7 @@ edit them as words.
 
 (defun subword-backward-internal ()
   (if superword-mode
-      (forward-symbol -1)
+      (forward-sexp -1)
     (if (save-excursion
           (let ((case-fold-search nil))
             (re-search-backward subword-backward-regexp nil t)))