@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.
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
@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
@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
(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
;; 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
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
(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)))
(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)
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)))
;; 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
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"
;; 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))
(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")
;; 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))
(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))
(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
(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
;; 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.
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.
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)
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;
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");
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);
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,
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