* lisp-mode and buffer local variables
@ 2011-06-08 21:47 Nikodemus Siivola
2011-06-08 22:36 ` Leo
0 siblings, 1 reply; 5+ messages in thread
From: Nikodemus Siivola @ 2011-06-08 21:47 UTC (permalink / raw)
To: emacs-devel
I'm working on styles for Common Lisp indentation in my cl-indent.el
fork. The intention is to use a buffer local variable
common-lisp-style to set things up:
;; -*- common-lisp-style: foo -*-
However, lisp-mode kills all buffer local variables, and I'm uncertain
how to best deal with this. As a somewhat terrible workaround I
currently add a lisp-mode-hook:
;;; `lisp-mode' kills all buffer-local variables. Get them back, and magically
;;; use the right indentation function.
;;;
;;; FIXME: there has got to be a better way to do this for Common Lisp files
;;; only, without requiring .emacs customizations.
(add-hook 'lisp-mode-hook
(lambda ()
(hack-local-variables)
(when common-lisp-style
(set (make-local-variable 'lisp-indent-function)
'common-lisp-indent-function)
(common-lisp-set-style (symbol-name common-lisp-style)))))
This, however seems pretty intrusive. ...what should I be doing instead?
Cheers,
-- nikodemus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lisp-mode and buffer local variables
2011-06-08 21:47 lisp-mode and buffer local variables Nikodemus Siivola
@ 2011-06-08 22:36 ` Leo
2011-06-09 4:20 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Leo @ 2011-06-08 22:36 UTC (permalink / raw)
To: Nikodemus Siivola; +Cc: emacs-devel
On 2011-06-09 05:47 +0800, Nikodemus Siivola wrote:
> However, lisp-mode kills all buffer local variables, and I'm uncertain
> how to best deal with this.
See:
,----[ kill-all-local-variables ]
| As a special exception, local variables whose names have
| a non-nil `permanent-local' property are not eliminated by this function.
`----
Leo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lisp-mode and buffer local variables
2011-06-08 22:36 ` Leo
@ 2011-06-09 4:20 ` Stefan Monnier
2011-06-09 11:18 ` Nikodemus Siivola
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2011-06-09 4:20 UTC (permalink / raw)
To: Leo; +Cc: Nikodemus Siivola, emacs-devel
>> However, lisp-mode kills all buffer local variables, and I'm uncertain
>> how to best deal with this.
> ,----[ kill-all-local-variables ]
> | As a special exception, local variables whose names have
> | a non-nil `permanent-local' property are not eliminated by this function.
> `----
No need for that. What he wants is for lisp-mode to use a hook run after
hack-local-variables to inspect the value of common-lisp-style and set
variables base on it. Oh wait there is one, it's called
`hack-local-variables-hook'.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lisp-mode and buffer local variables
2011-06-09 4:20 ` Stefan Monnier
@ 2011-06-09 11:18 ` Nikodemus Siivola
2011-06-09 15:17 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Nikodemus Siivola @ 2011-06-09 11:18 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Leo, emacs-devel
On 9 June 2011 07:20, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> ,----[ kill-all-local-variables ]
> No need for that. What he wants is for lisp-mode to use a hook run after
> hack-local-variables to inspect the value of common-lisp-style and set
> variables base on it. Oh wait there is one, it's called
> `hack-local-variables-hook'.
Thank you, both.
Stefan -- I'm missing something. Since lisp-mode kills all local
variables, without setting permanent-local all changes I might make in
hack-local-variables-hook are lost.
Cheers,
-- nikodemus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lisp-mode and buffer local variables
2011-06-09 11:18 ` Nikodemus Siivola
@ 2011-06-09 15:17 ` Stefan Monnier
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-06-09 15:17 UTC (permalink / raw)
To: Nikodemus Siivola; +Cc: Leo, emacs-devel
>> No need for that. What he wants is for lisp-mode to use a hook run after
>> hack-local-variables to inspect the value of common-lisp-style and set
>> variables base on it. Oh wait there is one, it's called
>> `hack-local-variables-hook'.
> Thank you, both.
> Stefan -- I'm missing something. Since lisp-mode kills all local
> variables, without setting permanent-local all changes I might make in
> hack-local-variables-hook are lost.
Doesn't matter: lisp-mode is called before hack-local-variables
(otherwise file-local variables would never work).
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-09 15:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 21:47 lisp-mode and buffer local variables Nikodemus Siivola
2011-06-08 22:36 ` Leo
2011-06-09 4:20 ` Stefan Monnier
2011-06-09 11:18 ` Nikodemus Siivola
2011-06-09 15:17 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.