[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dart-mode 613b311 111/192: Stop using lexical let
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dart-mode 613b311 111/192: Stop using lexical let |
Date: |
Sun, 29 Aug 2021 11:02:00 -0400 (EDT) |
branch: elpa/dart-mode
commit 613b311cc6e1842002a0d5cc0211b5fddf4918ec
Author: Natalie Weizenbaum <nex342@gmail.com>
Commit: Natalie Weizenbaum <nex342@gmail.com>
Stop using lexical let
Also, require Emacs 24 so that lexical binding works
---
dart-mode.el | 148 +++++++++++++++++++++++++++++------------------------------
1 file changed, 72 insertions(+), 76 deletions(-)
diff --git a/dart-mode.el b/dart-mode.el
index 5e45325..389d092 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -3,7 +3,7 @@
;; Author: Natalie Weizenbaum
;; URL: https://github.com/nex3/dart-mode
;; Version: 1.0.0
-;; Package-Requires: ((cl-lib "0.5") (dash "2.10.0") (flycheck "0.23"))
+;; Package-Requires: ((emacs "24.5") (cl-lib "0.5") (dash "2.10.0") (flycheck
"0.23"))
;; Keywords: language
;; Copyright (C) 2011 Google Inc.
@@ -210,7 +210,7 @@ Converts TEXT to a string if it's not already."
"Briefly highlights the text defined by OFFSET and LENGTH.
OFFSET and LENGTH are expected to come from the analysis server,
rather than Elisp."
- (lexical-let ((overlay (make-overlay (+ 1 offset) (+ 1 offset length))))
+ (let ((overlay (make-overlay (+ 1 offset) (+ 1 offset length))))
(overlay-put overlay 'face 'highlight)
(run-at-time "1 sec" nil (lambda () (delete-overlay overlay)))))
@@ -1054,9 +1054,9 @@ With a prefix argument, opens a new buffer rather than
using the
minibuffer."
(interactive "P")
(-when-let (filename (buffer-file-name))
- (lexical-let ((show-in-buffer show-in-buffer)
- (buffer (current-buffer))
- (pos (point)))
+ (let ((show-in-buffer show-in-buffer)
+ (buffer (current-buffer))
+ (pos (point)))
(dart--analysis-server-send
"analysis.getHover"
`(("file" . ,filename) ("offset" . ,pos))
@@ -1221,13 +1221,12 @@ minibuffer."
`(("file" . ,filename)
("offset" . ,pos)
("includePotential" . ,(or include-potential json-false)))
- (lexical-let ((buffer (current-buffer))
- (pos pos)
- (include-potential include-potential))
+ (let ((buffer (current-buffer))
+ (include-potential include-potential))
(lambda (response)
(-when-let (result (dart--get response 'result))
- (lexical-let ((name (dart--get result 'element 'name))
- (location (dart--get result 'element 'location)))
+ (let ((name (dart--get result 'element 'name))
+ (location (dart--get result 'element 'location)))
(dart--display-search-results
(dart--get result 'id)
(lambda ()
@@ -1268,29 +1267,24 @@ ARGUMENT. Displays a header beginning with HEADER in
the results."
(dart--analysis-server-send
method
(list (cons argument name))
- (lexical-let ((method method)
- (argument argument)
- (name name)
- (header header))
- (lambda (response)
- (-when-let (id (dart--get response 'result 'id))
- (dart--display-search-results
- id
- (lambda ()
- (setq dart--do-it-again-callback
- (lambda ()
- (dart--find-by-name method argument name header)))
- (insert header name ":\n\n"))))))))
+ (lambda (response)
+ (-when-let (id (dart--get response 'result 'id))
+ (dart--display-search-results
+ id
+ (lambda ()
+ (setq dart--do-it-again-callback
+ (lambda ()
+ (dart--find-by-name method argument name header)))
+ (insert header name ":\n\n")))))))
(defun dart--display-search-results (search-id callback)
"Displays search results with the given SEARCH-ID.
CALLBACK is called with no arguments in the search result buffer
to add a header and otherwise prepare it for displaying results."
- (lexical-let* (buffer
- (search-id search-id)
- beginning-of-results
- (total-results 0))
+ (let (buffer
+ beginning-of-results
+ (total-results 0))
(with-current-buffer-window
"*Dart Search*" nil nil
(dart-popup-mode)
@@ -1309,37 +1303,39 @@ to add a header and otherwise prepare it for displaying
results."
(goto-char (point-max))
(loop
for result across results
- do (lexical-let ((location (dart--get result 'location))
- (path (dart--get result 'path)))
- (let ((start (point)))
- (dart--fontify-excursion '(compilation-info
underline)
- (when (cl-some
- (lambda (element)
- (equal (dart--get element 'kind)
"CONSTRUCTOR"))
- path)
- (insert "new "))
-
- (insert
- (loop for element across path
- unless (member (dart--get element 'kind)
- '("COMPILATION_UNIT" "FILE"
"LIBRARY" "PARAMETER"))
- unless (string-empty-p (dart--get element
'name))
- collect (dart--get element 'name) into names
- finally return (mapconcat 'identity
(reverse names) ".")))
-
- (make-text-button
- start (point)
- 'action (lambda (_) (dart--goto-location
location))))
-
- (dart--json-let location (file (line startLine)
(column startColumn))
- (insert " " file ":"
- (dart--face-string line
'compilation-line-number) ":"
- (dart--face-string column
'compilation-column-number) ?\n)))))
-
- (setq total-results (+ total-results (length results)))
-
- (when (eq is-last t)
- (dart--analysis-server-unsubscribe subscription)
+ do (let ((location (dart--get result 'location))
+ (path (dart--get result 'path))
+ (start (point)))
+ (dart--fontify-excursion '(compilation-info underline)
+ (when (cl-some
+ (lambda (element)
+ (equal (dart--get element 'kind)
"CONSTRUCTOR"))
+ path)
+ (insert "new "))
+
+ (insert
+ (loop for element across path
+ unless (member (dart--get element 'kind)
+ '("COMPILATION_UNIT" "FILE"
"LIBRARY" "PARAMETER"))
+ unless (string-empty-p (dart--get element
'name))
+ collect (dart--get element 'name) into names
+ finally return (mapconcat 'identity (reverse
names) ".")))
+
+ (make-text-button
+ start (point)
+ 'action (lambda (_) (dart--goto-location
location))))
+
+ (dart--json-let location (file (line startLine)
(column startColumn))
+ (insert " " file ":"
+ (dart--face-string line
'compilation-line-number) ":"
+ (dart--face-string column
'compilation-column-number) ?\n)))))
+
+ (setq total-results (+ total-results (length results)))
+
+ (when (eq is-last t)
+ (dart--analysis-server-unsubscribe subscription)
+ (save-excursion
+ (goto-char (point-max))
(insert "\nFound " (dart--face-string total-results 'bold)
" results."))))))))))
(select-window (get-buffer-window buffer))
@@ -1426,25 +1422,25 @@ stayas in place when the parameter is overwritten.")
"completion.getSuggestions"
`(("file" . ,filename)
("offset" . ,(- (point) 1)))
- (lexical-let ((buffer (current-buffer)))
+ (let ((buffer (current-buffer))
+ (first t))
(lambda (response)
(-when-let (completion-id (dart--get response 'result 'id))
- (lexical-let ((first t))
- (dart--analysis-server-subscribe
- "completion.results"
- (setq dart--last-expand-subscription
- (lambda (event subscription)
- (dart--json-let event
- (id results
- (offset replacementOffset)
- (length replacementLength)
- (is-last isLast))
- (when is-last (dart--analysis-server-unsubscribe
subscription))
-
- (when (equal id completion-id)
- (with-current-buffer buffer
- (dart--handle-completion-event results offset
length first))
- (setq first nil)))))))))))))))
+ (dart--analysis-server-subscribe
+ "completion.results"
+ (setq dart--last-expand-subscription
+ (lambda (event subscription)
+ (dart--json-let event
+ (id results
+ (offset replacementOffset)
+ (length replacementLength)
+ (is-last isLast))
+ (when is-last (dart--analysis-server-unsubscribe
subscription))
+
+ (when (equal id completion-id)
+ (with-current-buffer buffer
+ (dart--handle-completion-event results offset
length first))
+ (setq first nil))))))))))))))
(defun dart--handle-completion-event (results offset length first)
"Handles a completion results event.
@@ -1455,7 +1451,7 @@ If FIRST is non-nil, this is the first completion event
for this completion."
;; extra suggestions to support search-as-you-type,
;; but we don't do that.
(when (> length 0)
- (lexical-let ((text (buffer-substring (+ offset 1) (+ offset length 1))))
+ (let ((text (buffer-substring (+ offset 1) (+ offset length 1))))
(setq results
(remove-if-not
(lambda (suggestion)
- [nongnu] elpa/dart-mode 8e09b68 120/192: Exclusively use cl-lib to avoid byte-compilation inconsistencies, (continued)
- [nongnu] elpa/dart-mode 8e09b68 120/192: Exclusively use cl-lib to avoid byte-compilation inconsistencies, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 1249417 108/192: Better handle zero-argument functions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 0277dad 107/192: Include parameter documentation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 73d0ebc 135/192: Merge branch 'refactor-tests', ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 4feac34 123/192: Make sure to provide the full buffer in dart-add-analysis-overlay, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode e01234a 113/192: Use funcall rather than apply where appropriate, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode eba375b 112/192: Parse JSON arrays as lists, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 905ce53 117/192: Fix a bunch of byte-compilation warnings, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 25a0b8a 128/192: Add tests for dart-format, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode d1a0c5e 103/192: Fall back to normal expansion, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 613b311 111/192: Stop using lexical let,
ELPA Syncer <=
- [nongnu] elpa/dart-mode 950d3a8 133/192: Add emacs versions 24.3 and snapshot, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode a4126bd 121/192: Allow s 1.10, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 52034c7 110/192: Add a dart--get helper to make it easier to use JSON, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode f3a7c7b 122/192: Properly tell flycheck when there are no errors, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 1153c53 134/192: Add ert-runner, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 2a95005 159/192: Fix typo in README, regarding M-/ fallback, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode c30eaa9 140/192: Specify path to the dart-sdk inside of flutter, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode d9a12e1 151/192: Fontifies function declarations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode aa628c9 138/192: Remove deprecated analysis server option, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 5d0a7cd 139/192: Use dart-sdk-path to find dartfmt., ELPA Syncer, 2021/08/29