[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make `occur' use word at point as default
From: |
Juri Linkov |
Subject: |
Re: make `occur' use word at point as default |
Date: |
Thu, 01 Sep 2005 22:29:33 +0300 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
>> 1. word at point - (current-word t)
>> 2. tag at point - (funcall (or find-tag-default-function
>> (get major-mode 'find-tag-default-function)
>> 'find-tag-default))
>
> These are pretty much the same. More specifically the tag should include
> the current-word as a substring, so I'd drop the number 1 and just keep
> number 2.
I agree.
>> 3. active region - (and transient-mark-mode mark-active
>> (buffer-substring-no-properties
>> (region-beginning) (region-end)))
>
> You could have done M-w before the current operation. Much simpler/quicker
> than doing M-n M-n M-n searching for it.
>> 5. last kill from the kill ring - (current-kill 0)
>
> C-y brings it more quickl;y and reliably than M-n M-n M-n M-n.
Doing M-w/C-y is simpler only for strings that don't contain special
regexp characters. But in regexps they need to be quoted. `M-n M-n ...'
could provide a default value with quoted special regexp characters.
>> 4. last isearch regexp - (car regexp-search-ring)
>
> This one makes sense. Maybe we could simply use the same ring for occur as
> for regexp-search so that it is available as M-p.
There is also another command that reads a regexp and that could share
the same regexp ring - `query-replace'. It has a special variable
`query-replace-from-history-variable' that defines the history list to use.
So `occur' and `isearch' could have similar variables to allow
occur/multi-occur/keep-lines/flush-lines/how-many and isearch-regexp
to use the same ring with either:
(setq regexp-history-variable 'regexp-history)
(setq regexp-search-ring-variable 'regexp-history)
or:
(setq regexp-history-variable 'regexp-search-ring)
(setq regexp-search-ring-variable 'regexp-search-ring)
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: make `occur' use word at point as default, Juri Linkov, 2005/09/01
- Re: make `occur' use word at point as default, Richard M. Stallman, 2005/09/01
- RE: make `occur' use word at point as default, Drew Adams, 2005/09/01
- Re: make `occur' use word at point as default, Richard M. Stallman, 2005/09/02
- RE: make `occur' use word at point as default, Drew Adams, 2005/09/02
- RE: make `occur' use word at point as default, Drew Adams, 2005/09/02
- Re: make `occur' use word at point as default, Benjamin Riefenstahl, 2005/09/03
- Re: make `occur' use word at point as default, Richard M. Stallman, 2005/09/03
- RE: make `occur' use word at point as default, Drew Adams, 2005/09/06