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#14405: 24.3.50; read-regexp-defaults-function Date: Thu, 16 May 2013 01:58:33 +0300 Organization: JURTA Message-ID: <87ehd7df52.fsf@mail.jurta.org> References: <87ppwtw1zq.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1368659284 1814 80.91.229.3 (15 May 2013 23:08:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 May 2013 23:08:04 +0000 (UTC) To: 14405@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 16 01:08:04 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 1Ucknk-0007kz-1a for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 May 2013 01:08:04 +0200 Original-Received: from localhost ([::1]:59111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ucknj-0007r0-Ga for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 May 2013 19:08:03 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ucknf-0007pX-Ad for bug-gnu-emacs@gnu.org; Wed, 15 May 2013 19:08:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ucknb-00067o-Pv for bug-gnu-emacs@gnu.org; Wed, 15 May 2013 19:07:59 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ucknb-00067f-N1 for bug-gnu-emacs@gnu.org; Wed, 15 May 2013 19:07:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Uckni-00050x-Hn for bug-gnu-emacs@gnu.org; Wed, 15 May 2013 19:08:02 -0400 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: Wed, 15 May 2013 23:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14405 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14405-submit@debbugs.gnu.org id=B14405.136865924619202 (code B ref 14405); Wed, 15 May 2013 23:08:02 +0000 Original-Received: (at 14405) by debbugs.gnu.org; 15 May 2013 23:07:26 +0000 Original-Received: from localhost ([127.0.0.1]:46585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uckn7-0004ze-HG for submit@debbugs.gnu.org; Wed, 15 May 2013 19:07:25 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:36347 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uckn3-0004zM-Gs for 14405@debbugs.gnu.org; Wed, 15 May 2013 19:07:23 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 8F279258B92943 for <14405@debbugs.gnu.org>; Wed, 15 May 2013 16:07:13 -0700 (PDT) In-Reply-To: <87ppwtw1zq.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 15 May 2013 02:51:20 +0300") 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:74308 Archived-At: > There are pending enhancements to create a single option to define > the same defaulting behavior for all regexp-reading commands > and to group the existing defaults to separate functions > that can be overridden by customizing that option. But note that the option `read-regexp-defaults-function' has limited usefulness. For example, in case when someone wants `M-x man' to provide the default value not an entry near point but the last element from the history, there is no way to do this by customizing a common option because `man' uses the specific variable `Man-topic-history'. I see the only way to customize this by using `advice' like: (advice-add 'Man-default-man-entry :override (lambda () (car Man-topic-history))) or even two default values (the last history and the original): (advice-add 'Man-default-man-entry :filter-return (lambda (r) (delq nil (list (car Man-topic-history) r)))) If advices are the preferable method of customization then the design goal would be to add more functions returning default values that users can customize using advices. For example, for `grep' there is already `grep-tag-default' that could be customized like: (advice-add 'grep-tag-default :override (lambda () (car grep-regexp-history))) as a better advice for http://stackoverflow.com/questions/15161592/make-emacs-rgrep-default-to-last-search-term-rather-than-word-at-point Other commands require adding more functions for advice-based customization like `occur-read-regexp-defaults' and `hi-lock-read-regexp-defaults'.