Skip to content

Commit

Permalink
[emacs] drop org-mode snippets in favor of yasnippet
Browse files Browse the repository at this point in the history
The behavior changed in 9.2 and I don't think it's worth using
anymore. Furthermore, it doesn't play well with elecric mode for <
brackets.

See also: https://www.reddit.com/r/emacs/comments/ad68zk/get_easytemplates_back_in_orgmode_92/
  • Loading branch information
rasendubi committed Mar 26, 2019
1 parent 3a5e405 commit 8ce96d2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 40 deletions.
7 changes: 7 additions & 0 deletions .emacs.d/snippets/org-mode/emacs-lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: emacs-lisp
# key: e
# --
#+begin_src emacs-lisp
$0
#+end_src
5 changes: 5 additions & 0 deletions .emacs.d/snippets/org-mode/name
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: name
# key: n
# --
#+name: $0
2 changes: 1 addition & 1 deletion .emacs.d/snippets/org-mode/src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: src
# key: src
# key: s
# binding: direct-keybinding
# --
#+begin_src $1
Expand Down
39 changes: 0 additions & 39 deletions emacs.org
Original file line number Diff line number Diff line change
Expand Up @@ -1261,45 +1261,6 @@ Allow encrypted entries in org files.
(setq org-crypt-key "[email protected]")
(add-hook 'org-babel-pre-tangle-hook 'org-decrypt-entries t)
#+end_src
** snippets
*** lowercase
Make default lowercase. I don't like shouting =#+BEGIN_SRC= and prefer calm =#+begin_src=.

This also sets =begin_example= to =E= (instead of default =e=).
#+name: org-config
#+begin_src emacs-lisp
(setq org-structure-template-alist
'(("s" "#+begin_src ?\n\n#+end_src" "<src lang=\"?\">\n\n</src>")
("E" "#+begin_example\n?\n#+end_example" "<example>\n?\n</example>")
("q" "#+begin_quote\n?\n#+end_quote" "<quote>\n?\n</quote>")
("v" "#+begin_verse\n?\n#+end_verse" "<verse>\n?\n</verse>")
("V" "#+begin_verbatim\n?\n#+end_verbatim" "<verbatim>\n?\n</verbatim>")
("c" "#+begin_center\n?\n#+end_center" "<center>\n?\n</center>")
("l" "#+begin_latex\n?\n#+end_latex" "<literal style=\"latex\">\n?\n</literal>")
("L" "#+latex: " "<literal style=\"latex\">?</literal>")
("h" "#+begin_html\n?\n#+end_html" "<literal style=\"html\">\n?\n</literal>")
("H" "#+html: " "<literal style=\"html\">?</literal>")
("a" "#+begin_ascii\n?\n#+end_ascii" "")
("A" "#+ascii: " "")
("i" "#+index: ?" "#+index: ?")
("I" "#+include: %file ?" "<include file=%file markup=\"?\">")))
#+end_src

These can be invoked with =< x TAB= where =x= is the letter from the above list. (e.g., =< s TAB= expands to src block.)
*** name attribute
I use =#+name:= attribute often.
#+name: org-config
#+begin_src emacs-lisp
(add-to-list 'org-structure-template-alist
'("n" "#+name: ?" ""))
#+end_src
*** emacs-lisp block
Insert Emacs Lisp code block. Used a lot in this file.
#+name: org-config
#+begin_src emacs-lisp
(add-to-list 'org-structure-template-alist
'("e" "#+begin_src emacs-lisp\n?\n#+end_src" "<src lang=\"emacs-lisp\">\n?\n</src>"))
#+end_src
** Pomodoro
#+begin_src emacs-lisp
(use-package org-pomodoro
Expand Down

0 comments on commit 8ce96d2

Please sign in to comment.