From unknown Fri Jun 20 19:58:09 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77607: 31.0.50; replace-region-contents moves point Resent-From: "Paul D. Nelson" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Apr 2025 12:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 77607 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 77607@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174402779330086 (code B ref -1); Mon, 07 Apr 2025 12:10:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Apr 2025 12:09:53 +0000 Received: from localhost ([127.0.0.1]:53198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1lIW-0007p6-E9 for submit@debbugs.gnu.org; Mon, 07 Apr 2025 08:09:52 -0400 Received: from lists.gnu.org ([2001:470:142::17]:53372) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u1lIR-0007ne-SR for submit@debbugs.gnu.org; Mon, 07 Apr 2025 08:09:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u1lHy-0003pF-VG for bug-gnu-emacs@gnu.org; Mon, 07 Apr 2025 08:09:21 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u1lHw-0006Vo-If for bug-gnu-emacs@gnu.org; Mon, 07 Apr 2025 08:09:18 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-ac3b12e8518so797526266b.0 for ; Mon, 07 Apr 2025 05:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744027754; x=1744632554; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=2Ho3aypT5ZSS09tb3rzMB7xsj37vzFhgi5yd7euW2y8=; b=DJf/frDSsEDwTvjKvD2fZNjt0/2DhCBi9d+RPMjaZk5hTzo2XtXFeO2AIraVLlkFy/ +w+S6X6WXBy2vobBDvmvQVQKZYOetCSLJH95nJtIVOtXfqIDEXFfgxqoC7E7I45Waw9/ 4bqu9+UEIZbHm+zxLw2EJ+Ox72fYbV8/EEaKd05P+UrxVUfAJUXKH+Ei21wmXhzwaR3n 3cJtnEvL58mOdcEWRd2aBjIwk/AX6lve6joBpDmRzrFm7e9sS4fJXzto9hHBkACA1Vlj VxprohcEf3oWAg/axIXbzkgvYk5zoHomu4ZeCTp+Pgj6P7gDj4DK0RMIx7j07NikL3ic gvhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744027754; x=1744632554; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2Ho3aypT5ZSS09tb3rzMB7xsj37vzFhgi5yd7euW2y8=; b=b417oXCdtQn+WwV6JGaPdee1OrevRvRjMpXa+aNOpQL32+gfQFN64A+pQnVZ5VAet3 0xGFUcYDh1jpk2+O574G6tAl1kC7BVmRFo5o1DE4cDtz6fO4tqQYsgYGalsN6a8OiEXv e7qAjI/Ihm5LAwgzNLGwcV01NsNPq04PX9M96PK0ynRnJILHd789YWBW91XgRNMNFNwo fGfCECECdBC7BWc+yuJKu4ydy3fC8lJM4lipZUe8OdVpGmuQ95oFB7ltZhQrFwLZhZnk MPzQ4GBlXIUYHxqb+vay/eYYPlleUh4B56gekHaQ8fOASXsGrw089GMayKj9s7QzUSbJ xcVA== X-Gm-Message-State: AOJu0Yy9OsF1m+7b5zEF4+kMakHj+VBQ4J/hh8aQYYYRlV2nXyOUpVGD Sls29IPdDu6tzBhM/pIWkQGuIXYfW+R5NhxG/1lOA+z4eOn/QbMcih/Xws4l X-Gm-Gg: ASbGncuh6e0huBqnx8X4BkEgOXkaIhTzTASeZu0amiU8ryEMJs0iyLohSKPQfM+QkDG AsctCVg7o5/pVYaNzDrrxGYqTzPaRb86A86hqzAy0vwBgJ4mA90JYQbKH7bj/+Je/YINND6jYNE MWmvBG1PWNhSwv7nBYAfItSVIpPeWt6RzpFml+z1g5OtIeePqvuMteY3TaYhZP6/Nlhe+vKJFmf NgjuKy5R2qkhls3tK3r5zY7fKKUQq4/a7KdwXkSNJ0N6i1hGTnRHh57GB5m1RuPJymZwNUDjRrV V0lV4tSZ4Dyqs6GNFXjaiZ0yev0MYtCoSsPseU9m9WZgrvHLb/441mg2D0m7GSht9mb5rHTywNM l X-Google-Smtp-Source: AGHT+IGYiqWL9II9b2FLv46KPT101QQmVVBTyPCD3CACsmRk+eabIZxeCZFbxVVzq6tSNX+fIcWrrg== X-Received: by 2002:a17:907:7b99:b0:ac2:723a:670f with SMTP id a640c23a62f3a-ac7d18e25f3mr1192187966b.24.1744027753888; Mon, 07 Apr 2025 05:09:13 -0700 (PDT) Received: from localhost (users-1190.st.net.au.dk. [130.225.0.251]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-ac7bfe5bd17sm749346766b.10.2025.04.07.05.09.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 05:09:13 -0700 (PDT) From: "Paul D. Nelson" Date: Mon, 07 Apr 2025 14:09:12 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=ultrono@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) The info docs for replace-region-contents say that it attempts to preserve point. With the latest update, it fails to preserve point in cases where it did before. I fixed my use case with save-excursion, and the docs are vague enough that this issue might not qualify as a bug, but I figured I'd report it just in case it was unintentional, or in case others come across it. For example: (with-temp-buffer (insert "abc") (replace-region-contents (- (point) 3) (- (point) 2) (lambda () "A")) (char-to-string (char-before))) now returns "A", but I believe that it previously returned "c". In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.1.0, NS appkit-2575.20 Version 15.1.1 (Build 24B91)) of 2025-04-06 built on d51735 Repository revision: 8ae7224b8fae59229b186853b300822bd70a8ec4 Repository branch: master Windowing system distributor 'Apple', version 10.3.2575 System Description: macOS 15.1.1 Configured using: 'configure --with-ns --with-native-compilation --with-tree-sitter --with-gif --with-png --with-jpeg --with-rsvg --with-tiff --with-imagemagick --with-x-toolkit=gtk3 --with-xwidgets' Configured features: ACL DBUS GLIB GNUTLS IMAGEMAGICK LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS ZLIB Important settings: value of $LC_CTYPE: UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: savehist-mode: t recentf-mode: t repeat-mode: t display-time-mode: t save-place-mode: t global-auto-revert-mode: t minibuffer-depth-indicate-mode: t electric-pair-mode: t override-global-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tab-bar-history-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug lisp-mnt message mailcap yank-media puny rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils thingatpt llm vc-git diff-mode track-changes files-x vc-dispatcher foldout noutline outline imenu dired-aux hl-line dired dired-loaddefs time-date pcase savehist recentf tree-widget repeat time saveplace autorevert filenotify mb-depth elec-pair comp comp-cstr warnings subr-x comp-run comp-common rx edmacro kmacro byte-opt cl-macs gv cl-extra help-mode use-package-bind-key bind-key easy-mmode use-package-ensure cl-seq use-package-core bytecomp byte-compile cus-edit pp cus-start cus-load icons wid-edit cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads xwidget-internal dbusbind kqueue cocoa ns lcms2 multi-tty make-network-process tty-child-frames native-compile emacs) Memory information: ((conses 16 201000 24284) (symbols 48 23072 1) (strings 32 56478 4127) (string-bytes 1 1440313) (vectors 16 25713) (vector-slots 8 1044292 203938) (floats 8 70 20) (intervals 56 1876 41) (buffers 992 17)) From unknown Fri Jun 20 19:58:09 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77607: 31.0.50; replace-region-contents moves point Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Apr 2025 13:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77607 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Paul D. Nelson" , Stefan Monnier Cc: 77607@debbugs.gnu.org Received: via spool by 77607-submit@debbugs.gnu.org id=B77607.17440336045272 (code B ref 77607); Mon, 07 Apr 2025 13:47:02 +0000 Received: (at 77607) by debbugs.gnu.org; 7 Apr 2025 13:46:44 +0000 Received: from localhost ([127.0.0.1]:53508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1moG-0001Mw-CY for submit@debbugs.gnu.org; Mon, 07 Apr 2025 09:46:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46008) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u1moD-0001MS-Oc for 77607@debbugs.gnu.org; Mon, 07 Apr 2025 09:46:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u1mo6-0000xD-VX; Mon, 07 Apr 2025 09:46:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=eBEJyPGq91eXLDisKMWkcT0aVidgd21Q8CsWmlVwu2A=; b=oKFRWvjjFtfq iJ/yEpVPNZDjnCk767owheKvS2UjNLFHfjDvv9T8pbDybGyjMpKBPw0QqbjxhfaHQwHIPpFleP2Rr ZmIsRpAZ4aKwbIjHrvrZH0ds0QYQI/uC9WJHcmuAVvCvVd1HVbJybkfzK2TGBiUOUL993jXM7248C PBf65EXzAZj801yyHTXX29yc9lHhcLxOIjiWtKn5T9VJCgTzKjAdI2TyOHlcWWL7NXtGCsbO3+yNP AguPqulmEGnNve0mQSmxy8jClwe3iVXUQ2QRapcPw+RqEoc9xJVOKj9Rhrm8KPzAKr/aHyDLfzDzN qrKYm+I4dh/Fk8NLZeKAZg==; Date: Mon, 07 Apr 2025 16:45:56 +0300 Message-Id: <86plhot78r.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (ultrono@gmail.com) References: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: "Paul D. Nelson" > Date: Mon, 07 Apr 2025 14:09:12 +0200 > > The info docs for replace-region-contents say that it attempts to > preserve point. With the latest update, it fails to preserve point in > cases where it did before. I fixed my use case with save-excursion, and > the docs are vague enough that this issue might not qualify as a bug, > but I figured I'd report it just in case it was unintentional, or in > case others come across it. > > For example: > > (with-temp-buffer > (insert "abc") > (replace-region-contents (- (point) 3) (- (point) 2) (lambda () "A")) > (char-to-string (char-before))) > > now returns "A", but I believe that it previously returned "c". Stefan, any comments? From unknown Fri Jun 20 19:58:09 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77607: 31.0.50; replace-region-contents moves point Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Apr 2025 15:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77607 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 77607@debbugs.gnu.org, "Paul D. Nelson" Received: via spool by 77607-submit@debbugs.gnu.org id=B77607.174403871423974 (code B ref 77607); Mon, 07 Apr 2025 15:12:01 +0000 Received: (at 77607) by debbugs.gnu.org; 7 Apr 2025 15:11:54 +0000 Received: from localhost ([127.0.0.1]:56294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1o8f-0006Ea-OQ for submit@debbugs.gnu.org; Mon, 07 Apr 2025 11:11:54 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:47893) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u1o8d-0006E6-LP for 77607@debbugs.gnu.org; Mon, 07 Apr 2025 11:11:52 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5375780932; Mon, 7 Apr 2025 11:11:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1744038705; bh=89dr/pwVf2VuENQ5lHsL2U8HU86VZio6Aa6L0ObRHPA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=kc0r0kV41LmuVKFINAt+v4wStnVhPKMJ80600ROiYKfjwKDI6O86odXugFSqic3hE 8TBFtUDnMEW/IQPfqe9/Vws1b92HK1f7cPXz5PjbOkYIKezGA+mmGJzaiT96WN5j8o egcM4nDzgJpwtKGq8jsg8+NGMVYCCVUViV6yargK7U3ynRTINIKdRoMk+DVdkCbsIz 57ZnbPZOiQMOq4Y6pjmlAAVbb5FTRt9uzjVf0lKF4ofWEhknSIqJzxaBp794Qbgxze wupIdEQ/nR1r4SA+YQWTt2v//+Ess5PnXFXiMH8wLVG308GMY5fN/DHxb/uR2KtilC anMMxOMyied2A== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8D7518085E; Mon, 7 Apr 2025 11:11:45 -0400 (EDT) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6C1BD12062E; Mon, 7 Apr 2025 11:11:45 -0400 (EDT) From: Stefan Monnier In-Reply-To: <86plhot78r.fsf@gnu.org> Message-ID: References: <86plhot78r.fsf@gnu.org> Date: Mon, 07 Apr 2025 11:11:44 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.162 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> The info docs for replace-region-contents say that it attempts to >> preserve point. With the latest update, it fails to preserve point in >> cases where it did before. I fixed my use case with save-excursion, and >> the docs are vague enough that this issue might not qualify as a bug, >> but I figured I'd report it just in case it was unintentional, or in >> case others come across it. >> >> For example: >> >> (with-temp-buffer >> (insert "abc") >> (replace-region-contents (- (point) 3) (- (point) 2) (lambda () "A")) >> (char-to-string (char-before))) >> >> now returns "A", but I believe that it previously returned "c". > > Stefan, any comments? Indeed that's a bug. Stefan From unknown Fri Jun 20 19:58:09 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Paul D. Nelson" Subject: bug#77607: closed (Re: bug#77607: 31.0.50; replace-region-contents moves point) Message-ID: References: X-Gnu-PR-Message: they-closed 77607 X-Gnu-PR-Package: emacs Reply-To: 77607@debbugs.gnu.org Date: Mon, 07 Apr 2025 15:55:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1744041302-4320-1" This is a multi-part message in MIME format... ------------=_1744041302-4320-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #77607: 31.0.50; replace-region-contents moves point which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 77607@debbugs.gnu.org. --=20 77607: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77607 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1744041302-4320-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 77607-done) by debbugs.gnu.org; 7 Apr 2025 15:54:33 +0000 Received: from localhost ([127.0.0.1]:56429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1onw-00015j-Iv for submit@debbugs.gnu.org; Mon, 07 Apr 2025 11:54:32 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54956) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u1onu-00015C-0C for 77607-done@debbugs.gnu.org; Mon, 07 Apr 2025 11:54:30 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E16E81002EC; Mon, 7 Apr 2025 11:54:23 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1744041263; bh=TparQN2bxUqrpz280QF+Pc1G5WobXLrLXB66ewujSKA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=TQ7+ssLBHsQknHOB9GduLWVA5b/a9rlog8PbtHqGJb4CbiW7dvRx9TdAmX7LtPxv2 Xk01cQdxgcsXw8zuKq5B1rsFggrgkiAJpXLAIFgZnJ6bGTjZ/W8YgBJqHSe6i5e31p iLWm8mfP1i+dj68KE8tcMUiDiQIvTOMO3Zhu+LeeqDHJRo+YWeUVthF56KnzhkhwsK U2bdDVueQhFBGfRdScN1WF9mFrwkE48Y2mYe++Z71MPMMipPYmLZt+1ysV1HQgtnXG Nphzlk6kHKXOc18zJj2+dWY7nMmdbECTDqjhlCY/yrfK5LrcyK04JL12+xm/y9c8S0 5stKVm5+dXXCQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2047410006B; Mon, 7 Apr 2025 11:54:23 -0400 (EDT) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F385412021C; Mon, 7 Apr 2025 11:54:22 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#77607: 31.0.50; replace-region-contents moves point In-Reply-To: Message-ID: References: <86plhot78r.fsf@gnu.org> Date: Mon, 07 Apr 2025 11:54:22 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.271 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77607-done Cc: 77607-done@debbugs.gnu.org, "Paul D. Nelson" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >>> (with-temp-buffer >>> (insert "abc") >>> (replace-region-contents (- (point) 3) (- (point) 2) (lambda () "A")) >>> (char-to-string (char-before))) >>> >>> now returns "A", but I believe that it previously returned "c". I installed the patch below which should fix it. Stefan diff --git a/src/editfns.c b/src/editfns.c index 9590b49dc25..669d3cdb140 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1968,6 +1968,7 @@ DEFUN ("replace-region-contents", Freplace_region_contents, if (FUNCTIONP (source)) { specpdl_ref count = SPECPDL_INDEX (); + record_unwind_protect_excursion (); record_unwind_protect (save_restriction_restore, save_restriction_save ()); Fnarrow_to_region (beg, end); @@ -2119,7 +2120,6 @@ DEFUN ("replace-region-contents", Freplace_region_contents, Fundo_boundary (); bool modification_hooks_inhibited = false; - record_unwind_protect_excursion (); /* We are going to make a lot of small modifications, and having the modification hooks called for each of them will slow us down. ------------=_1744041302-4320-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Apr 2025 12:09:53 +0000 Received: from localhost ([127.0.0.1]:53198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1lIW-0007p6-E9 for submit@debbugs.gnu.org; Mon, 07 Apr 2025 08:09:52 -0400 Received: from lists.gnu.org ([2001:470:142::17]:53372) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u1lIR-0007ne-SR for submit@debbugs.gnu.org; Mon, 07 Apr 2025 08:09:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u1lHy-0003pF-VG for bug-gnu-emacs@gnu.org; Mon, 07 Apr 2025 08:09:21 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u1lHw-0006Vo-If for bug-gnu-emacs@gnu.org; Mon, 07 Apr 2025 08:09:18 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-ac3b12e8518so797526266b.0 for ; Mon, 07 Apr 2025 05:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744027754; x=1744632554; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=2Ho3aypT5ZSS09tb3rzMB7xsj37vzFhgi5yd7euW2y8=; b=DJf/frDSsEDwTvjKvD2fZNjt0/2DhCBi9d+RPMjaZk5hTzo2XtXFeO2AIraVLlkFy/ +w+S6X6WXBy2vobBDvmvQVQKZYOetCSLJH95nJtIVOtXfqIDEXFfgxqoC7E7I45Waw9/ 4bqu9+UEIZbHm+zxLw2EJ+Ox72fYbV8/EEaKd05P+UrxVUfAJUXKH+Ei21wmXhzwaR3n 3cJtnEvL58mOdcEWRd2aBjIwk/AX6lve6joBpDmRzrFm7e9sS4fJXzto9hHBkACA1Vlj VxprohcEf3oWAg/axIXbzkgvYk5zoHomu4ZeCTp+Pgj6P7gDj4DK0RMIx7j07NikL3ic gvhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744027754; x=1744632554; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2Ho3aypT5ZSS09tb3rzMB7xsj37vzFhgi5yd7euW2y8=; b=b417oXCdtQn+WwV6JGaPdee1OrevRvRjMpXa+aNOpQL32+gfQFN64A+pQnVZ5VAet3 0xGFUcYDh1jpk2+O574G6tAl1kC7BVmRFo5o1DE4cDtz6fO4tqQYsgYGalsN6a8OiEXv e7qAjI/Ihm5LAwgzNLGwcV01NsNPq04PX9M96PK0ynRnJILHd789YWBW91XgRNMNFNwo fGfCECECdBC7BWc+yuJKu4ydy3fC8lJM4lipZUe8OdVpGmuQ95oFB7ltZhQrFwLZhZnk MPzQ4GBlXIUYHxqb+vay/eYYPlleUh4B56gekHaQ8fOASXsGrw089GMayKj9s7QzUSbJ xcVA== X-Gm-Message-State: AOJu0Yy9OsF1m+7b5zEF4+kMakHj+VBQ4J/hh8aQYYYRlV2nXyOUpVGD Sls29IPdDu6tzBhM/pIWkQGuIXYfW+R5NhxG/1lOA+z4eOn/QbMcih/Xws4l X-Gm-Gg: ASbGncuh6e0huBqnx8X4BkEgOXkaIhTzTASeZu0amiU8ryEMJs0iyLohSKPQfM+QkDG AsctCVg7o5/pVYaNzDrrxGYqTzPaRb86A86hqzAy0vwBgJ4mA90JYQbKH7bj/+Je/YINND6jYNE MWmvBG1PWNhSwv7nBYAfItSVIpPeWt6RzpFml+z1g5OtIeePqvuMteY3TaYhZP6/Nlhe+vKJFmf NgjuKy5R2qkhls3tK3r5zY7fKKUQq4/a7KdwXkSNJ0N6i1hGTnRHh57GB5m1RuPJymZwNUDjRrV V0lV4tSZ4Dyqs6GNFXjaiZ0yev0MYtCoSsPseU9m9WZgrvHLb/441mg2D0m7GSht9mb5rHTywNM l X-Google-Smtp-Source: AGHT+IGYiqWL9II9b2FLv46KPT101QQmVVBTyPCD3CACsmRk+eabIZxeCZFbxVVzq6tSNX+fIcWrrg== X-Received: by 2002:a17:907:7b99:b0:ac2:723a:670f with SMTP id a640c23a62f3a-ac7d18e25f3mr1192187966b.24.1744027753888; Mon, 07 Apr 2025 05:09:13 -0700 (PDT) Received: from localhost (users-1190.st.net.au.dk. [130.225.0.251]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-ac7bfe5bd17sm749346766b.10.2025.04.07.05.09.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 05:09:13 -0700 (PDT) From: "Paul D. Nelson" To: bug-gnu-emacs@gnu.org Subject: 31.0.50; replace-region-contents moves point Date: Mon, 07 Apr 2025 14:09:12 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=ultrono@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) The info docs for replace-region-contents say that it attempts to preserve point. With the latest update, it fails to preserve point in cases where it did before. I fixed my use case with save-excursion, and the docs are vague enough that this issue might not qualify as a bug, but I figured I'd report it just in case it was unintentional, or in case others come across it. For example: (with-temp-buffer (insert "abc") (replace-region-contents (- (point) 3) (- (point) 2) (lambda () "A")) (char-to-string (char-before))) now returns "A", but I believe that it previously returned "c". In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.1.0, NS appkit-2575.20 Version 15.1.1 (Build 24B91)) of 2025-04-06 built on d51735 Repository revision: 8ae7224b8fae59229b186853b300822bd70a8ec4 Repository branch: master Windowing system distributor 'Apple', version 10.3.2575 System Description: macOS 15.1.1 Configured using: 'configure --with-ns --with-native-compilation --with-tree-sitter --with-gif --with-png --with-jpeg --with-rsvg --with-tiff --with-imagemagick --with-x-toolkit=gtk3 --with-xwidgets' Configured features: ACL DBUS GLIB GNUTLS IMAGEMAGICK LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS ZLIB Important settings: value of $LC_CTYPE: UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: savehist-mode: t recentf-mode: t repeat-mode: t display-time-mode: t save-place-mode: t global-auto-revert-mode: t minibuffer-depth-indicate-mode: t electric-pair-mode: t override-global-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tab-bar-history-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug lisp-mnt message mailcap yank-media puny rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils thingatpt llm vc-git diff-mode track-changes files-x vc-dispatcher foldout noutline outline imenu dired-aux hl-line dired dired-loaddefs time-date pcase savehist recentf tree-widget repeat time saveplace autorevert filenotify mb-depth elec-pair comp comp-cstr warnings subr-x comp-run comp-common rx edmacro kmacro byte-opt cl-macs gv cl-extra help-mode use-package-bind-key bind-key easy-mmode use-package-ensure cl-seq use-package-core bytecomp byte-compile cus-edit pp cus-start cus-load icons wid-edit cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads xwidget-internal dbusbind kqueue cocoa ns lcms2 multi-tty make-network-process tty-child-frames native-compile emacs) Memory information: ((conses 16 201000 24284) (symbols 48 23072 1) (strings 32 56478 4127) (string-bytes 1 1440313) (vectors 16 25713) (vector-slots 8 1044292 203938) (floats 8 70 20) (intervals 56 1876 41) (buffers 992 17)) ------------=_1744041302-4320-1--