Emacs completion: Include module prefix in completion candidates - #497
Conversation
1fbf45c to
ae644e9
Compare
|
@bbatsov You contributed the original code: Could you take a look? |
e99219b to
b684685
Compare
| (push argument utop-completion) | ||
| (throw 'done t)))))) | ||
| (when-let* ((pos (string-match "[^.]*$" prefix)) | ||
| ((string-prefix-p (substring prefix pos) argument))) |
There was a problem hiding this comment.
I don't like much pushing conditional checks without bindings to when-let, as this makes a bit harder to understand what the code does.
| (throw 'done t)))))) | ||
| (when-let* ((pos (string-match "[^.]*$" prefix)) | ||
| ((string-prefix-p (substring prefix pos) argument))) | ||
| (push (concat (substring prefix 0 pos) argument) utop-completion) |
There was a problem hiding this comment.
Probably a binding for (substring prefix 0 pos) will make this bit of code slightly easier to understand.
There was a problem hiding this comment.
Thanks for your helpful suggestions. I amended the commit.
Fixes a mismatch of the completion START position in the Emacs buffer and the candidatates that didn't include the expected module-prefix. Fixes ocaml-community#455
b684685 to
1b0d11a
Compare
bbatsov
left a comment
There was a problem hiding this comment.
The proposed change seems solid to me!
|
The code looks correct from afar (I am unfortunately less familiar with emacs than with the compiler), however I am not been able to reproduce the bug report yet. @juergenhoetzel , do you have a full reproduction case that I could follow to check the bug and the fix in order to move forward with this PR? |
Of course:
Result: No completions Using this PR, this will result in |
|
I finally found the time to test the fix, sorry for the wait ! I have merged the PR and it should be part of the upcomong 2.16.0 release this week. |
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
Fixes a mismatch of the completion START position in the Emacs buffer and the candidatates that didn't include the expected module-prefix.
Fixes #455