From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Suggestion: two new commands: beginning-of-list and end-of-list Date: Mon, 09 Sep 2024 22:11:26 +0300 Message-ID: <86le00ve01.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="570"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: arthur miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 09 21:12:17 2024 Return-path: Envelope-to: ged-emacs-devel@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 1snjo7-000ATa-Fn for ged-emacs-devel@m.gmane-mx.org; Mon, 09 Sep 2024 21:12:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snjnU-0000V7-7X; Mon, 09 Sep 2024 15:11:36 -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 1snjnT-0000Ut-BP for emacs-devel@gnu.org; Mon, 09 Sep 2024 15:11:35 -0400 Original-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 1snjnS-0007ui-TW; Mon, 09 Sep 2024 15:11:34 -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=LtqNrULZ/xBQo9oSr7iBUnPKoVh6Lo5KwmShFVhyLu0=; b=UkZ3qZU0Im9C om7T2E1UicNDaTiZ/JNOUNdShCaDyQV5Ge7qY8MARd8aXSUSN67ug20UvVCp8KYDpr8VXeYOWqsvR Fmkwv0mtbga+/vIUhQZvcKxP5tX8F+K3npNYE5NNQWRSoe61SqO3RrilETfgjqdQm4/rlo0HumXqr 3doB3T9oBm8ERyhOsfzWYihITBceNvDbapzns0509O7PubwGoHHTFJYANCEHTcgGlbrj/UZR98CVP z2r4cJNty+jUAVEuXoZQ9SKXVez3mzOmCYFqpidQhDu8oBULyLN8azGd4ZPRoV/yyesCHAUkEZjb6 Y+8arG2zaSpQR6Wb+1i44Q==; In-Reply-To: (message from arthur miller on Mon, 9 Sep 2024 18:32:33 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323522 Archived-At: > From: arthur miller > Date: Mon, 9 Sep 2024 18:32:33 +0000 > > In elisp-mode.el, there is a function, IMO somewhat unfortunately named > "elisp--beginning-of-sexp". What this function does is to place cursor at the > beginning of the innermost list, which we can perhaps call more conveniently, > "current list". > > The function does so always, and is relatively well written, minor the case when > the cursor is placed in a literal string or outside a symbolic expression, say > between two top-level forms. In those cases, it jumps into the first string > before the current string, which might be anywhere in the file prior to the > current string, or to the beginning of the file. > > I took me a liberty to rename this function and update the doc to a more > appropriate wording, and turn it into a command. I have also patched the > above mentioned cases when it is invoked in a literal string or outside of > an expression. > > As another consideration, I have moved this function into lisp.el (in > lisp/emacs-lisp/) in the sources. It does not look like it has nothing > particularly specific to EmacsLisp per se, seems like it should work on any > "parenthesis"-language. I have tested it successfully in both CommonLisp and > EmacsLisp files. > > I found only one user of elisp--beginning-of-sexp in the entire Emacs, and that > is the function directly above: elisp--fnsym-in-current-sexp. > > Emacs already has few functions for motion over lists and symbolic expressions, > but actually not the one that places the cursor at the beginning of a list. I think we do have it: C-M-u, backward-up-list. What's more, it works not only in Lisp. I use it all the time. So I wonder why we need another function that does basically the same. Thanks.