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

Skip to content

Replace defvar with defcustom, making customize work properly #205

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 1 commit into from
Jan 21, 2020
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
92 changes: 60 additions & 32 deletions dashboard-widgets.el
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,21 @@ Example:
(defconst dashboard-banner-length 75
"Width of a banner.")

(defvar dashboard-banner-logo-title "Welcome to Emacs!"
"Specify the startup banner.")
(defcustom dashboard-banner-logo-title "Welcome to Emacs!"
"Specify the startup banner."
:type 'string
:group 'dashboard)

(defvar dashboard-navigator-buttons nil
(defcustom dashboard-navigator-buttons nil
"Specify the navigator buttons.
The format is: 'icon title help action face prefix suffix'.

Example:
'((\"☆\" \"Star\" \"Show stars\" (lambda (&rest _) (show-stars)) 'warning \"[\" \"]\"))")
'((\"☆\" \"Star\" \"Show stars\" (lambda (&rest _) (show-stars)) 'warning \"[\" \"]\"))"
:type '(repeat (repeat (list string string string function symbol string string)))
:group 'dashboard)

(defvar dashboard-init-info
(defcustom dashboard-init-info
;; Check if package.el was loaded and if package loading was enabled
(if (bound-and-true-p package-alist)
(format "%d packages loaded in %s"
Expand All @@ -138,9 +142,11 @@ Example:
(format "%d packages loaded in %s"
(hash-table-size straight--profile-cache) (emacs-init-time))
(format "Emacs started in %s" (emacs-init-time))))
"Init info with packages loaded and init time.")
"Init info with packages loaded and init time."
:type 'boolean
:group 'dashboard)

(defvar dashboard-footer
(defcustom dashboard-footer
(let ((list '("The one true editor, Emacs!"
"Who the hell uses VIM anyway? Go Evil!"
"Free as free speech, free as free Beer"
Expand All @@ -153,9 +159,11 @@ Example:
"I showed you my source code, pls respond"
)))
(nth (random (1- (1+ (length list)))) list))
"A footer with some short message.")
"A footer with some short message."
:type 'string
:group 'dashboard)

(defvar dashboard-footer-icon
(defcustom dashboard-footer-icon
(if (and (display-graphic-p)
(or (fboundp 'all-the-icons-fileicon)
(require 'all-the-icons nil 'noerror)))
Expand All @@ -164,46 +172,66 @@ Example:
:v-adjust -0.05
:face 'font-lock-keyword-face)
(propertize ">" 'face 'dashboard-footer))
"Footer's icon.")
"Footer's icon."
:type 'string
:group 'dashboard)

(defvar dashboard-startup-banner 'official
(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 file.
If the value is nil then no banner is displayed.")
If the value is nil then no banner is displayed."
:type '(choice (const :tag "offical" official)
(const :tag "logo" logo)
(string :tag "a png path"))
:group 'dashboard)

(defvar dashboard-buffer-last-width nil
"Previous width of dashboard-buffer.")
(defcustom dashboard-buffer-last-width nil
"Previous width of dashboard-buffer."
:type 'integer
:group 'dashboard)

(defvar dashboard-item-generators '((recents . dashboard-insert-recents)
(bookmarks . dashboard-insert-bookmarks)
(projects . dashboard-insert-projects)
(agenda . dashboard-insert-agenda)
(registers . dashboard-insert-registers)))
(defcustom dashboard-item-generators '((recents . dashboard-insert-recents)
(bookmarks . dashboard-insert-bookmarks)
(projects . dashboard-insert-projects)
(agenda . dashboard-insert-agenda)
(registers . dashboard-insert-registers))
"Association list of items to how to generate in the startup buffer.
Will be of the form `(list-type . list-function)'.
Possible values for list-type are: `recents', `bookmarks', `projects',
`agenda' ,`registers'."
:type '(repeat (alist :key-type symbol :value-type function))
:group 'dashboard)

(defvar dashboard-items '((recents . 5)
(bookmarks . 5)
(agenda . 5))
(defcustom dashboard-items '((recents . 5)
(bookmarks . 5)
(agenda . 5))
"Association list of items to show in the startup buffer.
Will be of the form `(list-type . list-size)`.
Will be of the form `(list-type . list-size)'.
If nil it is disabled. Possible values for list-type are:
`recents' `bookmarks' `projects' `agenda' `registers'")
`recents' `bookmarks' `projects' `agenda' `registers'."
:type '(repeat (alist :key-type symbol :value-type integer))
:group 'dashboard)

(defvar dashboard-items-default-length 20
(defcustom dashboard-items-default-length 20
"Length used for startup lists with otherwise unspecified bounds.
Set to nil for unbounded.")
Set to nil for unbounded."
:type 'integer
:group 'dashboard)

(defvar dashboard-heading-icons '((recents . "history")
(bookmarks . "bookmark")
(agenda . "calendar")
(projects . "rocket")
(registers . "database"))
(defcustom dashboard-heading-icons '((recents . "history")
(bookmarks . "bookmark")
(agenda . "calendar")
(projects . "rocket")
(registers . "database"))
"Association list for the icons of the heading sections.
Will be of the form `(list-type . icon-name-string)`.
If nil it is disabled. Possible values for list-type are:
`recents' `bookmarks' `projects' `agenda' `registers'")
`recents' `bookmarks' `projects' `agenda' `registers'"
:type '(repeat (alist :key-type symbol :value-type string))
:group 'dashboard)

(defvar recentf-list nil)

Expand Down