From a6f3041f4864735827d4465a1e11c2e86ef9628d Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 12 Mar 2019 18:47:23 +0100 Subject: emacs: added some convenience functions for org profiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- emacs/init.org | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'emacs/init.org') 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. -- cgit v1.2.3