View | Details | Raw Unified | Return to bug 254016 | Differences between
and this patch

Collapse All | Expand All

(-)editors/sly-asdf/Makefile (+53 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	sly-asdf
4
PORTVERSION=	20200306
5
CATEGORIES=	editors elisp
6
PKGNAMESUFFIX=	${EMACS_PKGNAMESUFFIX}
7
8
MAINTAINER=	olce.freebsd.ports@certner.fr
9
COMMENT=	SLY support for ASDF
10
11
LICENSE=	GPLv3
12
13
MY_DEPENDS=	${PREFIX}/${EMACS_VERSION_SITE_LISPDIR}/sly/sly.el:editors/sly
14
BUILD_DEPENDS=	${MY_DEPENDS}
15
RUN_DEPENDS=	${MY_DEPENDS}
16
17
USES=		emacs
18
USE_GITHUB=	yes
19
GH_ACCOUNT=	mmgeorge
20
GH_TAGNAME=	32ce14994e8faee9321605cec36d156b02996c46
21
22
NO_ARCH=	yes
23
24
EMACS_COMPILE=	${EMACS_CMD} --batch --no-site-file -L ${WRKSRC} \
25
		-f batch-byte-compile
26
27
THIS_LISPDIR=	${PREFIX}/${EMACS_VERSION_SITE_LISPDIR}/${PORTNAME}
28
PLIST_SUB=	THIS_LISPDIR=${THIS_LISPDIR}
29
30
OPTIONS_DEFINE=	DOCS
31
32
PORTDOCS=	README.md
33
34
post-patch:
35
	cd ${WRKSRC} && rm -f *flymake*
36
37
do-build:
38
	cd ${WRKSRC} && ${EMACS_COMPILE} sly-*.el
39
40
do-install:
41
	@${MKDIR} ${STAGEDIR}${THIS_LISPDIR}
42
	(cd ${WRKSRC} && \
43
		${COPYTREE_SHARE} . ${STAGEDIR}${THIS_LISPDIR} \
44
		"! ( -depth 1 ( ${PORTDOCS:C/^(.*)$/-name \1 -o/} \
45
			-name LICENSE -o -name *\.md ) -o \
46
			-path \./test* -o -path \./.[^.]* -o \
47
			-name *\.orig )")
48
49
post-install-DOCS-on:
50
	${MKDIR} ${STAGEDIR}${DOCSDIR}
51
	${INSTALL_DATA} ${PORTDOCS:%=${WRKSRC}/%} ${STAGEDIR}${DOCSDIR}
52
53
.include <bsd.port.mk>
(-)editors/sly-asdf/distinfo (+3 lines)
Line 0 Link Here
1
TIMESTAMP = 1614800779
2
SHA256 (mmgeorge-sly-asdf-20200306-32ce14994e8faee9321605cec36d156b02996c46_GH0.tar.gz) = 8923faee95e995363d36e34d321d1381ecfdcef34f2219cebdc1978bbdd2d1a2
3
SIZE (mmgeorge-sly-asdf-20200306-32ce14994e8faee9321605cec36d156b02996c46_GH0.tar.gz) = 42930
(-)editors/sly-asdf/files/patch-README.md (+15 lines)
Line 0 Link Here
1
--- README.md.orig	2020-03-06 04:33:38 UTC
2
+++ README.md
3
@@ -16,8 +16,8 @@ Installing manually will require the contrib be regist
4
 ```
5
 (add-to-list 'sly-contribs 'sly-asdf 'append)
6
 ```
7
+
8
 ## Experimental
9
-SLY-ASDF currently supports a very experimental system-aware checker that builds on flymake. This loads the system in a separate process and highlights any compilation/load errors for currently opened buffers. Only tested with SBCL. Enable this with 
10
-```
11
-(setq sly-asdf-enable-experimental-syntax-checking t)
12
-```
13
+Upstream currently supports a very experimental system-aware checker that
14
+builds on flymake. It is not available in this port (please use some ELPA
15
+package instead).
(-)editors/sly-asdf/files/patch-sly-asdf.el (+92 lines)
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)
(-)editors/sly-asdf/pkg-descr (+4 lines)
Line 0 Link Here
1
sly-asdf is an external contrib for SLY that enables specific support and
2
shortcuts for ASDF operations.
3
4
WWW: https://github.com/mmgeorge/sly-asdf
(-)editors/sly-asdf/pkg-message (+27 lines)
Line 0 Link Here
1
[
2
{ type: install
3
  message: <<EOM
4
To use the sly-asdf contrib, you must:
5
1. Register sly-asdf into SLY. You just have to add this line to some init
6
   file:
7
(require 'sly-asdf)
8
   Doing this is not strictly necessary if you want to automatically activate
9
   this contrib using `sly-contribs' (see below), but it never hurts.
10
   This contrib's automatic activation at load was disabled, contrary to what
11
   upstream does.
12
2. Ensure that ASDF is loaded by your Common Lisp implementation.
13
14
If you want sly-asdf to be automatically activated on each new SLY
15
session, put it in the `sly-contribs' list. E.g., you can add something like
16
this in some Emacs' init file:
17
(setq sly-contribs '(sly-fancy sly-asdf))
18
or customize the variable.
19
20
To enable it on demand in already running SLY sessions instead, just use the
21
`sly-enable-contrib' command, or modify `sly-contribs' and run `sly-setup'.
22
23
NOTE: The experimental Flymake code has been elided from this port (it requires
24
dependencies that are not in ports currently).
25
EOM
26
}
27
]
(-)editors/sly-asdf/pkg-plist (+4 lines)
Line 0 Link Here
1
%%THIS_LISPDIR%%/sly-asdf.el
2
%%THIS_LISPDIR%%/sly-asdf.elc
3
%%THIS_LISPDIR%%/slynk-asdf.asd
4
%%THIS_LISPDIR%%/slynk-asdf.lisp

Return to bug 254016