[mew-int 2930] Re: mewest script and Mail directory

"Diogo F. S. Ramos" <[email protected]> Fri, 05 Nov 2010 01:38:58 -0200 (BRST)
Newsgroups gmane.mail.mew.general
Message-ID <[email protected]>
> I noticed that the e-mail directory is hardcoded as
> "BASEDIR=${HOME}/Mail" in the "mewest" script used for updating the
> hyper estraier message index.  This poses a problem when one uses a
> custom directory for e-mail.
> 
> Maybe this could be adapted so the mewest script takes a parameter,
> which could than be passed from emacs?  Or otherwise, maybe it should
> be mentioned in the documentation.

I thought about what you said and tried your suggestion about the
parameter.

I am not at all familiarized with the code base so it would be cool
with someone could review it.

There is a variable called `mew-mail-path' that this patch uses to
inform where is the BASEDIR to the `mewest' script.

I tried it here and nothing broke, but I can't tell if it will actually
work to a directory other than "~/Mail", as it is the one I am using.

-- 
Diogo F. S. Ramos
mewest-hyper-basedir.patch (text/x-patch, 1.8 KB)
diff --git a/bin/mewest b/bin/mewest
index d710f41..59cc7c7 100755
--- a/bin/mewest
+++ b/bin/mewest
@@ -27,6 +27,7 @@ USAGE: ${PROG} [directory]
   -s specify suffix
   -h help
   -v verbose mode
+  -b base dir
 __HDT__
     exit 1
 }
@@ -104,9 +105,12 @@ case $? in
     ;;
 esac
 
-while getopts "hvs:" OPTION
+while getopts "b:hvs:" OPTION
 do
     case ${OPTION} in
+      b)
+        BASEDIR=${OPTARG}
+        ;;
       h)
         usage
         ;;
@@ -122,7 +126,7 @@ do
     esac
 done
 shift `expr $OPTIND - 1`
-TGTDIR=${1:-${HOME}/Mail}
+TGTDIR=${1:-${BASEDIR}}
 
 trap cleanup_trap 1 2 3 9 15
 
diff --git a/mew-search.el b/mew-search.el
index 71670a0..b7142b2 100644
--- a/mew-search.el
+++ b/mew-search.el
@@ -602,7 +602,7 @@ with a search method."
       (message "\"%s\" does not exist" mew-prog-est-update)
     (message "Hyper Estraier indexing for %s..." folder)
     (let* ((path (file-truename (mew-expand-folder folder)))
-	   (pro (start-process "*Mew EST*" nil mew-prog-est-update "-s" mew-suffix path)))
+	   (pro (start-process "*Mew EST*" nil mew-prog-est-update "-s" mew-suffix "-b" (mew-expand-folder mew-mail-path) path)))
       (set-process-filter pro 'mew-est-index-filter)
       (set-process-sentinel pro 'mew-est-index-sentinel))))
 
@@ -612,7 +612,7 @@ with a search method."
   (if (not (mew-which-exec mew-prog-est-update))
       (message "'%s' does not exist" mew-prog-est-update)
     (message "Hyper Estraier indexing...")
-    (let ((pro (start-process "*Mew EST*" nil mew-prog-est-update "-s" mew-suffix)))
+    (let ((pro (start-process "*Mew EST*" nil mew-prog-est-update "-s" mew-suffix "-b" (mew-expand-folder mew-mail-path))))
       (set-process-filter pro 'mew-est-index-filter)
       (set-process-sentinel pro 'mew-est-index-sentinel))))