* [PATCH] emacs: Display non-matching authors in italic.
@ 2010-04-28 18:00 David Edmondson
2010-04-28 18:43 ` Jameson Rollins
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: David Edmondson @ 2010-04-28 18:00 UTC (permalink / raw)
To: notmuch
In search mode some messages don't match the search criteria. Show
their authors names in italic.
---
Whilst enjoying knowing which authors match, I disliked the pipe
symbol. This is a proposed improvement.
emacs/notmuch.el | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 7457da9..0a7a398 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -576,6 +576,22 @@ matching will be applied."
(t
(setq tags-faces (cdr tags-faces)))))))))
+(defun notmuch-search-insert-authors (format-string authors)
+ (insert (let* ((formatted-sample (format format-string ""))
+ (formatted-authors (format format-string authors))
+ (truncated-string
+ (if (> (length formatted-authors)
+ (length formatted-sample))
+ (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
+ formatted-authors)))
+ ;; Need to save the match data to avoid interfering with
+ ;; `notmuch-search-process-filter'.
+ (save-match-data
+ (if (string-match "\\(.*\\)|\\(..*\\)" truncated-string)
+ (concat (match-string 1 truncated-string) ","
+ (propertize (match-string 2 truncated-string) 'face 'italic))
+ truncated-string)))))
+
(defun notmuch-search-insert-field (field date count authors subject tags)
(cond
((string-equal field "date")
@@ -583,13 +599,7 @@ matching will be applied."
((string-equal field "count")
(insert (format (cdr (assoc field notmuch-search-result-format)) count)))
((string-equal field "authors")
- (insert (let* ((format-string (cdr (assoc field notmuch-search-result-format)))
- (formatted-sample (format format-string ""))
- (formatted-authors (format format-string authors)))
- (if (> (length formatted-authors)
- (length formatted-sample))
- (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
- formatted-authors))))
+ (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors))
((string-equal field "subject")
(insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
((string-equal field "tags")
--
1.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] emacs: Display non-matching authors in italic.
2010-04-28 18:00 [PATCH] emacs: Display non-matching authors in italic David Edmondson
@ 2010-04-28 18:43 ` Jameson Rollins
2010-04-28 18:55 ` Dirk Hohndel
2010-04-29 6:52 ` [PATCH 1/2] emacs: Display non-matching authors with a different face David Edmondson
2010-04-29 6:52 ` [PATCH 2/2] emacs: Set the `face' property rather than `font-lock-face' David Edmondson
2 siblings, 1 reply; 8+ messages in thread
From: Jameson Rollins @ 2010-04-28 18:43 UTC (permalink / raw)
To: David Edmondson, notmuch
[-- Attachment #1: Type: text/plain, Size: 429 bytes --]
On Wed, 28 Apr 2010 19:00:27 +0100, David Edmondson <dme@dme.org> wrote:
> In search mode some messages don't match the search criteria. Show
> their authors names in italic.
> ---
>
> Whilst enjoying knowing which authors match, I disliked the pipe
> symbol. This is a proposed improvement.
I'm not a big fan of the | as a separator either, fwiw. I find it a
little distracting/confusing for some reason.
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] emacs: Display non-matching authors in italic.
2010-04-28 18:43 ` Jameson Rollins
@ 2010-04-28 18:55 ` Dirk Hohndel
2010-04-28 19:15 ` David Edmondson
0 siblings, 1 reply; 8+ messages in thread
From: Dirk Hohndel @ 2010-04-28 18:55 UTC (permalink / raw)
To: Jameson Rollins, David Edmondson, notmuch
On Wed, 28 Apr 2010 14:43:58 -0400, Jameson Rollins <jrollins@finestructure.net> wrote:
> On Wed, 28 Apr 2010 19:00:27 +0100, David Edmondson <dme@dme.org> wrote:
> > In search mode some messages don't match the search criteria. Show
> > their authors names in italic.
> > ---
> >
> > Whilst enjoying knowing which authors match, I disliked the pipe
> > symbol. This is a proposed improvement.
>
> I'm not a big fan of the | as a separator either, fwiw. I find it a
> little distracting/confusing for some reason.
I'm not a fan of it either (and I implemented this feature). Yet it was
the only character that I could think of that somehow create the visual
separation and that is rare in Author Names and at the same time not
already used (like ';') in notmuch output
/D
--
Dirk Hohndel
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] emacs: Display non-matching authors in italic.
2010-04-28 18:55 ` Dirk Hohndel
@ 2010-04-28 19:15 ` David Edmondson
2010-04-28 19:22 ` Jameson Rollins
0 siblings, 1 reply; 8+ messages in thread
From: David Edmondson @ 2010-04-28 19:15 UTC (permalink / raw)
To: Dirk Hohndel, Jameson Rollins, notmuch
[-- Attachment #1: Type: text/plain, Size: 487 bytes --]
On Wed, 28 Apr 2010 11:55:06 -0700, Dirk Hohndel <hohndel@infradead.org> wrote:
> I'm not a fan of it either (and I implemented this feature). Yet it was
> the only character that I could think of that somehow create the visual
> separation and that is rare in Author Names and at the same time not
> already used (like ';') in notmuch output
We could change that - replace ; with | as the separator in the output
(and vice-versa).
dme.
--
David Edmondson, http://dme.org
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] emacs: Display non-matching authors in italic.
2010-04-28 19:15 ` David Edmondson
@ 2010-04-28 19:22 ` Jameson Rollins
0 siblings, 0 replies; 8+ messages in thread
From: Jameson Rollins @ 2010-04-28 19:22 UTC (permalink / raw)
To: David Edmondson, Dirk Hohndel, notmuch
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
On Wed, 28 Apr 2010 20:15:24 +0100, David Edmondson <dme@dme.org> wrote:
> On Wed, 28 Apr 2010 11:55:06 -0700, Dirk Hohndel <hohndel@infradead.org> wrote:
> > I'm not a fan of it either (and I implemented this feature). Yet it was
> > the only character that I could think of that somehow create the visual
> > separation and that is rare in Author Names and at the same time not
> > already used (like ';') in notmuch output
>
> We could change that - replace ; with | as the separator in the output
> (and vice-versa).
But I like your idea of italicizing the other author names, at least in
theory (will have to try it to be sure).
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] emacs: Display non-matching authors with a different face.
2010-04-28 18:00 [PATCH] emacs: Display non-matching authors in italic David Edmondson
2010-04-28 18:43 ` Jameson Rollins
@ 2010-04-29 6:52 ` David Edmondson
2010-06-03 23:58 ` Carl Worth
2010-04-29 6:52 ` [PATCH 2/2] emacs: Set the `face' property rather than `font-lock-face' David Edmondson
2 siblings, 1 reply; 8+ messages in thread
From: David Edmondson @ 2010-04-29 6:52 UTC (permalink / raw)
To: notmuch
In search mode some messages don't match the search criteria. Show
their authors names with a different face - generally darker than
those that do match.
---
At Sebastian's request, allow the face to be customised.
emacs/notmuch.el | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 7457da9..60c0ee5 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -297,6 +297,17 @@ For a mouse binding, return nil."
"Notmuch search mode face used to highligh tags."
:group 'notmuch)
+(defface notmuch-search-non-matching-authors
+ '((((class color)
+ (background dark))
+ (:foreground "grey30"))
+ (((class color)
+ (background light))
+ (:foreground "grey60"))
+ (t (:italic t)))
+ "Face used in search mode for authors not matching the query."
+ :group 'notmuch)
+
;;;###autoload
(defun notmuch-search-mode ()
"Major mode displaying results of a notmuch search.
@@ -576,6 +587,23 @@ matching will be applied."
(t
(setq tags-faces (cdr tags-faces)))))))))
+(defun notmuch-search-insert-authors (format-string authors)
+ (insert (let* ((formatted-sample (format format-string ""))
+ (formatted-authors (format format-string authors))
+ (truncated-string
+ (if (> (length formatted-authors)
+ (length formatted-sample))
+ (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
+ formatted-authors)))
+ ;; Need to save the match data to avoid interfering with
+ ;; `notmuch-search-process-filter'.
+ (save-match-data
+ (if (string-match "\\(.*\\)|\\(..*\\)" truncated-string)
+ (concat (match-string 1 truncated-string) ","
+ (propertize (match-string 2 truncated-string)
+ 'face 'notmuch-search-non-matching-authors))
+ truncated-string)))))
+
(defun notmuch-search-insert-field (field date count authors subject tags)
(cond
((string-equal field "date")
@@ -583,13 +611,7 @@ matching will be applied."
((string-equal field "count")
(insert (format (cdr (assoc field notmuch-search-result-format)) count)))
((string-equal field "authors")
- (insert (let* ((format-string (cdr (assoc field notmuch-search-result-format)))
- (formatted-sample (format format-string ""))
- (formatted-authors (format format-string authors)))
- (if (> (length formatted-authors)
- (length formatted-sample))
- (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
- formatted-authors))))
+ (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors))
((string-equal field "subject")
(insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
((string-equal field "tags")
--
1.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] emacs: Set the `face' property rather than `font-lock-face'.
2010-04-28 18:00 [PATCH] emacs: Display non-matching authors in italic David Edmondson
2010-04-28 18:43 ` Jameson Rollins
2010-04-29 6:52 ` [PATCH 1/2] emacs: Display non-matching authors with a different face David Edmondson
@ 2010-04-29 6:52 ` David Edmondson
2 siblings, 0 replies; 8+ messages in thread
From: David Edmondson @ 2010-04-29 6:52 UTC (permalink / raw)
To: notmuch
Avoid using face properties reserved for the font-lock package.
---
emacs/notmuch.el | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 60c0ee5..d36a92d 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -438,7 +438,7 @@ and will also appear in a buffer named \"*Notmuch errors*\"."
(let ((end (point)))
(delete-region beg end)
(insert (propertize (mapconcat 'identity tags " ")
- 'font-lock-face 'notmuch-tag-face))))))
+ 'face 'notmuch-tag-face))))))
(defun notmuch-search-get-tags ()
(save-excursion
--
1.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-06-03 23:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-28 18:00 [PATCH] emacs: Display non-matching authors in italic David Edmondson
2010-04-28 18:43 ` Jameson Rollins
2010-04-28 18:55 ` Dirk Hohndel
2010-04-28 19:15 ` David Edmondson
2010-04-28 19:22 ` Jameson Rollins
2010-04-29 6:52 ` [PATCH 1/2] emacs: Display non-matching authors with a different face David Edmondson
2010-06-03 23:58 ` Carl Worth
2010-04-29 6:52 ` [PATCH 2/2] emacs: Set the `face' property rather than `font-lock-face' David Edmondson
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).