GNU bug report logs - #75042
29.4; `backward-delete-char-untabify': active-region behavior

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Asher Copeland <ashercopeland@HIDDEN>; dated Mon, 23 Dec 2024 08:37:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Dec 2024 08:36:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 23 03:36:25 2024
Received: from localhost ([127.0.0.1]:53223 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tPdvM-0000Aj-UO
	for submit <at> debbugs.gnu.org; Mon, 23 Dec 2024 03:36:25 -0500
Received: from lists.gnu.org ([209.51.188.17]:38474)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashercopeland@HIDDEN>) id 1tPXcD-00063J-MF
 for submit <at> debbugs.gnu.org; Sun, 22 Dec 2024 20:52:18 -0500
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 <ashercopeland@HIDDEN>)
 id 1tPXcD-00038T-9e
 for bug-gnu-emacs@HIDDEN; Sun, 22 Dec 2024 20:52:13 -0500
Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <ashercopeland@HIDDEN>)
 id 1tPXcB-0002nv-6m
 for bug-gnu-emacs@HIDDEN; Sun, 22 Dec 2024 20:52:12 -0500
Received: by mail-ot1-x329.google.com with SMTP id
 46e09a7af769-71e2aa8d5e3so1998123a34.2
 for <bug-gnu-emacs@HIDDEN>; Sun, 22 Dec 2024 17:52:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1734918727; x=1735523527; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=0tzeaGciaC+M5AnIUvDd/MXVSgEznIdXj5MGla1gt0I=;
 b=jgON9XNZzMHX2ojP+dK5W/R5z44KbntgSV8bahjPlmD0sgTk3qQm19zR4JXnMBIhbb
 5HNa4a4JuxbFM3hrvmqpltMRC4qDNo7SVOkocnIwNz5XhVKFtLk8Y+NyAQMdaZ2XuktQ
 Fm/PjvlXgaW/MoHY5+nYD3n+QpKriLANQOP415ZDRPRT/sykG8sItWgOAduNKhoCKihg
 ULkSEuUF7QojmhdU08DGcvc1DuaJBXEdRlNdtgHDXUkehJaam/E/OdJOCckrvxwAkVt0
 ELsAajCe7sgnBhjM5FLeFzcx5pPaf4H1+MMgU3pDRpueQ4WTwX1TRm1FXhC2m4Mts0EM
 ajWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1734918727; x=1735523527;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=0tzeaGciaC+M5AnIUvDd/MXVSgEznIdXj5MGla1gt0I=;
 b=sf0MNOjAsM91U4K/H8WUyk0NUZ+9TMoKeNDCZfvpexCS0FRYk8GPDfsDRUOwI0Tp/l
 YOfZ3ImwNH80dDznapWdrDROmNtEuZyYlqLx5a7xM5cx4zoKyIz5xkz/uNsaiF+dCbjb
 Xt4vU83q3I/Ejp+G5omTstynQGGMA5ZOjKtIg4cQgJmsD6PK8lVo3DwLy1JEDinm6YsE
 IXUAsdq9ztTMn5/VCcVae2BP2Dv9tYQr/NPqev4APbt9CeeMLGmMhAZfhezJDSZdZX2v
 C2W1YxZj2X0e5oOCUP7rVuyKq0xvYD4jX5UiXuNK66XKIkEcg+Au9N69jp0OZJUDxPfA
 6frA==
X-Gm-Message-State: AOJu0Yzyv2DMch4ofXYWZEJyqlpnyy1eHAaUh2G3TFb3wflInzfbcQQu
 FrQ9Kb0+ZN6YEbwQkI6p5vaewpJd9XdMHJU5wi1uAarSNy7JARM+OMB5Ww==
X-Gm-Gg: ASbGncv7Z6jXa1ySYw2z3L8WOjzGDrZdo8WZVOr1t4iaq12EMg6EfTfvkrXK8WmqfKM
 JQwd414WDAEFDON0djMIX4ldm6AkokocK+JsmzmE2DSnGwQo/YXvdUFP/g9tqcTy/LQZH9kMp2L
 GNSM7sVyORUcnhs+bN16XaVomHBu1rADOr0QuwEQGYd7OSTgUHNimXM21P7G3vDLRkHFsmfRv9g
 ExOsxtcERNUf4D/zdxity/f7pOwS5bAfRpjXC3Q791OzGmaVh8G3WVeEGg2jpLOnV1l
X-Google-Smtp-Source: AGHT+IFTJ1FENZTHrlqCbfCWcbqortISsU3jFlePuj6kv3Kr2SyR/bBhAaoMjw7Gw1789xml5prlzg==
X-Received: by 2002:a05:6830:3107:b0:718:18d6:a464 with SMTP id
 46e09a7af769-720ff685328mr7547113a34.5.1734918726767; 
 Sun, 22 Dec 2024 17:52:06 -0800 (PST)
Received: from asher-v-ubuntu ([2600:1700:3ec8:600:57f7:c3a3:1de2:bef0])
 by smtp.gmail.com with ESMTPSA id
 46e09a7af769-71fc9805c98sm2122402a34.42.2024.12.22.17.52.05
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 22 Dec 2024 17:52:06 -0800 (PST)
From: Asher Copeland <ashercopeland@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.4; `backward-delete-char-untabify': active-region behavior
Date: Sun, 22 Dec 2024 17:52:04 -0800
Message-ID: <87ttav9nej.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::329;
 envelope-from=ashercopeland@HIDDEN; helo=mail-ot1-x329.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.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 23 Dec 2024 03:36:23 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

The documentation of `backward-delete-char-untabify' indicates the
following:

 If Transient Mark mode is enabled, the mark is active, and ARG is 1,
 delete the text in the region and deactivate the mark instead.
 To disable this, set option `delete-active-region' to nil.

However, when `backward-delete-char-untabify-method' is set to hungry or
all and point has more than one whitespace character before it
(i.e. that `backward-delete-char-untabify' would delete more than one
character), `backward-delete-char-untabify' ignores the settings of
`transient-mark-mode' and `delete-active-region' and proceeds with its
normal action.

Practically, this means that, in a snippet of text such as the
following (assuming the spacing/newlines don't get messed up):

    line1
    line2
    line3

If point were placed before line2 and the region is active and nonempty,
with `backward-delete-char-untabify-method' set to hungry, the expected
behavior (and the behavior that is currently documented) would be that
the text highlighted by the region would be deleted and that the region
would be deactivated. What the function would instead do is delete the
spaces to the left of point and deactivate the region.

I have found this issue to occur running under `emacs -Q'.

For consistency with the current documentation and other deletion
commands, I believe that the behavior of `backward-delete-char-untabify'
should change to delete the text in the region, under the same
conditions that `backward-delete-char' would do the same.

Here is the last form of the definition of
`backward-delete-char-untabify', from simple.el:6522, for reference:

   (let* ((skip (cond ((eq backward-delete-char-untabify-method 'hungry) " \t")
                      ((eq backward-delete-char-untabify-method 'all)
                       " \t\n\r")))
          (n (if skip
                 (let* ((oldpt (point))
                        (wh (- oldpt (save-excursion
                                       (skip-chars-backward skip)
                                       (constrain-to-field nil oldpt)))))
                   (+ arg (if (zerop wh) 0 (1- wh))))
               arg)))
     ;; Avoid warning about delete-backward-char
     (with-no-warnings (delete-backward-char n killp))))

The issue seems to stem from the last line. In the described conditions,
the symbol `n' would be bound to a value greater than 1. Therefore,
`delete-backward-char' would delete n characters and deactivate the
region, instead of deleting the region.

--
Asher


In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.0, Xaw scroll bars) of 2024-10-16 built on asher-v-ubuntu
System Description: Ubuntu 24.04.1 LTS

Configured using:
 'configure --with-x-toolkit=lucid --prefix=/opt/emacs'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM LUCID ZLIB

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

Major mode: Fundamental

Minor modes in effect:
  gpm-mouse-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-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
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: linux
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr help-fns radix-tree help-mode emacsbug message
mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec
password-cache epa derived epg rfc6068 epg-config gnus-util
text-property-search time-date subr-x mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
t-mouse term/linux rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode 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 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 dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
xinput2 x multi-tty make-network-process emacs)

Memory information:
((conses 16 38095 7179)
 (symbols 48 5293 1)
 (strings 32 13493 2007)
 (string-bytes 1 379725)
 (vectors 16 7691)
 (vector-slots 8 105658 7932)
 (floats 8 19 318)
 (intervals 56 201 9)
 (buffers 984 11))




Acknowledgement sent to Asher Copeland <ashercopeland@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#75042; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.