Git Product home page Git Product logo

Comments (9)

minad avatar minad commented on July 2, 2024 2

BTW, someone on the doom discord mentioned all capfs, including this, that use :exclusive no are impacted by this Emacs bug??? If that's true, do you know of a workaround?

Yes, non-exclusive Capfs are affected by this issue in default completion. But it is not a serious issue. I talked to Stefan Monnier about this and he even considers this behavior somewhat intentional, but advises against using non-exclusive Capfs.

The issue is that non-exclusive Capfs must match the prefix such that they are taken into consideration. This means the completion style is ignored and non-exclusive Capfs may be falsely rejected for more complex completion style configurations (e.g. Orderless). But even then this is not a serious issue since the input prefix usually matches some of the candidates when you trigger completion (via TAB or automatically).

Anyway, Corfu contains a workaround for this issue such that the completion styles are always taken into account, and such that the issue can be considered fixed completely if you use Corfu.

https://github.com/minad/corfu/blob/46825deb5268355cb97396b270d83b24c7eee591/corfu.el#L1230-L1255

Additionally, I recommend to extract the Capf properties to a separate variable such that users can adjust the configuration (e.g., :exclusive, :annotation-function, ...) to their liking. For example:

https://github.com/minad/cape/blob/67c48f1c3609f1426f02c5d8b81e23b1e8b89659/cape.el#L229-L233

from citar-capf.

bdarcus avatar bdarcus commented on July 2, 2024 1

@mclearc - could you see about a preparing a PR against this branch, with just the function, and incorporating @minad's other suggestion?

That would have the advantage that when I merge breaking changes, this code will work. Plus you can give us feedback ;-)

Or you could wait until we merge that, likely sometime over the next week.

from citar-capf.

meliache avatar meliache commented on July 2, 2024 1

As this has been merged into citar itself, I would recommend archiving this repository and add a README message why, explaining that it has been merged. Today I read the 2022-06-13 emacs news, saw the announcement of this package and installed it at first, not knowing that the code is now in citar itself. While configuring it I looked at the issues and found this.

from citar-capf.

minad avatar minad commented on July 2, 2024

I looked at the code - there is really only a single function citar-capf which plays in the hands of my arguments above.

You define a minor mode:

citar-capf/citar-capf.el

Lines 97 to 109 in 59006cb

;;;; Define Minor Mode
(define-minor-mode citar-capf-mode
"Create a global minor mode for `citar-capf'.
This adds hooks and the citar-capf function to the relevant modes."
:lighter ""
:global t
(cond (citar-capf-mode
;; add to completion framework (buffer-local)
(add-hook 'completion-at-point-functions #'citar-capf -90 t)
(add-to-list 'completion-at-point-functions #'citar-capf))
(t
(remove-hook 'completion-at-point-functions #'citar-capf)
(remove #'citar-capf completion-at-point-functions))))

I think such a mode should be avoided, since activating it will only load the package more eagerly. For the user it is not a big difference to activate a mode or to add an auxillary Capf function to the completion-at-point-functions list. See also my Cape and Tempel packages where I only provide autoloaded Capfs without any additional modes.

from citar-capf.

bdarcus avatar bdarcus commented on July 2, 2024

Is the provided functionality controversial such that @bdarcus prefers to have it in a separate package?

@minad - no; I was pretty agnostic, and @mclearc asked if I was OK with it (I gave him part of the code, or at least an idea how to make it work), and so I said sure.

But I didn't think about one or two of your points, and am also fine to move it back too.

from citar-capf.

bdarcus avatar bdarcus commented on July 2, 2024

BTW, someone on the doom discord mentioned all capfs, including this, that use :exclusive no are impacted by this Emacs bug???

If that's true, do you know of a workaround?

from citar-capf.

mclearc avatar mclearc commented on July 2, 2024

Yeah @minad I have no strong feelings about this -- happy to integrate it into citar. @bdarcus let me know how (or whether) you'd like to do this.

from citar-capf.

mclearc avatar mclearc commented on July 2, 2024

Closed via emacs-citar/citar#629

from citar-capf.

mclearc avatar mclearc commented on July 2, 2024

Yeah that's the plan!

from citar-capf.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.