From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] emacs: compat: backport fix for folding long headers when sending
Date: Sun, 29 Jan 2017 10:04:41 +0000 [thread overview]
Message-ID: <1485684281-2760-3-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1485684281-2760-1-git-send-email-markwalters1009@gmail.com>
This backports the fix from emacs master (commit
77bbca8c82f6e553c42abbfafca28f55fc995d00) to notmuch-emacs to wrap
long headers.
This fixes the test introduced in the previous changeset.
---
emacs/notmuch-compat.el | 28 ++++++++++++++++++++++++----
test/T310-emacs.sh | 1 -
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el
index c3d827a..e71e861 100644
--- a/emacs/notmuch-compat.el
+++ b/emacs/notmuch-compat.el
@@ -1,8 +1,28 @@
-;; Compatibility functions for emacs 23 and 24 pre 24.4
+;; Compatibility functions for earlier versions of emacs
-;; The functions in this file are copied from eamcs 24.4 and are
-;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2014 Free Software
-;; Foundation, Inc.
+;; The functions in this file are copied from more modern versions of
+;; emacs and are Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2017
+;; Free Software Foundation, Inc.
+
+
+
+;; emacs master has a bugfix for folding long headers when sending
+;; messages. Include the fix for earlier versions of emacs. To avoid
+;; interfering with gnus we only run the hook when called from
+;; notmuch-message-mode.
+
+(declare-function mail-header-fold-field "mail-parse" nil)
+
+(unless (fboundp 'message--fold-long-headers)
+ (add-hook 'message-header-hook
+ (lambda ()
+ (when (eq major-mode 'notmuch-message-mode)
+ (goto-char (point-min))
+ (while (not (eobp))
+ (when (and (looking-at "[^:]+:")
+ (> (- (line-end-position) (point)) 998))
+ (mail-header-fold-field))
+ (forward-line 1))))))
(if (fboundp 'setq-local)
(defalias 'notmuch-setq-local 'setq-local)
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 5331514..a486df8 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -209,7 +209,6 @@ EOF
test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "Folding a long header when sending via (fake) SMTP"
-test_subtest_known_broken
long_subject="This is a long subject `seq -s ' ' 1 1000`"
emacs_deliver_message \
"${long_subject}" \
--
2.1.4
next prev parent reply other threads:[~2017-01-29 10:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-29 10:04 [PATCH 0/2] emacs: Fold long headers when sending Mark Walters
2017-01-29 10:04 ` [PATCH 1/2] Test: emacs: test for folding long headers Mark Walters
2017-01-29 10:04 ` Mark Walters [this message]
2017-01-30 16:19 ` [PATCH 0/2] emacs: Fold long headers when sending Tomi Ollila
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485684281-2760-3-git-send-email-markwalters1009@gmail.com \
--to=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.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 public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).