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: Fri, 21 Apr 2023 01:04:30 -0400 Message-ID: References: <83a5z36n1t.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000003a9e0805f9d19822" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6686"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ruijie@netyu.xyz, 62892@debbugs.gnu.org, Juri Linkov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 21 07:05: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 1ppixU-0001Ug-2q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Apr 2023 07:05:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppixH-0006aM-2p; Fri, 21 Apr 2023 01:05:07 -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 1ppixE-0006Zu-0v for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2023 01:05:04 -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 1ppixC-00070y-Fd for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2023 01:05:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ppixB-00032g-W6 for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2023 01:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Zachary Kanfer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Apr 2023 05:05: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.168205348911670 (code B ref 62892); Fri, 21 Apr 2023 05:05:01 +0000 Original-Received: (at 62892) by debbugs.gnu.org; 21 Apr 2023 05:04:49 +0000 Original-Received: from localhost ([127.0.0.1]:39075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppiwy-000329-T9 for submit@debbugs.gnu.org; Fri, 21 Apr 2023 01:04:49 -0400 Original-Received: from mail-ot1-f48.google.com ([209.85.210.48]:59772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppiwx-00031x-35 for 62892@debbugs.gnu.org; Fri, 21 Apr 2023 01:04:47 -0400 Original-Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6a5ebf9f432so1383266a34.3 for <62892@debbugs.gnu.org>; Thu, 20 Apr 2023 22:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682053481; x=1684645481; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TaCmExa3kha+YRrFsImuxgiOr2LwRjBVtxn1XDodXPg=; b=GzZAz0rTZSx9PJ7YdqJG6C8nitS8gyGMGkJhdjdTbGYSE+EpxVOsV9Zw2NlMmCPM1W QLEEHfUWB114YQ8bUnuNxYXeJ9txCGgvChE8sw5+/d04Q1cdpiQPIzc1iEvHtjZOA5Gp V3iUmPVRtCsTclkHLucaa3H0nAMt6HASRAOepXswDjXfv0TUpqmnJL0HM2oL0pzwnztZ Xa6d3U26cjsx6VvIIA5zAyRroGaXMuzr9XkXjAvRdeBcSwvxAIme/E7C6y6znN/sgpy2 EJryqmkDpfRfgk8GB8AzU2bC1LLGhYho4QOOcloNIta2MxeNNYLvlkuzRfaFBBXgpomM M0TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682053481; x=1684645481; 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=TaCmExa3kha+YRrFsImuxgiOr2LwRjBVtxn1XDodXPg=; b=N4aAQyPRwYwc+hNUu8oZFHqmRvns2GYyitDFNu/5ShD6O5Cb4Oxfw50WeDRxLOea4+ OdNowzcyfdtLWSXvQ7cl5fDbXIcrO1GFpQb2u4JxNUcd/i+XhOzBQkWNXiIgHZ/Bz4UC KzL6bHSAzZ/mr74xKDn56rdjGnL/1pTb2eCMYiW2UJM5S+SP2noUmqitKY7Ywy4nSksA 1ccTcjms7ApOYREYzsCXahrCAs3ulAIvhwJ77kUcr1DY4yDN8SxMJO7FGeOZZk70dN8E r3tYAObvsoExD8IRiimRVO9p6RaPi2mTlYxdrVo36kYnmYd0ij/kaR9gtI0FbSSNZjU4 HeTw== X-Gm-Message-State: AAQBX9dGaw78NEDM1xdqO2vWysqfCAHdGCtl9ctuRMfSHkJw3QRCx2GQ Lm+5urhYVcL0O4xvk8a2PXCQKsC9QHPHDvlN11c= X-Google-Smtp-Source: AKy350ZgmBC3rSip3XBrCbeu+UEXA/58GxMASpO0Vc8gJDpbORu0oZiuJ0IPW8eUiElg0lB3NTkhrVCyZx2AyVgJMfY= X-Received: by 2002:a05:6808:10d5:b0:38c:581f:6c90 with SMTP id s21-20020a05680810d500b0038c581f6c90mr2511508ois.57.1682053481011; Thu, 20 Apr 2023 22:04:41 -0700 (PDT) In-Reply-To: <83a5z36n1t.fsf@gnu.org> 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:260366 Archived-At: --0000000000003a9e0805f9d19822 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It's able to be worked around, yes -- but I think it's easier to have separate methods for forward and backward, the way we do for so many other commands. For one, having separate functions makes it easier to start moving backward, (rather than giving a -1 prefix argument. It's especially useful, I think, because on default Emacs, both C-M-SPC and C-M-S-SPC are bound to mark-sexp; it's quite nice to have C-M-SPC bound to mark-sexp-forward and C-M-S-SPC bound to mark-sexp-backward. So there are seemingly obvious keybindings to use for it (even if not in stock Emacs). On Thu, Apr 20, 2023 at 3:16=E2=80=AFAM Eli Zaretskii wrote: > > Cc: 62892@debbugs.gnu.org > > From: Zachary Kanfer > > Date: Thu, 20 Apr 2023 01:25:29 -0400 > > > > > If this is to be accepted, why not extend it to all like mark > functions, > > > listed below? Implementing them should be pretty similar, and you > might > > > even be able to reuse the same helper for all these variants. Also, > the > > > helper function might need to contain a double-dash in its name becau= se > > > this is inherently a private function. > > > > This makes sense to me, although I have not found the same need for > these to be marked. I'm happy > > to extend them as such; I'll add that in a later patch. > > > > > Please use `quote' to quote things in Emacs docstrings. Also, both > here > > > and in other docstrings, the newline immediately after the first line= , > > > while seems necessary, is usually redundant in Emacs docstrings. And > > > there is a typo: "amrk" -> "mark". > > > > > > I also think you shouldn't use wildcard-like elements in quotes (in > your > > > case, you reuse part of the name in the quote), but I'm not sure. > > > > Done. Updated patch attached. > > Thanks. > > Did you see the comment by Juri, viz.: > > > Did you know that it's possible to switch directions by typing 'C-x C-x= '. > > After that 'C-M-@' extends the region backwards. > > AFAIU, this means we already have an easy method to have C-M-@ switch > directions, and the changes you propose might therefore be > unnecessary. WDYT? > --0000000000003a9e0805f9d19822 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It's able to be worked around, yes -- but I think= it's easier to have separate methods for forward and backward, the way= we do for so many other commands. For one, having separate functions makes= it easier to start moving backward, (rather than giving a -1 prefix argume= nt.

It's especially useful, I think, becau= se on default Emacs, both C-M-SPC and C-M-S-SPC are bound to mark-sexp; it&= #39;s quite nice to have C-M-SPC bound to mark-sexp-forward and C-M-S-SPC b= ound to mark-sexp-backward. So there are seemingly obvious keybindings to u= se for it (even if not in stock Emacs).

On Thu, Apr 20, 2023 at 3:= 16=E2=80=AFAM Eli Zaretskii <eliz@gnu.or= g> wrote:
> Cc: 62892@= debbugs.gnu.org
> From: Zachary Kanfer <zkanfer@gmail.com>
> Date: Thu, 20 Apr 2023 01:25:29 -0400
>
> > If this is to be accepted, why not extend it to all like mark fun= ctions,
> > listed below?=C2=A0 Implementing them should be pretty similar, a= nd you might
> > even be able to reuse the same helper for all these variants.=C2= =A0 Also, the
> > helper function might need to contain a double-dash in its name b= ecause
> > this is inherently a private function.
>
> This makes sense to me, although I have not found the same need for th= ese to be marked. I'm happy
> to extend them as such; I'll add that in a later patch.
>
> > Please use `quote' to quote things in Emacs docstrings.=C2=A0= Also, both here
> > and in other docstrings, the newline immediately after the first = line,
> > while seems necessary, is usually redundant in Emacs docstrings.= =C2=A0 And
> > there is a typo: "amrk" -> "mark".
> >
> > I also think you shouldn't use wildcard-like elements in quot= es (in your
> > case, you reuse part of the name in the quote), but I'm not s= ure.
>
> Done. Updated patch attached.

Thanks.

Did you see the comment by Juri, viz.:

> Did you know that it's possible to switch directions by typing = 9;C-x C-x'.
> After that 'C-M-@' extends the region backwards.

AFAIU, this means we already have an easy method to have C-M-@ switch
directions, and the changes you propose might therefore be
unnecessary.=C2=A0 WDYT?
--0000000000003a9e0805f9d19822--