Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close #576, move usage of `downcase' #577

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/sly-mrepl.el
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ current ERROR-LEVEL."
error-level
next-entry-idx
condition)
'sly-mrepl--prompt (downcase package)))
'sly-mrepl--prompt package))
(move-overlay sly-mrepl--last-prompt-overlay beg (sly-mrepl--mark)))
(sly-mrepl--ensure-prompt-face)
(buffer-disable-undo)
Expand Down
2 changes: 1 addition & 1 deletion sly.el
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ that returns one such construct.")
(match-string 1 name))
((string-match "^\"\\(.*\\)\"$" name)
(match-string 1 name))
(t name)))
(t (downcase name))))

(add-to-list 'mode-line-misc-info
`(sly-mode (" [" sly--mode-line-format "] ")))
Expand Down
34 changes: 17 additions & 17 deletions slynk/slynk-completion.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@
(push s result)))
(remove-duplicates result)))

(defun unparse-symbol (symbol)
(defun unparse-string (string)
(let ((*print-case* (case (readtable-case *readtable*)
(:downcase :upcase)
(t :downcase))))
(unparse-name (symbol-name symbol))))
(unparse-name string)))

(defun unparse-symbol (symbol)
(unparse-string (symbol-name symbol)))

(defun prefix-match-p (prefix string)
"Return true if PREFIX is a prefix of STRING."
Expand Down Expand Up @@ -255,7 +258,7 @@ A floating-point score. Higher scores for better matches."
A match is a list (STRING SYMBOL INDEXES SCORE).
Return non-nil if match was collected, nil otherwise."
(multiple-value-bind (indexes score)
(flex-matches pattern string #'char=)
(flex-matches pattern (string-upcase string) #'char=)
(when indexes
(funcall collector
(list string
Expand All @@ -277,8 +280,9 @@ Matches are produced by COLLECT-IF-MATCHES (which see)."
(collecting (collect)
(and (char= (aref pattern 0) #\:)
(do-symbols (s +keyword-package+)
(collect-if-matches #'collect pattern (concatenate 'simple-string ":"
(symbol-name s))
(collect-if-matches #'collect pattern
(let ((*print-case* :downcase))
(prin1-to-string s))
s)))))

(defun accessible-matching (pattern package)
Expand All @@ -298,7 +302,7 @@ Matches are produced by COLLECT-IF-MATCHES (which see)."
(unless (gethash s collected)
(setf (gethash s collected) t)
(funcall #'collect thing)))
pattern (symbol-name s) s))))))
pattern (unparse-symbol s) s))))))

(defun qualified-matching (pattern home-package)
"Find package-qualified symbols flex-matching PATTERN.
Expand Down Expand Up @@ -364,10 +368,8 @@ Matches are produced by COLLECT-IF-MATCHES (which see)."
(setf (gethash s collected) t)
(funcall #'collect-internal thing)))
pattern
(concatenate 'simple-string
nickname
"::"
(symbol-name s))
(untokenize-symbol
(unparse-string nickname) t (unparse-symbol s))
s)))))
(t
(loop
Expand All @@ -389,10 +391,10 @@ Matches are produced by COLLECT-IF-MATCHES (which see)."
(loop for nickname in sorted-nicknames
do (collect-if-matches #'collect-external
pattern
(concatenate 'simple-string
nickname
":"
(symbol-name s))
(untokenize-symbol
(unparse-string nickname)
nil
(unparse-symbol s))
s))))))))))))))

(defslyfun flex-completions (pattern package-name &key (limit 300))
Expand All @@ -417,9 +419,7 @@ Returns a list of (COMPLETIONS NIL). COMPLETIONS is a list of
for i upto limit
collect e)
collect
(list (if (every #'common-lisp:upper-case-p pattern)
(string-upcase string)
(string-downcase string))
(list string
score
(to-chunks string indexes)
(readably-classify symbol)))
Expand Down