From unknown Fri Jun 20 07:18:42 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#13687 <13687@debbugs.gnu.org> To: bug#13687 <13687@debbugs.gnu.org> Subject: Status: 24.3.50; `read-regexp' should provide regex for symbol at point as defaults Reply-To: bug#13687 <13687@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:18:42 +0000 retitle 13687 24.3.50; `read-regexp' should provide regex for symbol at poi= nt as defaults reassign 13687 emacs submitter 13687 Jambunathan K severity 13687 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 11 01:29:31 2013 Received: (at submit) by debbugs.gnu.org; 11 Feb 2013 06:29:31 +0000 Received: from localhost ([127.0.0.1]:49705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4mtM-0004rw-9q for submit@debbugs.gnu.org; Mon, 11 Feb 2013 01:29:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58907) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4mtJ-0004ro-D4 for submit@debbugs.gnu.org; Mon, 11 Feb 2013 01:29:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4msz-0003w1-NO for submit@debbugs.gnu.org; Mon, 11 Feb 2013 01:29:06 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:38169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4msz-0003vx-J3 for submit@debbugs.gnu.org; Mon, 11 Feb 2013 01:29:05 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4msy-0002Zn-5O for bug-gnu-emacs@gnu.org; Mon, 11 Feb 2013 01:29:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4msw-0003ve-Qd for bug-gnu-emacs@gnu.org; Mon, 11 Feb 2013 01:29:04 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4msw-0003vY-Jk for bug-gnu-emacs@gnu.org; Mon, 11 Feb 2013 01:29:02 -0500 Received: by mail-pa0-f44.google.com with SMTP id kp1so2923111pab.3 for ; Sun, 10 Feb 2013 22:29:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:mime-version :content-type; bh=9JFMbTRNzNUFMVQDcaOWmNmPOBRmTWQ1rnWnsj/xK/4=; b=aw5hiKhyQWrTrX3L29D+sjquVThjtBdEqSZk6xD5f8QOx+6RV3RNlqdgvYwP4GBLXz KuJXx9SLkBhY2j7F/ZZuDJNlL62UzsW79qVZiP+srLGnPg2nbZQUboznvmmB+cQ+QUeX BjPNkhJPv2XOsEs+4pLHHNIFujubNKUhw0VPJGPw1OwBg04gHl7BI95OeVerjIPEIDaA 27E0BMRi81zeJNr0+ksHg86YRkVIVkhnvUt+ghodWq+Eh4qPEIZrGexeVWgM6h7wbxkK gXr23CudS28KRA4eJ0859Zy/ofs71PRN42D1w9mOyNxyIgRXj1Mlg1mEi9r2PdHxdJop cSrg== X-Received: by 10.68.137.168 with SMTP id qj8mr16301930pbb.32.1360564141510; Sun, 10 Feb 2013 22:29:01 -0800 (PST) Received: from debian-6.05 ([115.241.62.28]) by mx.google.com with ESMTPS id ps6sm6670461pbb.27.2013.02.10.22.28.59 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 10 Feb 2013 22:29:00 -0800 (PST) From: Jambunathan K To: bug-gnu-emacs@gnu.org Subject: 24.3.50; `read-regexp' should provide regex for symbol at point as defaults Date: Mon, 11 Feb 2013 11:58:35 +0530 Message-ID: <87r4kn5ppo.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) Spun from http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11095 `read-regexp' should provide regex for symbol at point as one of the defaults. This should be the first of defaults while in any of the progmodes. I provided a patch which can be seen here: http://debbugs.gnu.org/cgi/bugreport.cgi?msg=32;filename=bug11095-r110503.diff;att=4;bug=11095 The key thing to note is this: 1. `find-tag-default' (when find-tag-default-function is nil) will pick up the symbol at point. 2. When tag is picked as above, surround it with beginning/end-of-symbol regexp delimiters and add it to defaults. In GNU Emacs 24.3.50.3 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2013-02-11 on debian-6.05 Bzr revision: 111730 rgm@gnu.org-20130211015045-19w1ceor0tkfxc8q Windowing system distributor `The X.Org Foundation', version 11.0.10707000 System Description: Debian GNU/Linux 6.0.5 (squeeze) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 12 12:59:52 2013 Received: (at 13687) by debbugs.gnu.org; 12 Feb 2013 17:59:52 +0000 Received: from localhost ([127.0.0.1]:52521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5K90-00022G-A4 for submit@debbugs.gnu.org; Tue, 12 Feb 2013 12:59:51 -0500 Received: from ps18281.dreamhost.com ([69.163.218.105]:36639 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5K8x-000220-RH for 13687@debbugs.gnu.org; Tue, 12 Feb 2013 12:59:48 -0500 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 07B31201C9F033; Tue, 12 Feb 2013 09:59:19 -0800 (PST) From: Juri Linkov To: Jambunathan K Subject: Re: bug#13687: 24.3.50; `read-regexp' should provide regex for symbol at point as defaults Organization: JURTA References: <87r4kn5ppo.fsf@gmail.com> Date: Tue, 12 Feb 2013 19:50:29 +0200 In-Reply-To: <87r4kn5ppo.fsf@gmail.com> (Jambunathan K.'s message of "Mon, 11 Feb 2013 11:58:35 +0530") Message-ID: <87bobpxvyy.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) > Spun from > > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11095 Thanks for creating a separate request. What I mostly meant in http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11095#20 is that currently `isearch-highlight-regexp' doesn't propagate the search string to hi-lock as a symbol-matching regexp correctly. I proposed to relegate this problem to hi-lock by creating a new command `highlight-symbol' that would turn its plain string argument into a symbol-matching regexp. > `read-regexp' should provide regex for symbol at point as one of the > defaults. This should be the first of defaults while in any of the > progmodes. > > I provided a patch which can be seen here: > http://debbugs.gnu.org/cgi/bugreport.cgi?msg=32;filename=bug11095-r110503.diff;att=4;bug=11095 > > The key thing to note is this: > > 1. `find-tag-default' (when find-tag-default-function is nil) will pick > up the symbol at point. > > 2. When tag is picked as above, surround it with beginning/end-of-symbol > regexp delimiters and add it to defaults. The advantage of your proposal is that when the user doesn't need symbol delimiters, it's easy to delete them. This is easier than to add symbol delimiters in case when the user needs them. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 15 10:41:52 2013 Received: (at 13687) by debbugs.gnu.org; 15 Feb 2013 15:41:52 +0000 Received: from localhost ([127.0.0.1]:57808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6NQ8-0002pB-CO for submit@debbugs.gnu.org; Fri, 15 Feb 2013 10:41:52 -0500 Received: from relais.videotron.ca ([24.201.245.36]:9215) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6NQ6-0002p5-M7 for 13687@debbugs.gnu.org; Fri, 15 Feb 2013 10:41:50 -0500 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from ceviche.home ([24.201.208.110]) by VL-VM-MR005.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0MI900C6CQ8IQZ40@VL-VM-MR005.ip.videotron.ca> for 13687@debbugs.gnu.org; Fri, 15 Feb 2013 10:41:06 -0500 (EST) Received: by ceviche.home (Postfix, from userid 20848) id 7870666109; Fri, 15 Feb 2013 10:41:06 -0500 (EST) From: Stefan Monnier To: Jambunathan K Subject: Re: bug#13687: 24.3.50; `read-regexp' should provide regex for symbol at point as defaults Message-id: References: <87r4kn5ppo.fsf@gmail.com> Date: Fri, 15 Feb 2013 10:41:06 -0500 In-reply-to: <87r4kn5ppo.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Spam-Score: 1.6 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11095 > `read-regexp' should provide regex for symbol at point as one of the > defaults. This should be the first of defaults while in any of the > progmodes. [...] Content analysis details: (1.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [24.201.245.36 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4273] 0.1 HDRS_LCASE Odd capitalization of message header 0.0 T_MANY_HDRS_LCASE Odd capitalization of multiple message headers X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.7 (/) > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11095 > `read-regexp' should provide regex for symbol at point as one of the > defaults. This should be the first of defaults while in any of the > progmodes. I disagree: read-regexp is a generic function which can be used in various contexts, some of which might not care at all about the text around point. So the caller should have control over the first default (of course, it's perfectly fine to always add the current tag in the subsequent defaults). This said your patch seems to leave the caller's provided `defaults' at the beginning of the minibuffer's `defaults', so I think your patch is fine, feel free to install it. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 16 04:32:56 2013 Received: (at 13687) by debbugs.gnu.org; 16 Feb 2013 09:32:56 +0000 Received: from localhost ([127.0.0.1]:58581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6e8d-00004s-Tb for submit@debbugs.gnu.org; Sat, 16 Feb 2013 04:32:56 -0500 Received: from mail-pb0-f54.google.com ([209.85.160.54]:46105) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6e8b-0008WR-RK for 13687@debbugs.gnu.org; Sat, 16 Feb 2013 04:32:54 -0500 Received: by mail-pb0-f54.google.com with SMTP id rr4so944588pbb.27 for <13687@debbugs.gnu.org>; Sat, 16 Feb 2013 01:32:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=VRn77aqmXPgECT0Z1Is/5IGkm3z3nCHqagubX1Zy+mw=; b=NgTvzH1O5ALn21bVVCKhE9IURo0LEIno75u5dnl4Qs++SYdyIcJkX4hWDlUF0ZvyVD BTZWLhpX6zO1kf6zmbUkhoOpQN6rVwoKOrsL0HynQY+k5aaAn/0QoEOkWTlcqXCyM337 FnziYo/om49TwMCgNmSMKA25CD9Ndpol5fMJ5Wjynf60gQq25X2Jtnbkc7PzLqFfdJlX Ty8brYhxk6tleNpxDspMNaU2BGMsU6mhS6x7QPLOzVJhoLsi3fNIgxFI+6N8AeA5+RVW ns44s57h0TBwKF9uwy7NM06wQlFecpxgXjaSnVe73FE2Ix/c8+b8PxUnlL92oMp1pzab 18Mg== X-Received: by 10.68.143.197 with SMTP id sg5mr13001654pbb.101.1361007125577; Sat, 16 Feb 2013 01:32:05 -0800 (PST) Received: from debian-6.05 ([115.242.167.6]) by mx.google.com with ESMTPS id bi8sm96561735pab.15.2013.02.16.01.32.02 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sat, 16 Feb 2013 01:32:04 -0800 (PST) From: Jambunathan K To: 13687@debbugs.gnu.org Subject: Re: bug#13687: 24.3.50; `read-regexp' should provide regex for symbol at point as defaults References: <87r4kn5ppo.fsf@gmail.com> Date: Sat, 16 Feb 2013 15:01:42 +0530 In-Reply-To: (Stefan Monnier's message of "Fri, 15 Feb 2013 10:41:06 -0500") Message-ID: <874nhcr4e9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 13687 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > This said your patch seems to leave the caller's provided `defaults' at > the beginning of the minibuffer's `defaults', so I think your patch is > fine, feel free to install it. See revno: 111803 From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 16 09:29:18 2013 Received: (at 13687-done) by debbugs.gnu.org; 16 Feb 2013 14:29:18 +0000 Received: from localhost ([127.0.0.1]:58724 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6ilR-0007aq-DR for submit@debbugs.gnu.org; Sat, 16 Feb 2013 09:29:17 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:33118) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6ilM-0007ag-6L for 13687-done@debbugs.gnu.org; Sat, 16 Feb 2013 09:29:13 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFxKjI/2dsb2JhbABEuzWDWRdzgh4BAQQBViMQCzQSFBgNJIgeBsEtjQ+DewOIYZwZgV6DFYFR X-IPAS-Result: Av8EABK/CFFFxKjI/2dsb2JhbABEuzWDWRdzgh4BAQQBViMQCzQSFBgNJIgeBsEtjQ+DewOIYZwZgV6DFYFR X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="1564346" Received: from 69-196-168-200.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.200]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 16 Feb 2013 09:28:22 -0500 Received: by pastel.home (Postfix, from userid 20848) id DE9D16F8CE; Sat, 16 Feb 2013 09:28:18 -0500 (EST) From: Stefan Monnier To: Jambunathan K Subject: Re: bug#13687: 24.3.50; `read-regexp' should provide regex for symbol at point as defaults Message-ID: References: <87r4kn5ppo.fsf@gmail.com> <874nhcr4e9.fsf@gmail.com> Date: Sat, 16 Feb 2013 09:28:18 -0500 In-Reply-To: <874nhcr4e9.fsf@gmail.com> (Jambunathan K.'s message of "Sat, 16 Feb 2013 15:01:42 +0530") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13687-done Cc: 13687-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> This said your patch seems to leave the caller's provided `defaults' at >> the beginning of the minibuffer's `defaults', so I think your patch is >> fine, feel free to install it. > See revno: 111803 Thanks. You can close bugs simply by sending your email to "NNN-done@debbugs...", as I'm doing with this one. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 28 13:17:12 2013 Received: (at 13687) by debbugs.gnu.org; 28 Feb 2013 18:17:12 +0000 Received: from localhost ([127.0.0.1]:56571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB82a-00059z-2A for submit@debbugs.gnu.org; Thu, 28 Feb 2013 13:17:12 -0500 Received: from ps18281.dreamhost.com ([69.163.218.105]:47301 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB82X-00059r-EC for 13687@debbugs.gnu.org; Thu, 28 Feb 2013 13:17:11 -0500 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 3C29C258B92900; Thu, 28 Feb 2013 10:15:09 -0800 (PST) From: Juri Linkov To: Jambunathan K Subject: Re: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first Organization: JURTA References: <877glsyecw.fsf@gmail.com> Date: Thu, 28 Feb 2013 20:12:30 +0200 In-Reply-To: <877glsyecw.fsf@gmail.com> (Jambunathan K.'s message of "Thu, 28 Feb 2013 15:00:55 +0530") Message-ID: <87621cfhff.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > emacs -Q > M-s h r > > I find the following error > > ,---- > | Debugger entered--Lisp error: (error "Regexp cannot match an empty string") > | signal(error ("Regexp cannot match an empty string")) > | error("Regexp cannot match an empty string") > | hi-lock-regexp-okay("") > | byte-code("..." [regexp-history hi-lock-regexp-okay read-regexp "Regexp to highlight" hi-lock-read-face-name] 4) > | call-interactively(highlight-regexp nil nil) > | command-execute(highlight-regexp) > `---- > > So, if one does > (read-regexp something) ;; something is nil or evals to nil > > what should the interpretation be. > > With your change, a `nil' default will provide an empty string as input > and force user to enter a regexp or rely on M-n. > > We seem to be bumping in to each other in this area. Comments ...? > > ,---- Stefan @ http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13687#11 > | I disagree: read-regexp is a generic function which can be used in > | various contexts, some of which might not care at all about the text > | around point. So the caller should have control over the first default > | (of course, it's perfectly fine to always add the current tag in the > | subsequent defaults). > | > | This said your patch seems to leave the caller's provided `defaults' at > | the beginning of the minibuffer's `defaults', so I think your patch is > | fine, feel free to install it. > `---- > > I am wondering how we can resolve the contex-free read-regexp and > context-dependent regexp. Any suggestions? It's a responsibility of the caller to provide the default value. `M-s h r' (`highlight-regexp') provides the default value as `(car regexp-history)'. When it is called the first time after `emacs -Q', the history is empty, so its default value is nil (this fact is indicated with missing default value in the prompt, so the user is aware that RET with empty input will do nothing.) When `highlight-regexp' is called the second time and more, it gets the default value from `regexp-history', so you can't provide the tag at point as the default for later invocations of `highlight-regexp' anyway. So the question is: should the default value in the caller `highlight-regexp' be changed from `(car regexp-history)' to code that gets the tag at point? You could propose such a change, but since it changes the long-standing behavior, expect some disagreement (not from me :-) From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 03 04:39:30 2013 Received: (at 13687) by debbugs.gnu.org; 3 Mar 2013 09:39:30 +0000 Received: from localhost ([127.0.0.1]:56494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UC5OD-00023H-SE for submit@debbugs.gnu.org; Sun, 03 Mar 2013 04:39:30 -0500 Received: from ps18281.dreamhost.com ([69.163.218.105]:38301 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UC5OB-000238-7P for 13687@debbugs.gnu.org; Sun, 03 Mar 2013 04:39:28 -0500 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 337BC258B92900; Sun, 3 Mar 2013 01:39:16 -0800 (PST) From: Juri Linkov To: Jambunathan K Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first Organization: JURTA References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> Date: Sun, 03 Mar 2013 11:31:04 +0200 In-Reply-To: <87621cfhff.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 28 Feb 2013 20:12:30 +0200") Message-ID: <87zjykygjk.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > So the question is: should the default value in the caller > `highlight-regexp' be changed from `(car regexp-history)' > to code that gets the tag at point? You could propose > such a change, but since it changes the long-standing behavior, > expect some disagreement (not from me :-) There are surprisingly many users who prefer the previous item from the history instead of the tag at point as the default value of `occur', `highlight-regexp', `rgrep'. They got `(car regexp-history)' hard-coded into core Emacs for `occur' and `highlight-regexp', but not for `rgrep', so they raise the questions how to do the same for `rgrep', and get such horribly ugly solutions as this one: http://stackoverflow.com/questions/15161592/make-emacs-rgrep-default-to-last-search-term-rather-than-word-at-point This situation suggests that the default values should be customizable. Possible variants: 1. Put a special value on the command's symbol like: (put 'highlight-regexp 'default 'history) (put 'highlight-regexp 'default 'tag-at-point) checked on `this-command' in minibuffer-reading functions. Cons: Not easy to use. 2. Add a new defcustom like: (defcustom minibuffer-defaults '((highlight-regexp-default . tag-at-point) (rgrep . history) (occur . tag-at-point) (how-many . history) ...)) Cons: Too large list of commands for one option. 3. In the DEFAULT arg of minibuffer-reading calls specify a function that returns default values: (defun highlight-regexp (regexp &optional face) (interactive (list (read-regexp "Regexp to highlight" 'highlight-regexp-default) ... (defun highlight-regexp-default () (car regexp-history)) where users can override it with another function: (defun highlight-regexp-default () (let* ((tagf (or find-tag-default-function (get major-mode 'find-tag-default-function) 'find-tag-default)) (tag (funcall tagf))) (cond ((not tag) "") ((eq tagf 'find-tag-default) (format "\\_<%s\\_>" (regexp-quote tag))) (t (regexp-quote tag))))) Pros: Flexible and easy to configure. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 04 00:46:46 2013 Received: (at 13687) by debbugs.gnu.org; 4 Mar 2013 05:46:46 +0000 Received: from localhost ([127.0.0.1]:57979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCOEV-00083o-Vw for submit@debbugs.gnu.org; Mon, 04 Mar 2013 00:46:46 -0500 Received: from mail-pb0-f46.google.com ([209.85.160.46]:51619) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCOEP-00083X-7Y for 13687@debbugs.gnu.org; Mon, 04 Mar 2013 00:46:43 -0500 Received: by mail-pb0-f46.google.com with SMTP id uo15so2884305pbc.19 for <13687@debbugs.gnu.org>; Sun, 03 Mar 2013 21:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=mGedQEk1aipzbaOSNwc9Z/2Uyvdjq8YjZGLjpFyBXDA=; b=AHsMf2DucIfCPNBduqXfYf+VkS3iLpY71qgSHJjgYvt6TvEbWGnkCKAUDmQSeeAKUG 6e64eH+XRXYUY9llp5YPCm1MpEdF1xYy0H8u0Nn6P86CpLshWuWBzB0Vp8KSHOqRfqmN DCdHzZxdkQRJR6qvZvmIcCLywSpBo2TtmTIVzlGubc7tLXtmlZVTB+idPo/NU1Ri03DH qVRNU7oF2Ij/2LkRA+CsnOenu+wVtg/AYjF9Xa9EF6/AROvYry8nSGGXPkgM4XRLGVft IZKozmxr1JJSOMUuqXOFvkYNI0CeVfo0nw7eEKamHIdDZI4Fy11UT0PEJUHpyDqXmXfa 1WsQ== X-Received: by 10.68.129.73 with SMTP id nu9mr26451983pbb.57.1362375978400; Sun, 03 Mar 2013 21:46:18 -0800 (PST) Received: from debian-6.05 ([101.63.199.133]) by mx.google.com with ESMTPS id u10sm22588645pax.14.2013.03.03.21.46.14 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 03 Mar 2013 21:46:17 -0800 (PST) From: Jambunathan K To: Juri Linkov Subject: Re: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> Date: Mon, 04 Mar 2013 11:16:06 +0530 In-Reply-To: <87621cfhff.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 28 Feb 2013 20:12:30 +0200") Message-ID: <87d2vfbtup.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Juri Linkov writes: >> emacs -Q >> M-s h r >> >> I find the following error >> >> ,---- >> | Debugger entered--Lisp error: (error "Regexp cannot match an empty string") >> | signal(error ("Regexp cannot match an empty string")) >> | error("Regexp cannot match an empty string") >> | hi-lock-regexp-okay("") >> | byte-code("..." [regexp-history hi-lock-regexp-okay read-regexp >> | "Regexp to highlight" hi-lock-read-face-name] 4) >> | call-interactively(highlight-regexp nil nil) >> | command-execute(highlight-regexp) >> `---- >> >> So, if one does >> (read-regexp something) ;; something is nil or evals to nil >> >> what should the interpretation be. >> >> With your change, a `nil' default will provide an empty string as input >> and force user to enter a regexp or rely on M-n. >> >> We seem to be bumping in to each other in this area. Comments ...? >> >> ,---- Stefan @ http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13687#11 >> | I disagree: read-regexp is a generic function which can be used in >> | various contexts, some of which might not care at all about the text >> | around point. So the caller should have control over the first default >> | (of course, it's perfectly fine to always add the current tag in the >> | subsequent defaults). >> | >> | This said your patch seems to leave the caller's provided `defaults' at >> | the beginning of the minibuffer's `defaults', so I think your patch is >> | fine, feel free to install it. >> `---- >> >> I am wondering how we can resolve the contex-free read-regexp and >> context-dependent regexp. Any suggestions? > > It's a responsibility of the caller to provide the default value. > `M-s h r' (`highlight-regexp') provides the default value as > `(car regexp-history)'. When it is called the first time after > `emacs -Q', the history is empty, so its default value is nil > (this fact is indicated with missing default value in the prompt, > so the user is aware that RET with empty input will do nothing.) > > When `highlight-regexp' is called the second time and more, > it gets the default value from `regexp-history', so you can't > provide the tag at point as the default for later invocations > of `highlight-regexp' anyway. The question was one of how `read-regexp' should behave? If (car DEFAULTS) is nil should it offer (car SUGGESTIONS) as a default or offer an empty string for default. > > So the question is: should the default value in the caller > `highlight-regexp' be changed from `(car regexp-history)' > to code that gets the tag at point? You could propose > such a change, but since it changes the long-standing behavior, > expect some disagreement (not from me :-) From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 04 04:30:53 2013 Received: (at 13687) by debbugs.gnu.org; 4 Mar 2013 09:30:53 +0000 Received: from localhost ([127.0.0.1]:58229 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCRjR-00053g-Dm for submit@debbugs.gnu.org; Mon, 04 Mar 2013 04:30:53 -0500 Received: from ps18281.dreamhost.com ([69.163.218.105]:53626 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCRjO-00053Y-ON for 13687@debbugs.gnu.org; Mon, 04 Mar 2013 04:30:51 -0500 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id D6418258B92902; Mon, 4 Mar 2013 01:30:34 -0800 (PST) From: Juri Linkov To: Jambunathan K Subject: Re: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first Organization: JURTA References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87d2vfbtup.fsf@gmail.com> Date: Mon, 04 Mar 2013 11:28:48 +0200 In-Reply-To: <87d2vfbtup.fsf@gmail.com> (Jambunathan K.'s message of "Mon, 04 Mar 2013 11:16:06 +0530") Message-ID: <874ngrsecv.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > The question was one of how `read-regexp' should behave? > > If (car DEFAULTS) is nil should it offer (car SUGGESTIONS) as a default > or offer an empty string for default. As bug#13805 indicates, `read-regexp' should return an empty string when the caller specifies that (car DEFAULTS) is nil. This is like what `read-from-minibuffer' does. But note that `read-from-minibuffer' is even more strict, and doesn't return the default value even if it's specified, i.e. typing RET after evaluating (read-from-minibuffer "Prompt: " nil nil nil nil "default") returns an empty string instead of the default value. This is because its arg DEFAULT-VALUE acts more like a suggestion available for M-n whose values should not be returned for empty input. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 06 13:01:16 2013 Received: (at 13687) by debbugs.gnu.org; 6 Mar 2013 18:01:16 +0000 Received: from localhost ([127.0.0.1]:34617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDIeO-0004gJ-HZ for submit@debbugs.gnu.org; Wed, 06 Mar 2013 13:01:16 -0500 Received: from mail-pb0-f53.google.com ([209.85.160.53]:60049) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDIeI-0004fe-P8 for 13687@debbugs.gnu.org; Wed, 06 Mar 2013 13:01:11 -0500 Received: by mail-pb0-f53.google.com with SMTP id un1so6275938pbc.40 for <13687@debbugs.gnu.org>; Wed, 06 Mar 2013 10:00:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=ZitwaXVqvv3aZiSUeRJfeUmJDy9zCQxzmAmzHWVxPWs=; b=uFgee8be3irSXEyMA8+s4dfyRYXObFi2eYq8FZ47D2ujpuomz7NsoBf4vNpkXw0zpN mvVDskJ0bneTBjAtBogurXe8dRXf/6gYKOeBumGtR51oJo2nBeT37JgYO7TiH9ZCWEul RMMC1TIZAC8pDYlFZMZEWWKkQPzXzwsCXN1hDVnsPPTm/pDzueyND16SCPhOUDAwEdUv g6fwHPruqOeqF+Oq2ml+3BRsVubOTa05Of9FH0jaCjiFklHnts4d0JN4PsKucfFQWqg1 AklVT1QIqMy6LSDqKieKubENwLl0/u/N3Dv8XRu/96r8ZeGHCRUHGJGzj5NtL0Ayv2YH uFkg== X-Received: by 10.68.197.193 with SMTP id iw1mr15352352pbc.86.1362592833537; Wed, 06 Mar 2013 10:00:33 -0800 (PST) Received: from debian-6.05 ([115.241.90.1]) by mx.google.com with ESMTPS id tm1sm32269545pbc.11.2013.03.06.10.00.29 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 06 Mar 2013 10:00:32 -0800 (PST) From: Jambunathan K To: Juri Linkov Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> Date: Wed, 06 Mar 2013 23:30:27 +0530 In-Reply-To: <87zjykygjk.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 03 Mar 2013 11:31:04 +0200") Message-ID: <87boawz9vo.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Juri Linkov writes: >> So the question is: should the default value in the caller >> `highlight-regexp' be changed from `(car regexp-history)' >> to code that gets the tag at point? You could propose >> such a change, but since it changes the long-standing behavior, >> expect some disagreement (not from me :-) > > There are surprisingly many users who prefer the previous item from the > history instead of the tag at point as the default value of `occur', > `highlight-regexp', `rgrep'. They got `(car regexp-history)' hard-coded > into core Emacs for `occur' and `highlight-regexp', but not for `rgrep', > so they raise the questions how to do the same for `rgrep', and get such > horribly ugly solutions as this one: See bug#13892. I have gone with (3). For now, I have modified hi-lock.el. Modifications to occur will follow soon. > http://stackoverflow.com/questions/15161592/make-emacs-rgrep-default-to-last-search-term-rather-than-word-at-point > > This situation suggests that the default values should be customizable. > Possible variants: > > 1. Put a special value on the command's symbol like: > (put 'highlight-regexp 'default 'history) > (put 'highlight-regexp 'default 'tag-at-point) > checked on `this-command' in minibuffer-reading functions. > Cons: Not easy to use. > > 2. Add a new defcustom like: > (defcustom minibuffer-defaults '((highlight-regexp-default . tag-at-point) > (rgrep . history) > (occur . tag-at-point) > (how-many . history) > ...)) > Cons: Too large list of commands for one option. > > 3. In the DEFAULT arg of minibuffer-reading calls > specify a function that returns default values: > > (defun highlight-regexp (regexp &optional face) > (interactive > (list > (read-regexp "Regexp to highlight" 'highlight-regexp-default) > ... > > (defun highlight-regexp-default () > (car regexp-history)) > > where users can override it with another function: > > (defun highlight-regexp-default () > (let* ((tagf (or find-tag-default-function > (get major-mode 'find-tag-default-function) > 'find-tag-default)) > (tag (funcall tagf))) > (cond ((not tag) "") > ((eq tagf 'find-tag-default) > (format "\\_<%s\\_>" (regexp-quote tag))) > (t (regexp-quote tag))))) > > Pros: Flexible and easy to configure. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 06 13:03:57 2013 Received: (at 13687) by debbugs.gnu.org; 6 Mar 2013 18:03:57 +0000 Received: from localhost ([127.0.0.1]:34626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDIgz-0004kB-1f for submit@debbugs.gnu.org; Wed, 06 Mar 2013 13:03:56 -0500 Received: from mail-pb0-f53.google.com ([209.85.160.53]:32905) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDIgt-0004jt-EZ for 13687@debbugs.gnu.org; Wed, 06 Mar 2013 13:03:52 -0500 Received: by mail-pb0-f53.google.com with SMTP id un1so6300244pbc.26 for <13687@debbugs.gnu.org>; Wed, 06 Mar 2013 10:03:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:in-reply-to:references:user-agent :date:message-id:mime-version:content-type; bh=seHnKHnb1OUAQMxMvvF3LnWTnP1lf52z0vF9wFrtECI=; b=aLCQn4xpi54y0ZOjpfVyIGLz6pln4IuG7J1FMYNsAv18/NAUKVC5i8Es+g7NshC2gn QVi7sAR7sm2kmiisQM7yNwvpkurWm8r6ZvlUnpMp+joxYsIL5N4tnO+GooFea7d3tXOT b1E8Eo8jGrinaiCHCzt/RSM3ngXTDxmsoM/C8fTs6VmuGvvQnk3tld9SVNyjtoETrPhB mhC5sfVNLETjqFgGAkivprQ0qPJfYRPZ9M0S7mdOqflhohCwiajTWxhfuyMnI20n+2Z2 zFyMTP//O7OSHXqx1RKSvjpX+gLYGL20Vvxxvu+JFA0su32mk1Wp2HcHk+GEYO2TTz9l Eo5w== X-Received: by 10.68.189.234 with SMTP id gl10mr20897037pbc.15.1362592994311; Wed, 06 Mar 2013 10:03:14 -0800 (PST) Received: from debian-6.05 ([115.241.90.1]) by mx.google.com with ESMTPS id kl4sm32262512pbc.31.2013.03.06.10.03.11 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 06 Mar 2013 10:03:13 -0800 (PST) From: Jambunathan K To: Juri Linkov Subject: Re: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first In-Reply-To: <874ngrsecv.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 04 Mar 2013 11:28:48 +0200") References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87d2vfbtup.fsf@gmail.com> <874ngrsecv.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Date: Wed, 06 Mar 2013 23:33:08 +0530 Message-ID: <876214z9r7.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Juri Linkov writes: >> The question was one of how `read-regexp' should behave? >> >> If (car DEFAULTS) is nil should it offer (car SUGGESTIONS) as a default >> or offer an empty string for default. > > As bug#13805 indicates, `read-regexp' should return an empty string > when the caller specifies that (car DEFAULTS) is nil. I think I overlooked the bug number in your commit. Otherwise, I wouldn't have triggered this discussion in first place. Sorry. > > This is like what `read-from-minibuffer' does. But note that > `read-from-minibuffer' is even more strict, and doesn't return > the default value even if it's specified, i.e. typing RET > after evaluating > > (read-from-minibuffer "Prompt: " nil nil nil nil "default") > > returns an empty string instead of the default value. > This is because its arg DEFAULT-VALUE acts more like > a suggestion available for M-n whose values should not be > returned for empty input. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 08:03:31 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 13:03:31 +0000 Received: from localhost ([127.0.0.1]:38453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDwxL-0005r9-G8 for submit@debbugs.gnu.org; Fri, 08 Mar 2013 08:03:31 -0500 Received: from mail-pb0-f49.google.com ([209.85.160.49]:60271) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDwxF-0005qr-Oa for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 08:03:26 -0500 Received: by mail-pb0-f49.google.com with SMTP id xa12so1181074pbc.36 for <13687@debbugs.gnu.org>; Fri, 08 Mar 2013 05:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=HekvClfO5LuU/bnE0UWgA41XE2eceCPrmQJ09Rq9Sm8=; b=T2duxHwtDI2b1sZMGbWp/36DOZjAs+xNsp3oFa/4YeH4+ry0GuayK7P4SQxARX71+Y 8oLZvZV5tur/iLCnjQk1W3xUwT9S04BV+Ip7Kg1nY13thQ6wBRn6/eptbk8sxBmE7JTk 9fGWdSZZNyeXOxYP4sN+xdLviFot3+djH21qxFbHY1zdqfGNPSl3ud7DrbdkLfWWVeWZ xLn9jKHBc3qFYmSzoQ/fkJ9KzbkbOc5fL7ezoaGqqN0sfXnOCA2ms26XbMS3KcpXG3pD Df0bUJx88kFAZPcb0Nb34OEmjr3fXzXUxvK9PKAMT/vfqnv0gIPmUP6TjLQqAwNjTW8v V56g== X-Received: by 10.68.33.98 with SMTP id q2mr3085920pbi.135.1362747758577; Fri, 08 Mar 2013 05:02:38 -0800 (PST) Received: from debian-6.05 ([101.63.213.39]) by mx.google.com with ESMTPS id li8sm6230556pab.8.2013.03.08.05.02.34 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 08 Mar 2013 05:02:37 -0800 (PST) From: Jambunathan K To: Juri Linkov Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> Date: Fri, 08 Mar 2013 18:32:36 +0530 In-Reply-To: <87zjykygjk.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 03 Mar 2013 11:31:04 +0200") Message-ID: <87vc92gi37.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Juri Linkov writes: > 2. Add a new defcustom like: > (defcustom minibuffer-defaults '((highlight-regexp-default . tag-at-point) > (rgrep . history) > (occur . tag-at-point) > (how-many . history) > ...)) > Cons: Too large list of commands for one option. I am attaching a patch that handles `occur'. I will commit this patch tomorrow. ps: I have never used how-many. The defaults for grep and rgrep never bothered me. So I leave these two commands out of my current scope. --=-=-= Content-Type: text/x-diff Content-Disposition: inline Content-Description: replace.el.diff === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-03-08 08:11:28 +0000 +++ lisp/ChangeLog 2013-03-08 12:52:16 +0000 @@ -1,5 +1,11 @@ 2013-03-08 Jambunathan K + * replace.el (occur-read-regexp-defaults-function): New var. + (occur-read-regexp-defaults): New defun. + (occur-read-primary-args): Propagate above change (bug#13892). + +2013-03-08 Jambunathan K + * hi-lock.el (hi-lock-read-regexp-defaults-function): New var. (hi-lock-read-regexp-defaults): New defun. (hi-lock-line-face-buffer, hi-lock-face-buffer) === modified file 'lisp/replace.el' --- lisp/replace.el 2013-03-08 04:18:16 +0000 +++ lisp/replace.el 2013-03-08 12:45:40 +0000 @@ -1135,12 +1135,33 @@ which means to discard all text properti :group 'matching :version "22.1") +(defvar occur-read-regexp-defaults-function + 'occur-read-regexp-defaults + "Function that provides default regexp(s) for occur commands. +This function should take no arguments and return one of nil, a +regexp or a list of regexps for use with occur commands - +`occur', `multi-occur' and `multi-occur-in-matching-buffers'. +The return value of this function is used as DEFAULTS param of +`read-regexp' while executing the occur command. This function +is called only during interactive use. + +For example, to check for occurrence of a symbol at point by +default use + + \(setq occur-read-regexp-defaults-function + 'find-tag-default-as-regexp\).") + +(defun occur-read-regexp-defaults () + "Return the latest regexp from `regexp-history'. +See `occur-read-regexp-defaults-function' for details." + (car regexp-history)) + (defun occur-read-primary-args () (let* ((perform-collect (consp current-prefix-arg)) (regexp (read-regexp (if perform-collect "Collect strings matching regexp" "List lines matching regexp") - (car regexp-history)))) + (funcall occur-read-regexp-defaults-function)))) (list regexp (if perform-collect ;; Perform collect operation --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 10:30:57 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 15:30:57 +0000 Received: from localhost ([127.0.0.1]:39592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDzG0-0001u9-UR for submit@debbugs.gnu.org; Fri, 08 Mar 2013 10:30:56 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:28466) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDzFu-0001tr-35 for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 10:30:50 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r28FU1KW026206 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Mar 2013 15:30:02 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r28FU0fG018577 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Mar 2013 15:30:01 GMT Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r28FU0Os016061; Fri, 8 Mar 2013 09:30:00 -0600 Received: from dradamslap1 (/10.159.244.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 08 Mar 2013 07:30:00 -0800 From: "Drew Adams" To: "'Jambunathan K'" , "'Juri Linkov'" References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org><87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> Subject: RE: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Date: Fri, 8 Mar 2013 07:29:52 -0800 Message-ID: <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87vc92gi37.fsf@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac4b/Vzs5LaraRS8R8ihIBS4Es59mwAETIqg X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) > > 2. Add a new defcustom like: > > (defcustom minibuffer-defaults > > '((highlight-regexp-default . tag-at-point) > > (rgrep . history) > > (occur . tag-at-point) > > (how-many . history) > > ...)) > > Cons: Too large list of commands for one option. > > I am attaching a patch that handles `occur'. > I will commit this patch tomorrow. Sorry, I have not been following this thread at all - please excuse any jumping to wrong conclusions. If that defcustom is what it looks like to me, I'd say that such an approach is quite misguided. I.e., if you are defining a user option that globally controls defaulting for commands reading input from the minibuffer, that's a bad idea, IMHO. Let the command decide its own defaulting. Individual commands that read the minibuffer should control such defaulting, at the point of call. They can rely on user options if they want to. But a single user option for this kind of thing, and especially if it somehow takes control of defaulting away from the caller (command), is a bad idea. And doubly so if it does command lookup to determine the default value to use. That's the real mistake, IMHO. FWIW, in my code I do something that I'm guessing might be similar to the _effect_ you want, but I stay completely away from command lookup/dispatching. I have a user option, `search/replace-default-fn', whose value (a function) provides the default value(s) for functions `query-replace', `occur', `how-many', `flush-lines',... This means that, a priori, the same option value is used for all such functions. But a command can override this. And the function that is the option value can itself do the kind of dispatching that you are doing, if that is something the user really wants. code: http://www.emacswiki.org/emacs/download/replace%2b.el doc: http://www.emacswiki.org/cgi-bin/wiki/ReplacePlus I also wonder whether you are perhaps changing the user experience here without a proper proposal and discussion in emacs-devel first. "I will commit...tomorrow." does not inspire confidence. How about proposing a change and seeing what others in the development list think? Again, if I have misunderstood, mille excuses. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 11:54:13 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 16:54:13 +0000 Received: from localhost ([127.0.0.1]:39676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE0Ya-0003ot-QF for submit@debbugs.gnu.org; Fri, 08 Mar 2013 11:54:13 -0500 Received: from mail-pb0-f41.google.com ([209.85.160.41]:61884) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE0YU-0003o1-Bl for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 11:54:06 -0500 Received: by mail-pb0-f41.google.com with SMTP id um15so1351809pbc.28 for <13687@debbugs.gnu.org>; Fri, 08 Mar 2013 08:53:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=xpPeutUw0bIB4HBYpXdSoQvG090pVhYtKsS9z8XPQmc=; b=AMx58jDGSqfMUBUHNdHXJ8Dof4CFmCUTcwvIaNwJi4niEWPyVNIB4/BJQNyIap/mMW yCc/VRbutZOyAi2UifBMwnn8e6ZistL+IOMoDq2pHI3dH8+kg8vH15Uc46GK8c/dY2tm JytxvmPmmLL0dy44zqjsBjYJHErHDzF3f65kfCQhqzRkUpyMr82q8wUrkAPX2OpwJHDc sRHUvnCbg+HpWIS3BTLjx+nwQhBFup0/3rk4Y9s+zB2fcdig2cqoiuzb4MKY/1xMxwXD 9ye82FzZbjCPhQBbfHcnMVUjk5JACABfoX5mhXjsIdv6lxNBzeKRacTotZ6r4LQjPvBF WaKA== X-Received: by 10.68.224.1 with SMTP id qy1mr4399396pbc.169.1362761598060; Fri, 08 Mar 2013 08:53:18 -0800 (PST) Received: from debian-6.05 ([115.241.18.198]) by mx.google.com with ESMTPS id in5sm6140258pbc.20.2013.03.08.08.53.14 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 08 Mar 2013 08:53:17 -0800 (PST) From: Jambunathan K To: "Drew Adams" Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> Date: Fri, 08 Mar 2013 22:23:16 +0530 In-Reply-To: <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> (Drew Adams's message of "Fri, 8 Mar 2013 07:29:52 -0800") Message-ID: <87fw05esub.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) "Drew Adams" writes: >> > 2. Add a new defcustom like: >> > (defcustom minibuffer-defaults >> > '((highlight-regexp-default . tag-at-point) >> > (rgrep . history) >> > (occur . tag-at-point) >> > (how-many . history) >> > ...)) >> > Cons: Too large list of commands for one option. >> >> I am attaching a patch that handles `occur'. >> I will commit this patch tomorrow. > > Sorry, I have not been following this thread at all - please excuse > any jumping to wrong conclusions. Excused. You didn't look at the inline patch that I enclosed. > I also wonder whether you are perhaps changing the user experience > here without a proper proposal and discussion in emacs-devel first. You seem to think that emacs-bugs is not a right place to discuss a proposal. > "I will commit...tomorrow." does not inspire confidence. How about > proposing a change and seeing what others in the development list > think? It is happening as we type, don't you think. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 12:11:20 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 17:11:20 +0000 Received: from localhost ([127.0.0.1]:39693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE0p9-0004D2-Eg for submit@debbugs.gnu.org; Fri, 08 Mar 2013 12:11:19 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:22812) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE0p3-0004Cl-4l for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 12:11:13 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r28HAMMJ024000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Mar 2013 17:10:22 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r28HALYP017929 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Mar 2013 17:10:21 GMT Received: from abhmt108.oracle.com (abhmt108.oracle.com [141.146.116.60]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r28HAKmF031793; Fri, 8 Mar 2013 11:10:20 -0600 Received: from dradamslap1 (/10.159.244.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 08 Mar 2013 09:10:20 -0800 From: "Drew Adams" To: "'Jambunathan K'" References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org><87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com><1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87fw05esub.fsf@gmail.com> Subject: RE: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Date: Fri, 8 Mar 2013 09:10:12 -0800 Message-ID: <084E374181BA45FB96F8F71A19E20182@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87fw05esub.fsf@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac4cHXCnyz38r9EUQgWoGr+hWxDG9QAACgLw X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) > > I also wonder whether you are perhaps changing the user experience > > here without a proper proposal and discussion in emacs-devel first. > > You seem to think that emacs-bugs is not a right place to discuss a > proposal. You are correct - that it is what I think. It is not the best place to discuss a user-visible behavior change. emacs-devel@gnu.org is the list for discussing such changes. Some interested in Emacs development follow that list but do not follow the bugs list. Yes, sometimes a bug report leads to further discussion that involves potentially changing behavior for users. And yes, sometimes that change is minimal and it is OK to decide here and let the wider community know via NEWS. And yes, sometimes it happens that discussion of even more substantial changes does not get moved from here to emacs-devel, out of laziness or whatever. But that is a weakness to be overcome. The wider Emacs development community deserves to follow and weigh in on user-visible behavior changes. > > "I will commit...tomorrow." does not inspire confidence. How about > > proposing a change and seeing what others in the development list > > think? > > It is happening as we type, don't you think. No, it is not. It is buried within a particular bug thread on a separate mailing list from emacs-devel@gnu.org. I would guess (but haven't checked) that many more people subscribe to emacs-devel than subscribe to the bug mailing list. Likewise would be my guess wrt those who read the dev and bug threads in other ways. Make a proposal for the behavior change and present it to emacs-devel. Based on the discussion (if any) and the decision reached there, you can then follow up with the bug fix. Reference the bug thread in the emacs-devel discussion via the bug # or its URL (but don't cc both lists). That's the right way, IMHO. It is not always followed correctly, unfortunately. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 12:28:47 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 17:28:47 +0000 Received: from localhost ([127.0.0.1]:39720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE166-0004ba-1U for submit@debbugs.gnu.org; Fri, 08 Mar 2013 12:28:47 -0500 Received: from mail-pb0-f45.google.com ([209.85.160.45]:38226) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE163-0004bN-5s for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 12:28:44 -0500 Received: by mail-pb0-f45.google.com with SMTP id ro8so1379826pbb.32 for <13687@debbugs.gnu.org>; Fri, 08 Mar 2013 09:27:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=SaLQSbOAFnJqrk+bKuveZY7DS8WHKMbL7ejXlwZ7F98=; b=gl8pw4zcCJh8529igWWo7g28Yx3cvdHgrFKTmCTAkxrAzd5zXK/FirRBNoI7arK5pk aD3yaIUIwxo0SE/uW7d/QGumx1yQRiYVcXDtFP9LPGyqeYF5z6C41Woz4WtBqvuPk9Iz D84Jpinqi0oeYjhHZ9/7jEghdHhJTciTKQvFvFQ1pRUyshzZ8HXaOy68sithMfSmYUBO kwBTL0PqtFK4iNhKrUVhCP2sTu/sYbvtmPLh+sBUmeFJAsmEKVNEHIG8ZYzCalUdKY2o eRi2sTXeSdU3nUeMMs6PmkGVHkOSSGEpR7E8oxRWgNbEPvX8F8gdhcTZ9rKGQ/hBioOq 149Q== X-Received: by 10.68.4.97 with SMTP id j1mr4464824pbj.157.1362763678695; Fri, 08 Mar 2013 09:27:58 -0800 (PST) Received: from debian-6.05 ([115.241.18.198]) by mx.google.com with ESMTPS id qp13sm6238384pbb.3.2013.03.08.09.27.55 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 08 Mar 2013 09:27:57 -0800 (PST) From: Jambunathan K To: "Drew Adams" Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87fw05esub.fsf@gmail.com> <084E374181BA45FB96F8F71A19E20182@us.oracle.com> Date: Fri, 08 Mar 2013 22:57:57 +0530 In-Reply-To: <084E374181BA45FB96F8F71A19E20182@us.oracle.com> (Drew Adams's message of "Fri, 8 Mar 2013 09:10:12 -0800") Message-ID: <87obetn6n6.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) You are silent about the patch... You may also be interested in http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/111971 I hear you. I some how think that emacs-devel doesn't deserve to be spammed by small time development efforts. The way I have been working till now is to create a bug report (you may call it a proposal) and provide a patch myself. I want my reports/proposals to be tracked. If discussions happen on emacs-devel then it may or may not be tracked. For example, look at this thread http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00033.html There are just 2 users talking. This possibly because the discussion is not critical for the current release cycle. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 12:32:45 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 17:32:45 +0000 Received: from localhost ([127.0.0.1]:39738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE19t-0004i9-5O for submit@debbugs.gnu.org; Fri, 08 Mar 2013 12:32:45 -0500 Received: from ps18281.dreamhost.com ([69.163.218.105]:39333 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE19n-0004hw-In for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 12:32:40 -0500 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 7B432258B92901; Fri, 8 Mar 2013 09:31:55 -0800 (PST) From: Juri Linkov To: "Drew Adams" Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Organization: JURTA References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> Date: Fri, 08 Mar 2013 19:28:09 +0200 In-Reply-To: <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> (Drew Adams's message of "Fri, 8 Mar 2013 07:29:52 -0800") Message-ID: <87li9xer9u.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13687 Cc: 'Jambunathan K' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Let the command decide its own defaulting. Individual commands that read the > minibuffer should control such defaulting, at the point of call. Since when the command commands the user, and not other way round? > They can rely on user options if they want to. But a single user option for > this kind of thing, and especially if it somehow takes control of defaulting > away from the caller (command), is a bad idea. Perhaps you missed the whole thread, but see what the users are forced to use http://stackoverflow.com/questions/15161592/make-emacs-rgrep-default-to-last-search-term-rather-than-word-at-point in the absence of customizable options. > FWIW, in my code I do something that I'm guessing might be similar to the > _effect_ you want, but I stay completely away from command lookup/dispatching. There is no command lookup/dispatching since Jambunathan implements the third variant, and not the second cited above. > I have a user option, `search/replace-default-fn', whose value (a function) > provides the default value(s) for functions `query-replace', `occur', > `how-many', `flush-lines',... Your `search/replace-default-fn' is exactly the same thing as `occur-read-regexp-defaults-function', so why do you object? From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 13:17:19 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 18:17:19 +0000 Received: from localhost ([127.0.0.1]:39835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE1r1-0005ke-Hc for submit@debbugs.gnu.org; Fri, 08 Mar 2013 13:17:19 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:25594) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE1qv-0005kM-1I for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 13:17:14 -0500 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r28IGO5D002387 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Mar 2013 18:16:24 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r28IGNTo028719 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Mar 2013 18:16:23 GMT Received: from abhmt106.oracle.com (abhmt106.oracle.com [141.146.116.58]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r28IGMDT022672; Fri, 8 Mar 2013 12:16:23 -0600 Received: from dradamslap1 (/10.159.244.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 08 Mar 2013 10:16:22 -0800 From: "Drew Adams" To: "'Juri Linkov'" References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org><87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com><1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> Subject: RE: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Date: Fri, 8 Mar 2013 10:16:14 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87li9xer9u.fsf@mail.jurta.org> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac4cItWxQ0FU7zT2S5aIFFYpwxGt7wAAN3UA X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: 13687 Cc: 'Jambunathan K' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) > > Let the command decide its own defaulting. Individual > > commands that read the minibuffer should control such defaulting, > > at the point of call. > > Since when the command commands the user, and not other way round? Straw man. No one proposed that the command command the user. It is normal, typical, and traditional, for a command that calls a function to read input, to provide whatever defaults are appropriate. Appropriate for that particular command. And of course appropriate for a user who chooses to invoke that command. > Perhaps you missed the whole thread, but see what the users > are forced to use > http://stackoverflow.com/questions/15161592/make-emacs-rgrep-default-to-last-sea rch-term-rather-than-word-at-point > in the absence of customizable options. Did you hear me propose to get rid of customizable options? FWIW, I see nothing wrong with the request of that user. What I suggested would be a misguided approach is to have an option that tries to configure defaulting for a whole slew of possibly unrelated commands. That's all. I pointed to an alternative approach that provides an option specific to a command or to a group of related commands, the option value being a default-value-providing function. All commands in the group use the same defaulting function. I even mentioned that if some user wanted to be more specific about defaulting behavior within the group of related commands, s?he could always do so by providing as the option value a function that dispatches among the commands - just like option `minibuffer-defaults'. The design would not encourage that, but it would anyway allow for it. E.g., in the code I cited, if a user does not want the same defaulting behavior for commands `occur', `how-many', etc., she can set option `search/replace-default-fn' to a function that distinguishes them (e.g., using `this-command', as Jambunathan suggested). But a priori (according to the developer of replace+.el), a user would want the same defaulting behavior for such commands, and that's why they were grouped to use a common option. If it was thought that most users would want separate defaulting behavior here, then the design would reflect that, providing separate options. The point is to keep things narrowed in focus, promoting modularity. I would group some commands together for convenience in customizing their defaulting behavior, but only if such grouping (common behavior) made sense. You would apparently group any and all commands - across the entire Emacs spectrum, providing a single option (`minibuffer-defaults') that dispatches according to the given command. IMO, that's not the best approach; that's all. > > FWIW, in my code I do something that I'm guessing might be > > similar to the _effect_ you want, but I stay completely away > > from command lookup/dispatching. > > There is no command lookup/dispatching since Jambunathan implements > the third variant, and not the second cited above. Sorry, dunno what that means. I was writing only in reaction to the (your?) proposed `minibuffer-defaults' option that is an alist of (COMMAND . FUNCTION) entries and that seemed to me to dispatch defaulting based on the COMMAND. > > I have a user option, `search/replace-default-fn', whose > > value (a function) provides the default value(s) for functions > > `query-replace', `occur', `how-many', `flush-lines',... > > Your `search/replace-default-fn' is exactly the same thing as > `occur-read-regexp-defaults-function', so why do you object? See above. 1. I admitted that I did not follow the thread. 2. I made clear that I was commenting only on the proposal of a `minibuffer-defaults' option that dispatches defaulting according to the command. 3. Wrt that proposal I suggested an alternative approach. If such an alternative is what is really being used, wunderbar. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 13:31:08 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 18:31:08 +0000 Received: from localhost ([127.0.0.1]:39847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE24M-00063z-Jx for submit@debbugs.gnu.org; Fri, 08 Mar 2013 13:31:06 -0500 Received: from mail-pb0-f50.google.com ([209.85.160.50]:39267) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE24H-00063S-2q for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 13:31:01 -0500 Received: by mail-pb0-f50.google.com with SMTP id up1so1450913pbc.37 for <13687@debbugs.gnu.org>; Fri, 08 Mar 2013 10:30:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=DGIAlKiFay5zbJmomyBbU6GRXDl6Fsk6hAOt56d4FTE=; b=xj26/Q18k6LM+0W9gHUI9y7OAaZuuIdiEKc7hJaCZLVOa7Oy4qgaa+FFep605c9eKA J7LJltZdfW2M6VYgf/nK55kcdYu9xweR71X+xi2WGvgU6p/xpY2MkkbahtFB6MHvbXxe uvVA9bS6IJI1tWNZ+pnJuGGaOoJdN38P1ZE/hZ9gdfIQ6P2B6qvLmaTXXESv3pGyGNV/ gEcsPS8Z81xaEK4t1KpNqQkB1y5APQmjsGpx8DSgasyFTQT7BFeeV+nyyYqF8AB9Gc9o 0jrSPopoftBc8TC0+doKNZtEAAWf78XofQBz0DKvzIhEW0xHDnKXurn9xvX29haYVI06 tmPQ== X-Received: by 10.68.195.33 with SMTP id ib1mr4864360pbc.105.1362767412283; Fri, 08 Mar 2013 10:30:12 -0800 (PST) Received: from debian-6.05 ([115.241.18.198]) by mx.google.com with ESMTPS id ri1sm6365698pbc.16.2013.03.08.10.30.08 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 08 Mar 2013 10:30:11 -0800 (PST) From: Jambunathan K To: "Drew Adams" Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> Date: Sat, 09 Mar 2013 00:00:11 +0530 In-Reply-To: (Drew Adams's message of "Fri, 8 Mar 2013 10:16:14 -0800") Message-ID: <8738w5n3rg.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) "Drew Adams" writes: > E.g., in the code I cited, if a user does not want the same defaulting > behavior for commands `occur', `how-many', etc., she can set option > `search/replace-default-fn' to a function that distinguishes them > (e.g., using `this-command', as Jambunathan suggested). Interesting suggestion there. This makes me think that there is no need for multiple `hi-lock-read-regexp-defaults-function' and a separate `occur-read-regexp-defaults-function' etc. But a single `read-regexp-defaults-function' that cases on `this-command'. The function can return a symbol token like `t' for `this-command's which it doesn't want to meddle with but return nil or a regexp or list of regexps for commands it wants to insinuate. Is there any problem with this `read-regexp-defaults-function' approach? From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 13:54:53 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 18:54:53 +0000 Received: from localhost ([127.0.0.1]:39883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE2RQ-0006bp-An for submit@debbugs.gnu.org; Fri, 08 Mar 2013 13:54:52 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:46219) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE2RN-0006bb-La for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 13:54:50 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r28Is4gn012361 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Mar 2013 18:54:04 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r28Is3W8018084 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Mar 2013 18:54:03 GMT Received: from abhmt108.oracle.com (abhmt108.oracle.com [141.146.116.60]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r28Is3YK020027; Fri, 8 Mar 2013 12:54:03 -0600 Received: from dradamslap1 (/10.159.244.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 08 Mar 2013 10:54:02 -0800 From: "Drew Adams" To: "'Jambunathan K'" References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org><87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com><1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com><87li9xer9u.fsf@mail.jurta.org> <8738w5n3rg.fsf@gmail.com> Subject: RE: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Date: Fri, 8 Mar 2013 10:53:54 -0800 Message-ID: <812C4DC04A0D46B8AC5B11170E06A75C@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <8738w5n3rg.fsf@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac4cKvl5oHOt+wqlRHKqNjUHS6XgcQAAKUag X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) > > E.g., in the code I cited, if a user does not want the same > > defaulting behavior for commands `occur', `how-many', etc., > > she can set option `search/replace-default-fn' to a function > > that distinguishes them (e.g., using `this-command', as > > Jambunathan suggested). > > Interesting suggestion there. > > This makes me think that there is no need for multiple > `hi-lock-read-regexp-defaults-function' and a separate > `occur-read-regexp-defaults-function' etc. But a single > `read-regexp-defaults-function' that cases on `this-command'. The question, as I said, is whether it makes sense, for the particular commands that we group to use the same option, to provide the default regexp (or other string) in the same way. I can't speak to whether that is the case for hi-lock, occur, etc. But if it is true, then yes, a single option for such a group of commands makes sense. > The function can return a symbol token like `t' for > `this-command's which it doesn't want to meddle with but > return nil or a regexp or list of regexps for commands it > wants to insinuate. That is not what I suggested. I suggested that the option value be a function that returns a string to use as the default value when reading user input. What I said in the passage you cite is that that function (the value of the option) could, if the user so wants, itself test `this-command' and provide a different string depending on the current command. > Is there any problem with this > `read-regexp-defaults-function' approach? I think you're suggesting that the option value be a function that returns t or nil, instead of returning a default-value string. It's not clear to me how a given command such as `occur' would make use of that Boolean return value. As I noted before, I would not _encourage_ users to use a dispatching function as the option value, but that would not (could not) be prevented. They can do anything they want using any function they want. The out-of-the-box design should make a reasonable assumption about which commands to group (i.e., which should use the same option). If it is expected that some command that reads a regexp would generally be better off with a different defaulting behavior, then that command should not use the group option. It could use its own, similar option, with a different default option value (a different default-value-providing function). Or it could hard-code its defaulting, or whatever. The use of a function to dispatch according to the current command should be exceptional, IMO - only a fallback possibility and not something to be encouraged. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 14:04:43 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 19:04:44 +0000 Received: from localhost ([127.0.0.1]:39911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE2ax-0007ki-H0 for submit@debbugs.gnu.org; Fri, 08 Mar 2013 14:04:43 -0500 Received: from mail-pb0-f52.google.com ([209.85.160.52]:42019) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE2au-0007kV-ST for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 14:04:41 -0500 Received: by mail-pb0-f52.google.com with SMTP id ma3so1482869pbc.11 for <13687@debbugs.gnu.org>; Fri, 08 Mar 2013 11:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=Wgr4h239zvgm0KFgVSMvZsMIEit5lLgMLxLQUwtKzAs=; b=IjHSOHPqbAmFjpCfhkHEazK8qjmoGgAxw9MSL4L9A0lpxhc5rM1JRlLHqI7tboUNvA jH0Z8OznhLBmK0UFRGEQtOzWLMj0iAX2Luluiv0HUIsoXbv4a3R74xfLLt4n+nKauA4s N1SCOaRcJ+yS3VbxpnOSnv2pkXKlmNFwTc/WSuaJUBJGX2FvKT+Cc/OgAlkn0hsTRcVQ 4PfbGab8auvZ2Qx0EBAfgLn9MTChVJLwgUn6wa66Olf+Jg0hAIL4WVSCys6XAiVkDhxP 8ZYBxwFluqB1ggrQ0JnlzRkgXM/bUI+9uo5xXYlYmqKJwN3f1T4Y/Vlo7TvbMFEmvAPS I8Dw== X-Received: by 10.68.196.129 with SMTP id im1mr4876133pbc.206.1362769436278; Fri, 08 Mar 2013 11:03:56 -0800 (PST) Received: from debian-6.05 ([115.241.18.198]) by mx.google.com with ESMTPS id tm1sm6440995pbc.11.2013.03.08.11.03.52 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 08 Mar 2013 11:03:55 -0800 (PST) From: Jambunathan K To: "Drew Adams" Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> <8738w5n3rg.fsf@gmail.com> <812C4DC04A0D46B8AC5B11170E06A75C@us.oracle.com> Date: Sat, 09 Mar 2013 00:33:56 +0530 In-Reply-To: <812C4DC04A0D46B8AC5B11170E06A75C@us.oracle.com> (Drew Adams's message of "Fri, 8 Mar 2013 10:53:54 -0800") Message-ID: <87obetww6b.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Suspend your judgement. I don't like to discuss (or rather I cannot discuss) in abstract. It is so error prone. I will show my wares tomorrow. "Drew Adams" writes: >> > E.g., in the code I cited, if a user does not want the same >> > defaulting behavior for commands `occur', `how-many', etc., >> > she can set option `search/replace-default-fn' to a function >> > that distinguishes them (e.g., using `this-command', as >> > Jambunathan suggested). >> >> Interesting suggestion there. >> >> This makes me think that there is no need for multiple >> `hi-lock-read-regexp-defaults-function' and a separate >> `occur-read-regexp-defaults-function' etc. But a single >> `read-regexp-defaults-function' that cases on `this-command'. > > The question, as I said, is whether it makes sense, for the particular commands > that we group to use the same option, to provide the default regexp (or other > string) in the same way. > > I can't speak to whether that is the case for hi-lock, occur, etc. But if it is > true, then yes, a single option for such a group of commands makes sense. > >> The function can return a symbol token like `t' for >> `this-command's which it doesn't want to meddle with but >> return nil or a regexp or list of regexps for commands it >> wants to insinuate. > > That is not what I suggested. I suggested that the option value be a function > that returns a string to use as the default value when reading user input. > > What I said in the passage you cite is that that function (the value of the > option) could, if the user so wants, itself test `this-command' and provide a > different string depending on the current command. > >> Is there any problem with this >> `read-regexp-defaults-function' approach? > > I think you're suggesting that the option value be a function that returns t or > nil, instead of returning a default-value string. It's not clear to me how a > given command such as `occur' would make use of that Boolean return value. > > As I noted before, I would not _encourage_ users to use a dispatching function > as the option value, but that would not (could not) be prevented. They can do > anything they want using any function they want. > > The out-of-the-box design should make a reasonable assumption about which > commands to group (i.e., which should use the same option). > > If it is expected that some command that reads a regexp would generally be > better off with a different defaulting behavior, then that command should not > use the group option. It could use its own, similar option, with a different > default option value (a different default-value-providing function). Or it > could hard-code its defaulting, or whatever. > > The use of a function to dispatch according to the current command should be > exceptional, IMO - only a fallback possibility and not something to be > encouraged. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 08 16:09:37 2013 Received: (at 13687) by debbugs.gnu.org; 8 Mar 2013 21:09:37 +0000 Received: from localhost ([127.0.0.1]:40067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE4Xo-0002Bm-CI for submit@debbugs.gnu.org; Fri, 08 Mar 2013 16:09:37 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:40720) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UE4Xm-0002Ba-UA for 13687@debbugs.gnu.org; Fri, 08 Mar 2013 16:09:35 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r28L8n8x022720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Mar 2013 21:08:49 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r28L8mEO023646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Mar 2013 21:08:48 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r28L8mxZ020728; Fri, 8 Mar 2013 15:08:48 -0600 Received: from dradamslap1 (/10.159.244.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 08 Mar 2013 13:08:48 -0800 From: "Drew Adams" To: "'Jambunathan K'" References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org><87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com><1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com><87li9xer9u.fsf@mail.jurta.org><8738w5n3rg.fsf@gmail.com><812C4DC04A0D46B8AC5B11170E06A75C@us.oracle.com> <87obetww6b.fsf@gmail.com> Subject: RE: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Date: Fri, 8 Mar 2013 13:08:39 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87obetww6b.fsf@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac4cL6/fc2QyK30OS2e1BNYRQUEjPAAEVy+Q X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) > Suspend your judgement. I don't like to discuss (or rather I cannot > discuss) in abstract. It is so error prone. I will show my wares > tomorrow. Please take your time. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 09 03:48:12 2013 Received: (at 13687) by debbugs.gnu.org; 9 Mar 2013 08:48:12 +0000 Received: from localhost ([127.0.0.1]:40818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEFRr-0002J6-Kr for submit@debbugs.gnu.org; Sat, 09 Mar 2013 03:48:12 -0500 Received: from mail-pb0-f41.google.com ([209.85.160.41]:57477) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEFRp-0002It-9G for 13687@debbugs.gnu.org; Sat, 09 Mar 2013 03:48:10 -0500 Received: by mail-pb0-f41.google.com with SMTP id um15so2060712pbc.28 for <13687@debbugs.gnu.org>; Sat, 09 Mar 2013 00:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=0lTLIhE7+1JtFsqNycNkNjU6BYDvyjWOWP2ZJRcRBg8=; b=oL0CElLCGHc/uxAmYgAOE5vEBkyso1bRBIYgK0TXtQrBInVhniC+10B3JmpnAyC5dQ D9oEiHO8f+0DIUsHL4fdH3IxymodUqzlRkDvmppkdSGpz62TDGcc8IsxBdOMEBzZxyOR l8Nt1iiIqDRPFmuDNTZBnU7Pg9VR55L9w+VFWmjGFO2TK6WX0sYTtiQiR3Ym7l86Y4aa aYSPWWKRPiQ3jRuXzLpuS6eIchOlMi6QWiqyV+95+AcsBD/SmVk/bSSkyqTMnR5db573 JkTZbSKU+8+ImIT+gICUohoWbbSNKLFQSy2Rev+LRoBugkbGiqAhIdGrOPKBibtYiRlw 0B1g== X-Received: by 10.68.179.1 with SMTP id dc1mr3090187pbc.128.1362818841124; Sat, 09 Mar 2013 00:47:21 -0800 (PST) Received: from debian-6.05 ([115.242.225.97]) by mx.google.com with ESMTPS id vq9sm9226894pbc.36.2013.03.09.00.47.16 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sat, 09 Mar 2013 00:47:20 -0800 (PST) From: Jambunathan K To: "Drew Adams" Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> <8738w5n3rg.fsf@gmail.com> Date: Sat, 09 Mar 2013 14:17:22 +0530 In-Reply-To: <8738w5n3rg.fsf@gmail.com> (Jambunathan K.'s message of "Sat, 09 Mar 2013 00:00:11 +0530") Message-ID: <87d2v9rmcl.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Jambunathan K writes: > "Drew Adams" writes: > >> E.g., in the code I cited, if a user does not want the same defaulting >> behavior for commands `occur', `how-many', etc., she can set option >> `search/replace-default-fn' to a function that distinguishes them >> (e.g., using `this-command', as Jambunathan suggested). > > Interesting suggestion there. > > This makes me think that there is no need for multiple > `hi-lock-read-regexp-defaults-function' and a separate > `occur-read-regexp-defaults-function' etc. But a single > `read-regexp-defaults-function' that cases on `this-command'. > > The function can return a symbol token like `t' for `this-command's > which it doesn't want to meddle with but return nil or a regexp or list > of regexps for commands it wants to insinuate. > > Is there any problem with this `read-regexp-defaults-function' > approach? EXPERIMENTAL and ABANDONED PATCH Use of `this-command' is very fragile and flaky. Consider `multi-occur-in-matching-buffers' which does multiple `read-regexp' - one for the buffers and one for the actual regexp. It is not possible to return a two different regexps for the same `this-command'. Interestingly, I am attaching a long from *Messages* buffer and it looks like `this-command' is not reliable (Do you see `exit-minibuffer' in the logs.) So `this-command' could work for simple commands like highlighting commands but will be flaky to be applied in general. Anyways good to experiment and see where an idea takes us... ---------------------------------------------------------------- Customization (custom-set-variables '(read-regexp-user-defaults (quote ((highlight-regexp find-tag-default-as-regexp) (highlight-phrase find-tag-default) (multi-occur-in-matching-buffers find-tag-default))))) ---------------------------------------------------------------- --=-=-= Content-Type: text/x-diff Content-Disposition: inline Content-Description: replace.el.patch === modified file 'lisp/replace.el' --- lisp/replace.el 2013-03-08 04:18:16 +0000 +++ lisp/replace.el 2013-03-09 08:23:57 +0000 @@ -580,6 +580,39 @@ of `history-length', which see.") (defvar occur-collect-regexp-history '("\\1") "History of regexp for occur's collect operation") +(defcustom read-regexp-user-defaults nil + "" + :type '(choice + (const :tag "Use system defaults" nil) + (repeat :tag "Per-command defaults" + (list (radio :tag "Command" + (function-item highlight-regexp) + (function-item highlight-phrase) + (function-item highlight-lines-matching-regexp) + (function :tag "Command")) + (choice :tag "Function to retrieve the regexp" + (const :tag "Use no defaults" nil) + (const :tag "Use system defaults" t) + (radio + (function-item find-tag-default-as-regexp) + (function-item find-tag-default) + (function-item :tag "Regexp history" + (lambda nil + "Use regexp history." + (car regexp-history))) + function))))) + :group 'matching + :version "24.4") + +(defun read-regexp-defaults () + (if (not read-regexp-user-defaults) t + (let ((user-default (assoc this-command read-regexp-user-defaults))) + (pcase user-default + (`(,cmd ,(and (pred functionp) getter)) + (funcall getter)) + (`nil nil) + (_ t))))) + (defun read-regexp (prompt &optional defaults history) "Read and return a regular expression as a string. When PROMPT doesn't end with a colon and space, it adds a final \": \". @@ -597,6 +630,11 @@ and the last replacement regexp. Optional arg HISTORY is a symbol to use for the history list. If HISTORY is nil, `regexp-history' is used." + (let ((user-defaults (read-regexp-defaults))) + (unless (eq user-defaults t) + (setq defaults user-defaults) + (message "cmd: %s defaults: %S" this-command defaults))) + (let* ((default (if (consp defaults) (car defaults) defaults)) (suggestions (if (listp defaults) defaults (list defaults))) (suggestions --=-=-= Content-Type: text/plain ---------------------------------------------------------------- *Messages* Global-Hi-Lock mode enabled Mark saved where search started cmd: highlight-regexp defaults: "\\_" cmd: highlight-regexp defaults: "\\_" cmd: highlight-phrase defaults: "min-colors" cmd: multi-occur-in-matching-buffers defaults: ":background" cmd: exit-minibuffer defaults: nil Searched 1 buffer; 10 matches for `yellow' --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 09 10:10:08 2013 Received: (at 13687) by debbugs.gnu.org; 9 Mar 2013 15:10:08 +0000 Received: from localhost ([127.0.0.1]:41901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UELPQ-0004ZJ-CB for submit@debbugs.gnu.org; Sat, 09 Mar 2013 10:10:08 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:29112) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UELPJ-0004Ye-UY for 13687@debbugs.gnu.org; Sat, 09 Mar 2013 10:10:02 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r29F970o028507 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 9 Mar 2013 15:09:08 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r29F978j000663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Mar 2013 15:09:07 GMT Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r29F95uV012030; Sat, 9 Mar 2013 09:09:05 -0600 Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Mar 2013 07:09:05 -0800 From: "Drew Adams" To: "'Jambunathan K'" References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org><87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com><1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com><87li9xer9u.fsf@mail.jurta.org><8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com> Subject: RE: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Date: Sat, 9 Mar 2013 07:08:54 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87d2v9rmcl.fsf@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac4coreLtZlsGJ6oTRCNIzhLqvIQpgAMVRQQ X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) > EXPERIMENTAL and ABANDONED PATCH > > Use of `this-command' is very fragile and flaky. No, but it is somewhat fragile. > Consider `multi-occur-in-matching-buffers' which does multiple > `read-regexp' - one for the buffers and one for the actual > regexp. It is not possible to return a two different regexps > for the same `this-command'. You don't need to. If a user needs to test for `multi-occur-in-matching-buffers' via `this-command' then s?he can do that and act accordingly. No need for general code that tries to second-guess things. > Interestingly, I am attaching a long from *Messages* buffer > and it looks like `this-command' is not reliable (Do you see > `exit-minibuffer' in the logs.) See below. > So `this-command' could work for simple commands like highlighting > commands but will be flaky to be applied in general. > > Anyways good to experiment and see where an idea takes us... As I said, we should not encourage this. And yes, any use of `last-command' or `this-command' is somewhat fragile, because some functions intentionally change their values. And yes, comparing functions is also problematic in general. No eta reduction, for one thing: (equal (lambda (x) (car x)) 'car). See what I wrote earlier. Let users choose any string-returning function they want to use for defaulting. If a user wants to use a function that conditions its return value on `this-command', s?he can always do so. But there is no reason to encourage that. Any set of commands that we design to use the same defaulting choice (via the same user option) should be a cohesive group: the same choice should make sense across that set. If you have one or more commands that do not fit that, then give them their own defaulting options (grouping again, where appropriate). There is nothing new here - just common sense. The solution is simple, IMO. > Interestingly, I am attaching a long from *Messages* buffer > and it looks like `this-command' is not reliable (Do you see > `exit-minibuffer' in the logs.) > > cmd: exit-minibuffer defaults: nil Your code checks only (eq user-defaults t). When `user-defaults' is nil, this returns nil. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 09 11:22:04 2013 Received: (at 13687) by debbugs.gnu.org; 9 Mar 2013 16:22:04 +0000 Received: from localhost ([127.0.0.1]:41991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEMX5-0006EG-Vn for submit@debbugs.gnu.org; Sat, 09 Mar 2013 11:22:04 -0500 Received: from mail-pb0-f44.google.com ([209.85.160.44]:58893) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEMX3-0006Dm-68 for 13687@debbugs.gnu.org; Sat, 09 Mar 2013 11:22:02 -0500 Received: by mail-pb0-f44.google.com with SMTP id wz12so2274473pbc.3 for <13687@debbugs.gnu.org>; Sat, 09 Mar 2013 08:21:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=pHM0bavr8IkbvAOqpz04aKwKm5GpaB1euwS9ScyreYQ=; b=e8vdSK3eRrlfs3hQR+CBO17dAwLIFaJcJa8VBSJy2YnvTeu4C/KeZKLOZJO+cqbISv TvHrhjTADQI/NPtFwg2zHynN0JJej2ZrRGTNtwqPy9yEmrMXWK8Ls3NBLw+t7vU+Pgo+ IATqRViqF23Sj0TxVinAZT7o6f0nUAYkH5WzLmt1uMoFtqJqn7Sguvtl4B0hpKyrLxIg DKwRn5SmX+TeTlnVt7LS/fkoDcyWNAU5espsRxmwRFFopIX6uHCNMGy9ZnUl4rZMct4t mMBG/tGkB363Q4MdLbpM70rZhR+KVw4yS/zoX8h8+iCdmc0sjrMPhLUB+BzipABoqGEy YOXQ== X-Received: by 10.68.252.134 with SMTP id zs6mr5670051pbc.66.1362846071494; Sat, 09 Mar 2013 08:21:11 -0800 (PST) Received: from debian-6.05 ([101.63.128.26]) by mx.google.com with ESMTPS id gf6sm10914112pbc.24.2013.03.09.08.21.08 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sat, 09 Mar 2013 08:21:10 -0800 (PST) From: Jambunathan K To: "Drew Adams" Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> <8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com> Date: Sat, 09 Mar 2013 21:51:11 +0530 In-Reply-To: (Drew Adams's message of "Sat, 9 Mar 2013 07:08:54 -0800") Message-ID: <87sj44o87c.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Drew You are beating a dead horse and the first line clearly says it is a DEAD HORSE. The mail only stated why I KILLED the horse. It is my way of saying my earlier patch to hi-lock and the previous patch to occur stands and is useful. I will definitely look in to comments that you may have to offer with the patch that introduces `occur-read-regexp-defaults-function'. Grouping - I don't know why you are beating on it - will now be user's responsibility not that of Emacs. Jambunathan K. "Drew Adams" writes: >> EXPERIMENTAL and ABANDONED PATCH > >> Use of `this-command' is very fragile and flaky. > > No, but it is somewhat fragile. > >> Consider `multi-occur-in-matching-buffers' which does multiple >> `read-regexp' - one for the buffers and one for the actual >> regexp. It is not possible to return a two different regexps >> for the same `this-command'. > > You don't need to. If a user needs to test for > `multi-occur-in-matching-buffers' via `this-command' then s?he can do that and > act accordingly. No need for general code that tries to second-guess things. > >> Interestingly, I am attaching a long from *Messages* buffer >> and it looks like `this-command' is not reliable (Do you see >> `exit-minibuffer' in the logs.) > > See below. > >> So `this-command' could work for simple commands like highlighting >> commands but will be flaky to be applied in general. >> >> Anyways good to experiment and see where an idea takes us... > > As I said, we should not encourage this. And yes, any use of `last-command' or > `this-command' is somewhat fragile, because some functions intentionally change > their values. > > And yes, comparing functions is also problematic in general. No eta reduction, > for one thing: (equal (lambda (x) (car x)) 'car). > > See what I wrote earlier. Let users choose any string-returning function they > want to use for defaulting. If a user wants to use a function that conditions > its return value on `this-command', s?he can always do so. > > But there is no reason to encourage that. Any set of commands that we design to > use the same defaulting choice (via the same user option) should be a cohesive > group: the same choice should make sense across that set. > > If you have one or more commands that do not fit that, then give them their own > defaulting options (grouping again, where appropriate). > > There is nothing new here - just common sense. The solution is simple, IMO. > >> Interestingly, I am attaching a long from *Messages* buffer >> and it looks like `this-command' is not reliable (Do you see >> `exit-minibuffer' in the logs.) >> >> cmd: exit-minibuffer defaults: nil > > Your code checks only (eq user-defaults t). When `user-defaults' is nil, this > returns nil. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 09 11:39:00 2013 Received: (at 13687) by debbugs.gnu.org; 9 Mar 2013 16:39:00 +0000 Received: from localhost ([127.0.0.1]:42014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEMnT-0006bo-Du for submit@debbugs.gnu.org; Sat, 09 Mar 2013 11:38:59 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:43292) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEMnR-0006bb-1P for 13687@debbugs.gnu.org; Sat, 09 Mar 2013 11:38:58 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r29Gc6vQ016724 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 9 Mar 2013 16:38:07 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r29Gc5fZ026022 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Mar 2013 16:38:06 GMT Received: from abhmt103.oracle.com (abhmt103.oracle.com [141.146.116.55]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r29Gc4gC030326; Sat, 9 Mar 2013 10:38:04 -0600 Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Mar 2013 08:38:04 -0800 From: "Drew Adams" To: "'Jambunathan K'" References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org><87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com><1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com><87li9xer9u.fsf@mail.jurta.org><8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com> <87sj44o87c.fsf@gmail.com> Subject: RE: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Date: Sat, 9 Mar 2013 08:37:53 -0800 Message-ID: <365EC1D3D8334B83827CDD1691FDEBC7@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87sj44o87c.fsf@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac4c4h580AYQEd+2Si6StlowlGj6XwAAZjmA X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) > Drew You are beating a dead horse and the first line clearly > says it is a DEAD HORSE. The mail only stated why I KILLED > the horse. I'm not beating anything. > It is my way of saying my earlier patch to hi-lock and the previous > patch to occur stands and is useful. I will definitely look in to > comments that you may have to offer with the patch that introduces > `occur-read-regexp-defaults-function'. > > Grouping - I don't know why you are beating on it - will now be > user's responsibility not that of Emacs. I'm not beating on anything. Do you at least see why your *Messages* logged `exit-minibuffer'? From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 09 12:00:08 2013 Received: (at 13687) by debbugs.gnu.org; 9 Mar 2013 17:00:08 +0000 Received: from localhost ([127.0.0.1]:42041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEN7v-00075Z-Ny for submit@debbugs.gnu.org; Sat, 09 Mar 2013 12:00:07 -0500 Received: from mail-pb0-f53.google.com ([209.85.160.53]:46328) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEN7t-00074D-9N for 13687@debbugs.gnu.org; Sat, 09 Mar 2013 12:00:06 -0500 Received: by mail-pb0-f53.google.com with SMTP id un1so2282485pbc.12 for <13687@debbugs.gnu.org>; Sat, 09 Mar 2013 08:59:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=wSJAdpQ87bNQ3INRkXfSFI3m5sbKl0qrF1EOWroUSgo=; b=Pf6ZwEaHyIdwU19Q4jWQeydcTHTOmGPrW8NqLU2RPfvQhUm6M9znEu2QrArVsMx0mj cksxFhrlG6DVw2epNpKwkY7jfyuU90MNJtc7uVFUDyplZdoBwy2poB4OxcQ51sXO4b0j 9aStQF6U+vqURhC9aMEpWs/9fryRTPtEUFOu/D8pTVz0HuH8pP7zH+xZL7F1qeOwJapb B0xDlWIptDP7ZL9HD0Rl8DpUbqkY2s+6/WeZsczMbANiA1oXm7U0a8+bZhufJciUiXa+ e74uJtOpTx2vL80SE56N3wjN2/p3Be0Ei5+co3DmnSL9RE6pNaolR1AQWwDieB1gXVN7 AItQ== X-Received: by 10.68.137.42 with SMTP id qf10mr5644278pbb.80.1362848355574; Sat, 09 Mar 2013 08:59:15 -0800 (PST) Received: from debian-6.05 ([101.63.128.26]) by mx.google.com with ESMTPS id iu10sm11061828pbc.13.2013.03.09.08.59.11 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sat, 09 Mar 2013 08:59:14 -0800 (PST) From: Jambunathan K To: "Drew Adams" Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> <8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com> <87sj44o87c.fsf@gmail.com> <365EC1D3D8334B83827CDD1691FDEBC7@us.oracle.com> Date: Sat, 09 Mar 2013 22:29:13 +0530 In-Reply-To: <365EC1D3D8334B83827CDD1691FDEBC7@us.oracle.com> (Drew Adams's message of "Sat, 9 Mar 2013 08:37:53 -0800") Message-ID: <87vc90se5a.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) "Drew Adams" writes: > Do you at least see why your *Messages* logged `exit-minibuffer'? ,---- In `read-regexp' | + (let ((user-defaults (read-regexp-defaults))) | + (unless (eq user-defaults t) | + (setq defaults user-defaults) | + (message "cmd: %s defaults: %S" this-command defaults))) | + `---- ,---- | Global-Hi-Lock mode enabled | Mark saved where search started | cmd: highlight-regexp defaults: "\\_" | cmd: highlight-regexp defaults: "\\_" | cmd: highlight-phrase defaults: "min-colors" | cmd: multi-occur-in-matching-buffers defaults: ":background" | cmd: exit-minibuffer defaults: nil | Searched 1 buffer; 10 matches for `yellow' `---- >> Interestingly, I am attaching a long from *Messages* buffer >> and it looks like `this-command' is not reliable (Do you see >> `exit-minibuffer' in the logs.) >> >> cmd: exit-minibuffer defaults: nil > > Your code checks only (eq user-defaults t). When `user-defaults' is nil, this > returns nil. The cmd is `exit-minibuffer'. That corresponds to RET in minibuffer map. I have no other explanation. Btw, your explanation is *totally* off the mark. It talks about defaults in my snippet and not the cmd. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 09 12:15:48 2013 Received: (at 13687) by debbugs.gnu.org; 9 Mar 2013 17:15:48 +0000 Received: from localhost ([127.0.0.1]:42067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UENN5-0007RJ-N9 for submit@debbugs.gnu.org; Sat, 09 Mar 2013 12:15:48 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:48416) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UENN3-0007R6-D7 for 13687@debbugs.gnu.org; Sat, 09 Mar 2013 12:15:46 -0500 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r29HEsRO005155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 9 Mar 2013 17:14:55 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r29HEsUd009254 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Mar 2013 17:14:54 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r29HEq4R029247; Sat, 9 Mar 2013 11:14:52 -0600 Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Mar 2013 09:14:52 -0800 From: "Drew Adams" To: "'Jambunathan K'" References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org><87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com><1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com><87li9xer9u.fsf@mail.jurta.org><8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com><87sj44o87c.fsf@gmail.com><365EC1D3D8334B83827CDD1691FDEBC7@us.oracle.com> <87vc90se5a.fsf@gmail.com> Subject: RE: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Date: Sat, 9 Mar 2013 09:14:41 -0800 Message-ID: <778E2A4E7CBA425C994F7678C2E690CE@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87vc90se5a.fsf@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac4c529Ccfj3IbswSlWy1xgOal/04QAAOXAA X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) > > Do you at least see why your *Messages* logged `exit-minibuffer'? > > ,---- In `read-regexp' > | + (let ((user-defaults (read-regexp-defaults))) > | + (unless (eq user-defaults t) > | + (setq defaults user-defaults) > | + (message "cmd: %s defaults: %S" this-command defaults))) > | + > `---- > > cmd: exit-minibuffer defaults: nil > > > Your code checks only (eq user-defaults t). When > > `user-defaults' is nil, this returns nil. > > The cmd is `exit-minibuffer'. That corresponds to RET in minibuffer > map. I have no other explanation. > > Btw, your explanation is *totally* off the mark. It talks about > defaults in my snippet and not the cmd. NOW I suppose I AM dealing with a dead horse. But in hopes of helping and at the risk of being told once more to f___ off, let me try once more: +(defun read-regexp-defaults () + (if (not read-regexp-user-defaults) t + (let ((user-default (assoc this-command read-regexp-user-defaults))) + (pcase user-default + (`(,cmd ,(and (pred functionp) getter)) + (funcall getter)) + (`nil nil) + (_ t))))) Don't you think that that will return nil when `this-command' = `exit-minibuffer', since `exit-minibuffer' is not in your value of alist `read-regexp-user-defaults'? And if it returns nil, don't you think that the following will then print `cmd: exit-minibuffer defaults: nil'? + (let ((user-defaults (read-regexp-defaults))) + (unless (eq user-defaults t) + (setq defaults user-defaults) + (message "cmd: %s defaults: %S" this-command defaults))) If this doesn't help, I give up and lie down next to your dead horse. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 09 12:26:11 2013 Received: (at 13687) by debbugs.gnu.org; 9 Mar 2013 17:26:12 +0000 Received: from localhost ([127.0.0.1]:42094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UENX9-0007h2-GR for submit@debbugs.gnu.org; Sat, 09 Mar 2013 12:26:11 -0500 Received: from mail-pb0-f42.google.com ([209.85.160.42]:57647) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UENX6-0007go-NK for 13687@debbugs.gnu.org; Sat, 09 Mar 2013 12:26:09 -0500 Received: by mail-pb0-f42.google.com with SMTP id xb4so2301714pbc.1 for <13687@debbugs.gnu.org>; Sat, 09 Mar 2013 09:25:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=ta3e1XOZ5LEwjsMV+qcafcx2gaj/YAa9837Kqohtd+w=; b=WybP5OfeYGD1/IiZbEcxRRSHkHIZEpdkzrB62f6gZAfggMLFrCOxYM3LTWNEtzc9nm DyrvUVJiBbnncmn04vNXXrz1ltcnu1cYfCqGYQy5S2oyJk3U1e26Y5VI7rq4VyLqUxWy KokZtDwyUJzjXAbgRFEDKLNCNDrDguGfFTTcvXgLYJrAlQFavzxLnpfbZIh3IIDIH56O KOFF4YaZy8oNztwBR1CSaBc90a//2VQHmFkDrhOkp07TYxX2HehyQBo9pw2a/0ZmdKpY WbQSR9Qwghe4yjyiiLLc6DOVYWTmTlJn/Q+rOh0otyeeYf9KT1ERmwtHbUQui4puDL0Q ioow== X-Received: by 10.68.239.3 with SMTP id vo3mr6464939pbc.184.1362849919010; Sat, 09 Mar 2013 09:25:19 -0800 (PST) Received: from debian-6.05 ([101.63.128.26]) by mx.google.com with ESMTPS id qb10sm11132996pbb.43.2013.03.09.09.25.15 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sat, 09 Mar 2013 09:25:18 -0800 (PST) From: Jambunathan K To: "Drew Adams" Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> <8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com> <87sj44o87c.fsf@gmail.com> <365EC1D3D8334B83827CDD1691FDEBC7@us.oracle.com> <87vc90se5a.fsf@gmail.com> <778E2A4E7CBA425C994F7678C2E690CE@us.oracle.com> Date: Sat, 09 Mar 2013 22:55:18 +0530 In-Reply-To: <778E2A4E7CBA425C994F7678C2E690CE@us.oracle.com> (Drew Adams's message of "Sat, 9 Mar 2013 09:14:41 -0800") Message-ID: <87fw04scxt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) "Drew Adams" writes: >> > Do you at least see why your *Messages* logged `exit-minibuffer'? >> >> ,---- In `read-regexp' >> | + (let ((user-defaults (read-regexp-defaults))) >> | + (unless (eq user-defaults t) >> | + (setq defaults user-defaults) >> | + (message "cmd: %s defaults: %S" this-command defaults))) >> | + >> `---- >> >> cmd: exit-minibuffer defaults: nil >> >> > Your code checks only (eq user-defaults t). When >> > `user-defaults' is nil, this returns nil. >> >> The cmd is `exit-minibuffer'. That corresponds to RET in minibuffer >> map. I have no other explanation. >> >> Btw, your explanation is *totally* off the mark. It talks about >> defaults in my snippet and not the cmd. > > NOW I suppose I AM dealing with a dead horse. But in hopes of helping and at > the risk of being told once more to f___ off, let me try once more: > > +(defun read-regexp-defaults () > + (if (not read-regexp-user-defaults) t > + (let ((user-default (assoc this-command read-regexp-user-defaults))) > + (pcase user-default > + (`(,cmd ,(and (pred functionp) getter)) > + (funcall getter)) > + (`nil nil) > + (_ t))))) > > Don't you think that that will return nil when `this-command' = > `exit-minibuffer', since `exit-minibuffer' is not in your value of alist > `read-regexp-user-defaults'? Right. > And if it returns nil, don't you think that the following will then print `cmd: > exit-minibuffer defaults: nil'? > > + (let ((user-defaults (read-regexp-defaults))) > + (unless (eq user-defaults t) > + (setq defaults user-defaults) > + (message "cmd: %s defaults: %S" this-command defaults))) > > If this doesn't help, I give up and lie down next to your dead horse. Right. The question is why is this-command `exit-minibuffer' when it should have been `multi-occur-in-matching-buffers'. Where does `exit-minibuffer' come from. I am not concerned about the defaults, I am concerned about how the cmd. Do you have an explanation. There should be an explanation... and the closest I have come to is to map RET to `exit-minibuffer'. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 09 12:57:02 2013 Received: (at 13687) by debbugs.gnu.org; 9 Mar 2013 17:57:03 +0000 Received: from localhost ([127.0.0.1]:42119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEO10-0000r7-2j for submit@debbugs.gnu.org; Sat, 09 Mar 2013 12:57:02 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:17010) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEO0x-0000qn-7F for 13687@debbugs.gnu.org; Sat, 09 Mar 2013 12:57:00 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r29Hu8A9007682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 9 Mar 2013 17:56:09 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r29Hu7wT004432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Mar 2013 17:56:08 GMT Received: from abhmt108.oracle.com (abhmt108.oracle.com [141.146.116.60]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r29Hu7e6027803; Sat, 9 Mar 2013 11:56:07 -0600 Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Mar 2013 09:56:07 -0800 From: "Drew Adams" To: "'Jambunathan K'" References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org><87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com><1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com><87li9xer9u.fsf@mail.jurta.org><8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com><87sj44o87c.fsf@gmail.com><365EC1D3D8334B83827CDD1691FDEBC7@us.oracle.com><87vc90se5a.fsf@gmail.com><778E2A4E7CBA425C994F7678C2E690CE@us.oracle.com> <87fw04scxt.fsf@gmail.com> Subject: RE: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Date: Sat, 9 Mar 2013 09:55:56 -0800 Message-ID: <948A77F2F1984276A32EC2A5608272BE@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87fw04scxt.fsf@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac4c6xN6MymC8KnvRbqcWTCiF43eoQAApg1w X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 13687 Cc: 'Juri Linkov' , 13687@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) > The question is why is this-command `exit-minibuffer' when it should > have been `multi-occur-in-matching-buffers'. Where does > `exit-minibuffer' come from. > > I am not concerned about the defaults, I am concerned about > how the cmd. Do you have an explanation. There should be an > explanation... and the closest I have come to is to map RET to > `exit-minibuffer'. That IS the explanation, which you mentioned earlier as well. `read-regexp' calls `read-from-minibuffer'. When you hit `RET' during that read, `exit-minibuffer' is the value of `this-command'. You did not provide your recipe of testing interactions. But if you enter something in the minibuffer using `RET', then that explains why the current command when `read-regexp-default's is eval'd is `exit-minibuffer'. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 10 14:32:51 2013 Received: (at 13687) by debbugs.gnu.org; 10 Mar 2013 18:32:51 +0000 Received: from localhost ([127.0.0.1]:44308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEl3D-0003CV-ES for submit@debbugs.gnu.org; Sun, 10 Mar 2013 14:32:51 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:53739 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEl39-0003CC-Tr for 13687@debbugs.gnu.org; Sun, 10 Mar 2013 14:32:49 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 7B70E258B92900; Sun, 10 Mar 2013 11:31:55 -0700 (PDT) From: Juri Linkov To: Jambunathan K Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first Organization: JURTA References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> <8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com> Date: Sun, 10 Mar 2013 20:28:14 +0200 In-Reply-To: <87d2v9rmcl.fsf@gmail.com> (Jambunathan K.'s message of "Sat, 09 Mar 2013 14:17:22 +0530") Message-ID: <87li9vruup.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org, Drew Adams X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > EXPERIMENTAL and ABANDONED PATCH I think your patch is useful, please don't abandon it except its `this-command' part. As you already noted `this-command' is very fragile and flaky. Removing everything related to `this-command' would leave other useful parts of your patch that adds a new defcustom `read-regexp-defaults' and especially this part: + (choice :tag "Function to retrieve the regexp" + (const :tag "Use no defaults" nil) + (radio + (function-item find-tag-default-as-regexp) + (function-item find-tag-default) + (function-item :tag "Regexp history" + (lambda nil + "Use regexp history." + (car regexp-history))) + function))))) and a new function `read-regexp-defaults'. Instead of using `this-command', look for ideas to other similar features. For example, many invocations of minibuffer functions specify their HISTORY argument as a symbol that divides history variables into groups. The DEFAULTS argument could use a similar grouping, i.e. when `read-regexp' uses the symbol `regexp-history' in a call like: (read-regexp "Regexp to highlight" (car regexp-history) 'regexp-history) This could be changed to specify DEFAULTS as the symbol `read-regexp-defaults': (read-regexp "Regexp to highlight" 'read-regexp-defaults 'regexp-history) where `read-regexp-defaults' is a symbol name of the function that uses the value of the defcustom `read-regexp-defaults' the get the default value or returns nil. We could add as many additional default-providing functions as the number of places that call `read-regexp'. But I think it should be enough to have just two functions: (defun read-regexp-defaults-or-history () (or (read-regexp-defaults) (car regexp-history))) (defun read-regexp-defaults-or-tag () (or (read-regexp-defaults) (find-tag-default-as-regexp))) These two functions are necessary to keep the current status quo where some commands traditionally provide the last history element as the default (`highlight-regexp', `occur-read-primary-args', `how-many', `flush-lines', `keep-lines'), and other commands provide the tag at point (`rgrep', `query-replace', `multi-occur-in-matching-buffers'). This is an artificial division existing solely for historical reasons. These functions could be used e.g. in `occur-read-primary-args' as: (read-regexp "List lines matching regexp" 'read-regexp-defaults-or-history 'regexp-history) and e.g. in `grep-read-regexp': (read-regexp "Search for" 'read-regexp-defaults-or-tag 'regexp-history) This implementation will satisfy three goals: 1. Backward compatibility for the current traditional defaults, 2. Allow easy customization in one place (defcustom `read-regexp-defaults'), 3. Allow fine-tuning with function redefinitions, i.e. when the users will ask for more specific functions they could be added as: (defun occur-read-regexp-defaults () (read-regexp-defaults-or-history)) (defun grep-read-regexp-defaults () (read-regexp-defaults-or-tag)) and can be used in `occur-read-primary-args': (read-regexp "List lines matching regexp" 'occur-read-regexp-defaults 'regexp-history) and in `grep-read-regexp': (read-regexp "Search for" 'grep-read-regexp-defaults 'regexp-history) From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 18 03:25:45 2013 Received: (at 13687) by debbugs.gnu.org; 18 Mar 2013 07:25:45 +0000 Received: from localhost ([127.0.0.1]:60760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHUS0-0003jU-4W for submit@debbugs.gnu.org; Mon, 18 Mar 2013 03:25:44 -0400 Received: from mail-da0-f45.google.com ([209.85.210.45]:35690) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHURv-0003jA-1s for 13687@debbugs.gnu.org; Mon, 18 Mar 2013 03:25:42 -0400 Received: by mail-da0-f45.google.com with SMTP id v40so1165732dad.32 for <13687@debbugs.gnu.org>; Mon, 18 Mar 2013 00:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=H7xDsXtZI0qknJxseg1gPlf0JdhttK3oKAshpiRD4iE=; b=qCrtLS6RcDBmH2VU7SqKN+cYn/a0Mg41X1RPUhls9gm+1Zd63aDGO5ux1XeqWiPqkU bwsAMUWgVVDhP71qdnuELvGNmv+siwb8G1/RoeWal6KdFbf/vMxAbeEDXUkLQ3sMBNPg dJS/61KM+NpLOhTg+40658mBu68X5S5JFwB6ABUAwuhH8onctEHJ5k7YBIJUFx0bPRdQ NIVgTZodUWKnU0W7i+zgtq4JxZQRZStdss2MpNPRjFwiqBtLSIzoeH2PkeTgTOgTbAdN yWiw3YKAzSgUnJVKCeFarkMrwaCQGVhCTIIfldywv38Mhw9CMMQRHfYmWInVjUWmV3Sl 9WCw== X-Received: by 10.68.116.169 with SMTP id jx9mr31229561pbb.94.1363591440583; Mon, 18 Mar 2013 00:24:00 -0700 (PDT) Received: from debian-6.05 ([101.63.157.124]) by mx.google.com with ESMTPS id i9sm7196146paa.7.2013.03.18.00.23.56 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 18 Mar 2013 00:23:59 -0700 (PDT) From: Jambunathan K To: Juri Linkov Subject: Re: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> <8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com> <87li9vruup.fsf@mail.jurta.org> Date: Mon, 18 Mar 2013 12:54:09 +0530 In-Reply-To: <87li9vruup.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 10 Mar 2013 20:28:14 +0200") Message-ID: <87vc8pmaqu.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 13687 Cc: 13687@debbugs.gnu.org, Drew Adams X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Juri (For the sake of record) Feel free to take over this bug. In light of recent developments on the mailing list, I am a bit hesitant to take these discussions any further. Jambunathan K. Juri Linkov writes: >> EXPERIMENTAL and ABANDONED PATCH > > I think your patch is useful, please don't abandon it > except its `this-command' part. As you already noted > `this-command' is very fragile and flaky. Removing everything > related to `this-command' would leave other useful parts of your patch > that adds a new defcustom `read-regexp-defaults' and especially this part: > > + (choice :tag "Function to retrieve the regexp" > + (const :tag "Use no defaults" nil) > + (radio > + (function-item find-tag-default-as-regexp) > + (function-item find-tag-default) > + (function-item :tag "Regexp history" > + (lambda nil > + "Use regexp history." > + (car regexp-history))) > + function))))) > > and a new function `read-regexp-defaults'. > > Instead of using `this-command', look for ideas to other similar features. > For example, many invocations of minibuffer functions specify their > HISTORY argument as a symbol that divides history variables into groups. > The DEFAULTS argument could use a similar grouping, i.e. when > `read-regexp' uses the symbol `regexp-history' in a call like: > > (read-regexp "Regexp to highlight" (car regexp-history) 'regexp-history) > > This could be changed to specify DEFAULTS as the symbol `read-regexp-defaults': > > (read-regexp "Regexp to highlight" 'read-regexp-defaults 'regexp-history) > > where `read-regexp-defaults' is a symbol name of the function that uses > the value of the defcustom `read-regexp-defaults' the get the default value > or returns nil. > > We could add as many additional default-providing functions > as the number of places that call `read-regexp'. But I think > it should be enough to have just two functions: > > (defun read-regexp-defaults-or-history () > (or (read-regexp-defaults) > (car regexp-history))) > > (defun read-regexp-defaults-or-tag () > (or (read-regexp-defaults) > (find-tag-default-as-regexp))) > > These two functions are necessary to keep the current status quo > where some commands traditionally provide the last history element > as the default (`highlight-regexp', `occur-read-primary-args', `how-many', > `flush-lines', `keep-lines'), and other commands provide the tag at point > (`rgrep', `query-replace', `multi-occur-in-matching-buffers'). > This is an artificial division existing solely for historical reasons. > These functions could be used e.g. in `occur-read-primary-args' as: > > (read-regexp "List lines matching regexp" 'read-regexp-defaults-or-history 'regexp-history) > > and e.g. in `grep-read-regexp': > > (read-regexp "Search for" 'read-regexp-defaults-or-tag 'regexp-history) > > This implementation will satisfy three goals: > > 1. Backward compatibility for the current traditional defaults, > 2. Allow easy customization in one place (defcustom `read-regexp-defaults'), > 3. Allow fine-tuning with function redefinitions, i.e. when > the users will ask for more specific functions they could be added as: > > (defun occur-read-regexp-defaults () > (read-regexp-defaults-or-history)) > > (defun grep-read-regexp-defaults () > (read-regexp-defaults-or-tag)) > > and can be used in `occur-read-primary-args': > > (read-regexp "List lines matching regexp" 'occur-read-regexp-defaults 'regexp-history) > > and in `grep-read-regexp': > > (read-regexp "Search for" 'grep-read-regexp-defaults 'regexp-history) From unknown Fri Jun 20 07:18:42 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 15 Apr 2013 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator