GNU bug report logs - #18847
24.4; Inconsistent behaviour of M-h with negative arguments

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: dieter@HIDDEN (H. Dieter Wilhelm); merged with #45318; dated Sun, 26 Oct 2014 23:29:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Removed tag(s) fixed. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Forcibly Merged 18847 45318. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Removed tag(s) patch. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug No longer marked as fixed in versions 28.1 and reopened. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.
bug unarchived. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug archived. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.
bug marked as fixed in version 28.1, send any further explanations to 18847 <at> debbugs.gnu.org and dieter@HIDDEN (H. Dieter Wilhelm) Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 18847 <at> debbugs.gnu.org:


Received: (at 18847) by debbugs.gnu.org; 13 Aug 2020 09:52:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 13 05:52:12 2020
Received: from localhost ([127.0.0.1]:46948 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k69u8-0001wG-29
	for submit <at> debbugs.gnu.org; Thu, 13 Aug 2020 05:52:12 -0400
Received: from quimby.gnus.org ([95.216.78.240]:55488)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1k69u6-0001vz-Dt
 for 18847 <at> debbugs.gnu.org; Thu, 13 Aug 2020 05:52:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=FsG4oDvBtzSlqSwM27RXtm6aJbic/lX2fPt84MB9rhY=; b=g3KV0WMOiftDlrnGwQeAkG49a+
 noQspxdfJSWQ/NPNfvmt9FvIlLlxuRWH2Wpg6sgp5h3QxC6YHOm/woBY733wMVd/mKdY/+CF9WANa
 QS//eAIWaMKndEhBEiS6bxl2Jw/AvZLor/SZE4rcyNSvPC3cZnfutMYmMeGTaMsjdptg=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1k69tv-0004hn-VQ; Thu, 13 Aug 2020 11:52:03 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: dieter@HIDDEN (H. Dieter Wilhelm)
Subject: Re: bug#18847: 24.4; Inconsistent behaviour of M-h with negative
 arguments
References: <877fzmqunb.fsf@HIDDEN>
 <jwvfve8uo1r.fsf-monnier+emacsbugs@HIDDEN>
 <87oasvq1ja.fsf@HIDDEN>
 <jwvioj1a5ei.fsf-monnier+emacsbugs@HIDDEN>
 <877fzc418v.fsf@HIDDEN> <87ppco2s74.fsf@HIDDEN>
Date: Thu, 13 Aug 2020 11:51:58 +0200
In-Reply-To: <87ppco2s74.fsf@HIDDEN> (H. Dieter Wilhelm's message of
 "Sat, 15 Nov 2014 20:13:03 +0100")
Message-ID: <87zh6yg9fl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  dieter@HIDDEN (H. Dieter Wilhelm) writes: >
 The following patches > > 1) solve bug#18847 (when applying M-h with negative
 arguments and > repeating this command) > > 2) solve another - not reported
 - bug. When, e.g. at the end of the > buffer [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 18847
Cc: Stefan Monnier <monnier@HIDDEN>, 18847 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

dieter@HIDDEN (H. Dieter Wilhelm) writes:

> The following patches
>
> 1) solve bug#18847 (when applying M-h with negative arguments and
>    repeating this command)
>
> 2) solve another - not reported - bug.  When, e.g. at the end of the
>    buffer, the numbers of paragraphs left in the buffer is less than
>    ARG, then paragraphs are also marked *before* the current paragraph
>    (contradicting the function's documentation)
>
> 3) (hopefully) clarifying a bit the documentation of mark-paragraph
>
> 4) aligning the behaviour of a zero argument to other marking commands
>    (doing nothing, no error signal)

Thanks; I've now applied this patch to Emacs 28 (with some small
whitespace changes).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18847; Package emacs. Full text available.
Added tag(s) patch. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 18847 <at> debbugs.gnu.org:


Received: (at 18847) by debbugs.gnu.org; 15 Nov 2014 19:13:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 15 14:13:10 2014
Received: from localhost ([127.0.0.1]:34114 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XpimT-0006px-MR
	for submit <at> debbugs.gnu.org; Sat, 15 Nov 2014 14:13:10 -0500
Received: from mail-wg0-f49.google.com ([74.125.82.49]:38500)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <dieter.wilhelm@HIDDEN>) id 1XpimR-0006pp-JI
 for 18847 <at> debbugs.gnu.org; Sat, 15 Nov 2014 14:13:08 -0500
Received: by mail-wg0-f49.google.com with SMTP id x13so21836089wgg.8
 for <18847 <at> debbugs.gnu.org>; Sat, 15 Nov 2014 11:13:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-type;
 bh=B9KPMRFjuAJcpi/1E+81Dfp4wbbJeiDv130v29tb3LU=;
 b=x9yoaCk6xFXb5JzI8zD2bXzaehQN5hDYanH4iv3cBe0+GTc2aBqbYBZaMfPqUNOQQu
 VcnmWFt5brKcEmPaZpYRHLXTmKTVc2B5K0kPAU7E3Epv5jHj7uua8jh4Gto5Edw3CcWE
 KGUs+dO1+Le2sj+LeMD9vtAO44WxZBdIyyneLJ5w+OdfsWc/m0dZ0koFCZsCLpVN7T63
 s7urbRfnd1QSNH9NVgytQmbftdB9bra1yzGriE9cB//qrq6HH1Jhkh4T6/dGYx76A8QV
 1eoIDEm4e7WCbrhsyax5TogUou5iXeNcppKbcwmXilf0gUu0VwaTi3+LD1kWVbPYoHlq
 T3Ig==
X-Received: by 10.194.5.227 with SMTP id v3mr25549007wjv.63.1416078786827;
 Sat, 15 Nov 2014 11:13:06 -0800 (PST)
Received: from vsl28t2g.ww011 (p57ACDB2D.dip0.t-ipconnect.de. [87.172.219.45])
 by mx.google.com with ESMTPSA id
 da3sm44323272wjb.12.2014.11.15.11.13.04 for <multiple recipients>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 15 Nov 2014 11:13:05 -0800 (PST)
From: dieter@HIDDEN (H. Dieter Wilhelm)
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#18847: 24.4;
 Inconsistent behaviour of M-h with negative arguments
References: <877fzmqunb.fsf@HIDDEN>
 <jwvfve8uo1r.fsf-monnier+emacsbugs@HIDDEN>
 <87oasvq1ja.fsf@HIDDEN>
 <jwvioj1a5ei.fsf-monnier+emacsbugs@HIDDEN>
 <877fzc418v.fsf@HIDDEN>
Date: Sat, 15 Nov 2014 20:13:03 +0100
In-Reply-To: <877fzc418v.fsf@HIDDEN> (H. Dieter Wilhelm's message of
 "Mon, 03 Nov 2014 18:56:00 +0100")
Message-ID: <87ppco2s74.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 18847
Cc: 18847 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)


The following patches

1) solve bug#18847 (when applying M-h with negative arguments and
   repeating this command)

2) solve another - not reported - bug.  When, e.g. at the end of the
   buffer, the numbers of paragraphs left in the buffer is less than
   ARG, then paragraphs are also marked *before* the current paragraph
   (contradicting the function's documentation)

3) (hopefully) clarifying a bit the documentation of mark-paragraph

4) aligning the behaviour of a zero argument to other marking commands
   (doing nothing, no error signal)

It still remains one anomaly - in my opinon - but only for a fringe
case, at the moment C-h and forward/backward-paragraph consider empty
lines at the end or the beginning of the buffer as an additional
paragraph...

Anyway, could some good soul apply the patches to emacs-24?

Thank you

      Dieter

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a6ab3b8..463753c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-15  H. Dieter Wilhelm <dieter@HIDDEN>
+	* textmodes/paragraph.el (mark-paragraph): Handling of
+	negative arguments (bug#18847)
+
 2014-11-14  Ivan Andrus  <darthandrus@HIDDEN>
 
 	* progmodes/python.el (python-ffap-module-path): Use


diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 3e77d37..d17cf09 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -371,33 +371,47 @@ See `forward-paragraph' for more information."
 
 (defun mark-paragraph (&optional arg allow-extend)
   "Put point at beginning of this paragraph, mark at end.
-The paragraph marked is the one that contains point or follows point.
+The paragraph marked is the one that contains point or follows
+point.
 
-With argument ARG, puts mark at end of a following paragraph, so that
-the number of paragraphs marked equals ARG.
+With argument ARG, puts mark at the end of this or a following
+paragraph, so that the number of paragraphs marked equals ARG.
 
-If ARG is negative, point is put at end of this paragraph, mark is put
-at beginning of this or a previous paragraph.
+If ARG is negative, point is put at the end of this paragraph,
+mark is put at the beginning of this or a previous paragraph.
 
 Interactively (or if ALLOW-EXTEND is non-nil), if this command is
-repeated or (in Transient Mark mode) if the mark is active,
-it marks the next ARG paragraphs after the ones already marked."
-  (interactive "p\np")
-  (unless arg (setq arg 1))
-  (when (zerop arg)
-    (error "Cannot mark zero paragraphs"))
-  (cond ((and allow-extend
-	      (or (and (eq last-command this-command) (mark t))
-		  (and transient-mark-mode mark-active)))
-	 (set-mark
-	  (save-excursion
-	    (goto-char (mark))
-	    (forward-paragraph arg)
-	    (point))))
-	(t
-	 (forward-paragraph arg)
-	 (push-mark nil t t)
-	 (backward-paragraph arg))))
+repeated or (in Transient Mark mode) if the mark is active, it
+marks the next ARG paragraphs after the region already marked.
+This also means when activating the mark immediately before using
+this command, the current paragraph is only marked from point."
+  (interactive "P\np")
+  (let ((numeric-arg (prefix-numeric-value arg)))
+    (cond ((zerop numeric-arg))
+	  ((and allow-extend
+		(or (and (eq last-command this-command) mark-active)
+		    (region-active-p)))
+	   (if arg
+	       (setq arg numeric-arg)
+	     (if (< (mark) (point))
+		 (setq arg -1)
+	       (setq arg 1)))
+	   (set-mark
+	    (save-excursion
+	      (goto-char (mark))
+	      (forward-paragraph arg)
+	      (point))))
+	  ;; don't activate the mark when at eob
+	  ((and (eobp) (> numeric-arg 0)))
+	  (t
+	   (unless (save-excursion
+		     (forward-line 0)
+		     (looking-at  paragraph-start))
+	     (backward-paragraph (signum numeric-arg)))
+	   (push-mark
+	    (save-excursion
+	      (forward-paragraph numeric-arg)
+	      (point)) t t)))))
 
 (defun kill-paragraph (arg)
   "Kill forward to end of paragraph.



-- 
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18847; Package emacs. Full text available.

Message received at 18847 <at> debbugs.gnu.org:


Received: (at 18847) by debbugs.gnu.org; 3 Nov 2014 17:56:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 03 12:56:13 2014
Received: from localhost ([127.0.0.1]:47786 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XlLrQ-0005xM-UO
	for submit <at> debbugs.gnu.org; Mon, 03 Nov 2014 12:56:13 -0500
Received: from mail-lb0-f181.google.com ([209.85.217.181]:61986)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <dieter.wilhelm@HIDDEN>) id 1XlLrN-0005x7-VO
 for 18847 <at> debbugs.gnu.org; Mon, 03 Nov 2014 12:56:10 -0500
Received: by mail-lb0-f181.google.com with SMTP id l4so3087116lbv.12
 for <18847 <at> debbugs.gnu.org>; Mon, 03 Nov 2014 09:56:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:from:to:cc:subject:references:date:message-id:user-agent
 :mime-version:content-type;
 bh=QekHHlpvd9dEsoXZ6nUoP7Bz8kaF2nnkxo0Mi1t98do=;
 b=TPi/YjuzC+f97xrgsLScBWEqe7KmbkNAsc63HiO4K2EXNy41tn746dyWF64OGZoZwR
 X+3rsAQtIssZbNz2wMcaQZ3/IcQis/X8M9TObcm/lZ1Gakmutqw+x8o2OlvfBlrPZu9n
 yKhe4aRV1cGvSGO0gV+s/ypvVB6CCkPmjMHsmDlQBIQclSf81M+39NpGpflHIzcIDOJA
 vpUAE6YKVfaO24VMsjvUqsNuRlMA42MnqjfCUHCBksG3kE7XffUPoazeSib9lcAHu/iU
 6t8hJiwvYO8CVSFtIJ+pdCBUKoEdRrPxZjNoq3Lb2+4eAD29DkBvTRZkr2EzeaWpdQvV
 8S2g==
X-Received: by 10.112.169.106 with SMTP id ad10mr52740262lbc.13.1415037363606; 
 Mon, 03 Nov 2014 09:56:03 -0800 (PST)
Received: from vsl28t2g.ww011 (p4FD4F4FD.dip0.t-ipconnect.de. [79.212.244.253])
 by mx.google.com with ESMTPSA id or5sm8191666lbb.42.2014.11.03.09.56.02
 for <multiple recipients>
 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
 Mon, 03 Nov 2014 09:56:03 -0800 (PST)
From: dieter@HIDDEN (H. Dieter Wilhelm)
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#18847: 24.4;
 Inconsistent behaviour of M-h with negative arguments
References: <877fzmqunb.fsf@HIDDEN>
 <jwvfve8uo1r.fsf-monnier+emacsbugs@HIDDEN>
 <87oasvq1ja.fsf@HIDDEN>
 <jwvioj1a5ei.fsf-monnier+emacsbugs@HIDDEN>
Date: Mon, 03 Nov 2014 18:56:00 +0100
Message-ID: <877fzc418v.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 18847
Cc: 18847 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Stefan Monnier <monnier@HIDDEN> writes:

> [ Be careful to keep 18847 <at> debbugs.gnu.org in the Cc, please.  ]

Sorry, I overlooked the Cc field.

....

>> 2) When applying M-h (or any other marking command) at the end of a
>>    buffer (at least interactively, I failed to address this), the right
>>    thing to do is marking (a) previous element(s).  I would like to know
>>    if you find this a good idea.
>
> I have no opinion on this, I never use M-h myself.

Interesting, no M-h!  Anyway, in the meantime I tested M-h more
thoroughly in these borderline cases and I think its behaviour is
actually not correct.  I suggest to separate this issue and possible
enhancements from the current subject.

>> 3) M-h (C-M-h and C-x C-p ) differ from C-@ and C-M-@ that they are
>>    always marking (a) whole element(s).  I wanted to clarify in the
>>    documentation string that a marking from point is also achievable
>>    with M-h.
>
> So this part is just a docstring change, right?

Exactly.

>> 4) M-h does signal an error applying zero as an argument, the other
>>    marking commands just ignore zero, so I thought a message might be a
>>    good compromise to the current state...
>
> I have no opinion on this one either.  It doesn't seem terribly
> important, so reducing discrepancies in this case might be the
> dominating factor.

Right, I dropped the zero argument message. (But still inhibited M-h to
activate the mark in this situation.)

Thank you for your patience

       Dieter


(defun mark-paragraph (&optional arg allow-extend)
  "Put point at beginning of this paragraph, mark at end.
The paragraph marked is the one that contains point or follows
point.

With argument ARG, puts mark at the end of this or a following
paragraph, so that the number of paragraphs marked equals ARG.

If ARG is negative, point is put at the end of this paragraph,
mark is put at the beginning of this or a previous paragraph.

Interactively (or if ALLOW-EXTEND is non-nil), if this command is
repeated or (in Transient Mark mode) if the mark is active, it
marks the next ARG paragraphs after the region already marked.
This also means when activating the mark immediately before using
this command, the current paragraph is only marked from point."
  (interactive "P\np")
  (let ((numeric-arg (prefix-numeric-value arg)))
    (cond ((zerop numeric-arg))
	  ((and allow-extend
		(or (and (eq last-command this-command) mark-active)
		    (region-active-p)))
	   (if arg
	       (setq arg numeric-arg)
	     (if (< (mark) (point))
		 (setq arg -1)
	       (setq arg 1)))
	   (set-mark
	    (save-excursion
	      (goto-char (mark))
	      (forward-paragraph arg)
	      (point))))
	  (t
	   (forward-paragraph numeric-arg)
	   (push-mark nil t t)
	   (backward-paragraph numeric-arg)))))

diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 3e77d37..e1a735d 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -370,34 +370,47 @@ See `forward-paragraph' for more information."
   (forward-paragraph (- arg)))
 
 (defun mark-paragraph (&optional arg allow-extend)
-  "Put point at beginning of this paragraph, mark at end.
-The paragraph marked is the one that contains point or follows point.
-
-With argument ARG, puts mark at end of a following paragraph, so that
-the number of paragraphs marked equals ARG.
-
-If ARG is negative, point is put at end of this paragraph, mark is put
-at beginning of this or a previous paragraph.
-
-Interactively (or if ALLOW-EXTEND is non-nil), if this command is
-repeated or (in Transient Mark mode) if the mark is active,
-it marks the next ARG paragraphs after the ones already marked."
-  (interactive "p\np")
-  (unless arg (setq arg 1))
-  (when (zerop arg)
-    (error "Cannot mark zero paragraphs"))
-  (cond ((and allow-extend
-	      (or (and (eq last-command this-command) (mark t))
-		  (and transient-mark-mode mark-active)))
-	 (set-mark
-	  (save-excursion
-	    (goto-char (mark))
-	    (forward-paragraph arg)
-	    (point))))
-	(t
-	 (forward-paragraph arg)
-	 (push-mark nil t t)
-	 (backward-paragraph arg))))
+  "Put mark at beginning of this paragraph,  point at end.
+The paragraph marked is the one that contains point or follows
+point.
+
+With argument ARG, puts mark at the end of this or a following
+paragraph, so that the number of paragraphs marked equals ARG.
+
+If ARG is negative, point is put at the beginning of this
+paragraph, mark is put at the end of this or a previous
+paragraph.
+
+Interactively, if this command is repeated or (in Transient Mark
+Mode) if the mark is active, it marks the next ARG paragraphs
+after the region already marked.  This also means when activating
+the mark immediately before using this command, the current
+paragraph is only marked from point."
+  (interactive "P\np")
+  (let ((numeric-arg (prefix-numeric-value arg)))
+    (cond ((eobp)			; smart-aleck?
+	   (backward-paragraph (abs numeric-arg))
+	   (push-mark nil t t)
+	   (forward-paragraph (abs numeric-arg)))
+	  ((and allow-extend
+		(or (region-active-p)
+		    (and (eq last-command this-command) mark-active)))
+	   (if arg
+	       (setq arg numeric-arg)
+	     (if (< (mark) (point))
+		 (setq arg -1)
+	       (setq arg 1)))
+	   (set-mark
+	    (save-excursion
+	      (goto-char (mark))
+	      (forward-paragraph arg)
+	      (point))))
+	  ((zerop numeric-arg)
+	   (message "Will not mark zero paragraphs."))
+	  (t
+	   (forward-paragraph numeric-arg)
+	   (push-mark nil t t)
+	   (backward-paragraph numeric-arg)))))
 
 (defun kill-paragraph (arg)
   "Kill forward to end of paragraph.



-- 
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18847; Package emacs. Full text available.

Message received at 18847 <at> debbugs.gnu.org:


Received: (at 18847) by debbugs.gnu.org; 30 Oct 2014 16:35:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 30 12:35:04 2014
Received: from localhost ([127.0.0.1]:40704 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Xjsgh-0007OD-7M
	for submit <at> debbugs.gnu.org; Thu, 30 Oct 2014 12:35:03 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:40581)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1Xjsge-0007Nl-P4
 for 18847 <at> debbugs.gnu.org; Thu, 30 Oct 2014 12:35:01 -0400
Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s9UGYw0C031758;
 Thu, 30 Oct 2014 12:34:59 -0400
Received: by ceviche.home (Postfix, from userid 20848)
 id EAA106610C; Thu, 30 Oct 2014 12:35:00 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: dieter@HIDDEN (H. Dieter Wilhelm)
Subject: Re: bug#18847: 24.4;
 Inconsistent behaviour of M-h with negative arguments
Message-ID: <jwvioj1a5ei.fsf-monnier+emacsbugs@HIDDEN>
References: <877fzmqunb.fsf@HIDDEN>
 <jwvfve8uo1r.fsf-monnier+emacsbugs@HIDDEN>
 <87oasvq1ja.fsf@HIDDEN>
Date: Thu, 30 Oct 2014 12:35:00 -0400
In-Reply-To: <87oasvq1ja.fsf@HIDDEN> (H. Dieter Wilhelm's message of
 "Tue, 28 Oct 2014 23:20:41 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV5110=0
X-NAI-Spam-Version: 2.3.0.9393 : core <5110> : inlines <1462> : streams
 <1330543> : uri <1830472>
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 18847
Cc: 18847 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.9 (-)

[ Be careful to keep 18847 <at> debbugs.gnu.org in the Cc, please.  ]

> 1) The sole real bug - in my opinion - is that M-h doesn't retain the
>    "marking direction" from a negative argument when repeating.

OK, I agree with this, it's a plain bug.

> 2) When applying M-h (or any other marking command) at the end of a
>    buffer (at least interactively, I failed to address this), the right
>    thing to do is marking (a) previous element(s).  I would like to know
>    if you find this a good idea.

I have no opinion on this, I never use M-h myself.

> 3) M-h (C-M-h and C-x C-p ) differ from C-@ and C-M-@ that they are
>    always marking (a) whole element(s).  I wanted to clarify in the
>    documentation string that a marking from point is also achievable
>    with M-h.

So this part is just a docstring change, right?

> 4) M-h does signal an error applying zero as an argument, the other
>    marking commands just ignore zero, so I thought a message might be a
>    good compromise to the current state...

I have no opinion on this one either.  It doesn't seem terribly
important, so reducing discrepancies in this case might be the
dominating factor.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18847; Package emacs. Full text available.

Message received at 18847 <at> debbugs.gnu.org:


Received: (at 18847) by debbugs.gnu.org; 28 Oct 2014 17:05:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 28 13:05:11 2014
Received: from localhost ([127.0.0.1]:37959 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XjACk-0001Rj-Qb
	for submit <at> debbugs.gnu.org; Tue, 28 Oct 2014 13:05:11 -0400
Received: from mercure.iro.umontreal.ca ([132.204.24.67]:56429)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1XjACi-0001Ra-5V
 for 18847 <at> debbugs.gnu.org; Tue, 28 Oct 2014 13:05:08 -0400
Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca
 [132.204.27.50])
 by mercure.iro.umontreal.ca (Postfix) with ESMTP id 9111884F43;
 Tue, 28 Oct 2014 13:05:07 -0400 (EDT)
Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca
 [132.204.27.242])
 by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 470631E5874;
 Tue, 28 Oct 2014 13:04:44 -0400 (EDT)
Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848)
 id 16B07B4245; Tue, 28 Oct 2014 13:04:44 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: dieter@HIDDEN (H. Dieter Wilhelm)
Subject: Re: bug#18847: 24.4;
 Inconsistent behaviour of M-h with negative arguments
Message-ID: <jwvfve8uo1r.fsf-monnier+emacsbugs@HIDDEN>
References: <877fzmqunb.fsf@HIDDEN>
Date: Tue, 28 Oct 2014 13:04:44 -0400
In-Reply-To: <877fzmqunb.fsf@HIDDEN> (H. Dieter Wilhelm's message of
 "Mon, 27 Oct 2014 00:27:20 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-DIRO-MailScanner-Information: Please contact the ISP for more information
X-DIRO-MailScanner: Found to be clean
X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel,
 SpamAssassin (score=-2.82, requis 5, autolearn=not spam,
 ALL_TRUSTED -2.82, MC_TSTLAST 0.00)
X-DIRO-MailScanner-From: monnier@HIDDEN
X-Spam-Status: No
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 18847
Cc: 18847 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.9 (--)

> please try M-- M-h M-h M-h.
> below some paragraphs.  The behaviour is not in line with the other
> marking commands like M-@, ...

Could you give more details about which differences you're thinking of?
I have my ideas, but they don't seem to match yours, at least based on
my reading of your patch.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18847; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Oct 2014 09:20:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 27 05:20:41 2014
Received: from localhost ([127.0.0.1]:36363 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XigTc-0007Mh-M9
	for submit <at> debbugs.gnu.org; Mon, 27 Oct 2014 05:20:41 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55095)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1XigTZ-0007MP-0o
 for submit <at> debbugs.gnu.org; Mon, 27 Oct 2014 05:20:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1XigTM-0005FN-Ub
 for submit <at> debbugs.gnu.org; Mon, 27 Oct 2014 05:20:27 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38703)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1XigTM-0005FG-S3
 for submit <at> debbugs.gnu.org; Mon, 27 Oct 2014 05:20:20 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56714)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1XigTG-0008MB-TG
 for bug-gnu-emacs@HIDDEN; Mon, 27 Oct 2014 05:20:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1XigTA-0005C4-Tz
 for bug-gnu-emacs@HIDDEN; Mon, 27 Oct 2014 05:20:14 -0400
Received: from plane.gmane.org ([80.91.229.3]:57847)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1XigTA-0005Au-Jt
 for bug-gnu-emacs@HIDDEN; Mon, 27 Oct 2014 05:20:08 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1XifX1-0003yY-BR
 for bug-gnu-emacs@HIDDEN; Mon, 27 Oct 2014 09:20:03 +0100
Received: from p57acd226.dip0.t-ipconnect.de ([87.172.210.38])
 by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
 id 1AlnuQ-0007hv-00
 for <bug-gnu-emacs@HIDDEN>; Mon, 27 Oct 2014 09:20:03 +0100
Received: from dieter by p57acd226.dip0.t-ipconnect.de with local (Gmexim 0.1
 (Debian)) id 1AlnuQ-0007hv-00
 for <bug-gnu-emacs@HIDDEN>; Mon, 27 Oct 2014 09:20:03 +0100
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: dieter@HIDDEN (H. Dieter Wilhelm)
Subject: Re: bug#18847: 24.4;
 Inconsistent behaviour of M-h with negative arguments
Date: Mon, 27 Oct 2014 08:37:44 +0100
Organization: The Church of Emacs
Lines: 291
Message-ID: <8738aaq7xz.fsf@HIDDEN>
References: <877fzmqunb.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: usenet@HIDDEN
X-Gmane-NNTP-Posting-Host: p57acd226.dip0.t-ipconnect.de
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock: sha1:Iw53S0/620lZew01ZDTPBctBmyw=
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.1 (----)

dieter@HIDDEN (H. Dieter Wilhelm) writes:

> Hello,
>
> please try M-- M-h M-h M-h.
>
> below some paragraphs.  The behaviour is not in line with the other
> marking commands like M-@, ...
>
> Here's a suggestion and a matching patch:

I'm sorry, I overlooked a special case:

(defun mark-paragraph (&optional arg allow-extend)
  "Put mark at beginning of this paragraph,  point at end.
The paragraph marked is the one that contains point or follows
point.

With argument ARG, puts mark at the end of this or a following
paragraph, so that the number of paragraphs marked equals ARG.
 
If ARG is negative, point is put at the beginning of this
paragraph, mark is put at the end of this or a previous
paragraph.

Interactively, if this command is repeated or (in Transient Mark
Mode) if the mark is active, it marks the next ARG paragraphs
after the region already marked.  This also means when activating
the mark immediately before using this command, the current
paragraph is only marked from point."
  (interactive "P\np")
  (let ((numeric-arg (prefix-numeric-value arg)))
    (cond ((eobp)			; smart-aleck?
	   (backward-paragraph (abs numeric-arg))
	   (push-mark nil t t)
	   (forward-paragraph (abs numeric-arg)))
	  ((and allow-extend
		(or (region-active-p)
		    (and (eq last-command this-command) mark-active)))
	   (if arg
	       (setq arg numeric-arg)
	     (if (< (mark) (point))
		 (setq arg -1)
	       (setq arg 1)))
	   (set-mark
	    (save-excursion
	      (goto-char (mark))
	      (forward-paragraph arg)
	      (point))))
	  ((zerop numeric-arg)
	   (message "Will not mark zero paragraphs."))
	  (t
	   (forward-paragraph numeric-arg)
	   (push-mark nil t t)
	   (backward-paragraph numeric-arg)))))


diff -c /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el /usr/local/src/emacs/lisp/textmodes/paragraphs.el
*** /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el	2014-03-21 06:34:40.000000000 +0100
--- /usr/local/src/emacs/lisp/textmodes/paragraphs.el	2014-10-27 08:31:27.457755345 +0100
***************
*** 370,403 ****
    (forward-paragraph (- arg)))
  
  (defun mark-paragraph (&optional arg allow-extend)
!   "Put point at beginning of this paragraph, mark at end.
! The paragraph marked is the one that contains point or follows point.
  
! With argument ARG, puts mark at end of a following paragraph, so that
! the number of paragraphs marked equals ARG.
  
! If ARG is negative, point is put at end of this paragraph, mark is put
! at beginning of this or a previous paragraph.
  
! Interactively (or if ALLOW-EXTEND is non-nil), if this command is
! repeated or (in Transient Mark mode) if the mark is active,
! it marks the next ARG paragraphs after the ones already marked."
!   (interactive "p\np")
!   (unless arg (setq arg 1))
!   (when (zerop arg)
!     (error "Cannot mark zero paragraphs"))
!   (cond ((and allow-extend
! 	      (or (and (eq last-command this-command) (mark t))
! 		  (and transient-mark-mode mark-active)))
! 	 (set-mark
! 	  (save-excursion
! 	    (goto-char (mark))
! 	    (forward-paragraph arg)
! 	    (point))))
! 	(t
! 	 (forward-paragraph arg)
! 	 (push-mark nil t t)
! 	 (backward-paragraph arg))))
  
  (defun kill-paragraph (arg)
    "Kill forward to end of paragraph.
--- 370,416 ----
    (forward-paragraph (- arg)))
  
  (defun mark-paragraph (&optional arg allow-extend)
!   "Put mark at beginning of this paragraph,  point at end.
! The paragraph marked is the one that contains point or follows
! point.
  
! With argument ARG, puts mark at the end of this or a following
! paragraph, so that the number of paragraphs marked equals ARG.
  
! If ARG is negative, point is put at the beginning of this
! paragraph, mark is put at the end of this or a previous
! paragraph.
  
! Interactively, if this command is repeated or (in Transient Mark
! Mode) if the mark is active, it marks the next ARG paragraphs
! after the region already marked.  This also means when activating
! the mark immediately before using this command, the current
! paragraph is only marked from point."
!   (interactive "P\np")
!   (let ((numeric-arg (prefix-numeric-value arg)))
!     (cond ((eobp)			; smart-aleck?
! 	   (backward-paragraph (abs numeric-arg))
! 	   (push-mark nil t t)
! 	   (forward-paragraph (abs numeric-arg)))
! 	  ((and allow-extend
! 		(or (region-active-p)
! 		    (and (eq last-command this-command) mark-active)))
! 	   (if arg
! 	       (setq arg numeric-arg)
! 	     (if (< (mark) (point))
! 		 (setq arg -1)
! 	       (setq arg 1)))
! 	   (set-mark
! 	    (save-excursion
! 	      (goto-char (mark))
! 	      (forward-paragraph arg)
! 	      (point))))
! 	  ((zerop numeric-arg)
! 	   (message "Will not mark zero paragraphs."))
! 	  (t
! 	   (forward-paragraph numeric-arg)
! 	   (push-mark nil t t)
! 	   (backward-paragraph numeric-arg)))))
  
  (defun kill-paragraph (arg)
    "Kill forward to end of paragraph.

Diff finished.  Mon Oct 27 08:31:56 2014



> (defun mark-paragraph (&optional arg allow-extend)
>   "Put mark at beginning of this paragraph,  point at end.
> The paragraph marked is the one that contains point or follows
> point. 
>
> With argument ARG, puts mark at the end of a following paragraph,
> so that the number of paragraphs marked equals ARG.
>
> If ARG is negative, point is put at the beginning of this
> paragraph, mark is put at the end of this or a previous
> paragraph.
>
> Interactively, if this command is repeated or (in Transient Mark
> Mode) if the mark is active, it marks the next ARG paragraphs
> after the ones already marked.  This means when activating the
> mark before using this command, the current paragraph is only
> marked from point."
>   (interactive "P\np")
>   (let ((numeric-arg (prefix-numeric-value arg)))
>     (cond ((eobp)			; smart-aleck?
> 	   (backward-paragraph (abs numeric-arg))
> 	   (push-mark nil t t)
> 	   (forward-paragraph (abs numeric-arg)))
> 	  ((and allow-extend ;we already called this function or have
> 			     ;a (possibly empty) region
> 		(or (eq last-command this-command)
> 		    (region-active-p)))
> 	   (if arg
> 	       (setq arg numeric-arg)
> 	     (if (< (mark) (point))
> 		 (setq arg -1)
> 	       (setq arg 1)))
> 	   (set-mark
> 	    (save-excursion
> 	      (goto-char (mark))
> 	      (forward-paragraph arg)
> 	      (point))))
> 	  ((zerop numeric-arg)		
> 	   (message "Will not mark zero paragraphs."))
> 	  (t
> 	   (forward-paragraph numeric-arg)
> 	   (push-mark nil t t)
> 	   (backward-paragraph numeric-arg)))))
>
>
> Thank you for your troubles!
>
> diff -c /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el /usr/local/src/emacs/lisp/textmodes/paragraphs.el
> *** /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el	2014-03-21 06:34:40.000000000 +0100
> --- /usr/local/src/emacs/lisp/textmodes/paragraphs.el	2014-10-27 00:22:41.874845901 +0100
> ***************
> *** 370,403 ****
>     (forward-paragraph (- arg)))
>   
>   (defun mark-paragraph (&optional arg allow-extend)
> !   "Put point at beginning of this paragraph, mark at end.
> ! The paragraph marked is the one that contains point or follows point.
>   
> ! With argument ARG, puts mark at end of a following paragraph, so that
> ! the number of paragraphs marked equals ARG.
>   
> ! If ARG is negative, point is put at end of this paragraph, mark is put
> ! at beginning of this or a previous paragraph.
>   
> ! Interactively (or if ALLOW-EXTEND is non-nil), if this command is
> ! repeated or (in Transient Mark mode) if the mark is active,
> ! it marks the next ARG paragraphs after the ones already marked."
> !   (interactive "p\np")
> !   (unless arg (setq arg 1))
> !   (when (zerop arg)
> !     (error "Cannot mark zero paragraphs"))
> !   (cond ((and allow-extend
> ! 	      (or (and (eq last-command this-command) (mark t))
> ! 		  (and transient-mark-mode mark-active)))
> ! 	 (set-mark
> ! 	  (save-excursion
> ! 	    (goto-char (mark))
> ! 	    (forward-paragraph arg)
> ! 	    (point))))
> ! 	(t
> ! 	 (forward-paragraph arg)
> ! 	 (push-mark nil t t)
> ! 	 (backward-paragraph arg))))
>   
>   (defun kill-paragraph (arg)
>     "Kill forward to end of paragraph.
> --- 370,417 ----
>     (forward-paragraph (- arg)))
>   
>   (defun mark-paragraph (&optional arg allow-extend)
> !   "Put mark at beginning of this paragraph,  point at end.
> ! The paragraph marked is the one that contains point or follows
> ! point.
>   
> ! With argument ARG, puts mark at the end of a following paragraph,
> ! so that the number of paragraphs marked equals ARG.
>   
> ! If ARG is negative, point is put at the beginning of this
> ! paragraph, mark is put at the end of this or a previous
> ! paragraph.
>   
> ! Interactively, if this command is repeated or (in Transient Mark
> ! Mode) if the mark is active, it marks the next ARG paragraphs
> ! after the ones already marked.  This means when activating the
> ! mark before using this command, the current paragraph is only
> ! marked from point."
> !   (interactive "P\np")
> !   (let ((numeric-arg (prefix-numeric-value arg)))
> !     (cond ((eobp)			; smart-aleck?
> ! 	   (backward-paragraph (abs numeric-arg))
> ! 	   (push-mark nil t t)
> ! 	   (forward-paragraph (abs numeric-arg)))
> ! 	  ((and allow-extend ;we already called this function or have
> ! 			     ;a (possibly empty) region
> ! 		(or (eq last-command this-command)
> ! 		    (region-active-p)))
> ! 	   (if arg
> ! 	       (setq arg numeric-arg)
> ! 	     (if (< (mark) (point))
> ! 		 (setq arg -1)
> ! 	       (setq arg 1)))
> ! 	   (set-mark
> ! 	    (save-excursion
> ! 	      (goto-char (mark))
> ! 	      (forward-paragraph arg)
> ! 	      (point))))
> ! 	  ((zerop numeric-arg)
> ! 	   (message "Will not mark zero paragraphs."))
> ! 	  (t
> ! 	   (forward-paragraph numeric-arg)
> ! 	   (push-mark nil t t)
> ! 	   (backward-paragraph numeric-arg)))))
>   
>   (defun kill-paragraph (arg)
>     "Kill forward to end of paragraph.
>
> Diff finished.  Mon Oct 27 00:22:49 2014

-- 
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18847; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Oct 2014 23:28:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 26 19:28:02 2014
Received: from localhost ([127.0.0.1]:36262 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XiXE9-0000Kv-4k
	for submit <at> debbugs.gnu.org; Sun, 26 Oct 2014 19:28:01 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39945)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <dieter.wilhelm@HIDDEN>) id 1XiXE6-0000Kg-CW
 for submit <at> debbugs.gnu.org; Sun, 26 Oct 2014 19:27:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <dieter.wilhelm@HIDDEN>) id 1XiXDr-0005G8-SE
 for submit <at> debbugs.gnu.org; Sun, 26 Oct 2014 19:27:52 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:53786)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <dieter.wilhelm@HIDDEN>) id 1XiXDr-0005G4-PF
 for submit <at> debbugs.gnu.org; Sun, 26 Oct 2014 19:27:43 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41651)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <dieter.wilhelm@HIDDEN>) id 1XiXDi-0002sQ-Mh
 for bug-gnu-emacs@HIDDEN; Sun, 26 Oct 2014 19:27:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <dieter.wilhelm@HIDDEN>) id 1XiXDZ-0005DA-LI
 for bug-gnu-emacs@HIDDEN; Sun, 26 Oct 2014 19:27:34 -0400
Received: from mail-la0-x22c.google.com ([2a00:1450:4010:c03::22c]:53549)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <dieter.wilhelm@HIDDEN>) id 1XiXDZ-0005Cy-8U
 for bug-gnu-emacs@HIDDEN; Sun, 26 Oct 2014 19:27:25 -0400
Received: by mail-la0-f44.google.com with SMTP id hs14so4977222lab.17
 for <bug-gnu-emacs@HIDDEN>; Sun, 26 Oct 2014 16:27:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:from:to:subject:date:message-id:mime-version:content-type;
 bh=NuWTRd4eud/rih3X/CUM+LXxchvRISHKpZ4yFlx678w=;
 b=iCbXNhpBBihzsbsIgN9dCFJebebwRnORItLewI5//s4TbGgWU5970au7T0HyMnFJHB
 y1+K1bodj321K//N/QETb/y9jrGmqr5vPKhQpb7Ckuv1vf/O6+Spr7O8EVSpS5EFbLqV
 DQNUXpKinla0fKXeCPsH3nc/Y7GjZpVtTxgYn7MKhZwvVyHNyUGrWxQ4ynGIs+7Xw+7S
 YHERB+RSVhgr3r1Vj3uoaCzWNjboQKU8CuQLzfI/LGuQrfOQ5vHva3aYNlOLSVpUhTpk
 wPfSsN/1GHMNmDcs71S1fZXUKkAJt8VQmd4ivFL9PEhcfFH9cdUoTDZrZgDIa9wLueae
 fEDg==
X-Received: by 10.112.93.231 with SMTP id cx7mr4999849lbb.89.1414366043574;
 Sun, 26 Oct 2014 16:27:23 -0700 (PDT)
Received: from vsl28t2g.ww011 (p57ACF456.dip0.t-ipconnect.de. [87.172.244.86])
 by mx.google.com with ESMTPSA id
 qg4sm4343988lbb.36.2014.10.26.16.27.22 for <bug-gnu-emacs@HIDDEN>
 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
 Sun, 26 Oct 2014 16:27:22 -0700 (PDT)
From: dieter@HIDDEN (H. Dieter Wilhelm)
To: bug-gnu-emacs@HIDDEN
Subject: 24.4; Inconsistent behaviour of M-h with negative arguments
Date: Mon, 27 Oct 2014 00:27:20 +0100
Message-ID: <877fzmqunb.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)


Hello,

please try M-- M-h M-h M-h.

below some paragraphs.  The behaviour is not in line with the other
marking commands like M-@, ...

Here's a suggestion and a matching patch:

(defun mark-paragraph (&optional arg allow-extend)
  "Put mark at beginning of this paragraph,  point at end.
The paragraph marked is the one that contains point or follows
point. 

With argument ARG, puts mark at the end of a following paragraph,
so that the number of paragraphs marked equals ARG.

If ARG is negative, point is put at the beginning of this
paragraph, mark is put at the end of this or a previous
paragraph.

Interactively, if this command is repeated or (in Transient Mark
Mode) if the mark is active, it marks the next ARG paragraphs
after the ones already marked.  This means when activating the
mark before using this command, the current paragraph is only
marked from point."
  (interactive "P\np")
  (let ((numeric-arg (prefix-numeric-value arg)))
    (cond ((eobp)			; smart-aleck?
	   (backward-paragraph (abs numeric-arg))
	   (push-mark nil t t)
	   (forward-paragraph (abs numeric-arg)))
	  ((and allow-extend ;we already called this function or have
			     ;a (possibly empty) region
		(or (eq last-command this-command)
		    (region-active-p)))
	   (if arg
	       (setq arg numeric-arg)
	     (if (< (mark) (point))
		 (setq arg -1)
	       (setq arg 1)))
	   (set-mark
	    (save-excursion
	      (goto-char (mark))
	      (forward-paragraph arg)
	      (point))))
	  ((zerop numeric-arg)		
	   (message "Will not mark zero paragraphs."))
	  (t
	   (forward-paragraph numeric-arg)
	   (push-mark nil t t)
	   (backward-paragraph numeric-arg)))))


Thank you for your troubles!

diff -c /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el /usr/local/src/emacs/lisp/textmodes/paragraphs.el
*** /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el	2014-03-21 06:34:40.000000000 +0100
--- /usr/local/src/emacs/lisp/textmodes/paragraphs.el	2014-10-27 00:22:41.874845901 +0100
***************
*** 370,403 ****
    (forward-paragraph (- arg)))
  
  (defun mark-paragraph (&optional arg allow-extend)
!   "Put point at beginning of this paragraph, mark at end.
! The paragraph marked is the one that contains point or follows point.
  
! With argument ARG, puts mark at end of a following paragraph, so that
! the number of paragraphs marked equals ARG.
  
! If ARG is negative, point is put at end of this paragraph, mark is put
! at beginning of this or a previous paragraph.
  
! Interactively (or if ALLOW-EXTEND is non-nil), if this command is
! repeated or (in Transient Mark mode) if the mark is active,
! it marks the next ARG paragraphs after the ones already marked."
!   (interactive "p\np")
!   (unless arg (setq arg 1))
!   (when (zerop arg)
!     (error "Cannot mark zero paragraphs"))
!   (cond ((and allow-extend
! 	      (or (and (eq last-command this-command) (mark t))
! 		  (and transient-mark-mode mark-active)))
! 	 (set-mark
! 	  (save-excursion
! 	    (goto-char (mark))
! 	    (forward-paragraph arg)
! 	    (point))))
! 	(t
! 	 (forward-paragraph arg)
! 	 (push-mark nil t t)
! 	 (backward-paragraph arg))))
  
  (defun kill-paragraph (arg)
    "Kill forward to end of paragraph.
--- 370,417 ----
    (forward-paragraph (- arg)))
  
  (defun mark-paragraph (&optional arg allow-extend)
!   "Put mark at beginning of this paragraph,  point at end.
! The paragraph marked is the one that contains point or follows
! point.
  
! With argument ARG, puts mark at the end of a following paragraph,
! so that the number of paragraphs marked equals ARG.
  
! If ARG is negative, point is put at the beginning of this
! paragraph, mark is put at the end of this or a previous
! paragraph.
  
! Interactively, if this command is repeated or (in Transient Mark
! Mode) if the mark is active, it marks the next ARG paragraphs
! after the ones already marked.  This means when activating the
! mark before using this command, the current paragraph is only
! marked from point."
!   (interactive "P\np")
!   (let ((numeric-arg (prefix-numeric-value arg)))
!     (cond ((eobp)			; smart-aleck?
! 	   (backward-paragraph (abs numeric-arg))
! 	   (push-mark nil t t)
! 	   (forward-paragraph (abs numeric-arg)))
! 	  ((and allow-extend ;we already called this function or have
! 			     ;a (possibly empty) region
! 		(or (eq last-command this-command)
! 		    (region-active-p)))
! 	   (if arg
! 	       (setq arg numeric-arg)
! 	     (if (< (mark) (point))
! 		 (setq arg -1)
! 	       (setq arg 1)))
! 	   (set-mark
! 	    (save-excursion
! 	      (goto-char (mark))
! 	      (forward-paragraph arg)
! 	      (point))))
! 	  ((zerop numeric-arg)
! 	   (message "Will not mark zero paragraphs."))
! 	  (t
! 	   (forward-paragraph numeric-arg)
! 	   (push-mark nil t t)
! 	   (backward-paragraph numeric-arg)))))
  
  (defun kill-paragraph (arg)
    "Kill forward to end of paragraph.

Diff finished.  Mon Oct 27 00:22:49 2014


-- 
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany




Acknowledgement sent to dieter@HIDDEN (H. Dieter Wilhelm):
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#18847; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 11 Oct 2021 13:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.