]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid recording passwords' chars
authorManuel Giraud <manuel@ledu-giraud.fr>
Tue, 14 Jun 2022 09:14:02 +0000 (11:14 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 25 Jun 2022 09:27:27 +0000 (12:27 +0300)
* lisp/cus-start.el (standard): New user custom `record-all-keys'.
* src/keyboard.c (syms_of_keyboard): Un-obsolete
`inhibit--record-char'.
* lisp/subr.el (read-passwd): Use `inhibit--record-char' to
inhibit passwords recording.

etc/NEWS
lisp/cus-start.el
lisp/subr.el
src/keyboard.c

index e3b4df227eb624143cc46bf5bec06d8693886fed..afd0725a69743791f5e56fb6af1e513f7c6bf761 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -398,6 +398,12 @@ This inhibits putting empty strings onto the kill ring.
 These options allow adjusting point and scrolling a window when
 dragging items from another program.
 
++++
+** New user option 'record-all-keys'.
+If non-nil, this option will force recording of all input keys
+including in passwords prompt (this was the previous behaviour).  It
+now defaults to NIL and inhibits recording of passwords.
+
 +++
 ** New function 'command-query'.
 This function makes its argument command prompt the user for
index d8c4b480359421ff800d5ade5dcfc8d6a1b5ac12..ca2fca4eb779a7bf53dcda64c91ba31c75dff13c 100644 (file)
@@ -398,6 +398,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
             ;;                         (const :tag " current dir" nil)
             ;;                         (directory :format "%v"))))
             (load-prefer-newer lisp boolean "24.4")
+             (record-all-keys keyboard boolean)
             ;; minibuf.c
             (minibuffer-follows-selected-frame
               minibuffer (choice (const :tag "Always" t)
index 075bfb95b7b7537c2a7b30cd21ff884f8cb7623f..b05471f0c3e28a837ce265e0872a04e8a4f3e370 100644 (file)
@@ -1883,12 +1883,6 @@ be a list of the form returned by `event-start' and `event-end'."
 (make-obsolete-variable 'load-dangerous-libraries
                         "no longer used." "27.1")
 
-(defvar inhibit--record-char nil
-  "Obsolete variable.
-This was used internally by quail.el and keyboard.c in Emacs 27.
-It does nothing in Emacs 28.")
-(make-obsolete-variable 'inhibit--record-char nil "28.1")
-
 (define-obsolete-function-alias 'compare-window-configurations
   #'window-configuration-equal-p "29.1")
 
@@ -3048,6 +3042,7 @@ by doing (clear-string STRING)."
             (use-local-map read-passwd-map)
             (setq-local inhibit-modification-hooks nil) ;bug#15501.
            (setq-local show-paren-mode nil)            ;bug#16091.
+            (setq-local inhibit--record-char t)
             (add-hook 'post-command-hook #'read-password--hide-password nil t))
         (unwind-protect
             (let ((enable-recursive-minibuffers t)
index 7fb7afca87a90a3cf7ac67264ce11b2083375902..0d52378a93e4465bc941049b36d3d98149b60f1a 100644 (file)
@@ -3320,6 +3320,11 @@ help_char_p (Lisp_Object c)
 static void
 record_char (Lisp_Object c)
 {
+  /* subr.el/read-passwd binds inhibit_record_char to avoid recording
+     passwords.  */
+  if (!record_all_keys && inhibit_record_char)
+    return;
+
   int recorded = 0;
 
   if (CONSP (c) && (EQ (XCAR (c), Qhelp_echo) || EQ (XCAR (c), Qmouse_movement)))
@@ -13026,6 +13031,19 @@ argument, which is the terminal on which the monitor configuration
 changed.  */);
   Vdisplay_monitors_changed_functions = Qnil;
 
+  DEFVAR_BOOL ("inhibit--record-char",
+              inhibit_record_char,
+              doc: /* If non-nil, don't record input events.
+This inhibits recording input events for the purposes of keyboard
+macros, dribble file, and `recent-keys'.
+Internal use only.  */);
+  inhibit_record_char = false;
+
+  DEFVAR_BOOL ("record-all-keys", record_all_keys,
+              doc: /* Non-nil means to record all typed keys.  When
+nil, only passwords' keys are not recorded.  */);
+  record_all_keys = false;
+
   pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper);
 }