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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ivan Shmakov <ivan <at> siamics.net>
Subject: bug#18246: closed (Re: bug#18246: enriched-encode: should set
 inhibit-point-motion-hooks, too )
Date: Sat, 14 Feb 2015 08:33:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#18246: enriched-encode: should set inhibit-point-motion-hooks, too 

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 18246 <at> debbugs.gnu.org.

-- 
18246: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18246
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ivan Shmakov <ivan <at> siamics.net>
To: 18246-done <at> debbugs.gnu.org
Subject: Re: bug#18246: enriched-encode: should set inhibit-point-motion-hooks, too 
Date: Sat, 14 Feb 2015 08:31:56 +0000
Version: 25.1

>>>>> Stefan Monnier <monnier <at> iro.umontreal.ca> 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

[Message part 3 (message/rfc822, inline)]
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 4 (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 5 (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.