bug#45318: 28.0.50; mark-paragraph

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#45318: 28.0.50; mark-paragraph

Richard Stallman

Create a buffer in Fundamental mode, insert the text

this is
a test

with no newline at the end, put point at the end,  and type M-h.

It does not set the mark.


In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.32, cairo version 1.15.10)
 of 2020-12-08 built on freetop
Repository revision: 0155bd0fdb166c97a2ce76cc5bc64fd195a676d3
Repository branch: master
System Description: Trisquel GNU/Linux Etiona (9.0)

Configured using:
 'configure --with-gnutls=ifavailable 'CFLAGS=-O0 -g''

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 XDBE XIM MODULES THREADS PDUMPER

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: RMAIL

Minor modes in effect:
  shell-dirtrack-mode: t
  gpm-mouse-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow emacsbug smerge-mode diff log-edit pcvs-util add-log
org-element avl-tree generator ol-eww ol-rmail ol-mhe ol-irc ol-info
ol-gnus nnselect gnus-search eieio-opt speedbar ezimage dframe
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum gnus-group
gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail
mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win
ol-docview doc-view jka-compr image-mode exif ol-bibtex bibtex ol-bbdb
ol-w3m org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete org-list org-faces
org-entities noutline outline org-version ob-emacs-lisp ob-core
ob-eval org-table ol org-keys org-compat org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs cl-extra
parse-time iso8601 mhtml-mode css-mode smie eww xdg url-queue mm-url
gnus nnheader wid-edit color js imenu cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
sgml-mode help-mode mule-util shell pcomplete thingatpt files-x grep
compile comint ansi-color ring misearch multi-isearch epa-mail
rmailkwd rmailsum vc-mtn vc-hg vc-git diff-mode easy-mmode vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs vc vc-dispatcher shr kinsoku svg
xml dom rmailout dabbrev mailalias sendmail qp rmailmm message rmc
puny rfc822 mml mml-sec epa epg epg-config gnus-util
text-property-search time-date mm-decode mm-bodies mm-encode
mailabbrev gmm-utils mailheader mail-parse rfc2231 rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils dired-aux dired dired-loaddefs t-mouse term/linux view
derived paren cus-start cus-load advice finder-inf package easymenu
browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode
elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet
lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese composite charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 623831 68319)
 (symbols 48 27145 3)
 (strings 32 96682 5494)
 (string-bytes 1 3156284)
 (vectors 16 54707)
 (vector-slots 8 1438240 81088)
 (floats 8 363 545)
 (intervals 56 83923 2585)
 (buffers 984 96))
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]


--
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





Reply | Threaded
Open this post in threaded view
|

bug#45318: 28.0.50; mark-paragraph

Lars Ingebrigtsen
Richard Stallman <[hidden email]> writes:

> Create a buffer in Fundamental mode, insert the text
>
> this is
> a test
>
> with no newline at the end, put point at the end,  and type M-h.
>
> It does not set the mark.

It's this bit:

          ;; don't activate the mark when at eob
          ((and (eobp) (> numeric-arg 0)))

Looks like this was introduced in this commit:

commit eb090f65ceb0ae8a90829e911694348583135ba5
H. Dieter Wilhelm <[hidden email]>

Now added to the Cc's.

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



Reply | Threaded
Open this post in threaded view
|

bug#45318: 28.0.50; mark-paragraph

H. Dieter Wilhelm
Lars Ingebrigtsen <[hidden email]> 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 <[hidden email]>
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 | Threaded
Open this post in threaded view
|

bug#45318: 28.0.50; mark-paragraph

Stefan Kangas
Lars Ingebrigtsen <[hidden email]> writes:

> "H. Dieter Wilhelm" <[hidden email]> writes:
>
>> 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..
>
> The patch format looks good.  :-)
>
> However, this still doesn't quite restore how mark-paragraph works in
> Emacs 27 -- it leaves point in other places than it was.
>
> So I've reverted the previous change for now, and I've added a test.
> Could you have a look at the test
>
> cd check; make paragraphs-tests
>
> (it's the last one), and redo your original patch in a way that doesn't
> break the behaviour as demonstrated by this test?

That was 12 weeks ago.  Any news here?