diff --git a/core/core-funcs.el b/core/core-funcs.el index 73216ddc9798..4cffcf022017 100644 --- a/core/core-funcs.el +++ b/core/core-funcs.el @@ -171,6 +171,7 @@ Supported properties: (find-file file) (org-indent-mode) (view-mode) + (when(and(boundp 'space-doc-mode)(fboundp 'space-doc-mode)(space-doc-mode))) (goto-char (point-min)) (when anchor-text diff --git a/layers/org/local/space-doc/space-doc.el b/layers/org/local/space-doc/space-doc.el new file mode 100644 index 000000000000..63bc93a28383 --- /dev/null +++ b/layers/org/local/space-doc/space-doc.el @@ -0,0 +1,46 @@ +;;; space-doc.el --- Spacemacs documentation minor mode. +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 +;;; Code: +(require 'face-remap) +(require 'org) + +;;;###autoload +(define-minor-mode space-doc-mode + "Buffer local minor mode for Spacemacs documentation files. +The mode hides `org-mode' meta tags like #+TITLE: while +keeping their content visible." + :init-value nil + :lighter " ❤" + (if (eq major-mode 'org-mode) + (if space-doc-mode + (let ((bg (face-attribute 'default :background))) + (progn + ;; Make `org-mode' meta tags invisible. + (set (make-local-variable 'spacemacs--org-face-remap-cookie-org-tag) + (face-remap-add-relative 'org-tag `(:foreground ,bg))) + (set (make-local-variable 'spacemacs--org-face-remap-cookie-org-meta-line) + (face-remap-add-relative 'org-meta-line `(:foreground ,bg))) + (set (make-local-variable 'spacemacs--org-face-remap-cookie-org-block-begin-line) + (face-remap-add-relative 'org-block-begin-line `(:foreground ,bg))) + (set (make-local-variable 'spacemacs--org-face-remap-cookie-org-document-info-keyword) + (face-remap-add-relative 'org-document-info-keyword `(:foreground ,bg))))) + (progn + ;; Make `org-mode' meta tags visible. + (face-remap-remove-relative spacemacs--org-face-remap-cookie-org-tag) + (face-remap-remove-relative spacemacs--org-face-remap-cookie-org-meta-line) + (face-remap-remove-relative spacemacs--org-face-remap-cookie-org-block-begin-line) + (face-remap-remove-relative spacemacs--org-face-remap-cookie-org-document-info-keyword) + (setq spacemacs--org-face-remap-p nil))) + (progn (message (format "space-doc-mode error:%s isn't an org-mode buffer" (buffer-name))) + (setq org-mode nil)))) + +(provide 'space-doc) +;;; space-doc.el ends here diff --git a/layers/org/packages.el b/layers/org/packages.el index 28d67af50249..e1f651676c7d 100644 --- a/layers/org/packages.el +++ b/layers/org/packages.el @@ -32,6 +32,7 @@ org-repo-todo (ox-gfm :location local) persp-mode + (space-doc :location local) toc-org )) @@ -546,3 +547,6 @@ a Markdown buffer and use this command to convert it. (defun org/init-htmlize () (use-package htmlize :defer t)) + +(defun org/init-space-doc () + (use-package space-doc))