Skip to content

Commit

Permalink
Nix the destructuring-bind
Browse files Browse the repository at this point in the history
  • Loading branch information
nnoodle authored and Shinmera committed May 4, 2021
1 parent 640b177 commit 8d92e94
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions indent.lisp
Expand Up @@ -18,16 +18,14 @@

(defvar *indentation-hints* (make-hash-table :test #'eq))

(defmacro with-symbol (name-symbol-package-module &body body)
(defmacro with-symbol ((name symbol package module) &body body)
"Check if SYMBOL exists in PACKAGE when MODULE is loaded and bind it to NAME."
(destructuring-bind (name symbol package module)
name-symbol-package-module
(let ((pkg (gensym)))
`(when (member ,module *modules* :test #'string=)
(let* ((,pkg (find-package ,package))
(,name (when ,pkg (find-symbol (string ,symbol) ,pkg))))
(when ,name
,@body))))))
(let ((pkg (gensym)))
`(when (member ,module *modules* :test #'string=)
(let* ((,pkg (find-package ,package))
(,name (when ,pkg (find-symbol (string ,symbol) ,pkg))))
(when ,name
,@body)))))

(defun indentation (symbol)
"Returns the custom defined indentation of a symbol if there is any. SETF-able."
Expand Down

0 comments on commit 8d92e94

Please sign in to comment.