blob: 8c843f20613f37069d76572e8efb2dfbc5331cf8 (
plain) (
blame)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
;;; init-base.el --- base configuration -*- lexical-binding: t -*-
;; Author: Franck Cuny <franck@fcuny.net>
;;; Commentary:
;; commentary
;;; Code:
(setq sentence-end-double-space nil ;; it matters for filling
create-lockfiles nil ;; don't use a lock file
tab-always-indent 'complete ;; when using TAB, always indent
initial-major-mode 'fundamental-mode ;; default mode for the scratch buffer
initial-scratch-message "" ;; makes the scratch buffer empty
confirm-kill-emacs #'yes-or-no-p ;; ask before killing emacs
use-short-answers t ;; use y-or-n
minibuffer-message-timeout 2 ;; how long to display an echo-area message
ring-bell-function 'ignore ;; really no bell
visible-bell nil ;; no bell
indent-tabs-mode nil ;; turn off tab indentation
delete-by-moving-to-trash t ;; delete files by moving them to the trash
user-full-name "Franck Cuny"
user-mail-address "franck@fcuny.net"
history-length 200 ;; increase history length
history-delete-duplicates t ;; delete duplicate from history
require-final-newline t ;; ensure a new line is present at the bottom of files
auto-save-default nil ;; no auto save
backup-inhibited t ;; no backups
custom-file (expand-file-name "lisp/custom.el" user-emacs-directory))
;; Use UTF-8 everywhere
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(use-package recentf
:custom
(recentf-max-saved-items 2000)
(recentf-max-menu-items 200)
(recentf-exclude
'("~\\'" "\\`out\\'" "\\.log\\'" "^/[^/]*:" "\\.el\\.gz\\'" "\\.gz\\'"))
:config
(recentf-mode t))
(use-package savehist
:ensure nil
:hook (after-init . savehist-mode)
:config
(setq savehist-file (locate-user-emacs-file "savehist"))
(setq history-length 100)
(setq history-delete-duplicates t)
(setq savehist-save-minibuffer-history t)
(savehist-mode t))
(use-package saveplace
:config
(save-place-mode t))
(use-package autorevert
:custom
(auto-revert-use-notify nil)
:config
(global-auto-revert-mode t))
(global-set-key (kbd "M-j") 'join-line)
(use-package which-key
:diminish
:ensure t
:hook (after-init . which-key-mode))
(use-package imenu
:config
(setq imenu-auto-rescan t))
(when (memq window-system '(mac ns))
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(add-to-list 'default-frame-alist '(ns-appearance . nil))
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . nil)))
(use-package exec-path-from-shell
:ensure t
:demand t
:if (memq window-system '(mac ns))
:config
(exec-path-from-shell-initialize)
:custom
(exec-path-from-shell-variables '("ASPELL_CONF")))
(use-package ibuffer
:defer t
:bind ("C-x C-b" . ibuffer)
:custom
(ibuffer-expert t)
(ibuffer-show-empty-filter-groups nil)
(ibuffer-jump-offer-only-visible-buffers t)
(ibuffer-maybe-show-predicates '("^\\*.*\\*$"))
(ibuffer-never-show-predicates '("^ "))
(ibuffer-use-other-window t))
(use-package midnight
:defer t
:custom
;; every 6 hours
(midnight-period (* 3600 6)))
(use-package dired
:ensure nil
:defer t
:hook (dired-mode . dired-omit-mode)
:bind (:map dired-mode-map
( "." . dired-omit-mode))
:custom
(dired-omit-files (rx (seq bol ".")))
(dired-use-ls-dired t)
(insert-directory-program "/etc/profiles/per-user/fcuny/bin/ls")
(dired-clean-up-buffers-too nil)
(dired-dwim-target t)
(dired-hide-details-hide-information-lines nil)
(dired-hide-details-hide-symlink-targets nil)
(dired-recursive-copies 'always)
(dired-recursive-deletes 'always)
(dired-no-confirm
'(byte-compile chgrp chmod chown copy hardlink symlink touch)))
(defun my/rename-this-buffer-and-file ()
"Renames current buffer and file it is visiting."
(interactive)
(let ((name (buffer-name))
(filename (buffer-file-name))
(read-file-name-function 'read-file-name-default))
(if (not (and filename (file-exists-p filename)))
(error "Buffer '%s' is not visiting a file!" name)
(let ((new-name (read-file-name "New name: " filename)))
(cond ((get-buffer new-name)
(error "A buffer named '%s' already exists!" new-name))
(t
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil)
(message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name))))))))
(provide 'init-base)
;;; init-base.el ends here
|