From f26afdb0c543d2fe5299aa7c45a321d63534d687 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 26 Jul 2013 20:29:42 -0400 Subject: [PATCH] * lisp/format.el (format-annotate-function): Handle read-only text properties in the source. Fixes: debbugs:14887 --- lisp/ChangeLog | 5 +++++ lisp/format.el | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0c5b857d374..14af1cfbda9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-07-27 Glenn Morris + + * format.el (format-annotate-function): + Handle read-only text properties in the source. (Bug#14887) + 2013-07-24 Glenn Morris * dired-x.el (dired-mark-extension): Convert comment to doc string. diff --git a/lisp/format.el b/lisp/format.el index 221eaadcdd8..fc8dcb97b01 100644 --- a/lisp/format.el +++ b/lisp/format.el @@ -225,10 +225,12 @@ For most purposes, consider using `format-encode-region' instead." (setq selective-display sel-disp) (set-buffer-multibyte multibyte) (setq buffer-file-coding-system coding-system)) - (copy-to-buffer copy-buf from to) - (set-buffer copy-buf) - (format-insert-annotations write-region-annotations-so-far from) - (format-encode-run-method to-fn (point-min) (point-max) orig-buf) + (let ((inhibit-read-only t)) ; bug#14887 + (copy-to-buffer copy-buf from to) + (set-buffer copy-buf) + (format-insert-annotations write-region-annotations-so-far from) + (format-encode-run-method to-fn (point-min) (point-max) + orig-buf)) (when (buffer-live-p copy-buf) (with-current-buffer copy-buf ;; Set write-region-post-annotation-function to -- 2.39.2