From: Eshel Yaron Date: Sun, 13 Apr 2025 06:49:47 +0000 (+0200) Subject: Drop 'help-form' and associated cruft. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e0620f3b8d09ba030a5ec57b2293a62acdc69633;p=emacs.git Drop 'help-form' and associated cruft. --- diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 3354094487d..8662f658e2e 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi @@ -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 diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 3447be2fe29..ba811c2e3d4 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -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 diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index c8185947b52..71205b6bbb1 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -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 diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index c590b905ded..1c5b9e0336b 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -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))) diff --git a/lisp/dired.el b/lisp/dired.el index 2cb81f0bd5c..3b1013ff13f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -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) diff --git a/lisp/files.el b/lisp/files.el index b44eeb0c56c..5006064d477 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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" diff --git a/lisp/help.el b/lisp/help.el index 34c77c6a237..09081af6148 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -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)) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index cfbf3bf93c3..b6ff6c43ede 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -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") diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index e59a614d935..5afe31cb5e6 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -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)) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 7cb079e75be..44be5acd8c4 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -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 diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 85cdac46626..7042e1af82b 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -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 diff --git a/lisp/simple.el b/lisp/simple.el index fd400d35496..c49cf3ea2da 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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. diff --git a/src/keyboard.c b/src/keyboard.c index 89e7c4cac03..79092824603 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -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