From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first Date: Sun, 03 Mar 2013 11:31:04 +0200 Organization: JURTA Message-ID: <87zjykygjk.fsf@mail.jurta.org> References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362303601 17083 80.91.229.3 (3 Mar 2013 09:40:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Mar 2013 09:40:01 +0000 (UTC) Cc: 13687@debbugs.gnu.org To: Jambunathan K Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 03 10:40:25 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 1UC5P3-0008UD-SC for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Mar 2013 10:40:21 +0100 Original-Received: from localhost ([::1]:53953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC5Oi-0003aX-Du for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Mar 2013 04:40:00 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:51716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC5Od-0003aB-Qw for bug-gnu-emacs@gnu.org; Sun, 03 Mar 2013 04:39:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UC5Oc-0006uP-8B for bug-gnu-emacs@gnu.org; Sun, 03 Mar 2013 04:39:55 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC5Oc-0006uL-5W for bug-gnu-emacs@gnu.org; Sun, 03 Mar 2013 04:39:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UC5Ok-00024D-5b for bug-gnu-emacs@gnu.org; Sun, 03 Mar 2013 04:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Mar 2013 09:40:02 +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.13623035707896 (code B ref 13687); Sun, 03 Mar 2013 09:40:02 +0000 Original-Received: (at 13687) by debbugs.gnu.org; 3 Mar 2013 09:39:30 +0000 Original-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 Original-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 Original-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) In-Reply-To: <87621cfhff.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 28 Feb 2013 20:12:30 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72043 Archived-At: > 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.