From d52ea47f5c051ee6c295b6b9ce02b6c04b3a396b Mon Sep 17 00:00:00 2001 From: sshaw Date: Tue, 28 May 2019 00:14:58 -0400 Subject: [PATCH 1/3] Makefile: allow one set specify emacs' path --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1b96b47..ca2b910 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ +emacs ?= emacs + test: org-clock-csv-tests.el - emacs -batch -f package-initialize -l ert -L . -l $< -f ert-run-tests-batch-and-exit + "$(emacs)" -batch -f package-initialize -l ert -L . -l $< -f ert-run-tests-batch-and-exit .PHONY: test From 7e3ced43387e9eaef9bef92b0954b46db492c9dd Mon Sep 17 00:00:00 2001 From: sshaw Date: Sat, 1 Jun 2019 14:07:11 -0400 Subject: [PATCH 2/3] Add filename to parsed clock entry list [fixes #19] --- org-clock-csv.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/org-clock-csv.el b/org-clock-csv.el index 80b32a5..5f66cf2 100644 --- a/org-clock-csv.el +++ b/org-clock-csv.el @@ -214,10 +214,12 @@ When NO-CHECK is non-nil, skip checking if all files exist." ;; For the sake of better debug messages, check whether all of the ;; files exists first. (mapc (lambda (file) (cl-assert (file-exists-p file))) filelist)) - (cl-loop for file in filelist append - (with-current-buffer (find-file-noselect file) - (org-element-map (org-element-parse-buffer) 'clock - #'org-clock-csv--parse-element nil nil)))) + (cl-loop for file in filelist + for entry = (with-current-buffer (find-file-noselect file) + (org-element-map (org-element-parse-buffer) 'clock + #'org-clock-csv--parse-element nil nil)) + do (plist-put (car entry) :filename file) + append entry)) ;;;; Public API: From 24f0307e28043684d0e5ceb60e8750650109c0f7 Mon Sep 17 00:00:00 2001 From: sshaw Date: Sat, 1 Jun 2019 14:13:27 -0400 Subject: [PATCH 3/3] Provide a message when file exists assertion fails [fixes #18] --- org-clock-csv.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org-clock-csv.el b/org-clock-csv.el index 5f66cf2..48ac215 100644 --- a/org-clock-csv.el +++ b/org-clock-csv.el @@ -213,7 +213,8 @@ When NO-CHECK is non-nil, skip checking if all files exist." (when (not no-check) ;; For the sake of better debug messages, check whether all of the ;; files exists first. - (mapc (lambda (file) (cl-assert (file-exists-p file))) filelist)) + (mapc (lambda (file) + (cl-assert (file-exists-p file) nil "File does not exist: %s" file)) filelist)) (cl-loop for file in filelist for entry = (with-current-buffer (find-file-noselect file) (org-element-map (org-element-parse-buffer) 'clock