Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added heading and file icons #123

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

Merged
merged 16 commits into from
May 21, 2019
Merged

Added heading and file icons #123

merged 16 commits into from
May 21, 2019

Conversation

ema2159
Copy link
Contributor

@ema2159 ema2159 commented May 18, 2019

The following features were added (inspired in Centaur Emacs configuration):

  • Added icons for the default headings and added a defcustom for enabling and disabling them.
  • Added icons for the files and added a defcustom for enabling and disabling them.
  • Added info about the packages loaded and the init time and added a defcustom for enabling and disabling it.

It was heavily inspired in the Centaur Emacs custom version of Dashboard. I also included a couple of enhancements like adding bullet icons for the org agenda or detecting when a file is remote (tramp) and add a "remote" icon, without establishing a connection (which Centaur Emacs didn't do) which makes it much more efficient.

I tried to keep it consistent with the repo coding style and I tried to make it the most readable possible (though elisp is a language that I am not very familiar with and I've not used it much besides from configuring my emacs).

It currently looks like this:
screenshot

@ema2159
Copy link
Contributor Author

ema2159 commented May 19, 2019

Could you help me to pass the linting checks? I fixed all the indicated errors but it still gives me the incorrect indentation error and doesn't tell me why. Please tell me what is it so that I can fix it.

@JesusMtnez
Copy link
Contributor

Thank you @ema2159 for the hard work! I'll try to take a look at it during this weekend. 👏

@JesusMtnez JesusMtnez self-requested a review May 20, 2019 15:47
@JesusMtnez
Copy link
Contributor

JesusMtnez commented May 20, 2019

I find the problem with the lint. You need to update .dir-locals.el:

((emacs-lisp-mode . ((indent-tabs-mode . nil)
                     (fill-column . 100)
                     (elisp-lint-indent-specs . ((when-let . 1))))))

That would set when-let to only required one level of indentation, which is the one being applied in the macro by default.

After that, you could test it running make lint 😉

@JesusMtnez
Copy link
Contributor

@ema2159 One little thing. I really like the changes you propose. I want them to be included in the next 1.4.0 release. But one little thing. Would you mind to split the changes in two PRs? One PR including all all-the-icons integration (it could be this one) and the other one with the new init information.


;;
;; Add file icons
;; MUST redefine the sections because of the macro `dashboard-insert-section-list'
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is not necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which one? or both of them?

Copy link
Contributor

Choose a reason for hiding this comment

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

line 334

@ema2159
Copy link
Contributor Author

ema2159 commented May 20, 2019

@ema2159 One little thing. I really like the changes you propose. I want them to be included in the next 1.4.0 release. But one little thing. Would you mind to split the changes in two PRs? One PR including all all-the-icons integration (it could be this one) and the other one with the new init information.

Yes sir, I'll do that as soon as I'm out of the office, probably between today's afternoon and tomorrow.
And just to be clear with the .dir-locals.el, I just need to create a .dir-locals.el in the same directory as the dashboard.el file and write ((emacs-lisp-mode . ((indent-tabs-mode . nil) (fill-column . 100) (elisp-lint-indent-specs . ((when-let . 1))))))
in it?

@JesusMtnez
Copy link
Contributor

JesusMtnez commented May 20, 2019

No rush on the changes 😉

There is a .dir-locals.el already in the repository with configuration for emacs-lisp-mode. You just need to add the element (elisp-lint-indent-specs . ((when-let . 1))) to the alist.

@ema2159
Copy link
Contributor Author

ema2159 commented May 20, 2019

Ok perfect. I also wanted to ask you what do you consider good defaults? I mean, I put all the defcustoms in nil thinking that maybe someone didn't had all-the-icons installed but I'm also thinking that people may miss that the icons option is available.
By the way, I'm pretty sure we both hablamos español a la perfección porque es nuestra lengua madre but we'll keep it in english for standard comunication jaja.

@JesusMtnez
Copy link
Contributor

There were two errors failing in the CI. One was the indentation check that is fixed now. The other one is:

In toplevel form:
dashboard-widgets.el:396:49:Error: ‘(path (car (last (split-string (abbreviate-file-name el) " - "))))’ is a malformed function

This happens when trying to byte-compile dashboard-widgets.el. Any idea why?

@ema2159
Copy link
Contributor Author

ema2159 commented May 21, 2019

There were two errors failing in the CI. One was the indentation check that is fixed now. The other one is:

In toplevel form:
dashboard-widgets.el:396:49:Error: ‘(path (car (last (split-string (abbreviate-file-name el) " - "))))’ is a malformed function

This happens when trying to byte-compile dashboard-widgets.el. Any idea why?

Yes, I think Emacs 25 doesn't support the when-let macro. Changing that for a separated let, when expression seems to fix it

@ema2159
Copy link
Contributor Author

ema2159 commented May 21, 2019

Do you know exactly how do I have to include the all the icons package so that it doesn't complain about free variables or functions?

@JesusMtnez
Copy link
Contributor

Do you know exactly how do I have to include the all the icons package so that it doesn't complain about free variables or functions?

In .emacs/dependencies.el

@ema2159
Copy link
Contributor Author

ema2159 commented May 21, 2019

For some reason the master test failed to install page break lines and that made that test fail, but the others seem ok.

@JesusMtnez
Copy link
Contributor

I was preparing a new PR to update emacs version in the CircleCI configuration. And I found the same problem. Let me work on that one later (WIP #124). Once that one gets merged, we should be good to go!

@ema2159
Copy link
Contributor Author

ema2159 commented May 21, 2019

Seems that we're done! I've separated the PR as you told me and everything seems to be working fine! If there's anything else I can help you with just let me know!

- emacs 25.3
- emacs 26.2
- emacs master
@JesusMtnez
Copy link
Contributor

#124 is merged! The problem was a missing coding setting. Feel free to rebase this branch against master or merge master in this branch (as you prefer).

@ema2159
Copy link
Contributor Author

ema2159 commented May 21, 2019

Done, all the checks are passing now. What do I do now with the init info PR?

@JesusMtnez JesusMtnez changed the title Added heading and file icons and init info Added heading and file icons May 21, 2019
@JesusMtnez JesusMtnez merged commit 139a4f6 into emacs-dashboard:master May 21, 2019
@seagle0128
Copy link
Contributor

seagle0128 commented May 22, 2019

Nice to see the features of Centaur Emacs are merged! Thank you!

One question: Did you test this scenario: If user doesn't install all-the-icons, but enable dashboard-set-heading-icons and/or dashboard-set-file-icons?

I also add some comments below.

seagle0128 added a commit to seagle0128/.emacs.d that referenced this pull request May 22, 2019
@ema2159
Copy link
Contributor Author

ema2159 commented May 22, 2019

Nice to see the features of Centaur Emacs are merged! Thank you!

One question: Did you test this scenario: If user doesn't install all-the-icons, but enable dashboard-set-heading-icons and/or dashboard-set-file-icons?

I also add some comments below.

No sir, I personally haven't, but I guess it probably just display ugly icons as it usually does when the icons aren't installed, that's why I defaulted the icon's defcustom to nil, but it shouldn't be a bigger problem than that because all the icons was added as a dependency.
Also we're having this issue #128. Any idea why?
By the way, that's a killer configuration you've created.

@seagle0128
Copy link
Contributor

seagle0128 commented May 22, 2019

@ema2159 I was not talking about icons, but about the all-the-icons.el package. If users didn't install this package, undefined all-the-icons-xxx will be called. I use require 'all-the-icons nil t because the package is installed in Centaur Emacs definitely. I think the solution is check if the package is installed before calling the functions, or add all-the-icons to the dependency. I prefer it's an optional package.

Regarding #128 , I have to say it was as designed, since the icons are not widgets/buttons or the part of them, for displaying correctly. The buttons have different face properties which will break the properties of icons. That's why the TAB (next widget) does work but the cursor on icons doesn't.

@ema2159
Copy link
Contributor Author

ema2159 commented May 22, 2019

@ema2159 I was not talking about icons, but about the all-the-icons.el package. If users didn't install this package, undefined all-the-icons-xxx will be called. I use require 'all-the-icons nil t because the package is installed in Centaur Emacs definitely.

Regarding #128 , I have to say it was as designed, since the icons are not widgets/buttons or the part of them, for displaying correctly. The buttons have different face properties which will break the properties of icons. That's why the TAB (next widget) does work but the cursor on icons doesn't.

Yes I understand, but now all the icons is a dependency so it's installation is ensured with use package.

And regarding #128, I understand, so a work around would be that when the shorcut buttons are pressed the cursor fell directly into the text instead of the icon, do you know how to do this?

@seagle0128
Copy link
Contributor

seagle0128 commented May 22, 2019

Okay. Glad you understand the risks.

Aha, and I have a great news, I think I found the solution for #128 . Should I submit a PR?

@JesusMtnez
Copy link
Contributor

Of course, feel free to submit a PR and contribute! 😄

@seagle0128
Copy link
Contributor

Already committed. Please review and merge. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants