migrate cl- to cl-lib- in journelly-convert-entry-to-org-roam.el
Replace deprecated cl- functions with cl-lib- equivalents and add (require 'cl-lib) to silence the 'package cl is deprecated' warning.
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
;;; mostalive/convert-journelly-to-org-roam.el -*- lexical-binding: t; -*-
|
;;; mostalive/convert-journelly-to-org-roam.el -*- lexical-binding: t; -*-
|
||||||
|
(require 'cl-lib)
|
||||||
|
|
||||||
(provide 'journelly-convert-entry-to-org-roam)
|
(provide 'journelly-convert-entry-to-org-roam)
|
||||||
|
|
||||||
(cl-defstruct journelly-entry
|
(cl-lib-defstruct journelly-entry
|
||||||
title
|
title
|
||||||
content
|
content
|
||||||
heading
|
heading
|
||||||
@@ -11,14 +13,14 @@
|
|||||||
"Parse a journelly entry and return a journelly-entry struct."
|
"Parse a journelly entry and return a journelly-entry struct."
|
||||||
(let* ((lines (split-string entry-text "\n" t)) ; t omits null strings
|
(let* ((lines (split-string entry-text "\n" t)) ; t omits null strings
|
||||||
(heading (car lines))
|
(heading (car lines))
|
||||||
(url-line (cl-find-if (lambda (l) (string-match-p "https?://" l)) lines))
|
(url-line (cl-lib-find-if (lambda (l) (string-match-p "https?://" l)) lines))
|
||||||
(url-pos (cl-position url-line lines :test 'equal))
|
(url-pos (cl-lib-position url-line lines :test 'equal))
|
||||||
;; Title is the non-empty line before the URL
|
;; Title is the non-empty line before the URL
|
||||||
(title-line (when url-pos
|
(title-line (when url-pos
|
||||||
(cl-find-if (lambda (l) (not (string-match-p "^[[:space:]]*$" l)))
|
(cl-lib-find-if (lambda (l) (not (string-match-p "^[[:space:]]*$" l)))
|
||||||
(reverse (cl-subseq lines 0 url-pos)))))
|
(reverse (cl-lib-subseq lines 0 url-pos)))))
|
||||||
;; Content is everything except heading, title, and URL
|
;; Content is everything except heading, title, and URL
|
||||||
(content-lines (cl-remove-if (lambda (l)
|
(content-lines (cl-lib-remove-if (lambda (l)
|
||||||
(or (equal l heading)
|
(or (equal l heading)
|
||||||
(equal l title-line)
|
(equal l title-line)
|
||||||
(equal l url-line)))
|
(equal l url-line)))
|
||||||
|
|||||||
Reference in New Issue
Block a user