From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Roche Newsgroups: gmane.emacs.help Subject: Re: [C-u M-q] -> unfill-paragraph Date: Sun, 13 Nov 2011 10:52:44 -0500 Message-ID: <87zkg02f5f.fsf@pobox.com> References: <87mxc023k6.fsf@pobox.com> <87lirn28ea.fsf@pobox.com> Reply-To: help-gnu-emacs@gnu.org, Tom Roche NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1321199474 19365 80.91.229.12 (13 Nov 2011 15:51:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 13 Nov 2011 15:51:14 +0000 (UTC) To: help-gnu-emacs@gnu.org, Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 13 16:51:11 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RPcKs-0001ak-5A for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Nov 2011 16:51:10 +0100 Original-Received: from localhost ([::1]:40664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPcKr-0006Fz-A3 for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Nov 2011 10:51:09 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:39620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPcKl-0006Dl-BQ for help-gnu-emacs@gnu.org; Sun, 13 Nov 2011 10:51:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPcKk-0000cK-Cn for help-gnu-emacs@gnu.org; Sun, 13 Nov 2011 10:51:03 -0500 Original-Received: from b-pb-sasl-quonix.pobox.com ([208.72.237.35]:53240 helo=smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPcKk-0000cE-6Q for help-gnu-emacs@gnu.org; Sun, 13 Nov 2011 10:51:02 -0500 Original-Received: from smtp.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id 574EA4F5C; Sun, 13 Nov 2011 10:51:01 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:in-reply-to:references:reply-to:date:message-id :mime-version:content-type:content-transfer-encoding; s=sasl; bh=/JrF6A/ZM+jccCMr2QTEbAOzsfI=; b=ULqFjy9+5EFXxMv0UbUPJIrWNOsQ GxfW2V/loAzUqagU6MvHblrJDhYQNqa0LtUSRJlmL4AC1sfnoVNm/p0hxW0ZeuPu zikt0HrhOhnzAwK+DHzAn2vuecvn6NgO0gbTyO/IodLT3kh0fEaZJrdgcIe721O+ vgFqDb/m2Ns8bk4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :in-reply-to:references:reply-to:date:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=gDQUor mY10qb5is60V4g8CdBWZ6VCROkq8qq4W7hukunnwyMpBAdVR77uWBINrVkR4cnxb uz8uhAnvfZ3Db+X2keClDC14eZJQKsCZ/DCsQ2CSKiSqpppW5SR8jyp756OUBgKn Ad044LeB1whPOmC6GvIcFv2SuPgREs2BKmjMs= Original-Received: from b-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id 505F24F5B; Sun, 13 Nov 2011 10:51:01 -0500 (EST) Original-Received: from tlrPanP5.pobox.com (unknown [24.225.71.155]) by b-sasl-quonix.pobox.com (Postfix) with ESMTPA id CC9464F5A; Sun, 13 Nov 2011 10:51:00 -0500 (EST) In-Reply-To: <87mxc023k6.fsf@pobox.com> User-Agent: GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4) X-Pobox-Relay-ID: 49048A8C-0E0F-11E1-B004-9DB42E706CDE-07218935!b-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 208.72.237.35 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82889 Archived-At: [Text-mode table enclosed--best viewed in monospace font.] Tom Roche Thu, 10 Nov 2011 12:29:33 -0500 >> [How] to write one's own `fill-paragraph' fa=C3=A7ade such that >> * [my-fill-paragraph] would hide [the] emacs-provided >> `fill-paragraph' >> * [my-fill-paragraph] could delegate to the emacs-provided >> `fill-paragraph' except when called with prefix argument Scott Frazer Thu, 10 Nov 2011 14:00:14 -0500 > (defun my-fill-paragraph (&optional arg) > (interactive "P") > (let ((fill-column (if arg (point-max) fill-column))) > (fill-paragraph))) > (global-set-key (kbd "M-q") 'my-fill-paragraph) That works, except for region handling. What the code above does is +----------------------------------------------------------------+ | | M-q | C-u M-q | +----------------------------------------------------------------+ | no region selected | fill the paragraph | unfill the paragraph | | | surrounding or | surrounding or | | | following point | following point | +----------------------------------------------------------------+ | region selected | nothing | unfills first (only) | | | | paragraph in region | +----------------------------------------------------------------+ What I want is +------------------------------------------------------------------+ | | M-q | C-u M-q | +------------------------------------------------------------------+ | no region selected | fill the paragraph | unfill the paragraph | | | surrounding or | surrounding or | | | following point | following point | +------------------------------------------------------------------+ | region selected | fill all paragraphs | unfill all paragraphs | | | in the region | in the region | +------------------------------------------------------------------+ Note that the wanted region-handling behaviors are those which one gets usi= ng M-x, i.e., with region selected * `M-x fill-paragraph' fills all paragraphs in the selected region * `M-x unfill-paragraph' unfills all paragraphs in the selected region How to fix? Apologies for elisp lameness. One Of These Days I really gotta = sit down and learn the tool. But right now, I gotta learn more fortran firs= t :-( Your assistance is appreciated, Tom Roche