[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: RFC: [PATCH] isearch enhancements: symbol mode; syntactic filtering

From: Drew Adams
Subject: RE: RFC: [PATCH] isearch enhancements: symbol mode; syntactic filtering
Date: Thu, 7 Jul 2011 20:23:58 -0700

> > - Case sensitivity is now displayed alongside other isearch 
> >   settings in the isearch prompt.
> This is a good change as well, but one possible problem is that
> its message string "case-insensitive " (17 characters) is too long
> for the isearch prompt.

In Isearch+, I just change the case of the minor-mode lighter in the mode line
to indicate case-sensitivity: `Isearch' (case-sensitive) vs `ISEARCH'
(insensitive).  (I do the same thing in Icicles, for completion.)

That adds no chars to either the prompt or the minor-mode lighter, and I find it
is sufficiently noticeable (and always present during Isearch).

This is all that's needed:

1. Add this call to `isearch-toggle-case-fold':

2. Add this definition (or equivalent):

(defun isearch-highlight-lighter ()
  "Update minor-mode mode-line lighter to reflect case sensitivity."
  (let ((case-fold-search  isearch-case-fold-search))
    (when (and (eq case-fold-search t) search-upper-case)
      (setq case-fold-search
            (isearch-no-upper-case-p isearch-string isearch-regexp)))
    (setq minor-mode-alist
          (delete '(isearch-mode " ISEARCH") minor-mode-alist)
          (delete '(isearch-mode " Isearch") minor-mode-alist))
     `(isearch-mode ,(if case-fold-search " ISEARCH" " Isearch"))))
  (condition-case nil (redisplay t) (error nil)))

3. (add-hook 'isearch-update-post-hook 'isearch-highlight-lighter)

For the Emacs source code you would not need to use the hook (#3).
You would just add the lighter change to function `isearch-update'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]