core: add footer in home buffer
This commit is contained in:
parent
654c704f6c
commit
f3e50195d7
Binary file not shown.
After Width: | Height: | Size: 552 B |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
|
@ -299,7 +299,6 @@ refreshed during the current session."
|
|||
(defun configuration-layer/sync (&optional no-install)
|
||||
"Synchronize declared layers in dotfile with spacemacs.
|
||||
If NO-INSTALL is non nil then install steps are skipped."
|
||||
;; Force the display of warning buffers at the bottom
|
||||
(dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...")
|
||||
(when (spacemacs-buffer//choose-banner)
|
||||
(spacemacs-buffer//inject-version t))
|
||||
|
@ -1101,13 +1100,14 @@ path."
|
|||
(defun configuration-layer//install-packages (packages)
|
||||
"Install PACKAGES which are not lazy installed."
|
||||
(interactive)
|
||||
;; ensure we have quelpa available first
|
||||
;; Force the display of warning buffers at the bottom
|
||||
(let ((display-buffer-alist
|
||||
'(("\\(\\*Compile-Log\\*\\)\\|\\(\\*Warnings\\*\\)"
|
||||
(display-buffer-in-side-window)
|
||||
(inhibit-same-window . t)
|
||||
(side . bottom)
|
||||
(window-height . 0.2)))))
|
||||
;; ensure we have quelpa available first
|
||||
(configuration-layer//install-quelpa)
|
||||
(let* ((not-inst-pkg-names
|
||||
(configuration-layer//get-uninstalled-packages
|
||||
|
|
|
@ -26,6 +26,13 @@
|
|||
(defconst spacemacs-banner-official-png
|
||||
(expand-file-name (concat spacemacs-banner-directory "img/spacemacs.png"))
|
||||
"Spacemacs official banner image.")
|
||||
(defconst spacemacs-badge-official-png
|
||||
(expand-file-name (concat spacemacs-banner-directory
|
||||
"img/spacemacs-badge.png"))
|
||||
"Spacemacs official badge image.")
|
||||
(defconst spacemacs-purple-heart-png
|
||||
(expand-file-name (concat spacemacs-banner-directory "img/heart.png"))
|
||||
"Purple heart emoji.")
|
||||
(defconst spacemacs-cache-directory
|
||||
(expand-file-name (concat user-emacs-directory ".cache/"))
|
||||
"Spacemacs storage area for persistent files")
|
||||
|
|
|
@ -62,10 +62,9 @@ version the release note it displayed")
|
|||
:group 'spacemacs
|
||||
:syntax-table nil
|
||||
:abbrev-table nil
|
||||
(page-break-lines-mode)
|
||||
(setq buffer-read-only t
|
||||
truncate-lines t)
|
||||
(when (fboundp 'page-break-lines-mode)
|
||||
(page-break-lines-mode))
|
||||
;; needed to make tab work correctly in terminal
|
||||
(evil-define-key 'motion spacemacs-buffer-mode-map
|
||||
(kbd "C-i") 'widget-forward)
|
||||
|
@ -90,6 +89,8 @@ Cate special text banner can de reachable via `998', `cat' or `random*'.
|
|||
(insert-file-contents banner))
|
||||
(spacemacs-buffer//inject-version t))
|
||||
(spacemacs-buffer//insert-buttons)
|
||||
(unless (bound-and-true-p spacemacs-initialized)
|
||||
(spacemacs-buffer/insert-page-break))
|
||||
(spacemacs//redisplay))))
|
||||
|
||||
(defun spacemacs-buffer/display-info-box ()
|
||||
|
@ -166,7 +167,7 @@ If ALL is non-nil then truly all banners can be selected."
|
|||
(width (car size))
|
||||
(left-margin (max 0 (floor (- spacemacs-buffer--banner-length width) 2))))
|
||||
(goto-char (point-min))
|
||||
(insert "\n")
|
||||
(spacemacs-buffer/insert-page-break)
|
||||
(insert (make-string left-margin ?\ ))
|
||||
(insert-image spec)
|
||||
(insert "\n\n")
|
||||
|
@ -194,6 +195,39 @@ buffer, right justified."
|
|||
(format "%%s%%%ds" len)
|
||||
lhs rhs))))))
|
||||
|
||||
(defun spacemacs-buffer//insert-footer ()
|
||||
(save-excursion
|
||||
(let* ((maxcol spacemacs-buffer--banner-length)
|
||||
(badge-path spacemacs-badge-official-png)
|
||||
(badge (when (image-type-available-p
|
||||
(intern (file-name-extension badge-path)))
|
||||
(create-image badge-path)))
|
||||
(badge-size (when badge (car (image-size badge))))
|
||||
(heart-path spacemacs-purple-heart-png)
|
||||
(heart (when (image-type-available-p
|
||||
(intern (file-name-extension heart-path)))
|
||||
(create-image heart-path)))
|
||||
(heart-size (when heart (car (image-size heart))))
|
||||
(build-lhs "Made with ")
|
||||
(build-rhs " by the community")
|
||||
(buffer-read-only nil))
|
||||
(when (or badge heart)
|
||||
(goto-char (point-max))
|
||||
(spacemacs-buffer/insert-page-break)
|
||||
(when badge
|
||||
(insert (make-string (floor (/ (- maxcol badge-size) 2)) ?\ ))
|
||||
(insert-image badge))
|
||||
(when heart
|
||||
(when badge (insert "\n\n"))
|
||||
(insert (make-string (floor (/ (- maxcol
|
||||
(length build-lhs)
|
||||
heart-size
|
||||
(length build-rhs)) 2)) ?\ ))
|
||||
(insert build-lhs)
|
||||
(insert-image heart)
|
||||
(insert build-rhs)
|
||||
(insert "\n"))))))
|
||||
|
||||
(defun spacemacs-buffer//insert-note (file caption &optional additional-widgets)
|
||||
"Insert the release note just under the banner.
|
||||
|
||||
|
@ -765,6 +799,7 @@ border."
|
|||
(with-current-buffer (get-buffer spacemacs-buffer-name)
|
||||
(when dotspacemacs-startup-lists
|
||||
(spacemacs-buffer/insert-startupify-lists))
|
||||
(spacemacs-buffer//insert-footer)
|
||||
(if configuration-layer-error-count
|
||||
(progn
|
||||
(spacemacs-buffer-mode)
|
||||
|
@ -790,6 +825,7 @@ already exist, and switch to it."
|
|||
(setq spacemacs-buffer--banner-length
|
||||
(- (window-total-width) 2)))
|
||||
(with-current-buffer (get-buffer-create spacemacs-buffer-name)
|
||||
(page-break-lines-mode)
|
||||
(save-excursion
|
||||
(spacemacs-buffer/set-mode-line "")
|
||||
;; needed in case the buffer was deleted and we are recreating it
|
||||
|
@ -800,6 +836,7 @@ already exist, and switch to it."
|
|||
(progn
|
||||
(when dotspacemacs-startup-lists
|
||||
(spacemacs-buffer/insert-startupify-lists))
|
||||
(spacemacs-buffer//insert-footer)
|
||||
(spacemacs-buffer/set-mode-line spacemacs--default-mode-line)
|
||||
(force-mode-line-update)
|
||||
(spacemacs-buffer-mode))
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
(defconst emacs-start-time (current-time))
|
||||
|
||||
(require 'subr-x nil 'noerror)
|
||||
(require 'page-break-lines)
|
||||
(require 'core-debug)
|
||||
(require 'core-command-line)
|
||||
(require 'core-dotspacemacs)
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
;;; page-break-lines.el --- Display ugly ^L page breaks as tidy horizontal lines
|
||||
|
||||
;; Copyright (C) 2012-2015 Steve Purcell
|
||||
|
||||
;; Author: Steve Purcell <steve@sanityinc.com>
|
||||
;; URL: https://github.com/purcell/page-break-lines
|
||||
;; Package-Version: 20160109.1813
|
||||
;; Package-X-Original-Version: DEV
|
||||
;; Keywords: convenience, faces
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This library provides a global mode which displays form feed
|
||||
;; characters as horizontal rules.
|
||||
|
||||
;; Install from Melpa or Marmalade, or add to `load-path' and use
|
||||
;; (require 'page-break-lines).
|
||||
|
||||
;; Use `page-break-lines-mode' to enable the mode in specific buffers,
|
||||
;; or customize `page-break-lines-modes' and enable the mode globally with
|
||||
;; `global-page-break-lines-mode'.
|
||||
|
||||
;; Issues and limitations:
|
||||
|
||||
;; If `page-break-lines-char' is displayed at a different width to
|
||||
;; regular characters, the rule may be either too short or too long:
|
||||
;; rules may then wrap if `truncate-lines' is nil. On some systems,
|
||||
;; Emacs may erroneously choose a different font for the page break
|
||||
;; symbol, which choice can be overridden using code such as:
|
||||
|
||||
;; (set-fontset-font "fontset-default"
|
||||
;; (cons page-break-lines-char page-break-lines-char)
|
||||
;; (face-attribute 'default :family))
|
||||
|
||||
;; Use `describe-char' on a page break char to determine whether this
|
||||
;; is the case.
|
||||
|
||||
;; Additionally, the use of `text-scale-increase' or
|
||||
;; `text-scale-decrease' will cause the rule width to be incorrect,
|
||||
;; because the reported window width (in characters) will continue to
|
||||
;; be the width in the frame's default font, not the scaled font used to
|
||||
;; display the rule.
|
||||
|
||||
;; Adapted from code http://www.emacswiki.org/emacs/PageBreaks
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defgroup page-break-lines nil
|
||||
"Display ugly ^L page breaks as tidy horizontal lines."
|
||||
:prefix "page-break-lines-"
|
||||
:group 'faces)
|
||||
|
||||
(defcustom page-break-lines-char ?─
|
||||
"Character used to render page break lines."
|
||||
:type 'character
|
||||
:group 'page-break-lines)
|
||||
|
||||
(defcustom page-break-lines-lighter " PgLn"
|
||||
"Mode-line indicator for `page-break-lines-mode'."
|
||||
:type '(choice (const :tag "No lighter" "") string)
|
||||
:group 'page-break-lines)
|
||||
|
||||
(defcustom page-break-lines-modes
|
||||
'(emacs-lisp-mode lisp-mode scheme-mode compilation-mode outline-mode help-mode)
|
||||
"Modes in which to enable `page-break-lines-mode'."
|
||||
:type '(repeat symbol)
|
||||
:group 'page-break-lines)
|
||||
|
||||
(defface page-break-lines
|
||||
'((t :inherit font-lock-comment-face :bold nil :italic nil))
|
||||
"Face used to colorize page break lines.
|
||||
If using :bold or :italic, please ensure `page-break-lines-char'
|
||||
is available in that variant of your font, otherwise it may be
|
||||
displayed as a junk character."
|
||||
:group 'page-break-lines)
|
||||
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode page-break-lines-mode
|
||||
"Toggle Page Break Lines mode.
|
||||
|
||||
In Page Break mode, page breaks (^L characters) are displayed as a
|
||||
horizontal line of `page-break-string-char' characters."
|
||||
:lighter page-break-lines-lighter
|
||||
:group 'page-break-lines
|
||||
(page-break-lines--update-display-tables))
|
||||
|
||||
;;;###autoload
|
||||
(defun turn-on-page-break-lines-mode ()
|
||||
"Enable `page-break-lines-mode' in this buffer."
|
||||
(page-break-lines-mode 1))
|
||||
|
||||
;;;###autoload
|
||||
(defun turn-off-page-break-lines-mode ()
|
||||
"Disable `page-break-lines-mode' in this buffer."
|
||||
(page-break-lines-mode -1))
|
||||
|
||||
|
||||
(dolist (hook '(window-configuration-change-hook
|
||||
after-setting-font-hook))
|
||||
(add-hook hook 'page-break-lines--update-display-tables))
|
||||
|
||||
|
||||
|
||||
(defun page-break-lines--update-display-table (window)
|
||||
"Modify a display-table that displays page-breaks prettily.
|
||||
If the buffer inside WINDOW has `page-break-lines-mode' enabled,
|
||||
its display table will be modified as necessary."
|
||||
(with-current-buffer (window-buffer window)
|
||||
(if page-break-lines-mode
|
||||
(progn
|
||||
(unless buffer-display-table
|
||||
(setq buffer-display-table (make-display-table)))
|
||||
(let* ((width (- (window-width window) 1))
|
||||
(glyph (make-glyph-code page-break-lines-char 'page-break-lines))
|
||||
(new-display-entry (vconcat (make-list width glyph))))
|
||||
(unless (equal new-display-entry (elt buffer-display-table ?\^L))
|
||||
(aset buffer-display-table ?\^L new-display-entry))))
|
||||
(when buffer-display-table
|
||||
(aset buffer-display-table ?\^L nil)))))
|
||||
|
||||
(defun page-break-lines--update-display-tables ()
|
||||
"Function called for updating display table."
|
||||
(mapc 'page-break-lines--update-display-table (window-list nil 'no-minibuffer)))
|
||||
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun page-break-lines-mode-maybe ()
|
||||
"Enable `page-break-lines-mode' in the current buffer if desired.
|
||||
When `major-mode' is listed in `page-break-lines-modes', then
|
||||
`page-break-lines-mode' will be enabled."
|
||||
(if (and (not (minibufferp))
|
||||
(apply 'derived-mode-p page-break-lines-modes))
|
||||
(page-break-lines-mode 1)))
|
||||
|
||||
;;;###autoload
|
||||
(define-global-minor-mode global-page-break-lines-mode
|
||||
page-break-lines-mode page-break-lines-mode-maybe
|
||||
:group 'page-break-lines)
|
||||
|
||||
|
||||
(provide 'page-break-lines)
|
||||
|
||||
;; Local Variables:
|
||||
;; coding: utf-8
|
||||
;; byte-compile-warnings: (not cl-functions)
|
||||
;; checkdoc-minor-mode: t
|
||||
;; End:
|
||||
|
||||
;;; page-break-lines.el ends here
|
|
@ -28,6 +28,8 @@
|
|||
(hybrid-mode :location local :step pre)
|
||||
(linum :location built-in)
|
||||
(package-menu :location built-in)
|
||||
;; page-break-lines is shipped with spacemacs core
|
||||
(page-break-lines :location built-in)
|
||||
(process-menu :location built-in)
|
||||
projectile
|
||||
(recentf :location built-in)
|
||||
|
@ -201,6 +203,11 @@
|
|||
(evilified-state-evilify-map package-menu-mode-map
|
||||
:mode package-menu-mode))
|
||||
|
||||
(defun spacemacs-base/init-page-break-lines ()
|
||||
(require 'page-break-lines)
|
||||
(global-page-break-lines-mode t)
|
||||
(spacemacs|hide-lighter page-break-lines-mode))
|
||||
|
||||
(defun spacemacs-base/init-process-menu ()
|
||||
(evilified-state-evilify process-menu-mode process-menu-mode-map))
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
(diminish :step bootstrap)
|
||||
(evil :step bootstrap)
|
||||
(hydra :step bootstrap)
|
||||
(page-break-lines :step bootstrap)
|
||||
(use-package :step bootstrap)
|
||||
(which-key :step bootstrap)
|
||||
))
|
||||
|
@ -248,11 +247,6 @@
|
|||
(setq hydra-key-doc-function 'spacemacs//hydra-key-doc-function
|
||||
hydra-head-format "[%s] "))
|
||||
|
||||
(defun spacemacs-bootstrap/init-page-break-lines ()
|
||||
(require 'page-break-lines)
|
||||
(global-page-break-lines-mode t)
|
||||
(spacemacs|hide-lighter page-break-lines-mode))
|
||||
|
||||
(defun spacemacs-bootstrap/init-use-package ()
|
||||
(require 'use-package)
|
||||
(setq use-package-verbose init-file-debug
|
||||
|
|
Loading…
Reference in New Issue