* [PATCH 1/2] emacs: mv notmuch-{show,common}-do-stash
@ 2010-09-18 19:48 Jameson Rollins
2010-09-18 19:48 ` [PATCH 2/2] emacs: add stash thread-id function to notmuch-search mode Jameson Rollins
0 siblings, 1 reply; 3+ messages in thread
From: Jameson Rollins @ 2010-09-18 19:48 UTC (permalink / raw)
To: notmuch
Here we move the notmuch-show/notmuch-show-do-stash function to
notmuch-lib/notmuch-common-do-stash. Nothing in this function is
notmuch-show mode specific, so this move will make it cleaner to be
used by other modes (such as notmuch-search).
---
emacs/notmuch-lib.el | 8 ++++++++
emacs/notmuch-show.el | 20 ++++++++------------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index f30bcb4..9fb15ca 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -70,6 +70,13 @@ the user hasn't set this variable with the old or new value."
;;
+(defun notmuch-common-do-stash (text)
+ "Common function to stash text in kill ring, and display in minibuffer."
+ (kill-new text)
+ (message "Stashed: %s" text))
+
+;;
+
;; XXX: This should be a generic function in emacs somewhere, not
;; here.
(defun point-invisible-p ()
@@ -86,3 +93,4 @@ within the current window."
(assq prop buffer-invisibility-spec)))))
(provide 'notmuch-lib)
+
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b0c1f63..b88267d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1012,49 +1012,45 @@ buffer."
(interactive)
(notmuch-show-archive-thread-internal nil))
-(defun notmuch-show-do-stash (text)
- (kill-new text)
- (message "Saved: %s" text))
-
(defun notmuch-show-stash-cc ()
"Copy CC field of current message to kill-ring."
(interactive)
- (notmuch-show-do-stash (notmuch-show-get-cc)))
+ (notmuch-common-do-stash (notmuch-show-get-cc)))
(defun notmuch-show-stash-date ()
"Copy date of current message to kill-ring."
(interactive)
- (notmuch-show-do-stash (notmuch-show-get-date)))
+ (notmuch-common-do-stash (notmuch-show-get-date)))
(defun notmuch-show-stash-filename ()
"Copy filename of current message to kill-ring."
(interactive)
- (notmuch-show-do-stash (notmuch-show-get-filename)))
+ (notmuch-common-do-stash (notmuch-show-get-filename)))
(defun notmuch-show-stash-from ()
"Copy From address of current message to kill-ring."
(interactive)
- (notmuch-show-do-stash (notmuch-show-get-from)))
+ (notmuch-common-do-stash (notmuch-show-get-from)))
(defun notmuch-show-stash-message-id ()
"Copy message ID of current message to kill-ring."
(interactive)
- (notmuch-show-do-stash (notmuch-show-get-message-id)))
+ (notmuch-common-do-stash (notmuch-show-get-message-id)))
(defun notmuch-show-stash-subject ()
"Copy Subject field of current message to kill-ring."
(interactive)
- (notmuch-show-do-stash (notmuch-show-get-subject)))
+ (notmuch-common-do-stash (notmuch-show-get-subject)))
(defun notmuch-show-stash-tags ()
"Copy tags of current message to kill-ring as a comma separated list."
(interactive)
- (notmuch-show-do-stash (mapconcat 'identity (notmuch-show-get-tags) ",")))
+ (notmuch-common-do-stash (mapconcat 'identity (notmuch-show-get-tags) ",")))
(defun notmuch-show-stash-to ()
"Copy To address of current message to kill-ring."
(interactive)
- (notmuch-show-do-stash (notmuch-show-get-to)))
+ (notmuch-common-do-stash (notmuch-show-get-to)))
;; Commands typically bound to buttons.
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] emacs: add stash thread-id function to notmuch-search mode
2010-09-18 19:48 [PATCH 1/2] emacs: mv notmuch-{show,common}-do-stash Jameson Rollins
@ 2010-09-18 19:48 ` Jameson Rollins
2010-11-12 1:29 ` Carl Worth
0 siblings, 1 reply; 3+ messages in thread
From: Jameson Rollins @ 2010-09-18 19:48 UTC (permalink / raw)
To: notmuch
This add a "stash-map" for search-mode, just like in show-mode, and
adds one function, bound to "i" to stash the thread-id of the current
selected thread.
Couldn't think of the correct way to stash other thread info, so I
didn't add any other stash functions for now.
---
emacs/notmuch.el | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index fe1041f..c8486ba 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -207,6 +207,7 @@ For a mouse binding, return nil."
(define-key map "m" 'notmuch-mua-mail)
(define-key map "s" 'notmuch-search)
(define-key map "o" 'notmuch-search-toggle-order)
+ (define-key map "c" 'notmuch-search-stash-map)
(define-key map "=" 'notmuch-search-refresh-view)
(define-key map "G" 'notmuch-search-poll-and-refresh-view)
(define-key map "t" 'notmuch-search-filter-by-tag)
@@ -221,6 +222,18 @@ For a mouse binding, return nil."
"Keymap for \"notmuch search\" buffers.")
(fset 'notmuch-search-mode-map notmuch-search-mode-map)
+(defvar notmuch-search-stash-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "i" 'notmuch-search-stash-thread-id)
+ map)
+ "Submap for stash commands")
+(fset 'notmuch-search-stash-map notmuch-search-stash-map)
+
+(defun notmuch-search-stash-thread-id ()
+ "Copy thread ID of current thread to kill-ring."
+ (interactive)
+ (notmuch-common-do-stash (notmuch-search-find-thread-id)))
+
(defvar notmuch-search-query-string)
(defvar notmuch-search-target-thread)
(defvar notmuch-search-target-line)
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] emacs: add stash thread-id function to notmuch-search mode
2010-09-18 19:48 ` [PATCH 2/2] emacs: add stash thread-id function to notmuch-search mode Jameson Rollins
@ 2010-11-12 1:29 ` Carl Worth
0 siblings, 0 replies; 3+ messages in thread
From: Carl Worth @ 2010-11-12 1:29 UTC (permalink / raw)
To: Jameson Rollins, notmuch
[-- Attachment #1: Type: text/plain, Size: 624 bytes --]
On Sat, 18 Sep 2010 15:48:22 -0400, Jameson Rollins <jrollins@finestructure.net> wrote:
> This add a "stash-map" for search-mode, just like in show-mode, and
> adds one function, bound to "i" to stash the thread-id of the current
> selected thread.
>
> Couldn't think of the correct way to stash other thread info, so I
> didn't add any other stash functions for now.
Excellent. I've wanted this functionality for a while now. Hopefully I
can keep up better with patches on the list in the future so I don't
have to delay my gratification so much.
This is pushed now.
-Carl
--
carl.d.worth@intel.com
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-12 1:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-18 19:48 [PATCH 1/2] emacs: mv notmuch-{show,common}-do-stash Jameson Rollins
2010-09-18 19:48 ` [PATCH 2/2] emacs: add stash thread-id function to notmuch-search mode Jameson Rollins
2010-11-12 1:29 ` Carl Worth
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).