]> code.delx.au - gnu-emacs-elpa/commitdiff
[Fix #6] Local variables not being used
authorArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 9 Sep 2015 10:55:31 +0000 (11:55 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 9 Sep 2015 10:57:05 +0000 (11:57 +0100)
README.org
nameless.el

index c65ef3b857fc14c78449b090c69a507841168258..3e28eb9ed1093fb9749cece63674116832a0079c 100644 (file)
@@ -68,13 +68,15 @@ You can configure your own aliases globally with ~nameless-global-aliases~.
                                 ("q" . "queue")))
 #+END_SRC
 
-You can also configure aliases per-file by setting ~nameless-aliases~ as a file-local variable.
+You can also configure aliases per-file by setting ~nameless-aliases~
+as a file-local variable.
 #+BEGIN_SRC emacs-lisp
 ;; Local Variables:
-;; nameless-aliases: (quote (("c" . "cider")))
+;; nameless-aliases: (("c" . "cider"))
 ;; End:
 #+END_SRC
-Or you can configure it for a whole project, by setting it as a dir-local variable.
+/Note that there’s no ~quote~ before ~((c~!/\\
+You can also configure it for a whole project, by setting it as a dir-local variable.
 
 ** Indentation and paragraph filling
 Hiding parts of symbols could affect the way Emacs indents your code
@@ -100,4 +102,5 @@ had in `nameless-aliases' or `nameless-global-aliases', replace
 it with the full name for that alias.
 #+END_SRC
 
-To change this behavior, configure the variable ~nameless-affect-indentation-and-filling~.
+To change this behavior, configure the variable
+~nameless-affect-indentation-and-filling~.
index 83f45339a149556c5eec1778842121ff70a940cd..82dc1a3234346788428ddebbba137757569d8cd1 100644 (file)
@@ -72,6 +72,15 @@ This variable takes the same syntax and has the same effect as
 those in `nameless-global-aliases'.
 This variable is designed to be used as a file-local or dir-local
 variable.")
+(put 'nameless-aliases 'safe-local-variable
+     (lambda (x) (ignore-errors
+              (let ((safe t))
+                (mapc (lambda (cell)
+                        (unless (and (stringp (car cell))
+                                     (stringp (cdr cell)))
+                          (setq safe nil)))
+                      x)
+                safe))))
 
 (defface nameless-face
   '((t :inherit font-lock-type-face))
@@ -138,6 +147,7 @@ for it to take effect."
 \f
 ;;; Name and regexp
 (defvar-local nameless-current-name nil)
+(put 'nameless-current-name 'safe-local-variable #'stringp)
 
 (defun nameless--in-arglist-p ()
   "Is point inside an arglist?"
@@ -230,5 +240,12 @@ Return S."
     (setq nameless-current-name nil)
     (nameless--remove-keywords)))
 
+;;;###autoload
+(defun nameless-mode-from-hook ()
+  "Turn on `nameless-mode'.
+Designed to be added to `emacs-lisp-mode-hook'.
+Interactively, just invoke `nameless-mode' directly."
+  (add-hook 'find-file-hook #'nameless-mode nil 'local))
+
 (provide 'nameless)
 ;;; nameless.el ends here