unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52175: 27.2; stale marker left by `fill-region-as-paragraph'
@ 2021-11-29 10:49 Ikumi Keita
  2021-11-29 14:40 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Ikumi Keita @ 2021-11-29 10:49 UTC (permalink / raw)
  To: 52175

[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]


The function `fill-region-as-paragraph' leaves a temporal marker which
isn't cleared in the buffer.

Here is the structure of `fill-region-as-paragraph':
----------------------------------------------------------------------
(defun fill-region-as-paragraph (from to &optional justify
				      nosqueeze squeeze-after)
[...]
    (setq to (copy-marker (point) t))
[...]
  (if (not (> to (point)))
      nil ;; There is no paragraph, only whitespace: exit now.
[...]
      (goto-char to)
      (unless (eobp) (forward-char 1))
      ;; Return the fill-prefix we used
      fill-prefix)))
----------------------------------------------------------------------
With this code, temporal marker bound to local variable `to' is left in
the buffer. According to elisp reference `(elisp) Overview of Markers',
it is recommended to clear such stale marker with suitable `(set-marker
MARKER nil)':
,----
|    Insertion and deletion in a buffer must check all the markers and
| relocate them if necessary.  This slows processing in a buffer with a
| large number of markers.  For this reason, it is a good idea to make a
| marker point nowhere if you are sure you don’t need it any more.
`----
I'd propose to apply the attached patch to accomplish that.

Regards,
Ikumi Keita


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: clear temporal marker --]
[-- Type: text/x-diff, Size: 725 bytes --]

diff -r b5040f7ef2cb -r a9285b04999c lisp/textmodes/fill.el
--- a/lisp/textmodes/fill.el	Sat Mar 27 02:27:15 2021 +0900
+++ b/lisp/textmodes/fill.el	Fri Nov 19 14:00:38 2021 +0900
@@ -708,7 +709,10 @@
     (goto-char from-plus-indent))
 
   (if (not (> to (point)))
-      nil ;; There is no paragraph, only whitespace: exit now.
+      ;; There is no paragraph, only whitespace: exit now.
+      (progn
+        (set-marker to nil)
+        nil)
 
     (or justify (setq justify (current-justification)))
 
@@ -784,6 +788,7 @@
       ;; Leave point after final newline.
       (goto-char to)
       (unless (eobp) (forward-char 1))
+      (set-marker to nil)
       ;; Return the fill-prefix we used
       fill-prefix)))
 

[-- Attachment #3: Type: text/plain, Size: 5344 bytes --]




In GNU Emacs 27.2 (build 1, x86_64-unknown-freebsd13.0, GTK+ Version 3.24.27, cairo version 1.16.0)
 of 2021-04-15 built on freebsd.vmware
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: 13.0-RELEASE-p5

Recent messages:
No current message
Scanning +outbox...done
No more undeleted messages
Processing deletes and refiles for +outbox...done
Making completion list...
C-x v ~ runs the command vc-revision-other-window
Type C-x 1 to delete the help window, C-M-v to scroll help.
Mark saved where search started
Mark set
Making completion list...

Configured using:
 'configure --with-canna --with-canna-includes=/usr/local/canna/include
--with-canna-libraries=/usr/local/canna/lib --without-xim
--disable-largefile --without-modules --with-sound=yes
--with-file-notification=yes --with-cairo=yes CFLAGS=-O3'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY KQUEUE
ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
XDBE XIM THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $EMACSLOADPATH: /home/keita/elisp:
  value of $LANG: ja_JP.eucJP
  locale-coding-system: japanese-iso-8bit-unix

Major mode: Info

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-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
  blink-cursor-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

Load-path shadows:
~/elisp/reftex-parse hides /usr/local/share/emacs/27.2/lisp/textmodes/reftex-parse
/home/keita/.emacs.d/elpa/soap-client-3.2.0/soap-client hides /usr/local/share/emacs/27.2/lisp/net/soap-client
/home/keita/.emacs.d/elpa/soap-client-3.2.0/soap-inspect hides /usr/local/share/emacs/27.2/lisp/net/soap-inspect

Features:
(shadow emacsbug mule-util jka-compr misearch multi-isearch log-view vc
vc-dispatcher vc-hg bug-reference magit-gitignore face-remap
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode
diff git-commit rx log-edit pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor shell pcomplete comint ring server ansi-color
magit-mode transient magit-git magit-section magit-utils dash mh-thread
boxquote rect supercite regi mh-identity mh-letter mh-comp sendmail
vc-git diff-mode easy-mmode conf-mode flow-fill cl-extra help-mode
shr-color color mh-search mh-alias multi-prompt crm smiley qp mm-archive
mail-extr mh-mime mh-gnus mh-show goto-addr thingatpt gnus-cite gnus-art
mm-uu mml2015 mm-view mml-smime smime dig gnus-sum url url-proxy
url-privacy url-expand url-methods url-history mailcap shr url-cookie
url-domsuf url-util svg xml dom gnus-group gnus-undo gnus-start
gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time iso8601
gnus-spec gnus-int message rmc puny dired dired-loaddefs format-spec
rfc822 mml mml-sec epa derived epg epg-config mm-decode mm-bodies
mm-encode mail-parse rfc2231 gmm-utils mailheader gnus-win gnus-range
gnus nnheader wid-edit mh-seq mh-inc hl-line mh-tool-bar mh-xface
mh-utils mh-folder which-func imenu gnus-util rmail rmail-loaddefs
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
text-property-search time-date mh-scan mh-e mh-compat mailabbrev
mh-buffers mh-loaddefs edmacro kmacro preview-latex auto-loads tex-site
canna-im info package easymenu browse-url 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 japan-util 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 loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind kqueue lcms2 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 244096 28812)
 (symbols 48 22813 1)
 (strings 32 77097 10106)
 (string-bytes 1 2539003)
 (vectors 16 43698)
 (vector-slots 8 1236535 74930)
 (floats 8 398 186)
 (intervals 56 4375 0)
 (buffers 1000 31))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52175: 27.2; stale marker left by `fill-region-as-paragraph'
  2021-11-29 10:49 bug#52175: 27.2; stale marker left by `fill-region-as-paragraph' Ikumi Keita
@ 2021-11-29 14:40 ` Lars Ingebrigtsen
  2021-11-29 15:52   ` Ikumi Keita
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-29 14:40 UTC (permalink / raw)
  To: Ikumi Keita; +Cc: 52175

Ikumi Keita <ikumi@ikumi.que.jp> writes:

> I'd propose to apply the attached patch to accomplish that.

Looks good to me, so I've applied it to Emacs 29.

This change was small enough to apply without assigning copyright to the
FSF, but for future patches you want to submit, it might make sense to
get the paperwork started now, so that subsequent patches can be applied
speedily. Would you be willing to sign such paperwork?

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52175: 27.2; stale marker left by `fill-region-as-paragraph'
  2021-11-29 14:40 ` Lars Ingebrigtsen
@ 2021-11-29 15:52   ` Ikumi Keita
  2021-11-29 16:22     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Ikumi Keita @ 2021-11-29 15:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52175

Hi Lars,

>>>>> Lars Ingebrigtsen <larsi@gnus.org> writes:
> Ikumi Keita <ikumi@ikumi.que.jp> writes:
>> I'd propose to apply the attached patch to accomplish that.

> Looks good to me, so I've applied it to Emacs 29.

Thanks.

> This change was small enough to apply without assigning copyright to the
> FSF, but for future patches you want to submit, it might make sense to
> get the paperwork started now, so that subsequent patches can be applied
> speedily. Would you be willing to sign such paperwork?

I've already signed copyright assignment with my former email address
ikumi@revery.net, but it might be for AUCTeX only (sorry, my memory
isn't clear enough with respect to its coverage.) If so, I'm willing to
sign for other projects including Emacs for FSF.

Regards,
Ikumi Keita





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52175: 27.2; stale marker left by `fill-region-as-paragraph'
  2021-11-29 15:52   ` Ikumi Keita
@ 2021-11-29 16:22     ` Lars Ingebrigtsen
  2021-11-29 16:57       ` Ikumi Keita
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-29 16:22 UTC (permalink / raw)
  To: Ikumi Keita; +Cc: 52175

Ikumi Keita <ikumi@ikumi.que.jp> writes:

> I've already signed copyright assignment with my former email address
> ikumi@revery.net, but it might be for AUCTeX only (sorry, my memory
> isn't clear enough with respect to its coverage.) If so, I'm willing to
> sign for other projects including Emacs for FSF.

Yup, I see the assignment for AUCTEX, but not for Emacs as a whole.

Here's the form to get started with the Emacs assignment process:

Please email the following information to assign@gnu.org, and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]
Emacs

[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]

[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]

[For the copyright registration, what country are you a citizen of?]

[What year were you born?]

[Please write your email address here.]

[Please write your postal address here.]

[Which files have you changed so far, and which new files have you written
so far?]





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52175: 27.2; stale marker left by `fill-region-as-paragraph'
  2021-11-29 16:22     ` Lars Ingebrigtsen
@ 2021-11-29 16:57       ` Ikumi Keita
  0 siblings, 0 replies; 5+ messages in thread
From: Ikumi Keita @ 2021-11-29 16:57 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52175

>>>>> Lars Ingebrigtsen <larsi@gnus.org> writes:
> Yup, I see the assignment for AUCTEX, but not for Emacs as a whole.

I see, thanks.

> Here's the form to get started with the Emacs assignment process:

> Please email the following information to assign@gnu.org, and we
> will send you the assignment form for your past and future changes.

Done. :-)

Regards,
Ikumi Keita





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-29 16:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-29 10:49 bug#52175: 27.2; stale marker left by `fill-region-as-paragraph' Ikumi Keita
2021-11-29 14:40 ` Lars Ingebrigtsen
2021-11-29 15:52   ` Ikumi Keita
2021-11-29 16:22     ` Lars Ingebrigtsen
2021-11-29 16:57       ` Ikumi Keita

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).