[Joerg Jaspert] Bug#922536: notmuch-emacs: notmuch breaks on directory removal

Tomi Ollila tomi.ollila at iki.fi
Thu Feb 21 09:18:16 PST 2019


On Wed, Feb 20 2019, Matt Armstrong wrote:

> Tomi Ollila <tomi.ollila at iki.fi> writes:
>
>> On Sun, Feb 17 2019, David Bremner wrote:
>>
>>> Seems like reasonable complaint. It should be possible to change to
>>> the maildir root, but probably requires shelling out to notmuch
>>> config get the value.
>>
>> Hmm. what does other emacs software do in that case ?
>>
>> Since OTOH I can think of a situation where I run emacs when located
>> on a directory. from *scratch* buffer I launch notmuch-hello, then I
>> press 'm' to compose new mail and c-x i (insert-file) ... Now I'd
>> expect to be located on the same directory instead of my mail buffer
>> is suddenly cd'd to totally different location (*)
>>
>> Tomi
>>
>> (*) that would be comparable annoying like my experience when using
>>     ultimaker cura: have to run it with 
>>     $ HOME=$PWD /path/to/cura $PWD/file.stl
>>     to have it working as i'd expect software to locate input and
>>     output directories/files (it sure never default to current dir)
>
> I think David's original message was not specific about exactly how the
> directory might be changed.  There are two separable questions here:
>
> a) should notmuch-lib.el use whatever `default-directory' was in effect
> when, say, M-x notmuch was run when running notmuch sub-commands
> (i.e. when executing `call-process').
>
> b) if (a) is "no", then in what way should `default-directory' be
> changed?
>
> I think (a) is probably "yes" -- it is possible to run M-x notmuch while
> under any directory, but it makes little sense to run the notmuch
> sub-commands from the same directory.
>
> I think (b) has multiple answers.
>
> 1) The `default-directory' could be set to something predictable each
> notmuch mode (hello, etc.).
>
> 2) The `default-directory' could be let-bound to something reasonable,
> like (expand-file-name "~"), around each call to `call-proccess'.

Yes, (2) this seems pretty good alternative (3) is just... 
Is `(expand-file-name` -part needed: for me default-directory seems to
start with ~ whenever I test-start emacs in subdirectory of $HOME (*)

Tomi

(*) Emacs expands ~ to $HOME (the usual case) -- some other software 
(uses the home directory in password database to expand ~
(e.g. in openssh config example ControlPath ~/.ssh/master-%r@%h:%p).

> 3) Notmuch could limit option (2) to those cases where the current
> diretory seems inaccessible.
>
> I think (2) is probably the best option.
>
> Emacs itself sets a bit of a precedent here.  If `default-directory' is
> a remote file system (I suppose this is tramp?) then `call-process' runs
> the command under "~" instead.
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list