turns out using a mode in a hook always enables it so the turn on

functions were not actually needed
This commit is contained in:
Bozhidar Batsov 2012-10-05 19:35:39 +03:00
parent e62feee6e0
commit d5c1edc297
2 changed files with 3 additions and 28 deletions

View file

@ -231,23 +231,6 @@ there's a region, all lines that region covers will be duplicated."
(cond ((search-forward "<?xml" nil t) (xml-mode)) (cond ((search-forward "<?xml" nil t) (xml-mode))
((search-forward "<html" nil t) (html-mode))))) ((search-forward "<html" nil t) (html-mode)))))
;; We have a number of turn-on-* functions since it's advised that lambda
;; functions not go in hooks. Repeatedly evaluating an add-to-list with a
;; hook value will repeatedly add it since there's no way to ensure
;; that a lambda doesn't already exist in the list.
(defun prelude-turn-on-whitespace ()
(whitespace-mode +1))
(defun prelude-turn-off-whitespace ()
(whitespace-mode -1))
(defun prelude-turn-on-abbrev ()
(abbrev-mode +1))
(defun prelude-turn-off-abbrev ()
(abbrev-mode -1))
(defun prelude-untabify-buffer () (defun prelude-untabify-buffer ()
(interactive) (interactive)
(untabify (point-min) (point-max))) (untabify (point-min) (point-max)))

View file

@ -168,13 +168,8 @@
ispell-extra-args '("--sug-mode=ultra")) ispell-extra-args '("--sug-mode=ultra"))
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t) (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
(defun prelude-turn-on-flyspell () (add-hook 'message-mode-hook 'flyspell-mode)
"Force flyspell-mode on using a positive argument. For use in hooks." (add-hook 'text-mode-hook 'flyspell-mode)
(interactive)
(flyspell-mode +1))
(add-hook 'message-mode-hook 'prelude-turn-on-flyspell)
(add-hook 'text-mode-hook 'prelude-turn-on-flyspell)
;; enable narrowing commands ;; enable narrowing commands
(put 'narrow-to-region 'disabled nil) (put 'narrow-to-region 'disabled nil)
@ -191,9 +186,6 @@
(setq bookmark-default-file (concat prelude-savefile-dir "bookmarks") (setq bookmark-default-file (concat prelude-savefile-dir "bookmarks")
bookmark-save-flag 1) bookmark-save-flag 1)
;; enabled auto-fill mode in text-mode and all related modes
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;; load yasnippet ;; load yasnippet
(require 'yasnippet) (require 'yasnippet)
(add-to-list 'yas/snippet-dirs prelude-snippets-dir) (add-to-list 'yas/snippet-dirs prelude-snippets-dir)
@ -267,7 +259,7 @@ indent yanked text (with prefix arg don't indent)."
(yank-advised-indent-function (region-beginning) (region-end))))) (yank-advised-indent-function (region-beginning) (region-end)))))
;; abbrev config ;; abbrev config
(add-hook 'text-mode-hook 'prelude-turn-on-abbrev) (add-hook 'text-mode-hook 'abbrev-mode)
;; make a shell script executable automatically on save ;; make a shell script executable automatically on save
(add-hook 'after-save-hook (add-hook 'after-save-hook