GNU bug report logs - #45318
28.0.50; mark-paragraph

Previous Next

Package: emacs;

Reported by: rms <at> gnu.org

Date: Sat, 19 Dec 2020 05:13:02 UTC

Severity: wishlist

Merged with 18847

Found in versions 24.4, 28.0.50

Full log


Message #17 received at 45318 <at> debbugs.gnu.org (full text, mbox):

From: "H. Dieter Wilhelm" <dieter <at> duenenhof-wilhelm.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 45318 <at> debbugs.gnu.org, Richard Stallman <rms <at> gnu.org>
Subject: Re: bug#45318: 28.0.50; mark-paragraph
Date: Tue, 05 Jan 2021 23:27:30 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I'm not quite sure I follow you, but either with the proposed patch, or
> what I take to be your suggestion here, `mark-paragraph' works quite
> differently here than in Emacs 27, and we should get the previous
> behaviour back.

Right, below is my suggestion, please have a look.

Many thanks

      Dieter

PS: Please tell me if I can prepare patches in a better way or
    format..



From 35743faf181b04101ecdc61c6f6a3de3f9c6b10f Mon Sep 17 00:00:00 2001
From: Dieter Wilhelm <dieter <at> duenenhof-wilhelm.de>
Date: Tue, 5 Jan 2021 22:44:21 +0100
Subject: [PATCH] textmodes/paragraphs.el fix mark-paragraph (Bug#45318)

Thus aligning the behavior of mark-paragraph with mark-defun.
---
 lisp/textmodes/paragraphs.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 217ae10fe4..699c2191b8 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -386,7 +386,8 @@ mark-paragraph
 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)))
+  (let ((numeric-arg (prefix-numeric-value arg))
+        (pt))
     (cond ((zerop numeric-arg))
 	  ((and allow-extend
 		(or (and (eq last-command this-command) mark-active)
@@ -401,8 +402,13 @@ mark-paragraph
 	      (goto-char (mark))
 	      (forward-paragraph arg)
 	      (point))))
-	  ;; don't activate the mark when at eob
-	  ((and (eobp) (> numeric-arg 0)))
+	  ;; check if point is behind the very last paragraph and mark
+	  ;; it when no arg is given.
+	  ((if (> (save-excursion (forward-paragraph)) 0)
+               (progn (setq pt (point))
+                      (forward-paragraph (- 1))
+                      (set-mark (point))
+                      (goto-char pt))))
 	  (t
 	   (unless (save-excursion
 		     (forward-line 0)
-- 
2.17.1


-- 
Best wishes
H. Dieter Wilhelm
Zwingenberg, Germany




This bug report was last modified 3 years and 241 days ago.

Previous Next


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