summaryrefslogtreecommitdiff
path: root/lisp/init-general.el
blob: 7b2f95ccabf85f730dd5357db21623595fbb9e07 (plain)
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

(setq echo-keystrokes 0.1
      use-dialog-box nil
      visible-bell t
      enable-recursive-minibuffers t)

(setq tramp-default-method "ssh")

(setq-default indicate-empty-lines t
              indent-tabs-mode nil)

(setq set-mark-command-repeat-pop t)

;; This is intentionally not loaded.
(setq custom-file "~/.emacs.d/.custom.el")

(setq save-abbrevs 'silently)

(setq bookmark-save-flag 1)

(defalias 'yes-or-no-p 'y-or-n-p)

(put 'narrow-to-region 'disabled nil)
(put 'narrow-to-page 'disabled nil)
(put 'set-goal-column 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)

(add-hook 'after-save-hook
          'executable-make-buffer-file-executable-if-script-p)

(defun km/imenu (rescan)
  "Call `imenu', rescanning if RESCAN is non-nil."
  (interactive "P")
  (when (and rescan
             ;; No need to rescan if imenu hasn't been autoloaded yet.
             (fboundp 'imenu--cleanup))
    ;; Taken from `imenu-choose-buffer-index'.
    (imenu--cleanup)
    (setq imenu--index-alist nil))
  (call-interactively #'helm-imenu))

;; Taken from
;; http://milkbox.net/note/single-file-master-emacs-configuration/.
(defmacro after (mode &rest body)
  "`eval-after-load' MODE evaluate BODY."
  (declare (indent defun))
  `(eval-after-load ,mode
     '(progn ,@body)))

(global-set-key (kbd "C-h ;") 'find-function)
(global-set-key (kbd "C-h 4 ;") 'find-function-other-window)


(global-set-key (kbd "C-c l") 'km/imenu)

;; Disable `suspend-frame' binding.
(global-set-key (kbd "C-x C-z") nil)

;; Avoid shift key for `backward-paragraph' and `forward-paragraph'.
(global-set-key (kbd "M-}") nil)
(global-set-key (kbd "M-]") 'forward-paragraph)
(global-set-key (kbd "M-{") nil)
(global-set-key (kbd "M-[") 'backward-paragraph)

(define-key occur-mode-map "n" 'next-line)
(define-key occur-mode-map "p" 'previous-line)

(show-paren-mode)
(global-auto-revert-mode)
(transient-mark-mode -1)
(key-chord-mode 1)

(provide 'init-general)