Skip to content

Commit

Permalink
[Core] Un-inline treemacs--file-extension.
Browse files Browse the repository at this point in the history
Fixes #1051
  • Loading branch information
Alexander-Miller committed Oct 24, 2023
1 parent 474febd commit 95c0747
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/elisp/treemacs-core-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -408,18 +408,16 @@ FILE here is a list consisting of an absolute path and file attributes."
(and (not (s-matches? treemacs-dotfiles-regex filename))
(--none? (funcall it filename ,file) treemacs-ignored-file-predicates))))))

(define-inline treemacs--file-extension (filename)
(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))
(inline-letevals (filename)
(inline-quote
(if (string-match treemacs-file-extension-regex ,filename)
(substring ,filename (1+ (match-beginning 0)))
,filename))))
(if (string-match treemacs-file-extension-regex filename)
(substring filename (1+ (match-beginning 0)))
filename))

(define-inline treemacs-is-treemacs-window? (window)
"Return t when WINDOW is showing a treemacs buffer."
Expand Down

0 comments on commit 95c0747

Please sign in to comment.