1 ;;; eh-misc.el --- Tumashu's emacs configuation -*- lexical-binding: t; -*-
4 ;; Copyright (c) 2011-2019, Feng Shu
6 ;; Author: Feng Shu <tumashu@163.com>
7 ;; URL: https://github.com/tumashu/emacs-helper
10 ;; This file is not part of GNU Emacs.
14 ;; This program is free software; you can redistribute it and/or
15 ;; modify it under the terms of the GNU General Public License
16 ;; as published by the Free Software Foundation; either version 3
17 ;; of the License, or (at your option) any later version.
19 ;; This program is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27 ;; Boston, MA 02110-1301, USA.
32 ;; 这个文件是tumashu个人专用的emacs配置文件,emacs中文用户可以参考。
42 (defun eh-eat--set-cmd (cmd)
43 (when (cl-some (lambda (x)
44 (string-search x cmd
))
45 '("htop" "nmtui" "mutt" "aptitude"))
47 ;; 0. black 1. red 2. green 3. yellow
48 ;; 4. blue 5. magenta 6. cyan 7. white
49 (dolist (x '((1 .
124)
51 (eh-eat--change-color (car x
) (cdr x
)))))
53 (defun eh-eat--change-color (old-color-number new-color-number
)
54 (let ((old-face (intern (format "color-%s-face" old-color-number
)))
55 (new-face (intern (format "eat-term-color-%s" new-color-number
))))
56 (setf (eat-term-parameter eat-terminal old-face
) new-face
)))
58 (defun eh-eat--eshell-adjust-make-process-args (_ command _args
)
60 (eh-eat--set-cmd nil command
)))
62 (defun eh-eat--set-cmd-status (&rest _
)
64 (eh-eat--change-color i i
)))
66 (advice-add 'eat--set-cmd
:after
#'eh-eat--set-cmd
)
67 (advice-add 'eat--set-cmd-status
:after
#'eh-eat--set-cmd-status
)
68 (advice-add 'eat--eshell-adjust-make-process-args
:after
#'eh-eat--eshell-adjust-make-process-args
)
72 (global-set-key (kbd "C-x F") 'projectile-find-file
)
73 (global-set-key (kbd "C-S-s") 'projectile-grep
)
74 (setq projectile-enable-caching nil
)
79 (setq tempel-path
(list (format "%s/*" (expand-file-name "tempel" (eh-directory)))))
80 (global-set-key (kbd "<f4>") 'tempel-insert
)
81 (define-key tempel-map
(kbd "<tab>") #'tempel-next
)
82 (define-key tempel-map
(kbd "C-<tab>") #'tempel-previous
)
83 (add-hook 'write-file-functions
#'tempel-done
)
88 (defvar eh-org-syncthing-dir
"~/syncthing")
89 (defun eh-org-open-syncthing-dir ()
91 (let ((dir (file-name-as-directory
92 (expand-file-name eh-org-syncthing-dir
))))
93 (when (file-directory-p dir
)
94 (if (or (derived-mode-p 'org-mode
)
95 (derived-mode-p 'org-agenda-mode
))
96 (eh-org-attach-reveal)
97 (eh-system-open dir
)))))
99 (global-set-key (kbd "<f1>") 'eh-org-open-syncthing-dir
)
103 (setq-default line-spacing
2)
104 (setq cnfonts-use-face-font-rescale
105 (eq system-type
'gnu
/linux
))
106 (setq cnfonts-personal-fontnames
107 '(("PragmataPro Mono")))
109 (define-key cnfonts-mode-map
(kbd "C--") 'cnfonts-decrease-fontsize
)
110 (define-key cnfonts-mode-map
(kbd "C-=") 'cnfonts-increase-fontsize
)
117 ;; 1. Put the below to your ~/.gnupg/gpg-agent.conf:
118 ;; allow-emacs-pinentry
119 ;; allow-loopback-pinentry
120 ;; 2. gpgconf --reload gpg-agent
121 ;; 3. (setq epa-pinentry-mode 'loopback)
122 ;; 4. (pinentry-start)
123 (setq epg-pinentry-mode
'loopback
)
128 ;; ** aggressive-indent
129 (require 'aggressive-indent
)
131 (defun eh-elisp-setup ()
133 (setq show-trailing-whitespace t
)
135 (aggressive-indent-mode))
137 (add-hook 'emacs-lisp-mode-hook
142 (global-set-key (kbd "C-c g") 'magit-status
)
143 (define-key magit-status-mode-map
(kbd "C-c f") 'magit-format-patch
)
152 ;; coding: utf-8-unix
155 ;;; eh-misc.el ends here