Skip to content

Commit

Permalink
update to emacs 29 (mostly working)
Browse files Browse the repository at this point in the history
  • Loading branch information
JJPandari committed Aug 22, 2023
1 parent a9003d2 commit 74e49ac
Show file tree
Hide file tree
Showing 19 changed files with 70 additions and 50 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[submodule "elispfl"]
path = extensions/elispfl
url = [email protected]:cireu/elispfl.git
[submodule "apheleia"]
path = extensions/apheleia
url = [email protected]:raxod502/apheleia.git
[submodule "emacs-application-framework"]
path = extensions/emacs-application-framework
url = [email protected]:manateelazycat/emacs-application-framework.git
Expand Down
1 change: 0 additions & 1 deletion extensions/apheleia
Submodule apheleia deleted from b5dbab
2 changes: 1 addition & 1 deletion init.el
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
(require 'init-help)
(require 'init-read)

;; (require 'init-flycheck)
(require 'init-flycheck)
(require 'init-vc)
(require 'init-git)
(require 'init-compile)
Expand Down
2 changes: 1 addition & 1 deletion modes/init-buffer.el
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ current window."
(defun jester/copy-buffer-name ()
"Copy the buffer name, show it in minibuffer."
(interactive)
(message (kill-new (buffer-name))))
(kill-new (message (buffer-name))))

;;----------------------------------------------------------------------------
;; switch major mode
Expand Down
4 changes: 1 addition & 3 deletions modes/init-evil.el
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,8 @@
(dolist (cmd '(evil-yank evil-delete lispyville-yank lispyville-delete))
(advice-add cmd :after 'jester/evil-portal-jump-advice))

(evil-define-command jester/cycle-line-beginning-end ()
(evil-define-motion jester/cycle-line-beginning-end (count)
"Go to line text beginning, line end, line very beginning, in turn."
:repeat nil
(interactive)
(cl-block 'my-return
(when (and (looking-at "[^\s]") (looking-back "^\s*")) (evil-end-of-line) (cl-return-from 'my-return)) ; at beg of line text
(when (looking-at (if evil-move-beyond-eol "$" ".$")) (evil-beginning-of-line) (cl-return-from 'my-return)) ; at end of line
Expand Down
4 changes: 2 additions & 2 deletions modes/init-face.el
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
;; :family "JetBrains Mono"
;; :family "Fira Code"
:height jester-small-font-size
:weight 'normal
:weight 'medium
:width 'normal)
(jester/set-fallback-fonts))

Expand All @@ -78,7 +78,7 @@
;; :family "JetBrains Mono"
;; :family "Fira Code"
:height jester-large-font-size
:weight 'normal
:weight 'medium
:width 'normal)
(jester/set-fallback-fonts))

Expand Down
6 changes: 3 additions & 3 deletions modes/init-file.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
(defun jester/save-all-buffers ()
"Save all buffers."
;; yas overlay and company-select-next has problem with this.
(when (and (not yas--active-snippets)
(when (and (or (not (boundp 'yas--active-snippets)) (not yas--active-snippets))
;; (not company-candidates)
(not acm-mode)
(or (not (boundp 'acm-mode)) (not acm-mode))
(not (eq major-mode 'snippet-mode)))
;; https://github.com/manateelazycat/lazycat-emacs/commit/da13a688ef89f8ab2c577a3e9d2a7bcf0ef9b71d
;; https://emacs-china.org/t/topic/7687/30?u=jjpandari
Expand Down Expand Up @@ -147,7 +147,7 @@
;; list-buffers-directory is the variable set in dired buffers
(let ((file-name (or (buffer-file-name) list-buffers-directory)))
(if file-name
(message (kill-new file-name))
(kill-new (message file-name))
(error "Buffer not visiting a file"))))


Expand Down
11 changes: 6 additions & 5 deletions modes/init-flycheck.el
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
(use-package flycheck
:hook (prog-mode . flycheck-mode)
;; using lsp-bridge now, but still require this file since flycheck-* is used in many places
;; :hook (prog-mode . flycheck-mode)
:config
(setq flycheck-idle-change-delay 1)
(evil-set-initial-state 'flycheck-error-list-mode 'motion)
(jester/with-leader
"e l" 'flycheck-list-errors
"e p" 'flycheck-previous-error
"e n" 'flycheck-next-error)
;; (jester/with-leader
;; "e l" 'flycheck-list-errors
;; "e p" 'flycheck-previous-error
;; "e n" 'flycheck-next-error)
(general-define-key
:states '(motion)
:keymaps 'flycheck-error-list-mode-map
Expand Down
4 changes: 1 addition & 3 deletions modes/init-formatter.el
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
(push (expand-file-name "apheleia" jester-submodules-dir) load-path)
;; (push (expand-file-name "apheleia" jester-submodules-dir) load-path)
(use-package apheleia
:ensure nil
:straight nil
:init
(jester/with-major-leader '(js2-mode-map web-mode-map typescript-mode-map)
"f" 'apheleia-format-buffer)
Expand Down
11 changes: 7 additions & 4 deletions modes/init-ivy.el
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
;; -*- lexical-binding: t -*-
(use-package ivy
:demand t
:custom
Expand Down Expand Up @@ -207,10 +208,12 @@ If called interactively, let the user select start directory first."
:demand t
:after ivy
:config
(defhydra+ hydra-ivy ()
("a" nil)
("<escape>" keyboard-escape-quit :exit t)
("q" keyboard-escape-quit :exit t)))
;; TODO eager macro expansion error
;; (defhydra+ hydra-ivy ()
;; ("a" nil)
;; ("<escape>" keyboard-escape-quit :exit t)
;; ("q" keyboard-escape-quit :exit t))
)


(use-package wgrep
Expand Down
14 changes: 7 additions & 7 deletions modes/init-javascript.el
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
".test.jsx" ".spec.jsx"
".test.ts" ".spec.ts"
".test.tsx" ".spec.tsx")))
(setq jester-test-command (format "(cd %s && node node_modules/.bin/jest %s --collectCoverageOnlyFrom '')" (projectile-project-root) file-name)))))
(setq jester-test-command (format "(cd %s && node node_modules/.bin/jest --detectOpenHandles --forceExit %s --collectCoverageOnlyFrom '')" (projectile-project-root) file-name)))))

(add-hook! '(js2-mode-hook typescript-mode-hook web-mode-hook) 'jester/set-js-ts-test-command)

Expand All @@ -207,12 +207,12 @@
(condition-case err
(js2-jump-to-definition)
(error (citre-jump)))))
(general-define-key
:states '(normal motion)
:keymaps '(js2-mode-map)
"g d" 'jester/js2-jump-or-citre-jump
;; "g r" 'jester/xref-find-references-at-point
)
;; (general-define-key
;; :states '(normal motion)
;; :keymaps '(js2-mode-map)
;; "g d" 'jester/js2-jump-or-citre-jump
;; ;; "g r" 'jester/xref-find-references-at-point
;; "g p" 'xref-pop-marker-stack)


(provide 'init-javascript)
16 changes: 7 additions & 9 deletions modes/init-jump.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
:states '(normal motion)
:keymaps '(typescript-mode-map web-mode-map js2-mode-map)
"g d" 'lsp-bridge-find-def
"g p" 'lsp-bridge-find-def-return)
(general-define-key
:states 'normal
:keymaps '(typescript-mode-map web-mode-map js2-mode-map)
"g p" 'lsp-bridge-find-def-return
"g r" 'lsp-bridge-find-references
"g t" 'lsp-bridge-find-type-def)

(jester/with-major-leader '(typescript-mode-map web-mode-map js2-mode-map)
"r" 'lsp-bridge-rename)
(jester/with-leader
Expand Down Expand Up @@ -65,11 +63,11 @@
(setq xref-show-xrefs-function #'ivy-xref-show-xrefs))


(use-package citre
:custom ((citre-enable-imenu-integration nil)
(citre-tags-file-names '("tagz" ".tags" "tags")))
:init
(require 'citre-config))
;; (use-package citre
;; :custom ((citre-enable-imenu-integration nil)
;; (citre-tags-file-names '("tagz" ".tags" "tags")))
;; :init
;; (require 'citre-config))
;; TODO try `citre-peek'


Expand Down
5 changes: 5 additions & 0 deletions modes/init-lsp-bridge.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:straight (lsp-bridge :type git :host github :repo "manateelazycat/lsp-bridge"
:files ("*" (:exclude ".git" "test")))
:init
;; TODO a new face to inherit markdown mode
(setq acm-enable-tabnine nil
;; TODO acm-enable-codeium
acm-enable-yas nil
Expand All @@ -12,6 +13,7 @@
acm-candidate-match-function 'orderless-flex
acm-enable-quick-access t ; select candidate with number key
acm-quick-access-use-number-select t
lsp-bridge-enable-signature-help nil
lsp-bridge-signature-show-function 'lsp-bridge-signature-show-with-frame
lsp-bridge-signature-show-with-frame-position "top-left"
lsp-bridge-enable-hover-diagnostic t)
Expand All @@ -21,6 +23,9 @@

(evil-set-initial-state 'lsp-bridge-ref-mode 'emacs)

;; TODO what's the face for error pop?
(set-face-attribute 'lsp-bridge-ref-font-lock-diagnostic nil :foreground (face-attribute 'error :foreground))

(jester/with-minor-leader 'lsp-bridge-mode
"d" 'lsp-bridge-popup-documentation)

Expand Down
4 changes: 3 additions & 1 deletion modes/init-markdown.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
:commands markdown-mode
:mode "\\.md\\.html\\'"
:config
(set-face-attribute 'markdown-code-face nil :family "Fira Code"))
(set-face-attribute 'markdown-code-face nil
:family "Fira Code"
:height 140))


(provide 'init-markdown)
4 changes: 4 additions & 0 deletions modes/init-misc.el
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
(add-to-list 'recentf-exclude no-littering-var-directory)
(add-to-list 'recentf-exclude no-littering-etc-directory)))


;; (use-package emacs-gc-stats
;; )

;; TODO remember layout when ediff


Expand Down
6 changes: 4 additions & 2 deletions modes/init-org.el
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ typical word processor."
:states '(insert emacs)
:keymaps 'org-mode-map
"<tab>" 'org-cycle
"C-d" 'backward-char))
"C-d" 'org-metaleft
"C-f" 'org-metaright))

;; TODO org-superstar
(use-package org-bullets
Expand All @@ -321,7 +322,8 @@ typical word processor."
(general-define-key
:states '(insert)
:keymaps 'evil-org-mode-map
"C-d" 'backward-char))
"C-d" 'org-metaleft
"C-f" 'org-metaright))


(provide 'init-org)
14 changes: 10 additions & 4 deletions modes/init-themes.el
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
'solarized-light)
t)

;; TODO duplicate with theme hook, how to dedup?
(when (memq 'solarized-light custom-enabled-themes)
(custom-set-faces '(web-mode-keyword-face ((t (:inherit font-lock-keyword-face
:foreground unspecified
:weight unspecified))))))


;; TODO `enable-theme-functions' when 29
;; https://gist.github.com/hlissner/1ace77658c772cf150a43dc9396fa2ed
(defvar load-theme-hook nil
"Hook run after the theme is loaded with `load-theme'.")
Expand All @@ -25,12 +32,11 @@

(advice-add #'load-theme :after #'run-load-theme-hooks)

;; TODO `enable-theme-functions' when 29
(add-hook! 'load-theme-hook
(when (memq 'solarized-light custom-enabled-themes)
(custom-theme-set-faces
'solarized-light
'(web-mode-keyword-face ((t (:inherit 'font-lock-keyword-face)))))))
(custom-set-faces '(web-mode-keyword-face ((t (:inherit font-lock-keyword-face
:foreground unspecified
:weight unspecified)))))))


(provide 'init-themes)
2 changes: 1 addition & 1 deletion snippets/js2-mode/import
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# name: import
# key: imp
# --
import ${2:\{ $0 \}} from '$1';
import ${2:\{ $0 \} from }'$1';
7 changes: 7 additions & 0 deletions snippets/js2-mode/useEffect
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: useEffect
# key: ue
# --
useEffect(() => {
$0
}${1:, [$2]});

0 comments on commit 74e49ac

Please sign in to comment.