unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42311: [PATCH] Wrap skeleton logic in atomic-change-group
@ 2020-07-10 15:43 Philip K.
  2020-08-05 14:08 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Philip K. @ 2020-07-10 15:43 UTC (permalink / raw)
  To: 42311

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]


I'm not sure if this is intended, but when expanding a skeleton
(e.g. using sgml-tag), I sometimes change my mind and press C-g. I'm
then left with a half finished HTML tag, like for example

     <a id="

that is really never intended. The patch below ensures that all
skeletons are either inserted correctly, or cleaned up as part of an
atomic change group.

I didn't thoroughly investigate each instance of define-skeleton I could
find, but from skimming the places I found examples, it seems like this
change shouldn't break any expected behaviour.

-- 
	Philip K.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Wrap-skeleton-logic-in-atomic-change-group.patch --]
[-- Type: text/x-diff, Size: 845 bytes --]

From c6dfdffa25e3d64f78f261b4b536dfae4f02a040 Mon Sep 17 00:00:00 2001
From: Philip K <philip@warpmail.net>
Date: Fri, 10 Jul 2020 17:37:02 +0200
Subject: [PATCH] Wrap skeleton logic in atomic-change-group

---
 lisp/skeleton.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/skeleton.el b/lisp/skeleton.el
index 8c694c128b..3609d6ba6a 100644
--- a/lisp/skeleton.el
+++ b/lisp/skeleton.el
@@ -135,7 +135,8 @@ define-skeleton
 A prefix argument of zero says to wrap around zero words---that is, nothing.
 This is a way of overriding the use of a highlighted region.")
        (interactive "*P\nP")
-       (skeleton-proxy-new ',skeleton str arg))))
+       (atomic-change-group
+         (skeleton-proxy-new ',skeleton str arg)))))
 
 ;;;###autoload
 (defun skeleton-proxy-new (skeleton &optional str arg)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#42311: [PATCH] Wrap skeleton logic in atomic-change-group
  2020-07-10 15:43 bug#42311: [PATCH] Wrap skeleton logic in atomic-change-group Philip K.
@ 2020-08-05 14:08 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-05 14:08 UTC (permalink / raw)
  To: Philip K.; +Cc: 42311

"Philip K." <philip@warpmail.net> writes:

> I'm not sure if this is intended, but when expanding a skeleton
> (e.g. using sgml-tag), I sometimes change my mind and press C-g. I'm
> then left with a half finished HTML tag, like for example
>
>      <a id="
>
> that is really never intended. The patch below ensures that all
> skeletons are either inserted correctly, or cleaned up as part of an
> atomic change group.

[...]

> -       (skeleton-proxy-new ',skeleton str arg))))
> +       (atomic-change-group
> +         (skeleton-proxy-new ',skeleton str arg)))))

Thanks.

I'm not a heavy user of skeletons, but this looks sensible to me, so
I've applied it to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-05 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 15:43 bug#42311: [PATCH] Wrap skeleton logic in atomic-change-group Philip K.
2020-08-05 14:08 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).