Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 produce a list of known org files for quick navigation, but I can't seem to find it. If org-mode does not have this feature, how can I make a simple command that launches something like helm or icicles to find them?

like image 229
shader Avatar asked Oct 19 '25 16:10

shader


1 Answers

The question is not very clear to me. But if your Org-mode files all have a certain file-name pattern (e.g. *.org) and all are in the same directory (org-directory) then you can use several methods Emacs method to access them:

  1. C-x C-f *.org RETURN in org-directory opens them all (the buffers are visiting them but only the last one is shown).

  2. C-x C-f *.org TAB in org-directory, to show them using completion, then pick whichever one you want (or pick more than one, using a glob pattern, as in #1).

  3. The same as #2, using Icicles or Helm. In Icicles, at least, you can also match using regexps and in other ways.

  4. Open Dired for just those files: C-x d *.org.

There are really any number of ways to do what you've described. But I'm guessing that you have not really described your request/problem/question well enough, and when you do you will get a narrower set of answers.


UPDATE after your comments:

Here's one way: Open Dired on all of 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 or 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)))
like image 194
Drew Avatar answered Oct 21 '25 12:10

Drew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!