emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: superword-mode


From: Ted Zlatanov
Subject: Re: superword-mode
Date: Wed, 27 Mar 2013 11:19:12 -0400
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

On Wed, 27 Mar 2013 09:03:06 -0600 Davis Herring <address@hidden> wrote: 

DH> On 03/26/2013 01:04 PM, Ted Zlatanov wrote:
>> +(defun subword-right (&optional arg)
>> +  (interactive "p")
>> +  (subword-forward arg))

DH> Shouldn't this be bidi-aware (as is right-word)?

(: .tniop doog ,seY

Does the attached work properly?  If yes I can install.

Ted

=== modified file 'lisp/progmodes/subword.el'
--- lisp/progmodes/subword.el   2013-03-27 14:04:34 +0000
+++ lisp/progmodes/subword.el   2013-03-27 15:10:46 +0000
@@ -168,8 +168,6 @@
 
 (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.
@@ -177,7 +175,19 @@
   (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]