[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-notify 5875631410 09/23: Treat only one file per ca
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-notify 5875631410 09/23: Treat only one file per call of org-notify-process. |
Date: |
Mon, 25 Jul 2022 12:57:56 -0400 (EDT) |
branch: externals/org-notify
commit 5875631410de9db45d948af45cd252dc8f9ec71b
Author: Peter Münster <pmrb@free.fr>
Commit: Peter Münster <pmrb@free.fr>
Treat only one file per call of org-notify-process.
---
org-notify.el | 59 ++++++++++++++++++++++++++++++++---------------------------
1 file changed, 32 insertions(+), 27 deletions(-)
diff --git a/org-notify.el b/org-notify.el
index 317e53a7c5..4a9ea8a242 100644
--- a/org-notify.el
+++ b/org-notify.el
@@ -73,8 +73,8 @@
(defvar org-notify-timer nil
"Timer of the notification daemon.")
-(defvar org-notify-parse-file
- "Current file, that `org-element-parse-buffer' is parsing.")
+(defvar org-notify-parse-file nil
+ "Index of current file, that `org-element-parse-buffer' is parsing.")
(defvar org-notify-on-action-map nil
"Mapping between on-action identifiers and parameter lists.")
@@ -102,22 +102,26 @@
result)
(when (and (eq (get :todo-type) 'todo) heading deadline)
(pr :heading heading) (pr :notify (intern notify))
- (pr :begin (get :begin)) (pr :file org-notify-parse-file)
+ (pr :begin (get :begin))
+ (pr :file (nth org-notify-parse-file (org-agenda-files 'unrestricted)))
(pr :timestamp deadline) (pr :uid (md5 (concat heading deadline)))
(pr :deadline (- (org-time-string-to-seconds deadline)
(org-float-time))))
result)))
(defun org-notify-todo-list ()
- "Create the todo-list."
- (let ((files (org-agenda-files 'unrestricted)) result)
- (dolist (org-notify-parse-file files result)
- (save-excursion
- (with-current-buffer (find-file-noselect org-notify-parse-file)
- (setq result (append result (org-element-map
- (org-element-parse-buffer 'headline)
- 'headline 'org-notify-make-todo))))))
- result))
+ "Create the todo-list for one org-agenda file."
+ (let* ((files (org-agenda-files 'unrestricted))
+ (max (1- (length files))))
+ (setq org-notify-parse-file
+ (if (or (not org-notify-parse-file) (>= org-notify-parse-file max))
+ 0
+ (1+ org-notify-parse-file)))
+ (save-excursion
+ (with-current-buffer (find-file-noselect
+ (nth org-notify-parse-file files))
+ (org-element-map (org-element-parse-buffer 'headline)
+ 'headline 'org-notify-make-todo)))))
(defun org-notify-maybe-too-late (diff period heading)
"Print waring message, when notified significantly later than defined by
@@ -180,13 +184,14 @@ ones, whose names are prefixed with `org-notify-action-'."
(setq org-notify-map (plist-put org-notify-map name params)))
(defun org-notify-start (&optional secs)
- "Start the notification daemon. If SECS is positive, it's the period in
-seconds for processing the notifications, and if negative, notifications
-will be checked only when emacs is idle for -SECS seconds. The default value
-for SECS is 50."
+ "Start the notification daemon. If SECS is positive, it's the
+period in seconds for processing the notifications of one
+org-agenda file, and if negative, notifications will be checked
+only when emacs is idle for -SECS seconds. The default value for
+SECS is 20."
(if org-notify-timer
(org-notify-stop))
- (setq secs (or secs 50)
+ (setq secs (or secs 20)
org-notify-timer (if (< secs 0)
(run-with-idle-timer (* -1 secs) t
'org-notify-process)
@@ -202,14 +207,14 @@ for SECS is 50."
"User wants to see action."
(save-excursion
(with-current-buffer (find-file-noselect (plist-get plist :file))
- (show-all)
- (goto-char (plist-get plist :begin))
- (search-forward "DEADLINE: <")
- (cond
- ((string-equal key "done") (org-todo))
- ((string-equal key "hour") (org-timestamp-change 60 'minute))
- ((string-equal key "day") (org-timestamp-up-day))
- ((string-equal key "week") (org-timestamp-change 7 'day))))))
+ (org-with-wide-buffer
+ (goto-char (plist-get plist :begin))
+ (search-forward "DEADLINE: <")
+ (cond
+ ((string-equal key "done") (org-todo))
+ ((string-equal key "hour") (org-timestamp-change 60 'minute))
+ ((string-equal key "day") (org-timestamp-up-day))
+ ((string-equal key "week") (org-timestamp-change 7 'day)))))))
(defun org-notify-on-action-notify (id key)
"User wants to see action after mouse-click in notify window."
@@ -300,8 +305,8 @@ org-notify window. Mostly copied from
`appt-select-lowest-window'."
(switch-to-buffer buf))
(setq buffer-read-only nil buffer-undo-list t)
(erase-buffer)
- (insert (format "TODO: %s, in %d seconds.\n"
- (get :heading) (get :deadline)))
+ (insert (format "TODO: %s, %s.\n" (get :heading)
+ (org-notify-body-text (get :deadline))))
(let ((timer (run-with-timer (or (get :duration) 10) nil
'org-notify-delete-window buf)))
(dotimes (i (/ (length org-notify-actions) 2))
- [elpa] externals/org-notify d24a1525c1 06/23: Remove obsolete org-notify-verbose., (continued)
- [elpa] externals/org-notify d24a1525c1 06/23: Remove obsolete org-notify-verbose., ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify d2e1c297fa 17/23: README.md: this module is no more in the org-mode distribution, ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify 3a9c55aabd 19/23: Fix package-lint errors, ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify d61af2d334 04/23: Use common prefix for all objects., ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify 75df171a0a 05/23: Allow also suffixes for predefined functions., ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify 13afc93024 08/23: Add support for sending emails., ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify dd342f86d6 11/23: org-notify-audible: new configuration variable., ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify 76f75705b3 13/23: org-notify-on-action: New action: show the entry., ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify 1c65ee9597 16/23: org-notify.el: update to version in org-mode distribution, ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify f566817937 10/23: New notification type: "notify or window"., ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify 5875631410 09/23: Treat only one file per call of org-notify-process.,
ELPA Syncer <=
- [elpa] externals/org-notify 160c7eb64d 12/23: org-notify-body-text: Add time-stamp to text., ELPA Syncer, 2022/07/25
- [elpa] externals/org-notify e4bdac5a14 15/23: Create README.md, ELPA Syncer, 2022/07/25