Received: (at 68487) by debbugs.gnu.org; 2 May 2024 08:37:53 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 02 04:37:52 2024 Received: from localhost ([127.0.0.1]:42390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s2Rwu-0002h4-AW for submit <at> debbugs.gnu.org; Thu, 02 May 2024 04:37:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1s2Rwr-0002gy-OI for 68487 <at> debbugs.gnu.org; Thu, 02 May 2024 04:37:50 -0400 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 <eliz@HIDDEN>) id 1s2RwP-0003pZ-NI; Thu, 02 May 2024 04:37:22 -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=M2fxwEma0CGyQy2PDLPf7QdhQ7774lPeFRZ0eaMIvpk=; b=YDArPhvGPKwh 83UPfvECfp4sb5wDmYuujFyzvrOlUneCCSxd1i5q+zlY4YbRhAwwwtrhjpLvBLKh2iFQwkf2/bRuW 6cV9skKcDHw8x4QNEYH/R735Wm9reS+JQdb9kxYlx29+VGLwo/VMtJQijW6GWUR9TrPWPVrzZfuYl ZGnjeVoy85hZVRffF7SEMWSRVWcWjkAcW4vhBy7TXyJw6oUmRNdZWCkzaFKFvr9tHmxiRo+ogwtNq m2IWh17y8Jfe7X9gvMS7YnHh7l2sjyZfQDPMRhDBbX62x7Lxjf/EYnyWUB++yRQhBabXCVPPfK9/C s8z70ogbXLlayOTuK+Qp0Q==; Date: Thu, 02 May 2024 11:37:15 +0300 Message-Id: <86le4smwxw.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: law@HIDDEN In-Reply-To: <86edb3f3nj.fsf@HIDDEN> (message from Eli Zaretskii on Thu, 18 Apr 2024 11:58:40 +0300) Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> <87il316y4w.fsf@HIDDEN> <jwvy1bws07s.fsf-monnier+emacs@HIDDEN> <875xycyq0x.fsf@HIDDEN> <jwvedcsfczm.fsf-monnier+emacs@HIDDEN> <86o7bhb6ak.fsf@HIDDEN> <87h6gzxhan.fsf@HIDDEN> <868r1q50oa.fsf@HIDDEN> <86edb3f3nj.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org, monnier@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Ping! Ping! Martin, could you please respond? > Cc: 68487 <at> debbugs.gnu.org, monnier@HIDDEN > Date: Thu, 18 Apr 2024 11:58:40 +0300 > From: Eli Zaretskii <eliz@HIDDEN> > > Ping! Martin, did you have time to make any progress in this matter? > > > Cc: 68487 <at> debbugs.gnu.org, monnier@HIDDEN > > Date: Sat, 06 Apr 2024 11:56:53 +0300 > > From: Eli Zaretskii <eliz@HIDDEN> > > > > Any progress there? > > > > > From: martin <law@HIDDEN> > > > Cc: Stefan Monnier <monnier@HIDDEN>, 68487 <at> debbugs.gnu.org > > > Date: Thu, 21 Mar 2024 20:05:04 -0400 > > > > > > Eli Zaretskii <eliz@HIDDEN> writes: > > > > > > > Ping! Martin, can you please respond to Stefan's comments, so we > > > > could move forward with this issue? > > > > > > Sorry for the long delay in responding. I'll try to get to this by the > > > end of the weekend. > > > > > > > > > >> Cc: 68487 <at> debbugs.gnu.org > > > >> Date: Sat, 02 Mar 2024 23:07:18 -0500 > > > >> From: Stefan Monnier via "Bug reports for GNU Emacs, > > > >> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> > > > >> > > > >> >> Ideally this should go along with the removal of the use of a vector in > > > >> >> `expand-list`, which not only is odd given its name but is odd because > > > >> >> it seems completely useless. > > > >> > > > > >> > Nothing (at least nothing in Emacs core) stores a vector to > > > >> > `expand-list`. So I'm curious why `expand-abbrev-hook` was written to > > > >> > account for that possibility. > > > >> > > > >> It's because it internally did that, tho I don't know why it did that > > > >> internally since my patch seems to show that it's simpler not to. > > > >> > > > >> > Changing `expand-abbrev-hook` to expect `expand-list` to actually be a > > > >> > list (as you did with your patch) makes sense to me. > > > >> > > > >> Should I install it, so it's kept separate from the changes you add > > > >> on top (mostly for readability of the patches)? > > > >> > > > >> > What do you think? > > > >> > > > >> I find the patch a bit hard to read, maybe for lack of a separate > > > >> description of the intended changes, or maybe because it does too much > > > >> in a single step. > > > >> > > > >> I have one question, tho: > > > >> > > > >> > (defun expand-do-expansion () > > > >> > - (delete-char (- (length last-abbrev-text))) > > > >> > - (let* ((vect (symbol-value last-abbrev)) > > > >> > - (text (aref vect 0)) > > > >> > - (position (aref vect 1)) > > > >> > - (jump-args (aref vect 2)) > > > >> > - (hook (aref vect 3))) > > > >> > - (cond (text > > > >> > - (insert text) > > > >> > - (setq expand-point (point)))) > > > >> > - (if jump-args > > > >> > - (funcall #'expand-build-list (car jump-args) (cdr jump-args))) > > > >> > - (if position > > > >> > - (backward-char position)) > > > >> > - (if hook > > > >> > - (funcall hook)) > > > >> > - t)) > > > >> > - > > > >> > -(defun expand-abbrev-from-expand (word) > > > >> > - "Test if an abbrev has a hook." > > > >> > - (or > > > >> > - (and (intern-soft word local-abbrev-table) > > > >> > - (symbol-function (intern-soft word local-abbrev-table))) > > > >> > - (and (intern-soft word global-abbrev-table) > > > >> > - (symbol-function (intern-soft word global-abbrev-table))))) > > > >> > - > > > >> > -(defun expand-previous-word () > > > >> > - "Return the previous word." > > > >> > - (save-excursion > > > >> > - (let ((p (point))) > > > >> > - (backward-word 1) > > > >> > - (buffer-substring p (point))))) > > > >> > + ;; expand-point tells us if we have inserted the text > > > >> > + ;; ourself or if it is the hook which has done the job. > > > >> > + (if (listp expand-list) > > > >> > + (setq expand-index 0 > > > >> > + expand-pos (expand-list-to-markers expand-list) > > > >> > + expand-list nil)) > > > >> > + (run-hooks 'expand-expand-hook)) > > > >> > > > >> Hmm... but this `expand-do-expansion` doesn't actually "do" any > > > >> expansion any more, right? > > > >> > > > >> > (defun expand-skeleton-end-hook () > > > >> > - (if skeleton-positions > > > >> > - (setq expand-list skeleton-positions))) > > > >> > + (when skeleton-positions > > > >> > + (setq expand-list skeleton-positions) > > > >> > + (expand-do-expansion))) > > > >> > > > >> Here if you read the code out loud it doesn't make sense to call > > > >> `expand-do-expansion` since skeleton has already "done the expansion". > > > >> > > > >> > > > >> Stefan > > > >> > > > >> > > > >> > > > >> > > > >> > > > > > > -- > > > Best regards, > > > Martin Marshall > > > > > > > > > > > > > > >
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 18 Apr 2024 08:59:20 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 18 04:59:19 2024 Received: from localhost ([127.0.0.1]:51147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rxNbu-0007mg-Nz for submit <at> debbugs.gnu.org; Thu, 18 Apr 2024 04:59:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1rxNbk-0007jv-7y for 68487 <at> debbugs.gnu.org; Thu, 18 Apr 2024 04:59:08 -0400 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 <eliz@HIDDEN>) id 1rxNbR-0008M5-Cp; Thu, 18 Apr 2024 04:58:45 -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=9v35MCMuyLqwOn5Dzy7OAYkhpEi7bdm+LxH9bQleM0k=; b=XFAGIapbJ9wn KT/l12A99FeOOSyVWrzo+NModtKCuUUa1yeOx0pyYnwTcKm07kmq0r16fy6OW2J6sfWD/NZpoEcv2 4MpHLv8Vy+ICETVIPC0cuEGL6g+vlfWw7aIkC2C8+c5naXcRn1BrbN+drkU/O+XIwELphCh2OJgrC Pv4yY/xAqwtdfMzsqgzVEmEM7LeFKubndGlhPQJj6vK7nUGDH7w/HKDov8SsB1wyqRECMTiNl84L/ 5eaBZABzF9u0AtQpU18Yv0h/rwoj5WTnhdG841XjbAAd4cwC87dA6geTLXq86qDe9Nf4NsfTCUadm /5FrZucg+cerN4yfbzcPMA==; Date: Thu, 18 Apr 2024 11:58:40 +0300 Message-Id: <86edb3f3nj.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: law@HIDDEN In-Reply-To: <868r1q50oa.fsf@HIDDEN> (message from Eli Zaretskii on Sat, 06 Apr 2024 11:56:53 +0300) Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> <87il316y4w.fsf@HIDDEN> <jwvy1bws07s.fsf-monnier+emacs@HIDDEN> <875xycyq0x.fsf@HIDDEN> <jwvedcsfczm.fsf-monnier+emacs@HIDDEN> <86o7bhb6ak.fsf@HIDDEN> <87h6gzxhan.fsf@HIDDEN> <868r1q50oa.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org, monnier@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Ping! Martin, did you have time to make any progress in this matter? > Cc: 68487 <at> debbugs.gnu.org, monnier@HIDDEN > Date: Sat, 06 Apr 2024 11:56:53 +0300 > From: Eli Zaretskii <eliz@HIDDEN> > > Any progress there? > > > From: martin <law@HIDDEN> > > Cc: Stefan Monnier <monnier@HIDDEN>, 68487 <at> debbugs.gnu.org > > Date: Thu, 21 Mar 2024 20:05:04 -0400 > > > > Eli Zaretskii <eliz@HIDDEN> writes: > > > > > Ping! Martin, can you please respond to Stefan's comments, so we > > > could move forward with this issue? > > > > Sorry for the long delay in responding. I'll try to get to this by the > > end of the weekend. > > > > > > >> Cc: 68487 <at> debbugs.gnu.org > > >> Date: Sat, 02 Mar 2024 23:07:18 -0500 > > >> From: Stefan Monnier via "Bug reports for GNU Emacs, > > >> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> > > >> > > >> >> Ideally this should go along with the removal of the use of a vector in > > >> >> `expand-list`, which not only is odd given its name but is odd because > > >> >> it seems completely useless. > > >> > > > >> > Nothing (at least nothing in Emacs core) stores a vector to > > >> > `expand-list`. So I'm curious why `expand-abbrev-hook` was written to > > >> > account for that possibility. > > >> > > >> It's because it internally did that, tho I don't know why it did that > > >> internally since my patch seems to show that it's simpler not to. > > >> > > >> > Changing `expand-abbrev-hook` to expect `expand-list` to actually be a > > >> > list (as you did with your patch) makes sense to me. > > >> > > >> Should I install it, so it's kept separate from the changes you add > > >> on top (mostly for readability of the patches)? > > >> > > >> > What do you think? > > >> > > >> I find the patch a bit hard to read, maybe for lack of a separate > > >> description of the intended changes, or maybe because it does too much > > >> in a single step. > > >> > > >> I have one question, tho: > > >> > > >> > (defun expand-do-expansion () > > >> > - (delete-char (- (length last-abbrev-text))) > > >> > - (let* ((vect (symbol-value last-abbrev)) > > >> > - (text (aref vect 0)) > > >> > - (position (aref vect 1)) > > >> > - (jump-args (aref vect 2)) > > >> > - (hook (aref vect 3))) > > >> > - (cond (text > > >> > - (insert text) > > >> > - (setq expand-point (point)))) > > >> > - (if jump-args > > >> > - (funcall #'expand-build-list (car jump-args) (cdr jump-args))) > > >> > - (if position > > >> > - (backward-char position)) > > >> > - (if hook > > >> > - (funcall hook)) > > >> > - t)) > > >> > - > > >> > -(defun expand-abbrev-from-expand (word) > > >> > - "Test if an abbrev has a hook." > > >> > - (or > > >> > - (and (intern-soft word local-abbrev-table) > > >> > - (symbol-function (intern-soft word local-abbrev-table))) > > >> > - (and (intern-soft word global-abbrev-table) > > >> > - (symbol-function (intern-soft word global-abbrev-table))))) > > >> > - > > >> > -(defun expand-previous-word () > > >> > - "Return the previous word." > > >> > - (save-excursion > > >> > - (let ((p (point))) > > >> > - (backward-word 1) > > >> > - (buffer-substring p (point))))) > > >> > + ;; expand-point tells us if we have inserted the text > > >> > + ;; ourself or if it is the hook which has done the job. > > >> > + (if (listp expand-list) > > >> > + (setq expand-index 0 > > >> > + expand-pos (expand-list-to-markers expand-list) > > >> > + expand-list nil)) > > >> > + (run-hooks 'expand-expand-hook)) > > >> > > >> Hmm... but this `expand-do-expansion` doesn't actually "do" any > > >> expansion any more, right? > > >> > > >> > (defun expand-skeleton-end-hook () > > >> > - (if skeleton-positions > > >> > - (setq expand-list skeleton-positions))) > > >> > + (when skeleton-positions > > >> > + (setq expand-list skeleton-positions) > > >> > + (expand-do-expansion))) > > >> > > >> Here if you read the code out loud it doesn't make sense to call > > >> `expand-do-expansion` since skeleton has already "done the expansion". > > >> > > >> > > >> Stefan > > >> > > >> > > >> > > >> > > >> > > > > -- > > Best regards, > > Martin Marshall > > > > > >
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 6 Apr 2024 08:57:11 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 06 04:57:11 2024 Received: from localhost ([127.0.0.1]:38232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rt1rL-0006oa-5W for submit <at> debbugs.gnu.org; Sat, 06 Apr 2024 04:57:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1rt1rI-0006oG-Bl for 68487 <at> debbugs.gnu.org; Sat, 06 Apr 2024 04:57:09 -0400 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 <eliz@HIDDEN>) id 1rt1r5-0007SH-8t; Sat, 06 Apr 2024 04:56:55 -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=FOeZ/sTA2SfxX8hEjx8aTMO9KhdEI9+N09bUrCsr/s0=; b=IxIw0T/9AbNv 0a8/scOKkjLVTpzhHtgvS7XOoSmsbHySZ6WEnXxrEAPgO2wTboqSAHtT6+dQNpYWUeOOor3OPmXyQ 4vP31jO1WZSgPh3LB5LFBFD8nf4A2G6bToGaioE5yVuWnQa1hsLnWRVxDj/+SaXZ0HtS4QqPkUI1o QyVECYWpeJRSsEnXe/jSuNcQNz1ugggc6qMijsp4IfVjpK58Wf7dm4thhEUDoxPS/t8lhG0F/boNM cdyFGN+deugWqMeZhN3iRwidGHn5/5zpeoqCV6bgMgIRuktefizQ//tokNFNjtuQxztBbrRziH23t k7pX+AY1sOcK6gcjqECYxw==; Date: Sat, 06 Apr 2024 11:56:53 +0300 Message-Id: <868r1q50oa.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: martin <law@HIDDEN> In-Reply-To: <87h6gzxhan.fsf@HIDDEN> (message from martin on Thu, 21 Mar 2024 20:05:04 -0400) Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> <87il316y4w.fsf@HIDDEN> <jwvy1bws07s.fsf-monnier+emacs@HIDDEN> <875xycyq0x.fsf@HIDDEN> <jwvedcsfczm.fsf-monnier+emacs@HIDDEN> <86o7bhb6ak.fsf@HIDDEN> <87h6gzxhan.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org, monnier@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Any progress there? > From: martin <law@HIDDEN> > Cc: Stefan Monnier <monnier@HIDDEN>, 68487 <at> debbugs.gnu.org > Date: Thu, 21 Mar 2024 20:05:04 -0400 > > Eli Zaretskii <eliz@HIDDEN> writes: > > > Ping! Martin, can you please respond to Stefan's comments, so we > > could move forward with this issue? > > Sorry for the long delay in responding. I'll try to get to this by the > end of the weekend. > > > >> Cc: 68487 <at> debbugs.gnu.org > >> Date: Sat, 02 Mar 2024 23:07:18 -0500 > >> From: Stefan Monnier via "Bug reports for GNU Emacs, > >> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> > >> > >> >> Ideally this should go along with the removal of the use of a vector in > >> >> `expand-list`, which not only is odd given its name but is odd because > >> >> it seems completely useless. > >> > > >> > Nothing (at least nothing in Emacs core) stores a vector to > >> > `expand-list`. So I'm curious why `expand-abbrev-hook` was written to > >> > account for that possibility. > >> > >> It's because it internally did that, tho I don't know why it did that > >> internally since my patch seems to show that it's simpler not to. > >> > >> > Changing `expand-abbrev-hook` to expect `expand-list` to actually be a > >> > list (as you did with your patch) makes sense to me. > >> > >> Should I install it, so it's kept separate from the changes you add > >> on top (mostly for readability of the patches)? > >> > >> > What do you think? > >> > >> I find the patch a bit hard to read, maybe for lack of a separate > >> description of the intended changes, or maybe because it does too much > >> in a single step. > >> > >> I have one question, tho: > >> > >> > (defun expand-do-expansion () > >> > - (delete-char (- (length last-abbrev-text))) > >> > - (let* ((vect (symbol-value last-abbrev)) > >> > - (text (aref vect 0)) > >> > - (position (aref vect 1)) > >> > - (jump-args (aref vect 2)) > >> > - (hook (aref vect 3))) > >> > - (cond (text > >> > - (insert text) > >> > - (setq expand-point (point)))) > >> > - (if jump-args > >> > - (funcall #'expand-build-list (car jump-args) (cdr jump-args))) > >> > - (if position > >> > - (backward-char position)) > >> > - (if hook > >> > - (funcall hook)) > >> > - t)) > >> > - > >> > -(defun expand-abbrev-from-expand (word) > >> > - "Test if an abbrev has a hook." > >> > - (or > >> > - (and (intern-soft word local-abbrev-table) > >> > - (symbol-function (intern-soft word local-abbrev-table))) > >> > - (and (intern-soft word global-abbrev-table) > >> > - (symbol-function (intern-soft word global-abbrev-table))))) > >> > - > >> > -(defun expand-previous-word () > >> > - "Return the previous word." > >> > - (save-excursion > >> > - (let ((p (point))) > >> > - (backward-word 1) > >> > - (buffer-substring p (point))))) > >> > + ;; expand-point tells us if we have inserted the text > >> > + ;; ourself or if it is the hook which has done the job. > >> > + (if (listp expand-list) > >> > + (setq expand-index 0 > >> > + expand-pos (expand-list-to-markers expand-list) > >> > + expand-list nil)) > >> > + (run-hooks 'expand-expand-hook)) > >> > >> Hmm... but this `expand-do-expansion` doesn't actually "do" any > >> expansion any more, right? > >> > >> > (defun expand-skeleton-end-hook () > >> > - (if skeleton-positions > >> > - (setq expand-list skeleton-positions))) > >> > + (when skeleton-positions > >> > + (setq expand-list skeleton-positions) > >> > + (expand-do-expansion))) > >> > >> Here if you read the code out loud it doesn't make sense to call > >> `expand-do-expansion` since skeleton has already "done the expansion". > >> > >> > >> Stefan > >> > >> > >> > >> > >> > > -- > Best regards, > Martin Marshall >
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 22 Mar 2024 00:15:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 21 20:15:18 2024 Received: from localhost ([127.0.0.1]:48846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rnSZ3-0006dz-Qy for submit <at> debbugs.gnu.org; Thu, 21 Mar 2024 20:15:18 -0400 Received: from mail-qv1-f53.google.com ([209.85.219.53]:46491) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <law@HIDDEN>) id 1rnSZ1-0006db-DR for 68487 <at> debbugs.gnu.org; Thu, 21 Mar 2024 20:15:16 -0400 Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-68f41af71ebso12686136d6.1 for <68487 <at> debbugs.gnu.org>; Thu, 21 Mar 2024 17:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martinmarshall-com.20230601.gappssmtp.com; s=20230601; t=1711066409; x=1711671209; 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=Pbete4xl1t/7pV3GKnXNOw/tg96D9nML6GEHZpy4jXg=; b=kPNzUC67dIFVteOu5D4ER7dbtZ0519Gr3QzSE3Rnw+CM+vBjZlE63eKU4/8iFprjrw PVEI7ynzuUManLe12FfEyTMFxWf0/xkpsJJyV4AmM7Pd3/ArQ0MbVZNF8dd46zIPituN VZ03wIkkdBeTQ3tjsSJtdv+H9zRq/AW95ET9+4TPWvm3SOm2fAFYOAXxwmHJQpEOWjk7 IbcEVnkWsdNSNjJeo6RNtkGBIW7ydcLxz4YNbMB0RnC3tudHCXQD0YgPVS5Z++J/mG0L wDFIneX0/oL4vFdOTzNzqydfkcu6fqCZn2WL3128JYoGymj/ZxexctPVnXlkMdPQRoM6 hapQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711066409; x=1711671209; 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=Pbete4xl1t/7pV3GKnXNOw/tg96D9nML6GEHZpy4jXg=; b=hUANV/7F1pUCrrA2JQsXImMbAXnyEYdSCUHSrsVJ5u8v3f0DqsKCoeqgIJWJyi0Ayv HRtGwwsfauwhyWNkWsBI8SH0WRiQcKJme47kvl3rXFgAtiHeYz/7elf8Rxwi3LVntFoa uYaOrB+AtmhcAUigznjIgJyhgiFl/lUGtV03vtbP8eADPXSq6mgVLIkIu6twjN2nybZx lV8ZMnfw9C7XTDeDA7VxJwXkJhD6yBv9ieaw85I2jE1SJgJLAh+yQH2JT8ketVySFfwt Am7eiFCBT3QVpqCzWtrJY2BeVOsC56sm+GyOyeoI2mkvFqGwa5Bq66YT1sOfjhV5bK29 ukxQ== X-Forwarded-Encrypted: i=1; AJvYcCWs77t8Hc0NyM9b3ROgIPKG3o1r9nOYPa7R8Hn2g8hszF7NsjTcJP1avjO+6a35SEZPDHZsvAiORJsjKehsDe38foGdu3Q= X-Gm-Message-State: AOJu0YzNpXMdiLyl31W47VeoB0gGBYWowG0ia9S31UBgrrvYsrmZrt6i 6Eo5x0XDuQ3Dc3o0B3kTYqNXTww2WW2TbEQljEuRSDagEgRFMnkhQIn/u/JguFmRGVPT6k5yOtc = X-Google-Smtp-Source: AGHT+IHI6PgSWSCTczHPhBNO3ipkQ0WpSIg9WPPx4zok5ZauDcnjTGcTPHgEdTQ9Fqo/kIMl7UFylA== X-Received: by 2002:a0d:d202:0:b0:60a:5031:2de9 with SMTP id u2-20020a0dd202000000b0060a50312de9mr799894ywd.51.1711065925534; Thu, 21 Mar 2024 17:05:25 -0700 (PDT) Received: from vader (68-252-220-225.lightspeed.tukrga.sbcglobal.net. [68.252.220.225]) by smtp.gmail.com with ESMTPSA id gj6-20020a05690c428600b00610e03c9fe8sm157743ywb.103.2024.03.21.17.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 17:05:25 -0700 (PDT) From: martin <law@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <86o7bhb6ak.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 14 Mar 2024 09:50:59 +0200") References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> <87il316y4w.fsf@HIDDEN> <jwvy1bws07s.fsf-monnier+emacs@HIDDEN> <875xycyq0x.fsf@HIDDEN> <jwvedcsfczm.fsf-monnier+emacs@HIDDEN> <86o7bhb6ak.fsf@HIDDEN> Date: Thu, 21 Mar 2024 20:05:04 -0400 Message-ID: <87h6gzxhan.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: > Ping! Martin, can you please respond to Stefan's comments, so we > could move forward with this issue? Sorry for the long delay in responding. I'll try to get to this by the end of the weekend. >> Cc: 68487 <at> debbugs.gnu.org >> Date: Sat, 02 Mar 2024 23:07:18 -0500 >> From: Stefan Monnier via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> >> >> >> Ideally this should go along with the removal of the use of a vector in >> >> `expand-list`, which not only is odd given its name but is odd because >> >> it seems completely useless. >> > >> > Nothing (at least nothing in Emacs core) stores a vector to >> > `expand-list`. So I'm curious why `expand-abbrev-hook` was written to >> > account for that possibility. >> >> It's because it internally did that, tho I don't know why it did that >> internally since my patch seems to show that it's simpler not to. >> >> > Changing `expand-abbrev-hook` to expect `expand-list` to actually be a >> > list (as you did with your patch) makes sense to me. >> >> Should I install it, so it's kept separate from the changes you add >> on top (mostly for readability of the patches)? >> >> > What do you think? >> >> I find the patch a bit hard to read, maybe for lack of a separate >> description of the intended changes, or maybe because it does too much >> in a single step. >> >> I have one question, tho: >> >> > (defun expand-do-expansion () >> > - (delete-char (- (length last-abbrev-text))) >> > - (let* ((vect (symbol-value last-abbrev)) >> > - (text (aref vect 0)) >> > - (position (aref vect 1)) >> > - (jump-args (aref vect 2)) >> > - (hook (aref vect 3))) >> > - (cond (text >> > - (insert text) >> > - (setq expand-point (point)))) >> > - (if jump-args >> > - (funcall #'expand-build-list (car jump-args) (cdr jump-args))) >> > - (if position >> > - (backward-char position)) >> > - (if hook >> > - (funcall hook)) >> > - t)) >> > - >> > -(defun expand-abbrev-from-expand (word) >> > - "Test if an abbrev has a hook." >> > - (or >> > - (and (intern-soft word local-abbrev-table) >> > - (symbol-function (intern-soft word local-abbrev-table))) >> > - (and (intern-soft word global-abbrev-table) >> > - (symbol-function (intern-soft word global-abbrev-table))))) >> > - >> > -(defun expand-previous-word () >> > - "Return the previous word." >> > - (save-excursion >> > - (let ((p (point))) >> > - (backward-word 1) >> > - (buffer-substring p (point))))) >> > + ;; expand-point tells us if we have inserted the text >> > + ;; ourself or if it is the hook which has done the job. >> > + (if (listp expand-list) >> > + (setq expand-index 0 >> > + expand-pos (expand-list-to-markers expand-list) >> > + expand-list nil)) >> > + (run-hooks 'expand-expand-hook)) >> >> Hmm... but this `expand-do-expansion` doesn't actually "do" any >> expansion any more, right? >> >> > (defun expand-skeleton-end-hook () >> > - (if skeleton-positions >> > - (setq expand-list skeleton-positions))) >> > + (when skeleton-positions >> > + (setq expand-list skeleton-positions) >> > + (expand-do-expansion))) >> >> Here if you read the code out loud it doesn't make sense to call >> `expand-do-expansion` since skeleton has already "done the expansion". >> >> >> Stefan >> >> >> >> >> -- Best regards, Martin Marshall
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 14 Mar 2024 07:52:12 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 14 03:52:12 2024 Received: from localhost ([127.0.0.1]:48153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rkfsq-0006n0-74 for submit <at> debbugs.gnu.org; Thu, 14 Mar 2024 03:52:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1rkfsn-0006mc-69 for 68487 <at> debbugs.gnu.org; Thu, 14 Mar 2024 03:52:09 -0400 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 <eliz@HIDDEN>) id 1rkfs6-0006aK-BR; Thu, 14 Mar 2024 03:51:28 -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=wq0oPYqr7FUZAwBsvWVwBSpuvvTNa3oyMr126r/6Jhk=; b=YMdMp/+2BlGA bRL0JZ2ZZpOhMNgVPQPEj9NaHX2MwGyJ4Gmufmf26MOIvo0G+mUa3w1U/R3p2jBm4Aw4QXL+TJRRR PKUSxOA3n3ADrcNUiImh6620+nY9IMVjxol2L+FVY9qxuH7BP6X0EyW38pbpoimd7OuMvwhYmKWGV c7krjztqBtUfgEZ84LznVndHhrUm5Uk0lyKYX7PgXF9J4bSefQ4NIMieMFhER9UBRtbSge1PJY5sG s4EpjDXrlYNP/j/Tlav0O+9fSqin8YzjG1hUEhJuajHvzmXbvnrvPJw40nildIbQvpgvg3IrMl0Nf 0U6E8H8LMBiFvcuRF+nFTg==; Date: Thu, 14 Mar 2024 09:50:59 +0200 Message-Id: <86o7bhb6ak.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: law@HIDDEN, Stefan Monnier <monnier@HIDDEN> In-Reply-To: <jwvedcsfczm.fsf-monnier+emacs@HIDDEN> (bug-gnu-emacs@HIDDEN) Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> <87il316y4w.fsf@HIDDEN> <jwvy1bws07s.fsf-monnier+emacs@HIDDEN> <875xycyq0x.fsf@HIDDEN> <jwvedcsfczm.fsf-monnier+emacs@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Ping! Martin, can you please respond to Stefan's comments, so we could move forward with this issue? > Cc: 68487 <at> debbugs.gnu.org > Date: Sat, 02 Mar 2024 23:07:18 -0500 > From: Stefan Monnier via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> > > >> Ideally this should go along with the removal of the use of a vector in > >> `expand-list`, which not only is odd given its name but is odd because > >> it seems completely useless. > > > > Nothing (at least nothing in Emacs core) stores a vector to > > `expand-list`. So I'm curious why `expand-abbrev-hook` was written to > > account for that possibility. > > It's because it internally did that, tho I don't know why it did that > internally since my patch seems to show that it's simpler not to. > > > Changing `expand-abbrev-hook` to expect `expand-list` to actually be a > > list (as you did with your patch) makes sense to me. > > Should I install it, so it's kept separate from the changes you add > on top (mostly for readability of the patches)? > > > What do you think? > > I find the patch a bit hard to read, maybe for lack of a separate > description of the intended changes, or maybe because it does too much > in a single step. > > I have one question, tho: > > > (defun expand-do-expansion () > > - (delete-char (- (length last-abbrev-text))) > > - (let* ((vect (symbol-value last-abbrev)) > > - (text (aref vect 0)) > > - (position (aref vect 1)) > > - (jump-args (aref vect 2)) > > - (hook (aref vect 3))) > > - (cond (text > > - (insert text) > > - (setq expand-point (point)))) > > - (if jump-args > > - (funcall #'expand-build-list (car jump-args) (cdr jump-args))) > > - (if position > > - (backward-char position)) > > - (if hook > > - (funcall hook)) > > - t)) > > - > > -(defun expand-abbrev-from-expand (word) > > - "Test if an abbrev has a hook." > > - (or > > - (and (intern-soft word local-abbrev-table) > > - (symbol-function (intern-soft word local-abbrev-table))) > > - (and (intern-soft word global-abbrev-table) > > - (symbol-function (intern-soft word global-abbrev-table))))) > > - > > -(defun expand-previous-word () > > - "Return the previous word." > > - (save-excursion > > - (let ((p (point))) > > - (backward-word 1) > > - (buffer-substring p (point))))) > > + ;; expand-point tells us if we have inserted the text > > + ;; ourself or if it is the hook which has done the job. > > + (if (listp expand-list) > > + (setq expand-index 0 > > + expand-pos (expand-list-to-markers expand-list) > > + expand-list nil)) > > + (run-hooks 'expand-expand-hook)) > > Hmm... but this `expand-do-expansion` doesn't actually "do" any > expansion any more, right? > > > (defun expand-skeleton-end-hook () > > - (if skeleton-positions > > - (setq expand-list skeleton-positions))) > > + (when skeleton-positions > > + (setq expand-list skeleton-positions) > > + (expand-do-expansion))) > > Here if you read the code out loud it doesn't make sense to call > `expand-do-expansion` since skeleton has already "done the expansion". > > > Stefan > > > > >
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 3 Mar 2024 04:08:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 02 23:08:04 2024 Received: from localhost ([127.0.0.1]:39542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rgd8u-0004at-CR for submit <at> debbugs.gnu.org; Sat, 02 Mar 2024 23:08:04 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53620) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1rgd8q-0004aM-VV for 68487 <at> debbugs.gnu.org; Sat, 02 Mar 2024 23:08:02 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C58E480AD4; Sat, 2 Mar 2024 23:07:25 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1709438840; bh=aCtZutSPBZrt2NVcGWjTNCm5zUbEg2k/SpFU5YrIayc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mM1lpAR9g9ThCldPrBycl7x5hYZlCSnjaV4WEdWzY7mRnckPFYnxEVbGpOZ7ruSQm HH56Dj14gMf4rHYgqbQKNFPNcKtN0lhH4Zs6M2BW5zL0Xpk0CFn2uKZg0bVuTTwJi2 roy5vGeJSjDOHDqnqRBt+s/pY7m9qj/8EhRLL7tErJJKm6ataGW46qjc96nNaZwGHW ITisr9dzj2Uh1l+dOt1qoXSGKPc2kc69X4WpCbIo7QduRTRSN/I+IXqg4bLO1Rf8yS QfAZQnaEcVEBxymKk0DW4FqVl6vv2ne+r5FYYwXIR2IUAYppkx+nGTSr2hnjFJCnGb r+4jWQSItwI3Q== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7284D804BC; Sat, 2 Mar 2024 23:07:20 -0500 (EST) Received: from pastel (unknown [216.154.1.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4B3B6120749; Sat, 2 Mar 2024 23:07:20 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: Martin Marshall <law@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <875xycyq0x.fsf@HIDDEN> (Martin Marshall's message of "Sun, 25 Feb 2024 20:26:22 -0500") Message-ID: <jwvedcsfczm.fsf-monnier+emacs@HIDDEN> References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> <87il316y4w.fsf@HIDDEN> <jwvy1bws07s.fsf-monnier+emacs@HIDDEN> <875xycyq0x.fsf@HIDDEN> Date: Sat, 02 Mar 2024 23:07:18 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) >> Ideally this should go along with the removal of the use of a vector in >> `expand-list`, which not only is odd given its name but is odd because >> it seems completely useless. > > Nothing (at least nothing in Emacs core) stores a vector to > `expand-list`. So I'm curious why `expand-abbrev-hook` was written to > account for that possibility. It's because it internally did that, tho I don't know why it did that internally since my patch seems to show that it's simpler not to. > Changing `expand-abbrev-hook` to expect `expand-list` to actually be a > list (as you did with your patch) makes sense to me. Should I install it, so it's kept separate from the changes you add on top (mostly for readability of the patches)? > What do you think? I find the patch a bit hard to read, maybe for lack of a separate description of the intended changes, or maybe because it does too much in a single step. I have one question, tho: > (defun expand-do-expansion () > - (delete-char (- (length last-abbrev-text))) > - (let* ((vect (symbol-value last-abbrev)) > - (text (aref vect 0)) > - (position (aref vect 1)) > - (jump-args (aref vect 2)) > - (hook (aref vect 3))) > - (cond (text > - (insert text) > - (setq expand-point (point)))) > - (if jump-args > - (funcall #'expand-build-list (car jump-args) (cdr jump-args))) > - (if position > - (backward-char position)) > - (if hook > - (funcall hook)) > - t)) > - > -(defun expand-abbrev-from-expand (word) > - "Test if an abbrev has a hook." > - (or > - (and (intern-soft word local-abbrev-table) > - (symbol-function (intern-soft word local-abbrev-table))) > - (and (intern-soft word global-abbrev-table) > - (symbol-function (intern-soft word global-abbrev-table))))) > - > -(defun expand-previous-word () > - "Return the previous word." > - (save-excursion > - (let ((p (point))) > - (backward-word 1) > - (buffer-substring p (point))))) > + ;; expand-point tells us if we have inserted the text > + ;; ourself or if it is the hook which has done the job. > + (if (listp expand-list) > + (setq expand-index 0 > + expand-pos (expand-list-to-markers expand-list) > + expand-list nil)) > + (run-hooks 'expand-expand-hook)) Hmm... but this `expand-do-expansion` doesn't actually "do" any expansion any more, right? > (defun expand-skeleton-end-hook () > - (if skeleton-positions > - (setq expand-list skeleton-positions))) > + (when skeleton-positions > + (setq expand-list skeleton-positions) > + (expand-do-expansion))) Here if you read the code out loud it doesn't make sense to call `expand-do-expansion` since skeleton has already "done the expansion". Stefan
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 26 Feb 2024 01:27:58 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 25 20:27:58 2024 Received: from localhost ([127.0.0.1]:41346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rePmf-0007pJ-8L for submit <at> debbugs.gnu.org; Sun, 25 Feb 2024 20:27:58 -0500 Received: from mail-yw1-f169.google.com ([209.85.128.169]:61743) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <law@HIDDEN>) id 1rePmc-0007os-Ol for 68487 <at> debbugs.gnu.org; Sun, 25 Feb 2024 20:27:56 -0500 Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-608959cfcbfso24930877b3.3 for <68487 <at> debbugs.gnu.org>; Sun, 25 Feb 2024 17:27:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martinmarshall-com.20230601.gappssmtp.com; s=20230601; t=1708910784; x=1709515584; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:organization:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=6CwdxYwX+BMKHxtnYeQ5iPf88ydSq4uUw/23c1saNpI=; b=mLH4kga1lMJNq8yUK6TnMuIcy+KVLPu6CcM9X00N3Ldq+CTY3AR5WkqlUF0RQilVNc 5jh5n742AcXfEiR91PhT7t8B8RLXLa/t5N0cixAl3F6yn2T6ZgQNGbFcY+N+GVqsP5l5 VZvojPhjMI8pednl7wl/Ahe/Cbka75op+DaOKgAgd2WF2kaNYBzs/SEC68gAJdx8XnqK 78KIbK2Zo6mD/edhI9q5SYPf9jsQ8yU7KyeGi57w4/3Fr8vW5R4h3+Y+3dcB7nuaZ0Au qjvKFFjwdHCwv+M7K2O9mbTY54Ba/N9amFdJnZy+RuJ0MZsd9eJ+QN2jPXv3qRLd5I8j qU9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708910784; x=1709515584; h=mime-version:message-id:date:references:organization:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6CwdxYwX+BMKHxtnYeQ5iPf88ydSq4uUw/23c1saNpI=; b=CnqZvYS6sEJkTjcIFQy4I+Au14vQC77d1UcR5j6m14JqF76h0zStFL98GxjhNdycc0 XFWKFg9AYm0GBFlPAi2ZbPyBsebr2V726or4C3HLAP8GzW/+7OS/WZU62rDWMmoipUZK eYJqFVxLZPZXd+6+iECnZvAQdlImtHOpQwrK9f8ycMOoiSqtjx29Vof8OLdsbOjHRRKu Kkrxw89DH4qfNrOZWjjXej2OeEOystwWwk15UE5fuuFUGW/FI6pbGNCoL+UZlNg0GCsQ v5pZRou25fqZK+bfY4ZlQxAMCdM9y2O//o+vh5Ky/PLHURDoTWnxe/bRTzyBEeVqF8HP 453Q== X-Gm-Message-State: AOJu0Yz7q404g55d9KYfTbXlvbQ09outiD+HwwDX5jMCYJwEECKtvaIz /i5fxRUW3pRa3QJxfxKNVEI88TMyDvbOmnqvr1EAwbvysyb95oT7xAh52yIyuRz1eSwS1HLQ/VI = X-Google-Smtp-Source: AGHT+IE7vqugEsyp99qrnubpfykf0uF7ZzeP430yFVab+6bhaPXxTaXksB3hifgzsgymi8Uvb2Gguw== X-Received: by 2002:a81:b64f:0:b0:608:8a6b:b213 with SMTP id h15-20020a81b64f000000b006088a6bb213mr5874911ywk.33.1708910783695; Sun, 25 Feb 2024 17:26:23 -0800 (PST) Received: from vader (68-252-220-225.lightspeed.tukrga.sbcglobal.net. [68.252.220.225]) by smtp.gmail.com with ESMTPSA id i184-20020a0dc6c1000000b00607e72b478csm960386ywd.133.2024.02.25.17.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 17:26:23 -0800 (PST) From: Martin Marshall <law@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <jwvy1bws07s.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message of "Wed, 07 Feb 2024 12:13:11 -0500") Organization: The Marshall Firm, LLC References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> <87il316y4w.fsf@HIDDEN> <jwvy1bws07s.fsf-monnier+emacs@HIDDEN> Date: Sun, 25 Feb 2024 20:26:22 -0500 Message-ID: <875xycyq0x.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Finally got around to looking at this again. Stefan Monnier <monnier@HIDDEN> writes: > I'm having trouble understanding the design behind `expand.el`, but IIUC > `expand-list` is basically the variable through which interaction with > other things is expected to take place, so I think it's fair to make > `skeleton.el` set `expand-list` whereas `expand-pos/index` seem like > internal vars and `skeleton.el` shouldn't touch them. That sounds right. But outside code also needs a way to trigger population of `expand-pos` from `expand-list`. I tried to do this with some of the new changes copied below. > Ideally this should go along with the removal of the use of a vector in > `expand-list`, which not only is odd given its name but is odd because > it seems completely useless. Nothing (at least nothing in Emacs core) stores a vector to `expand-list`. So I'm curious why `expand-abbrev-hook` was written to account for that possibility. Changing `expand-abbrev-hook` to expect `expand-list` to actually be a list (as you did with your patch) makes sense to me. > IOW my reading of the code suggests the code would work just as well > with the patch below. Yes, I applied your patch and added more changes to separate functionality between (a) expansion and (b) populating `expand-pos` with the marks that the "expand-jump" commands use. I also removed some more functions that either became obsolete because of the changes from your patch or were already not being used anywhere. These changes make expand.el much more compact and easier to understand, not to mention the improved functionality. Still a work in progress though. What do you think? -- Best regards, Martin Marshall diff --git a/lisp/expand.el b/lisp/expand.el index f32ab101224..56329dd9805 100644 --- a/lisp/expand.el +++ b/lisp/expand.el @@ -331,60 +331,43 @@ expand-abbrev-hook (let ((p (point))) (setq expand-point nil) ;; don't expand if the preceding char isn't a word constituent - (if (and (eq (char-syntax (preceding-char)) - ?w) - (expand-do-expansion)) - (progn - ;; expand-point tells us if we have inserted the text - ;; ourself or if it is the hook which has done the job. - (if expand-point - (progn - (if (vectorp expand-list) - (expand-build-marks expand-point)) - (indent-region p expand-point nil)) - ;; an outside function can set expand-list to a list of - ;; markers in reverse order. - (if (listp expand-list) - (setq expand-index 0 - expand-pos (expand-list-to-markers expand-list) - expand-list nil))) - (run-hooks 'expand-expand-hook) + (if (eq (char-syntax (preceding-char)) ?w) + (progn + (delete-char (- (length last-abbrev-text))) + (let* ((vect (symbol-value last-abbrev)) + (text (aref vect 0)) + (position (aref vect 1)) + (jump-args (aref vect 2)) + (hook (aref vect 3)) + (startpos (point))) + (cond (text + (insert text) + (setq expand-point (point)))) + (if jump-args + (setq expand-list (nreverse + (mapcar (lambda (offset) + (+ startpos -1 offset)) + (cdr jump-args))))) + (if position + (backward-char position)) + (if hook + (funcall hook)) + (if expand-point + (indent-region p expand-point nil)) + (unless hook + (expand-do-expansion))) t) nil)) nil)) (defun expand-do-expansion () - (delete-char (- (length last-abbrev-text))) - (let* ((vect (symbol-value last-abbrev)) - (text (aref vect 0)) - (position (aref vect 1)) - (jump-args (aref vect 2)) - (hook (aref vect 3))) - (cond (text - (insert text) - (setq expand-point (point)))) - (if jump-args - (funcall #'expand-build-list (car jump-args) (cdr jump-args))) - (if position - (backward-char position)) - (if hook - (funcall hook)) - t)) - -(defun expand-abbrev-from-expand (word) - "Test if an abbrev has a hook." - (or - (and (intern-soft word local-abbrev-table) - (symbol-function (intern-soft word local-abbrev-table))) - (and (intern-soft word global-abbrev-table) - (symbol-function (intern-soft word global-abbrev-table))))) - -(defun expand-previous-word () - "Return the previous word." - (save-excursion - (let ((p (point))) - (backward-word 1) - (buffer-substring p (point))))) + ;; expand-point tells us if we have inserted the text + ;; ourself or if it is the hook which has done the job. + (if (listp expand-list) + (setq expand-index 0 + expand-pos (expand-list-to-markers expand-list) + expand-list nil)) + (run-hooks 'expand-expand-hook)) ;;;###autoload (defun expand-jump-to-previous-slot () @@ -415,38 +398,6 @@ expand-jump-to-next-slot ;;;###autoload (define-key abbrev-map "p" 'expand-jump-to-previous-slot) ;;;###autoload (define-key abbrev-map "n" 'expand-jump-to-next-slot) -(defun expand-build-list (len l) - "Build a vector of offset positions from the list of positions." - (expand-clear-markers) - (setq expand-list (vconcat l)) - (let ((i 0) - (lenlist (length expand-list))) - (while (< i lenlist) - (aset expand-list i (- len (1- (aref expand-list i)))) - (setq i (1+ i))))) - -(defun expand-build-marks (p) - "Transform the offsets vector into a marker vector." - (if expand-list - (progn - (setq expand-index 0) - (setq expand-pos (make-vector (length expand-list) nil)) - (let ((i (1- (length expand-list)))) - (while (>= i 0) - (aset expand-pos i (copy-marker (- p (aref expand-list i)))) - (setq i (1- i)))) - (setq expand-list nil)))) - -(defun expand-clear-markers () - "Make the markers point nowhere." - (if expand-pos - (progn - (let ((i (1- (length expand-pos)))) - (while (>= i 0) - (set-marker (aref expand-pos i) nil) - (setq i (1- i)))) - (setq expand-pos nil)))) - (defun expand-in-literal () "Test if we are in a comment or in a string." (save-excursion @@ -477,8 +428,9 @@ expand-list-to-markers ;; Used in `skeleton-end-hook' to fetch the positions for @ skeleton tags. ;; See `skeleton-insert'. (defun expand-skeleton-end-hook () - (if skeleton-positions - (setq expand-list skeleton-positions))) + (when skeleton-positions + (setq expand-list skeleton-positions) + (expand-do-expansion))) (add-hook 'skeleton-end-hook (function expand-skeleton-end-hook))
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 7 Feb 2024 17:13:39 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 07 12:13:39 2024 Received: from localhost ([127.0.0.1]:57808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rXlUQ-0003cQ-TC for submit <at> debbugs.gnu.org; Wed, 07 Feb 2024 12:13:39 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39049) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1rXlUL-0003c7-Ox for 68487 <at> debbugs.gnu.org; Wed, 07 Feb 2024 12:13:37 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7A3BF10009F; Wed, 7 Feb 2024 12:13:13 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1707325992; bh=kLPCdqc/Ks/cnZQ90OR/1lq841SXPmMg0muwQjbTyq8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=FNPz0e84rrks3BeVC/UMwDUTnEKLhzMiXoNtzoKQMBQ+zh8gHqHRS0eMhx/HbN9oL qKfqFuCxJ9ap61hcegvyScLBEBk+8FjIsM0jR5dDs1CDreK1gH2zAsqsfipr4y7P6q cD6iWQ0SlreowM7UY++YXPXuhdFk7APUtILqA1GBDqFUEeJY7xaBq4luqN5XUHaJD1 OQkIoiyg3I8DOJMrB4WIEfBlEU9hsBAe5WLCAaHvsEUVn7o2d+mLBeeULkHemQRtMi Jb1+RZwaZ/iGhuMjX/q+ctzDly5oAIUBQ3dcka3XtuAz2riRiL1YyLV1Pf5H+y/N5f oSAk2fqsHITCg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 676F210004C; Wed, 7 Feb 2024 12:13:12 -0500 (EST) Received: from pastel (unknown [104.247.238.113]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 05144120209; Wed, 7 Feb 2024 12:13:11 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: Martin Marshall <law@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <87il316y4w.fsf@HIDDEN> (Martin Marshall's message of "Tue, 06 Feb 2024 17:11:59 -0500") Message-ID: <jwvy1bws07s.fsf-monnier+emacs@HIDDEN> References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> <87il316y4w.fsf@HIDDEN> Date: Wed, 07 Feb 2024 12:13:11 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) >>> 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. >> >> Hmm... this suggests we should try and "merge" `expand-list/pos` and >> `skeleton-positions`? > > My thinking was just to initialize `expand-list/pos/index` in skeleton.el, so > that a skeleton-command could populate `expand-pos` with locations from > `skeleton-positions` even before expand.el has loaded. I'm having trouble understanding the design behind `expand.el`, but IIUC `expand-list` is basically the variable through which interaction with other things is expected to take place, so I think it's fair to make `skeleton.el` set `expand-list` whereas `expand-pos/index` seem like internal vars and `skeleton.el` shouldn't touch them. But the docstring of `expand-list` needs to be (re)written for that, first. Ideally this should go along with the removal of the use of a vector in `expand-list`, which not only is odd given its name but is odd because it seems completely useless. IOW my reading of the code suggests the code would work just as well with the patch below. Stefan diff --git a/lisp/expand.el b/lisp/expand.el index f32ab101224..714cc5fc11a 100644 --- a/lisp/expand.el +++ b/lisp/expand.el @@ -337,17 +337,12 @@ expand-abbrev-hook (progn ;; expand-point tells us if we have inserted the text ;; ourself or if it is the hook which has done the job. + (if (listp expand-list) + (setq expand-index 0 + expand-pos (expand-list-to-markers expand-list) + expand-list nil)) (if expand-point - (progn - (if (vectorp expand-list) - (expand-build-marks expand-point)) - (indent-region p expand-point nil)) - ;; an outside function can set expand-list to a list of - ;; markers in reverse order. - (if (listp expand-list) - (setq expand-index 0 - expand-pos (expand-list-to-markers expand-list) - expand-list nil))) + (indent-region p expand-point nil)) (run-hooks 'expand-expand-hook) t) nil)) @@ -359,12 +354,16 @@ expand-do-expansion (text (aref vect 0)) (position (aref vect 1)) (jump-args (aref vect 2)) - (hook (aref vect 3))) + (hook (aref vect 3)) + (startpos (point))) (cond (text (insert text) (setq expand-point (point)))) (if jump-args - (funcall #'expand-build-list (car jump-args) (cdr jump-args))) + (setq expand-list (nreverse + (mapcar (lambda (offset) + (+ startpos -1 offset)) + (cdr jump-args))))) (if position (backward-char position)) (if hook @@ -415,28 +414,6 @@ expand-jump-to-next-slot ;;;###autoload (define-key abbrev-map "p" 'expand-jump-to-previous-slot) ;;;###autoload (define-key abbrev-map "n" 'expand-jump-to-next-slot) -(defun expand-build-list (len l) - "Build a vector of offset positions from the list of positions." - (expand-clear-markers) - (setq expand-list (vconcat l)) - (let ((i 0) - (lenlist (length expand-list))) - (while (< i lenlist) - (aset expand-list i (- len (1- (aref expand-list i)))) - (setq i (1+ i))))) - -(defun expand-build-marks (p) - "Transform the offsets vector into a marker vector." - (if expand-list - (progn - (setq expand-index 0) - (setq expand-pos (make-vector (length expand-list) nil)) - (let ((i (1- (length expand-list)))) - (while (>= i 0) - (aset expand-pos i (copy-marker (- p (aref expand-list i)))) - (setq i (1- i)))) - (setq expand-list nil)))) - (defun expand-clear-markers () "Make the markers point nowhere." (if expand-pos
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 6 Feb 2024 22:12:26 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 06 17:12:26 2024 Received: from localhost ([127.0.0.1]:55290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rXTg1-0005iL-Mw for submit <at> debbugs.gnu.org; Tue, 06 Feb 2024 17:12:25 -0500 Received: from mail-yb1-xb2c.google.com ([2607:f8b0:4864:20::b2c]:61887) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <law@HIDDEN>) id 1rXTfx-0005i5-E1 for 68487 <at> debbugs.gnu.org; Tue, 06 Feb 2024 17:12:24 -0500 Received: by mail-yb1-xb2c.google.com with SMTP id 3f1490d57ef6-dc6d9a8815fso5875145276.3 for <68487 <at> debbugs.gnu.org>; Tue, 06 Feb 2024 14:12:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martinmarshall-com.20230601.gappssmtp.com; s=20230601; t=1707257522; x=1707862322; 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=t+qTg4T8udZRO4BbJq8Cfr4bFKqDWAvHRT7Fl1Kyssk=; b=KPlawkomrDVha3Oosi90lZmhriSULqZ4GVCOjlsQLpbyUW1Ol7f10/we6Uu9wFcycD JSy8APoHXkbenf4yQNSgnosIeB5JaXi5abpbRFJh65Azqp9drryrkLlB3i1htuZDYPmn eTJoi1UtdTB9pDDqguNgpsGhJMKScfIpQQtl+opLkbHk1DddbgRoz3bQMvA0O5abIY13 6VMB0OyV4dAXx+WBFjNWJxlVRoy6tzB1AP/FLUysN7SibY+8Ic75jbuVUFKiIAZOknzc sKsSV2Kp9rehMCZ4XsIMqyKC0iqx8SDsGV5WIUeQRxoxI7vwj0loYyyX/0jd7DzZoUqr I4qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707257522; x=1707862322; 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=t+qTg4T8udZRO4BbJq8Cfr4bFKqDWAvHRT7Fl1Kyssk=; b=J/YTWkECVvEH/q4QtR1ud6l+kQf2TylNbi1iUoyBYi1ENoiKNArpG2v/giSWjGW6Gf yKfYA9F4D2XhrOX4QniaWXDKMPnjfikAazAnq3X3nJ0DN+gEn7gK9Y/2yC3s+Bc83JuQ a4wRRgmtt4UIcaGSbLsDbzOUevyTmthxDXXgbj8X6J9TnKDsLxIWHO0cqCuh/4ZvBib0 vnKlSBgqie95CFhYgLbg8JiKi5ywHsKN0KoEo+/hOaOZ1oa4Z9YxO3Hi9tc7xofBvxue Ykt4sE/QMr6pN/yD+f5z5t5BOEOFOxh4540YarNfo4yq2wBpTmJ7tdwxN9+gF2AJBQ0x vIWw== X-Gm-Message-State: AOJu0Yz/bHEd/Wt0EAB0DjJr8htjOl2/lpXf79+oilINA6BDDrR0xPp9 NdeYnvEhBhgS0iCmvYsi0iaSOzyS0Ug+EG7e4i+KsdJkc52ZMGoxCqwwwXrMxpSmhG4MuZI3WGs = X-Google-Smtp-Source: AGHT+IEaPaPCFxbC0o21UVSi90mpihWtEIlPclWuNLNabOkuBsS5xIggxNoUqqjCkw2bNPQr8B15Xw== X-Received: by 2002:a25:ef45:0:b0:db9:794b:5733 with SMTP id w5-20020a25ef45000000b00db9794b5733mr3315160ybm.19.1707257520516; Tue, 06 Feb 2024 14:12:00 -0800 (PST) Received: from vader (68-252-220-225.lightspeed.tukrga.sbcglobal.net. [68.252.220.225]) by smtp.gmail.com with ESMTPSA id e3-20020a258743000000b00dc2324b3cddsm662468ybn.37.2024.02.06.14.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:11:59 -0800 (PST) From: Martin Marshall <law@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message of "Mon, 05 Feb 2024 21:46:19 -0500") References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> Date: Tue, 06 Feb 2024 17:11:59 -0500 Message-ID: <87il316y4w.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Stefan Monnier <monnier@HIDDEN> writes: >> 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. > > Hmm... this suggests we should try and "merge" `expand-list/pos` and > `skeleton-positions`? My thinking was just to initialize `expand-list/pos/index` in skeleton.el, so that a skeleton-command could populate `expand-pos` with locations from `skeleton-positions` even before expand.el has loaded. I think `skeleton-positions` was intended as a building block for users (or package authors) to create jumping capability of their own. For example, an emacswiki article[1] proposes one way of doing this. I'd want to avoid renaming `skeleton-positions` or changing the value it receives, since that would probably break such configurations. [1] https://www.emacswiki.org/emacs/SkeletonMode#h5o-15 -- Best regards, Martin Marshall
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 6 Feb 2024 02:46:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 05 21:46:47 2024 Received: from localhost ([127.0.0.1]:52960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rXBTy-0003oo-TJ for submit <at> debbugs.gnu.org; Mon, 05 Feb 2024 21:46:47 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1rXBTt-0003oX-JL for 68487 <at> debbugs.gnu.org; Mon, 05 Feb 2024 21:46:45 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B452E100390; Mon, 5 Feb 2024 21:46:22 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1707187581; bh=9T2TEeQ0UvSdKtqPhxug+QLL0XwWckm7zF6LWAijwLk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fOS2BakSFLTfPYebai/c1lsSxoIEQ4joxTFfo+15DKFJLp4yqW80XHhA3TZvzL3Ab 2OFKJZPYEXkiUQvd/5ehNqDHchr0Gmud7PRjrWOrgLhKLhDEjdPwwsGH+jx/cWXwF5 fqAuQjxh9dPBNs/gng2SjqBetOI0tpeoNt5pGYSY1zLM62MJLp01NK4rrHs3qyAqbX fb/rdIxsAAsbx35HBMTSZPOl1tbH9ugDSMXeSatQbYpk6/QoB06wfP5y16YPEXZIie qLcIbXKzl4G2/P0q7ZvVKBBRUxxxm2aLRRe/RfgkmsqBk9w14GTJ/a8BloopHgXwBD Xo28f5vKxonIQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7B6EE1002F1; Mon, 5 Feb 2024 21:46:21 -0500 (EST) Received: from pastel (69-165-153-17.dsl.teksavvy.com [69.165.153.17]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 546981200CC; Mon, 5 Feb 2024 21:46:21 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: Martin Marshall <law@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <875xz2y46o.fsf@HIDDEN> (Martin Marshall's message of "Mon, 05 Feb 2024 16:46:55 -0500") Message-ID: <jwvh6imwc5f.fsf-monnier+emacs@HIDDEN> References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> <875xz2y46o.fsf@HIDDEN> Date: Mon, 05 Feb 2024 21:46:19 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.294 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > 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. Hmm... this suggests we should try and "merge" `expand-list/pos` and `skeleton-positions`? Stefan
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 5 Feb 2024 21:47:25 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 05 16:47:25 2024 Received: from localhost ([127.0.0.1]:52468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rX6oD-0001Ci-3u for submit <at> debbugs.gnu.org; Mon, 05 Feb 2024 16:47:24 -0500 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 <law@HIDDEN>) id 1rX6o7-0001CP-8w for 68487 <at> debbugs.gnu.org; Mon, 05 Feb 2024 16:47:19 -0500 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-60427d9c5dbso30008777b3.1 for <68487 <at> 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) 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) From: Martin Marshall <law@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message of "Sun, 28 Jan 2024 14:45:37 -0500") References: <877ckawckc.fsf@HIDDEN> <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> Date: Mon, 05 Feb 2024 16:46:55 -0500 Message-ID: <875xz2y46o.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Stefan Monnier <monnier@HIDDEN> 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
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 28 Jan 2024 19:45:56 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 28 14:45:56 2024 Received: from localhost ([127.0.0.1]:58403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rUB6J-0007D3-Re for submit <at> debbugs.gnu.org; Sun, 28 Jan 2024 14:45:56 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:9560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1rUB6H-0007Cq-VV for 68487 <at> debbugs.gnu.org; Sun, 28 Jan 2024 14:45:54 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 33BDF44226A; Sun, 28 Jan 2024 14:45:40 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1706471138; bh=ojKD1xia82ZgWZOevGUQa3OVCeC1I3lPj3+J4jbMQ2I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=YHBZGVWKNvtA+1Ttb3oWk82Ki8GMu6sOEbJHbeQxF0Bs5qeEePG3rVuOfpF4RrtTf eCQxu1j0sobWgeJvh73TuDA8sg3MvbOxzcg0D7noso/42qsMEbe2hpyV64B8bGo+eK 2bMSEBOQmx5iq68xc/aa+7LLO1JuGw0eSpae0sJvpciQolefcwJJfXqnIbsTLbyBqL Jx446tI7YuqozjMcV7ZRP7XsNnbRf5+i9UU6wmaWx6E2yJNnEJ2ETOMXzqT0wMDif1 6tjbBoPeqCowWITvArQKZSxVXfbzDrefiN4aK8//LfBoD4VStDMW1ELjSkhWtfGi/L qaBYwkGsF1Wxw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B1FD84410C6; Sun, 28 Jan 2024 14:45:38 -0500 (EST) Received: from alfajor (unknown [45.72.206.68]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8268612078A; Sun, 28 Jan 2024 14:45:38 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: Martin Marshall <law@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <877ckawckc.fsf@HIDDEN> (Martin Marshall's message of "Mon, 15 Jan 2024 15:45:23 -0500") Message-ID: <jwvle89s0y3.fsf-monnier+emacs@HIDDEN> References: <877ckawckc.fsf@HIDDEN> Date: Sun, 28 Jan 2024 14:45:37 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.001 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > 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
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 28 Jan 2024 19:25:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 28 14:25:15 2024 Received: from localhost ([127.0.0.1]:58377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rUAmI-0006dR-PV for submit <at> debbugs.gnu.org; Sun, 28 Jan 2024 14:25:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1rUAmH-0006dA-4F for 68487 <at> debbugs.gnu.org; Sun, 28 Jan 2024 14:25:13 -0500 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 <eliz@HIDDEN>) id 1rUAm3-0000p5-K6; Sun, 28 Jan 2024 14:24:59 -0500 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=rvBqSl0+CGWaaeaqRRHWRuny/Hu5UcbrMwfpKWrGWHM=; b=F9v76iECHOM5 0DMcIPz6iH6WSAhbVwjFTd4+Ao6Uv6q69u3aYgWBeE92Bcj17IIYhKr8GObFg9LDz/DPLG/3waRIT BbA3Ui+if3OdEiBT0Ciq93kDVT2deF5dpyzWIH+PJLHNPKR47h3miJDe8Ovn4jf8ULQGJGLiclTPz ouz5L897vGk9ezf/Zj/8YC2XHJ1kQU/4hKGLBPa2UVK80AN629h2zR9xocOSHe7P7aJLaBagHNwfF BMRsxbMmlkJZhNQVoVXHwDEox1tJOTVu9jqpnGDQ1AZredudXgAvDI/soJVNK4So+g1ZSr4LJUg6U fhYw9zv9kMSzqx8VLayeCQ==; Date: Sun, 28 Jan 2024 21:24:55 +0200 Message-Id: <86wmrt45x4.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> In-Reply-To: <jwv8r49thy6.fsf-monnier+emacs@HIDDEN> (message from Stefan Monnier on Sun, 28 Jan 2024 13:47:34 -0500) Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons References: <877ckawckc.fsf@HIDDEN> <86wmrv87hf.fsf@HIDDEN> <87v87e3a3w.fsf@HIDDEN> <86h6iy7gpu.fsf@HIDDEN> <87h6iy78hn.fsf@HIDDEN> <86cytm6m33.fsf@HIDDEN> <jwv8r49thy6.fsf-monnier+emacs@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org, law@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Stefan Monnier <monnier@HIDDEN> > Cc: Martin Marshall <law@HIDDEN>, 68487 <at> debbugs.gnu.org > Date: Sun, 28 Jan 2024 13:47:34 -0500 > > >> > OK. But after applying the patch on the master branch, I get this > >> > while byte-compiling: > >> > > >> > In toplevel form: > >> > expand.el:91:2: Error: Eager macro-expansion failure: (error "Eager macro-expansion skipped due to cycle: > >> > => (load \"expand.el\") => (macroexpand-all (define-skeleton expand-c-for-skeleton )) => (macroexpand (define-skeleton )) => (load \"skeleton.el\") => (load \"expand.el\")") > > Why does loading `skeleton.el` cause a load of `expand.el`? > I can't reproduce it here and I can't see any mention of "expand" in > `skeleton.el` that would explain it. You need to apply the patch in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68487#5 Sorry for not making it clear. > > Stefan, what are our facilities to avoid mutual recursion like that? > > It all depends on the specifics. TIA for any advice.
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 28 Jan 2024 18:47:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 28 13:47:51 2024 Received: from localhost ([127.0.0.1]:58356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rUAC7-0005Y4-Ed for submit <at> debbugs.gnu.org; Sun, 28 Jan 2024 13:47:51 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:38206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1rUAC5-0005XG-Se for 68487 <at> debbugs.gnu.org; Sun, 28 Jan 2024 13:47:50 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 36CA9442267; Sun, 28 Jan 2024 13:47:36 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1706467655; bh=UwRsMdkZMmSCATZkBXYSXXeahg1oXHf1zhXlhS/uleI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=asHGWgtnp3u82gZOBjam2H/Y9MmgZ8lBGYColTzXlU3xrP0HMo0QrLYdjpzj8fnC8 ks9Rx7oRdU9nwOPbIlX9igrc2X+DVlAPRQZWtlWmHxbsog2knLD4v4LgbehwgpluWK l9T6znYNiw7ZDpw5EmD8D2A0ZtD4xlB9iVkSmGapTtWNY2mgxrpZuce9aTAfTICRuf l9sTec4siqvD0x3bY5NC8yB/fpUhEr7WrUmXyXExxTX35Q6fdGTO51+vNDwQ3loEgY bVNLqShm2eLdo3qHGldQslv1hft/6oMXG+KIifS7beO7vdKqg9NnPRVYH26m3mq2fB EG0jlDr685mGA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1DFE7440E80; Sun, 28 Jan 2024 13:47:35 -0500 (EST) Received: from alfajor (unknown [45.72.206.68]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AD15E120185; Sun, 28 Jan 2024 13:47:34 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <86cytm6m33.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 28 Jan 2024 07:52:48 +0200") Message-ID: <jwv8r49thy6.fsf-monnier+emacs@HIDDEN> References: <877ckawckc.fsf@HIDDEN> <86wmrv87hf.fsf@HIDDEN> <87v87e3a3w.fsf@HIDDEN> <86h6iy7gpu.fsf@HIDDEN> <87h6iy78hn.fsf@HIDDEN> <86cytm6m33.fsf@HIDDEN> Date: Sun, 28 Jan 2024 13:47:34 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.001 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org, Martin Marshall <law@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) >> > OK. But after applying the patch on the master branch, I get this >> > while byte-compiling: >> > >> > In toplevel form: >> > expand.el:91:2: Error: Eager macro-expansion failure: (error "Eager macro-expansion skipped due to cycle: >> > => (load \"expand.el\") => (macroexpand-all (define-skeleton expand-c-for-skeleton )) => (macroexpand (define-skeleton )) => (load \"skeleton.el\") => (load \"expand.el\")") Why does loading `skeleton.el` cause a load of `expand.el`? I can't reproduce it here and I can't see any mention of "expand" in `skeleton.el` that would explain it. > Stefan, what are our facilities to avoid mutual recursion like that? It all depends on the specifics. Stefan
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 28 Jan 2024 05:53:06 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 28 00:53:05 2024 Received: from localhost ([127.0.0.1]:56286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rTy6L-00035b-Fi for submit <at> debbugs.gnu.org; Sun, 28 Jan 2024 00:53:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59310) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1rTy6J-000357-3W for 68487 <at> debbugs.gnu.org; Sun, 28 Jan 2024 00:53:04 -0500 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 <eliz@HIDDEN>) id 1rTy66-0007IT-2n; Sun, 28 Jan 2024 00:52:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=r6ZEvbtg6nfbXBVakSHCQh8HIC8mk67zqByPnB0JQag=; b=FjFbsjDtChh+3po9wwks Rl9ZNx+i3sxEXMnGEm+2pepeiRIBO8NVzMctzI1a5R5akhDkhp11sl4VMi35LXbMz24UUwGAqq13V jM2avA/QfUblMTjse0in+uyQPt5H3g3Ut6rp25uM6uN3Dh88oUzoZaOmPtf4GesNFS9yn3TAr7N9p 4VHZT7Pf+navQQmhCv7GEgEvOvGdTmL8VUAvor6COeUEFuyWnHonnJrly2JznBUijjIm7WaDzcqnS qV9CPvM1wCSIoC9s0eepwooYK84fMD7p5EtRh9gvHGICfZJnuSuEYuStJ7tI4EhjEmVAA92N8v32r tWBqyuNg9k+ezQ==; Date: Sun, 28 Jan 2024 07:52:48 +0200 Message-Id: <86cytm6m33.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Martin Marshall <law@HIDDEN>, Stefan Monnier <monnier@HIDDEN> In-Reply-To: <87h6iy78hn.fsf@HIDDEN> (message from Martin Marshall on Sat, 27 Jan 2024 16:48:52 -0500) Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons References: <877ckawckc.fsf@HIDDEN> <86wmrv87hf.fsf@HIDDEN> <87v87e3a3w.fsf@HIDDEN> <86h6iy7gpu.fsf@HIDDEN> <87h6iy78hn.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Martin Marshall <law@HIDDEN> > Cc: 68487 <at> debbugs.gnu.org > Date: Sat, 27 Jan 2024 16:48:52 -0500 > > Eli Zaretskii <eliz@HIDDEN> writes: > > OK. But after applying the patch on the master branch, I get this > > while byte-compiling: > > > > In toplevel form: > > expand.el:91:2: Error: Eager macro-expansion failure: (error "Eager macro-expansion skipped due to cycle: > > => (load \"expand.el\") => (macroexpand-all (define-skeleton expand-c-for-skeleton )) => (macroexpand (define-skeleton )) => (load \"skeleton.el\") => (load \"expand.el\")") > > > > In toplevel form: > > skeleton.el:34:11: Error: Eager macro-expansion failure: (error "Eager macro-expansion skipped due to cycle: > > => (load \"expand.el\") => (macroexpand-all (define-skeleton expand-c-for-skeleton )) => (macroexpand (define-skeleton )) => (load \"skeleton.el\") => (load \"expand.el\")") > > Makefile:335: recipe for target `skeleton.elc' failed > > make[3]: *** [skeleton.elc] Error 1 > > make[3]: *** Waiting for unfinished jobs.... > > Makefile:335: recipe for target `expand.elc' failed > > > > Could you please DTRT to avoid these errors? > > Sorry, that was due to my incorrect assumption that byte-compiling with > "C-c C-f" would be equivalent to a full recompile. > > I can fix it by deleting the sample skeleton (`expand-c-for-skeleton') > from expand.el. But even though it's just a sample template, there > might be people using it. > > Another option would be to join expand.el and skeleton.el into a single > file, perhaps calling it "expand-skeleton.el". > > What do you think is best? Neither alternative sounds attractive, TBH. Stefan, what are our facilities to avoid mutual recursion like that? Put the common stuff on a separate file, perhaps? Thanks.
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 27 Jan 2024 21:49:10 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 27 16:49:10 2024 Received: from localhost ([127.0.0.1]:56073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rTqY2-0006Uo-AJ for submit <at> debbugs.gnu.org; Sat, 27 Jan 2024 16:49:10 -0500 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:54335) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <law@HIDDEN>) id 1rTqXy-0006UI-LN for 68487 <at> debbugs.gnu.org; Sat, 27 Jan 2024 16:49:08 -0500 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-429af318342so15427381cf.0 for <68487 <at> debbugs.gnu.org>; Sat, 27 Jan 2024 13:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martinmarshall-com.20230601.gappssmtp.com; s=20230601; t=1706392133; x=1706996933; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S+0WkGwhqgGfE8YWJaCTiY/i0SEWejkIW3yQiYwG2Hc=; b=tGMFqZY0EjhbtyeceEtk2kYHj6CXwwn+VYQplNvoRqB4e1xHAN0Gsg3w35Ja+eqLcB BdqUo0DFR5K9ZemwcDiZsRLALvAM6lZx8DSw3Hdu7uuWrDhHCF5RAt/yDly1yigPrydr 9YqNIhGtsslRE+MN0VVnTuNcLRSm8ytOHPAQtKPp9G+psZ9RHhvoHzH5MVtefKq8OO9+ Uz8qaN3B/VKy/tNqxkixbRHHdKCP8uL4JZs3acbGFc/tNKu84BzjjKV5iBHv6maqB/E2 LAv6RhwZUFOLWhOmQoi9IImOn1pLOihfWgwxV5C8rC0LB6xhj10jDb0dz3sCjfhq22XO Bu/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706392133; x=1706996933; h=content-transfer-encoding:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=S+0WkGwhqgGfE8YWJaCTiY/i0SEWejkIW3yQiYwG2Hc=; b=D2UXiIOxgMmel2co9zsHa5G6gLirc2VcZO1FjSOtw0zbYVyM6c+ZlEjL98RE7JBHEA 3x/8RQII+zkHAs6H1nLCpTTgzdYW/rvuchy0Z2BJiqAmZikcGnIi68lahbh97wXEot4O biVrB4jNnIdKebpopbl6fBjgdqQ6E/2LLPaHaZw0IN7nh+v7ucg0k0aD2D1x/TKX73EB czEC6ZsycPhxqlhyMVsmX9LXqUrs/rULAQrqSr5xVq7HEzHabQfgWLacApne80XLdhA4 g6M89TiZ9ZMbJUPOzMaN8kSORI6v3EfxCpcsQXgDiry23pFwUlL9YHKJjpnwMuVdnA5D rtEg== X-Gm-Message-State: AOJu0YyBOK+7cjfNmjzHSGA/qxRZ2jjXDSeMZAkUQMWwitoJzaOWq/N+ uTXqPl6+oR8yeFjNX3icSrmXdHlVhOL5Y8Duw4dATrRqsFXhJOTOzXI/8xZRYwzp7F04VFOljIw AkA== X-Google-Smtp-Source: AGHT+IF/0WpTdCCwTrV5c1C88z+8uFGZN4BxP+MbQ5FfnUqgpLt2JEkAHKAHYhFs3Lf1RBCR+a2/ew== X-Received: by 2002:a05:620a:1492:b0:783:f42f:7f9b with SMTP id w18-20020a05620a149200b00783f42f7f9bmr665667qkj.13.1706392133370; Sat, 27 Jan 2024 13:48:53 -0800 (PST) Received: from vader (68-252-220-225.lightspeed.tukrga.sbcglobal.net. [68.252.220.225]) by smtp.gmail.com with ESMTPSA id hd10-20020a05690c488a00b005fffb25df43sm922308ywb.22.2024.01.27.13.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 13:48:53 -0800 (PST) From: Martin Marshall <law@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <86h6iy7gpu.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 27 Jan 2024 20:51:09 +0200") Organization: The Marshall Firm, LLC References: <877ckawckc.fsf@HIDDEN> <86wmrv87hf.fsf@HIDDEN> <87v87e3a3w.fsf@HIDDEN> <86h6iy7gpu.fsf@HIDDEN> Date: Sat, 27 Jan 2024 16:48:52 -0500 Message-ID: <87h6iy78hn.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: > OK. But after applying the patch on the master branch, I get this > while byte-compiling: > > In toplevel form: > expand.el:91:2: Error: Eager macro-expansion failure: (error "Eager mac= ro-expansion skipped due to cycle: > =3D> (load \"expand.el\") =3D> (macroexpand-all (define-skeleton ex= pand-c-for-skeleton )) =3D> (macroexpand (define-skeleton )) =3D> (load \= "skeleton.el\") =3D> (load \"expand.el\")") > > In toplevel form: > skeleton.el:34:11: Error: Eager macro-expansion failure: (error "Eager = macro-expansion skipped due to cycle: > =3D> (load \"expand.el\") =3D> (macroexpand-all (define-skeleton ex= pand-c-for-skeleton )) =3D> (macroexpand (define-skeleton )) =3D> (load \= "skeleton.el\") =3D> (load \"expand.el\")") > Makefile:335: recipe for target `skeleton.elc' failed > make[3]: *** [skeleton.elc] Error 1 > make[3]: *** Waiting for unfinished jobs.... > Makefile:335: recipe for target `expand.elc' failed > > Could you please DTRT to avoid these errors? Sorry, that was due to my incorrect assumption that byte-compiling with "C-c=C2=A0C-f" would be equivalent to a full recompile. I can fix it by deleting the sample skeleton (`expand-c-for-skeleton') from expand.el. But even though it's just a sample template, there might be people using it. Another option would be to join expand.el and skeleton.el into a single file, perhaps calling it "expand-skeleton.el". What do you think is best? --=20 Best regards, Martin Marshall
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 27 Jan 2024 18:51:54 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 27 13:51:54 2024 Received: from localhost ([127.0.0.1]:55934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rTnmU-00012h-H8 for submit <at> debbugs.gnu.org; Sat, 27 Jan 2024 13:51:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1rTnmS-00012R-ID for 68487 <at> debbugs.gnu.org; Sat, 27 Jan 2024 13:51:53 -0500 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 <eliz@HIDDEN>) id 1rTnm4-0002B1-EU; Sat, 27 Jan 2024 13:51:37 -0500 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=hw7oqtvlfQuj5iGY5bdOuiXD1a/QhURRoNvr5artWxU=; b=HIelxg5YIeUS sNJL9qNhAYt9kMF7IzwtS7kJ4/eeIRwZesWekkGA8JvPvclcb4PpAecw0BeNNceG8To53ODxunCZT 7PWrbJVWtG8pg2fwui17jIlkvFIDqe8rXog808JMQv880Ax4/8jrkCGGwRW5obOY3H+NZsS1kVDMc QJhxLpJX1DfioVC0EX8prZcaEZuYVsZHxq7gi0AOy/OGrJAC/cvlq8B1SZeMRDKX0jyT0uJV0c9nW HEM6KqKqj8iB56YDU0vWU5jGyfl7t5AMSCAZ2Wu8tum20Xm89RPOSdprIi0yKgjdxuBxS7Kprazjp Lbdy7XbdqRSYMikl2+4iPQ==; Date: Sat, 27 Jan 2024 20:51:09 +0200 Message-Id: <86h6iy7gpu.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Martin Marshall <law@HIDDEN> In-Reply-To: <87v87e3a3w.fsf@HIDDEN> (message from Martin Marshall on Sat, 27 Jan 2024 13:27:31 -0500) Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons References: <877ckawckc.fsf@HIDDEN> <86wmrv87hf.fsf@HIDDEN> <87v87e3a3w.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Martin Marshall <law@HIDDEN> > Cc: 68487 <at> debbugs.gnu.org > Date: Sat, 27 Jan 2024 13:27:31 -0500 > > Eli Zaretskii <eliz@HIDDEN> writes: > > > Is this patch still relevant, or you intend to resolve this while > > consolidating the related packages, perhaps based on yasnippet? > > I think it's still relevant. > > As I understand it, a goal for the snippet-engine project is to include > it in core and implement skeleton.el, expand.el, and tempo.el on top of > it. > > When completed, that will make this patch irrelevant, but I don't know > how long that process will take. OK. But after applying the patch on the master branch, I get this while byte-compiling: In toplevel form: expand.el:91:2: Error: Eager macro-expansion failure: (error "Eager macro-expansion skipped due to cycle: => (load \"expand.el\") => (macroexpand-all (define-skeleton expand-c-for-skeleton )) => (macroexpand (define-skeleton )) => (load \"skeleton.el\") => (load \"expand.el\")") In toplevel form: skeleton.el:34:11: Error: Eager macro-expansion failure: (error "Eager macro-expansion skipped due to cycle: => (load \"expand.el\") => (macroexpand-all (define-skeleton expand-c-for-skeleton )) => (macroexpand (define-skeleton )) => (load \"skeleton.el\") => (load \"expand.el\")") Makefile:335: recipe for target `skeleton.elc' failed make[3]: *** [skeleton.elc] Error 1 make[3]: *** Waiting for unfinished jobs.... Makefile:335: recipe for target `expand.elc' failed Could you please DTRT to avoid these errors?
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 27 Jan 2024 18:27:49 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 27 13:27:49 2024 Received: from localhost ([127.0.0.1]:55902 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rTnPB-0000K5-93 for submit <at> debbugs.gnu.org; Sat, 27 Jan 2024 13:27:49 -0500 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]:46382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <law@HIDDEN>) id 1rTnP8-0000Jr-2y for 68487 <at> debbugs.gnu.org; Sat, 27 Jan 2024 13:27:47 -0500 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-602ab446cd8so15256287b3.1 for <68487 <at> debbugs.gnu.org>; Sat, 27 Jan 2024 10:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martinmarshall-com.20230601.gappssmtp.com; s=20230601; t=1706380053; x=1706984853; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=aL+77uUF7b+p9oIOrshUgM8U6wuWrU8/BMDl0MLnJl4=; b=jYBxBslt3LLaGKwxTAImXYCSAgGjkT/ebNO4gyqmpoDwLcY71MEJZNIgLUo3wkPqvI TtoBsyzz4gzhjjFWDvQ4MwxIZOtQnWzDcBoZq4ckZMSKcb15xTbu/jDfQ45BZPMO8Go4 SRbNsn687Jr08hrcapd7ZApAtFu9N0hztR+VULH85iAa5v48yRu+nunRsD0DUqJlAXUS Bv8tc/Ze5gNsAkmQURvvjFvIOyPE65yePJ7hkVfyu7/4YrXNZ/ujGNhwcUmVw7soBnVQ 6USZs07UFwtDV1Mz7J/MIIikpFa0ltujuUS7rHL/p+4/Rl6iHY7/YPPC+Osemz3w102d wiKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706380053; x=1706984853; h=content-transfer-encoding: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=aL+77uUF7b+p9oIOrshUgM8U6wuWrU8/BMDl0MLnJl4=; b=F/aPh4vMqx8v1J2btaJ8QuF9qIoKkaoI4ItiiP5w8JIqHULnF5TLSt9//71FqLqzBK ZIfL7twQ4GqsA/CbkCMx/ZtSS1XzUcXtalUdRV8po1uPp2E2FshBremZxyiPABFkY9bT 3AahvgnqzZ5rR2X8JWY33braT55CTanIpoQwzDn+1kmCS74MBfzBiWEAeGbRDyruQef2 BCJDPTPQBjdO6RRsr3CmG+pCxS9SCvzXGxwR2wBZUFXj+O8NJHmOwJGw0YdCFb5Cv3Ku Ykm0ACK1TtLpajyBPuCEi6LbvtTwm3uqDokUdJgvIsZXHS80bKDwiZVcqTYEIBHWbYui mFLQ== X-Gm-Message-State: AOJu0YwAbYoLWDBeKQiYrRULyVya9mWFjdXy2ops+1yF3GC6zZMB/3EB JB3CApAuHpBJt3xTdIga1IFi2i1zTlRmhHOkfxW/DbBkMqmR6NooXhA6kYJFlBl0goA3SYgdQ6U DyA== X-Google-Smtp-Source: AGHT+IGwctyjfnM6KxfZUZY4zbkr3ihy43KXLaQbehzs1z2o5XJ2xZW4mI/D+JV2ABxEm+pRRem5LA== X-Received: by 2002:a0d:d2c2:0:b0:602:ca2a:e3be with SMTP id u185-20020a0dd2c2000000b00602ca2ae3bemr1898990ywd.68.1706380053087; Sat, 27 Jan 2024 10:27:33 -0800 (PST) Received: from vader (68-252-220-225.lightspeed.tukrga.sbcglobal.net. [68.252.220.225]) by smtp.gmail.com with ESMTPSA id q6-20020a819906000000b006000bddd691sm1248369ywg.77.2024.01.27.10.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 10:27:32 -0800 (PST) From: Martin Marshall <law@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons In-Reply-To: <86wmrv87hf.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 27 Jan 2024 11:13:00 +0200") References: <877ckawckc.fsf@HIDDEN> <86wmrv87hf.fsf@HIDDEN> Date: Sat, 27 Jan 2024 13:27:31 -0500 Message-ID: <87v87e3a3w.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: >> From: Martin Marshall <law@HIDDEN> >> Date: Mon, 15 Jan 2024 15:45:23 -0500 >>=20 >> Dear Emacs Maintainers, >>=20 >> I noticed the following item in the Emacs TODO file: >>=20 >> > ** Improve the "code snippets" support >> > Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then >> > advertise/use/improve it. >>=20 >> To that end, here's a patch which allows using expand.el's >> `expand-jump-to-next-slot' ("C-x=C2=A0a=C2=A0n") and >> `expand-jump-to-previous-slot' ("C-x=C2=A0a=C2=A0p") commands with all >> skeletons. >>=20 >> In the current Emacs release, an expanded skeleton adds the locations >> of `@' symbols to `skeleton-positions' list. One could theoretically >> convert these positions to markers and write commands for navigating >> to the locations. Fortunately, expand.el already implements this >> behavior. The only problem is that it's limited to skeletons being >> expanded as abbrevs. Skeletons invoked by a keybinding, menu entry, >> or "M-x" can't use expand.el's jumping commands. >>=20 >> This patch changes that by updating `define-skeleton', so that >> skeleton commands will update the list of markers in `expand-pos' >> whenever called outside of `expand-abbrev'. >>=20 >> What do you think? > > Martin, > > Is this patch still relevant, or you intend to resolve this while > consolidating the related packages, perhaps based on yasnippet? I think it's still relevant. As I understand it, a goal for the snippet-engine project is to include it in core and implement skeleton.el, expand.el, and tempo.el on top of it. When completed, that will make this patch irrelevant, but I don't know how long that process will take. --=20 Best regards, Martin Marshall
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at 68487) by debbugs.gnu.org; 27 Jan 2024 09:13:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 27 04:13:22 2024 Received: from localhost ([127.0.0.1]:53459 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rTekb-0006DH-SR for submit <at> debbugs.gnu.org; Sat, 27 Jan 2024 04:13:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1rTekZ-0006D5-Su for 68487 <at> debbugs.gnu.org; Sat, 27 Jan 2024 04:13:20 -0500 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 <eliz@HIDDEN>) id 1rTekM-0000pp-Id; Sat, 27 Jan 2024 04:13:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=XagA3UC29L6Ck3z2TufdeNNFjvoRw6ePMEQ1q1LVMtw=; b=hbKTfY3F6iCWA531QDWG TFdsExxPN+4/EByWnD1LdyIr9f6hVAmaeP/h+bxIXNc9ziMGleoUYFSYM8xIrIE4qcaKITNHtyevO jFp5nD32O0A66eruFZq5dyI6J1iayc7X3VJ5YJBz1tXyodsYYyOfIz/y2zz5bpvspPGoE717a9ieQ vgD+Y7TxkaZd6ejFL7N6deHUYS0DTg1Tct+U8/SjDU01r7mZ5Xy86bpKonr2ibVQmHfNcy78Jrfy0 2oWKz229d1u3SYfIa2Y7MxjIyrr+BK3enDViJkcXOz8M0EQYfeBM7k4dSyyXkQ4vbO4EQ8uaE+AzO c3gMfvQvup+mkQ==; Date: Sat, 27 Jan 2024 11:13:00 +0200 Message-Id: <86wmrv87hf.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Martin Marshall <law@HIDDEN> In-Reply-To: <877ckawckc.fsf@HIDDEN> (message from Martin Marshall on Mon, 15 Jan 2024 15:45:23 -0500) Subject: Re: bug#68487: [PATCH] Make jump commands usable for all skeletons References: <877ckawckc.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68487 Cc: 68487 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Martin Marshall <law@HIDDEN> > Date: Mon, 15 Jan 2024 15:45:23 -0500 > > Dear Emacs Maintainers, > > I noticed the following item in the Emacs TODO file: > > > ** Improve the "code snippets" support > > Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then > > advertise/use/improve it. > > To that end, here's a patch which allows using expand.el's > `expand-jump-to-next-slot' ("C-x a n") and > `expand-jump-to-previous-slot' ("C-x a p") commands with all > skeletons. > > In the current Emacs release, an expanded skeleton adds the locations > of `@' symbols to `skeleton-positions' list. One could theoretically > convert these positions to markers and write commands for navigating > to the locations. Fortunately, expand.el already implements this > behavior. The only problem is that it's limited to skeletons being > expanded as abbrevs. Skeletons invoked by a keybinding, menu entry, > or "M-x" can't use expand.el's jumping commands. > > This patch changes that by updating `define-skeleton', so that > skeleton commands will update the list of markers in `expand-pos' > whenever called outside of `expand-abbrev'. > > What do you think? Martin, Is this patch still relevant, or you intend to resolve this while consolidating the related packages, perhaps based on yasnippet? Thanks.
bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 15 Jan 2024 20:45:39 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 15 15:45:39 2024 Received: from localhost ([127.0.0.1]:47120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rPTpy-0006Pi-PC for submit <at> debbugs.gnu.org; Mon, 15 Jan 2024 15:45:39 -0500 Received: from lists.gnu.org ([2001:470:142::17]:47780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <law@HIDDEN>) id 1rPTpv-0006B9-R2 for submit <at> debbugs.gnu.org; Mon, 15 Jan 2024 15:45:37 -0500 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 <law@HIDDEN>) id 1rPTpp-0001D1-Jk for bug-gnu-emacs@HIDDEN; Mon, 15 Jan 2024 15:45:29 -0500 Received: from mail-yw1-x112f.google.com ([2607:f8b0:4864:20::112f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <law@HIDDEN>) id 1rPTpn-0004ZJ-9g for bug-gnu-emacs@HIDDEN; Mon, 15 Jan 2024 15:45:29 -0500 Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-5fc2e997804so26306837b3.3 for <bug-gnu-emacs@HIDDEN>; Mon, 15 Jan 2024 12:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martinmarshall-com.20230601.gappssmtp.com; s=20230601; t=1705351525; x=1705956325; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=3s2rBotKPW+fb/bU1J7Plagy/B090rj/4+NUpoggQkE=; b=bWIJ8XK8bdXr1eIDH9Raw1+8QqPmWmO8PbA22JNWc4VurY/y/Ke5AlTxd/ha29F5s+ mQup71DYYTsZQCvaOqCDmuIi4GiBExnJUIe396rpLTiyH9TGfMkvaCOzkQnFAw0XQXFr dezBetuGltK7Hab2ZbEc3RaGyOTqOhbxX/Dmfz73rQYh8A7TMuNlO12p0T8Lx7RKBxug 214EyIwkiBgr4Xp8XgBxQJtBFB8aFtAQ61ZVu1krTQxyT9tGQl2iLWjb0EpZ3bdqC7Q+ jjkgHo5ZpRVo/9rPdW0sIReYB7mjSvcXTlASgaa1ROpg8opG0dsfbdjTEDi6AjwutcG6 kwug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705351525; x=1705956325; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=3s2rBotKPW+fb/bU1J7Plagy/B090rj/4+NUpoggQkE=; b=cI/kET9NaOg3A8R/Tkam6Ctw/3efnUR+e+Kgy9+/Byhp6eAI80h0M34TSHtEs3uX75 qO1Jutee2frossHzRxl12mjNWKqf4Cj4XTUncoJEuJ/K0DhUWIfWhOVoItnTCXRJIrz5 k/TWawhluHI6mPdwlFfoxtbOdcSm8AA9TRldAc2zaaPhN+0ZQWhVYxW23De+d9o1H6Nb 8oC5ZFhCE0YD58D8xF2aei51Q/XzRMpUjWppoCk0X1vOQfxhDQ42EehjtvKLmOsaixKY SgIyIjlneLEBbjMCX0jKxqhrNhjc+TrpgbHrGIyHt+spQGWddwvOJBL+wV/X8hoifAmh W+Ow== X-Gm-Message-State: AOJu0YzYoucXUpw8CLWflSDyOf9dUU3o1d7mNcnT8coMEQ5ts9Xw+GwU ZdmmonbN/ULTd3d6wzY9UoBUqzT8+LcJblTz+TZMk2RWrYHI X-Google-Smtp-Source: AGHT+IHGqfiZQJbAI6B2v9h3rrwHyVQ1d1T8YOLLfRe49V9Qc0VyURoYJIPMo0XLyFIV/AK5SJj7GA== X-Received: by 2002:a05:690c:c14:b0:5fc:77e5:87b with SMTP id cl20-20020a05690c0c1400b005fc77e5087bmr1842248ywb.20.1705351525439; Mon, 15 Jan 2024 12:45:25 -0800 (PST) Received: from vader (68-252-220-225.lightspeed.tukrga.sbcglobal.net. [68.252.220.225]) by smtp.gmail.com with ESMTPSA id cn27-20020a05690c0d1b00b005f4e25747b7sm4230817ywb.47.2024.01.15.12.45.24 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 12:45:24 -0800 (PST) From: Martin Marshall <law@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: [PATCH] Make jump commands usable for all skeletons X-Debbugs-Cc: Date: Mon, 15 Jan 2024 15:45:23 -0500 Message-ID: <877ckawckc.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: none client-ip=2607:f8b0:4864:20::112f; envelope-from=law@HIDDEN; helo=mail-yw1-x112f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Dear Emacs Maintainers, I noticed the following item in the Emacs TODO file: > ** Improve the "code snippets" support > Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then > advertise/use/improve it. To that end, here's a patch which allows using expand.el's `expand-jump-to-next-slot' ("C-x=C2=A0a=C2=A0n") and `expand-jump-to-previous-slot' ("C-x=C2=A0a=C2=A0p") commands with all skeletons. In the current Emacs release, an expanded skeleton adds the locations of `@' symbols to `skeleton-positions' list. One could theoretically convert these positions to markers and write commands for navigating to the locations. Fortunately, expand.el already implements this behavior. The only problem is that it's limited to skeletons being expanded as abbrevs. Skeletons invoked by a keybinding, menu entry, or "M-x" can't use expand.el's jumping commands. This patch changes that by updating `define-skeleton', so that skeleton commands will update the list of markers in `expand-pos' whenever called outside of `expand-abbrev'. What do you think? --=20 Best regards, Martin Marshall --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Make-jump-commands-usable-for-all-skeletons.patch Content-Description: [PATCH] Make jump commands usable for all skeletons From f5dbc75b7d8c06ebed6ad0dae6c06b6957d7852b Mon Sep 17 00:00:00 2001 From: Martin Marshall <law@HIDDEN> Date: Mon, 15 Jan 2024 15:09:01 -0500 Subject: [PATCH] Make jump commands usable for all skeletons * etc/NEWS: Announce availability of jump commands for all skeletons * lisp/expand.el (expand-in-progress-p, expand-abbrev-hook): Add global variable to indicate when the 'expand-abbrev-hook' function is running. (expand-skeleton-end-hook, skeleton-end-hook): Remove the 'expand-skeleton-end-hook' function and move its code to 'define-skeleton'. * lisp/skeleton.el (expand): Require the expand.el library. (define-skeleton): Populate 'expand-pos' for use by expand.el's jump commands, or if 'expand-abbrev-hook' is runnning, copy the positions for handling by that function. --- etc/NEWS | 13 +++++++++++++ lisp/expand.el | 14 +++++--------- lisp/skeleton.el | 11 ++++++++++- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index bce33f96aee..ef30d4e9219 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -147,6 +147,19 @@ compositing manager, Emacs will now redisplay such a frame even though 'frame-visible-p' returns nil or 'icon' for it. This can happen, for example, as part of preview for iconified frames. +** Consolidation of tempo.el, skeleton.el, and expand.el + +--- +*** All skeleton templates can now use expand.el "jump" commands. +Previously, skeleton templates invoked by "M-x", a keybinding, or a +menu entry, could not use expand.el's jump commands +('expand-jump-to-next-slot' and 'expand-jump-to-previous-slot'). A +skeleton could only use expand.el navigation if added as an abbrev +using 'expand-add-abbrev' and only when invoked using such an abbrev. + +The expand.el jump commands now work on all skeletons, regardless of +invocation method. + --- ** New user option 'menu-bar-close-window'. When non-nil, selecting "Close" from the "File" menu or clicking diff --git a/lisp/expand.el b/lisp/expand.el index f32ab101224..ff2ae226d5f 100644 --- a/lisp/expand.el +++ b/lisp/expand.el @@ -286,6 +286,9 @@ expand-add-abbrevs (defvar expand-list nil "Temporary variable used by the Expand package.") +(defvar expand-in-progress-p nil + "If non-nil, `expand-abbrev-hook' is expanding an abbrev.") + (defvar-local expand-pos nil "If non-nil, store a vector with position markers defined by the last expansion.") @@ -326,6 +329,7 @@ expand-abbrev-hook See `expand-add-abbrevs'. Value is non-nil if expansion was done." ;; Expand only at the end of a line if we are near a word that has ;; an abbrev built from expand-add-abbrev. + (setq expand-in-progress-p t) (if (and (eolp) (not (expand-in-literal))) (let ((p (point))) @@ -348,6 +352,7 @@ expand-abbrev-hook (setq expand-index 0 expand-pos (expand-list-to-markers expand-list) expand-list nil))) + (setq expand-in-progress-p nil) (run-hooks 'expand-expand-hook) t) nil)) @@ -473,15 +478,6 @@ expand-list-to-markers loop (1- loop))) v)) -;; integration with skeleton.el -;; Used in `skeleton-end-hook' to fetch the positions for @ skeleton tags. -;; See `skeleton-insert'. -(defun expand-skeleton-end-hook () - (if skeleton-positions - (setq expand-list skeleton-positions))) - -(add-hook 'skeleton-end-hook (function expand-skeleton-end-hook)) - (provide 'expand) (run-hooks 'expand-load-hook) 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) -- 2.39.2 --=-=-=--
Martin Marshall <law@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#68487
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.