diff options
| author | Michael Olson | 2008-05-19 22:36:09 +0000 |
|---|---|---|
| committer | Michael Olson | 2008-05-19 22:36:09 +0000 |
| commit | 1b21ee065d77baee6da0c46a207bfb44d7cc0a95 (patch) | |
| tree | ac173ee06682f6fe2d09403c2be5d246b9d26558 /doc | |
| parent | ad97b375e8189e1826d562898ea78e4f3bb94bda (diff) | |
| download | emacs-1b21ee065d77baee6da0c46a207bfb44d7cc0a95.tar.gz emacs-1b21ee065d77baee6da0c46a207bfb44d7cc0a95.zip | |
Implement Project-local variables.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/custom.texi | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index e270f863253..a85925c0f05 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -796,6 +796,7 @@ here we describe other aspects of Emacs variables. | |||
| 796 | of Emacs to run on particular occasions. | 796 | of Emacs to run on particular occasions. |
| 797 | * Locals:: Per-buffer values of variables. | 797 | * Locals:: Per-buffer values of variables. |
| 798 | * File Variables:: How files can specify variable values. | 798 | * File Variables:: How files can specify variable values. |
| 799 | * Directory Variables:: How variable values can be specified by directory. | ||
| 799 | @end menu | 800 | @end menu |
| 800 | 801 | ||
| 801 | @node Examining | 802 | @node Examining |
| @@ -1262,6 +1263,65 @@ customizable list of eval forms which are safe. Emacs does not ask | |||
| 1262 | for confirmation when it finds these forms for the @code{eval} | 1263 | for confirmation when it finds these forms for the @code{eval} |
| 1263 | variable. | 1264 | variable. |
| 1264 | 1265 | ||
| 1266 | @node Directory Variables | ||
| 1267 | @subsection Per-Directory Local Variables | ||
| 1268 | @cindex local variables in directories | ||
| 1269 | @cindex directory local variables | ||
| 1270 | |||
| 1271 | Emacs provides a way to specify local variable values per-directory. | ||
| 1272 | This can be done one of two ways. | ||
| 1273 | |||
| 1274 | The first approach is to put a special file, named | ||
| 1275 | @file{.dir-settings.el}, in a directory. When opening a file, Emacs | ||
| 1276 | searches for @file{.dir-settings.el} starting in the file's directory | ||
| 1277 | and then moving up the directory hierarchy. If | ||
| 1278 | @file{.dir-settings.el} is found, Emacs applies variable settings from | ||
| 1279 | the file to the new buffer. If the file is remote, Emacs skips this | ||
| 1280 | search, because it would be too slow. | ||
| 1281 | |||
| 1282 | The file should hold a specially-constructed list. This list maps | ||
| 1283 | Emacs mode names (symbols) to alists; each alist maps variable names | ||
| 1284 | to values. The special mode name @samp{nil} means that the alist | ||
| 1285 | should be applied to all buffers. Finally, a string key can be used | ||
| 1286 | to specify an alist which applies to a relative subdirectory in the | ||
| 1287 | project. | ||
| 1288 | |||
| 1289 | @example | ||
| 1290 | ((nil . ((indent-tabs-mode . t) | ||
| 1291 | (tab-width . 4) | ||
| 1292 | (fill-column . 80))) | ||
| 1293 | (c-mode . ((c-file-style . "BSD"))) | ||
| 1294 | (java-mode . ((c-file-style . "BSD"))) | ||
| 1295 | ("src/imported" | ||
| 1296 | . ((nil . ((change-log-default-name . "ChangeLog.local")))))) | ||
| 1297 | @end example | ||
| 1298 | |||
| 1299 | This example shows some settings for a hypothetical project. This | ||
| 1300 | sets @samp{indent-tabs-mode} to @samp{t} for any file in the source | ||
| 1301 | tree, and it sets the indentation style for any C or Java source file | ||
| 1302 | to @samp{BSD}. Finally, it specifies a different @file{ChangeLog} | ||
| 1303 | file name for any file in the project that appears beneath the | ||
| 1304 | directory @file{src/imported}. | ||
| 1305 | |||
| 1306 | The second approach to directory-local settings is to explicitly | ||
| 1307 | define a project class using @code{define-project-bindings}, and then | ||
| 1308 | to tell Emacs which directory roots correspond to that class, using | ||
| 1309 | @code{set-directory-project}. You can put calls to these functions in | ||
| 1310 | your @file{.emacs}; this can useful when you can't put | ||
| 1311 | @file{.dir-settings.el} in the directory for some reason. For | ||
| 1312 | example, you could apply settings to an unwriteable directory this | ||
| 1313 | way: | ||
| 1314 | |||
| 1315 | @example | ||
| 1316 | (define-project-bindings 'unwriteable-directory | ||
| 1317 | '((nil . ((some-useful-setting . value))))) | ||
| 1318 | |||
| 1319 | (set-directory-project "/usr/include/" 'unwriteable-directory) | ||
| 1320 | @end example | ||
| 1321 | |||
| 1322 | Unsafe directory-local variables are handled in the same way as | ||
| 1323 | unsafe file-local variables. | ||
| 1324 | |||
| 1265 | @node Key Bindings | 1325 | @node Key Bindings |
| 1266 | @section Customizing Key Bindings | 1326 | @section Customizing Key Bindings |
| 1267 | @cindex key bindings | 1327 | @cindex key bindings |