From d23d3ec70c5ad5c4399772510095951e980b178f Mon Sep 17 00:00:00 2001 From: Kaan Berk Yaman <6b6279+noreply@mailbox.org> Date: Wed, 15 Feb 2023 22:24:49 +0100 Subject: [PATCH 1/3] Add ascii option to dashboard-startup-banner --- dashboard-widgets.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dashboard-widgets.el b/dashboard-widgets.el index 8e3e5e4..532527e 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -157,6 +157,11 @@ 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`. @@ -205,12 +210,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" @@ -536,6 +543,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) @@ -584,7 +593,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)) From 214c1b54200e5c1e476252c7cc9b5f214da6f29a Mon Sep 17 00:00:00 2001 From: Kaan Berk Yaman <6b6279+noreply@mailbox.org> Date: Thu, 16 Feb 2023 03:19:25 +0100 Subject: [PATCH 2/3] Fix formatting of docstrings --- dashboard-widgets.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dashboard-widgets.el b/dashboard-widgets.el index 532527e..a7d47cf 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -158,7 +158,8 @@ preserved." :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'." + "String to be shown in place of the startup banner +if `dashboard-startup-banner' is set to `ascii'." :type 'string :group 'dashboard) @@ -210,8 +211,8 @@ Example: (defcustom dashboard-startup-banner 'official "Specify the startup banner. Default value is `official', it displays the Emacs logo. `logo' displays Emacs -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. +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) From 7828c0009f111d0e45a309e1713674943c4fef66 Mon Sep 17 00:00:00 2001 From: Kaan Berk Yaman <6b6279+noreply@mailbox.org> Date: Thu, 16 Feb 2023 03:19:25 +0100 Subject: [PATCH 3/3] Fix formatting of docstrings from previous commit --- dashboard-widgets.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dashboard-widgets.el b/dashboard-widgets.el index 532527e..a7d47cf 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -158,7 +158,8 @@ preserved." :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'." + "String to be shown in place of the startup banner +if `dashboard-startup-banner' is set to `ascii'." :type 'string :group 'dashboard) @@ -210,8 +211,8 @@ Example: (defcustom dashboard-startup-banner 'official "Specify the startup banner. Default value is `official', it displays the Emacs logo. `logo' displays Emacs -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. +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)