emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master b580ee6 6/9: [Fix #6] Local variables not being used


From: Artur Malabarba
Subject: [elpa] master b580ee6 6/9: [Fix #6] Local variables not being used
Date: Wed, 09 Sep 2015 11:08:20 +0000

branch: master
commit b580ee639571abb25a01d12313ce956c9543afaf
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    [Fix #6] Local variables not being used
---
 README.org  |   11 +++++++----
 nameless.el |   17 +++++++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index c65ef3b..3e28eb9 100644
--- a/README.org
+++ b/README.org
@@ -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~.
diff --git a/nameless.el b/nameless.el
index 83f4533..82dc1a3 100644
--- a/nameless.el
+++ b/nameless.el
@@ -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."
 
 ;;; 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]