Fix some bugs

This commit is contained in:
Alexander Rosenberg 2024-10-17 21:13:42 -07:00
parent a0e268b1a9
commit 003bc783d7
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

14
init.el
View File

@ -408,7 +408,9 @@ directory. Otherwise, run `find-file' on that file."
(evil-define-key '(normal visual motion) proced-mode-map (evil-define-key '(normal visual motion) proced-mode-map
"u" #'proced-unmark) "u" #'proced-unmark)
(evil-define-key '(normal visual motion) dired-mode-map (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 (use-package evil-collection
:after evil :after evil
:diminish evil-collection-unimpaired-mode :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)))) (wrong-type-argument nil))))
(defun my/-evil-cp-region-ok-p-no-string (oldfun beg end) (defun my/-evil-cp-region-ok-p-no-string (oldfun beg end)
(or (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))) (funcall oldfun beg end)))
(defun my/column-num-at-pos (pos) (defun my/column-num-at-pos (pos)
"Return the column number at 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) (defun my/-evil-cp-block-ok-p-no-string (oldfun beg end)
(when (> beg end) (cl-rotatef beg end)) (when (> beg end) (cl-rotatef beg end))
(or (or
(funcall oldfun beg end)
(save-excursion (save-excursion
(goto-char beg) (goto-char beg)
(let ((start-off (current-column)) (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) (unless (sp-region-ok-p (+ bol start-off)
(+ bol end-off)) (+ bol end-off))
(cl-return)) (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 '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)) (advice-add 'evil-cp--balanced-block-p :around 'my/-evil-cp-block-ok-p-no-string))