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

From: Jambunathan K <[email-masked]>
Date: Fri, 27 Dec 2013 10:52:31 +0530

Juri Linkov <[email-masked]> writes:

>> I depend on occur and rgrep.  For occur, I want the symbol delimiters.
>> For rgrep, a mere tag at point will do.  If one were to use multi-occur
>> from Buffer menu mode, a symbol match doesn't make sense.
>
> You can use `this-command' for different defaults of different commands
> in a customized function like you wrote in the docstring that is
> still preserved in `read-regexp-defaults-function'.

For the benefit of googler out there.

    (setq read-regexp-defaults-function
          (lambda nil
            (pcase this-command
              (`rgrep (find-tag-default-as-regexp))
              (_ (find-tag-default-as-symbol-regexp)))))

It would be a good idea to choose a different name for
find-tag-default-*?  The function retrieves the tag-at-point but doesn't
find it (as in M-.).  So "find" is misleading.