--- Begin Message ---
Subject: |
enriched-encode: should set inhibit-point-motion-hooks, too |
Date: |
Mon, 11 Aug 2014 12:09:27 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Package: emacs
While enriched-encode already sets inhibit-read-only to t to
avoid issues with any text bearing the read-only property [1] in
the encoded part, it doesn’t yet set inhibit-point-motion-hooks,
which easily results in incorrect encoding should text being
encoded contain parts protected with the ‘intangible’ property.
Example:
(with-temp-buffer
(insert "Hello, world!\n")
(re-search-backward "\\<")
(put-text-property (point) (point-max) 'intangible t)
(put-text-property (+ -1 (point)) (+ 1 (point)) 'face 'bold)
(put-text-property (+ 2 (point)) (+ 3 (point)) 'face 'italic)
(enriched-encode (point-min) (point-max) nil)
(buffer-substring-no-properties (point-min) (point-max)))
"Content-Type: text/enriched
Text-Width: 72
Hello,<bold> <</bold>italic>world!
</italic>"
With the trivial patch MIMEd, this results in the following
(correct) string instead:
"Content-Type: text/enriched
Text-Width: 72
Hello,<bold> w</bold>o<italic>r</italic>ld!
"
[1]
http://www.gnu.org/software/emacs/manual/html_node/elisp/Special-Properties.html
--
FSF associate member #7257 http://boycottsystemd.org/ … 3013 B6A0 230E 334A
--- a/lisp/textmodes/enriched.el
+++ b/lisp/textmodes/enriched.el
@@ -314,7 +314,8 @@ the region, and the START and END of each region."
;;;###autoload
(defun enriched-encode (from to orig-buf)
(if enriched-verbose (message "Enriched: encoding document..."))
- (let ((inhibit-read-only t))
+ (let ((inhibit-read-only t)
+ (inhibit-point-motion-hooks t))
(save-restriction
(narrow-to-region from to)
(delete-to-left-margin)
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#18246: enriched-encode: should set inhibit-point-motion-hooks, too |
Date: |
Sat, 14 Feb 2015 08:31:56 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Version: 25.1
>>>>> Stefan Monnier <address@hidden> writes:
[…]
> Your patch is probably OK,
I’ve pushed this change back in January; closing.
commit 172854461531ac7ad11b4490adc148e7a42a9fb3
CommitDate: 2015-01-17 19:34:50 +0000
Fix: inhibit point motion hooks when encoding an enriched document.
* lisp/textmodes/enriched.el (enriched-encode): Use
inhibit-point-motion-hooks in addition to inhibit-read-only.
Fixes: debbugs:18246
[…]
--
FSF associate member #7257 np. Undercurrent — Jami Sieber … B6A0 230E 334A
--- End Message ---