[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14405: 24.3.50; read-regexp-defaults-function

From: Juri Linkov
Subject: bug#14405: 24.3.50; read-regexp-defaults-function
Date: Thu, 16 May 2013 01:58:33 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

> 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

Other commands require adding more functions for advice-based customization
like `occur-read-regexp-defaults' and `hi-lock-read-regexp-defaults'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]