* Reparsing local variables without reopening file?
@ 2002-09-21 19:13 Ole Laursen
2002-09-21 22:27 ` Michael Slass
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ole Laursen @ 2002-09-21 19:13 UTC (permalink / raw)
Hi
I was changing a local variable for a test example when it occurred to
me that I didn't know how to make Emacs reparse them. For example:
// Local Variables: ***
// compile-command: "g++ test.cpp -o test -O3" ***
// End: ***
Now, one can save and kill the buffer and refind the file (or perhaps
even do a M-x revert-buffer); however, this seems silly. M-x apropos
gives hack-local-variables. But that is a function? What do the gurus
do? Or should hack-local-variables be a command (perhaps with a
somewhat more descriptive name :-)? Typing M-: (hack-local-variables)
is a little laborious.
--
Ole Laursen
http://sunsite.dk/olau/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reparsing local variables without reopening file?
2002-09-21 19:13 Reparsing local variables without reopening file? Ole Laursen
@ 2002-09-21 22:27 ` Michael Slass
2002-09-22 17:42 ` Thomas F. Burdick
2002-09-23 12:29 ` Peter Boettcher
2 siblings, 0 replies; 5+ messages in thread
From: Michael Slass @ 2002-09-21 22:27 UTC (permalink / raw)
Ole Laursen <olau@hardworking.dk> writes:
>Hi
>
>I was changing a local variable for a test example when it occurred to
>me that I didn't know how to make Emacs reparse them. For example:
>
> // Local Variables: ***
> // compile-command: "g++ test.cpp -o test -O3" ***
> // End: ***
>
>Now, one can save and kill the buffer and refind the file (or perhaps
>even do a M-x revert-buffer); however, this seems silly. M-x apropos
>gives hack-local-variables. But that is a function? What do the gurus
>do? Or should hack-local-variables be a command (perhaps with a
>somewhat more descriptive name :-)? Typing M-: (hack-local-variables)
>is a little laborious.
A faster way to do that is with find-alternate-file (usually bound to
C-x C-v) and then accept the default which will be the file you're
currently visiting. This will re-load the file from disk, re-start
the appropriate mode, and eval the local variables.
That doesn't address your point of any other way to do it, but makes
your way easier to do.
BOL
--
Mike Slass
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reparsing local variables without reopening file?
2002-09-21 19:13 Reparsing local variables without reopening file? Ole Laursen
2002-09-21 22:27 ` Michael Slass
@ 2002-09-22 17:42 ` Thomas F. Burdick
2002-09-24 20:22 ` Kevin Rodgers
2002-09-23 12:29 ` Peter Boettcher
2 siblings, 1 reply; 5+ messages in thread
From: Thomas F. Burdick @ 2002-09-22 17:42 UTC (permalink / raw)
Ole Laursen <olau@hardworking.dk> writes:
> Hi
>
> I was changing a local variable for a test example when it occurred to
> me that I didn't know how to make Emacs reparse them. For example:
>
> // Local Variables: ***
> // compile-command: "g++ test.cpp -o test -O3" ***
> // End: ***
>
> Now, one can save and kill the buffer and refind the file (or perhaps
> even do a M-x revert-buffer); however, this seems silly. M-x apropos
> gives hack-local-variables. But that is a function? What do the gurus
> do? Or should hack-local-variables be a command (perhaps with a
> somewhat more descriptive name :-)? Typing M-: (hack-local-variables)
> is a little laborious.
Come to think of it, that would be a nice thing to have as a command,
wouldn't it? But hack-local-variables is the function that gets
called when you find-file a file, so you can just put this in your
.emacs:
(defun my-reparse-local-variables ()
(interactive)
(hack-local-variables))
(global-set-key ... #'my-reparse-local-varaibles)
--
/|_ .-----------------------.
,' .\ / | No to Imperialist war |
,--' _,' | Wage class war! |
/ / `-----------------------'
( -. |
| ) |
(`-. '--.)
`. )----'
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reparsing local variables without reopening file?
2002-09-21 19:13 Reparsing local variables without reopening file? Ole Laursen
2002-09-21 22:27 ` Michael Slass
2002-09-22 17:42 ` Thomas F. Burdick
@ 2002-09-23 12:29 ` Peter Boettcher
2 siblings, 0 replies; 5+ messages in thread
From: Peter Boettcher @ 2002-09-23 12:29 UTC (permalink / raw)
On 21 Sep 2002, olau@hardworking.dk wrote:
> Hi
>
> I was changing a local variable for a test example when it occurred
> to me that I didn't know how to make Emacs reparse them. For
> example:
>
> // Local Variables: ***
> // compile-command: "g++ test.cpp -o test -O3" ***
> // End: ***
>
> Now, one can save and kill the buffer and refind the file (or
> perhaps even do a M-x revert-buffer); however, this seems silly. M-x
> apropos gives hack-local-variables. But that is a function? What do
> the gurus do? Or should hack-local-variables be a command (perhaps
> with a somewhat more descriptive name :-)? Typing M-:
> (hack-local-variables) is a little laborious.
I use M-x normal-mode for this kind of thing. I bind it to C-c n.
--
Peter Boettcher
MIT Lincoln Laboratory
boettcher@ll.mit.edu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reparsing local variables without reopening file?
2002-09-22 17:42 ` Thomas F. Burdick
@ 2002-09-24 20:22 ` Kevin Rodgers
0 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2002-09-24 20:22 UTC (permalink / raw)
Thomas F. Burdick wrote:
> Come to think of it, that would be a nice thing to have as a command,
> wouldn't it? But hack-local-variables is the function that gets
> called when you find-file a file, so you can just put this in your
> .emacs:
>
> (defun my-reparse-local-variables ()
> (interactive)
> (hack-local-variables))
>
> (global-set-key ... #'my-reparse-local-varaibles)
Or you can advise the original definition and bind a key to that (or
call it via M-x), instead of creating a new function:
(defadvice hack-local-variables (before interactive activate)
"Provide an `interactive' specification."
(interactive))
--
<a href="mailto:<kevinr@ihs.com>">Kevin Rodgers</a>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-09-24 20:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-21 19:13 Reparsing local variables without reopening file? Ole Laursen
2002-09-21 22:27 ` Michael Slass
2002-09-22 17:42 ` Thomas F. Burdick
2002-09-24 20:22 ` Kevin Rodgers
2002-09-23 12:29 ` Peter Boettcher
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.