all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* strip extraneous CR characters
@ 2009-09-28 15:01 Ted Zlatanov
  2009-09-28 15:54 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2009-09-28 15:01 UTC (permalink / raw)
  To: emacs-devel

This code in Gnus' nnheader.el was also useful for the imap-hash.el I
put into Emacs recently:

;; from nnheader.el
(defsubst imap-hash-remove-cr-followed-by-lf ()
  (goto-char (point-max))
  (while (search-backward "\r\n" nil t)
    (delete-char 1)))

;; from nnheader.el
(defun imap-hash-ms-strip-cr (&optional string)
  "Strip ^M from the end of all lines in current buffer or STRING."
  (if string
    (with-temp-buffer
      (insert string)
      (imap-hash-remove-cr-followed-by-lf)
      (buffer-string))
    (save-excursion
      (imap-hash-remove-cr-followed-by-lf))))

I wonder if it makes sense to define these functions globally?  They are
not trivial, though the implementation is short.

Thanks
Ted





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

end of thread, other threads:[~2009-09-29  0:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-28 15:01 strip extraneous CR characters Ted Zlatanov
2009-09-28 15:54 ` Eli Zaretskii
2009-09-28 17:49   ` Ted Zlatanov
2009-09-28 18:10     ` Eli Zaretskii
2009-09-29  0:44     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.