The file-local-variable Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The file-local-variable Reference Manual

This is the file-local-variable Reference Manual, version 0.1, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 03:53:27 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction


* File-Local-Variable  - File-local variable independent from ASDF

[[https://circleci.com/gh/guicho271828/file-local-variable][https://circleci.com/gh/guicho271828/file-local-variable.svg?style=svg]]

Implements a file-local variable using a carefully designed file-reloading scheme.

#+BEGIN_SRC lisp

(defpackage file-local-variable.example
  (:use :cl))

(in-package :file-local-variable.example)

(defun myhook (macrofn form env)
  (print form)
  (funcall macrofn form env))

(flv:file-local-bind *macroexpand-hook* 'myhook
                     *read-default-float-format* 'double-float)

(eval-when (:compile-toplevel) (print :compile-toplevel))
(eval-when (:load-toplevel)    (print :load-toplevel))
(eval-when (:execute)          (print :execute))

(eval-when (:compile-toplevel :load-toplevel :execute)
  (print '#.*macroexpand-hook*)         ; 'myhook
  (print (type-of 3.0)))                ; 'double-float

#+END_SRC

** syntax

The syntax is the same as =setf=.

: (file-local-bind var val &rest more)

** Related work

ASDF-FLV, but it depends on ASDF. by Didier Verna.

http://www.cliki.net/asdf-flv

CDR 9 proposal (File-local variables) by Didier Verna.

https://common-lisp.net/project/cdr/document/9/verna.11.cdr2.pdf

** How It Works

1. =flv:file-local-bind= dynamically binds the variable using =progv=, and
   opens the current =*compile-pathanme*=. Within the dynamic environment
   of =progv=, reread the file as follows:
   1. Skip the forms until the first appearance of =flv:file-local-bind=.
   2. Skip the =flv:file-local-bind= form.
   3. Read, then macroexpands the rest of the forms. Currently it depends
      on the implementation-specific =macroexpand-all=.
   4. =flv:file-local-bind= expands into a =progn= containing their
      expansion results.
2. Skips the rest of the forms by assigning =*dumb-readtable*= to
   =*readtable*= , i.e., a readtable which treats all characters
   as [[http://www.lispworks.com/documentation/HyperSpec/Body/02_ad.htm][whitespace characters]].
3. Since =*readtable*= is file-local as specified by ANSI, it is unbound when the file
   compilation finishes.

** Dependencies

This library is at least tested on implementation listed below:

+ SBCL 1.3.2 on X86-64 Linux  3.19.0-49-generic (author's environment)

Also, it depends on the following libraries:

+ iterate by  ::
    Jonathan Amsterdam's iterator/gatherer/accumulator facility

+ alexandria by  ::
    Alexandria is a collection of portable public domain utilities.

+ trivia  ::
    



** Installation


** Author

+ Masataro Asai (guicho2.71828@gmail.com)

* Copyright

Copyright (c) 2016 Masataro Asai (guicho2.71828@gmail.com)


* License

Licensed under the LLGPL License.





Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 file-local-variable

Author

Masataro Asai

Contact

guicho2.71828@gmail.com

License

LLGPL

Description

File-local variable independent from ASDF

Version

0.1

Dependencies
Source

file-local-variable.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 file-local-variable/src

Parent

file-local-variable (system)

Location

src/

Component

package.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 file-local-variable.asd

Location

file-local-variable.asd

Systems

file-local-variable (system)

Packages

file-local-variable-asd


Previous: , Up: Lisp files   [Contents][Index]

4.1.2 file-local-variable/src/package.lisp

Parent

src (module)

Location

src/package.lisp

Packages

file-local-variable

Exported Definitions

file-local-bind (macro)

Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 file-local-variable-asd

Source

file-local-variable.asd

Use List

Previous: , Up: Packages   [Contents][Index]

5.2 file-local-variable

Source

package.lisp (file)

Nickname

flv

Use List
Exported Definitions

file-local-bind (macro)

Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Macros

Macro: file-local-bind VARIABLE VALUE &rest MORE
Package

file-local-variable

Source

package.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Special variables

Special Variable: *dumb-readtable*
Package

file-local-variable

Source

package.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Functions

Function: recompile-with-flv BINDINGS ENV
Package

file-local-variable

Source

package.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   M  
Index Entry  Section

F
File, Lisp, file-local-variable.asd: The file-local-variable<dot>asd file
File, Lisp, file-local-variable/src/package.lisp: The file-local-variable/src/package<dot>lisp file
file-local-variable.asd: The file-local-variable<dot>asd file
file-local-variable/src: The file-local-variable/src module
file-local-variable/src/package.lisp: The file-local-variable/src/package<dot>lisp file

L
Lisp File, file-local-variable.asd: The file-local-variable<dot>asd file
Lisp File, file-local-variable/src/package.lisp: The file-local-variable/src/package<dot>lisp file

M
Module, file-local-variable/src: The file-local-variable/src module

Jump to:   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   F   M   R  
Index Entry  Section

F
file-local-bind: Exported macros
Function, recompile-with-flv: Internal functions

M
Macro, file-local-bind: Exported macros

R
recompile-with-flv: Internal functions

Jump to:   F   M   R  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*dumb-readtable*: Internal special variables

S
Special Variable, *dumb-readtable*: Internal special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   F   P   S  
Index Entry  Section

F
file-local-variable: The file-local-variable system
file-local-variable: The file-local-variable package
file-local-variable-asd: The file-local-variable-asd package

P
Package, file-local-variable: The file-local-variable package
Package, file-local-variable-asd: The file-local-variable-asd package

S
System, file-local-variable: The file-local-variable system

Jump to:   F   P   S