[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 83131b8: packages/excorporate: Support diary on Emacs 24.1
[elpa] master 83131b8: packages/excorporate: Support diary on Emacs 24.1, 24.2, 24.3
Wed, 12 Sep 2018 18:23:21 -0400 (EDT)
Author: Thomas Fitzsimmons <address@hidden>
Commit: Thomas Fitzsimmons <address@hidden>
packages/excorporate: Support diary on Emacs 24.1, 24.2, 24.3
* packages/excorporate/excorporate.el: Update copyright year.
Unbump Emacs version requirement to 24.1. Add nadvice 0.2
(exco-calendar-item-with-details-iterate): Do not pass identifier
* packages/excorporate/excorporate-diary.el: Require nadvice.
(exco-diary-icalendar--add-diary-entry-around): Port defadvice to
(exco-diary-initialize): Move retrieval message to
(exco-diary-diary-advice): Add retrieval message from
exco-diary-initialize. Explicitly return nil.
(excorporate-diary-enable): Create excorporate diary directory and
blank files. Sharp quote and reorder diary hooks.
(excorporate-diary-disable): Remove autoload cookie.
packages/excorporate/excorporate-diary.el | 32 +++++++++++++++++++++----------
packages/excorporate/excorporate.el | 10 +++++++---
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/packages/excorporate/excorporate-diary.el
index dcd6cc2..c4c94e1 100644
@@ -31,7 +31,9 @@
+;; FIXME: Add something like this to diary-lib.el.
(defun exco-diary-diary-make-entry (string &optional nonmarking file)
"Insert a diary entry STRING which may be NONMARKING in FILE.
If omitted, NONMARKING defaults to nil and FILE defaults to
@@ -53,9 +55,9 @@ If omitted, NONMARKING defaults to nil and FILE defaults to
(if nonmarking diary-nonmarking-symbol "")
-(defadvice icalendar--add-diary-entry (around
+;; FIXME: Have icalendar--add-diary-entry use the new diary-lib
+;; function instead of diary-make-entry.
+(defun exco-diary-icalendar--add-diary-entry-around (original &rest arguments)
"Prevent whitespace workaround from selecting diary buffer.
Also prevent `diary-make-entry' from putting the diary file
where (other-buffer (current-buffer)) will return it."
@@ -65,7 +67,9 @@ where (other-buffer (current-buffer)) will return it."
;; and buffer manipulations.
+ (apply original arguments)))
+(advice-add #'icalendar--add-diary-entry :around
@@ -83,7 +87,6 @@ This file will be #include'd in `diary-file' by
"Initialize diary files used by Excorporate.
Run before retrieving diary entries from servers. TODAY is t to
initialize for today's date, nil otherwise."
- (message "Retrieving diary entries via Excorporate...")
;; Keep today's entries if running on a day other than today. If
;; retrieving results for today, delete results from days other than
;; today, in case the transient file (having been filled in on a
@@ -149,6 +152,7 @@ the arguments to the advisee."
;; `diary-view-entries' are ignored.
+ (message "Retrieving diary entries via Excorporate...")
(exco-diary-initialize (calendar-date-equal today date)))
(lambda (identifier callback)
(cl-destructuring-bind (month day year) date
@@ -166,7 +170,13 @@ the arguments to the advisee."
(let ((appt-display-diary nil))
(message "Done retrieving diary entries via Excorporate."))
+ ;; Just return nil from this advice. We eventually run the advisee
+ ;; asynchronously so there is no way of providing the same return
+ ;; value as the unadvised `diary' and `diary-view-entries'
+ ;; functions. Luckily they seem to only be used interactively, at
+ ;; least within Emacs itself.
(defun exco-diary-diary-around (original-diary &rest arguments)
"Call `diary' asynchronously.
@@ -192,7 +202,10 @@ ARGUMENTS are the arguments to `diary-view-entries'."
(defun excorporate-diary-enable ()
"Enable Excorporate diary support."
- ;; Remove these first so that `diary' will not be run by any save
+ ;; Create the directory for Excorporate diary files if it doesn't
+ ;; already exist.
+ (exco-diary-initialize t)
+ ;; Remove advice first so that `diary' will not be run by any save
(advice-remove #'diary #'exco-diary-diary-around)
(advice-remove #'diary-view-entries #'exco-diary-diary-view-entries-override)
@@ -209,12 +222,11 @@ ARGUMENTS are the arguments to `diary-view-entries'."
(advice-add #'diary :around #'exco-diary-diary-around)
(advice-add #'diary-view-entries :override
- (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
- (add-hook 'diary-list-entries-hook 'diary-sort-entries)
+ (add-hook 'diary-list-entries-hook #'diary-sort-entries)
+ (add-hook 'diary-list-entries-hook #'diary-include-other-diary-files)
(message "Excorporate diary support enabled."))
(defun excorporate-diary-disable ()
"Disable Excorporate diary support."
diff --git a/packages/excorporate/excorporate.el
index e458028..0b0120e 100644
@@ -1,6 +1,6 @@
;;; excorporate.el --- Exchange integration -*- lexical-binding: t
-;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
;; Author: Thomas Fitzsimmons <address@hidden>
;; Maintainer: Thomas Fitzsimmons <address@hidden>
@@ -8,7 +8,7 @@
;; Version: 0.7.7
;; Keywords: calendar
;; Homepage: https://www.fitzsim.org/blog/
-;; Package-Requires: ((emacs "24.4") (fsm "0.2") (soap-client "3.1.4")
+;; Package-Requires: ((emacs "24.1") (fsm "0.2") (soap-client "3.1.4")
(url-http-ntlm "2.0.3") (nadvice "0.2"))
;; 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
@@ -102,6 +102,10 @@
;; Fabio Leimgruber <address@hidden> tested NTLM
;; authentication against a challenging server configuration.
+;; Stefan Monnier <address@hidden> wrote a variant of
+;; nadvice.el for GNU ELPA so that Excorporate could continue
+;; supporting Emacs versions 24.1, 24.2 and 24.3.
;; Implementation-visible functions and variables.
@@ -728,7 +732,7 @@ processing is done."
(when (equal countdown 0)
(apply finalize arguments)))))
(if (equal countdown 0)
- (funcall finalize identifier)
+ (funcall finalize)
|[Prev in Thread]
||[Next in Thread]|
- [elpa] master 83131b8: packages/excorporate: Support diary on Emacs 24.1, 24.2, 24.3,
Thomas Fitzsimmons <=