Function: ruby-ts--align-keywords

ruby-ts--align-keywords is a byte-compiled function defined in ruby-ts-mode.el.gz.

Signature

(ruby-ts--align-keywords PRED)

Documentation

Return either start or bol of PRED.

PRED should specify a node that is listed in ruby-alignable-keywords. If PRED is listed in user option ruby-align-to-stmt-keywords, then return the BOL of PRED. Otherwise return start of PRED.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ruby-ts-mode.el.gz
(defun ruby-ts--align-keywords (pred)
  "Return either start or bol of PRED.
PRED should specify a node that is listed in
`ruby-alignable-keywords'.  If PRED is listed in user option
`ruby-align-to-stmt-keywords', then return the BOL of PRED.
Otherwise return start of PRED."
  (lambda (node parent bol &rest rest)
    (let* ((pred-node (funcall pred node parent bol rest))
           (temp (treesit-node-start pred-node))
           (type (treesit-node-type pred-node))
           (bol (ruby-smie--indent-to-stmt-p
                 (if (equal type "method")
                     "def"
                   type))))
      (when temp
        (if bol
            (save-excursion
              (goto-char temp)
              (back-to-indentation)
              (point))
          temp)))))