emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master e3ef1f8 267/433: Collapsed undo of insertion into one comm


From: Dmitry Gutov
Subject: [elpa] master e3ef1f8 267/433: Collapsed undo of insertion into one command.
Date: Thu, 15 Mar 2018 19:44:18 -0400 (EDT)

branch: master
commit e3ef1f83064d25e7c64a897be9fd3791bb37b342
Author: viritrilbia <viritrilbia>
Commit: viritrilbia <viritrilbia>

    Collapsed undo of insertion into one command.
---
 mmm-cmds.el | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/mmm-cmds.el b/mmm-cmds.el
index cbe677c..893214a 100644
--- a/mmm-cmds.el
+++ b/mmm-cmds.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2000 by Michael Abraham Shulman
 
 ;; Author: Michael Abraham Shulman <address@hidden>
-;; Version: $Id: mmm-cmds.el,v 1.17 2003/03/09 17:04:03 viritrilbia Exp $
+;; Version: $Id: mmm-cmds.el,v 1.18 2003/03/25 21:48:33 viritrilbia Exp $
 
 ;;{{{ GPL
 
@@ -267,7 +267,8 @@ or a symbol such as tab, return, etc. Note that if there 
are no
 MODIFIERS, the dotted list becomes simply BASIC-KEY."
   (multiple-value-bind (class skel str) (mmm-get-insertion-spec key)
     (when skel
-      (let ((after-change-functions nil))
+      (let ((after-change-functions nil)
+            (old-undo buffer-undo-list) undo)
         ;; XEmacs' skeleton doesn't manage positions by itself, so we
         ;; have to do it.
         (if mmm-xemacs (setq skeleton-positions nil))
@@ -325,7 +326,15 @@ MODIFIERS, the dotted list becomes simply BASIC-KEY."
 ;;;             :end-sticky (plist-get class :end-sticky)
              :beg-sticky t :end-sticky t
              :creation-hook (plist-get class :creation-hook))
-            (mmm-enable-font-lock submode)))))))
+            (mmm-enable-font-lock submode)))
+        ;; Now get rid of intermediate undo boundaries, so that the entire
+        ;; insertion can be undone as one action.  This should really be
+        ;; skeleton's job, but it doesn't do it.
+        (setq undo buffer-undo-list)
+        (while (not (eq (cdr undo) old-undo))
+          (when (eq (cadr undo) nil)
+            (setcdr undo (cddr undo)))
+          (setq undo (cdr undo)))))))
 
 (defun mmm-get-insertion-spec (key &optional classlist)
   "Get the insertion info for KEY from all classes in CLASSLIST.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]