[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/macrostep aa4736c 067/110: Fix some silly errors
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/macrostep aa4736c 067/110: Fix some silly errors |
Date: |
Sat, 7 Aug 2021 09:18:04 -0400 (EDT) |
branch: elpa/macrostep
commit aa4736c06f2159aed421b19b73fe377ffe36cdff
Author: Luís Oliveira <loliveira@common-lisp.net>
Commit: Luís Oliveira <loliveira@common-lisp.net>
Fix some silly errors
---
swank-macrostep.lisp | 66 ++++++++++++++++++++++++----------------------------
1 file changed, 30 insertions(+), 36 deletions(-)
diff --git a/swank-macrostep.lisp b/swank-macrostep.lisp
index d954687..0ca3fba 100644
--- a/swank-macrostep.lisp
+++ b/swank-macrostep.lisp
@@ -17,17 +17,17 @@
(bindings (mapcar #'read-from-string binding-strings))
(env (compute-environment bindings))
(expansion
- (multiple-value-bind (expansion expanded?)
- (macroexpand-1 form env)
- (if expanded?
- expansion
- (if (not compiler-macros?)
- (error "Not a macro form.")
- (multiple-value-bind (expansion expanded?)
- (compiler-macroexpand-1 form env)
- (if expanded?
- expansion
- (error "Not a macro or compiler-macro form.")))))))
+ (multiple-value-bind (expansion expanded?)
+ (macroexpand-1 form env)
+ (if expanded?
+ expansion
+ (if (not compiler-macros?)
+ (error "Not a macro form.")
+ (multiple-value-bind (expansion expanded?)
+ (compiler-macroexpand-1 form env)
+ (if expanded?
+ expansion
+ (error "Not a macro or compiler-macro
form.")))))))
(pretty-expansion (to-string expansion)))
(list pretty-expansion
(multiple-value-bind (expansion* tracking-stream)
@@ -35,20 +35,21 @@
(multiple-value-bind (macros compiler-macros)
(collect-macro-forms expansion*)
(flet ((collect-positions (forms type)
- (mapcar (lambda (form)
- (destructuring-bind (start end)
- (cdr (assoc form (forms-of
tracking-stream)))
- ;; this assumes that the operator
- ;; starts right next to the opening
- ;; parenthesis. I guess we could be
- ;; more forgiving with some
- ;; cleverness on the Emacs side.
- (let ((op-end (+ start (length (to-string
(first form))))))
- (list type
- start (position-line start
tracking-stream)
- op-end (position-line op-end
tracking-stream)
- end (position-line end
tracking-stream)))))
- forms)))
+ (loop for form in forms
+ for bounds = (cdr (assoc form (forms-of
tracking-stream)))
+ when bounds
+ collect (destructuring-bind (start end)
+ bounds
+ ;; this assumes that the operator
+ ;; starts right next to the opening
+ ;; parenthesis. I guess we could be
+ ;; more forgiving with some
+ ;; cleverness on the Emacs side.
+ (let ((op-end (+ start (length
(to-string (first form))))))
+ (list type
+ start (position-line start
tracking-stream)
+ op-end (position-line
op-end tracking-stream)
+ end (position-line end
tracking-stream)))))))
(append (collect-positions macros :macro)
(collect-positions compiler-macros
:compiler-macro)))))))))
@@ -156,18 +157,11 @@
(defun form-tracking-stream-p (stream)
(typep stream 'form-tracking-stream))
-(defun line-and-column (position tracking-stream)
- (let* ((line (or (position-if (lambda (newline-pos)
- (> newline-pos position))
- (newlines-of tracking-stream))
- 1))
- (column (if (eql line 1)
- position
- (- position (aref (newlines-of tracking-stream) (1-
line))))))
- (values line column)))
-
(defun position-line (position tracking-stream)
- (nth-value 0 (line-and-column position tracking-stream)))
+ (or (position-if (lambda (newline-pos)
+ (> newline-pos position))
+ (newlines-of tracking-stream))
+ (length (newlines-of tracking-stream))))
(defun tracking-read-from-string (string &key (readtable *readtable*))
(with-input-from-string (string-stream string)
- [nongnu] elpa/macrostep 4d75baf 003/110: Bump version number, (continued)
- [nongnu] elpa/macrostep 4d75baf 003/110: Bump version number, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 8a85acc 022/110: Refactor backquote handling and text properties., ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 2d216ba 109/110: Merge pull request #19 from fice-t/autoload, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 83b2a0a 015/110: Tweak visible highlight, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 3f815fb 031/110: Test for normal defmacro expansion, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 9d2c58c 040/110: Add option to expand in a separate buffer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 3f965b0 048/110: Use new `macrostep-macro-start` text property, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep ff3888f 065/110: Use a form-tracking stream rather than gensym substitution, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 0fd292c 006/110: Better README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 0db08ec 007/110: add Url: header for marmalade, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep aa4736c 067/110: Fix some silly errors,
ELPA Syncer <=
- [nongnu] elpa/macrostep 0b1c0fe 069/110: Add swank/gray:stream-read-char-no-hang implementation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 704f164 091/110: Merge branch 'generic', ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep bf87b7c 095/110: Whitespace cleanup, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep d1e954d 099/110: Attempt to shell out to "indent" in macrostep-c, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep b65cc96 102/110: Makefile tweaks, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 424e373 110/110: Merge pull request #16 from fice-t/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep c5d1c5b 009/110: Autoload macro definitions if needed., ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 8b89694 012/110: Only enter macrostep-mode after successful macro expansion, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep b060e1a 014/110: Add visible highlight of expanded section, ELPA Syncer, 2021/08/07
- [nongnu] elpa/macrostep 4b0d96f 013/110: Remove incorrect use of :version in defgroup, ELPA Syncer, 2021/08/07