domtronn / all-the-icons.el Goto Github PK
View Code? Open in Web Editor NEWA utility package to collect various Icon Fonts and propertize them within Emacs.
License: MIT License
A utility package to collect various Icon Fonts and propertize them within Emacs.
License: MIT License
When I use code:
(all-the-icons-icon-for-file (buffer-file-name) :v-adjust -0.05)
in my custom mode-line.
The icon is wrong, not the correct icon. For example, the elisp buffer should show the emacs icon, but it is not. Not just elisp icon, also including Org-mode icon, and clojure-mode icon etc.
Check out the screenshot.
BTW, seems I can't change the icon size. How to adjust the icon size by override args?
Hi,
could you please create a tag to use this package using melpa stable
Thanks
Hi,
I'm getting this error:
Debugger entered--Lisp error: (error "Invalid character: 59657, #o164411, #xe909")
eval-buffer(#<buffer load<3>> nil "~/.emacs.d/modules/all-the-icons/data/data-alltheicons.el" nil t) ; Reading at buffer position 88
Not sure if this is related, but the only commands I have available are:
Possible completions are:
all-the-icons-insert all-the-icons-insert-alltheicon
all-the-icons-insert-faicon all-the-icons-insert-fileicon
all-the-icons-insert-material all-the-icons-insert-octicon
all-the-icons-insert-wicon all-the-icons-install-fonts
Any idea?
it looks like all-the-icons-spaceline.el
completely ignores any info messages by flycheck. It would make sense to add them to the list of issues or add a separate segment for info messages for flycheck.
Using neotree icons
theme, some icons are wrong.
Take a look at the screenshot:
I don't know why weather icons messed in.
position: 1137 of 7154 (16%), column: 5
character: (displayed as ) (codepoint 61487, #o170057, #xf02f)
preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0xF02F
syntax: w which means: word
category: L:Left-to-right (strong)
to input: type "C-x 8 RET f02f"
buffer code: #xEF #x80 #xAF
file code: #xEF #x80 #xAF (encoded by coding system utf-8)
display: by this font (glyph code)
xft:-UKWN-Weather Icons-normal-normal-normal-*-19-*-*-*-*-0-iso10646-1 (#x3F)
Thanks for this great package! It looks awesome with neotree and dired. I also use speedbar a lot so I'm curious if there is any way to make the two work together? I googled but there is barely any relevant information.
I use Emacs25.1+windows10
When i use all-the-icons with neotree wo all-the-icons-dired ,while call neotree-toggle or dired(C-x d),the emacs become very slow.
the config is
(require 'all-the-icons)
(require 'all-the-icons-dired)
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
I haven't checked the other font families, but FontAwesome includes icon aliases. This can help with icon discoverability / semantic use of the icons. It would be helpful for users of all-the-icons to have access to these aliases.
For example: "gears" is an alias (an alternate name) for "cogs" in FontAwesome. Users searching for "gears" find the icon they are looking for and don't need to divine the true library name "cogs" (which may be less intuitive).
Here is one definition in the FA project: https://github.com/FortAwesome/Font-Awesome/blob/fc064e9d5c938c3d8ebc29862be1e3a0ff43fb44/src/icons.yml#L171-L173
This is what it looks like now, as you can see it not very different and has a bad contrast.
I am using solarized-light theme btw.
Thanks
When I install all-the-icons through emacs package manager, I got the following error:
package 'font-lock+-0' is unavailable.
What does this mean?
M-x all-the-icons-install-fonts
doesn't work behind a proxy, while at least the Emacs package manager honors the proxy settings.
The specific error is:
open-network-stream: make client process failed: connection refused, :name, github.com, :buffer,#<killed buffer>, :host, github.com, :service, 443, :nowait, nil
Org-Agenda can display icon in buffer with the following settings:
(setq org-agenda-category-icon-alist
'(("Diary" "~/.emacs.d/resources/icon/diary.xpm" nil nil :ascent center)
("Todo" "~/.emacs.d/resources/icon/todo.xpm" nil nil :ascent center)
("Star" "~/.emacs.d/resources/icon/star.xpm" nil nil :ascent center)
;; ("Org" "~/.emacs.d/resources/icon/Org-mode.xpm" nil nil :ascent center)
("Org" '(all-the-icons-faicon "cogs") nil nil :ascent center)
...
I tried the upper method, but it does not work. Hope to find a way to show all-the-icons in org-agenda buffer. Thanks.
First of, great package dood. I was finally able to make my own mode line configuration inspired by this package. One of the things I always wanted to customize for a long time. Really thanks.
Anyway, let's say I have a buffer meow.org
; the function all-the-icons--icon-info-for-buffer
(which is called by all-the-icons-icon-for-buffer
) returns org-mode
. When I save the buffer as ~/meow.org
, it now returns the icon
of org-mode which is what I wanted in the first place. Is this an intended behavior or a bug? If it is a bug, I can make a PR if I can help.
How did you get that nice bottom bar?
Currently XML files are not recognized. Is there an existing icon we could use to present XML files?
Hello!
I got part of your mode-line ported for using in telephone-line, here is the entire section of my telephone-line configuration:
(use-package telephone-line
:preface (defun shackra/vc-state ()
(vc-state (buffer-file-name (current-buffer))))
:init
(setf telephone-line-height 30)
(custom-set-faces
'(mode-line ((t (:box nil))))
'(mode-line-inactive ((t (:box nil))))
'(mode-line-highlight ((t (:box nil)))))
:config
(telephone-line-defsegment* shackra-buffer-vc-modified-segment
(cond ((buffer-modified-p)
(propertize (format " %s" (all-the-icons-faicon "pencil")) 'face `(:foreground "orange" :height 1.3 :family ,(all-the-icons-faicon-family))
'display '(raise -0.1) 'help-echo "Buffer modificado."))
((eq (shackra/vc-state) 'edited)
(propertize (format " %s" (all-the-icons-faicon "pencil")) 'face `(:height 1.3 :family ,(all-the-icons-faicon-family))
'display '(raise -0.1) 'help-echo "Buffer modificado, cambios sin registrar."))
((eq (shackra/vc-state) 'unregistered)
(propertize (format " %s" (all-the-icons-faicon "question")) 'face `(:height 1.3 :family ,(all-the-icons-faicon-family))
'display '(raise -0.1) 'help-echo "Archivo sin registrar al VCS."))
((eq (shackra/vc-state) 'missing)
(propertize (format " %s" (all-the-icons-faicon "exclamation")) 'face `(:height 1.3 :family ,(all-the-icons-faicon-family))
'display '(raise -0.1) 'help-echo "Archivo sólo existe en VCS, no en el disco duro."))
((eq (shackra/vc-state) 'ignored)
(propertize (format " %s" (all-the-icons-faicon "ban")) 'face `(:height 1.3 :family ,(all-the-icons-faicon-family))
'display '(raise -0.1) 'help-echo "Archivo ignorado"))
((eq (shackra/vc-state) 'added)
(propertize (format " %s" (all-the-icons-faicon "plus")) 'face `(:height 1.3 :family ,(all-the-icons-faicon-family))
'display '(raise -0.1) 'help-echo "Archivo será registrado en VCS en el siguiente commit."))))
(telephone-line-defsegment* shackra-line-buffer-segment
`(""
,(telephone-line-raw mode-line-buffer-identification t)))
(telephone-line-defsegment* shackra-vc-info
(when vc-mode
(cond ((string-match "Git[:-]" vc-mode)
(let ((branch (mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-")))
(concat
(propertize (format " %s" (all-the-icons-alltheicon "git")) 'face `(:height 1.3) 'display '(raise -0.1))
" · "
(propertize (format "%s" (all-the-icons-octicon "git-branch"))
'face `(:height 1.3 :family ,(all-the-icons-octicon-family))
'display '(raise -0.1))
(propertize (format " %s" branch) 'face `(:height 0.9)))))
((string-match "SVN-" vc-mode)
(let ((revision (cadr (split-string vc-mode "-"))))
(concat
(propertize (format " %s" (all-the-icons-faicon "cloud")) 'face `(:height 1.3) 'display '(raise -0.1))
(propertize (format " · %s" revision) 'face `(:height 0.9)))))
(t (format "%s" vc-mode)))))
(telephone-line-defsegment* shackra-flycheck-status
(let* ((text (pcase flycheck-last-status-change
(`finished (if flycheck-current-errors
(let ((count (let-alist (flycheck-count-errors flycheck-current-errors)
(+ (or .warning 0) (or .error 0)))))
(format " ✖ %s problema%s" count (unless (eq 1 count) "s")))
" ✔ Sin problemas"))
(`running " ⟲ En ejecución")
(`no-checker " ⚠ No existe revisor")
(`not-checked " ✖ Deshabilitado")
(`errored " ⚠ Error")
(`interrupted " ⛔ Interrumpido")
(`suspicious ""))))
(propertize text
'help-echo "Muestra errores detectados por Flycheck"
'mouse-face '(:box 1)
'local-map (make-mode-line-mouse-map
'mouse-1 (lambda () (interactive) (flycheck-list-errors))))))
(setf telephone-line-lhs
'((accent . (shackra-line-buffer-segment shackra-buffer-vc-modified-segment))
(nil . (shackra-vc-info shackra-flycheck-status))))
(setf telephone-line-rhs '((nil . (telephone-line-misc-info-segment telephone-line-major-mode-segment))
(accent . (telephone-line-minor-mode-segment telephone-line-position-segment))))
(telephone-line-mode 1))
This code assumes the user have (use-package all-the-icons)
somewhere in his configuration.
When I try to install fonts with all-the-icons-install-fonts
I see this error on emacs 25.2 on linux:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
file-directory-p(nil)
(if (file-directory-p font-dest) nil (mkdir font-dest t))
(let* ((url-format "https://github.com/domtronn/all-the-icons.el/blob/master/fonts/%s?raw=true") (font-dest (cond ((eql window-system (quote x)) (concat (or (getenv "XDG_DATA_HOME") (concat ... "/.local/share")) "/fonts/")) ((eql window-system (quote mac)) (concat (getenv "HOME") "/Library/Fonts/")) ((eql window-system (quote ns)) (concat (getenv "HOME") "/Library/Fonts/")))) (known-dest\? (stringp font-dest)) (font-dest (if font-dest nil (read-directory-name "Font installation directory: " "~/")))) (if (file-directory-p font-dest) nil (mkdir font-dest t)) (mapc (function (lambda (font) (url-copy-file (format url-format font) (expand-file-name font font-dest) t))) all-the-icons-font-names) (if known-dest\? (progn (message "Fonts downloaded, updating font cache... <fc-cache -f -v> ") (shell-command-to-string (format "fc-cache -f -v")))) (message "%s Successfully %s `all-the-icons' fonts to `%s'!" (all-the-icons-wicon "stars" :v-adjust 0.0) (if known-dest\? "installed" "downloaded") font-dest))
(progn (let* ((url-format "https://github.com/domtronn/all-the-icons.el/blob/master/fonts/%s?raw=true") (font-dest (cond ((eql window-system (quote x)) (concat (or ... ...) "/fonts/")) ((eql window-system (quote mac)) (concat (getenv "HOME") "/Library/Fonts/")) ((eql window-system (quote ns)) (concat (getenv "HOME") "/Library/Fonts/")))) (known-dest\? (stringp font-dest)) (font-dest (if font-dest nil (read-directory-name "Font installation directory: " "~/")))) (if (file-directory-p font-dest) nil (mkdir font-dest t)) (mapc (function (lambda (font) (url-copy-file (format url-format font) (expand-file-name font font-dest) t))) all-the-icons-font-names) (if known-dest\? (progn (message "Fonts downloaded, updating font cache... <fc-cache -f -v> ") (shell-command-to-string (format "fc-cache -f -v")))) (message "%s Successfully %s `all-the-icons' fonts to `%s'!" (all-the-icons-wicon "stars" :v-adjust 0.0) (if known-dest\? "installed" "downloaded") font-dest)))
(if (or pfx (yes-or-no-p "This will download and install fonts, are you sure you want to do this?")) (progn (let* ((url-format "https://github.com/domtronn/all-the-icons.el/blob/master/fonts/%s?raw=true") (font-dest (cond ((eql window-system ...) (concat ... "/fonts/")) ((eql window-system ...) (concat ... "/Library/Fonts/")) ((eql window-system ...) (concat ... "/Library/Fonts/")))) (known-dest\? (stringp font-dest)) (font-dest (if font-dest nil (read-directory-name "Font installation directory: " "~/")))) (if (file-directory-p font-dest) nil (mkdir font-dest t)) (mapc (function (lambda (font) (url-copy-file (format url-format font) (expand-file-name font font-dest) t))) all-the-icons-font-names) (if known-dest\? (progn (message "Fonts downloaded, updating font cache... <fc-cache -f -v> ") (shell-command-to-string (format "fc-cache -f -v")))) (message "%s Successfully %s `all-the-icons' fonts to `%s'!" (all-the-icons-wicon "stars" :v-adjust 0.0) (if known-dest\? "installed" "downloaded") font-dest))))
all-the-icons-install-fonts((4))
funcall-interactively(all-the-icons-install-fonts (4))
call-interactively(all-the-icons-install-fonts record nil)
command-execute(all-the-icons-install-fonts record)
#[257 "\304\305!\203\f
mm-write-region: Opening output file: No such file or directory, /fonts/material-design-icons.ttf
I can't retrieve the golang icon :
ELISP> (all-the-icons-match-to-alist "/tmp/foo.java" all-the-icons-icon-alist)
(all-the-icons-devicon "java" :height 1.0 :face all-the-icons-purple)
ELISP> (all-the-icons-match-to-alist "/tmp/nyx.go" all-the-icons-icon-alist)
(all-the-icons-faicon "file-o" :height 0.8 :v-adjust 0.0 :face all-the-icons-dsilver)
ELISP> (all-the-icons-match-to-alist "/tmp/nyx.py" all-the-icons-icon-alist)
(all-the-icons-devicon "python" :height 1.0 :face all-the-icons-dblue)
For some reason i can't install package from MELPA. When i'm trying to install it i get
error: Package ‘font-lock+-0’ is unavailable
In fact that doesnt work with melpa-stable, with the regular melpa everything is ok so i think there is something wrong with package in melpa-stable
Hi, today I was installing your package and I ran into issue very similar to #60.
mm-write-region: Opening output file: No such file or directory, /home/tlegutko/.local/share/fonts/material-design-icons.ttf
But the problem was not the XDG_DATA_HOME (I didn't have it set, but when I set it I still had the same error - so auto-resolution was correct), but it still assumed that I should have material-design-icons.ttf prior to installation - when I downloaded the file manually, the installation went smoothly. So I think one of the following should ease the installation process:
My setup: Arch Linux, GNU Emacs 25.2.1, all-the-icons 2.5.2.
something like:
("\.p[lm]$" all-the-icons-alltheicon "perl" :face all-the-icons-lorange)
Thank you for your really cool emacs mode.
I just wanted to let you know that I added dired support here.
I can't get this to work with neotree. I've followed the instructions in this video, but all I get are squares with hex numbers in them. I use Spacemacs.
Some of the file icons being displayed are too big, here are some screenshots:
https://s17.postimg.io/7yquh6767/Screenshot_from_2016_09_15_14_24_10.png
https://s9.postimg.io/jzuzm0dbz/Screenshot_from_2016_09_15_15_03_15.png
This issue was discussed here as well: doomemacs/themes#8
I'm running Linux (Fedora 25) and Emacs 25.1.1 (but Emacs 24 has the same issue)
I installed the fonts by dropping the ttf files in /usr/share/fonts/all-the-icons
and running fc-cache -f -v
.
The icons that I'm aware of that are having this issue are:
I believe I installed the fonts correctly as other icons are being displayed properly, other people (but not all) are also having this issue (see emacs-doom-theme link).
If there's any other info I can give you let me know.
PS: as for Emacs configuration, I tested it (as well) with a completely raw emacs config and only install all-the-icons
through melpa. image
First thank you for your great work. You spaceline config looks great and I would love to have the same, but I get some strange rendering issues.
I tried to play around using different fonts, sizes and tweaking numbers in your theme, but could not figure out, why this happens. Any ideas?
My config can be found here
hi,
i'm wondering how to change default icons, for example, i want to change org
file icon to readme
file icon.
many thanks in advance
Hi,
i try to insert the golang icon .
In go-mode, i can't use the function all-the-icons-data/devicons-alist , but it works with "go" :
ELISP> (assoc "go-mode" all-the-icons-data/devicons-alist)
nil
ELISP> (assoc "go" all-the-icons-data/devicons-alist)
(assoc "go" all-the-icons-data/devicons-alist)
("go" . "")
ELISP> (all-the-icons-devicon "go")
#("" 0 1
(display
(raise -0.24)
face
(:family "icomoon" :height 1.2 :inherit nil)))
ELISP> (propertize (all-the-icons-devicon "go")
'face `(:family ,(all-the-icons-devicon-family) :height 0.1)
'display '(raise -0.1))
#("" 0 1
(face
(:family "icomoon" :height 0.1)
display
(raise -0.1)))
But in the buffer, the icon is the same size for (all-the-icons-devicon "go") and (propertize ...)
any idead how to fix that ?
Thanks
With new spaceline I got
Error during redisplay: (eval (spaceline-ml-ati)) signaled (void-function spaceline-ml-ati)
Hi,
I love your package.
Have you ever thought about adding the icons to the buffer switcher or find file? At least for the buffer switching having the same icon for the buffers having the same major-mode would be a huge visual hint. I mean something like what you do with displaying the icon next to the icon name in all-the-icons-insert
.
Do you think it's doable? Do you think that it would add a lot of overhead?
When combine this with dashboard,
Following error was raised,
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p #<buffer *dashboard*>)
spaceline-ml-ati()
eval((spaceline-ml-ati) nil)
eval-expression((spaceline-ml-ati) nil)
funcall-interactively(eval-expression (spaceline-ml-ati) nil)
call-interactively(eval-expression nil nil)
command-execute(eval-expression)
When I resize the emacs window, everything is fine.
It would be nice to have a function all-the-icons-icon-for-url
which chooses an icon based on a URL. Ofcourse it would be hard to cover all possibilities, but as a starter the function and the alist could be added, and then people could send in pull requests with new link types.
For instance if the URL matches wikipedia.org
, the Wikipedia icon could be used.
I execute code:
(all-the-icons-oction "git-branch")
This caused Emacs segment fault.
Currently, when typing e.g.,
(insert (all-the-icons-faicon "dropbox"))
and then hitting C-x c-e
, the Dropbox icon is inserted in the buffer, but in such a way that subsequent characters inherit the icon's text properties. Since these include a face
property, characters inserted immediately after the Dropbox icon are displayed in the same FontAwesome
font, which is usually not what you'd want. Adding the text property rear-nonsticky
to the icon with the value t
solves this issue.
Would it be a good idea to add this text property to the string returned by all-the-icons-faicon
and similar functions?
Does somebody tried overwrite default git gutter symbols?
Currently I'm using that plus
symbol, but it looks ugly in my opinion
(fringe-helper-define 'git-gutter-fr+-added nil
"...XX..."
"...XX..."
"...XX..."
"XXXXXXXX"
"XXXXXXXX"
"...XX..."
"...XX..."
"...XX...")
I read #33 and related commit. Tab symbol aligns but for a whole symbol 😂. Not sure if fixable. Thought that should raise an issue in case you didn't know. Btw, I'm using Fira Code fonts
Sorry if this has been covered before, but does this package support terminal more or only gui?
Thanks,
-- Arron
Tried using the code from wiki but it looks like there are some missing dependencies.
I added yahoo-weather
which was missing but still getting spaceline-ml-ati
doesn't evaluate.
If I try executing it in ielm
I get following error.
*** Eval error *** Wrong type argument: stringp, nil
I'm trying this with Spacemacs which includes spaceline.
Hello,
First of all, thanks for this awesome package.
I wanted to add an icon for compilation-mode
that I use a lot, so I went into all-the-icons.el
and added the following to the list all-the-icons-mode-icon-alist
.
(compilation-mode all-the-icons-faicon "cogs" :height 1.0 :v-adjust 0.0)
However, I'm using all-the-icons in many places but I'm particularly interested in my modeline segment (using spaceline) which is defined as follows
(spaceline-define-segment prolusion-mode-icon
(let ((icon (all-the-icons-icon-for-buffer)))
(unless (symbolp icon)
(propertize icon
'help-echo (format "Major-mode: `%s`" major-mode)
'display '(raise 0.0)
'face `(:height 0.9 :family ,(all-the-icons-icon-family-for-buffer) :inherit)))))
all-the-icons-icon-for-buffer
doesn't provides me with compilation-mode
. I guess it comes from ...
(if (and (buffer-file-name)
(all-the-icons-auto-mode-match?))
... which is ...
(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)))
(auto-mode (all-the-icons-match-to-alist file auto-mode-alist)))
(eq major-mode auto-mode)))
... which is ...
(defun all-the-icons-match-to-alist (file alist)
"Match FILE against an entry in ALIST using `string-match'."
(cdr (--first (string-match (car it) file) alist)))
The point is, I do not see any fallback for the mode involving all-the-icons-mode-icon-alist
.
Could you please point me to what I'm missing ?
The current fonts that we have don't support Elixir and Erlang. I found a font which does though:
LICENSE: MIT
https://github.com/fizzed/font-mfizz
http://fizzed.com/oss/font-mfizz
I don't know if you're interested in adding it though.
I have wrote my own minimal package for insert icons as an exercise. I used it with spaceline
.
With icons wider than a regular character in the mode-line, the content is shifted to the right because spaceline
relies on the string length to pad things. As a result, when I use my icons in right-aligned segments, part of the mode-line is truncated.
From the screenshots, it seems you don't have this issue yourself with all-the-icons
. But I can't find the relevant part of the code I should focus on.
Edit: I added 2 extra icons to better show the shift.
I was playing around with this package a bit and spent some time with this oddity.
If I run (all-the-icons-icon-for-file "foo.rb")
using eval-expression
, then I often get back the incorrect icon. What I get back varies depending on what font family is installed, I'm currently getting back a weather icon, but have also seen a four arrows and what looks like a wizard a staff. However, when I run (insert (all-the-icons-icon-for-file "foo.rb"))
, the expected ruby icon is inserted in the buffer.
Most uses of icons in web development rely on the keywords or classnames of icons. Interactive / visual lookup is very helpful and the ultimate goal in this context is to insert the keyword or classname(s) corresponding to that icon.
Expressing an icon in HTML for example:
<i class="fa fa-area-chart" aria-hidden="true"></i>
A generally useful function that would be useful to include in this library (maybe all-the-icons-insert-faicon-classname
?) would insert/return "fa-area-chart". More specific behavior like insertion of html or additional classes (like "fa") could be left to the user to accomplish with user functions / snippets.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.