Skip to content

Commit

Permalink
[emacs] Update configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
fifthdrew committed Nov 2, 2024
1 parent 922db02 commit 72c8282
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 107 deletions.
58 changes: 55 additions & 3 deletions emacs/.emacs.d/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@

;; Set font family and size
(cond
((find-font (font-spec :name "MPLUS1Code"))
(set-frame-font "MPLUS1Code 8" nil t)))
((find-font (font-spec :name "MPLUS1Code"))
(set-face-attribute 'default nil :font "MPLUS1Code 8")
(set-face-attribute 'fixed-pitch nil :font "MPLUS1Code 8")))
(cond
((find-font (font-spec :name "MPLUS1"))
(set-face-attribute 'variable-pitch nil :font "MPLUS1 8")))

;; Enable y/n answers
(fset 'yes-or-no-p 'y-or-n-p)
Expand Down Expand Up @@ -64,7 +68,7 @@
(setq mode-line-percent-position nil)

;; Show line numbers by default
;(setq-default display-line-numbers 'relative)
;(setq-default display-line-numbers 'relative)

;; Set frame title, to show file or buffer name
;; SOURCE: https://github.com/bbatsov/emacs.d/blob/master/init.el
Expand Down Expand Up @@ -145,6 +149,52 @@

;(ido-mode 1)

;; Org Mode
(custom-set-faces
'(org-code ((t (:inherit (shadow fixed-pitch)))))
'(org-block ((t (:inherit fixed-pitch))))
'(org-table ((t (:inherit fixed-pitch))))
'(org-verbatim ((t (:inherit (shadow fixed-pitch)))))
'(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))
'(org-indent ((t (:inherit (org-hide fixed-pitch)))))
'(org-link ((t (:underline t))))
'(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch)))))
'(org-property-value ((t (:inherit fixed-pitch))))
'(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
'(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8))))
'(org-table-number ((t (:inherit fixed-pitch))))
'(org-table-cell-field ((t (:inherit fixed-pitch))))
'(org-table-header-1 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-2 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-3 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-4 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-5 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-6 ((t (:inherit fixed-pitch :bold t))))
'(org-table-row ((t (:inherit fixed-pitch))))
'(org-table-cell ((t (:inherit fixed-pitch))))
'(org-table-hline ((t (:inherit fixed-pitch))))
'(org-table-hline-1 ((t (:inherit fixed-pitch))))
'(org-table-hline-2 ((t (:inherit fixed-pitch))))
'(org-table-hline-3 ((t (:inherit fixed-pitch))))
'(org-table-hline-4 ((t (:inherit fixed-pitch))))
'(org-table-hline-5 ((t (:inherit fixed-pitch))))
'(org-table-hline-6 ((t (:inherit fixed-pitch))))
'(org-table-first-column ((t (:inherit fixed-pitch))))
'(org-table-current-cell-highlight ((t (:inherit fixed-pitch))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background)))))


(add-hook 'org-mode-hook 'turn-on-text-scale-mode)

(add-hook 'org-mode-hook 'variable-pitch-mode)

;; make the fringe stand out from the background
;;(setq solarized-distinct-fringe-background t)

Expand Down Expand Up @@ -235,6 +285,8 @@
(use-package rainbow-delimiters
:hook ((emacs-lisp-mode lisp-mode racket-mode) . rainbow-delimiters-mode))

(use-package mixed-pitch)

(defun toggle-top-menu ()
"Run toggle-menu-bar-mode-from-frame and toggle-tool-bar-mode-from-frame"
(interactive)
Expand Down
260 changes: 156 additions & 104 deletions emacs/.emacs.d/config.org
Original file line number Diff line number Diff line change
Expand Up @@ -28,142 +28,192 @@

#+begin_src emacs-lisp

;; Set font family and size
(cond
((find-font (font-spec :name "MPLUS1Code"))
(set-frame-font "MPLUS1Code 8" nil t)))
;; Set font family and size
(cond
((find-font (font-spec :name "MPLUS1Code"))
(set-face-attribute 'default nil :font "MPLUS1Code 8")
(set-face-attribute 'fixed-pitch nil :font "MPLUS1Code 8")))
(cond
((find-font (font-spec :name "MPLUS1"))
(set-face-attribute 'variable-pitch nil :font "MPLUS1 8")))

;; Enable y/n answers
(fset 'yes-or-no-p 'y-or-n-p)

;; Set path to themes directory
(add-to-list 'custom-theme-load-path my/themes-directory)
;; Enable y/n answers
(fset 'yes-or-no-p 'y-or-n-p)

;; Set fullscreen frame automatically
(add-to-list 'initial-frame-alist '(fullscreen . maximized))
;; Set path to themes directory
(add-to-list 'custom-theme-load-path my/themes-directory)

;; Keep emacs Custom-settings in separate file.
(when (not (file-exists-p my/custom-file))
(write-region "" nil my/custom-file))
(load my/custom-file)
;; Set fullscreen frame automatically
(add-to-list 'initial-frame-alist '(fullscreen . maximized))

;; Set Encoding
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; Keep emacs Custom-settings in separate file.
(when (not (file-exists-p my/custom-file))
(write-region "" nil my/custom-file))
(load my/custom-file)

;; No wrap lines
(set-default 'truncate-lines t)
;; Set Encoding
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)

;; Remove scroll bars
(set-window-scroll-bars (minibuffer-window) nil nil)
;; No wrap lines
(set-default 'truncate-lines t)

;; Set better scrolling
;; SOURCE: https://github.com/bbatsov/emacs.d/blob/master/init.el
(setq scroll-margin 0
scroll-conservatively 100000
scroll-preserve-screen-position 1)
;; Remove scroll bars
(set-window-scroll-bars (minibuffer-window) nil nil)

;; Disable startup screen
(setq inhibit-startup-screen t)
;; Set better scrolling
;; SOURCE: https://github.com/bbatsov/emacs.d/blob/master/init.el
(setq scroll-margin 0
scroll-conservatively 100000
scroll-preserve-screen-position 1)

;; Disable scratch message
(setq initial-scratch-message nil)
;; Disable startup screen
(setq inhibit-startup-screen t)

;; Disable alarms
(setq ring-bell-function 'ignore)
;; Disable scratch message
(setq initial-scratch-message nil)

;; No percentage (and no "All"/"Top"/"Bot"):
(setq mode-line-percent-position nil)
;; Disable alarms
(setq ring-bell-function 'ignore)

;; Show line numbers by default
;(setq-default display-line-numbers 'relative)
;; No percentage (and no "All"/"Top"/"Bot"):
(setq mode-line-percent-position nil)

;; Set frame title, to show file or buffer name
;; SOURCE: https://github.com/bbatsov/emacs.d/blob/master/init.el
(setq frame-title-format
'((:eval (if (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
"%b"))))
;; Show line numbers by default
;(setq-default display-line-numbers 'relative)

;; Don't use tabs to indent
(setq-default indent-tabs-mode nil)
;; Set frame title, to show file or buffer name
;; SOURCE: https://github.com/bbatsov/emacs.d/blob/master/init.el
(setq frame-title-format
'((:eval (if (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
"%b"))))

;; Default identation width
(setq-default tab-width 4)
;; Don't use tabs to indent
(setq-default indent-tabs-mode nil)

;; Tab first tries to indent the current line, and if the line was already
;; indented, then try to complete the thing at point.
(setq tab-always-indent 'complete)
;; Default identation width
(setq-default tab-width 4)

;; Force packages relying on this general indentation variable (e.g., lsp-mode)
;; to indent with 4 spaces.
(setq-default standard-indent 4)
;; Tab first tries to indent the current line, and if the line was already
;; indented, then try to complete the thing at point.
(setq tab-always-indent 'complete)

;; Newline at end of file
(setq require-final-newline t)
;; Force packages relying on this general indentation variable (e.g., lsp-mode)
;; to indent with 4 spaces.
(setq-default standard-indent 4)

;; Make cursor movement faster
;; SOURCE: https://emacs.stackexchange.com/questions/28736/emacs-pointcursor-movement-lag/28746
(setq auto-window-vscroll nil)
;; Newline at end of file
(setq require-final-newline t)

;; Store backup files in the tmp directory
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
;; Make cursor movement faster
;; SOURCE: https://emacs.stackexchange.com/questions/28736/emacs-pointcursor-movement-lag/28746
(setq auto-window-vscroll nil)

;; Store autosave files in the tmp directory
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; Store backup files in the tmp directory
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))

;; Don't write lock-files
(setq create-lockfiles nil)
;; Store autosave files in the tmp directory
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))

;; Move files to trash when deleting
(setq delete-by-moving-to-trash t)
;; Don't write lock-files
(setq create-lockfiles nil)

;; Show matching parens
(setq show-paren-delay 0)
;; Move files to trash when deleting
(setq delete-by-moving-to-trash t)

;; Show matching parens
(setq show-paren-delay 0)

#+end_src

* Default Modes

#+begin_src emacs-lisp

;; Set scrolling mode
;; SOURCE: https://github.com/bbatsov/emacs.d/blob/master/init.el
(when (fboundp 'pixel-scroll-precision-mode)
(pixel-scroll-precision-mode t))

;; Remove unnecessary ui modes
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tooltip-mode) (tooltip-mode -1))

;; Mode line settings
(line-number-mode t)
(column-number-mode t)
;(size-indication-mode t)

;; Auto-close brackets and double quotes
(electric-pair-mode 1)

;; Revert buffers automatically when underlying files are changed externally
(global-auto-revert-mode t)
;; Set scrolling mode
;; SOURCE: https://github.com/bbatsov/emacs.d/blob/master/init.el
(when (fboundp 'pixel-scroll-precision-mode)
(pixel-scroll-precision-mode t))

;; Remove unnecessary ui modes
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tooltip-mode) (tooltip-mode -1))

;; Mode line settings
(line-number-mode t)
(column-number-mode t)
;(size-indication-mode t)

;; Auto-close brackets and double quotes
(electric-pair-mode 1)

;; Revert buffers automatically when underlying files are changed externally
(global-auto-revert-mode t)

;; Disable blinking cursor
(blink-cursor-mode -1)

;; Swap terms like 'lambda' for their corresponding symbol
(global-prettify-symbols-mode t)

(show-paren-mode 1)

(fringe-mode 0)

;(ido-mode 1)

;; Org Mode
(custom-set-faces
'(org-code ((t (:inherit (shadow fixed-pitch)))))
'(org-block ((t (:inherit fixed-pitch))))
'(org-table ((t (:inherit fixed-pitch))))
'(org-verbatim ((t (:inherit (shadow fixed-pitch)))))
'(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))
'(org-indent ((t (:inherit (org-hide fixed-pitch)))))
'(org-link ((t (:underline t))))
'(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch)))))
'(org-property-value ((t (:inherit fixed-pitch))))
'(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
'(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8))))
'(org-table-number ((t (:inherit fixed-pitch))))
'(org-table-cell-field ((t (:inherit fixed-pitch))))
'(org-table-header-1 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-2 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-3 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-4 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-5 ((t (:inherit fixed-pitch :bold t))))
'(org-table-header-6 ((t (:inherit fixed-pitch :bold t))))
'(org-table-row ((t (:inherit fixed-pitch))))
'(org-table-cell ((t (:inherit fixed-pitch))))
'(org-table-hline ((t (:inherit fixed-pitch))))
'(org-table-hline-1 ((t (:inherit fixed-pitch))))
'(org-table-hline-2 ((t (:inherit fixed-pitch))))
'(org-table-hline-3 ((t (:inherit fixed-pitch))))
'(org-table-hline-4 ((t (:inherit fixed-pitch))))
'(org-table-hline-5 ((t (:inherit fixed-pitch))))
'(org-table-hline-6 ((t (:inherit fixed-pitch))))
'(org-table-first-column ((t (:inherit fixed-pitch))))
'(org-table-current-cell-highlight ((t (:inherit fixed-pitch))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background))))
'(org-table-cell-highlight ((t (:inherit fixed-pitch :background)))))

(add-hook 'org-mode-hook 'turn-on-text-scale-mode)

(add-hook 'org-mode-hook 'variable-pitch-mode)

;; Disable blinking cursor
(blink-cursor-mode -1)

;; Swap terms like 'lambda' for their corresponding symbol
(global-prettify-symbols-mode t)

(show-paren-mode 1)

(fringe-mode 0)

;(ido-mode 1)

#+end_src

Expand Down Expand Up @@ -267,6 +317,8 @@
(use-package rainbow-delimiters
:hook ((emacs-lisp-mode lisp-mode racket-mode) . rainbow-delimiters-mode))

(use-package mixed-pitch)

#+end_src

* Utility Functions
Expand Down
Loading

0 comments on commit 72c8282

Please sign in to comment.