[Top][All Lists]

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

Re: help with setq for specific file types....

From: Oliver Scholz
Subject: Re: help with setq for specific file types....
Date: Mon, 30 Sep 2002 16:22:42 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

twylie <address@hidden> writes:
> 1. I want to be able to do a setq for specific file types. For example,
> any file that ends with .html I would like to use (setq-default
> line-spacing 12). I see how to add file suffixes to alist -- but not how
> to set setq values. Can someone help me here?

The way you explain it does not make sense for me at all. If you do
what you explain here literally, _all_ buffers would change their
line-spacing, whenever you open a file of a different type.

I presume that you want to have, say, all html buffers with a line
spacing of 12 and all Elisp buffers with a line spacing of 4. The
Emacsian way to do such things is via the corresponding major modes
and via  hooks. See the section about hooks in the Emacs manual:
`C-h i d m emacs RET i hook RET'. Or with the mouse:

Help ==> Read the Emacs manual ==> Customization ==> Variables 
==> Hooks.

For example to get a line spacing of four in every Elisp buffer, you
could add this to your .emacs:

(add-hook 'emacs-lisp-mode-hook
          (lambda () (setq line-spacing 4)))

> 2. Also, I would like to add color syntax for anything between quotes
> (") in text mode.

Uuh, I have not yet mastered the arcane mysteries of the ways of the
mighty Font Lock. But the following seems to work for me:

(add-hook 'text-mode-hook (lambda ()
                            (modify-syntax-entry ?\" "|" text-mode-syntax-table)
                            (make-local-variable 'font-lock-defaults)
                            (setq font-lock-defaults '(nil nil t))))

    -- Oliver

9 Vendémiaire an 211 de la Révolution
Liberté, Egalité, Fraternité!

reply via email to

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