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

Re: sed ignorer une occurence



Le 1 juin 2023 benoit a écrit :

> Ne fonctionne pas chez moi

Autant pour moi, faut toujours regarder les Messages :)
Là ça devrait marcher pour de vrai.

(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 (concat (match-string 1) " ") nil t))
      )))

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


Reply to: