[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/gnorb 452a3f0 177/449: Basic skeleton of registry usage

From: Stefan Monnier
Subject: [elpa] externals/gnorb 452a3f0 177/449: Basic skeleton of registry usage
Date: Fri, 27 Nov 2020 23:15:33 -0500 (EST)

branch: externals/gnorb
commit 452a3f03b98849fe784db394c5a387768082dcdc
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Basic skeleton of registry usage
    * lisp/gnorb-registry.el: New file
 lisp/gnorb-registry.el | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++
 lisp/gnorb.el          |  1 +
 2 files changed, 61 insertions(+)

diff --git a/lisp/gnorb-registry.el b/lisp/gnorb-registry.el
new file mode 100644
index 0000000..df05029
--- /dev/null
+++ b/lisp/gnorb-registry.el
@@ -0,0 +1,60 @@
+;;; gnorb-registry.el --- Registry implementation for Gnorb
+;; This file is in the public domain.
+;; Author: Eric Abrahamsen <eric@ericabrahamsen.net.>
+;; This file is part of GNU Emacs.
+;; GNU Emacs 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.
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; GNU General Public License for more details.
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+;;; Commentary:
+;; Early on, Gnorb's message/todo tracking was done by relying on the
+;; user to insert links to received messages into an Org heading, and
+;; by automatically storing the Message-Ids of sent messages in a
+;; property (`gnorb-org-msg-id-key', defaulting to GNORB_MSG_ID) on
+;; the same heading. The heading could find all relevant messages by
+;; combining the links (incoming) and the IDs of the Gnorb-specific
+;; property (outgoing).
+;; In the end, this proved to be fragile and messy. Enter the
+;; registry. The Gnus registry is a specialization of a general
+;; "registry" library -- it's possible to roll your own. If you want
+;; to track connections between messages and Org headings, it's an
+;; obvious choice: Each relevant message is stored in the registry,
+;; keyed on its Message-ID, and the org-ids of all relevant headings
+;; are stored in a custom property, in our case gnorb-ids. This allows
+;; us to keep all Gnorb-specific data in one place, without polluting
+;; Org files or Gnus messages, persistent on disk, and with the added
+;; bonus of providing a place to keep arbitrary additional metadata.
+;; The drawback is that the connections are no longer readily visible
+;; to the user (they need to query the registry to see them), and it
+;; becomes perhaps a bit more difficult (but only a bit) to keep
+;; registry data in sync with the current state of the user's Gnus and
+;; Org files. But a clear win, in the end.
+;;; Code:
+(require 'gnus-registry)
+(defgroup gnorb-registry nil
+  "Gnorb's use of the Gnus registry."
+  :tag "Gnorb Registry"
+  :group 'gnorb)
+(provide 'gnorb-registry)
diff --git a/lisp/gnorb.el b/lisp/gnorb.el
index d972ee8..a7676b1 100644
--- a/lisp/gnorb.el
+++ b/lisp/gnorb.el
@@ -29,6 +29,7 @@
 (require 'gnorb-gnus)
 (require 'gnorb-bbdb)
 (require 'gnorb-org)
+(require 'gnorb-registry)
 (provide 'gnorb)
 ;;; gnorb.el ends here

reply via email to

[Prev in Thread] Current Thread [Next in Thread]