summary refs log tree commit diff stats
path: root/lisp/+emacs.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/+emacs.el')
-rw-r--r--lisp/+emacs.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index b69d1a0..9158b62 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el
@@ -316,8 +316,9 @@ ARG is passed to `backward-kill-word'."
316 316
317(defun +save-some-buffers-p () 317(defun +save-some-buffers-p ()
318 "Predicate for `save-some-buffers-default-predicate'. 318 "Predicate for `save-some-buffers-default-predicate'.
319It returns nil with remote files." 319It returns nil with remote files and those without attached files."
320 (not (file-remote-p (buffer-file-name)))) 320 (and (buffer-file-name)
321 (not (file-remote-p (buffer-file-name)))))
321 322
322;; https://www.wwwtech.de/articles/2013/may/emacs:-jump-to-matching-paren-beginning-of-block 323;; https://www.wwwtech.de/articles/2013/may/emacs:-jump-to-matching-paren-beginning-of-block
323(defun +goto-matching-paren (&optional arg) 324(defun +goto-matching-paren (&optional arg)
@@ -333,6 +334,14 @@ It returns nil with remote files."
333 ((looking-back "[\[\(\{]" 1) (backward-char) (forward-sexp arg)) 334 ((looking-back "[\[\(\{]" 1) (backward-char) (forward-sexp arg))
334 (t (up-list arg t t)))) 335 (t (up-list arg t t))))
335 336
337(defun +delete-window-or-bury-buffer ()
338 "Delete the current window, or bury the current buffer.
339If the current window is the only window, bury the buffer."
340 (interactive)
341 (condition-case e
342 (delete-window)
343 (t (bury-buffer))))
344
336 345
337;;; Bindings 346;;; Bindings
338 347
@@ -348,6 +357,7 @@ It returns nil with remote files."
348(global-set-key (kbd "C-x 4 n") #'clone-buffer) 357(global-set-key (kbd "C-x 4 n") #'clone-buffer)
349;; https://christiantietze.de/posts/2022/07/shift-click-in-emacs-to-select/ 358;; https://christiantietze.de/posts/2022/07/shift-click-in-emacs-to-select/
350(global-set-key (kbd "S-<down-mouse-1>") #'mouse-set-mark) 359(global-set-key (kbd "S-<down-mouse-1>") #'mouse-set-mark)
360(global-set-key (kbd "C-x 0") #'+delete-window-or-bury-buffer)
351 361
352 362
353;;; Required libraries 363;;; Required libraries