Subject: bug#67361: 29.1; MH-E: creating a new folder can sometimes fail with a Lisp error

From: Bill Wohler <[email-masked]>
Date: Sat, 30 Dec 2023 15:33:54 -0800

Chris, you are correct. Even if you start up the speedbar before
starting MH-E, MH-E will then update the old speedbar view with an MH
view when a MH-E folder becomes active.

Mike, if you've been running this patch without problems, I'd say commit
it and resolve this issue. Testing for an existing speedbar-buffer seems
like a stronger test than mh-speed-folder-map. I just applied the patch
and hasn't broken anything thus far. I even used the speedbar :-).

Mike Kupfer <[email-masked]> wrote:

> Chris Siebenmann wrote:
> 
> > I believe that if the speedbar is active (which I believe is when
> > speedbar-buffer is non-nil) and you're in MH-E, the speedbar will be
> > showing your MH folder hierarchy instead of anything else. But I'm not
> > 100% sure of this.
> 
> I've lightly tested the patch below and not seen any problems.  What do
> you guys think about it?
> 
> mike
> 
> diff --git a/lisp/mh-e/mh-funcs.el b/lisp/mh-e/mh-funcs.el
> --- a/lisp/mh-e/mh-funcs.el
> +++ b/lisp/mh-e/mh-funcs.el
> @@ -108,7 +108,7 @@
>              (window-config mh-previous-window-config))
>          (mh-set-folder-modified-p t)    ; lock folder to kill it
>          (mh-exec-cmd-daemon "rmf" 'mh-rmf-daemon folder)
> -        (when (boundp 'mh-speed-folder-map)
> +        (when (and (boundp 'speedbar-buffer) speedbar-buffer)
>            (mh-speed-invalidate-map folder))
>          (mh-remove-from-sub-folders-cache folder)
>          (mh-set-folder-modified-p nil)  ; so kill-buffer doesn't complain
> diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el
> --- a/lisp/mh-e/mh-search.el
> +++ b/lisp/mh-e/mh-search.el
> @@ -1569,7 +1569,7 @@
>      (save-excursion (mh-exec-cmd-quiet nil "rmf" chosen-name))
>      (mh-exec-cmd-quiet nil "folder" "-create" "-fast" chosen-name)
>      (mh-remove-from-sub-folders-cache chosen-name)
> -    (when (boundp 'mh-speed-folder-map)
> +    (when (and (boundp 'speedbar-buffer) speedbar-buffer)
>        (mh-speed-add-folder chosen-name))
>      chosen-name))
>  
> diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
> --- a/lisp/mh-e/mh-utils.el
> +++ b/lisp/mh-e/mh-utils.el
> @@ -795,7 +795,7 @@
>               (message "Creating %s" folder-name)
>               (mh-exec-cmd-error nil "folder" folder-name)
>               (mh-remove-from-sub-folders-cache folder-name)
> -             (when (boundp 'mh-speed-folder-map)
> +             (when (and (boundp 'speedbar-buffer) speedbar-buffer)
>                 (mh-speed-add-folder folder-name))
>               (message "Creating %s...done" folder-name))
>              (new-file-flag
> 

-- 
Bill Wohler <[email-masked]> aka <[email-masked]>
http://www.newt.com/wohler/, GnuPG ID:610BD9AD