Compare commits
5 Commits
d74a5495c9
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d26e2dbce6 | |||
| 397704f046 | |||
| 413ad5305a | |||
| 519de17eaa | |||
| f6cdc61863 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -29,4 +29,5 @@ ido.*
|
||||
eln-cache
|
||||
straight/
|
||||
dark-mode
|
||||
org-persist/
|
||||
org-persist/
|
||||
*.frameg
|
||||
38
frameg.el
Normal file
38
frameg.el
Normal file
@@ -0,0 +1,38 @@
|
||||
;; https://www.reddit.com/r/emacs/comments/4ermj9/comment/d237n0i/?utm_source=share&utm_medium=web2x&context=3
|
||||
;; Custom functions/hooks for persisting/loading frame geometry upon save/load
|
||||
|
||||
(defun save-frameg ()
|
||||
"Gets the current frame's geometry and saves to ~/.emacs.frameg."
|
||||
(let ((frameg-font (frame-parameter (selected-frame) 'font))
|
||||
(frameg-left (frame-parameter (selected-frame) 'left))
|
||||
(frameg-top (frame-parameter (selected-frame) 'top))
|
||||
(frameg-width (frame-parameter (selected-frame) 'width))
|
||||
(frameg-height (frame-parameter (selected-frame) 'height))
|
||||
(frameg-file (expand-file-name ".emacs.frameg" user-emacs-directory)))
|
||||
(with-temp-buffer
|
||||
;; Turn off backup for this file
|
||||
(make-local-variable 'make-backup-files)
|
||||
(setq make-backup-files nil)
|
||||
(insert
|
||||
";;; This file stores the previous emacs frame's geometry.\n"
|
||||
";;; Last generated " (current-time-string) ".\n"
|
||||
"(setq initial-frame-alist\n"
|
||||
" '("
|
||||
(format " (top . %d)\n" (max frameg-top 0))
|
||||
(format " (left . %d)\n" (max frameg-left 0))
|
||||
(format " (width . %d)\n" (max frameg-width 0))
|
||||
(format " (height . %d)))\n" (max frameg-height 0)))
|
||||
(when (file-writable-p frameg-file)
|
||||
(write-file frameg-file)))))
|
||||
|
||||
(defun load-frameg ()
|
||||
"Loads ~/.emacs.frameg which should load the previous frame's geometry."
|
||||
(let ((frameg-file (expand-file-name ".emacs.frameg" user-emacs-directory)))
|
||||
(when (file-readable-p frameg-file)
|
||||
(load-file frameg-file))))
|
||||
|
||||
;; Special work to do ONLY when there is a window system being used
|
||||
(if window-system
|
||||
(progn
|
||||
(add-hook 'after-init-hook 'load-frameg)
|
||||
(add-hook 'kill-emacs-hook 'save-frameg)))
|
||||
38
init.el
38
init.el
@@ -47,22 +47,23 @@
|
||||
(delete-file dark-mode-file)
|
||||
(with-temp-buffer
|
||||
(write-file dark-mode-file)))
|
||||
(modus-themes-toggle))))
|
||||
|
||||
;; Default frame size
|
||||
(setq default-frame-alist
|
||||
(append (list '(width . 90) '(height . 45)
|
||||
'(vertical-scroll-bars . nil)
|
||||
'(internal-border-width . 5)))))
|
||||
(modus-themes-toggle)))))
|
||||
|
||||
;; Disable some UI elements
|
||||
(tool-bar-mode -1)
|
||||
(menu-bar-mode -1)
|
||||
(tooltip-mode -1)
|
||||
(fringe-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
|
||||
;; The minimap gives a much better scrolling experience
|
||||
(use-package minimap
|
||||
:straight t
|
||||
:config
|
||||
(minimap-mode)
|
||||
(setq minimap-window-location 'right)
|
||||
(setq minimap-width-fraction 0.10))
|
||||
|
||||
(scroll-bar-mode t)
|
||||
(set-window-scroll-bars (minibuffer-window) nil nil nil nil 1)
|
||||
|
||||
;; Font settings
|
||||
(set-face-attribute 'default nil :font "Iosevka Fixed SS05-12")
|
||||
@@ -83,6 +84,21 @@
|
||||
(setq auto-save-default nil)
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
(when (getenv "WAYLAND_DISPLAY")
|
||||
;; Without this, copy and pasting from other wayland apps into
|
||||
;; emacs-pgtk doesn't work.
|
||||
;; https://www.emacswiki.org/emacs/CopyAndPaste#h5o-4
|
||||
(setq wl-copy-process nil)
|
||||
(defun wl-copy (text)
|
||||
(setq wl-copy-process (make-process :name "wl-copy"
|
||||
:buffer nil
|
||||
:command '("wl-copy" "-f" "-n")
|
||||
:connection-type 'pipe
|
||||
:noquery t))
|
||||
(process-send-string wl-copy-process text)
|
||||
(process-send-eof wl-copy-process))
|
||||
(setq interprogram-cut-function 'wl-copy))
|
||||
|
||||
;; Dired settings
|
||||
(defun embark-open-externally (file)
|
||||
"Open FILE externally using the default application of the system."
|
||||
@@ -176,6 +192,7 @@
|
||||
(global-auto-revert-mode 1)
|
||||
|
||||
;; Keybindings
|
||||
(bind-key "M-<f4>" 'kill-emacs)
|
||||
(bind-key "C-x k" 'kill-buffer-with-prejudice)
|
||||
(bind-key "C-w" 'kill-buffer-with-prejudice)
|
||||
(bind-key "C-x C-k" 'kill-buffer-and-window)
|
||||
@@ -433,6 +450,9 @@
|
||||
(when (current-buffer-matches-file-p) (set-buffer-modified-p nil))
|
||||
(kill-buffer))
|
||||
|
||||
;; saving/restoring of the default frame
|
||||
(load "~/.emacs.d/frameg.el")
|
||||
|
||||
;; movies.org package
|
||||
(load "~/.emacs.d/org-movies.el" 'noerror)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user