[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/new-tutorial 2367af9 06/10: First org-mode tutoria
From: |
Phillip Lord |
Subject: |
[Emacs-diffs] feature/new-tutorial 2367af9 06/10: First org-mode tutorial |
Date: |
Thu, 18 May 2017 05:18:53 -0400 (EDT) |
branch: feature/new-tutorial
commit 2367af9cae9b5a30a8cf41d8ab720a5d0e457870
Author: Phillip Lord <address@hidden>
Commit: Phillip Lord <address@hidden>
First org-mode tutorial
---
lisp/tutorial-org.el | 34 +++++++++++++++++++++++++++++++++-
lisp/tutorial.el | 2 +-
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/lisp/tutorial-org.el b/lisp/tutorial-org.el
index f71cd65..e74e7f5 100644
--- a/lisp/tutorial-org.el
+++ b/lisp/tutorial-org.el
@@ -26,10 +26,42 @@
;; Code for running the Emacs Tutorials written in org-mode.
;;; Code:
+(require 'subr-x)
+(define-derived-mode tutorial-org-mode org-mode "Tutor"
+ "A mode for displaying tutorials."
+ (show-all)
+ (setq-local org-hide-emphasis-markers t))
+
+(defun tutorial-org--display-buffer (tutorial-buffer-name)
+ (when-let ((tutorial-buffer
+ (get-buffer-window tutorial-buffer-name t)))
+ (raise-frame
+ (window-frame
+ (select-window tutorial-window))))
+ (switch-to-buffer tutorial-buffer)
+ ;; Use whole frame for tutorial
+ (delete-other-windows))
+
+(defun tutorial-org-display (org-file)
+ "Display the org-file as a tutorial"
+ (let* ((tutorial-buffer-name
+ (file-name-nondirectory
+ (file-name-sans-extension
+ org-file)))
+ (tutorial-buffer (get-buffer-create tutorial-buffer-name)))
+ ;; Display it
+ (tutorial-org--display-buffer tutorial-buffer)
+ ;; Fill it if needed
+ (when (= 0 (buffer-size tutorial-buffer))
+ (insert-file-contents org-file)
+ (tutorial-org-mode))))
(defun tutorial-org--help-with-tutorial-org (lang)
- (error "not implemented yet"))
+ (tutorial-org-display
+ (expand-file-name
+ (get-language-info lang 'tutorial-org)
+ tutorial-org-directory)))
(provide 'tutorial-org)
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 9a0c246..780c1ef 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -768,7 +768,7 @@ enabled Viper.")
(if (get-language-info lang 'tutorial-org)
'org 'orig)))
(if (get-language-info lang 'tutorial-org)
- (tutorial--help-with-tutorial-org lang)
+ (tutorial-org--help-with-tutorial-org lang)
(tutorial--help-with-tutorial-orig lang dont-ask-for-revert)))))
(defun tutorial--help-with-tutorial-orig (lang dont-ask-for-revert)
- [Emacs-diffs] branch feature/new-tutorial created (now 7812f5e), Phillip Lord, 2017/05/18
- [Emacs-diffs] feature/new-tutorial a780687 02/10: Move tutorial.org to correct location, Phillip Lord, 2017/05/18
- [Emacs-diffs] feature/new-tutorial 7812f5e 10/10: Add images, Phillip Lord, 2017/05/18
- [Emacs-diffs] feature/new-tutorial 1a25246 03/10: Support saving org-mode tutorial, Phillip Lord, 2017/05/18
- [Emacs-diffs] feature/new-tutorial 2367af9 06/10: First org-mode tutorial,
Phillip Lord <=
- [Emacs-diffs] feature/new-tutorial 2a7e4ee 07/10: Make tutorial read-only, Phillip Lord, 2017/05/18
- [Emacs-diffs] feature/new-tutorial 353fc5f 09/10: Update branch notes, Phillip Lord, 2017/05/18
- [Emacs-diffs] feature/new-tutorial d37b299 05/10: Add tutorial-org, refactor tutorial, and lots of supporting changes., Phillip Lord, 2017/05/18
- [Emacs-diffs] feature/new-tutorial 1979beb 01/10: Commit, Phillip Lord, 2017/05/18
- [Emacs-diffs] feature/new-tutorial 4a9a824 08/10: Refill tutorial, Phillip Lord, 2017/05/18
- [Emacs-diffs] feature/new-tutorial 1f5d3b7 04/10: Add test framework, Phillip Lord, 2017/05/18