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

Re: sed ignorer une occurence



Le 1 juin 2023 benoit a écrit :

> Je m'y suis essayé, j'ai abandonné, mais avec un petit coupe de pouce... ;-)

Tu y étais presque :)

(defun ConvertRet ()
  "Convertit un retour à la ligne."
  (interactive)
  (let (
	(p1 (region-beginning))
	(p2 (region-end)))
    (save-restriction
      (narrow-to-region p1 p2)
      (goto-char (point-min))
      (while (re-search-forward "-\\\n" nil t)
	(replace-match "" nil t))
      (goto-char (point-min))

      (while (re-search-forward "\\\n" nil t)
	(replace-match " " nil t))
      )))

(defun indentBuffer ()
  "Convertit un texte jutifié avec des retours à la ligne."
  (interactive)
  (mark-whole-buffer)
  (ConvertRet))


Reply to: