Juan571 / js2-mode

Automatically exported from code.google.com/p/js2-mode
0 stars 0 forks source link

fill-paragraph is broken #65

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Enter this text into an empty js2-mode buffer:

function f() {
    // i am a very long comment that should be filled so that i am easy to
read!
}

2. Put point anywhere in the comment text (on `!', for example)
3. Invoke fill-paragraph (typically M-q)

What is the expected output? What do you see instead?

Expect the comment to wrap as in other modes, which // prefixed on the
second line of text. In actuality, an error occurs:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  looking-at(nil)
  c-literal-limits(nil t)
  c-mask-paragraph(t nil fill-paragraph nil)
  c-fill-paragraph(nil)
  js2-fill-comment((1 14 nil nil t nil 0 t 20 (14)) nil)
  js2-fill-paragraph(nil)
  fill-paragraph(nil)
  call-interactively(fill-paragraph)

What version of the product are you using? On what operating system?

js2-mode-version is a variable defined in `js2-mode.el'.
Its value is 20080424
GNU Emacs 22.2.50.1 (i386-mingw-nt6.0.6001)
 of 2008-04-22 on SLAG

Please provide any additional information below.

This has been broken for a while. I've hacked around it by using normal
fill-paragraph but it would be nice to gain whatever special behaviors
you've added here.

Original issue reported on code.google.com by dereksla...@gmail.com on 29 Apr 2008 at 1:36

GoogleCodeExporter commented 8 years ago
In step 1 above, "read!" should be on the previous line.

Original comment by dereksla...@gmail.com on 29 Apr 2008 at 1:37

GoogleCodeExporter commented 8 years ago
+1 for this issue.

fill-paragraph is one of the most frequent commands I use.

Original comment by nick...@gmail.com on 7 May 2008 at 11:44

GoogleCodeExporter commented 8 years ago
Digging through the code, it seems to be calling js-fill-comment, which is 
designed
to fill block comments, i.e. those that look like:

/**
 * Comment
 */

So it doesn't work at all with // comments.

However, it also doesn't work at all with block comments! So I'm somewhat lost 
here.

Original comment by dmho...@gmail.com on 18 Jul 2008 at 8:16

GoogleCodeExporter commented 8 years ago
I have attached a patch that fixes inline comments by using the c-fill-paragraph
which seems to provide good results for inline comments.

Original comment by waw...@gmail.com on 4 Oct 2008 at 9:41

Attachments:

GoogleCodeExporter commented 8 years ago
Also, @dmhouse, js2-fill-comment works for me on block comments without the 
patch.

Original comment by waw...@gmail.com on 4 Oct 2008 at 9:45

GoogleCodeExporter commented 8 years ago
That patch provided in Comment 4 made my day.  Thanks, waw325.

Original comment by JoeCoval...@gmail.com on 19 Nov 2008 at 9:57

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Fixed in 20090723.

Original comment by steve.ye...@gmail.com on 23 Jul 2009 at 10:36