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: Mon, 05 Oct 2020 00:56:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Patrick Mahan wrote:

> Yes, I have never byte-compiled it as I have only
> used it interactively to clean-up text files coming
> from a DOS world to linux/unix/macos. It is defined
> in my .emacs init file.

Well, you can byte-compile your .emacs as well. It is
just another Elisp file...

Anyway, here (last) is a refined version, if you
don't mind...

I wonder tho... why does (insert-char 13) insert ^M
but M-x insert-char 13 RET inserts ^S?

(defun delete-c-m (&optional beg end)
  (interactive (if (use-region-p)
                   (list (region-beginning) (region-end))
                 (list (point-min) (point-max)) ))
  (save-excursion
    (goto-char beg)
    (while (search-forward "\r" end t)
      (replace-match "" nil t) )
    (set-buffer-modified-p nil) ; can be user or omitted...
    ))
;; (insert-char 13)

-- 
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]