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

Re : Re: sed ignorer une occurence



Le jeudi 1 juin 2023 à 15:21, Michel Verdier <mv524@free.fr> a écrit :

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

Un tout grand merci ! :-)
Il me reste juste l'exception pour le cas ou je veux laisser les "\n" des lignes qui se terminent par un "." ?

C'est sur ce site que je me suis initié à faire mes macros pour emacs, du coup un petit UP dans les moteurs de recherche !
http://xahlee.info/emacs/emacs
 


Reply to: