Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!ut-sally!im4u!rutgers!iuvax!pur-ee!uiucdcs!uiucdcsb!liberte From: liberte@uiucdcsb.cs.uiuc.edu Newsgroups: comp.emacs Subject: Re: (treat-as-single-undo) Message-ID: <165400024@uiucdcsb> Date: Wed, 2-Sep-87 12:11:00 EDT Article-I.D.: uiucdcsb.165400024 Posted: Wed Sep 2 12:11:00 1987 Date-Received: Sat, 5-Sep-87 08:26:26 EDT References: <4300001@uiucdcsm> Lines: 50 Nf-ID: #R:uiucdcsm:4300001:uiucdcsb:165400024:000:1438 Nf-From: uiucdcsb.cs.uiuc.edu!liberte Sep 2 11:11:00 1987 In an attempt to satisfy Mr. Grunwald's desire for undo chunking, I wrote the following code which curiously does not work. It would work if the undo-boundary command were changed from a primitive to a lisp funciton. I see no other reasonable way to chunk undos with standard GNU Emacs. dan ----- (defvar undo-chunk-list nil "List of (hopefully) unique information corresponding to each chunk of changes. With this version, the undo-boundary-count is used.") (make-variable-buffer-local 'undo-chunk-list) (defvar undo-boundary-count 0 "Count of undo-boundary calls since the last undo-chunk") (make-variable-buffer-local 'undo-boundary-count) (fset 'primitive-undo-boundary (symbol-function 'undo-boundary)) (defun undo-boundary () "Substitue for the primitive undo-boundary to count undo boundaries" (setq undo-boundary-count (1+ undo-boundary-count)) ; (message "undo-boundary %d" undo-boundary-count) (primitive-undo-boundary) ) (defun mark-undo-chunk "Add undo-chunk info to undo-chunk-list." (setq undo-chunk-list (cons undo-boundary-count undo-chunk-list)) (setq undo-boundary-count 0) ) (defun undo-chunk (n) "Undo N chunks of undos." (interactive "p") (if (> 0 n) (progn (undo-more undo-boundary-count) (setq n (1- n)))) (while (and undo-chunk-list (> n 0)) (undo-more (car undo-chunk-list)) (setq undo-chunk-list (cdr undo-chunk-list)) (setq n (1- n)) ) )