summary refs log tree commit diff stats
path: root/lisp/compat.el
diff options
context:
space:
mode:
authorCase Duckworth2022-07-06 16:47:32 -0500
committerCase Duckworth2022-07-06 16:47:32 -0500
commit42947150adc2639bf7456d40dedce09338cec303 (patch)
tree87d0c4eac037266581f2c3599c308a0b616cf358 /lisp/compat.el
parentUpdate readme (diff)
downloademacs-42947150adc2639bf7456d40dedce09338cec303.tar.gz
emacs-42947150adc2639bf7456d40dedce09338cec303.zip
Rename +compat.el to avoid collision; add a thing
Diffstat (limited to 'lisp/compat.el')
-rw-r--r--lisp/compat.el34
1 files changed, 0 insertions, 34 deletions
diff --git a/lisp/compat.el b/lisp/compat.el deleted file mode 100644 index 4bb8706..0000000 --- a/lisp/compat.el +++ /dev/null
@@ -1,34 +0,0 @@
1;;; compat.el --- Thin backward-compatibility shim -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;; I use different versionso of Emacs. Sometimes I have to copy-paste functions
6;; from newer Emacs to make my customizations work. This is that file.
7
8;; This is probably ill-advised.
9
10;;; Code:
11
12;; Load stuff in compat/ subdirectory
13(dolist (file (directory-files (locate-user-emacs-file "lisp/compat") :full "\\.el\\'"))
14 (load file :noerror))
15
16;; Other stuff...
17
18(unless (fboundp 'dlet)
19 (defmacro dlet (binders &rest body)
20 "Like `let' but using dynamic scoping."
21 (declare (indent 1) (debug let))
22 ;; (defvar FOO) only affects the current scope, but in order for
23 ;; this not to affect code after the main `let' we need to create a new scope,
24 ;; which is what the surrounding `let' is for.
25 ;; FIXME: (let () ...) currently doesn't actually create a new scope,
26 ;; which is why we use (let (_) ...).
27 `(let (_)
28 ,@(mapcar (lambda (binder)
29 `(defvar ,(if (consp binder) (car binder) binder)))
30 binders)
31 (let ,binders ,@body))))
32
33(provide 'compat)
34;;; compat.el ends here