unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links
@ 2011-12-23  4:59 Jameson Graef Rollins
  2011-12-23  7:48 ` David Edmondson
                   ` (2 more replies)
  0 siblings, 3 replies; 35+ messages in thread
From: Jameson Graef Rollins @ 2011-12-23  4:59 UTC (permalink / raw)
  To: Notmuch Mail

Since message-ids necessarily match just a single message, there's no
reason to do a search for the id before viewing the actual message;
the search just becomes an extra screen to click through.  Clicking on
an id: links now just jumps straight to the message itself.
---
This just fixes the subject of the patch, which had a typo.  Sorry.

 emacs/notmuch-show.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 98db8f2..623d521 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -803,7 +803,7 @@ a corresponding notmuch search."
       (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)
       (make-text-button (match-beginning 0) (match-end 0)
 			'action `(lambda (arg)
-				   (notmuch-search ,(match-string-no-properties 0)))
+				   (notmuch-show ,(match-string-no-properties 0)))
 			'follow-link t
 			'help-echo "Mouse-1, RET: search for this message"
 			'face goto-address-mail-face))))
-- 
1.7.7.3

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

* Re: [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links
  2011-12-23  4:59 [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links Jameson Graef Rollins
@ 2011-12-23  7:48 ` David Edmondson
  2011-12-23 10:10   ` Xavier Maillard
  2011-12-24 21:51 ` David Bremner
  2012-01-12 17:20 ` Pieter Praet
  2 siblings, 1 reply; 35+ messages in thread
From: David Edmondson @ 2011-12-23  7:48 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

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

On Thu, 22 Dec 2011 20:59:12 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> Since message-ids necessarily match just a single message, there's no
> reason to do a search for the id before viewing the actual message;
> the search just becomes an extra screen to click through.  Clicking on
> an id: links now just jumps straight to the message itself.

It's often useful to see a message in context, particularly as it's
common for people to reference id:'s when referring to a thread (thread:
is instance local, as I recall).

Is there a simple way from `notmuch-show' to jump out to the result of
`notmuch-search' for the current id:? Maybe we could bind ^ to something
like `notmuch-show-in-context'.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links
  2011-12-23  7:48 ` David Edmondson
@ 2011-12-23 10:10   ` Xavier Maillard
  2011-12-23 10:25     ` David Edmondson
  0 siblings, 1 reply; 35+ messages in thread
From: Xavier Maillard @ 2011-12-23 10:10 UTC (permalink / raw)
  To: David Edmondson, Jameson Graef Rollins, Notmuch Mail

Hi David,

On Fri, 23 Dec 2011 07:48:49 +0000, David Edmondson <dme@dme.org> wrote:
> On Thu, 22 Dec 2011 20:59:12 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > Since message-ids necessarily match just a single message, there's no
> > reason to do a search for the id before viewing the actual message;
> > the search just becomes an extra screen to click through.  Clicking on
> > an id: links now just jumps straight to the message itself.
> 
> It's often useful to see a message in context, particularly as it's
> common for people to reference id:'s when referring to a thread (thread:
> is instance local, as I recall).
> 
> Is there a simple way from `notmuch-show' to jump out to the result of
> `notmuch-search' for the current id:? Maybe we could bind ^ to something
> like `notmuch-show-in-context'.

Why not use a prefix argument to do different thing:

C-u RET -> show in context
RET -> show single message

WDYT ?

/Xavier

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

* Re: [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links
  2011-12-23 10:10   ` Xavier Maillard
@ 2011-12-23 10:25     ` David Edmondson
  0 siblings, 0 replies; 35+ messages in thread
From: David Edmondson @ 2011-12-23 10:25 UTC (permalink / raw)
  To: Xavier Maillard, Jameson Graef Rollins, Notmuch Mail

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

On Fri, 23 Dec 2011 11:10:53 +0100, Xavier Maillard <xavier@maillard.im> wrote:
> Hi David,
> 
> On Fri, 23 Dec 2011 07:48:49 +0000, David Edmondson <dme@dme.org> wrote:
> > On Thu, 22 Dec 2011 20:59:12 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > > Since message-ids necessarily match just a single message, there's no
> > > reason to do a search for the id before viewing the actual message;
> > > the search just becomes an extra screen to click through.  Clicking on
> > > an id: links now just jumps straight to the message itself.
> > 
> > It's often useful to see a message in context, particularly as it's
> > common for people to reference id:'s when referring to a thread (thread:
> > is instance local, as I recall).
> > 
> > Is there a simple way from `notmuch-show' to jump out to the result of
> > `notmuch-search' for the current id:? Maybe we could bind ^ to something
> > like `notmuch-show-in-context'.
> 
> Why not use a prefix argument to do different thing:
> 
> C-u RET -> show in context
> RET -> show single message
> 
> WDYT ?

I was talking nonsense. `notmuch-show' will show the full thread but
only the matching message open.

Jesse: Sorry for the noise - the patch looks good to me.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links
  2011-12-23  4:59 [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links Jameson Graef Rollins
  2011-12-23  7:48 ` David Edmondson
@ 2011-12-24 21:51 ` David Bremner
  2012-01-12 17:20 ` Pieter Praet
  2 siblings, 0 replies; 35+ messages in thread
From: David Bremner @ 2011-12-24 21:51 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

On Thu, 22 Dec 2011 20:59:12 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> Since message-ids necessarily match just a single message, there's no
> reason to do a search for the id before viewing the actual message;
> the search just becomes an extra screen to click through.  Clicking on
> an id: links now just jumps straight to the message itself.

Pushed.

d

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

* Re: [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links
  2011-12-23  4:59 [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links Jameson Graef Rollins
  2011-12-23  7:48 ` David Edmondson
  2011-12-24 21:51 ` David Bremner
@ 2012-01-12 17:20 ` Pieter Praet
  2012-01-12 17:23   ` [PATCH 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
  2017-03-05 11:51   ` [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links David Bremner
  2 siblings, 2 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-12 17:20 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

On Thu, 22 Dec 2011 20:59:12 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> Since message-ids necessarily match just a single message, there's no
> reason to do a search for the id before viewing the actual message;
> the search just becomes an extra screen to click through.  Clicking on
> an id: links now just jumps straight to the message itself.
> ---
> This just fixes the subject of the patch, which had a typo.  Sorry.
> 
>  emacs/notmuch-show.el |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 98db8f2..623d521 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -803,7 +803,7 @@ a corresponding notmuch search."
>        (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)
>        (make-text-button (match-beginning 0) (match-end 0)
>  			'action `(lambda (arg)
> -				   (notmuch-search ,(match-string-no-properties 0)))
> +				   (notmuch-show ,(match-string-no-properties 0)))
>  			'follow-link t
>  			'help-echo "Mouse-1, RET: search for this message"
>  			'face goto-address-mail-face))))
> -- 
> 1.7.7.3

Anti-RSI FTW!

However...  If no message with that id: exists, `notmuch-show'
will drop us to a blank screen.

See id:"87lisjzrsc.fsf@kepler.schwinge.homeip.net" for some mock
'id:' links which demonstrate this nicely.

Patches follow.


Peace

-- 
Pieter

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

* [PATCH 1/3] emacs: s/buttonise/buttonize/g
  2012-01-12 17:20 ` Pieter Praet
@ 2012-01-12 17:23   ` Pieter Praet
  2012-01-12 17:23     ` [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
                       ` (3 more replies)
  2017-03-05 11:51   ` [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links David Bremner
  1 sibling, 4 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-12 17:23 UTC (permalink / raw)
  To: Jameson Graef Rollins; +Cc: Notmuch Mail

"Worldwide, -ize endings prevail in scientific writing and are commonly
used by many international organizations, such as the ISO and the
WHO. The European Union switched from -ize to -ise some years ago in its
English language publications, and this resulted in the coexistence of
the -ize spelling in older legislative acts and the -ise spelling in
more recent ones." ... and other convincing reasons [1].

Let's follow the good example of academic and standards bodies,
instead of the errors of a non-democratic pseudo-authority [2].

[1] http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#Greek-derived_spellings
[2] http://en.wikipedia.org/wiki/Democratic_deficit_in_the_European_Union
---
 emacs/notmuch-show.el |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5502efd..c55a1d1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -797,8 +797,8 @@ current buffer, if possible."
 (defvar notmuch-show-buffer-name nil)
 (make-variable-buffer-local 'notmuch-show-buffer-name)
 
-(defun notmuch-show-buttonise-links (start end)
-  "Buttonise URLs and mail addresses between START and END.
+(defun notmuch-show-buttonize-links (start end)
+  "Buttonize URLs and mail addresses between START and END.
 
 This also turns id:\"<message id>\"-parts into buttons for
 a corresponding notmuch search."
@@ -874,7 +874,7 @@ buffer."
 	  (notmuch-show-insert-forest
 	   (notmuch-query-get-threads basic-args))))
 
-      (jit-lock-register #'notmuch-show-buttonise-links)
+      (jit-lock-register #'notmuch-show-buttonize-links)
 
       ;; Act on visual lines rather than logical lines.
       (visual-line-mode t)
-- 
1.7.8.1

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

* [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2012-01-12 17:23   ` [PATCH 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
@ 2012-01-12 17:23     ` Pieter Praet
  2012-01-16 11:43       ` David Edmondson
  2012-01-12 17:23     ` [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state Pieter Praet
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 35+ messages in thread
From: Pieter Praet @ 2012-01-12 17:23 UTC (permalink / raw)
  To: Jameson Graef Rollins; +Cc: Notmuch Mail

* emacs/notmuch-show.el (notmuch-show-found-target-p): new predicate function
  that uses notmuch(1) 'count' to see if a query turns up any results.

* emacs/notmuch-show.el (notmuch-show-if-found): new function that only shows
  a message/thread if present in the database and otherwise returns an error.

* emacs/notmuch-show.el (notmuch-show-buttonize-links): some deduplication,
  and use new function `notmuch-show-if-found' instead of `notmuch-show'
  to prevent showing a blank screen for Message-Id's which aren't present
  in the database.
---
 emacs/notmuch-show.el |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index c55a1d1..8f12955 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -806,11 +806,14 @@ a corresponding notmuch search."
   (save-excursion
     (goto-char start)
     (while (re-search-forward "id:\\(\"?\\)[^[:space:]\"]+\\1" end t)
+      (let ((message-id (match-string-no-properties 0))
+	    (string-start (match-beginning 0))
+	    (string-end (match-end 0)))
       ;; remove the overlay created by goto-address-mode
-      (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)
-      (make-text-button (match-beginning 0) (match-end 0)
+      (remove-overlays string-start string-end 'goto-address t)
+      (make-text-button string-start string-end
 			'action `(lambda (arg)
-				   (notmuch-show ,(match-string-no-properties 0)))
+				   (notmuch-show-if-found ,message-id))
 			'follow-link t
 			'help-echo "Mouse-1, RET: search for this message"
 			'face goto-address-mail-face))))
@@ -906,6 +909,18 @@ thread id.  If a prefix is given, crypto processing is toggled."
     (notmuch-kill-this-buffer)
     (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
 
+(defun notmuch-show-found-target-p (target)
+  (let ((args `("count" ,target)))
+    (> (string-to-number (substring
+      (with-output-to-string
+        (apply 'call-process notmuch-command nil standard-output nil args))
+      0 -1)) 0)))
+
+(defun notmuch-show-if-found (target &rest args)
+  (if (notmuch-show-found-target-p target nil)
+      (notmuch-show target args)
+    (error (format "Can't find target: %s" target))))
+
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
     (define-key map "c" 'notmuch-show-stash-cc)
-- 
1.7.8.1

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

* [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-12 17:23   ` [PATCH 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
  2012-01-12 17:23     ` [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
@ 2012-01-12 17:23     ` Pieter Praet
  2012-01-16 11:45       ` David Edmondson
  2012-01-16 11:38     ` [PATCH 1/3] emacs: s/buttonise/buttonize/g David Edmondson
  2012-01-25 11:16     ` David Bremner
  3 siblings, 1 reply; 35+ messages in thread
From: Pieter Praet @ 2012-01-12 17:23 UTC (permalink / raw)
  To: Jameson Graef Rollins; +Cc: Notmuch Mail

* emacs/notmuch-show.el (notmuch-show-buttonized-link-present),
* emacs/notmuch-show.el (notmuch-show-buttonized-link-present-and-unread),
* emacs/notmuch-show.el (notmuch-show-buttonized-link-missing):
  new faces for buttonized id: links.

* emacs/notmuch-show.el (notmuch-show-found-target-p): add optional arg
  VERIFY-UNREAD which causes results to be filtered by "tag:unread".

* emacs/notmuch-show.el (notmuch-show-buttonize-links): use different
  face property depending on the result of `notmuch-show-found-target-p',
  causing buttons to present, present-and-unread and missing messages to
  be displayed in a different color.
---
 emacs/notmuch-show.el |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8f12955..25330c4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -797,6 +797,27 @@ current buffer, if possible."
 (defvar notmuch-show-buffer-name nil)
 (make-variable-buffer-local 'notmuch-show-buffer-name)
 
+(defface notmuch-show-buttonized-link-present
+  '((t (:inherit goto-address-mail-face :foreground "blue")))
+  "Face used for buttonized links to messages which are present
+in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-appearance)
+
+(defface notmuch-show-buttonized-link-present-and-unread
+  '((t (:inherit goto-address-mail-face :foreground "green")))
+  "Face used for buttonized links to messages which are present
+in the mail store, and are tagged `unread'."
+  :group 'notmuch-show
+  :group 'notmuch-appearance)
+
+(defface notmuch-show-buttonized-link-missing
+  '((t (:inherit goto-address-mail-face :foreground "red")))
+  "Face used for buttonized links to messages which are NOT
+present in in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-appearance)
+
 (defun notmuch-show-buttonize-links (start end)
   "Buttonize URLs and mail addresses between START and END.
 
@@ -816,7 +837,12 @@ a corresponding notmuch search."
 				   (notmuch-show-if-found ,message-id))
 			'follow-link t
 			'help-echo "Mouse-1, RET: search for this message"
-			'face goto-address-mail-face))))
+			'face (cond
+			       ((notmuch-show-found-target-p message-id t)
+				'notmuch-show-buttonized-link-present-and-unread)
+			       ((notmuch-show-found-target-p message-id)
+				'notmuch-show-buttonized-link-present)
+			       (t 'notmuch-show-buttonized-link-missing)))))))
 
 ;;;###autoload
 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
@@ -909,8 +935,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
     (notmuch-kill-this-buffer)
     (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
 
-(defun notmuch-show-found-target-p (target)
-  (let ((args `("count" ,target)))
+(defun notmuch-show-found-target-p (target &optional verify-unread)
+  (let ((args `("count" ,target ,(if verify-unread "and tag:unread" ""))))
     (> (string-to-number (substring
       (with-output-to-string
         (apply 'call-process notmuch-command nil standard-output nil args))
-- 
1.7.8.1

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

* Re: [PATCH 1/3] emacs: s/buttonise/buttonize/g
  2012-01-12 17:23   ` [PATCH 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
  2012-01-12 17:23     ` [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
  2012-01-12 17:23     ` [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state Pieter Praet
@ 2012-01-16 11:38     ` David Edmondson
  2012-01-25 11:16     ` David Bremner
  3 siblings, 0 replies; 35+ messages in thread
From: David Edmondson @ 2012-01-16 11:38 UTC (permalink / raw)
  To: Pieter Praet, Jameson Graef Rollins; +Cc: Notmuch Mail

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

On Thu, 12 Jan 2012 18:23:43 +0100, Pieter Praet <pieter@praet.org> wrote:
> "Worldwide, -ize endings prevail in scientific writing and are commonly
> used by many international organizations, such as the ISO and the
> WHO. The European Union switched from -ize to -ise some years ago in its
> English language publications, and this resulted in the coexistence of
> the -ize spelling in older legislative acts and the -ise spelling in
> more recent ones." ... and other convincing reasons [1].
> 
> Let's follow the good example of academic and standards bodies,
> instead of the errors of a non-democratic pseudo-authority [2].
> 
> [1] http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#Greek-derived_spellings
> [2] http://en.wikipedia.org/wiki/Democratic_deficit_in_the_European_Union

Reluctantly, +1.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2012-01-12 17:23     ` [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
@ 2012-01-16 11:43       ` David Edmondson
  2012-01-16 16:49         ` Pieter Praet
  0 siblings, 1 reply; 35+ messages in thread
From: David Edmondson @ 2012-01-16 11:43 UTC (permalink / raw)
  To: Pieter Praet, Jameson Graef Rollins; +Cc: Notmuch Mail

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

On Thu, 12 Jan 2012 18:23:44 +0100, Pieter Praet <pieter@praet.org> wrote:
> +      (make-text-button string-start string-end
>  			'action `(lambda (arg)
> -				   (notmuch-show ,(match-string-no-properties 0)))
> +				   (notmuch-show-if-found ,message-id))

I like this, but wonder idly about the performance impact (not enough to
suggest denying it, though).

> +(defun notmuch-show-found-target-p (target)
> +  (let ((args `("count" ,target)))
> +    (> (string-to-number (substring
> +      (with-output-to-string
> +        (apply 'call-process notmuch-command nil standard-output nil args))
> +      0 -1)) 0)))

`substring' seems unnecessary, presuming that it's to get rid of the
carriage return.

> +(defun notmuch-show-if-found (target &rest args)
> +  (if (notmuch-show-found-target-p target nil)
> +      (notmuch-show target args)
> +    (error (format "Can't find target: %s" target))))

`error' will format strings without help.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-12 17:23     ` [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state Pieter Praet
@ 2012-01-16 11:45       ` David Edmondson
  2012-01-16 16:53         ` Pieter Praet
  2012-01-16 16:54         ` Pieter Praet
  0 siblings, 2 replies; 35+ messages in thread
From: David Edmondson @ 2012-01-16 11:45 UTC (permalink / raw)
  To: Pieter Praet, Jameson Graef Rollins; +Cc: Notmuch Mail

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

On Thu, 12 Jan 2012 18:23:45 +0100, Pieter Praet <pieter@praet.org> wrote:
> +			'face (cond
> +			       ((notmuch-show-found-target-p message-id t)
> +				'notmuch-show-buttonized-link-present-and-unread)
> +			       ((notmuch-show-found-target-p message-id)
> +				'notmuch-show-buttonized-link-present)
> +			       (t 'notmuch-show-buttonized-link-missing)))))))

I like it, but worry a bit more about the performance (we're up to two
'notmuch' invocations for a missing or read message).

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2012-01-16 11:43       ` David Edmondson
@ 2012-01-16 16:49         ` Pieter Praet
  2012-01-16 16:51           ` [PATCH v2] " Pieter Praet
  0 siblings, 1 reply; 35+ messages in thread
From: Pieter Praet @ 2012-01-16 16:49 UTC (permalink / raw)
  To: David Edmondson, Jameson Graef Rollins; +Cc: Notmuch Mail

On Mon, 16 Jan 2012 11:43:25 +0000, David Edmondson <dme@dme.org> wrote:
> On Thu, 12 Jan 2012 18:23:44 +0100, Pieter Praet <pieter@praet.org> wrote:
> > +      (make-text-button string-start string-end
> >  			'action `(lambda (arg)
> > -				   (notmuch-show ,(match-string-no-properties 0)))
> > +				   (notmuch-show-if-found ,message-id))
> 
> I like this, but wonder idly about the performance impact (not enough to
> suggest denying it, though).
> 

Hardly noticable (if at all) AFAICT, but yeah, it *does* cost one
extra notmuch(1) invocation at every `push-button' event...

Still, rather that than potentially dumping users in a blank screen IMO.

Can't think of a better solution ATM.

> > +(defun notmuch-show-found-target-p (target)
> > +  (let ((args `("count" ,target)))
> > +    (> (string-to-number (substring
> > +      (with-output-to-string
> > +        (apply 'call-process notmuch-command nil standard-output nil args))
> > +      0 -1)) 0)))
> 
> `substring' seems unnecessary, presuming that it's to get rid of the
> carriage return.
> 

Correct.  Mindless proactiveness, I guess :)  Removed.

> > +(defun notmuch-show-if-found (target &rest args)
> > +  (if (notmuch-show-found-target-p target nil)
> > +      (notmuch-show target args)
> > +    (error (format "Can't find target: %s" target))))
> 
> `error' will format strings without help.

Idem.

Patch follows.


Peace

-- 
Pieter

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

* [PATCH v2] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2012-01-16 16:49         ` Pieter Praet
@ 2012-01-16 16:51           ` Pieter Praet
  2012-01-16 17:06             ` David Edmondson
  0 siblings, 1 reply; 35+ messages in thread
From: Pieter Praet @ 2012-01-16 16:51 UTC (permalink / raw)
  To: David Edmondson, Jameson Graef Rollins; +Cc: Notmuch Mail

* emacs/notmuch-show.el (notmuch-show-found-target-p): new predicate function
  that uses notmuch(1) 'count' to see if a query turns up any results.

* emacs/notmuch-show.el (notmuch-show-if-found): new function that only shows
  a message/thread if present in the database and otherwise returns an error.

* emacs/notmuch-show.el (notmuch-show-buttonize-links): some deduplication,
  and use new function `notmuch-show-if-found' instead of `notmuch-show'
  to prevent showing a blank screen for Message-Id's which aren't present
  in the database.

---

v2:  (corrections by David Edmondson [1])

 - `notmuch-show-found-target-p' : removed useless `substring'.
 - `notmuch-show-if-found' : remove redundant `format'.

... and added a missing closing paren due to badly splitting up the
original commit.

[1] id:"cun7h0r50v6.fsf@hotblack-desiato.hh.sledj.net"


 emacs/notmuch-show.el |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f101d76..7a79d06 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -803,14 +803,17 @@ a corresponding notmuch search."
   (save-excursion
     (goto-char start)
     (while (re-search-forward "id:\\(\"?\\)[^[:space:]\"]+\\1" end t)
-      ;; remove the overlay created by goto-address-mode
-      (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)
-      (make-text-button (match-beginning 0) (match-end 0)
-			'action `(lambda (arg)
-				   (notmuch-show ,(match-string-no-properties 0)))
-			'follow-link t
-			'help-echo "Mouse-1, RET: search for this message"
-			'face goto-address-mail-face))))
+      (let ((message-id (match-string-no-properties 0))
+	    (string-start (match-beginning 0))
+	    (string-end (match-end 0)))
+	;; remove the overlay created by goto-address-mode
+	(remove-overlays string-start string-end 'goto-address t)
+	(make-text-button string-start string-end
+			  'action `(lambda (arg)
+				     (notmuch-show-if-found ,message-id))
+			  'follow-link t
+			  'help-echo "Mouse-1, RET: search for this message"
+			  'face goto-address-mail-face)))))
 
 ;;;###autoload
 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
@@ -903,6 +906,18 @@ thread id.  If a prefix is given, crypto processing is toggled."
     (notmuch-kill-this-buffer)
     (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
 
+(defun notmuch-show-found-target-p (target)
+  (let ((args `("count" ,target)))
+    (> (string-to-number
+	(with-output-to-string
+	  (apply 'call-process notmuch-command nil standard-output nil args)))
+       0)))
+
+(defun notmuch-show-if-found (target &rest args)
+  (if (notmuch-show-found-target-p target)
+      (notmuch-show target args)
+    (error "Can't find target: %s" target)))
+
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
     (define-key map "c" 'notmuch-show-stash-cc)
-- 
1.7.8.1

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

* Re: [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-16 11:45       ` David Edmondson
@ 2012-01-16 16:53         ` Pieter Praet
  2012-01-16 16:54         ` Pieter Praet
  1 sibling, 0 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-16 16:53 UTC (permalink / raw)
  To: David Edmondson, Jameson Graef Rollins; +Cc: Notmuch Mail

On Mon, 16 Jan 2012 11:45:13 +0000, David Edmondson <dme@dme.org> wrote:
> On Thu, 12 Jan 2012 18:23:45 +0100, Pieter Praet <pieter@praet.org> wrote:
> > +			'face (cond
> > +			       ((notmuch-show-found-target-p message-id t)
> > +				'notmuch-show-buttonized-link-present-and-unread)
> > +			       ((notmuch-show-found-target-p message-id)
> > +				'notmuch-show-buttonized-link-present)
> > +			       (t 'notmuch-show-buttonized-link-missing)))))))
> 
> I like it, but worry a bit more about the performance [...]

Rightly so :)

> [...] (we're up to two
> 'notmuch' invocations for a missing or read message).

I'll at least add an option to toggle it.

Patch follows.


Peace

-- 
Pieter

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

* Re: [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-16 11:45       ` David Edmondson
  2012-01-16 16:53         ` Pieter Praet
@ 2012-01-16 16:54         ` Pieter Praet
  2012-01-16 16:57           ` [PATCH] v2 " Pieter Praet
  1 sibling, 1 reply; 35+ messages in thread
From: Pieter Praet @ 2012-01-16 16:54 UTC (permalink / raw)
  To: David Edmondson, Jameson Graef Rollins; +Cc: Notmuch Mail

On Mon, 16 Jan 2012 11:45:13 +0000, David Edmondson <dme@dme.org> wrote:
> On Thu, 12 Jan 2012 18:23:45 +0100, Pieter Praet <pieter@praet.org> wrote:
> > +			'face (cond
> > +			       ((notmuch-show-found-target-p message-id t)
> > +				'notmuch-show-buttonized-link-present-and-unread)
> > +			       ((notmuch-show-found-target-p message-id)
> > +				'notmuch-show-buttonized-link-present)
> > +			       (t 'notmuch-show-buttonized-link-missing)))))))
> 
> I like it, but worry a bit more about the performance [...]

Rightly so :)

> [...] (we're up to two
> 'notmuch' invocations for a missing or read message).

I'll at least add an option to toggle it.

Patch follows.


Peace

-- 
Pieter

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

* [PATCH] v2 emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-16 16:54         ` Pieter Praet
@ 2012-01-16 16:57           ` Pieter Praet
  2012-01-16 17:07             ` David Edmondson
  2012-01-16 21:43             ` Aaron Ecay
  0 siblings, 2 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-16 16:57 UTC (permalink / raw)
  To: David Edmondson, Jameson Graef Rollins; +Cc: Notmuch Mail

* emacs/notmuch-show.el (notmuch-show-buttonized-link-colors):
  new defcustom, allows toggling colorization of buttonized links.

* emacs/notmuch-show.el (notmuch-show-buttonized-link-present),
* emacs/notmuch-show.el (notmuch-show-buttonized-link-present-and-unread),
* emacs/notmuch-show.el (notmuch-show-buttonized-link-missing):
  new faces for buttonized id: links.

* emacs/notmuch-show.el (notmuch-show-found-target-p): add optional arg
  VERIFY-UNREAD which causes results to be filtered by "tag:unread".

* emacs/notmuch-show.el (notmuch-show-buttonize-links): use different
  face property depending on the result of `notmuch-show-found-target-p',
  causing buttons to available, available-and-unread and missing messages
  to be displayed in a different color.

---

v2:

- add `notmuch-show-buttonized-link-colors': new defcustom, allows
  toggling colorization of buttonized links, to address concerns re
  performance.
- ... and some minor refactoring


 emacs/notmuch-show.el |   45 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7a79d06..c6d7e29 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -794,6 +794,38 @@ current buffer, if possible."
 (defvar notmuch-show-buffer-name nil)
 (make-variable-buffer-local 'notmuch-show-buffer-name)
 
+(defcustom notmuch-show-buttonized-link-colors t
+  "Colorize buttonized links depending on their target's state.
+
+Also see `notmuch-show-buttonized-link-available',
+         `notmuch-show-buttonized-link-available-and-unread',
+         `notmuch-show-buttonized-link-missing'.
+
+Might impact performance."
+  :type 'boolean
+  :group 'notmuch-show)
+
+(defface notmuch-show-buttonized-link-available
+  '((t (:inherit goto-address-mail-face :foreground "blue")))
+  "Face used for buttonized links to messages which are present
+in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
+(defface notmuch-show-buttonized-link-available-and-unread
+  '((t (:inherit goto-address-mail-face :foreground "green")))
+  "Face used for buttonized links to messages which are present
+in the mail store, and are tagged `unread'."
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
+(defface notmuch-show-buttonized-link-missing
+  '((t (:inherit goto-address-mail-face :foreground "red")))
+  "Face used for buttonized links to messages which are NOT
+present in in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
 (defun notmuch-show-buttonize-links (start end)
   "Buttonize URLs and mail addresses between START and END.
 
@@ -813,7 +845,14 @@ a corresponding notmuch search."
 				     (notmuch-show-if-found ,message-id))
 			  'follow-link t
 			  'help-echo "Mouse-1, RET: search for this message"
-			  'face goto-address-mail-face)))))
+			  'face (if notmuch-show-buttonized-link-colors
+				    (cond
+				     ((notmuch-show-found-target-p message-id "and tag:unread")
+				      'notmuch-show-buttonized-link-available-and-unread)
+				     ((notmuch-show-found-target-p message-id nil)
+				      'notmuch-show-buttonized-link-available)
+				     (t 'notmuch-show-buttonized-link-missing))
+				  'goto-address-mail-face))))))
 
 ;;;###autoload
 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
@@ -906,8 +945,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
     (notmuch-kill-this-buffer)
     (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
 
-(defun notmuch-show-found-target-p (target)
-  (let ((args `("count" ,target)))
+(defun notmuch-show-found-target-p (target &optional subquery)
+  (let ((args `("count" ,target ,(or subquery ""))))
     (> (string-to-number
 	(with-output-to-string
 	  (apply 'call-process notmuch-command nil standard-output nil args)))
-- 
1.7.8.1

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

* Re: [PATCH v2] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2012-01-16 16:51           ` [PATCH v2] " Pieter Praet
@ 2012-01-16 17:06             ` David Edmondson
  0 siblings, 0 replies; 35+ messages in thread
From: David Edmondson @ 2012-01-16 17:06 UTC (permalink / raw)
  To: Pieter Praet, Jameson Graef Rollins; +Cc: Notmuch Mail

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

+1.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] v2 emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-16 16:57           ` [PATCH] v2 " Pieter Praet
@ 2012-01-16 17:07             ` David Edmondson
  2012-01-16 21:43             ` Aaron Ecay
  1 sibling, 0 replies; 35+ messages in thread
From: David Edmondson @ 2012-01-16 17:07 UTC (permalink / raw)
  To: Pieter Praet, Jameson Graef Rollins; +Cc: Notmuch Mail

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

Nice. +1.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] v2 emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-16 16:57           ` [PATCH] v2 " Pieter Praet
  2012-01-16 17:07             ` David Edmondson
@ 2012-01-16 21:43             ` Aaron Ecay
  2012-01-18 10:08               ` Pieter Praet
  1 sibling, 1 reply; 35+ messages in thread
From: Aaron Ecay @ 2012-01-16 21:43 UTC (permalink / raw)
  To: Pieter Praet, David Edmondson, Jameson Graef Rollins; +Cc: Notmuch Mail

On Mon, 16 Jan 2012 17:57:33 +0100, Pieter Praet <pieter@praet.org> wrote:
> * emacs/notmuch-show.el (notmuch-show-buttonized-link-colors):
>   new defcustom, allows toggling colorization of buttonized links.
> 
> * emacs/notmuch-show.el (notmuch-show-buttonized-link-present),
> * emacs/notmuch-show.el (notmuch-show-buttonized-link-present-and-unread),
> * emacs/notmuch-show.el (notmuch-show-buttonized-link-missing):
>   new faces for buttonized id: links.
> 
> * emacs/notmuch-show.el (notmuch-show-found-target-p): add optional arg
>   VERIFY-UNREAD which causes results to be filtered by "tag:unread".
> 
> * emacs/notmuch-show.el (notmuch-show-buttonize-links): use different
>   face property depending on the result of `notmuch-show-found-target-p',
>   causing buttons to available, available-and-unread and missing messages
>   to be displayed in a different color.

I really like the idea behind this patch, but it has the very small
problem that it colorizes too much.  So in reading this thread, there
are things like “id:’s” and “id:?” that get colored the missing-message
color (a very angry red, by default).  Though this isn’t likely to be a
very frequent problem with email messages that are not on this listserv
:), it would be nice to fix it.  Maybe you could change the regex that
matches id:’s to require a little more structure – an at-sign, perhaps.
Or even requiring more than (say) 5 non-space characters after the
message id would cut down sharply on the false positive rate.

-- 
Aaron Ecay

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

* Re: [PATCH] v2 emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-16 21:43             ` Aaron Ecay
@ 2012-01-18 10:08               ` Pieter Praet
  2012-01-18 12:48                 ` [PATCH 3/3 v3] " Pieter Praet
  2012-01-20 19:15                 ` [PATCH] v2 " Mark Anderson
  0 siblings, 2 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-18 10:08 UTC (permalink / raw)
  To: Aaron Ecay, David Edmondson, Jameson Graef Rollins; +Cc: Notmuch Mail

On Mon, 16 Jan 2012 16:43:06 -0500, Aaron Ecay <aaronecay@gmail.com> wrote:
> On Mon, 16 Jan 2012 17:57:33 +0100, Pieter Praet <pieter@praet.org> wrote:
> > * emacs/notmuch-show.el (notmuch-show-buttonized-link-colors):
> >   new defcustom, allows toggling colorization of buttonized links.
> > 
> > * emacs/notmuch-show.el (notmuch-show-buttonized-link-present),
> > * emacs/notmuch-show.el (notmuch-show-buttonized-link-present-and-unread),
> > * emacs/notmuch-show.el (notmuch-show-buttonized-link-missing):
> >   new faces for buttonized id: links.
> > 
> > * emacs/notmuch-show.el (notmuch-show-found-target-p): add optional arg
> >   VERIFY-UNREAD which causes results to be filtered by "tag:unread".
> > 
> > * emacs/notmuch-show.el (notmuch-show-buttonize-links): use different
> >   face property depending on the result of `notmuch-show-found-target-p',
> >   causing buttons to available, available-and-unread and missing messages
> >   to be displayed in a different color.
> 
> I really like the idea behind this patch, but it has the very small
> problem that it colorizes too much.  So in reading this thread, there
> are things like “id:’s” and “id:?” that get colored the missing-message
> color (a very angry red, by default).  Though this isn’t likely to be a
> very frequent problem with email messages that are not on this listserv
> :), it would be nice to fix it.  [...]

Excellent suggestion!

Amended patch follows.

> [...] Maybe you could change the regex that
> matches id:’s to require a little more structure – an at-sign, perhaps.
> Or even requiring more than (say) 5 non-space characters after the
> message id would cut down sharply on the false positive rate.
> 

Not sure how that would pan out.  It's fairly common behaviour to put
one or more spaces after a inline Message-Id, so I don't think such a
limitation would be warmly recepted.

> -- 
> Aaron Ecay


Peace

-- 
Pieter

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

* [PATCH 3/3 v3] emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-18 10:08               ` Pieter Praet
@ 2012-01-18 12:48                 ` Pieter Praet
  2012-01-20 19:15                 ` [PATCH] v2 " Mark Anderson
  1 sibling, 0 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-18 12:48 UTC (permalink / raw)
  To: Aaron Ecay, David Edmondson, Jameson Graef Rollins; +Cc: Notmuch Mail

* emacs/notmuch-show.el

  (notmuch-show-buttonized-link-colors):
    - new defcustom, allows toggling colorization of buttonized links.

  (notmuch-show-buttonized-link-available),
  (notmuch-show-buttonized-link-available-and-unread),
  (notmuch-show-buttonized-link-missing):
    - new faces for buttonized id: links.

  (notmuch-show-found-target-p):
    - add optional arg SUBQUERY to allow addition filtering,
      eg. with "tag:unread".

  (notmuch-show-buttonize-links):
    - tweak `Message-Id' regexp: less greedy matching.
    - use different face property depending on the result of
      `notmuch-show-found-target-p', causing buttons to available,
      available-and-unread and missing messages to be displayed in
      different colors.
---

[Forgot to cc the list, apologies for the dupes.]

I've also noticed that Message-Id's from `git send-email'
don't get colorized (but do get buttonized) for some reason.
Thus, would appreciate some assistance with the regexp.


v2:

- add `notmuch-show-buttonized-link-colors': new defcustom, allows
  toggling colorization of buttonized links, to address unquestionable
  concerns re performance, voiced by David Edmondson [1].
- ... and some minor refactoring

v3:

- tweak `Message-Id' regexp: mock Message-Id's shouldn't be matched,
  as pointed out by Aaron Ecay [2].


[1] id:"cun4nvv50s6.fsf@hotblack-desiato.hh.sledj.net"
[2] id:"m2sjjfb9xx.fsf@gmail.com"


 emacs/notmuch-show.el |   47 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 244824a..deac9a6 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -798,6 +798,38 @@ current buffer, if possible."
 (defvar notmuch-show-buffer-name nil)
 (make-variable-buffer-local 'notmuch-show-buffer-name)
 
+(defcustom notmuch-show-buttonized-link-colors t
+  "Colorize buttonized links depending on their target's state.
+
+Also see `notmuch-show-buttonized-link-available',
+         `notmuch-show-buttonized-link-available-and-unread',
+         `notmuch-show-buttonized-link-missing'.
+
+Might impact performance."
+  :type 'boolean
+  :group 'notmuch-show)
+
+(defface notmuch-show-buttonized-link-available
+  '((t (:inherit goto-address-mail-face :foreground "blue")))
+  "Face used for buttonized links to messages which are present
+in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
+(defface notmuch-show-buttonized-link-available-and-unread
+  '((t (:inherit goto-address-mail-face :foreground "green")))
+  "Face used for buttonized links to messages which are present
+in the mail store, and are tagged `unread'."
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
+(defface notmuch-show-buttonized-link-missing
+  '((t (:inherit goto-address-mail-face :foreground "red")))
+  "Face used for buttonized links to messages which are NOT
+present in in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
 (defun notmuch-show-buttonize-links (start end)
   "Buttonize URLs and mail addresses between START and END.
 
@@ -806,7 +838,7 @@ a corresponding notmuch search."
   (goto-address-fontify-region start end)
   (save-excursion
     (goto-char start)
-    (while (re-search-forward "id:\\(\"?\\)[^[:space:]\"]+\\1" end t)
+    (while (re-search-forward "id:\\(\"?\\)\[^ \t\"@\]\+@[^ \t\"]\+\\1" end t)
       (let ((message-id (match-string-no-properties 0))
 	    (string-start (match-beginning 0))
 	    (string-end (match-end 0)))
@@ -817,7 +849,14 @@ a corresponding notmuch search."
 				     (notmuch-show-if-found ,message-id))
 			  'follow-link t
 			  'help-echo "Mouse-1, RET: search for this message"
-			  'face goto-address-mail-face)))))
+			  'face (if notmuch-show-buttonized-link-colors
+				    (cond
+				     ((notmuch-show-found-target-p message-id "and tag:unread")
+				      'notmuch-show-buttonized-link-available-and-unread)
+				     ((notmuch-show-found-target-p message-id nil)
+				      'notmuch-show-buttonized-link-available)
+				     (t 'notmuch-show-buttonized-link-missing))
+				  'goto-address-mail-face))))))
 
 ;;;###autoload
 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
@@ -910,8 +949,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
     (notmuch-kill-this-buffer)
     (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
 
-(defun notmuch-show-found-target-p (target)
-  (let ((args `("count" ,target)))
+(defun notmuch-show-found-target-p (target &optional subquery)
+  (let ((args `("count" ,target ,(or subquery ""))))
     (> (string-to-number
 	(with-output-to-string
 	  (apply 'call-process notmuch-command nil standard-output nil args)))
-- 
1.7.8.1

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

* Re: [PATCH] v2 emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-18 10:08               ` Pieter Praet
  2012-01-18 12:48                 ` [PATCH 3/3 v3] " Pieter Praet
@ 2012-01-20 19:15                 ` Mark Anderson
  2012-01-22  8:40                   ` Pieter Praet
  1 sibling, 1 reply; 35+ messages in thread
From: Mark Anderson @ 2012-01-20 19:15 UTC (permalink / raw)
  To: Pieter Praet, Aaron Ecay, David Edmondson, Jameson Graef Rollins
  Cc: Notmuch Mail

On Wed, 18 Jan 2012 04:08:54 -0600, Pieter Praet <pieter@praet.org> wrote:
> On Mon, 16 Jan 2012 16:43:06 -0500, Aaron Ecay <aaronecay@gmail.com> wrote:
> > On Mon, 16 Jan 2012 17:57:33 +0100, Pieter Praet <pieter@praet.org> wrote:
> > [...] Maybe you could change the regex that
> > matches id:’s to require a little more structure – an at-sign, perhaps.
> > Or even requiring more than (say) 5 non-space characters after the
> > message id would cut down sharply on the false positive rate.
> > 
> 
> Not sure how that would pan out.  It's fairly common behaviour to put
> one or more spaces after a inline Message-Id, so I don't think such a
> limitation would be warmly recepted.

I thought this was a suggestion to have more than 5 non-space characters
after the id:, not the full id:LongIdThingHere 

It sounded to me like an attempt to prevent extra false positives and
the confusing buttonizing and notmuch queries that go with them.

-Mark

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

* Re: [PATCH] v2 emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-20 19:15                 ` [PATCH] v2 " Mark Anderson
@ 2012-01-22  8:40                   ` Pieter Praet
  2012-01-22  8:54                     ` [PATCH v4 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
                                       ` (2 more replies)
  0 siblings, 3 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-22  8:40 UTC (permalink / raw)
  To: Mark Anderson, Aaron Ecay, David Edmondson, Jameson Graef Rollins
  Cc: Notmuch Mail

On Fri, 20 Jan 2012 12:15:13 -0700, Mark Anderson <MarkR.Anderson@amd.com> wrote:
> On Wed, 18 Jan 2012 04:08:54 -0600, Pieter Praet <pieter@praet.org> wrote:
> > On Mon, 16 Jan 2012 16:43:06 -0500, Aaron Ecay <aaronecay@gmail.com> wrote:
> > > On Mon, 16 Jan 2012 17:57:33 +0100, Pieter Praet <pieter@praet.org> wrote:
> > > [...] Maybe you could change the regex that
> > > matches id:’s to require a little more structure – an at-sign, perhaps.
> > > Or even requiring more than (say) 5 non-space characters after the
> > > message id would cut down sharply on the false positive rate.
> > > 
> > 
> > Not sure how that would pan out.  It's fairly common behaviour to put
> > one or more spaces after a inline Message-Id, so I don't think such a
> > limitation would be warmly recepted.
> 
> I thought this was a suggestion to have more than 5 non-space characters
> after the id:, not the full id:LongIdThingHere 
> 

Now that you mention it...

I may have taken Aaron's suggestion a bit too literally. :)

> It sounded to me like an attempt to prevent extra false positives and
> the confusing buttonizing and notmuch queries that go with them.
> 
> -Mark
> 


Peace

-- 
Pieter

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

* [PATCH v4 1/3] emacs: s/buttonise/buttonize/g
  2012-01-22  8:40                   ` Pieter Praet
@ 2012-01-22  8:54                     ` Pieter Praet
  2012-01-22  8:54                     ` [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
  2012-01-22  8:54                     ` [PATCH v4 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state Pieter Praet
  2 siblings, 0 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-22  8:54 UTC (permalink / raw)
  To: Mark Anderson, Aaron Ecay, David Edmondson, Jameson Graef Rollins
  Cc: Notmuch Mail

"Worldwide, -ize endings prevail in scientific writing and are commonly
used by many international organizations, such as the ISO and the
WHO. The European Union switched from -ize to -ise some years ago in its
English language publications, and this resulted in the coexistence of
the -ize spelling in older legislative acts and the -ise spelling in
more recent ones." ... and other convincing reasons [1].

Let's follow the good example of academic and standards bodies,
instead of the errors of a non-democratic pseudo-authority [2].

[1] http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#Greek-derived_spellings
[2] http://en.wikipedia.org/wiki/Democratic_deficit_in_the_European_Union
---
 emacs/notmuch-show.el |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e6a5b31..57dd232 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -899,8 +899,8 @@ current buffer, if possible."
 (defvar notmuch-show-buffer-name nil)
 (make-variable-buffer-local 'notmuch-show-buffer-name)
 
-(defun notmuch-show-buttonise-links (start end)
-  "Buttonise URLs and mail addresses between START and END.
+(defun notmuch-show-buttonize-links (start end)
+  "Buttonize URLs and mail addresses between START and END.
 
 This also turns id:\"<message id>\"-parts into buttons for
 a corresponding notmuch search."
@@ -976,7 +976,7 @@ buffer."
 	  (notmuch-show-insert-forest
 	   (notmuch-query-get-threads basic-args))))
 
-      (jit-lock-register #'notmuch-show-buttonise-links)
+      (jit-lock-register #'notmuch-show-buttonize-links)
 
       (run-hooks 'notmuch-show-hook))
 
-- 
1.7.8.1

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

* [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2012-01-22  8:40                   ` Pieter Praet
  2012-01-22  8:54                     ` [PATCH v4 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
@ 2012-01-22  8:54                     ` Pieter Praet
  2012-01-22 11:10                       ` Mark Walters
  2014-05-07 15:22                       ` David Edmondson
  2012-01-22  8:54                     ` [PATCH v4 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state Pieter Praet
  2 siblings, 2 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-22  8:54 UTC (permalink / raw)
  To: Mark Anderson, Aaron Ecay, David Edmondson, Jameson Graef Rollins
  Cc: Notmuch Mail

* emacs/notmuch-show.el (notmuch-show-found-target-p): new predicate function
  that uses notmuch(1) 'count' to see if a query turns up any results.

* emacs/notmuch-show.el (notmuch-show-if-found): new function that only shows
  a message/thread if present in the database and otherwise returns an error.

* emacs/notmuch-show.el (notmuch-show-buttonize-links): some deduplication,
  and use new function `notmuch-show-if-found' instead of `notmuch-show'
  to prevent showing a blank screen for Message-Id's which aren't present
  in the database.
---
 emacs/notmuch-show.el |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 57dd232..972ac79 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -908,14 +908,17 @@ a corresponding notmuch search."
   (save-excursion
     (goto-char start)
     (while (re-search-forward "id:\\(\"?\\)[^[:space:]\"]+\\1" end t)
-      ;; remove the overlay created by goto-address-mode
-      (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)
-      (make-text-button (match-beginning 0) (match-end 0)
-			'action `(lambda (arg)
-				   (notmuch-show ,(match-string-no-properties 0)))
-			'follow-link t
-			'help-echo "Mouse-1, RET: search for this message"
-			'face goto-address-mail-face))))
+      (let ((message-id (match-string-no-properties 0))
+	    (string-start (match-beginning 0))
+	    (string-end (match-end 0)))
+	;; remove the overlay created by goto-address-mode
+	(remove-overlays string-start string-end 'goto-address t)
+	(make-text-button string-start string-end
+			  'action `(lambda (arg)
+				     (notmuch-show-if-found ,message-id))
+			  'follow-link t
+			  'help-echo "Mouse-1, RET: search for this message"
+			  'face goto-address-mail-face)))))
 
 ;;;###autoload
 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
@@ -1005,6 +1008,18 @@ thread id.  If a prefix is given, crypto processing is toggled."
     (notmuch-kill-this-buffer)
     (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
 
+(defun notmuch-show-found-target-p (target)
+  (let ((args `("count" ,target)))
+    (> (string-to-number
+	(with-output-to-string
+	  (apply 'call-process notmuch-command nil standard-output nil args)))
+       0)))
+
+(defun notmuch-show-if-found (target &rest args)
+  (if (notmuch-show-found-target-p target)
+      (notmuch-show target args)
+    (error "Can't find target: %s" target)))
+
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
     (define-key map "c" 'notmuch-show-stash-cc)
-- 
1.7.8.1

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

* [PATCH v4 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state
  2012-01-22  8:40                   ` Pieter Praet
  2012-01-22  8:54                     ` [PATCH v4 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
  2012-01-22  8:54                     ` [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
@ 2012-01-22  8:54                     ` Pieter Praet
  2 siblings, 0 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-22  8:54 UTC (permalink / raw)
  To: Mark Anderson, Aaron Ecay, David Edmondson, Jameson Graef Rollins
  Cc: Notmuch Mail

* emacs/notmuch-show.el

  (notmuch-show-buttonized-link-colors):
    - new defcustom, allows toggling colorization of buttonized links.

  (notmuch-show-buttonized-link-available),
  (notmuch-show-buttonized-link-available-and-unread),
  (notmuch-show-buttonized-link-missing):
    - new faces for buttonized id: links.

  (notmuch-show-found-target-p):
    - add optional arg SUBQUERY to allow addition filtering,
      eg. with "tag:unread".

  (notmuch-show-buttonize-links):
    - tweak `Message-Id' regexp: less greedy matching.
    - use different face property depending on the result of
      `notmuch-show-found-target-p', causing buttons to available,
      available-and-unread and missing messages to be displayed in
      different colors.
---

Updated regexp.

 emacs/notmuch-show.el |   47 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 972ac79..c04fc28 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -899,6 +899,38 @@ current buffer, if possible."
 (defvar notmuch-show-buffer-name nil)
 (make-variable-buffer-local 'notmuch-show-buffer-name)
 
+(defcustom notmuch-show-buttonized-link-colors t
+  "Colorize buttonized links depending on their target's state.
+
+Also see `notmuch-show-buttonized-link-available',
+         `notmuch-show-buttonized-link-available-and-unread',
+         `notmuch-show-buttonized-link-missing'.
+
+Might impact performance."
+  :type 'boolean
+  :group 'notmuch-show)
+
+(defface notmuch-show-buttonized-link-available
+  '((t (:inherit goto-address-mail-face :foreground "blue")))
+  "Face used for buttonized links to messages which are present
+in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
+(defface notmuch-show-buttonized-link-available-and-unread
+  '((t (:inherit goto-address-mail-face :foreground "green")))
+  "Face used for buttonized links to messages which are present
+in the mail store, and are tagged `unread'."
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
+(defface notmuch-show-buttonized-link-missing
+  '((t (:inherit goto-address-mail-face :foreground "red")))
+  "Face used for buttonized links to messages which are NOT
+present in in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
 (defun notmuch-show-buttonize-links (start end)
   "Buttonize URLs and mail addresses between START and END.
 
@@ -907,7 +939,7 @@ a corresponding notmuch search."
   (goto-address-fontify-region start end)
   (save-excursion
     (goto-char start)
-    (while (re-search-forward "id:\\(\"?\\)[^[:space:]\"]+\\1" end t)
+    (while (re-search-forward "id:\\(\"?\\)[^[:space:]\"]+@[^[:space:]\"]\\{3,\\}\\1" end t)
       (let ((message-id (match-string-no-properties 0))
 	    (string-start (match-beginning 0))
 	    (string-end (match-end 0)))
@@ -918,7 +950,14 @@ a corresponding notmuch search."
 				     (notmuch-show-if-found ,message-id))
 			  'follow-link t
 			  'help-echo "Mouse-1, RET: search for this message"
-			  'face goto-address-mail-face)))))
+			  'face (if notmuch-show-buttonized-link-colors
+				    (cond
+				     ((notmuch-show-found-target-p message-id "and tag:unread")
+				      'notmuch-show-buttonized-link-available-and-unread)
+				     ((notmuch-show-found-target-p message-id nil)
+				      'notmuch-show-buttonized-link-available)
+				     (t 'notmuch-show-buttonized-link-missing))
+				  'goto-address-mail-face))))))
 
 ;;;###autoload
 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
@@ -1008,8 +1047,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
     (notmuch-kill-this-buffer)
     (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
 
-(defun notmuch-show-found-target-p (target)
-  (let ((args `("count" ,target)))
+(defun notmuch-show-found-target-p (target &optional subquery)
+  (let ((args `("count" ,target ,(or subquery ""))))
     (> (string-to-number
 	(with-output-to-string
 	  (apply 'call-process notmuch-command nil standard-output nil args)))
-- 
1.7.8.1

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

* Re: [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2012-01-22  8:54                     ` [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
@ 2012-01-22 11:10                       ` Mark Walters
  2012-01-25  0:41                         ` Pieter Praet
  2014-05-07 15:22                       ` David Edmondson
  1 sibling, 1 reply; 35+ messages in thread
From: Mark Walters @ 2012-01-22 11:10 UTC (permalink / raw)
  To: Pieter Praet, Mark Anderson, Aaron Ecay, David Edmondson,
	Jameson Graef Rollins, Austin Clements
  Cc: Notmuch Mail


> * emacs/notmuch-show.el (notmuch-show-if-found): new function that only shows
>   a message/thread if present in the database and otherwise returns an error.

I like this in principle but it interacts awkwardly with the automatic tag
exclusion. If the id:<message-id> matches a message with an excluded tag
then notmuch-show-if-found will not let you view it, but if you typed the
same search in a search field it would show you the message. 

Note notmuch show currently does not currently respect excluded tags (see
id:"871uqvgrnm.fsf@qmul.ac.uk"), and this is not completely trivial to
fix since it is not clear quite what its behaviour should be in some
corner cases.

Perhaps we could have an option like "--include-all" to notmuch
search/count to tell it not to apply the exclusions. On the other hand
that might also be useful as something the user can type in a search box
so a special search term (eg include:all) might be better.

Best wishes

Mark

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

* Re: [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2012-01-22 11:10                       ` Mark Walters
@ 2012-01-25  0:41                         ` Pieter Praet
  0 siblings, 0 replies; 35+ messages in thread
From: Pieter Praet @ 2012-01-25  0:41 UTC (permalink / raw)
  To: Mark Walters, Mark Anderson, Aaron Ecay, David Edmondson,
	Jameson Graef Rollins, Austin Clements
  Cc: Notmuch Mail

On Sun, 22 Jan 2012 11:10:02 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> 
> > * emacs/notmuch-show.el (notmuch-show-if-found): new function that only shows
> >   a message/thread if present in the database and otherwise returns an error.
> 
> I like this in principle but it interacts awkwardly with the automatic tag
> exclusion. If the id:<message-id> matches a message with an excluded tag
> then notmuch-show-if-found will not let you view it, but if you typed the
> same search in a search field it would show you the message. 
> 
> Note notmuch show currently does not currently respect excluded tags (see
> id:"871uqvgrnm.fsf@qmul.ac.uk"), and this is not completely trivial to
> fix since it is not clear quite what its behaviour should be in some
> corner cases.
> 
> Perhaps we could have an option like "--include-all" to notmuch
> search/count to tell it not to apply the exclusions. On the other hand
> that might also be useful as something the user can type in a search box
> so a special search term (eg include:all) might be better.
> 

Hmm, interesting...

Sorry I haven't taken the time to have a look at your patch series yet.
(I probably wouldn't have anything useful to contribute anyway...)

I'll be taking a stab at fixing this when the exclusion-dust settles.

Thanks for pointing it out!


> Best wishes
> 
> Mark
> 
> 


Peace

-- 
Pieter

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

* Re: [PATCH 1/3] emacs: s/buttonise/buttonize/g
  2012-01-12 17:23   ` [PATCH 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
                       ` (2 preceding siblings ...)
  2012-01-16 11:38     ` [PATCH 1/3] emacs: s/buttonise/buttonize/g David Edmondson
@ 2012-01-25 11:16     ` David Bremner
  2012-01-26 13:00       ` Pieter Praet
  3 siblings, 1 reply; 35+ messages in thread
From: David Bremner @ 2012-01-25 11:16 UTC (permalink / raw)
  To: Pieter Praet; +Cc: Notmuch Mail

On Thu, 12 Jan 2012 18:23:43 +0100, Pieter Praet <pieter@praet.org> wrote:
> "Worldwide, -ize endings prevail in scientific writing and are commonly
> used by many international organizations, such as the ISO and the
> WHO. The European Union switched from -ize to -ise some years ago in its
> English language publications, and this resulted in the coexistence of

needs rebasing against master. 

d

P.S. Personally think it's a bit silly, but that might be because I'm
Canadian, and we are all about the inconsistent anglo/american
spelling. But if the consensus is to follow the UN black helicopter
spelling police, ok :).

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

* Re: [PATCH 1/3] emacs: s/buttonise/buttonize/g
  2012-01-25 11:16     ` David Bremner
@ 2012-01-26 13:00       ` Pieter Praet
  2012-01-26 14:34         ` Tomi Ollila
  0 siblings, 1 reply; 35+ messages in thread
From: Pieter Praet @ 2012-01-26 13:00 UTC (permalink / raw)
  To: David Bremner; +Cc: Notmuch Mail

On Wed, 25 Jan 2012 07:16:13 -0400, David Bremner <david@tethera.net> wrote:
> On Thu, 12 Jan 2012 18:23:43 +0100, Pieter Praet <pieter@praet.org> wrote:
> > "Worldwide, -ize endings prevail in scientific writing and are commonly
> > used by many international organizations, such as the ISO and the
> > WHO. The European Union switched from -ize to -ise some years ago in its
> > English language publications, and this resulted in the coexistence of
> 
> needs rebasing against master. 
> 

Actually, it's been superseded by:
  id:"1327222469-29487-1-git-send-email-pieter@praet.org"

> d
> 
> P.S. Personally think it's a bit silly, [...]

Perhaps it is, but then again, spelling errors may be considered as
being indicative of the quality of the project as a whole, so it
wouldn't hurt to keep them to a minimum.

> [...] but that might be because I'm
> Canadian, and we are all about the inconsistent anglo/american
> spelling. [...]

Exactly!

"American and Canadian spelling accepts only -ize endings in
most cases, [...]" [1]  :)

> [...] But if the consensus is to follow the UN black helicopter
> spelling police, ok :).

Follow WHO? (lame pun intended...)


Peace

-- 
Pieter

[1] http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-ise.2C_-ize_.28-isation.2C_-ization.29

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

* Re: [PATCH 1/3] emacs: s/buttonise/buttonize/g
  2012-01-26 13:00       ` Pieter Praet
@ 2012-01-26 14:34         ` Tomi Ollila
  0 siblings, 0 replies; 35+ messages in thread
From: Tomi Ollila @ 2012-01-26 14:34 UTC (permalink / raw)
  To: Pieter Praet, David Bremner; +Cc: Notmuch Mail


I personally like -ise (easier to my mind, 'z' is so "hard" in finnish
language), but -ize is just prevalent in emacs (customiSe, propertiSe)

Tomi

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

* Re: [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2012-01-22  8:54                     ` [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
  2012-01-22 11:10                       ` Mark Walters
@ 2014-05-07 15:22                       ` David Edmondson
  2017-03-05 11:52                         ` David Bremner
  1 sibling, 1 reply; 35+ messages in thread
From: David Edmondson @ 2014-05-07 15:22 UTC (permalink / raw)
  To: Pieter Praet; +Cc: Notmuch Mail

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

[ Trimmed to/cc list. ]

On Sun, Jan 22 2012, Pieter Praet wrote:
> * emacs/notmuch-show.el (notmuch-show-found-target-p): new predicate function
>   that uses notmuch(1) 'count' to see if a query turns up any results.
>
> * emacs/notmuch-show.el (notmuch-show-if-found): new function that only shows
>   a message/thread if present in the database and otherwise returns an error.
>
> * emacs/notmuch-show.el (notmuch-show-buttonize-links): some deduplication,
>   and use new function `notmuch-show-if-found' instead of `notmuch-show'
>   to prevent showing a blank screen for Message-Id's which aren't present
>   in the database.

Mark provided some feedback about this (relating to exclusions), but
more generally there is a problem that `M-x notmuch-show id:doesntexist'
will result in an error ("notmuch-show-message-top: Beginning of
buffer"). That seems like a bug that should be fixed.

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

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

* Re: [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links
  2012-01-12 17:20 ` Pieter Praet
  2012-01-12 17:23   ` [PATCH 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
@ 2017-03-05 11:51   ` David Bremner
  1 sibling, 0 replies; 35+ messages in thread
From: David Bremner @ 2017-03-05 11:51 UTC (permalink / raw)
  To: Pieter Praet, Jameson Graef Rollins, Notmuch Mail

Pieter Praet <pieter@praet.org> writes:

>
> Anti-RSI FTW!
>
> However...  If no message with that id: exists, `notmuch-show'
> will drop us to a blank screen.
>
> See id:"87lisjzrsc.fsf@kepler.schwinge.homeip.net" for some mock
> 'id:' links which demonstrate this nicely.

This old bug seems fixed to me in current notmuch (0.23.7-131-g85df8b39)

d

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

* Re: [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists
  2014-05-07 15:22                       ` David Edmondson
@ 2017-03-05 11:52                         ` David Bremner
  0 siblings, 0 replies; 35+ messages in thread
From: David Bremner @ 2017-03-05 11:52 UTC (permalink / raw)
  To: David Edmondson, Pieter Praet; +Cc: Notmuch Mail

David Edmondson <dme@dme.org> writes:

> [ Trimmed to/cc list. ]
>
> On Sun, Jan 22 2012, Pieter Praet wrote:
>> * emacs/notmuch-show.el (notmuch-show-found-target-p): new predicate function
>>   that uses notmuch(1) 'count' to see if a query turns up any results.
>>
>> * emacs/notmuch-show.el (notmuch-show-if-found): new function that only shows
>>   a message/thread if present in the database and otherwise returns an error.
>>
>> * emacs/notmuch-show.el (notmuch-show-buttonize-links): some deduplication,
>>   and use new function `notmuch-show-if-found' instead of `notmuch-show'
>>   to prevent showing a blank screen for Message-Id's which aren't present
>>   in the database.
>
> Mark provided some feedback about this (relating to exclusions), but
> more generally there is a problem that `M-x notmuch-show id:doesntexist'
> will result in an error ("notmuch-show-message-top: Beginning of
> buffer"). That seems like a bug that should be fixed.

This also now seems fixed in 0.23.7-131-g85df8b39

d

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

end of thread, other threads:[~2017-03-05 11:52 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-23  4:59 [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links Jameson Graef Rollins
2011-12-23  7:48 ` David Edmondson
2011-12-23 10:10   ` Xavier Maillard
2011-12-23 10:25     ` David Edmondson
2011-12-24 21:51 ` David Bremner
2012-01-12 17:20 ` Pieter Praet
2012-01-12 17:23   ` [PATCH 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
2012-01-12 17:23     ` [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
2012-01-16 11:43       ` David Edmondson
2012-01-16 16:49         ` Pieter Praet
2012-01-16 16:51           ` [PATCH v2] " Pieter Praet
2012-01-16 17:06             ` David Edmondson
2012-01-12 17:23     ` [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state Pieter Praet
2012-01-16 11:45       ` David Edmondson
2012-01-16 16:53         ` Pieter Praet
2012-01-16 16:54         ` Pieter Praet
2012-01-16 16:57           ` [PATCH] v2 " Pieter Praet
2012-01-16 17:07             ` David Edmondson
2012-01-16 21:43             ` Aaron Ecay
2012-01-18 10:08               ` Pieter Praet
2012-01-18 12:48                 ` [PATCH 3/3 v3] " Pieter Praet
2012-01-20 19:15                 ` [PATCH] v2 " Mark Anderson
2012-01-22  8:40                   ` Pieter Praet
2012-01-22  8:54                     ` [PATCH v4 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
2012-01-22  8:54                     ` [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
2012-01-22 11:10                       ` Mark Walters
2012-01-25  0:41                         ` Pieter Praet
2014-05-07 15:22                       ` David Edmondson
2017-03-05 11:52                         ` David Bremner
2012-01-22  8:54                     ` [PATCH v4 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state Pieter Praet
2012-01-16 11:38     ` [PATCH 1/3] emacs: s/buttonise/buttonize/g David Edmondson
2012-01-25 11:16     ` David Bremner
2012-01-26 13:00       ` Pieter Praet
2012-01-26 14:34         ` Tomi Ollila
2017-03-05 11:51   ` [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links David Bremner

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).