Subject: Re: bug#33208: 26.1; mark-defun gives incorrect results in some fixed format FORTRAN

From: Tomas Nordin <[email-masked]>
Date: Thu, 10 Dec 2020 22:01:11 +0100

Lars Ingebrigtsen <[email-masked]> writes:

> "Fairey, Robin M." <[email-masked]> writes:
>
>> Starting from emacs -Q,
>> - Open a new fixed format fortran file ( C-x C-f t e s t . f o r <RET> )
>> - Populate it with the following text:
>>       SUBROUTINE ONE
>>
>>       END SUBROUTINE
>> C------------------------------------------------------------------------
>>       SUBROUTINE TWO
>>
>>       END SUBROUTINE
>> C------------------------------------------------------------------------
>>       SUBROUTINE THREE
>>
>>       END SUBROUTINE
>>
>> Position point on line 6 (the blank line in TWO), and observe that
>> M-x mark-defun marks TWO and THREE instead of just TWO.
>>
>> Inserting an additional newline between the comment line and the start
>> of TWO results in correct behaviour.
>
> Looks like the interface of beginning-of-defun-function has changed --
> it now takes an optional arg, and fortran-beginning-of-subprogram didn't
> implement that.
>
> I've now fixed that in Emacs 28, and mark-defun now seems to work fine
> for me there.  (I don't know Fortran, so my testing is limited, though.)

But does fortran-beginning-of-subprogram do what it documents now after
the fix when arg < 0?

I cannot recall ever writing anything in Fortran so I should just keep
silent, but I spent much time recently studying the beginning-of-defun
and friends, so this caught my eye.

Best regards
--
Tomas