GNU bug report logs - #35373
[PATCH] (info "(emacs) Safe File Variables")

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Mon, 22 Apr 2019 01:18:03 UTC

Severity: wishlist

Merged with 6615, 29451, 34130

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] (info "(emacs) Safe File Variables")
Date: Mon, 22 Apr 2019 09:10:24 +0800
-- 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))))))




This bug report was last modified 5 years and 309 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.