diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-05-03 12:27:54 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-05-07 00:37:11 -0400 |
commit | 4d386818291d2e3b4072b188ab93e522968ea53e (patch) | |
tree | 0232d1ae10598283c472020d4676d30b188b7b46 /piem.el | |
parent | 776393889a3be6f79f800506ccc1587d635cc903 (diff) | |
download | piem-4d386818291d2e3b4072b188ab93e522968ea53e.tar.gz |
piem: Sketch a base
This does nothing useful, but the idea is that it never will do much
of anything on its own. Different libraries---piem-notmuch,
piem-elfeed, piem-gnus, and so on---will populate its hooks, teaching
it how to extract information.
Diffstat (limited to 'piem.el')
-rw-r--r-- | piem.el | 110 |
1 files changed, 109 insertions, 1 deletions
@@ -1,4 +1,112 @@ -;;; piem.el --- Emacs tools for working with public-index +;;; piem.el --- Emacs tools for working with public-index -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Kyle Meyer + +;; Author: Kyle Meyer <kyle@kyleam.com> +;; Keywords: vc, tools +;; Version: 0.0.0 +;; Package-Requires: ((emacs "26.3")) + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'subr-x) + +(defgroup piem () + "Emacs tools for working with public-inbox archives." + :link '(info-link "(piem)Top") + :group 'tools) + +;; TODO: These intentionally follow public-inbox's configuration +;; names. Eventually reading values from there as well should be +;; supported. +;; +;; TODO: Decide how to deal with inboxes that map to more than one +;; coderepos. This is important to support for people that want to +;; use a catchall inbox for small projects which they don't think +;; (yet) need a dedicated address. +(defcustom piem-inboxes nil + "List of public-inbox-archived projects. + +Elements have the form (NAME . INFO), where INFO is a property +list that supports the following properties: + + :address + :listid + The email address and List-ID for the inbox. + :coderepo + Local path of the code repository associated with the inbox. + :url + A URL hosting HTTPS archives. + +Here's an example for the public-inbox project itself: + + (\"public-inbox\" . + (:coderepo + \"~/src/public-inbox/\" + :address + \"meta@public-inbox.org\" + :listid + \"meta.public-inbox.org\" + :url + \"https://public-inbox.org/meta/\"))" + :type '(alist :key-type string + :value-type + (plist :value-type string))) + +(defcustom piem-get-inbox-functions nil + "Functions tried to get the inbox of the current buffer. +Each function should accept no arguments and return the name of +the inbox associated with the current buffer or nil." + :type 'hook) + +(defcustom piem-get-mid-functions nil + "Functions tried to get the message ID of the current buffer. +Each function should accept no arguments and return the +message ID associated with the current buffer or nil." + :type 'hook) + +(defcustom piem-mid-to-thread-functions nil + "Functions tried to create an mbox from a message ID. +Each function should accept one argument, the message ID. If the +function knows how to create an mbox for the message ID, it +should return a function that takes no arguments and inserts the +mbox's contents in the current buffer." + :type 'hook) + +;;;###autoload +(defun piem-inbox () + "Return the current buffer's inbox." + (run-hook-with-args-until-success 'piem-get-inbox-functions)) + +;;;###autoload +(defun piem-inbox-coderepo () + "Return the code repository of current buffer's inbox." + (when-let ((p (piem-inbox)) + (repo (plist-get + (alist-get p piem-inboxes) :coderepo))) + (expand-file-name repo))) + +;;;###autoload +(defun piem-mid () + "Return the current buffer's message ID." + (run-hook-with-args-until-success 'piem-get-mid-functions)) (defun piem-please () "How I wish I could intersect my emails, feeds, and repos") |