emacs-diffs
[Top][All Lists]
Advanced

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

scratch/tzz/auth-source-reveal-mode 45ed0ec: lisp/auth-source.el: use th


From: Teodor Zlatanov
Subject: scratch/tzz/auth-source-reveal-mode 45ed0ec: lisp/auth-source.el: use the new prettify-symbols-add-prettification-rx API
Date: Tue, 16 Jun 2020 14:03:18 -0400 (EDT)

branch: scratch/tzz/auth-source-reveal-mode
commit 45ed0ecb4e4309db599c852b9dce2b88eec549bb
Author: Ted Zlatanov <tzz@lifelogs.com>
Commit: Ted Zlatanov <tzz@lifelogs.com>

    lisp/auth-source.el: use the new prettify-symbols-add-prettification-rx API
---
 lisp/auth-source.el | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index d3fc774..75e11bf 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -2465,18 +2465,17 @@ tokens and keys associated with passwords."
   :group 'auth-source
 
   (when auth-source-reveal-mode
-    (let ((prettify-augments
-           `(auth-source-reveal-mode-prettify-regexp ; identifier symbol
-             ,(if (apply #'derived-mode-p auth-source-reveal-json-modes)
-                  (format "\"?password\"?[:[:blank:]]+\"\\([^\t\r\n\"]+\\)\"" 
auth-source-reveal-regex)
-                (format "\\b%s\\b\\s-+\\([^ \t\r\n]+\\)" 
auth-source-reveal-regex))
-             ,auth-source-reveal-hider)))
-
-      (setq-local
-       prettify-symbols-compose-predicate #'auth-source-reveal-compose-p
-       prettify-symbols-alist (cl-adjoin prettify-augments
-                                         prettify-symbols-alist
-                                         :test #'equal)))
+    ;; Install the prettification magic.
+    (prettify-symbols-add-prettification-rx
+     'auth-source-reveal-mode-prettify-regexp ; The identifier symbol.
+     ;; regexp to hide/reveal
+     (if (apply #'derived-mode-p auth-source-reveal-json-modes)
+         (format "\"?password\"?[:[:blank:]]+\"\\([^\t\r\n\"]+\\)\"" 
auth-source-reveal-regex)
+       (format "\\b%s\\b\\s-+\\([^ \t\r\n]+\\)" auth-source-reveal-regex))
+     auth-source-reveal-hider)
+
+    (setq-local
+     prettify-symbols-compose-predicate #'auth-source-reveal-compose-p)
     (unless prettify-symbols-unprettify-at-point
       (auth-source-do-warn
        "Please set `%s' to _see_ passwords at point"



reply via email to

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