all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* highlight failed part of isearch input
@ 2007-07-10  3:03 Drew Adams
  2007-07-10 13:21 ` Juri Linkov
                   ` (3 more replies)
  0 siblings, 4 replies; 61+ messages in thread
From: Drew Adams @ 2007-07-10  3:03 UTC (permalink / raw)
  To: Emacs-Devel

I find that this minor tweak to `isearch-message' helps a good deal when
using Isearch. It highlights, within your Isearch input, the part that fails
to match.

(defface isearch-fail '((t (:foreground "Black" :background "Plum")))
  "Face for highlighting failed part in Isearch echo-area message."
  :group 'isearch)

(defun isearch-message (&optional c-q-hack ellipsis)
  ;; Generate and print the message string.
  (let ((cursor-in-echo-area ellipsis)
        (cmds isearch-cmds)
        succ-msg m)
    (while (not (isearch-success-state (car cmds))) (pop cmds))
    (setq succ-msg (and cmds (isearch-message-state (car cmds))))
    (setq m (concat
             (isearch-message-prefix c-q-hack ellipsis
isearch-nonincremental)
             succ-msg
             (and (not isearch-success)
                  (string-match succ-msg isearch-message)
                  (not (string= succ-msg isearch-message))
                  (propertize (substring isearch-message (match-end 0))
                              'face 'isearch-fail))))
    (when (string-match " +$" m)
      (propertize (substring m (match-beginning 0)) 'face
'trailing-whitespace))
    (setq m (concat m (isearch-message-suffix c-q-hack ellipsis)))
    (if c-q-hack m (let ((message-log-max nil)) (message "%s" m)))))

--

Here is the original `isearch-message', for reference:

(defun isearch-message (&optional c-q-hack ellipsis)
  ;; Generate and print the message string.
  (let ((cursor-in-echo-area ellipsis)
	(m (concat
	    (isearch-message-prefix c-q-hack ellipsis isearch-nonincremental)
	    (if (and (not isearch-success)
                     (string-match " +$" isearch-message))
                (concat
                 (substring isearch-message 0 (match-beginning 0))
                 (propertize (substring isearch-message (match-beginning 0))
                             'face 'trailing-whitespace))
              isearch-message)
	    (isearch-message-suffix c-q-hack ellipsis)
	    )))
    (if c-q-hack
	m
      (let ((message-log-max nil))
	(message "%s" m)))))

^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2008-02-25  7:59 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-10  3:03 highlight failed part of isearch input Drew Adams
2007-07-10 13:21 ` Juri Linkov
2007-07-10 14:19   ` Drew Adams
2007-07-10 23:22     ` Juri Linkov
2007-07-11  0:16       ` Drew Adams
2007-07-11  3:57         ` Stefan Monnier
2007-07-11  5:27           ` David Kastrup
2007-07-11  6:18             ` Stefan Monnier
2007-07-11  6:26               ` Miles Bader
2007-07-11  7:14                 ` Stefan Monnier
2007-07-11  7:15                 ` David Kastrup
2007-07-11 16:10           ` Drew Adams
2007-07-11 19:20             ` Robert J. Chassell
2007-07-11 21:14               ` Drew Adams
2007-07-11 23:17                 ` Juri Linkov
2007-07-12 13:01                 ` Robert J. Chassell
     [not found]                 ` <E1I968h-0002xA-VO@fencepost.gnu.org>
2007-07-12 23:16                   ` Juri Linkov
2007-07-13 18:38                     ` Richard Stallman
2007-07-14 23:05                       ` Juri Linkov
2007-07-15 22:53                         ` Richard Stallman
2007-07-23  4:27                         ` Richard Stallman
2007-07-14 23:07                       ` Juri Linkov
2007-07-15 22:53                         ` Richard Stallman
2007-07-12 21:24             ` Richard Stallman
2007-07-11 21:03       ` Richard Stallman
2007-07-11 21:15         ` Drew Adams
2007-07-10 14:07 ` Masatake YAMATO
2007-07-10 14:37   ` ding susceptibility (was: highlight failed part of isearch input) Drew Adams
2007-07-10 22:01   ` highlight failed part of isearch input Richard Stallman
2007-07-10 14:32 ` Stefan Monnier
2007-07-10 22:01 ` Richard Stallman
2007-07-22 23:40   ` Drew Adams
2007-07-23 18:06     ` Richard Stallman
2007-07-23 21:29       ` Juri Linkov
2007-07-23 22:37         ` Drew Adams
2007-07-23 23:33           ` Juri Linkov
2007-07-24  2:22             ` Drew Adams
2007-07-24 22:16               ` Richard Stallman
2007-07-24 16:45         ` Richard Stallman
2007-07-24 17:25           ` Drew Adams
2008-02-11 23:31       ` Drew Adams
2008-02-12  0:18         ` Juri Linkov
2008-02-12  0:36           ` Drew Adams
2008-02-12  0:54             ` Bastien
2008-02-16 19:18               ` Juri Linkov
2008-02-23 19:47                 ` Juri Linkov
2008-02-23 21:27                   ` Drew Adams
2008-02-23 21:55                     ` Juri Linkov
2008-02-23 23:12                       ` Drew Adams
2008-02-24 17:32                         ` Juri Linkov
2008-02-24 23:15                           ` Drew Adams
2008-02-25  0:01                             ` Juri Linkov
2008-02-25  7:59                             ` Bastien
2008-02-24 23:31                           ` Dan Nicolaescu
2008-02-24 23:47                             ` Drew Adams
2008-02-24 23:58                               ` Dan Nicolaescu
2008-02-25  0:00                               ` Jason Rumney
2008-02-25  0:12                                 ` Drew Adams
2008-02-25  0:17                                 ` Juri Linkov
2008-02-24 17:29                   ` Juri Linkov
2008-02-24 23:05                     ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.