From 874b5eac1d6900fb2c2c35557ed14c24dd234300 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 25 Jan 2017 17:41:29 +0100 Subject: emacs: improved yasnippet and diminish some minor modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- emacs/init.html | 60 ++++++++++++++++++++++---------- emacs/init.org | 77 +++++++++++++++++++++++++++--------------- emacs/snippets/org-mode/header | 8 +++++ 3 files changed, 99 insertions(+), 46 deletions(-) create mode 100644 emacs/snippets/org-mode/header 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 @@ mssola's GNU Emacs configuration - + @@ -709,6 +709,18 @@ package-install, I decided on use-package because I feel more well-organized. (package-install 'use-package)) + +

+Some use-package calls require diminish.el to be available. So, let's +require it here on the very top. +

+ +
+ +
(use-package diminish
+  :ensure t)
+
+
@@ -854,9 +866,13 @@ recent versions of GNU Emacs.
(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)))
@@ -875,6 +891,7 @@ extension. This works with lots of languages with proper glue code.
 
 (use-package flycheck
   :ensure t
+  :diminish
   :config
   (add-hook 'after-init-hook 'global-flycheck-mode)
 
@@ -925,6 +942,7 @@ I never use the mouse.
 
 
(use-package disable-mouse
   :ensure t
+  :diminish
   :config
   (global-disable-mouse-mode))
 
@@ -999,6 +1017,27 @@ covers most of my uses, it's convenient to have this tool anyways. (add-hook 'text-mode-hook 'er/add-text-mode-expansions)
+ +

+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 +, a to yas-describe-tables, which shows the available +snippets in another buffer. +

+ +
+ +
(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)))
+
+
@@ -1521,7 +1560,7 @@ render an HTML message with Webkit.

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

@@ -2169,21 +2208,6 @@ criteria really). (add-hook lang-hook 'soria-purple-identifiers)) - -

-Last but not least, YASnippet. This package allows people to define shortcuts -for writing some common blocks. -

- -
- -
(use-package yasnippet
-  :ensure t
-  :config
-  (yas-reload-all)
-  (add-hook 'prog-mode-hook #'yas-minor-mode))
-
-
@@ -2261,7 +2285,7 @@ along with this program. If not, see < 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: #+HTML_HEAD: #+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:, a@@ 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:} +#+AUTHOR: `(user-full-name)` +#+EMAIL: `user-mail-address` + +* $0 \ No newline at end of file -- cgit v1.2.3