From d8fa86e10c12a380d5a04883af7c87a070b22279 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 8 Feb 2017 17:48:50 +0100 Subject: emacs: added json-reformat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've also sorted a bit how things are in the programming language section. Signed-off-by: Miquel Sabaté Solà --- emacs/custom.el | 2 +- emacs/init.html | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++------ emacs/init.org | 34 +++++++++++++++++++-- 3 files changed, 116 insertions(+), 12 deletions(-) (limited to 'emacs') 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 @@ mssola's GNU Emacs configuration - + @@ -182,7 +182,19 @@ for the JavaScript code in this tag.
  • IRC
  • -
  • Languages
  • +
  • Languages + +
  • WoMan
  • Misc
  • Credits
  • @@ -2198,6 +2210,9 @@ 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. @@ -2227,7 +2242,12 @@ context too. In this case, I want spell check and wc-mode activated (wc-mode 1)))

    +
    +
    +
    +

    Lisp

    +

    Emacs lisp needs rainbow-delimiters, so the amount of parenthesis is less confusing. Moreover, I'm also enabling eldoc-mode and the aforementioned @@ -2245,7 +2265,12 @@ confusing. Moreover, I'm also enabling eldoc-mode and the aforement (setq mode-name "ξ")))

    +
    + +
    +

    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. @@ -2266,7 +2291,12 @@ comments and the usage of tabs instead of spaces. (lambda () (setq indent-tabs-mode t)))

    +
    + +
    +

    Ruby

    +

    Include warning keywords in Ruby.

    @@ -2276,7 +2306,12 @@ Include warning keywords in Ruby.
    (add-hook 'ruby-mode-hook 'warnings-mode-hook)
     
    +
    + +
    +

    Go

    +

    And now my Go configuration. This includes stuff like the usage of goimports, gofmt on save, among many other useful things. @@ -2326,7 +2361,12 @@ And now my Go configuration. This includes stuff like the usage of goimpor (add-hook 'go-mode-hook 'mssola-go-mode))

    +
    + +
    +

    Tabs vs spaces

    +

    Tabs or spaces? Both. The smart-tabs-mode 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). (smart-tabs-insinuate 'c 'c++ 'golang))

    +
    + -

    -Inferior markup languages. -

    - +
    +

    Inferior markup languages.

    +
    ;; Markdown mode with preview mode in the browser.
    @@ -2376,9 +2417,14 @@ Inferior markup languages.
       (add-hook 'yaml-mode-hook 'warnings-mode-hook))
     
    +
    +
    +
    +

    Web-related stuff.

    +

    -Web-related stuff. +Slim and SCSS.

    @@ -2392,8 +2438,17 @@ Web-related stuff. (setq scss-compile-at-save nil) (add-hook 'yaml-mode-hook 'warnings-mode-hook)) + +
    + +

    +Languages specific for backend code like PHP, and web-mode, which provides a +bundle of features which are interesting for web-related stuff. +

    -(use-package php-mode +
    + +
    (use-package php-mode
       :ensure t)
     
     (use-package web-mode
    @@ -2412,6 +2467,24 @@ Web-related stuff.
     
    +

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

    + +
    + +
    (use-package json-reformat
    +  :ensure t)
    +
    +
    +
    +
    + +
    +

    Others

    +

    CMake for y'all.

    @@ -2482,6 +2555,7 @@ criteria really).
    +

    WoMan

    @@ -2591,7 +2665,7 @@ along with this program. If not, see <
    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 -- cgit v1.2.3