* running lisp code like file variables
@ 2008-07-23 22:23 Xah
2008-07-23 22:47 ` Lennart Borgman (gmail)
2008-07-24 12:48 ` Tim X
0 siblings, 2 replies; 3+ messages in thread
From: Xah @ 2008-07-23 22:23 UTC (permalink / raw
To: help-gnu-emacs
is there a way to attache a simple lisp code to a file like file
variables?
for example, i want this line at the top of a file,
-*- (highlight-regexp "\([^"]+\)" hi-yellow) -*-
when the file is opened, the expr is evaluated so that all double
quoted text are highlighted.
Thanks.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: running lisp code like file variables
2008-07-23 22:23 running lisp code like file variables Xah
@ 2008-07-23 22:47 ` Lennart Borgman (gmail)
2008-07-24 12:48 ` Tim X
1 sibling, 0 replies; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-23 22:47 UTC (permalink / raw
To: Xah; +Cc: help-gnu-emacs
Xah wrote:
> is there a way to attache a simple lisp code to a file like file
> variables?
>
> for example, i want this line at the top of a file,
>
> -*- (highlight-regexp "\([^"]+\)" hi-yellow) -*-
>
> when the file is opened, the expr is evaluated so that all double
> quoted text are highlighted.
See
(info "(emacs) File Variables")
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: running lisp code like file variables
2008-07-23 22:23 running lisp code like file variables Xah
2008-07-23 22:47 ` Lennart Borgman (gmail)
@ 2008-07-24 12:48 ` Tim X
1 sibling, 0 replies; 3+ messages in thread
From: Tim X @ 2008-07-24 12:48 UTC (permalink / raw
To: help-gnu-emacs
Xah <xahlee@gmail.com> writes:
> is there a way to attache a simple lisp code to a file like file
> variables?
>
> for example, i want this line at the top of a file,
>
> -*- (highlight-regexp "\([^"]+\)" hi-yellow) -*-
>
> when the file is opened, the expr is evaluated so that all double
> quoted text are highlighted.
>
Yes, you can do this. However, by default, this is either disabled or
you have to interactively agree to it. the reason is of course obvious -
if emacs blindly just evaluated any bit of emacs lisp put into a local
variable (file variable) you would get the sort of mess you get with
other "modern" user friendly non-tech geeking software solutions that
do this and which have provided a convenient way to embed malicious code
or a virus in a file just waiting to be opened!
Of course, as emacs knows that some will be smart enough to know how to
use this feature safely, you can enable it so that it does execute the
code automatically.
Note that I'm not sure you can do it in the top line - you may need to
have the local variables section at the end of the file - of course, not
a big issue for anyone who knows emacs and how to handle that in pretty
much an invisible way.
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-24 12:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-23 22:23 running lisp code like file variables Xah
2008-07-23 22:47 ` Lennart Borgman (gmail)
2008-07-24 12:48 ` Tim X
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.