all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Juri Linkov <juri@jurta.org>
Cc: 13687@debbugs.gnu.org
Subject: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first
Date: Wed, 06 Mar 2013 23:30:27 +0530	[thread overview]
Message-ID: <87boawz9vo.fsf@gmail.com> (raw)
In-Reply-To: <87zjykygjk.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 03 Mar 2013 11:31:04 +0200")

Juri Linkov <juri@jurta.org> writes:

>> 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:

See bug#13892.  I have gone with (3).  For now, I have modified
hi-lock.el.  Modifications to occur will follow soon.


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





  reply	other threads:[~2013-03-06 18:00 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1UA5QC-0006Vm-Qb@vcs.savannah.gnu.org>
     [not found] ` <877glsyecw.fsf@gmail.com>
2013-02-28 18:12   ` bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first Juri Linkov
2013-03-03  9:31     ` Juri Linkov
2013-03-06 18:00       ` Jambunathan K [this message]
2013-03-08 13:02       ` Jambunathan K
2013-03-08 15:29         ` bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): " Drew Adams
2013-03-08 16:53           ` Jambunathan K
2013-03-08 17:10             ` Drew Adams
2013-03-08 17:27               ` Jambunathan K
2013-03-08 17:28           ` Juri Linkov
2013-03-08 18:16             ` Drew Adams
2013-03-08 18:30               ` Jambunathan K
2013-03-08 18:53                 ` Drew Adams
2013-03-08 19:03                   ` Jambunathan K
2013-03-08 21:08                     ` Drew Adams
2013-03-09  8:47                 ` Jambunathan K
2013-03-09 15:08                   ` Drew Adams
2013-03-09 16:21                     ` Jambunathan K
2013-03-09 16:37                       ` Drew Adams
2013-03-09 16:59                         ` Jambunathan K
2013-03-09 17:14                           ` Drew Adams
2013-03-09 17:25                             ` Jambunathan K
2013-03-09 17:55                               ` Drew Adams
2013-03-10 18:28                   ` Juri Linkov
2013-03-18  7:24                     ` Jambunathan K
2013-03-04  5:46     ` bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): " Jambunathan K
2013-03-04  9:28       ` Juri Linkov
2013-03-06 18:03         ` 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

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

  git send-email \
    --in-reply-to=87boawz9vo.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=13687@debbugs.gnu.org \
    --cc=juri@jurta.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.