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

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

bug#45318: 28.0.50; mark-paragraph


From: H. Dieter Wilhelm
Subject: bug#45318: 28.0.50; mark-paragraph
Date: Tue, 05 Jan 2021 23:27:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Lars Ingebrigtsen <larsi@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@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





reply via email to

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