aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2017-01-25 17:41:29 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2017-01-25 17:41:29 +0100
commit874b5eac1d6900fb2c2c35557ed14c24dd234300 (patch)
tree9b694bf2cdf1eddfbfbfdd826d445f04667f9cab
parent6a6faa368328ad3b7d7737e535875405778f9103 (diff)
downloaddotfiles-874b5eac1d6900fb2c2c35557ed14c24dd234300.tar.gz
dotfiles-874b5eac1d6900fb2c2c35557ed14c24dd234300.zip
emacs: improved yasnippet and diminish some minor modes
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
-rw-r--r--emacs/init.html60
-rw-r--r--emacs/init.org77
-rw-r--r--emacs/snippets/org-mode/header8
3 files changed, 99 insertions, 46 deletions
diff --git a/emacs/init.html b/emacs/init.html
index fb71af3..c4c85c2 100644
--- a/emacs/init.html
+++ b/emacs/init.html
@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>mssola's GNU Emacs configuration</title>
-<!-- 2017-01-19 Thu 09:51 -->
+<!-- 2017-01-25 Wed 17:40 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="generator" content="Org-mode" />
<meta name="author" content="Miquel Sabaté Solà" />
@@ -709,6 +709,18 @@ package-install, I decided on use-package because I feel more well-organized.
<span class="org-rainbow-delimiters-depth-2">(</span>package-install 'use-package<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>
</pre>
</div>
+
+<p>
+Some <code>use-package</code> calls require <code>diminish.el</code> to be available. So, let's
+require it here on the very top.
+</p>
+
+<div class="org-src-container">
+
+<pre class="src src-elisp"><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">use-package</span> diminish
+ <span class="org-builtin">:ensure</span> t<span class="org-rainbow-delimiters-depth-1">)</span>
+</pre>
+</div>
</div>
</div>
</div>
@@ -854,9 +866,13 @@ recent versions of GNU Emacs.
<pre class="src src-elisp"><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">with-eval-after-load</span> 'undo-tree
<span class="org-rainbow-delimiters-depth-2">(</span>global-undo-tree-mode 1<span class="org-rainbow-delimiters-depth-2">)</span>
+
<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-keyword">setq</span> undo-tree-visualizer-diff t
undo-tree-visualizer-timestamps t
undo-tree-visualizer-relative-timestamps t<span class="org-rainbow-delimiters-depth-2">)</span>
+
+ <span class="org-rainbow-delimiters-depth-2">(</span>diminish 'undo-tree-mode<span class="org-rainbow-delimiters-depth-2">)</span>
+
<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-keyword">with-eval-after-load</span> 'evil-leader
<span class="org-rainbow-delimiters-depth-3">(</span>evil-leader/set-key
<span class="org-string">"u"</span> 'undo-tree-visualize<span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>
@@ -875,6 +891,7 @@ extension. This works with lots of languages with proper glue code.
<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">use-package</span> flycheck
<span class="org-builtin">:ensure</span> t
+ <span class="org-builtin">:diminish</span>
<span class="org-builtin">:config</span>
<span class="org-rainbow-delimiters-depth-2">(</span>add-hook 'after-init-hook 'global-flycheck-mode<span class="org-rainbow-delimiters-depth-2">)</span>
@@ -925,6 +942,7 @@ I never use the mouse.
<pre class="src src-elisp"><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">use-package</span> disable-mouse
<span class="org-builtin">:ensure</span> t
+ <span class="org-builtin">:diminish</span>
<span class="org-builtin">:config</span>
<span class="org-rainbow-delimiters-depth-2">(</span>global-disable-mouse-mode<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>
</pre>
@@ -999,6 +1017,27 @@ covers most of my uses, it's convenient to have this tool anyways.
<span class="org-rainbow-delimiters-depth-1">(</span>add-hook 'text-mode-hook 'er/add-text-mode-expansions<span class="org-rainbow-delimiters-depth-1">)</span>
</pre>
</div>
+
+<p>
+Last but not least, <code>YASnippet</code>. This package allows people to define shortcuts
+for writing some common blocks. Moreover, it comes with a set of builtin
+snippets already. Since I don't remember some of these snippets, I've mapped
+<kbd>, a</kbd> to <code>yas-describe-tables</code>, which shows the available
+snippets in another buffer.
+</p>
+
+<div class="org-src-container">
+
+<pre class="src src-elisp"><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">use-package</span> yasnippet
+ <span class="org-builtin">:ensure</span> t
+ <span class="org-builtin">:diminish</span> yas-minor-mode
+ <span class="org-builtin">:init</span> <span class="org-rainbow-delimiters-depth-2">(</span>yas-global-mode<span class="org-rainbow-delimiters-depth-2">)</span>
+ <span class="org-builtin">:config</span>
+ <span class="org-rainbow-delimiters-depth-2">(</span>yas-global-mode 1<span class="org-rainbow-delimiters-depth-2">)</span>
+ <span class="org-rainbow-delimiters-depth-2">(</span><span class="org-keyword">with-eval-after-load</span> 'evil-leader
+ <span class="org-rainbow-delimiters-depth-3">(</span>evil-leader/set-key <span class="org-string">"h"</span> 'yas-describe-tables<span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>
+</pre>
+</div>
</div>
</div>
@@ -1521,7 +1560,7 @@ render an HTML message with Webkit.
</div>
<p>
-Look for mu4e-msg2pdf in the exec path. The reason for this is that that OBS
+Look for <code>mu4e-msg2pdf</code> in the exec path. The reason for this is that the OBS
package installs mu's <code>toys</code> into the exec path, but <code>mu4e</code> doesn't really count
on it.
</p>
@@ -2169,21 +2208,6 @@ criteria really).
<span class="org-rainbow-delimiters-depth-2">(</span>add-hook lang-hook 'soria-purple-identifiers<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>
</pre>
</div>
-
-<p>
-Last but not least, <code>YASnippet</code>. This package allows people to define shortcuts
-for writing some common blocks.
-</p>
-
-<div class="org-src-container">
-
-<pre class="src src-elisp"><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">use-package</span> yasnippet
- <span class="org-builtin">:ensure</span> t
- <span class="org-builtin">:config</span>
- <span class="org-rainbow-delimiters-depth-2">(</span>yas-reload-all<span class="org-rainbow-delimiters-depth-2">)</span>
- <span class="org-rainbow-delimiters-depth-2">(</span>add-hook 'prog-mode-hook #'yas-minor-mode<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>
-</pre>
-</div>
</div>
</div>
@@ -2261,7 +2285,7 @@ along with this program. If not, see <a href="http://www.gnu.org/licenses/">&lt
</div>
<div id="postamble" class="status">
<p class="author">Author: Miquel Sabaté Solà</p>
-<p class="date">Created: 2017-01-19 Thu 09:51</p>
+<p class="date">Created: 2017-01-25 Wed 17:40</p>
<p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 25.1.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10)</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
diff --git a/emacs/init.org b/emacs/init.org
index 0ad6c97..855e610 100644
--- a/emacs/init.org
+++ b/emacs/init.org
@@ -1,5 +1,6 @@
#+TITLE: mssola's GNU Emacs configuration
#+AUTHOR: Miquel Sabaté Solà
+#+EMAIL: mikisabate@gmail.com
#+HTML_HEAD: <link rel="stylesheet" href="http://jo.mssola.com/static/style.css" type="text/css" />
#+HTML_HEAD: <link rel="stylesheet" href="http://jo.mssola.com/static/org.css" type="text/css" />
#+BABEL: :cache yes
@@ -392,6 +393,14 @@ package-install, I decided on use-package because I feel more well-organized.
(package-install 'use-package))
#+END_SRC
+Some =use-package= calls require =diminish.el= to be available. So, let's
+require it here on the very top.
+
+#+BEGIN_SRC elisp
+(use-package diminish
+ :ensure t)
+#+END_SRC
+
* Project
First of all, load the silver searcher, which is a convenient and fast searcher.
@@ -510,9 +519,13 @@ recent versions of GNU Emacs.
#+BEGIN_SRC elisp
(with-eval-after-load 'undo-tree
(global-undo-tree-mode 1)
+
(setq undo-tree-visualizer-diff t
undo-tree-visualizer-timestamps t
undo-tree-visualizer-relative-timestamps t)
+
+ (diminish 'undo-tree-mode)
+
(with-eval-after-load 'evil-leader
(evil-leader/set-key
"u" 'undo-tree-visualize)))
@@ -522,20 +535,21 @@ Another important package is =flycheck=, which is an on-the-fly syntax checking
extension. This works with lots of languages with proper glue code.
#+BEGIN_SRC elisp
- (use-package let-alist
- :ensure t)
+(use-package let-alist
+ :ensure t)
- (use-package flycheck
- :ensure t
- :config
- (add-hook 'after-init-hook 'global-flycheck-mode)
+(use-package flycheck
+ :ensure t
+ :diminish
+ :config
+ (add-hook 'after-init-hook 'global-flycheck-mode)
- ;; Only show the errors buffer if it isn't there and if I'm saving the
- ;; buffer.
- (setq flycheck-emacs-lisp-load-path 'inherit)
- (setq flycheck-check-syntax-automatically '(mode-enabled save))
- (setq flycheck-display-errors-function
- #'flycheck-display-error-messages-unless-error-list))
+ ;; Only show the errors buffer if it isn't there and if I'm saving the
+ ;; buffer.
+ (setq flycheck-emacs-lisp-load-path 'inherit)
+ (setq flycheck-check-syntax-automatically '(mode-enabled save))
+ (setq flycheck-display-errors-function
+ #'flycheck-display-error-messages-unless-error-list))
#+END_SRC
A recurring issue in speeches and presentations is that when showing something
@@ -563,10 +577,11 @@ supports it).
I never use the mouse.
#+BEGIN_SRC elisp
- (use-package disable-mouse
- :ensure t
- :config
- (global-disable-mouse-mode))
+(use-package disable-mouse
+ :ensure t
+ :diminish
+ :config
+ (global-disable-mouse-mode))
#+END_SRC
Sometimes you begin typing a prefix, but then you forget the following
@@ -623,6 +638,23 @@ covers most of my uses, it's convenient to have this tool anyways.
(add-hook 'text-mode-hook 'er/add-text-mode-expansions)
#+END_SRC
+Last but not least, =YASnippet=. This package allows people to define shortcuts
+for writing some common blocks. Moreover, it comes with a set of builtin
+snippets already. Since I don't remember some of these snippets, I've mapped
+@@html:<kbd>, a</kbd>@@ to =yas-describe-tables=, which shows the available
+snippets in another buffer.
+
+#+BEGIN_SRC elisp
+(use-package yasnippet
+ :ensure t
+ :diminish yas-minor-mode
+ :init (yas-global-mode)
+ :config
+ (yas-global-mode 1)
+ (with-eval-after-load 'evil-leader
+ (evil-leader/set-key "h" 'yas-describe-tables)))
+#+END_SRC
+
* Dired
I use dired mode mainly for attaching document into emails. That being said,
@@ -1057,7 +1089,7 @@ render an HTML message with Webkit.
'("webkit" . mu4e-action-view-with-xwidget)))
#+END_SRC
-Look for mu4e-msg2pdf in the exec path. The reason for this is that that OBS
+Look for =mu4e-msg2pdf= in the exec path. The reason for this is that the OBS
package installs mu's =toys= into the exec path, but =mu4e= doesn't really count
on it.
@@ -1582,17 +1614,6 @@ criteria really).
(add-hook lang-hook 'soria-purple-identifiers))
#+END_SRC
-Last but not least, =YASnippet=. This package allows people to define shortcuts
-for writing some common blocks.
-
-#+BEGIN_SRC elisp
- (use-package yasnippet
- :ensure t
- :config
- (yas-reload-all)
- (add-hook 'prog-mode-hook #'yas-minor-mode))
-#+END_SRC
-
* Misc
Install a set of useful functions from [[https://github.com/bbatsov][@bbatsov]]. The bindings are following
diff --git a/emacs/snippets/org-mode/header b/emacs/snippets/org-mode/header
new file mode 100644
index 0000000..a3f7fca
--- /dev/null
+++ b/emacs/snippets/org-mode/header
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+#name : header
+# --
+#+TITLE: ${1:<title>}
+#+AUTHOR: `(user-full-name)`
+#+EMAIL: `user-mail-address`
+
+* $0 \ No newline at end of file