bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#17619: 24.3; js-indent-line mixes display position with character po


From: Stefan Monnier
Subject: bug#17619: 24.3; js-indent-line mixes display position with character position
Date: Sat, 31 May 2014 21:30:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> `js-indent-line' mixes up display column with character count.

Indeed.

> I am using the following modification to work-around the issue, although
[..]
>           (offset (- current-char-position (current-indentation))))

This still mixes char counts and column counts.  I used the patch
below instead.


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog      2014-05-31 20:02:47 +0000
+++ lisp/ChangeLog      2014-06-01 01:27:03 +0000
@@ -1,3 +1,8 @@
+2014-06-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/js.el (js-indent-line): Don't mix columns and chars
+       (bug#17619).
+
 2014-05-31  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * subr.el (set-transient-map): Don't wait for some "nested"

=== modified file 'lisp/progmodes/js.el'
--- lisp/progmodes/js.el        2014-05-01 23:55:25 +0000
+++ lisp/progmodes/js.el        2014-06-01 01:29:02 +0000
@@ -1907,7 +1907,7 @@
   (interactive)
   (let* ((parse-status
           (save-excursion (syntax-ppss (point-at-bol))))
-         (offset (- (current-column) (current-indentation))))
+         (offset (- (point) (save-excursion (back-to-indentation) (point)))))
     (indent-line-to (js--proper-indentation parse-status))
     (when (> offset 0) (forward-char offset))))
 






reply via email to

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