summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlendoit <blendoit@gmail.com>2021-01-25 19:53:12 -0800
committerBlendoit <blendoit@gmail.com>2021-01-25 19:53:12 -0800
commit6389bf9f6b5807d23d4f2181afec63393b4948c2 (patch)
treea02eeef5474ba0aca2a6c842000b3e646e92dd66
parentd28eee960e1472774e4893eb3d6cbaacba8adfc2 (diff)
Logic
-rw-r--r--smart-documents.org42
1 files changed, 28 insertions, 14 deletions
diff --git a/smart-documents.org b/smart-documents.org
index c989aad..06f896f 100644
--- a/smart-documents.org
+++ b/smart-documents.org
@@ -1,4 +1,5 @@
# -*- mode: org; -*-
+
#+TITLE: Smart Documents
#+AUTHOR: Marius Peter
#+DATE: <2020-12-19 Sat>
@@ -6,6 +7,7 @@
#+STARTUP: showall
#+SETUPFILE: ~/.emacs.d/templates/documents/gnu-default.org
#+INCLUDE: ~/.emacs.d/templates/documents/default-title.org
+
#+LATEX_HEADER_EXTRA: \newfontfamily\garamond{EB Garamond}
#+LATEX_HEADER_EXTRA: \newfontfamily\publicsans{Public Sans}
@@ -371,13 +373,7 @@ The following bindings lead to more natural window & frame exit behaviors.
#+NAME: close-window-or-previous-buffer
#+BEGIN_SRC emacs-lisp :tangle yes
- (global-set-key (kbd "C-w")
- (lambda ()
- "Delete window; if sole window, previous buffer."
- (interactive)
- (if (> (length (window-list)) 1)
- (delete-window)
- (previous-buffer))))
+ (global-set-key (kbd "C-w") 'sd-delete-window-or-previous-buffer)
#+END_SRC
** Frame
@@ -398,13 +394,8 @@ The following bindings lead to more natural window & frame exit behaviors.
#+NAME: delete-frame-or-kill-emacs
#+BEGIN_SRC emacs-lisp :tangle yes
- (global-set-key (kbd "C-q")
- (lambda ()
- (interactive)
- "delete frame; if sole frame, kill Emacs."
- (if (> (length (frame-list)) 1)
- (delete-frame)
- (kill-emacs))))
+(global-set-key (kbd "C-q") 'sd-delete-frame-or-kill-emacs)
+ (setq confirm-kill-emacs 'y-or-n-p)
#+END_SRC
*** Open sidebar
@@ -1359,6 +1350,29 @@ Binding defined in Section [[Indent buffer]].
(sd-indent-buffer)))
#+END_SRC
+** Smart window quitting
+
+#+BEGIN_SRC emacs-lisp :tangle yes
+ (defun sd-delete-window-or-previous-buffer ()
+ "Delete window; if sole window, previous buffer."
+ (interactive)
+ (if (> (length (window-list)) 1)
+ (delete-window)
+ (previous-buffer)))
+#+END_SRC
+
+** Smart frame quitting
+
+#+BEGIN_SRC emacs-lisp :tangle yes
+ (defun sd-delete-frame-or-kill-emacs ()
+ (interactive)
+ "delete frame; if sole frame, kill Emacs."
+ (if (> (length (frame-list)) 1)
+ (delete-frame)
+ (kill-emacs)))
+#+END_SRC
+
+
* Editing preferences
These customizations enhance editor usability. They also encompass
Copyright 2019--2024 Marius PETER