all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Custom option to turn Flyspell mode on in prog modes
@ 2013-12-09  0:25 Matthias Meulien
  2013-12-09 13:28 ` Rüdiger Sonderfeld
  0 siblings, 1 reply; 12+ messages in thread
From: Matthias Meulien @ 2013-12-09  0:25 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]

The attached patch allows users to enable spell checking in prog 
modes by customization means. Thanks to `flyspell-prog-mode', the 
spell checking is done in comments and strings only.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Custom-option-to-turn-Flyspell-mode-on-in-prog-modes.patch --]
[-- Type: text/x-diff, Size: 1670 bytes --]

From 0898bacd9012a0d01da417b3f491f008d4bdefe8 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Mon, 9 Dec 2013 01:20:11 +0100
Subject: [PATCH] Custom option to turn Flyspell mode on in prog modes

---
 lisp/progmodes/prog-mode.el | 6 ++++++
 lisp/textmodes/flyspell.el  | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index b3ed328..92820dc 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -35,6 +35,12 @@
   "Generic programming mode, from which others derive."
   :group 'languages)
 
+(defcustom prog-mode-hook nil
+  "Normal hook run when entering Text mode and many related modes."
+  :type 'hook
+  :options '(turn-on-flyspell-prog)
+  :group 'prog-mode)
+
 (defvar prog-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [?\C-\M-q] 'prog-indent-sexp)
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 81f17c8..0ce0a90 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -519,11 +519,17 @@ in your init file.
   (flyspell-mode 1))
 
 ;;;###autoload
+(defun turn-on-flyspell-prog ()
+  "Unconditionally turn on Flyspell mode for comments and strings."
+  (flyspell-prog-mode))
+
+;;;###autoload
 (defun turn-off-flyspell ()
   "Unconditionally turn off Flyspell mode."
   (flyspell-mode -1))
 
 (custom-add-option 'text-mode-hook 'turn-on-flyspell)
+(custom-add-option 'prog-mode-hook 'turn-on-flyspell-prog)
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-buffers ...                                             */
-- 
1.8.5.1


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
Matthias

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-08-15  5:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-09  0:25 [PATCH] Custom option to turn Flyspell mode on in prog modes Matthias Meulien
2013-12-09 13:28 ` Rüdiger Sonderfeld
2013-12-11 23:17   ` bug#16394: " Matthias Meulien
2014-08-08 14:10     ` Rüdiger Sonderfeld
2013-12-11 23:17   ` Matthias Meulien
2014-01-07 19:23     ` Glenn Morris
2014-01-07 19:30       ` Glenn Morris
2014-08-08 13:59     ` Rüdiger Sonderfeld
2014-08-08 23:45       ` Juri Linkov
2014-08-14 12:46         ` Sebastien Vauban
2014-08-14 20:21   ` Mode line strings for sub- and super- minor modes are counterintuitive Matthias Meulien
2014-08-15  5:45     ` Bozhidar Batsov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.