core: move spacemacs-mode to core-spacemacs-buffer.el

The rationale is to keep the spacemacs buffer related code contained in
the core-spacemacs-buffer.el file.
This commit is contained in:
justbur 2015-10-16 10:08:08 -04:00 committed by syl20bnr
parent f2878d594a
commit 812ba329f2
5 changed files with 36 additions and 33 deletions

View File

@ -20,7 +20,7 @@ See `spacemacs/load-or-install-package' for more information."
"Load PKG package. PKG will be installed if it is not already installed.
Whenever the initial require fails the absolute path to the package
directory is returned.
If LOG is non-nil a message is displayed in spacemacs-mode buffer.
If LOG is non-nil a message is displayed in spacemacs-buffer-mode buffer.
FILE-TO-LOAD is an explicit file to load after the installation."
(let ((warning-minimum-level :error))
(condition-case nil

View File

@ -30,6 +30,30 @@ version the release note it displayed")
(defvar spacemacs-buffer--previous-insert-type nil
"Previous type of note inserted.")
(defvar spacemacs-buffer-mode-map
(let ((map (make-sparse-keymap)))
(define-key map [tab] 'widget-forward)
(define-key map (kbd "C-i") 'widget-forward)
(define-key map [backtab] 'widget-backward)
(define-key map (kbd "RET") 'widget-button-press)
(define-key map [down-mouse-1] 'widget-button-click)
map)
"Keymap for spacemacs buffer mode.")
(define-derived-mode spacemacs-buffer-mode special-mode "Spacemacs buffer"
"Spacemacs major mode for startup screen.
\\<spacemacs-buffer-mode-map>
"
:group 'spacemacs
:syntax-table nil
:abbrev-table nil
(setq truncate-lines t)
;; needed to make tab work correctly in terminal
(evil-define-key 'motion spacemacs-buffer-mode-map (kbd "C-i") 'widget-forward)
;; motion state since this is a special mode
(add-to-list 'evil-motion-state-modes 'spacemacs-buffer-mode))
(defun spacemacs-buffer/insert-banner-and-buttons ()
"Choose a banner according to `dotspacemacs-startup-banner'and insert it
in spacemacs buffer along with quick buttons underneath.
@ -398,13 +422,13 @@ HPADDING is the horizontal spacing betwee the content line and the frame border.
(spacemacs//redisplay))))
(defmacro spacemacs//insert--shortcut (shortcut-char search-label &optional no-next-line)
`(define-key spacemacs-mode-map ,shortcut-char (lambda ()
(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 (lambda ()
(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))))
(defun spacemacs-buffer//insert-buttons ()
(goto-char (point-max))
@ -550,7 +574,7 @@ HPADDING is the horizontal spacing betwee the content line and the frame border.
(widget-forward 1)))
(defun spacemacs-buffer/goto-buffer ()
"Create the special buffer for `spacemacs-mode' if it doesn't
"Create the special buffer for `spacemacs-buffer-mode' if it doesn't
already exist, and switch to it."
(interactive)
(unless (buffer-live-p (get-buffer spacemacs-buffer-name))

View File

@ -42,30 +42,9 @@
(/ spacemacs-loading-dots-count spacemacs-loading-dots-chunk-count))
(defvar spacemacs-loading-dots-chunk-threshold 0)
(defvar spacemacs-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<tab>") 'widget-forward)
(define-key map (kbd "<return>") 'widget-button-press)
(define-key map [backtab] 'widget-backward)
(define-key map [down-mouse-1] 'widget-button-click)
map)
"Keymap for spacemacs mode.")
(defvar spacemacs--default-mode-line mode-line-format
"Backup of default mode line format.")
(define-derived-mode spacemacs-mode special-mode "Spacemacs"
"Spacemacs major mode for startup screen.
\\<spacemacs-mode-map>
"
:group 'spacemacs
:syntax-table nil
:abbrev-table nil
(setq truncate-lines t)
;; motion state since this is a special mode
(add-to-list 'evil-motion-state-modes 'spacemacs-mode))
(defun spacemacs/init ()
"Perform startup initialization."
;; explicitly set the prefered coding systems to avoid annoying prompt

View File

@ -196,8 +196,8 @@ If you are looking for commands to operate on your buffer, they are right under
~SPC b~, if you want to operate on your project, then it is ~SPC p~, etc...
** Discoverable
Spacemacs comes with a dedicated major mode =spacemacs-mode=. Its goal is to
give useful feedbacks and easily perform maintenance tasks.
Spacemacs comes with a dedicated major mode =spacemacs-buffer-mode=. Its goal is
to give useful feedbacks and easily perform maintenance tasks.
It also comes with dedicated [[https://github.com/emacs-helm/helm][helm]] sources to quickly find layers, packages and
more.

View File

@ -104,7 +104,7 @@
:commands spacemacs/ace-buffer-links
:init
(progn
(define-key spacemacs-mode-map "o" 'spacemacs/ace-buffer-links)
(define-key spacemacs-buffer-mode-map "o" 'spacemacs/ace-buffer-links)
(with-eval-after-load 'info
(define-key Info-mode-map "o" 'ace-link-info))
(with-eval-after-load 'help-mode