* isearch-whole-buffer? @ 2006-03-24 15:10 xyblor 2006-03-24 16:09 ` isearch-whole-buffer? Kevin Rodgers 2006-03-26 1:02 ` isearch-whole-buffer? Johan Bockgård 0 siblings, 2 replies; 10+ messages in thread From: xyblor @ 2006-03-24 15:10 UTC (permalink / raw) Is there a way to search the whole buffer while I type, like Firefox's "find" command? As it is now, C-s only searches the text after the point, and C-r searches the text before the point. I think it would be more convenient for me if C-s searched the whole text, without forcing me to press C-s again to overwrap the search. Does anyone know of a function that would accomplish this? Or maybe there's a variable I can change to get the desired behavior? I'm using XEmacs 21.4.13 on Win32. Thanks for any help! ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: isearch-whole-buffer? 2006-03-24 15:10 isearch-whole-buffer? xyblor @ 2006-03-24 16:09 ` Kevin Rodgers 2006-03-24 16:58 ` isearch-whole-buffer? Kevin Rodgers [not found] ` <mailman.19.1143219602.14013.help-gnu-emacs@gnu.org> 2006-03-26 1:02 ` isearch-whole-buffer? Johan Bockgård 1 sibling, 2 replies; 10+ messages in thread From: Kevin Rodgers @ 2006-03-24 16:09 UTC (permalink / raw) xyblor wrote: > Is there a way to search the whole buffer while I type, like Firefox's > "find" command? > > As it is now, C-s only searches the text after the point, and C-r > searches the text before the point. I think it would be more convenient > for me if C-s searched the whole text, without forcing me to press C-s > again to overwrap the search. Does anyone know of a function that would > accomplish this? Or maybe there's a variable I can change to get the > desired behavior? I'm using XEmacs 21.4.13 on Win32. (defadvice isearch-forward (before beginning-of-buffer activate) "Move point to the beginning of the buffer." (goto-char (point-min))) -- Kevin Rodgers ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: isearch-whole-buffer? 2006-03-24 16:09 ` isearch-whole-buffer? Kevin Rodgers @ 2006-03-24 16:58 ` Kevin Rodgers [not found] ` <mailman.19.1143219602.14013.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 10+ messages in thread From: Kevin Rodgers @ 2006-03-24 16:58 UTC (permalink / raw) Kevin Rodgers wrote: > xyblor wrote: > >> Is there a way to search the whole buffer while I type, like Firefox's >> "find" command? >> >> As it is now, C-s only searches the text after the point, and C-r >> searches the text before the point. I think it would be more convenient >> for me if C-s searched the whole text, without forcing me to press C-s >> again to overwrap the search. Does anyone know of a function that would >> accomplish this? Or maybe there's a variable I can change to get the >> desired behavior? I'm using XEmacs 21.4.13 on Win32. > > > (defadvice isearch-forward (before beginning-of-buffer activate) > "Move point to the beginning of the buffer." > (goto-char (point-min))) Actually the following might be a little better. Generally you don't want to clobber the mark, but this would allow you to return to the current point after the search with `C-u C-SPC C-u C-SPC'. (defadvice isearch-forward (before beginning-of-buffer activate) "Move point to the beginning of the buffer; leave mark at previous position." (beginning-of-buffer)) -- Kevin Rodgers ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <mailman.19.1143219602.14013.help-gnu-emacs@gnu.org>]
* Re: isearch-whole-buffer? [not found] ` <mailman.19.1143219602.14013.help-gnu-emacs@gnu.org> @ 2006-03-25 18:42 ` xyblor 2006-03-25 20:56 ` isearch-whole-buffer? B. T. Raven 0 siblings, 1 reply; 10+ messages in thread From: xyblor @ 2006-03-25 18:42 UTC (permalink / raw) Kevin Rodgers wrote: > Kevin Rodgers wrote: > >> xyblor wrote: >> >>> Is there a way to search the whole buffer while I type, like Firefox's >>> "find" command? > > (defadvice isearch-forward (before beginning-of-buffer activate) > "Move point to the beginning of the buffer; leave mark at previous > position." > (beginning-of-buffer)) Thanks for the suggestion; I didn't know about this whole "advice" concept. As you pointed out, this solution messes with the point in such a way that C-g does not get you back to where you were before the search, and I don't think I can live with that. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: isearch-whole-buffer? 2006-03-25 18:42 ` isearch-whole-buffer? xyblor @ 2006-03-25 20:56 ` B. T. Raven 2006-03-25 22:48 ` isearch-whole-buffer? xyblor 0 siblings, 1 reply; 10+ messages in thread From: B. T. Raven @ 2006-03-25 20:56 UTC (permalink / raw) "xyblor" <fake@invalid.email> wrote in message news:eoidnQEUW5yMErjZnZ2dnUVZ_v6dnZ2d@mcgill.ca... > Kevin Rodgers wrote: > > Kevin Rodgers wrote: > > > >> xyblor wrote: > >> > >>> Is there a way to search the whole buffer while I type, like Firefox's > >>> "find" command? > > > > (defadvice isearch-forward (before beginning-of-buffer activate) > > "Move point to the beginning of the buffer; leave mark at previous > > position." > > (beginning-of-buffer)) > > Thanks for the suggestion; I didn't know about this whole "advice" > concept. As you pointed out, this solution messes with the point in > such a way that C-g does not get you back to where you were before the > search, and I don't think I can live with that. I'm having trouble imagining why C-s xxxxxxxxxx... and then C-s again to force wrapping to the beginning of the buffer doesn't work for you. Even if the search string (xxxxxx...) is very long, you don't have to backspace to the beginning to return to the mark. You can just C-x C-x. No? Ed ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: isearch-whole-buffer? 2006-03-25 20:56 ` isearch-whole-buffer? B. T. Raven @ 2006-03-25 22:48 ` xyblor 2006-03-25 23:34 ` isearch-whole-buffer? Vin Shelton ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: xyblor @ 2006-03-25 22:48 UTC (permalink / raw) B. T. Raven wrote: > I'm having trouble imagining why C-s xxxxxxxxxx... and then C-s again to > force wrapping to the beginning of the buffer doesn't work for you. Even > if the search string (xxxxxx...) is very long, you don't have to backspace > to the beginning to return to the mark. You can just C-x C-x. No? Being forced to wrap the search is inconvenient when you don't know how to spell what you are looking for, and you have to press C-s every time you want to try a different spelling. It's also inconvenient to start a search when the point is at the end of the buffer, because no matter what you're looking for, you'll have to press C-s again, and you don't know you've typed enough characters. There's also a more general design issue at play here: it seems to me that most of the time, when a person initiates a search, s/he wants to answer the question "where in this buffer will I find this string?" not "where will I find this string in the portion of the buffer that is below/above the point?". I find Firefox's "find" (control-f) to be more sensible in this regard, and I am surprised that in the long history of Emacs' development, nobody seems to have shared this view; to such an extent that not only is there no built in function or variable to enable searching the whole buffer by default, there isn't even a convenient workaround. I realize it's a minor point, but given Emacs' extensible nature, I'm supposed to bend it to my will, right? Or am I just out to lunch on this? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: isearch-whole-buffer? 2006-03-25 22:48 ` isearch-whole-buffer? xyblor @ 2006-03-25 23:34 ` Vin Shelton 2006-03-26 2:07 ` isearch-whole-buffer? Miles Bader 2006-03-26 10:42 ` isearch-whole-buffer? Peter Dyballa 2 siblings, 0 replies; 10+ messages in thread From: Vin Shelton @ 2006-03-25 23:34 UTC (permalink / raw) xyblor <fake@invalid.email> writes: > B. T. Raven wrote: > >> I'm having trouble imagining why C-s xxxxxxxxxx... and then C-s again to >> force wrapping to the beginning of the buffer doesn't work for you. Even >> if the search string (xxxxxx...) is very long, you don't have to backspace >> to the beginning to return to the mark. You can just C-x C-x. No? > > Being forced to wrap the search is inconvenient when you don't know > how to spell what you are looking for, and you have to press C-s every > time you want to try a different spelling. It's also inconvenient to > start a search when the point is at the end of the buffer, because no > matter what you're looking for, you'll have to press C-s again, and > you don't know you've typed enough characters. > > There's also a more general design issue at play here: it seems to me > that most of the time, when a person initiates a search, s/he wants to > answer the question "where in this buffer will I find this string?" > not "where will I find this string in the portion of the buffer that > is below/above the point?". I find Firefox's "find" (control-f) to be > more sensible in this regard, and I am surprised that in the long > history of Emacs' development, nobody seems to have shared this view; > to such an extent that not only is there no built in function or > variable to enable searching the whole buffer by default, there isn't > even a convenient workaround. I realize it's a minor point, but given > Emacs' extensible nature, I'm supposed to bend it to my will, right? > Or am I just out to lunch on this? It seems to me that Firefox and emacsen are fundamentally different in the sense that a emacs (or any screen-based editor) has a sense of 'point' - where you are right now, vs. a browser's sense that you're viewing a webpage. In the former case it makes sense to search from where you are, but in the latter case it makes more sense to search from the start of the entire webpage. ... at least IMO. As to your problem - is it too cumbersome to type M-< before you type C-s? This does have the disadvantage that C-g doesn't work in exactly the same way, but your original point is still in the mark ring. (Personally, I thought Kevin's advice solution was more elegant than my proposed solution, but sometimes there's a value to explicitness and tastes vary, so perhaps you'd prefer my suggestion.) BTW, if you don't know exactly what you're searching for, isearch-forward-regexp (bound to M-C-s) may help. My $.02. - Vin Shelton ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: isearch-whole-buffer? 2006-03-25 22:48 ` isearch-whole-buffer? xyblor 2006-03-25 23:34 ` isearch-whole-buffer? Vin Shelton @ 2006-03-26 2:07 ` Miles Bader 2006-03-26 10:42 ` isearch-whole-buffer? Peter Dyballa 2 siblings, 0 replies; 10+ messages in thread From: Miles Bader @ 2006-03-26 2:07 UTC (permalink / raw) xyblor <fake@invalid.email> writes: > There's also a more general design issue at play here: it seems to me > that most of the time, when a person initiates a search, s/he wants to > answer the question "where in this buffer will I find this string?" not > "where will I find this string in the portion of the buffer that is > below/above the point?". I find Firefox's "find" (control-f) to be more > sensible in this regard, and I am surprised that in the long history of > Emacs' development, nobody seems to have shared this view I find the Emacs method far more natural than the search-whole-buffer method -- it's extremely confusing if a search _can't_ fail because it just automatically wraps. In other words, the Emacs method gives you more easily usable information about your search. To find out if you've reached the last occurance of a string in an "auto wrap" system, you've got to always note the position of your last match, and manually compare to the position after hitting search, which is quite annoying in practice. The fact that Emacs basically _does_ give you the "whole buffer" functionality with just one more repetition of the search key seems like a pretty good way to satisfy both scenarios with a minimum of fuss. -Miles -- `...the Soviet Union was sliding in to an economic collapse so comprehensive that in the end its factories produced not goods but bads: finished products less valuable than the raw materials they were made from.' [The Economist] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: isearch-whole-buffer? 2006-03-25 22:48 ` isearch-whole-buffer? xyblor 2006-03-25 23:34 ` isearch-whole-buffer? Vin Shelton 2006-03-26 2:07 ` isearch-whole-buffer? Miles Bader @ 2006-03-26 10:42 ` Peter Dyballa 2 siblings, 0 replies; 10+ messages in thread From: Peter Dyballa @ 2006-03-26 10:42 UTC (permalink / raw) Cc: help-gnu-emacs Am 25.03.2006 um 23:48 schrieb xyblor: > I find Firefox's "find" (control-f) to be more sensible in this > regard, and I am surprised that in the long history of Emacs' > development, nobody seems to have shared this view; to such an > extent that not only is there no built in function or variable to > enable searching the whole buffer by default, there isn't even a > convenient workaround. Could be GNU Emacs dedicates itself to people who have a plan, know what they're doing, and know what they've achieved until now. And you are right: there is no work-around, there are two: Esc-< C-s and Esc-> C-r. -- Greetings Pete The human animal differs from the lesser primates in his passion for lists of "Ten Best". -- H. Allen Smith ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: isearch-whole-buffer? 2006-03-24 15:10 isearch-whole-buffer? xyblor 2006-03-24 16:09 ` isearch-whole-buffer? Kevin Rodgers @ 2006-03-26 1:02 ` Johan Bockgård 1 sibling, 0 replies; 10+ messages in thread From: Johan Bockgård @ 2006-03-26 1:02 UTC (permalink / raw) In Emacs 22 you could use something like: (setq isearch-search-fun-function 'wrapping-search-fun) (defun wrapping-search-fun () (lambda (&rest args) (let* ((isearch-search-fun-function nil) (fun (isearch-search-fun))) (or (apply fun args) (unless (cadr args) (goto-char (if isearch-forward (point-min) (point-max))) (apply fun args)))))) (It will wrap around silently without indicating "wrapped" or "overwrapped" search.) -- Johan Bockgård ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-03-26 10:42 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-03-24 15:10 isearch-whole-buffer? xyblor 2006-03-24 16:09 ` isearch-whole-buffer? Kevin Rodgers 2006-03-24 16:58 ` isearch-whole-buffer? Kevin Rodgers [not found] ` <mailman.19.1143219602.14013.help-gnu-emacs@gnu.org> 2006-03-25 18:42 ` isearch-whole-buffer? xyblor 2006-03-25 20:56 ` isearch-whole-buffer? B. T. Raven 2006-03-25 22:48 ` isearch-whole-buffer? xyblor 2006-03-25 23:34 ` isearch-whole-buffer? Vin Shelton 2006-03-26 2:07 ` isearch-whole-buffer? Miles Bader 2006-03-26 10:42 ` isearch-whole-buffer? Peter Dyballa 2006-03-26 1:02 ` isearch-whole-buffer? Johan Bockgård
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).