unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: Replace whole words?
       [not found] <Xns93E7BCA3B6E3Fljxilsjfdiaujiosdfua@130.133.1.4>
@ 2003-08-31  1:43 ` Johan Bockgård
  2003-09-01 13:19   ` Rob Thorpe
  2003-08-31  1:50 ` Jesper Harder
  2003-08-31  9:19 ` Thien-Thi Nguyen
  2 siblings, 1 reply; 7+ messages in thread
From: Johan Bockgård @ 2003-08-31  1:43 UTC (permalink / raw)


dum dee dee dum <xjkljasdfi@yahoo.org> writes:

> I have written a fairly long program, but I now want to find and
> replace all the 'int' s in the program to double as easily as
> possible. But I don't want the other words, variable names, etc. in
> the program that have 'int' in them (internationalization, for
> example) to change. Any ideas? M-% is an option

C-u M-%

    [...]
    Third arg DELIMITED (prefix arg if interactive), if non-nil, means
    replace only matches surrounded by word boundaries.

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Replace whole words?
       [not found] <Xns93E7BCA3B6E3Fljxilsjfdiaujiosdfua@130.133.1.4>
  2003-08-31  1:43 ` Replace whole words? Johan Bockgård
@ 2003-08-31  1:50 ` Jesper Harder
  2003-08-31  9:19 ` Thien-Thi Nguyen
  2 siblings, 0 replies; 7+ messages in thread
From: Jesper Harder @ 2003-08-31  1:50 UTC (permalink / raw)


dum dee dee dum <xjkljasdfi@yahoo.org> writes:

> I have written a fairly long program, but I now want to find and
> replace all the 'int' s in the program to double as easily as
> possible. But I don't want the other words, variable names, etc. in
> the program that have 'int' in them (internationalization, for
> example) to change. Any ideas? M-% is an option, but I have to say
> yes or no for each word it finds to make sure that parts of words
> don't get replaced - I want to do this in just one command if
> possible.

You can replace by using a regular expression -- use `C-M-%'. 

"\<" matches the beginning of a word, and "\>" matches the end of a
word.  So "\<int\>" is the string you want to search for.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Replace whole words?
       [not found] <Xns93E7BCA3B6E3Fljxilsjfdiaujiosdfua@130.133.1.4>
  2003-08-31  1:43 ` Replace whole words? Johan Bockgård
  2003-08-31  1:50 ` Jesper Harder
@ 2003-08-31  9:19 ` Thien-Thi Nguyen
  2 siblings, 0 replies; 7+ messages in thread
From: Thien-Thi Nguyen @ 2003-08-31  9:19 UTC (permalink / raw)


dum dee dee dum <xjkljasdfi@yahoo.org> writes:

> I want to do this in just one 
> command if possible.

hee hee answer:

     #define int double

sometimes i wish there were a C-M-% for days of the week...

thi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Replace whole words?
       [not found] <E19tLWW-0000ph-Tp@monty-python.gnu.org>
@ 2003-08-31 16:28 ` Joe Corneli
  2003-08-31 16:36 ` mail-yank-original Joe Corneli
       [not found] ` <mailman.1350.1062349996.29551.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Corneli @ 2003-08-31 16:28 UTC (permalink / raw)


You could alternatively M-% " int " RET " double " RET !  [no quotes]
(or maybe M-% "(int " RET "(double " RET !) though this in't the elegant
way.

Joe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* mail-yank-original
       [not found] <E19tLWW-0000ph-Tp@monty-python.gnu.org>
  2003-08-31 16:28 ` Replace whole words? Joe Corneli
@ 2003-08-31 16:36 ` Joe Corneli
       [not found] ` <mailman.1350.1062349996.29551.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Corneli @ 2003-08-31 16:36 UTC (permalink / raw)


C-c C-y  mail-yank-original in my *mail* evokes

Symbol's value as variable is void: mail-reply-buffer

Why is this?  Seems like something that rmail & mail should
be able to settle between themselves without my intervention...

Joe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Replace whole words?
  2003-08-31  1:43 ` Replace whole words? Johan Bockgård
@ 2003-09-01 13:19   ` Rob Thorpe
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Thorpe @ 2003-09-01 13:19 UTC (permalink / raw)


bojohan+news@dd.chalmers.se (Johan Bockgård) wrote in message news:<yoij3cfiha9c.fsf@frealaf.dd.chalmers.se>...
> dum dee dee dum <xjkljasdfi@yahoo.org> writes:
> 
> > I have written a fairly long program, but I now want to find and
> > replace all the 'int' s in the program to double as easily as
> > possible. But I don't want the other words, variable names, etc. in
> > the program that have 'int' in them (internationalization, for
> > example) to change. Any ideas? M-% is an option
> 
> C-u M-%
> 
>     [...]
>     Third arg DELIMITED (prefix arg if interactive), if non-nil, means
>     replace only matches surrounded by word boundaries.

If I were you I would do it the way Jesper suggests, but I would
replace it with another term, say num_type.  Then put at the top
something like ttn suggests :-

#define  num_type int;
/* #define num_type double; */

(Or use typedef.)

This allows you to change things easily.  I've often done this in the
past to allow me to experiment with using doubles and floats.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mail-yank-original
       [not found] ` <mailman.1350.1062349996.29551.help-gnu-emacs@gnu.org>
@ 2003-09-10 13:46   ` Kai Grossjohann
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Grossjohann @ 2003-09-10 13:46 UTC (permalink / raw)


Joe Corneli <jcorneli@math.utexas.edu> wrote in message news:<mailman.1350.1062349996.29551.help-gnu-emacs@gnu.org>...
> C-c C-y  mail-yank-original in my *mail* evokes
> 
> Symbol's value as variable is void: mail-reply-buffer
> 
> Why is this?  Seems like something that rmail & mail should
> be able to settle between themselves without my intervention...

Nobody has answered, and I also don't have a good idea.  The only
thing that comes to my mind is to try to reproduce the problem with
"emacs -q -no-site-file".  If it still happens there, then it must be
a bug and M-x report-emacs-bug RET is your friend.  If it makes the
problem go away, then you can try "emacs -q".  If that shows the
problem then there is something wrong in site-start.el or default.el. 
If "emacs -q" also doesn't show the problem, then something is fishy
in ~/.emacs.

For finding the problem in site-start.el or default.el or .emacs, I
suggest to comment out the second half of the file.  Then you know
whether it's in the first half or in the second half.  Then you halve
the half and so on and pretty soon you'll find the problematic spot. 
Then you either know what to do, or you post another question saying
the following lisp code fubars and ask for help.

Kai

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-09-10 13:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E19tLWW-0000ph-Tp@monty-python.gnu.org>
2003-08-31 16:28 ` Replace whole words? Joe Corneli
2003-08-31 16:36 ` mail-yank-original Joe Corneli
     [not found] ` <mailman.1350.1062349996.29551.help-gnu-emacs@gnu.org>
2003-09-10 13:46   ` mail-yank-original Kai Grossjohann
     [not found] <Xns93E7BCA3B6E3Fljxilsjfdiaujiosdfua@130.133.1.4>
2003-08-31  1:43 ` Replace whole words? Johan Bockgård
2003-09-01 13:19   ` Rob Thorpe
2003-08-31  1:50 ` Jesper Harder
2003-08-31  9:19 ` Thien-Thi Nguyen

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