/usr/share/common-lisp/source/mcclim/Drei/Persistent/persistent-undo.lisp is in cl-mcclim 0.9.6.dfsg.cvs20100315-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | ;;; -*- mode: lisp -*-
;;;
;;; (c) copyright 2005 by Aleksandar Bakic (a_bakic@yahoo.com)
;;;
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Library General Public
;;; License as published by the Free Software Foundation; either
;;; version 2 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; Library General Public License for more details.
;;;
;;; You should have received a copy of the GNU Library General Public
;;; License along with this library; if not, write to the
;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;;; Boston, MA 02111-1307 USA.
;;; Part of the Undo protocol that works with persistent buffers
(in-package :drei-undo)
(defclass p-undo-mixin ()
((tree :initform (make-instance 'standard-undo-tree) :reader undo-tree)
(undo-accumulate :initform '() :accessor undo-accumulate)
(performing-undo :initform nil :accessor performing-undo)))
(defclass p-undo-record (climacs-undo-record)
((contents :initarg :contents)))
(defun save-p-undo-record (buffer)
(unless (performing-undo buffer)
(push (make-instance
'p-undo-record
:buffer buffer
:contents (slot-value buffer 'drei-buffer::contents))
(undo-accumulate buffer))))
(defmethod insert-buffer-object :before ((buffer p-undo-mixin) offset object)
(declare (ignore offset object))
(save-p-undo-record buffer))
(defmethod insert-buffer-sequence :before ((buffer p-undo-mixin) offset seq)
(declare (ignore offset seq))
(save-p-undo-record buffer))
(defmethod delete-buffer-range :before ((buffer p-undo-mixin) offset n)
(declare (ignore offset n))
(save-p-undo-record buffer))
(defmethod (setf buffer-object) :before (object (buffer p-undo-mixin) offset)
(declare (ignore object offset))
(save-p-undo-record buffer))
(defmethod flip-undo-record ((record p-undo-record))
(with-slots (buffer contents) record
(setf (slot-value buffer 'drei-buffer::contents) contents)
(drei-buffer::filter-and-update
(drei-buffer::cursors buffer)
#'(lambda (c) (flexichain::weak-pointer-value c buffer))
#'(lambda (wpc)
(setf (cursor-pos wpc)
(max 0 (min (cursor-pos wpc) (1- (size buffer)))))))))
|