X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/6d0703a01df1ece3fd9ba2a927913d1bcf10d549..54fe3b6ec0557941c5759523b36bfdec21003f77:/lisp/emulation/viper-cmd.el diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index da72b97628..3d9d1cc59f 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -1714,8 +1714,9 @@ invokes the command before that, etc." (let ((inhibit-quit t) tmp tmp2) (setq viper-undo-needs-adjustment nil) - (if (listp buffer-undo-list) - (if (setq tmp (memq viper-buffer-undo-list-mark buffer-undo-list)) + (when (listp buffer-undo-list) + (let ((had-boundary (null (car buffer-undo-list)))) + (if (setq tmp (memq viper-buffer-undo-list-mark buffer-undo-list)) (progn (setq tmp2 (cdr tmp)) ; the part after mark @@ -1728,8 +1729,11 @@ invokes the command before that, etc." (delq viper-buffer-undo-list-mark buffer-undo-list)) ;; restore tail of buffer-undo-list (setq buffer-undo-list (nconc buffer-undo-list tmp2))) - (setq buffer-undo-list (delq nil buffer-undo-list))))) - )) + (setq buffer-undo-list (delq nil buffer-undo-list))) + ;; The top-level loop only adds boundaries if there has been + ;; modifications in the buffer, so make sure we don't accidentally + ;; drop the "final" boundary (bug#22295). + (if had-boundary (undo-boundary))))))) (defun viper-set-complex-command-for-undo () @@ -2127,6 +2131,7 @@ problems." (setq keymap (or keymap minibuffer-local-map) initial (or initial "") + viper-initial initial temp-msg (if default (format "(default %s) " default) ""))