]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
optimize snippet-mode
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Tue, 1 Mar 2016 11:02:57 +0000 (12:02 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 2 Mar 2016 13:54:53 +0000 (14:54 +0100)
- default to snippet-mode while in .emacs.d/snippets/*/
- add header template for new files.

bba.org
templates/default-snippet [new file with mode: 0644]

diff --git a/bba.org b/bba.org
index 35e99cb7eda3ec676ce1d53a4aaa8dfa2c161d87..a672c1824d13e0c84fa0efca279dc57614da2de7 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -77,18 +77,6 @@ No need for that:
   (setq inhibit-startup-screen t)
 #+END_SRC
 
-* full screen
-
-Go full screen on OSX in GUI mode:
-
-#+BEGIN_SRC emacs-lisp
-  (when ( and (string-equal system-type "darwin") (display-graphic-p))
-    (set-frame-position nil 0 0)
-    (set-frame-size nil 235 55)
-    )
-
-#+END_SRC
-
 * shell aliases
 
 Some aliases you might want to set in your bash to talk to your Emacs server:
@@ -482,7 +470,7 @@ snippets for =aws cli= are awesome!
   (define-auto-insert "\\.sh$" ["default-sh.sh" ha-autoinsert-yas-expand])
   (define-auto-insert "\\.pl$" ["default-pl.pl" ha-autoinsert-yas-expand])
   (define-auto-insert "\\.tex$" ["default-tex.tex" ha-autoinsert-yas-expand])
-
+  (define-auto-insert "\\.emacs.d/snippets/[^/]*/" ["default-snippet" ha-autoinsert-yas-expand])
 
 #+END_SRC
 
@@ -510,6 +498,11 @@ From http://emacswiki.org/emacs/Yasnippet
             nil)))
 #+end_src
 
+Default to snippet-mode if we are in a sub directory of snippets:
+
+#+BEGIN_SRC emacs-lisp
+  (add-to-list 'auto-mode-alist '("\\.emacs.d/snippets/[^/]*/" . snippet-mode))
+#+END_SRC
 
 * [[https://github.com/flycheck/flycheck][flycheck]]
 
diff --git a/templates/default-snippet b/templates/default-snippet
new file mode 100644 (file)
index 0000000..8600ec2
--- /dev/null
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: header
+# key: <header
+# --
+# -*- mode: snippet -*-
+# name: ${1:`(insert (buffer-name))`}
+# key: ${2:`(insert (buffer-name))`}
+# --
+$0
\ No newline at end of file