Subject: bug#25125: 25.1; copyright-fix-years pollutes undo history

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 27 Jul 2019 13:41:46 +0200

Lluís Vilanova <[email-masked]> writes:

> I have setup `copyright-update' to run every time I save a file in prog-mode:
>
>   (add-hook 'prog-mode-hook
>             (lambda ()
>               (add-hook 'before-save-hook
>                         (lambda ()
>                             (save-excursion (copyright-fix-years))))))
>
> Every time it runs in a file that has a copyright, a change is recorded into the
> undo history, even if the function performed no changes at all (i.e., the
> copyright years were already correct).
>
> This makes it quite annoying to go back my modifications history,
> since it keeps jumping up and down between the header and the actual
> code.

(I'm going through older Emacs bug reports that have received no
response.)

I tried testing this by just saying `M-x copyright-fix-years' in a file
where it doesn't do any changes (like lisp/emacs-lisp/edebug.el).  It
didn't record anything in the undo history, so I'm unable to reproduce
this bug in Emacs 27.  Are you still seeing this?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no