Line 0
Link Here
|
|
|
1 |
--- sly-asdf.el.orig 2020-03-06 04:33:38 UTC |
2 |
+++ sly-asdf.el |
3 |
@@ -32,7 +32,6 @@ |
4 |
(require 'sly) |
5 |
(require 'cl-lib) |
6 |
(require 'grep) |
7 |
-(require 'sly-asdf-flymake) |
8 |
|
9 |
(defvar sly-mrepl-shortcut-alist) ;; declared in sly-mrepl |
10 |
|
11 |
@@ -58,13 +57,23 @@ |
12 |
(:license "GPL") |
13 |
(:slynk-dependencies slynk-asdf) |
14 |
(:on-load |
15 |
- (add-hook 'sly-connected-hook |
16 |
- ;; MG: Investigate race, due to when ASDF loads? |
17 |
- (lambda () (run-with-idle-timer .5 nil #'sly-asdf-flymake))) |
18 |
(setq sly-mrepl-shortcut-alist |
19 |
(append sly-mrepl-shortcut-alist sly-asdf-shortcut-alist)))) |
20 |
|
21 |
|
22 |
+(defvar *sly-asdf-lisp-extensions* (list "lisp") |
23 |
+ "File extensions to look for when finding open Lisp files.") |
24 |
+ |
25 |
+(defun sly-asdf--lisp-buffer-p (buffer) |
26 |
+ "Check whether BUFFER refers to a Lisp buffer." |
27 |
+ (member (file-name-extension (buffer-name buffer)) *sly-asdf-lisp-extensions*)) |
28 |
+ |
29 |
+ |
30 |
+(defun sly-asdf--current-lisp-buffers () |
31 |
+ "Traverses the current `buffer-list`, returning those buffers with a .lisp extension." |
32 |
+ (cl-remove-if-not #'sly-asdf--lisp-buffer-p (buffer-list))) |
33 |
+ |
34 |
+ |
35 |
;;; Interactive functions |
36 |
|
37 |
(defun sly-asdf-load-system (&optional system) |
38 |
@@ -178,26 +187,21 @@ buffer's working directory" |
39 |
(isearch-forward))) |
40 |
|
41 |
|
42 |
-(defun sly-asdf-query-replace-system (_name from to &optional delimited) |
43 |
- "Run `query-replace' on an ASDF system with NAME given FROM and TO with optional DELIMITED." |
44 |
- ;; MG: Underscore added to _name to suppress an unused-lexical-arg warning that fires |
45 |
- ;; despite the var being used in the condition-case below. |
46 |
+(defun sly-asdf-query-replace-system (name from to &optional delimited) |
47 |
+ "Query-replace in all files of an ASDF system. |
48 |
+ |
49 |
+NAME is the ASDF's sytem name, FROM is the string to replace, TO |
50 |
+its replacement, and the optional DELIMITED when true restricts |
51 |
+replacements to word-delimited matches." |
52 |
(interactive (let ((system (sly-asdf-read-system-name))) |
53 |
(cons system (sly-asdf-read-query-replace-args |
54 |
"Query replace throughout `%s'" system)))) |
55 |
- (condition-case c |
56 |
- ;; `tags-query-replace' actually uses `query-replace-regexp' |
57 |
- ;; internally. |
58 |
- (tags-query-replace (regexp-quote from) to delimited |
59 |
- '(mapcar 'sly-from-lisp-filename |
60 |
- (sly-eval `(slynk-asdf:asdf-system-files ,_name)))) |
61 |
- (error |
62 |
- ;; Kludge: `tags-query-replace' does not actually return but |
63 |
- ;; signals an unnamed error with the below error |
64 |
- ;; message. (<=23.1.2, at least.) |
65 |
- (unless (string-equal (error-message-string c) "All files processed") |
66 |
- (signal (car c) (cdr c))) ; resignal |
67 |
- t))) |
68 |
+ (fileloop-initialize-replace |
69 |
+ (regexp-quote from) to 'default |
70 |
+ (mapcar #'sly-from-lisp-filename |
71 |
+ (sly-eval `(slynk-asdf:asdf-system-files ,name))) |
72 |
+ delimited) |
73 |
+ (fileloop-continue)) |
74 |
|
75 |
|
76 |
(defun sly-asdf-query-replace-system-and-dependents |
77 |
@@ -344,14 +348,10 @@ in the directory of the current buffer." |
78 |
(setf sly-last-compilation-result result) ;; For interactive use |
79 |
(when sly-highlight-compiler-notes |
80 |
(sly-highlight-notes notes)) |
81 |
+ (when message (message message)) |
82 |
;; Conditionally show compilation log and other options defined in settings |
83 |
(run-hook-with-args 'sly-compilation-finished-hook successp notes buffer t))) |
84 |
|
85 |
- |
86 |
- |
87 |
-;;;###autoload |
88 |
-(with-eval-after-load 'sly |
89 |
- (add-to-list 'sly-contribs 'sly-asdf 'append)) |
90 |
|
91 |
|
92 |
(provide 'sly-asdf) |