GNU bug report logs - #17619
24.3; js-indent-line mixes display position with character position

Previous Next

Package: emacs;

Reported by: uu1101 <at> gmail.com

Date: Wed, 28 May 2014 18:19:01 UTC

Severity: normal

Found in version 24.3

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: uu1101 <at> gmail.com
Cc: 17619 <at> debbugs.gnu.org
Subject: bug#17619: 24.3; js-indent-line mixes display position with character position
Date: Sat, 31 May 2014 21:30:23 -0400
> `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 <at> iro.umontreal.ca>
+
+	* progmodes/js.el (js-indent-line): Don't mix columns and chars
+	(bug#17619).
+
 2014-05-31  Stefan Monnier  <monnier <at> 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))))
 





This bug report was last modified 10 years and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.