From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrea Crotti Newsgroups: gmane.emacs.help Subject: Re: 2 modes in the flyspell in .emacs Date: Tue, 08 Mar 2011 07:59:30 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1299567696 2325 80.91.229.12 (8 Mar 2011 07:01:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 8 Mar 2011 07:01:36 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Pedro Costa Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 08 08:01:32 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PwqvC-00049J-US for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Mar 2011 08:01:32 +0100 Original-Received: from localhost ([127.0.0.1]:59169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pwqv8-00045b-Ii for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Mar 2011 02:01:26 -0500 Original-Received: from [140.186.70.92] (port=55646 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pwquf-00042t-Ip for help-gnu-emacs@gnu.org; Tue, 08 Mar 2011 02:01:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwqtL-0006RN-9N for help-gnu-emacs@gnu.org; Tue, 08 Mar 2011 01:59:36 -0500 Original-Received: from mail-bw0-f41.google.com ([209.85.214.41]:46558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwqtL-0006RJ-3P for help-gnu-emacs@gnu.org; Tue, 08 Mar 2011 01:59:35 -0500 Original-Received: by bwz17 with SMTP id 17so4974591bwz.0 for ; Mon, 07 Mar 2011 22:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=WixU44/QklxAWnoYercLOyO3atcHrlZG5ROtmXgbPas=; b=Kkhe22AXcyscgEWPSFuSLdJLmwx/30MBbueR+oUEESLRaWGtcNipUzs2DFjLCGk3kP XVmJZB2pVolILA37X0RiasFR3hIobQZKo8NWHZ4+M1UwyXQaFBMRyzmEt5IIZrkcLsG9 PvOcJSst3ME+jdVLpPR4uoXtNNMMHjjURBdhk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=F2NUHA85zjNhd7RtCA5bb+ddDM6RpgTcp4iKgvsF5VrV6VfnKBBKrbVvh3xDzn7WYd sx14nnGtPWD3sHDZ8LiQgnX18UfZGI26L5H7WsN8aQIWmgjUktS+qzrC+BwvGUaTZz7a k8wAIbhgOoL8UZYdfEUAwXV8wDXbr8pfGe9KA= Original-Received: by 10.204.130.16 with SMTP id q16mr4036128bks.192.1299567574136; Mon, 07 Mar 2011 22:59:34 -0800 (PST) Original-Received: from ip1-201.halifax.rwth-aachen.de (ip1-201.halifax.RWTH-Aachen.DE [137.226.108.201]) by mx.google.com with ESMTPS id u23sm240678bkw.21.2011.03.07.22.59.32 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Mar 2011 22:59:33 -0800 (PST) In-Reply-To: (Pedro Costa's message of "Mon, 7 Mar 2011 23:30:06 +0000") User-Agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (darwin) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.214.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:79877 Archived-At: Pedro Costa 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---