summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2003-04-12 20:43:58 +0000
committerGlenn Morris <rgm@gnu.org>2003-04-12 20:43:58 +0000
commita259425b582d6d09333599a1929ba9d1c1828e5d (patch)
treedafa87b754df3b9ec2a93929c1c352971f1c64a6 /lisp
parent6c2161c427cd40682ec14dd79cc8abe360370b41 (diff)
downloademacs-a259425b582d6d09333599a1929ba9d1c1828e5d.tar.gz
emacs-a259425b582d6d09333599a1929ba9d1c1828e5d.tar.bz2
emacs-a259425b582d6d09333599a1929ba9d1c1828e5d.zip
(f90-join-lines): Make it behave more like the standard function
`join-line' - join with previous line, unless an argument supplied. Join comments correctly. No longer has a meaningful return value, no longer fills (seems contradictory to join AND fill). (f90-fill-region, f90-menu): Adapt for new f90-join-lines.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/progmodes/f90.el51
2 files changed, 28 insertions, 25 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5abe2744492..4023d57b6ab 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -38,6 +38,8 @@
* progmodes/f90.el (f90-abbrev-start): Only offer help if
abbrev-mode is active.
+ (f90-join-lines): Make it behave more like standard join-line.
+ (f90-fill-region, f90-menu): Adapt for new f90-join-lines.
* progmodes/fortran.el (fortran-abbrev-start): Only offer help if
abbrev-mode is active.
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index db26449b4c0..45503aa1c17 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -470,9 +470,9 @@ Can be overridden by the value of `font-lock-maximum-decoration'.")
["Indent Region" f90-indent-region mark-active]
["Fill Region" f90-fill-region mark-active]
"--"
- ["Break Line at Point" f90-break-line t]
- ["Join with Next Line" f90-join-lines t]
- ["Insert Block End" f90-insert-end t]
+ ["Break Line at Point" f90-break-line t]
+ ["Join with Previous Line" f90-join-lines t]
+ ["Insert Block End" f90-insert-end t]
"--"
("Highlighting"
["Toggle font-lock-mode" font-lock-mode :selected font-lock-mode
@@ -1534,28 +1534,25 @@ Update keyword case first."
(goto-char pos-mark)
(set-marker pos-mark nil)))))
-
-(defun f90-join-lines ()
- "Join present line with next line, if this line ends with \&."
- (interactive)
- (let (pos (oldpos (point)))
- (end-of-line)
+(defun f90-join-lines (&optional arg)
+ "Join current line to previous, fix whitespace, continuation, comments.
+With an argument, join current line to following line.
+Like `join-line', but handles F90 syntax."
+ (interactive "*P")
+ (beginning-of-line)
+ (if arg (forward-line 1))
+ (when (eq (preceding-char) ?\n)
+ (skip-chars-forward " \t")
+ (if (looking-at "\&") (delete-char 1))
+ (beginning-of-line)
+ (delete-region (point) (1- (point)))
(skip-chars-backward " \t")
- (when (= (preceding-char) ?&)
- (delete-char -1)
- (setq pos (point))
- (forward-line 1)
- (skip-chars-forward " \t")
- (if (looking-at "\&") (delete-char 1))
- (delete-region pos (point))
- (unless (f90-in-string)
- (delete-horizontal-space)
- (insert " "))
- (if (and auto-fill-function
- (> (line-end-position) fill-column))
- (f90-do-auto-fill))
- (goto-char oldpos)
- t))) ; return t if joined something
+ (and (eq (preceding-char) ?&) (delete-char -1))
+ (and (f90-in-comment)
+ (looking-at "[ \t]*!+")
+ (replace-match ""))
+ (or (f90-in-string)
+ (fixup-whitespace))))
(defun f90-fill-region (beg-region end-region)
"Fill every line in region by forward parsing. Join lines if possible."
@@ -1567,7 +1564,11 @@ Update keyword case first."
(goto-char beg-region)
(while go-on
;; Join as much as possible.
- (while (f90-join-lines))
+ (while (progn
+ (end-of-line)
+ (skip-chars-backward " \t")
+ (eq (preceding-char) ?&))
+ (f90-join-lines 'forward))
;; Chop the line if necessary.
(while (> (save-excursion (end-of-line) (current-column))
fill-column)