emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/realgud 1cfadb2 123/140: Lots of small changes...


From: Rocky Bernstein
Subject: [elpa] externals/realgud 1cfadb2 123/140: Lots of small changes...
Date: Sat, 25 May 2019 19:35:48 -0400 (EDT)

branch: externals/realgud
commit 1cfadb278bd80a30eb77821ee00a67a99d46cf84
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    Lots of small changes...
    
    Add completing read of debugger breakpoint numbers
    *Describe*  -> *Describe Debugger Session*
    Command hash key underscores are now dashes
---
 realgud/common/buffer/backtrace.el |   4 +-
 realgud/common/buffer/command.el   |   6 +--
 realgud/common/buffer/helper.el    |   2 +-
 realgud/common/cmds.el             | 100 ++++++++++++++++++++++---------------
 realgud/common/loc.el              |   8 +--
 realgud/common/lochist.el          |   6 +--
 6 files changed, 74 insertions(+), 52 deletions(-)

diff --git a/realgud/common/buffer/backtrace.el 
b/realgud/common/buffer/backtrace.el
index 0a7908f..ef05b1d 100644
--- a/realgud/common/buffer/backtrace.el
+++ b/realgud/common/buffer/backtrace.el
@@ -2,7 +2,7 @@
 
 ;; Author: Rocky Bernstein <address@hidden>
 
-;; Copyright (C) 2015-2017 Free Software Foundation, Inc
+;; Copyright (C) 2015-2017, 2019 Free Software Foundation, Inc
 
 ;; This program is free software: you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
@@ -83,7 +83,7 @@
          (frame)
          (loc)
          (i 0))
-      (switch-to-buffer (get-buffer-create "*Describe*"))
+      (switch-to-buffer (get-buffer-create "*Describe Backtrace*"))
       (while (and (< i (ring-length frames)) (setq frame (ring-ref frames i)))
        (insert (format "*** %d\n" i))
        (insert (format "%s\n" frame))
diff --git a/realgud/common/buffer/command.el b/realgud/common/buffer/command.el
index 31d3767..2cd7cfe 100644
--- a/realgud/common/buffer/command.el
+++ b/realgud/common/buffer/command.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc
 ;; Author: Rocky Bernstein <address@hidden>
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -247,7 +247,7 @@
   "Display realgud-cmdcbuf-info fields of BUFFER.
 BUFFER is either a debugger command or source buffer. If BUFFER is not given
 the current buffer is used as a starting point.
-Information is put in an internal buffer called *Describe*."
+Information is put in an internal buffer called *Describe Debugger Session*."
   (interactive "")
   (setq buffer (realgud-get-cmdbuf buffer))
   (if buffer
@@ -256,7 +256,7 @@ Information is put in an internal buffer called *Describe*."
              (cmdbuf-name (buffer-name)))
          (if info
              (progn
-               (switch-to-buffer (get-buffer-create "*Describe*"))
+               (switch-to-buffer (get-buffer-create "*Describe Debugger 
Session*"))
                (setq buffer-read-only 'nil)
                (delete-region (point-min) (point-max))
                ;;(insert "#+OPTIONS:    H:2 num:nil toc:t \\n:nil ::t |:t 
^:nil -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc\n")
diff --git a/realgud/common/buffer/helper.el b/realgud/common/buffer/helper.el
index 97e73da..b30f8ad 100644
--- a/realgud/common/buffer/helper.el
+++ b/realgud/common/buffer/helper.el
@@ -154,7 +154,7 @@ use to get the information from.
              (a2 realgud-overlay-arrow2)
              (a3 realgud-overlay-arrow3)
              )
-         (switch-to-buffer (get-buffer-create "*Describe*"))
+         (switch-to-buffer (get-buffer-create "*Describe Debugger Session*"))
          (delete-region (point-min) (point-max))
          (mapc 'insert
                (list
diff --git a/realgud/common/cmds.el b/realgud/common/cmds.el
index a46f3bc..776225e 100644
--- a/realgud/common/cmds.el
+++ b/realgud/common/cmds.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015-2017 Free Software Foundation, Inc
+;; Copyright (C) 2015-2017, 2019 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -87,37 +87,43 @@ with other motion initiated by debugger messages."
 
 (defconst realgud-cmd:default-hash
   (let ((hash (make-hash-table :test 'equal)))
-    (puthash "backtrace"   "backtrace" hash)
-    (puthash "break"       "break %X:%l" hash)
-    (puthash "break_fn"    "break %s" hash)
-    (puthash "clear"       "clear %l" hash)
-    (puthash "continue"    "continue" hash)
-    (puthash "delete"      "delete %p" hash)
-    (puthash "delete_all"  "delete" hash)
-    (puthash "disable"     "disable %p" hash)
-    (puthash "disable_all" "disable" hash)
-    (puthash "down"        "down %p" hash)
-    (puthash "enable"      "enable %p" hash)
-    (puthash "enable_all"  "enable" hash)
-    (puthash "eval"        "eval %s" hash)
-    (puthash "finish"      "finish" hash)
-    (puthash "frame"       "frame %p" hash)
-    (puthash "help"        "help" hash)
-    (puthash "jump"        "jump %l" hash)
-    (puthash "kill"        "kill" hash)
-    (puthash "next"        "next %p" hash)
-    (puthash "repeat-last" "\n" hash)
-    (puthash "restart"     "run" hash)
-    (puthash "shell"       "shell" hash)
-    (puthash "step"        "step %p" hash)
-    (puthash "tbreak"      "tbreak %X:%l" hash)
-    (puthash "until"       "until" hash)
-    (puthash "until-here"  "until %l" hash)    
-    (puthash "up"          "up %p" hash)
+    (puthash "backtrace"         "backtrace" hash)
+    (puthash "break"             "break %X:%l" hash)
+    (puthash "break-fn"          "break %s" hash)
+    (puthash "clear"             "clear %l" hash)
+    (puthash "continue"          "continue" hash)
+    (puthash "delete"            "delete %p" hash)
+    (puthash "delete-all"        "delete" hash)
+    (puthash "disable"           "disable %p" hash)
+    (puthash "disable-all"       "disable" hash)
+    (puthash "down"              "down %p" hash)
+    (puthash "enable"            "enable %p" hash)
+    (puthash "enable-all"        "enable" hash)
+    (puthash "eval"              "eval %s" hash)
+    (puthash "finish"            "finish" hash)
+    (puthash "frame"             "frame %p" hash)
+    (puthash "help"              "help" hash)
+    (puthash "info-breakpoints"  "info break" hash)
+    (puthash "jump"              "jump %l" hash)
+    (puthash "kill"              "kill" hash)
+    (puthash "next"              "next %p" hash)
+    (puthash "repeat-last"       "\n" hash)
+    (puthash "restart"           "run" hash)
+    (puthash "shell"             "shell" hash)
+    (puthash "step"              "step %p" hash)
+    (puthash "tbreak"            "tbreak %X:%l" hash)
+    (puthash "until"             "until" hash)
+    (puthash "until-here"        "until %l" hash)
+    (puthash "up"                "up %p" hash)
     hash)
   "Default hash of command name → debugger command.
 This is used as a fallback when the debugger-specific command
-hash does not specify a custom debugger command.")
+hash does not specify a custom debugger command. The keys of the
+hash contain all the debugger commands we know about.
+
+If a value is *not-implemented*, then this command is not available
+in a particular debugger.
+")
 
 (defun realgud:cmd-run-command(arg cmd-name &optional
                                    default-cmd-template no-record?
@@ -190,7 +196,7 @@ With prefix argument LINE-NUMBER, prompt for line number."
                                    (realgud:cmd-run-command line-number 
"tbreak")))
 
 (defun realgud:cmd-until-here (&optional line-number)
-  "Continue until the current line. 
+  "Continue until the current line.
 With prefix argument LINE-NUMBER, prompt for line number."
   (interactive (realgud:cmd--line-number-from-prefix-arg))
   (realgud:cmd--with-line-override line-number
@@ -221,24 +227,40 @@ running."
                    "Continue to next breakpoint?"))
       (realgud:cmd-run-command arg "continue")))
 
+(defun realgud-get-bp-list()
+  "Return breakpoint numbers as a list of strings. This can be used for
+example in a completing read."
+  (with-current-buffer (realgud-get-cmdbuf)
+    ;; Remove duplicates doesn't seem to work on strings so
+    ;; we need a separate mapcar outside to stringify
+    ;; Also note that lldb breakpoint numbers can be dotted like
+    ;; 5.1.
+    (mapcar (lambda (num) (format "%s" num))
+           (remove-duplicates
+            (mapcar (lambda(loc) (realgud-loc-num loc))
+                    (realgud-cmdbuf-info-bp-list realgud-cmdbuf-info))))))
+
 (defun realgud:bpnum-on-current-line()
   "Return number of one breakpoint on current line, if any.
 If none is found, return nil."
   (realgud-get-bpnum-from-line-num (line-number-at-pos)))
 
-(defun realgud:bpnum-from-prefix-arg()
+(defun realgud:bpnum-from-prefix-arg(action-verb)
   "Return number of one breakpoint on current line, if any.
 If none is found, or if `current-prefix-arg' is a cons (i.e. a
 C-u prefix arg), ask user for a breakpoint number.  If
 `current-prefix-arg' is a number (i.e. a numeric prefix arg),
 return it unmodified."
   (let ((must-prompt (consp current-prefix-arg))
+       (cmd-buffer (realgud-get-cmdbuf))
         (current-bp (realgud:bpnum-on-current-line)))
-    (list
-     (if (numberp current-prefix-arg)
-         current-prefix-arg
-       (or (and (not must-prompt) current-bp)
-           (read-number "Breakpoint number: " current-bp))))))
+      (list
+       (if (numberp current-prefix-arg)
+          current-prefix-arg
+        (or (and (not must-prompt) current-bp)
+            (string-to-number (completing-read (format "%s breakpoint number: 
" action-verb)
+                             (realgud-get-bp-list)
+                             nil nil current-bp)))))))
 
 (defun realgud:cmd-delete(bpnum)
     "Delete breakpoint by number.
@@ -246,7 +268,7 @@ Interactively, find breakpoint on current line, if any.  
With
 numeric prefix argument, delete breakpoint with that number
 instead.  With prefix argument (C-u), or when no breakpoint can
 be found on the current line, prompt for a breakpoint number."
-    (interactive (realgud:bpnum-from-prefix-arg))
+    (interactive (realgud:bpnum-from-prefix-arg "Delete"))
     (realgud:cmd-run-command bpnum "delete"))
 
 (defun realgud:cmd-disable(bpnum)
@@ -255,7 +277,7 @@ Interactively, find breakpoint on current line, if any.  
With
 numeric prefix argument, disable breakpoint with that number
 instead.  With prefix argument (C-u), or when no breakpoint can
 be found on the current line, prompt for a breakpoint number."
-    (interactive (realgud:bpnum-from-prefix-arg))
+    (interactive (realgud:bpnum-from-prefix-arg "Disable"))
     (realgud:cmd-run-command bpnum "disable"))
 
 (defun realgud:cmd-enable(bpnum)
@@ -264,7 +286,7 @@ Interactively, find breakpoint on current line, if any.  
With
 numeric prefix argument, enable breakpoint with that number
 instead.  With prefix argument (C-u), or when no breakpoint can
 be found on the current line, prompt for a breakpoint number."
-    (interactive (realgud:bpnum-from-prefix-arg))
+    (interactive (realgud:bpnum-from-prefix-arg "Enable"))
     (realgud:cmd-run-command bpnum "enable"))
 
 (defun realgud-cmds--add-remove-bp (pos)
diff --git a/realgud/common/loc.el b/realgud/common/loc.el
index f90436f..d42c509 100644
--- a/realgud/common/loc.el
+++ b/realgud/common/loc.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015-2017 Free Software Foundation, Inc
+;; Copyright (C) 2015-2017, 2019 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -59,14 +59,14 @@ without buffer properties."
 
 (defun realgud:loc-describe (loc)
   "Display realgud-cmdcbuf-info.
-Information is put in an internal buffer called *Describe*."
+Information is put in an internal buffer called *Describe Debugger Session*."
   (interactive "")
-  (switch-to-buffer (get-buffer-create "*Describe*"))
+  (switch-to-buffer (get-buffer-create "*Describe Debugger Session*"))
   (realgud:org-mode-append-loc loc))
 
 (defun realgud:org-mode-append-loc (loc)
   "Display realgud-cmdcbuf-info.
-Information is put in an internal buffer called *Describe*."
+Information is put in an internal buffer called *Describe Debugger Session*."
   (let ((column-number (realgud-loc-column-number loc))
        (bp-num (realgud-loc-num loc))
        (source-text (realgud-loc-source-text loc))
diff --git a/realgud/common/lochist.el b/realgud/common/lochist.el
index 088589f..38c2665 100644
--- a/realgud/common/lochist.el
+++ b/realgud/common/lochist.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2010, 2012, 2014-2016 Free Software Foundation, Inc
+;; Copyright (C) 2010, 2012, 2014-2016, 2019 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -39,8 +39,8 @@
   (ring (make-ring realgud-loc-hist-size)))
 
 (defun realgud:loc-hist-describe(loc-hist)
-  "Format LOC-HIST values inside buffer *Describe*"
-  (switch-to-buffer (get-buffer-create "*Describe*"))
+  "Format LOC-HIST values inside buffer *Describe Debugger Session*"
+  (switch-to-buffer (get-buffer-create "*Describe Debugger Session*"))
   (org-mode)
   (insert "** Source Positions Stopped at (loc-hist)\n")
   (mapc 'insert



reply via email to

[Prev in Thread] Current Thread [Next in Thread]