I want to do a set of search and replace operations in emacs, so I wrote this function:

```
defun untwist ()
 (interactive)
 (while (re-search-forward "yield " nil t) (replace-match ""))
 (while (re-search-forward "@defer.inlineCallbacks" nil t) (replace-match ""))
 (while (re-search-forward "defer.returnValue" nil t) (replace-match "return "))
 (while (re-search-forward "@inlineCallbacks" nil t) (replace-match ""))
 (while (re-search-forward "returnValue" nil t) (replace-match "return "))
 (while (re-search-forward "^from twisted\.+\n" nil t) (replace-match ""))
 (while (re-search-forward "(session," nil t) (replace-match "("))
 (while (re-search-forward "session\.log(\(.*\))" nil t) (replace-match "print \1"))
)

```

However, only some of the substitutions get done. I ran it on:

```
@defer.inlineCallbacks
yield x

```

and got:

```
@defer.inlineCallbacks
x

```

What am I doing wrong?