diff options
| author | Phillip Lord | 2017-05-07 23:41:29 +0100 |
|---|---|---|
| committer | Phillip Lord | 2017-05-07 23:41:29 +0100 |
| commit | 2367af9cae9b5a30a8cf41d8ab720a5d0e457870 (patch) | |
| tree | 5a1dc59b13bc0726cdd4b137c905f190508eafd9 | |
| parent | d37b29909e397770d2ab8dd5a8e091fb82689961 (diff) | |
| download | emacs-2367af9cae9b5a30a8cf41d8ab720a5d0e457870.tar.gz emacs-2367af9cae9b5a30a8cf41d8ab720a5d0e457870.zip | |
First org-mode tutorial
| -rw-r--r-- | lisp/tutorial-org.el | 34 | ||||
| -rw-r--r-- | lisp/tutorial.el | 2 |
2 files changed, 34 insertions, 2 deletions
diff --git a/lisp/tutorial-org.el b/lisp/tutorial-org.el index f71cd653880..e74e7f57997 100644 --- a/lisp/tutorial-org.el +++ b/lisp/tutorial-org.el | |||
| @@ -26,10 +26,42 @@ | |||
| 26 | ;; Code for running the Emacs Tutorials written in org-mode. | 26 | ;; Code for running the Emacs Tutorials written in org-mode. |
| 27 | 27 | ||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | (require 'subr-x) | ||
| 29 | 30 | ||
| 31 | (define-derived-mode tutorial-org-mode org-mode "Tutor" | ||
| 32 | "A mode for displaying tutorials." | ||
| 33 | (show-all) | ||
| 34 | (setq-local org-hide-emphasis-markers t)) | ||
| 35 | |||
| 36 | (defun tutorial-org--display-buffer (tutorial-buffer-name) | ||
| 37 | (when-let ((tutorial-buffer | ||
| 38 | (get-buffer-window tutorial-buffer-name t))) | ||
| 39 | (raise-frame | ||
| 40 | (window-frame | ||
| 41 | (select-window tutorial-window)))) | ||
| 42 | (switch-to-buffer tutorial-buffer) | ||
| 43 | ;; Use whole frame for tutorial | ||
| 44 | (delete-other-windows)) | ||
| 45 | |||
| 46 | (defun tutorial-org-display (org-file) | ||
| 47 | "Display the org-file as a tutorial" | ||
| 48 | (let* ((tutorial-buffer-name | ||
| 49 | (file-name-nondirectory | ||
| 50 | (file-name-sans-extension | ||
| 51 | org-file))) | ||
| 52 | (tutorial-buffer (get-buffer-create tutorial-buffer-name))) | ||
| 53 | ;; Display it | ||
| 54 | (tutorial-org--display-buffer tutorial-buffer) | ||
| 55 | ;; Fill it if needed | ||
| 56 | (when (= 0 (buffer-size tutorial-buffer)) | ||
| 57 | (insert-file-contents org-file) | ||
| 58 | (tutorial-org-mode)))) | ||
| 30 | 59 | ||
| 31 | (defun tutorial-org--help-with-tutorial-org (lang) | 60 | (defun tutorial-org--help-with-tutorial-org (lang) |
| 32 | (error "not implemented yet")) | 61 | (tutorial-org-display |
| 62 | (expand-file-name | ||
| 63 | (get-language-info lang 'tutorial-org) | ||
| 64 | tutorial-org-directory))) | ||
| 33 | 65 | ||
| 34 | (provide 'tutorial-org) | 66 | (provide 'tutorial-org) |
| 35 | 67 | ||
diff --git a/lisp/tutorial.el b/lisp/tutorial.el index 9a0c2468a8a..780c1ef8894 100644 --- a/lisp/tutorial.el +++ b/lisp/tutorial.el | |||
| @@ -768,7 +768,7 @@ enabled Viper.") | |||
| 768 | (if (get-language-info lang 'tutorial-org) | 768 | (if (get-language-info lang 'tutorial-org) |
| 769 | 'org 'orig))) | 769 | 'org 'orig))) |
| 770 | (if (get-language-info lang 'tutorial-org) | 770 | (if (get-language-info lang 'tutorial-org) |
| 771 | (tutorial--help-with-tutorial-org lang) | 771 | (tutorial-org--help-with-tutorial-org lang) |
| 772 | (tutorial--help-with-tutorial-orig lang dont-ask-for-revert))))) | 772 | (tutorial--help-with-tutorial-orig lang dont-ask-for-revert))))) |
| 773 | 773 | ||
| 774 | (defun tutorial--help-with-tutorial-orig (lang dont-ask-for-revert) | 774 | (defun tutorial--help-with-tutorial-orig (lang dont-ask-for-revert) |