]> git.eshelyaron.com Git - emacs.git/commitdiff
Drop 'help-form' and associated cruft.
authorEshel Yaron <me@eshelyaron.com>
Sun, 13 Apr 2025 06:49:47 +0000 (08:49 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 13 Apr 2025 06:49:47 +0000 (08:49 +0200)
13 files changed:
doc/lispref/help.texi
doc/lispref/minibuf.texi
lisp/buff-menu.el
lisp/dired-aux.el
lisp/dired.el
lisp/files.el
lisp/help.el
lisp/minibuffer.el
lisp/net/tramp-cmds.el
lisp/progmodes/elisp-mode.el
lisp/progmodes/octave.el
lisp/simple.el
src/keyboard.c

index 3354094487d30fac2380622e8a468be646b446cd..8662f658e2e97ccfd151f7fcff0e4fd2f03eafc7 100644 (file)
@@ -672,18 +672,9 @@ follows:
 
 @defopt help-char
 The value of this variable is the help character---the character that
-Emacs recognizes as meaning Help.  By default, its value is 8, which
-stands for @kbd{C-h}.  When Emacs reads this character, if
-@code{help-form} is a non-@code{nil} Lisp expression, it evaluates that
-expression, and displays the result in a window if it is a string.
-
-Usually the value of @code{help-form} is @code{nil}.  Then the
-help character has no special meaning at the level of command input, and
-it becomes part of a key sequence in the normal way.  The standard key
-binding of @kbd{C-h} is a prefix key for several general-purpose help
-features.
-
-The help character is special after prefix keys, too.  If it has no
+Emacs recognizes as meaning Help.
+
+The help character is special after prefix keys.  If it has no
 binding as a subcommand of the prefix key, it runs
 @code{describe-prefix-bindings}, which displays a list of all the
 subcommands of the prefix key.
@@ -695,20 +686,6 @@ alternative help characters.  These events are handled just like the
 event specified by @code{help-char}.
 @end defopt
 
-@defvar help-form
-If this variable is non-@code{nil}, its value is a form to evaluate
-whenever the character @code{help-char} is read.  If evaluating the form
-produces a string, that string is displayed.
-
-A command that calls @code{read-event}, @code{read-char-choice},
-@code{read-char}, @code{read-char-from-minibuffer}, or
-@code{y-or-n-p} probably should bind @code{help-form} to a
-non-@code{nil} expression while it does input.  (The time when you
-should not do this is when @kbd{C-h} has some other meaning.)
-Evaluating this expression should result in a string that explains
-what the input is for and how to enter it properly.
-@end defvar
-
 @defvar prefix-help-command
 This variable holds a function to print help for a prefix key.  The
 function is called when the user types a prefix key followed by the help
index 3447be2fe29533de5bb320e1e6cfc5a17a42c9be..ba811c2e3d459a2fcdab6155815e2e26706a382f 100644 (file)
@@ -2296,11 +2296,6 @@ special responses @code{recenter}, @code{scroll-up},
 @kbd{C-v}, @kbd{M-v}, @kbd{C-M-v} and @kbd{C-M-S-v} in
 @code{query-replace-map}), this function performs the specified window
 recentering or scrolling operation, and poses the question again.
-
-If you bind @code{help-form} (@pxref{Help Functions}) to
-a non-@code{nil} value while calling @code{y-or-n-p}, then pressing
-@code{help-char} causes it to evaluate @code{help-form} and display
-the result.  @code{help-char} is automatically added to @var{prompt}.
 @end defun
 
 @defun y-or-n-p-with-timeout prompt seconds default
@@ -2532,11 +2527,6 @@ character.  Optionally, it ignores any input that is not a member of
 @var{chars}, a list of accepted characters.  The @var{history}
 argument specifies the history list symbol to use; if it is omitted or
 @code{nil}, this function doesn't use the history.
-
-If you bind @code{help-form} (@pxref{Help Functions}) to
-a non-@code{nil} value while calling @code{read-char-from-minibuffer},
-then pressing @code{help-char} causes it to evaluate @code{help-form}
-and display the result.
 @end defun
 
 @node Reading a Password
index c8185947b526ad55718b229d47032eac97320e6e..71205b6bbb1a3558162fd180a0bf6d5d9a4bab4c 100644 (file)
@@ -114,6 +114,14 @@ then the buffer will be displayed in the buffer list.")
 (defvar-local Buffer-menu-buffer-list nil
   "The current list of buffers or function to return buffers.")
 
+(defcustom Buffer-menu-human-readable-sizes nil
+  "If non-nil, show buffer sizes in human-readable format.
+That means to use `file-size-human-readable' (which see) to format the
+buffer sizes in the buffer size column."
+  :type 'boolean
+  :group 'Buffer-menu
+  :version "31.1")
+
 (defvar-keymap Buffer-menu-mode-map
   :doc "Local keymap for `Buffer-menu-mode' buffers."
   :parent tabulated-list-mode-map
index c590b905ded6ee77b97aae81b3aeadb75c479339..1c5b9e0336bc46cf91944d02b8478fa6d8c12449 100644 (file)
@@ -3070,20 +3070,11 @@ Also see `dired-do-revert-buffer'."
   ;; Optional arg MARKER-CHAR as in dired-create-files.
   (let* ((fn-list (dired-get-marked-files nil arg))
         (operation-prompt (concat operation " `%s' to `%s'?"))
-         (rename-regexp-help-form (format-message
-                                   (substitute-command-keys "\
-Type \\`SPC' or \\`y' to %s one match, \\`DEL' or \\`n' to skip to next,
-\\`!' to %s all remaining matches with no more questions.")
-                                   (downcase operation)
-                                   (downcase operation)))
         (regexp-name-constructor
          ;; Function to construct new filename using REGEXP and NEWNAME:
          (if whole-name                ; easy (but rare) case
              (lambda (from)
-               (let ((to (dired-string-replace-match regexp from newname))
-                     ;; must bind help-form directly around call to
-                     ;; dired-query
-                     (help-form rename-regexp-help-form))
+               (let ((to (dired-string-replace-match regexp from newname)))
                  (if to
                      (and (dired-query 'rename-regexp-query
                                        operation-prompt
@@ -3098,8 +3089,7 @@ Type \\`SPC' or \\`y' to %s one match, \\`DEL' or \\`n' to skip to next,
                           regexp (file-name-nondirectory from) newname))
                     (to (and new       ; nil means there was no match
                              (expand-file-name new
-                                               (file-name-directory from))))
-                    (help-form rename-regexp-help-form))
+                                               (file-name-directory from)))))
                (if to
                    (and (dired-query 'rename-regexp-query
                                      operation-prompt
@@ -3206,16 +3196,10 @@ for more info."
        (let ((to (concat (file-name-directory from)
                         (funcall basename-constructor
                                  (file-name-nondirectory from)))))
-         (and (let ((help-form (format-message
-                                (substitute-command-keys "\
-Type \\`SPC' or \\`y' to %s one file, \\`DEL' or \\`n' to skip to next,
-\\`!' to %s all remaining matches with no more questions.")
-                                (downcase operation)
-                                (downcase operation))))
-               (dired-query 'rename-non-directory-query
-                            (concat operation " `%s' to `%s'")
-                            (dired-make-relative from)
-                            (dired-make-relative to)))
+         (and (dired-query 'rename-non-directory-query
+                          (concat operation " `%s' to `%s'")
+                          (dired-make-relative from)
+                          (dired-make-relative to))
              to)))
      dired-keep-marker-rename)))
 
index 2cb81f0bd5cd64e80efcf7baaf8dcc028cab9659..3b1013ff13f7afe26fbd057b4472c2cafb2474da 100644 (file)
@@ -4772,10 +4772,7 @@ Type \\[help-command] at that time for help."
     (let* ((count 0)
           (inhibit-read-only t) case-fold-search
            dired-unmark-all-files-query
-          (string (format "\n%c" mark))
-           (help-form (substitute-command-keys "\
-Type \\`SPC' or \\`y' to unmark one file, \\`DEL' or \\`n' to skip to next,
-\\`!' to unmark all remaining files with no more questions.")))
+          (string (format "\n%c" mark)))
       (goto-char (point-min))
       (while (if (eq mark ?\r)
                 (re-search-forward dired-re-mark nil t)
index b44eeb0c56c9cb280c7af0dfddabe16a635f62e4..5006064d4770dbd988319eee65d46123a9ea15e9 100644 (file)
@@ -2591,7 +2591,7 @@ the various files."
               find-file-suppress-same-file-warnings
               (string-equal filename (buffer-file-name other))
               (files--message "%s and %s are the same file"
-                         filename (buffer-file-name other)))
+                              filename (buffer-file-name other)))
           ;; Optionally also find that buffer.
           (if (or find-file-existing-other-name find-file-visit-truename)
               (setq buf other)))
@@ -2676,23 +2676,10 @@ the various files."
                            ;; hexl-mode or image-mode.
                            (memq major-mode '(hexl-mode image-mode)))
                  (if (buffer-modified-p)
-                     (if (let ((help-form
-                                (format-message
-                                 (if rawfile "\
-The file %s is already visited normally,
-and you have edited the buffer.  Now you have asked to visit it literally,
-meaning no coding system handling, format conversion, or local variables.
-Emacs can visit a file in only one way at a time."
-                                   "\
-The file %s is already visited literally,
-meaning no coding system handling, format conversion, or local variables.
-You have edited the buffer.  Now you have asked to visit the file normally,
-but Emacs can visit a file in only one way at a time.")
-                                 (file-name-nondirectory filename))))
-                           (y-or-n-p
-                            (if rawfile "\
+                     (if (y-or-n-p
+                          (if rawfile "\
 Do you want to save the file, and visit it literally instead? " "\
-Do you want to save the file, and visit it normally instead? ")))
+Do you want to save the file, and visit it normally instead? "))
                          (progn
                            (save-buffer)
                            (find-file-noselect-1 buf filename nowarn
@@ -2705,23 +2692,10 @@ Do you want to discard your changes, and visit the file normally now? "))
                                                  rawfile truename number)
                          (error (if rawfile "File already visited non-literally"
                                   "File already visited literally"))))
-                   (if (let ((help-form
-                              (format-message
-                               (if rawfile "\
-The file %s is already visited normally.
-You have asked to visit it literally,
-meaning no coding system decoding, format conversion, or local variables.
-But Emacs can visit a file in only one way at a time."
-                                 "\
-The file %s is already visited literally,
-meaning no coding system decoding, format conversion, or local variables.
-You have asked to visit it normally,
-but Emacs can visit a file in only one way at a time.")
-                               (file-name-nondirectory filename))))
-                         (y-or-n-p
-                          (if rawfile "\
+                   (if (y-or-n-p
+                        (if rawfile "\
 Do you want to revisit the file literally now? " "\
-Do you want to revisit the file normally now? ")))
+Do you want to revisit the file normally now? "))
                        (find-file-noselect-1 buf filename nowarn
                                              rawfile truename number)
                      (error (if rawfile "File already visited non-literally"
index 34c77c6a237c9e494d7d8bdb9bd1fb0a9dfa647c..09081af614835eaeff93d6deeaccc6aca1c62c74 100644 (file)
@@ -2305,14 +2305,8 @@ The `temp-buffer-window-setup-hook' hook is called."
         ;; generated, since `temp-buffer-resize-mode' may be enabled.
         (help-window-setup (temp-buffer-window-show (current-buffer)))))))
 
-;; Called from C, on encountering `help-char' when reading a char.
-;; Don't print to *Help*; that would clobber Help history.
-(defun help-form-show ()
-  "Display the output of a non-nil `help-form'."
-  (let ((msg (eval help-form t)))
-    (if (stringp msg)
-       (with-output-to-temp-buffer " *Char Help*"
-         (princ msg)))))
+(defvar help-form nil "Unused obsolete variable.")
+(make-obsolete-variable 'help-form nil "31.1")
 
 (defun help--append-keystrokes-help (str)
   (let* ((keys (this-single-command-keys))
index cfbf3bf93c35ef5fcfb403df89f2b9dc929e8b7c..b6ff6c43edef391858221048fae6f9b0cbeb06ff 100644 (file)
@@ -6412,7 +6412,7 @@ interactions is customizable via `minibuffer-regexp-prompts'."
 (make-obsolete-variable 'completion-regexp-list nil "30.1")
 
 (defvar minibuffer-help-form nil "Unused obsolete variable.")
-(make-obsolete-variable 'minibuffer-help-form 'help-form "30.1")
+(make-obsolete-variable 'minibuffer-help-form nil "31.1")
 
 (defvar minibuffer-allow-text-properties nil "Unused obsolete variable.")
 (make-obsolete-variable 'minibuffer-allow-text-properties nil "30.1")
index e59a614d935fca24e5ffb11eabec213cb473596b..5afe31cb5e60a7c242bd39697e351bcb4f1c63e8 100644 (file)
@@ -533,13 +533,7 @@ The remote connection identified by SOURCE is flushed by
   ;; Rename visited file names of source buffers.
   (save-window-excursion
     (save-current-buffer
-      (let ((help-form "\
-Type SPC or `y' to set visited file name,
-DEL or `n' to skip to next,
-`e' to edit the visited file name,
-ESC or `q' to quit without changing further buffers,
-`!' to change all remaining buffers with no more questions.")
-           (query-choices '(?y ?\s ?n ?\177 ?! ?e ?q ?\e))
+      (let ((query-choices '(?y ?\s ?n ?\177 ?! ?e ?q ?\e))
            (query (unless tramp-confirm-rename-file-names ?!))
            changed-buffers)
        (dolist (buffer (tramp-list-remote-buffers))
index 7cb079e75becd9c89d33c43a8774669153c6ef5d..44be5acd8c4d3a69b07853fe5c38686a66e57f8a 100644 (file)
@@ -2678,11 +2678,11 @@ of TARGET."
          (puthash file (cons modtime
                              (with-work-buffer
                                (insert-file-contents file)
-                               (elisp-symbols-index-1)))
+                               (elisp-symbols-index-1 file)))
                   elisp-symbols-index-cache)
        cached))))
 
-(defun elisp-symbols-index-1 ()
+(defun elisp-symbols-index-1 (file)
   (let (all)
     (save-excursion
       (goto-char (point-min))
@@ -2694,7 +2694,7 @@ of TARGET."
                 (list type beg len (buffer-substring beg (+ beg len)))
                 all))))
         (end-of-file (nreverse all))
-        (error (message "Encountered error while scanning %s: %S" buffer-file-name e) nil)))))
+        (error (message "Encountered error while scanning %s: %S" file e) nil)))))
 
 (defun elisp-eval-1 (vars form)
   (cond
index 85cdac466267ffebdc5532afc4f1b08ebce6ad42..7042e1af82b0238b9faf02c8b304a38555a1e1bc 100644 (file)
@@ -1118,13 +1118,8 @@ See Info node `(octave)Function Files'."
         (let* ((func (buffer-substring name-start name-end))
                (file (file-name-sans-extension
                       (file-name-nondirectory buffer-file-name)))
-               (help-form (format-message "\
-a: Use function name `%s'
-b: Use file name `%s'
-q: Don't fix\n" func file))
                (c (unless (equal file func)
                     (save-window-excursion
-                      (help-form-show)
                       (read-char-choice
                        "Which name to use? (a/b/q) " '(?a ?b ?q))))))
           (pcase c
index fd400d3549601775f3dc8f857c949bd88301e60a..c49cf3ea2dadf0d243399112f8d559a4a73bc6e4 100644 (file)
@@ -978,12 +978,7 @@ for numeric input."
            ;; Don't let C-h or other help chars get the help
            ;; message--only help function keys.  See bug#16617.
            (help-char nil)
-           (help-event-list help-events)
-           (help-form
-            "Type the special character you want to use,
-or the octal character code.
-RET terminates the character code and is discarded;
-any other non-digit terminates the character code and is then used as input."))
+           (help-event-list help-events))
        (setq char (read-event (and prompt (format "%s-" prompt)) t))
        (if inhibit-quit (setq quit-flag nil)))
       ;; Translate TAB key into control-I ASCII character, and so on.
@@ -4647,22 +4642,10 @@ impose the use of a shell (with its need to quote arguments)."
                                   output-buffer nil error-buffer))))))
 
 (defun shell-command--same-buffer-confirm (action)
-  (let ((help-form
-         (format
-          "There's a command already running in the default buffer,
-so we can't start a new one in the same one.
-
-Answering \"yes\" will %s.
-
-Answering \"no\" will exit without doing anything, and won't
-start the new command.
-
-Also see the `async-shell-command-buffer' variable."
-          (downcase action))))
-    (unless (yes-or-no-p
-             (format "A command is running in the default buffer.  %s? "
-                     action))
-      (user-error "Shell command in progress"))))
+  (unless (yes-or-no-p
+           (format "A command is running in the default buffer.  %s? "
+                   action))
+    (user-error "Shell command in progress")))
 
 (defun file-user-uid ()
   "Return the connection-local effective uid.
index 89e7c4cac0365ac34d7c3923c0484cf97d1ed23b..790928246036bafb928d6ea555054a85d6406434 100644 (file)
@@ -2280,16 +2280,6 @@ static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu,
                                         struct timespec *end_time);
 static void record_char (Lisp_Object c);
 
-static Lisp_Object help_form_saved_window_configs;
-static void
-read_char_help_form_unwind (void)
-{
-  Lisp_Object window_config = XCAR (help_form_saved_window_configs);
-  help_form_saved_window_configs = XCDR (help_form_saved_window_configs);
-  if (!NILP (window_config))
-    Fset_window_configuration (window_config, Qnil, Qnil);
-}
-
 #define STOP_POLLING                                   \
 do { if (! polling_stopped_here) stop_polling ();      \
        polling_stopped_here = true; } while (0)
@@ -3346,40 +3336,6 @@ read_char (int commandflag, Lisp_Object map,
   last_input_event = c;
   num_input_events++;
 
-  /* Process the help character specially if enabled.  */
-  if (!NILP (Vhelp_form) && help_char_p (c))
-    {
-      specpdl_ref count = SPECPDL_INDEX ();
-
-      help_form_saved_window_configs
-       = Fcons (Fcurrent_window_configuration (Qnil),
-                help_form_saved_window_configs);
-      record_unwind_protect_void (read_char_help_form_unwind);
-      call0 (Qhelp_form_show);
-
-      cancel_echoing ();
-      do
-       {
-         c = read_char (0, Qnil, Qnil, 0, NULL);
-         c_volatile = c;
-         if (EVENT_HAS_PARAMETERS (c)
-             && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_click))
-           XSETCAR (help_form_saved_window_configs, Qnil);
-       }
-      while (BUFFERP (c));
-      /* Remove the help from the frame.  */
-      unbind_to (count, Qnil);
-
-      redisplay ();
-      if (BASE_EQ (c, make_fixnum (040)))
-       {
-         cancel_echoing ();
-         do
-           c_volatile = c = read_char (0, Qnil, Qnil, 0, NULL);
-         while (BUFFERP (c));
-       }
-    }
-
  exit:
   RESUME_POLLING;
   input_was_pending = input_pending;
@@ -13170,8 +13126,6 @@ syms_of_keyboard (void)
   DEFSYM (Qinput_method_exit_on_first_char, "input-method-exit-on-first-char");
   DEFSYM (Qinput_method_use_echo_area, "input-method-use-echo-area");
 
-  DEFSYM (Qhelp_form_show, "help-form-show");
-
   DEFSYM (Qhelp_key_binding, "help-key-binding");
 
   DEFSYM (Qhelp__append_keystrokes_help, "help--append-keystrokes-help");
@@ -13282,9 +13236,6 @@ syms_of_keyboard (void)
   menu_bar_items_vector = Qnil;
   staticpro (&menu_bar_items_vector);
 
-  help_form_saved_window_configs = Qnil;
-  staticpro (&help_form_saved_window_configs);
-
 #ifdef POLL_FOR_INPUT
   poll_timer_time = Qnil;
   staticpro (&poll_timer_time);
@@ -13511,9 +13462,7 @@ came from `unread-command-events' instead).  */);
               doc: /* The ERASE character as set by the user with stty.  */);
 
   DEFVAR_LISP ("help-char", Vhelp_char,
-              doc: /* Character to recognize as meaning Help.
-When it is read, do `(eval help-form)', and display result if it's a string.
-If the value of `help-form' is nil, this char can be read normally.  */);
+              doc: /* Character to recognize as meaning Help.  */);
   XSETINT (Vhelp_char, Ctl ('H'));
 
   DEFVAR_LISP ("help-event-list", Vhelp_event_list,
@@ -13521,12 +13470,6 @@ If the value of `help-form' is nil, this char can be read normally.  */);
 These work just like the value of `help-char' (see that).  */);
   Vhelp_event_list = Qnil;
 
-  DEFVAR_LISP ("help-form", Vhelp_form,
-              doc: /* Form to execute when character `help-char' is read.
-If the form returns a string, that string is displayed.
-If `help-form' is nil, the help char is not recognized.  */);
-  Vhelp_form = Qnil;
-
   DEFVAR_LISP ("prefix-help-command", Vprefix_help_command,
               doc: /* Command to run when `help-char' character follows a prefix key.
 This command is used only when there is no actual binding