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

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

Re: Any way to remove ^L or ^M from some buffer outputs?


From: Emanuel Berg
Subject: Re: Any way to remove ^L or ^M from some buffer outputs?
Date: Sun, 04 Oct 2020 21:49:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Patrick Mahan wrote:

> (defun cut-ctrlM ()
>   "Cut all visible ^M."
>   (interactive)
>   (beginning-of-buffer)
>   (while (search-forward "\r" nil t)
>     (replace-match "" nil t))
>   (not-modified)
>   (beginning-of-buffer))

Well, yeah, if we want to replace (not hide), only,
as always, the byte compiler is your friend!

  In cut-ctrlM:
  [...]Warning: ‘beginning-of-buffer’ is for interactive use only; use
      ‘(goto-char (point-min))’ instead.
  [...]Warning: ‘not-modified’ is for interactive use only; use
      ‘set-buffer-modified-p’ instead.
  [...]Warning: ‘beginning-of-buffer’ is for interactive use only; use
      ‘(goto-char (point-min))’ instead.

And... maybe wrap it in `save-excursion' as well?

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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