commit b950b46f514989442fdd9937a0e96d53a3affa88 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Mon Feb 13 12:32:11 2023 -0800 Fix insert-file-contents on /proc files This should fix Bug#9800 (2011-10-19). * src/fileio.c (Finsert_file_contents): Do not trust st_size even on regular files, as the file might be a Linux /proc file, or it might be growing. Instead, always read to EOF when END is nil. diff --git a/src/fileio.c b/src/fileio.c index ee30db8b49b..b80f8d61de4 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3907,7 +3907,6 @@ because (1) it preserves some marker positions (in unchanged portions struct timespec mtime; int fd; ptrdiff_t inserted = 0; - ptrdiff_t how_much; int unprocessed; specpdl_ref count = SPECPDL_INDEX (); Lisp_Object handler, val, insval, orig_filename, old_undo; @@ -3920,7 +3919,8 @@ because (1) it preserves some marker positions (in unchanged portions bool replace_handled = false; bool set_coding_system = false; Lisp_Object coding_system; - bool read_quit = false; + /* Negative if read error, 0 if OK so far, positive if quit. */ + ptrdiff_t read_quit = 0; /* If the undo log only contains the insertion, there's no point keeping it. It's typically when we first fill a file-buffer. */ bool empty_undo_list_p @@ -4404,7 +4404,7 @@ because (1) it preserves some marker positions (in unchanged portions ptrdiff_t bufpos; unsigned char *decoded; ptrdiff_t temp; - ptrdiff_t this = 0; + ptrdiff_t this; specpdl_ref this_count = SPECPDL_INDEX (); bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); @@ -4580,8 +4580,12 @@ because (1) it preserves some marker positions (in unchanged portions } move_gap_both (PT, PT_BYTE); - if (GAP_SIZE < total) - make_gap (total - GAP_SIZE); + + /* Ensure the gap is at least one byte larger than needed for the + estimated file size, so that in the usual case we read to EOF + without reallocating. */ + if (GAP_SIZE <= total) + make_gap (total - GAP_SIZE + 1); if (beg_offset != 0 || !NILP (replace)) { @@ -4589,12 +4593,6 @@ because (1) it preserves some marker positions (in unchanged portions report_file_error ("Setting file position", orig_filename); } - /* In the following loop, HOW_MUCH contains the total bytes read so - far for a regular file, and not changed for a special file. But, - before exiting the loop, it is set to a negative value if I/O - error occurs. */ - how_much = 0; - /* Total bytes inserted. */ inserted = 0; @@ -4603,23 +4601,26 @@ because (1) it preserves some marker positions (in unchanged portions { ptrdiff_t gap_size = GAP_SIZE; - while (how_much < total) + while (NILP (end) || inserted < total) { - /* `try' is reserved in some compilers (Microsoft C). */ - ptrdiff_t trytry = min (total - how_much, READ_BUF_SIZE); ptrdiff_t this; + if (gap_size == 0) + { + /* The size estimate was wrong. Make the gap 50% larger. */ + make_gap (GAP_SIZE >> 1); + gap_size = GAP_SIZE - inserted; + } + + /* 'try' is reserved in some compilers (Microsoft C). */ + ptrdiff_t trytry = min (gap_size, READ_BUF_SIZE); + if (!NILP (end)) + trytry = min (trytry, total - inserted); + if (!seekable && NILP (end)) { Lisp_Object nbytes; - /* Maybe make more room. */ - if (gap_size < trytry) - { - make_gap (trytry - gap_size); - gap_size = GAP_SIZE - inserted; - } - /* Read from the file, capturing `quit'. When an error occurs, end the loop, and arrange for a quit to be signaled after decoding the text we read. */ @@ -4630,7 +4631,7 @@ because (1) it preserves some marker positions (in unchanged portions if (NILP (nbytes)) { - read_quit = true; + read_quit = 1; break; } @@ -4649,19 +4650,11 @@ because (1) it preserves some marker positions (in unchanged portions if (this <= 0) { - how_much = this; + read_quit = this; break; } gap_size -= this; - - /* For a regular file, where TOTAL is the real size, - count HOW_MUCH to compare with it. - For a special file, where TOTAL is just a buffer size, - so don't bother counting in HOW_MUCH. - (INSERTED is where we count the number of characters inserted.) */ - if (seekable || !NILP (end)) - how_much += this; inserted += this; } } @@ -4682,7 +4675,7 @@ because (1) it preserves some marker positions (in unchanged portions emacs_close (fd); clear_unwind_protect (fd_index); - if (how_much < 0) + if (read_quit < 0) report_file_error ("Read error", orig_filename); notfound: commit bae5fa5d9a8ef8c41fbb3408eea441a2ee14d1db Author: Paul Eggert Date: Mon Feb 13 08:53:52 2023 -0800 Fix src/fileio.c comment * src/fileio.c (Finsert_file_contents): Fix comment. Since the code relies on st_size, it’s limited to regular files, not to seekable files. diff --git a/src/fileio.c b/src/fileio.c index 47177be0f4d..ee30db8b49b 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4101,7 +4101,7 @@ because (1) it preserves some marker positions (in unchanged portions else { /* Don't try looking inside a file for a coding system - specification if it is not seekable. */ + specification if it is not a regular file. */ if (regular && !NILP (Vset_auto_coding_function)) { /* Find a coding system specified in the heading two commit ccc092115172f15c9135771f90d0000f8bf21614 Author: Paul Eggert Date: Mon Feb 13 08:51:45 2023 -0800 Don’t scan text twice to guess coding system * src/fileio.c (Finsert_file_contents): If the file shrank below 4 KiB, don’t read duplicate text into READ_BUF. This also removes a use of SEEK_END, which Linux /proc file systems do not support (not that we should get here with /proc). diff --git a/src/fileio.c b/src/fileio.c index 751b8ec573c..47177be0f4d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4119,7 +4119,7 @@ because (1) it preserves some marker positions (in unchanged portions if (nread == 1024) { int ntail; - if (lseek (fd, - (1024 * 3), SEEK_END) < 0) + if (lseek (fd, st.st_size - 1024 * 3, SEEK_CUR) < 0) report_file_error ("Setting file position", orig_filename); ntail = emacs_read_quit (fd, read_buf + nread, 1024 * 3); commit b0842671e750be08356425e2fc38251e7b08d5d7 Author: Paul Eggert Date: Sun Feb 12 17:52:46 2023 -0800 Improve insert-file-contents on non-regular files * src/fileio.c (Finsert_file_contents): If the file is not a regular file, check REPLACE and VISIT before doing further syscalls that won’t matter in this case. diff --git a/src/fileio.c b/src/fileio.c index 64337abdaef..751b8ec573c 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4022,7 +4022,6 @@ because (1) it preserves some marker positions (in unchanged portions if (!S_ISREG (st.st_mode)) { regular = false; - seekable = lseek (fd, 0, SEEK_CUR) < 0; if (! NILP (visit)) { @@ -4030,14 +4029,15 @@ because (1) it preserves some marker positions (in unchanged portions goto notfound; } + if (!NILP (replace)) + xsignal2 (Qfile_error, + build_string ("not a regular file"), orig_filename); + + seekable = lseek (fd, 0, SEEK_CUR) < 0; if (!NILP (beg) && !seekable) xsignal2 (Qfile_error, build_string ("cannot use a start position in a non-seekable file/device"), orig_filename); - - if (!NILP (replace)) - xsignal2 (Qfile_error, - build_string ("not a regular file"), orig_filename); } if (end_offset < 0) commit 5284af27ee5250c631ff4ee2f3d8682f0c5df8bc Author: Paul Eggert Date: Sun Feb 12 17:30:46 2023 -0800 Improve insert-file-contents checking * src/fileio.c (Finsert_file_contents): Check BEG, END, REPLACE for validity before launching into opening files etc. diff --git a/src/fileio.c b/src/fileio.c index c672e0f7baf..64337abdaef 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3908,7 +3908,6 @@ because (1) it preserves some marker positions (in unchanged portions int fd; ptrdiff_t inserted = 0; ptrdiff_t how_much; - off_t beg_offset, end_offset; int unprocessed; specpdl_ref count = SPECPDL_INDEX (); Lisp_Object handler, val, insval, orig_filename, old_undo; @@ -3970,6 +3969,17 @@ because (1) it preserves some marker positions (in unchanged portions goto handled; } + if (!NILP (visit)) + { + if (!NILP (beg) || !NILP (end)) + error ("Attempt to visit less than an entire file"); + if (BEG < Z && NILP (replace)) + error ("Cannot do file visiting in a non-empty buffer"); + } + + off_t beg_offset = !NILP (beg) ? file_offset (beg) : 0; + off_t end_offset = !NILP (end) ? file_offset (end) : -1; + orig_filename = filename; filename = ENCODE_FILE (filename); @@ -4030,22 +4040,7 @@ because (1) it preserves some marker positions (in unchanged portions build_string ("not a regular file"), orig_filename); } - if (!NILP (visit)) - { - if (!NILP (beg) || !NILP (end)) - error ("Attempt to visit less than an entire file"); - if (BEG < Z && NILP (replace)) - error ("Cannot do file visiting in a non-empty buffer"); - } - - if (!NILP (beg)) - beg_offset = file_offset (beg); - else - beg_offset = 0; - - if (!NILP (end)) - end_offset = file_offset (end); - else + if (end_offset < 0) { if (!regular) end_offset = TYPE_MAXIMUM (off_t); commit df5c1c9370ca3c6a6e119278ef6bb1e3bca4d578 Author: Juri Linkov Date: Mon Feb 13 19:53:05 2023 +0200 ; * etc/NEWS: Move treesit-related functions and variables to Lisp Changes. diff --git a/etc/NEWS b/etc/NEWS index d3eafaadf19..2d63593ff17 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -71,50 +71,9 @@ mistaken compositions, this will now work as well. This works like 'kill-matching-buffers', but without asking for confirmation. -+++ -** New helper variable 'transpose-sexps-function'. -Emacs now can set this variable to customize the behavior of the -'transpose-sexps' function. - -+++ -** New function 'transpose-sexps-default-function'. -The previous implementation is moved into its own function, to be -bound by 'transpose-sexps-function'. - -** New function 'treesit-transpose-sexps'. -Tree-sitter now unconditionally sets 'transpose-sexps-function' for all -tree-sitter enabled modes. This functionality utilizes the new -'transpose-sexps-function'. - -** Commands and variables to move by program statements - -*** New variable 'forward-sentence-function'. -Major modes can now set this variable to customize the behavior of the -'forward-sentence' command. - -*** New function 'forward-sentence-default-function'. -The previous implementation of 'forward-sentence' is moved into its -own function, to be bound by 'forward-sentence-function'. - -*** New buffer-local variable 'treesit-sentence-type-regexp'. -Similarly to 'treesit-defun-type-regexp', this variable is used to -define "sentences" in tree-sitter enabled modes. - -*** New function 'treesit-forward-sentence'. -All tree-sitter enabled modes that define 'treesit-sentence-type-regexp' -now set 'forward-sentence-function' to call 'treesit-forward-sentence'. - -*** New buffer-local variable 'treesit-sexp-type-regexp'. -Similarly to 'treesit-defun-type-regexp', this variable is used to -define "sexps" in tree-sitter enabled modes. - -*** New function 'treesit-forward-sexp'. -Tree-sitter conditionally sets 'forward-sexp-function' for major modes -that have defined 'treesit-sexp-type-regexp' to enable sexp-related -motion commands. - * Changes in Specialized Modes and Packages in Emacs 30.1 + --- ** Variable order and truncation can now be configured in 'gdb-many-windows'. The new user option 'gdb-locals-table-row-config' allows users to @@ -240,6 +199,52 @@ This user option has been obsoleted in Emacs 27, use * Lisp Changes in Emacs 30.1 +** Functions and variables to transpose sexps + ++++ +*** New helper variable 'transpose-sexps-function'. +Emacs now can set this variable to customize the behavior of the +'transpose-sexps' function. + ++++ +*** New function 'transpose-sexps-default-function'. +The previous implementation is moved into its own function, to be +bound by 'transpose-sexps-function'. + +*** New function 'treesit-transpose-sexps'. +Tree-sitter now unconditionally sets 'transpose-sexps-function' for all +tree-sitter enabled modes. This functionality utilizes the new +'transpose-sexps-function'. + +** Functions and variables to move by program statements + +*** New variable 'forward-sentence-function'. +Major modes can now set this variable to customize the behavior of the +'forward-sentence' command. + +*** New function 'forward-sentence-default-function'. +The previous implementation of 'forward-sentence' is moved into its +own function, to be bound by 'forward-sentence-function'. + +*** New buffer-local variable 'treesit-sentence-type-regexp'. +Similarly to 'treesit-defun-type-regexp', this variable is used to +define "sentences" in tree-sitter enabled modes. + +*** New function 'treesit-forward-sentence'. +All tree-sitter enabled modes that define 'treesit-sentence-type-regexp' +now set 'forward-sentence-function' to call 'treesit-forward-sentence'. + +** Functions and variables to move by program sexps + +*** New buffer-local variable 'treesit-sexp-type-regexp'. +Similarly to 'treesit-defun-type-regexp', this variable is used to +define "sexps" in tree-sitter enabled modes. + +*** New function 'treesit-forward-sexp'. +Tree-sitter conditionally sets 'forward-sexp-function' for major modes +that have defined 'treesit-sexp-type-regexp' to enable sexp-related +motion commands. + ** New or changed byte-compilation warnings --- commit a124cfd4418c054736fc1c56834191258507caf2 Author: Robert Pluim Date: Mon Feb 13 18:40:55 2023 +0100 ; Fix previous mule-conf change diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index 30376b5bc19..a83eeb08525 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el @@ -1737,11 +1737,12 @@ password-word-equivalents ;; (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}) + '(?\u003a ; ?\N{COLON} + ?\uff1a ; ?\N{FULLWIDTH COLON} + ?\ufe55 ; ?\N{SMALL COLON} + ?\ufe13 ; ?\N{PRESENTATION FORM FOR VERTICAL COLON} + ?\u17d6 ; ?\N{KHMER SIGN CAMNUC PII KUUH}) + ) "List of characters equivalent to trailing colon in \"password\" prompts." :type '(repeat character) :version "30.1" commit 8aef401b4f66a64ddfa9390590fb2cae1f96d522 Author: Mattias Engdegård Date: Sun Feb 12 12:33:27 2023 +0100 LAP optimiser: more stack reduction hoisting Hoisting stack reduction ops allows them to coalesce and/or cancel out pushing ops, and for useful operations to sink and combine, such as not + goto-if-[not-]nil. * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Add the rule UNARY discardN-preserve-tos --> discardN-preserve-tos UNARY where UNARY pops and pushes one value. Generalise the rule const discardN-preserve-tos --> discardN const to any 0-ary op, not just const: varref, point, etc. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 833e88887f9..1fa8e8bdf8b 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -2042,6 +2042,22 @@ byte-optimize-lapcode (let ((side-effect-free (if byte-compile-delete-errors byte-compile-side-effect-free-ops byte-compile-side-effect-and-error-free-ops)) + ;; Ops taking and produce a single value on the stack. + (unary-ops '( byte-not byte-length byte-list1 byte-nreverse + byte-car byte-cdr byte-car-safe byte-cdr-safe + byte-symbolp byte-consp byte-stringp + byte-listp byte-integerp byte-numberp + byte-add1 byte-sub1 byte-negate + ;; There are more of these but the list is + ;; getting long and the gain is typically small. + )) + ;; Ops producing a single result without looking at the stack. + (producer-ops '( byte-constant byte-varref + byte-point byte-point-max byte-point-min + byte-following-char byte-preceding-char + byte-current-column + byte-eolp byte-eobp byte-bolp byte-bobp + byte-current-buffer byte-widen)) (add-depth 0) (keep-going 'first-time) ;; Create a cons cell as head of the list so that removing the first @@ -2421,12 +2437,7 @@ byte-optimize-lapcode ;; const, varref, point etc. ;; ((and (eq (car (nth 2 rest)) 'byte-return) - (memq (car lap1) '( byte-constant byte-varref - byte-point byte-point-max byte-point-min - byte-following-char byte-preceding-char - byte-current-column - byte-eolp byte-eobp byte-bolp byte-bobp - byte-current-buffer byte-widen)) + (memq (car lap1) producer-ops) (or (memq (car lap0) '( byte-discard byte-discardN byte-discardN-preserve-tos byte-stack-set)) @@ -2438,26 +2449,15 @@ byte-optimize-lapcode lap0 lap1 (nth 2 rest) lap1 (nth 2 rest))) ;; - ;; discardN-preserve-tos OP return --> OP return - ;; dup OP return --> OP return - ;; where OP is 1->1 in stack use, like `not'. + ;; (discardN-preserve-tos|dup) UNARY return --> UNARY return + ;; where UNARY takes and produces a single value on the stack ;; ;; FIXME: ideally we should run this backwards, so that we could do ;; discardN-preserve-tos OP1...OPn return -> OP1..OPn return ;; but that would require a different approach. ;; ((and (eq (car (nth 2 rest)) 'byte-return) - (memq (car lap1) - '( byte-not - byte-symbolp byte-consp byte-stringp - byte-listp byte-integerp byte-numberp - byte-list1 - byte-car byte-cdr byte-car-safe byte-cdr-safe - byte-length - byte-add1 byte-sub1 byte-negate byte-nreverse - ;; There are more of these but the list is - ;; getting long and the gain is small. - )) + (memq (car lap1) unary-ops) (or (memq (car lap0) '(byte-discardN-preserve-tos byte-dup)) (and (eq (car lap0) 'byte-stack-set) (eql (cdr lap0) 1)))) @@ -2785,14 +2785,32 @@ byte-optimize-lapcode (push newjmp (cdr rest))) t))))) + ;; + ;; UNARY discardN-preserve-tos --> discardN-preserve-tos UNARY + ;; where UNARY takes and produces a single value on the stack + ;; + ((and (memq (car lap0) unary-ops) + (or (eq (car lap1) 'byte-discardN-preserve-tos) + (and (eq (car lap1) 'byte-stack-set) + (eql (cdr lap1) 1))) + ;; unless followed by return (which will eat the discard) + (not (eq (car lap2) 'byte-return))) + (setq keep-going t) + (byte-compile-log-lap " %s %s\t-->\t%s %s" lap0 lap1 lap1 lap0) + (setcar rest lap1) + (setcar (cdr rest) lap0)) + ;; - ;; const discardN-preserve-tos ==> discardN const - ;; const stack-set(1) ==> discard const + ;; PRODUCER discardN-preserve-tos(X) --> discard(X) PRODUCER + ;; where PRODUCER pushes a result without looking at the stack: + ;; const, varref, point etc. ;; - ((and (eq (car lap0) 'byte-constant) + ((and (memq (car lap0) producer-ops) (or (eq (car lap1) 'byte-discardN-preserve-tos) (and (eq (car lap1) 'byte-stack-set) - (eql (cdr lap1) 1)))) + (eql (cdr lap1) 1))) + ;; unless followed by return (which will eat the discard) + (not (eq (car lap2) 'byte-return))) (setq keep-going t) (let ((newdiscard (if (eql (cdr lap1) 1) (cons 'byte-discard nil) @@ -2801,6 +2819,7 @@ byte-optimize-lapcode " %s %s\t-->\t%s %s" lap0 lap1 newdiscard lap0) (setf (car rest) newdiscard) (setf (cadr rest) lap0))) + (t ;; If no rule matched, advance and try again. (setq prev (cdr prev)))))))) commit a3edacd3f547195740304139cb68aaa94d7b18ee Author: Michael Albinus Date: Mon Feb 13 15:51:48 2023 +0100 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. diff --git a/lisp/comint.el b/lisp/comint.el index c5589324a14..9d2c245247f 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -383,7 +383,8 @@ comint-password-prompt-regexp "\\(?:" (regexp-opt password-word-equivalents) "\\|Response\\)" "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?" ;; "[[: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 ;; treat it specially. "\\|^Enter encryption key: (repeat) *\\'" diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 46c3c2fa175..1b8f5ff8018 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -172,7 +172,10 @@ eshell-preoutput-filter-functions :type 'hook) (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. This is used by `eshell-watch-for-password-prompt'." :type 'regexp diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index 979e685e32a..30376b5bc19 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el @@ -1734,6 +1734,19 @@ password-word-equivalents :version "27.1" :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 charsets defined in this file but might be required by user ;; code. diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 01f1c38988c..420d6cadb9c 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -275,6 +275,19 @@ 'tramp-compat-auth-source-netrc-parse-all (autoload 'netrc-parse "netrc") (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)) (put (intern elt) 'tramp-suppress-trace t)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 115048d59db..9fa9866aec8 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -641,10 +641,11 @@ tramp-shell-prompt-pattern :type 'regexp) (defcustom tramp-password-prompt-regexp - (rx - bol (* nonl) - (group (regexp (regexp-opt password-word-equivalents))) - (* nonl) (any "::៖") (? "\^@") (* blank)) + (rx-to-string + `(: bol (* nonl) + (group (| . ,password-word-equivalents)) + (* nonl) (any . ,tramp-compat-password-colon-equivalents) + (? "\^@") (* blank))) "Regexp matching password-like prompts. The regexp should match at end of buffer.