From 7308fa0e2b8d929a4e0f7f54ac46228f93674672 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Jul 2018 12:28:11 +0300 Subject: [PATCH 01/11] Improve doc strings of several variables in keyboard.c * src/keyboard.c (syms_of_keyboard) : Make sure the first sentence of the doc string fits on a single line. --- src/keyboard.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index e62dd0ec489..1da5ac088d3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11854,10 +11854,10 @@ if the command is in this list, the selection is not updated. */); DEFVAR_LISP ("debug-on-event", Vdebug_on_event, - doc: /* Enter debugger on this event. When Emacs -receives the special event specified by this variable, it will try to -break into the debugger as soon as possible instead of processing the -event normally through `special-event-map'. + doc: /* Enter debugger on this event. +When Emacs receives the special event specified by this variable, +it will try to break into the debugger as soon as possible instead +of processing the event normally through `special-event-map'. Currently, the only supported values for this variable are `sigusr1' and `sigusr2'. */); @@ -11865,21 +11865,23 @@ variable are `sigusr1' and `sigusr2'. */); DEFVAR_BOOL ("attempt-stack-overflow-recovery", attempt_stack_overflow_recovery, - doc: /* If non-nil, attempt to recover from C stack -overflow. This recovery is unsafe and may lead to deadlocks or data + doc: /* If non-nil, attempt to recover from C stack overflows. +This recovery is potentially unsafe and may lead to deadlocks or data corruption, but it usually works and may preserve modified buffers that would otherwise be lost. If nil, treat stack overflow like any -other kind of crash. */); +other kind of crash or fatal error. */); attempt_stack_overflow_recovery = true; DEFVAR_BOOL ("attempt-orderly-shutdown-on-fatal-signal", attempt_orderly_shutdown_on_fatal_signal, - doc: /* If non-nil, attempt to perform an orderly -shutdown when Emacs receives a fatal signal (e.g., a crash). -This cleanup is unsafe and may lead to deadlocks or data corruption, -but it usually works and may preserve modified buffers that would -otherwise be lost. If nil, crash immediately in response to fatal -signals. */); + doc: /* If non-nil, attempt orderly shutdown on fatal signals. +By default this variable is non-nil, and Emacs attempts to perform +an orderly shutdown when it catches a fatal signal (e.g., a crash). +The orderly shutdown includes an attempt to auto-save your unsaved edits +and other useful cleanups. These cleanups are potentially unsafe and may +lead to deadlocks or data corruption, but it usually works and may +preserve data in modified buffers that would otherwise be lost. +If nil, Emacs crashes immediately in response to fatal signals. */); attempt_orderly_shutdown_on_fatal_signal = true; /* Create the initial keyboard. Qt means 'unset'. */ From e0f33ea394c636ab1aa2412b4f35b7dfc1ca768a Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 21 Jul 2018 12:29:06 +0200 Subject: [PATCH 02/11] Fix Bug#32226 * lisp/shadowfile.el (shadow-site-name, shadow-name-site): Use "[-.[:word:]]+" as hostname regexp. (Bug#32226) * test/lisp/shadowfile-tests.el (shadow-test06-literal-groups) (shadow-test07-regexp-groups, shadow-test08-shadow-todo) (shadow-test09-shadow-copy-files): Skip if needed. --- lisp/shadowfile.el | 4 ++-- test/lisp/shadowfile-tests.el | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el index e1a9b8e1d98..27d934d9fce 100644 --- a/lisp/shadowfile.el +++ b/lisp/shadowfile.el @@ -231,12 +231,12 @@ information defining the cluster. For interactive use, call (defun shadow-site-name (site) "Return name if SITE has the form \"/name:\", otherwise SITE." - (if (string-match "\\`/\\(\\w+\\):\\'" site) + (if (string-match "\\`/\\([-.[:word:]]+\\):\\'" site) (match-string 1 site) site)) (defun shadow-name-site (name) "Return \"/name:\" if NAME has word syntax, otherwise NAME." - (if (string-match "\\`\\w+\\'" name) + (if (string-match "\\`[-.[:word:]]+\\'" name) (format "/%s:"name) name)) (defun shadow-site-primary (site) diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index 5ded94480ec..200fb4c58c6 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el @@ -556,6 +556,8 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test06-literal-groups () "Check literal group definitions." + (skip-unless (file-remote-p shadow-test-remote-temporary-file-directory)) + (let ((shadow-info-file shadow-test-info-file) (shadow-todo-file shadow-test-todo-file) shadow-clusters shadow-literal-groups @@ -618,6 +620,8 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test07-regexp-groups () "Check regexp group definitions." + (skip-unless (file-remote-p shadow-test-remote-temporary-file-directory)) + (let ((shadow-info-file shadow-test-info-file) (shadow-todo-file shadow-test-todo-file) shadow-clusters shadow-regexp-groups @@ -682,6 +686,8 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test08-shadow-todo () "Check that needed shadows are added to todo." + (skip-unless (file-remote-p shadow-test-remote-temporary-file-directory)) + (let ((backup-inhibited t) (shadow-info-file shadow-test-info-file) (shadow-todo-file shadow-test-todo-file) @@ -780,6 +786,8 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test09-shadow-copy-files () "Check that needed shadow files are copied." + (skip-unless (file-remote-p shadow-test-remote-temporary-file-directory)) + (let ((backup-inhibited t) (shadow-info-file shadow-test-info-file) (shadow-todo-file shadow-test-todo-file) From cc4ceed18d51047b390288d2d0a584e678423517 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Jul 2018 19:44:38 +0300 Subject: [PATCH 03/11] ; etc/NEWS: Remove unnecessary reference to a bug number. --- etc/NEWS | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 1551c36c5a3..a27d1b89ec8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -38,7 +38,6 @@ in its NEWS.) ** New variable 'xft-ignore-color-fonts'. Default t means don't try to load color fonts when using Xft, as they often cause crashes. Set it to nil if you really need those fonts. -(Bug#30874) * Editing Changes in Emacs 26.2 From 671dc5a51edfb9aaea943e144997e7c1297f56fb Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Jul 2018 21:05:52 +0300 Subject: [PATCH 04/11] Fix calls to buffer modification hooks from replace-buffer-contents * src/editfns.c (Freplace_buffer_contents): Don't call buffer modification hooks if nothing was deleted/inserted. (Bug#32237) --- src/editfns.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/editfns.c b/src/editfns.c index d1a6bfbbb1b..cf596aec37c 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3254,10 +3254,12 @@ differences between the two buffers. */) from = BEGV + k; /* Find the last character position to be changed. */ - for (l = size_a; l > 0 && !bit_is_set (ctx.deletions, l - 1); l--) + for (l = size_a; l > k && !bit_is_set (ctx.deletions, l - 1); l--) ; to = BEGV + l; - prepare_to_modify_buffer (from, to, NULL); + /* If k >= l, it means nothing needs to be deleted. */ + if (k < l) + prepare_to_modify_buffer (from, to, NULL); specbind (Qinhibit_modification_hooks, Qt); modification_hooks_inhibited = true; } @@ -3308,11 +3310,16 @@ differences between the two buffers. */) SAFE_FREE (); rbc_quitcounter = 0; - if (modification_hooks_inhibited) + if (modification_hooks_inhibited && from <= to) { ptrdiff_t updated_to = to + ZV - BEGV - size_a; - signal_after_change (from, to - from, updated_to - from); - update_compositions (from, updated_to, CHECK_INSIDE); + /* Only call after-change-functions if something was actually + inserted. */ + if (from < updated_to) + { + signal_after_change (from, to - from, updated_to - from); + update_compositions (from, updated_to, CHECK_INSIDE); + } } return Qnil; From 47f75b1ba0246b5d770fbb52e0fa3e00f9f83ffb Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Jul 2018 22:27:33 +0300 Subject: [PATCH 05/11] Fix last change in editfns.c * src/editfns.c (Freplace_buffer_contents): Fix last change: always call buffer modification hooks, even if nothing was deleted/inserted. (bug#32237) --- src/editfns.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/editfns.c b/src/editfns.c index cf596aec37c..a18a71e6d77 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3257,9 +3257,7 @@ differences between the two buffers. */) for (l = size_a; l > k && !bit_is_set (ctx.deletions, l - 1); l--) ; to = BEGV + l; - /* If k >= l, it means nothing needs to be deleted. */ - if (k < l) - prepare_to_modify_buffer (from, to, NULL); + prepare_to_modify_buffer (from, to, NULL); specbind (Qinhibit_modification_hooks, Qt); modification_hooks_inhibited = true; } @@ -3310,16 +3308,11 @@ differences between the two buffers. */) SAFE_FREE (); rbc_quitcounter = 0; - if (modification_hooks_inhibited && from <= to) + if (modification_hooks_inhibited) { ptrdiff_t updated_to = to + ZV - BEGV - size_a; - /* Only call after-change-functions if something was actually - inserted. */ - if (from < updated_to) - { - signal_after_change (from, to - from, updated_to - from); - update_compositions (from, updated_to, CHECK_INSIDE); - } + signal_after_change (from, to - from, updated_to - from); + update_compositions (from, updated_to, CHECK_INSIDE); } return Qnil; From 59e8533286cc8b5abc80b0966ef4b9fb676fbdfe Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 18 Jul 2018 18:45:47 -0400 Subject: [PATCH 06/11] Add save-match-data to abbreviate-file-name (Bug#32201) * lisp/files.el (abbreviate-file-name): Save match-data around expand-file-name; it is not guaranteed to preserve match-data, and may well do so depending on what file handlers and hooks are in effect. --- lisp/files.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/files.el b/lisp/files.el index fb8c34bcae8..4eb1560a20d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1929,7 +1929,7 @@ started Emacs, set `abbreviated-home-dir' to nil so it will be recalculated)." (save-match-data (string-match "^[a-zA-`]:/$" filename)))) (equal (get 'abbreviated-home-dir 'home) - (expand-file-name "~"))) + (save-match-data (expand-file-name "~")))) (setq filename (concat "~" (match-string 1 filename) From 1b4b96597c7868d9c24389d83089097a521206a5 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 19 Jul 2018 06:40:54 -0400 Subject: [PATCH 07/11] Fix indent-sexp of #s(...) (Bug#31984) * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Look for a sexp that ends after the current line. * test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp-go): New test. --- lisp/emacs-lisp/lisp-mode.el | 10 ++++++++-- test/lisp/emacs-lisp/lisp-mode-tests.el | 12 ++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 3a03b56313d..44b27236a9c 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1199,8 +1199,14 @@ ENDPOS is encountered." (setq endpos (copy-marker (if endpos endpos ;; Get error now if we don't have a complete sexp - ;; after point. - (save-excursion (forward-sexp 1) (point))))) + ;; after point. We actually look for a sexp which + ;; ends after the current line so that we properly + ;; indent things like #s(...). This might not be + ;; needed if Bug#15998 is fixed. + (let ((eol (line-end-position))) + (save-excursion (while (and (< (point) eol) (not (eobp))) + (forward-sexp 1)) + (point)))))) (save-excursion (while (let ((indent (lisp-indent-calc-next parse-state)) (ppss (lisp-indent-state-ppss parse-state))) diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index 8598d419788..0b052e9fc30 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -113,6 +113,18 @@ noindent\" 3 ;; we're indenting ends on the previous line. (should (equal (buffer-string) original))))) +(ert-deftest indent-sexp-go () + "Make sure `indent-sexp' doesn't stop after #s." + ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31984. + (with-temp-buffer + (emacs-lisp-mode) + (insert "#s(foo\nbar)\n") + (goto-char (point-min)) + (indent-sexp) + (should (equal (buffer-string) "\ +#s(foo + bar)\n")))) + (ert-deftest lisp-indent-region () "Test basics of `lisp-indent-region'." (with-temp-buffer From 5de444112cf19c078d4a74752a50e890233ef033 Mon Sep 17 00:00:00 2001 From: Jonathan Kyle Mitchell Date: Mon, 16 Jul 2018 21:46:20 -0500 Subject: [PATCH 08/11] Check for special filenames in eshell (Bug#30724) * lisp/eshell/esh-cmd.el (eshell-lisp-command): Check for "~" in lisp commands with the eshell-filename-arguments property (Bug#30724). * lisp/eshell/em-dirs.el (eshell/cd, eshell/pushd, eshell/popd): * lisp/eshell/em-ls.el (eshell/ls): * lisp/eshell/em-unix.el (eshell/rm, eshell/mkdir, eshell/rmdir) (eshell/mv, eshell/cp, eshell/ln, eshell/cat, eshell/du, eshell/diff): * lisp/eshell/esh-ext.el (eshell/addpath): Add eshell-filename-arguments to symbol plist. --- lisp/eshell/em-dirs.el | 3 +++ lisp/eshell/em-ls.el | 1 + lisp/eshell/em-unix.el | 10 +++++++++ lisp/eshell/esh-cmd.el | 51 +++++++++++++++++++++++++----------------- lisp/eshell/esh-ext.el | 1 + 5 files changed, 45 insertions(+), 21 deletions(-) diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 37cb6b169a0..ba3bdb5cd53 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el @@ -407,6 +407,7 @@ in the minibuffer: nil)))) (put 'eshell/cd 'eshell-no-numeric-conversions t) +(put 'eshell/cd 'eshell-filename-arguments t) (defun eshell-add-to-dir-ring (path) "Add PATH to the last-dir-ring, if applicable." @@ -470,6 +471,7 @@ in the minibuffer: nil) (put 'eshell/pushd 'eshell-no-numeric-conversions t) +(put 'eshell/pushd 'eshell-filename-arguments t) ;;; popd [+n] (defun eshell/popd (&rest args) @@ -500,6 +502,7 @@ in the minibuffer: nil) (put 'eshell/popd 'eshell-no-numeric-conversions t) +(put 'eshell/pop 'eshell-filename-arguments t) (defun eshell/dirs (&optional if-verbose) "Implementation of dirs in Lisp." diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index 900b28905b7..2b568a991a2 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el @@ -334,6 +334,7 @@ instead." (apply 'eshell-do-ls args))) (put 'eshell/ls 'eshell-no-numeric-conversions t) +(put 'eshell/ls 'eshell-filename-arguments t) (declare-function eshell-glob-regexp "em-glob" (pattern)) diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index c3448de407d..b00b6654cc5 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -307,6 +307,7 @@ Remove (unlink) the FILE(s).") nil)) (put 'eshell/rm 'eshell-no-numeric-conversions t) +(put 'eshell/rm 'eshell-filename-arguments t) (defun eshell/mkdir (&rest args) "Implementation of mkdir in Lisp." @@ -324,6 +325,7 @@ Create the DIRECTORY(ies), if they do not already exist.") nil)) (put 'eshell/mkdir 'eshell-no-numeric-conversions t) +(put 'eshell/mkdir 'eshell-filename-arguments t) (defun eshell/rmdir (&rest args) "Implementation of rmdir in Lisp." @@ -340,6 +342,7 @@ Remove the DIRECTORY(ies), if they are empty.") nil)) (put 'eshell/rmdir 'eshell-no-numeric-conversions t) +(put 'eshell/rmdir 'eshell-filename-arguments t) (defvar no-dereference) @@ -524,6 +527,7 @@ Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY. eshell-mv-overwrite-files)))) (put 'eshell/mv 'eshell-no-numeric-conversions t) +(put 'eshell/mv 'eshell-filename-arguments t) (defun eshell/cp (&rest args) "Implementation of cp in Lisp." @@ -561,6 +565,7 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.") eshell-cp-overwrite-files preserve))) (put 'eshell/cp 'eshell-no-numeric-conversions t) +(put 'eshell/cp 'eshell-filename-arguments t) (defun eshell/ln (&rest args) "Implementation of ln in Lisp." @@ -593,6 +598,7 @@ with `--symbolic'. When creating hard links, each TARGET must exist.") eshell-ln-overwrite-files)))) (put 'eshell/ln 'eshell-no-numeric-conversions t) +(put 'eshell/ln 'eshell-filename-arguments t) (defun eshell/cat (&rest args) "Implementation of cat in Lisp. @@ -645,6 +651,7 @@ Concatenate FILE(s), or standard input, to standard output.") (setq eshell-ensure-newline-p nil)))) (put 'eshell/cat 'eshell-no-numeric-conversions t) +(put 'eshell/cat 'eshell-filename-arguments t) ;; special front-end functions for compilation-mode buffers @@ -927,6 +934,8 @@ Summarize disk usage of each FILE, recursively for directories.") (eshell-print (concat (eshell-du-size-string size) "total\n")))))))) +(put 'eshell/du 'eshell-filename-arguments t) + (defvar eshell-time-start nil) (defun eshell-show-elapsed-time () @@ -1029,6 +1038,7 @@ Show wall-clock time elapsed during execution of COMMAND.") nil) (put 'eshell/diff 'eshell-no-numeric-conversions t) +(put 'eshell/diff 'eshell-filename-arguments t) (defvar locate-history-list) diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 61c0ebc71d0..92cac612d4c 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -1304,27 +1304,36 @@ messages, and errors." "Insert Lisp OBJECT, using ARGS if a function." (catch 'eshell-external ; deferred to an external command (let* ((eshell-ensure-newline-p (eshell-interactive-output-p)) - (result - (if (functionp object) - (progn - (setq eshell-last-arguments args - eshell-last-command-name - (concat "#")) - ;; if any of the arguments are flagged as numbers - ;; waiting for conversion, convert them now - (unless (get object 'eshell-no-numeric-conversions) - (while args - (let ((arg (car args))) - (if (and (stringp arg) - (> (length arg) 0) - (not (text-property-not-all - 0 (length arg) 'number t arg))) - (setcar args (string-to-number arg)))) - (setq args (cdr args)))) - (eshell-apply object eshell-last-arguments)) - (setq eshell-last-arguments args - eshell-last-command-name "#") - (eshell-eval object)))) + (result + (if (functionp object) + (progn + (setq eshell-last-arguments args + eshell-last-command-name + (concat "#")) + (let ((numeric (not (get object + 'eshell-no-numeric-conversions))) + (fname-args (get object 'eshell-filename-arguments))) + (when (or numeric fname-args) + (while args + (let ((arg (car args))) + (cond ((and numeric (stringp arg) (> (length arg) 0) + (text-property-any 0 (length arg) + 'number t arg)) + ;; If any of the arguments are + ;; flagged as numbers waiting for + ;; conversion, convert them now. + (setcar args (string-to-number arg))) + ((and fname-args (stringp arg) + (string-equal arg "~")) + ;; If any of the arguments match "~", + ;; prepend "./" to treat it as a + ;; regular file name. + (setcar args (concat "./" arg))))) + (setq args (cdr args))))) + (eshell-apply object eshell-last-arguments)) + (setq eshell-last-arguments args + eshell-last-command-name "#") + (eshell-eval object)))) (if (and eshell-ensure-newline-p (save-excursion (goto-char eshell-last-output-end) diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el index 1bfab23c220..fdb77d32265 100644 --- a/lisp/eshell/esh-ext.el +++ b/lisp/eshell/esh-ext.el @@ -259,6 +259,7 @@ Adds the given PATH to $PATH.") (eshell-printn dir))))) (put 'eshell/addpath 'eshell-no-numeric-conversions t) +(put 'eshell/addpath 'eshell-filename-arguments t) (defun eshell-script-interpreter (file) "Extract the script to run from FILE, if it has #! in it. From 2b70b54739a8a422aff85f0183fb69eb339c35d4 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Thu, 15 Feb 2018 09:09:50 +0900 Subject: [PATCH 09/11] Prevent line-mode term from showing user passwords For buffers whose mode derive from comint-mode, the user password is read from the minibuffer and it's hidden. A buffer in term-mode and line submode, instead shows the passwords. Make buffers in line term-mode to hide passwords too (Bug#30190). * lisp/term.el (term-send-invisible): Prefer the more robust `read-passwd' instead of `term-read-noecho'. (term-watch-for-password-prompt): New function. (term-emulate-terminal): Call it each time we receive non-escape sequence output. Co-authored-by: Noam Postavsky --- lisp/term.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lisp/term.el b/lisp/term.el index b7f5b0e7f20..ae451e94bd6 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -347,6 +347,7 @@ (eval-when-compile (require 'cl-lib)) (require 'ring) (require 'ehelp) +(require 'comint) ; Password regexp. (declare-function ring-empty-p "ring" (ring)) (declare-function ring-ref "ring" (ring index)) @@ -2283,12 +2284,10 @@ applications." (defun term-send-invisible (str &optional proc) "Read a string without echoing. Then send it to the process running in the current buffer. A new-line -is additionally sent. String is not saved on term input history list. -Security bug: your string can still be temporarily recovered with -\\[view-lossage]." +is additionally sent. String is not saved on term input history list." (interactive "P") ; Defeat snooping via C-x esc (when (not (stringp str)) - (setq str (term-read-noecho "Non-echoed text: " t))) + (setq str (read-passwd "Non-echoed text: "))) (when (not proc) (setq proc (get-buffer-process (current-buffer)))) (if (not proc) (error "Current buffer has no process") @@ -2297,6 +2296,16 @@ Security bug: your string can still be temporarily recovered with (term-send-string proc str) (term-send-string proc "\n"))) +;; TODO: Maybe combine this with `comint-watch-for-password-prompt'. +(defun term-watch-for-password-prompt (string) + "Prompt in the minibuffer for password and send without echoing. +Checks if STRING contains a password prompt as defined by +`comint-password-prompt-regexp'." + (when (term-in-line-mode) + (when (let ((case-fold-search t)) + (string-match comint-password-prompt-regexp string)) + (term-send-invisible (read-passwd string))))) + ;;; Low-level process communication @@ -3152,6 +3161,8 @@ See `term-prompt-regexp'." (term-handle-deferred-scroll)) (set-marker (process-mark proc) (point)) + (when (stringp decoded-substring) + (term-watch-for-password-prompt decoded-substring)) (when save-point (goto-char save-point) (set-marker save-point nil)) From 1208aaa9893700292693a6b85ae7d1abdb0460ef Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 22 Jul 2018 16:15:43 -0400 Subject: [PATCH 10/11] Omit keymap from subword-mode docstring (Bug#32212) * lisp/progmodes/subword.el (subword-mode): Remove listing of subword-mode-map bindings, since it is empty as of 2014-03-23 "Merge capitalized-words-mode and subword-mode". --- lisp/progmodes/subword.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el index cbaa273a7a4..c09ba37c859 100644 --- a/lisp/progmodes/subword.el +++ b/lisp/progmodes/subword.el @@ -113,9 +113,7 @@ called a `subword'. Here are some examples: NSGraphicsContext => \"NS\", \"Graphics\" and \"Context\" This mode changes the definition of a word so that word commands -treat nomenclature boundaries as word boundaries. - -\\{subword-mode-map}" +treat nomenclature boundaries as word boundaries." :lighter " ," (when subword-mode (superword-mode -1)) (subword-setup-buffer)) From f64c2774e96c755a5fddcbc49db65dcc3fcb9323 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Mon, 23 Jul 2018 21:49:00 -0400 Subject: [PATCH 11/11] Let bookmark-jump override window-point (Bug#31751) * lisp/bookmark.el (bookmark-jump): Use pop-to-buffer-same-window instead of switch-to-buffer, the latter obeys switch-to-buffer-preserve-window-point and so loses the bookmark's point. --- lisp/bookmark.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 1a2ec1eb667..9299ab8850f 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1102,7 +1102,7 @@ BOOKMARK is usually a bookmark name (a string). It can also be a bookmark record, but this is usually only done by programmatic callers. If DISPLAY-FUNC is non-nil, it is a function to invoke to display the -bookmark. It defaults to `switch-to-buffer'. A typical value for +bookmark. It defaults to `pop-to-buffer-same-window'. A typical value for DISPLAY-FUNC would be `switch-to-buffer-other-window'." (interactive (list (bookmark-completing-read "Jump to bookmark" @@ -1110,7 +1110,7 @@ DISPLAY-FUNC would be `switch-to-buffer-other-window'." (unless bookmark (error "No bookmark specified")) (bookmark-maybe-historicize-string bookmark) - (bookmark--jump-via bookmark (or display-func 'switch-to-buffer))) + (bookmark--jump-via bookmark (or display-func 'pop-to-buffer-same-window))) ;;;###autoload