GNU bug report logs - #9553
24.0.50; Suboptimal comment filling in f90-mode

Previous Next

Package: emacs;

Reported by: Lawrence Mitchell <wence <at> gmx.li>

Date: Mon, 19 Sep 2011 16:44:05 UTC

Severity: normal

Found in version 24.0.50

Fixed in version 24.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Lawrence Mitchell <wence <at> gmx.li>
Subject: bug#9553: closed (Re: bug#9553: 24.0.50; Suboptimal comment
 filling in f90-mode)
Date: Tue, 20 Sep 2011 04:18:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#9553: 24.0.50; Suboptimal comment filling in f90-mode

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 9553 <at> debbugs.gnu.org.

-- 
9553: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9553
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Glenn Morris <rgm <at> gnu.org>
To: 9553-done <at> debbugs.gnu.org
Subject: Re: bug#9553: 24.0.50; Suboptimal comment filling in f90-mode
Date: Tue, 20 Sep 2011 00:12:22 -0400
Version: 24.1

Thank you; applied.

[Message part 3 (message/rfc822, inline)]
From: Lawrence Mitchell <wence <at> gmx.li>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; Suboptimal comment filling in f90-mode
Date: Mon, 19 Sep 2011 17:37:30 +0100
If auto-fill-mode is on, when typing comments in an f90-mode
buffer successive lines receive more and more whitespace indent
after the comment prefix:

emacs -Q
C-x h C-w
M-x f90-mode RET
M-x auto-fill-mode RET

M-: (progn (insert "!!!") (dotimes (i 20) (insert " aaaa"))) RET

SPC

Results in:

!!! aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
!!!  aaaa aaaa aaaa aaaa aaaa aaaa aaaa
    ^
  Note extra space here

Second issue.  f90-find-breakpoint doesn't do the correct thing
in comments.  It searches backwards for f90-break-delimiters
(defaulting to [-+\\*/><=,% \t]).  If one of these characters
happens to be at the appropriate point at the end of a line, it
is broken onto the next line.  This can leave (for example) a
comma detached from the preceeding word on its own.  In comments
this reads badly.

emacs -Q
C-x h C-w
M-x f90-mode RET
M-x auto-fill-mode RET

M-: (progn (insert "!!!") (dotimes (i 13) (insert " aaaa")) (insert "a, aaaa")) RET

SPC

Results in:

!!! aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaaa
!!! , aaaa
    ^
  Hanging comma

ChangeLog entry:

* progmodes/f90.el (f90-find-breakpoint): Only break at
whitespace inside a comment.
(f90-break-line): If breaking inside comment delete all
whitespace around breakpoint.

Patch for both issues:

diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index cdb5f2a..7d23973 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -2000,7 +2000,7 @@ is non-nil, call `f90-update-line' after inserting the continuation marker."
   (cond ((f90-in-string)
          (insert "&\n&"))
         ((f90-in-comment)
-         (delete-horizontal-space 'backwards) ; remove trailing whitespace
+         (delete-horizontal-space) ; remove trailing whitespace
          (insert "\n" (f90-get-present-comment-type)))
         (t (insert "&")
            (or no-update (f90-update-line))
@@ -2012,7 +2012,9 @@ is non-nil, call `f90-update-line' after inserting the continuation marker."
 
 (defun f90-find-breakpoint ()
   "From `fill-column', search backward for break-delimiter."
-  (re-search-backward f90-break-delimiters (line-beginning-position))
+  (if (f90-in-comment)
+      (re-search-backward "\\s-" (line-beginning-position))
+    (re-search-backward f90-break-delimiters (line-beginning-position)))
   (if (not f90-break-before-delimiters)
       (forward-char (if (looking-at f90-no-break-re) 2 1))
     (backward-char)



This bug report was last modified 13 years and 311 days ago.

Previous Next


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