unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* help with setq for specific file types....
@ 2002-09-29 20:33 twylie
  0 siblings, 0 replies; 3+ messages in thread
From: twylie @ 2002-09-29 20:33 UTC (permalink / raw)



Hi-

I almost have my .emacs file the way I want it ... just 2 more things
I'd lke to be able to do that I have no idea how to do:

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?

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

Any help would be *greatly* appreciated.

Thanks-
T.

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

* Re: help with setq for specific file types....
       [not found] <mailman.1033331785.4656.help-gnu-emacs@gnu.org>
@ 2002-09-30 14:22 ` Oliver Scholz
  2002-09-30 14:40 ` kgold
  1 sibling, 0 replies; 3+ messages in thread
From: Oliver Scholz @ 2002-09-30 14:22 UTC (permalink / raw)


twylie <twylie@charter.net> 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é!

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

* Re: help with setq for specific file types....
       [not found] <mailman.1033331785.4656.help-gnu-emacs@gnu.org>
  2002-09-30 14:22 ` help with setq for specific file types Oliver Scholz
@ 2002-09-30 14:40 ` kgold
  1 sibling, 0 replies; 3+ messages in thread
From: kgold @ 2002-09-30 14:40 UTC (permalink / raw)



This is usually done in a hook.  Example:

(add-hook 'c-mode-common-hook
	  (function (lambda ()
		      (setq c-basic-offset 4)
		      )))

twylie <twylie@charter.net> 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?

-- 
-- 
Ken Goldman   kgold@watson.ibm.com   914-784-7646

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

end of thread, other threads:[~2002-09-30 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1033331785.4656.help-gnu-emacs@gnu.org>
2002-09-30 14:22 ` help with setq for specific file types Oliver Scholz
2002-09-30 14:40 ` kgold
2002-09-29 20:33 twylie

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