Isearch-prompt-proposal

The goal of this proposal is to help new users discover some (or all) of the options and keys available in isearch. Most editors nowadays have some of the options supported by isearch (regexp seaching and full-match, for instance), so many users have come to expect this. As such, it is important we show people that this (and much more) functionality exists, so they don’t come out thinking isearch is featureless.

This proposal tries to expose these options without being intrusive.

The proposal

The idea is just to add a help reminder at the right-edge of the echo area.

IsearchReminder

To use this is in your session, evaluate the following code:

(defcustom isearch-help-reminder "          [F1 m] Help"
  "Reminder shown at the right edge of the search prompt.
Pad it with spaces to the left to ensure it is only displayed if
there is plenty of empty room in the prompt."
  :type 'string
  :version "25.1")

(defun isearch-message (&optional c-q-hack ellipsis)
  ;; Generate and print the message string.
  (let ((cursor-in-echo-area ellipsis)
	(m isearch-message)
	(fail-pos (isearch-fail-pos t)))
    ;; Highlight failed part
    (when fail-pos
      (setq m (copy-sequence m))
      (add-text-properties fail-pos (length m) '(face isearch-fail) m)
      ;; Highlight failed trailing whitespace
      (when (string-match " +$" m)
	(add-text-properties (match-beginning 0) (match-end 0)
			     '(face trailing-whitespace) m)))
    (setq m (concat
	     (isearch-message-prefix ellipsis isearch-nonincremental)
	     m
	     (isearch-message-suffix c-q-hack)))
    (let ((padding-needed (when (and isearch-help-reminder
                                     (not c-q-hack))
                            (- (window-width (minibuffer-window))
                               1
                               (string-width (replace-regexp-in-string "\n" ".." m))
                               (string-width isearch-help-reminder)))))
      (when (and padding-needed (>= padding-needed 0))
        (setq m (concat m (make-string padding-needed ?\s)
                        (propertize isearch-help-reminder 'face 'minibuffer-prompt)))))
    (if c-q-hack m (let ((message-log-max nil)) (message "%s" m)))))

Further considerations

There are a couple more future improvements under consideration (not part of the actual proposal for now).