[Top][All Lists]

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

Re: Form to store/recover buffer modified state?

From: Jesper Harder
Subject: Re: Form to store/recover buffer modified state?
Date: Wed, 03 Sep 2003 03:29:29 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Joakim Hove <address@hidden> writes:

> I have some buffer manipulating[1] functions which are wrapped in a
> construct like this:
> (let ((modified (buffer-modified-p)))
>   ;;
>   (lots of code)
>   ;;
>   (if (not modified) (set-buffer-modifed-p nil)))
> To ensure that the buffer is not marked as modified when the function
> has finished executing.  Is there a special form, i.e. resembling
> (save-excursion ) to achieve this?

I don't think there's an existing special form.  But you can always
create you own macro that works like a special form.  Something like:

(defmacro save-modified (&rest body)
  (let ((temp (make-symbol "modified")))
    `(let ((,temp (buffer-modified-p)))
         (unless ,temp
           (set-buffer-modified-p nil))))))

reply via email to

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