Update emacs.org

This commit is contained in:
Sakooooo 2023-11-25 17:51:31 +04:00 committed by GitHub
parent ff8dc9f345
commit 3d018247b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,18 +43,22 @@ Should make startup faster, taken from doom-emacs
#+end_src #+end_src
* UI * UI
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; UI/UX ;; UI/UX
(setq inhibit-splash-screen t) (setq inhibit-splash-screen t)
;; make it look like neovim a little ;; remove useless GUI elements
(scroll-bar-mode -1) (scroll-bar-mode -1)
(tool-bar-mode -1) (tool-bar-mode -1)
(tooltip-mode -1) (tooltip-mode -1)
(set-fringe-mode 10) (set-fringe-mode 10)
(menu-bar-mode -1) (menu-bar-mode -1)
;; Line Numbers ;; Line Numbers
(column-number-mode) (column-number-mode)
;; Bell ;; Bell
(setq visible-bell t) (setq visible-bell t)
;; prefer y/n
(fset 'yes-or-no-p 'y-or-n-p)
;; Stop Emacs from trying to use dialog boxes.
(setq use-dialog-box nil)
#+end_src #+end_src
* Line Numbers * Line Numbers
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -78,49 +82,49 @@ Should make startup faster, taken from doom-emacs
#+end_src #+end_src
* Use-Package setup * Use-Package setup
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require `package) (message "setting up use-package")
(require `package)
(setq package-archives `(("mepla" . "https://melpa.org/packages/") (setq package-archives `(("mepla" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/") ("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/"))) ("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize) (package-initialize)
(unless package-archive-contents (unless package-archive-contents
(package-refresh-contents)) (package-refresh-contents))
;; Init package for non-linux ;; Init package for non-linux
(unless (package-installed-p `use-package) (unless (package-installed-p `use-package)
(package-install `use-package)) (package-install `use-package))
(require 'use-package) (require 'use-package)
(setq use-package-always-ensure t) (setq use-package-always-ensure t)
#+end_src #+end_src
* Straight.el setup * Straight.el setup
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defvar bootstrap-version) (message "setting up straight.el")
(let ((bootstrap-file (defvar bootstrap-version)
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (let ((bootstrap-file
(bootstrap-version 6)) (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(unless (file-exists-p bootstrap-file) (bootstrap-version 6))
(with-current-buffer (unless (file-exists-p bootstrap-file)
(url-retrieve-synchronously (with-current-buffer
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" (url-retrieve-synchronously
'silent 'inhibit-cookies) "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
(goto-char (point-max)) 'silent 'inhibit-cookies)
(eval-print-last-sexp))) (goto-char (point-max))
(load bootstrap-file nil 'nomessage)) (eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
#+end_src #+end_src
* SPEED SPEED SPEED SPEED * SPEED SPEED SPEED SPEED
Most of these are taken from Doom-Emacs!
https://github.com/doomemacs/doomemacs/blob/develop/docs/faq.org#how-does-doom-start-up-so-quickly
Theres also Centaur Emacs
https://github.com/seagle0128/.emacs.d
** Avoid Garbage Collection at startup ** Avoid Garbage Collection at startup
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package gcmh (use-package gcmh
:init :init
(gcmh-mode 1)) (setq gcmh-idle-delay 5)
(add-hook 'emacs-startup-hook (gcmh-mode 1)) (setq gcmh-high-cons-threshold (* 16 1024 1024))
:config
(gcmh-mode))
#+end_src #+end_src
** Move Garbage collection further back ** Move Garbage collection further back
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -136,8 +140,32 @@ https://github.com/seagle0128/.emacs.d
(lambda () (lambda ()
(setq file-name-handler-alist sakomacs--file-name-handler-alist))) (setq file-name-handler-alist sakomacs--file-name-handler-alist)))
#+end_src #+end_src
** Go back to normal GC after init
#+begin_src emacs-lisp
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold 16777216 ; 16mb
gc-cons-percentage 0.1)))
#+end_src
** Don't use GC when minibuffer is used
#+begin_src emacs-lisp
(defun doom-defer-garbage-collection-h ()
"Disable garbage collection."
(setq gc-cons-threshold most-positive-fixnum))
(defun doom-restore-garbage-collection-h ()
"Restore garbage collection."
(run-at-time
1 nil (lambda () (setq gc-cons-threshold 16777216))))
(add-hook 'minibuffer-setup-hook #'doom-defer-garbage-collection-h)
(add-hook 'minibuffer-exit-hook #'doom-restore-garbage-collection-h)
#+end_src
* Packages * Packages
** Log state
#+begin_src emacs-lisp
(message "setting up packages")
#+end_src
** Command Log Mode ** Command Log Mode
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package command-log-mode (use-package command-log-mode
@ -1092,6 +1120,10 @@ only god knows why im doing this
:straight t :straight t
) )
#+end_src #+end_src
** System Packages
#+begin_src emacs-lisp
(use-package system-packages)
#+end_src
* Org Mode Configuration Setup * Org Mode Configuration Setup
** Babel Languages ** Babel Languages
#+begin_src emacs-lisp #+begin_src emacs-lisp