(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.
;; Author: Artur Malabarba <emacs@endlessparentheses.com>
;; 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
(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)
(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))
(defun nameless--name-regexp (name)
"Return a regexp of the current name."
- (concat "\\<" (regexp-quote name) "-"))
+ (concat "\\<\\(" (regexp-quote name) "-\\)\\(\\s_\\|\\sw\\)"))
\f
;;; Minor mode