diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2019-03-12 18:47:23 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2019-03-12 18:47:23 +0100 |
| commit | a6f3041f4864735827d4465a1e11c2e86ef9628d (patch) | |
| tree | b20f095c7a6fcfee41fa8f22912dc1d6a6daafe3 /emacs/init.org | |
| parent | 3594f7785dc5f5f0257002fea7cae4b0776e1f9e (diff) | |
| download | dotfiles-a6f3041f4864735827d4465a1e11c2e86ef9628d.tar.gz dotfiles-a6f3041f4864735827d4465a1e11c2e86ef9628d.zip | |
emacs: added some convenience functions for org profiles
There are some org files that I use everyday and in a particular layout. I've
created some handy functions to help me with that.
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'emacs/init.org')
| -rw-r--r-- | emacs/init.org | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/emacs/init.org b/emacs/init.org index 6c33233..012d78d 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -1621,6 +1621,58 @@ Will work on both org-mode and any mode that accepts plain html." (define-key org-mode-map "\C-ck" #'endless/insert-key) #+END_SRC +Define profiles. + +#+BEGIN_SRC elisp +;; Variables + +(defvar mssola-org-profiles + '(("minimal" . mssola-org-minimal) + ("monthly" . mssola-org-monthly)) + "Defined profiles for organization matters.") + +(defvar mssola-org-default-profile "minimal" + "The default profile for mssola-org.") + +;; Profiles + +(defun mssola-org-minimal () + "Load a minimal set of files." + (find-file (concat (file-name-as-directory org-directory) "setmana.org"))) + +(defun mssola-org-monthly () + "Load a set of files useful for monthly planning." + (find-file (concat (file-name-as-directory org-directory) "setmana.org")) + (split-window-right) + (windmove-right) + (find-file (concat (file-name-as-directory org-directory) "any.org")) + (windmove-left)) + +;; Functions + +(defun mssola-org (&optional profile) + "Setup a frame for organizational matters. +PROFILE is the profile to be picked when given. If it's not given, then the +user will be prompted to provide it." + (interactive) + + (delete-other-windows) + (unless profile + (setq profile (completing-read "Give me the profile: " + (mapcar 'car mssola-org-profiles) nil t))) + (message "%s" profile) + (funcall (cdr (assoc profile mssola-org-profiles)))) + +(defun mssola-org-default () + "Setup a frame for organizational matters given a default profile has been set." + (interactive) + + (mssola-org mssola-org-default-profile)) + +(define-key global-map (kbd "C-c C-o") #'mssola-org-default) +(define-key global-map (kbd "C-c M-o") #'mssola-org) +#+END_SRC + ** TODO shortcut for making an org link, and transforming a link into a proper org link ** TODO make it work with evil ** TODO Proper keybindings for quick access. |
