Emacs helm: Adding new sources to helm-mini

977 views Asked by At

Helm has builtin helm-mini command which includes buffers and recentf in its sources.

(setq helm-source-buffers-list
      (helm-make-source "Buffers" 'helm-source-buffers)))
(helm :sources helm-mini-default-sources
      :buffer "*helm mini*"
      :truncate-lines t)

There is one more package helm recent dirs which provides helm interface to recentd It uses '(helm-source-dired-recent-dirs) as it source.

I am trying to combine those two so i am adding this in helm-mini

(append helm-mini-default-sources '(helm-source-dired-recent-dirs))

but it doesn't work. Am I missing something?

1

There are 1 answers

2
xuchunyang On BEST ANSWER

The append form doesn't change the value of helm-mini-default-sources, so it, i.e., M-x helm-mini, does not work. You can combine setq and append or just add-to-list:

(setq helm-mini-default-sources
      (append helm-mini-default-sources'(helm-source-dired-recent-dirs)))
;; or
(add-to-list 'helm-mini-default-sources 'helm-source-dired-recent-dirs 'append)

but the more flexible way is just using a plain setq because you can choose source and their order:

(setq helm-mini-default-sources '(helm-source-buffers-list
                                  helm-source-dired-recent-dirs
                                  helm-source-recentf
                                  helm-source-buffer-not-found))

There is no needs to write your own helm-mini function, use the built-in one is enough.