spacemacs/layers/+emacs/org/funcs.el
Eivind Fonn b416d83d8b Add code block surround in org-mode
Also:
- don't pad drawer surround with extra newlines
- upcase the drawer surround as per org conventions
2016-05-06 13:30:20 +02:00

59 lines
1.7 KiB
EmacsLisp
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; funcs.el --- Org Layer functions File for Spacemacs
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun ort/find-todo-file (&optional directory)
(let* ((ort/todo-root (or directory (ort/find-root default-directory)))
(file (ort/todo-file)))
(when (and (not (file-remote-p file))
(file-readable-p file))
file)))
(defun ort/find-all-todo-files ()
(require 'projectile)
(delq nil (mapcar 'ort/find-todo-file projectile-known-projects)))
(defun ort/list-project-todos ()
"List all the TODOs of the current project."
(interactive)
(let ((org-agenda-files (list (ort/find-todo-file))))
(org-todo-list)))
(defun ort/list-all-project-todos ()
"List all the TODOs of all known projects (excluding remote
projects)."
(interactive)
(let ((org-agenda-files (ort/find-all-todo-files)))
(org-todo-list)))
(defun ort/list-all-todos ()
"List all the TODOs of all known projects (excluding remote
projects) as well as those from `org-agenda-files'."
(interactive)
(let ((org-agenda-files (append (org-agenda-files) (ort/find-all-todo-files))))
(org-todo-list)))
(defun spacemacs/ob-fix-inline-images ()
"Fix redisplay of inline images after a code block evaluation."
(when org-inline-image-overlays
(org-redisplay-inline-images)))
(defun spacemacs//surround-drawer ()
(let ((dname (read-from-minibuffer "" "")))
(cons (format ":%s:" (upcase (or dname ""))) ":END:")))
(defun spacemacs//surround-code ()
(let ((dname (read-from-minibuffer "" "")))
(cons (format "#+BEGIN_SRC %s" (or dname "")) "#+END_SRC")))