[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `make-local-variable' and `add-hook'
From: |
Reiner Steib |
Subject: |
Re: `make-local-variable' and `add-hook' |
Date: |
Wed, 02 Apr 2008 23:02:03 +0200 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.92 (gnu/linux) |
On Wed, Apr 02 2008, Sebastian P. Luque wrote:
> Is this the best way to give a buffer-local value to a variable inside a
> hook:
>
> ---<---------------cut here---------------start-------------->---
> (add-hook 'sql-interactive-mode-hook
> (lambda ()
> (setq sql-input-ring-file-name "~/.emacs.d/sql_history")
> (set (make-local-variable 'truncate-lines) t)))
`truncate-lines' is already buffer-local:
,----[ <f1> v truncate-lines RET ]
| truncate-lines is a variable defined in `C source code'.
| Its value is nil
|
| Automatically becomes buffer-local when set in any fashion.
`----
> ---<---------------cut here---------------end---------------->---
>
> ? I'm a bit confused about the last paragraph in the docs:
>
> ,-----[ C-h f make-local-variable RET ]
[...]
> | Do not use `make-local-variable' to make a hook variable buffer-local.
> | Instead, use `add-hook' and specify t for the LOCAL argument.
> `-----
This paragraph would be relevant if you'd like to make
`sql-interactive-mode-hook' buffer-local.
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/