Keith OHara <k-ohara5...@oco.net> writes: > But beware that this uses mixed tabs and spaces, unless you have > configured emacs to use spaces only, as most people prefer today,
Should we put up directory-local variables to promote this and a few other conventions? File: emacs.info, Node: Directory Variables, Prev: File Variables, Up: Variables 48.2.5 Per-Directory Local Variables ------------------------------------ Sometimes, you may wish to define the same set of local variables to all the files in a certain directory and its subdirectories, such as the directory tree of a large software project. This can be accomplished with "directory-local variables". The usual way to define directory-local variables is to put a file named `.dir-locals.el'(1) in a directory. Whenever Emacs visits any file in that directory or any of its subdirectories, it will apply the directory-local variables specified in `.dir-locals.el', as though they had been defined as file-local variables for that file (*note File Variables::). Emacs searches for `.dir-locals.el' starting in the directory of the visited file, and moving up the directory tree. To avoid slowdown, this search is skipped for remote files. If needed, the search can be extended for remote files by setting the variable `enable-remote-dir-locals' to `t'. The `.dir-locals.el' file should hold a specially-constructed list, which maps major mode names (symbols) to alists (*note Association Lists: (elisp)Association Lists.). Each alist entry consists of a variable name and the directory-local value to assign to that variable, when the specified major mode is enabled. Instead of a mode name, you can specify `nil', which means that the alist applies to any mode; or you can specify a subdirectory name (a string), in which case the alist applies to all files in that subdirectory. Here's an example of a `.dir-locals.el' file: ((nil . ((indent-tabs-mode . t) (fill-column . 80))) (c-mode . ((c-file-style . "BSD"))) (subdirs . nil))) ("src/imported" . ((nil . ((change-log-default-name . "ChangeLog.local")))))) This sets `indent-tabs-mode' and `fill-column' for any file in the directory tree, and the indentation style for any C source file. The special `subdirs' element is not a variable, but a special keyword which indicates that the C mode settings are only to be applied in the current directory, not in any subdirectories. Finally, it specifies a different `ChangeLog' file name for any file in the `src/imported' subdirectory. Instead of editing the `.dir-locals.el' file by hand, you can use the command `M-x add-dir-local-variable'. This prompts for a mode or subdirectory name, and for variable and value, and adds the entry defining the directory-local variable. `M-x delete-dir-local-variable' deletes an entry. `M-x copy-file-locals-to-dir-locals' copies the file-local variables in the current file into `.dir-locals.el'. -- David Kastrup _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel