Skip to content

Commit

Permalink
fix(test): address CI warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Sylvain Bougerel <[email protected]>
  • Loading branch information
sbougerel committed Feb 18, 2024
1 parent 26a5672 commit b581c85
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions logseq-org-roam.el
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
;;; Code:
(require 'org)
(require 'org-roam)
(require 'image) ;; for `image-type-file-name-regexps' & `image-type-available-p'

(defgroup logseq-org-roam nil
"Convert Logseq files to `org-roam' files."
Expand Down Expand Up @@ -439,7 +440,6 @@ previously created."
(insert-file-contents ,file)
,@body))

;; TODO: test
(defmacro logseq-org-roam--catch-fun (sym errs fun &rest body)
"Catch ERRS for SYM during BODY's execution and pass it to FUN."
(declare (indent 3) (debug t))
Expand All @@ -448,7 +448,7 @@ previously created."
(if (and ,result
(symbolp ,result)
(memq ,result ,errs))
(,fun ,result)))))
(apply ,fun (list ,result))))))

(defun logseq-org-roam--fl (file)
"Make an org link to FILE relative to `org-roam-directory'."
Expand Down Expand Up @@ -495,8 +495,7 @@ previously created."
(not (string-empty-p (org-element-property :value element)))))

(defun logseq-org-roam-maybe-date-default (date-format maybe-date)
"Turn MAYBE-DATE into time if it matches DATE-FORMAT.
"When MAYBE-DATE match DATE-FORMAT, turn it into a time value.
Attempts to parse MAYBE-DATE with `parse-time-string' first and
convert it back to a string with `format-time-string' using
DATE-FORMAT. If both string match, it is taken as a journal
Expand Down Expand Up @@ -974,9 +973,9 @@ only with file links, this hashtable is not used."
(pcase-dolist (`(_ ,beg ,end _ _ ,raw) links)
(unless (string= (buffer-substring-no-properties beg end) raw)
(throw 'update-error 'mismatch-link)))
;; Avoid offset calculations with buffer updates
(sort links (lambda (a b) (> (nth 1 a) (nth 1 b))))
(pcase-dolist (`(,type ,beg ,end ,path ,descr _) links)
(pcase-dolist (`(,type ,beg ,end ,path ,descr _)
;; Avoid offset calculations with buffer updates
(sort links (lambda (a b) (> (nth 1 a) (nth 1 b)))))
(when-let ((id (plist-get
(gethash
;; file-dict and fuzzy-dict key can be `consp' (conflict)
Expand Down Expand Up @@ -1248,19 +1247,19 @@ Return non-nil if issues where found."
"Check that `org-roam' is installed and configured."
(cond
((not (featurep 'org-roam))
(user-error "logseq-org-roam: `org-roam' is not installed"))
(user-error "Feature `org-roam' is not found"))
((not org-roam-directory)
(user-error "logseq-org-roam: `org-roam-directory' is not set"))
(user-error "Variable `org-roam-directory' is nil"))
((not (file-directory-p org-roam-directory))
(user-error "logseq-org-roam: `org-roam-directory' is not a directory"))
(user-error "Directory `org-roam-directory' does not exists"))
((not (file-exists-p (expand-file-name
logseq-org-roam-pages-directory
org-roam-directory)))
(user-error "logseq-org-roam: Logseq pages must be found directly under `org-roam-directory'"))
(user-error "Logseq pages must be found directly under `org-roam-directory'"))
((not (file-exists-p (expand-file-name
logseq-org-roam-journals-directory
org-roam-directory)))
(user-error "logseq-org-roam: Logseq journals must be found directly under `org-roam-directory'"))
(user-error "Logseq journals must be found directly under `org-roam-directory'"))
(t)))

;;;###autoload
Expand Down

0 comments on commit b581c85

Please sign in to comment.