Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9166507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:10:01+00:00 2026-06-17T15:10:01+00:00

How to code auto-complete to immediately trigger when there is only one unique option?

  • 0

How to code auto-complete to immediately trigger when there is only one unique option?
(or, when there are several options, but they all have the same base)

(eval-exp_[point-is-here]_)

Autocomplete offers:

(eval-expression
(eval-expression-print-format)

Now when it hits a unique option, wouldn’t it be great if it would just immediately complete to (eval-expression, and then if we would type "-" that it would immediately choose print-format?

Even if there would be then 2 options, you can see in the following example that you would only need "-p" to complete:

(eval-expression-print-format)
(eval-expression-something-else)

Is this behavior possible in Emacs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:10:02+00:00Added an answer on June 17, 2026 at 3:10 pm

    It realizes required behavior:

    (defadvice ac-inline-show (after eab-ac-expand activate)
      (if (> (length ac-candidates) 1)
          (let ((ac-common-part (try-completion ac-prefix ac-candidates)))
            (ac-expand-common))
        (progn
          (ac-expand-string ac-common-part)
          (ac-inline-hide)))
      (setq eab-last-selected-candidate ac-selected-candidate))
    

    For deactivate:

    (ad-remove-advice 'ac-inline-show 'after 'eab-ac-expand)
    (ad-deactivate 'ac-inline-show)
    

    EDIT:

    I experimented with workflow and found one way to cancel miswritings. As an example you prints lam and it is expanded as lambda but you adds extra bd accidentally and gets lambdabd. So I setup

    (global-set-key (kbd "C-<tab>") '(lambda () (interactive) (flet ((ac-candidates () `(,eab-last-selected-candidate))) (ac-fuzzy-complete)) (ac-expand)))
    

    and use it: lambdabd becomes lambda and you can continue as usual.

    EDIT2:

    There was one downside of the solution: “it slows down a bit when it does the fuzzy”. It is fixed by narrowing ac-candidates to eab-last-selected-candidate for ac-fuzzy-complete. Now it’s fast!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do they perform auto complete of code in eclipse or other ides? What
Is there an Open Source "Pseudo Code" Editor with "Syntax Highlighting" and "Auto Complete"?
I have auto complete functionality in combo box ,it works properly but there is
I implemented auto complete in vb.net textbox , but there is an issue that
Is there any control for auto complate my code in textbox at runtime? There
I want auto complete results only from Mexico, for this I am trying the
I'm having a problem with the Auto complete plug-in. Here is my code: var
I have managed to get code the knockoutJS jqauto auto-complete working as per the
Is it possible with jQuery Auto-complete, to make it so that if there are
How can I code a simple auto complete feature with ExtJs? If the field

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.