blob: 76c6845b82b3806f1a0a75de3ab450402d16f31c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
;;; asdf-flv.lisp --- Implementation
;; Copyright (C) 2011, 2015 Didier Verna
;; Author: Didier Verna <didier@didierverna.net>
;; This file is part of ASDF-FLV.
;; Copying and distribution of this file, with or without modification,
;; are permitted in any medium without royalty provided the copyright
;; notice and this notice are preserved. This file is offered as-is,
;; without any warranty.
;;; Commentary:
;; Contents management by FCM version 0.1.
;;; Code:
(in-package :net.didierverna.asdf-flv)
(defvar *file-local-variables* ()
"List of file-local special variables.")
(defun make-variable-file-local (symbol)
"Make special variable named by SYMBOL have a file-local value."
(pushnew symbol *file-local-variables*))
(defmacro set-file-local-variable (symbol)
"Set special variable named by SYMBOL as file-local.
SYMBOL need not be quoted."
`(make-variable-file-local ',symbol))
(defun make-variables-file-local (&rest symbols)
"Make special variables named by SYMBOLS have a file-local value."
(dolist (symbol symbols)
(pushnew symbol *file-local-variables*)))
(defmacro set-file-local-variables (&rest symbols)
"Set special variables named by SYMBOLS as file-local.
SYMBOLS need not be quoted."
`(make-variables-file-local ,@(mapcar (lambda (symbol) (list 'quote symbol))
symbols)))
(defmethod asdf:perform :around
((operation asdf:load-op) (file asdf:cl-source-file))
"Establish new dynamic bindings for file-local variables."
(progv *file-local-variables*
(mapcar #'symbol-value *file-local-variables*)
(call-next-method)))
(defmethod asdf:perform :around
((operation asdf:compile-op) (file asdf:cl-source-file))
"Establish new dynamic bindings for file-local variables."
(progv *file-local-variables*
(mapcar #'symbol-value *file-local-variables*)
(call-next-method)))
;;; asdf-flv.lisp ends here
|