From 003bc783d7a160869a40c36258bb01a14920d535 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Thu, 17 Oct 2024 21:13:42 -0700 Subject: [PATCH] Fix some bugs --- init.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/init.el b/init.el index 15a7eaa..40c61a8 100644 --- a/init.el +++ b/init.el @@ -408,7 +408,9 @@ directory. Otherwise, run `find-file' on that file." (evil-define-key '(normal visual motion) proced-mode-map "u" #'proced-unmark) (evil-define-key '(normal visual motion) dired-mode-map - "u" #'dired-unmark)) + "u" #'dired-unmark) + (evil-define-key '(normal visual motion) profiler-report-mode-map + (kbd "TAB") #'profiler-report-toggle-entry)) (use-package evil-collection :after evil :diminish evil-collection-unimpaired-mode @@ -478,7 +480,11 @@ With NO-EDGE, return nil if beg or end fall on the edge of the range." (wrong-type-argument nil)))) (defun my/-evil-cp-region-ok-p-no-string (oldfun beg end) (or - (my/range-inside-thing-p 'string beg end t) + (and (sp-point-in-comment beg) + (sp-point-in-comment end)) + (and (sp-point-in-string beg) + (sp-point-in-string end) + (my/range-inside-thing-p 'string beg end t)) (funcall oldfun beg end))) (defun my/column-num-at-pos (pos) "Return the column number at POS." @@ -488,7 +494,6 @@ With NO-EDGE, return nil if beg or end fall on the edge of the range." (defun my/-evil-cp-block-ok-p-no-string (oldfun beg end) (when (> beg end) (cl-rotatef beg end)) (or - (funcall oldfun beg end) (save-excursion (goto-char beg) (let ((start-off (current-column)) @@ -499,7 +504,8 @@ With NO-EDGE, return nil if beg or end fall on the edge of the range." (unless (sp-region-ok-p (+ bol start-off) (+ bol end-off)) (cl-return)) - (forward-line)))))))) + (forward-line)))))) + (funcall oldfun beg end))) (advice-add 'sp-region-ok-p :around 'my/-evil-cp-region-ok-p-no-string) (advice-add 'evil-cp--balanced-block-p :around 'my/-evil-cp-block-ok-p-no-string))