aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/emacs/erlang.el
diff options
context:
space:
mode:
authorMagnus Henoch <magnus.henoch@erlang-solutions.com>2011-03-09 15:03:03 +0000
committerMagnus Henoch <magnus.henoch@erlang-solutions.com>2011-03-09 15:03:03 +0000
commitebbcdf5d18e17d7c6a7a7b0c80a85663927d6676 (patch)
tree33ecb8aa5e08690d787b8f695d274c11615288f2 /lib/tools/emacs/erlang.el
parent8f3edd734829736a53d6afcac4794c3c9891de9d (diff)
downloadotp-ebbcdf5d18e17d7c6a7a7b0c80a85663927d6676.tar.gz
otp-ebbcdf5d18e17d7c6a7a7b0c80a85663927d6676.tar.bz2
otp-ebbcdf5d18e17d7c6a7a7b0c80a85663927d6676.zip
Declare indentation options as "safe" in erlang-mode for Emacs
Emacs has a facility for setting options on a per-file basis based on comments in the source file. By default, all options are considered "unsafe", and the user is queried before the variable is set. This patch declares the variables erlang-indent-level, erlang-indent-guard and erlang-argument-indent to be safe, if the value specified in the source file is valid. Such declarations usually look like this: %% -*- erlang-indent-level: 2 -*- and appear on the first line of the file.
Diffstat (limited to 'lib/tools/emacs/erlang.el')
-rw-r--r--lib/tools/emacs/erlang.el3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index ed825a298f..17b093ee34 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -466,14 +466,17 @@ To activate the workaround, place the following in your `~/.emacs' file:
(defvar erlang-indent-level 4
"*Indentation of Erlang calls/clauses within blocks.")
+(put 'erlang-indent-level 'safe-local-variable 'integerp)
(defvar erlang-indent-guard 2
"*Indentation of Erlang guards.")
+(put 'erlang-indent-guard 'safe-local-variable 'integerp)
(defvar erlang-argument-indent 2
"*Indentation of the first argument in a function call.
When nil, indent to the column after the `(' of the
function.")
+(put 'erlang-argument-indent 'safe-local-variable '(lambda (val) (or (null val) (integerp val))))
(defvar erlang-tab-always-indent t
"*Non-nil means TAB in Erlang mode should always re-indent the current line,