Skip to content

Commit

Permalink
Add placeholder text for modules and sources
Browse files Browse the repository at this point in the history
  • Loading branch information
svaante committed Nov 27, 2024
1 parent 80d6a9a commit 8a9f5ae
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions dape.el
Original file line number Diff line number Diff line change
Expand Up @@ -3975,7 +3975,8 @@ current buffer with CONN config."
;;; Info modules buffer

(defvar dape--info-modules-font-lock-keywords
'(("^\\([^ ]+\\) " (1 font-lock-function-name-face)))
'(("^No" (1 default)) ;; Skip fontification of placeholder string
("^\\([^ ]+\\) " (1 font-lock-function-name-face)))
"Font lock keywords used in `gdb-frames-mode'.")

(dape--command-at-line dape-info-modules-goto (dape--info-module)
Expand All @@ -3993,18 +3994,20 @@ current buffer with CONN config."
(define-derived-mode dape-info-modules-mode dape-info-parent-mode "Modules"
"Major mode for Dape info modules."
:interactive nil
(setq font-lock-defaults '(dape--info-modules-font-lock-keywords)))
(setq font-lock-defaults '(dape--info-modules-font-lock-keywords))
(dape--info-update-with
(insert "No modules available.")))

(cl-defmethod dape--info-revert (&context (major-mode (eql dape-info-modules-mode))
&optional _ignore-auto _noconfirm _preserve-modes)
"Revert buffer function for MAJOR-MODE `dape-info-modules-mode'."
(dape--info-update-with
;; Use last connection if current is dead
(when-let ((conn (or (dape--live-connection 'stopped t)
(dape--live-connection 'last t)
dape--connection)))
(cl-loop with modules = (dape--modules conn)
with table = (make-gdb-table)
;; Use last connection if current is dead
(when-let* ((conn (or (dape--live-connection 'stopped t)
(dape--live-connection 'last t)
dape--connection))
(modules (dape--modules conn)))
(dape--info-update-with
(cl-loop with table = (make-gdb-table)
for module in (reverse modules) do
(gdb-table-add-row
table
Expand Down Expand Up @@ -4041,18 +4044,20 @@ current buffer with CONN config."

(define-derived-mode dape-info-sources-mode dape-info-parent-mode "Sources"
"Major mode for Dape info sources."
:interactive nil)
:interactive nil
(dape--info-update-with
(insert "No sources available.")))

(cl-defmethod dape--info-revert (&context (major-mode (eql dape-info-sources-mode))
&optional _ignore-auto _noconfirm _preserve-modes)
"Revert buffer function for MAJOR-MODE `dape-info-sources-mode'."
(dape--info-update-with
;; Use last connection if current is dead
(when-let ((conn (or (dape--live-connection 'stopped t)
(dape--live-connection 'last t)
dape--connection)))
(cl-loop with sources = (dape--sources conn)
with table = (make-gdb-table)
;; Use last connection if current is dead
(when-let* ((conn (or (dape--live-connection 'stopped t)
(dape--live-connection 'last t)
dape--connection))
(sources (dape--sources conn)))
(dape--info-update-with
(cl-loop with table = (make-gdb-table)
for source in (reverse sources) do
(gdb-table-add-row
table (list (concat (plist-get source :name) " "))
Expand Down

0 comments on commit 8a9f5ae

Please sign in to comment.