-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add completion-at-point function for completing latexsubs #82
Conversation
ede359a
to
158bb52
Compare
I am a bit confused, I thought that |
|
If |
2ab10bf
to
48a5409
Compare
In the completion-at-point function, the :exit-function property is set to replace the LaTeX string with the unicode character when completion is finished. This should give feature-parity with current code.
48a5409
to
b40a0b3
Compare
I've update the gif to show what emacs vanilla completion looks like with this PR without company (actually ran it with |
The problem with completion using |
@giordano then users are free to rebind Maybe a note in the README/COMMENTARY on setting up vanilla TAB completion by setting |
Or maybe set |
Then you lose all the benefits of this PR wrt nicer, well-integrated completion (see the gif in the first post). But I agree that doing so would be an improvement on the current state. Would probably break ess though. EDIT: on second thought, I think that would be worse. You're breaking the implicit contract (interface) of |
For what it's worth, this change allows completion/latexsub from the middle of symbols, so it can supercede #70. |
b40a0b3
to
0e6130d
Compare
It's ready now. Not gonna write tests until there's a clear disposition to merge/not merge. |
Is there a way to mimic the old behavior (completions pop up automatically when applicable) with this solution? I like your code very much (it is very clean and nicely written), but would be unwilling to break current behavior. |
Completions only came up with Tab before, right? Not just automatically. If tab-completion is a requirement, I think the least intrusive solution would be to add a customizable variable |
Sorry, yes, I mixed it up with some other mode. I am fine with any solution that
|
Also, given your last comment in #80 (what you are after does not work, after all), what's the advantage of this PR for users? (I admit that the code is much nicer, and in case this PR is not merged in full it should be ported back). |
What I was after did end up working. I hadn't yet found the documentation on |
a255d83
to
4888245
Compare
Are you super attached to this precise algorithm? With the change I just pushed in c0ba31c, Tab tries to indent and then completes if that doesn't do anything (indent->complete instead of complete->indent). Since the cases where you're editing a buffer and want to complete without having yet indented are fairly rare (and indent->complete is a built-in emacs completion behavior), this seems acceptable to me. Even in the case where the line hasn't yet been indented, completion just takes 2 presses of Tab instead of 1. |
FWIW the behaviour @non-Jedi describes there is what I would expect as the emacsy way. There are a some outlier modes, namely cc-mode and ess, that rebind TAB, but I think that is just because they have both been around forever, and they go to lengths to replicate the standard behaviour. |
@non-Jedi: no, I think am fine with either order, but I will test in practice. I will do the cleanup for MELPA first, then make a release, then drop support for 23, and then I am open to merging this. |
4888245
to
d9f676f
Compare
So after living with this for a bit, it has a couple of issues in practice related to third-party packages. Neither ivy nor company consistently calls the So in summary:
Possible ways forward:
|
Thanks for exploring this so thoroughly. Since we do have a working completion implementation, just keeping it may be the simplest solution. However, I find your code very nice (much cleaner than what we currently have) and it would be great if you could port it back to this package. It is my understanding that this is essentially the last option you suggested, correct? |
In the past I've used
which appears to work in this case for company (don't know about ivy) |
Even if that works in this case, I think it's going against the "meaning" of
Sure; I could refactor out the part that's common to completion and substitution. My preference is to first wait and see what the ivy and company upstreams say. I think that current behavior is a bug and might be quickly fixed. One other really hacky idea I had was to append a zero-width-space to the end of all the EDIT: actually using EDIT2: So if |
Note it shouldn't be hard to check if exit-function is being called from company or vanilla -- but I don't think it is necessary anyway -- do you have an example of unexpected behaviour with |
Replying to your comment here to keep it in a more relevant place: #93 (comment) I won't be able to use any of the code you linked unless you release it under a compatible license. ;) |
@non-Jedi Sure thing, everything there is just public domain, but I added a license -- I had been planning on suing you after you make millions off this code in the future, but oh well :D Now, I'all actually probably just steal it back if you use and improve it. I may have some more time in a week or two if your looking for help on any of this or smie stuff. |
If you want to help take care of my annoyances for me, I would of course be mighty thankful. I tend not to have a lot of time to devote to this kind of stuff. SMIE in particular is faaarr down my list of priorities and might not be touched for months if not years (if ever). |
Company has fixed this on master, which as far as I know is by far the most common external in-buffer completion framework. |
@non-Jedi, I think this PR does two things:
I wonder if you would be willing to port the first part as a PR to current master, with tests, etc. It would be a nice improvement. Then, as those two other packages catch up, hooking into them could be done. |
So my opinion is that this PR does the following:
1 is non-controversial. 2 is probably the same as long as we keep the existing substitution stuff. 3 probably needs to wait for ivy to fix it's crap. 4 I've become convinced is a bad idea after having used this fork as a daily driver for the past months. The current implementation uses the string from the |
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
Closing in favor of #100 |
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
This is a version of JuliaEditorSupport#82 without the usage of :exit-function to replace the LaTeX string with a unicode symbol.
Closes #80.
Example gif using vanilla completion-at-point via M-TAB:
@tpapp trying this might give you a better idea what I was going for in #80. Before this could be merged, I'd need to:
julia-latexsub
based implementationsubr-x
which wasn't added to emacs until 24.4