help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 modes in the flyspell in .emacs


From: Andrea Crotti
Subject: Re: 2 modes in the flyspell in .emacs
Date: Tue, 08 Mar 2011 07:59:30 +0100
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (darwin)

Pedro Costa <psdc1978@gmail.com> writes:

> Hi,
>
> 1 - emacs has these 2 mode for spell checking.
>
> M-x flyspell-mode
> Enable Flyspell mode, which highlights all misspelled words.
> M-x flyspell-prog-mode
> Enable Flyspell mode for comments and strings only.

That's simple, use hooks on the mode you're using. Since I use
flyspell-prog-mode for many languages I have a list and I loop on it to
add the right hook.

--8<---------------cut here---------------start------------->8---
  (defcustom to-spell-langs
    '(emacs-lisp-mode-hook python-mode-hook c-mode-common-hook nesc-mode-hook 
java-mode-hook jde-mode-hook haskell-mode-hook)
    "Set of programming modes for which I want to enable spelling in comments 
and strings"
    :type 'list)
  
  (dolist (lang-hook to-spell-langs)
    (add-hook  lang-hook 'flyspell-prog-mode))
--8<---------------cut here---------------end--------------->8---


> 2 - I would like to create a shortcut that, when I'm editing java
> files, I compile the files with javac. And, when I editing latex
> files, the shortcut compile it with the latex command. How I do that?

Again use hooks and set local variables with your values.

I don't have an example of this but it should be something like
--8<---------------cut here---------------start------------->8---
(add-hook 'java-mode-hook (lambda ()
  (make-local-variable ...)
--8<---------------cut here---------------end--------------->8---




reply via email to

[Prev in Thread] Current Thread [Next in Thread]