From aab5bfd074e57d06a79e39d7c7c4760e1f385a06 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 17 Oct 2022 21:41:28 -0500 Subject: Bankruptcy 9 --- lisp/+compat.el | 64 --------------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 lisp/+compat.el (limited to 'lisp/+compat.el') diff --git a/lisp/+compat.el b/lisp/+compat.el deleted file mode 100644 index 286d5da..0000000 --- a/lisp/+compat.el +++ /dev/null @@ -1,64 +0,0 @@ -;;; +compat.el --- Thin backward-compatibility shim -*- lexical-binding: t; -*- - -;;; Commentary: - -;; I use different versionso of Emacs. Sometimes I have to copy-paste functions -;; from newer Emacs to make my customizations work. This is that file. - -;; This is probably ill-advised. - -;;; Code: - -;;; Load stuff in +compat/ subdirectory -(dolist (file (directory-files (locate-user-emacs-file "lisp/+compat") :full "\\.el\\'")) - (load file :noerror)) - -;;; Only define things if not already defined -(defmacro +compat-defun (name &rest args) - `(if (fboundp ',name) - (message "+compat: `%s' already bound." ',name) - (defun ,name ,@args))) - -(defmacro +compat-defmacro (name &rest args) - `(if (fboundp ',name) - (message "+compat: `%s' already bound." ',name) - (defmacro ,name ,@args))) - -;;; Single functions - -(+compat-defmacro dlet (binders &rest body) - "Like `let' but using dynamic scoping." - (declare (indent 1) (debug let)) - ;; (defvar FOO) only affects the current scope, but in order for - ;; this not to affect code after the main `let' we need to create a new scope, - ;; which is what the surrounding `let' is for. - ;; FIXME: (let () ...) currently doesn't actually create a new scope, - ;; which is why we use (let (_) ...). - `(let (_) - ,@(mapcar (lambda (binder) - `(defvar ,(if (consp binder) (car binder) binder))) - binders) - (let ,binders ,@body))) - -;; https://git.savannah.gnu.org/cgit/emacs.git/diff/?id=772b189143453745a8e014e21d4b6b78f855bba3 -(+compat-defun rename-visited-file (new-location) - "Rename the file visited by the current buffer to NEW-LOCATION. -This command also sets the visited file name. If the buffer -isn't visiting any file, that's all it does. - -Interactively, this prompts for NEW-LOCATION." - (interactive - (list (if buffer-file-name - (read-file-name "Rename visited file to: ") - (read-file-name "Set visited file name: " - default-directory - (expand-file-name - (file-name-nondirectory (buffer-name)) - default-directory))))) - (when (and buffer-file-name - (file-exists-p buffer-file-name)) - (rename-file buffer-file-name new-location)) - (set-visited-file-name new-location nil t)) - -(provide '+compat) -;;; +compat.el ends here -- cgit 1.4.1-21-gabe81