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

[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



reply via email to

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