0

I first set up this key binding : (global-set-key (kbd "<f4>") (lambda () (interactive) (other-window -1)))

When I use imenu I always have to perform the following steps:

Step 1: Press M-x
Step 2: type imenu , Press RET
Step 3: Press TAB ;; run minibuffer-complete
Step 4: Press f4 ;; run (other-window -1) for switch to *Completions* buffer
Step 5: Press C-s ;; run isearch-forward

I want to use a function to perform the above 5 steps.

Is this possible? This is useful when there are a lot of functions. Final Results

Similarly, if want to display struct, need to insert between the second and third steps:
Step 3: type Class , Press RET


My current solution is to use xdotool:

show struct list: (global-set-key (kbd "<f8>") (lambda () (interactive) (shell-command "xdotool key alt+x && xdotool type 'imenu' && xdotool key Return && xdotool type 'Class' && xdotool key Return && xdotool key Tab && xdotool key F4 && xdotool key ctrl+s")))

show function list: (global-set-key (kbd "<f9>") (lambda () (interactive) (shell-command "xdotool key alt+x && xdotool type 'imenu' && xdotool key Return && xdotool key Tab && xdotool key F4 && xdotool key ctrl+s")))

I want to quickly locate the item by fuzzy search in *Completions* buffer, Instead of pressing Tab key complete in the minibuffer

1 Answer 1

1

I'm not really sure what you're trying to do, but maybe this will help:

(defun foo ()
  "..."
  (interactive)
  (minibuffer-with-setup-hook #'minibuffer-complete
    (call-interactively #'imenu)))

(global-set-key (kbd "<f4>") 'foo)
1
  • This is very useful for me, but can only complete the first 3 steps.
    – dongli si
    Commented Sep 21, 2019 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.