Skip to content

Commit

Permalink
fix: apply Evil-specific tweaks only when Evil is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed May 15, 2024
1 parent 0452e5c commit 96d917d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions modules/extras/me-realgud.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

;;; Code:

;;;###autoload(autoload '+realgud:start "../modules/extras/me-realgud" "Start the RealGUD debugger suitable for the current mode." t)
(evil-define-command +realgud:start (&optional path)
;;;###autoload
(defun +realgud:start (&optional path)
"Start the RealGUD debugger suitable for the current mode."
(interactive "<f>")
(interactive (list (when evil-called-from-ex-p (evil-ex-file-arg)))) ;; <=> `evil-define-command' with (interactive "<f>")
(let ((default-directory
(or (and (project-current) (project-root (project-current)))
(and (fboundp 'projectile-project-root) (projectile-project-root))
Expand All @@ -38,12 +38,16 @@
(_ (user-error "No shell debugger for %s" sh-shell))))
(_ (user-error "No debugger for %s" major-mode)))))

;;;###autoload(autoload '+realgud:toggle-breakpoint "../modules/extras/me-realgud" "Toggle break point." t)
(evil-define-command +realgud:toggle-breakpoint (&optional bang)
;;;###autoload
(defun +realgud:toggle-breakpoint (&optional bang)
"Toggle break point."
(interactive "<!>")
(interactive (list evil-ex-bang)) ;; <=> `evil-define-command' with (interactive "<!>")
(call-interactively (if bang #'realgud:cmd-clear #'realgud:cmd-break)))

(with-eval-after-load 'evil
(evil-set-command-properties +realgud:start '(:ex-arg file))
(evil-set-command-properties +realgud:toggle-breakpoint '(:ex-arg t)))

;; Add some missing gdb/rr commands
(defun +realgud:cmd-run (arg)
"Run."
Expand Down
2 changes: 1 addition & 1 deletion modules/me-vc.el
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
(git-commit-summary-max-length 72) ; defaults to Github's max commit message length
(git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line))
:config
(evil-set-initial-state 'git-commit-mode 'insert)
(with-eval-after-load 'evil (evil-set-initial-state 'git-commit-mode 'insert))
(global-git-commit-mode 1))

(use-package git-modes
Expand Down

0 comments on commit 96d917d

Please sign in to comment.