Subject: Re: bug#77263: MH-E: want all folder buffers to use $HOME as default-directory

From: Eli Zaretskii <[email-masked]>
Date: Wed, 26 Mar 2025 14:16:20 +0200

> From: Stephen Gildea <[email-masked]>
> Date: Tue, 25 Mar 2025 14:07:33 -0700
> 
> An MH-E folder buffer inherits the default-directory of the
> buffer you happened to be in when you gave the command 'mh-rmail'.
> 
> This seems arbitrary in general, and inconvenient when the
> current directory happens to be remote.  With a remote
> directory, Emacs tries to do remote things in the background,
> and all I'm trying to do is read my (local) email.
> 
> The following patch would fix the problem.  It introduces a new
> variable 'mh-default-directory', which defaults to $HOME.

Bill, any comments?

> --- a/lisp/mh-e/mh-folder.el
> +++ b/lisp/mh-e/mh-folder.el
> @@ -51,9 +51,12 @@ mh-rmail
>    (interactive "P")
>    (mh-find-path)
>    (if arg
> -      (call-interactively 'mh-visit-folder)
> +      (progn
> +        (call-interactively 'mh-visit-folder)
> +        (cd-absolute mh-default-directory))
>      (unless (get-buffer mh-inbox)
> -      (mh-visit-folder mh-inbox (symbol-name mh-unseen-seq)))
> +      (mh-visit-folder mh-inbox (symbol-name mh-unseen-seq))
> +      (cd-absolute mh-default-directory))
>      (mh-inc-folder)))
>  
>  ;;;###autoload
> @@ -67,6 +70,7 @@ mh-nmail
>    (mh-find-path)                        ; init mh-inbox
>    (if arg
>        (call-interactively 'mh-visit-folder)
> -    (mh-visit-folder mh-inbox)))
> +    (mh-visit-folder mh-inbox))
> +  (cd-absolute mh-default-directory))
>  

I wonder if calling cd-absolute here is really a good idea.  That
function could signal an error, and it insists on the directory being
an existing accessible directory.  Is it a good idea to potentially
screw up starting MH-E if the directory happens to be problematic?
Why not simply set the default-directory of the buffer instead?

However, I'm not using MH-E, so feel free to disregard the above.

Thanks.