all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18246: enriched-encode: should set inhibit-point-motion-hooks, too
@ 2014-08-11 12:09 Ivan Shmakov
  2014-08-11 14:47 ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Ivan Shmakov @ 2014-08-11 12:09 UTC (permalink / raw)
  To: 18246

[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 449 bytes --]

--- 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)

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-02-14  8:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-11 12:09 bug#18246: enriched-encode: should set inhibit-point-motion-hooks, too Ivan Shmakov
2014-08-11 14:47 ` Stefan Monnier
2014-08-11 18:57   ` Ivan Shmakov
2014-08-12  3:15   ` Richard Stallman
2014-08-12 14:38     ` Eli Zaretskii
2014-08-13  3:59       ` Richard Stallman
2014-08-13 15:08         ` Eli Zaretskii
2014-08-13 22:50           ` Richard Stallman
2014-08-14 18:14             ` Ivan Shmakov
2014-08-14 18:26               ` Eli Zaretskii
2014-08-14 19:25                 ` Stefan Monnier
2014-08-12 14:53     ` Stefan Monnier
2015-02-14  8:31   ` Ivan Shmakov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.