Emacs: Also bind flyspell-prog-mode to <f9>

master
Pierre Neidhardt 2017-08-30 16:43:59 +01:00
parent 14bb84a04c
commit f9f3375ec5
3 changed files with 15 additions and 5 deletions

View File

@ -135,6 +135,15 @@ Work on buffer or region. Require `tabify-leading'."
(narrow-to-region start end)
(delete-trailing-whitespace))))
(defun flyspell-and-whitespace-mode ()
"Toggle `flyspell-mode' and `whitespace-mode'."
(interactive)
(if (derived-mode-p 'text-mode)
(flyspell-mode)
(if flyspell-mode (flyspell-mode 0) (flyspell-prog-mode)))
(whitespace-mode 'toggle))
(global-set-key (kbd "<f9>") 'flyspell-and-whitespace-mode)
(defun get-closest-pathname (&optional file)
"Get pathname of the first instance of FILE towards root.
If FILE is unspecified, look for 'Makefile'. If it does not find

View File

@ -1,12 +1,14 @@
;;; Flycheck
(defun flycheck-or-whitespace-mode ()
(defun flycheck-and-whitespace-mode ()
"Toggle `flycheck-mode' and `whitespace-mode'."
(interactive)
(when (derived-mode-p 'prog-mode)
(flycheck-mode 'toggle))
(if (derived-mode-p 'text-mode)
(flyspell-mode)
(flycheck-mode 'toggle)
(if flyspell-mode (flyspell-mode 0) (flyspell-prog-mode)))
(whitespace-mode 'toggle))
(global-set-key (kbd "<f9>") 'flycheck-or-whitespace-mode)
(global-set-key (kbd "<f9>") 'flycheck-and-whitespace-mode)
(define-key flycheck-mode-map (kbd "C-c ! h") 'helm-flycheck)

View File

@ -104,7 +104,6 @@
;;; Line by line scrolling
(setq scroll-step 1)
(global-set-key (kbd "<f9>") 'whitespace-mode)
(setq
whitespace-style
'(face empty indentation space-after-tab space-before-tab tab-mark trailing))