unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35373: [PATCH] (info "(emacs) Safe File Variables")
@ 2019-04-22  1:10 積丹尼 Dan Jacobson
  2019-04-23  1:34 ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-04-22  1:10 UTC (permalink / raw)
  To: 35373

-- Append to (info "(emacs) Safe File Variables") --

Sometimes simply postprocessing the local variables is much more
appropriate than eval.

Consider the example on the previous page,

     # Local Variables:
     # compile-command: "cc foo.c ..."
     # End:

To make it work in any file,

     # Local Variables:
     # compile-command: "cc @FILE@ ..."
     # End:

use

(add-hook
 'hack-local-variables-hook
 (function
  (lambda ()
    (if (local-variable-p 'compile-command)
	(setq compile-command
	      (replace-regexp-in-string
	       "@FILE@"
	       (file-name-nondirectory buffer-file-name)
	       compile-command t))))))





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

end of thread, other threads:[~2019-04-25  2:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-22  1:10 bug#35373: [PATCH] (info "(emacs) Safe File Variables") 積丹尼 Dan Jacobson
2019-04-23  1:34 ` Richard Stallman
2019-04-23 19:29   ` 積丹尼 Dan Jacobson
2019-04-23 22:05   ` 積丹尼 Dan Jacobson
2019-04-24 22:26   ` 積丹尼 Dan Jacobson
2019-04-25  2:11   ` 積丹尼 Dan Jacobson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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