diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2017-02-08 17:48:50 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2017-02-08 17:48:50 +0100 |
| commit | d8fa86e10c12a380d5a04883af7c87a070b22279 (patch) | |
| tree | aed29ac49088b20d54a54dfc69a3e8cf717e9878 | |
| parent | 74860a68f092ce7d195eb83c6b6de7a0cb77acdc (diff) | |
| download | dotfiles-d8fa86e10c12a380d5a04883af7c87a070b22279.tar.gz dotfiles-d8fa86e10c12a380d5a04883af7c87a070b22279.zip | |
emacs: added json-reformat
I've also sorted a bit how things are in the programming language section.
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
| -rw-r--r-- | emacs/custom.el | 2 | ||||
| -rw-r--r-- | emacs/init.html | 92 | ||||
| -rw-r--r-- | emacs/init.org | 34 |
3 files changed, 116 insertions, 12 deletions
diff --git a/emacs/custom.el b/emacs/custom.el index af4867b..6ba8355 100644 --- a/emacs/custom.el +++ b/emacs/custom.el @@ -15,7 +15,7 @@ '(markdown-command "/usr/bin/markdown-calibre") '(package-selected-packages (quote - (erc-image erc-yt erc-hl-nicks emoji-cheat-sheet-plus helm-circe htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile writeroom-mode org-eldoc evil-commentary circe yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck expand-region evil-surround evil-org evil-numbers evil-mu4e evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag)))) + (json-reformat erc-image erc-yt erc-hl-nicks emoji-cheat-sheet-plus helm-circe htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile writeroom-mode org-eldoc evil-commentary circe yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck expand-region evil-surround evil-org evil-numbers evil-mu4e evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/emacs/init.html b/emacs/init.html index 784972d..f79b590 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-02-07 Tue 17:02 --> +<!-- 2017-02-08 Wed 17:48 --> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta name="generator" content="Org-mode" /> <meta name="author" content="Miquel Sabaté Solà" /> @@ -182,7 +182,19 @@ for the JavaScript code in this tag. </ul> </li> <li><a href="#sec-14">IRC</a></li> -<li><a href="#sec-15">Languages</a></li> +<li><a href="#sec-15">Languages</a> +<ul> +<li><a href="#sec-15-1">General</a></li> +<li><a href="#sec-15-2">Lisp</a></li> +<li><a href="#sec-15-3">C and C++</a></li> +<li><a href="#sec-15-4">Ruby</a></li> +<li><a href="#sec-15-5">Go</a></li> +<li><a href="#sec-15-6">Tabs vs spaces</a></li> +<li><a href="#sec-15-7">Inferior markup languages.</a></li> +<li><a href="#sec-15-8">Web-related stuff.</a></li> +<li><a href="#sec-15-9">Others</a></li> +</ul> +</li> <li><a href="#sec-16">WoMan</a></li> <li><a href="#sec-17">Misc</a></li> <li><a href="#sec-18">Credits</a></li> @@ -2198,6 +2210,9 @@ And now define a function to connect to both IRC servers. <div id="outline-container-sec-15" class="outline-2"> <h2 id="sec-15">Languages</h2> <div class="outline-text-2" id="text-15"> +</div><div id="outline-container-sec-15-1" class="outline-3"> +<h3 id="sec-15-1">General</h3> +<div class="outline-text-3" id="text-15-1"> <p> First of all, define a function that identifies some warning keywords (e.g. TODO). This function can then be applied to the proper mode. @@ -2227,7 +2242,12 @@ context too. In this case, I want spell check and <code>wc-mode</code> activated <span class="org-rainbow-delimiters-depth-3">(</span>wc-mode 1<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> +<div id="outline-container-sec-15-2" class="outline-3"> +<h3 id="sec-15-2">Lisp</h3> +<div class="outline-text-3" id="text-15-2"> <p> Emacs lisp needs <code>rainbow-delimiters</code>, so the amount of parenthesis is less confusing. Moreover, I'm also enabling <code>eldoc-mode</code> and the aforementioned @@ -2245,7 +2265,12 @@ confusing. Moreover, I'm also enabling <code>eldoc-mode</code> and the aforement <span class="org-rainbow-delimiters-depth-3">(</span><span class="org-keyword">setq</span> mode-name <span class="org-string">"ξ"</span><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> +<div id="outline-container-sec-15-3" class="outline-3"> +<h3 id="sec-15-3">C and C++</h3> +<div class="outline-text-3" id="text-15-3"> <p> C and C++ only require the <code>warnings-mode-hook</code> function, spell checking for the comments and the usage of tabs instead of spaces. @@ -2266,7 +2291,12 @@ comments and the usage of tabs instead of spaces. <span class="org-rainbow-delimiters-depth-2">(</span><span class="org-keyword">lambda</span> <span class="org-rainbow-delimiters-depth-3">()</span> <span class="org-rainbow-delimiters-depth-3">(</span><span class="org-keyword">setq</span> indent-tabs-mode t<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> +<div id="outline-container-sec-15-4" class="outline-3"> +<h3 id="sec-15-4">Ruby</h3> +<div class="outline-text-3" id="text-15-4"> <p> Include warning keywords in Ruby. </p> @@ -2276,7 +2306,12 @@ Include warning keywords in Ruby. <pre class="src src-elisp"><span class="org-rainbow-delimiters-depth-1">(</span>add-hook 'ruby-mode-hook 'warnings-mode-hook<span class="org-rainbow-delimiters-depth-1">)</span> </pre> </div> +</div> +</div> +<div id="outline-container-sec-15-5" class="outline-3"> +<h3 id="sec-15-5">Go</h3> +<div class="outline-text-3" id="text-15-5"> <p> And now my Go configuration. This includes stuff like the usage of <code>goimports</code>, <code>gofmt</code> on save, among many other useful things. @@ -2326,7 +2361,12 @@ And now my Go configuration. This includes stuff like the usage of <code>goimpor <span class="org-rainbow-delimiters-depth-2">(</span>add-hook 'go-mode-hook 'mssola-go-mode<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span> </pre> </div> +</div> +</div> +<div id="outline-container-sec-15-6" class="outline-3"> +<h3 id="sec-15-6">Tabs vs spaces</h3> +<div class="outline-text-3" id="text-15-6"> <p> Tabs or spaces? <a href="https://www.emacswiki.org/emacs/TabsSpacesBoth">Both</a>. The <code>smart-tabs-mode</code> has the philosophy of: tabs for indentation, spaces for alignment. This is only applied in languages where I'm @@ -2344,11 +2384,12 @@ usings tabs for indentation (C, C++ and Go). <span class="org-rainbow-delimiters-depth-2">(</span>smart-tabs-insinuate 'c 'c++ 'golang<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span> </pre> </div> +</div> +</div> -<p> -Inferior markup languages. -</p> - +<div id="outline-container-sec-15-7" class="outline-3"> +<h3 id="sec-15-7">Inferior markup languages.</h3> +<div class="outline-text-3" id="text-15-7"> <div class="org-src-container"> <pre class="src src-elisp"><span class="org-comment-delimiter">;; </span><span class="org-comment">Markdown mode with preview mode in the browser.</span> @@ -2376,9 +2417,14 @@ Inferior markup languages. <span class="org-rainbow-delimiters-depth-2">(</span>add-hook 'yaml-mode-hook 'warnings-mode-hook<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span> </pre> </div> +</div> +</div> +<div id="outline-container-sec-15-8" class="outline-3"> +<h3 id="sec-15-8">Web-related stuff.</h3> +<div class="outline-text-3" id="text-15-8"> <p> -Web-related stuff. +Slim and SCSS. </p> <div class="org-src-container"> @@ -2392,8 +2438,17 @@ Web-related stuff. <span class="org-rainbow-delimiters-depth-2">(</span><span class="org-keyword">setq</span> scss-compile-at-save nil<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-rainbow-delimiters-depth-2">(</span>add-hook 'yaml-mode-hook 'warnings-mode-hook<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span> +</pre> +</div> + +<p> +Languages specific for backend code like PHP, and <code>web-mode</code>, which provides a +bundle of features which are interesting for web-related stuff. +</p> -<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">use-package</span> <span class="org-constant">php-mode</span> +<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> <span class="org-constant">php-mode</span> <span class="org-builtin">:ensure</span> t<span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">use-package</span> <span class="org-constant">web-mode</span> @@ -2413,6 +2468,24 @@ Web-related stuff. </div> <p> +The <code>json-reformat</code> package provides functions for reformatting JSON strings. It +happens from time to time that I have to read JSON output from responses, and it +can be frustrating without proper formatting. +</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> <span class="org-constant">json-reformat</span> + <span class="org-builtin">:ensure</span> t<span class="org-rainbow-delimiters-depth-1">)</span> +</pre> +</div> +</div> +</div> + +<div id="outline-container-sec-15-9" class="outline-3"> +<h3 id="sec-15-9">Others</h3> +<div class="outline-text-3" id="text-15-9"> +<p> CMake for y'all. </p> @@ -2482,6 +2555,7 @@ criteria really). </div> </div> </div> +</div> <div id="outline-container-sec-16" class="outline-2"> <h2 id="sec-16">WoMan</h2> @@ -2591,7 +2665,7 @@ along with this program. If not, see <a href="http://www.gnu.org/licenses/">< </div> <div id="postamble" class="status"> <p class="author">Author: Miquel Sabaté Solà</p> -<p class="date">Created: 2017-02-07 Tue 17:02</p> +<p class="date">Created: 2017-02-08 Wed 17:48</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 79c332f..5632fa3 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -1579,6 +1579,8 @@ And now define a function to connect to both IRC servers. * Languages +** General + First of all, define a function that identifies some warning keywords (e.g. TODO). This function can then be applied to the proper mode. @@ -1601,6 +1603,8 @@ context too. In this case, I want spell check and =wc-mode= activated. (wc-mode 1))) #+END_SRC +** Lisp + Emacs lisp needs =rainbow-delimiters=, so the amount of parenthesis is less confusing. Moreover, I'm also enabling =eldoc-mode= and the aforementioned =warnings-mode-hook=. @@ -1615,6 +1619,8 @@ confusing. Moreover, I'm also enabling =eldoc-mode= and the aforementioned (setq mode-name "ξ"))) #+END_SRC +** C and C++ + C and C++ only require the =warnings-mode-hook= function, spell checking for the comments and the usage of tabs instead of spaces. @@ -1632,12 +1638,16 @@ comments and the usage of tabs instead of spaces. (lambda () (setq indent-tabs-mode t))) #+END_SRC +** Ruby + Include warning keywords in Ruby. #+BEGIN_SRC elisp (add-hook 'ruby-mode-hook 'warnings-mode-hook) #+END_SRC +** Go + And now my Go configuration. This includes stuff like the usage of =goimports=, =gofmt= on save, among many other useful things. @@ -1684,6 +1694,8 @@ And now my Go configuration. This includes stuff like the usage of =goimports=, (add-hook 'go-mode-hook 'mssola-go-mode)) #+END_SRC +** Tabs vs spaces + Tabs or spaces? [[https://www.emacswiki.org/emacs/TabsSpacesBoth][Both]]. The =smart-tabs-mode= has the philosophy of: tabs for indentation, spaces for alignment. This is only applied in languages where I'm usings tabs for indentation (C, C++ and Go). @@ -1698,7 +1710,7 @@ usings tabs for indentation (C, C++ and Go). (smart-tabs-insinuate 'c 'c++ 'golang)) #+END_SRC -Inferior markup languages. +** Inferior markup languages. #+BEGIN_SRC elisp ;; Markdown mode with preview mode in the browser. @@ -1726,7 +1738,9 @@ Inferior markup languages. (add-hook 'yaml-mode-hook 'warnings-mode-hook)) #+END_SRC -Web-related stuff. +** Web-related stuff. + +Slim and SCSS. #+BEGIN_SRC elisp (use-package slim-mode @@ -1738,7 +1752,12 @@ Web-related stuff. (setq scss-compile-at-save nil) (add-hook 'yaml-mode-hook 'warnings-mode-hook)) +#+END_SRC + +Languages specific for backend code like PHP, and =web-mode=, which provides a +bundle of features which are interesting for web-related stuff. +#+BEGIN_SRC elisp (use-package php-mode :ensure t) @@ -1757,6 +1776,17 @@ Web-related stuff. (setq web-mode-code-indent-offset 2)))) #+END_SRC +The =json-reformat= package provides functions for reformatting JSON strings. It +happens from time to time that I have to read JSON output from responses, and it +can be frustrating without proper formatting. + +#+BEGIN_SRC elisp +(use-package json-reformat + :ensure t) +#+END_SRC + +** Others + CMake for y'all. #+BEGIN_SRC elisp |
