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#23038: 25.0.92; M-% from isearch broken (error in isearch--describe-regexp-mode) Date: Fri, 18 Mar 2016 10:58:06 -0400 Message-ID: References: <87r3f98agb.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113cfa16df4913052e53fb2d X-Trace: ger.gmane.org 1458313167 20155 80.91.229.3 (18 Mar 2016 14:59:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Mar 2016 14:59:27 +0000 (UTC) Cc: Michael Heerdegen , 23038@debbugs.gnu.org To: Artur Malabarba Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 18 15:59: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 1agvrz-0002uw-5M for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Mar 2016 15:59:19 +0100 Original-Received: from localhost ([::1]:44234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agvrt-0007vg-I5 for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Mar 2016 10:59:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agvro-0007q0-IX for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2016 10:59:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agvri-00020J-BW for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2016 10:59:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agvri-00020C-7R for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2016 10:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1agvrh-00033v-Jy for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2016 10:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2016 14:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23038 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23038-submit@debbugs.gnu.org id=B23038.145831313411757 (code B ref 23038); Fri, 18 Mar 2016 14:59:01 +0000 Original-Received: (at 23038) by debbugs.gnu.org; 18 Mar 2016 14:58:54 +0000 Original-Received: from localhost ([127.0.0.1]:52775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agvrZ-00033Z-Nt for submit@debbugs.gnu.org; Fri, 18 Mar 2016 10:58:53 -0400 Original-Received: from mail-oi0-f42.google.com ([209.85.218.42]:36003) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agvrY-00033M-8D for 23038@debbugs.gnu.org; Fri, 18 Mar 2016 10:58:52 -0400 Original-Received: by mail-oi0-f42.google.com with SMTP id r187so90793786oih.3 for <23038@debbugs.gnu.org>; Fri, 18 Mar 2016 07:58:52 -0700 (PDT) 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=XdvSUxwL0T7c95C7YzJW+5t85GLm/3XboGVETliG+nw=; b=XAfx1ZsNYSZra/m4WNq1QMqehRfyId4mY1JwRtlfzAWxShZBYEYV0pfDF/FNal5/Vm TIas1zoSNTEeVs8p8R2uv0iIhVx0rOS5OgkckXbnzXClmyPGQ6MVVfygydbFoez78x+v 5KwHJUockjYw8WIFn7HEpEL9VPzegZyY31IsASdCpi5qWms+j+CerOwLson65rnD3B0V mX50+gCH3d5XYPOWuJOitGKN/h/PbKs3l1lDq+PkdMMnkHfBhs7OCYOaiprTTD6naSgb 8xIxUR2UnYmo5cNkxIQxqQ6yWuSxHmWPtHYpphHcYozG66Qk2b0M8bJ6q+nE60XMJBMO 47HA== 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=XdvSUxwL0T7c95C7YzJW+5t85GLm/3XboGVETliG+nw=; b=a5g2AVtAjsTq9TWpHV9Q4uUsuK7L4v1ouSm0Eiw1scXZ5uzCFSosszA09CoUXveBW6 WuC2CTfQTV2m7PrcGJWxh6NAlspbkLa6ayTHRMMlZW4bYBhxHeoLNQiEdU0ZkYoXQ35A EoUHVR+1Ux9z6uS7FpWMW+Op4rMFlMddkm823bzZ0n9JS0yCXY0P15uk95J0s9VgJ+Hv hANdP/iGU6UANPwLEJunUOBZyNpYtL9TtlWbix0BfDo1TWb4JSp8i+Cp6cRCvMjInI5w 53e3KUF/w4d3IPUULbSqcQczEPB0OwxCpHsHSaY+vvYfg6effGZRrKfe/kclibNEIfik +/Ew== X-Gm-Message-State: AD7BkJJzVZvJpQCwns5uTuBv8+Mb6LPx0FoXzg6hlmIzBo6Ql1cve4LwaOmmEA+9YALbsmxwSDbr3cwA9ZXR9Q== X-Received: by 10.202.177.3 with SMTP id a3mr9887807oif.2.1458313126428; Fri, 18 Mar 2016 07:58:46 -0700 (PDT) Original-Received: by 10.202.172.198 with HTTP; Fri, 18 Mar 2016 07:58:06 -0700 (PDT) In-Reply-To: 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:115029 Archived-At: --001a113cfa16df4913052e53fb2d Content-Type: text/plain; charset=UTF-8 On Thu, Mar 17, 2016 at 11:53 PM, Artur Malabarba wrote: > Thanks Kaushal! It looks good to me. Thanks! Here's a formatted patch (with indentation fixes too). By mistake I created my last patch with an alias that did git format-patch ignoring whitespace diffs. Below patch fixes this bug plus those indentation changes. >From c06557b30dd8b81362c3970b5b9b54154dfabac9 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Fri, 18 Mar 2016 10:41:04 -0400 Subject: [PATCH] Fix an Isearch var to be a string (bug 23038) * isearch.el (isearch--describe-regexp-mode): The `description' var needs to always be a string. Added the missing default case for the cond form that ensures that. Before this bug fix, for the events when `regexp-function' and `search-default-mode' both were nil, `description' also stayed nil. So when `space-before' was non-nil, the "non-string" `description' (with a value of nil) got passed as an argument to `replace-regexp-in-string' (where a string was expected). That caused the error described in debbugs # 23038. --- lisp/isearch.el | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index 988503e..48354d3 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2585,16 +2585,19 @@ isearch--describe-regexp-mode (eq search-default-mode isearch-regexp))) "") ;; 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) - ""))) + (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 the - ;; default mode is also not literal), describe it. - ((functionp search-default-mode) "literal ")))) + (isearch-regexp "regexp ") + ;; 4. Else if we're in literal mode (and if the default + ;; mode is also not literal), describe it. + ((functionp search-default-mode) "literal ") + ;; 5. And finally, if none of the above is true, set the + ;; description to an empty string. + (t "")))) (if space-before ;; Move space from the end to the beginning. (replace-regexp-in-string "\\(.*\\) \\'" " \\1" description) -- 2.6.0.rc0.24.gec371ff -- Kaushal Modi --001a113cfa16df4913052e53fb2d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On Thu, Mar 17, 2016 at 11:53 PM, Artur Malabarba <bruce.connor.am= @gmail.com> wrote:
Thanks Kaushal! It loo= ks good to me.

Thanks! Here's a formatted patch (= with indentation fixes too).
By mistake I c= reated my last patch with an alias that did git format-patch ignoring white= space diffs. Below patch fixes this bug plus those indentation changes.

From c06557b30dd8b81362c3970b5b9b54154dfabac9 Mon Sep 17 = 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Fri, 18 Mar 2016 10:41:04 -0400
Subject: [PATCH] Fix an Isearch var to be a string (bug = 23038)

* isearch.el (isearch--describe-regexp-mode): The `description' var ne= eds
=C2=A0 to always be a string. Added the= missing default case for the cond
=C2=A0 f= orm that ensures that.

Before this bug fix, for the events when `regexp-function&= #39; and
`search-default-mode' both wer= e nil, `description' also stayed nil.
S= o when `space-before' was non-nil, the "non-string" `descript= ion'
(with a value of nil) got passed a= s an argument to
`replace-regexp-in-string&= #39; (where a string was expected). That caused
the error described in debbugs # 23038.
---
=C2=A0lisp/isearch.el | 19 ++++++++++= +--------
=C2=A01 file changed, 11 insertio= ns(+), 8 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 988503e..48354d3 100644
--- a/lisp/isearch.el
+++ b/lisp/is= earch.el
@@ -2585,16 +2585,19 @@ isearch--d= escribe-regexp-mode
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(eq search-default-m= ode isearch-regexp))) "")
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; 2. Use the `isearch-message-prefix'= ; set for
=C2=A0 =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 =C2=A0 =C2=A0 (rege= xp-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 "")))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(regexp-function
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (and (symbolp regex= p-function)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(or (get regexp-function 'isearch-message-pr= efix)
+ =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 =C2=A0;; 3. Else if `isearch-rege= xp' is non-nil, set description
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; =C2=A0 =C2=A0to "regexp ".
- =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;; 4. And finally, if we're in lit= eral mode (and if the
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0;; =C2=A0 =C2=A0default mode is also not literal), describ= e it.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ((functionp search-default-mode) "literal "))))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(isearch-r= egexp "regexp ")
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0;; 4. Else if we're in literal mode (and if the def= ault
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;;= =C2=A0 =C2=A0mode is also not literal), describe it.
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((functionp search-default-m= ode) "literal ")
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0;; 5. And finally, if none of the above is true, set th= e
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; = =C2=A0 =C2=A0description to an empty string.
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(t ""))))
=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 beginning.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(replace-regexp-in-string "\\(.*\\) \\'" " \\1&quo= t; description)
--=C2=A0
2.6.0.rc0.24.gec371ff



--
Kaushal Modi
--001a113cfa16df4913052e53fb2d--