unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/8] improvements around notmuch-emacs-mua 
@ 2016-11-03 20:37 Jani Nikula
  2016-11-03 20:37 ` [PATCH 1/8] completion: complete notmuch emacs-mua Jani Nikula
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-03 20:37 UTC (permalink / raw)
  To: notmuch

This series brings together a bunch of my previous patches [1][2][3],
and adds some new ones, to make notmuch-emacs-mua a first class notmuch
citizen.

Document it as 'notmuch emacs-mua'. Do bash completion. Install it as
part of notmuch-emacs. Have the desktop file use
notmuch-emacs-mua. Update the desktop file to handle mailto:
URIs. Install the desktop file as part of notmuch-emacs.

With these changes, you can configure your desktop environment (well,
tested on a bog standard Gnome on Debian stable) to use notmuch-emacs to
handle mailto: URIs. \o/

BR,
Jani.


[1] id:1477153459-5359-1-git-send-email-jani@nikula.org
[2] id:1478113767-25875-1-git-send-email-jani@nikula.org
[3] id:1478111914-21927-1-git-send-email-jani@nikula.org

Jani Nikula (8):
  completion: complete notmuch emacs-mua
  man: advertize notmuch-emacs-mua as notmuch emacs-mua subcommand
  emacs: move notmuch-emacs-mua under emacs
  build: install notmuch-emacs-mua with notmuch-emacs
  notmuch.desktop: move under emacs as notmuch-emacs-mua.desktop
  emacs/desktop: update to use notmuch-emacs-mua and handle mailto
  build: install notmuch-emacs-mua.desktop file with emacs
  build: update the desktop database after installing the desktop file

 Makefile.local                                     |  5 ----
 completion/notmuch-completion.bash                 | 34 +++++++++++++++++++++-
 configure                                          | 13 +++++++++
 doc/man1/notmuch-emacs-mua.rst                     |  4 +--
 emacs/Makefile.local                               |  9 ++++++
 notmuch-emacs-mua => emacs/notmuch-emacs-mua       |  0
 notmuch.desktop => emacs/notmuch-emacs-mua.desktop |  5 +++-
 7 files changed, 61 insertions(+), 9 deletions(-)
 rename notmuch-emacs-mua => emacs/notmuch-emacs-mua (100%)
 rename notmuch.desktop => emacs/notmuch-emacs-mua.desktop (50%)

-- 
2.1.4

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

* [PATCH 1/8] completion: complete notmuch emacs-mua
  2016-11-03 20:37 [PATCH 0/8] improvements around notmuch-emacs-mua Jani Nikula
@ 2016-11-03 20:37 ` Jani Nikula
  2016-11-03 20:37 ` [PATCH 2/8] man: advertize notmuch-emacs-mua as notmuch emacs-mua subcommand Jani Nikula
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-03 20:37 UTC (permalink / raw)
  To: notmuch

With subcommand handling for external commands we can easily complete
'notmuch emacs-mua' using the existing completion system.
---
 completion/notmuch-completion.bash | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
index 78047b5f424d..9e1f7bb74bbf 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -204,6 +204,38 @@ _notmuch_dump()
     esac
 }
 
+_notmuch_emacs_mua()
+{
+    local cur prev words cword split
+    _init_completion -s || return
+
+    $split &&
+    case "${prev}" in
+	--to|--cc|--bcc)
+	    COMPREPLY=( $(compgen -W "`_notmuch_email to:${cur}`" -- ${cur}) )
+	    return
+	    ;;
+	--body)
+	    _filedir
+	    return
+	    ;;
+    esac
+
+    ! $split &&
+    case "${cur}" in
+        -*)
+	    local options="--subject= --to= --cc= --bcc= --body= --no-window-system --client --auto-daemon --create-frame --print --help"
+
+	    compopt -o nospace
+	    COMPREPLY=( $(compgen -W "$options" -- ${cur}) )
+	    ;;
+	*)
+	    COMPREPLY=( $(compgen -W "`_notmuch_email to:${cur}`" -- ${cur}) )
+	    return
+	    ;;
+    esac
+}
+
 _notmuch_insert()
 {
     local cur prev words cword split
@@ -464,7 +496,7 @@ _notmuch_tag()
 
 _notmuch()
 {
-    local _notmuch_commands="compact config count dump help insert new reply restore search address setup show tag"
+    local _notmuch_commands="compact config count dump help insert new reply restore search address setup show tag emacs-mua"
     local arg cur prev words cword split
 
     # require bash-completion with _init_completion
-- 
2.1.4

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

* [PATCH 2/8] man: advertize notmuch-emacs-mua as notmuch emacs-mua subcommand
  2016-11-03 20:37 [PATCH 0/8] improvements around notmuch-emacs-mua Jani Nikula
  2016-11-03 20:37 ` [PATCH 1/8] completion: complete notmuch emacs-mua Jani Nikula
@ 2016-11-03 20:37 ` Jani Nikula
  2016-11-03 20:37 ` [PATCH 3/8] emacs: move notmuch-emacs-mua under emacs Jani Nikula
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-03 20:37 UTC (permalink / raw)
  To: notmuch

With subcommand handling for external commands we can now hide the
implementation detail of emacs-mua being a separate notmuch-emacs-mua
script.
---
 doc/man1/notmuch-emacs-mua.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
index 651d00fa4eb8..b80aa5f9b2e5 100644
--- a/doc/man1/notmuch-emacs-mua.rst
+++ b/doc/man1/notmuch-emacs-mua.rst
@@ -5,7 +5,7 @@ notmuch-emacs-mua
 SYNOPSIS
 ========
 
-**notmuch-emacs-mua** [options ...] [<to-address> ... | <mailto-url>]
+**notmuch** **emacs-mua** [options ...] [<to-address> ... | <mailto-url>]
 
 DESCRIPTION
 ===========
@@ -13,7 +13,7 @@ DESCRIPTION
 Start composing an email in the Notmuch Emacs UI with the specified
 subject, recipients, and message body, or mailto: URL.
 
-Supported options for **notmuch-emacs-mua** include
+Supported options for **emacs-mua** include
 
     ``-h, --help``
         Display help.
-- 
2.1.4

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

* [PATCH 3/8] emacs: move notmuch-emacs-mua under emacs
  2016-11-03 20:37 [PATCH 0/8] improvements around notmuch-emacs-mua Jani Nikula
  2016-11-03 20:37 ` [PATCH 1/8] completion: complete notmuch emacs-mua Jani Nikula
  2016-11-03 20:37 ` [PATCH 2/8] man: advertize notmuch-emacs-mua as notmuch emacs-mua subcommand Jani Nikula
@ 2016-11-03 20:37 ` Jani Nikula
  2016-11-03 20:37 ` [PATCH 4/8] build: install notmuch-emacs-mua with notmuch-emacs Jani Nikula
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-03 20:37 UTC (permalink / raw)
  To: notmuch

While the notmuch-emacs-mua script is a sort of cli command, it is
really a part of notmuch-emacs. Move it under the emacs directory.
---
 notmuch-emacs-mua => emacs/notmuch-emacs-mua | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename notmuch-emacs-mua => emacs/notmuch-emacs-mua (100%)

diff --git a/notmuch-emacs-mua b/emacs/notmuch-emacs-mua
similarity index 100%
rename from notmuch-emacs-mua
rename to emacs/notmuch-emacs-mua
-- 
2.1.4

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

* [PATCH 4/8] build: install notmuch-emacs-mua with notmuch-emacs
  2016-11-03 20:37 [PATCH 0/8] improvements around notmuch-emacs-mua Jani Nikula
                   ` (2 preceding siblings ...)
  2016-11-03 20:37 ` [PATCH 3/8] emacs: move notmuch-emacs-mua under emacs Jani Nikula
@ 2016-11-03 20:37 ` Jani Nikula
  2016-11-03 20:37 ` [PATCH 5/8] notmuch.desktop: move under emacs as notmuch-emacs-mua.desktop Jani Nikula
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-03 20:37 UTC (permalink / raw)
  To: notmuch

notmuch-emacs-mua is good enough to be installed with notmuch-emacs.
---
 emacs/Makefile.local | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 2d6aedbdfd5d..56b9714d91d7 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -27,6 +27,7 @@ $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
 	@sed -e 's/%AG%/Generated file (from $(<F)) -- do not edit!/' \
 	     -e 's/%VERSION%/"$(VERSION)"/' $< > $@
 
+emacs_mua := $(dir)/notmuch-emacs-mua
 
 emacs_images := \
 	$(srcdir)/$(dir)/notmuch-logo.png
@@ -83,5 +84,7 @@ ifeq ($(HAVE_EMACS),1)
 endif
 	mkdir -p "$(DESTDIR)$(emacsetcdir)"
 	install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
+	mkdir -p "$(DESTDIR)$(prefix)/bin/"
+	install $(emacs_mua) "$(DESTDIR)$(prefix)/bin"
 
 CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el
-- 
2.1.4

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

* [PATCH 5/8] notmuch.desktop: move under emacs as notmuch-emacs-mua.desktop
  2016-11-03 20:37 [PATCH 0/8] improvements around notmuch-emacs-mua Jani Nikula
                   ` (3 preceding siblings ...)
  2016-11-03 20:37 ` [PATCH 4/8] build: install notmuch-emacs-mua with notmuch-emacs Jani Nikula
@ 2016-11-03 20:37 ` Jani Nikula
  2016-11-03 20:37 ` [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto Jani Nikula
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-03 20:37 UTC (permalink / raw)
  To: notmuch

The notmuch.desktop file is part of notmuch-emacs. Move it under
emacs, and rename as notmuch-emacs-mua.desktop to reflect this.
---
 Makefile.local                                     | 5 -----
 emacs/Makefile.local                               | 6 ++++++
 notmuch.desktop => emacs/notmuch-emacs-mua.desktop | 0
 3 files changed, 6 insertions(+), 5 deletions(-)
 rename notmuch.desktop => emacs/notmuch-emacs-mua.desktop (100%)

diff --git a/Makefile.local b/Makefile.local
index d1b0585f2866..a9998d5b6890 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -333,11 +333,6 @@ ifeq ($(WITH_EMACS), 1)
 endif
 endif
 
-.PHONY: install-desktop
-install-desktop:
-	mkdir -p "$(DESTDIR)$(desktop_dir)"
-	desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" notmuch.desktop
-
 SRCS  := $(SRCS) $(notmuch_client_srcs)
 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
 CLEAN := $(CLEAN) version.stamp notmuch-*.tar.gz.tmp
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 56b9714d91d7..76ba974c4065 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -28,6 +28,7 @@ $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
 	     -e 's/%VERSION%/"$(VERSION)"/' $< > $@
 
 emacs_mua := $(dir)/notmuch-emacs-mua
+emacs_mua_desktop := $(dir)/notmuch-emacs-mua.desktop
 
 emacs_images := \
 	$(srcdir)/$(dir)/notmuch-logo.png
@@ -87,4 +88,9 @@ endif
 	mkdir -p "$(DESTDIR)$(prefix)/bin/"
 	install $(emacs_mua) "$(DESTDIR)$(prefix)/bin"
 
+.PHONY: install-desktop
+install-desktop:
+	mkdir -p "$(DESTDIR)$(desktop_dir)"
+	desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" $(emacs_mua_desktop)
+
 CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el
diff --git a/notmuch.desktop b/emacs/notmuch-emacs-mua.desktop
similarity index 100%
rename from notmuch.desktop
rename to emacs/notmuch-emacs-mua.desktop
-- 
2.1.4

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

* [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto
  2016-11-03 20:37 [PATCH 0/8] improvements around notmuch-emacs-mua Jani Nikula
                   ` (4 preceding siblings ...)
  2016-11-03 20:37 ` [PATCH 5/8] notmuch.desktop: move under emacs as notmuch-emacs-mua.desktop Jani Nikula
@ 2016-11-03 20:37 ` Jani Nikula
  2016-11-21 11:34   ` David Bremner
  2016-11-03 20:38 ` [PATCH 7/8] build: install notmuch-emacs-mua.desktop file with emacs Jani Nikula
  2016-11-03 20:38 ` [PATCH 8/8] build: update the desktop database after installing the desktop file Jani Nikula
  7 siblings, 1 reply; 15+ messages in thread
From: Jani Nikula @ 2016-11-03 20:37 UTC (permalink / raw)
  To: notmuch

With the mailto: handling in notmuch-emacs-mua, we can update the
desktop file to advertize we can be set as the default application to
handle email. While at it, add GenericName and Comment to be more
informative.
---
 emacs/notmuch-emacs-mua.desktop | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-emacs-mua.desktop b/emacs/notmuch-emacs-mua.desktop
index f1600473bf60..93b16c9e7fa7 100644
--- a/emacs/notmuch-emacs-mua.desktop
+++ b/emacs/notmuch-emacs-mua.desktop
@@ -1,6 +1,9 @@
 [Desktop Entry]
 Name=Notmuch (emacs interface)
-Exec=emacs -f notmuch
+GenericName=Email Client
+Comment=Emacs based email client
+Exec=notmuch-emacs-mua %u
+MimeType=x-scheme-handler/mailto;
 Icon=emblem-mail
 Terminal=false
 Type=Application
-- 
2.1.4

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

* [PATCH 7/8] build: install notmuch-emacs-mua.desktop file with emacs
  2016-11-03 20:37 [PATCH 0/8] improvements around notmuch-emacs-mua Jani Nikula
                   ` (5 preceding siblings ...)
  2016-11-03 20:37 ` [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto Jani Nikula
@ 2016-11-03 20:38 ` Jani Nikula
  2016-11-03 20:38 ` [PATCH 8/8] build: update the desktop database after installing the desktop file Jani Nikula
  7 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-03 20:38 UTC (permalink / raw)
  To: notmuch

There is really no need to have a separate install target for the
desktop file. Just install the desktop file with emacs, with a
configure option to opt out.
---
 configure            | 13 +++++++++++++
 emacs/Makefile.local |  5 ++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 2a0ce9eb4156..009d33ab4f92 100755
--- a/configure
+++ b/configure
@@ -70,6 +70,7 @@ LIBDIR=
 WITH_DOCS=1
 WITH_API_DOCS=1
 WITH_EMACS=1
+WITH_DESKTOP=1
 WITH_BASH=1
 WITH_RUBY=1
 WITH_ZSH=1
@@ -141,6 +142,7 @@ Some features can be disabled (--with-feature=no is equivalent to
 	--without-docs			Do not install documentation
 	--without-api-docs		Do not install API man page
 	--without-emacs			Do not install lisp file
+	--without-desktop		Do not install desktop file
 	--without-ruby			Do not install ruby bindings
 	--without-zsh-completion	Do not install zsh completions files
 	--without-retry-lock		Do not use blocking xapian opens, even if available
@@ -209,6 +211,14 @@ for option; do
 	fi
     elif [ "${option}" = '--without-emacs' ] ; then
 	WITH_EMACS=0
+    elif [ "${option%%=*}" = '--with-desktop' ]; then
+	if [ "${option#*=}" = 'no' ]; then
+	    WITH_DESKTOP=0
+	else
+	    WITH_DESKTOP=1
+	fi
+    elif [ "${option}" = '--without-desktop' ] ; then
+	WITH_DESKTOP=0
     elif [ "${option%%=*}" = '--with-bash-completion' ]; then
 	if [ "${option#*=}" = 'no' ]; then
 	    WITH_BASH=0
@@ -1123,6 +1133,9 @@ VALGRIND_CFLAGS = ${valgrind_cflags}
 # Support for emacs
 WITH_EMACS = ${WITH_EMACS}
 
+# Support for desktop file
+WITH_DESKTOP = ${WITH_DESKTOP}
+
 # Support for bash completion
 WITH_BASH = ${WITH_BASH}
 
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 76ba974c4065..a984023f7840 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -87,10 +87,9 @@ endif
 	install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
 	mkdir -p "$(DESTDIR)$(prefix)/bin/"
 	install $(emacs_mua) "$(DESTDIR)$(prefix)/bin"
-
-.PHONY: install-desktop
-install-desktop:
+ifeq ($(WITH_DESKTOP),1)
 	mkdir -p "$(DESTDIR)$(desktop_dir)"
 	desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" $(emacs_mua_desktop)
+endif
 
 CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el
-- 
2.1.4

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

* [PATCH 8/8] build: update the desktop database after installing the desktop file
  2016-11-03 20:37 [PATCH 0/8] improvements around notmuch-emacs-mua Jani Nikula
                   ` (6 preceding siblings ...)
  2016-11-03 20:38 ` [PATCH 7/8] build: install notmuch-emacs-mua.desktop file with emacs Jani Nikula
@ 2016-11-03 20:38 ` Jani Nikula
  7 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-03 20:38 UTC (permalink / raw)
  To: notmuch

This makes the option to choose Notmuch as mailto: handler show up in
the desktop environment settings.
---
 emacs/Makefile.local | 1 +
 1 file changed, 1 insertion(+)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index a984023f7840..3192b5a9c3cc 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -90,6 +90,7 @@ endif
 ifeq ($(WITH_DESKTOP),1)
 	mkdir -p "$(DESTDIR)$(desktop_dir)"
 	desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" $(emacs_mua_desktop)
+	update-desktop-database "$(DESTDIR)$(desktop_dir)"
 endif
 
 CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el
-- 
2.1.4

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

* Re: [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto
  2016-11-03 20:37 ` [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto Jani Nikula
@ 2016-11-21 11:34   ` David Bremner
  2016-11-21 11:44     ` Jani Nikula
  0 siblings, 1 reply; 15+ messages in thread
From: David Bremner @ 2016-11-21 11:34 UTC (permalink / raw)
  To: Jani Nikula, notmuch

Jani Nikula <jani@nikula.org> writes:

> -Exec=emacs -f notmuch
> +GenericName=Email Client
> +Comment=Emacs based email client
> +Exec=notmuch-emacs-mua %u

This seems like a fairly substantial change in functionality. Previously
people could click on the icon fire up a mail reader; now they get a
mail composition window. I probably won't use either, but it seems like
the change merits some discussion.

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

* Re: [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto
  2016-11-21 11:34   ` David Bremner
@ 2016-11-21 11:44     ` Jani Nikula
  2016-11-21 12:29       ` Tomi Ollila
  2016-11-21 16:22       ` Keith Amidon
  0 siblings, 2 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-21 11:44 UTC (permalink / raw)
  To: David Bremner; +Cc: Notmuch Mail

On Mon, Nov 21, 2016 at 1:34 PM, David Bremner <david@tethera.net> wrote:
> Jani Nikula <jani@nikula.org> writes:
>
>> -Exec=emacs -f notmuch
>> +GenericName=Email Client
>> +Comment=Emacs based email client
>> +Exec=notmuch-emacs-mua %u
>
> This seems like a fairly substantial change in functionality. Previously
> people could click on the icon fire up a mail reader; now they get a
> mail composition window. I probably won't use either, but it seems like
> the change merits some discussion.

I wonder if there's a way to define different Execs for clicking on
the icon and handling mailto.

BR,
Jani.

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

* Re: [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto
  2016-11-21 11:44     ` Jani Nikula
@ 2016-11-21 12:29       ` Tomi Ollila
  2016-11-21 16:22       ` Keith Amidon
  1 sibling, 0 replies; 15+ messages in thread
From: Tomi Ollila @ 2016-11-21 12:29 UTC (permalink / raw)
  To: Notmuch Mail

On Mon, Nov 21 2016, Jani Nikula <jani@nikula.org> wrote:

> On Mon, Nov 21, 2016 at 1:34 PM, David Bremner <david@tethera.net> wrote:
>> Jani Nikula <jani@nikula.org> writes:
>>
>>> -Exec=emacs -f notmuch
>>> +GenericName=Email Client
>>> +Comment=Emacs based email client
>>> +Exec=notmuch-emacs-mua %u
>>
>> This seems like a fairly substantial change in functionality. Previously
>> people could click on the icon fire up a mail reader; now they get a
>> mail composition window. I probably won't use either, but it seems like
>> the change merits some discussion.
>
> I wonder if there's a way to define different Execs for clicking on
> the icon and handling mailto.

What if notmuch-emacs-mua started (notmuch-hello) in case there are no
arguments given ... ?

Tomi

>
> BR,
> Jani.

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

* Re: [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto
  2016-11-21 11:44     ` Jani Nikula
  2016-11-21 12:29       ` Tomi Ollila
@ 2016-11-21 16:22       ` Keith Amidon
  2016-11-21 20:49         ` Jani Nikula
  1 sibling, 1 reply; 15+ messages in thread
From: Keith Amidon @ 2016-11-21 16:22 UTC (permalink / raw)
  To: Jani Nikula, David Bremner; +Cc: Notmuch Mail

On Mon, 2016-11-21 at 13:44 +0200, Jani Nikula wrote:
> I wonder if there's a way to define different Execs for clicking on
> the icon and handling mailto.

The desktop file format specification implies you can just add an extra
context entry.  For reference, the full specification is here:

https://specifications.freedesktop.org/desktop-entry-spec/latest/

Something like this seems like what the spec suggests:

[Desktop Entry]
Name=Notmuch Emacs Client
GenericName=Email Client
Comment=Emacs based email client
Exec=emacs -f notmuch
Icon=emblem-mail
Terminal=false
Type=Application
Categories=Network;Email;

[Create Message]
Name=Notmuch Emacs Create Message
Exec=notmuch-emacs-mua %u
MimeType=x-scheme-handler/mailto;

However, this did not seem to work when I tried it out in my gnome
session.  I'm pretty sure creating two separate desktop files
(duplicating some of the fields) would work.

          --- Keith

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

* Re: [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto
  2016-11-21 16:22       ` Keith Amidon
@ 2016-11-21 20:49         ` Jani Nikula
  2016-11-21 20:52           ` Jani Nikula
  0 siblings, 1 reply; 15+ messages in thread
From: Jani Nikula @ 2016-11-21 20:49 UTC (permalink / raw)
  To: Keith Amidon, David Bremner; +Cc: Notmuch Mail, Tomi Ollila

On Mon, 21 Nov 2016, Keith Amidon <camalot@picnicpark.org> wrote:
> However, this did not seem to work when I tried it out in my gnome
> session.  I'm pretty sure creating two separate desktop files
> (duplicating some of the fields) would work.

I see three options here:

1) Just always go to message composition directly (meh)

2) Add two desktop files (meh)

3) Have notmuch-emacs-mua call (notmuch-hello) if there are no arguments
   (Tomi's suggestion). I like this because notmuch-emacs-mua also does
   (require 'notmuch).

4) Same as 3) but only do it if a new --hello parameter is given but
   there are no other arguments. This is to not change notmuch-emacs-mua
   default behaviour.

I'd go for either 3 or 4.

BR,
Jani.

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

* Re: [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto
  2016-11-21 20:49         ` Jani Nikula
@ 2016-11-21 20:52           ` Jani Nikula
  0 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2016-11-21 20:52 UTC (permalink / raw)
  To: Keith Amidon, David Bremner; +Cc: Notmuch Mail, Tomi Ollila

On Mon, 21 Nov 2016, Jani Nikula <jani@nikula.org> wrote:
> On Mon, 21 Nov 2016, Keith Amidon <camalot@picnicpark.org> wrote:
>> However, this did not seem to work when I tried it out in my gnome
>> session.  I'm pretty sure creating two separate desktop files
>> (duplicating some of the fields) would work.
>
> I see three options here:
>
> 1) Just always go to message composition directly (meh)
>
> 2) Add two desktop files (meh)
>
> 3) Have notmuch-emacs-mua call (notmuch-hello) if there are no arguments
>    (Tomi's suggestion). I like this because notmuch-emacs-mua also does
>    (require 'notmuch).
>
> 4) Same as 3) but only do it if a new --hello parameter is given but
>    there are no other arguments. This is to not change notmuch-emacs-mua
>    default behaviour.
>
> I'd go for either 3 or 4.

This is what 4) would look like:

diff --git a/emacs/notmuch-emacs-mua b/emacs/notmuch-emacs-mua
index 98103972f400..a521497784ec 100755
--- a/emacs/notmuch-emacs-mua
+++ b/emacs/notmuch-emacs-mua
@@ -40,6 +40,7 @@ AUTO_DAEMON=
 CREATE_FRAME=
 ELISP=
 MAILTO=
+HELLO=
 
 # Short options compatible with mutt(1).
 while getopts :s:c:b:i:h opt; do
@@ -63,7 +64,7 @@ while getopts :s:c:b:i:h opt; do
 		    opt=${opt%%=*}
 		    ;;
 		# Long options without arguments.
-		--help|--print|--no-window-system|--client|--auto-daemon|--create-frame)
+		--help|--print|--no-window-system|--client|--auto-daemon|--create-frame|--hello)
 		    ;;
 		*)
 		    echo "$0: unknown long option ${opt}, or argument mismatch." >&2
@@ -112,6 +113,9 @@ while getopts :s:c:b:i:h opt; do
 	--create-frame)
 	    CREATE_FRAME="-c"
 	    ;;
+	--hello)
+	    HELLO=1
+	    ;;
 	*)
 	    # We should never end up here.
 	    echo "$0: internal error (option ${opt})." >&2
@@ -146,6 +150,8 @@ if [ -n "${MAILTO}" ]; then
 	exit 1
     fi
     ELISP="(browse-url-mail \"${MAILTO}\")"
+elif [ -z "${ELISP}" -a -n "${HELLO}" ]; then
+    ELISP="(notmuch)"
 else
     ELISP="(notmuch-mua-new-mail) ${ELISP}"
 fi

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

end of thread, other threads:[~2016-11-22  4:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-03 20:37 [PATCH 0/8] improvements around notmuch-emacs-mua Jani Nikula
2016-11-03 20:37 ` [PATCH 1/8] completion: complete notmuch emacs-mua Jani Nikula
2016-11-03 20:37 ` [PATCH 2/8] man: advertize notmuch-emacs-mua as notmuch emacs-mua subcommand Jani Nikula
2016-11-03 20:37 ` [PATCH 3/8] emacs: move notmuch-emacs-mua under emacs Jani Nikula
2016-11-03 20:37 ` [PATCH 4/8] build: install notmuch-emacs-mua with notmuch-emacs Jani Nikula
2016-11-03 20:37 ` [PATCH 5/8] notmuch.desktop: move under emacs as notmuch-emacs-mua.desktop Jani Nikula
2016-11-03 20:37 ` [PATCH 6/8] emacs/desktop: update to use notmuch-emacs-mua and handle mailto Jani Nikula
2016-11-21 11:34   ` David Bremner
2016-11-21 11:44     ` Jani Nikula
2016-11-21 12:29       ` Tomi Ollila
2016-11-21 16:22       ` Keith Amidon
2016-11-21 20:49         ` Jani Nikula
2016-11-21 20:52           ` Jani Nikula
2016-11-03 20:38 ` [PATCH 7/8] build: install notmuch-emacs-mua.desktop file with emacs Jani Nikula
2016-11-03 20:38 ` [PATCH 8/8] build: update the desktop database after installing the desktop file 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).