emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bring up a screen giving option to open a series of orgmode files


From: Diego Zamboni
Subject: Re: Bring up a screen giving option to open a series of orgmode files
Date: Mon, 23 Nov 2020 10:52:48 +0100

Hi Gerardo,

Apart from what others have suggested, what you can do if you have a fixed list of files you want to quickly access, you could manually define keybindings for them. I have four main files where I capture things, so I define a submenu that allows me to access them quickly:

(note: I got this idea originally from Sacha Chua's https://sachachua.com/blog/2015/02/learn-take-notes-efficiently-org-mode/)

First, I define a helper function to define keybindings that open files. Note that this requires lexical binding to be enabled, so that  the =lambda= creates a closure, otherwise the keybindings don't work.

#+begin_src emacs-lisp
(defun zz/add-file-keybinding (key file &optional desc)
  (let ((key key)
        (file file)
        (desc desc))
    (map! :desc (or desc file)
          key
          (lambda () (interactive) (find-file file)))))
#+end_src

(note #2: the map! macro is Doom Emacs-specific, should be replaced with `bind-key` or equivalent if you are not using Doom)

Now I define keybindings to access my commonly-used org files.

#+begin_src emacs-lisp
(zz/add-file-keybinding "C-c z w" "~/Work/work.org.gpg" "work.org")
(zz/add-file-keybinding "C-c z i" "~/org/ideas.org" "ideas.org")
(zz/add-file-keybinding "C-c z p" "~/org/projects.org" "projects.org")
(zz/add-file-keybinding "C-c z d" "~/org/diary.org" "diary.org")
#+end_src

This results in a submenu bound to "C-c z" which looks like this, and which allows me to quickly open my files:

image.png

--Diego


On Sun, Nov 22, 2020 at 11:01 AM Gerardo Moro <gerardomoro37@gmail.com> wrote:
Basically that :)
I'm looking for some setup that allows me to open a menu with a list of files and shortcut access keys to open them.

Probably somebody has done this before.

Thank you, 
GM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]