From 2cb8328f6870dec32ac603c536e6910d20cc7127 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 29 Jul 2024 18:07:44 -0400 Subject: [PATCH 1/8] bump: evil-org doomelpa/evil-org-mode@a9706da260c4 -> doomelpa/evil-org-mode@06518c65ff4f Fix: #7960 --- modules/lang/org/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/org/packages.el b/modules/lang/org/packages.el index 4d40495f9..5fc023410 100644 --- a/modules/lang/org/packages.el +++ b/modules/lang/org/packages.el @@ -64,7 +64,7 @@ (when (modulep! :editor evil +everywhere) (package! evil-org :recipe (:host github :repo "doomelpa/evil-org-mode") - :pin "a9706da260c45b98601bcd72b1d2c0a24a017700")) + :pin "06518c65ff4f7aea2ea51149d701549dcbccce5d")) (when (modulep! :tools pdf) (package! org-pdftools :pin "4e420233a153a9c4ab3d1a7e1d7d3211c836f0ac")) (when (modulep! :tools magit) From 04efd825900849e1b601c00c0a5c78706c83721b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 29 Jul 2024 18:40:22 -0400 Subject: [PATCH 2/8] feat(evil): optionally wrap move-window commands Introduces an `+evil-want-move-window-to-wrap-around` option. If non-nil, `+evil/window-move-*` commands will wrap around the frame. If these commands are passed the prefix arg, behave as if `+evil-want-move-window-to-wrap-around` were inverted (just once). Close: #7218 Co-authored-by: agzam --- modules/editor/evil/autoload/evil.el | 38 ++++++++++++++++++++-------- modules/editor/evil/config.el | 3 +++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/modules/editor/evil/autoload/evil.el b/modules/editor/evil/autoload/evil.el index dfb0748ee..8746e5736 100644 --- a/modules/editor/evil/autoload/evil.el +++ b/modules/editor/evil/autoload/evil.el @@ -39,11 +39,16 @@ replacing its contents." (let ((evil-kill-on-visual-paste (not evil-kill-on-visual-paste))) (call-interactively #'evil-paste-after))) -(defun +evil--window-swap (direction) +(defun +evil--window-swap (direction &optional invert-wrap?) "Move current window to the next window in DIRECTION. + If there are no windows there and there is only one window, split in that direction and place this window there. If there are no windows and this isn't -the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')." +the only window, uses evil-window-move-* (e.g. `evil-window-move-far-left'). + +If already at the edge of the frame and `+evil-want-move-window-to-wrap-around' +is non-nil, move the window to the other end of the frame. Inverts +`+evil-want-move-window-to-wrap-around' if INVERT-WRAP? is non-nil." (unless (memq direction '(left right up down)) (user-error "Invalid direction: %s" direction)) (when (window-dedicated-p) @@ -61,7 +66,14 @@ the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')." '(up down) '(left right)) if (window-in-direction dir nil this-window) return t))) - (user-error "Window is already at the edge") + (if (funcall (if invert-wrap? #'not #'identity) +evil-want-move-window-to-wrap-around) + (call-interactively + (pcase direction + ('left #'evil-window-move-far-right) + ('right #'evil-window-move-far-left) + ('up #'evil-window-move-very-bottom) + ('down #'evil-window-move-very-top))) + (user-error "Window is already at the edge")) (call-interactively (pcase direction ('left #'evil-window-move-far-left) @@ -77,21 +89,25 @@ the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')." (select-window that-window)))) ;;;###autoload -(defun +evil/window-move-left () +(defun +evil/window-move-left (&optional arg) "Swap windows to the left." - (interactive) (+evil--window-swap 'left)) + (interactive "P") + (+evil--window-swap 'left (or arg +evil-want-move-window-to-wrap-around))) ;;;###autoload -(defun +evil/window-move-right () +(defun +evil/window-move-right (&optional arg) "Swap windows to the right" - (interactive) (+evil--window-swap 'right)) + (interactive "P") + (+evil--window-swap 'right (or arg +evil-want-move-window-to-wrap-around))) ;;;###autoload -(defun +evil/window-move-up () +(defun +evil/window-move-up (&optional arg) "Swap windows upward." - (interactive) (+evil--window-swap 'up)) + (interactive "P") + (+evil--window-swap 'up (or arg +evil-want-move-window-to-wrap-around))) ;;;###autoload -(defun +evil/window-move-down () +(defun +evil/window-move-down (&optional arg) "Swap windows downward." - (interactive) (+evil--window-swap 'down)) + (interactive "P") + (+evil--window-swap 'down (or arg +evil-want-move-window-to-wrap-around))) ;;;###autoload (defun +evil/window-split-and-follow () diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index e8f31550a..5a20a7007 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -12,6 +12,9 @@ Set this to `nil' to disable universal-repeating on these keys.") "If non-nil, the o/O keys will continue comment lines if the point is on a line with a linewise comment.") +(defvar +evil-want-move-window-to-wrap-around nil + "If non-nil, `+evil/window-move-*' commands will wrap around.") + (defvar +evil-preprocessor-regexp "^\\s-*#[a-zA-Z0-9_]" "The regexp used by `+evil/next-preproc-directive' and `+evil/previous-preproc-directive' on ]# and [#, to jump between preprocessor From 9cdcfdac36d3264bd9a8282606472d2267ddf1a7 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 29 Jul 2024 19:46:42 -0400 Subject: [PATCH 3/8] feat(workspaces): add +workspace/delete For deleting saved workspaces (saved with `+workspace/save` or `+workspace-save`). Also binds `SPC TAB D` (for evil users) and `C-c w K` (for non-evil users) to it. Fix: #4399 Close: #7869 Co-authored-by: sriramsk1999 --- modules/config/default/+emacs-bindings.el | 1 + modules/config/default/+evil-bindings.el | 1 + modules/ui/workspaces/autoload/workspaces.el | 35 ++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index 1b0394eea..fd773d704 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -413,6 +413,7 @@ :desc "Create workspace" "c" #'+workspace/new :desc "Create named workspace" "C" #'+workspace/new-named :desc "Delete workspace" "k" #'+workspace/kill + :desc "Delete saved workspace" "K" #'+workspace/delete :desc "Save workspace" "S" #'+workspace/save :desc "Switch to other workspace" "o" #'+workspace/other :desc "Switch to left workspace" "p" #'+workspace/switch-left diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 826ad31d9..c4cca4a19 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -382,6 +382,7 @@ :desc "Save workspace to file" "s" #'+workspace/save :desc "Kill session" "x" #'+workspace/kill-session :desc "Kill this workspace" "d" #'+workspace/kill + :desc "Delete saved workspace" "D" #'+workspace/delete :desc "Rename workspace" "r" #'+workspace/rename :desc "Restore last session" "R" #'+workspace/restore-last-session :desc "Next workspace" "]" #'+workspace/switch-right diff --git a/modules/ui/workspaces/autoload/workspaces.el b/modules/ui/workspaces/autoload/workspaces.el index d83c9d5da..1a182be62 100644 --- a/modules/ui/workspaces/autoload/workspaces.el +++ b/modules/ui/workspaces/autoload/workspaces.el @@ -122,6 +122,24 @@ Returns t on success, nil otherwise." (and (member name (persp-list-persp-names-in-file fname)) t))) +;;;###autoload +(defun +workspace-delete (workspace) + "Delete WORKSPACE from the saved workspaces in `persp-save-dir'. + +Return t if WORKSPACE was successfully deleted. Throws error if WORKSPACE is not +found or wasn't saved with `+workspace-save'." + (let* ((fname (expand-file-name +workspaces-data-file persp-save-dir)) + (workspace-name (if (stringp workspace) workspace (persp-name workspace))) + (workspace-names (persp-list-persp-names-in-file fname)) + (workspace-idx (cl-position workspace-name workspace-names :test #'equal))) + (unless workspace-idx + (error "Couldn't find saved workspace '%s'" workspace-name)) + (doom-file-write + fname (list (cl-remove-if (lambda (ws) (equal workspace-name (nth 1 ws))) + (doom-file-read fname :by 'read) + :count 1))) + (not (member name (persp-list-persp-names-in-file fname))))) + ;;;###autoload (defun +workspace-new (name) "Create a new workspace named NAME. If one already exists, return nil. @@ -267,6 +285,23 @@ workspace to delete." (+workspace-message (format "Deleted '%s' workspace" name) 'success))) ('error (+workspace-error ex t)))) +;;;###autoload +(defun +workspace/delete (name) + "Delete a saved workspace in `persp-save-dir'. + +Can only selete workspaces saved with `+workspace/save' or `+workspace-save'." + (interactive + (list + (completing-read "Delete saved workspace: " + (cl-loop with wsfile = (doom-path persp-save-dir +workspaces-data-file) + for p in (persp-list-persp-names-in-file wsfile) + collect p)))) + (and (condition-case-unless-debug ex + (or (+workspace-delete name) + (+workspace-error (format "Couldn't delete '%s' workspace" name))) + ('error (+workspace-error ex t))) + (+workspace-message (format "Deleted '%s' workspace" name) 'success))) + ;;;###autoload (defun +workspace/kill-session (&optional interactive) "Delete the current session, all workspaces, windows and their buffers." From 014112c16cbd3d45bc6e7187bd6edda1d260eecf Mon Sep 17 00:00:00 2001 From: schoettker Date: Tue, 30 Jul 2024 02:59:48 +0200 Subject: [PATCH 4/8] docs(org): remove org-yt custom link type The org-yt package has been removed in 321f2d2, therefore the custom link type `yt:...` is no longer supported. Amend: 321f2d2249a5 --- modules/lang/org/README.org | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/lang/org/README.org b/modules/lang/org/README.org index 46626d900..08fcc2cb1 100644 --- a/modules/lang/org/README.org +++ b/modules/lang/org/README.org @@ -235,7 +235,6 @@ They are (with examples): - ~wolfram:sin(x^3)~ - ~wikipedia:Emacs~ - ~youtube:P196hEuA_Xc~ (link only) -- ~yt:P196hEuA_Xc~ (like =youtube=, but includes an inline preview of the video) ** evil-mode keybindings For =evil-mode= users, an overview of org-mode keybindings is provided [[https://github.com/Somelauw/evil-org-mode/blob/master/README.org#keybindings][here]]. From 93dfb0acfbde80382a11726dc1240681a27fb12e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 30 Jul 2024 00:41:52 -0400 Subject: [PATCH 5/8] fix(lsp): set lsp-zig-download-url-format earlier If delayed until lsp-zig is loaded, then the `lsp-dependency` call in lsp-zig will evaluate with the old (and incorrect) value of `lsp-zig-download-url-format`. Fix: #7970 Amend: bc5a8ec3fa67 Amend: 7bb5df4cd4ae --- modules/tools/lsp/+lsp.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/tools/lsp/+lsp.el b/modules/tools/lsp/+lsp.el index 59c05a02c..3fbcebc6d 100644 --- a/modules/tools/lsp/+lsp.el +++ b/modules/tools/lsp/+lsp.el @@ -44,9 +44,8 @@ Can be a list of backends; accepts any value `company-backends' accepts.") (setq lsp-keymap-prefix nil)) ;; REVIEW: Remove when zigtools/zls#1879 is resolved. - (after! lsp-zig - (unless (featurep :system 'windows) - (setq lsp-zig-download-url-format "https://github.com/zigtools/zls/releases/latest/download/zls-%s-%s.tar.xz"))) + (unless (featurep :system 'windows) + (setq lsp-zig-download-url-format "https://github.com/zigtools/zls/releases/latest/download/zls-%s-%s.tar.xz")) :config (add-to-list 'doom-debug-variables 'lsp-log-io) From 85b7b6151b99aba90350b9c1bd13b7349f83b015 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 30 Jul 2024 00:48:42 -0400 Subject: [PATCH 6/8] fix(lsp): force lsp-zig-download-url-format to change Can't change the variable after lsp-zig loads because its used when it's loaded. Can't set it before lsp-zig loads because it's a constant (resetting its value). Thank god it uses a (non-inlined) function to build that URL, so we have an easy target to advise. Fix: #7970 Amend: 93dfb0acfbde Amend: bc5a8ec3fa67 Amend: 7bb5df4cd4ae --- modules/tools/lsp/+lsp.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/tools/lsp/+lsp.el b/modules/tools/lsp/+lsp.el index 3fbcebc6d..95abfd247 100644 --- a/modules/tools/lsp/+lsp.el +++ b/modules/tools/lsp/+lsp.el @@ -43,9 +43,20 @@ Can be a list of backends; accepts any value `company-backends' accepts.") (when (modulep! :config default +bindings) (setq lsp-keymap-prefix nil)) - ;; REVIEW: Remove when zigtools/zls#1879 is resolved. (unless (featurep :system 'windows) - (setq lsp-zig-download-url-format "https://github.com/zigtools/zls/releases/latest/download/zls-%s-%s.tar.xz")) + ;; HACK: Frustratingly enough, the value of `lsp-zig-download-url-format' is + ;; used immediately while the lsp-zig package is loading, so changing it + ;; *after* lsp-zig makes no difference. What's worse, the variable is a + ;; constant, so we can't change it *before* the package is loaded either! + ;; Thank god a (non-inlined) function is used to build the URL, so we have + ;; something to advise. + ;; REVIEW: Remove when zigtools/zls#1879 is resolved. + (defadvice! +lsp--use-correct-zls-download-url-a (fn &rest _) + "See zigtools/zls#1879." + :around #'lsp-zig--zls-url + (let ((lsp-zig-download-url-format + "https://github.com/zigtools/zls/releases/latest/download/zls-%s-%s.tar.xz")) + (apply fn args)))) :config (add-to-list 'doom-debug-variables 'lsp-log-io) From 0bac5fe132bf791e3bfb6aef39d8b8978ce53dc9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 30 Jul 2024 02:45:44 -0400 Subject: [PATCH 7/8] fix(format): register shfmt for sh-mode Apheleia already has a (and better) definition for shfmt. Fix: #5268 --- modules/editor/format/config.el | 2 ++ modules/lang/sh/config.el | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/editor/format/config.el b/modules/editor/format/config.el index d0658a5f1..13278cfe6 100644 --- a/modules/editor/format/config.el +++ b/modules/editor/format/config.el @@ -44,6 +44,8 @@ This is controlled by `+format-on-save-disabled-modes'." (add-to-list 'doom-debug-variables '(apheleia-log-only-errors . nil)) (add-to-list 'doom-debug-variables '(apheleia-log-debug-info . t)) + (add-to-list 'apheleia-mode-alist '(sh-mode . shfmt)) + ;; A psuedo-formatter that dispatches to the appropriate LSP client (via ;; `lsp-mode' or `eglot') that is capable of formatting. Without +lsp, users ;; must manually set `+format-with' to `lsp' to use it, or activate diff --git a/modules/lang/sh/config.el b/modules/lang/sh/config.el index 7355b7ac3..7f2ba3774 100755 --- a/modules/lang/sh/config.el +++ b/modules/lang/sh/config.el @@ -18,10 +18,6 @@ :config (set-docsets! 'sh-mode "Bash") (set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;")) - (set-formatter! 'shfmt '("shfmt" "-ci" - (unless indent-tabs-mode - (list "-i" (number-to-string tab-width))))) - (set-repl-handler! 'sh-mode #'+sh/open-repl) (set-lookup-handlers! 'sh-mode :documentation #'+sh-lookup-documentation-handler) (set-ligatures! 'sh-mode From 8be1ef498b81628214ab5e78739661faaf9d950f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 30 Jul 2024 04:46:12 -0400 Subject: [PATCH 8/8] fix(lsp): void-variable args error Fix: #7974 Fix: #7970 Amend: 85b7b6151b99 --- modules/tools/lsp/+lsp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tools/lsp/+lsp.el b/modules/tools/lsp/+lsp.el index 95abfd247..c82805ff4 100644 --- a/modules/tools/lsp/+lsp.el +++ b/modules/tools/lsp/+lsp.el @@ -51,7 +51,7 @@ Can be a list of backends; accepts any value `company-backends' accepts.") ;; Thank god a (non-inlined) function is used to build the URL, so we have ;; something to advise. ;; REVIEW: Remove when zigtools/zls#1879 is resolved. - (defadvice! +lsp--use-correct-zls-download-url-a (fn &rest _) + (defadvice! +lsp--use-correct-zls-download-url-a (fn &rest args) "See zigtools/zls#1879." :around #'lsp-zig--zls-url (let ((lsp-zig-download-url-format