From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#12986: Pressing backspace during isearch exits case-sensitive and word modes Date: Sun, 02 Jun 2013 12:49:19 +0300 Organization: JURTA Message-ID: <87obbolu5c.fsf@mail.jurta.org> References: <1354124058.21763.YahooMailClassic@web141103.mail.bf1.yahoo.com> <87a9u1jqzh.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1370166871 2866 80.91.229.3 (2 Jun 2013 09:54:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Jun 2013 09:54:31 +0000 (UTC) Cc: 12986@debbugs.gnu.org To: Kelly Dean Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 02 11:54:30 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uj4zc-0004X9-C5 for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Jun 2013 11:54:28 +0200 Original-Received: from localhost ([::1]:38523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uj4zc-00053F-1O for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Jun 2013 05:54:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uj4zX-0004xq-2A for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2013 05:54:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uj4zV-0002Xh-8d for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2013 05:54:23 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58989) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uj4zV-0002Xb-4J for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2013 05:54:21 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Uj51B-0002CD-42 for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2013 05:56:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Jun 2013 09:56:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12986 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12986-submit@debbugs.gnu.org id=B12986.13701669528343 (code B ref 12986); Sun, 02 Jun 2013 09:56:05 +0000 Original-Received: (at 12986) by debbugs.gnu.org; 2 Jun 2013 09:55:52 +0000 Original-Received: from localhost ([127.0.0.1]:47346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uj50x-0002AQ-Jz for submit@debbugs.gnu.org; Sun, 02 Jun 2013 05:55:51 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:36922 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uj50u-00029t-3h for 12986@debbugs.gnu.org; Sun, 02 Jun 2013 05:55:49 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 31378258B9E938; Sun, 2 Jun 2013 02:54:01 -0700 (PDT) In-Reply-To: <87a9u1jqzh.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 29 Nov 2012 01:15:14 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:74747 Archived-At: >> But it still seems to be a UI inconsistency: although the described >> behavior happens for word mode and case-insensitivity mode, it >> doesn't happen for regex mode, which it what led me to believe it was >> a bug for the first two. If it's supposed to happen for the first two, >> then shouldn't it happen for all three? > > Good point. `isearch-delete-char' (that uses `isearch-pop-state') > restores word mode but not regexp mode. This looks like > unaccountable inconsistency. Perhaps it should restore > regexp mode as well. > > Case-insensitivity is already restored when you type > but you can't see this because it has no indication in the prompt. > Maybe it should momentarily flash a case sensitivity indicator > when you type like it does when you type `M-c' > (but only when changes the state of case-insensitivity). > > The recently added `isearch-lax-whitespace' could be saved/restored too. > > For customizability a new user option could be added to define a list > of search states that the user wants to keep on the isearch stack. This patch adds a new user option `isearch-keep-stack-variables' intended to accompany another option `isearch-keep-mode-variables' added in bug#11378. It adds a new option but doesn't change the default behavior - its default value is `isearch-regexp' that means to not keep regexp mode when pressing backspace (other search variables will be supported later as well). === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-05-30 23:50:36 +0000 +++ lisp/isearch.el 2013-06-02 09:45:01 +0000 @@ -153,6 +153,17 @@ (defcustom isearch-hide-immediately t :type 'boolean :group 'isearch) +(defcustom isearch-keep-stack-variables '(isearch-regexp) + "A set of search variables to keep and not to restore from the search stack." + :type '(set (const :tag "Regexp search" isearch-regexp) + (const :tag "Case folding" isearch-case-fold-search) + (const :tag "Invisible text" isearch-invisible) + (const :tag "Filters" isearch-filter-predicates) + (const :tag "Lax whitespace" isearch-lax-whitespace) + (const :tag "Regexp lax whitespace" isearch-regexp-lax-whitespace)) + :version "24.4" + :group 'isearch) + (defcustom isearch-resume-in-command-history nil "If non-nil, `isearch-resume' commands are added to the command history. This allows you to resume earlier Isearch sessions through the @@ -1109,6 +1143,7 @@ (cl-defstruct (isearch--state (case-fold-search isearch-case-fold-search) (pop-fun (if isearch-push-state-function (funcall isearch-push-state-function))) + (regexp isearch-regexp) (filter-predicates isearch-filter-predicates)))) (string :read-only t) (message :read-only t) @@ -1122,6 +1157,7 @@ (cl-defstruct (isearch--state (barrier :read-only t) (case-fold-search :read-only t) (pop-fun :read-only t) + (regexp :read-only t) (filter-predicates :read-only t)) (defun isearch--set-state (cmd) @@ -1136,6 +1172,8 @@ (defun isearch--set-state (cmd) isearch-barrier (isearch--state-barrier cmd) isearch-case-fold-search (isearch--state-case-fold-search cmd) isearch-filter-predicates (isearch--state-filter-predicates cmd)) + (unless (memq 'isearch-regexp isearch-keep-stack-variables) + (setq isearch-regexp (isearch--state-regexp cmd))) (if (functionp (isearch--state-pop-fun cmd)) (funcall (isearch--state-pop-fun cmd) cmd)) (goto-char (isearch--state-point cmd)))