[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 87b685f: Add an `authinfo-hidden' variable
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master 87b685f: Add an `authinfo-hidden' variable |
Date: |
Mon, 23 Sep 2019 06:27:53 -0400 (EDT) |
branch: master
commit 87b685f4365f663ef1258cd60616034cd2cc89c9
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Add an `authinfo-hidden' variable
* lisp/auth-source.el (authinfo-hidden): New variable.
(authinfo--hide-passwords): Use it to allow users to decide what
to hide.
---
etc/NEWS | 3 ++-
lisp/auth-source.el | 19 +++++++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 73f0ca2..e28bb2c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1497,7 +1497,8 @@ To recover the previous behavior, set new user option
*** .authinfo and .netrc files now use a new mode: 'authinfo-mode'.
This is just like 'fundamental-mode', except that it hides passwords
under a "****" display property. When the cursor moves to this text,
-the real password is revealed (via 'reveal-mode').
+the real password is revealed (via 'reveal-mode'). The
+'authinfo-hidden' variable can be used to control what to hide.
** Tramp
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 6d53a22..9061d41 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -2400,6 +2400,11 @@ MODE can be \"login\" or \"password\"."
;;; Tiny mode for editing .netrc/.authinfo modes (that basically just
;;; hides passwords).
+(defcustom authinfo-hidden "password"
+ "Regexp matching elements in .authinfo/.netrc files that should be hidden."
+ :type 'regexp
+ :version "27.1")
+
;;;###autoload
(define-derived-mode authinfo-mode fundamental-mode "Authinfo"
"Mode for editing .authinfo/.netrc files.
@@ -2416,13 +2421,15 @@ passwords are revealed when point moved into the
password.
(save-restriction
(narrow-to-region start end)
(goto-char start)
- (while (re-search-forward "\\(\\s-\\|^\\)password\\s-+\\([^\n\t ]+\\)"
+ (while (re-search-forward (format "\\(\\s-\\|^\\)\\(%s\\)\\s-+"
+ authinfo-hidden)
nil t)
- (let ((overlay (make-overlay (match-beginning 2) (match-end 2))))
- (overlay-put overlay 'display (propertize "****"
- 'face 'warning))
- (overlay-put overlay 'reveal-toggle-invisible
- #'authinfo--toggle-display))))))
+ (when (looking-at "[^\n\t ]+")
+ (let ((overlay (make-overlay (match-beginning 0) (match-end 0))))
+ (overlay-put overlay 'display (propertize "****"
+ 'face 'warning))
+ (overlay-put overlay 'reveal-toggle-invisible
+ #'authinfo--toggle-display)))))))
(defun authinfo--toggle-display (overlay hide)
(if hide
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 87b685f: Add an `authinfo-hidden' variable,
Lars Ingebrigtsen <=