* [PATCH] (Or "question"...) isearch-kill-found @ 2010-05-30 12:37 Deniz Dogan 2010-05-30 14:05 ` Johan Bockgård 2010-05-30 18:36 ` Juri Linkov 0 siblings, 2 replies; 26+ messages in thread From: Deniz Dogan @ 2010-05-30 12:37 UTC (permalink / raw) To: Emacs-Devel devel [-- Attachment #1: Type: text/plain, Size: 386 bytes --] Recently, in a discussion on #emacs, we looked for a command which kills the text that has been found using isearch. None of us knew if there existed anything like that and I coludn't find it. So attached is a patch which adds isearch-kill-found and binds it to M-C-m (not too keen on the choice of binding though). Any thoughts or comments? Does this already exist? -- Deniz Dogan [-- Attachment #2: isearch-kill-found.patch --] [-- Type: application/octet-stream, Size: 780 bytes --] === modified file 'lisp/isearch.el' --- lisp/isearch.el 2010-05-20 22:33:09 +0000 +++ lisp/isearch.el 2010-05-30 12:27:58 +0000 @@ -462,6 +462,7 @@ (define-key map "\M-\C-w" 'isearch-del-char) (define-key map "\M-\C-y" 'isearch-yank-char) (define-key map "\C-y" 'isearch-yank-line) + (define-key map "\M-\C-m" 'isearch-kill-found) (define-key map (char-to-string help-char) isearch-help-map) (define-key map [help] isearch-help-map) @@ -1497,6 +1498,12 @@ (interactive) (isearch-yank-string (x-get-selection))) +(defun isearch-kill-found () + "Kills the region that isearch has found." + (interactive) + (isearch-exit) + (kill-region isearch-other-end (point))) + (defun isearch-mouse-2 (click) "Handle mouse-2 in Isearch mode. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 12:37 [PATCH] (Or "question"...) isearch-kill-found Deniz Dogan @ 2010-05-30 14:05 ` Johan Bockgård 2010-05-30 14:11 ` Deniz Dogan 2010-05-30 18:36 ` Juri Linkov 1 sibling, 1 reply; 26+ messages in thread From: Johan Bockgård @ 2010-05-30 14:05 UTC (permalink / raw) To: emacs-devel Deniz Dogan <deniz.a.m.dogan@gmail.com> writes: > Recently, in a discussion on #emacs, we looked for a command which > kills the text that has been found using isearch. None of us knew if > there existed anything like that and I coludn't find it. > > So attached is a patch which adds isearch-kill-found and binds it to > M-C-m (not too keen on the choice of binding though). > > Any thoughts or comments? Does this already exist? A command to simply exit isearch and set the region around the match would be more generally useful. The key M-RET would make more sense there too. http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00492.html ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 14:05 ` Johan Bockgård @ 2010-05-30 14:11 ` Deniz Dogan 2010-05-30 15:25 ` Drew Adams 0 siblings, 1 reply; 26+ messages in thread From: Deniz Dogan @ 2010-05-30 14:11 UTC (permalink / raw) To: Johan Bockgård; +Cc: emacs-devel 2010/5/30 Johan Bockgård <bojohan@gnu.org>: > Deniz Dogan <deniz.a.m.dogan@gmail.com> writes: > >> Recently, in a discussion on #emacs, we looked for a command which >> kills the text that has been found using isearch. None of us knew if >> there existed anything like that and I coludn't find it. >> >> So attached is a patch which adds isearch-kill-found and binds it to >> M-C-m (not too keen on the choice of binding though). >> >> Any thoughts or comments? Does this already exist? > > A command to simply exit isearch and set the region around the match > would be more generally useful. The key M-RET would make more sense > there too. > > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00492.html > I agree, that makes sense. -- Deniz Dogan ^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 14:11 ` Deniz Dogan @ 2010-05-30 15:25 ` Drew Adams 2010-05-30 22:19 ` Christoph 0 siblings, 1 reply; 26+ messages in thread From: Drew Adams @ 2010-05-30 15:25 UTC (permalink / raw) To: 'Deniz Dogan', 'Johan Bockgård'; +Cc: emacs-devel > >> Recently, in a discussion on #emacs, we looked for a command which > >> kills the text that has been found using isearch. None of > >> us knew if there existed anything like that and I coludn't find it. > >> > >> So attached is a patch which adds isearch-kill-found and > >> binds it to M-C-m (not too keen on the choice of binding though). > >> > >> Any thoughts or comments? Does this already exist? > > > > A command to simply exit isearch and set the region around the match > > would be more generally useful. The key M-RET would make more sense > > there too. > > > > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00492.html > > I agree, that makes sense. (FYI, that link is to a side post that is not representative of the thread's proposal.) FWIW, as the person who proposed this feature, here is the history: I mentioned this possibility in help-gnu-emacs on 2006-07-21: http://lists.gnu.org/archive/html/help-gnu-emacs/2006-07/msg00370.html Andreas Roehler contributed some ideas in that thread. I added the feature to my isearch+.el code on 2006-07-29. I proposed the feature to emacs-devel on 2007-07-10: http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00490.html The bottom line was Richard's decision: "I don't think it is needed. You can type C-@ C-r C-r to put the region around the match that was just found." If you want to try it, to see what you think: http://www.emacswiki.org/emacs/isearch%2b.el `C-SPC' during isearch toggles the effect of the option `isearchp-set-region-flag', which sets the default behavior. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 15:25 ` Drew Adams @ 2010-05-30 22:19 ` Christoph 2010-05-30 22:40 ` Lennart Borgman 2010-05-31 0:48 ` Drew Adams 0 siblings, 2 replies; 26+ messages in thread From: Christoph @ 2010-05-30 22:19 UTC (permalink / raw) To: emacs-devel On 05/30/2010 09:25 AM, Drew Adams wrote: > I proposed the feature to emacs-devel on 2007-07-10: > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00490.html > > The bottom line was Richard's decision: > > "I don't think it is needed. You can type C-@ C-r C-r to put > the region around the match that was just found." > In that same thread Davis Herring had an idea that sounds interesting and useful to me: http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00492.html > Thinking about this, I realize > that I would get almost all the utility of this idea with just one command > added to isearch which meant "exit and move point to start of match", or > (closer to your idea) a command which meant "exit and drop mark at start > of match" in place of your toggle. WDOT? I think a function "exit and drop mark at start of match" would be very useful. Christoph ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 22:19 ` Christoph @ 2010-05-30 22:40 ` Lennart Borgman 2010-05-31 0:28 ` Drew Adams 2010-05-31 3:30 ` Michael Welsh Duggan 2010-05-31 0:48 ` Drew Adams 1 sibling, 2 replies; 26+ messages in thread From: Lennart Borgman @ 2010-05-30 22:40 UTC (permalink / raw) To: Christoph; +Cc: emacs-devel On Mon, May 31, 2010 at 12:19 AM, Christoph <cschol2112@googlemail.com> wrote: > > In that same thread Davis Herring had an idea that sounds interesting and > useful to me: > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00492.html > >> Thinking about this, I realize >> that I would get almost all the utility of this idea with just one >> command >> added to isearch which meant "exit and move point to start of match", or >> (closer to your idea) a command which meant "exit and drop mark at start >> of match" in place of your toggle. WDOT? > > > I think a function "exit and drop mark at start of match" would be very > useful. Would it disturb if instead mark was always set to start of match? ^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 22:40 ` Lennart Borgman @ 2010-05-31 0:28 ` Drew Adams 2010-05-31 3:30 ` Michael Welsh Duggan 1 sibling, 0 replies; 26+ messages in thread From: Drew Adams @ 2010-05-31 0:28 UTC (permalink / raw) To: 'Lennart Borgman', 'Christoph'; +Cc: emacs-devel > > I think a function "exit and drop mark at start of match" > > would be very useful. > > Would it disturb if instead mark was always set to start of match? Always? Why? Why not let users toggle the behavior using `C-SPC', as the proposal suggests? The implementation I use gives users the choice (1) of the default behavior (an option) and (2) on the fly (a toggle). ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 22:40 ` Lennart Borgman 2010-05-31 0:28 ` Drew Adams @ 2010-05-31 3:30 ` Michael Welsh Duggan 2010-05-31 15:32 ` Lennart Borgman 1 sibling, 1 reply; 26+ messages in thread From: Michael Welsh Duggan @ 2010-05-31 3:30 UTC (permalink / raw) To: Lennart Borgman; +Cc: Christoph, emacs-devel Lennart Borgman <lennart.borgman@gmail.com> writes: > On Mon, May 31, 2010 at 12:19 AM, Christoph <cschol2112@googlemail.com> wrote: >> >> In that same thread Davis Herring had an idea that sounds interesting and >> useful to me: >> http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00492.html >> >>> Thinking about this, I realize >>> that I would get almost all the utility of this idea with just one >>> command >>> added to isearch which meant "exit and move point to start of match", or >>> (closer to your idea) a command which meant "exit and drop mark at start >>> of match" in place of your toggle. WDOT? >> >> >> I think a function "exit and drop mark at start of match" would be very >> useful. > > > Would it disturb if instead mark was always set to start of match? It would. I am often in a situation where I am at the beginning of a construct, use C-s to find the end of the construct, and then C-w or M-w to cut or copy it. I use this behavior frequently, especially when writing macros. -- Michael Welsh Duggan (md5i@md5i.com) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-31 3:30 ` Michael Welsh Duggan @ 2010-05-31 15:32 ` Lennart Borgman 0 siblings, 0 replies; 26+ messages in thread From: Lennart Borgman @ 2010-05-31 15:32 UTC (permalink / raw) To: Michael Welsh Duggan; +Cc: Christoph, emacs-devel On Mon, May 31, 2010 at 5:30 AM, Michael Welsh Duggan <md5i@md5i.com> wrote: > Lennart Borgman <lennart.borgman@gmail.com> writes: > >> On Mon, May 31, 2010 at 12:19 AM, Christoph <cschol2112@googlemail.com> wrote: >>> >>> In that same thread Davis Herring had an idea that sounds interesting and >>> useful to me: >>> http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00492.html >>> >>>> Thinking about this, I realize >>>> that I would get almost all the utility of this idea with just one >>>> command >>>> added to isearch which meant "exit and move point to start of match", or >>>> (closer to your idea) a command which meant "exit and drop mark at start >>>> of match" in place of your toggle. WDOT? >>> >>> >>> I think a function "exit and drop mark at start of match" would be very >>> useful. >> >> >> Would it disturb if instead mark was always set to start of match? > > It would. I am often in a situation where I am at the beginning of a > construct, use C-s to find the end of the construct, and then C-w or M-w > to cut or copy it. I use this behavior frequently, especially when > writing macros. Thanks Michael, I see. And learned a bit more about using the mark. ^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 22:19 ` Christoph 2010-05-30 22:40 ` Lennart Borgman @ 2010-05-31 0:48 ` Drew Adams 1 sibling, 0 replies; 26+ messages in thread From: Drew Adams @ 2010-05-31 0:48 UTC (permalink / raw) To: 'Christoph', emacs-devel > > I proposed the feature to emacs-devel on 2007-07-10: > > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00490.html > > > > The bottom line was Richard's decision: > > > > "I don't think it is needed. You can type C-@ C-r C-r to put > > the region around the match that was just found." > > In that same thread Davis Herring had an idea that sounds interesting > and useful to me: > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00492.html > > > Thinking about this, I realize > > that I would get almost all the utility of this idea with > > just one command added to isearch which meant "exit and move > > point to start of match", or (closer to your idea) a command > > which meant "exit and drop mark at start > > of match" in place of your toggle. WDOT? > > I think a function "exit and drop mark at start of match" > would be very useful. Hm. That interesting and useful idea that "Davis Herring had" I implemented in 2006, a year before the proposal. And I pointed the list (hence Davis too) to that code. I call that command `set-region-around-search-target'.[*] (defun set-region-around-search-target () "Set the region around the last search or query-replace target." (interactive) (case last-command ((isearch-forward isearch-backward isearch-forward-regexp isearch-backward-regexp) (push-mark isearch-other-end t 'activate)) (t (push-mark (match-beginning 0) t 'activate))) (setq deactivate-mark nil)) It does exactly what he described: "drop mark at start of match". Unlike `isearchp-set-region' (the proposal), it is not conditional on the user option or on `transient-mark-mode', and thus not sensitive to the toggle key, `C-SPC'. I do not bind that command by default, but you can bind it in `isearch-map'. Or you can add it, in place of `isearchp-set-region', to `isearch-mode-end-hook'. It is in fact the _same_ as `isearchp-set-region' (the proposal) in this context, except that it is unconditional instead of respecting the toggle key. IOW, if `transient-mark-mode' is on and the option is on, then the proposed behavior is exactly what Davis described: just put mark at the match start. If t-m-mode is off and you still want the start to be marked, then use `set-region-around-search-target' instead. Here is what I proposed (I use it on `isearch-mode-end-hook'): (defun isearchp-set-region () "Set region around search target, if `isearchp-set-region-flag'. Used only for Transient Mark mode." (when (and isearchp-set-region-flag transient-mark-mode) (push-mark isearch-other-end t 'activate))) You might notice, BTW, that Davis started by saying that he does not use either transient-mark mode or delete-selection mode. Yet t-m mode is the context the feature was designed for - it is active only in t-m mode. (Transient-mark mode is now the default.) --- [*] There is perhaps a better test to use here than `last-command'. Maybe isearch has a state variable that can be checked for this - dunno. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 12:37 [PATCH] (Or "question"...) isearch-kill-found Deniz Dogan 2010-05-30 14:05 ` Johan Bockgård @ 2010-05-30 18:36 ` Juri Linkov 2010-05-31 14:24 ` Chong Yidong 1 sibling, 1 reply; 26+ messages in thread From: Juri Linkov @ 2010-05-30 18:36 UTC (permalink / raw) To: Deniz Dogan; +Cc: Emacs-Devel devel > Recently, in a discussion on #emacs, we looked for a command which > kills the text that has been found using isearch. None of us knew if > there existed anything like that and I coludn't find it. > > So attached is a patch which adds isearch-kill-found and binds it to > M-C-m (not too keen on the choice of binding though). > > Any thoughts or comments? Does this already exist? A command to delete the current match without exiting isearch would be more useful. It will allow to continue searching for the next matches and delete them too: (define-key isearch-mode-map [delete] 'isearch-delete-current-match) (defun isearch-delete-current-match () "Kills the region that isearch has found." (interactive) (kill-region isearch-other-end (point))) -- Juri Linkov http://www.jurta.org/emacs/ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-30 18:36 ` Juri Linkov @ 2010-05-31 14:24 ` Chong Yidong 2010-05-31 15:38 ` Lennart Borgman 2010-05-31 15:54 ` Stefan Monnier 0 siblings, 2 replies; 26+ messages in thread From: Chong Yidong @ 2010-05-31 14:24 UTC (permalink / raw) To: Juri Linkov; +Cc: Emacs-Devel devel, Deniz Dogan Juri Linkov <juri@jurta.org> writes: > A command to delete the current match without exiting isearch > would be more useful. It will allow to continue searching for the > next matches and delete them too: > > (define-key isearch-mode-map [delete] 'isearch-delete-current-match) > > (defun isearch-delete-current-match () > "Kills the region that isearch has found." > (interactive) > (kill-region isearch-other-end (point))) I think this is a good idea, since [delete] isn't currently used. Maybe add C-d also. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-31 14:24 ` Chong Yidong @ 2010-05-31 15:38 ` Lennart Borgman 2010-05-31 15:54 ` Stefan Monnier 1 sibling, 0 replies; 26+ messages in thread From: Lennart Borgman @ 2010-05-31 15:38 UTC (permalink / raw) To: Chong Yidong; +Cc: Juri Linkov, Deniz Dogan, Emacs-Devel devel On Mon, May 31, 2010 at 4:24 PM, Chong Yidong <cyd@stupidchicken.com> wrote: > Juri Linkov <juri@jurta.org> writes: > >> A command to delete the current match without exiting isearch >> would be more useful. It will allow to continue searching for the >> next matches and delete them too: >> >> (define-key isearch-mode-map [delete] 'isearch-delete-current-match) >> >> (defun isearch-delete-current-match () >> "Kills the region that isearch has found." >> (interactive) >> (kill-region isearch-other-end (point))) > > I think this is a good idea, since [delete] isn't currently used. Maybe > add C-d also. Can't you easily do this by for example switching to query-replace from within isearch? I think being able to mark the match at exit would be more useful. (This could also easily be used to delete the matched region.) And perhaps exiting with a submatch marked instead could be done with numerical prefixes. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-31 14:24 ` Chong Yidong 2010-05-31 15:38 ` Lennart Borgman @ 2010-05-31 15:54 ` Stefan Monnier 2010-05-31 16:50 ` Lennart Borgman ` (2 more replies) 1 sibling, 3 replies; 26+ messages in thread From: Stefan Monnier @ 2010-05-31 15:54 UTC (permalink / raw) To: Chong Yidong; +Cc: Juri Linkov, Deniz Dogan, Emacs-Devel devel >> A command to delete the current match without exiting isearch >> would be more useful. It will allow to continue searching for the >> next matches and delete them too: >> (define-key isearch-mode-map [delete] 'isearch-delete-current-match) >> (defun isearch-delete-current-match () >> "Kills the region that isearch has found." >> (interactive) >> (kill-region isearch-other-end (point))) > I think this is a good idea, since [delete] isn't currently used. Maybe > add C-d also. Every new key we use tends to collide with its current use of "exit isearch and run the command globally bound to that key". I.e. people who currently expect C-d/delete to exit isearch and delete the next char will be badly surprised. Now, I haven't heard a proposal yet that doesn't suffer from this kind of problem, but I think that using a new key should only be done if there's a good chance that it's very rarely used (C-d might not be very frequently used to exit isearch, but there's no reason to think it's rarely used either) *and* if the new functionality is sufficiently important. In my experience deleting the matched text is not that frequent a need. Yes, I also do it every once in a while, but I also often want to delete something slightly different. Or I want to do something else with it. So I'd much rather see an "exit and set the mark at isearch-other-end" command, after which you can do C-w if you want to delete that text (I could also imagine a "set the mark isearch-other-end but don't exit", but then deleting the text would require RET C-w instead). Richard thinks that C-SPC C-r C-r works as well, but for regexp-patterns it won't always match the same text, and I must say that C-SPC C-r C-r RET C-w is pretty long winded. Still, if we want a new isearch-set-mark-and-exit, we'll need to find a good keybinding for it. I'm not sure C-SPC is a good choice (OT1H it's pretty common to use C-SPC to exit isearch, so many uses will be affected, OTOH it will behave in a similar way, just pushing the mark at the other end of the search). Of course, we could provide the command without binding it, like we've done with isearch-toggle-case-fold, isearch-toggle-regexp and a few others. Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-31 15:54 ` Stefan Monnier @ 2010-05-31 16:50 ` Lennart Borgman 2010-05-31 19:14 ` Drew Adams 2010-05-31 20:14 ` Juri Linkov 2 siblings, 0 replies; 26+ messages in thread From: Lennart Borgman @ 2010-05-31 16:50 UTC (permalink / raw) To: Stefan Monnier; +Cc: Juri Linkov, Chong Yidong, Emacs-Devel devel, Deniz Dogan On Mon, May 31, 2010 at 5:54 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote: > > So I'd much rather see an "exit and set the mark at isearch-other-end" > command, after which you can do C-w if you want to delete that text How about reusing C-M-h? Let it be "exit isearch and put mark at current point and move point to match beginning". Typing C-M-h once again if needed is not too hard and would normally fit despite that point has moved. ^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH] (Or "question"...) isearch-kill-found 2010-05-31 15:54 ` Stefan Monnier 2010-05-31 16:50 ` Lennart Borgman @ 2010-05-31 19:14 ` Drew Adams 2010-05-31 19:50 ` Stefan Monnier 2010-05-31 20:14 ` Juri Linkov 2 siblings, 1 reply; 26+ messages in thread From: Drew Adams @ 2010-05-31 19:14 UTC (permalink / raw) To: 'Stefan Monnier', 'Chong Yidong' Cc: 'Juri Linkov', 'Emacs-Devel devel', 'Deniz Dogan' > Every new key we use tends to collide with its current use of "exit > isearch and run the command globally bound to that key". I.e. people > who currently expect C-d/delete to exit isearch and delete > the next char will be badly surprised. > > Now, I haven't heard a proposal yet that doesn't suffer from this kind > of problem... > > I'm not sure C-SPC is a good choice (OT1H it's pretty common to use > C-SPC to exit isearch, so many uses will be affected, What you're thinking of: `C-s KEY C-w', where KEY exits isearch and sets the mark at the search-match start. You use `C-w' only if you want to delete the selected text. In `delete-selection-mode', you could use `C-s KEY abcd' to replace the text with `abcd'. Or you could extend the active region (`M-f' etc.). If you do the search+kill several times in succession: `C-s KEY C-w C-s C-s KEY C-w...'. Likewise, for replacements. What you say about the limitation regarding the choice of KEY is correct. But a single-touch chord or key such as `C-SPC' is not a big deal - you just hit it twice to get the normal effect (almost - there will be an extra mark on the ring). Or hit `RET' and then the key: `RET C-SPC'. The alternative that I proposed does not affect any keys that exit isearch - you exit it normally, any way you want. What it does do is leave the mark-setting on or off until you toggle it, with `C-SPC' during isearch. IOW, once you've hit `C-SPC' to turn marking on: `C-s RET C-w' or `C-s RET abcd', where RET could be any other key that exits isearch. If you do the search+kill several times in succession: `C-s RET C-w C-s C-s RET C-w...'. This is identical to your case above, with RET (or any exiting key) in place of KEY. So that's the choice I see: 1. a KEY (e.g. C-SPC) to exit and mark versus 2. a KEY (e.g. C-SPC) to toggle marking #1 has the disadvantage that KEY can no longer be used to exit normally. But that just means you have to hit KEY twice to get the normal behavior. (Well, ALMOST the normal behavior, because the first hit adds a position to the mark ring.) #2 has the disadvantage that you need to turn it off if you want to do this only as a one-off action. But that just means you need to hit KEY a second time. The choice I think depends on how often you (a) want to exit normally using KEY versus (b) how often you want to do this only as a one-off. For #1, each time you would exit normally using KEY you need to hit KEY twice. For #2, each time you would set mark as a one-off you need to hit KEY twice. For #2, if you never use this marking feature, then nothing changes for you. For #1, if you never use KEY to exit normally, then nothing changes for you. If you use this feature sometimes, but rarely, then change "never" and "nothing" to "rarely" and "almost nothing". For people who use this rarely or never, #2 is preferable. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-31 19:14 ` Drew Adams @ 2010-05-31 19:50 ` Stefan Monnier 2010-05-31 20:04 ` Drew Adams 0 siblings, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2010-05-31 19:50 UTC (permalink / raw) To: Drew Adams Cc: 'Juri Linkov', 'Chong Yidong', 'Deniz Dogan', 'Emacs-Devel devel' > The alternative that I proposed does not affect any keys that exit > isearch - you exit it normally, any way you want. What it does do is > leave the mark-setting on or off until you toggle it, with `C-SPC' > during isearch. Eh.... it *does* affect a key that exits isearch: C-SPC. Of course I also dislike it because it adds a state. As for simply providing a variable to change the behavior (without a key-binding to change it), that's another solution, indeed. Maybe not a bad one. Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH] (Or "question"...) isearch-kill-found 2010-05-31 19:50 ` Stefan Monnier @ 2010-05-31 20:04 ` Drew Adams 2010-06-01 3:10 ` Stefan Monnier 0 siblings, 1 reply; 26+ messages in thread From: Drew Adams @ 2010-05-31 20:04 UTC (permalink / raw) To: 'Stefan Monnier' Cc: 'Juri Linkov', 'Chong Yidong', 'Deniz Dogan', 'Emacs-Devel devel' > > The alternative that I proposed does not affect any keys that exit > > isearch - you exit it normally, any way you want. What it does do > > is leave the mark-setting on or off until you toggle it, with > > `C-SPC' during isearch. > > Eh.... it *does* affect a key that exits isearch: C-SPC. Yes. I should have said only that you need not exit specially to get the marking behavior. > Of course I also dislike it because it adds a state. As for simply > providing a variable to change the behavior (without a key-binding to > change it), that's another solution, indeed. Maybe not a bad one. Why is not having a key to toggle the variable better? It is the variable that "adds a state", not the toggle key. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-31 20:04 ` Drew Adams @ 2010-06-01 3:10 ` Stefan Monnier 2010-06-01 4:43 ` Drew Adams 0 siblings, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2010-06-01 3:10 UTC (permalink / raw) To: Drew Adams Cc: 'Juri Linkov', 'Chong Yidong', 'Deniz Dogan', 'Emacs-Devel devel' >> Of course I also dislike it because it adds a state. As for simply >> providing a variable to change the behavior (without a key-binding to >> change it), that's another solution, indeed. Maybe not a bad one. > Why is not having a key to toggle the variable better? Because keys are in very short supply. > It is the variable that "adds a state", not the toggle key. No: if the variable never changes, then it doesn't contribute to state. Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH] (Or "question"...) isearch-kill-found 2010-06-01 3:10 ` Stefan Monnier @ 2010-06-01 4:43 ` Drew Adams 2010-06-01 12:56 ` Stefan Monnier 2010-06-01 21:03 ` Richard Stallman 0 siblings, 2 replies; 26+ messages in thread From: Drew Adams @ 2010-06-01 4:43 UTC (permalink / raw) To: 'Stefan Monnier' Cc: 'Juri Linkov', 'Chong Yidong', 'Deniz Dogan', 'Emacs-Devel devel' > >> Of course I also dislike it because it adds a state. As for simply > >> providing a variable to change the behavior (without a > >> key-binding to change it), that's another solution, indeed. > >> Maybe not a bad one. > > > Why is not having a key to toggle the variable better? > > Because keys are in very short supply. Not really, for a keymap such as isearch. > > It is the variable that "adds a state", not the toggle key. > > No: if the variable never changes, then it doesn't contribute > to state. ;-) If a variable (in the usual programming sense, not in the math sense) never changes, then it's not very variable. Why have a variable in that case? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-06-01 4:43 ` Drew Adams @ 2010-06-01 12:56 ` Stefan Monnier 2010-06-01 13:55 ` Lennart Borgman 2010-06-01 21:03 ` Richard Stallman 1 sibling, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2010-06-01 12:56 UTC (permalink / raw) To: Drew Adams Cc: 'Juri Linkov', 'Chong Yidong', 'Deniz Dogan', 'Emacs-Devel devel' >> >> Of course I also dislike it because it adds a state. As for simply >> >> providing a variable to change the behavior (without a >> >> key-binding to change it), that's another solution, indeed. >> >> Maybe not a bad one. >> > Why is not having a key to toggle the variable better? >> Because keys are in very short supply. > Not really, for a keymap such as isearch. Huh? Please suggest free key-bindings, then. Since keys not bound in isearch-mode-map lead to exiting isearch and running the corresponding command in the global map, isearch-mode-map is basically just as full as the global map. >> > It is the variable that "adds a state", not the toggle key. >> No: if the variable never changes, then it doesn't contribute to state. > ;-) > If a variable (in the usual programming sense, not in the math sense) never > changes, then it's not very variable. Why have a variable in that case? Because it can be customized. Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-06-01 12:56 ` Stefan Monnier @ 2010-06-01 13:55 ` Lennart Borgman 2010-06-01 19:03 ` Stefan Monnier 0 siblings, 1 reply; 26+ messages in thread From: Lennart Borgman @ 2010-06-01 13:55 UTC (permalink / raw) To: Stefan Monnier Cc: Juri Linkov, Chong Yidong, Emacs-Devel devel, Drew Adams, Deniz Dogan On Tue, Jun 1, 2010 at 2:56 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >>> >> Of course I also dislike it because it adds a state. As for simply >>> >> providing a variable to change the behavior (without a >>> >> key-binding to change it), that's another solution, indeed. >>> >> Maybe not a bad one. >>> > Why is not having a key to toggle the variable better? >>> Because keys are in very short supply. >> Not really, for a keymap such as isearch. > > Huh? Please suggest free key-bindings, then. Since keys not bound in > isearch-mode-map lead to exiting isearch and running the corresponding > command in the global map, isearch-mode-map is basically just as full as > the global map. I made another suggestion, reuse C-M-h. It will not interfere with the global command in a bad manner I believe. You just have to do it twice in case you want the global binding. I believe it will be easy getting used to it - as long as the region is visible... ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-06-01 13:55 ` Lennart Borgman @ 2010-06-01 19:03 ` Stefan Monnier 2010-06-01 19:15 ` Lennart Borgman 0 siblings, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2010-06-01 19:03 UTC (permalink / raw) To: Lennart Borgman Cc: Juri Linkov, Chong Yidong, Emacs-Devel devel, Drew Adams, Deniz Dogan >>>> > Why is not having a key to toggle the variable better? >>>> Because keys are in very short supply. >>> Not really, for a keymap such as isearch. >> Huh? Please suggest free key-bindings, then. Since keys not bound in >> isearch-mode-map lead to exiting isearch and running the corresponding >> command in the global map, isearch-mode-map is basically just as full as >> the global map. > I made another suggestion, reuse C-M-h. > It will not interfere with the global command in a bad manner I > believe. You just have to do it twice in case you want the global > binding. I believe it will be easy getting used to it - as long as the > region is visible... Your choice of C-M-h, which has no particular mnemonic or logical connection to the functionality you suggest, together with the argumentation about how its impact would be bearable, is a vivid proof of my argument: keys are in very short supply. Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-06-01 19:03 ` Stefan Monnier @ 2010-06-01 19:15 ` Lennart Borgman 0 siblings, 0 replies; 26+ messages in thread From: Lennart Borgman @ 2010-06-01 19:15 UTC (permalink / raw) To: Stefan Monnier Cc: Juri Linkov, Chong Yidong, Emacs-Devel devel, Drew Adams, Deniz Dogan On Tue, Jun 1, 2010 at 9:03 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >>>>> > Why is not having a key to toggle the variable better? >>>>> Because keys are in very short supply. >>>> Not really, for a keymap such as isearch. >>> Huh? Please suggest free key-bindings, then. Since keys not bound in >>> isearch-mode-map lead to exiting isearch and running the corresponding >>> command in the global map, isearch-mode-map is basically just as full as >>> the global map. >> I made another suggestion, reuse C-M-h. >> It will not interfere with the global command in a bad manner I >> believe. You just have to do it twice in case you want the global >> binding. I believe it will be easy getting used to it - as long as the >> region is visible... > > Your choice of C-M-h, which has no particular mnemonic or logical > connection to the functionality you suggest, Maybe my mnemonics and fuzzy logic are a bit wider then... ;-) I suggested a key binding that marks something (it is normally mark-defun) since we (at least I) wanted something to mark the matched region. > together with the > argumentation about how its impact would be bearable, is a vivid proof > of my argument: keys are in very short supply. This conclusion is maybe a bit circular since it is the assumption I started with ;-) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-06-01 4:43 ` Drew Adams 2010-06-01 12:56 ` Stefan Monnier @ 2010-06-01 21:03 ` Richard Stallman 1 sibling, 0 replies; 26+ messages in thread From: Richard Stallman @ 2010-06-01 21:03 UTC (permalink / raw) To: Drew Adams; +Cc: juri, cyd, emacs-devel, monnier, deniz.a.m.dogan > Because keys are in very short supply. Not really, for a keymap such as isearch. The characters that have a special meaning in isearch are started to interfere with the default meaning that they exit the search and then do their normal job. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] (Or "question"...) isearch-kill-found 2010-05-31 15:54 ` Stefan Monnier 2010-05-31 16:50 ` Lennart Borgman 2010-05-31 19:14 ` Drew Adams @ 2010-05-31 20:14 ` Juri Linkov 2 siblings, 0 replies; 26+ messages in thread From: Juri Linkov @ 2010-05-31 20:14 UTC (permalink / raw) To: Stefan Monnier; +Cc: Chong Yidong, Deniz Dogan, Emacs-Devel devel > So I'd much rather see an "exit and set the mark at isearch-other-end" > command, after which you can do C-w if you want to delete that text (I > could also imagine a "set the mark isearch-other-end but don't exit", > but then deleting the text would require RET C-w instead). For "exit and set the mark" we could add a prefix argument to RET (`isearch-exit') to do that. I remember some other suggestions for the prefix argument of `isearch-exit' like keeping lazy-highlighted matches, so maybe it should provide a set of different prefix arguments. -- Juri Linkov http://www.jurta.org/emacs/ ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2010-06-01 21:03 UTC | newest] Thread overview: 26+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-05-30 12:37 [PATCH] (Or "question"...) isearch-kill-found Deniz Dogan 2010-05-30 14:05 ` Johan Bockgård 2010-05-30 14:11 ` Deniz Dogan 2010-05-30 15:25 ` Drew Adams 2010-05-30 22:19 ` Christoph 2010-05-30 22:40 ` Lennart Borgman 2010-05-31 0:28 ` Drew Adams 2010-05-31 3:30 ` Michael Welsh Duggan 2010-05-31 15:32 ` Lennart Borgman 2010-05-31 0:48 ` Drew Adams 2010-05-30 18:36 ` Juri Linkov 2010-05-31 14:24 ` Chong Yidong 2010-05-31 15:38 ` Lennart Borgman 2010-05-31 15:54 ` Stefan Monnier 2010-05-31 16:50 ` Lennart Borgman 2010-05-31 19:14 ` Drew Adams 2010-05-31 19:50 ` Stefan Monnier 2010-05-31 20:04 ` Drew Adams 2010-06-01 3:10 ` Stefan Monnier 2010-06-01 4:43 ` Drew Adams 2010-06-01 12:56 ` Stefan Monnier 2010-06-01 13:55 ` Lennart Borgman 2010-06-01 19:03 ` Stefan Monnier 2010-06-01 19:15 ` Lennart Borgman 2010-06-01 21:03 ` Richard Stallman 2010-05-31 20:14 ` Juri Linkov
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).