spacemacs-editing: refactor

- Refactored function
- Replaced unnecessary backquote construct with simple quotation
This commit is contained in:
Lucius Hu 2021-03-18 01:13:34 -04:00 committed by duianto
parent 55eda227c3
commit 46a02ed29b
2 changed files with 48 additions and 48 deletions

View File

@ -54,36 +54,35 @@ of the cleanup."
(defun spacemacs-whitespace-cleanup/on-message (&optional global)
"Return a string to display when the mode is activated."
(pcase dotspacemacs-whitespace-cleanup
(`all
(format "whitespace-cleanup enabled%s (all whitespace)"
(if global " globally" "")))
(`trailing
(format "whitespace-cleanup enabled%s (trailing whitespace)"
(if global " globally" "")))
(`changed
(format "whitespace-cleanup enabled%s (changed lines)"
(if global " globally" "")))))
(format "whitespace-cleanup enabled%s (%s)"
(if global " globally" "")
(pcase dotspacemacs-whitespace-cleanup
('all "all whitespace")
('trailing "trailing whitespace")
('changed "changed lines")
(x (user-error
"%s is not a valid option for 'dotspacemacs-whitespace-cleanup'"
x)))))
(defun spacemacs-whitespace-cleanup//turn-on (&optional global)
"Turn on `spacemacs-whitespace-cleanup-mode'."
(pcase dotspacemacs-whitespace-cleanup
(`all
('all
(add-hook 'before-save-hook 'whitespace-cleanup nil (not global)))
(`trailing
('trailing
(add-hook 'before-save-hook 'delete-trailing-whitespace nil (not global)))
(`changed
('changed
(when (fboundp 'ws-butler-mode)
(if global (ws-butler-global-mode) (ws-butler-mode))))))
(defun spacemacs-whitespace-cleanup//turn-off (&optional global)
"Turn off `spacemacs-whitespace-cleanup-mode'."
(pcase dotspacemacs-whitespace-cleanup
(`all
('all
(remove-hook 'before-save-hook 'whitespace-cleanup (not global)))
(`trailing
('trailing
(remove-hook 'before-save-hook 'delete-trailing-whitespace (not global)))
(`changed
('changed
(when (fboundp 'ws-butler-mode)
(if global (ws-butler-global-mode -1) (ws-butler-mode -1))))))

View File

@ -585,38 +585,39 @@
:defer t
:init
(progn
(pcase dotspacemacs-swap-number-row
(`qwerty-us (setq evil-swap-keys-number-row-keys '(("1" . "!")
("2" . "@")
("3" . "#")
("4" . "$")
("5" . "%")
("6" . "^")
("7" . "&")
("8" . "*")
("9" . "(")
("0" . ")"))))
(`qwertz-de (setq evil-swap-keys-number-row-keys '(("1" . "!")
("2" . "\"")
("3" . "§")
("4" . "$")
("5" . "%")
("6" . "&")
("7" . "/")
("8" . "(")
("9" . ")")
("0" . "="))))
(`qwerty-ca-fr (setq evil-swap-keys-number-row-keys '(("1" . "!")
("2" . "@")
("3" . "#")
("4" . "$")
("5" . "%")
("6" . "?")
("7" . "&")
("8" . "*")
("9" . "(")
("0" . ")"))))
(_ (message "dotspacemacs-swap-number-row %s is not supported." dotspacemacs-swap-number-row)))
(setq evil-swap-keys-number-row-keys
(pcase dotspacemacs-swap-number-row
('qwerty-us '(("1" . "!")
("2" . "@")
("3" . "#")
("4" . "$")
("5" . "%")
("6" . "^")
("7" . "&")
("8" . "*")
("9" . "(")
("0" . ")")))
('qwerty-de '(("1" . "!")
("2" . "\"")
("3" . "§")
("4" . "$")
("5" . "%")
("6" . "&")
("7" . "/")
("8" . "(")
("9" . ")")
("0" . "=")))
('qwerty-ca-fr '(("1" . "!")
("2" . "@")
("3" . "#")
("4" . "$")
("5" . "%")
("6" . "?")
("7" . "&")
("8" . "*")
("9" . "(")
("0" . ")")))
(x (message "dotspacemacs-swap-number-row %s is not supported." x))))
(add-hook 'prog-mode-hook #'evil-swap-keys-swap-number-row))))
(defun spacemacs-editing/init-persistent-scratch ()