0

I would like to perform some commands after I open a file in helm. For instance, call imenu to get a list of headings of opened org-mode buffer. But for some buffers, like message, it is not necessary to do that. So if here, the major-mode name or the file name of current selection in helm can be obtained, it will be much easy to call conditional subsequent commands.

like:

(defun call-imenu-after-helm () 
    (interactive)
    (helm-for-files)
    (when "a condition to say this buffer is a org file"
       (helm-imenu)
       (org-show-entry)))

I asked help in github and google plus, but it seems like that the function has not been implemented in helm for now.

Can anyone get some good ideas to do this?

  • Do you mean something like adding a new imenu action to the helm-buffers-list command if current selection is a org-mode file? – xuchunyang Jul 27 '15 at 18:26
  • @xuchunyang thanks for response. Yes. – Leu_Grady Jul 27 '15 at 21:25
  • I think the answer to your question (in title) will not help you. There are many commands provided by the helm package, not all of them are about buffers of files, for example, helm-imenu and helm-show-kill-ring, it can be anything at the cursor in helm. Did you ever try to make a helm command yourself? – xuchunyang Jul 28 '15 at 7:05
  • a simple demo: gist.github.com/xuchunyang/9296e3d1469416124bcb – xuchunyang Jul 28 '15 at 7:15
  • Hi, @xuchunyang thanks for your comments. I will study your snippet. – Leu_Grady Jul 29 '15 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.