Rebased on newest emacs-29 and added bug number in commit. Theo