* notmuch-show-message-resend v3
@ 2016-05-07 19:03 Tomi Ollila
2016-05-07 19:03 ` [PATCH 1/2] emacs: add function to resend message to new recipients Tomi Ollila
2016-05-07 19:03 ` [PATCH 2/2] emacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode Tomi Ollila
0 siblings, 2 replies; 4+ messages in thread
From: Tomi Ollila @ 2016-05-07 19:03 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
V3 of notmuch-show-message-resend feature
v2: id:1441204482-26509-3-git-send-email-tomi.ollila@iki.fi
id:87pozza0dw.fsf@qmul.ac.uk has been consulted while doing
these changes (iirc ;)
I tried to get company mode also work while reading email
addresses from minibuffer -- and got something to function,
but not anything really working. Therefore this currently
uses minibuffer (with tab completion) working.
The following diff shows what I tried to do to get it working.
In addition to work poorly it breaks "normal" address tab
completion (as it was crafted to work with minibuffer completion
tests only)
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 7defed3..7a8424e 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -256,12 +256,11 @@ (defun notmuch-address-from-minibuffer (prompt)
;; "Original" minibuffer keymap is restored just before calling
;; notmuch-address-expand-name as it may also use minibuffer-local-map
;; (completing-read probably does not but if something else is used there).
- (define-key rmap (kbd "TAB") (lambda ()
- (interactive)
- (let ((enable-recursive-minibuffers t)
- (minibuffer-local-map omap))
- (notmuch-address-expand-name))))
- (let ((minibuffer-local-map rmap))
+ (define-key rmap (kbd "TAB") #'company-manual-begin)
+
+ (let ((minibuffer-local-map rmap)
+ (minibuffer-setup-hook minibuffer-setup-hook))
+ (add-hook 'minibuffer-setup-hook #'notmuch-company-setup)
(read-string prompt)))))
;;
diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el
index add3161..210175a 100644
--- a/emacs/notmuch-company.el
+++ b/emacs/notmuch-company.el
@@ -45,7 +45,7 @@ (defvar notmuch-address-completion-headers-regexp)
;;;###autoload
(defun notmuch-company-setup ()
- (company-mode)
+ (company-mode 1)
(make-local-variable 'company-backends)
(setq company-backends '(notmuch-company)))
@@ -58,10 +58,7 @@ (defun notmuch-company (command &optional arg &rest _ignore)
(completion-ignore-case t))
(case command
(interactive (company-begin-backend 'notmuch-company))
- (prefix (and (derived-mode-p 'message-mode)
- (looking-back (concat notmuch-address-completion-headers-regexp ".*")
- (line-beginning-position))
- (setq notmuch-company-last-prefix (company-grab "[:,][ \t]*\\(.*\\)" 1 (point-at-bol)))))
+ (prefix (setq notmuch-company-last-prefix (company-grab "[:,][ \t]*\\(.*\\)" 1)))
(candidates (cond
(notmuch-address-full-harvest-finished
;; Update harvested addressed from time to time
@@ -82,5 +79,15 @@ (defun notmuch-company (command &optional arg &rest _ignore)
0))
(no-cache t))))
+;; (partial) code snipped someone(tm) doing some company-minubuffer stuff
+;; (defun company--posn-col-row (posn)
+;; (let ((col (car (posn-col-row posn)))
+;; ;; `posn-col-row' doesn't work well with lines of different height.
+;; ;; `posn-actual-col-row' doesn't handle multiple-width characters.
+;; (row (cdr (posn-actual-col-row posn))))
+;; (when (and header-line-format (version< emacs-version "24.3.93.3"))
+;; ;; http://debbugs.gnu.org/18384
+;; (cl-decf row))
+;; (cons (+ col (window-hscroll) company-col-offset) (+ row company-row-offset))))
(provide 'notmuch-company)
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/2] emacs: add function to resend message to new recipients
2016-05-07 19:03 notmuch-show-message-resend v3 Tomi Ollila
@ 2016-05-07 19:03 ` Tomi Ollila
2016-05-19 11:06 ` David Bremner
2016-05-07 19:03 ` [PATCH 2/2] emacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode Tomi Ollila
1 sibling, 1 reply; 4+ messages in thread
From: Tomi Ollila @ 2016-05-07 19:03 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
The new function notmuch-show-message-resend re-sends
message to new recipients using #'message-resend.
Recipients are read from minibuffer as a comma-separated
string (with some keyboard support including tab completion).
Final confirmation before sending is asked.
---
emacs/notmuch-address.el | 19 +++++++++++++++++++
emacs/notmuch-show.el | 8 ++++++++
2 files changed, 27 insertions(+)
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index aafbe5fb8328..8b79d3402184 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -249,6 +249,25 @@ (defun notmuch-address-harvest-trigger ()
;;
+(defun notmuch-address-from-minibuffer (prompt)
+ (if (not notmuch-address-command)
+ (read-string prompt)
+ (let ((rmap (copy-keymap minibuffer-local-map))
+ (omap minibuffer-local-map))
+ ;; Configure TAB to start completion when executing read-string.
+ ;; "Original" minibuffer keymap is restored just before calling
+ ;; notmuch-address-expand-name as it may also use minibuffer-local-map
+ ;; (completing-read probably does not but if something else is used there).
+ (define-key rmap (kbd "TAB") (lambda ()
+ (interactive)
+ (let ((enable-recursive-minibuffers t)
+ (minibuffer-local-map omap))
+ (notmuch-address-expand-name))))
+ (let ((minibuffer-local-map rmap))
+ (read-string prompt)))))
+
+;;
+
(provide 'notmuch-address)
;;; notmuch-address.el ends here
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5d9b7b45c557..4b8c66fdb2a1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1855,6 +1855,14 @@ (defun notmuch-show-forward-open-messages (&optional prompt-for-sender)
(error "No open messages to forward."))
(notmuch-mua-new-forward-messages open-messages prompt-for-sender)))
+(defun notmuch-show-resend-message (addresses)
+ "Resend the current message."
+ (interactive (list (notmuch-address-from-minibuffer "Resend to: ")))
+ (when (y-or-n-p (concat "Confirm resend to " addresses " "))
+ (notmuch-show-view-raw-message)
+ (message-resend addresses)
+ (notmuch-bury-or-kill-this-buffer)))
+
(defun notmuch-show-next-message (&optional pop-at-end)
"Show the next message.
--
2.6.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] emacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode
2016-05-07 19:03 notmuch-show-message-resend v3 Tomi Ollila
2016-05-07 19:03 ` [PATCH 1/2] emacs: add function to resend message to new recipients Tomi Ollila
@ 2016-05-07 19:03 ` Tomi Ollila
1 sibling, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2016-05-07 19:03 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
This binding is similar to mutt's, which is
bind {mode} b "bounce-message" # remail a message to another user
where {mode} is 'index', 'pager' or 'attach'.
---
emacs/notmuch-show.el | 1 +
1 file changed, 1 insertion(+)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4b8c66fdb2a1..f33096cf00b8 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1418,6 +1418,7 @@ (defvar notmuch-show-mode-map
(define-key map (kbd "TAB") 'notmuch-show-next-button)
(define-key map "f" 'notmuch-show-forward-message)
(define-key map "F" 'notmuch-show-forward-open-messages)
+ (define-key map "b" 'notmuch-show-resend-message)
(define-key map "l" 'notmuch-show-filter-thread)
(define-key map "r" 'notmuch-show-reply-sender)
(define-key map "R" 'notmuch-show-reply)
--
2.6.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-19 11:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-07 19:03 notmuch-show-message-resend v3 Tomi Ollila
2016-05-07 19:03 ` [PATCH 1/2] emacs: add function to resend message to new recipients Tomi Ollila
2016-05-19 11:06 ` David Bremner
2016-05-07 19:03 ` [PATCH 2/2] emacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode Tomi Ollila
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).