[Top][All Lists]

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

Re: address@hidden: highlight-changes-rotate-faces sets buffer modified

From: martin rudalics
Subject: Re: address@hidden: highlight-changes-rotate-faces sets buffer modified flag]
Date: Mon, 14 May 2007 11:03:31 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> That sounds good.  However, given that, it seems that explicit changes
> of the highlighting ought not to mark the buffer as modified.

... the OP's problem.

> When these commands are used on an unmodified buffer, perhaps they
> should make undo records, but not mark the buffer as modified, and set
> up the undo records so that undoing them re-marks the buffer as
> unmodified.  That is a strange thing to do, but perhaps it is the least
> strange alternative.
>       If there were a
>     buffer-undo-list entry type which wouldn't set the modified flag ...
> You can make an undo entry that will clear it.

Maybe we could use a macro like

(defmacro with-buffer-undo-unmodified (&rest body)
  "Eval BODY, preserving the current buffer's modified state.
In addition create entries to `buffer-undo-list' in order to not alter
the buffer's modified state during undos and redos."
  (let ((modified (make-symbol "modified")))
    `(let ((,modified
            (or (buffer-modified-p)
                  (setq buffer-undo-list
                        (cons '(apply set-buffer-modified-p nil)
           (progn ,@body)
         (unless ,modified
           (setq buffer-undo-list
                 (cons '(apply set-buffer-modified-p nil)
           (restore-buffer-modified-p nil))))))

reply via email to

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