]> git.eshelyaron.com Git - dict.git/commitdiff
Use define-auto-insert instead of manual add-to-list
authorEshel Yaron <me@eshelyaron.com>
Fri, 18 Nov 2022 10:05:37 +0000 (12:05 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 18 Nov 2022 10:05:37 +0000 (12:05 +0200)
sweeprolog.el

index 56f7277bbd623330ecc1b1d61a2b4f4babba57bc..36523e56c6e53c25fd1497f7b97673d3194b1a4b 100644 (file)
@@ -3348,24 +3348,32 @@ certain contexts to maintain conventional Prolog layout."
               #'sweeprolog-analyze-fragment-variable nil t)
     (cursor-sensor-mode 1)))
 
-(add-to-list 'auto-insert-alist
-             '((sweeprolog-mode . "SWI-Prolog module header")
-               (or (and (buffer-file-name)
-                        (file-name-sans-extension (file-name-base (buffer-file-name))))
-                   (read-string "Module name: "))
-               "/*"
-               "\n    Author:        "
-               (progn user-full-name)
-               "\n    Email:         "
-               (progn user-mail-address)
-               (progn sweeprolog-module-header-comment-skeleton)
-               "\n*/"
-               "\n\n:- module("
-               str
-               ", [])."
-               "\n\n/** <module> "
-               -
-               "\n\n*/\n\n"))
+
+;;;; Auto-insert Prolog module header
+
+(defconst sweeprolog-module-header-skeleton
+  '((or (and (buffer-file-name)
+             (file-name-sans-extension
+              (file-name-base (buffer-file-name))))
+        (read-string "Module name: "))
+    "/*"
+    "\n    Author:        "
+    (progn user-full-name)
+    "\n    Email:         "
+    (progn user-mail-address)
+    (progn sweeprolog-module-header-comment-skeleton)
+    "\n*/"
+    "\n\n:- module("
+    str
+    ", [])."
+    "\n\n/** <module> "
+    -
+    "\n\n*/\n\n")
+  "Prolog module header skeleton inserted by \\[auto-insert].")
+
+(define-auto-insert
+  '(sweeprolog-mode . "SWI-Prolog module header")
+  sweeprolog-module-header-skeleton)
 
 
 ;;;; Indentation