-
-
Notifications
You must be signed in to change notification settings - Fork 141
Feature/center content #88
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
Feature/center content #88
Conversation
Just realized I need to update the readme. Sorry about that. |
|
Hello @jkdufair, Thank you so much for putting together a PR. Before i review the code, please fix back the code indentation to be able to properly review the other parts of the code. I think we should introduce some lint to that because every contributor seems to have their own indentation style / settings. |
Sure thing. Do you have a style guide I can refer to? |
Not really... now i am considering it to be honest. |
Ok. I tried not to make any whitespace-only changes to existing functions. I'll revert any that I may have created inadvertently. Thank you. |
Ok sorry about that! I didn't realize I had those whitespace-only changes. Thanks for taking a look. |
,list)) | ||
max-line-length)) | ||
|
||
(defmacro dashboard-insert-section (section-name list list-size shortcut action &rest widget-params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this become a macro rather than a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to have each section insert return its longest line so I could do centering calculations. Each of the section and section list inserts was similar and I didn't want to just boilerplate it in there. So I refactored the section and section list inserts into a macro and replaced the repetitive sections with calls to the macro. This should also make it easy to create new sections in the future with less boilerplate code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it should make the intent of creating sections more clean and more declarative
(defun dashboard-insert-recents (list-size) | ||
"Add the list of LIST-SIZE items from recently edited files." | ||
(recentf-mode) | ||
(when (dashboard-insert-recentf-list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dashboard let's you configure widgets to include... this is why the when
statement is there. Why was it removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this still works as intended? When I remove, i.e. 'recents
from 'dashboard-items
, the section no longer appears on the dashboard. Am I understanding correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. I should add there is a when-let
in dashboard-insert-section
that I believe accomplishes the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the linter seems to have had trouble with when-let
so I just did a let
and if
. This still appears to allow the configurability of which widgets to include.
f7974e5
to
09d6f20
Compare
@jkdufair sorry for the conflict, just merge a PR that deletes `:follow-link "\C-m" which makes your macro change a conflict. 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure i like this macro approach as it'll probably break people's custom widgets that are not provided by Dashboard itself. But i like the refactoring in general so i am willing to merge this.
@JesusMtnez if you have a better idea please feel free to chime in
dashboard.el
Outdated
@@ -62,6 +62,11 @@ | |||
"Settings that are used in the Dashboard" | |||
:group 'dashboard) | |||
|
|||
(defcustom dashboard-center-content t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have the default value as nil (non-centered)... might need to update the documentation with this change.
I agree. I don’t want to break backward compatibility @rakanalh. The more I think about it, the less I like putting the responsibility of returning Sound ok? |
@JesusMtnez no problem. I’ll get it fixed shortly. |
@rakanalh I don't have any possible idea to that. @jkdufair I like you approach, but if it is possible to keep backwards compatibility, let's try it. In case we do not find a way, I would suggest making an stable release before merging this, so next release is a major release. Also, good documentation is important if this change is going to include breaking changes. |
@rakanalh @JesusMtnez I have done the following
Thank you for your assistance with this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jkdufair for all of your work
Glad to help. Count me in as a regular contributor. |
Hello @rakanalh. This PR addresses #77
I approached this by creating a macro that can insert arbtrary sections and returns the maximum line length for that section. Then
'dashboard-insert-startupify-lists
finds the maximum of the maximums and moves all items over accordingly. I initially looked at adjusting the margins and/or the gutter but neither looked very attractive.Additionally, I'd be willing to be a maintainer. I've been looking for something fun to hack on for a while. Thanks for considering.