rainstormstudio / nerd-icons.el

GNU General Public License v3.0
206 stars 22 forks source link

Inconsistency between icon-for-file and icon-for-mode for some languages #31

Open fredericgiquel opened 1 year ago

fredericgiquel commented 1 year ago

The icon provided by nerd-icons-icon-for-file and nerd-icons-for-mode is not the same for some languages. The problem can be highlighted by the following code:

(let ((output)
      (lang-info '(("Ruby" "foobar.rb" ruby-mode)
                   ("Makefile" "Makefile" makefile-mode)
                   ("Perl" "foobar.pl" perl-mode)
                   ("Emacs Lisp" "foobar.el" emacs-lisp-mode)
                   ("Python" "foobar.py" python-mode)
                   ("Go" "foobar.go" go-mode))))
  (dolist (item lang-info)
    (setq output (concat output
                         "=== " (nth 0 item) " ===\n"
                         "- Icon for file: " (nerd-icons-icon-for-file (nth 1 item)) "\n"
                         "- Icon for mode: " (nerd-icons-icon-for-mode (nth 2 item)) "\n\n")))
  output)

We can see the result in this screenshot: nerd-icons

For Emacs Lisp, Python and Go, the icon is the same. But it differs for Ruby, Makefile and Perl. Is this situation expected?

rainstormstudio commented 1 year ago

Based on the code, this is expected behaviour. However, I do believe we could make them the same icon.

fredericgiquel commented 1 year ago

In some situations, both types of icons are visible at the same time. This can be confusing.

This happens especially when using consult-buffer (and its derivatives) with marginalia and nerd-icons-completion.

Here is an example of using consult-project-buffer in a ruby project, the icon is different depending if the file is currently open in a buffer or not.

nerds-icons-consult-buffer

rainstormstudio commented 1 year ago

Actually this is not a big issue but I think you are right. I'm adding a bug tag for this issue, and I will try to make them consistent.