GNU bug report logs - #18246
enriched-encode: should set inhibit-point-motion-hooks, too

Previous Next

Package: emacs;

Reported by: Ivan Shmakov <ivan <at> siamics.net>

Date: Mon, 11 Aug 2014 12:10:02 UTC

Severity: minor

Tags: patch

Fixed in version 25.1

Done: Ivan Shmakov <ivan <at> siamics.net>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ivan Shmakov <ivan <at> siamics.net>
To: submit <at> debbugs.gnu.org
Subject: enriched-encode: should set inhibit-point-motion-hooks, too 
Date: Mon, 11 Aug 2014 12:09:27 +0000
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/x-diff, inline)]
--- 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)

This bug report was last modified 10 years and 99 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.