├── funcs.el ├── README.org └── packages.el /funcs.el: -------------------------------------------------------------------------------- 1 | (defun view-journal () 2 | (interactive) 3 | (org-journal-new-entry t nil) 4 | ) 5 | 6 | (defun search-all-journals () 7 | (interactive) 8 | (setq current-prefix-arg '(4)) 9 | (call-interactively 'org-journal-search) 10 | ) 11 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: journal layer 2 | 3 | * Table of Contents :TOC_4_gh:noexport: 4 | - [[#description][Description]] 5 | - [[#install][Install]] 6 | - [[#key-bindings][Key bindings]] 7 | - [[#global-bindings][Global Bindings]] 8 | - [[#major-mode-bindings][Major Mode Bindings]] 9 | - [[#calendar-mode-bindings][Calendar Mode Bindings]] 10 | 11 | * Description 12 | =spacemacs-journal= is a wrapper for [[https://github.com/bastibe/org-journal][org-journal]] providing spacemacs-style keybindings. 13 | 14 | =org-journal= provides functions to maintain a simple personal diary / journal using in Emacs. 15 | 16 | * Install 17 | To use journal layer: 18 | 19 | 1. =git clone https://github.com/borgnix/spacemacs-journal.git ~/.emacs.d/private/journal= 20 | 2. add it to your =~/.spacemacs=. You will need to add =journal= to the existing =dotspacemacs-configuration-layers= list in this file. 21 | 22 | * Key bindings 23 | ** Global Bindings 24 | | Key Binding | Description | 25 | |-------------+--------------------------------------------------| 26 | | ~SPC a j j~ | new journal entry | 27 | | ~SPC a j v~ | view journal of today | 28 | | ~SPC a j s~ | search journals within a specified time interval | 29 | | ~SPC a j S~ | search all journal for a string | 30 | ** Major Mode Bindings 31 | | Key Binding | Description | 32 | |-------------+---------------------------------| 33 | | ~SPC m j j~ | new journal entry | 34 | | ~SPC m j n~ | next journal file | 35 | | ~SPC m j p~ | previous journal file | 36 | | ~SPC m j s~ | search the current journal file | 37 | ** Calendar Mode Bindings 38 | | Key Binding | Description | 39 | |-------------+--------------------------------------------| 40 | | ~J j~ | new journal entry | 41 | | ~J v~ | view an entry in a new buffer | 42 | | ~J V~ | view an entry but do not switch to it | 43 | | ~J n~ | go to next day with journal entries | 44 | | ~J p~ | go to previous day with journal entries | 45 | | ~J S~ | search in all entries of all time | 46 | | ~J w~ | search in all entries of the current week | 47 | | ~J m~ | search in all entries of the current month | 48 | | ~J y~ | search in all entries of the current year | 49 | -------------------------------------------------------------------------------- /packages.el: -------------------------------------------------------------------------------- 1 | ;;; packages.el --- journal layer packages file for Spacemacs. 2 | ;; 3 | ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors 4 | ;; 5 | ;; Author: robinx 6 | ;; URL: https://github.com/syl20bnr/spacemacs 7 | ;; 8 | ;; This file is not part of GNU Emacs. 9 | ;; 10 | ;;; License: GPLv3 11 | 12 | (defconst journal-packages 13 | '( 14 | org-journal 15 | calendar 16 | ) 17 | ) 18 | 19 | (defun journal//set-global-keys () 20 | (spacemacs/declare-prefix "aj" "journal") 21 | (spacemacs/set-leader-keys 22 | "ajj" 'org-journal-new-entry) 23 | (spacemacs/set-leader-keys 24 | "ajv" 'view-journal) 25 | (spacemacs/set-leader-keys 26 | "ajs" 'org-journal-search) 27 | (spacemacs/set-leader-keys 28 | "ajS" 'search-all-journals) 29 | ) 30 | 31 | (defun journal//set-major-mode-keys () 32 | (spacemacs/set-leader-keys-for-major-mode 'org-journal-mode 33 | "jn" 'org-journal-open-next-entry) 34 | (spacemacs/set-leader-keys-for-major-mode 'org-journal-mode 35 | "jp" 'org-journal-open-previous-entry) 36 | (spacemacs/set-leader-keys-for-major-mode 'org-journal-mode 37 | "jj" 'org-journal-new-entry) 38 | (spacemacs/set-leader-keys-for-major-mode 'org-journal-mode 39 | "js" 'org-journal-search) 40 | ) 41 | 42 | (defun journal//set-calendar-keys () 43 | (define-key calendar-mode-map "Jj" 'org-journal-new-date-entry) 44 | (define-key calendar-mode-map "Jv" 'org-journal-read-entry) 45 | (define-key calendar-mode-map "JV" 'org-journal-display-entry) 46 | (define-key calendar-mode-map "Jn" 'org-journal-next-entry) 47 | (define-key calendar-mode-map "Jp" 'org-journal-previous-entry) 48 | (define-key calendar-mode-map "JS" 'org-journal-search-forever) 49 | (define-key calendar-mode-map "Jw" 'org-journal-search-calendar-week) 50 | (define-key calendar-mode-map "Jm" 'org-journal-search-calendar-month) 51 | (define-key calendar-mode-map "Jy" 'org-journal-search-calendar-year) 52 | ) 53 | 54 | (defun journal/init-org-journal () 55 | (use-package org-journal 56 | :defer t 57 | :init 58 | (progn 59 | (journal//set-global-keys) 60 | (setq spacemacs-org-journal-mode-map (copy-keymap spacemacs-org-mode-map)) 61 | (spacemacs//init-leader-mode-map 'org-journal-mode 'spacemacs-org-journal-mode-map) 62 | (journal//set-major-mode-keys) 63 | ) 64 | ) 65 | ) 66 | 67 | (defun journal/init-calendar () 68 | (use-package calendar 69 | :config 70 | (progn 71 | (journal//set-calendar-keys) 72 | ) 73 | ) 74 | ) 75 | 76 | --------------------------------------------------------------------------------