aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2019-08-27 23:43:04 -0700
committerGravatar Tom Willemse2019-08-27 23:43:04 -0700
commit5ab30e5be5262c5abc74b3762a75b17c0eb7710c (patch)
tree5b8745629b4554a138e43095edb14d397bfcc0b3
parentd5cca9d5795824fd2a2b54e6254a0354735ce500 (diff)
downloademacs-config-5ab30e5be5262c5abc74b3762a75b17c0eb7710c.tar.gz
emacs-config-5ab30e5be5262c5abc74b3762a75b17c0eb7710c.zip
Add snippets for ‘oni-org’
-rw-r--r--GNUmakefile16
-rw-r--r--oni-org/Cask14
-rw-r--r--oni-org/oni-org.el (renamed from oni-org.el)27
-rw-r--r--oni-org/snippets/org-mode/.yas-compiled-snippets.el11
-rw-r--r--oni-org/snippets/org-mode/codeblock7
-rw-r--r--oni-org/snippets/org-mode/heading9
-rw-r--r--oni-org/snippets/org-mode/project51
-rw-r--r--oni-org/snippets/org-mode/snippet14
8 files changed, 146 insertions, 3 deletions
diff --git a/GNUmakefile b/GNUmakefile
index e58648c..246208b 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -3,7 +3,7 @@ FILES := $(wildcard *.el)
PACKAGE_TARGETS := $(addprefix package-,$(FILES))
package: $(PACKAGE_TARGETS) package-oni-conf package-oni-css package-oni-elisp \
- package-oni-haml package-oni-html package-oni-nxml
+ package-oni-haml package-oni-html package-oni-nxml package-oni-org
package-%: %
emacs --batch \
@@ -47,6 +47,12 @@ package-oni-nxml:
--funcall package-initialize \
--eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-nxml/dist/*.tar\") #'string>)))"
+package-oni-org:
+ emacs --batch \
+ --load oni-package.el \
+ --funcall package-initialize \
+ --eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-org/dist/*.tar\") #'string>)))"
+
install-%:
emacs --batch \
--load oni-package.el \
@@ -103,6 +109,14 @@ install-oni-nxml:
$(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
--eval "(package-install-file (car (sort (file-expand-wildcards \"oni-nxml/dist/*.tar\") #'string>)))"
+install-oni-org:
+ emacs --batch \
+ --load oni-package.el \
+ --fluncall package-initialize \
+ --eval '(package-refresh-contents)' \
+ $(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
+ --eval "(package-install-file (car (sort (file-expand-wildcards \"oni-org/dist/*.tar\") #'string>)))"
+
test-%: install-%
emacs --batch \
--load oni-package.el \
diff --git a/oni-org/Cask b/oni-org/Cask
new file mode 100644
index 0000000..ea3441e
--- /dev/null
+++ b/oni-org/Cask
@@ -0,0 +1,14 @@
+(source gnu)
+(source melpa)
+
+(package-file "./oni-org.el")
+
+(depends-on "oni-yasnippet" :git "../" :files ("oni-yasnippet.el"))
+(depends-on "org-plus-contrib")
+(depends-on "org-bullets")
+(depends-on "hydra")
+(depends-on "org-wild-notifier")
+
+(files
+ "*.el"
+ ("snippets" "./snippets/*"))
diff --git a/oni-org.el b/oni-org/oni-org.el
index 59170d1..4ba4506 100644
--- a/oni-org.el
+++ b/oni-org/oni-org.el
@@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 20190815163343
-;; Package-Requires: (org-plus-contrib org-bullets hydra org-wild-notifier)
+;; Version: 20190827234011
+;; Package-Requires: (oni-yasnippet org-plus-contrib org-bullets hydra org-wild-notifier)
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -31,6 +31,17 @@
(require 'org-capture)
(require 'org-clock)
(require 'org-habit)
+(require 'yasnippet)
+
+(defconst oni-org-root
+ (file-name-directory
+ (or load-file-name
+ (buffer-file-name)))
+ "The directory where ‘oni-org’ was loaded from.")
+
+(defconst oni-org-snippets-dir
+ (expand-file-name "snippets" oni-org-root)
+ "The directory where ‘oni-org’ stores its snippets.")
(defun oni-org-expand-to-home (file-name)
"Expand FILE-NAME to the base directory for that system.
@@ -83,6 +94,13 @@ ones that have a predecessor."
(oni-org-heading-has-predecessor-p))
(oni-org-next-heading-position))))
+;;;###autoload
+(defun oni-org-snippets-initialize ()
+ "Initialize the snippets for ‘oni-org’."
+ (when (boundp 'yas-snippet-dirs)
+ (add-to-list 'yas-snippet-dirs oni-org-snippets-dir t))
+ (yas-load-directory oni-org-snippets-dir))
+
(defun oni-org-delete-frame-once ()
"Run `delete-frame'.
@@ -185,6 +203,11 @@ After running it once remove it from `org-capture-after-finalize-hook'."
;;;###autoload
(global-set-key (kbd "C-<home>") #'oni-org-open-index)
+;;;###autoload
+(with-eval-after-load 'org
+ (with-eval-after-load 'yasnippet
+ (oni-org-snippets-initialize)))
+
;;;###autoload(with-eval-after-load 'org (require 'oni-org))
(provide 'oni-org)
diff --git a/oni-org/snippets/org-mode/.yas-compiled-snippets.el b/oni-org/snippets/org-mode/.yas-compiled-snippets.el
new file mode 100644
index 0000000..84e4e69
--- /dev/null
+++ b/oni-org/snippets/org-mode/.yas-compiled-snippets.el
@@ -0,0 +1,11 @@
+;;; Compiled snippets and support files for `org-mode'
+;;; Snippet definitions:
+;;;
+(yas-define-snippets 'org-mode
+ '(("snippet" "#+TITLE: ${1:snippet-name}\n#+OPTIONS: toc:nil\n\n* $1\n\n ${2:A short description abount $1}\n\n #+BEGIN_SRC $3 :tangle yes\n$0\n #+END_SRC" "snippet" nil nil nil "/home/chelys/projects/new-dotfiles/emacs/.emacs.d/snippets/org-mode/snippet" nil nil)
+ ("project" "#+TITLE: ${1:project_name}\n#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/}\n#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz\n#+LINK: zip $2$4.zip\n#+STARTUP: showall\n\n#+begin_html\n <script src=\"/keyjs.js\" type=\"text/javascript\"></script>\n <script type=\"text/javascript\">\n keyjs_initialize({ \"u\": [ \"keyjs_goto\", \"../index.html\" ],\n \"h\": [ \"keyjs_goto\", \"http://ryuslash.org\" ] });\n </script>\n#+end_html\n\n#+INCLUDE: \"dlmenu.inc\"\n\n* About\n\n ${5:A short description about $1}\n\n | $0Status | $6 |\n | Language | $7 |\n | License | ${8:GPLv3} |\n\n* Why?\n\n ${9:Why did you even think of writing $1?}\n\n* Features\n\n ${10:$1 does...}\n\n* Dependencies\n\n ${11:$1 needs to have...}\n\n* Download\n\n ${12:To download $1...}\n\n* Install\n\n ${13:To install $1...}\n\n* Usage\n\n ${14:Using $1...}" "project" nil nil nil "/home/chelys/projects/new-dotfiles/emacs/.emacs.d/snippets/org-mode/project" nil nil)
+ ("*" "${1:*} ${2:TODO} $3\n${1:$(make-string (length text) ?\\ )} :PROPERTIES:\n${1:$(make-string (length text) ?\\ )} :CATEGORY: $4\n${1:$(make-string (length text) ?\\ )} :END:\n${1:$(make-string (length text) ?\\ )} $0" "Heading" nil nil nil "/home/chelys/projects/new-dotfiles/emacs/.emacs.d/snippets/org-mode/heading" nil nil)
+ ("code" "#+begin_src $1\n $0\n#+end_src" "codeblock" nil nil nil "/home/chelys/projects/new-dotfiles/emacs/.emacs.d/snippets/org-mode/codeblock" nil nil)))
+
+
+;;; Do not edit! File generated at Sun Jun 24 19:24:25 2018
diff --git a/oni-org/snippets/org-mode/codeblock b/oni-org/snippets/org-mode/codeblock
new file mode 100644
index 0000000..a200b08
--- /dev/null
+++ b/oni-org/snippets/org-mode/codeblock
@@ -0,0 +1,7 @@
+# -*- mode: snippet -*-
+# name: codeblock
+# key: code
+# --
+#+begin_src $1
+ $0
+#+end_src \ No newline at end of file
diff --git a/oni-org/snippets/org-mode/heading b/oni-org/snippets/org-mode/heading
new file mode 100644
index 0000000..9d5451e
--- /dev/null
+++ b/oni-org/snippets/org-mode/heading
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: Heading
+# key: *
+# --
+${1:*} ${2:TODO} $3
+${1:$(make-string (length text) ?\ )} :PROPERTIES:
+${1:$(make-string (length text) ?\ )} :CATEGORY: $4
+${1:$(make-string (length text) ?\ )} :END:
+${1:$(make-string (length text) ?\ )} $0 \ No newline at end of file
diff --git a/oni-org/snippets/org-mode/project b/oni-org/snippets/org-mode/project
new file mode 100644
index 0000000..269d655
--- /dev/null
+++ b/oni-org/snippets/org-mode/project
@@ -0,0 +1,51 @@
+# -*- mode: snippet -*-
+# name: project
+# key: project
+# --
+#+TITLE: ${1:project_name}
+#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/}
+#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz
+#+LINK: zip $2$4.zip
+#+STARTUP: showall
+
+#+begin_html
+ <script src="/keyjs.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ keyjs_initialize({ "u": [ "keyjs_goto", "../index.html" ],
+ "h": [ "keyjs_goto", "http://ryuslash.org" ] });
+ </script>
+#+end_html
+
+#+INCLUDE: "dlmenu.inc"
+
+* About
+
+ ${5:A short description about $1}
+
+ | $0Status | $6 |
+ | Language | $7 |
+ | License | ${8:GPLv3} |
+
+* Why?
+
+ ${9:Why did you even think of writing $1?}
+
+* Features
+
+ ${10:$1 does...}
+
+* Dependencies
+
+ ${11:$1 needs to have...}
+
+* Download
+
+ ${12:To download $1...}
+
+* Install
+
+ ${13:To install $1...}
+
+* Usage
+
+ ${14:Using $1...} \ No newline at end of file
diff --git a/oni-org/snippets/org-mode/snippet b/oni-org/snippets/org-mode/snippet
new file mode 100644
index 0000000..67f15d5
--- /dev/null
+++ b/oni-org/snippets/org-mode/snippet
@@ -0,0 +1,14 @@
+# -*- mode: snippet -*-
+# name: snippet
+# key: snippet
+# --
+#+TITLE: ${1:snippet-name}
+#+OPTIONS: toc:nil
+
+* $1
+
+ ${2:A short description abount $1}
+
+ #+BEGIN_SRC $3 :tangle yes
+$0
+ #+END_SRC \ No newline at end of file