Function: combobulate-envelope-smart-sort

combobulate-envelope-smart-sort is a natively compiled function defined in combobulate-envelope.el.

Signature

(combobulate-envelope-smart-sort A B)

Documentation

Sort A and B based on their distance from point.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-envelope.el
(defun combobulate-envelope-smart-sort (a b)
  "Sort A and B based on their distance from point."
  ;; "Smart" sorting that orders by largest node first but
  ;; *only* when the distance from `point' to the start of `a'
  ;; is 0 (i.e., the node starts at point.)
  ;;
  ;; For all other instances, we measure distance from point.
  (if (= (- (combobulate-node-start a) (point)) 0)
      (combobulate-node-larger-than-node-p a b)
    (> (- (combobulate-node-start a) (point))
       (- (combobulate-node-start b) (point)))))