From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Martin Marshall Newsgroups: gmane.emacs.bugs Subject: bug#68487: [PATCH] Make jump commands usable for all skeletons Date: Mon, 05 Feb 2024 16:46:55 -0500 Message-ID: <875xz2y46o.fsf@martinmarshall.com> References: <877ckawckc.fsf@martinmarshall.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9742"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68487@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 05 22:48:19 2024 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 1rX6p5-0002Ds-N6 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 05 Feb 2024 22:48:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rX6ol-0000r4-3Y; Mon, 05 Feb 2024 16:47:55 -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 1rX6of-0000qo-Nu for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2024 16:47:49 -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 1rX6of-0002ho-F7 for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2024 16:47:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rX6os-0001Dv-7H for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2024 16:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Martin Marshall Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Feb 2024 21:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68487 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68487-submit@debbugs.gnu.org id=B68487.17071696454645 (code B ref 68487); Mon, 05 Feb 2024 21:48:02 +0000 Original-Received: (at 68487) by debbugs.gnu.org; 5 Feb 2024 21:47:25 +0000 Original-Received: from localhost ([127.0.0.1]:52468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rX6oD-0001Ci-3u for submit@debbugs.gnu.org; Mon, 05 Feb 2024 16:47:24 -0500 Original-Received: from mail-yw1-x1131.google.com ([2607:f8b0:4864:20::1131]:43357) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rX6o7-0001CP-8w for 68487@debbugs.gnu.org; Mon, 05 Feb 2024 16:47:19 -0500 Original-Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-60427d9c5dbso30008777b3.1 for <68487@debbugs.gnu.org>; Mon, 05 Feb 2024 13:47:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martinmarshall-com.20230601.gappssmtp.com; s=20230601; t=1707169617; x=1707774417; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=JEMj7b1gIUMHDBKDWHiKYUzKfiFocGOUR718TETOqqE=; b=rU+PP1Vc3lEkv1lkuuPs54UXuro8EYMUzLMuY8iIVjJR6fsorO4fGH8zEdp75hE6+s ms3wZ8ncVTf2hgu+qnMnCUlgxoR72CcP0BgF9eWPvSZBgxd3bt49jSipRc0IcMCJd4h4 CsFbndr8vZRCKAlCl8oHg5qCBMIKwNRAqehDwPENbVvjtpOV7Ag3XfJxiBYKXxMT5v8R XIujwMfhOatJHEESA6djVOHSmAxbVtzUGUtpj4E0PidbsPM+vfH9qBRXYgIzH2Z2Erpb i5PGyDbB/cd0qlByhoOPUizbjhQEmTFwImMuEzWv+O0Kt3f5IQ5bBsvL8NtpdnDvNkEG xxrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707169617; x=1707774417; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JEMj7b1gIUMHDBKDWHiKYUzKfiFocGOUR718TETOqqE=; b=FeV2D9sXNPKAATOvnSzOs6dGPEu4C+bl9V3HkbkjZeETCOxFe/U0rLhr1oqRwOa1yd HzavfTpC0S1mff4YJth0sYdGD2U6BheO3uGLL0hqjJ7R+GT5obxwrzNnjQdhf4pa4YHn DNUmyUVKE/DfHmvTXyqElkN6BfaNzdKbRYMNfrSWV9Q/nc0UYuN71u2NNLqLlD2hXjDJ aTCmoEEiHozWW6UsXGeOPlrmayP5YshYvGmzCG36t9pc/WvuBwrFIDDb9ku2YspdMrpM PQm6JJG4sUr3r+ywwIBhK7uX1SAdoYh83aCKbJt8EPU5hIWDAPwhqD1/3iqu1fwv7//O Ci8Q== X-Gm-Message-State: AOJu0Yx7T4yC8WNiGqUu7rW7OE0bQ9Ikdi6PqNBhWnd6WIjRLyf0K1Ey EL593vsHigTEw8n/csZk2SSUYwKUzWmTY+xuLzi2UD+vbANVur1pOwd40f6/iXLDDlzIMwFqpZs = X-Google-Smtp-Source: AGHT+IFyp/TfcbiMMljKx/LKC0ujIlprfpbrkjTAd031g1TTXvC0FZMbupbwVUlvuBwzMgcZHnuMIA== X-Received: by 2002:a81:4409:0:b0:604:4c55:8959 with SMTP id r9-20020a814409000000b006044c558959mr935808ywa.20.1707169616705; Mon, 05 Feb 2024 13:46:56 -0800 (PST) Original-Received: from vader (68-252-220-225.lightspeed.tukrga.sbcglobal.net. [68.252.220.225]) by smtp.gmail.com with ESMTPSA id t186-20020a0deac3000000b005ffaaf886ecsm158775ywe.57.2024.02.05.13.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:46:56 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Sun, 28 Jan 2024 14:45:37 -0500") 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:279466 Archived-At: Stefan Monnier writes: >> diff --git a/lisp/skeleton.el b/lisp/skeleton.el >> index 89cb11b0fe2..24d6ef15e74 100644 >> --- a/lisp/skeleton.el >> +++ b/lisp/skeleton.el >> @@ -31,6 +31,8 @@ >> >> ;;; Code: >> >> +(require 'expand) >> + >> (eval-when-compile (require 'cl-lib)) >> >> ;; page 1: statement skeleton language definition & interpreter >> @@ -139,7 +141,14 @@ define-skeleton >> This is a way of overriding the use of a highlighted region.") >> (interactive "*P\nP") >> (atomic-change-group >> - (skeleton-proxy-new ',skeleton str arg))))) >> + (skeleton-proxy-new ',skeleton str arg)) >> + (if expand-in-progress-p >> + ;; `expand-abbrev-hook' will set the markers in this case. >> + (setq expand-list skeleton-positions) >> + (setq expand-index 0 >> + expand-pos (expand-list-to-markers skeleton-positions) >> + expand-list nil)) >> + t))) >> >> ;;;###autoload >> (defun skeleton-proxy-new (skeleton &optional str arg) > > I don't think we want such a tight dependency between `skeleton.el` and > `expand.el` [ Partly to avoid the kind of circular dependencies you > just found yourself in, but also more generally. ] > > My suggestion would be to move that code to the `skeleton-end-hook`, but > I see that's where the code started, so I'm obviously missing something: > what make you decide to move the code out of the `skeleton-end-hook` and > into `define-skeleton`? > > > Stefan Sorry for my late response. I had moved that code to the skeleton command definition because I thought I'd have to account for adding skeleton positions to `expand-pos' before expand.el had loaded. But since it turns out that expand.el loads skeleton.el anyway, it seems to makes more sense to follow your suggestion and put this change back on `skeleton-end-hook'. There's one problem though. The autoloaded keybindings for `expand-jump-to-next-slot' and `expand-jump-to-previous-slot' won't work the first time they're called on an expanded skeleton, unless the user has previously loaded expand.el. -- Best regards, Martin Marshall