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

Work with proposed updates to julia-mode LaTeX completion #236

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

non-Jedi
Copy link
Contributor

@non-Jedi non-Jedi commented Apr 2, 2020

JuliaEditorSupport/julia-emacs#100 changes
LaTeX completion in julia-mode to work by a combination of
completion-at-point-function and abbrev-mode. This is the necessary
change to give full-featured LaTeX completion with emacs-jupyter julia
buffers with the PR in its current form.

Unlike #201, this is actually working. Obviously shouldn't be merged until/if JuliaEditorSupport/julia-emacs#100 is merged, but since I've already done the work, I thought it worthwhile to publish here.

JuliaEditorSupport/julia-emacs#100 changes
LaTeX completion in julia-mode to work by a combination of
completion-at-point-function and abbrev-mode. This is the necessary
change to give full-featured LaTeX completion with emacs-jupyter julia
buffers with the PR in its current form.
@non-Jedi
Copy link
Contributor Author

non-Jedi commented May 11, 2023

The LaTeX symbol completion rework has been merged into julia-mode, so this needs to be fixed now. Unfortunately, this PR isn't working as is. It seems like something is clearing out completion-at-point-functions because neither of julia-mode-latexsub-completion-at-point-around nor julia-mode-latexsub-completion-at-point-before are even getting called.

Quickly skimming through the code in jupyter-repl.el, I'm not seeing why this would be the case though. @nnicandro, any guidance on why adding things to completion-at-point-functions to run before jupyter-completion-at-point wouldn't work? I'm fairly confident this PR was working when I first created it, so something has probably changed in how completion works with emacs-jupyter since then.

@non-Jedi
Copy link
Contributor Author

Further investigation. Normally if I describe-variable on completion-at-point-functions in jupyter-repl-mode running the julia kernel, I get what I want with the latexsub functions running first:

(julia-mode-latexsub-completion-at-point-around
 julia-mode-latexsub-completion-at-point-before
 jupyter-completion-at-point
 t)

But if I add advice to completion-at-point to see the value of completion-at-point-functions immediately before completion:

(advice-add 'completion-at-point :before
            (lambda ()
              (message "completion-at-point-functions before completion-at-point called: %s"
                       completion-at-point-functions)))

I see that jupyter-completion-at-point got moved to the top of the list:

(jupyter-completion-at-point julia-mode-latexsub-completion-at-point-around julia-mode-latexsub-completion-at-point-before t)

Interestingly, sometimes invoking indent-for-tab-command will cause completion-at-point to be called twice, and the second time completion-at-point-functions has the latexsub functions first.

I still don't see what in the code would be causing this rearrangement of completion-at-point-functions.

@nnicandro
Copy link
Collaborator

I'm not sure what could be going on. The completion code hasn't changed in a long time. Have you tried using something like add-variable-watcher on completion-at-point-functions to check what function is changing the value of that variable, e.g. you can put a call to backtrace in the watch-function. Note there is also remove-variable-watcher to undo the watcher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants