-
Notifications
You must be signed in to change notification settings - Fork 145
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
Extended completion-sort-predicate code to be able to use package and pattern for sorting #417
Open
svetlyak40wt
wants to merge
333
commits into
joaotavora:scratch/fix-193-export-a-completion-sorting-function
Choose a base branch
from
svetlyak40wt:scratch/fix-193-export-a-completion-sorting-function
base: scratch/fix-193-export-a-completion-sorting-function
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* contrib/sly-stickers.el (sly-stickers--level): Move up in file before usage.
* sly.el (sly--add-in-buffer-note): Simplify. * contrib/sly-stickers.el (sly-stickers--level): Use sly-button--level. * lib/sly-buttons.el (sly-button--overlays-at): Use sly-button--level. (sly-button--level): Use helper.
...or other users of sly-to-lisp-filename-function. Per joaotavora#257 and joaotavora#256. * contrib/sly-mrepl.el (sly-mrepl-sync): Use sly-to-lisp-filename
...where they completely break things. Filenames are an example of strings handed to Lisp that might have such properties: sly-tramp used in conjuntion with Helm seems to provoke this. The best way would be to do it at a lower level, in sly-prin1-to-string, but it doesn't seem possible for now, so just unpropertize strings in sly-to-lisp-filename. Per joaotavora#257 and joaotavora#256. Thanks to Alexander Artemenko for the original implementation. * sly.el (sly-to-lisp-filename): Use substring-no-properties.
* contrib/sly-stickers.el (when): Don't require 'cl, except sometimes on Emacs <26 * contrib/sly-tramp.el (cl-lib): require it. (sly-create-filename-translator): Use let. (sly-tramp-to-lisp-filename): Use cl-first and cl-second.
* contrib/sly-stickers.el (sly-stickers--replay-refresh-1): use cl-rest. (sly-stickers-replay): use cl-plusp. (sly-stickers-replay-refresh): use cl-plusp. (sly-stickers--handle-break): use cl-first.
* contrib/sly-stickers.el (sly-stickers--flashing-sticker): New variable. (sly-stickers--find-and-flash): Avoid interflashing.
* contrib/sly-mrepl.el (sly-mrepl-sync): Unbreak.
* contrib/slynk-stickers.lisp (:slynk-stickers): Export *BREAK-ON-STICKERS*.
WITHOUT-PRINTING-ERRORS must be either passed a non-nil STREAM, or no STREAM at all. Otherwise, it will always expand to its first clause, and will break horribly and misteriously when a printing error actually occurs. * slynk/slynk.lisp (without-printing-errors): Add comment. (slynk-pprint): Ensure WITHOUT-PRINTING-ERRORS is either passed a non-nil STREAM, or no STREAM at all.
This affects the REPL, Inspector, Trace Dialog, etc... Ideally we could just respect *PRINT-RIGHT-MARGIN*, but implementations don't seem to support that, and it would probably require a column-counting gray-stream. Respecting *PRINT-LENGTH* should help avoid the most common cases of slowdowns due to very large strings. Reported by Renee Klawitter. * slynk/slynk.lisp (slynk-pprint): Handle strings specially.
This variable, similarly to * or +, is defined in the REPL. It holds the value of the currently evaluated form during the evaluation itself. It holds the value about to be given to +. * contrib/slynk-mrepl.lisp (mrepl-eval-1): Set - . * slynk/slynk.lisp (simple-repl): Set - .
…x arg * sly.el (sly-switch-to-most-recent): change prefix-arg to current-prefix-arg, since the former does not store anything.
…mma shortcut * contrib/sly-mrepl (sly-mrepl-shortcut-alist): Add "sly-quit-lisp".
Bogus call to sly-write-string was inherited from a call to slime-write-string, a function in contrib/slime-repl.el called extemporaneously from slime.el. * sly.el (sly-db-eval-in-frame): Don't call sly-write-string, Co-authored-by: João Távora <joaotavora@gmail.com>
* slynk/slynk.lisp (with-struct*): Delete. (lcons-cdr, control-thread): Don't use WITH-STRUCT*.
* sly.el (sly-eval): Tweak catch-tag's name.
* sly.el: Bump version to 1.0.0-beta-3 * contrib/sly-trace-dialog.el (sly-trace-dialog--open-specs): Use lambda. Expect cons spec. (sly-trace-dialog--insert-trace, sly-trace-dialog-spec-button): Expect cons spec. * contrib/slynk-trace-dialog.lisp (report-specs) (describe-trace-for-emacs): Report spec as conses.
Elisp/Lisp flow control sometimes still produces stale continuations sometimes appear in some hard-to-reproduce scenarios that aren't still totally clear to me. Take a hint from Emacs lisp/jsonrpc.el's jsonrpc-request function and don't mess with inhibit-quit or quit-flag. The only confirmed user-visible difference is that C-g'ing immediately after:: (sly-eval '(cl:progn (cl:sleep 42) 'hmmm)) Would lead to an error 42 seconds later. * sly.el (sly--stack-eval-tags): Rename from sly-stack-eval-tags. Document. (sly-eval): Simplify. (sly-db-setup): Use sly--stack-eval-tags
* slynk/slynk.lisp (spawn-worker-thread): Call REMOVE-ACTIVE-THREAD here. (dispatch-event): Not here.
* contrib/slynk-arglists.lisp (decode-required-arg): Don't break if ARG is a number.
This makes for a less contentious, more efficient SLYNK-BACKEND:RECEIVE-IF implementation, i.e. one that isn't constantly checking for interrupts. Co-authored-by: Michael Kirkland <mkirkland@ravenpack.com> * slynk/backend/allegro.lisp (wake-thread): New implementation. (receive-if): Rewrite.
* contrib/slynk-stickers.lisp (invoke-debugger-for-sticker): Fix IGNORE-THIS-STICKER restart.
* contrib/sly-stickers.el (sly-stickers--set-face): Adjust sticker shading.
* contrib/sly-stickers.el (pulse-momentary-unhighlight): Work around a pulse.el. bug.
* sly.el (sly-db-invoke-restart-by-name): Use cl-first Copyright-paperwork-exempt: yes
… streams Close joaotavora#583. Streams, whether gray or not, have a so-called output-column or line-column. This change makes sure to reset it to 0 when the stream is flushed, fixing the REPL problems described in joaotavora#581. In slynk/slynk-gray.lisp a new generic RESET-STREAM-LINE-COLUMN is added, with a method for SLY's gray stream couple class, SLY-OUTPUT-STREAM, and a couple of extra methods for SBCL and CMUCL, which aren't always using gray streams in the context where stream-flushing is needed. This allows us to call RESET-STREAM-LINE-COLUMN safely in slynk/slynk.lisp's FLUSH-LISTENER-STREAMS (except for abcl, which has some problem I didn't investigate). * slynk/slynk-gray.lisp (reset-stream-line-column): New generic and methods. * slynk/slynk.lisp (flush-listener-streams): Call reset-stream-line-column. Commit-message-by: João Távora <joaotavora@gmail.com>
* sly.el (sly-remove-method): Use sly-eval. * lib/sly-completion.el (sly-parse): Require it. (sly--read-method): Rework. Add docstring. Fix CL terminology. * slynk/slynk.lisp (remove-method-by-name): Rename from undefine-method. Just error when method not found. Add docstring (generic-method-specs): Rename from method-selectors. Add docstring.
Leads to recursive requires. Need to find a better way to solve this. * lib/sly-completion.el (sly-parse): Don't require;
This sets the variable elisp-flymake-byte-compile-load-path which allows flymake-mode to work properly in the lib/*.el files. * .dir-locals.el: New file.
* NEWS.md: mention sly-remove-method * doc/sly.texi: mention sly-remove-method
More than one face may be applied to a region, and the test didn't expect that. * test/sly-fontifying-fu-tests.el (font-lock-magic): Fix.
More Elisp files in subdirectories need correct settings of elisp-flymake-byte-compile-load-path. * .dir-locals.el: Enhance.
* lib/sly-tests.el (sly-tests-auto-tags): Protect against file-less compilation.
* test/sly-package-fu-tests.el: New file.
Instead of strings, use lisp forms, which are easier to read. Make some tests where :USE subforms aren't present. Use find-file-noselect. Change name of test. test/sly-package-fu-tests.el (package-fu-import): Rework.
… in name For example, if the package is `bknr.datastore`, it'll keep creating multiple `(:import-from ...)` statements. * contrib/sly-package-fu.el (sly-package-fu--search-import-from): Don't regexp-quote twice.
Previously, if a DEFPACKAGE form had no :USE or :IMPORT-FROM subforms at, C-c i would not be able to find a suitable palce for a new :IMPORT-FROM subform. This commit fixes that. Related to joaotavora#560 * contrib/sly-package-fu.el (sly-package-fu--create-new-import-from): Fix finding suitable place for new :import-from.
Related to joaotavora#560. * contrib/sly-package-fu.el (sly-package-fu--insert-symbol): Fix.
slynk-backend:find-symbo2l -> slynk-backend:find-symbol2 * slynk/backend/allegro.lisp (with-redirected-y-or-n-p): Fix typo.
* slynk/backend/lispworks.lisp (package-local-nicknames): New impl.
* slynk/backend/lispworks.lisp (set-sigint-handler) (install-sigint-handler): Use SYS::UNIX-SIGINT.
The default value for SLYNK-MREPL::*DEDICATED-OUTPUT-STREAM-BUFFERING* depends on the comm style and, previously, a rare but possible 'nil' comm style (as in Clisp) would also prevent a gray stream from being used for the dedicated output stream, So a native stream would be used instead. This is possible, but only on sbcl and cmucl. So always make a gray stream, regardless of the value of SLYNK-MREPL::*DEDICATED-OUTPUT-STREAM-BUFFERING*. Fix joaotavora#595, Fix joaotavora#600. * contrib/slynk-mrepl.lisp (open-dedicated-output-stream): Always use line-buffering for the dedicated output stream.
* sly.el (sly-quit-connection-at-point): Invoke function with a floating-point argument.
…fers * lib/sly-buttons.el (sly-button-define-part-action): Pass NO-ERROR to sly-button-at- calls. Co-authored-by: João Távora <joaotavora@gmail.com>
Let SLYNK::SEND-TO-INDENTATION-CACHE be called without Emacs connection * slynk/slynk.lisp (send-to-indentation-cache): Don't fail if no Emacs connection.
SBCL reuses conses. Closes joaotavora#626
…otavora#634) See also joaotavora#631. This allows add-ons like 'kind-icon' to show icons for the completions in completion frontends like Company. Co-authored-by: João Távora <joaotavora@gmail.com> * lib/sly-completion.el (sly-flex-completions): Record classification and score separately. (sly--completions-complete-symbol-1): Emit :company-kind (sly-completion-annotation): Rework (sly--completion-fill-completions-buffer): Use sly-completion-annotation.
This emulates try-completion half-decently when sly-complet-symbol-function is the non-default sly-simple-completions and sly-symbol-completion-mode is off. * lib/sly-completion.el (completion-styles-alist) (completion-category-overrides): Tweak. (sly--external-allc, sly--external-tryc): New helpers. (completion--backend-call, completion-backend-try-completion) (completion-backend-all-completions): Remove. (sly--completion-function-wrapper): Simplify.
Use it to control whether to prompt interactively about replacing SLIME, and if not prompting whether to replace or not replace. Thanks to Stefan Monnier for suggesting improvements to the original patch. * sly.el (sly-replace-slime): New defcustom. Co-authored-by João Távora <joaotavora@gmail.com>
* slynk/slynk-completion.lisp (:slynk-completion): Export (*completion-sort-predicate*): New parameter. (sort-by-score): Use it.
… pattern for sorting. Here is an example of a custom function, which moves higher results from the same packages of the current package inferred ASDF system: (defun is-from-same-system (left-package right-package) (let* ((left-package-name (package-name left-package)) (right-package-name (package-name right-package)) (slash-in-left (position #\/ left-package-name)) (slash-in-right (position #\/ right-package-name))) (string= (subseq left-package-name 0 slash-in-left) (subseq right-package-name 0 slash-in-right)))) (defun sort-autocompletion-results (left right) (cond ;; We need this branch to keep ordering by ;; score between symbols from the same package ((is-from-same-system (symbol-package left) (symbol-package right)) nil) ;; This will move results from the current-buffer's ;; package to the front. ((is-from-same-system (symbol-package left) slynk-completion:*current-package*) t)))
svetlyak40wt
force-pushed
the
scratch/fix-193-export-a-completion-sorting-function
branch
from
June 14, 2024 17:48
598d14f
to
24a18f0
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is an example of a custom function, which moves higher
results from the same packages of the current package inferred ASDF system: