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

Skip to content

Text startup banner. #157

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

Closed
wants to merge 5 commits into from
Closed

Text startup banner. #157

wants to merge 5 commits into from

Conversation

jcs090218
Copy link
Member

@jcs090218 jcs090218 commented Jun 21, 2019

This is a quick implementation for text banner. See #153. The benefits are this is down compatible if the user want to use default 1.txt, 2.txt and 3.txt banner files. Otherwise, they can just set the dashboard-banner-logo-text variable like the line of code below. If they want the default banner just set to nil.

(setq dashboard-banner-logo-text "dir/banner.txt")

Edit: This implementation may not be the best solution, because I don't know what the author of dashboard wants. So I guess this PR is just an advice.

Copy link
Member Author

@jcs090218 jcs090218 left a comment

Choose a reason for hiding this comment

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

Some implementation explanation.

@JesusMtnez
Copy link
Contributor

@jcs090218 thank you so much for this work! Every pice of work is always welcome 😄

Have you tried it? I've tried to use this branch but it didn't work for me. Even if I set up dashboard-logo-banner-text to an ascii version of Emacs logo, it didn't use it at all.

The problem is in the dashboard-choose-banner. Even if you setup correctly dashboard-logo-banner-text, since its value is not an integer, it would never meet the condition to choose to the text banner.

I think the key of this feature is not about adding a new variable, but modifying dashboard-choose-banner to check if the file extension is txt and loading it as a text banner.

Feel free to ask any doubts you may have.

@JesusMtnez
Copy link
Contributor

Also, remember that adding new features / improving current ones may require an update of the documentation too 😉

@jcs090218
Copy link
Member Author

Have you tried it? I've tried to use this branch but it didn't work for me. Even if I set up dashboard-logo-banner-text to an ascii version of Emacs logo, it didn't use it at all.

I did test it, and it works for me. Did you try it in the terminal? Cuz this would only works inside terminal? :/

The problem is in the dashboard-choose-banner. Even if you setup correctly dashboard-logo-banner-text, since its value is not an integer, it would never meet the condition to choose to the text banner.

Not quite sure what do you mean by this. In the function dashboard-choose-banner if the value's isn't integer wouldn't matter, wouldn't it? Cuz the code eventually goes down to dashboard-get-banner-path by default.

I think the key of this feature is not about adding a new variable, but modifying dashboard-choose-banner to check if the file extension is txt and loading it as a text banner.

Thanks for letting me know! I will do this when I have time! :D

Also, remember that adding new features / improving current ones may require an update of the documentation too 😉

And this too!

Copy link
Member Author

@jcs090218 jcs090218 left a comment

Choose a reason for hiding this comment

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

Attempt 1. This is the version if not using the dashboard-logo-banner-text.

I think the key of this feature is not about adding a new variable, but modifying dashboard-choose-banner to check if the file extension is txt and loading it as a text banner.

Still not quite sure what exactly you want because whatever returns from dashboard-choose-banner, that's what you will load. So by checking the img or txt wouldn't matter, would it?

(image-type-available-p (intern (file-name-extension
dashboard-startup-banner)))
(display-graphic-p))
((stringp dashboard-startup-banner)
Copy link
Member Author

@jcs090218 jcs090218 Jun 21, 2019

Choose a reason for hiding this comment

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

This might sounds stupid, but I changed to check if the value is string and ignore to check if it is image and display-graphic-p. So just let the user decide what file to load? Just mention this in the README file to prefer setting the variable this way.

(setq dashboard-startup-banner (if (display-graphic-p) "path/to/image.png" "path/to/text.txt")

Copy link
Contributor

@JesusMtnez JesusMtnez Jul 21, 2019

Choose a reason for hiding this comment

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

I like your suggestion on how to setup dashboard-startup-banner, I would like to see the README.md updated with that.

But this line change would break backwards compatibility. Until now, people set dashboard-startup-banner like this:

(dashboard-startup-banner "/tmp/emacs-dashboard/banners/logo.png")

If you start emacs in terminal with the variable like set like that, it would fail to start. I think you should handle what happens if the value is a png file but emacs is started with now window system.

image

Maybe there should be always a default txt banner to fallback (i.e. banner 1.txt).

@jcs090218
Copy link
Member Author

@JesusMtnez What do you think about this patch?

@JesusMtnez
Copy link
Contributor

@jcs090218 Sorry, but I couldn't take a look. I'll try to review it before next week to give you some feedback. Thank you for your patience.

@jcs090218
Copy link
Member Author

@JesusMtnez Any progress on this patch? :D

@JesusMtnez
Copy link
Contributor

@jcs090218 Sorry, I'm pretty busy these days. I'll try to review it this week.

@jcs090218
Copy link
Member Author

@JesusMtnez No worries, I don't mean to rush you! :D

@JesusMtnez
Copy link
Contributor

@jcs090218 Any plans on updating this work to latest emacs-dashboard? 🤔

@jcs090218
Copy link
Member Author

I think the latest post is about the review? The conflict must have a write access to this branch hence I couldn't resolve it! You might have to resolve or else I would have open another PR? Thanks! 😄

@jcs090218 jcs090218 mentioned this pull request Oct 29, 2020
@jcs090218
Copy link
Member Author

Move to #246. Close this now!

@jcs090218 jcs090218 closed this Oct 29, 2020
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.

2 participants