;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/gnus/mailrc.el (require 'cl-lib) (require 'subr-x) (defun mailrc-read-name () (save-excursion (goto-char (pos-bol)) (let*((eol (pos-eol)) (beg (search-forward "\"" eol t)) (end (search-forward "<" eol t))) (when (and beg end) (string-trim (buffer-substring-no-properties beg (1- end))))))) (defun mailrc-read-mail () (save-excursion (goto-char (pos-bol)) (let*((eol (pos-eol)) (beg (search-forward "<" eol t)) (end (search-forward ">" eol t))) (when (and beg end) (string-trim (buffer-substring-no-properties beg (1- end))))))) (let ((mailrc-all-mails '())) (defun parse-mailrc-line () (let*((name (mailrc-read-name)) (mail (mailrc-read-mail)) (entry (and name mail (list name mail))) ) (when entry (push entry mailrc-all-mails) ))) (declare-function parse-mailrc-line nil) (defun parse-mailrc-file () (save-excursion (goto-char (point-min)) (cl-loop while (zerop (forward-line)) do (parse-mailrc-line) )) mailrc-all-mails) (declare-function parse-mailrc-file nil) ) (provide 'mailrc)