Use subtypep instead of eq to test for type

This commit is contained in:
Renaud Casenave-Péré 2023-01-05 22:17:07 +01:00
parent f5510a7944
commit e65618de08
3 changed files with 9 additions and 9 deletions

View file

@ -113,7 +113,7 @@
(removing-rows ((1+ (index-of command)))
(relink-nodes node next-next)
(dec-nodes-count))
(reparse-node (index-of command) (eq (type-of next) 'org-headline)))
(reparse-node (index-of command) (subtypep (type-of next) 'org-headline)))
(progn
(relink-nodes node next-next)
(dec-nodes-count))))))

View file

@ -54,10 +54,10 @@
(replace-node node new-node)
(when (eq *current-node* node)
(setf *current-node* new-node))
(when (eq (type-of new-node) 'org-headline)
(when (subtypep (type-of new-node) 'org-headline)
(setf *current-headline* new-node))
(when (eq *current-headline* node)
(setf *current-headline* (if (eq (type-of new-node) 'org-headline)
(setf *current-headline* (if (subtypep (type-of new-node) 'org-headline)
new-node
(headline-of new-node))))))
@ -97,14 +97,14 @@
(defun previous-node (node)
(let ((prev (previous-of node)))
(assert prev)
(when (eq (type-of node) 'org-headline)
(when (subtypep (type-of node) 'org-headline)
(setf *current-headline* (previous-headline-of node)))
prev))
(defun next-node (node)
(let ((next (next-of node)))
(assert next)
(when (eq (type-of next) 'org-headline)
(when (subtypep (type-of next) 'org-headline)
(setf *current-headline* next))
next))
@ -136,7 +136,7 @@
(lambda (node)
(or (let ((next (next-of node)))
(or (null next)
(and (eq (type-of next) 'org-headline)
(and (subtypep (type-of next) 'org-headline)
(or (null depth) (<= (depth-of next) depth)))))
(not (incf step))))
#'next-node))
@ -187,5 +187,5 @@
*current-index* 0
*nodes-count* (loop for node = (next-of org-document) then (next-of node)
while node count node))
(setf *current-headline* (and (eq (type-of *current-node*) 'org-headline) *current-node*))
(setf *current-headline* (and (subtypep (type-of *current-node*) 'org-headline) *current-node*))
(|endResetModel| *org-model*))

View file

@ -87,7 +87,7 @@
(defmethod headline-of ((node org-line))
(loop for prev = (previous-of node) then (previous-of prev)
while (and prev (not (eq (type-of prev) 'org-headline)))
while (and prev (not (subtypep (type-of prev) 'org-headline)))
finally (return prev)))
(defmethod headline-of ((node org-headline))
@ -97,7 +97,7 @@
(defmethod next-headline-of ((node org-line))
(loop for next = (next-of node) then (next-of next)
while (and next (not (eq (type-of next) 'org-headline)))
while (and next (not (subtypep (type-of next) 'org-headline)))
finally (return next)))
(defmethod title-of ((node org-line))