Function: org-element--cache-key-less-p

org-element--cache-key-less-p is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element--cache-key-less-p A B)

Documentation

Non-nil if key A is less than key B.

A and B are either integers or lists of integers, as returned by org-element--cache-key.

Note that it is not reliable to compare buffer position with the cache keys. They keys may be larger compared to actual element :begin position.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
(defsubst org-element--cache-key-less-p (a b)
  "Non-nil if key A is less than key B.
A and B are either integers or lists of integers, as returned by
`org-element--cache-key'.

Note that it is not reliable to compare buffer position with the cache
keys.  They keys may be larger compared to actual element :begin
position."
  (if (integerp a) (if (integerp b) (< a b) (<= a (car b)))
    (if (integerp b) (< (car a) b)
      (catch 'exit
	(while (and a b)
	  (cond ((car-less-than-car a b) (throw 'exit t))
		((car-less-than-car b a) (throw 'exit nil))
		(t (setq a (cdr a) b (cdr b)))))
	;; If A is empty, either keys are equal (B is also empty) and
	;; we return nil, or A is lesser than B (B is longer) and we
	;; return a non-nil value.
	;;
	;; If A is not empty, B is necessarily empty and A is greater
	;; than B (A is longer).  Therefore, return nil.
	(and (null a) b)))))