unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: add mimetype completions to searches
@ 2016-09-27  9:26 Mark Walters
  2016-09-27 11:31 ` David Bremner
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mark Walters @ 2016-09-27  9:26 UTC (permalink / raw)
  To: notmuch

---

When doing the patch for commit
f94921520778ae4005500f5d1b943e2d4ddd3b2a emacs: show: let the user
override the mime-type of an attachment, I discovered how to do
mimetype completion (in particular where to get a list of mimetypes),
so we may as well add this completion for searches too.

Best wishes

Mark



emacs/notmuch.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 8e14692..29afd45 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -891,9 +891,10 @@ PROMPT is the string to prompt with."
                 (process-lines notmuch-command "search" "--output=tags" "*")))
        (completions
 	 (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
-		       "subject:" "attachment:" "mimetype:")
+		       "subject:" "attachment:")
 		 (mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
-		 (mapcar (lambda (tag) (concat "is:" tag)) all-tags))))
+		 (mapcar (lambda (tag) (concat "is:" tag)) all-tags)
+		 (mapcar (lambda (mimetype) (concat "mimetype:" mimetype)) (mailcap-mime-types)))))
     (let ((keymap (copy-keymap minibuffer-local-map))
 	  (current-query (case major-mode
 			   (notmuch-search-mode (notmuch-search-get-query))
-- 
2.1.4

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

* Re: [PATCH] emacs: add mimetype completions to searches
  2016-09-27  9:26 [PATCH] emacs: add mimetype completions to searches Mark Walters
@ 2016-09-27 11:31 ` David Bremner
  2016-09-28 12:52   ` David Bremner
  2016-10-09 12:09 ` David Bremner
  2016-10-22  9:55 ` Jani Nikula
  2 siblings, 1 reply; 7+ messages in thread
From: David Bremner @ 2016-09-27 11:31 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> ---
>
> When doing the patch for commit
> f94921520778ae4005500f5d1b943e2d4ddd3b2a emacs: show: let the user
> override the mime-type of an attachment, I discovered how to do
> mimetype completion (in particular where to get a list of mimetypes),
> so we may as well add this completion for searches too.
>
> Best wishes
>
> Mark

Did you mean to have an empty commit message?

> emacs/notmuch.el | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 8e14692..29afd45 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -891,9 +891,10 @@ PROMPT is the string to prompt with."
>                  (process-lines notmuch-command "search" "--output=tags" "*")))
>         (completions
>  	 (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
> -		       "subject:" "attachment:" "mimetype:")
> +		       "subject:" "attachment:")
>  		 (mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
> -		 (mapcar (lambda (tag) (concat "is:" tag)) all-tags))))
> +		 (mapcar (lambda (tag) (concat "is:" tag)) all-tags)
> +		 (mapcar (lambda (mimetype) (concat "mimetype:" mimetype)) (mailcap-mime-types)))))
>      (let ((keymap (copy-keymap minibuffer-local-map))
>  	  (current-query (case major-mode
>  			   (notmuch-search-mode (notmuch-search-get-query))

I don't seem to have the variable mailcap-mime-types in this emacs
session, with notmuch loaded.

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

* Re: [PATCH] emacs: add mimetype completions to searches
  2016-09-27 11:31 ` David Bremner
@ 2016-09-28 12:52   ` David Bremner
  0 siblings, 0 replies; 7+ messages in thread
From: David Bremner @ 2016-09-28 12:52 UTC (permalink / raw)
  To: Mark Walters, notmuch

David Bremner <david@tethera.net> writes:

>
> Did you mean to have an empty commit message?
>

I'm on the fence about this. I'll revisit the patch after 0.23 release.

>> emacs/notmuch.el | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
>
> I don't seem to have the variable mailcap-mime-types in this emacs
> session, with notmuch loaded.

Oops, my mistake. mailcap-mime-types is (evidently) a function.

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

* Re: [PATCH] emacs: add mimetype completions to searches
  2016-09-27  9:26 [PATCH] emacs: add mimetype completions to searches Mark Walters
  2016-09-27 11:31 ` David Bremner
@ 2016-10-09 12:09 ` David Bremner
  2016-10-22  9:55 ` Jani Nikula
  2 siblings, 0 replies; 7+ messages in thread
From: David Bremner @ 2016-10-09 12:09 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

pushed

d

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

* Re: [PATCH] emacs: add mimetype completions to searches
  2016-09-27  9:26 [PATCH] emacs: add mimetype completions to searches Mark Walters
  2016-09-27 11:31 ` David Bremner
  2016-10-09 12:09 ` David Bremner
@ 2016-10-22  9:55 ` Jani Nikula
  2016-10-22 18:08   ` Keith Amidon
  2 siblings, 1 reply; 7+ messages in thread
From: Jani Nikula @ 2016-10-22  9:55 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Tue, 27 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
> When doing the patch for commit
> f94921520778ae4005500f5d1b943e2d4ddd3b2a emacs: show: let the user
> override the mime-type of an attachment, I discovered how to do
> mimetype completion (in particular where to get a list of mimetypes),
> so we may as well add this completion for searches too.

Any ideas how to get a list of mime types in shell, so I could do the
same in bash completion without hard-coding some limited list?

BR,
Jani.

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

* Re: [PATCH] emacs: add mimetype completions to searches
  2016-10-22  9:55 ` Jani Nikula
@ 2016-10-22 18:08   ` Keith Amidon
  2016-10-22 18:58     ` Jani Nikula
  0 siblings, 1 reply; 7+ messages in thread
From: Keith Amidon @ 2016-10-22 18:08 UTC (permalink / raw)
  To: Jani Nikula, Mark Walters, notmuch

On Sat, 2016-10-22 at 12:55 +0300, Jani Nikula wrote:
> Any ideas how to get a list of mime types in shell, so I could do the
> same in bash completion without hard-coding some limited list?

Not sure if this is really what you're looking for, but on my archlinux
system, the file /etc/mime.types is installed by a package called mime-
types, which lists this gentoo package as its upstream:

http://packages.gentoo.org/package/app-misc/mime-types

It's pulled in as a dependency of installing firefox, so presumably
some version of this is pretty ubiquitous on Linux systems.

          --- Keith

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

* Re: [PATCH] emacs: add mimetype completions to searches
  2016-10-22 18:08   ` Keith Amidon
@ 2016-10-22 18:58     ` Jani Nikula
  0 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2016-10-22 18:58 UTC (permalink / raw)
  To: Keith Amidon, Mark Walters, notmuch

On Sat, 22 Oct 2016, Keith Amidon <camalot@picnicpark.org> wrote:
> On Sat, 2016-10-22 at 12:55 +0300, Jani Nikula wrote:
>> Any ideas how to get a list of mime types in shell, so I could do the
>> same in bash completion without hard-coding some limited list?
>
> Not sure if this is really what you're looking for, but on my archlinux
> system, the file /etc/mime.types is installed by a package called mime-
> types, which lists this gentoo package as its upstream:
>
> http://packages.gentoo.org/package/app-misc/mime-types
>
> It's pulled in as a dependency of installing firefox, so presumably
> some version of this is pretty ubiquitous on Linux systems.

Thanks. I did look at it before, but dismissed it because the package
doesn't seem to provide a tool for parsing the file. I ended up parsing
it using a sed one-liner [1]. Oh well.

BR,
Jani.


[1] id:1477162534-7814-1-git-send-email-jani@nikula.org

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

end of thread, other threads:[~2016-10-22 19:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-27  9:26 [PATCH] emacs: add mimetype completions to searches Mark Walters
2016-09-27 11:31 ` David Bremner
2016-09-28 12:52   ` David Bremner
2016-10-09 12:09 ` David Bremner
2016-10-22  9:55 ` Jani Nikula
2016-10-22 18:08   ` Keith Amidon
2016-10-22 18:58     ` Jani Nikula

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