Function: treesit--set-nonsticky

treesit--set-nonsticky is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit--set-nonsticky START END SYM &optional REMOVE)

Documentation

Set rear-nonsticky property between START and END.

Set the property to a list containing SYM. If there is already a list, add SYM to that list. If REMOVE is non-nil, remove SYM instead.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit--set-nonsticky (start end sym &optional remove)
  "Set `rear-nonsticky' property between START and END.
Set the property to a list containing SYM.  If there is already a
list, add SYM to that list.  If REMOVE is non-nil, remove SYM
instead."
  (let* ((prop (get-text-property start 'rear-nonsticky))
         (new-prop
          (pcase prop
            ((pred listp) ; PROP is a list or nil.
             (if remove
                 (remove sym prop)
               ;; We should make sure PORP doesn't contain SYM, but
               ;; whatever.
               (cons sym prop)))
            ;; PROP is t.
            (_ (if remove
                   nil
                 (list sym))))))
    (if (null new-prop)
        (remove-text-properties start end '(rear-nonsticky nil))
      (put-text-property start end 'rear-nonsticky new-prop))))