From 43bed1f97e6f1a229553d7a25dc437741326772e Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 10 May 2023 13:08:35 -0500 Subject: Bankruptcy 10 --- lisp/ical2org.el | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 lisp/ical2org.el (limited to 'lisp/ical2org.el') diff --git a/lisp/ical2org.el b/lisp/ical2org.el deleted file mode 100644 index 2716787..0000000 --- a/lisp/ical2org.el +++ /dev/null @@ -1,56 +0,0 @@ -;;; ical2org.el --- Run ical2org in Emacs -*- lexical-binding: t; -*- - -;;; Commentary: - -;; based on code from this reddit thread: -;; https://www.reddit.com/r/emacs/comments/8s1ion/ical2org_integrations/ -;; -;; see also: icalendar.org (converts to diary format, might be all I need) -;; -;; XXX: This code currently imports into gnus, which isn't what I want. - -;;; Code: - -(defun ical2org (&optional replace output-buffer) - "Run ical2org on contents of this buffer. -If REPLACE (interactive prefix argument), replace contents of the -buffer. If no REPLACE nor OUTPUT-BUFFER, output goes to -minibuffer." - (interactive "P") - (shell-command-on-region (point-min) (point-max) - "ical2org" - output-buffer - replace - "*ical2org errors*" - 'display-errors)) - -(defun ical2org-capture () - "Run `ical2org' on this buffer, then `org-capture' the result. -Leaves current buffer as-was afterwards." - (interactive) - (let ((buf (current-buffer)) - (ics (buffer-string))) - (ical2org 'replace) - (mark-whole-buffer) - (call-interactively #'org-capture) - (with-current-buffer buf - (delete-region (point-min) (point-max)) - (insert ics)))) - -(defun my-gnus-org-capture-icalendar () - "Capture any text/calendar invites with org." - (interactive) - (with-current-buffer gnus-article-buffer ;;; XXX - (save-excursion - (dolist (part gnus-article-mime-handle-alist) - (when (and (>= (length part) 3) - (listp (caddr part)) - (or (equal "application/ics" (caaddr part)) - (equal "text/calendar" (caaddr part)))) - (save-window-excursion - (gnus-mime-copy-part (cdr part)) - (ical2org-capture))))))) -(add-hook 'gnus-article-prepare-hook #'my-gnus-org-capture-icalendar) - -(provide 'ical2org) -;;; ical2org.el ends here -- cgit 1.4.1-21-gabe81