From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Kupfer Newsgroups: gmane.emacs.devel Subject: MH-E patch to support nmh 1.5 Date: Sun, 28 Sep 2014 21:21:42 -0700 Message-ID: <21240.1411964502@allegro.localdomain> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1411964531 25507 80.91.229.3 (29 Sep 2014 04:22:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Sep 2014 04:22:11 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 29 06:22:05 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XYSTM-0002Y7-2f for ged-emacs-devel@m.gmane.org; Mon, 29 Sep 2014 06:22:04 +0200 Original-Received: from localhost ([::1]:34180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYSTL-00047x-Ae for ged-emacs-devel@m.gmane.org; Mon, 29 Sep 2014 00:22:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYSTE-00047o-Li for emacs-devel@gnu.org; Mon, 29 Sep 2014 00:22:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYST9-0005RE-PP for emacs-devel@gnu.org; Mon, 29 Sep 2014 00:21:56 -0400 Original-Received: from shell0.rawbw.com ([198.144.192.45]:61106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYST9-0005QL-GS for emacs-devel@gnu.org; Mon, 29 Sep 2014 00:21:51 -0400 Original-Received: from allegro.localdomain (m208-249.dsl.rawbw.com [198.144.208.249]) by shell0.rawbw.com (8.14.4/8.14.4) with ESMTP id s8T4LhSG018003 for ; Sun, 28 Sep 2014 21:21:43 -0700 (PDT) (envelope-from m.kupfer@acm.org) X-Mailer: MH-E 8.5+bzr; nmh 1.5; GNU Emacs 24.3.93 X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 198.144.192.45 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:174790 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=mhe-nmh15-patch.txt Content-Description: bzr bundle # 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 + + * 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 + + * 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 * 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 VHfLiK/segLuP83F5LW+nW7kD3xmbVlpgH6HVhmAZhhhmG7+EHDrpX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