Subject: Re: Own context (was: src mh-e.el,1.395,1.396 ChangeLog,1.1210,1.1211)
From: "Mark D. Baushke" <firstname.lastname@example.org>
X-Mailer: MH-E 7.82+cvs; nmh 1.0.4; GNU Emacs 21.1.1
Date: Mon, 06 Sep 2004 19:58:15 -0700
Bill Wohler <email@example.com> writes:
> Satyaki Das <firstname.lastname@example.org> wrote:
> > Mark D. Baushke <email@example.com> writes:
> > > I also have my own context.
> > >
> > > I think we would do well to have a configuration option for our users to
> > > set their own.
> > >
> > > Note that my own context is created under my home directory because /tmp
> > > is sometimes swept for old files on some of my systems and I would
> > > rather not have it removed out from under me.
> > Yes, mine too (~/Mail/mhe-context). Should be easy enough to add
> > a defcustom to do this.
> Oddly enough, I'm probably the only one around here who hasn't set my
> own context, but then I'm always paranoid about what procmail or I might
> do to screw things up. I think adding our own context is a marvelous
> idea. With this change, I'll be able to sleep at night again ;-).
> I like your filename a lot (~/Mail/mhe-context) as it is consistent with
> mhe-index and context, so let's go with that. Since context is
> customizable in .mh_profile, I agree that we should have a customization
> variable for it as well; mh-context is a clear choice.
> Can everyone who has done this please post your code please? Then we can
> vote on or merge the implementations.
Here is mine. It is probably similar to what other folks have... I used
to have (make-temp-file "~/tmp/mh-e.context.") instead of the odd dance
with ~/tmp and ~ until I ran into a box which replicated some, but not
all of my home directory stuff... Note that `mhpath +` will give you whatever
.mh_profile sets for Path instead of assuming that the default "Path: Mail"
is being used... for example, my .mh_profile uses "Path: .Mail" to avoid
walking into assumptions about what is in Mail by various browsers...
(if (fboundp 'setenv)
(let ((tmpdir (expand-file-name "~/tmp")))
(if (not (and tmpdir
(car (file-attributes tmpdir)))) ; a directory
(setq tmpdir (expand-file-name "~")))
(setenv "MHCONTEXT" (make-temp-file (concat tmpdir "/mh-e.context.")))
(add-hook 'kill-emacs-hook 'mdb-private-mh-kill-context))))
(defun mdb-private-mh-kill-context ()
(let ((filename (getenv "MHCONTEXT")))
(if (and filename
(delete-file (getenv "MHCONTEXT")))))