unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* 2 modes in the flyspell in .emacs
@ 2011-03-07 23:30 Pedro Costa
  2011-03-08  6:59 ` Andrea Crotti
  0 siblings, 1 reply; 2+ messages in thread
From: Pedro Costa @ 2011-03-07 23:30 UTC (permalink / raw)
  To: help-gnu-emacs

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.

I would like to, when I'm using java files, the flyspell-prog-mode is
enabled. When I'm using latex files the flyspell-mode is enabled.

How can I do that in .emacs files?

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?

__________________
Thanks,



-- 
Pedro



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

* Re: 2 modes in the flyspell in .emacs
  2011-03-07 23:30 2 modes in the flyspell in .emacs Pedro Costa
@ 2011-03-08  6:59 ` Andrea Crotti
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Crotti @ 2011-03-08  6:59 UTC (permalink / raw)
  To: Pedro Costa; +Cc: help-gnu-emacs

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---




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

end of thread, other threads:[~2011-03-08  6:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-07 23:30 2 modes in the flyspell in .emacs Pedro Costa
2011-03-08  6:59 ` Andrea Crotti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).