0

windows 10, emacs 26.1

I want to set I-search case sensitive mode. Before:

enter image description here

M-x isearch-toggle-case-fold

after:

enter image description here

Now it's search in case sensitive mode. Nice.

But why it select text?

P.S. If I start by emacs -Q it's same result:

Here steps of reproduce:

  1. Start emacs -Q
  2. Input some text
  3. M-x isearch-toggle-case-fold
  4. C-s (isearch) HELLO
  5. C-g
  6. M-x isearch-toggle-case-fold
  7. and see result on step4.jpg

enter image description here enter image description here enter image description here enter image description here

  • You've probably had your mark set before you've started to search. – DoMiNeLa10 Jul 30 at 13:17
  • @DoMiNeLa10 No, I'm not mark any text – a_subscriber Jul 30 at 13:40
  • Do you see this with emacs -Q? If not, bisect your init file to find the culprit. – Drew Jul 30 at 15:19
  • @Drew Yes, I updated my post – a_subscriber Jul 30 at 15:39
  • 1
    Sounds like a bug. Toggling case-sensitivity should not activate the region. Please consider filing a bug report, M-x report-emacs-bug, with a step-by-step recipe to reproduce the problem, starting with emacs -Q. – Drew Jul 30 at 19:21
1

Note, that I assume that isearch-toggle-case-fold is not supposed to be run outside of isearch-mode.

Cause of the effect: The highlighting belongs to the overlay stored in variable isearch-overlay generated or moved by function isearch-highlight.

isearch-highlight is called in isearch-update which is called in isearch-toggle-case-fold generated by isearch-define-mode-toggle.

The reason why isearch-update is used in isearch-define-mode-toggle is pretty clear. The change of the case sensitivity should have immediate effect.

But that only makes sense when we are in isearch-mode.

A conceptual fix would be:

(defun isearch-update-only-in-isearch-mode (fun &rest args)
  (when isearch-mode
    (apply fun args)))

(advice-add 'isearch-update :around #'isearch-update-only-in-isearch-mode)

But, maybe isearch-toggle-case-fold should actually throw an error when called outside of isearch-mode.

  • it looks like a bug in Emacs – a_subscriber Aug 2 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.