Subject: bug#17880: 24.4.50; [FEATURE] abbrev with skeleton

From: Leo Liu <[email-masked]>
Date: Mon, 30 Jun 2014 09:10:58 +0800

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)