fix(memory): Implement missing list-objects-with-attribute
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
This commit is contained in:
@@ -160,6 +160,18 @@ Basic functions for retrieving objects by ID or type.
|
|||||||
"Returns a list of all objects matching a specific Org element type."
|
"Returns a list of all objects matching a specific Org element type."
|
||||||
(let ((results nil))
|
(let ((results nil))
|
||||||
(maphash (lambda (id obj) (declare (ignore id)) (when (eq (org-object-type obj) type) (push obj results))) *memory*)
|
(maphash (lambda (id obj) (declare (ignore id)) (when (eq (org-object-type obj) type) (push obj results))) *memory*)
|
||||||
|
results))
|
||||||
|
(defun list-objects-with-attribute (attr-name value)
|
||||||
|
"Returns a list of all objects where ATTR-NAME matches VALUE."
|
||||||
|
(let ((results nil))
|
||||||
|
(maphash (lambda (id obj)
|
||||||
|
(declare (ignore id))
|
||||||
|
(let ((attrs (org-object-attributes obj)))
|
||||||
|
(when (equal (getf attrs attr-name) value)
|
||||||
|
(push obj results))))
|
||||||
|
*memory*)
|
||||||
|
results))
|
||||||
|
|
||||||
results))
|
results))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,18 @@
|
|||||||
(let ((results nil))
|
(let ((results nil))
|
||||||
(maphash (lambda (id obj) (declare (ignore id)) (when (eq (org-object-type obj) type) (push obj results))) *memory*)
|
(maphash (lambda (id obj) (declare (ignore id)) (when (eq (org-object-type obj) type) (push obj results))) *memory*)
|
||||||
results))
|
results))
|
||||||
|
(defun list-objects-with-attribute (attr-name value)
|
||||||
|
"Returns a list of all objects where ATTR-NAME matches VALUE."
|
||||||
|
(let ((results nil))
|
||||||
|
(maphash (lambda (id obj)
|
||||||
|
(declare (ignore id))
|
||||||
|
(let ((attrs (org-object-attributes obj)))
|
||||||
|
(when (equal (getf attrs attr-name) value)
|
||||||
|
(push obj results))))
|
||||||
|
*memory*)
|
||||||
|
results))
|
||||||
|
|
||||||
|
results))
|
||||||
|
|
||||||
(defun find-headline-missing-id (ast)
|
(defun find-headline-missing-id (ast)
|
||||||
"Traverses an AST to find headlines that lack an :ID: property."
|
"Traverses an AST to find headlines that lack an :ID: property."
|
||||||
|
|||||||
Reference in New Issue
Block a user