oantolin / embark

Emacs Mini-Buffer Actions Rooted in Keymaps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disambiguate functions and variables in Elisp

minad opened this issue · comments

If there exists a function and variable in Elisp with the same name, they are not disambiguated automatically by Embark. Consider the following docstring:

"In docstrings the convention is to write the variable `jinx-languages'
or the function `jinx-languages', while checkdoc will warn if plain
`jinx-languages` is mentioned."

It would be nice to perform an automatic disambiguation in this case if possible. Do you think it makes sense to add this or is this another waste of time? Maybe this is too much of an edge case. 😉

I think Embark will currently find both target types at each occurrence. Are you suggesting returning only one type depending on context, or just changing the priority so that the type mentioned in the surrounding text comes first?

I think if the context uniquely specifies the type, only that type should be returned or at least it should be prioritized.

Sure, but maybe it would be worth it to list more contexts that disambiguate type: let means it's the variable, symbol-function and #' mean it's the function, etc.

Indeed. This would be nice.

Trying to detect the context everywhere is a lot of work, and all of this only to disambiguate. Reusing a name for variables and functions is not that common, so it doesn't seem worth to do this.