1
0
Fork 0

Add snippets for ‘oni-org’

This commit is contained in:
Tom Willemse 2019-08-27 23:43:04 -07:00
parent d5cca9d579
commit 5ab30e5be5
8 changed files with 146 additions and 3 deletions

View file

@ -3,7 +3,7 @@ FILES := $(wildcard *.el)
PACKAGE_TARGETS := $(addprefix package-,$(FILES)) PACKAGE_TARGETS := $(addprefix package-,$(FILES))
package: $(PACKAGE_TARGETS) package-oni-conf package-oni-css package-oni-elisp \ 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-%: % package-%: %
emacs --batch \ emacs --batch \
@ -47,6 +47,12 @@ package-oni-nxml:
--funcall package-initialize \ --funcall package-initialize \
--eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-nxml/dist/*.tar\") #'string>)))" --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-%: install-%:
emacs --batch \ emacs --batch \
--load oni-package.el \ --load oni-package.el \
@ -103,6 +109,14 @@ install-oni-nxml:
$(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \ $(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
--eval "(package-install-file (car (sort (file-expand-wildcards \"oni-nxml/dist/*.tar\") #'string>)))" --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-% test-%: install-%
emacs --batch \ emacs --batch \
--load oni-package.el \ --load oni-package.el \

14
oni-org/Cask Normal file
View file

@ -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/*"))

View file

@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 20190815163343 ;; Version: 20190827234011
;; Package-Requires: (org-plus-contrib org-bullets hydra org-wild-notifier) ;; 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 ;; 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 ;; it under the terms of the GNU General Public License as published by
@ -31,6 +31,17 @@
(require 'org-capture) (require 'org-capture)
(require 'org-clock) (require 'org-clock)
(require 'org-habit) (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) (defun oni-org-expand-to-home (file-name)
"Expand FILE-NAME to the base directory for that system. "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-heading-has-predecessor-p))
(oni-org-next-heading-position)))) (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 () (defun oni-org-delete-frame-once ()
"Run `delete-frame'. "Run `delete-frame'.
@ -185,6 +203,11 @@ After running it once remove it from `org-capture-after-finalize-hook'."
;;;###autoload ;;;###autoload
(global-set-key (kbd "C-<home>") #'oni-org-open-index) (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)) ;;;###autoload(with-eval-after-load 'org (require 'oni-org))
(provide 'oni-org) (provide 'oni-org)

View file

@ -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

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: codeblock
# key: code
# --
#+begin_src $1
$0
#+end_src

View file

@ -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

View file

@ -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...}

View file

@ -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