From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Ehud Karni" Newsgroups: gmane.emacs.devel Subject: Re: How to avoid put-text-property setting buffer modified flag, and messing with the undo history? Date: Thu, 9 Jun 2011 17:15:23 +0300 Organization: Mivtach-Simon Insurance agencies Message-ID: <201106091415.p59EFNcQ003457@beta.mvs.co.il> References: <871uz6h7vf.fsf@gmail.com> Reply-To: ehud@unix.mvs.co.il NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1307629342 17652 80.91.229.12 (9 Jun 2011 14:22:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Jun 2011 14:22:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: wojciech.meyer@googlemail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 09 16:22:18 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QUg7l-0007Mf-SD for ged-emacs-devel@m.gmane.org; Thu, 09 Jun 2011 16:22:17 +0200 Original-Received: from localhost ([::1]:56681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUg7k-0000PI-Np for ged-emacs-devel@m.gmane.org; Thu, 09 Jun 2011 10:22:16 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUg1I-0007Pg-Gv for emacs-devel@gnu.org; Thu, 09 Jun 2011 10:15:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUg1D-00056v-S1 for emacs-devel@gnu.org; Thu, 09 Jun 2011 10:15:36 -0400 Original-Received: from [193.16.147.12] (port=59435 helo=unix.mvs.co.il) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUg1C-00056B-Vv for emacs-devel@gnu.org; Thu, 09 Jun 2011 10:15:31 -0400 Original-Received: from beta.mvs.co.il (beta [10.253.0.3]) by unix.mvs.co.il (8.13.8/8.13.7) with ESMTP id p59EFOBG020447; Thu, 9 Jun 2011 17:15:25 +0300 Original-Received: from beta.mvs.co.il (localhost [127.0.0.1]) by beta.mvs.co.il (8.14.1/8.14.1) with ESMTP id p59EFO5c003460; Thu, 9 Jun 2011 17:15:24 +0300 Original-Received: (from root@localhost) by beta.mvs.co.il (8.14.1/8.14.1/Submit) id p59EFNcQ003457; Thu, 9 Jun 2011 17:15:23 +0300 In-reply-to: <871uz6h7vf.fsf@gmail.com> (message from Wojciech Meyer on Tue, 07 Jun 2011 00:12:36 +0100) X-Mailer: Emacs 21.3.1 rmail (send-msg 1.109) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 2) X-Received-From: 193.16.147.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:140320 Archived-At: On Tue, 07 Jun 2011 00:12:36 +0100, Wojciech Meyer wrote: > > I'm trying to dynamically color the buffer using text properties. It > works as follows: > [snip] > > 6. For coloring I use text properties, but they change buffer marking it > as modified and altering undo information, and I don't want that. Here is a snippet that i use for exactly the same purpose. I don't know if it is the best solution, but it works. (let ((sbul buffer-undo-list) ;; undo list for selected buffer (bmp (buffer-modified-p)) ;; modify state (buffer-read-only nil)) ;; allow change! (put-text-property P1 P2 'face FACE);; change face (color) (set-buffer-modified-p bmp) ;; restore modify state (setq buffer-undo-list sbul)) ;; restore undo Ehud. -- Ehud Karni Tel: +972-3-7966-561 /"\ Mivtach - Simon Fax: +972-3-7976-561 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ GnuPG: 98EA398D Better Safe Than Sorry