comparison lisp/progmodes/f90.el @ 55250:d5d0f1479a4a

(f90-get-present-comment-type): Return whitespace, as well as comment chars, for consistent filling of comment blocks. Use `match-string-no-properties'. (f90-break-line): Do not leave trailing whitespace when filling comments.
author Glenn Morris <rgm@gnu.org>
date Fri, 30 Apr 2004 18:52:11 +0000
parents 859030e39b53
children 239a750fdcfa
comparison
equal deleted inserted replaced
55249:c51143d3c644 55250:d5d0f1479a4a
848 ;; Leave >= 1 space after line number. 848 ;; Leave >= 1 space after line number.
849 (indent-to col (if (zerop (current-column)) 0 1))) 849 (indent-to col (if (zerop (current-column)) 0 1)))
850 850
851 (defsubst f90-get-present-comment-type () 851 (defsubst f90-get-present-comment-type ()
852 "If point lies within a comment, return the string starting the comment. 852 "If point lies within a comment, return the string starting the comment.
853 For example, \"!\" or \"!!\"." 853 For example, \"!\" or \"!!\", followed by the appropriate amount of
854 whitespace, if any."
855 ;; Include the whitespace for consistent auto-filling of comment blocks.
854 (save-excursion 856 (save-excursion
855 (when (f90-in-comment) 857 (when (f90-in-comment)
856 (beginning-of-line) 858 (beginning-of-line)
857 (re-search-forward "!+" (line-end-position)) 859 (re-search-forward "!+[ \t]*" (line-end-position))
858 (while (f90-in-string) 860 (while (f90-in-string)
859 (re-search-forward "!+" (line-end-position))) 861 (re-search-forward "!+[ \t]*" (line-end-position)))
860 (match-string 0)))) 862 (match-string-no-properties 0))))
861 863
862 (defsubst f90-equal-symbols (a b) 864 (defsubst f90-equal-symbols (a b)
863 "Compare strings A and B neglecting case and allowing for nil value." 865 "Compare strings A and B neglecting case and allowing for nil value."
864 (equal (if a (downcase a) nil) 866 (equal (if a (downcase a) nil)
865 (if b (downcase b) nil))) 867 (if b (downcase b) nil)))
1517 is non-nil, call `f90-update-line' after inserting the continuation marker." 1519 is non-nil, call `f90-update-line' after inserting the continuation marker."
1518 (interactive "*P") 1520 (interactive "*P")
1519 (cond ((f90-in-string) 1521 (cond ((f90-in-string)
1520 (insert "&\n&")) 1522 (insert "&\n&"))
1521 ((f90-in-comment) 1523 ((f90-in-comment)
1524 (delete-horizontal-space 'backwards) ; remove trailing whitespace
1522 (insert "\n" (f90-get-present-comment-type))) 1525 (insert "\n" (f90-get-present-comment-type)))
1523 (t (insert "&") 1526 (t (insert "&")
1524 (or no-update (f90-update-line)) 1527 (or no-update (f90-update-line))
1525 (newline 1) 1528 (newline 1)
1526 (if f90-beginning-ampersand (insert "&")))) 1529 (if f90-beginning-ampersand (insert "&"))))