From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [RFC PATCH v2 2/3] emacs: changes to other files to support notmuch-pick
Date: Sun, 12 Feb 2012 18:49:38 +0000 [thread overview]
Message-ID: <1329072579-27340-3-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>
---
emacs/Makefile.local | 3 ++-
emacs/notmuch-hello.el | 10 ++++++++++
emacs/notmuch-lib.el | 4 ++++
emacs/notmuch-query.el | 4 +++-
emacs/notmuch-show.el | 25 ++++++++++++++++++++++---
emacs/notmuch.el | 8 ++++++++
6 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 4fee0e8..2922d9e 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -14,7 +14,8 @@ emacs_sources := \
$(dir)/notmuch-message.el \
$(dir)/notmuch-crypto.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-hello.el b/emacs/notmuch-hello.el
index d17a30f..6d28a7e 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -27,6 +27,7 @@
(require 'notmuch-mua)
(declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation))
+(declare-function notmuch-pick "notmuch-pick" (query &optional query-context buffer-name))
(declare-function notmuch-poll "notmuch" ())
(defcustom notmuch-hello-recent-searches-max 10
@@ -181,6 +182,14 @@ International Bureau of Weights and Measures."
(notmuch-search search notmuch-search-oldest-first nil nil
#'notmuch-hello-search-continuation))
+(defun notmuch-hello-pick (&optional search)
+ (interactive)
+ (unless (null search)
+ (setq search (notmuch-hello-trim search))
+ (let ((history-delete-duplicates t))
+ (add-to-history 'notmuch-search-history search)))
+ (notmuch-pick search))
+
(defun notmuch-hello-add-saved-search (widget)
(interactive)
(let ((search (widget-value
@@ -345,6 +354,7 @@ should be. Returns a cons cell `(tags-per-line width)'."
(define-key map (kbd "<C-tab>") 'widget-backward)
(define-key map "m" 'notmuch-mua-new-mail)
(define-key map "s" 'notmuch-hello-search)
+ (define-key map "z" 'notmuch-hello-pick)
map)
"Keymap for \"notmuch hello\" buffers.")
(fset 'notmuch-hello-mode-map notmuch-hello-mode-map)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index d315f76..b88bb80 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -40,6 +40,10 @@
"Showing messages and threads."
:group 'notmuch)
+(defgroup notmuch-pick nil
+ "Showing message and thread structure."
+ :group 'notmuch)
+
(defgroup notmuch-send nil
"Sending messages from Notmuch."
:group 'notmuch)
diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el
index d66baea..b3c91a3 100644
--- a/emacs/notmuch-query.el
+++ b/emacs/notmuch-query.el
@@ -22,7 +22,7 @@
(require 'notmuch-lib)
(require 'json)
-(defun notmuch-query-get-threads (search-terms)
+(defun notmuch-query-get-threads (search-terms &rest extra-format)
"Return a list of threads of messages matching SEARCH-TERMS.
A thread is a forest or list of trees. A tree is a two element
@@ -33,6 +33,8 @@ is a possibly empty forest of replies.
(json-object-type 'plist)
(json-array-type 'list)
(json-false 'nil))
+ (if extra-format
+ (setq args (append args extra-format)))
(if notmuch-show-process-crypto
(setq args (append args '("--decrypt"))))
(setq args (append args search-terms))
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 43408d9..1adf964 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -42,6 +42,7 @@
(declare-function notmuch-search-next-thread "notmuch" nil)
(declare-function notmuch-search-show-thread "notmuch" nil)
(declare-function notmuch-update-tags "notmuch" (current-tags tag-changes))
+(declare-function notmuch-pick "notmuch-pick" (query &optional query-context buffer-name))
(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
"Headers that should be shown in a message, in this order.
@@ -151,6 +152,12 @@ indentation."
(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
(put 'notmuch-show-elide-non-matching-messages 'permanent-local t)
+;; This is very similar to the previous variable: they should be
+;; unified. MJW
+(defvar notmuch-show-just-matches nil)
+(make-variable-buffer-local 'notmuch-show-just-matches)
+(put 'notmuch-show-just-matches 'permanent-local t)
+
(defvar notmuch-show-indent-content t)
(make-variable-buffer-local 'notmuch-show-indent-content)
(put 'notmuch-show-indent-content 'permanent-local t)
@@ -1013,7 +1020,7 @@ a corresponding notmuch search."
'face goto-address-mail-face))))
;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
+(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name just-matches)
"Run \"notmuch show\" with the given thread ID and display results.
The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -1046,8 +1053,11 @@ function is used."
(setq notmuch-show-thread-id thread-id
notmuch-show-parent-buffer parent-buffer
- notmuch-show-query-context query-context)
- (notmuch-show-worker)))
+ notmuch-show-query-context query-context
+ notmuch-show-just-matches just-matches)
+
+ (notmuch-show-worker)
+ (current-buffer)))
(defun notmuch-show-worker ()
(let ((inhibit-read-only t))
@@ -1064,6 +1074,8 @@ function is used."
(append (list "\'") basic-args
(list "and (" notmuch-show-query-context ")\'"))
(append (list "\'") basic-args (list "\'")))))
+ (if notmuch-show-just-matches
+ (setq args (append (list "--thread=none") args)))
(notmuch-show-insert-forest (notmuch-query-get-threads args))
;; If the query context reduced the results to nothing, run
;; the basic query.
@@ -1158,6 +1170,8 @@ buffer is stored and re-applied after the refresh."
(define-key map (kbd "<backtab>") 'notmuch-show-previous-button)
(define-key map (kbd "TAB") 'notmuch-show-next-button)
(define-key map "s" 'notmuch-search)
+ (define-key map "z" 'notmuch-pick)
+ (define-key map "Z" 'notmuch-show-pick-current-query)
(define-key map "m" 'notmuch-mua-new-mail)
(define-key map "f" 'notmuch-show-forward-message)
(define-key map "r" 'notmuch-show-reply-sender)
@@ -1565,6 +1579,11 @@ to show, nil otherwise."
(notmuch-show-mark-read)
(notmuch-show-message-adjust))
+(defun notmuch-show-pick-current-query ()
+ "Call notmuch pick with the current query"
+ (interactive)
+ (notmuch-pick notmuch-show-thread-id notmuch-show-query-context))
+
(defun notmuch-show-view-raw-message ()
"View the file holding the current message."
(interactive)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5b4f1c5..43e77d0 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -54,6 +54,7 @@
(require 'notmuch-lib)
(require 'notmuch-show)
+(require 'notmuch-pick)
(require 'notmuch-mua)
(require 'notmuch-hello)
(require 'notmuch-maildir-fcc)
@@ -272,6 +273,8 @@ For a mouse binding, return nil."
(define-key map "R" 'notmuch-search-reply-to-thread)
(define-key map "m" 'notmuch-mua-new-mail)
(define-key map "s" 'notmuch-search)
+ (define-key map "z" 'notmuch-pick)
+ (define-key map "Z" 'notmuch-search-pick-current-query)
(define-key map "o" 'notmuch-search-toggle-order)
(define-key map "c" 'notmuch-search-stash-map)
(define-key map "=" 'notmuch-search-refresh-view)
@@ -1021,6 +1024,11 @@ same relative position within the new buffer."
(notmuch-search query oldest-first target-thread target-line continuation)
(goto-char (point-min))))
+(defun notmuch-search-pick-current-query ()
+ "Call notmuch pick with the current query"
+ (interactive)
+ (notmuch-pick notmuch-search-query-string))
+
(defcustom notmuch-poll-script nil
"An external script to incorporate new mail into the notmuch database.
--
1.7.2.3
next prev parent reply other threads:[~2012-02-12 18:49 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-12 18:49 [RFC PATCH v2 0/3] notmuch-pick: an emacs threaded message view with split-pane Mark Walters
2012-02-12 18:49 ` [RFC PATCH v2 1/3] cli: notmuch-show changes to support pick Mark Walters
2012-02-12 21:08 ` Daniel Schoepe
2012-02-12 22:08 ` Mark Walters
2012-02-12 18:49 ` Mark Walters [this message]
2012-02-12 22:27 ` [RFC PATCH v2 2/3] emacs: changes to other files to support notmuch-pick Mark Walters
2012-02-12 18:49 ` [RFC PATCH v2 3/3] emacs: add notmuch-pick itself Mark Walters
2012-02-12 20:39 ` [RFC PATCH v2 0/3] notmuch-pick: an emacs threaded message view with split-pane Jameson Graef Rollins
2012-02-12 21:51 ` Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 00/11] " Mark Walters
2012-02-14 12:28 ` Mark Walters
2012-02-14 15:21 ` Austin Clements
2012-02-15 9:27 ` Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 01/11] cli: add --headers_only option to notmuch-show.c Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 02/11] cli: add sort options " Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 03/11] cli: add --thread= option to notmuch-show Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 04/11] emacs: add entry to notmuch-pick from notmuch-hello.el Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 05/11] emacs: add defcustom group for notmuch-pick Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 06/11] emacs: add extra parameters option to notmuch-query-get-threads Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 07/11] emacs: add entry to notmuch-pick from notmuch.el Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 08/11] emacs: add the entry to notmuch-pick to notmuch-show.el Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 09/11] emacs: make notmuch-show return its buffer Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 10/11] emacs: notmuch-show.el just show the actual matching messages Mark Walters
2012-02-13 1:20 ` [RFC PATCH v3 11/11] emacs: add notmuch-pick itself Mark Walters
2012-02-13 9:05 ` [RFC PATCH v2 0/3] notmuch-pick: an emacs threaded message view with split-pane Aneesh Kumar K.V
2012-02-13 18:16 ` Mark Walters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1329072579-27340-3-git-send-email-markwalters1009@gmail.com \
--to=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).