Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing a custom for user defined repositories #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion all-the-icons.el
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,23 @@
:group 'all-the-icons
:type 'number)


(defcustom all-the-icons-mode-repositories
'(".git" ; Git VCS root dir
".hg" ; Mercurial VCS root dir
".fslckout" ; Fossil VCS root dir
"_FOSSIL_" ; Fossil VCS root DB on Windows
".bzr" ; Bazaar VCS root dir
"_darcs" ; Darcs VCS root dir
".svn" ; Svn VCS root dir
"CVS" ; Csv VCS root dir
)
"A list of files considered to mark the root of a repository."
:group 'all-the-icons
:type '(repeat string))



(defvar all-the-icons-font-families '() "List of defined icon font families.")
(defvar all-the-icons-font-names '() "List of defined font file names this package was built with.")

Expand Down Expand Up @@ -526,6 +543,12 @@
;; Functions Start
;; ====================

(defun* all-the-icons-is-repo (path)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(defun* all-the-icons-is-repo (path)
(defun all-the-icons-is-repo (path)

"Check if PATH is a repository."
(dolist (repo all-the-icons-mode-repositories)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emacs already has a vc-mode built-in that comes with a custom called vc-directory-exclusion-list, can you try reusing it in your all-the-icons-is-repo, how about this:

Suggested change
(dolist (repo all-the-icons-mode-repositories)
(dolist (repo vc-directory-exclusion-list)

Don't forget to load this variable somewhere in your file as well.

(when (file-exists-p (format "%s/%s" path repo))
(return-from all-the-icons-is-repo t))))

(defun all-the-icons-auto-mode-match? (&optional file)
"Whether or not FILE's `major-mode' match against its `auto-mode-alist'."
(let* ((file (or file (buffer-file-name) (buffer-name)))
Expand Down Expand Up @@ -566,7 +589,7 @@ directory contents"
(all-the-icons-octicon "file-symlink-directory" :height 1.0))
((all-the-icons-dir-is-submodule path)
(all-the-icons-octicon "file-submodule" :height 1.0))
((file-exists-p (format "%s/.git" path))
((all-the-icons-is-repo path)
(format "%s" (all-the-icons-octicon "repo" :height 1.1)))
(t (apply (car matcher) (cdr matcher))))))
(format "%s%s%s%s%s" padding chevron padding icon padding)))
Expand Down