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

Skip to content

Added foot note plus several enhancements and code improvements #137

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 7 commits into from
Jun 2, 2019
Merged
Show file tree
Hide file tree
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: 20 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,26 @@ To show info about the packages loaded and the init time:
(setq dashboard-set-init-info t)
#+END_SRC

Also, the message can be customized like this:
#+BEGIN_SRC elisp
(setq dashboard-init-info "This is an init message!")
#+END_SRC

A randomly selected footnote will be displayed. To disable it:
#+BEGIN_SRC elisp
(setq dashboard-set-footer nil)
#+END_SRC

To customize it and customize its icon;

#+BEGIN_SRC elisp
(setq dashboard-footer "Dashboard is pretty cool!")
(setq dashboard-footer-icon (all-the-icons-octicon "dashboard"
:height 1.1
:v-adjust -0.05
:face 'font-lock-keyword-face))
#+END_SRC

** Org mode’s agenda

To display today’s agenda items on the dashboard, add ~agenda~ to ~dashboard-items~:
Expand Down
69 changes: 57 additions & 12 deletions dashboard-widgets.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ to the specified width, with aspect ratio preserved."
:type 'integer
:group 'dashboard)


(defcustom dashboard-set-heading-icons nil
"When non nil, heading sections will have icons."
:type 'boolean
Expand All @@ -60,6 +59,11 @@ to the specified width, with aspect ratio preserved."
:type 'boolean
:group 'dashboard)

(defcustom dashboard-set-footer t
"When non nil, a footer will be displayed at the bottom."
:type 'boolean
:group 'dashboard)

(defcustom dashboard-show-shortcuts t
"Whether to show shortcut keys for each section."
:type 'boolean
Expand Down Expand Up @@ -88,6 +92,27 @@ to the specified width, with aspect ratio preserved."
(length package-activated-list) (emacs-init-time))
"Init info with packages loaded and init time.")

(defvar 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"
"Richard Stallman is proud of you"
"Happy coding!"
"Vi Vi Vi, the editor of the beast"
"Welcome to the church of Emacs"
"While any text editor can save your files,\
only Emacs can save your soul"
"I showed you my source code,pls respond"
)))
(nth (random (1- (1+ (length list)))) list))
"A footer with some short message.")

(defvar dashboard-footer-icon (all-the-icons-fileicon "emacs"
:height 1.1
:v-adjust -0.05
:face 'font-lock-keyword-face)
"Footer's icon.")

(defvar dashboard-startup-banner 'official
"Specify the startup banner.
Default value is `official', it displays
Expand Down Expand Up @@ -133,7 +158,7 @@ If nil it is disabled. Possible values for list-type are:
;; Faces
;;
(defface dashboard-text-banner
'((t :inherit default))
'((t (:inherit font-lock-keyword-face)))
"Face used for text banners."
:group 'dashboard)

Expand Down Expand Up @@ -230,6 +255,11 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer."
(insert (propertize heading 'face 'dashboard-heading))
(if shortcut (insert (format " (%s)" shortcut))))

(defun dashboard-center-line (string)
"Center a STRING accoring to it's size."
(insert (make-string (max 0 (floor (/ (- dashboard-banner-length
(+ (length string) 1)) 2))) ?\ )))

;;
;; BANNER
;;
Expand Down Expand Up @@ -275,14 +305,18 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer."
(insert-image spec)
(insert "\n\n")
(when title
(insert (make-string (max 0 (floor (/ (- dashboard-banner-length
(+ (length title) 1)) 2))) ?\ ))
(insert (format "%s\n\n" (propertize title 'face 'dashboard-banner-logo-title))))
(when dashboard-set-init-info
(insert (make-string (max 0 (floor (/ (- dashboard-banner-length
(+ (length dashboard-init-info) 1)) 2))) ?\ ))
(insert (concat
(propertize dashboard-init-info 'face 'font-lock-comment-face)))))))
(dashboard-center-line title)
(insert (format "%s\n\n" (propertize title 'face 'dashboard-banner-logo-title)))))))

;;
;; INIT INFO
;;
(defun dashboard-insert-init-info ()
"Insert init info when dashboard-set-init-info is t."
(when dashboard-set-init-info
(dashboard-center-line dashboard-init-info)
(insert
(propertize dashboard-init-info 'face 'font-lock-comment-face))))

(defun dashboard-get-banner-path (index)
"Return the full path to banner with index INDEX."
Expand Down Expand Up @@ -321,8 +355,8 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer."
(when banner
(if (image-type-available-p (intern (file-name-extension banner)))
(dashboard-insert-image-banner banner)
(dashboard-insert-ascii-banner-centered banner))))))

(dashboard-insert-ascii-banner-centered banner))
(dashboard-insert-init-info)))))

(defmacro dashboard-insert-section (section-name list list-size shortcut action &rest widget-params)
"Add a section with SECTION-NAME and LIST of LIST-SIZE items to the dashboard.
Expand Down Expand Up @@ -389,6 +423,17 @@ WIDGET-PARAMS are passed to the \"widget-create\" function."
:format "%[%t%]")))
,list)))

;; Footer
(defun dashboard-insert-footer ()
"Insert footer of dashboard."
(when dashboard-set-footer
(insert "\n")
(dashboard-center-line dashboard-footer)
(when (display-graphic-p)
(insert dashboard-footer-icon))
(insert " ")
(insert (propertize dashboard-footer 'face 'font-lock-doc-face))))

;;
;; Recentf
;;
Expand Down
3 changes: 2 additions & 1 deletion dashboard.el
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ Optional prefix ARG says how many lines to move; default is one line."
(while (not (eobp))
(and (not (eq ? (char-after)))
(insert (make-string margin ?\ )))
(forward-line 1)))))
(forward-line 1))))
(dashboard-insert-footer))
(dashboard-mode)
(goto-char (point-min))))
(if recentf-is-on
Expand Down
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.