Skip to content

Commit

Permalink
Fix compatibility for AllegroCL
Browse files Browse the repository at this point in the history
especially for Allegro's Modern Mode: https://franz.com/support/tech_corner/modern.mode.lhtml
  • Loading branch information
Tianyu Gu committed Apr 26, 2023
1 parent 8820a62 commit 925f3da
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
4 changes: 3 additions & 1 deletion slynk/slynk-completion.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,9 @@ Returns a list of (COMPLETIONS NIL). COMPLETIONS is a list of
(when (plusp (length pattern))
(list (loop
with package = (guess-buffer-package package-name)
with upcasepat = (string-upcase pattern)
with upcasepat = (if (eq :UPCASE (readtable-case *readtable*))
(string-upcase pattern)
pattern)
for (string symbol indexes score)
in
(loop with (external internal)
Expand Down
33 changes: 27 additions & 6 deletions slynk/slynk.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,12 @@ keywords: :BOUNDP, :FBOUNDP, :CONSTANT, :GENERIC-FUNCTION,
(when (find-class symbol nil) (push :class result))
(when (macro-function symbol) (push :macro result))
(when (special-operator-p symbol) (push :special-operator result))
(when (find-package symbol) (push :package result))
(when #-allegro (find-package symbol)
#+allegro (handler-case (find-package symbol)
(error (e)
(log-event "classify-symbol: error raised in find-package (allegro)")
nil))
(push :package result))
(when (and (fboundp symbol)
(typep (ignore-errors (fdefinition symbol))
'generic-function))
Expand Down Expand Up @@ -2966,11 +2971,19 @@ soon once non-ASDF loading is removed. (see github#134)")
Receives a module name as argument and should return non-nil if it
managed to load it.")
(:method ((method (eql :slynk-loader)) module)
(funcall (intern "REQUIRE-MODULE" :slynk-loader) module))
(funcall (intern #.(if (eq :UPCASE (readtable-case *readtable*))
"REQUIRE-MODULE"
"require-module")
:slynk-loader)
module))
(:method ((method (eql :asdf)) module)
(unless *asdf-load-in-progress*
(let ((*asdf-load-in-progress* t))
(funcall (intern "LOAD-SYSTEM" :asdf) module)))))
(funcall (intern #.(if (eq :UPCASE (readtable-case *readtable*))
"LOAD-SYSTEM"
"load-system")
:asdf)
module)))))

(defun add-to-load-path-1 (path load-path-var)
(pushnew path (symbol-value load-path-var) :test #'equal))
Expand All @@ -2979,9 +2992,15 @@ managed to load it.")
(:documentation
"Using METHOD, consider PATH when searching for modules.")
(:method ((method (eql :slynk-loader)) path)
(add-to-load-path-1 path (intern "*LOAD-PATH*" :slynk-loader)))
(add-to-load-path-1 path (intern #.(if (eq :UPCASE (readtable-case *readtable*))
"*LOAD-PATH*"
"*load-path*")
:slynk-loader)))
(:method ((method (eql :asdf)) path)
(add-to-load-path-1 path (intern "*CENTRAL-REGISTRY*" :asdf))))
(add-to-load-path-1 path (intern #.(if (eq :UPCASE (readtable-case *readtable*))
"*CENTRAL-REGISTRY*"
"*central-registry*")
:asdf))))

(defvar *slynk-require-hook* '()
"Functions run after SLYNK-REQUIRE. Called with new modules.")
Expand Down Expand Up @@ -3219,7 +3238,9 @@ QUALIFIERS and SPECIALIZERS are lists of strings."
(mapcar (lambda (specializer)
(if (typep specializer 'slynk-mop:eql-specializer)
(format nil "(eql ~A)"
(sb-mop:eql-specializer-object specializer))
(funcall #+allegro 'mop:eql-specializer-object
#+sbcl 'sb-mop:eql-specializer-object
specializer))
(prin1-to-string (class-name specializer))))
(slynk-mop:method-specializers method))))
(slynk-mop:generic-function-methods (read-as-function generic-name))))
Expand Down

0 comments on commit 925f3da

Please sign in to comment.