help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to search whole buffer?


From: Tassilo Horn
Subject: Re: How to search whole buffer?
Date: Wed, 22 Apr 2009 12:39:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Ulrich Scholz <d7@thispla.net> writes:

Hi Ulrich,

what you want is this:

--8<---------------cut here---------------start------------->8---
(defun my-replace ()
  "change escape sequences to umlauts"
  (interactive)
  (save-excursion
    (goto-char 1)
    (while (search-forward "ß" nil t)
      (replace-match "ß" nil nil))))
--8<---------------cut here---------------end--------------->8---

The `save-excursion' takes care that point is on the same position after
the replace and (goto-char 1) sets the point to the first position in
the buffer, so that the replace is done in the whole buffer.

HTH,
Tassilo
-- 
A morning without coffee is like something without something else.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]