Function: treemacs--file-extension

treemacs--file-extension is a byte-compiled function defined in treemacs-core-utils.el.

Signature

(treemacs--file-extension FILENAME)

Documentation

Same as file-name-extension, but also works with leading periods.

This is something a of workaround to easily allow assigning icons to a FILENAME with a name like '.gitignore' without always having to check for both filename extensions and special names like this.

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-core-utils.el
(defun treemacs--file-extension (filename)
  "Same as `file-name-extension', but also works with leading periods.

This is something a of workaround to easily allow assigning icons to a FILENAME
with a name like '.gitignore' without always having to check for both filename
extensions and special names like this."
  (declare (side-effect-free t))
  (if (string-match treemacs-file-extension-regex filename)
      (substring filename (1+ (match-beginning 0)))
    filename))