How do I find org-mode files with completion in Emacs?

I have a growing set of org files stored in org-directory

. How can I navigate between them, preferably with interactive filtering and completion?

I thought there was a way to get org-mode to generate a list of known org files for quick navigation, but I cannot find it. If org-mode doesn't have this function, how can I make a simple command that launches something like a rudder or icicles to find them?

+3


source to share


4 answers


The question is not very clear to me. But if your files in Org mode have a specific filename pattern (for example *.org

) and they are all in the same directory ( org-directory

), you can use several Emacs methods to access them:

  • C-x C-f *.org RETURN

    c org-directory

    opens them all (buffers visit them, but only the last one is displayed).

  • C-x C-f *.org TAB

    in org-directory

    to show them with completion, then select the one you want (or select more than one using the glob pattern as in # 1).

  • Same as # 2, using icicles or helmet. In Icicles, at least you can use regular expressions in other ways as well.

  • Dired open only for these files: C-x d *.org

    .

There are many ways to do what you have described. But my guess is that you didn't describe your request / problem / question very well, and when you do, you will get a narrower set of answers.


UPDATE after your comments:

Here's one way: Open Dired on all your Org files in and under org-directory

.



(defun foo ()
  "Open Dired for (only) the Org files in and under `org-directory`."
  (interactive)
  (cd org-directory)
  (dired "*.org" "-lRF"))

      

Test it with M-x foo

. Put this in your init file:

(foo)

      

And here's another way: M-x bar

either bind bar

to a key.

(defun bar ()
  "Open an Org file in or under `org-directory`."
  (interactive)
  (let ((default-directory         org-directory)
        (icicle-file-match-regexp  ".*\\.org"))
    (icicle-locate-file-of-content)))

      

+1


source


I have a package that does exactly that: plain-org-wiki . It's not too hard: I just dump all my 45 org files into one directory and get completion for them.



+1


source


How about the org-iswitchb that is already provided by the organization?

Switching between Org buffers. With one prefix argument, limit the available buffers to files. With two prefix arguments, limit the available buffers to agenda files.

Add this to your boot file after org upload: (global-set-key "\C-cb" 'org-iswitchb)

+1


source


My favorite solution for this is helm-mode

which is activated by a package helm

from MELPA. Here's a demo:

Helm Mode Completion

This really creates a great environment for quickly finding files. Alternatively, you can enable fuzzy completion! Here's the minimal config (after installing the package helm

):

(require 'helm-config)
(helm-mode 1)
(global-set-key (kbd "C-x C-f") 'helm-find-files)

      

You can also run grep

in files if you want to search for their content. Take a look at this awesome guide if you want to know more.

0


source







All Articles