From 5a425b58122e6b134de60a20e7c18d2c29150aa0 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 1 Apr 2021 01:07:33 +0100 Subject: [PATCH] fix(version-control): pin diff-hl to a known good commit The very next commit introduces a new feature to show git hunks, which seems to have a negative impact on performance when moving the cursor around, or adding/removing text within lines which are highlighted by diff-hl while diff-hl-flydiff-mode is enabled. So for now I'm pinning diff-hl to the commit right before this was introduced. --- core/siren-core-packages.el | 9 ++ modules/version-control/siren-diff-hl.el | 108 ++++++++++++----------- straight/versions/default.el | 1 - straight/versions/pinned.el | 2 + 4 files changed, 67 insertions(+), 53 deletions(-) create mode 100644 straight/versions/pinned.el diff --git a/core/siren-core-packages.el b/core/siren-core-packages.el index 612d698..6a72adb 100644 --- a/core/siren-core-packages.el +++ b/core/siren-core-packages.el @@ -9,6 +9,8 @@ ;; Initialize straight.el (setq straight-cache-autoloads t straight-check-for-modifications '(check-on-save find-when-checking) + straight-profiles '((nil . "default.el") + (pinned . "pinned.el")) straight-repository-branch "develop" straight-use-package-by-default t use-package-always-ensure nil) @@ -28,6 +30,13 @@ (load bootstrap-file nil 'nomessage)) (autoload 'straight-x-clean-unused-repos "straight-x" nil t) +(autoload 'straight-x-pull-all "straight-x" nil t) +(autoload 'straight-x-freeze-versions "straight-x" nil t) +(autoload 'straight-x-thaw-pinned-versions "straight-x" nil t) + +(defun straight-x-pin-package (package gitsha) + (add-to-list 'straight-x-pinned-packages + `(,package . ,gitsha))) (straight-use-package 'use-package) diff --git a/modules/version-control/siren-diff-hl.el b/modules/version-control/siren-diff-hl.el index a1b1389..8df6dae 100644 --- a/modules/version-control/siren-diff-hl.el +++ b/modules/version-control/siren-diff-hl.el @@ -8,70 +8,74 @@ (require 'siren-magit) -(use-package diff-hl - :hook - (prog-mode . siren-turn-on-diff-hl-mode) - (text-mode . siren-turn-on-diff-hl-mode) - (dired-mode . diff-hl-dired-mode) - (magit-pre-refresh . diff-hl-magit-pre-refresh) - (magit-post-refresh . diff-hl-magit-post-refresh) +(let ((straight-current-profile 'pinned)) + (straight-x-pin-package + "diff-hl" "4c46b3b9851c85d15bff1e3ec92e5fc6043322bc") - :custom - ;; (diff-hl-fringe-bmp-function 'siren-diff-hl-fringe-bmp-line) - ;; (diff-hl-fringe-face-function 'siren-diff-hl-fringe-face-from-type) - (diff-hl-fringe-bmp-function 'diff-hl-fringe-bmp-from-pos) - (diff-hl-fringe-face-function 'diff-hl-fringe-face-from-type) + (use-package diff-hl + :hook + (prog-mode . siren-turn-on-diff-hl-mode) + (text-mode . siren-turn-on-diff-hl-mode) + (dired-mode . diff-hl-dired-mode) + (magit-pre-refresh . diff-hl-magit-pre-refresh) + (magit-post-refresh . diff-hl-magit-post-refresh) - (diff-hl-margin-symbols-alist - '((insert . "+") - (delete . "-") - (change . "=") - (unknown . "?") - (ignored . "i"))) + :custom + ;; (diff-hl-fringe-bmp-function 'siren-diff-hl-fringe-bmp-line) + ;; (diff-hl-fringe-face-function 'siren-diff-hl-fringe-face-from-type) + (diff-hl-fringe-bmp-function 'diff-hl-fringe-bmp-from-pos) + (diff-hl-fringe-face-function 'diff-hl-fringe-face-from-type) - :init - (defun siren-turn-on-diff-hl-mode () - (turn-on-diff-hl-mode) - (diff-hl-flydiff-mode 1)) + (diff-hl-margin-symbols-alist + '((insert . "+") + (delete . "-") + (change . "=") + (unknown . "?") + (ignored . "i"))) - (defgroup siren-diff-hl nil - "Siren specific tweaks to diff-hl.") + :init + (defun siren-turn-on-diff-hl-mode () + (turn-on-diff-hl-mode) + (diff-hl-flydiff-mode 1)) - (defface siren-diff-hl-insert - '((default :inherit diff-hl-insert)) - "Face used to highlight inserted lines." - :group 'siren-diff-hl) + (defgroup siren-diff-hl nil + "Siren specific tweaks to diff-hl.") - (defface siren-diff-hl-delete - '((default :inherit diff-hl-delete)) - "Face used to highlight deleted lines." - :group 'siren-diff-hl) + (defface siren-diff-hl-insert + '((default :inherit diff-hl-insert)) + "Face used to highlight inserted lines." + :group 'siren-diff-hl) - (defface siren-diff-hl-change - '((default :inherit diff-hl-change)) - "Face used to highlight changed lines." - :group 'siren-diff-hl) + (defface siren-diff-hl-delete + '((default :inherit diff-hl-delete)) + "Face used to highlight deleted lines." + :group 'siren-diff-hl) - (defun siren-diff-hl-fringe-face-from-type (type _pos) - (intern (format "siren-diff-hl-%s" type))) + (defface siren-diff-hl-change + '((default :inherit diff-hl-change)) + "Face used to highlight changed lines." + :group 'siren-diff-hl) - (defun siren-diff-hl-fringe-bmp-from-type(type _pos) - (intern (format "siren-diff-hl-%s" type))) + (defun siren-diff-hl-fringe-face-from-type (type _pos) + (intern (format "siren-diff-hl-%s" type))) - (defun siren-diff-hl-fringe-bmp-line(type _pos) - 'siren-diff-hl-insert) + (defun siren-diff-hl-fringe-bmp-from-type(type _pos) + (intern (format "siren-diff-hl-%s" type))) - :config - (if (not (window-system)) - (diff-hl-margin-mode 1)) + (defun siren-diff-hl-fringe-bmp-line(type _pos) + 'siren-diff-hl-insert) - ;; Fringe bitmaps borrowed from doom-emacs' ui/vc-gutter module - (define-fringe-bitmap 'siren-diff-hl-insert - [224] nil nil '(center repeated)) - (define-fringe-bitmap 'siren-diff-hl-change - [224] nil nil '(center repeated)) - (define-fringe-bitmap 'siren-diff-hl-delete - [128 192 224 240] nil nil 'bottom)) + :config + (if (not (window-system)) + (diff-hl-margin-mode 1)) + + ;; Fringe bitmaps borrowed from doom-emacs' ui/vc-gutter module + (define-fringe-bitmap 'siren-diff-hl-insert + [224] nil nil '(center repeated)) + (define-fringe-bitmap 'siren-diff-hl-change + [224] nil nil '(center repeated)) + (define-fringe-bitmap 'siren-diff-hl-delete + [128 192 224 240] nil nil 'bottom))) (provide 'siren-diff-hl) ;;; siren-diff-hl.el ends here diff --git a/straight/versions/default.el b/straight/versions/default.el index 6ffdcbd..0adb72f 100644 --- a/straight/versions/default.el +++ b/straight/versions/default.el @@ -21,7 +21,6 @@ ("dash-at-point" . "4d795a23a8428c421d5107f1b005c9d8e0d1816c") ("dash.el" . "a17b6b5409825891423b3867cd7bea84852d6ddd") ("desktop-plus" . "88055cee526a000056201898499cebbd35e3ea76") - ("diff-hl" . "4c46b3b9851c85d15bff1e3ec92e5fc6043322bc") ("diminish.el" . "6ec6ebc391371418efc6c98d70b013f34af5a2ee") ("dired-hacks" . "d1a2bda6aa8f890cb367297ed93aee6d3b5ba388") ("dired-plus" . "40881cbe37faa27c14ef47af0a0449bcbb2c38af") diff --git a/straight/versions/pinned.el b/straight/versions/pinned.el new file mode 100644 index 0000000..46f9ebb --- /dev/null +++ b/straight/versions/pinned.el @@ -0,0 +1,2 @@ +(("diff-hl" . "4c46b3b9851c85d15bff1e3ec92e5fc6043322bc")) +:beta