all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* MH-E patch to support nmh 1.5
@ 2014-09-29  4:21 Mike Kupfer
  2014-09-30  5:27 ` Bill Wohler
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Kupfer @ 2014-09-29  4:21 UTC (permalink / raw)
  To: emacs-devel

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

Attached is a Bazaar bundle for emacs-24, to fix MH-E to work with
nmh-1.5 and above.  This is my first Emacs submission, so apologies in
advance for any rookie mistakes.

mike

[-- Attachment #2: bzr bundle --]
[-- Type: text/plain, Size: 8861 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: m.kupfer@acm.org-20140929040526-o9l4xz8v0cgv964w
# target_branch: bzr://bzr.savannah.gnu.org/emacs/emacs-24/
# testament_sha1: dae0aa9c4d55efb8fd1f70ddff82aa23c47c1f04
# timestamp: 2014-09-28 21:05:58 -0700
# base_revision_id: monnier@iro.umontreal.ca-20140927162553-\
#   hjq3w3mbdp5jwa4s
# 
# Begin patch
=== modified file 'lisp/mh-e/ChangeLog'
--- lisp/mh-e/ChangeLog	2014-03-17 00:50:05 +0000
+++ lisp/mh-e/ChangeLog	2014-09-29 04:05:26 +0000
@@ -1,3 +1,19 @@
+2014-09-28  Mike Kupfer  <m.kupfer@acm.org>
+
+	* mh-comp.el (mh-bare-components): Improve the temp folder and
+	file names as per a suggestion from Bill Wohler.  Also address
+	XEmacs compatibility issues: use mm-make-temp-file instead of
+	make-temp-file, and only pass one argument to delete-directory.
+
+2014-09-26  Mike Kupfer  <m.kupfer@acm.org>
+
+	* mh-comp.el (mh-insert-x-face): Ensure that mh-x-face-file is a
+	string before trying to use it (closes SF #474).
+	(mh-bare-components): New function to create a temporary initial
+	components file; replaces mh-find-components.
+	(mh-edit-again, mh-send-sub): Use mh-bare-components instead of
+	mh-find-components (partially closes SF #468).
+
 2014-03-16  Bill Wohler  <wohler@newt.com>
 
 	* mh-folder.el (mh-regenerate-headers): Fix scan: bad message list

=== modified file 'lisp/mh-e/mh-comp.el'
--- lisp/mh-e/mh-comp.el	2014-01-01 07:43:34 +0000
+++ lisp/mh-e/mh-comp.el	2014-09-29 04:05:26 +0000
@@ -411,6 +411,7 @@
   (interactive (list (mh-get-msg-num t)))
   (let* ((from-folder mh-current-folder)
          (config (current-window-configuration))
+         (components-file (mh-bare-components))
          (draft
           (cond ((and mh-draft-folder (equal from-folder mh-draft-folder))
                  (pop-to-buffer (find-file-noselect (mh-msg-filename message))
@@ -467,7 +468,8 @@
            ;; Text field, that's an easy case
            (t
             (mh-modify-header-field field value))))))
-     (mh-components-to-list (mh-find-components)))
+     (mh-components-to-list components-file))
+    (delete-file components-file)
     (goto-char (point-min))
     (save-buffer)
     (mh-compose-and-send-mail
@@ -885,22 +887,6 @@
           (t
            nil))))
 
-(defun mh-find-components ()
-  "Return the path to the components file."
-  (let (components)
-    (cond
-     ((file-exists-p
-       (setq components
-             (expand-file-name mh-comp-formfile mh-user-path)))
-      components)
-     ((file-exists-p
-       (setq components
-             (expand-file-name mh-comp-formfile mh-lib)))
-      components)
-     (t
-      (error "Can't find %s in %s or %s"
-             mh-comp-formfile mh-user-path mh-lib)))))
-
 (defun mh-send-sub (to cc subject config)
   "Do the real work of composing and sending a letter.
 Expects the TO, CC, and SUBJECT fields as arguments.
@@ -910,8 +896,8 @@
     (message "Composing a message...")
     (let ((draft (mh-read-draft
                   "message"
-                  (mh-find-components)
-                  nil)))
+                  (mh-bare-components)
+                  t)))
       (mh-insert-fields "To:" to "Subject:" subject "Cc:" cc)
       (goto-char (point-max))
       (mh-compose-and-send-mail draft "" folder msg-num
@@ -920,6 +906,29 @@
       (mh-letter-mode-message)
       (mh-letter-adjust-point))))
 
+(defun mh-bare-components ()
+  "Generate a temporary, clean components file and return its path."
+  ;; Let comp(1) create the skeleton for us.  This is particularly
+  ;; important with nmh-1.5, because its default "components" needs
+  ;; some processing before it can be used.  Unfortunately, comp(1)
+  ;; doesn't have a -build option.  So, to avoid the possibility of
+  ;; clobbering an existing draft, create a temporary directory and
+  ;; use it as the drafts folder.  Then copy the skeleton to a regular
+  ;; temp file, and return the regular temp file.
+  (let (new
+        (temp-folder (mm-make-temp-file
+                      (concat mh-user-path "draftfolder.") t)))
+    (mh-exec-cmd "comp" "-nowhatnowproc"
+                 "-draftfolder" (format "+%s"
+                                        (file-name-nondirectory temp-folder))
+                 (if (stringp mh-comp-formfile)
+                     (list "-form" mh-comp-formfile)))
+    (setq new (mm-make-temp-file "comp."))
+    (rename-file (concat temp-folder "/" "1") new t)
+    (delete-file (concat temp-folder "/" ".mh_sequences"))
+    (delete-directory temp-folder)
+    new))
+
 (defun mh-read-draft (use initial-contents delete-contents-file)
   "Read draft file into a draft buffer and make that buffer the current one.
 
@@ -1069,7 +1078,8 @@
 (defun mh-insert-x-face ()
   "Append X-Face, Face or X-Image-URL field to header.
 If the field already exists, this function does nothing."
-  (when (and (file-exists-p mh-x-face-file)
+  (when (and (stringp mh-x-face-file)
+             (file-exists-p mh-x-face-file)
              (file-readable-p mh-x-face-file))
     (save-excursion
       (unless (or (mh-position-on-field "X-Face")

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWYqETd8ABsr/gGYzMABe////
e68OwL////BgDC7VfK3ccqjiikqFfc94rdm9l7Vy6d25rdHU7bWywkkpqbR6mieqfoMlHp6myNNU
9PSQMgGEYGowTTCSQjCNE9BExTTUD0g9I0Bo0GgAAAcAwjCaYhgEAyAGEaZMmEYCGgkRBECp/qU9
DTeqfqJqenqnqGnkaZTaRoAAB6mgMlIZAZAA0AAAAAAAAACSIJo0TIKfqZNMmmlT3ohT9J6p+U2p
AaAAxB6jxK2IyDHd1836OWwhJtNDzcIGBgcw7b/yvUND/h49D6HVvUVYVcWczo5Z+JMbqTlT/vB3
+C+B1bdiUZP4eDY34bpOYV7CjyckUMfL7u46uWFCadfG4aA/OUSvfJrbjzEgLCQ22g4TcWxgP8PE
VH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UDjwYYWacdcWdgOiFwSzSgdy3r9
YhwNyzkgG9y8J/4u5IpwoSEVCJu+

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

end of thread, other threads:[~2014-09-30 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-29  4:21 MH-E patch to support nmh 1.5 Mike Kupfer
2014-09-30  5:27 ` Bill Wohler
2014-09-30 15:31   ` Glenn Morris

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.