summary refs log tree commit diff stats
path: root/lisp/+emacs.el
diff options
context:
space:
mode:
authorCase Duckworth2021-12-19 22:11:39 -0600
committerCase Duckworth2021-12-19 22:11:39 -0600
commitcf0ae4b20cb8375046266214ba918fb3cc8a2cc0 (patch)
tree1a5bd765f88ca4182e9caac8801b1b81d1841a0f /lisp/+emacs.el
parentRequire `+ace-window' (diff)
downloademacs-cf0ae4b20cb8375046266214ba918fb3cc8a2cc0.tar.gz
emacs-cf0ae4b20cb8375046266214ba918fb3cc8a2cc0.zip
Changes and shit
Diffstat (limited to 'lisp/+emacs.el')
-rw-r--r--lisp/+emacs.el31
1 files changed, 30 insertions, 1 deletions
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 15e23da..3fe243c 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el
@@ -120,7 +120,8 @@ Do this only if the buffer is not visiting a file."
120(when (version< emacs-version "28") 120(when (version< emacs-version "28")
121 (fset 'yes-or-no-p 'y-or-n-p)) 121 (fset 'yes-or-no-p 'y-or-n-p))
122 122
123;; Encoding -- UTF-8 everywhere 123;;; Encodings
124
124(setq-default locale-coding-system 'utf-8-unix 125(setq-default locale-coding-system 'utf-8-unix
125 coding-system-for-read 'utf-8-unix 126 coding-system-for-read 'utf-8-unix
126 coding-system-for-write 'utf-8-unix 127 coding-system-for-write 'utf-8-unix
@@ -174,8 +175,36 @@ Do this only if the buffer is not visiting a file."
174(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) 175(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
175(add-hook 'minibuffer-setup-hook 'cursor-intangible-mode) 176(add-hook 'minibuffer-setup-hook 'cursor-intangible-mode)
176 177
178;;; Better-default functions
179
180(defun +cycle-spacing (&optional n preserve-nl-back mode)
181 "Negate N argument on `cycle-spacing'.
182That is, with a positive N, deletes newlines as well, leaving -N
183spaces. If N is negative, it will not delete newlines and leave
184N spaces. See docstring of `cycle-spacing' for the meaning of
185PRESERVE-NL-BACK and MODE."
186 (interactive "*p")
187 (cycle-spacing (- n) preserve-nl-back mode))
188
189(defun +save-buffers-quit (&optional arg)
190 "Silently save each buffer, then kill the current connection.
191If the current frame has no client, kill Emacs itself using
192`save-buffers-kill-emacs' after confirming with the user.
193
194With prefix ARG, silently save all file-visiting buffers, then
195kill without asking."
196 (interactive "P")
197 (save-some-buffers t)
198 (if (and (not (frame-parameter nil 'client))
199 (and (not arg)))
200 (when (yes-or-no-p "Sure you want to quit? ")
201 (save-buffers-kill-emacs))
202 (server-save-buffers-kill-terminal nil)))
203
177;;; Bindings 204;;; Bindings
178 205
206(global-set-key (kbd "C-x C-c") '+save-buffers-quit)
207(global-set-key (kbd "M-SPC") '+cycle-spacing)
179(global-set-key (kbd "M-/") 'hippie-expand) 208(global-set-key (kbd "M-/") 'hippie-expand)
180(global-set-key (kbd "M-=") 'count-words) 209(global-set-key (kbd "M-=") 'count-words)
181(global-set-key (kbd "C-x C-b") 'ibuffer) 210(global-set-key (kbd "C-x C-b") 'ibuffer)