help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: [C-u M-q] -> unfill-paragraph


From: Tom Roche
Subject: Re: [C-u M-q] -> unfill-paragraph
Date: Thu, 10 Nov 2011 12:29:33 -0500
User-agent: GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4)

Tom Roche Wed, 09 Nov 2011 16:15:00 -0500
>> $ emacs --version
>> GNU Emacs 23.3.1

>> on which M-q "runs the command fill-paragraph". Therefore ISTM
>> C-u M-q should run the command unfill-paragraph ... but it does not.

Eric Abrahamsen Thu, 10 Nov 2011 11:55:56 +0800
> First of all, on my setup (emacs 24) there's no `unfill-paragraph'
> command, are you sure you've got one?

Turns out nxhtml

http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html

provides unfill-paragraph:

`C-h f`
>>> unfill-paragraph is an interactive compiled Lisp function in
>>> `ourcomments-util.el'.

nxhtml_2.08/util/ourcomments-util.el (slightly edited for email)
>>>> ;;; 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))

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

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

>>>> (defun with-unfilling (fn)
>>>>   "Unfill using the fill function FN."
>>>>   (let ((fill-column (1+ (point-max)))) (call-interactively fn)))

> In order for a command to change its behavior in the presence of a
> prefix argument, the function definition itself has to look for the
> argument and handle it. A function that doesn't handle it just ignores
> it. In this case, `fill-paragraph' does handle a prefix argument, but
> takes it to mean that you want to justify the paragraph.

Which I don't want.

> You would have to rewrite the function definition to make it treat a
> prefix argument differently. Even then, you wouldn't bind any new
> function to C-u M-q, you'd just call `fill-paragraph' with a prefix
> argument (which is the key combination C-u M-q)

So is there an easy, userland way to write one's own `fill-paragraph' façade 
such that

* my `fill-paragraph' would hide (e.g., be earlier in a $PATH) the 
emacs-provided `fill-paragraph'

* my `fill-paragraph' could delegate to the emacs-provided `fill-paragraph' 
except when called with prefix argument

? Your assistance is appreciated, Tom Roche <Tom_Roche@pobox.com>



reply via email to

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