From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#75310: Eliminate obsolete alias warning Date: Fri, 3 Jan 2025 23:33:25 -0800 Message-ID: <77CBB14F-094D-48DA-A7D1-ED9E1F43DAD3@gmail.com> References: <86h66ggl6a.fsf@gnu.org> <02134785-ad5d-8b9a-4b51-64e8d466b038@mavit.org.uk> <86bjwogewx.fsf@gnu.org> <868qrrhq8h.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16911"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Peter Oliver , 75310@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 04 08:34:38 2025 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 1tTygA-0004HR-9L for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jan 2025 08:34:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTyfk-0000pG-WB; Sat, 04 Jan 2025 02:34:13 -0500 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 1tTyfb-0000kR-BJ for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 02:34:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTyfb-0004Yq-0F for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 02:34:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:Date:In-Reply-To:From:Mime-Version:To:Subject; bh=fLjxb69wVU0GsfZMbThAw1wpkXB46MQryRE/Ond9f8U=; b=D5tTAGgySHSNsAMaJUsUYSAka7ciOpgzpR0xErO69i7KzgNH0eVQyM+LeO4zt/quzMD2Pl+gICGTT/rm/OXNOetxokanX9BoQuMS88+eZ64RY3EvruZF9iEhtazOlGlEwhLEaxqt6ZSkIYDRKWr+fSO0CoKiQpaaqrxYq/Qet4tDbVUrYuaqktO4xDK6/RY2XnN/hXVfAWAULolJtdyTnoTZGc62Pi/avMBiO2nbjxGD53LXmcAnZKJUcu3NCqfNhUJJxUWbF5Z/FC4zzV9iX2GRJ1TGIVHOU06RH9bX1sO61h7lhU04+wtOdiyjQ49H5d9QbWkVp4MqFzDmfP+4Hw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTyfa-0008Mu-HN for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 02:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jan 2025 07:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75310 X-GNU-PR-Package: emacs Original-Received: via spool by 75310-submit@debbugs.gnu.org id=B75310.173597602132140 (code B ref 75310); Sat, 04 Jan 2025 07:34:02 +0000 Original-Received: (at 75310) by debbugs.gnu.org; 4 Jan 2025 07:33:41 +0000 Original-Received: from localhost ([127.0.0.1]:53191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTyfE-0008MK-Qn for submit@debbugs.gnu.org; Sat, 04 Jan 2025 02:33:41 -0500 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:55796) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tTyfC-0008M5-93 for 75310@debbugs.gnu.org; Sat, 04 Jan 2025 02:33:39 -0500 Original-Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-21644aca3a0so107692075ad.3 for <75310@debbugs.gnu.org>; Fri, 03 Jan 2025 23:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735976017; x=1736580817; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fLjxb69wVU0GsfZMbThAw1wpkXB46MQryRE/Ond9f8U=; b=YhWZ998h1SL+ro6AksoFl2UO6leZ+2D2fNWc5X7KmTqBSnGwIfhTpiYXSn0ZCwRQqf 5I+kG/n0VN7ankgTRcb3T6ARYquZEtAphY0n6ntiTq2ojslPwhSrOEznp5lYreNbJniT y2CWsxco8TvrRRGy5XWmPebajkIqalsZLrCYoLD8wEaguJWU8bZxD/1XgI3R6Njg9HQO SSjh6wh5fK5R4lKB4FMkhKJTXIl5CR01SJectEQTtdcM5svpq/YMVrzS+Wn9Kw9FFFCS HgRk7/5iNgoopVKbiZ1hy4COBO1XDakLCR5toWq2GbLn0SBtoAAjKre8+lbFqVhmOUmB O+rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735976017; x=1736580817; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fLjxb69wVU0GsfZMbThAw1wpkXB46MQryRE/Ond9f8U=; b=CXbM6QJHxl5ZGR9UXmvHA0LoBDw3335sCx38EauR4IUKXafaXvnH7/QOepmrvTXDkw qPMuqOUkYeth0UybFh+pnER1E1NiMvzorQGezI7Qo4XXhTwOAhg2QVlU3lX7YtVounNz 7DRjAzNVJEtvTWk10S1NO83XQBEMWP0OU1eoBxpnOWj6PJ3m4AyPU6e7ujeunjLhY9J4 9NBf9OUL72vR9DSy+i2Ax4OQWH+p3w+VGODzWdUzpbrnbNq342mMeVEFZ4fLD4nnnWWs Yxvhv9pPo+9a5QaexcnILk3Qen64LJ+Ev5AhXrVKCG5u7xvZJo5XNjWSoHUIaIOGOSz8 y+HA== X-Forwarded-Encrypted: i=1; AJvYcCXl+Bcx7DJQY7rcKPMBIBHRtKcqZgO7pGf+6Smnnerrz1k91DkC+gaTce8c8DIvAvilgC5syQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yx7ae38i1xRMoCT/nvkbCzJ965YF3N7nvnH40WDsglHsj/DXPxq 5eX2Dlj325Rj1sofpLWzLy8MGtjWLYltWAMcw/D+OMsuiRn0XEyg X-Gm-Gg: ASbGncumHSnW8Wv/V0uhioQ6Q+ks5uUw2yIe4zCTWdjU0aX+BWwLbtQqaLOSssVBFrs YAD3rUJWmNFxbA1AO2/AzfmtVAqk+40GnFCJv9iRLJhk1EUxHWdKZs/kg/bX4XgcB9iHXZ1L9af 0ZyEsj+YGyU+XAZYZKVbDzsBjfQuWDlEpGvLS9C/mj0443deYzTwQ+MhI8axd6ryd3qRrN1jd0H bJF6KWHlGpj1gP2R5/A2zG+1GJYy1OzqQGFLi7z0Lcc9ReW2tOO+PsoAWdu+WzVDubm1vVdTfFb dTMe X-Google-Smtp-Source: AGHT+IEcv4Gob1kLWA5G/dl7cDKCFlxRoUaDRkGxCHd6fHOSaUrk8oCIBuqyLAhYshdNGd43H99DiQ== X-Received: by 2002:a17:902:da8d:b0:20c:6399:d637 with SMTP id d9443c01a7336-219e6f117ddmr846457365ad.40.1735976016833; Fri, 03 Jan 2025 23:33:36 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:c496:8cdf:4c5d:3617]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f68e4sm254963805ad.211.2025.01.03.23.33.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jan 2025 23:33:36 -0800 (PST) In-Reply-To: <868qrrhq8h.fsf@gnu.org> X-Mailer: Apple Mail (2.3776.700.51) 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:298330 Archived-At: > On Jan 3, 2025, at 7:27=E2=80=AFAM, Eli Zaretskii = wrote: >=20 >> Date: Fri, 3 Jan 2025 14:47:53 +0000 (GMT) >> From: Peter Oliver >> cc: 75310@debbugs.gnu.org >>=20 >> On Fri, 3 Jan 2025, Eli Zaretskii wrote: >>=20 >>> IOW, can you show a minimal recipe for reproducing the problem, >>> starting from "emacs -Q"? >>=20 >> $ src/emacs -Q --batch --eval "(progn (message emacs-version) = (require 'cl) (require 'treesit))" >> 31.0.50 >> Package cl is deprecated >> lisp/treesit.el: Warning: =E2=80=98loop=E2=80=99 is an obsolete alias = (as of 27.1); use =E2=80=98cl-loop=E2=80=99 instead. >=20 > Thanks. >=20 > Yuan, I think it would be good to rename 'loop' there to some other > name, do you agree? I would definitely agree. I=E2=80=99ve always used cl-loop (and now I = try to not use it for new code). The only instance of =E2=80=9Cloop=E2=80=9D= I can find in treesit.el is in a named-let in treesit-transpose-sexps = wriiten by Theo, and it=E2=80=99s not the CL loop but a local function = defined by named-let. I wanted to rewrite it so it doesn=E2=80=99t use = named-let because it=E2=80=99s not very readable, but tbh I haven=E2=80=99= t find the time to understand that function well enough to rewrite it = (because it=E2=80=99s not very readable :-) It could be that only I can=E2=80=99t understand it, but code should be = simple enough that even I can understand ;-) Once I rewrite it, there shouldn't be any occurrence of loop in = treesit.el. treesit-transpose-sexps looks like this: (defun treesit-transpose-sexps (&optional arg) "Tree-sitter `transpose-sexps' function. ARG is the same as in `transpose-sexps'. Locate the node closest to POINT, and transpose that node with its sibling node ARG nodes away. Return a pair of positions as described by `transpose-sexps-function' for use in `transpose-subr' and friends." ;; First arrive at the right level at where the node at point is ;; considered a sexp. If sexp isn't defined, or we can't find any ;; node that's a sexp, use the node at point. (let* ((node (or (treesit-thing-at-point 'sexp 'nested) (treesit-node-at (point)))) (parent (treesit-node-parent node)) (child (treesit-node-child parent 0 t))) (named-let loop ((prev child) (next (treesit-node-next-sibling child t))) (when (and prev next) (if (< (point) (treesit-node-end next)) (if (=3D arg -1) (cons (treesit-node-start prev) (treesit-node-end prev)) (when-let* ((n (treesit-node-child parent (+ arg (treesit-node-index prev t)) = t))) (cons (treesit-node-end n) (treesit-node-start n)))) (loop (treesit-node-next-sibling prev t) (treesit-node-next-sibling next t))))))) Yuan=