aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2002-05-26 19:58:31 +0000
committerGlenn Morris2002-05-26 19:58:31 +0000
commit76bccf35b4b67e71dc73b1d066eee30459a36afc (patch)
treeeead6600a90bbb86d929f113121db0278f8948a0
parent608d30f7bedb5ff889b0df623a8e70549e503645 (diff)
downloademacs-76bccf35b4b67e71dc73b1d066eee30459a36afc.tar.gz
emacs-76bccf35b4b67e71dc73b1d066eee30459a36afc.zip
(f90-previous-block, f90-next-block): New names (and slightly changed
behaviour) for the functions f90-previous-block-start, f90-next-block-end. (f90-beginning-of-subprogram, f90-end-of-subprogram): Simplify.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/progmodes/f90.el80
2 files changed, 44 insertions, 43 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1d3bf6d479e..21b09117177 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12002-05-26 Glenn Morris <gmorris@ast.cam.ac.uk>
2
3 * progmodes/f90.el (f90-previous-block, f90-next-block): New names,
4 and slightly changed behaviour, for `f90-previous-block-start' and
5 `f90-next-block-end'.
6 (f90-beginning-of-subprogram, f90-end-of-subprogram): Simplify.
7
12002-05-26 Simon Josefsson <jas@extundo.com> 82002-05-26 Simon Josefsson <jas@extundo.com>
2 9
3 * fringe.el (set-fringe-mode): Work when updating 10 * fringe.el (set-fringe-mode): Work when updating
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index eac1737382e..cdb7db4688e 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -433,8 +433,8 @@ do\\([ \t]*while\\)?\\|select[ \t]*case\\|where\\|forall\\)\\)\\>"
433 (define-key map "\r" 'newline) 433 (define-key map "\r" 'newline)
434 (define-key map "\C-c\r" 'f90-break-line) 434 (define-key map "\C-c\r" 'f90-break-line)
435;;; (define-key map [M-return] 'f90-break-line) 435;;; (define-key map [M-return] 'f90-break-line)
436 (define-key map "\C-c\C-a" 'f90-previous-block-start) 436 (define-key map "\C-c\C-a" 'f90-previous-block)
437 (define-key map "\C-c\C-e" 'f90-next-block-end) 437 (define-key map "\C-c\C-e" 'f90-next-block)
438 (define-key map "\C-c\C-d" 'f90-join-lines) 438 (define-key map "\C-c\C-d" 'f90-join-lines)
439 (define-key map "\C-c\C-f" 'f90-fill-region) 439 (define-key map "\C-c\C-f" 'f90-fill-region)
440 (define-key map "\C-c\C-p" 'f90-previous-statement) 440 (define-key map "\C-c\C-p" 'f90-previous-statement)
@@ -1189,15 +1189,12 @@ Return nil if no later statement is found."
1189 not-last-statement)) 1189 not-last-statement))
1190 1190
1191(defun f90-beginning-of-subprogram () 1191(defun f90-beginning-of-subprogram ()
1192 "Move point to the beginning of subprogram. 1192 "Move point to the beginning of the current subprogram.
1193Return (TYPE NAME), or nil if not found." 1193Return (TYPE NAME), or nil if not found."
1194 (interactive) 1194 (interactive)
1195 (let ((count 1) (case-fold-search t) matching-beg) 1195 (let ((count 1) (case-fold-search t) matching-beg)
1196 (beginning-of-line) 1196 (beginning-of-line)
1197 (skip-chars-forward " \t0-9") 1197 (while (and (> count 0)
1198 (if (setq matching-beg (f90-looking-at-program-block-start))
1199 (setq count (1- count)))
1200 (while (and (not (zerop count))
1201 (re-search-backward f90-program-block-re nil 'move)) 1198 (re-search-backward f90-program-block-re nil 'move))
1202 (beginning-of-line) 1199 (beginning-of-line)
1203 (skip-chars-forward " \t0-9") 1200 (skip-chars-forward " \t0-9")
@@ -1212,16 +1209,12 @@ Return (TYPE NAME), or nil if not found."
1212 nil))) 1209 nil)))
1213 1210
1214(defun f90-end-of-subprogram () 1211(defun f90-end-of-subprogram ()
1215 "Move point to the end of subprogram. 1212 "Move point to the end of the current subprogram.
1216Return (TYPE NAME), or nil if not found." 1213Return (TYPE NAME), or nil if not found."
1217 (interactive) 1214 (interactive)
1218 (let ((count 1) (case-fold-search t) matching-end) 1215 (let ((count 1) (case-fold-search t) matching-end)
1219 (beginning-of-line)
1220 (skip-chars-forward " \t0-9")
1221 (if (setq matching-end (f90-looking-at-program-block-end))
1222 (setq count (1- count)))
1223 (end-of-line) 1216 (end-of-line)
1224 (while (and (not (zerop count)) 1217 (while (and (> count 0)
1225 (re-search-forward f90-program-block-re nil 'move)) 1218 (re-search-forward f90-program-block-re nil 'move))
1226 (beginning-of-line) 1219 (beginning-of-line)
1227 (skip-chars-forward " \t0-9") 1220 (skip-chars-forward " \t0-9")
@@ -1285,7 +1278,7 @@ and completes outermost block if necessary."
1285 (error "End label `%s' does not match start label `%s'" 1278 (error "End label `%s' does not match start label `%s'"
1286 end-label start-label))))) 1279 end-label start-label)))))
1287 (end-of-line)) 1280 (end-of-line))
1288 (if (> count 0) (error "Unterminated block")) 1281 (if (> count 0) (error "Missing block end"))
1289 ;; Check outermost block. 1282 ;; Check outermost block.
1290 (if (interactive-p) 1283 (if (interactive-p)
1291 (save-excursion 1284 (save-excursion
@@ -1340,39 +1333,40 @@ Does not check the outermost block, because it may be incomplete."
1340 start-label end-label)))))) 1333 start-label end-label))))))
1341 (if (> count 0) (error "Missing block start")))) 1334 (if (> count 0) (error "Missing block start"))))
1342 1335
1343(defun f90-next-block-end (&optional num) 1336(defun f90-next-block (&optional num)
1344 "Move point forward to the next block end. 1337 "Move point forward to the next end or start of a code block.
1345With optional argument NUM, go forward that many block ends. 1338With optional argument NUM, go forward that many blocks.
1346If NUM is negative, go backward to the start of a block." 1339If NUM is negative, go backwards.
1340A block is a subroutine, if-endif, etc."
1347 (interactive "p") 1341 (interactive "p")
1348 (if (and num (< num 0)) (f90-previous-block-start (- num))) 1342 (let ((case-fold-search t)
1349 (let ((count (or num 1)) 1343 (count (if num (abs num) 1)))
1350 (end-re (concat "end[ \t]*" f90-blocks-re))) 1344 (while (and (> count 0)
1351 (while (and (> count 0) (re-search-forward end-re nil 'move)) 1345 (if (> num 0) (re-search-forward f90-blocks-re nil 'move)
1346 (re-search-backward f90-blocks-re nil 'move)))
1352 (beginning-of-line) 1347 (beginning-of-line)
1353 (skip-chars-forward " \t0-9") 1348 (skip-chars-forward " \t0-9")
1354 (or (f90-in-string) (f90-in-comment) 1349 (cond ((or (f90-in-string) (f90-in-comment)))
1355 (setq count (1- count))) 1350 ((or
1356 (end-of-line)))) 1351 (looking-at "end[ \t]*")
1357 1352 (f90-looking-at-do)
1358(defun f90-previous-block-start (&optional num) 1353 (f90-looking-at-select-case)
1359 "Move point backward to the previous block start. 1354 (f90-looking-at-type-like)
1360With optional argument NUM, go backward that many block starts. 1355 (f90-looking-at-program-block-start)
1361If NUM is negative, go forward to the end of a block." 1356 (f90-looking-at-if-then)
1357 (f90-looking-at-where-or-forall))
1358 (setq count (1- count))))
1359 (if (> num 0) (end-of-line)
1360 (beginning-of-line)))))
1361
1362
1363(defun f90-previous-block (&optional num)
1364 "Move point backward to the previous end or start of a code block.
1365With optional argument NUM, go backward that many blocks.
1366If NUM is negative, go forwards.
1367A block is a subroutine, if-endif, etc."
1362 (interactive "p") 1368 (interactive "p")
1363 (if (and num (< num 0)) (f90-next-block-end (- num))) 1369 (f90-next-block (- (or num 1))))
1364 (let ((count (or num 1)))
1365 (while (and (> count 0) (re-search-backward f90-blocks-re nil 'move))
1366 (beginning-of-line)
1367 (skip-chars-forward " \t0-9")
1368 (or (f90-in-string) (f90-in-comment)
1369 (and (or (f90-looking-at-do)
1370 (f90-looking-at-select-case)
1371 (f90-looking-at-type-like)
1372 (f90-looking-at-program-block-start)
1373 (f90-looking-at-if-then)
1374 (f90-looking-at-where-or-forall))
1375 (setq count (1- count)))))))
1376 1370
1377 1371
1378(defvar f90-mark-subprogram-overlay nil 1372(defvar f90-mark-subprogram-overlay nil