unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9553: 24.0.50; Suboptimal comment filling in f90-mode
@ 2011-09-19 16:37 Lawrence Mitchell
  2011-09-20  4:12 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Lawrence Mitchell @ 2011-09-19 16:37 UTC (permalink / raw)
  To: 9553


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)





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#9553: 24.0.50; Suboptimal comment filling in f90-mode
  2011-09-19 16:37 bug#9553: 24.0.50; Suboptimal comment filling in f90-mode Lawrence Mitchell
@ 2011-09-20  4:12 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2011-09-20  4:12 UTC (permalink / raw)
  To: 9553-done

Version: 24.1

Thank you; applied.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-20  4:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-19 16:37 bug#9553: 24.0.50; Suboptimal comment filling in f90-mode Lawrence Mitchell
2011-09-20  4:12 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).