From b2eb31629e96043163f6e210b4fc8b7f72b63f16 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 17:28:30 -0500 Subject: Begin on acdw-auto-insert.el XXX It doesn't work right now --- init.el | 34 ++++++++++++++++++++++++++++++ lisp/acdw-autoinsert.el | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 lisp/acdw-autoinsert.el diff --git a/init.el b/init.el index fcf37c8..ac88cde 100644 --- a/init.el +++ b/init.el @@ -13,7 +13,9 @@ ;; Everyone is permitted to do whatever with this software, without ;; limitation. This software comes without any warranty whatsoever, ;; but with two pieces of advice: + ;; - Be kind to yourself. + ;; - Make good choices. ;;; Commentary: @@ -94,6 +96,38 @@ (expand-file-name-exists-p "pkg/" user-emacs-directory))) (normal-top-level-add-subdirs-to-load-path))) +(setup autoinsert + (require 'acdw-autoinsert) + (acdw/define-auto-insert '(:replace t) + ;; This is my custom auto-insert for elisp files. + '("\\.el\\'" . "Emacs Lisp header (acdw)") + '("Short description: " ";;; " + (file-name-nondirectory (buffer-file-name)) + " --- " str + (make-string (max 2 ( - 80 (current-column) 27)) 32) + "-*- lexical-binding: t; -*-" + '(setq lexical-binding t) + "\n\n;; Copyright (C) " (format-time-string "%Y") + " " (getenv "ORGANIZATION") | (progn user-full-name) + "\n\n;; Author: " (user-full-name) + '(if (search-backward "&" (line-beginning-position) t) + (replace-match (capitalize (user-login-name)) t t)) + '(end-of-line 1) + " <" (progn user-mail-address) ">" + & -2 + "\n\n;;; License:" + "\n\n;; Everyone is permitted to do whatever with this software, without" + "\n;; limitation. This software comes without any warranty whatsoever," + "\n;; but with two pieces of advice:" + "\n\n;; - Be kind to yourself." + "\n\n;; - Make good choices." + "\n\n;;; Commentary:" + "\n\n;; " _ + "\n\n;;; Code:" + "\n\n\n\n(provide '" (file-name-base (buffer-file-name)) ")" + "\n;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n")) + (auto-insert-mode +1)) + (setup autorevert (:option global-auto-revert-non-file-buffers t auto-revert-verbose nil) diff --git a/lisp/acdw-autoinsert.el b/lisp/acdw-autoinsert.el new file mode 100644 index 0000000..a89bc80 --- /dev/null +++ b/lisp/acdw-autoinsert.el @@ -0,0 +1,55 @@ +;;; acdw-autoinsert.el --- autoinsert.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Case Duckworth + +;; Author: Case Duckworth