branch: elpa/org-journal
commit 8b9b46f988ed69baee0b3db4fde9ee5827587b1e
Merge: e581bf5530 25c5d95dba
Author: Bastian Bechtold <bast...@users.noreply.github.com>
Commit: GitHub <nore...@github.com>

    Merge pull request #457 from jcs-PR/ci/improve
    
    ci: Improve CI and fix compile warnings
---
 .github/workflows/test.yml | 41 ++++++++++++++++++++++++++++++-----------
 .gitignore                 |  3 +++
 Eask                       | 20 ++++++++++++++++++++
 Makefile                   | 11 ++++-------
 org-journal.el             | 45 +++++++++++++++++++++++++--------------------
 5 files changed, 82 insertions(+), 38 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 954626e657..05b5e15e6c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -13,24 +13,43 @@ on:
 
 jobs:
   build:
-    runs-on: ubuntu-latest
+    runs-on: ${{ matrix.os }}
     continue-on-error: ${{ matrix.experimental }}
     strategy:
+      fail-fast: false
       matrix:
-        emacs_version:
-          - 26.1
-          - 27.1
-          - 28.1
-          - 29.1
-          - release-snapshot
+        os: [ubuntu-latest, macos-latest, windows-latest]
+        emacs-version:
+          - 26.3
+          - 27.2
+          - 28.2
+          - 29.4
+          - 30.1
         experimental: [false]
         include:
-          - emacs_version: snapshot
-            experimental: true
+        - os: ubuntu-latest
+          emacs-version: snapshot
+          experimental: true
+        - os: macos-latest
+          emacs-version: snapshot
+          experimental: true
+        - os: windows-latest
+          emacs-version: snapshot
+          experimental: true
+        exclude:
+          - os: macos-latest
+            emacs-version: 26.3
+          - os: macos-latest
+            emacs-version: 27.2
+
     steps:
-    - uses: purcell/setup-emacs@master
+    - uses: jcs090218/setup-emacs@master
+      with:
+        version: ${{ matrix.emacs-version }}
+
+    - uses: emacs-eask/setup-eask@master
       with:
-        version: ${{ matrix.emacs_version }}
+        version: 'snapshot'
 
     - uses: actions/checkout@v4
 
diff --git a/.gitignore b/.gitignore
index e0062bb48e..351b6c50aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
 *.elc
 /org-journal-autoloads.el
+
+/.eask
+/dist
diff --git a/Eask b/Eask
new file mode 100644
index 0000000000..e6c8dff37f
--- /dev/null
+++ b/Eask
@@ -0,0 +1,20 @@
+;; -*- mode: eask; lexical-binding: t -*-
+
+(package "org-journal"
+         "2.2.0"
+         "a simple org-mode based journaling mode")
+
+(website-url "http://github.com/bastibe/org-journal";)
+
+(package-file "org-journal.el")
+
+(script "test" "echo \"Error: no test specified\" && exit 1")
+
+(source 'gnu)
+
+(depends-on "emacs" "26.1")
+(depends-on "org")
+
+(add-hook 'eask-before-compile-hook
+           (lambda ()
+             (setq byte-compile-error-on-warn t)))
diff --git a/Makefile b/Makefile
index 5edb6c0940..7b67f92de7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 EMACS = emacs
+EASK = eask
 BATCH = $(EMACS) -Q -batch -L .
 
 export LC_ALL=C
@@ -10,14 +11,10 @@ clean:
        git clean -Xf
 
 compile:
-       $(BATCH) -f batch-byte-compile org-journal.el
+       $(EASK) compile
 
 gen-autoloads:
-       $(BATCH) \
-               --eval "(require 'autoload)" \
-               --eval '(setq make-backup-files nil)' \
-               --eval "(setq generated-autoload-file (concat 
command-line-default-directory \"/\" \"org-journal-autoloads.el\"))" \
-               -f batch-update-autoloads "."
+       $(EASK) generate autoloads
 
 test:
-       $(BATCH) -l tests/org-journal-test -f ert-run-tests-batch-and-exit
+       $(EASK) test ert ./tests/*.el
diff --git a/org-journal.el b/org-journal.el
index d274fb3202..e22a7131d7 100644
--- a/org-journal.el
+++ b/org-journal.el
@@ -103,27 +103,32 @@
 ;; Silent byte-compiler
 (defvar view-exit-action)
 (declare-function org-collect-keywords "org")
+(defvar age-armor)
+(defvar age-file-encrypt-to)
+(declare-function age-make-context "ext:age.el")
+(declare-function age-select-keys "ext:age.el")
 
 (when (version< org-version "9.2")
   (defalias 'org-set-tags-to 'org-set-tags))
 
-(unless (fboundp 'org--tag-add-to-alist)
-  ;; This function can be removed once emacs-26 is required or de-facto 
standard.
-  (defun org-tag-add-to-alist (alist1 alist2)
-    "Append ALIST1 elements to ALIST2 if they are not there yet.
+(eval-when-compile
+  (unless (fboundp 'org--tag-add-to-alist)
+    ;; This function can be removed once emacs-26 is required or de-facto 
standard.
+    (defun org-tag-add-to-alist (alist1 alist2)
+      "Append ALIST1 elements to ALIST2 if they are not there yet.
 
 From branch \"emacs-26\", added for compatibility.
 "
-    (cond
-      ((null alist2) alist1)
-      ((null alist1) alist2)
-      (t (let ((alist2-cars (mapcar (lambda (x) (car-safe x)) alist2))
-               to-add)
-           (dolist (i alist1)
-             (unless (member (car-safe i) alist2-cars)
-               (push i to-add)))
-           (append to-add alist2)))))
-  (defalias 'org--tag-add-to-alist 'org-tag-add-to-alist))
+      (cond
+       ((null alist2) alist1)
+       ((null alist1) alist2)
+       (t (let ((alist2-cars (mapcar (lambda (x) (car-safe x)) alist2))
+                to-add)
+            (dolist (i alist1)
+              (unless (member (car-safe i) alist2-cars)
+                (push i to-add)))
+            (append to-add alist2)))))
+    (defalias 'org--tag-add-to-alist 'org-tag-add-to-alist)))
 
 
 ;;; Customizable variables
@@ -764,7 +769,7 @@ This allows the use of `org-journal-tag-alist' and
                     and return (equal entry date))) ;; If an entry exists 
don't create a header
 
 
-      (when (looking-back "[^\t ]" (point-at-bol))
+      (when (looking-back "[^\t ]" (line-beginning-position))
         (insert "\n"))
       (insert entry-header)
 
@@ -965,8 +970,8 @@ to process the carryover entries in `prev-buffer'."
       (save-excursion
         (while (re-search-forward 
"<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\( [a-z]+\\)?\\)>" nil t)
           (unless (save-excursion
-                    (goto-char (point-at-bol))
-                    (re-search-forward "\\<\\(SCHEDULED\\|DEADLINE\\):" 
(point-at-eol) t))
+                    (goto-char (line-beginning-position))
+                    (re-search-forward "\\<\\(SCHEDULED\\|DEADLINE\\):" 
(line-end-position) t))
             (replace-match
              (format-time-string "%Y-%m-%d %a"
                                  (org-journal--calendar-date->time
@@ -1048,7 +1053,7 @@ previous day's file to the current file."
               end (save-excursion (outline-next-heading) (point))
               text (buffer-substring-no-properties start end))
         (push (cons start (cons end text)) carryover-item-with-parents)))
-    (setq start (point-at-bol)
+    (setq start (line-beginning-position)
           end (progn (outline-end-of-subtree) (outline-next-heading) (point))
           text (buffer-substring-no-properties start end))
     (setq carryover-item-with-parents (append carryover-item-with-parents 
(list (cons start (cons end text)))))))
@@ -1212,7 +1217,7 @@ With non-nil prefix argument create a regular entry 
instead of a TODO entry."
       (let (org-journal-carryover-items)
         (org-save-outline-visibility t
                                      (org-journal-new-entry t time)
-                                     (when (looking-back "[^\t ]" 
(point-at-bol) t)
+                                     (when (looking-back "[^\t ]" 
(line-beginning-position) t)
                                        (insert "\n"))
                                      (org-yank))))))
 
@@ -1354,7 +1359,7 @@ If NO-SELECT is non-nil, open it, but don't show it."
       (when (file-exists-p org-journal--cache-file)
         (with-temp-buffer
           (insert-file-contents org-journal--cache-file)
-          (setq org-journal--dates (read (buffer-substring (point-at-bol) 
(point-at-eol))))))))
+          (setq org-journal--dates (read (buffer-substring 
(line-beginning-position) (line-end-position))))))))
   (org-journal--sort-dates))
 
 (defun org-journal--sort-dates ()

Reply via email to