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
)
78 (require 'citre-config
)
79 (global-set-key (kbd "C-x c j") 'citre-jump
)
80 (global-set-key (kbd "C-x c J") 'citre-jump-back
)
81 (global-set-key (kbd "C-x c p") 'citre-ace-peek
)
82 (global-set-key (kbd "C-x c u") 'citre-update-this-tags-file
)
83 (setq citre-project-root-function
#'projectile-project-root
84 citre-default-create-tags-file-location
'global-cache
85 citre-use-project-root-when-creating-tags t
86 citre-prompt-language-for-ctags-command t
87 citre-auto-enable-citre-mode-modes
'(prog-mode))
91 (setq tempel-path
(list (format "%s/*" (expand-file-name "tempel" (eh-directory)))))
92 (global-set-key (kbd "<f4>") 'tempel-insert
)
93 (define-key tempel-map
(kbd "<tab>") #'tempel-next
)
94 (define-key tempel-map
(kbd "C-<tab>") #'tempel-previous
)
95 (add-hook 'write-file-functions
#'tempel-done
)
98 (defvar eh-org-syncthing-dir
"~/syncthing")
99 (defun eh-org-open-syncthing-dir ()
101 (let ((dir (file-name-as-directory
102 (expand-file-name eh-org-syncthing-dir
))))
103 (when (file-directory-p dir
)
104 (if (or (derived-mode-p 'org-mode
)
105 (derived-mode-p 'org-agenda-mode
))
106 (eh-org-attach-reveal)
107 (eh-system-open dir
)))))
109 (global-set-key (kbd "<f1>") 'eh-org-open-syncthing-dir
)
113 (setq-default line-spacing
2)
114 (setq cnfonts-use-face-font-rescale
115 (eq system-type
'gnu
/linux
))
117 (define-key cnfonts-mode-map
(kbd "C--") 'cnfonts-decrease-fontsize
)
118 (define-key cnfonts-mode-map
(kbd "C-=") 'cnfonts-increase-fontsize
)
125 ;; 1. Put the below to your ~/.gnupg/gpg-agent.conf:
126 ;; allow-emacs-pinentry
127 ;; allow-loopback-pinentry
128 ;; 2. gpgconf --reload gpg-agent
129 ;; 3. (setq epa-pinentry-mode 'loopback)
130 ;; 4. (pinentry-start)
131 (setq epg-pinentry-mode
'loopback
)
136 ;; ** aggressive-indent
137 (require 'aggressive-indent
)
139 (defun eh-elisp-setup ()
141 (setq show-trailing-whitespace t
)
143 (setq highlight-tabs t
)
145 (aggressive-indent-mode))
147 (add-hook 'emacs-lisp-mode-hook
152 (global-set-key (kbd "C-c g") 'magit-status
)
153 (define-key magit-status-mode-map
(kbd "C-c f") 'magit-format-patch
)
162 ;; coding: utf-8-unix
165 ;;; eh-misc.el ends here