unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Liu <sdl.web@gmail.com>
To: 17880@debbugs.gnu.org
Subject: bug#17880: 24.4.50; [FEATURE] abbrev with skeleton
Date: Mon, 30 Jun 2014 09:10:58 +0800	[thread overview]
Message-ID: <m3bntb42xp.fsf@gmail.com> (raw)


I was looking for packages to obsolete and find this expand.el. The
skeleton DSL is certainly more powerful. Comments?

BTW, we should be able to extend skeleton to cover snippet.el or
whatever nicely. I mean snippet.el/yas-snippet.el might not be the one
we want to converge to.

=== modified file 'lisp/abbrev.el'
--- lisp/abbrev.el	2014-05-27 01:09:45 +0000
+++ lisp/abbrev.el	2014-06-30 01:02:15 +0000
@@ -776,7 +776,7 @@
   (let ((value abbrev))
     ;; If this abbrev has an expansion, delete the abbrev
     ;; and insert the expansion.
-    (when (stringp (symbol-value abbrev))
+    (cond ((stringp (symbol-value abbrev))
       (goto-char wordstart)
       ;; Insert at beginning so that markers at the end (e.g. point)
       ;; are preserved.
@@ -806,6 +806,9 @@
               ;; Change just that.
               (upcase-initials-region (point) (1+ (point)))
               (goto-char end))))))
+	  ((consp (symbol-value abbrev))
+	   (delete-char (- wordstart wordend))
+	   (skeleton-insert (symbol-value abbrev))))
     ;; Now point is at the end of the expansion and the beginning is
     ;; in last-abbrev-location.
     (when (symbol-function abbrev)





             reply	other threads:[~2014-06-30  1:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30  1:10 Leo Liu [this message]
2014-06-30 13:43 ` bug#17880: 24.4.50; [FEATURE] abbrev with skeleton Stefan Monnier
2014-06-30 23:09   ` Leo Liu
2021-07-14  9:40 ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3bntb42xp.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=17880@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).