From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: Re: highlight-changes-rotate-faces sets buffer modified flag Date: Wed, 09 May 2007 18:53:46 +0200 Message-ID: <4641FC9A.9080805@gmx.at> References: <46401465.4050803@gmx.at> <4641BD88.7020207@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020509030400060009070001" X-Trace: sea.gmane.org 1178730209 16601 80.91.229.12 (9 May 2007 17:03:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 9 May 2007 17:03:29 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Reindert-Jan Ekker Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 09 19:03:24 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HlpZQ-0002GJ-3a for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 May 2007 19:03:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hlpgd-0001zz-5O for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 May 2007 13:10:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hlpgb-0001xJ-06 for bug-gnu-emacs@gnu.org; Wed, 09 May 2007 13:10:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hlpga-0001uW-30 for bug-gnu-emacs@gnu.org; Wed, 09 May 2007 13:10:44 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HlpgZ-0001u3-RB for bug-gnu-emacs@gnu.org; Wed, 09 May 2007 13:10:43 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1HlpZL-0002Mo-Mp for bug-gnu-emacs@gnu.org; Wed, 09 May 2007 13:03:16 -0400 Original-Received: (qmail invoked by alias); 09 May 2007 17:03:14 -0000 Original-Received: from M3197P023.adsl.highway.telekom.at (EHLO [88.117.47.151]) [88.117.47.151] by mail.gmx.net (mp044) with SMTP; 09 May 2007 19:03:14 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19Zb5RiWYpZN1yxVzytLYmkzqLajK4/h+3D6Ji+2M 7Apfu6xQgx1HMy User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: X-Y-GMX-Trusted: 0 X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15699 Archived-At: This is a multi-part message in MIME format. --------------020509030400060009070001 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > So this is an improved version of my advice: > > (defadvice highlight-changes-rotate-faces (around around-rotate-faces) > (let ((was-modified (buffer-modified-p)) > (saved-undo-list buffer-undo-list) > (buffer-undo-list t)) > ad-do-it > (setq buffer-undo-list saved-undo-list) > (unless was-modified > (set-buffer-modified-p nil)))) > (ad-activate 'highlight-changes-rotate-faces) The following should be sufficient (defadvice highlight-changes-rotate-faces (around around-rotate-faces) (let ((was-modified (buffer-modified-p)) (buffer-undo-list t)) ad-do-it (unless was-modified (set-buffer-modified-p nil)))) (ad-activate 'highlight-changes-rotate-faces) but please check whether undoing / redoing does assign the correct colors. Alternatively you could try to replace your version of `highlight-changes-rotate-faces' with the one I attached. Either you do that directly in hilit-chg.el (recompiling that file) or you add it to your .emacs preceded by a (require 'hilit-chg) line. --------------020509030400060009070001 Content-Type: text/plain; name="highlight-changes-rotate-faces.el" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="highlight-changes-rotate-faces.el" (defun highlight-changes-rotate-faces () "Rotate the faces used by Highlight Changes mode. Current changes are displayed in the face described by the first element of `highlight-changes-face-list', one level older changes are shown in face described by the second element, and so on. Very old changes remain shown in the last face in the list. You can automatically rotate colors when the buffer is saved by adding this function to `write-file-functions' as a buffer-local value. To do this, eval the following in the buffer to be saved: \(add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t)" (interactive) ;; If not in active mode do nothing but don't complain because this ;; may be bound to a hook. (when (eq highlight-changes-mode 'active) (let ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-modification-hooks t)) (unwind-protect (progn ;; ensure hilit-chg-list is made and up to date (hilit-chg-make-list) ;; remove our existing overlays (hilit-chg-hide-changes) ;; for each change text property, increment it (hilit-chg-map-changes 'hilit-chg-bump-change) ;; and display them all if active (if (eq highlight-changes-mode 'active) (hilit-chg-display-changes))) (unless modified (set-buffer-modified-p nil))))) ;; This always returns nil so it is safe to use in write-file-functions nil) --------------020509030400060009070001 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ bug-gnu-emacs mailing list bug-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs --------------020509030400060009070001--