all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Shmakov <ivan@siamics.net>
To: 18246@debbugs.gnu.org
Subject: bug#18246: enriched-encode: should set inhibit-point-motion-hooks, too
Date: Mon, 11 Aug 2014 12:09:27 +0000	[thread overview]
Message-ID: <87sil3qlc8.fsf@violet.siamics.net> (raw)

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

             reply	other threads:[~2014-08-11 12:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11 12:09 Ivan Shmakov [this message]
2014-08-11 14:47 ` bug#18246: enriched-encode: should set inhibit-point-motion-hooks, too 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sil3qlc8.fsf@violet.siamics.net \
    --to=ivan@siamics.net \
    --cc=18246@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.