-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathemacsd-prog-module.el
72 lines (57 loc) · 2.67 KB
/
emacsd-prog-module.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
;;; emacsd-prog-module.el --- Emacs.d modules.
;;
;; Author: Sliim <[email protected]>
;; Version: 1.0.0
;; Keywords: emacs.d modules
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Personal Emacs.d Prog module
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'multiple-cursors)
(require 'restclient)
(require 'flycheck)
(require 'smartparens-config)
(defun emacsd-json-pretty-format ()
"Print json string into an human readable format.
This function run external shell command `python -m json.tool` on current region."
(interactive)
(shell-command-on-region (region-beginning) (region-end) "python -m json.tool"))
(defun emacsd-nxml-pretty-format()
"Pretty print XML format. Requires xmllint in your path."
(interactive)
(save-excursion
(shell-command-on-region (region-beginning) (region-end) "xmllint --format -" (buffer-name) t)
(nxml-mode)
(indent-region (region-beginning) (region-end))))
(add-to-list 'auto-mode-alist '("\\.zsh\\'" . shell-script-mode))
(add-to-list 'auto-mode-alist '("Cask" . emacs-lisp-mode))
(add-to-list 'auto-mode-alist '("\\.rasi\\'" . css-mode))
(add-hook 'prog-mode-hook (lambda ()
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(when (and (require 'auto-complete nil t) (require 'auto-complete-config nil t))
(make-local-variable 'ac-sources)
(setq ac-sources '(ac-source-words-in-same-mode-buffers
ac-source-dictionary))
(when (and (require 'auto-complete-etags nil t) tags-table-list)
(add-to-list 'ac-sources 'ac-source-etags))
(auto-complete-mode t))))
(setq flycheck-emacs-lisp-load-path 'inherit)
(add-hook 'prog-mode-hook #'smartparens-mode)
(add-hook 'prog-mode-hook 'show-paren-mode)
(provide 'emacsd-prog-module)
;;; emacsd-prog-module.el ends here