[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b81dadf 08/15: Add nameless-affect-indentation variable, t
From: |
Artur Malabarba |
Subject: |
[elpa] master b81dadf 08/15: Add nameless-affect-indentation variable, to decide between display and compose |
Date: |
Thu, 03 Sep 2015 11:01:21 +0000 |
branch: master
commit b81dadf8347948d8476f229de19b0d73345cea5c
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
Add nameless-affect-indentation variable, to decide between display and
compose
---
nameless.el | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/nameless.el b/nameless.el
index 28ead40..c6032fd 100644
--- a/nameless.el
+++ b/nameless.el
@@ -53,16 +53,33 @@
'((t :inherit font-lock-type-face))
"Face used on `nameless-prefix'")
+(defcustom nameless-affect-indentation 'outside-strings
+ "If non-nil, code is indented according to what you see.
+If nil, code is indented according to its actual content.
+If the value is `outside-strings', behave like nil inside strings
+and non-nil otherwise.
+
+After changing this variable, you must reenable `nameless-mode'
+for it to take effect."
+ :type '(choice (const :tag "Always affect indentation" t)
+ (const :tag "Don't affect indentation" nil)
+ (const :tag "Only outside strings" 'outside-strings)))
+
;;; Font-locking
(defvar nameless-mode)
(defun nameless--compose-as (display)
"Compose the matched region and return a face spec."
(when nameless-mode
- (compose-region (match-beginning 1)
- (match-end 1)
- (concat display nameless-prefix))
- '(face nameless-face)))
+ (let ((compose (and nameless-affect-indentation
+ (or (not (eq nameless-affect-indentation
'outside-strings))
+ (not (nth 3 (syntax-ppss))))))
+ (dis (concat display nameless-prefix)))
+ (when compose
+ (compose-region (match-beginning 1)
+ (match-end 1)
+ dis))
+ `(face nameless-face ,@(unless compose (list 'display dis))))))
(defvar-local nameless--font-lock-keywords nil)
- [elpa] master updated (4de2352 -> e0a3544), Artur Malabarba, 2015/09/03
- [elpa] master dc2fb41 06/15: Improve regexps, Artur Malabarba, 2015/09/03
- [elpa] master 3074f24 01/15: Initial commit, Artur Malabarba, 2015/09/03
- [elpa] master f662c5e 10/15: Fix composition, Artur Malabarba, 2015/09/03
- [elpa] master 2cd0e01 03/15: Autoload, Artur Malabarba, 2015/09/03
- [elpa] master 1a1719a 02/15: Add file, Artur Malabarba, 2015/09/03
- [elpa] master 7c425ed 12/15: Documentation, Artur Malabarba, 2015/09/03
- [elpa] master e23d22c 04/15: Implement disabling the mode too, Artur Malabarba, 2015/09/03
- [elpa] master e8922a6 05/15: Only hide prefix if something is written after it, Artur Malabarba, 2015/09/03
- [elpa] master 3690ce8 13/15: Add nameless-insert-name-or-self-insert command, Artur Malabarba, 2015/09/03
- [elpa] master b81dadf 08/15: Add nameless-affect-indentation variable, to decide between display and compose,
Artur Malabarba <=
- [elpa] master 59d6da9 07/15: Change defaults a bit, Artur Malabarba, 2015/09/03
- [elpa] master 1937b95 09/15: Implement aliases, Artur Malabarba, 2015/09/03
- [elpa] master c1dd76b 14/15: Readme, Artur Malabarba, 2015/09/03
- [elpa] master 9767c97 11/15: Improve aliases, Artur Malabarba, 2015/09/03
- [elpa] master e0a3544 15/15: Add 'packages/nameless/' from commit 'c1dd76b972ab978884d5c1b2add43e83cc23134e', Artur Malabarba, 2015/09/03