[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e8922a6 05/15: Only hide prefix if something is written af
From: |
Artur Malabarba |
Subject: |
[elpa] master e8922a6 05/15: Only hide prefix if something is written after it |
Date: |
Thu, 03 Sep 2015 11:01:20 +0000 |
branch: master
commit e8922a6f4d3ffd79c26c5502d0f37974375db5bf
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
Only hide prefix if something is written after it
---
README.org | 6 ++++--
nameless.el | 12 ++++++------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/README.org b/README.org
index f9c3fa0..1da8051 100644
--- a/README.org
+++ b/README.org
@@ -16,8 +16,10 @@ To use this package add the following configuration to your
Emacs init file.
(add-hook 'emacs-lisp-mode-hook #'nameless-mode)
#+END_SRC
-You can configure a string to use instead of ~:~ by setting the
~nameless-prefix~,
-and the name of the face used is ~nameless-face~.
+You can configure a string to use instead of ~:~ by setting the
+~nameless-prefix~, and the name of the face used is ~nameless-face~.
+You can even just hide the prefix completely by setting this variable
+to an empty string.
While the mode is active, the =_= key inserts the package namespace if
appropriate.
diff --git a/nameless.el b/nameless.el
index cdc841a..04f5a40 100644
--- a/nameless.el
+++ b/nameless.el
@@ -4,7 +4,7 @@
;; Author: Artur Malabarba <address@hidden>
;; Keywords: convenience, lisp
-;; Version: 0.1
+;; Version: 0.2
;; Package-Requires: ((emacs "24.2"))
;; This program is free software; you can redistribute it and/or modify
@@ -59,9 +59,9 @@
(defun nameless--compose-as (display)
"Compose the matched region and return a face spec."
(when nameless-mode
- (compose-region (match-beginning 0)
- (match-end 0)
- (or display nameless-prefix))
+ (compose-region (match-beginning 1)
+ (match-end 1)
+ (concat display nameless-prefix))
'(face nameless-face)))
(defvar-local nameless--font-lock-keywords nil)
@@ -84,7 +84,7 @@
(cons 'composition font-lock-extra-managed-props))
(let ((kws nil))
(while r
- (push `(,(pop r) 0 (nameless--compose-as ,(pop r)) prepend) kws))
+ (push `(,(pop r) 1 (nameless--compose-as ,(pop r)) prepend) kws))
(setq nameless--font-lock-keywords kws)
(font-lock-add-keywords nil kws t))
(nameless--ensure))
@@ -116,7 +116,7 @@
(defun nameless--name-regexp (name)
"Return a regexp of the current name."
- (concat "\\<" (regexp-quote name) "-"))
+ (concat "\\<\\(" (regexp-quote name) "-\\)\\(\\s_\\|\\sw\\)"))
;;; Minor mode
- [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 <=
- [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, 2015/09/03
- [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