[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb eab79ec 241/449: Allow attachment transfers in nn
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb eab79ec 241/449: Allow attachment transfers in nngnorb summary buffers |
Date: |
Fri, 27 Nov 2020 23:15:47 -0500 (EST) |
branch: externals/gnorb
commit eab79ece8c218409a04578825f719bdc1d70898a
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Allow attachment transfers in nngnorb summary buffers
* nngnorb.el (nngnorb-attachment-file-list): New buffer-local variable
to hold attachment list.
(nnir-run-gnorb): Populate the list as we scan org ids.
(gnorb-summary-minor-mode): Copy the value of the variable into the
summary buffer.
(gnorb-summary-reply-hook): Copy the value of the variable into the
reply buffer, and prompt to attach attachments.
For some reason, buffer-local-value isn't working, and I've had to
do (with-current-buffer buf variable). Why?
---
nngnorb.el | 44 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/nngnorb.el b/nngnorb.el
index 930f8e2..bdaf569 100644
--- a/nngnorb.el
+++ b/nngnorb.el
@@ -45,6 +45,12 @@
(defvar nngnorb-status-string "")
+(defvar nngnorb-attachment-file-list nil
+ "A place to store Org attachments relevant to the subtree being
+ viewed.")
+
+(make-variable-buffer-local 'nngnorb-attachment-file-list)
+
(gnus-declare-backend "nngnorb" 'none)
(add-to-list 'nnir-method-default-engines '(nngnorb . gnorb))
@@ -77,7 +83,8 @@ be scanned for gnus messages, and those messages displayed."
(buf (get-buffer-create nnir-tmp-buffer))
msg-ids org-ids links vectors)
(with-current-buffer buf
- (erase-buffer))
+ (erase-buffer)
+ (setq nngnorb-attachment-file-list nil))
(when (equal "5.13" gnus-version-number)
(setq q (car q)))
(cond ((string-match "id\\+\\([[:alnum:]-]+\\)$" q)
@@ -93,7 +100,16 @@ be scanned for gnus messages, and those messages displayed."
(setq org-ids
(append
(gnorb-collect-ids)
- org-ids)))))
+ org-ids))
+ (when org-ids
+ (with-current-buffer buf
+ ;; The file list var is buffer local, so set it
+ ;; (local to the nnir-tmp-buffer) to a full list
+ ;; of all files in the subtree.
+ (dolist (id org-ids)
+ (setq nngnorb-attachment-file-list
+ (append (gnorb-org-attachment-list id)
+ nngnorb-attachment-file-list))))))))
((listp q)
;; be a little careful: this could be a list of links, or
;; it could be the full plist
@@ -159,7 +175,13 @@ These *Summary* buffers are usually created by calling
While active, this mode provides some Gnorb-specific commands,
and also advises Gnus' reply-related commands in order to
continue to provide tracking of sent messages."
- nil " Gnorb" gnorb-summary-minor-mode-map)
+ nil " Gnorb" gnorb-summary-minor-mode-map
+ (setq nngnorb-attachment-file-list
+ ;; Copy the list of attached files from the nnir-tmp-buffer to
+ ;; this summary buffer.
+ (buffer-local-value
+ 'nngnorb-attachment-file-list
+ (get-buffer nnir-tmp-buffer))))
(define-key gnorb-summary-minor-mode-map
[remap gnus-summary-exit]
@@ -240,7 +262,10 @@ continue to provide tracking of sent messages."
;; Not actually a "hook"
(let* ((msg-id (aref message-reply-headers 4))
(org-id (car-safe (gnus-registry-get-id-key msg-id 'gnorb-ids)))
- (compose-marker (make-marker)))
+ (compose-marker (make-marker))
+ (attachments (buffer-local-value
+ 'nngnorb-attachment-file-list
+ (get-buffer nnir-tmp-buffer))))
(when org-id
(move-marker compose-marker (point))
(save-restriction
@@ -253,7 +278,16 @@ continue to provide tracking of sent messages."
org-id)
(add-to-list 'message-exit-actions
'gnorb-org-restore-after-send t))
- (goto-char compose-marker))))
+ (goto-char compose-marker))
+ (when attachments
+ (map-y-or-n-p
+ (lambda (a) (format "Attach %s to outgoing message? "
+ (file-name-nondirectory a)))
+ (lambda (a)
+ (mml-attach-file a (mm-default-file-encoding a)
+ nil "attachment"))
+ attachments
+ '("file" "files" "attach")))))
(defun gnorb-summary-exit ()
"Like `gnus-summary-exit', but restores the gnorb window conf."
- [elpa] externals/gnorb 326fcb0 210/449: Document new tracking system, (continued)
- [elpa] externals/gnorb 326fcb0 210/449: Document new tracking system, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 096e39a 209/449: Remove the capture-to-child/sibling actions for now, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 04d2951 211/449: Shadow message forwarding in nngnorb summary buffers, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b6ab1c5 214/449: Only use the summary reply hook once., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 46a8e6b 217/449: Assume creation of attachment dirs, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6f868fb 219/449: Fix logic of finding links to reply to, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5182998 228/449: Necessary headers in main file, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ec32255 231/449: Use org-reveal when restoring/triggering, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4da19b0 232/449: Get rid of gnorb-org-mail-todos, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 01f0a31 235/449: Move all *.el files out of lisp/ to top directory, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb eab79ec 241/449: Allow attachment transfers in nngnorb summary buffers,
Stefan Monnier <=
- [elpa] externals/gnorb 20de4ee 104/449: Caching of msg-id to org-id correlations, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb edab89d 110/449: Be more careful about cleaning up attachments, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6375f83 112/449: And append doesn't modify destructively..., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb f7b93f2 115/449: Whitespace/indentation cleanup, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e86d24a 119/449: Robustification of nngnorb nnir message viewing, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e089d66 129/449: Documenting recent additions in the README, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d254f39 140/449: Merge and simplify handle-mail and email-subtree, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de3a512 244/449: Releasing version 1, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4b8a6da 255/449: New function for removing message/heading association, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb aaf8556 261/449: Be a good citizen about the cl package, Stefan Monnier, 2020/11/27