[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
- [elpa] master updated (a1c9e99 -> 8ad76a7), Artur Malabarba, 2015/09/09
- [elpa] master 89a74bb 2/9: Avoid further confusion when an alias matches the current name, Artur Malabarba, 2015/09/09
- [elpa] master c97ac2b 4/9: Merge pull request #4 from cpitclaudel/master, Artur Malabarba, 2015/09/09
- [elpa] master e0f5357 3/9: Add a missing 'delete-selection property, Artur Malabarba, 2015/09/09
- [elpa] master 6fd3a49 7/9: Fix doc, Artur Malabarba, 2015/09/09
- [elpa] master 6087323 8/9: Version bump, Artur Malabarba, 2015/09/09
- [elpa] master b580ee6 6/9: [Fix #6] Local variables not being used,
Artur Malabarba <=
- [elpa] master 489378f 1/9: Avoid confusion when an alias matches the current name, Artur Malabarba, 2015/09/09
- [elpa] master fe3829f 5/9: Improve documentation and change keybind from _ to C-c C--, Artur Malabarba, 2015/09/09
- [elpa] master 8ad76a7 9/9: Merge commit '60873230991f7a0cd3175eb578fee34c7e238fb3', Artur Malabarba, 2015/09/09