emacs-devel
[Top][All Lists]
Advanced

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

Re: unfill-paragraph (region) and indentation


From: Lennart Borgman
Subject: Re: unfill-paragraph (region) and indentation
Date: Mon, 2 Nov 2009 19:35:53 +0100

On Mon, Nov 2, 2009 at 7:21 PM, Lluís <address@hidden> wrote:
> `fill-paragraph-or-region' has been conflated with `fill-paragraph' [1] 
> (don't know in which
> version), so your code should be something like:
>
> (defun unfill-paragraph-or-region ()
>  (interactive)
>  (filladapt-mode nil);this is important, because
>                      ;otherwise    the   result  is   distorted  by the
>                      ;filladapt function stuff
>  (let ((fill-column (point-max)))
>    (fill-paragraph nil)
>    (filladapt-mode nil)))              ;on again
>
> Note that this will not work with a region containing multiple paragraphs.

I think I have sent something like those very simple functions below a
couple of times here (they are part of nXhtml):

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Unfilling
;;
;; The idea is from
;;   http://interglacial.com/~sburke/pub/emacs/sburke_dot_emacs.config

;;;###autoload
(defun unfill-paragraph ()
  "Unfill the current paragraph."
  (interactive) (with-unfilling 'fill-paragraph))
;;(defalias 'unwrap-paragraph 'unfill-paragraph)

;;;###autoload
(defun unfill-region ()
  "Unfill the current region."
  (interactive) (with-unfilling 'fill-region))
;;(defalias 'unwrap-region 'unfill-region)

;;;###autoload
(defun unfill-individual-paragraphs ()
  "Unfill individual paragraphs in the current region."
  (interactive) (with-unfilling 'fill-individual-paragraphs))
;;(defalias 'unwrap-individual-paragraphs 'unfill-individual-paragraphs)

(defun with-unfilling (fn)
  "Unfill using the fill function FN."
  (let ((fill-column 10000000)) (call-interactively fn)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]