[comp.emacs] This is Bad

sprecher@bimacs.BITNET (Sprecher yossy) (08/13/89)

The most annoying thing about emacs is that when you use incremental search
to find some string you must end it with an Escape. If you instead use an
arrow to move around the screen it generates junk (the reason is that the
arrow keys are implemented as a character sequence starting with an Escape,
e.g. ESC O C. Therefore, when you press an arrow emacs uses the ESC to end
the search and plugs in the OC charcters in the file, as if they were keyed
in from the key-board). This is really annoying. It happens so many times
that it's not funny.

Why can't emacs be like any other good editor where once you found the text,
you can move around without any preliminary steps, such as pressing ESC?

query-replace is even worse: once you get out of it with an ESC it is
impossible to resume.

Why doesn't emacs have any plain vanilla search and search-replace where you
can pause and then resume as in SPF (pardon the heresy).

Is there a way to replace the ESC with some other control-character as the
stop character for the search?

Am I missing some thing?

I found a partial answer for the search by adding the following:

(global-set-key "\C-f" "\C-s\C-s")

The first time I search for a string I still need to use the regular
incremental search (cntl-s), but on all subsequent occurances I can
use  cntl-f  which will find the next occurance without expecting an
ESC to end it, so that I can use the arrows freely. To wrap around to
the beginning of the file I still need cntl-s.

Any better suggestions?

Yossi Sprecher


p.s. I'm using emacs verion 18.45

aej@wpi.wpi.edu (Allan E Johannesen) (08/14/89)

> The most annoying thing about emacs is that when you use incremental search
> to find some string you must end it with an Escape. If you instead use an
> arrow to move around the screen it generates junk (the reason is that the
> arrow keys are implemented as a character sequence starting with an Escape,
> e.g. ESC O C. Therefore, when you press an arrow emacs uses the ESC to end
> the search and plugs in the OC charcters in the file, as if they were keyed
> in from the key-board). This is really annoying. It happens so many times
> that it's not funny.

> Is there a way to replace the ESC with some other control-character as the
> stop character for the search?

	.. many expressions of frustration are deleted above ..

I never use the arrow pad since I like to keep my fingers over the
keys, but do find that I often do want to issue meta-prefixed commands
when I've positioned via search.  So, if I had a terminal with a META
key, I'd have no problem at all.

Your problem, then is choosing the keystroke that you are least likely
to want to issue when you've reached some point in a buffer via
search; other commands will just dispatch and drop you out of search
naturally.  Personally, I like to exit search with a NUL, since I
think that emacs' feature of dropping a mark where the search started
is really where I would have put a mark anyway.  I do have to stroke
NUL NUL to drop a mark after search, but I manage to live with that.

(setq search-exit-char ?\C-\@)

montnaro@sprite.crd.ge.com (Skip Montanaro) (08/14/89)

Before you dump on Emacs, try M-x apropos search. Among other things you'll
find:

    re-search-backward	      
      Function: Search backward from point for match for regular expression REGEXP.
    re-search-forward	      
      Function: Search forward from point for regular expression REGEXP.
    search-backward		      
      Function: Search backward from point for STRING.
    search-forward		      
      Function: Search forward from point for STRING.

Just bind your favorites to C-s and C-r instead of their isearch
equivalents.

Alternatively, some other key besides escape can be the key that exits
incremental search mode. Again, from the apropos output:

    search-exit-char	      
      Variable: *Character to exit incremental search.

Just use setq to reset it.

Emacs (not GNU, but several of its direct predecessors) was around before
terminals with arrow keys that generated escape sequences.  Other dialects
of Emacs use the escape key to terminate entry of non-incremental search
strings (MicroEmacs at least, perhaps others).

--
Skip Montanaro (montanaro@sprite.crd.ge.com)

adb@bu-cs.bu.edu (Adam Bryant) (08/14/89)

In article <1042@bimacs.BITNET> sprecher@bimacs.BITNET (Sprecher yossy) writes:
+
+   The most annoying thing about emacs is that when you use incremental search
+   [description of exiting isearch with arrow keys]
+   Why can't emacs be like any other good editor where once you found the text,
+   you can move around without any preliminary steps, such as pressing ESC?

   I used to find the exiting of i-searchs in that way annoying as
well, but I have since gotten much more used to using the C-n, C-f, etc.
commands to move around, so that is not really a problem anymore.

   You can also just use the command 'search-forward' to search.
Better yet, I have written a number of emacs-lisp functions to
interface the search-forward and search-backword commands which allow
me to do repeated searches.

+   query-replace is even worse: once you get out of it with an ESC it is
+   impossible to resume.

   True, but a quick 'redo (C-x ESC)' with a RETURN will start up the
same query-replace again.  [Same for a lot of other commands... redo is
a very handy command]

+   Why doesn't emacs have any plain vanilla search and search-replace where you
+   can pause and then resume as in SPF (pardon the heresy).

   It does.  If the current functions are not quite what you want, you can
always write some code to use those functions the exact way that you want.
That is without a doubt the best part of Emacs, being able to totally
configure your environment the way that you want.  [Does vi have an
Emacs-mode?] 
+
+   Is there a way to replace the ESC with some other control-character as the
+   stop character for the search?

    Probably...

+   I found a partial answer for the search by adding the following:
+
+   (global-set-key "\C-f" "\C-s\C-s")

    You probably don't want to do that, since C-f is actually very
useful especially if you use a number of different terminals, and some
don't have well placed arrows keys. [if any].

+   Any better suggestions?

    I find the combination of 'search-forward' and 'redo' to work
rather well.  And the functions that I wrote:
    'find-string-{forward,backward}'
    'refind-string-{forward,backward}'
come in really handy when I have function keys to waste.  [I also
use the functions in sun.el(?) for repeated regular expression
searches.]

adam bryant
--
Adam Bryant                               ARPA:   adb@bu-cs.bu.edu
Conquer Hack'n'Slasher                    BITNET: adb@buenga
list: conquer-news-request@bu-cs.bu.edu   UUCP:   ...!harvard!bu-cs!adb

john@compugen. (John Beaudin) (08/14/89)

sprecher@bimacs.BITNET (Sprecher  yossy) writes:

>annoying thing about emacs is that when you use incremental search
>to find some string you must end it with an Escape. 

Not so, ^a, ^e, ^f, ^b, ^d can end it as well.

>query-replace is even worse: once you get out of it with an ESC it is
>impossible to resume.
Query-replace has 'recursive edit' available whereby you temporarily
leave the query-replace, do some stuff, and resume where you left off.

I think you owe the implementors of emacs an appology. You have very
clearly not made an attempt to read the documentation. Instead you
flame. Please be more considerate in the future. I feel bad when I read
about freeloaders (:-) like yourself cutting up something they didn't
contribute to. I use emacs and am damn glad some people had the generosity
and sense to post it. "Those who can, do; those who can't, complain."

I don't regret this flame.O
I'm not really sorry for the flame, 
-- 
We don' sign no stinkin dots

rbj@dsys.ncsl.nist.GOV (Root Boy Jim) (08/15/89)

? Is there a way to replace the ESC with some other control-character as the
? stop character for the search?

Put (setq search-exit-char ?\^M) in your .emacs to end searches with RET.
I do this because I don't like my escapes gobbled.

	Root Boy Jim
	Have GNU, Will Travel.

lrs@indetech.uucp (Lynn Slater) (08/15/89)

> Why can't emacs be like any other good editor where once you found the text,
> you can move around without any preliminary steps, such as pressing ESC?
I have changes to do this on a sun. Write me if you want them.
===============================================================
Lynn Slater -- {sun, ames, pacbell}!indetech!lrs or lrs@indetech.uucp
42075 Lawrence Place, Fremont Ca 94538
Office (415) 438-2048; Home (415) 796-4149; Fax (415) 438-2034
===============================================================

P.S. you might want to get into the habit of checking David Sills code archive.
-- 
===============================================================
Lynn Slater -- {sun, ames, pacbell}!indetech!lrs or lrs@indetech.uucp
42075 Lawrence Place, Fremont Ca 94538
Office (415) 438-2048; Home (415) 796-4149; Fax (415) 438-2034

lrs@indetech.uucp (Lynn Slater) (08/15/89)

> Alternatively, some other key besides escape can be the key that exits
> incremental search mode. 
Setting search-exit-char will not make the arrow keys stop a search and
work as arrow keys (like c-f or c-n will).  To make this work, a more
general solution is needed such as allowing multiple search-exit-characters.
You also have to let a character both stop a search and start the dispatch
of the next command. 

> interface the search-forward and search-backword commands which allow
> me to do repeated searches.
I don't get it. Typing c-s/c-r from inside a search already repeats the
current or previous search.
===============================================================
Lynn Slater -- {sun, ames, pacbell}!indetech!lrs or lrs@indetech.uucp
42075 Lawrence Place, Fremont Ca 94538
Office (415) 438-2048; Home (415) 796-4149; Fax (415) 438-2034
===============================================================
-- 
===============================================================
Lynn Slater -- {sun, ames, pacbell}!indetech!lrs or lrs@indetech.uucp
42075 Lawrence Place, Fremont Ca 94538
Office (415) 438-2048; Home (415) 796-4149; Fax (415) 438-2034

ceb@csli.Stanford.EDU (Charles Buckley) (08/15/89)

In article <2078@compugen.> john@compugen. (John Beaudin) writes:

   From: john@compugen. (John Beaudin)
   Newsgroups: comp.emacs
   Date: 14 Aug 89 03:36:18 GMT

   sprecher@bimacs.BITNET (Sprecher  yossy) writes:

   >annoying thing about emacs is that when you use incremental search
   >to find some string you must end it with an Escape. 

   Not so, ^a, ^e, ^f, ^b, ^d can end it as well.

What's more, if you change your search exit character (viz. for Gnu)

(setq search-exit-char ?\C-j)      ;C-j = line feed

you can end i-search with an escape-prefixed-command.  Don't go
tarring emacs with vi-mode-itis.  It's got the cleanest way of making
mode transitions I've ever seen, and far fewer modes.  I couldn't
believe one had to pass into a mode simply to *insert characters* when
I first used vi after years of emacsing.

Considerations of image size aside, in my opinion, the only reason
there are still vi users around is to give "the guys" something to
carry on about at lunchtime.

nate@hobbes.intel.com (Nate Hess) (08/16/89)

In article <10089@csli.Stanford.EDU>, ceb@csli (Charles Buckley) writes:

[discussion of getting out of i-search.]

>What's more, if you change your search exit character (viz. for Gnu)

>(setq search-exit-char ?\C-j)      ;C-j = line feed

>you can end i-search with an escape-prefixed-command.  Don't go
>tarring emacs with vi-mode-itis.  It's got the cleanest way of making
>mode transitions I've ever seen, and far fewer modes.  I couldn't
>believe one had to pass into a mode simply to *insert characters* when
>I first used vi after years of emacsing.

Indeed, it makes much more sense to exit out of a search, than to have
to enter and exit insert mode.

>Considerations of image size aside, in my opinion, the only reason
>there are still vi users around is to give "the guys" something to
>carry on about at lunchtime.

If everyone used Emacs, what would there be left to debate in
alt.religion.computers?!  I'd love to create some kind of an editor
benchmark, in which some fairly large, reasonably complex editing task
has to be performed in the Editor Of Your Choice.  I think that GNU
Emacs would win such a benchmark with no problem.

--woodstock
-- 
	   "What I like is when you're looking and thinking and looking
	   and thinking...and suddenly you wake up."   - Hobbes

woodstock@hobbes.intel.com   ...!{decwrl|hplabs!oliveb}!intelca!mipos3!nate 

evs@romeo.cs.duke.edu (Ed Simpson) (08/19/89)

In article <1989Aug14.203218.6947@indetech.uucp> lrs@indetech.UUCP (Lynn Slater) writes:
>
>> Alternatively, some other key besides escape can be the key that exits
>> incremental search mode. 
>Setting search-exit-char will not make the arrow keys stop a search and
>work as arrow keys (like c-f or c-n will).

I think it will work because the ESC char will be treated as a random
control character and will be passed on as the start of the next
command:

search-exit-option's value is t

Documentation:
*Non-nil means random control characters terminate incremental search.

----------
Ed Simpson    e-mail by ARPANET: evs@cs.duke.edu    tel.: (919)684-6807
P.O.Box 3140, Duke Univ. Medical Center, Durham, NC, USA 27710

knighten@pinocchio (Bob Knighten) (08/23/89)

In article <1989Aug14.203218.6947@indetech.uucp>, lrs@indetech (Lynn Slater) writes:
>
>> Alternatively, some other key besides escape can be the key that exits
>> incremental search mode. 
>Setting search-exit-char will not make the arrow keys stop a search and
>work as arrow keys (like c-f or c-n will).  To make this work, a more
>general solution is needed such as allowing multiple search-exit-characters.
>You also have to let a character both stop a search and start the dispatch
>of the next command. 

Not so.  I use (setq search-exit-char 13)              ; Change from ESC to CR
and standard arrow key bindings and they exactly stop a search and work as
arrow keys.