From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#62892: proposal to extend mark-sexp to go forward and backward on command Date: Mon, 17 Apr 2023 11:06:03 +0800 Message-ID: References: Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3361"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.22; emacs 30.0.50 Cc: 62892@debbugs.gnu.org To: Zachary Kanfer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 17 05:18:22 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 1poFNm-0000h6-3c for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 17 Apr 2023 05:18:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1poFNV-0007HV-Dk; Sun, 16 Apr 2023 23:18:05 -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 1poFNT-0007Gv-G6 for bug-gnu-emacs@gnu.org; Sun, 16 Apr 2023 23:18:03 -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 1poFNT-0001ek-1t for bug-gnu-emacs@gnu.org; Sun, 16 Apr 2023 23:18:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1poFNS-00061a-IX for bug-gnu-emacs@gnu.org; Sun, 16 Apr 2023 23:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ruijie Yu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Apr 2023 03:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62892 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, 62892@debbugs.gnu.org Original-Received: via spool by 62892-submit@debbugs.gnu.org id=B62892.168170143223079 (code B ref 62892); Mon, 17 Apr 2023 03:18:02 +0000 Original-Received: (at 62892) by debbugs.gnu.org; 17 Apr 2023 03:17:12 +0000 Original-Received: from localhost ([127.0.0.1]:52805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1poFMe-00060A-6g for submit@debbugs.gnu.org; Sun, 16 Apr 2023 23:17:12 -0400 Original-Received: from netyu.xyz ([152.44.41.246]:60942 helo=mail.netyu.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1poFMb-000601-VV for 62892@debbugs.gnu.org; Sun, 16 Apr 2023 23:17:10 -0400 Original-Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 5498538b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 17 Apr 2023 03:17:08 +0000 (UTC) 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:260168 Archived-At: Zachary Kanfer writes: > Attached is a patch to add #'mark-sexp-forwards and #'mark-sexp-backwards. These functions extend the region by sexps forward and > backward. They are mutually incremental: you can call mark-sexp-fowards, then mark-sexp-backwards twice, then mark-sexp-forwards. After > this, the region will consist of the two sexps before point and the two sexps after point. 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 because this is inherently a private function. - `mark-defun' - `mark-page' - `mark-paragraph' - `mark-word' > +(defun mark-sexp-helper (number-of-expressions) > + "A helper function for 'mark-sexp-[forward, backward]'. > + > +If NUMBER-OF-EXPRESSIONS is positive, mark that many sexps forward; > +otherwise, amrk backward." 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. -- Best, RY