comparison lisp/smerge-mode.el @ 104881:98356e8ba345

(smerge-remove-props, smerge-refine): Use with-silent-modifications (bug#4342).
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 08 Sep 2009 19:47:07 +0000
parents afa0e028ba97
children 098f8a47a308
comparison
equal deleted inserted replaced
104880:02bf3383a22f 104881:98356e8ba345
365 ;; highlighted as if it were still a valid conflict. Note that in many 365 ;; highlighted as if it were still a valid conflict. Note that in many
366 ;; important cases (such as the previous example) we're actually called 366 ;; important cases (such as the previous example) we're actually called
367 ;; during font-locking so inhibit-modification-hooks is non-nil, so we 367 ;; during font-locking so inhibit-modification-hooks is non-nil, so we
368 ;; can't just modify the buffer and expect font-lock to be triggered as in: 368 ;; can't just modify the buffer and expect font-lock to be triggered as in:
369 ;; (put-text-property beg end 'smerge-force-highlighting nil) 369 ;; (put-text-property beg end 'smerge-force-highlighting nil)
370 (let ((modified (buffer-modified-p))) 370 (with-silent-modifications
371 (remove-text-properties beg end '(fontified nil)) 371 (remove-text-properties beg end '(fontified nil))))
372 (restore-buffer-modified-p modified)))
373 372
374 (defun smerge-popup-context-menu (event) 373 (defun smerge-popup-context-menu (event)
375 "Pop up the Smerge mode context menu under mouse." 374 "Pop up the Smerge mode context menu under mouse."
376 (interactive "e") 375 (interactive "e")
377 (if (and smerge-mode 376 (if (and smerge-mode
1013 (t 2))) 1012 (t 2)))
1014 (let ((n1 (if (eq part 1) 2 1)) 1013 (let ((n1 (if (eq part 1) 2 1))
1015 (n2 (if (eq part 3) 2 3))) 1014 (n2 (if (eq part 3) 2 3)))
1016 (smerge-ensure-match n1) 1015 (smerge-ensure-match n1)
1017 (smerge-ensure-match n2) 1016 (smerge-ensure-match n2)
1018 (put-text-property (match-beginning 0) (1+ (match-beginning 0)) 1017 (with-silent-modifications
1019 'smerge-refine-part 1018 (put-text-property (match-beginning 0) (1+ (match-beginning 0))
1020 (cons (buffer-chars-modified-tick) part)) 1019 'smerge-refine-part
1020 (cons (buffer-chars-modified-tick) part)))
1021 (smerge-refine-subst (match-beginning n1) (match-end n1) 1021 (smerge-refine-subst (match-beginning n1) (match-end n1)
1022 (match-beginning n2) (match-end n2) 1022 (match-beginning n2) (match-end n2)
1023 '((smerge . refine) 1023 '((smerge . refine)
1024 (face . smerge-refined-change))))) 1024 (face . smerge-refined-change)))))
1025 1025