1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

Add new user option password-colon-equivalents

* lisp/international/mule-conf.el (password-colon-equivalents):
New defcustom.

* lisp/comint.el (comint-password-prompt-regexp):
* lisp/eshell/esh-mode.el (eshell-password-prompt-regexp): Use it.

* lisp/net/tramp-compat.el (tramp-compat-password-colon-equivalents):
New variable.

* lisp/net/tramp.el (tramp-password-prompt-regexp): Use it.
This commit is contained in:
Michael Albinus 2023-02-13 15:51:48 +01:00
parent 609319da87
commit a3edacd3f5
5 changed files with 37 additions and 6 deletions

View File

@ -383,7 +383,8 @@ This variable is buffer-local."
"\\(?:" (regexp-opt password-word-equivalents) "\\|Response\\)" "\\(?:" (regexp-opt password-word-equivalents) "\\|Response\\)"
"\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?" "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?"
;; "[[:alpha:]]" used to be "for", which fails to match non-English. ;; "[[:alpha:]]" used to be "for", which fails to match non-English.
"\\(?: [[:alpha:]]+ .+\\)?[[:blank:]]*[::៖][[:space:]]*\\'" "\\(?: [[:alpha:]]+ .+\\)?[[:blank:]]*"
"[" (apply #'string password-colon-equivalents) "][[:space:]]*\\'"
;; The ccrypt encryption dialog doesn't end with a colon, so ;; The ccrypt encryption dialog doesn't end with a colon, so
;; treat it specially. ;; treat it specially.
"\\|^Enter encryption key: (repeat) *\\'" "\\|^Enter encryption key: (repeat) *\\'"

View File

@ -172,7 +172,10 @@ inserted. They return the string as it should be inserted."
:type 'hook) :type 'hook)
(defcustom eshell-password-prompt-regexp (defcustom eshell-password-prompt-regexp
(format "\\(%s\\)[^::៖]*[::៖]\\s *\\'" (regexp-opt password-word-equivalents)) (format "%s[^%s]*[%s]\\s *\\'"
(regexp-opt password-word-equivalents t)
(apply #'string password-colon-equivalents)
(apply #'string password-colon-equivalents))
"Regexp matching prompts for passwords in the inferior process. "Regexp matching prompts for passwords in the inferior process.
This is used by `eshell-watch-for-password-prompt'." This is used by `eshell-watch-for-password-prompt'."
:type 'regexp :type 'regexp

View File

@ -1734,6 +1734,19 @@ included; callers should bind `case-fold-search' to t."
:version "27.1" :version "27.1"
:group 'processes) :group 'processes)
;; (describe-char-fold-equivalences ?:)
;; The last entry is taken from history.
(defcustom password-colon-equivalents
'(?\N{COLON}
?\N{FULLWIDTH COLON}
?\N{SMALL COLON}
?\N{PRESENTATION FORM FOR VERTICAL COLON}
?\N{KHMER SIGN CAMNUC PII KUUH})
"List of characters equivalent to trailing colon in \"password\" prompts."
:type '(repeat character)
:version "30.1"
:group 'processes)
;; The old code-pages library is obsoleted by coding systems based on ;; The old code-pages library is obsoleted by coding systems based on
;; the charsets defined in this file but might be required by user ;; the charsets defined in this file but might be required by user
;; code. ;; code.

View File

@ -275,6 +275,19 @@ Add the extension of F, if existing."
(autoload 'netrc-parse "netrc") (autoload 'netrc-parse "netrc")
(netrc-parse file)))) (netrc-parse file))))
;; User option `password-colon-equivalents' is new in Emacs 30.1.
(if (boundp 'password-colon-equivalents)
(defvaralias
'tramp-compat-password-colon-equivalents
'password-colon-equivalents)
(defvar tramp-compat-password-colon-equivalents
'(?\N{COLON}
?\N{FULLWIDTH COLON}
?\N{SMALL COLON}
?\N{PRESENTATION FORM FOR VERTICAL COLON}
?\N{KHMER SIGN CAMNUC PII KUUH})
"List of characters equivalent to trailing colon in \"password\" prompts."))
(dolist (elt (all-completions "tramp-compat-" obarray 'functionp)) (dolist (elt (all-completions "tramp-compat-" obarray 'functionp))
(put (intern elt) 'tramp-suppress-trace t)) (put (intern elt) 'tramp-suppress-trace t))

View File

@ -641,10 +641,11 @@ This regexp must match both `tramp-initial-end-of-output' and
:type 'regexp) :type 'regexp)
(defcustom tramp-password-prompt-regexp (defcustom tramp-password-prompt-regexp
(rx (rx-to-string
bol (* nonl) `(: bol (* nonl)
(group (regexp (regexp-opt password-word-equivalents))) (group (| . ,password-word-equivalents))
(* nonl) (any "::៖") (? "\^@") (* blank)) (* nonl) (any . ,tramp-compat-password-colon-equivalents)
(? "\^@") (* blank)))
"Regexp matching password-like prompts. "Regexp matching password-like prompts.
The regexp should match at end of buffer. The regexp should match at end of buffer.