From 90056b3191eddccee2954b36ee77137fdec5ce29 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 16:00:39 -0500 Subject: Add require/ function --- lisp/acdw.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/acdw.el b/lisp/acdw.el index cc73071..50ca00c 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -878,7 +878,23 @@ three blank lines, then place the point on the second one." (newline) (delete-blank-lines) (newline 2) - (previous-line)) + (forward-line -1)) + +(defun require/ (feature &optional filename noerror) + "If FEATURE is not loaded, load it from FILENAME. +This function works just like `require', with one crucial +difference: if the FEATURE name contains a slash, the FILENAME +will as well -- unless, of course, FILENAME is set. This allows +for `require/' to require files within subdirectories of +directories of `load-path'. Of course, NOERROR isn't affected by +the change." + (let* ((feature-name (if (symbolp feature) + (symbol-name feature) + feature)) + (filename (or filename + (and (string-match-p "/" feature-name) + feature-name)))) + (require (intern feature-name) filename noerror))) (provide 'acdw) ;;; acdw.el ends here -- cgit 1.4.1-21-gabe81 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 (limited to 'lisp') 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