Move vi-tilde-fringe hook to shell layer

Also replace lambdas by named functions
This commit is contained in:
syl20bnr 2016-04-29 17:48:00 -04:00
parent c115a66210
commit e18b1cbe0e
4 changed files with 35 additions and 11 deletions

View file

@ -0,0 +1,20 @@
;;; funcs.el --- Spacemacs Visual UI Layer functions File
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacemacs/disable-vi-tilde-fringe ()
"Disable `vi-tilde-fringe' in the current buffer."
(vi-tilde-fringe-mode -1))
(defun spacemacs/disable-vi-tilde-fringe-read-only ()
"Disable `vi-tilde-fringe' in the current buffer if it is read only."
(when buffer-read-only
(spacemacs/disable-vi-tilde-fringe)))

View file

@ -390,18 +390,14 @@
:evil-leader "T~")
;; don't enable it on spacemacs home buffer
(with-current-buffer spacemacs-buffer-name
(vi-tilde-fringe-mode -1))
(spacemacs/disable-vi-tilde-fringe))
;; after a major mode is loaded, check if the buffer is read only
;; if so, disable vi-tilde-fringe-mode
(add-hook 'after-change-major-mode-hook (lambda ()
(when buffer-read-only
(vi-tilde-fringe-mode -1))))
(spacemacs/add-to-hooks (lambda () (vi-tilde-fringe-mode -1))
'(comint-mode-hook
eshell-mode-hook
eww-mode-hook
shell-mode-hook
term-mode-hook)))
(add-hook 'after-change-major-mode-hook
'spacemacs/disable-vi-tilde-fringe-read-only)
;; TODO move this hook if/when we have a layer for eww
(spacemacs/add-to-hooks 'spacemacs/disable-vi-tilde-fringe
'(eww-mode-hook)))
:config
(spacemacs|hide-lighter vi-tilde-fringe-mode))))

View file

@ -1,4 +1,4 @@
;;; funcs.el --- Spacemacs Base Layer functions File
;;; funcs.el --- Shell Layer functions File
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;

View file

@ -27,6 +27,7 @@
smooth-scrolling
(term :location built-in)
xterm-color
vi-tilde-fringe
))
(defun shell/init-comint ()
@ -347,3 +348,10 @@ is achieved by adding the relevant text properties."
(remove 'ansi-color-process-output comint-output-filter-functions))
(setq font-lock-unfontify-region-function 'xterm-color-unfontify-region)
(add-hook 'eshell-mode-hook 'spacemacs/init-eshell-xterm-color))))
(defun shell/post-init-vi-tilde-fringe ()
(spacemacs/add-to-hooks 'spacemacs/disable-vi-tilde-fringe
'(comint-mode-hook
eshell-mode-hook
shell-mode-hook
term-mode-hook)))