Function: projectile--dirconfig-classify-line

projectile--dirconfig-classify-line is a byte-compiled function defined in projectile.el.

Signature

(projectile--dirconfig-classify-line LINE)

Documentation

Classify LINE from a dirconfig file.

Return a cons (BUCKET . VALUE) where BUCKET is one of :keep,
:ignore, :ensure, :legacy-ignore, or :comment. Return nil
for a blank line. Leading whitespace is skipped before dispatch so an accidental space or tab before the prefix does not change classification. :legacy-ignore is reserved for prefix-less lines, which are still treated as ignore patterns for backward compatibility but are tracked separately so callers can warn.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--dirconfig-classify-line (line)
  "Classify LINE from a dirconfig file.
Return a cons (BUCKET . VALUE) where BUCKET is one of `:keep',
`:ignore', `:ensure', `:legacy-ignore', or `:comment'.  Return nil
for a blank line.  Leading whitespace is skipped before dispatch
so an accidental space or tab before the prefix does not change
classification.  `:legacy-ignore' is reserved for prefix-less
lines, which are still treated as ignore patterns for backward
compatibility but are tracked separately so callers can warn."
  (let* ((trimmed (string-trim-left line))
         (first-char (and (> (length trimmed) 0) (aref trimmed 0))))
    (cond
     ((null first-char) nil)
     ((and projectile-dirconfig-comment-prefix
           (eql first-char projectile-dirconfig-comment-prefix))
      (cons :comment nil))
     ((eql first-char ?+) (cons :keep          (string-trim (substring trimmed 1))))
     ((eql first-char ?-) (cons :ignore        (string-trim (substring trimmed 1))))
     ((eql first-char ?!) (cons :ensure        (string-trim (substring trimmed 1))))
     (t                   (cons :legacy-ignore (string-trim trimmed))))))