Compare commits
5 Commits
d74a5495c9
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d26e2dbce6 | |||
| 397704f046 | |||
| 413ad5305a | |||
| 519de17eaa | |||
| f6cdc61863 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,3 +30,4 @@ eln-cache
|
|||||||
straight/
|
straight/
|
||||||
dark-mode
|
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)
|
(delete-file dark-mode-file)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(write-file dark-mode-file)))
|
(write-file dark-mode-file)))
|
||||||
(modus-themes-toggle))))
|
(modus-themes-toggle)))))
|
||||||
|
|
||||||
;; Default frame size
|
|
||||||
(setq default-frame-alist
|
|
||||||
(append (list '(width . 90) '(height . 45)
|
|
||||||
'(vertical-scroll-bars . nil)
|
|
||||||
'(internal-border-width . 5)))))
|
|
||||||
|
|
||||||
;; Disable some UI elements
|
;; Disable some UI elements
|
||||||
(tool-bar-mode -1)
|
(tool-bar-mode -1)
|
||||||
(menu-bar-mode -1)
|
(menu-bar-mode -1)
|
||||||
(tooltip-mode -1)
|
(tooltip-mode -1)
|
||||||
(fringe-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
|
;; Font settings
|
||||||
(set-face-attribute 'default nil :font "Iosevka Fixed SS05-12")
|
(set-face-attribute 'default nil :font "Iosevka Fixed SS05-12")
|
||||||
@@ -83,6 +84,21 @@
|
|||||||
(setq auto-save-default nil)
|
(setq auto-save-default nil)
|
||||||
(setq create-lockfiles 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
|
;; Dired settings
|
||||||
(defun embark-open-externally (file)
|
(defun embark-open-externally (file)
|
||||||
"Open FILE externally using the default application of the system."
|
"Open FILE externally using the default application of the system."
|
||||||
@@ -176,6 +192,7 @@
|
|||||||
(global-auto-revert-mode 1)
|
(global-auto-revert-mode 1)
|
||||||
|
|
||||||
;; Keybindings
|
;; Keybindings
|
||||||
|
(bind-key "M-<f4>" 'kill-emacs)
|
||||||
(bind-key "C-x k" 'kill-buffer-with-prejudice)
|
(bind-key "C-x k" 'kill-buffer-with-prejudice)
|
||||||
(bind-key "C-w" 'kill-buffer-with-prejudice)
|
(bind-key "C-w" 'kill-buffer-with-prejudice)
|
||||||
(bind-key "C-x C-k" 'kill-buffer-and-window)
|
(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))
|
(when (current-buffer-matches-file-p) (set-buffer-modified-p nil))
|
||||||
(kill-buffer))
|
(kill-buffer))
|
||||||
|
|
||||||
|
;; saving/restoring of the default frame
|
||||||
|
(load "~/.emacs.d/frameg.el")
|
||||||
|
|
||||||
;; movies.org package
|
;; movies.org package
|
||||||
(load "~/.emacs.d/org-movies.el" 'noerror)
|
(load "~/.emacs.d/org-movies.el" 'noerror)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user