unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Cycle-expand all org-style in show-mode and search all
@ 2019-04-03  9:14 Pierre Neidhardt
  2019-04-03 11:11 ` David Edmondson
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Neidhardt @ 2019-04-03  9:14 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

Hi,

Is it possible to cycle-expand-all subtrees in show-mode, à-la Org?

Related: is it possible to search the entire conversation, even when
messages are folded?  If not, the workaround would be to temporarily
expand-all (once the above feature is implemented), and search from
there.

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycle-expand all org-style in show-mode and search all
  2019-04-03  9:14 Cycle-expand all org-style in show-mode and search all Pierre Neidhardt
@ 2019-04-03 11:11 ` David Edmondson
  2019-04-03 11:24   ` Pierre Neidhardt
  0 siblings, 1 reply; 8+ messages in thread
From: David Edmondson @ 2019-04-03 11:11 UTC (permalink / raw)
  To: Pierre Neidhardt, notmuch

On Wednesday, 2019-04-03 at 11:14:42 +02, Pierre Neidhardt wrote:

> Is it possible to cycle-expand-all subtrees in show-mode, à-la Org?

What do you mean by “subtrees”?

M-RET should open all of the messages in the thread, but it doesn't do
anything about regions that are hidden within messages due to washing.

> Related: is it possible to search the entire conversation, even when
> messages are folded?

No.

> If not, the workaround would be to temporarily expand-all (once the
> above feature is implemented), and search from there.

You might also be able to do something with isearch-open-invisible
properties on the overlay used to fold messages.

dme.
-- 
Do I have to tell the story, of a thousand rainy days since we first met?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycle-expand all org-style in show-mode and search all
  2019-04-03 11:11 ` David Edmondson
@ 2019-04-03 11:24   ` Pierre Neidhardt
  2019-04-03 11:41     ` David Edmondson
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Neidhardt @ 2019-04-03 11:24 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]

David Edmondson <dme@dme.org> writes:

>> Is it possible to cycle-expand-all subtrees in show-mode, à-la Org?
>
> What do you mean by “subtrees”?

Example:

- Message 1
  - Message 2
    - Message 3
      - Message 4
  - Message 5
    - Message 6
  - Message 7

With the point on message 2, have a `notmuch-show-open-or-close'
function that opens/closes all message beneath Message 2 (included), but
does not touch the expansion of Message 1, 5, 6 or 7.

> M-RET should open all of the messages in the thread, but it doesn't do
> anything about regions that are hidden within messages due to washing.

Somehow I had misded M-RET... :p  Thanks!

>> Related: is it possible to search the entire conversation, even when
>> messages are folded?
>
> No.
>
>> If not, the workaround would be to temporarily expand-all (once the
>> above feature is implemented), and search from there.
>
> You might also be able to do something with isearch-open-invisible
> properties on the overlay used to fold messages.

I found a bunch of variables, none of which is documented:

Functions:
- isearch-open-overlay-temporary
- isearch-open-necessary-overlays
- outline-isearch-open-invisible

Variables:
- outline-isearch-open-invisible-function

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycle-expand all org-style in show-mode and search all
  2019-04-03 11:24   ` Pierre Neidhardt
@ 2019-04-03 11:41     ` David Edmondson
  2019-04-09 17:25       ` Pierre Neidhardt
  0 siblings, 1 reply; 8+ messages in thread
From: David Edmondson @ 2019-04-03 11:41 UTC (permalink / raw)
  To: Pierre Neidhardt, notmuch

On Wednesday, 2019-04-03 at 13:24:28 +02, Pierre Neidhardt wrote:

>>> Related: is it possible to search the entire conversation, even when
>>> messages are folded?
>>
>> No.
>>
>>> If not, the workaround would be to temporarily expand-all (once the
>>> above feature is implemented), and search from there.
>>
>> You might also be able to do something with isearch-open-invisible
>> properties on the overlay used to fold messages.
>
> I found a bunch of variables, none of which is documented:
>
> Functions:
> - isearch-open-overlay-temporary
> - isearch-open-necessary-overlays
> - outline-isearch-open-invisible
>
> Variables:
> - outline-isearch-open-invisible-function

There is some documentation here:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Invisible-Text.html

dme.
-- 
Please forgive me if I act a little strange, for I know not what I do.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycle-expand all org-style in show-mode and search all
  2019-04-03 11:41     ` David Edmondson
@ 2019-04-09 17:25       ` Pierre Neidhardt
  2019-04-10 10:33         ` Pierre Neidhardt
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Neidhardt @ 2019-04-09 17:25 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

David Edmondson <dme@dme.org> writes:

> https://www.gnu.org/software/emacs/manual/html_node/elisp/Invisible-Text.html

Thanks for the pointer, I'll look into it.

Regarding M-RET, wouldn't it be more useful to make it a toggler that
does not need C-u?
E.g. when all messages are collapsed, open them all and vice-versa


-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycle-expand all org-style in show-mode and search all
  2019-04-09 17:25       ` Pierre Neidhardt
@ 2019-04-10 10:33         ` Pierre Neidhardt
  2019-05-18 12:30           ` Pierre Neidhardt
  2019-06-09 23:34           ` Daniel Kahn Gillmor
  0 siblings, 2 replies; 8+ messages in thread
From: Pierre Neidhardt @ 2019-04-10 10:33 UTC (permalink / raw)
  To: David Edmondson, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 103 bytes --]

The attached patch seems to work.
What do you think?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-Open-matching-folded-messages-when-searching.patch --]
[-- Type: text/x-patch, Size: 820 bytes --]

From c38c46dc751c7f8c9ca3b4034c4013921360afee Mon Sep 17 00:00:00 2001
From: Pierre Neidhardt <mail@ambrevar.xyz>
Date: Wed, 10 Apr 2019 12:31:37 +0200
Subject: [PATCH] emacs: Open matching folded messages when searching

---
 emacs/notmuch-show.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 49fc779d..c96733f1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1618,6 +1618,7 @@ effects."
 
 (defun notmuch-show-message-visible (props visible-p)
   (overlay-put (plist-get props :message-overlay) 'invisible (not visible-p))
+  (overlay-put (plist-get props :message-overlay) 'isearch-open-invisible #'identity)
   (notmuch-show-set-prop :message-visible visible-p props))
 
 (defun notmuch-show-headers-visible (props visible-p)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Cycle-expand all org-style in show-mode and search all
  2019-04-10 10:33         ` Pierre Neidhardt
@ 2019-05-18 12:30           ` Pierre Neidhardt
  2019-06-09 23:34           ` Daniel Kahn Gillmor
  1 sibling, 0 replies; 8+ messages in thread
From: Pierre Neidhardt @ 2019-05-18 12:30 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 67 bytes --]

Friendly ping! :)

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycle-expand all org-style in show-mode and search all
  2019-04-10 10:33         ` Pierre Neidhardt
  2019-05-18 12:30           ` Pierre Neidhardt
@ 2019-06-09 23:34           ` Daniel Kahn Gillmor
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Kahn Gillmor @ 2019-06-09 23:34 UTC (permalink / raw)
  To: Pierre Neidhardt, David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 2773 bytes --]

Hi Pierre--

sorry for the delay in responding here, i'd missed this proposal when it
came in!

I *think* what you're trying to do here is, when reading a thread in
emacs' notmuch-show mode, you want to use "C-s" (I-search?) to find
whatever you're searching for in the folded messages as well as the
expanded ones.  Is that right?  do you always want to search in the
folded messages, or only sometimes?

In my own use of notmuch-emacs, i confess i've appreciated only
searching in expanded messages sometimes, and resented having to use
M-RET to expand-all before searching other times.  I don't know whether
i'd prefer one or the other in any given situation, and i guess i'd like
to be able to switch between them, but i'm not sure how to do that in a
user-friendly way.

On Wed 2019-04-10 12:33:23 +0200, Pierre Neidhardt wrote:
> The attached patch seems to work.
> What do you think?

I don't think i understand well enough what this change is trying to do,
even from reading the thread.  And the commit message itself is
*definitely* not enough to understand what the intent of the patch is.
It certainly doesn't seem to be related to the thread's subject line
"cycle-expand all org-style in show-mode and search all".

We generally try to make notmuch commit messages contain enough
motivation that when you go back and read it a year later you can tell
what you were trying to do here. (some of us are very forgetful!)

You don't need to copy the entire upstream emacs documentation for
invisible text or anything, but it'd be good to have the commit message
explain the problem encountered, and at least point at the mechanism the
patch is using to try to fix it.  Ideally, it should put a little bit of
thought into similar scenarios that it is *not* trying to change, so
that we can tell that it's scoped correctly.

One way to legitimately cut down on the length of the commit message
(and to ensure that your fix doesn't itself get broken later) is to
include a change to the test suite in your commit.  A good addition to
the test suite shows a plausible series of actions, and documents what
the correct output *should* be.  (even better if the use case is broken
before your patch, and fixed afterward!)

So anyway, could you take a stab at regenerate the 

(as an aside, i note that you signed your e-mail to the list, but the
patch appears to be outside the cryptographic signature.  Is seems
suboptimal -- you'd surely like us to evaluate your signature over the
message *including* the patch.  how was this message generated?  if it
was in notmuch-emacs, can you help me to recreate the steps you took so
that maybe we can fix it up or at least document it as a dangerous
path?)

        --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-06-10 11:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03  9:14 Cycle-expand all org-style in show-mode and search all Pierre Neidhardt
2019-04-03 11:11 ` David Edmondson
2019-04-03 11:24   ` Pierre Neidhardt
2019-04-03 11:41     ` David Edmondson
2019-04-09 17:25       ` Pierre Neidhardt
2019-04-10 10:33         ` Pierre Neidhardt
2019-05-18 12:30           ` Pierre Neidhardt
2019-06-09 23:34           ` Daniel Kahn Gillmor

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).