From 944e7eceb86b916ed24a85ea40dfc51b5d826e1d Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 20 Aug 2021 03:38:47 +0100 Subject: jao-notmuch-move (unused) spin-off --- lib/net/jao-notmuch.el | 47 +---------------------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) (limited to 'lib/net/jao-notmuch.el') diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index c7dc1fb..d3c7841 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -24,62 +24,17 @@ ;;; Code: -(require 'eww) (require 'outline) (require 'notmuch) (require 'notmuch-tree) (require 'notmuch-show) - -;; Moving messages around - -(defvar jao-notmuch-mailboxes nil) -(defvar jao-notmuch-mailboxes-rx nil) - -(defun jao-notmuch--path-to-mailbox (full-path) - (unless jao-notmuch-mailboxes-rx - (setq jao-notmuch-mailboxes-rx (regexp-opt jao-notmuch-mailboxes))) - (if (string-match jao-notmuch-mailboxes-rx full-path) - (match-string 0 full-path) - (user-error "Message not in any registered mailbox!"))) - -(defun jao-notmuch--msg-props () - (if-let ((p (save-excursion - (beginning-of-line) - (text-property-search-forward :notmuch-message-properties)))) - (prop-match-value p) - (user-error "No message at point"))) - -(defun jao-notmuch--full-path () - (seq-find #'file-exists-p (plist-get (jao-notmuch--msg-props) :filename))) - -(defun jao-notmuch--move (&optional full-path d) - (let* ((full-path (or full-path (jao-notmuch--full-path))) - (ff (jao-notmuch--path-to-mailbox full-path)) - (d (or d (completing-read (format "From %s to: " ff) - (remove ff jao-notmuch-mailboxes) nil t))) - (dest (string-replace ff d full-path)) - (dest (replace-regexp-in-string ",U=.+$" "m:2,S" dest)) - (ftags (split-string ff "/")) - (ttags (split-string d "/"))) - (when (y-or-n-p (format "%s -> %s? " ftags ttags)) - (notmuch-tree-close-message-window) - (notmuch-tree-tag (append (notmuch-tag-change-list ftags t) - (notmuch-tag-change-list ttags))) - (rename-file (jao-notmuch--full-path) dest) - (shell-command-to-string "notmuch new") - (notmuch-refresh-this-buffer)))) - -(defun jao-notmuch-move-message () - "Move message at point to another folder." - (interactive) - (jao-notmuch--move)) - ;; Targetting the displayed message from the tree view (defvar-local jao-notmuch--tree-buffer nil) +(declare eww--url-at-point "eww") (defun jao-notmuch-goto-message-buffer (&optional and-click no-record) (interactive "P") -- cgit v1.2.3