From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zachary Kanfer Newsgroups: gmane.emacs.bugs Subject: bug#62892: proposal to extend mark-sexp to go forward and backward on command Date: Wed, 26 Apr 2023 00:41:45 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000032604505fa35dce0" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37303"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ruijie Yu , Stefan Monnier , 62892@debbugs.gnu.org To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 26 06:43:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1prWzt-0009UE-Ln for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Apr 2023 06:43:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prWzf-0005Y4-SP; Wed, 26 Apr 2023 00:43:03 -0400 Original-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 1prWze-0005WS-DX for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2023 00:43:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prWze-0006Jp-1M for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2023 00:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1prWzd-0007q4-TQ for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2023 00:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Zachary Kanfer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Apr 2023 04:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62892 X-GNU-PR-Package: emacs Original-Received: via spool by 62892-submit@debbugs.gnu.org id=B62892.168248412630052 (code B ref 62892); Wed, 26 Apr 2023 04:43:01 +0000 Original-Received: (at 62892) by debbugs.gnu.org; 26 Apr 2023 04:42:06 +0000 Original-Received: from localhost ([127.0.0.1]:53962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1prWyk-0007oe-5z for submit@debbugs.gnu.org; Wed, 26 Apr 2023 00:42:06 -0400 Original-Received: from mail-oa1-f51.google.com ([209.85.160.51]:53452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1prWyh-0007nc-QW for 62892@debbugs.gnu.org; Wed, 26 Apr 2023 00:42:04 -0400 Original-Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-18665c1776dso4902867fac.2 for <62892@debbugs.gnu.org>; Tue, 25 Apr 2023 21:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682484118; x=1685076118; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+Tt1QsRbDDMU4icx/MW7YfQok3AxL0D7fRx2nCR6K9Q=; b=Ktj6wCvUv+6Nz179pmaMMYS113ldmJv6kiijFo5v4Vy+kFE+II6NuM+ThXJQpcNz9G EGj37qI95gUrfcV0kY4lSQUvWphgobDcBBz1UtxMuwJtugP2vWbJJo+NhOeqI80jpCk+ 0GoSFHOou7MenYXWIUlinI2mefnK3ka/ECw93QJTErcYI+kcxGBxXglJ5Gor920cAFh5 nZKX1cHwaJktLDjYsmbEnDZMVUslxsYnHvBQfGJ5Keuu/px/xO9czJ4TmKqhpLfXCikr h4xM6BaLh35sGpFqgNC/+69xB3pUVd3madp+l3mA/QVYYwdILKKSXtHWUIlubGXE201+ ytOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682484118; x=1685076118; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+Tt1QsRbDDMU4icx/MW7YfQok3AxL0D7fRx2nCR6K9Q=; b=EnxezdebqK+FKr2vR0s6gZRP2sBNMaRkCLMdiGrcBLQggk+g85E7qXoqPnhTMTAzTv UROhP9ftNXH/iClgbvAetFOd3tglKOjgKMPkwwjACt3gkV1pspq5tWooBEv7eXQDerTP Vffbo1FVxlrRcrghM/Ryzgq8dnJpCFDRmLikwEphIgbxg96FV6g35ywMNSMLy9ptOEYd cPDRrqF37T9M0HZgcwIdLsGLm/yrxjfGwDYpmH22Tw5IHXpuOstzn8ka7NFsYUaGniFV BtSFp0bYVLZTnaePUmRhIg/QZ52drEvhga7XVt1gRD2md/OxnwPkrmDhlgV6B0m1RBQ7 s/nw== X-Gm-Message-State: AAQBX9egjJ5kqF41jMMGAp5MRoZPMR6Ap6vIRvAO+d89l7AYwzkUhYaE A+WVdCBalLjtIKwoX4IB4HrO/RwIh0XfOzwr80Q= X-Google-Smtp-Source: AKy350ZcHZOXMr8CQTny1oVYR1ADNHDB9tBzRMfdNvYHAPcT0NwkyAWF+DP7+X6yT0drtE+7H+hrZdC7cIgSBpLl4VY= X-Received: by 2002:a05:6870:ea92:b0:187:dbb8:f5fc with SMTP id s18-20020a056870ea9200b00187dbb8f5fcmr12412082oap.35.1682484118051; Tue, 25 Apr 2023 21:41:58 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260645 Archived-At: --00000000000032604505fa35dce0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable The documentation for mark-sexp says: > Set mark ARG sexps from point. > The place mark goes is the same place C-M- would > move to with the same argument. This is correct but misleading. Worse still is the next part: > Interactively, if this command is repeated > or (in Transient Mark mode) if the mark is active, > it marks the next ARG sexps after the ones already marked. This says it marks sexps *after* the ones already marked. This is incorrect; if point is *after* mark, and mark is active, this function marks sexps *before* the ones already marked. > In my opinion, the description of that feature should not be part of the > mark-sexp command documentation, because the feature is actually > provided by C-x C-x (exchange-point-and-mark). One way for this situation to occur is by using C-x C-x, yes, but it's not the only way. You can set point, move forward sexps, and then calling mark-sexp will mark sexps backwards. There is specific code in mark-sexp to check which direction to move; it should be documented as such. On Tue, Apr 25, 2023 at 6:26=E2=80=AFPM Daniel Mart=C3=ADn wrote: > Zachary Kanfer writes: > > > > > Also, whatever the outcome of this patch, I think it would be advisable > to > > explain somewhere how mark-sexp extends region by the end of region > > opposite point; this is not in the docstring or any other documentation > > I've seen. > > > > In my opinion, the description of that feature should not be part of the > mark-sexp command documentation, because the feature is actually > provided by C-x C-x (exchange-point-and-mark). The Emacs manual in > section 12.1 Setting the Mark describes this use case well, I think: > > =E2=80=98C-x C-x=E2=80=99 is useful when you are > satisfied with the position of point but want to move the other end of > the region (where the mark is). > --00000000000032604505fa35dce0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The documentation for mark-sexp says:

<= /div>
> Set mark ARG sexps from point.
> The place mark= goes is the same place C-M-<right> would
> move to with the sa= me argument.

This is correct but misleading. Worse= still is the next part:

> Interactively, i= f this command is repeated
> or (in Transient Mark mode) if the mark = is active,
> it marks the next ARG sexps after the ones already marke= d.

This says it marks sexps *after* the ones alrea= dy marked. This is incorrect; if point is *after* mark, and mark is active,= this function marks sexps *before* the ones already marked.

=
> In my opinion, the description of that feature should not b= e part of the
> mark-sexp command documentation, because the feature = is actually
> provided by C-x C-x (exchange-point-and-mark).

One way for this situation to occur is by using C-x C-x, y= es, but it's not the only way. You can set point, move forward sexps, a= nd then calling mark-sexp will mark sexps backwards.

There is specific code in mark-sexp to check which direction to move; it= should be documented as such.

On Tue, Apr 25, 2023 at 6:26=E2=80= =AFPM Daniel Mart=C3=ADn <mardani2= 9@yahoo.es> wrote:
Zachary Kanfer <zkanfer@gmail.com> writes:

>
> Also, whatever the outcome of this patch, I think it would be advisabl= e to
> explain somewhere how mark-sexp extends region by the end of region > opposite point; this is not in the docstring or any other documentatio= n
> I've seen.
>

In my opinion, the description of that feature should not be part of the mark-sexp command documentation, because the feature is actually
provided by C-x C-x (exchange-point-and-mark).=C2=A0 The Emacs manual in section 12.1 Setting the Mark describes this use case well, I think:

=E2=80=98C-x C-x=E2=80=99 is useful when you are
satisfied with the position of point but want to move the other end of
the region (where the mark is).
--00000000000032604505fa35dce0--