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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/nameless 9755032 3/7: Allow using a separate prefix str


From: Stefan Monnier
Subject: [elpa] externals/nameless 9755032 3/7: Allow using a separate prefix string for private symbols
Date: Fri, 26 Mar 2021 22:42:48 -0400 (EDT)

branch: externals/nameless
commit 9755032d043ef5625e4189dec8a7dd0aedda02b9
Author: Sebastian Reuße <seb@wirrsal.net>
Commit: Sebastian Reuße <seb@wirrsal.net>

    Allow using a separate prefix string for private symbols
    
    This augments the function of ‘nameless-private-prefix’ so that, when set 
to a
    string, we use that string as a prefix instead of prefixing 
‘nameless-prefix’
    twice.
---
 nameless.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/nameless.el b/nameless.el
index 9f34f32..3052b05 100644
--- a/nameless.el
+++ b/nameless.el
@@ -108,10 +108,15 @@ for it to take effect."
 (put 'nameless-current-name 'safe-local-variable #'symbolp)
 
 (defcustom nameless-private-prefix nil
-  "If non-nil, private symbols are displayed with a double prefix.
-For instance, the function `foobar--internal-impl' will be
-displayed as `::internal-impl', instead of `:-internal-impl'."
-  :type 'boolean)
+  "If non-nil, handle private symbols specially.
+
+When t, display private symbols with a double prefix. For
+instance, the function `foobar--internal-impl' will be displayed
+as `::internal-impl', instead of `:-internal-impl'.
+
+When set to a string, use this string as a prefix for private
+symbols instead of `nameless-prefix'."
+  :type '(choice boolean string))
 
 (defcustom nameless-separator "-"
   "Separator used between package prefix and rest of symbol.
@@ -148,7 +153,9 @@ Value can also be nil, in which case the separator is never 
hidden."
       (when private-prefix
         (setq beg (match-beginning 0))
         (setq end (match-end 0))
-        (setq dis (concat dis nameless-prefix)))
+        (setq dis (if (stringp nameless-private-prefix)
+                      (concat display nameless-private-prefix)
+                    (concat dis nameless-prefix))))
       (if compose
           (compose-region beg end (nameless--make-composition dis))
         (add-text-properties beg end (list 'display dis)))



reply via email to

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