bug#81229: 32.0.50; (vc-mode) log-edit-generate-changelog-from-diff fails on org-mode file check-in

Ihor Radchenko <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <877bm1apw3.fsf@localhost>
Eli Zaretskii <[email protected]> writes:

>> I have been thinking about this for a while, and I am not convinced
>> about "does not have to move point".
>> 
>> end-of-defun in Elisp does not move point in one single case - at eob.
>
> That is exactly a case where it cannot move point.  How is your case
> different?

I am just describing the current existing behavior. (I do no like it).

>> IMHO, throwing a user error would be more useful.
>
> Why?  Signaling an error has various side effects, which are not
> necessarily useful.

> You are in effect inventing your own incompatible interpretation of
> the behavior when there's no next defun.  Why is this a good idea?

It is a common feature of many interactive commands to throw user-error
when they cannot do what they are supposed to do.

(defun end-of-defun (&optional arg interactive)
  "Move forward to next end of defun.

At the end of buffer, **next** end of defun is absent.
So, end-of-defun cannot perform what its own docstring describes.
Thus, it would make sense to signal user-error.
It would also benefit keyboard macros that make use of end-of-defun.
Without signaling error, those macros will inf-loop.

>> That said, end-of-defun-*function* is supposed to do something slightly
>> different -
>> "... the function can assume that point is at the beginning of the defun body.
>> It should move point to the first position after the defun."
>> I have fixed end-of-defun-function in Org to behave as the docstring
>> demands. (Similar for beginning-of-defun-function).
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7bd41df72
>
> Does this fix the issue reported in this bug?

Yes, I believe. But I did not test it as I do not have enough knowledge
of vc-mode to repeat the original reproducer.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.