unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: 14405@debbugs.gnu.org
Subject: bug#14405: 24.3.50; read-regexp-defaults-function
Date: Thu, 16 May 2013 01:58:33 +0300	[thread overview]
Message-ID: <87ehd7df52.fsf@mail.jurta.org> (raw)
In-Reply-To: <87ppwtw1zq.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 15 May 2013 02:51:20 +0300")

> 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'.





  reply	other threads:[~2013-05-15 22:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-14 23:51 bug#14405: 24.3.50; read-regexp-defaults-function Juri Linkov
2013-05-15 22:58 ` Juri Linkov [this message]
2013-05-18 23:28 ` Juri Linkov
     [not found] ` <87mwjvwb1u.fsf@mail.jurta.org>
2013-12-21  2:39   ` Jambunathan K
2013-12-21 21:25     ` Juri Linkov
2013-12-21 22:28       ` Jambunathan K
2013-12-22 21:39         ` Juri Linkov
2013-12-23  2:38           ` Jambunathan K
2013-12-24 18:25             ` Jambunathan K
2013-12-25 20:56               ` Juri Linkov
2013-12-27  5:22                 ` Jambunathan K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ehd7df52.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=14405@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).