auto-complete / popup-el

Visual Popup Interface Library for Emacs
GNU General Public License v3.0
445 stars 96 forks source link

How can i select the current menu item like the user pressing the enter key? #119

Closed super-tomcat closed 3 years ago

super-tomcat commented 3 years ago

Hi, i am trying to select and close the popup menu from elisp as though the user had pressed the Enter key.

So far i have this which gives me the cursor position and the name of the popup item, however if i use popup-select it just moves the cursor to the popup item but does not close the popup.... how can i close the popup on the current selection as though the user had made a selection themselves?

(message "%s" (popup-cursor menu))
(message "%s" (popup-selected-item menu))
(popup-select menu (popup-cursor menu))
super-tomcat commented 3 years ago

Okay, we can use this:

(setq unread-command-events
      (mapcar (lambda (e) `(t . ,e))
              (listify-key-sequence (kbd "\r"))))