From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.bugs Subject: bug#22991: 25.0.92: C-u C-s does not display "Regexp I-search:" in the echo area Date: Fri, 11 Mar 2016 16:22:30 -0500 Message-ID: References: <83ziu4hh1r.fsf@gnu.org> <83wpp8hgdy.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c1bb24a88d4f052dcc8954 X-Trace: ger.gmane.org 1457731467 31020 80.91.229.3 (11 Mar 2016 21:24:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2016 21:24:27 +0000 (UTC) Cc: Artur Malabarba , 22991@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 11 22:24:20 2016 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 1aeUXk-0006Xo-BY for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Mar 2016 22:24:20 +0100 Original-Received: from localhost ([::1]:57734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUXj-0007S7-Re for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Mar 2016 16:24:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUXV-0007C1-Fk for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:24:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeUXS-0004Mc-5N for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:24:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUXS-0004MY-2Z for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aeUXR-00083j-VM for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:24:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Mar 2016 21:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22991 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22991-submit@debbugs.gnu.org id=B22991.145773139730929 (code B ref 22991); Fri, 11 Mar 2016 21:24:01 +0000 Original-Received: (at 22991) by debbugs.gnu.org; 11 Mar 2016 21:23:17 +0000 Original-Received: from localhost ([127.0.0.1]:45525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aeUWi-00082n-Ny for submit@debbugs.gnu.org; Fri, 11 Mar 2016 16:23:16 -0500 Original-Received: from mail-ob0-f179.google.com ([209.85.214.179]:36451) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aeUWh-00082b-9T for 22991@debbugs.gnu.org; Fri, 11 Mar 2016 16:23:15 -0500 Original-Received: by mail-ob0-f179.google.com with SMTP id m7so125554723obh.3 for <22991@debbugs.gnu.org>; Fri, 11 Mar 2016 13:23:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=T9hbI+4/LusvRSDfY1I+mJdYVc5mi4dntsqLcfuSZZE=; b=S2gUVswcSUGzeHFcFjiF61A0vL5CP3qxN8z5vwdQWngcuLLQSOZSj6Ju6UbuvQkDpZ 66nDqkerQZ1dqHGe7gkjpulUD+TzqSJ0UyhgYf+OLymMbS1vSAQA7aJ6H9MPOe21bwOe 1YrlNGLpcayi/Yuu9K2OLgOYmtSiQYtvxqu6ybrre/w2vULU5VeOvL0T8vaavAI5WVrB eFmIemIPtNniry+obLnA+PRAociP4bPEUhdNsx5qy4uYOu5P72Bv002oPcBY5dcScVHJ iiBknp/5d6lXZSvwI7Q5B3kJK3SXXsSYVxOknkdcn0Q3mwz0Wm1916osawTO1ttm+PD2 qxjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=T9hbI+4/LusvRSDfY1I+mJdYVc5mi4dntsqLcfuSZZE=; b=hZlhHksLlOeJPa6mB9wWBHXjviXTYldBm9MLTBMeZGsUqUhInQNZUEMUJ4CdsFt/v9 snipb+Av9m50bKZ9BC3yV8Cfg87F2sCIUNvI4InHcAx9LbwADJ96ezBefWhiGloTpf9w fGDiHrT0XS4chB/9sYMcXLqq1qy1rYsLO2ZFmsuVRSXxA3Fy59lzDoU/+0XntWINC2dA 0m/DzRYrjDNpR3/KUprrMlpcqL/OQnfwUgZhw94e7TTksMMw/muNi5B6BECYBTyErH3Z qn8Ha+LnHbPf9v/5l1IUTpgBsSQ/4RNyjydgWB1Nmd1ey3EIIAtFJrlbxalGZRKu7cpE 7mtA== X-Gm-Message-State: AD7BkJLlxCI5n7LHdCQJ0CXFANyWDD7wjeK8991qGqAvbl+1a/CfHB0/cz+f+zYXALtvxrty5p1lXwTZped4gg== X-Received: by 10.182.65.138 with SMTP id x10mr6898042obs.39.1457731389654; Fri, 11 Mar 2016 13:23:09 -0800 (PST) Original-Received: by 10.202.172.198 with HTTP; Fri, 11 Mar 2016 13:22:30 -0800 (PST) In-Reply-To: <83wpp8hgdy.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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:114792 Archived-At: --001a11c1bb24a88d4f052dcc8954 Content-Type: text/plain; charset=UTF-8 > Which I think is wrong, since the default mode shouldn't show anything > except "I-search: ". Right? Even before this patch, that behavior (Displaying "Regexp I-search:" on C-s even when search-default-mode is t) was that way. Because, even when search-default-mode is t, regexp-function still stays nil. So that first cond form condition evals to nil. But I discovered a major issue with my patch. So here's a new one which is less intrusive. I also added explanation for the current priority order in the cond. diff --git a/lisp/isearch.el b/lisp/isearch.el index b8ada2c..7c3d4e3 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2574,16 +2574,23 @@ isearch--describe-regexp-mode (when (eq regexp-function t) (setq regexp-function #'word-search-regexp)) (let ((description - ;; Don't use a description on the default search mode. - (cond ((equal regexp-function search-default-mode) "") - (regexp-function - (and (symbolp regexp-function) - (or (get regexp-function 'isearch-message-prefix) - ""))) - (isearch-regexp "regexp ") - ;; We're in literal mode. If the default mode is not - ;; literal, then describe it. - ((functionp search-default-mode) "literal ")))) + (cond + ;; 1. Don't use a description on the default search mode, + ;; only if the default search mode is non-nil. + ((and search-default-mode + (equal regexp-function search-default-mode)) "") + ;; 2. Use the `isearch-message-prefix' set for + ;; `regexp-function' if available. + (regexp-function + (and (symbolp regexp-function) + (or (get regexp-function 'isearch-message-prefix) + ""))) + ;; 3. Else if `isearch-regexp' is non-nil, set description + ;; to "regexp ". + (isearch-regexp "regexp ") + ;; 4. And finally, if we're in literal mode (AND if default + ;; mode is not literal too), then describe it. + ((functionp search-default-mode) "literal ")))) (if space-before ;; Move space from the end to the beginning. (replace-regexp-in-string "\\(.*\\) \\'" " \\1" description) --001a11c1bb24a88d4f052dcc8954 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
> Which I think is wrong, since the default mode s= houldn't show anything
> except "I-search: ".=C2=A0 Rig= ht?

Even before this patch, that behavior (Displayi= ng "Regexp I-search:" on C-s even when search-default-mode is t) = was that way. Because, even when search-default-mode is t, regexp-function = still stays nil. So that first cond form condition evals to nil.

But I discovered a major issue with my patch. So here's a new = one which is less intrusive. I also added explanation for the current prior= ity order in the cond.

diff --git a/lisp/isearch.el= b/lisp/isearch.el
index b8ada2c..7c3d4e3 100644
--- a/= lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2574,16 +2574= ,23 @@ isearch--describe-regexp-mode
=C2=A0 =C2=A0(when (eq regex= p-function t)
=C2=A0 =C2=A0 =C2=A0(setq regexp-function #'wor= d-search-regexp))
=C2=A0 =C2=A0(let ((description
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ;; Don't use a description on the default sear= ch mode.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cond ((equal regexp-funct= ion search-default-mode) "")
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (regexp-function
- =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(and (symbolp regexp-function)
= - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or= (get regexp-function 'isearch-message-prefix)
- =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &= quot;")))
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (isearch-regexp "regexp ")
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ;; We're in literal mode. If the default mode = is not
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; lite= ral, then describe it.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 ((functionp search-default-mode) "literal "))))
<= div>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cond
+ =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0;; 1. Don't use a description on the default search mode,<= /div>
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; =C2=A0 =C2=A0only if the d= efault search mode is non-nil.
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0((and search-default-mode
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(equal regexp-function search-default-mode)) "&qu= ot;)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; 2. Use the `isearch-m= essage-prefix' set for
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;;= =C2=A0 =C2=A0`regexp-function' if available.
+ =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(regexp-function
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (and (symbolp regexp-function)
+ =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(or (get regexp-function 'isearch-mes= sage-prefix)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"")))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0;; 3. Else if `isearch-regexp' is non-nil, set description
=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; =C2=A0 =C2=A0to "regexp &q= uot;.
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(isearch-regexp "r= egexp ")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; 4. And final= ly, if we're in literal mode (AND if default
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0;; mode is not literal too), then describe it.
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((functionp search-default-mode) &quo= t;literal "))))
=C2=A0 =C2=A0 =C2=A0(if space-before
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Move space from the end to the begi= nning.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(replace-regexp-in-strin= g "\\(.*\\) \\'" " \\1" description)

--001a11c1bb24a88d4f052dcc8954--