From f6b79d40a29f4d041393f6949b1ecaf2da7d691c Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Thu, 29 Aug 2019 12:02:12 +0200 Subject: [PATCH 01/12] add ox-hugo to org --- modules/lang/org/config.el | 12 ++++++++++-- modules/lang/org/packages.el | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 07fdfe08e..01c915045 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -392,7 +392,12 @@ file isn't in `org-directory'." (setq org-pandoc-options '((standalone . t) (mathjax . t) - (variable . "revealjs-url=https://cdn.jsdelivr.net/npm/reveal.js@3/"))))) + (variable . "revealjs-url=https://cdn.jsdelivr.net/npm/reveal.js@3/")))) + + (when (featurep! +hugo) + (use-package! ox-hugo + :after ox))) + (defun +org-init-habit-h () @@ -561,7 +566,10 @@ between the two." (:prefix ("b" . "from beamer") :desc "to latex" "l" #'org-beamer-export-to-latex :desc "to latex & open" "L" #'org-beamer-export-as-latex - :desc "as pdf" "p" #'org-beamer-export-to-pdf)) + :desc "as pdf" "p" #'org-beamer-export-to-pdf) + (:when (featurep! +hugo) + :desc "to hugo" "h" #'org-hugo-export-to-md + :desc "to hugo & open" "H" #'org-hugo-export-as-md)) (:prefix ("g" . "goto") "g" #'org-goto (:when (featurep! :completion ivy) diff --git a/modules/lang/org/packages.el b/modules/lang/org/packages.el index db46d566e..5fea442e3 100644 --- a/modules/lang/org/packages.el +++ b/modules/lang/org/packages.el @@ -52,3 +52,6 @@ (when (featurep! +journal) (package! org-journal)) + +(when (featurep! +hugo) + (package! ox-hugo)) From ede04f705cac4a6f641e5d6446a993f2b44f7551 Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Thu, 29 Aug 2019 12:08:11 +0200 Subject: [PATCH 02/12] add +hugo to init.example.el and README.org --- init.example.el | 1 + modules/lang/org/README.org | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/init.example.el b/init.example.el index c854a7f4e..aadb388dd 100644 --- a/init.example.el +++ b/init.example.el @@ -127,6 +127,7 @@ ;;ocaml ; an objective camel (org ; organize your plain life in plain text +dragndrop ; drag & drop files/images into org buffers + ;+hugo ; use Emacs for hugo blogging +ipython ; ipython/jupyter support for babel +pandoc ; export-with-pandoc support +present) ; using org-mode for presentations diff --git a/modules/lang/org/README.org b/modules/lang/org/README.org index b1c059e63..6569ac46d 100644 --- a/modules/lang/org/README.org +++ b/modules/lang/org/README.org @@ -61,6 +61,8 @@ https://www.mfoot.com/blog/2015/11/22/literate-emacs-configuration-with-org-mode + =+pandoc= Enables pandoc integration into the Org exporter. + =+present= Enables integration with reveal.js, beamer and org-tree-slide, so Emacs can be used for presentations. ++ =+hugo= Enables integration with [[https://gohugo.io][hugo]] to export from + Emacs well formed (blackfriday) markdown. ** Plugins + [[https://orgmode.org/][org-plus-contrib]] @@ -99,6 +101,8 @@ https://www.mfoot.com/blog/2015/11/22/literate-emacs-configuration-with-org-mode + [[https://github.com/anler/centered-window-mode][centered-window]] + [[https://github.com/takaxp/org-tree-slide][org-tree-slide]] + [[https://github.com/yjwen/org-reveal][ox-reveal]] ++ =+hugo= + + [[https://github.com/kaushalmodi/ox-hugo][ox-hugo]] ** Hacks + The window is recentered when following links. From 84cd3b5bfbdfdac366af0c62d5da2866b03da22a Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Thu, 29 Aug 2019 12:53:02 +0200 Subject: [PATCH 03/12] use package! macro :when flag minor change to the README docs --- modules/lang/org/README.org | 2 +- modules/lang/org/packages.el | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/lang/org/README.org b/modules/lang/org/README.org index 6569ac46d..cf5462afd 100644 --- a/modules/lang/org/README.org +++ b/modules/lang/org/README.org @@ -62,7 +62,7 @@ https://www.mfoot.com/blog/2015/11/22/literate-emacs-configuration-with-org-mode + =+present= Enables integration with reveal.js, beamer and org-tree-slide, so Emacs can be used for presentations. + =+hugo= Enables integration with [[https://gohugo.io][hugo]] to export from - Emacs well formed (blackfriday) markdown. + Emacs well-formed ([[https://github.com/russross/blackfriday][blackfriday]]) markdown. ** Plugins + [[https://orgmode.org/][org-plus-contrib]] diff --git a/modules/lang/org/packages.el b/modules/lang/org/packages.el index 5fea442e3..848b8d82c 100644 --- a/modules/lang/org/packages.el +++ b/modules/lang/org/packages.el @@ -53,5 +53,6 @@ (when (featurep! +journal) (package! org-journal)) -(when (featurep! +hugo) - (package! ox-hugo)) +(package! ox-hugo + :when (featurep! +hugo) + :after ox) From a9e2bdf28c44ccfc3cc00e0d75c1610587a7888e Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Thu, 29 Aug 2019 14:56:31 +0200 Subject: [PATCH 04/12] update package! with straight recipe This is needed to avoid downloading the whole hugo configuration of the repo' documentation website --- modules/lang/org/packages.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/lang/org/packages.el b/modules/lang/org/packages.el index 848b8d82c..7caee5872 100644 --- a/modules/lang/org/packages.el +++ b/modules/lang/org/packages.el @@ -53,6 +53,8 @@ (when (featurep! +journal) (package! org-journal)) -(package! ox-hugo - :when (featurep! +hugo) - :after ox) +(when (featurep! +hugo) + (package! ox-hugo :recipe (:host github + :repo "kaushalmodi/ox-hugo" + :nonrecursive t + :files (:defaults "*.el")))) From ea4fa7021d9a08e701154643692b62766351b0fc Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Thu, 29 Aug 2019 14:59:54 +0200 Subject: [PATCH 05/12] move +hugo feature to contrib/+hugo.el --- modules/lang/org/config.el | 9 +-------- modules/lang/org/contrib/+hugo.el | 12 ++++++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 modules/lang/org/contrib/+hugo.el diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 01c915045..2a7a2f979 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -394,10 +394,6 @@ file isn't in `org-directory'." (mathjax . t) (variable . "revealjs-url=https://cdn.jsdelivr.net/npm/reveal.js@3/")))) - (when (featurep! +hugo) - (use-package! ox-hugo - :after ox))) - (defun +org-init-habit-h () @@ -566,10 +562,7 @@ between the two." (:prefix ("b" . "from beamer") :desc "to latex" "l" #'org-beamer-export-to-latex :desc "to latex & open" "L" #'org-beamer-export-as-latex - :desc "as pdf" "p" #'org-beamer-export-to-pdf) - (:when (featurep! +hugo) - :desc "to hugo" "h" #'org-hugo-export-to-md - :desc "to hugo & open" "H" #'org-hugo-export-as-md)) + :desc "as pdf" "p" #'org-beamer-export-to-pdf)) (:prefix ("g" . "goto") "g" #'org-goto (:when (featurep! :completion ivy) diff --git a/modules/lang/org/contrib/+hugo.el b/modules/lang/org/contrib/+hugo.el new file mode 100644 index 000000000..f8bff0282 --- /dev/null +++ b/modules/lang/org/contrib/+hugo.el @@ -0,0 +1,12 @@ +;;; +hugo.el --- ox-hugo support -*- lexical-binding: t; -*- +;;;###if (featurep! +hugo) + +(use-package! ox-hugo + :after ox + (map! :map org-mode-map + :localleader + (:prefix ("e" . "export") + :desc "to hugo" "h" #'org-hugo-export-to-md + :desc "to hugo & open" "H" #'org-hugo-export-as-md))) + +;;; +hugo.el ends here From 8fd3bd80da990674511e989ad2426274146fb4ee Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Thu, 29 Aug 2019 16:26:06 +0200 Subject: [PATCH 06/12] fix config.el, clean package :recipe --- modules/lang/org/config.el | 3 +-- modules/lang/org/packages.el | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 2a7a2f979..07fdfe08e 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -392,8 +392,7 @@ file isn't in `org-directory'." (setq org-pandoc-options '((standalone . t) (mathjax . t) - (variable . "revealjs-url=https://cdn.jsdelivr.net/npm/reveal.js@3/")))) - + (variable . "revealjs-url=https://cdn.jsdelivr.net/npm/reveal.js@3/"))))) (defun +org-init-habit-h () diff --git a/modules/lang/org/packages.el b/modules/lang/org/packages.el index 7caee5872..f4cfd81c1 100644 --- a/modules/lang/org/packages.el +++ b/modules/lang/org/packages.el @@ -56,5 +56,4 @@ (when (featurep! +hugo) (package! ox-hugo :recipe (:host github :repo "kaushalmodi/ox-hugo" - :nonrecursive t - :files (:defaults "*.el")))) + :nonrecursive t))) From 8457d2f8256096f3a0dac214ae32c186410660f3 Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Fri, 30 Aug 2019 17:23:47 +0200 Subject: [PATCH 07/12] descriptions and keybindings as per ox-hugo docs Mimicks the ox menu `C-c C-e H #` --- modules/lang/org/config.el | 1 + modules/lang/org/contrib/+hugo.el | 30 ++++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 07fdfe08e..bb7856ef1 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -868,6 +868,7 @@ compelling reason, so..." ;;; Custom org modules (if (featurep! +dragndrop) (load! "contrib/dragndrop")) + (if (featurep! +hugo) (load! "contrib/+hugo")) (if (featurep! +ipython) (load! "contrib/ipython")) (if (featurep! +present) (load! "contrib/present")) diff --git a/modules/lang/org/contrib/+hugo.el b/modules/lang/org/contrib/+hugo.el index f8bff0282..d5146a1da 100644 --- a/modules/lang/org/contrib/+hugo.el +++ b/modules/lang/org/contrib/+hugo.el @@ -1,12 +1,30 @@ ;;; +hugo.el --- ox-hugo support -*- lexical-binding: t; -*- ;;;###if (featurep! +hugo) +(defun org-hugo-doom-subtree-to-file-and-open () + (interactive) + (org-open-file (org-hugo-export-wim-to-md))) + +(defun org-hugo-doom-to-file-and-open () + (interactive) + (org-open-file (org-hugo-export-to-md))) + +(defun org-hugo-doom-all-subtrees-to-files () + (interactive) + (org-hugo-export-wim-to-md :all-subtrees)) + (use-package! ox-hugo - :after ox - (map! :map org-mode-map - :localleader - (:prefix ("e" . "export") - :desc "to hugo" "h" #'org-hugo-export-to-md - :desc "to hugo & open" "H" #'org-hugo-export-as-md))) + :after ox) + +(map! :map org-mode-map + :localleader + (:prefix "e" + (:prefix ("H" . "hugo") + :desc "Subtree to file" "H" #'org-hugo-export-wim-to-md + :desc "To file" "h" #'org-hugo-export-wim-to-md + :desc "Subtree to file & open" "O" #'org-hugo-doom-subtree-to-file-and-open + :desc "To file & open" "o" #'org-hugo-doom-to-file-and-open + :desc "All subtrees to files" "a" #'org-hugo-doom-all-subtrees-to-files + :desc "To temporary buffer" "t" #'org-hugo-export-as-md))) ;;; +hugo.el ends here From 22d3dbe306a5c2f0ef1bbcdae57fee24f564a024 Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Fri, 30 Aug 2019 22:22:24 +0200 Subject: [PATCH 08/12] use descriptions from kaushalmodi/ox-hugo@a8e0c6e remove defun declarations, use lambdas --- modules/lang/org/contrib/+hugo.el | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/modules/lang/org/contrib/+hugo.el b/modules/lang/org/contrib/+hugo.el index d5146a1da..88454f8eb 100644 --- a/modules/lang/org/contrib/+hugo.el +++ b/modules/lang/org/contrib/+hugo.el @@ -1,18 +1,6 @@ ;;; +hugo.el --- ox-hugo support -*- lexical-binding: t; -*- ;;;###if (featurep! +hugo) -(defun org-hugo-doom-subtree-to-file-and-open () - (interactive) - (org-open-file (org-hugo-export-wim-to-md))) - -(defun org-hugo-doom-to-file-and-open () - (interactive) - (org-open-file (org-hugo-export-to-md))) - -(defun org-hugo-doom-all-subtrees-to-files () - (interactive) - (org-hugo-export-wim-to-md :all-subtrees)) - (use-package! ox-hugo :after ox) @@ -20,11 +8,17 @@ :localleader (:prefix "e" (:prefix ("H" . "hugo") - :desc "Subtree to file" "H" #'org-hugo-export-wim-to-md - :desc "To file" "h" #'org-hugo-export-wim-to-md - :desc "Subtree to file & open" "O" #'org-hugo-doom-subtree-to-file-and-open - :desc "To file & open" "o" #'org-hugo-doom-to-file-and-open - :desc "All subtrees to files" "a" #'org-hugo-doom-all-subtrees-to-files - :desc "To temporary buffer" "t" #'org-hugo-export-as-md))) + :desc "Subtree or File to Md to file" "H" #'org-hugo-export-wim-to-md + :desc "File to Md file" "h" #'org-hugo-export-to-md + :desc "Subtree or File to Md to file & open" "O" '(lambda () + (interactive) + (org-open-file (org-hugo-export-wim-to-md))) + :desc "File to Md file & open" "o" '(lambda () + (interactive) + (org-open-file (org-hugo-export-to-md))) + :desc "All subtrees (or File) to Md file(s)" "A" '(lambda () + (interactive) + (org-hugo-export-wim-to-md :all-subtrees)) + :desc "File to a temporary Md buffer" "t" #'org-hugo-export-as-md))) ;;; +hugo.el ends here From ab144f89c2367814edfbd55c29bbe59c8a2da107 Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Mon, 30 Sep 2019 16:10:26 +0200 Subject: [PATCH 09/12] =?UTF-8?q?use=20the=20=CE=BB!=20macro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/lang/org/contrib/+hugo.el | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/lang/org/contrib/+hugo.el b/modules/lang/org/contrib/+hugo.el index 88454f8eb..6697b83b0 100644 --- a/modules/lang/org/contrib/+hugo.el +++ b/modules/lang/org/contrib/+hugo.el @@ -10,15 +10,9 @@ (:prefix ("H" . "hugo") :desc "Subtree or File to Md to file" "H" #'org-hugo-export-wim-to-md :desc "File to Md file" "h" #'org-hugo-export-to-md - :desc "Subtree or File to Md to file & open" "O" '(lambda () - (interactive) - (org-open-file (org-hugo-export-wim-to-md))) - :desc "File to Md file & open" "o" '(lambda () - (interactive) - (org-open-file (org-hugo-export-to-md))) - :desc "All subtrees (or File) to Md file(s)" "A" '(lambda () - (interactive) - (org-hugo-export-wim-to-md :all-subtrees)) + :desc "Subtree or File to Md to file & open" "O" '(λ! (org-open-file (org-hugo-export-wim-to-md))) + :desc "File to Md file & open" "o" '(λ! (org-open-file (org-hugo-export-to-md))) + :desc "All subtrees (or File) to Md file(s)" "A" '(λ! (org-hugo-export-wim-to-md :all-subtrees)) :desc "File to a temporary Md buffer" "t" #'org-hugo-export-as-md))) ;;; +hugo.el ends here From 440f2cffaa6842ef18686d7d447653ba4ccc1bfc Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Mon, 30 Sep 2019 16:16:59 +0200 Subject: [PATCH 10/12] move map! to the :init section of the package definition --- modules/lang/org/contrib/+hugo.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/lang/org/contrib/+hugo.el b/modules/lang/org/contrib/+hugo.el index 6697b83b0..5f10b844e 100644 --- a/modules/lang/org/contrib/+hugo.el +++ b/modules/lang/org/contrib/+hugo.el @@ -2,17 +2,17 @@ ;;;###if (featurep! +hugo) (use-package! ox-hugo - :after ox) - -(map! :map org-mode-map - :localleader - (:prefix "e" - (:prefix ("H" . "hugo") - :desc "Subtree or File to Md to file" "H" #'org-hugo-export-wim-to-md - :desc "File to Md file" "h" #'org-hugo-export-to-md - :desc "Subtree or File to Md to file & open" "O" '(λ! (org-open-file (org-hugo-export-wim-to-md))) - :desc "File to Md file & open" "o" '(λ! (org-open-file (org-hugo-export-to-md))) - :desc "All subtrees (or File) to Md file(s)" "A" '(λ! (org-hugo-export-wim-to-md :all-subtrees)) - :desc "File to a temporary Md buffer" "t" #'org-hugo-export-as-md))) + :after ox + :init + (map! :map org-mode-map + :localleader + (:prefix "e" + (:prefix ("H" . "hugo") + :desc "Subtree or File to Md to file" "H" #'org-hugo-export-wim-to-md + :desc "File to Md file" "h" #'org-hugo-export-to-md + :desc "Subtree or File to Md to file & open" "O" '(λ! (org-open-file (org-hugo-export-wim-to-md))) + :desc "File to Md file & open" "o" '(λ! (org-open-file (org-hugo-export-to-md))) + :desc "All subtrees (or File) to Md file(s)" "A" '(λ! (org-hugo-export-wim-to-md :all-subtrees)) + :desc "File to a temporary Md buffer" "t" #'org-hugo-export-as-md)))) ;;; +hugo.el ends here From 4480ab00518bc4b6c3b3b4385b3d6509b06f6905 Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Thu, 3 Oct 2019 21:32:07 +0200 Subject: [PATCH 11/12] unquote interactive lambda macros --- modules/lang/org/contrib/+hugo.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/lang/org/contrib/+hugo.el b/modules/lang/org/contrib/+hugo.el index 5f10b844e..cea2e9b4c 100644 --- a/modules/lang/org/contrib/+hugo.el +++ b/modules/lang/org/contrib/+hugo.el @@ -10,9 +10,9 @@ (:prefix ("H" . "hugo") :desc "Subtree or File to Md to file" "H" #'org-hugo-export-wim-to-md :desc "File to Md file" "h" #'org-hugo-export-to-md - :desc "Subtree or File to Md to file & open" "O" '(λ! (org-open-file (org-hugo-export-wim-to-md))) - :desc "File to Md file & open" "o" '(λ! (org-open-file (org-hugo-export-to-md))) - :desc "All subtrees (or File) to Md file(s)" "A" '(λ! (org-hugo-export-wim-to-md :all-subtrees)) + :desc "Subtree or File to Md to file & open" "O" (λ! (org-open-file (org-hugo-export-wim-to-md))) + :desc "File to Md file & open" "o" (λ! (org-open-file (org-hugo-export-to-md))) + :desc "All subtrees (or File) to Md file(s)" "A" (λ! (org-hugo-export-wim-to-md :all-subtrees)) :desc "File to a temporary Md buffer" "t" #'org-hugo-export-as-md)))) ;;; +hugo.el ends here From ce6b2f8c71df0ef351b40b33521269abe4644cec Mon Sep 17 00:00:00 2001 From: Lorenzo Giuliani Date: Fri, 4 Oct 2019 10:28:36 +0200 Subject: [PATCH 12/12] move map! to the :preface section --- modules/lang/org/contrib/+hugo.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/org/contrib/+hugo.el b/modules/lang/org/contrib/+hugo.el index cea2e9b4c..da689afc2 100644 --- a/modules/lang/org/contrib/+hugo.el +++ b/modules/lang/org/contrib/+hugo.el @@ -3,7 +3,7 @@ (use-package! ox-hugo :after ox - :init + :preface (map! :map org-mode-map :localleader (:prefix "e"