-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpostfundamental-setting.el
75 lines (73 loc) · 2.83 KB
/
postfundamental-setting.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
73
74
75
;; -*- coding: utf-8 -*-
;; File: postfundamental-setting.el --- fundamental setting as the last step, for all emacs configurations
;;
;; Author: Denny(https://www.dennyzhang.com/contact)
;;
;; Copyright 2020, https://DennyZhang.com
;; Created:2008-10-01
;; Updated: Time-stamp: <2020-02-03 15:37:43>
;;
;; --8<-------------------------- separator ------------------------>8--
(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<down>") 'shrink-window)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)
;; --8<-------------------------- separator ------------------------>8--
;;diary
(global-set-key [f4] 'calendar)
(setq diary-file (concat CONF-EMACS-DATA "/filebat.diary"))
(display-time)
(require 'appt)
(add-hook 'diary-hook 'appt-make-list)
;;Generate the diary window for 2 days starting with the current date.
(diary)
;; --8<-------------------------- separator ------------------------>8--
(global-set-key "\M-." 'smart-locate)
(defun smart-locate ()
"Smart locate files.
- If current position is org-mode file, call occur-org-title,
which only search in titles of org-mode entires.
- If current position has no words, call my-find-name-dired, which is somewhat find-name-dired.
- Otherwise, call etags-select-find-tag.
"
(interactive)
(if (string-equal mode-name "Org")
(occur-org-title)
(let ((bounds (bounds-of-thing-at-point 'word)))
(if (null bounds)
(my-find-name-dired)
(etags-select-find-tag)
))
))
(defun my-find-name-dired ()
(interactive)
(let (pattern)
(setq pattern (read-shell-command "Find-name (filename wildcard): " nil nil))
(find-dired default-directory
(concat find-name-arg " " (shell-quote-argument pattern)))
))
(defun occur-org-title()
"when regexp search, only search title of org-mode entries"
(interactive)
(let (regexp)
(setq regexp
(read-string "Search org entries whose title matching regexp: " "^\\\*+ .*"))
(occur-1 regexp 0 (list (current-buffer)))))
;; --8<-------------------------- separator ------------------------>8--
;;(set-language-environment 'Chinese-GB)
;;(set-keyboard-coding-system 'chinese-iso-8bit-unix)
;; --8<-------------------------- separator ------------------------>8--
;; (set-buffer-file-coding-system 'utf-8)
;; (setq safe-local-variable-values
;; '(
;; (encoding . utf-8)
;; (encoding . utf-8-unix)
;; (encoding . utf-8-emacs-UNIX)
;; ))
;; --8<-------------------------- separator ------------------------>
;; (add-hook 'flyspell-prog-mode-hook
;; #'(lambda ()
;; (define-key flyspell-mode-map [(control ?\.)]
;; 'grep-find-with-querystring-quoted)))
;; --8<-------------------------- separator ------------------------>8--
;; File: postfundamental-setting.el ends here