From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.bugs Subject: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first Date: Wed, 06 Mar 2013 23:30:27 +0530 Message-ID: <87boawz9vo.fsf@gmail.com> References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362592918 22425 80.91.229.3 (6 Mar 2013 18:01:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Mar 2013 18:01:58 +0000 (UTC) Cc: 13687@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 06 19:02:15 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UDIfI-0007b3-QI for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Mar 2013 19:02:09 +0100 Original-Received: from localhost ([::1]:52006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDIex-0002LZ-1d for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Mar 2013 13:01:47 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDIep-0002Eg-NM for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2013 13:01:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDIel-0008No-5y for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2013 13:01:39 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDIel-0008Nk-3o for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2013 13:01:35 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UDIfB-0004hX-Vn for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2013 13:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jambunathan K Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Mar 2013 18:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13687 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13687-submit@debbugs.gnu.org id=B13687.136259287618007 (code B ref 13687); Wed, 06 Mar 2013 18:02:01 +0000 Original-Received: (at 13687) by debbugs.gnu.org; 6 Mar 2013 18:01:16 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: <87zjykygjk.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 03 Mar 2013 11:31:04 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72166 Archived-At: 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.