unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: [R.Ekker@ai.rug.nl: highlight-changes-rotate-faces sets buffer modified flag]
Date: Wed, 16 May 2007 07:59:17 +0200	[thread overview]
Message-ID: <464A9DB5.5010001@gmx.at> (raw)
In-Reply-To: <E1Hntbp-0008MQ-I7@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 173 bytes --]

> First let's see what is best in this specific case.
> Afterward we could see if any part of it is worth generalizing.

The attached patch should handle the specific case.

[-- Attachment #2: hilit-chg.patch --]
[-- Type: text/plain, Size: 2289 bytes --]

*** hilit-chg.el	Tue May 15 20:20:12 2007
--- hilit-chg.el	Tue May 15 20:22:12 2007
***************
*** 790,806 ****
    (interactive)
    ;; If not in active mode do nothing but don't complain because this
    ;; may be bound to a hook.
!   (if (eq highlight-changes-mode 'active)
!       (let ((after-change-functions nil))
! 	;; 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))))
    ;; This always returns nil so it is safe to use in write-file-functions
    nil)

--- 790,826 ----
    (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))
! 	  (inhibit-modification-hooks t))
!       ;; The `modified' related code tries to combine two goals: (1) Record the
!       ;; rotation in `buffer-undo-list' and (2) avoid setting the modified flag
!       ;; of the current buffer due to the rotation.  We do this by inserting (in
!       ;; `buffer-undo-list') entries restoring buffer-modified-p to nil before
!       ;; and after the entry for the rotation.
!       (unless modified
! 	;; Install the "before" entry.
! 	(setq buffer-undo-list
! 	      (cons '(apply restore-buffer-modified-p nil)
! 		    buffer-undo-list)))
!       (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
! 	  ;; Install the "after" entry.
! 	  (setq buffer-undo-list
! 		(cons '(apply restore-buffer-modified-p nil)
! 		      buffer-undo-list))
! 
! 	  (restore-buffer-modified-p nil)))))
    ;; This always returns nil so it is safe to use in write-file-functions
    nil)


[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-05-16  5:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08 18:09 [R.Ekker@ai.rug.nl: highlight-changes-rotate-faces sets buffer modified flag] Richard Stallman
2007-05-08 22:00 ` martin rudalics
2007-05-09 14:26   ` Stefan Monnier
2007-05-09 18:05     ` martin rudalics
2007-05-09 19:24       ` Stefan Monnier
2007-05-09 21:27         ` martin rudalics
2007-05-09 21:34   ` Richard Stallman
2007-05-09 21:58     ` martin rudalics
2007-05-09  6:44 ` martin rudalics
2007-05-09 21:34   ` Richard Stallman
2007-05-09 21:59     ` martin rudalics
2007-05-11  7:44       ` Richard Stallman
2007-05-11  9:11         ` martin rudalics
2007-05-13 17:37           ` Richard Stallman
2007-05-14  9:03             ` martin rudalics
2007-05-15  9:46               ` Richard Stallman
2007-05-16  5:59                 ` martin rudalics [this message]
2007-05-16 14:32                   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=464A9DB5.5010001@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).