[Top][All Lists]

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

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

From: Eric Abrahamsen
Subject: Re: [C-u M-q] -> unfill-paragraph
Date: Thu, 10 Nov 2011 11:55:56 +0800
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.91 (gnu/linux)

On Thu, Nov 10 2011, Tom Roche wrote:

> I'm running
> $ lsb_release -ds
> Linux Mint Debian Edition # Update Pack 3
> $ uname -rv
> 2.6.39-2-amd64 #1 SMP Tue Jul 5 02:51:22 UTC 2011
> $ 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.
> How to accomplish that? I tried

First of all, on my setup (emacs 24) there's no `unfill-paragraph'
command, are you sure you've got one? I had to make my own.

Your basic problem is that C-u is a prefix argument: ie, it's used to
feed a numerical argument (specifically, 4) to whatever command you call
next. You can't actually bind it as part of a key sequence to call a
specific command. Prefix keys have to be defined specially, and C-u

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.

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), and the function would
behave differently.

So, provided you actually have an `unfill-paragraph' command, you'll
have to bind it to some other key (like C-M-q).

Sure hope that makes sense,


> - (define-key global-map "\C-u\M-q" 'unfill-paragraph)
> but that fails with error=
> - Lisp error: (error "Key sequence C-u M-q starts with non-prefix key C-u")
> Apologies if this is a FAQ: feel free to send links to RTFM.
> TIA, Tom Roche <address@hidden>

GNU Emacs (i686-pc-linux-gnu, GTK+ Version 2.24.6)
 of 2011-11-07 on pellet

reply via email to

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