[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 6d0b2a6: Fix narrow-to-defun in f90-mode
From: |
Lars Ingebrigtsen |
Subject: |
master 6d0b2a6: Fix narrow-to-defun in f90-mode |
Date: |
Sat, 17 Oct 2020 03:43:28 -0400 (EDT) |
branch: master
commit 6d0b2a60f6e3b20c807ae17f4afe8a327bea584b
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix narrow-to-defun in f90-mode
* lisp/progmodes/f90.el (f90-beginning-of-subprogram): Make
narrow-to-defun work better (bug#44042).
---
lisp/progmodes/f90.el | 41 ++++++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index 22f1cfd..1fbbc89 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1649,25 +1649,28 @@ Return (TYPE NAME), or nil if not found."
(interactive)
(let ((count 1) (case-fold-search t) matching-beg)
(beginning-of-line)
- (while (and (> count 0)
- (re-search-backward f90-program-block-re nil 'move))
- (beginning-of-line)
- (skip-chars-forward " \t0-9")
- ;; Check if in string in case using non-standard feature where
- ;; continued strings do not need "&" at start of continuations.
- (cond ((f90-in-string))
- ((setq matching-beg (f90-looking-at-program-block-start))
- (setq count (1- count)))
- ((f90-looking-at-program-block-end)
- (setq count (1+ count)))))
- (beginning-of-line)
- (if (zerop count)
- matching-beg
- ;; Note this includes the case of an un-named main program,
- ;; in which case we go to (point-min).
- (if (called-interactively-p 'interactive)
- (message "No beginning found"))
- nil)))
+ ;; Check whether we're already at the start of a subprogram.
+ (or (f90-looking-at-program-block-start)
+ ;; We're not; search backwards.
+ (while (and (> count 0)
+ (re-search-backward f90-program-block-re nil 'move))
+ (beginning-of-line)
+ (skip-chars-forward " \t0-9")
+ ;; Check if in string in case using non-standard feature where
+ ;; continued strings do not need "&" at start of continuations.
+ (cond ((f90-in-string))
+ ((setq matching-beg (f90-looking-at-program-block-start))
+ (setq count (1- count)))
+ ((f90-looking-at-program-block-end)
+ (setq count (1+ count)))))
+ (beginning-of-line)
+ (if (zerop count)
+ matching-beg
+ ;; Note this includes the case of an un-named main program,
+ ;; in which case we go to (point-min).
+ (if (called-interactively-p 'interactive)
+ (message "No beginning found"))
+ nil))))
(defun f90-end-of-subprogram ()
"Move point to the end of the current subprogram.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 6d0b2a6: Fix narrow-to-defun in f90-mode,
Lars Ingebrigtsen <=