2022-03-25 21:41:32 +00:00
|
|
|
|
;;; core-spacemacs-buffer.el --- Spacemacs Core File -*- lexical-binding: t -*-
|
2015-01-26 03:36:07 +00:00
|
|
|
|
;;
|
2022-05-31 16:12:58 +00:00
|
|
|
|
;; Copyright (c) 2012-2022 Sylvain Benner & Contributors
|
2015-01-26 03:36:07 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
|
;;
|
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
|
;; 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/>.
|
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
2022-12-09 00:00:02 +00:00
|
|
|
|
(require 'core-dotspacemacs)
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(defvar dotspacemacs-distribution)
|
|
|
|
|
(defvar dotspacemacs-filepath)
|
|
|
|
|
(defvar dotspacemacs-show-startup-list-numbers)
|
|
|
|
|
(defvar dotspacemacs-startup-banner)
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(defvar dotspacemacs-startup-banner-scale)
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(defvar dotspacemacs-startup-buffer-show-icons)
|
|
|
|
|
(defvar spacemacs-badge-official-png)
|
|
|
|
|
(defvar spacemacs-banner-directory)
|
|
|
|
|
(defvar spacemacs-banner-official-png)
|
|
|
|
|
(defvar spacemacs-gplv3-official-png)
|
2022-12-09 00:00:02 +00:00
|
|
|
|
(defvar spacemacs-version)
|
|
|
|
|
(defvar configuration-layer-error-count))
|
2022-02-17 22:58:17 +00:00
|
|
|
|
|
|
|
|
|
|
2022-01-08 15:01:44 +00:00
|
|
|
|
(defconst spacemacs-buffer-version-info "0.999"
|
2016-04-01 03:44:00 +00:00
|
|
|
|
"Current version used to display addition release information.")
|
|
|
|
|
|
2015-02-04 04:56:52 +00:00
|
|
|
|
(defconst spacemacs-buffer-name "*spacemacs*"
|
|
|
|
|
"The name of the spacemacs buffer.")
|
|
|
|
|
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(defconst spacemacs-buffer-logo-title "[S P A C E M A C S]"
|
|
|
|
|
"The title displayed beneath the logo.")
|
|
|
|
|
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(defconst spacemacs-buffer-buttons-startup-lists-offset 25
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Relative position between the home buffer buttons and startup lists.")
|
2016-09-03 10:47:58 +00:00
|
|
|
|
|
2016-10-29 02:04:42 +00:00
|
|
|
|
(defconst spacemacs-buffer--window-width 80
|
|
|
|
|
"Current width of the home buffer if responsive, 80 otherwise.
|
|
|
|
|
See `dotspacemacs-startup-buffer-responsive'.")
|
2015-01-26 03:36:07 +00:00
|
|
|
|
|
2015-04-13 06:17:48 +00:00
|
|
|
|
(defconst spacemacs-buffer--cache-file
|
|
|
|
|
(expand-file-name (concat spacemacs-cache-directory "spacemacs-buffer.el"))
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Cache file for various persistent data for the spacemacs startup buffer.")
|
2015-04-13 06:17:48 +00:00
|
|
|
|
|
2016-09-02 20:42:37 +00:00
|
|
|
|
(defvar spacemacs-buffer-startup-lists-length 20
|
|
|
|
|
"Length used for startup lists with otherwise unspecified bounds.
|
|
|
|
|
Set to nil for unbounded.")
|
|
|
|
|
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(defvar spacemacs-buffer-list-separator "\n\n")
|
|
|
|
|
|
2015-04-13 06:17:48 +00:00
|
|
|
|
(defvar spacemacs-buffer--release-note-version nil
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"If nil the release note is displayed.
|
|
|
|
|
If non nil it contains a version number, if the version number is lesser than
|
|
|
|
|
the current version the release note it displayed")
|
2015-04-13 06:17:48 +00:00
|
|
|
|
|
2015-04-15 14:30:25 +00:00
|
|
|
|
(defvar spacemacs-buffer--note-widgets nil
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"List of widgets used in currently inserted notes.
|
|
|
|
|
Allows to keep track of widgets to delete when removing them.")
|
2015-04-04 14:33:04 +00:00
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defvar spacemacs-buffer--current-note-type nil
|
|
|
|
|
"Type of note currently displayed.")
|
2015-04-15 14:30:25 +00:00
|
|
|
|
|
2016-04-03 06:51:44 +00:00
|
|
|
|
(defvar spacemacs-buffer--fresh-install
|
|
|
|
|
(not (file-exists-p dotspacemacs-filepath))
|
|
|
|
|
"Non-nil if this Emacs instance if a fresh install.")
|
|
|
|
|
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(defvar spacemacs-buffer--buttons-position nil
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Horizontal position of the home buffer buttons.
|
|
|
|
|
Internal use, do not set this variable.")
|
2016-09-03 10:47:58 +00:00
|
|
|
|
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(defvar spacemacs-buffer--random-banner nil
|
|
|
|
|
"The random banner chosen.")
|
|
|
|
|
|
|
|
|
|
(defvar spacemacs-buffer-note-preview-lines 5
|
|
|
|
|
"If it's a positive integer, show the notes first number of lines.
|
|
|
|
|
If nil, show the full note.")
|
|
|
|
|
|
|
|
|
|
(defvar spacemacs-buffer--note-preview-nr-of-removed-lines nil
|
|
|
|
|
"Store the number of removed lines from the notes:
|
|
|
|
|
Quick Help and Release Notes.")
|
|
|
|
|
|
|
|
|
|
(defvar spacemacs-buffer--errors nil
|
|
|
|
|
"List of errors during startup.")
|
|
|
|
|
|
|
|
|
|
(defvar spacemacs-buffer--idle-numbers-timer nil
|
|
|
|
|
"This stores the idle numbers timer.")
|
|
|
|
|
|
|
|
|
|
(defvar spacemacs-buffer--startup-list-number nil
|
|
|
|
|
"This accumulates the numbers that are typed in the home buffer.
|
|
|
|
|
It's cleared when the idle timer runs.")
|
|
|
|
|
|
|
|
|
|
(defvar spacemacs-buffer--last-width nil
|
|
|
|
|
"Previous width of spacemacs-buffer.")
|
|
|
|
|
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(defvar spacemacs-buffer-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(when dotspacemacs-show-startup-list-numbers
|
|
|
|
|
(define-key map (kbd "0") 'spacemacs-buffer/jump-to-number-startup-list-line)
|
|
|
|
|
(define-key map (kbd "1") 'spacemacs-buffer/jump-to-number-startup-list-line)
|
|
|
|
|
(define-key map (kbd "2") 'spacemacs-buffer/jump-to-number-startup-list-line)
|
|
|
|
|
(define-key map (kbd "3") 'spacemacs-buffer/jump-to-number-startup-list-line)
|
|
|
|
|
(define-key map (kbd "4") 'spacemacs-buffer/jump-to-number-startup-list-line)
|
|
|
|
|
(define-key map (kbd "5") 'spacemacs-buffer/jump-to-number-startup-list-line)
|
|
|
|
|
(define-key map (kbd "6") 'spacemacs-buffer/jump-to-number-startup-list-line)
|
|
|
|
|
(define-key map (kbd "7") 'spacemacs-buffer/jump-to-number-startup-list-line)
|
|
|
|
|
(define-key map (kbd "8") 'spacemacs-buffer/jump-to-number-startup-list-line)
|
|
|
|
|
(define-key map (kbd "9") 'spacemacs-buffer/jump-to-number-startup-list-line))
|
2021-03-20 17:24:19 +00:00
|
|
|
|
|
2016-10-09 16:31:04 +00:00
|
|
|
|
(define-key map [down-mouse-1] 'widget-button-click)
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(define-key map (kbd "RET") 'spacemacs-buffer/return)
|
2016-10-09 16:31:04 +00:00
|
|
|
|
|
2015-10-16 14:08:08 +00:00
|
|
|
|
(define-key map [tab] 'widget-forward)
|
2016-10-09 16:31:04 +00:00
|
|
|
|
(define-key map (kbd "J") 'widget-forward)
|
2015-10-16 14:08:08 +00:00
|
|
|
|
(define-key map (kbd "C-i") 'widget-forward)
|
2016-10-09 16:31:04 +00:00
|
|
|
|
|
2015-10-16 14:08:08 +00:00
|
|
|
|
(define-key map [backtab] 'widget-backward)
|
2016-10-09 16:31:04 +00:00
|
|
|
|
(define-key map (kbd "K") 'widget-backward)
|
|
|
|
|
|
2016-05-13 06:26:34 +00:00
|
|
|
|
(define-key map (kbd "C-r") 'spacemacs-buffer/refresh)
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(define-key map "q" 'quit-window)
|
|
|
|
|
map)
|
|
|
|
|
"Keymap for spacemacs-buffer mode.")
|
2015-10-16 14:08:08 +00:00
|
|
|
|
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(define-derived-mode spacemacs-buffer-mode special-mode "Spacemacs buffer"
|
|
|
|
|
"Spacemacs major mode for startup screen.
|
2016-01-07 17:02:47 +00:00
|
|
|
|
|
2022-02-17 22:58:17 +00:00
|
|
|
|
\\{spacemacs-buffer-mode-map}"
|
2015-10-16 14:08:08 +00:00
|
|
|
|
:group 'spacemacs
|
|
|
|
|
:syntax-table nil
|
|
|
|
|
:abbrev-table nil
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(buffer-disable-undo)
|
|
|
|
|
(page-break-lines-mode +1)
|
|
|
|
|
(with-eval-after-load 'evil
|
|
|
|
|
(progn
|
|
|
|
|
(evil-set-initial-state 'spacemacs-buffer-mode 'motion)
|
|
|
|
|
(evil-make-overriding-map spacemacs-buffer-mode-map 'motion)))
|
|
|
|
|
(suppress-keymap spacemacs-buffer-mode-map t)
|
|
|
|
|
(set-keymap-parent spacemacs-buffer-mode-map nil)
|
|
|
|
|
(setq-local buffer-read-only t
|
|
|
|
|
truncate-lines t))
|
2015-10-16 14:08:08 +00:00
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defun spacemacs-buffer//insert-ascii-banner-centered (file)
|
|
|
|
|
"Insert the ascii banner contain in file and center it in the window.
|
|
|
|
|
FILE: the path to the file containing the banner."
|
|
|
|
|
(insert
|
2016-07-05 17:50:57 +00:00
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-file-contents file)
|
|
|
|
|
(let ((banner-width 0))
|
|
|
|
|
(while (not (eobp))
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(let ((line-length (- (line-end-position) (line-beginning-position))))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(when (< banner-width line-length)
|
|
|
|
|
(setq banner-width line-length)))
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(forward-line 1))
|
2016-07-05 17:50:57 +00:00
|
|
|
|
(goto-char 0)
|
2016-10-29 02:04:42 +00:00
|
|
|
|
(let ((margin (max 0 (floor (/ (- spacemacs-buffer--window-width
|
2016-10-27 17:43:22 +00:00
|
|
|
|
banner-width) 2)))))
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(while (not (eobp))
|
2016-11-29 13:12:36 +00:00
|
|
|
|
(insert (make-string margin ?\s))
|
2019-11-29 20:28:43 +00:00
|
|
|
|
(forward-line 1)))
|
|
|
|
|
(insert "\n"))
|
2016-07-05 17:50:57 +00:00
|
|
|
|
(buffer-string))))
|
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer/insert-banner-and-buttons ()
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Choose a banner according to `dotspacemacs-startup-banner'and insert it.
|
2015-07-29 19:40:22 +00:00
|
|
|
|
in spacemacs buffer along with quick buttons underneath.
|
2015-03-13 03:55:38 +00:00
|
|
|
|
Easter egg:
|
|
|
|
|
Doge special text banner can be reachable via `999', `doge' or `random*'.
|
2019-06-01 04:23:51 +00:00
|
|
|
|
Doge special text banner for dark themes can be reachable via `997',
|
|
|
|
|
`doge-inverted' or `random*'.
|
2016-05-30 03:27:31 +00:00
|
|
|
|
Cate special text banner can de reachable via `998', `cat' or `random*'.
|
2015-01-26 03:36:07 +00:00
|
|
|
|
`random' ignore special banners whereas `random*' does not."
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(let ((banner (spacemacs-buffer//choose-banner))
|
2015-01-26 03:36:07 +00:00
|
|
|
|
(buffer-read-only nil))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(when banner
|
|
|
|
|
(spacemacs-buffer/message (format "Banner: %s" banner))
|
|
|
|
|
(if (image-type-available-p (intern (file-name-extension banner)))
|
|
|
|
|
(spacemacs-buffer//insert-image-banner banner)
|
|
|
|
|
(spacemacs-buffer//insert-ascii-banner-centered banner)))
|
|
|
|
|
(spacemacs-buffer//insert-buttons)
|
|
|
|
|
(spacemacs//redisplay)))
|
2015-01-26 03:36:07 +00:00
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defun spacemacs-buffer/display-startup-note ()
|
|
|
|
|
"Decide of the startup note and display it if relevant."
|
2016-04-03 06:51:44 +00:00
|
|
|
|
(when (file-exists-p spacemacs-buffer--cache-file)
|
2018-06-10 06:49:51 +00:00
|
|
|
|
(load spacemacs-buffer--cache-file nil (not init-file-debug)))
|
2016-04-03 06:51:44 +00:00
|
|
|
|
(cond
|
|
|
|
|
(spacemacs-buffer--fresh-install
|
|
|
|
|
;; we assume the user is new to spacemacs and open the quickhelp
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(spacemacs-buffer/toggle-note 'quickhelp)
|
2016-04-03 06:51:44 +00:00
|
|
|
|
(setq spacemacs-buffer--release-note-version spacemacs-version)
|
|
|
|
|
(spacemacs/dump-vars-to-file '(spacemacs-buffer--release-note-version)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
spacemacs-buffer--cache-file))
|
2016-04-03 06:51:44 +00:00
|
|
|
|
((or (not spacemacs-buffer--release-note-version)
|
|
|
|
|
(version< spacemacs-buffer--release-note-version
|
|
|
|
|
spacemacs-version))
|
2017-01-25 05:28:15 +00:00
|
|
|
|
;; check the variable spacemacs-buffer--release-note-version
|
|
|
|
|
;; to decide whether we show the release note
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(spacemacs-buffer/toggle-note 'release-note)))
|
2016-04-03 06:51:44 +00:00
|
|
|
|
(spacemacs//redisplay))
|
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer//choose-banner ()
|
2015-03-09 02:09:09 +00:00
|
|
|
|
"Return the full path of a banner based on the dotfile value."
|
2015-09-07 16:52:09 +00:00
|
|
|
|
(when dotspacemacs-startup-banner
|
|
|
|
|
(cond ((eq 'official dotspacemacs-startup-banner)
|
|
|
|
|
(if (and (display-graphic-p) (image-type-available-p 'png))
|
|
|
|
|
spacemacs-banner-official-png
|
|
|
|
|
(spacemacs-buffer//get-banner-path 1)))
|
|
|
|
|
((eq 'random dotspacemacs-startup-banner)
|
|
|
|
|
(spacemacs-buffer//choose-random-text-banner))
|
|
|
|
|
((eq 'random* dotspacemacs-startup-banner)
|
|
|
|
|
(spacemacs-buffer//choose-random-text-banner t))
|
|
|
|
|
((eq 'doge dotspacemacs-startup-banner)
|
|
|
|
|
(spacemacs-buffer//get-banner-path 999))
|
2019-06-01 04:23:51 +00:00
|
|
|
|
((eq 'doge-inverted dotspacemacs-startup-banner)
|
|
|
|
|
(spacemacs-buffer//get-banner-path 997))
|
2016-05-30 03:27:31 +00:00
|
|
|
|
((eq 'cat dotspacemacs-startup-banner)
|
2016-05-27 00:18:48 +00:00
|
|
|
|
(spacemacs-buffer//get-banner-path 998))
|
2015-09-07 16:52:09 +00:00
|
|
|
|
((integerp dotspacemacs-startup-banner)
|
|
|
|
|
(spacemacs-buffer//get-banner-path dotspacemacs-startup-banner))
|
|
|
|
|
((and dotspacemacs-startup-banner
|
|
|
|
|
(image-type-available-p (intern (file-name-extension
|
|
|
|
|
dotspacemacs-startup-banner)))
|
|
|
|
|
(display-graphic-p))
|
|
|
|
|
(if (file-exists-p dotspacemacs-startup-banner)
|
|
|
|
|
dotspacemacs-startup-banner
|
|
|
|
|
(spacemacs-buffer/warning (format "could not find banner %s"
|
|
|
|
|
dotspacemacs-startup-banner))
|
|
|
|
|
(spacemacs-buffer//get-banner-path 1)))
|
|
|
|
|
(t (spacemacs-buffer//get-banner-path 1)))))
|
2015-03-09 02:09:09 +00:00
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer//choose-random-text-banner (&optional all)
|
2015-01-26 03:36:07 +00:00
|
|
|
|
"Return the full path of a banner chosen randomly.
|
|
|
|
|
If ALL is non-nil then truly all banners can be selected."
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(unless spacemacs-buffer--random-banner
|
|
|
|
|
(let* ((files (directory-files spacemacs-banner-directory t ".*\.txt"))
|
|
|
|
|
(count (length files))
|
|
|
|
|
;; -2 to remove the two last ones (easter eggs)
|
|
|
|
|
(choice (random (- count (if all 0 2)))))
|
2022-02-15 19:01:03 +00:00
|
|
|
|
(setq spacemacs-buffer--random-banner (nth choice files))))
|
|
|
|
|
spacemacs-buffer--random-banner)
|
2015-01-26 03:36:07 +00:00
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer//get-banner-path (index)
|
2015-01-26 03:36:07 +00:00
|
|
|
|
"Return the full path to banner with index INDEX."
|
|
|
|
|
(concat spacemacs-banner-directory (format "%03d-banner.txt" index)))
|
|
|
|
|
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(defun spacemacs-buffer//banner-fit-height-size ()
|
|
|
|
|
"Calculate height of startup banner to fit buffer contents.
|
|
|
|
|
Returns height in units of line height with a minimum of 1."
|
|
|
|
|
;; first determine number of lines occupied by startup list
|
|
|
|
|
(let* ((startup-list-line-height
|
|
|
|
|
;; the all-the-icons package is not available here yet, but we don't
|
|
|
|
|
;; require icons for just counting the lines in the
|
|
|
|
|
;; `dotspacemacs-startup-lists'
|
|
|
|
|
(let ((icons dotspacemacs-startup-buffer-show-icons)
|
|
|
|
|
lines)
|
|
|
|
|
(setq dotspacemacs-startup-buffer-show-icons nil)
|
|
|
|
|
(setq lines (with-temp-buffer
|
|
|
|
|
(spacemacs-buffer//do-insert-startupify-lists)
|
2022-06-09 18:58:18 +00:00
|
|
|
|
(recentf-mode -1)
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(line-number-at-pos)))
|
|
|
|
|
;; (count-lines (point-min) (point-max)))
|
|
|
|
|
(setq dotspacemacs-startup-buffer-show-icons icons)
|
|
|
|
|
lines))
|
|
|
|
|
;; We determine the maximum available banner height by subtracting the
|
|
|
|
|
;; number of lines in the home buffer contents (excl. logo and
|
|
|
|
|
;; startup-list), i.e. `26', and the number of lines in the startup
|
|
|
|
|
;; list from the total available text lines
|
|
|
|
|
(image-height (- (window-text-height) 26 startup-list-line-height)))
|
|
|
|
|
;; return image-height with minimum of 3 line heights
|
|
|
|
|
(max image-height 3)))
|
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer//insert-image-banner (banner)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Display an image banner.
|
|
|
|
|
BANNER: the path to an ascii banner file."
|
2015-03-13 03:55:38 +00:00
|
|
|
|
(when (file-exists-p banner)
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(let* ((title spacemacs-buffer-logo-title)
|
2015-07-30 02:07:27 +00:00
|
|
|
|
(spec (create-image banner))
|
2022-02-19 17:45:22 +00:00
|
|
|
|
;; we must use the scaled size for determining the correct
|
|
|
|
|
;; left-margin size
|
|
|
|
|
(unscaled-size (image-size spec)) ;; size in 'canonical character units'
|
|
|
|
|
(height (cdr unscaled-size)) ;; return size in units of line heights
|
|
|
|
|
(scale (pcase dotspacemacs-startup-banner-scale
|
|
|
|
|
('auto (let ((factor (/ (float (spacemacs-buffer//banner-fit-height-size))
|
|
|
|
|
height)))
|
|
|
|
|
;; return factor with maximum of 1
|
|
|
|
|
(min factor 1)))
|
|
|
|
|
(factor factor)))
|
|
|
|
|
(size (cons (* scale (car unscaled-size)) (* scale (cdr unscaled-size))))
|
2015-03-13 03:55:38 +00:00
|
|
|
|
(width (car size))
|
2016-10-29 02:04:42 +00:00
|
|
|
|
(left-margin (max 0 (floor (- spacemacs-buffer--window-width width) 2))))
|
2022-02-19 17:45:22 +00:00
|
|
|
|
;; we scale the image by simply setting the scale property in the image-spec
|
|
|
|
|
(plist-put (cdr spec) :scale scale)
|
2016-11-29 13:12:36 +00:00
|
|
|
|
(insert (make-string left-margin ?\s))
|
2015-03-13 03:55:38 +00:00
|
|
|
|
(insert-image spec)
|
|
|
|
|
(insert "\n\n")
|
2016-10-29 02:04:42 +00:00
|
|
|
|
(insert (make-string (max 0 (floor (/ (- spacemacs-buffer--window-width
|
2016-11-29 13:12:36 +00:00
|
|
|
|
(+ (length title) 1)) 2))) ?\s))
|
2015-07-30 02:07:27 +00:00
|
|
|
|
(insert (format "%s\n\n" title)))))
|
2015-03-13 03:55:38 +00:00
|
|
|
|
|
2019-11-29 20:28:43 +00:00
|
|
|
|
(defun spacemacs-buffer//insert-version ()
|
|
|
|
|
"Insert the current version of Spacemacs and Emacs.
|
|
|
|
|
Right justified, based on the Spacemacs buffers window width."
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create spacemacs-buffer-name)
|
2019-11-29 20:28:43 +00:00
|
|
|
|
(let ((version (format "%s@%s (%s)"
|
|
|
|
|
spacemacs-version
|
|
|
|
|
emacs-version
|
|
|
|
|
dotspacemacs-distribution))
|
|
|
|
|
(buffer-read-only nil))
|
|
|
|
|
(insert (format (format "%%%ds"
|
|
|
|
|
(if (display-graphic-p)
|
|
|
|
|
spacemacs-buffer--window-width
|
|
|
|
|
;; terminal needs one less char
|
|
|
|
|
(1- spacemacs-buffer--window-width)))
|
|
|
|
|
version))
|
|
|
|
|
(insert "\n\n"))))
|
2015-01-26 03:36:07 +00:00
|
|
|
|
|
2016-06-05 04:04:53 +00:00
|
|
|
|
(defun spacemacs-buffer//insert-footer ()
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Insert the footer of the home buffer."
|
2016-06-05 04:04:53 +00:00
|
|
|
|
(save-excursion
|
2016-11-29 13:12:36 +00:00
|
|
|
|
(let* ((badge-path spacemacs-badge-official-png)
|
2016-06-13 09:20:38 +00:00
|
|
|
|
(badge (when (and (display-graphic-p)
|
|
|
|
|
(image-type-available-p
|
2016-06-24 22:47:14 +00:00
|
|
|
|
(intern (file-name-extension badge-path))))
|
|
|
|
|
(create-image badge-path)))
|
2016-06-05 04:04:53 +00:00
|
|
|
|
(badge-size (when badge (car (image-size badge))))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(build-by (concat "Made with "
|
|
|
|
|
(if (and dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(display-graphic-p)
|
|
|
|
|
(or (fboundp 'all-the-icons-faicon)
|
|
|
|
|
(require 'all-the-icons nil 'noerror)))
|
|
|
|
|
(all-the-icons-faicon "heart" :height 0.8 :v-adjust -0.05)
|
|
|
|
|
"heart")
|
|
|
|
|
" by the community"))
|
2021-03-26 22:58:29 +00:00
|
|
|
|
(proudly-free "Proudly free software")
|
2021-03-24 20:03:04 +00:00
|
|
|
|
(gplv3-path spacemacs-gplv3-official-png)
|
|
|
|
|
(gplv3 (when (and (display-graphic-p)
|
|
|
|
|
(image-type-available-p
|
|
|
|
|
(intern (file-name-extension gplv3-path))))
|
|
|
|
|
(create-image gplv3-path)))
|
|
|
|
|
(gplv3-size (when gplv3 (car (image-size gplv3))))
|
2016-06-05 04:04:53 +00:00
|
|
|
|
(buffer-read-only nil))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(spacemacs-buffer/insert-page-break)
|
|
|
|
|
(insert "\n")
|
|
|
|
|
(when badge
|
|
|
|
|
(insert-image badge)
|
|
|
|
|
(spacemacs-buffer//center-line badge-size)
|
|
|
|
|
(insert "\n\n"))
|
|
|
|
|
(insert build-by)
|
|
|
|
|
(spacemacs-buffer//center-line (length build-by))
|
|
|
|
|
(insert "\n\n")
|
|
|
|
|
(widget-create 'url-link
|
|
|
|
|
:tag proudly-free
|
|
|
|
|
:help-echo "What is free software?"
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
"https://www.gnu.org/philosophy/free-sw.en.html")
|
|
|
|
|
(spacemacs-buffer//center-line (+ 2 (length proudly-free)))
|
|
|
|
|
(when gplv3
|
|
|
|
|
(insert "\n\n")
|
|
|
|
|
(insert-image gplv3)
|
|
|
|
|
(spacemacs-buffer//center-line gplv3-size)
|
|
|
|
|
(insert "\n")))))
|
2016-06-05 04:04:53 +00:00
|
|
|
|
|
2019-03-20 18:18:01 +00:00
|
|
|
|
(defmacro spacemacs-buffer||notes-adapt-caption-to-width (caption
|
|
|
|
|
caption-length
|
|
|
|
|
width)
|
|
|
|
|
"Adapt caption string's length to the note's frame current width.
|
|
|
|
|
For internal use in `spacemacs-buffer//notes-render-framed-text'.
|
|
|
|
|
CAPTION: string to be encrusted onto the note's frame
|
|
|
|
|
CAPTION-LENGTH: length of the caption
|
|
|
|
|
WIDTH: current external width of the note's frame."
|
|
|
|
|
`(when (> ,caption-length (- ,width 6)) ; minimum frame width is 6
|
|
|
|
|
(if (> ,width 8)
|
|
|
|
|
(setq ,caption (concat (substring ,caption
|
|
|
|
|
0
|
|
|
|
|
(min -3 (- (- ,width 6 3)
|
|
|
|
|
,caption-length)))
|
|
|
|
|
"..."))
|
|
|
|
|
(setq ,caption nil
|
|
|
|
|
,caption-length 0))))
|
|
|
|
|
|
2021-05-13 14:23:59 +00:00
|
|
|
|
(defun spacemacs-buffer//if-note-preview-remove-rest-of-note ()
|
|
|
|
|
"If `spacemacs-buffer-note-preview-lines' is a positive integer,
|
|
|
|
|
remove the rest of the note, after the variables line number."
|
|
|
|
|
(when (and (integerp spacemacs-buffer-note-preview-lines)
|
|
|
|
|
(> spacemacs-buffer-note-preview-lines 0))
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line spacemacs-buffer-note-preview-lines)
|
2021-05-13 14:23:59 +00:00
|
|
|
|
(let* ((first-removed-line (line-number-at-pos (point)))
|
|
|
|
|
(last-removed-line (line-number-at-pos (point-max))))
|
|
|
|
|
(setq spacemacs-buffer--note-preview-nr-of-removed-lines
|
|
|
|
|
(- last-removed-line first-removed-line))
|
|
|
|
|
(delete-region (point) (point-max)))))
|
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defun spacemacs-buffer//notes-render-framed-text
|
|
|
|
|
(content &optional topcaption botcaption hpadding max-width min-width)
|
2018-05-24 02:12:30 +00:00
|
|
|
|
"Return a formatted string framed with curved lines.
|
2016-10-27 17:43:22 +00:00
|
|
|
|
The width of the created frame is the width of the content, unless it does not
|
|
|
|
|
satisfy max-width or min-width. Note that max-width can be limited by the
|
|
|
|
|
window's width.
|
|
|
|
|
CONTENT can be a text or a filepath.
|
|
|
|
|
TOPCAPTION is a text to be encrusted at the top of the frame.
|
|
|
|
|
BOTCAPTION is a text to be encrusted at the bottom of the frame.
|
|
|
|
|
HPADDING is the horizontal spacing between the text and the frame. The vertical
|
|
|
|
|
spacing is always one line.
|
|
|
|
|
MAX-WIDTH is the maximum width of the frame, frame included. When
|
|
|
|
|
`dotspacemacs-startup-buffer-responsive' is t, MAX-WIDTH will be
|
|
|
|
|
limited to the window's width. MAX-WIDTH takes precedence over
|
|
|
|
|
MIN-WIDTH.
|
|
|
|
|
MIN-WIDTH is the minimal width of the frame, frame included. The frame will not
|
|
|
|
|
shrink any thinner than MIN-WIDTH characters unless MAX-WIDTH says
|
|
|
|
|
otherwise."
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(if (not (file-exists-p content))
|
|
|
|
|
(insert content)
|
|
|
|
|
(insert-file-contents content)
|
2021-05-13 14:23:59 +00:00
|
|
|
|
(spacemacs-buffer//if-note-preview-remove-rest-of-note)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(when (eq ?\n (char-before)) ;; remove additional newline at eof
|
|
|
|
|
(delete-char -1)))
|
|
|
|
|
(let* ((hpadding (if hpadding hpadding 1))
|
|
|
|
|
(text-width (spacemacs-buffer//get-buffer-width))
|
|
|
|
|
(width (+ 2 (* 2 hpadding) text-width))
|
|
|
|
|
(fill-column text-width)
|
|
|
|
|
(sentence-end-double-space nil) ; needed by fill-region
|
2016-11-05 00:10:15 +00:00
|
|
|
|
(paragraph-start "\f\\|[ \t]*$\\|[ \t]*[-+*] \\|[ \t]*[0-9]+[.)] ")
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(topcaption-length (if topcaption (length topcaption) 0))
|
|
|
|
|
(botcaption-length (if botcaption (length botcaption) 0)))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
;; min-width defaults to 1
|
|
|
|
|
;; max-width defaults to width, but truncated between min-width and window-width
|
|
|
|
|
(setq min-width (or min-width 1)
|
|
|
|
|
max-width (min (max (or max-width width) min-width)
|
|
|
|
|
spacemacs-buffer--window-width))
|
|
|
|
|
(cond
|
|
|
|
|
((< width min-width)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(setq width min-width
|
|
|
|
|
fill-column (max 0 (- min-width 2 (* hpadding 2)))))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
((> width max-width)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(setq width max-width
|
2022-02-15 06:52:00 +00:00
|
|
|
|
fill-column (max 0 (- max-width 2 (* hpadding 2))))))
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(spacemacs-buffer||notes-adapt-caption-to-width topcaption
|
|
|
|
|
topcaption-length
|
|
|
|
|
width)
|
|
|
|
|
(spacemacs-buffer||notes-adapt-caption-to-width botcaption
|
|
|
|
|
botcaption-length
|
|
|
|
|
width)
|
|
|
|
|
(fill-region (point-min) (point-max) nil nil)
|
|
|
|
|
(concat
|
|
|
|
|
"╭─" (when topcaption (propertize (concat " " topcaption " ")
|
|
|
|
|
'face
|
|
|
|
|
'(:weight bold)))
|
|
|
|
|
(make-string (max 0 (- width (if topcaption 6 4) topcaption-length)) ?─) "─╮\n"
|
|
|
|
|
(spacemacs-buffer//notes-render-framed-line "" width hpadding)
|
|
|
|
|
(mapconcat (lambda (line)
|
|
|
|
|
(spacemacs-buffer//notes-render-framed-line line width hpadding))
|
|
|
|
|
(split-string (buffer-string) "\n" nil) "")
|
|
|
|
|
(spacemacs-buffer//notes-render-framed-line "" width hpadding)
|
|
|
|
|
"╰─" (when botcaption (propertize (concat " " botcaption " ")
|
|
|
|
|
'face '(:weight bold)))
|
|
|
|
|
(make-string (max 0 (- width (if botcaption 6 4) botcaption-length)) ?─)
|
|
|
|
|
"─╯" (when botcaption "\n")))))
|
2015-04-15 14:30:25 +00:00
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defun spacemacs-buffer//notes-render-framed-line (line width hpadding)
|
2018-05-24 02:12:30 +00:00
|
|
|
|
"Return a formatted LINE with borders of a frame on each side.
|
2016-10-27 17:43:22 +00:00
|
|
|
|
WIDTH: external width of the frame. LINE should be shorter than WIDTH.
|
|
|
|
|
HPADDING: horizontal padding on both sides of the framed string."
|
|
|
|
|
(let ((fill (max 0 (- width 2 hpadding (length line)))))
|
|
|
|
|
(concat "│" (make-string hpadding ?\s) line (make-string fill ?\s)
|
|
|
|
|
"│\n")))
|
2015-04-15 14:30:25 +00:00
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defun spacemacs-buffer//notes-insert-note
|
2016-10-27 16:02:59 +00:00
|
|
|
|
(file topcaption botcaption &optional additional-widgets)
|
|
|
|
|
"Insert the release note just under the banner.
|
2016-10-27 17:43:22 +00:00
|
|
|
|
FILE: the file that contains the content to show.
|
|
|
|
|
TOPCAPTION: the title of the note.
|
|
|
|
|
BOTCAPTION: a text to be encrusted at the bottom of the frame.
|
|
|
|
|
ADDITIONAL-WIDGETS: a function for inserting a widget under the frame."
|
2016-10-27 16:02:59 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
2022-04-02 19:23:58 +00:00
|
|
|
|
(search-forward "Search in Spacemacs\]" nil "move to limit") ; TODO: this is dirty
|
2016-10-27 16:02:59 +00:00
|
|
|
|
(forward-line)
|
|
|
|
|
(let* ((buffer-read-only nil)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(note (concat "\n"
|
|
|
|
|
(spacemacs-buffer//notes-render-framed-text file
|
|
|
|
|
topcaption
|
|
|
|
|
botcaption
|
|
|
|
|
2
|
|
|
|
|
nil
|
|
|
|
|
80))))
|
2016-10-27 16:02:59 +00:00
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region (point) (point))
|
2020-10-03 07:24:24 +00:00
|
|
|
|
(add-to-list 'spacemacs-buffer--note-widgets (widget-create 'text :format "%v" note))
|
2016-10-29 02:04:42 +00:00
|
|
|
|
(let* ((width (spacemacs-buffer//get-buffer-width))
|
|
|
|
|
(padding (max 0 (floor (/ (- spacemacs-buffer--window-width
|
|
|
|
|
width) 2)))))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(insert (make-string padding ?\s))
|
|
|
|
|
(forward-line))))
|
2020-07-02 22:44:29 +00:00
|
|
|
|
(save-excursion
|
2016-10-27 16:02:59 +00:00
|
|
|
|
(while (re-search-backward "\\[\\[\\(.*\\)\\]\\]" nil t)
|
|
|
|
|
(make-text-button (match-beginning 1)
|
|
|
|
|
(match-end 1)
|
|
|
|
|
'type 'help-url
|
|
|
|
|
'help-args (list (match-string 1)))))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(when additional-widgets
|
|
|
|
|
(funcall additional-widgets))
|
2016-10-29 02:04:42 +00:00
|
|
|
|
(spacemacs-buffer//center-line)
|
|
|
|
|
(delete-trailing-whitespace (line-beginning-position)
|
|
|
|
|
(line-end-position)))))
|
2016-10-27 16:02:59 +00:00
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defun spacemacs-buffer//notes-insert-quickhelp ()
|
|
|
|
|
"Insert quickhelp."
|
2016-02-01 01:24:13 +00:00
|
|
|
|
(let ((widget-func
|
|
|
|
|
(lambda ()
|
2021-05-13 14:23:59 +00:00
|
|
|
|
(when spacemacs-buffer-note-preview-lines
|
|
|
|
|
(widget-insert "\n")
|
|
|
|
|
(let ((full-note-link-text
|
|
|
|
|
(format "Click to show the full note (%s more lines)"
|
|
|
|
|
spacemacs-buffer--note-preview-nr-of-removed-lines)))
|
|
|
|
|
(add-to-list
|
|
|
|
|
'spacemacs-buffer--note-widgets
|
|
|
|
|
(widget-create
|
|
|
|
|
'push-button
|
|
|
|
|
:tag (propertize
|
|
|
|
|
full-note-link-text 'face 'font-lock-warning-face)
|
|
|
|
|
:help-echo "Open full note."
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(let ((cursor-pos-before-showing-full-note (point))
|
|
|
|
|
(spacemacs-buffer-note-preview-lines nil))
|
|
|
|
|
;; close note
|
|
|
|
|
(spacemacs-buffer/toggle-note 'quickhelp)
|
|
|
|
|
;; open full note
|
|
|
|
|
(spacemacs-buffer/toggle-note 'quickhelp)
|
|
|
|
|
;; cursor to beg of first line after preview
|
|
|
|
|
(goto-char cursor-pos-before-showing-full-note)
|
|
|
|
|
(progn (forward-line -2)
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
(forward-word)
|
|
|
|
|
(backward-word))))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"))
|
|
|
|
|
(spacemacs-buffer//center-line)
|
|
|
|
|
(widget-insert "\n")))
|
2016-02-01 01:24:13 +00:00
|
|
|
|
(add-to-list
|
|
|
|
|
'spacemacs-buffer--note-widgets
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:tag (propertize "Evil Tutorial"
|
|
|
|
|
'face 'font-lock-keyword-face)
|
|
|
|
|
:help-echo
|
|
|
|
|
"Teach you how to use Vim basics."
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(call-interactively #'evil-tutor-start))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"))
|
|
|
|
|
(widget-insert " ")
|
|
|
|
|
(add-to-list
|
|
|
|
|
'spacemacs-buffer--note-widgets
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:tag (propertize "Emacs Tutorial"
|
|
|
|
|
'face 'font-lock-keyword-face)
|
|
|
|
|
:help-echo "Teach you how to use Emacs basics."
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(call-interactively #'help-with-tutorial))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"))
|
|
|
|
|
(widget-insert " ")
|
|
|
|
|
(add-to-list
|
|
|
|
|
'spacemacs-buffer--note-widgets
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:tag (propertize "Vim Migration Guide"
|
|
|
|
|
'face 'font-lock-keyword-face)
|
|
|
|
|
:help-echo "Documentation for former vim users."
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(spacemacs/view-org-file
|
|
|
|
|
(concat spacemacs-docs-directory
|
|
|
|
|
"VIMUSERS.org") "^" 'all))
|
|
|
|
|
:mouse-face 'highlight
|
2021-05-08 15:45:51 +00:00
|
|
|
|
:follow-link "\C-m"))
|
|
|
|
|
(widget-insert " ")
|
|
|
|
|
(add-to-list
|
|
|
|
|
'spacemacs-buffer--note-widgets
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:tag (propertize "Close note"
|
|
|
|
|
'face '(:foreground "orangeRed"))
|
|
|
|
|
:help-echo "Close note"
|
|
|
|
|
:action
|
|
|
|
|
(lambda (&rest ignore)
|
|
|
|
|
(spacemacs-buffer/toggle-note 'quickhelp)
|
|
|
|
|
(search-backward "[?"))
|
|
|
|
|
:mouse-face 'highlight
|
2021-05-13 14:23:59 +00:00
|
|
|
|
:follow-link "\C-m"))
|
|
|
|
|
;; center the buttons: Evil Tutorial, Emacs Tutorial, etc.
|
|
|
|
|
(spacemacs-buffer//center-line)
|
|
|
|
|
(widget-insert "\n"))))
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(spacemacs-buffer//notes-insert-note (concat spacemacs-info-directory
|
|
|
|
|
"quickhelp.txt")
|
|
|
|
|
"Quick Help"
|
|
|
|
|
nil
|
|
|
|
|
widget-func)))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//notes-insert-release-note ()
|
|
|
|
|
"Insert release note."
|
2016-02-01 01:24:13 +00:00
|
|
|
|
(let ((widget-func
|
|
|
|
|
(lambda ()
|
2021-05-13 14:23:59 +00:00
|
|
|
|
(when spacemacs-buffer-note-preview-lines
|
|
|
|
|
(let ((full-note-link-text
|
|
|
|
|
(format "Click to show the full note (%s more lines)"
|
|
|
|
|
spacemacs-buffer--note-preview-nr-of-removed-lines)))
|
|
|
|
|
(add-to-list
|
|
|
|
|
'spacemacs-buffer--note-widgets
|
|
|
|
|
(widget-create
|
|
|
|
|
'push-button
|
|
|
|
|
:tag (propertize
|
|
|
|
|
full-note-link-text 'face 'font-lock-warning-face)
|
|
|
|
|
:help-echo "Open full note."
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(let ((cursor-pos-before-showing-full-note (point))
|
|
|
|
|
(spacemacs-buffer-note-preview-lines nil))
|
|
|
|
|
;; close note
|
|
|
|
|
(spacemacs-buffer/toggle-note 'release-note)
|
|
|
|
|
;; open full note
|
|
|
|
|
(spacemacs-buffer/toggle-note 'release-note)
|
|
|
|
|
;; cursor to beg of first line after preview
|
|
|
|
|
(goto-char cursor-pos-before-showing-full-note)
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(progn
|
|
|
|
|
(back-to-indentation)
|
|
|
|
|
(forward-line -1)
|
|
|
|
|
(forward-char 3))))
|
2021-05-13 14:23:59 +00:00
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"))
|
|
|
|
|
(spacemacs-buffer//center-line)
|
|
|
|
|
(widget-insert "\n")))
|
2016-02-01 01:24:13 +00:00
|
|
|
|
(add-to-list
|
|
|
|
|
'spacemacs-buffer--note-widgets
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:tag (propertize "Click here for full change log"
|
|
|
|
|
'face 'font-lock-warning-face)
|
|
|
|
|
:help-echo "Open the full change log."
|
2016-04-01 03:44:00 +00:00
|
|
|
|
:action
|
|
|
|
|
(lambda (&rest ignore)
|
|
|
|
|
(funcall 'spacemacs/view-org-file
|
2016-06-23 04:19:12 +00:00
|
|
|
|
(concat spacemacs-start-directory
|
2016-04-01 03:44:00 +00:00
|
|
|
|
"CHANGELOG.org")
|
|
|
|
|
(format "Release %s.x"
|
|
|
|
|
spacemacs-buffer-version-info)
|
|
|
|
|
'subtree))
|
2016-02-01 01:24:13 +00:00
|
|
|
|
:mouse-face 'highlight
|
2021-05-08 15:45:51 +00:00
|
|
|
|
:follow-link "\C-m"))
|
|
|
|
|
(widget-insert " ")
|
|
|
|
|
(add-to-list
|
|
|
|
|
'spacemacs-buffer--note-widgets
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:tag (propertize "Close note"
|
|
|
|
|
'face '(:foreground "orangeRed"))
|
|
|
|
|
:help-echo "Close note"
|
|
|
|
|
:action
|
|
|
|
|
(lambda (&rest ignore)
|
|
|
|
|
(spacemacs-buffer/toggle-note 'release-note)
|
|
|
|
|
(search-backward "[Release"))
|
|
|
|
|
:mouse-face 'highlight
|
2021-05-13 14:23:59 +00:00
|
|
|
|
:follow-link "\C-m"))
|
|
|
|
|
;; center the buttons: Click here for full change log and Close note
|
|
|
|
|
(spacemacs-buffer//center-line)
|
|
|
|
|
(widget-insert "\n"))))
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(spacemacs-buffer//notes-insert-note (concat spacemacs-release-notes-directory
|
|
|
|
|
spacemacs-buffer-version-info
|
|
|
|
|
".txt")
|
|
|
|
|
(format "Important Notes (Release %s.x)"
|
|
|
|
|
spacemacs-buffer-version-info)
|
|
|
|
|
"Update your dotfile (SPC f e D) and\
|
2016-10-27 16:02:59 +00:00
|
|
|
|
packages after every update"
|
2016-10-27 17:43:22 +00:00
|
|
|
|
widget-func))
|
2015-04-15 14:30:25 +00:00
|
|
|
|
(setq spacemacs-buffer--release-note-version nil)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(spacemacs/dump-vars-to-file '(spacemacs-buffer--release-note-version)
|
|
|
|
|
spacemacs-buffer--cache-file))
|
2015-04-15 14:30:25 +00:00
|
|
|
|
|
2021-05-13 14:23:59 +00:00
|
|
|
|
(defun spacemacs-buffer//note-removal-cleanup ()
|
|
|
|
|
"After removing a home buffer note.
|
|
|
|
|
Remove: additional empty lines (leaving only one),
|
|
|
|
|
and the trailing whitespace."
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(delete-blank-lines)
|
|
|
|
|
(delete-region (line-beginning-position) (line-end-position))))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//widget-text-note-beg-pos ()
|
|
|
|
|
(let (pos)
|
|
|
|
|
(dolist (w spacemacs-buffer--note-widgets)
|
|
|
|
|
(when (eq (car w) 'text)
|
|
|
|
|
(setq pos (marker-position (widget-get w :from)))))
|
|
|
|
|
pos))
|
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defun spacemacs-buffer//notes-clear-notes-and-widgets ()
|
|
|
|
|
"Remove existing note widgets if exists."
|
|
|
|
|
(when spacemacs-buffer--note-widgets
|
2021-05-13 14:23:59 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((note-beg-pos (spacemacs-buffer//widget-text-note-beg-pos)))
|
|
|
|
|
(mapc 'widget-delete spacemacs-buffer--note-widgets)
|
|
|
|
|
(goto-char note-beg-pos)
|
|
|
|
|
(spacemacs-buffer//note-removal-cleanup)))
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(setq spacemacs-buffer--note-widgets nil)
|
|
|
|
|
(setq spacemacs-buffer--release-note-version spacemacs-version)
|
|
|
|
|
(spacemacs/dump-vars-to-file
|
|
|
|
|
'(spacemacs-buffer--release-note-version) spacemacs-buffer--cache-file)))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//notes-redisplay-current-note ()
|
|
|
|
|
"Delete and rediplay the currently displayed note."
|
|
|
|
|
(spacemacs-buffer//notes-clear-notes-and-widgets)
|
|
|
|
|
(let ((type spacemacs-buffer--current-note-type))
|
|
|
|
|
(cond
|
|
|
|
|
((eq type 'quickhelp) (spacemacs-buffer//notes-insert-quickhelp))
|
|
|
|
|
((eq type 'release-note) (spacemacs-buffer//notes-insert-release-note))
|
|
|
|
|
(t))))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer/toggle-note (type)
|
|
|
|
|
"Toggle the displayed note based on TYPE.
|
|
|
|
|
If TYPE is nil or unknown, just remove the currently displayed note. Currently
|
|
|
|
|
allowed types are `quickhelp' and `release-note'"
|
|
|
|
|
(spacemacs-buffer//notes-clear-notes-and-widgets)
|
|
|
|
|
(if (or (eq spacemacs-buffer--current-note-type nil)
|
|
|
|
|
(not (eq spacemacs-buffer--current-note-type type)))
|
|
|
|
|
(progn
|
|
|
|
|
(setq spacemacs-buffer--current-note-type type)
|
|
|
|
|
(cond
|
|
|
|
|
((eq type 'quickhelp) (spacemacs-buffer//notes-insert-quickhelp))
|
|
|
|
|
((eq type 'release-note) (spacemacs-buffer//notes-insert-release-note))
|
|
|
|
|
(t (setq spacemacs-buffer--current-note-type nil)
|
|
|
|
|
(message "Unknown note type: %s" 'type))))
|
|
|
|
|
(setq spacemacs-buffer--current-note-type nil)))
|
2015-04-04 14:33:04 +00:00
|
|
|
|
|
2017-10-30 01:43:43 +00:00
|
|
|
|
(defun spacemacs-buffer/set-mode-line (format &optional redisplay)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Set mode-line format for spacemacs buffer.
|
2017-10-30 01:43:43 +00:00
|
|
|
|
FORMAT: the `mode-line-format' variable Emacs will use to build the mode-line.
|
|
|
|
|
If REDISPLAY is non-nil then force a redisplay as well"
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create spacemacs-buffer-name)
|
2017-10-30 01:43:43 +00:00
|
|
|
|
(setq mode-line-format format))
|
|
|
|
|
(when redisplay (spacemacs//redisplay)))
|
2015-03-16 05:28:21 +00:00
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer/message (msg &rest args)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Display MSG in *Messages* prepended with '(Spacemacs)'.
|
|
|
|
|
The message is displayed only if `init-file-debug' is non nil.
|
|
|
|
|
ARGS: format string arguments."
|
2015-10-07 19:29:20 +00:00
|
|
|
|
(when init-file-debug
|
2015-04-06 03:45:02 +00:00
|
|
|
|
(message "(Spacemacs) %s" (apply 'format msg args))))
|
2015-01-26 03:36:07 +00:00
|
|
|
|
|
2017-10-30 02:01:39 +00:00
|
|
|
|
(defun spacemacs-buffer/error (msg &rest args)
|
|
|
|
|
"Display MSG as an Error message in `*Messages*' buffer.
|
|
|
|
|
ARGS: format string arguments."
|
|
|
|
|
(let ((msg (apply 'format msg args)))
|
|
|
|
|
(message "(Spacemacs) Error: %s" msg)
|
|
|
|
|
(when message-log-max
|
|
|
|
|
(add-to-list 'spacemacs-buffer--errors msg 'append))))
|
|
|
|
|
|
2016-10-10 13:39:03 +00:00
|
|
|
|
(defvar spacemacs-buffer--warnings nil
|
|
|
|
|
"List of warnings during startup.")
|
|
|
|
|
|
2015-04-12 16:25:53 +00:00
|
|
|
|
(defun spacemacs-buffer/warning (msg &rest args)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Display MSG as a warning message but in buffer `*Messages*'.
|
|
|
|
|
ARGS: format string arguments."
|
2016-10-10 13:39:03 +00:00
|
|
|
|
(let ((msg (apply 'format msg args)))
|
|
|
|
|
(message "(Spacemacs) Warning: %s" msg)
|
2016-10-20 13:32:03 +00:00
|
|
|
|
(when message-log-max
|
|
|
|
|
(add-to-list 'spacemacs-buffer--warnings msg 'append))))
|
2015-04-12 16:25:53 +00:00
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer/insert-page-break ()
|
2015-04-03 02:23:16 +00:00
|
|
|
|
"Insert a page break line in spacemacs buffer."
|
2016-06-05 04:15:02 +00:00
|
|
|
|
(spacemacs-buffer/append "\n\n"))
|
2015-04-03 02:23:16 +00:00
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer/append (msg &optional messagebuf)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Append MSG to spacemacs buffer.
|
|
|
|
|
If MESSAGEBUF is not nil then MSG is also written in message buffer."
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create spacemacs-buffer-name)
|
2015-01-26 03:36:07 +00:00
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
|
(insert msg)
|
2017-01-31 16:54:19 +00:00
|
|
|
|
(when messagebuf
|
|
|
|
|
(message "(Spacemacs) %s" msg)))))
|
2015-01-26 03:36:07 +00:00
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer/replace-last-line (msg &optional messagebuf)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Replace the last line of the spacemacs buffer with MSG.
|
|
|
|
|
If MESSAGEBUF is not nil then MSG is also written in message buffer."
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create spacemacs-buffer-name)
|
2015-01-26 03:36:07 +00:00
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
|
(delete-region (line-beginning-position) (point-max))
|
|
|
|
|
(insert msg)
|
2017-01-31 16:54:19 +00:00
|
|
|
|
(when messagebuf
|
|
|
|
|
(message "(Spacemacs) %s" msg)))))
|
2015-01-26 03:36:07 +00:00
|
|
|
|
|
2022-12-12 00:00:03 +00:00
|
|
|
|
(eval-and-compile
|
|
|
|
|
(defun spacemacs-buffer//startup-list-jump-func-name (str)
|
|
|
|
|
"Given a string, return a spacemacs-buffer function name.
|
2021-01-29 13:19:33 +00:00
|
|
|
|
|
|
|
|
|
Given: Return:
|
|
|
|
|
\"[?]\" \"spacemacs-buffer/jump-to-[?]\"
|
|
|
|
|
\"Recent Files:\" \"spacemacs-buffer/jump-to-recent-files\""
|
2022-12-12 00:00:03 +00:00
|
|
|
|
(let ((s (downcase str)))
|
|
|
|
|
;; remove last char if it's a colon
|
|
|
|
|
(when (string-match ":$" s)
|
|
|
|
|
(setq s (substring s nil (1- (length s)))))
|
|
|
|
|
;; replace any spaces with a dash
|
|
|
|
|
(setq s (replace-regexp-in-string " " "-" s))
|
|
|
|
|
(concat "spacemacs-buffer/jump-to-" s))))
|
2021-01-29 13:19:33 +00:00
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defmacro spacemacs-buffer||add-shortcut
|
|
|
|
|
(shortcut-char search-label &optional no-next-line)
|
|
|
|
|
"Add a single-key keybinding for quick navigation in the home buffer.
|
|
|
|
|
Navigation is done by searching for a specific word in the buffer.
|
|
|
|
|
SHORTCUT-CHAR: the key that the user will have to press.
|
|
|
|
|
SEARCH-LABEL: the word the cursor will be brought under (or on).
|
2021-01-29 13:19:33 +00:00
|
|
|
|
NO-NEXT-LINE: if nil the cursor is brought under the searched word.
|
|
|
|
|
|
|
|
|
|
Define a named function: spacemacs-buffer/jump-to-...
|
|
|
|
|
for the shortcut. So that a descriptive name is shown,
|
2022-02-17 22:58:17 +00:00
|
|
|
|
in for example the `view-lossage' (C-h l) buffer:
|
2021-01-29 13:19:33 +00:00
|
|
|
|
r ;; spacemacs-buffer/jump-to-recent-files
|
|
|
|
|
p ;; spacemacs-buffer/jump-to-projects
|
|
|
|
|
instead of:
|
|
|
|
|
r ;; anonymous-command
|
|
|
|
|
p ;; anonymous-command"
|
2022-06-14 00:00:47 +00:00
|
|
|
|
(let ((func-name-symbol
|
|
|
|
|
(intern (spacemacs-buffer//startup-list-jump-func-name search-label))))
|
|
|
|
|
`(progn (defun ,func-name-symbol ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(unless (search-forward ,search-label (point-max) t)
|
|
|
|
|
(search-backward ,search-label (point-min) t))
|
|
|
|
|
,@(unless no-next-line
|
|
|
|
|
'((forward-line 1)))
|
|
|
|
|
(back-to-indentation))
|
|
|
|
|
(define-key spacemacs-buffer-mode-map ,shortcut-char ',func-name-symbol))))
|
2015-04-20 20:01:11 +00:00
|
|
|
|
|
2016-11-29 13:12:36 +00:00
|
|
|
|
(defun spacemacs-buffer//center-line (&optional real-width)
|
|
|
|
|
"When point is at the end of a line, center it.
|
|
|
|
|
REAL-WIDTH: the real width of the line. If the line contains an image, the size
|
|
|
|
|
of that image will be considered to be 1 by the calculation method
|
|
|
|
|
used in this function. As a consequence, the caller must calculate
|
|
|
|
|
himself the correct length of the line taking into account the
|
|
|
|
|
images he inserted in it."
|
|
|
|
|
(let* ((width (or real-width (current-column)))
|
|
|
|
|
(margin (max 0 (floor (/ (- spacemacs-buffer--window-width
|
|
|
|
|
width)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
2)))))
|
2016-05-13 06:26:34 +00:00
|
|
|
|
(beginning-of-line)
|
2016-11-29 13:12:36 +00:00
|
|
|
|
(insert (make-string margin ?\s))
|
2016-05-13 06:26:34 +00:00
|
|
|
|
(end-of-line)))
|
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer//insert-buttons ()
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Create and insert the interactive buttons under Spacemacs banner."
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(spacemacs-buffer||add-shortcut "m" "[?]" t)
|
|
|
|
|
(widget-create 'url-link
|
|
|
|
|
:tag (propertize "?" 'face 'font-lock-doc-face)
|
|
|
|
|
:help-echo "Open the quickhelp."
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(spacemacs-buffer/toggle-note 'quickhelp))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m")
|
|
|
|
|
(insert " ")
|
|
|
|
|
(widget-create 'url-link
|
|
|
|
|
:tag (propertize "Homepage" 'face 'font-lock-keyword-face)
|
2020-01-13 18:12:25 +00:00
|
|
|
|
:help-echo "Open the Spacemacs GitHub page in your browser."
|
2016-10-27 17:43:22 +00:00
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
"http://spacemacs.org")
|
|
|
|
|
(insert " ")
|
|
|
|
|
(widget-create 'url-link
|
|
|
|
|
:tag (propertize "Documentation" 'face 'font-lock-keyword-face)
|
|
|
|
|
:help-echo "Open the Spacemacs documentation in your browser."
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
"http://spacemacs.org/doc/DOCUMENTATION.html")
|
|
|
|
|
(insert " ")
|
|
|
|
|
(widget-create 'url-link
|
|
|
|
|
:tag (propertize "Gitter Chat" 'face 'font-lock-keyword-face)
|
|
|
|
|
:help-echo
|
|
|
|
|
"Ask questions and chat with fellow users in our chat room."
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
"https://gitter.im/syl20bnr/spacemacs")
|
|
|
|
|
(insert " ")
|
2021-03-24 19:50:09 +00:00
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:help-echo "GPLv3 copying conditions."
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(find-file (concat spacemacs-start-directory "LICENSE"))
|
|
|
|
|
(read-only-mode))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
(propertize "Licensing" 'face 'font-lock-keyword-face))
|
2021-03-26 03:18:39 +00:00
|
|
|
|
(let ((len (- (line-end-position)
|
|
|
|
|
(line-beginning-position))))
|
|
|
|
|
(spacemacs-buffer//center-line)
|
|
|
|
|
(setq spacemacs-buffer--buttons-position (- (line-end-position)
|
2022-01-08 15:01:44 +00:00
|
|
|
|
(line-beginning-position)
|
|
|
|
|
len)))
|
2021-03-24 19:50:09 +00:00
|
|
|
|
(insert "\n")
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:help-echo "Update all ELPA packages to the latest versions."
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(configuration-layer/update-packages))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
(propertize "Update Packages" 'face 'font-lock-keyword-face))
|
|
|
|
|
(insert " ")
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:help-echo
|
|
|
|
|
"Rollback ELPA package updates if something got borked."
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(call-interactively 'configuration-layer/rollback))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
(propertize "Rollback Package Update"
|
|
|
|
|
'face 'font-lock-keyword-face))
|
|
|
|
|
(spacemacs-buffer//center-line)
|
|
|
|
|
(insert "\n")
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:tag (propertize "Release Notes"
|
|
|
|
|
'face 'font-lock-preprocessor-face)
|
|
|
|
|
:help-echo "Hide or show the Changelog"
|
|
|
|
|
:action (lambda (&rest ignore)
|
|
|
|
|
(spacemacs-buffer/toggle-note 'release-note))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m")
|
|
|
|
|
(insert " ")
|
|
|
|
|
(widget-create 'url-link
|
|
|
|
|
:tag (propertize "Search in Spacemacs"
|
|
|
|
|
'face 'font-lock-function-name-face)
|
|
|
|
|
:help-echo "Search Spacemacs contents."
|
|
|
|
|
:action
|
|
|
|
|
(lambda (&rest ignore)
|
|
|
|
|
(let ((comp-frontend
|
|
|
|
|
(cond
|
2017-07-02 13:48:06 +00:00
|
|
|
|
((configuration-layer/layer-used-p 'helm)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
'helm-spacemacs-help)
|
2017-07-02 13:48:06 +00:00
|
|
|
|
((configuration-layer/layer-used-p 'ivy)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
'ivy-spacemacs-help))))
|
|
|
|
|
(call-interactively comp-frontend)))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m")
|
|
|
|
|
(spacemacs-buffer//center-line)
|
2019-11-29 20:28:43 +00:00
|
|
|
|
(insert "\n"))
|
2015-01-26 03:36:07 +00:00
|
|
|
|
|
2016-10-10 13:39:03 +00:00
|
|
|
|
(defun spacemacs-buffer//insert-string-list (list-display-name list)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Insert a non-interactive startup list in the home buffer.
|
|
|
|
|
LIST-DISPLAY-NAME: the displayed title of the list.
|
|
|
|
|
LIST: a list of strings displayed as entries."
|
2016-10-10 13:39:03 +00:00
|
|
|
|
(when (car list)
|
|
|
|
|
(insert list-display-name)
|
|
|
|
|
(mapc (lambda (el)
|
|
|
|
|
(insert
|
|
|
|
|
"\n"
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert el)
|
|
|
|
|
(fill-paragraph)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(insert " - ")
|
|
|
|
|
(while (= 0 (forward-line))
|
|
|
|
|
(insert " "))
|
|
|
|
|
(buffer-string))))
|
|
|
|
|
list)))
|
|
|
|
|
|
2015-06-03 06:45:54 +00:00
|
|
|
|
(defun spacemacs-buffer//insert-file-list (list-display-name list)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Insert an interactive list of files in the home buffer.
|
|
|
|
|
LIST-DISPLAY-NAME: the displayed title of the list.
|
2021-01-27 15:46:53 +00:00
|
|
|
|
LIST: a list of string pathnames made interactive in this function.
|
|
|
|
|
|
|
|
|
|
If LIST-DISPLAY-NAME is \"Recent Files:\":
|
|
|
|
|
prepend each list item with a number starting at: 1
|
|
|
|
|
The numbers indicate that the file can be opened,
|
|
|
|
|
by pressing its number key."
|
2015-03-28 14:30:56 +00:00
|
|
|
|
(when (car list)
|
2015-04-13 14:18:19 +00:00
|
|
|
|
(insert list-display-name)
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(mapc (lambda (el)
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(let ((button-prefix
|
|
|
|
|
(concat
|
|
|
|
|
"\n "
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(when dotspacemacs-show-startup-list-numbers
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(format "%2s " (number-to-string spacemacs-buffer--startup-list-nr)))
|
|
|
|
|
" "
|
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(cond
|
|
|
|
|
((file-remote-p el)
|
|
|
|
|
(all-the-icons-octicon "radio-tower" :height 0.8 :v-adjust -0.05))
|
|
|
|
|
((file-directory-p el)
|
|
|
|
|
(all-the-icons-icon-for-dir el))
|
|
|
|
|
(t
|
|
|
|
|
(all-the-icons-icon-for-file (file-name-nondirectory el) :height 0.8 :v-adjust -0.05))))
|
|
|
|
|
" "))
|
|
|
|
|
(button-text (abbreviate-file-name el)))
|
|
|
|
|
(insert button-prefix)
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:action `(lambda (&rest ignore)
|
|
|
|
|
(find-file-existing ,el))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
:button-prefix ""
|
|
|
|
|
:button-suffix ""
|
2022-02-15 06:52:00 +00:00
|
|
|
|
:button-face nil
|
2021-03-20 17:24:19 +00:00
|
|
|
|
:format "%[%t%]" button-text))
|
|
|
|
|
(setq spacemacs-buffer--startup-list-nr
|
|
|
|
|
(1+ spacemacs-buffer--startup-list-nr)))
|
|
|
|
|
list)))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//insert-files-by-dir-list
|
|
|
|
|
(list-display-name grouped-list)
|
2021-01-04 18:33:49 +00:00
|
|
|
|
"Insert an interactive grouped list of files in the home buffer.
|
|
|
|
|
LIST-DISPLAY-NAME: the displayed title of the list.
|
|
|
|
|
GROUPED-LIST: a list of string pathnames made interactive in this function."
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(when (car-safe grouped-list)
|
2021-01-04 18:33:49 +00:00
|
|
|
|
(insert list-display-name)
|
|
|
|
|
(mapc (lambda (group)
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(let* ((group-remote-p (file-remote-p (car group)))
|
|
|
|
|
(button-prefix
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(concat
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"\n "
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(when dotspacemacs-show-startup-list-numbers
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(format "%2s " (number-to-string spacemacs-buffer--startup-list-nr)))
|
|
|
|
|
" "
|
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(if group-remote-p
|
|
|
|
|
(all-the-icons-octicon "radio-tower" :height 0.8 :v-adjust -0.05)
|
|
|
|
|
(all-the-icons-icon-for-dir (car group))))
|
|
|
|
|
" "))
|
|
|
|
|
(button-text-project (abbreviate-file-name (car group))))
|
|
|
|
|
(insert button-prefix)
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:action `(lambda (&rest ignore)
|
|
|
|
|
(find-file-existing ,(car group)))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
:button-prefix ""
|
|
|
|
|
:button-suffix ""
|
|
|
|
|
:format "%[%t%]" button-text-project)
|
|
|
|
|
(setq spacemacs-buffer--startup-list-nr
|
|
|
|
|
(1+ spacemacs-buffer--startup-list-nr))
|
|
|
|
|
(mapc (lambda (el)
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(let* ((button-prefix
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(concat
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"\n "
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(when dotspacemacs-show-startup-list-numbers
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(format "%2s " (number-to-string spacemacs-buffer--startup-list-nr)))
|
|
|
|
|
" "
|
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(if (or group-remote-p
|
|
|
|
|
(file-remote-p (concat (car group) el)))
|
|
|
|
|
(all-the-icons-octicon "radio-tower" :height 0.8 :v-adjust -0.05)
|
|
|
|
|
(all-the-icons-icon-for-file (file-name-nondirectory el) :height 0.8 :v-adjust -0.05)))
|
|
|
|
|
" "))
|
|
|
|
|
(button-text-filename (abbreviate-file-name el)))
|
|
|
|
|
(insert button-prefix)
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:action `(lambda (&rest ignore)
|
|
|
|
|
(find-file-existing
|
|
|
|
|
(concat ,(car group) ,el)))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
:button-prefix ""
|
|
|
|
|
:button-suffix ""
|
|
|
|
|
:format "%[%t%]" button-text-filename))
|
|
|
|
|
(setq spacemacs-buffer--startup-list-nr
|
|
|
|
|
(1+ spacemacs-buffer--startup-list-nr)))
|
|
|
|
|
(cdr group))))
|
|
|
|
|
grouped-list)))
|
2021-01-04 18:33:49 +00:00
|
|
|
|
|
2015-07-30 02:21:31 +00:00
|
|
|
|
(defun spacemacs-buffer//insert-bookmark-list (list-display-name list)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Insert an interactive list of bookmarks entries (if any) in the home buffer.
|
|
|
|
|
LIST-DISPLAY-NAME: the displayed title of the list.
|
|
|
|
|
LIST: a list of string bookmark names made interactive in this function."
|
2015-07-30 02:21:31 +00:00
|
|
|
|
(when (car list)
|
|
|
|
|
(insert list-display-name)
|
|
|
|
|
(mapc (lambda (el)
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(let* ((filename (bookmark-get-filename el))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(button-prefix
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(concat
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"\n "
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(when dotspacemacs-show-startup-list-numbers
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(format "%2s " (number-to-string spacemacs-buffer--startup-list-nr)))
|
|
|
|
|
" "
|
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(cond
|
|
|
|
|
((file-remote-p filename)
|
|
|
|
|
(all-the-icons-octicon "radio-tower" :height 0.8 :v-adjust -0.05))
|
|
|
|
|
((file-directory-p filename)
|
|
|
|
|
(all-the-icons-icon-for-dir filename))
|
|
|
|
|
(t
|
|
|
|
|
(all-the-icons-icon-for-file (file-name-nondirectory filename) :height 0.8 :v-adjust -0.05))))
|
|
|
|
|
" "))
|
|
|
|
|
(button-text
|
|
|
|
|
(if filename
|
|
|
|
|
(format "%s - %s"
|
|
|
|
|
el (abbreviate-file-name filename))
|
|
|
|
|
(format "%s" el))))
|
|
|
|
|
(insert button-prefix)
|
2016-02-14 16:09:16 +00:00
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:action `(lambda (&rest ignore) (bookmark-jump ,el))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
:button-prefix ""
|
|
|
|
|
:button-suffix ""
|
2021-03-20 17:24:19 +00:00
|
|
|
|
:format "%[%t%]" button-text))
|
|
|
|
|
(setq spacemacs-buffer--startup-list-nr
|
|
|
|
|
(1+ spacemacs-buffer--startup-list-nr)))
|
2015-07-30 02:21:31 +00:00
|
|
|
|
list)))
|
|
|
|
|
|
2016-01-07 22:07:28 +00:00
|
|
|
|
(defun spacemacs-buffer//get-org-items (types)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Make a list of agenda file items for today of kind types.
|
|
|
|
|
TYPES: list of `org-mode' types to fetch."
|
2016-01-07 22:07:28 +00:00
|
|
|
|
(require 'org-agenda)
|
|
|
|
|
(let ((date (calendar-gregorian-from-absolute (org-today))))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(cl-loop for file in (org-agenda-files nil 'ifmode)
|
|
|
|
|
append (spacemacs-buffer//make-org-items
|
2020-07-02 22:44:29 +00:00
|
|
|
|
file
|
|
|
|
|
(apply 'org-agenda-get-day-entries file date
|
2022-02-15 06:52:00 +00:00
|
|
|
|
types)))))
|
2016-01-07 22:07:28 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//agenda-list ()
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Return today's agenda."
|
2016-01-07 22:07:28 +00:00
|
|
|
|
(require 'org-agenda)
|
2016-02-01 01:24:13 +00:00
|
|
|
|
(spacemacs-buffer//get-org-items org-agenda-entry-types))
|
2016-01-07 22:07:28 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//todo-list ()
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Return current todos."
|
2016-01-07 22:07:28 +00:00
|
|
|
|
(require 'org-agenda)
|
2016-02-01 01:24:13 +00:00
|
|
|
|
(spacemacs-buffer//get-org-items '(:todo)))
|
2016-01-07 22:07:28 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//make-org-items (file items)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Make a spacemacs-buffer org item list.
|
|
|
|
|
FILE: file name.
|
|
|
|
|
ITEMS:"
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(cl-loop for item in items
|
|
|
|
|
collect (spacemacs-buffer//make-org-item file item)))
|
2016-01-07 22:07:28 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//make-org-item (file item)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Make a spacemacs-buffer version of an org item.
|
|
|
|
|
FILE: file name.
|
|
|
|
|
ITEM:"
|
2022-02-15 06:52:00 +00:00
|
|
|
|
`(("text" . ,(get-text-property 0 'txt item))
|
|
|
|
|
("file" . ,file)
|
|
|
|
|
("pos" . ,(marker-position (get-text-property 0 'org-marker item)))
|
|
|
|
|
("time" . ,(get-text-property 0 'time item))))
|
2016-01-07 22:07:28 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//org-jump (el)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Action executed when using an item in the home buffer's todo list.
|
|
|
|
|
EL: `org-agenda' element to jump to."
|
2016-01-07 22:07:28 +00:00
|
|
|
|
(require 'org-agenda)
|
|
|
|
|
(find-file-other-window (cdr (assoc "file" el)))
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char (cdr (assoc "pos" el)))
|
|
|
|
|
(when (derived-mode-p 'org-mode)
|
|
|
|
|
(org-show-context 'agenda)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(org-flag-heading nil))) ; show the next heading
|
2016-01-07 22:07:28 +00:00
|
|
|
|
(when (outline-invisible-p)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(outline-show-entry)) ; display invisible text
|
2016-01-07 22:07:28 +00:00
|
|
|
|
(recenter (/ (window-height) 2))
|
|
|
|
|
(org-back-to-heading t)
|
|
|
|
|
(if (re-search-forward org-complex-heading-regexp nil t)
|
|
|
|
|
(goto-char (match-beginning 4))))
|
2016-02-01 01:24:13 +00:00
|
|
|
|
(run-hooks 'org-agenda-after-show-hook))
|
2016-01-07 22:07:28 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//insert-todo-list (list-display-name list)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Insert an interactive todo list of `org-agenda' entries in the home buffer.
|
|
|
|
|
LIST-DISPLAY-NAME: the displayed title of the list.
|
|
|
|
|
LIST: list of `org-agenda' entries in the todo list."
|
2016-01-07 22:07:28 +00:00
|
|
|
|
(when (car list)
|
|
|
|
|
(insert list-display-name)
|
|
|
|
|
(setq list (sort list
|
|
|
|
|
(lambda (a b)
|
|
|
|
|
(cond
|
|
|
|
|
((eq "" (cdr (assoc "time" b)))
|
|
|
|
|
t)
|
|
|
|
|
((eq "" (cdr (assoc "time" a)))
|
|
|
|
|
nil)
|
|
|
|
|
(t
|
|
|
|
|
(string< (cdr (assoc "time" a))
|
|
|
|
|
(cdr (assoc "time" b))))))))
|
|
|
|
|
(mapc (lambda (el)
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(let* ((button-prefix
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(concat
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"\n "
|
2021-05-08 19:32:24 +00:00
|
|
|
|
(when dotspacemacs-show-startup-list-numbers
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(format "%2s " (number-to-string spacemacs-buffer--startup-list-nr)))
|
|
|
|
|
" "
|
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(all-the-icons-octicon "primitive-dot" :height 1.0 :v-adjust 0.01))
|
|
|
|
|
" "))
|
|
|
|
|
(button-text
|
|
|
|
|
(format "%s %s %s"
|
|
|
|
|
(let ((filename (cdr (assoc "file" el))))
|
|
|
|
|
(if dotspacemacs-home-shorten-agenda-source
|
|
|
|
|
(file-name-nondirectory filename)
|
|
|
|
|
(abbreviate-file-name filename)))
|
|
|
|
|
(if (not (eq "" (cdr (assoc "time" el))))
|
|
|
|
|
(format "- %s -"
|
|
|
|
|
(cdr (assoc "time" el)))
|
|
|
|
|
"-")
|
|
|
|
|
(cdr (assoc "text" el)))))
|
|
|
|
|
(insert button-prefix)
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:action `(lambda (&rest ignore)
|
|
|
|
|
(spacemacs-buffer//org-jump ',el))
|
|
|
|
|
:mouse-face 'highlight
|
|
|
|
|
:follow-link "\C-m"
|
|
|
|
|
:button-prefix ""
|
|
|
|
|
:button-suffix ""
|
|
|
|
|
:format "%[%t%]" button-text))
|
|
|
|
|
(setq spacemacs-buffer--startup-list-nr
|
|
|
|
|
(1+ spacemacs-buffer--startup-list-nr)))
|
2016-01-07 22:07:28 +00:00
|
|
|
|
list)))
|
|
|
|
|
|
2021-01-04 18:33:49 +00:00
|
|
|
|
(defun spacemacs-buffer//associate-to-project (recent-file by-project)
|
|
|
|
|
(dolist (x by-project)
|
|
|
|
|
(when (string-prefix-p (car x) recent-file)
|
|
|
|
|
(setcdr x (cons (string-remove-prefix (car x) recent-file) (cdr x))))))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//recent-files-by-project ()
|
|
|
|
|
(let ((by-project (mapcar (lambda (p) (cons (expand-file-name p) nil))
|
|
|
|
|
(projectile-relevant-known-projects))))
|
|
|
|
|
(dolist (recent-file recentf-list by-project)
|
|
|
|
|
(spacemacs-buffer//associate-to-project recent-file by-project))))
|
|
|
|
|
|
2016-06-08 06:42:35 +00:00
|
|
|
|
(defun spacemacs//subseq (seq start end)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Adapted version of `cl-subseq'.
|
|
|
|
|
Use `cl-subseq', but accounting for end points greater than the size of the
|
|
|
|
|
list. Return entire list if end is omitted.
|
|
|
|
|
SEQ, START and END are the same arguments as for `cl-subseq'"
|
2016-06-08 06:42:35 +00:00
|
|
|
|
(let ((len (length seq)))
|
|
|
|
|
(cl-subseq seq start (and (number-or-marker-p end)
|
|
|
|
|
(min len end)))))
|
|
|
|
|
|
2022-02-20 01:56:45 +00:00
|
|
|
|
(defmacro spacemacs-buffer||propertize-heading (icon text shortcut-char)
|
|
|
|
|
`(concat (when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(concat ,icon " "))
|
|
|
|
|
(propertize ,text 'face 'font-lock-keyword-face)
|
|
|
|
|
(propertize (concat " (" ,shortcut-char ")")
|
|
|
|
|
'face 'font-lock-comment-face)))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(defun spacemacs-buffer//insert-errors ()
|
|
|
|
|
(when (spacemacs-buffer//insert-string-list
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(spacemacs-buffer||propertize-heading
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(all-the-icons-material "error" :face 'font-lock-keyword-face))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"Errors:" "e")
|
|
|
|
|
spacemacs-buffer--errors)
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(spacemacs-buffer||add-shortcut "e" "Errors:")
|
|
|
|
|
(insert spacemacs-buffer-list-separator)))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//insert-warnings ()
|
|
|
|
|
(when (spacemacs-buffer//insert-string-list
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(spacemacs-buffer||propertize-heading
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(all-the-icons-material "warning" :face 'font-lock-keyword-face))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"Warnings:" "w")
|
|
|
|
|
spacemacs-buffer--warnings)
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(spacemacs-buffer||add-shortcut "w" "Warnings:")
|
|
|
|
|
(insert spacemacs-buffer-list-separator)))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//insert-recent-files (list-size)
|
|
|
|
|
(unless recentf-mode (recentf-mode))
|
2021-03-11 13:55:13 +00:00
|
|
|
|
(setq spacemacs-buffer//recent-files-list
|
2022-02-25 17:30:03 +00:00
|
|
|
|
(let ((agenda-files (if (fboundp 'org-agenda-files)
|
|
|
|
|
(mapcar #'expand-file-name (org-agenda-files))
|
|
|
|
|
nil)))
|
|
|
|
|
(cl-delete-if (lambda (x)
|
|
|
|
|
(or (when (and (bound-and-true-p org-directory) (file-exists-p org-directory))
|
|
|
|
|
(member x (directory-files org-directory t)))
|
|
|
|
|
(member x agenda-files)))
|
|
|
|
|
recentf-list)))
|
2022-02-03 19:29:05 +00:00
|
|
|
|
(setq spacemacs-buffer//recent-files-list
|
|
|
|
|
(spacemacs//subseq spacemacs-buffer//recent-files-list 0 list-size))
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(when (spacemacs-buffer//insert-file-list
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(spacemacs-buffer||propertize-heading
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(all-the-icons-octicon "history" :face 'font-lock-keyword-face :v-adjust -0.05))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"Recent Files:" "r")
|
2021-03-11 13:55:13 +00:00
|
|
|
|
spacemacs-buffer//recent-files-list)
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(spacemacs-buffer||add-shortcut "r" "Recent Files:"))
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(insert spacemacs-buffer-list-separator))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//insert-recent-files-by-project (list-size)
|
|
|
|
|
(unless recentf-mode (recentf-mode))
|
|
|
|
|
(unless projectile-mode (projectile-mode))
|
|
|
|
|
(when (spacemacs-buffer//insert-files-by-dir-list
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(spacemacs-buffer||propertize-heading
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(all-the-icons-octicon "rocket" :face 'font-lock-keyword-face :v-adjust -0.05))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"Recent Files by Project:" "R")
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(mapcar (lambda (group)
|
|
|
|
|
(cons (car group)
|
|
|
|
|
(spacemacs//subseq (reverse (cdr group))
|
|
|
|
|
0
|
|
|
|
|
(cdr list-size))))
|
|
|
|
|
(spacemacs//subseq (spacemacs-buffer//recent-files-by-project)
|
|
|
|
|
0
|
|
|
|
|
(car list-size))))
|
|
|
|
|
(spacemacs-buffer||add-shortcut "R" "Recent Files by Project:")
|
|
|
|
|
(insert spacemacs-buffer-list-separator)))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//insert-todos (list-size)
|
|
|
|
|
(when (spacemacs-buffer//insert-todo-list
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(spacemacs-buffer||propertize-heading
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(all-the-icons-octicon "check" :face 'font-lock-keyword-face :v-adjust -0.05))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"To-Do:" "d")
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(spacemacs//subseq (spacemacs-buffer//todo-list)
|
|
|
|
|
0 list-size))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(spacemacs-buffer||add-shortcut "d" "To-Do:")
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(insert spacemacs-buffer-list-separator)))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//insert-agenda (list-size)
|
|
|
|
|
(when (spacemacs-buffer//insert-todo-list
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(spacemacs-buffer||propertize-heading
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(all-the-icons-octicon "calendar" :face 'font-lock-keyword-face :v-adjust -0.05))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"Agenda:" "c")
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(spacemacs//subseq (spacemacs-buffer//agenda-list)
|
|
|
|
|
0 list-size))
|
|
|
|
|
(spacemacs-buffer||add-shortcut "c" "Agenda:")
|
|
|
|
|
(insert spacemacs-buffer-list-separator)))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//insert-bookmarks (list-size)
|
|
|
|
|
(when (configuration-layer/layer-used-p 'spacemacs-helm)
|
|
|
|
|
(helm-mode))
|
|
|
|
|
(require 'bookmark)
|
|
|
|
|
(when (spacemacs-buffer//insert-bookmark-list
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(spacemacs-buffer||propertize-heading
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(all-the-icons-octicon "bookmark" :face 'font-lock-keyword-face :v-adjust -0.05))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"Bookmarks:" "b")
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(spacemacs//subseq (bookmark-all-names)
|
|
|
|
|
0 list-size))
|
|
|
|
|
(spacemacs-buffer||add-shortcut "b" "Bookmarks:")
|
|
|
|
|
(insert spacemacs-buffer-list-separator)))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//insert-projects (list-size)
|
|
|
|
|
(unless projectile-mode (projectile-mode))
|
|
|
|
|
(when (spacemacs-buffer//insert-file-list
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(spacemacs-buffer||propertize-heading
|
2022-02-19 17:45:22 +00:00
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(all-the-icons-octicon "rocket" :face 'font-lock-keyword-face :v-adjust -0.05))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"Projects:" "p")
|
2021-02-03 12:11:34 +00:00
|
|
|
|
(spacemacs//subseq (projectile-relevant-known-projects)
|
|
|
|
|
0 list-size))
|
|
|
|
|
(spacemacs-buffer||add-shortcut "p" "Projects:")
|
|
|
|
|
(insert spacemacs-buffer-list-separator)))
|
|
|
|
|
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(defvar spacemacs-buffer--startup-list-nr 1)
|
|
|
|
|
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(defun spacemacs-buffer//do-insert-startupify-lists ()
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Insert the startup lists in the current buffer."
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(setq spacemacs-buffer--startup-list-nr 1)
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(let ((dotspacemacs-startup-buffer-show-icons dotspacemacs-startup-buffer-show-icons))
|
|
|
|
|
(if (display-graphic-p)
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(unless (configuration-layer/package-used-p 'all-the-icons)
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(message "Package `all-the-icons' isn't installed")
|
|
|
|
|
(setq dotspacemacs-startup-buffer-show-icons nil))
|
|
|
|
|
(setq dotspacemacs-startup-buffer-show-icons nil))
|
2022-02-18 03:22:39 +00:00
|
|
|
|
(when dotspacemacs-startup-buffer-show-icons
|
|
|
|
|
(require 'all-the-icons))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(dolist (els (append '(warnings) dotspacemacs-startup-lists))
|
|
|
|
|
(let ((el (or (car-safe els) els))
|
|
|
|
|
(list-size (or (cdr-safe els)
|
|
|
|
|
spacemacs-buffer-startup-lists-length)))
|
|
|
|
|
(cond
|
|
|
|
|
((eq el 'warnings)
|
|
|
|
|
(spacemacs-buffer//insert-errors)
|
|
|
|
|
(spacemacs-buffer//insert-warnings))
|
|
|
|
|
((eq el 'recents) (spacemacs-buffer//insert-recent-files list-size))
|
2022-07-13 03:18:18 +00:00
|
|
|
|
((and (eq el 'recents-by-project)
|
|
|
|
|
(fboundp 'projectile-mode))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(spacemacs-buffer//insert-recent-files-by-project list-size))
|
|
|
|
|
((eq el 'todos) (spacemacs-buffer//insert-todos list-size))
|
|
|
|
|
((eq el 'agenda) (spacemacs-buffer//insert-agenda list-size))
|
|
|
|
|
((eq el 'bookmarks) (spacemacs-buffer//insert-bookmarks list-size))
|
|
|
|
|
((and (eq el 'projects)
|
|
|
|
|
(fboundp 'projectile-mode))
|
|
|
|
|
(spacemacs-buffer//insert-projects list-size)))))))
|
2016-09-03 10:47:58 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//get-buffer-width ()
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Return the length of longest line in the current buffer."
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char 0)
|
|
|
|
|
(let ((current-max 0))
|
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(let ((line-length (- (line-end-position) (line-beginning-position))))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(setq current-max (max current-max line-length)))
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(forward-line 1))
|
|
|
|
|
current-max)))
|
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defun spacemacs-buffer//center-startup-lists ()
|
|
|
|
|
"Center startup lists after they were inserted."
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(let* ((lists-width (spacemacs-buffer//get-buffer-width))
|
|
|
|
|
(margin (max 0 (- spacemacs-buffer--buttons-position
|
|
|
|
|
spacemacs-buffer-buttons-startup-lists-offset)))
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(width-diff (- spacemacs-buffer--window-width lists-width))
|
|
|
|
|
(final-padding (cond
|
|
|
|
|
((>= width-diff margin) margin)
|
|
|
|
|
((< width-diff 0) 0)
|
|
|
|
|
(t (floor (/ width-diff 2))))))
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(goto-char (point-min))
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(while (not (eobp))
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(insert (make-string final-padding ?\s))
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(forward-line))))
|
|
|
|
|
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(defun spacemacs-buffer/insert-startup-lists ()
|
|
|
|
|
"Insert startup lists in home buffer."
|
2016-09-03 10:47:58 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(with-current-buffer (get-buffer spacemacs-buffer-name)
|
|
|
|
|
(let ((buffer-read-only nil))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(spacemacs-buffer/insert-page-break)
|
|
|
|
|
(insert "\n")
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region (point) (point))
|
|
|
|
|
(spacemacs-buffer//do-insert-startupify-lists)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(spacemacs-buffer//center-startup-lists)))))
|
2015-03-28 14:30:56 +00:00
|
|
|
|
|
2015-04-12 04:24:03 +00:00
|
|
|
|
(defun spacemacs-buffer/goto-link-line ()
|
2016-01-27 14:15:34 +00:00
|
|
|
|
"Set point to the beginning of the link line."
|
2015-02-04 04:56:52 +00:00
|
|
|
|
(interactive)
|
2015-07-30 02:07:07 +00:00
|
|
|
|
(with-current-buffer spacemacs-buffer-name
|
|
|
|
|
(goto-char (point-min))
|
2015-12-01 20:02:48 +00:00
|
|
|
|
(with-demoted-errors "spacemacs buffer error: %s"
|
2018-06-10 07:05:35 +00:00
|
|
|
|
(search-forward "[")
|
|
|
|
|
(left-char 2))))
|
2015-02-04 04:56:52 +00:00
|
|
|
|
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(defun spacemacs-buffer/jump-to-number-startup-list-line ()
|
|
|
|
|
"Jump to the startup list line with the typed number.
|
|
|
|
|
|
2021-03-25 15:36:48 +00:00
|
|
|
|
The minimum delay in seconds between number key presses,
|
|
|
|
|
can be adjusted with the variable:
|
|
|
|
|
`dotspacemacs-startup-buffer-multi-digit-delay'."
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(when spacemacs-buffer--idle-numbers-timer
|
|
|
|
|
(cancel-timer spacemacs-buffer--idle-numbers-timer))
|
2022-02-10 08:39:31 +00:00
|
|
|
|
(let* ((key-pressed-string (string-trim-left (if (characterp last-input-event)
|
|
|
|
|
(string last-input-event)
|
|
|
|
|
(format "%s" last-input-event))
|
|
|
|
|
"kp-")))
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(setq spacemacs-buffer--startup-list-number
|
|
|
|
|
(concat spacemacs-buffer--startup-list-number key-pressed-string))
|
|
|
|
|
(let (message-log-max) ; only show in minibuffer
|
|
|
|
|
(message "Jump to startup list: %s" spacemacs-buffer--startup-list-number))
|
|
|
|
|
(setq spacemacs-buffer--idle-numbers-timer
|
|
|
|
|
(run-with-idle-timer
|
2021-03-25 15:36:48 +00:00
|
|
|
|
dotspacemacs-startup-buffer-multi-digit-delay nil
|
2021-03-20 17:24:19 +00:00
|
|
|
|
'spacemacs-buffer/stop-waiting-for-additional-numbers))))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer/jump-to-line-starting-with-nr-space (nr-string)
|
2022-02-15 06:52:00 +00:00
|
|
|
|
"Jump to the line begins with NR-STRING, skipping non-digit prefix."
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(let ((prev-point (point)))
|
2021-05-08 16:27:06 +00:00
|
|
|
|
(goto-char (window-start))
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(if (not (re-search-forward
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(concat "^ +" nr-string "[0-9]* +. ")
|
2021-05-08 16:27:06 +00:00
|
|
|
|
;; don't search past two lines above the window-end,
|
|
|
|
|
;; because they bottom two lines are hidden by the mode line
|
|
|
|
|
(save-excursion (goto-char (window-end))
|
|
|
|
|
(forward-line -1)
|
|
|
|
|
(point))
|
|
|
|
|
'noerror))
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(progn
|
|
|
|
|
(goto-char prev-point)
|
|
|
|
|
(let (message-log-max) ; only show in minibuffer
|
|
|
|
|
(message "Couldn't find startup list number: %s"
|
|
|
|
|
spacemacs-buffer--startup-list-number)))
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(message "Opening file/dir: %s"
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(widget-value (widget-at (point))))
|
2021-03-20 17:24:19 +00:00
|
|
|
|
(widget-button-press (point)))))
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer/stop-waiting-for-additional-numbers ()
|
|
|
|
|
(spacemacs-buffer/jump-to-line-starting-with-nr-space
|
|
|
|
|
spacemacs-buffer--startup-list-number)
|
|
|
|
|
(setq spacemacs-buffer--startup-list-number nil))
|
|
|
|
|
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(defun spacemacs-buffer//startup-hook ()
|
|
|
|
|
"Code executed when Emacs has finished loading."
|
|
|
|
|
(with-current-buffer (get-buffer spacemacs-buffer-name)
|
|
|
|
|
(when dotspacemacs-startup-lists
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(spacemacs-buffer/insert-startup-lists))
|
2016-06-05 04:04:53 +00:00
|
|
|
|
(spacemacs-buffer//insert-footer)
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(if configuration-layer-error-count
|
|
|
|
|
(progn
|
|
|
|
|
(spacemacs-buffer-mode)
|
2017-10-30 01:43:43 +00:00
|
|
|
|
(face-remap-add-relative 'mode-line
|
|
|
|
|
'((:background "red") mode-line))
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(spacemacs-buffer/set-mode-line
|
|
|
|
|
(format
|
|
|
|
|
(concat "%s error(s) at startup! "
|
|
|
|
|
"Spacemacs may not be able to operate properly.")
|
2017-10-30 01:43:43 +00:00
|
|
|
|
configuration-layer-error-count) t))
|
2016-04-01 03:44:00 +00:00
|
|
|
|
(spacemacs-buffer/set-mode-line spacemacs--default-mode-line)
|
|
|
|
|
(spacemacs-buffer-mode))
|
|
|
|
|
(force-mode-line-update)
|
|
|
|
|
(spacemacs-buffer/goto-link-line)))
|
|
|
|
|
|
2016-06-08 07:00:57 +00:00
|
|
|
|
(defun spacemacs-buffer/goto-buffer (&optional refresh)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Create the special buffer for `spacemacs-buffer-mode' and switch to it.
|
2020-01-08 07:55:12 +00:00
|
|
|
|
REFRESH if the buffer should be redrawn.
|
|
|
|
|
|
|
|
|
|
If a prefix argument is given, switch to it in an other, possibly new window."
|
2015-10-16 13:17:03 +00:00
|
|
|
|
(interactive)
|
2016-06-08 07:00:57 +00:00
|
|
|
|
(let ((buffer-exists (buffer-live-p (get-buffer spacemacs-buffer-name)))
|
2016-09-07 00:05:15 +00:00
|
|
|
|
(save-line nil))
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(when (not buffer-exists)
|
|
|
|
|
(setq spacemacs-buffer--note-widgets nil))
|
2016-09-14 17:29:07 +00:00
|
|
|
|
(when (or (not (eq spacemacs-buffer--last-width (window-width)))
|
2016-09-07 00:05:15 +00:00
|
|
|
|
(not buffer-exists)
|
|
|
|
|
refresh)
|
2016-11-29 13:12:36 +00:00
|
|
|
|
(setq spacemacs-buffer--window-width (if dotspacemacs-startup-buffer-responsive
|
|
|
|
|
(window-width)
|
|
|
|
|
80)
|
2016-10-29 02:04:42 +00:00
|
|
|
|
spacemacs-buffer--last-width spacemacs-buffer--window-width)
|
2016-09-07 00:05:15 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create spacemacs-buffer-name)
|
|
|
|
|
(page-break-lines-mode)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(when (> (buffer-size) 0)
|
2022-10-19 00:00:53 +00:00
|
|
|
|
(setq save-line (line-number-at-pos))
|
2016-09-07 00:05:15 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(erase-buffer)))
|
|
|
|
|
(spacemacs-buffer/set-mode-line "")
|
2020-02-20 07:24:05 +00:00
|
|
|
|
(if dotspacemacs-startup-buffer-show-version
|
2020-07-02 22:44:29 +00:00
|
|
|
|
(spacemacs-buffer//insert-version)
|
2020-02-20 07:24:05 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(insert "\n")))
|
2016-09-07 00:05:15 +00:00
|
|
|
|
(spacemacs-buffer/insert-banner-and-buttons)
|
2017-01-22 05:31:30 +00:00
|
|
|
|
(when (bound-and-true-p spacemacs-initialized)
|
|
|
|
|
(spacemacs-buffer//notes-redisplay-current-note)
|
|
|
|
|
(when dotspacemacs-startup-lists
|
|
|
|
|
(spacemacs-buffer/insert-startup-lists))
|
|
|
|
|
(spacemacs-buffer//insert-footer)
|
2022-02-15 06:52:00 +00:00
|
|
|
|
(configuration-layer/display-summary emacs-start-time)
|
2017-01-22 05:31:30 +00:00
|
|
|
|
(spacemacs-buffer/set-mode-line spacemacs--default-mode-line)
|
|
|
|
|
(force-mode-line-update)
|
2017-08-11 06:38:26 +00:00
|
|
|
|
(spacemacs-buffer-mode)))
|
|
|
|
|
(if save-line
|
|
|
|
|
(progn (goto-char (point-min))
|
|
|
|
|
(forward-line (1- save-line))
|
|
|
|
|
(forward-to-indentation 0))
|
2022-02-17 22:58:17 +00:00
|
|
|
|
(spacemacs-buffer/goto-link-line)))
|
2020-01-08 07:55:12 +00:00
|
|
|
|
(if current-prefix-arg
|
|
|
|
|
(switch-to-buffer-other-window spacemacs-buffer-name)
|
|
|
|
|
(switch-to-buffer spacemacs-buffer-name))
|
2016-09-14 17:29:07 +00:00
|
|
|
|
(spacemacs//redisplay))))
|
2016-06-08 07:00:57 +00:00
|
|
|
|
|
2016-09-02 12:42:25 +00:00
|
|
|
|
(add-hook 'window-setup-hook
|
|
|
|
|
(lambda ()
|
2016-10-27 17:43:22 +00:00
|
|
|
|
(add-hook 'window-configuration-change-hook
|
|
|
|
|
'spacemacs-buffer//resize-on-hook)
|
2016-09-02 12:42:25 +00:00
|
|
|
|
(spacemacs-buffer//resize-on-hook)))
|
2016-06-08 07:00:57 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer//resize-on-hook ()
|
2016-10-27 17:43:22 +00:00
|
|
|
|
"Hook run on window resize events to redisplay the home buffer."
|
2019-01-28 13:50:33 +00:00
|
|
|
|
;; prevent spacemacs buffer redisplay in the filetree window
|
|
|
|
|
(unless (memq this-command '(neotree-find-project-root
|
|
|
|
|
neotree-show
|
|
|
|
|
neotree-toggle
|
|
|
|
|
spacemacs/treemacs-project-toggle
|
|
|
|
|
treemacs
|
|
|
|
|
treemacs-bookmark
|
|
|
|
|
treemacs-find-file
|
|
|
|
|
treemacs-select-window))
|
2020-07-02 22:44:29 +00:00
|
|
|
|
(let ((home-buffer (get-buffer-window spacemacs-buffer-name))
|
|
|
|
|
(frame-win (frame-selected-window)))
|
|
|
|
|
(when (and dotspacemacs-startup-buffer-responsive
|
|
|
|
|
home-buffer
|
|
|
|
|
(not (window-minibuffer-p frame-win)))
|
|
|
|
|
(with-selected-window home-buffer
|
|
|
|
|
(spacemacs-buffer/goto-buffer))))))
|
2015-10-16 13:17:03 +00:00
|
|
|
|
|
2016-05-13 06:26:34 +00:00
|
|
|
|
(defun spacemacs-buffer/refresh ()
|
2016-06-08 07:00:57 +00:00
|
|
|
|
"Force recreation of the spacemacs buffer."
|
2016-05-13 06:26:34 +00:00
|
|
|
|
(interactive)
|
2016-06-08 07:00:57 +00:00
|
|
|
|
(setq spacemacs-buffer--last-width nil)
|
|
|
|
|
(spacemacs-buffer/goto-buffer t))
|
2016-05-13 06:26:34 +00:00
|
|
|
|
|
2016-10-09 16:57:46 +00:00
|
|
|
|
(defalias 'spacemacs/home 'spacemacs-buffer/refresh
|
2022-02-17 22:58:17 +00:00
|
|
|
|
"Go to Spacemacs home buffer.")
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-buffer/return ()
|
|
|
|
|
"Open the button or go to next line.
|
|
|
|
|
|
|
|
|
|
This function is intended to be used in `spacemacs-buffer-mode' only."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (get-char-property (point) 'button)
|
|
|
|
|
;; point on a button, press it
|
|
|
|
|
(widget-button-press (point))
|
|
|
|
|
;; point on an entry, press it
|
|
|
|
|
(if-let ((button (save-excursion
|
|
|
|
|
(beginning-of-line-text)
|
|
|
|
|
(re-search-forward "[0-9]* +. " (point-at-eol) 'noerror))))
|
|
|
|
|
(widget-button-press button)
|
|
|
|
|
;; go to next line
|
|
|
|
|
(forward-line)
|
|
|
|
|
(beginning-of-line-text))))
|
2016-10-09 16:57:46 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs/home-delete-other-windows ()
|
|
|
|
|
"Open home Spacemacs buffer and delete other windows.
|
|
|
|
|
Useful for making the home buffer the only visible buffer in the frame."
|
|
|
|
|
(interactive)
|
|
|
|
|
(spacemacs/home)
|
|
|
|
|
(delete-other-windows))
|
|
|
|
|
|
2015-01-27 03:51:47 +00:00
|
|
|
|
(provide 'core-spacemacs-buffer)
|
2016-10-27 17:43:22 +00:00
|
|
|
|
|
|
|
|
|
;;; core-spacemacs-buffer ends here
|