diff --git a/init.el b/init.el index a2d4e6b..6fc9592 100644 --- a/init.el +++ b/init.el @@ -492,6 +492,83 @@ visual states." "--header-insertion=never" "--pch-storage=memory" "--malloc-trim" "--function-arg-placeholders")))) +;; gud +(use-package gud + :demand t + :ensure nil + :after (project evil) + :bind (:map project-prefix-map + ("U" . my/project-gdb)) + :init + (setq gdb-debuginfod-enable-setting t) + (defvar my/project-gdb-command nil + "Command to use in `my/project-gdb'.") + (put 'my/project-gdb-command 'safe-local-variable (lambda (val) + (stringp val))) + (defun my/project-gdb (project command-line) + "Run gdb in the project root" + (interactive (let* ((project (project-current t)) + (default-directory (project-root project)) + (gud-gdb-history + (if my/project-gdb-command + (cons my/project-gdb-command gud-gdb-history) + gud-gdb-history))) + (list project (gud-query-cmdline 'gdb)))) + (let ((default-directory (project-root project))) + (gdb command-line))) + (evil-set-initial-state 'gdb-locals-mode 'motion) + (evil-collection-inhibit-insert-state 'gdb-locals-mode-map) + (evil-define-key '(normal motion visual) gdb-locals-mode-map + (kbd "TAB") (keymap-lookup gdb-locals-mode-map "TAB") + (kbd "RET") #'gdb-edit-locals-value + (kbd "") #'gdb-edit-locals-value + "q" #'kill-current-buffer) + (evil-set-initial-state 'gdb-registers-mode 'motion) + (evil-collection-inhibit-insert-state 'gdb-registers-mode-map) + (evil-define-key '(normal motion visual) gdb-registers-mode-map + (kbd "TAB") (keymap-lookup gdb-registers-mode-map "TAB") + (kbd "RET") #'gdb-edit-register-value + (kbd "") #'gdb-edit-register-value + "q" #'kill-current-buffer + (kbd "C-c f") #'gdb-registers-toggle-filter + (kbd "C-c F") (lambda () + "Customize the filter for the registers buffer." + (interactive) + (customize-option-other-window + 'gdb-registers-filter-pattern-list))) + (evil-set-initial-state 'gdb-frames-mode 'motion) + (evil-collection-inhibit-insert-state 'gdb-frames-mode-map) + (evil-define-key '(normal motion visual) gdb-frames-mode-map + "q" #'kill-current-buffer + (kbd "RET") #'gdb-select-frame) + (evil-set-initial-state 'gdb-breakpoints-mode 'motion) + (evil-collection-inhibit-insert-state 'gdb-breakpoints-mode-map) + (evil-define-key '(normal motion visual) gdb-breakpoints-mode-map + (kbd "TAB") (keymap-lookup gdb-breakpoints-mode-map "TAB") + "q" #'gdb-delete-frame-or-window + "D" #'gdb-delete-breakpoint + (kbd "RET") #'gdb-goto-breakpoint + (kbd "") #'gdb-goto-breakpoint + (kbd "SPC") #'gdb-toggle-breakpoint) + (evil-set-initial-state 'gdb-threads-mode 'motion) + (evil-collection-inhibit-insert-state 'gdb-threads-mode-map) + (evil-define-key '(normal motion visual) gdb-threads-mode-map + (kbd "TAB") (keymap-lookup gdb-threads-mode-map "TAB") + "q" #'gdb-delete-frame-or-window + "D" #'gdb-frame-disassembly-for-thread + (kbd "C-c f") #'gdb-display-stack-for-thread + (kbd "C-c i") #'gdb-interrupt-thread + (kbd "C-c l") #'gdb-display-locals-for-thread + (kbd "C-c r") #'gdb-display-registers-for-thread + (kbd "C-c c") #'gdb-continue-thread + (kbd "C-c d") #'gdb-display-disassembly-for-thread + (kbd "C-c s") #'gdb-step-thread + (kbd "C-c F") #'gdb-frame-stack-for-thread + (kbd "C-c L") #'gdb-frame-locals-for-thread + (kbd "C-c R") #'gdb-frame-registers-for-thread + (kbd "RET") #'gdb-select-thread + (kbd "") #'gdb-select-thread)) + ;; dumb-jump (use-package dumb-jump :init @@ -1154,7 +1231,8 @@ If no name is given, list all bookmarks instead." ;; helpful (use-package helpful - :hook (emacs-lisp-mode . my/-helpful-setup-emacs-lisp-mode) + :hook ((emacs-lisp-mode . my/-helpful-setup-emacs-lisp-mode) + (helpful-mode . my/-setup-helpful-mode)) :bind (:map help-map ("f" . helpful-callable) ("v" . helpful-variable) @@ -1167,6 +1245,8 @@ If no name is given, list all bookmarks instead." :init (defun my/-helpful-setup-emacs-lisp-mode () (setq-local evil-lookup-func #'helpful-at-point)) + (defun my/-setup-helpful-mode () + (setq-local evil-lookup-func #'helpful-at-point)) (defvar my/helpful-symbol-history-size 20 "Max size of `my/helpful-symbol-history'.") (defvar my/helpful-symbol-history '()