Patch for planner-mhe in order to be able to use refiled messages in MH-E

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Patch for planner-mhe in order to be able to use refiled messages in MH-E

Christophe Garion-4
Hi everybody,

Please find a patch for planner-mhe in order to be able to use directly
refiled messages in MH-E as links for a task.

The initial discussion on mh-e-users mailing list is here:
http://sourceforge.net/mailarchive/forum.php?thread_name=18865.1268858262%40henrikfrisk.com&forum_name=mh-e-users

The ChangeLog is the following:

Fix planner-mhe to be able to use refiled messages

* planner-mhe.el (planner-mhe-get-message-real-folder): first verify
  if the message is refiled and in this case use the folder in which the
  message is refiled as "real" folder.

Best,

Christophe

---
 planner-mhe.el |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/planner-mhe.el b/planner-mhe.el
index 3304237..7627d27 100644
--- a/planner-mhe.el
+++ b/planner-mhe.el
@@ -6,7 +6,7 @@
 ;; Author: Christophe Garion <[hidden email]>
 ;; Author: Sandra Jean Chua <[hidden email]>
 ;; Created: <2004-08-09 17:16:57 tof planner-mhe.el>
-;; Time-stamp: <2006-09-28 15:05:05 tof planner-mhe.el>
+;; Time-stamp: <2010-04-28 17:15:39 tof planner-mhe.el>
 ;; Keywords: planner, mh-e
 
 ;; This file is part of Planner.  It is not part of GNU Emacs.
@@ -55,14 +55,26 @@
      (planner-line-end-position))))
 
 (defun planner-mhe-get-message-real-folder ()
-  "Return the name of the current message real folder, so if you use
-  sequences, it will now work."
+  "Return the name of the current message real (or future in case of
+  refile) folder, so if you use sequences or refiles, it will now work."  
   (save-excursion
-    (let* ((folder
+    (let* ((folder            
             (if (equal major-mode 'mh-folder-mode)
-                mh-current-folder
+                ;; first, try to see if the message is refiled
+                (let ((refile-folder
+                       (let ((num (mh-get-msg-num t)))
+                         (loop for seq in mh-refile-list
+                               when (member num (cdr seq)) return (symbol-name (car seq))
+                               finally return nil)
+                         )))
+                  (if refile-folder
+                      refile-folder
+                    mh-current-folder
+                    )
+                  )
               ;; Refer to the show buffer
-              mh-show-folder-buffer))
+              mh-show-folder-buffer)
+            )
            (end-index (min (length mh-index-folder) (length folder))))
       ;; a simple test on mh-index-data does not work, because
       ;; mh-index-data is always nil in a show buffer.
--
1.7.0

--
Christophe Garion          ISAE/DMIA - SUPAERO/IN
[hidden email]             10 avenue Edouard Belin
Tél : (33)5 61 33 80 57    BP 54032
Fax : (33)5 61 33 83 45    31055 Toulouse Cedex 4

_______________________________________________
Planner-el-discuss mailing list
[hidden email]
https://mail.gna.org/listinfo/planner-el-discuss