unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "H. Dieter Wilhelm" <dieter@duenenhof-wilhelm.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 45318@debbugs.gnu.org, Richard Stallman <rms@gnu.org>
Subject: bug#45318: 28.0.50; mark-paragraph
Date: Tue, 05 Jan 2021 23:27:30 +0100	[thread overview]
Message-ID: <86czyjj9yl.fsf@duenenhof-wilhelm.de> (raw)
In-Reply-To: <871rf16our.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 04 Jan 2021 10:19:40 +0100")

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	other threads:[~2021-01-05 22:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-19  5:11 bug#45318: 28.0.50; mark-paragraph Richard Stallman
2020-12-19 16:53 ` Lars Ingebrigtsen
2021-01-03 22:29   ` H. Dieter Wilhelm
2021-01-04  9:19     ` Lars Ingebrigtsen
2021-01-05 22:27       ` H. Dieter Wilhelm [this message]
2021-01-07 12:11         ` Lars Ingebrigtsen
2021-04-04  1:01           ` Stefan Kangas
2021-10-11 12:15             ` Stefan Kangas
2021-10-16 17:33             ` H. Dieter Wilhelm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86czyjj9yl.fsf@duenenhof-wilhelm.de \
    --to=dieter@duenenhof-wilhelm.de \
    --cc=45318@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).