unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/3] Notmuch pick: a threaded view 
@ 2012-07-11 18:57 Mark Walters
  2012-07-11 18:57 ` [PATCH 1/3] emacs: add a stub notmuch-pick.el file Mark Walters
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mark Walters @ 2012-07-11 18:57 UTC (permalink / raw)
  To: notmuch

Hello

Notmuch pick is an emacs view which displays a threaded view of
messages: each message has its own line and the thread structure is
shown with UTF-8 graphics characters (so it looks vaguely similar to
mutt's threaded view)

Pick was originally written by David Edmondon and posted on irc and I
have been developing it on and off since.  Now that almost all the
backend changes it uses are in I would like to see about getting it
into mainline.

However, the code is definitely not of the same standard as the main
notmuch code. One suggestion on irc was that we put it in contrib and
ship a stub notmuch-pick.el file in mainline so all a user would need
to do is replace the stub by the full version and compile.

This patch series implements this approach. I have managed to keep the
impact on the main notmuch code minimal: a stub pick file (which is
almost entirely the copyright boilerplate) and a entry from the main
notmuch.el. The way it works is that notmuch unconditionally calls
notmuch-pick-init when started: in the default case (the stub file)
this does nothing, whereas if the user replaces the stub by the full
file this sets up all the keybinding etc.

I have code for another approach which is only a little bigger: I add
a variable notmuch-pick-wanted and if the user sets this (which could
be by using setq in their .emacs file, or we could add a defcustom
option) which tells the code whether to load the pick functionality or
not.

In all the above cases this should give no change for a user who does
not enable the functionality. In the latter two cases notmuch-pick
would show up during compilation, whereas in the former it should be
completely invisible.

Any comments on the preferred approach?

Finally there have been suggestion that the name notmuch-pick is not
intuitive: are there any suggestions for a better name?

Best wishes

Mark

Mark Walters (3):
  emacs: add a stub notmuch-pick.el file
  emacs: add a stub entry to notmuch-pick in notmuch.el
  emacs: make notmuch-show return its buffer

 emacs/Makefile.local  |    3 ++-
 emacs/notmuch-pick.el |   28 ++++++++++++++++++++++++++++
 emacs/notmuch-show.el |    3 ++-
 emacs/notmuch.el      |    2 ++
 4 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 emacs/notmuch-pick.el

-- 
1.7.9.1

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

* [PATCH 1/3] emacs: add a stub notmuch-pick.el file
  2012-07-11 18:57 [PATCH 0/3] Notmuch pick: a threaded view Mark Walters
@ 2012-07-11 18:57 ` Mark Walters
  2012-07-11 18:57 ` [PATCH 2/3] emacs: add a stub entry to notmuch-pick in notmuch.el Mark Walters
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Walters @ 2012-07-11 18:57 UTC (permalink / raw)
  To: notmuch

All the actual setup done by the real notmuch-pick is in the function
notmuch-pick-init so that is the only function we need to provide.
---
 emacs/Makefile.local  |    3 ++-
 emacs/notmuch-pick.el |   28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletions(-)
 create mode 100644 emacs/notmuch-pick.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index fb82247..5822358 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -15,7 +15,8 @@ emacs_sources := \
 	$(dir)/notmuch-crypto.el \
 	$(dir)/notmuch-tag.el \
 	$(dir)/coolj.el \
-	$(dir)/notmuch-print.el
+	$(dir)/notmuch-print.el \
+	$(dir)/notmuch-pick.el
 
 emacs_images := \
 	$(srcdir)/$(dir)/notmuch-logo.png
diff --git a/emacs/notmuch-pick.el b/emacs/notmuch-pick.el
new file mode 100644
index 0000000..79fc19a
--- /dev/null
+++ b/emacs/notmuch-pick.el
@@ -0,0 +1,28 @@
+;; notmuch-pick.el --- displaying notmuch forests.
+;;
+;; Copyright © Carl Worth
+;; Copyright © David Edmondson
+;; Copyright © Mark Walters
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;; Authors: David Edmondson <dme@dme.org>
+;;          Mark Walters <markwalters1009@gmail.com>
+
+(defun notmuch-pick-init ()
+  "empty function ready to be replaced")
+
+(provide 'notmuch-pick)
-- 
1.7.9.1

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

* [PATCH 2/3] emacs: add a stub entry to notmuch-pick in notmuch.el
  2012-07-11 18:57 [PATCH 0/3] Notmuch pick: a threaded view Mark Walters
  2012-07-11 18:57 ` [PATCH 1/3] emacs: add a stub notmuch-pick.el file Mark Walters
@ 2012-07-11 18:57 ` Mark Walters
  2012-07-11 18:57 ` [PATCH 3/3] emacs: make notmuch-show return its buffer Mark Walters
  2012-07-11 19:06 ` [PATCH 0/3] Notmuch pick: a threaded view Mark Walters
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Walters @ 2012-07-11 18:57 UTC (permalink / raw)
  To: notmuch

This adds the stub entry to notmuch-pick.el to notmuch.el. We call
notmuch-pick-init when notmuch starts up; by default this function
does nothing but if the user replaces the file by the "proper" one
from contrib then this will setup key binding for the various entries
to notmuch-pick.
---
 emacs/notmuch.el |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index fabb7c0..2d32baa 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -58,6 +58,7 @@
 (require 'notmuch-hello)
 (require 'notmuch-maildir-fcc)
 (require 'notmuch-message)
+(require 'notmuch-pick)
 
 (defcustom notmuch-search-result-format
   `(("date" . "%12s ")
@@ -1032,6 +1033,7 @@ current search results AND that are tagged with the given tag."
 (defun notmuch ()
   "Run notmuch and display saved searches, known tags, etc."
   (interactive)
+  (notmuch-pick-init)
   (notmuch-hello))
 
 (defun notmuch-interesting-buffer (b)
-- 
1.7.9.1

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

* [PATCH 3/3] emacs: make notmuch-show return its buffer
  2012-07-11 18:57 [PATCH 0/3] Notmuch pick: a threaded view Mark Walters
  2012-07-11 18:57 ` [PATCH 1/3] emacs: add a stub notmuch-pick.el file Mark Walters
  2012-07-11 18:57 ` [PATCH 2/3] emacs: add a stub entry to notmuch-pick in notmuch.el Mark Walters
@ 2012-07-11 18:57 ` Mark Walters
  2012-07-11 19:06 ` [PATCH 0/3] Notmuch pick: a threaded view Mark Walters
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Walters @ 2012-07-11 18:57 UTC (permalink / raw)
  To: notmuch

notmuch-pick uses the returned buffer to try and make sure it does not
close the wrong buffer.
---
 emacs/notmuch-show.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6335d45..1cabd17 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1031,7 +1031,8 @@ function is used."
 	  notmuch-show-parent-buffer parent-buffer
 	  notmuch-show-query-context query-context)
     (notmuch-show-build-buffer)
-    (notmuch-show-goto-first-wanted-message)))
+    (notmuch-show-goto-first-wanted-message)
+    (current-buffer)))
 
 (defun notmuch-show-build-buffer ()
   (let ((inhibit-read-only t))
-- 
1.7.9.1

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

* Re: [PATCH 0/3] Notmuch pick: a threaded view
  2012-07-11 18:57 [PATCH 0/3] Notmuch pick: a threaded view Mark Walters
                   ` (2 preceding siblings ...)
  2012-07-11 18:57 ` [PATCH 3/3] emacs: make notmuch-show return its buffer Mark Walters
@ 2012-07-11 19:06 ` Mark Walters
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Walters @ 2012-07-11 19:06 UTC (permalink / raw)
  To: notmuch


> The way it works is that notmuch unconditionally calls
> notmuch-pick-init when started: in the default case (the stub file)
> this does nothing, whereas if the user replaces the stub by the full
> file this sets up all the keybinding etc.

In case people are interested the relevant code in the real
notmuch-pick-init function is

(defvar notmuch-pick-initialized nil)

(defun notmuch-pick-init()
  (unless notmuch-pick-initialized
    (define-key 'notmuch-search-mode-map "z" 'notmuch-pick)
    (define-key 'notmuch-search-mode-map "Z" 'notmuch-search-pick-current-query)
    (define-key 'notmuch-search-mode-map (kbd "M-RET") 'notmuch-search-pick-thread)
    (define-key 'notmuch-hello-mode-map "z" 'notmuch-hello-pick)
    (define-key 'notmuch-show-mode-map "z" 'notmuch-pick)
    (define-key 'notmuch-show-mode-map "Z" 'notmuch-show-pick-current-query)
    (setq notmuch-pick-initialized t)
    (message "Initialised notmuch-pick")))

Best wishes 

Mark

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

end of thread, other threads:[~2012-07-11 19:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 18:57 [PATCH 0/3] Notmuch pick: a threaded view Mark Walters
2012-07-11 18:57 ` [PATCH 1/3] emacs: add a stub notmuch-pick.el file Mark Walters
2012-07-11 18:57 ` [PATCH 2/3] emacs: add a stub entry to notmuch-pick in notmuch.el Mark Walters
2012-07-11 18:57 ` [PATCH 3/3] emacs: make notmuch-show return its buffer Mark Walters
2012-07-11 19:06 ` [PATCH 0/3] Notmuch pick: a threaded view Mark Walters

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