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

Skip to content

Add ascii option to dashboard-startup-banner #436

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 4 commits into from
Feb 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions dashboard-widgets.el
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ preserved."
:type 'string
:group 'dashboard)

(defcustom dashboard-banner-ascii "EMACS"
"String to be shown in place of the startup banner
if `dashboard-startup-banner' is set to `ascii'."
:type 'string
:group 'dashboard)

(defcustom dashboard-navigator-buttons nil
"Specify the navigator buttons.
The format is: `icon title help action face prefix suffix`.
Expand Down Expand Up @@ -205,12 +211,14 @@ Example:
(defcustom dashboard-startup-banner 'official
"Specify the startup banner.
Default value is `official', it displays the Emacs logo. `logo' displays Emacs
alternative logo. An integer value is the index of text banner. A string
value must be a path to a .PNG or .TXT file. If the value is nil then no banner
is displayed."
alternative logo. If set to `ascii', the value of `dashboard-banner-ascii'
will be used as the banner. An integer value is the index of text banner.
A string value must be a path to a .PNG or .TXT file. If the value is
nil then no banner is displayed."
:type '(choice (const :tag "no banner" nil)
(const :tag "offical" official)
(const :tag "logo" logo)
(const :tag "ascii" ascii)
(integer :tag "index of a text banner")
(string :tag "a path to an image or text banner")
(cons :tag "an image and text banner"
Expand Down Expand Up @@ -536,6 +544,8 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer."
(append (when (image-type-available-p 'png)
(list :image dashboard-banner-logo-png))
(list :text (dashboard-get-banner-path 1))))
('ascii
(append (list :text dashboard-banner-ascii)))
((pred integerp)
(list :text (dashboard-get-banner-path dashboard-startup-banner)))
((pred stringp)
Expand Down Expand Up @@ -584,7 +594,9 @@ Argument IMAGE-PATH path to the image."
(insert "\n")
;; If specified, insert a text banner.
(when-let (txt (plist-get banner :text))
(insert-file-contents txt)
(if (eq dashboard-startup-banner 'ascii)
(insert txt)
(insert-file-contents txt))
(put-text-property (point) (point-max) 'face 'dashboard-text-banner)
(setq text-width 0)
(while (not (eobp))
Expand Down