]> git.eshelyaron.com Git - emacs.git/commitdiff
Stop highlighting current line when debuggee is running
authorDiancheng Wang <diancheng_wang@163.com>
Tue, 8 Oct 2024 03:11:24 +0000 (11:11 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 14 Oct 2024 17:39:43 +0000 (19:39 +0200)
* lisp/progmodes/gud.el (gud-hide-current-line-indicator): New
function.
(gud-sentinel):
* lisp/progmodes/gdb-mi.el (gdb-starting): Use it.  (Bug#73687)

(cherry picked from commit bd5d84e5d3311e7ab4a7d0091d6c98365927d17a)

lisp/progmodes/gdb-mi.el
lisp/progmodes/gud.el

index 2981965ee0cb774dd4baa822af81700687b28cb3..6a9735fbc2515e457ee52323fe58d751e23c9cad 100644 (file)
@@ -2699,7 +2699,8 @@ Sets `gdb-thread-number' to new id."
   (gdb-force-mode-line-update
    (propertize gdb-inferior-status 'face font-lock-type-face))
   (setq gdb-active-process t)
-  (setq gud-running t))
+  (setq gud-running t)
+  (gud-hide-current-line-indicator nil))
 
 ;; -break-insert -t didn't give a reason before gdb 6.9
 
index 53a7d78328c8e8fd6a504328465e3848d056966c..a4e611277e487463da57ec6c02b02056d574f522 100644 (file)
@@ -2949,11 +2949,19 @@ It is saved for when this flag is not set.")
   "Overlay created for `gud-highlight-current-line'.
 It is nil if not yet present.")
 
+(defun gud-hide-current-line-indicator(destroy-overlay)
+  "Stop displaying arrow and highlighting current line in a source file."
+  ;; Stop displaying an arrow in a source file.
+  (setq gud-overlay-arrow-position nil)
+  ;; And any highlight overlays.
+  (when gud-highlight-current-line-overlay
+    (delete-overlay gud-highlight-current-line-overlay)
+    (if destroy-overlay
+    (setq gud-highlight-current-line-overlay nil))))
+
 (defun gud-sentinel (proc msg)
   (cond ((null (buffer-name (process-buffer proc)))
         ;; buffer killed
-        ;; Stop displaying an arrow in a source file.
-        (setq gud-overlay-arrow-position nil)
         (set-process-buffer proc nil)
         (if (and (boundp 'speedbar-initial-expansion-list-name)
                  (string-equal speedbar-initial-expansion-list-name "GUD"))
@@ -2963,12 +2971,9 @@ It is nil if not yet present.")
             (gdb-reset)
           (gud-reset)))
        ((memq (process-status proc) '(signal exit))
-        ;; Stop displaying an arrow in a source file.
-        (setq gud-overlay-arrow-position nil)
-         ;; And any highlight overlays.
-         (when gud-highlight-current-line-overlay
-           (delete-overlay gud-highlight-current-line-overlay)
-           (setq gud-highlight-current-line-overlay nil))
+
+         (gud-hide-current-line-indicator t)
+
         (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
                   'gdbmi)
             (gdb-reset)