From 0fd7f785e76c9f2eea1baa40aed6ee327f68a993 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerd=20M=C3=B6llmann?= Date: Thu, 19 Oct 2023 11:27:14 +0200 Subject: [PATCH] Gud support for column numbers Allow gud-last-frame to be of the form (FILE LINE COLUMN). * lisp/progmodes/gud.el (gud-display-frame): Support column numbers. (gud-display-line): New optional parameter for column number. Move point to that column, if set. (gud-lldb-marker-filter): Set column number. --- lisp/progmodes/gud.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 5bc333c6730..805e7a1b7a4 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -3021,7 +3021,12 @@ Obeying it means displaying in another window the specified file and line." (interactive) (when gud-last-frame (gud-set-buffer) - (gud-display-line (car gud-last-frame) (cdr gud-last-frame)) + ;; Support either (file . line) or (file line column). + (if (consp (cdr gud-last-frame)) + (let ((line (cadr gud-last-frame)) + (column (caddr gud-last-frame))) + (gud-display-line (car gud-last-frame) line column)) + (gud-display-line (car gud-last-frame) (cdr gud-last-frame))) (setq gud-last-last-frame gud-last-frame gud-last-frame nil))) @@ -3054,7 +3059,7 @@ line, until it is displaced by subsequent cursor motion." "Face for highlighting the source code line being executed." :version "30.1") -(defun gud-display-line (true-file line) +(defun gud-display-line (true-file line &optional column) (let* ((last-nonmenu-event t) ; Prevent use of dialog box for questions. (buffer (with-current-buffer gud-comint-buffer @@ -3080,6 +3085,8 @@ line, until it is displaced by subsequent cursor motion." (goto-char (point-min)) (forward-line (1- line)) (setq pos (point)) + (when column + (forward-char (1- column))) (or gud-overlay-arrow-position (setq gud-overlay-arrow-position (make-marker))) (set-marker gud-overlay-arrow-position (point) (current-buffer)) @@ -3859,8 +3866,8 @@ so they have been disabled.")) "Default command to run an executable under LLDB." :type 'string) -(cl-defun gud-lldb-stop (&key file line _column) - (setq gud-last-frame (cons file line))) +(cl-defun gud-lldb-stop (&key file line column) + (setq gud-last-frame (list file line column))) (defun gud-lldb-marker-filter (string) "Deduce interesting stuff from process output STRING." -- 2.39.2