~thecatster/.emacs.d

22afe6ebdf7c589a67cfd9a42de5b51114520f16 — Daniil Rose 4 months ago 95d7592
Update various settings related to macos
2 files changed, 137 insertions(+), 82 deletions(-)

M emacs.org
M init.el
M emacs.org => emacs.org +73 -43
@@ 36,8 36,6 @@ more.
  - [[#yasnippet][Yasnippet]]
  - [[#helpful][Helpful]]
  - [[#magit][Magit]]
  - [[#vterm][Vterm]]
  - [[#eshell][Eshell]]
  - [[#ediff][Ediff]]
  - [[#pdf-view][PDF View]]
  - [[#dashboard][Dashboard]]


@@ 266,6 264,13 @@ heard much good about straight, so time to put that to the test.
Inspired from a multitude of different configs, this removes the Emacs menu bar
and other bits of the UI, and includes some limits I consider useful.

Add my name and email address as default

#+BEGIN_SRC emacs-lisp
(setq user-full-name "Daniil Rose"
      user-mail-address "daniil.rose@member.fsf.org")
#+END_SRC

Hide annoying minor modes that will always be on anyway.

#+BEGIN_SRC emacs-lisp


@@ 290,6 295,50 @@ lag.
    (global-so-long-mode 1))
#+END_SRC

When on macOS, make some tweaks to better the experience.

#+BEGIN_SRC emacs-lisp
(when IS-MAC
  ;; Switch keys around, since it's easier to hit Command
  (setq mac-option-key-is-meta nil
        mac-command-key-is-meta t
        mac-command-modifier 'meta
        mac-option-modifier 'super)

  ;; Use spotlight as search
  (setq locate-command "mdfind")

  ;; Curse Lion and its sudden but inevitable fullscreen mode!
  ;; NOTE Meaningless to railwaycat's emacs-mac build
  (setq ns-use-native-fullscreen nil)

  ;; Visit files opened outside of Emacs in existing frame, not a new one
  (setq ns-pop-up-frames nil)

  ;; sane trackpad/mouse scroll settings
  (setq mac-redisplay-dont-reset-vscroll t
        mac-mouse-wheel-smooth-scroll nil)

  ;; Sets `ns-transparent-titlebar' and `ns-appearance' frame parameters so window
  ;; borders will match the enabled theme.
  (and (or (daemonp)
           (display-graphic-p))
       (require 'ns-auto-titlebar nil t)
       (ns-auto-titlebar-mode +1))

  ;; Integrate with Keychain
  ;;(auth-sources 'macos-keychain-internet 'macos-keychain-generic)

  ;; Delete files to trash
  (use-package osx-trash
    :init
    (setq delete-by-moving-to-trash t)
    (and IS-MAC
         (not (fboundp 'system-move-file-to-trash))
         (defalias #'system-move-file-to-trash #'osx-trash-move-file-to-trash)))
  )
#+END_SRC

Add programs to path on macOS.

#+BEGIN_SRC emacs-lisp


@@ 376,27 425,10 @@ Always update files on change globally.
  (global-auto-revert-mode 1)
#+END_SRC

I used to always use relative line numbers, and I cannot tell if it is
a placebo or not, but absolute feels faster.
I don't really need line numbers.

#+BEGIN_SRC emacs-lisp
    (dolist (mode '(text-mode-hook
                    prog-mode-hook
                    conf-mode-hook))
      (add-hook mode (lambda () (display-line-numbers-mode 1))))

    (dolist (mode '(org-mode-hook))
      (add-hook mode (lambda ()
                       (display-line-numbers-mode 0)
                       (setq-local global-hl-line-mode nil))))
  (dolist (mode '(vterm-mode-hook))
    (add-hook mode (lambda ()
                     (display-line-numbers-mode 0)
                     (setq-local global-hl-line-mode nil))))
    (dolist (mode '(magit-mode-hook))
      (add-hook mode (lambda ()
                       (display-line-numbers-mode 0)
                       (setq-local global-hl-line-mode nil))))
(line-number-mode nil)
#+END_SRC

Update that load path.


@@ 439,7 471,7 @@ this font name! And if we're talking about fonts, you gotta have
emojis.

#+BEGIN_SRC emacs-lisp
(add-to-list 'default-frame-alist '(font . "JetBrains Mono 12"))
(add-to-list 'default-frame-alist '(font . "JetBrainsMono Nerd Font 12"))
(use-package emojify
  :hook (erc-mode . emojify-mode)
  :commands emojify-mode)


@@ 576,7 608,7 @@ Let's handle encryption with Emacs as well.
;; Don't bring up key recipient dialogue.
(require 'epa-file)
(setq epa-file-select-keys 1)
(setq epa-file-encrypt-to '("<danielrose@member.fsf.org>"))
(setq epa-file-encrypt-to '("<daniil.rose@member.fsf.org>"))

;; Increase the password cache expiry time, technically doesn't do anything for GPG2
(setq password-cache-expiry (* 60 15))


@@ 1399,32 1431,32 @@ phenomenal, allowing for a proper debugging experience within Emacs
    :defer t
    :hook (((rustic-mode
       python-mode
	     rjsx-mode
	     web-mode
	     typescript-mode
	     clojure-mode) . lsp)
	   (lsp-mode . lsp-enable-which-key-integration))
       rjsx-mode
       web-mode
       typescript-mode
       clojure-mode) . lsp)
     (lsp-mode . lsp-enable-which-key-integration))
    :commands (lsp)
    :init
    (setq  lsp-keymap-prefix "C-c l"
	   lsp-eslint-run "onSave"
	   lsp-completion-provider :capf
	   lsp-log-io nil
	   lsp-idle-delay 1
	   lsp-headerline-breadcrumb-enable nil))
     lsp-eslint-run "onSave"
     lsp-completion-provider :capf
     lsp-log-io nil
     lsp-idle-delay 1
     lsp-headerline-breadcrumb-enable nil))

  (use-package lsp-ui
    :hook (lsp-mode . lsp-ui-mode)
    :commands lsp-ui-mode
    :init
    (setq lsp-ui-sideline-show-hover nil
	  lsp-ui-sideline-enable t
	  lsp-ui-doc-enable nil
	  lsp-signature-auto-activate nil
	  lsp-signature-render-document nil
	  ;; This is SO annoying. Believe it or not, I know what a `fn` does
	  ;; in Rust!
	  lsp-eldoc-render-all nil))
    lsp-ui-sideline-enable t
    lsp-ui-doc-enable nil
    lsp-signature-auto-activate nil
    lsp-signature-render-document nil
    ;; This is SO annoying. Believe it or not, I know what a `fn` does
    ;; in Rust!
    lsp-eldoc-render-all nil))

#+END_SRC



@@ 1644,7 1676,7 @@ else I'll eventually need.

(use-package tree-sitter
  :hook ((typescript-mode . tree-sitter-hl-mode)
	       (typescript-tsx-mode . tree-sitter-hl-mode)))
         (typescript-tsx-mode . tree-sitter-hl-mode)))

(use-package tree-sitter-langs
  :after tree-sitter


@@ 1923,8 1955,6 @@ The new version of Org Roam Server, Org Roam UI looks awesome!

#+BEGIN_SRC emacs-lisp
(use-package org-roam-ui
  :straight
    (:host github :repo "org-roam/org-roam-ui" :branch "main" :files ("*.el" "out"))
    :after org-roam
    :hook (after-init . org-roam-ui-mode)
    :config

M init.el => init.el +64 -39
@@ 153,6 153,9 @@
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)

(setq user-full-name "Daniil Rose"
      user-mail-address "daniil.rose@member.fsf.org")

(use-package diminish)

(scroll-bar-mode -1)


@@ 165,6 168,46 @@
  (global-so-long-mode 1))

(when IS-MAC
  ;; Switch keys around, since it's easier to hit Command
  (setq mac-option-key-is-meta nil
        mac-command-key-is-meta t
        mac-command-modifier 'meta
        mac-option-modifier 'super)

  ;; Use spotlight as search
  (setq locate-command "mdfind")

  ;; Curse Lion and its sudden but inevitable fullscreen mode!
  ;; NOTE Meaningless to railwaycat's emacs-mac build
  (setq ns-use-native-fullscreen nil)

  ;; Visit files opened outside of Emacs in existing frame, not a new one
  (setq ns-pop-up-frames nil)

  ;; sane trackpad/mouse scroll settings
  (setq mac-redisplay-dont-reset-vscroll t
        mac-mouse-wheel-smooth-scroll nil)

  ;; Sets `ns-transparent-titlebar' and `ns-appearance' frame parameters so window
  ;; borders will match the enabled theme.
  (and (or (daemonp)
           (display-graphic-p))
       (require 'ns-auto-titlebar nil t)
       (ns-auto-titlebar-mode +1))

  ;; Integrate with Keychain
  ;;(auth-sources 'macos-keychain-internet 'macos-keychain-generic)

  ;; Delete files to trash
  (use-package osx-trash
    :init
    (setq delete-by-moving-to-trash t)
    (and IS-MAC
         (not (fboundp 'system-move-file-to-trash))
         (defalias #'system-move-file-to-trash #'osx-trash-move-file-to-trash)))
  )

(when IS-MAC
  (use-package exec-path-from-shell
    :init
    (exec-path-from-shell-initialize)))


@@ 206,23 249,7 @@
(setq global-auto-revert-non-file-buffers t)
(global-auto-revert-mode 1)

(dolist (mode '(text-mode-hook
                  prog-mode-hook
                  conf-mode-hook))
    (add-hook mode (lambda () (display-line-numbers-mode 1))))

  (dolist (mode '(org-mode-hook))
    (add-hook mode (lambda ()
                     (display-line-numbers-mode 0)
                     (setq-local global-hl-line-mode nil))))
(dolist (mode '(vterm-mode-hook))
  (add-hook mode (lambda ()
                   (display-line-numbers-mode 0)
                   (setq-local global-hl-line-mode nil))))
  (dolist (mode '(magit-mode-hook))
    (add-hook mode (lambda ()
                     (display-line-numbers-mode 0)
                     (setq-local global-hl-line-mode nil))))
(line-number-mode nil)

(add-to-list 'load-path "~/.emacs.d/lisp/")



@@ 239,7 266,7 @@

(add-hook 'before-save-hook 'delete-trailing-whitespace)

(add-to-list 'default-frame-alist '(font . "JetBrains Mono 12"))
(add-to-list 'default-frame-alist '(font . "JetBrainsMono Nerd Font 12"))
(use-package emojify
  :hook (erc-mode . emojify-mode)
  :commands emojify-mode)


@@ 311,7 338,7 @@
;; Don't bring up key recipient dialogue.
(require 'epa-file)
(setq epa-file-select-keys 1)
(setq epa-file-encrypt-to '("<danielrose@member.fsf.org>"))
(setq epa-file-encrypt-to '("<daniil.rose@member.fsf.org>"))

;; Increase the password cache expiry time, technically doesn't do anything for GPG2
(setq password-cache-expiry (* 60 15))


@@ 930,32 957,32 @@
  :defer t
  :hook (((rustic-mode
     python-mode
	   rjsx-mode
	   web-mode
	   typescript-mode
	   clojure-mode) . lsp)
	 (lsp-mode . lsp-enable-which-key-integration))
     rjsx-mode
     web-mode
     typescript-mode
     clojure-mode) . lsp)
   (lsp-mode . lsp-enable-which-key-integration))
  :commands (lsp)
  :init
  (setq  lsp-keymap-prefix "C-c l"
	 lsp-eslint-run "onSave"
	 lsp-completion-provider :capf
	 lsp-log-io nil
	 lsp-idle-delay 1
	 lsp-headerline-breadcrumb-enable nil))
   lsp-eslint-run "onSave"
   lsp-completion-provider :capf
   lsp-log-io nil
   lsp-idle-delay 1
   lsp-headerline-breadcrumb-enable nil))

(use-package lsp-ui
  :hook (lsp-mode . lsp-ui-mode)
  :commands lsp-ui-mode
  :init
  (setq lsp-ui-sideline-show-hover nil
	lsp-ui-sideline-enable t
	lsp-ui-doc-enable nil
	lsp-signature-auto-activate nil
	lsp-signature-render-document nil
	;; This is SO annoying. Believe it or not, I know what a `fn` does
	;; in Rust!
	lsp-eldoc-render-all nil))
  lsp-ui-sideline-enable t
  lsp-ui-doc-enable nil
  lsp-signature-auto-activate nil
  lsp-signature-render-document nil
  ;; This is SO annoying. Believe it or not, I know what a `fn` does
  ;; in Rust!
  lsp-eldoc-render-all nil))

;; (use-package dap-mode
;;   :after lsp-mode


@@ 1103,7 1130,7 @@

(use-package tree-sitter
  :hook ((typescript-mode . tree-sitter-hl-mode)
	       (typescript-tsx-mode . tree-sitter-hl-mode)))
         (typescript-tsx-mode . tree-sitter-hl-mode)))

(use-package tree-sitter-langs
  :after tree-sitter


@@ 1312,8 1339,6 @@
      (require 'org-roam-protocol))

(use-package org-roam-ui
  :straight
    (:host github :repo "org-roam/org-roam-ui" :branch "main" :files ("*.el" "out"))
    :after org-roam
    :hook (after-init . org-roam-ui-mode)
    :config