diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-06-11 23:50:48 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-06-11 23:50:48 -0400 |
commit | ba606bd09f499a6b621b0344454cf5ec9931b421 (patch) | |
tree | 33f99c34227026f8eff9ad6c210cd5e1b6f1b084 | |
parent | 14df537d80f2476f2a90a3746c9ee9a0316866d5 (diff) | |
download | piem-ba606bd09f499a6b621b0344454cf5ec9931b421.tar.gz |
Reposition two incorrectly placed things
Neither of these belong in the "Options" section.
-rw-r--r-- | piem.el | 78 |
1 files changed, 39 insertions, 39 deletions
@@ -101,45 +101,6 @@ how to create an mbox, it should return a function that takes no arguments and inserts the mbox's contents in the current buffer." :type 'hook) -(defvar piem-link-re - (rx "/" (group (one-or-more (not (any "/" "\n")))) - "/" (group (one-or-more (not (any "/" "\n")))) - "/" (group (zero-or-one - (or "raw" - "t.mbox.gz" - (and (or "t" "T") "/#" - (one-or-more (not (any "/" "\n"))))))) - string-end) - "Regular expression matching public-inbox HTTP link. -The first group is the inbox, the second is the message ID, and -the rest is any trailing endpoint.") - -(defun piem-inbox-by-header-match () - "Return inbox based on matching message headers. -This should be called from a buffer containing a message and is -intended to be used by libraries implementing a function for -`piem-get-mid-functions'." - (pcase-let ((`(,listid ,to ,cc) - (save-restriction - (message-narrow-to-headers) - (list (message-fetch-field "list-id") - (message-fetch-field "to") - (message-fetch-field "cc"))))) - (catch 'hit - (dolist (inbox piem-inboxes) - (let* ((info (cdr inbox)) - (p-listid (plist-get info :listid))) - (when (and listid - p-listid - (string-match-p (concat "<" (regexp-quote p-listid) ">") - listid)) - (throw 'hit (car inbox))) - (when-let ((addr (plist-get info :address)) - (to (mapconcat #'identity (list to cc) - " "))) - (when (string-match-p (regexp-quote addr) to) - (throw 'hit (car inbox))))))))) - (defcustom piem-git-executable (or (and (boundp 'magit-git-executable) magit-git-executable) "git") @@ -263,6 +224,45 @@ Functions should accept one argument, the message ID given to ;;;; Extractors +(defvar piem-link-re + (rx "/" (group (one-or-more (not (any "/" "\n")))) + "/" (group (one-or-more (not (any "/" "\n")))) + "/" (group (zero-or-one + (or "raw" + "t.mbox.gz" + (and (or "t" "T") "/#" + (one-or-more (not (any "/" "\n"))))))) + string-end) + "Regular expression matching public-inbox HTTP link. +The first group is the inbox, the second is the message ID, and +the rest is any trailing endpoint.") + +(defun piem-inbox-by-header-match () + "Return inbox based on matching message headers. +This should be called from a buffer containing a message and is +intended to be used by libraries implementing a function for +`piem-get-mid-functions'." + (pcase-let ((`(,listid ,to ,cc) + (save-restriction + (message-narrow-to-headers) + (list (message-fetch-field "list-id") + (message-fetch-field "to") + (message-fetch-field "cc"))))) + (catch 'hit + (dolist (inbox piem-inboxes) + (let* ((info (cdr inbox)) + (p-listid (plist-get info :listid))) + (when (and listid + p-listid + (string-match-p (concat "<" (regexp-quote p-listid) ">") + listid)) + (throw 'hit (car inbox))) + (when-let ((addr (plist-get info :address)) + (to (mapconcat #'identity (list to cc) + " "))) + (when (string-match-p (regexp-quote addr) to) + (throw 'hit (car inbox))))))))) + (defun piem-inbox () "Return the current buffer's inbox." (run-hook-with-args-until-success 'piem-get-inbox-functions)) |