Subject: Re: bug#24882: 25.1; edebug-defun fails when lparen in string at BOL

From: Matt Armstrong <[email-masked]>
Date: Wed, 30 Nov 2016 00:48:07 -0800

John Mastro <[email-masked]> writes:

> David Bremner <[email-masked]> wrote:
>> 1) save the following definitions into a file edebug-fail.el
>>
>> (defun edebug-fail ()
>>   "blah"
>>   (glub "foo
>> (bar)"))
>>
>> (defun edebug-success ()
>>   "blah"
>>   (glub "foo (bar)"))
>>
>> 2) emacs -Q edebug-defun.el
>>
>> 3) place the point after the defun for edebug fail
>>
>> 4) run M-x edebug-defun ; observe the next defun, for edebug-success is
>> evaled.
>>
>> 5) Add a space before (bar), repeat step 4. Observe the correct function
>> definition is evaluated
>
> This is caused by the heuristic that an open paren in column zero
> indicates the beginning of a defun, via end-of-defun. If you set
> open-paren-in-column-0-is-defun-start to nil the recipe will work as
> expected (i.e. edebug-defun will evaluate edebug-fail).
>
> Not sure if there's anything that can be reasonably done to improve this
> (other than changing the default for o-p-i-c-0-i-d-s).
>
>         John

Indeed this heuristic appears to be intentional, justified by an apeal
to efficiency.  The Emacs manual uses an example very similar to
`edebug-fail' above as a "what not to do" case:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Left-Margin-Paren.html

David, if you agree with this rationale, mind closing the bug?