branch: externals/realgud
commit 50edd7c33d2dd97839af1b3c71ba39a131f31d39
Author: rocky <[email protected]>
Commit: rocky <[email protected]>

    Try elisp-autofmt
---
 realgud.el             |  70 ++++++-----
 realgud/common/file.el | 336 +++++++++++++++++++++++++++----------------------
 realgud/common/loc.el  | 218 ++++++++++++++++----------------
 3 files changed, 335 insertions(+), 289 deletions(-)

diff --git a/realgud.el b/realgud.el
index 27f11ee5cf..0d7932088f 100644
--- a/realgud.el
+++ b/realgud.el
@@ -87,11 +87,10 @@
   :version "27.1")
 
 ;; FIXME: extend require-relative for "autoload".
-(defun realgud:load-features()
+(defun realgud:load-features ()
   (progn
     (require-relative-list
-     '(
-       "./realgud/common/attach"
+     '("./realgud/common/attach"
        "./realgud/common/track-mode"
        "./realgud/common/backtrack-mode"
        "./realgud/common/breakpoint-mode"
@@ -110,54 +109,54 @@
        "./realgud/debugger/trepan.pl/trepanpl"
        "./realgud/debugger/trepan2/trepan2"
        "./realgud/debugger/trepan3k/trepan3k"
-       "./realgud/debugger/zshdb/zshdb"
-       ) "realgud-")
+       "./realgud/debugger/zshdb/zshdb")
+     "realgud-")
     (require-relative-list
-     '(
-       "./realgud/lang/java"
+     '("./realgud/lang/java"
        "./realgud/lang/js"
        "./realgud/lang/perl"
        "./realgud/lang/posix-shell"
        "./realgud/lang/python"
-       "./realgud/lang/ruby"
-       ) "realgud-lang-")
-    (realgud:loaded-features)
-    )
-  )
+       "./realgud/lang/ruby")
+     "realgud-lang-")
+    (realgud:loaded-features)))
 
 (load-relative "./realgud/common/custom")
 (load-relative "./realgud/lang/java")
 
-(defun realgud-feature-starts-with(feature prefix)
+(defun realgud-feature-starts-with (feature prefix)
   "realgud-strings-starts-with on stringified FEATURE and PREFIX."
   (declare (indent 1))
-  (string-prefix-p (symbol-name feature) prefix)
-  )
+  (string-prefix-p (symbol-name feature) prefix))
 
-(defun realgud:loaded-features()
+(defun realgud:loaded-features ()
   "Return a list of loaded debugger features. These are the features
 that start with \"realgud-\" and \"realgud:\""
 
-  (delq nil
-               (mapcar (lambda (x) (and (string-match-p 
"^\\(realgud:\\|realgud-\\)" (symbol-name x)) x))
-                               features)))
+  (delq
+   nil
+   (mapcar
+    (lambda (x)
+      (and (string-match-p
+            "^\\(realgud:\\|realgud-\\)" (symbol-name x))
+           x))
+    features)))
 
-(defun realgud:unload-features()
+(defun realgud:unload-features ()
   "Remove all features loaded from this package. Used in
 `realgud:reload-features'. See that."
   (let ((removal-set (realgud:loaded-features)))
-       (dolist (feature removal-set)
-         (unload-feature feature t))
-       removal-set)) ; return removed set
+    (dolist (feature removal-set)
+      (unload-feature feature t))
+    removal-set)) ; return removed set
 
-(defun realgud:reload-features()
+(defun realgud:reload-features ()
   "Reload all features loaded from this package. Useful if have
 changed some code or want to reload another version, say a newer
 development version and you already have this package loaded."
   (interactive "")
   (realgud:unload-features)
-  (realgud:load-features)
-  )
+  (realgud:load-features))
 
 ;; Load everything.
 (realgud:load-features)
@@ -171,13 +170,15 @@ development version and you already have this package 
loaded."
 ;; autoloded form.
 
 ;;;###autoload
-(defconst realgud--recursive-autoloads-file-name 
"realgud-recursive-autoloads.el"
+(defconst realgud--recursive-autoloads-file-name
+  "realgud-recursive-autoloads.el"
   "Where to store autoloads for subdirectory contents.")
 
 ;;;###autoload
 (defconst realgud--recursive-autoloads-base-directory
   (file-name-directory
-   (if load-in-progress load-file-name
+   (if load-in-progress
+       load-file-name
      buffer-file-name)))
 
 ;;;###autoload
@@ -195,13 +196,16 @@ autoloaded form.  Maintainers should run this after adding
 autoloaded functions, and commit the resulting changes."
   (interactive)
   (let ((generated-autoload-file
-         (expand-file-name realgud--recursive-autoloads-file-name
-                           realgud--recursive-autoloads-base-directory)))
+         (expand-file-name
+          realgud--recursive-autoloads-file-name
+          realgud--recursive-autoloads-base-directory)))
     (when (file-exists-p generated-autoload-file)
       (delete-file generated-autoload-file))
-    (dolist (name (with-no-warnings
-                    (directory-files-recursively
-                     realgud--recursive-autoloads-base-directory "" t)))
+    (dolist (name
+             (with-no-warnings
+               (directory-files-recursively
+                realgud--recursive-autoloads-base-directory ""
+                t)))
       (when (file-directory-p name)
         (update-directory-autoloads name)))))
 
diff --git a/realgud/common/file.el b/realgud/common/file.el
index 1e8dd112ac..c1a363e0cd 100644
--- a/realgud/common/file.el
+++ b/realgud/common/file.el
@@ -18,60 +18,75 @@
 (require-relative-list '("helper" "loc") "realgud-")
 (require-relative-list '("buffer/command") "realgud-buffer-")
 
-(declare-function realgud:strip         'realgud)
-(declare-function realgud-loc-goto      'realgud-loc)
-(declare-function realgud-get-cmdbuf    'realgud-buffer-helper)
-(declare-function buffer-killed?        'helper)
+(declare-function realgud:strip 'realgud)
+(declare-function realgud-loc-goto 'realgud-loc)
+(declare-function realgud-get-cmdbuf 'realgud-buffer-helper)
+(declare-function buffer-killed? 'helper)
 (declare-function compilation-find-file 'compile)
-(declare-function realgud-cmdbuf-info-ignore-re-file-list  
'realgud-buffer-command)
-(declare-function realgud-cmdbuf-info-source-path=         
'realgud-buffer-command)
-(declare-function realgud-cmdbuf-mutex                     
'realgud-buffer-command)
-(declare-function realgud-cmdbuf-filename-remap-alist      
'realgud-buffer-command)
-(declare-function realgud-cmdbuf-filename-remap-alist=     
'realgud-buffer-command)
-(declare-function realgud-cmdbuf-mutex                     
'realgud-buffer-command)
+(declare-function realgud-cmdbuf-info-ignore-re-file-list
+                  'realgud-buffer-command)
+(declare-function realgud-cmdbuf-info-source-path=
+                  'realgud-buffer-command)
+(declare-function realgud-cmdbuf-mutex 'realgud-buffer-command)
+(declare-function realgud-cmdbuf-filename-remap-alist
+                  'realgud-buffer-command)
+(declare-function realgud-cmdbuf-filename-remap-alist=
+                  'realgud-buffer-command)
+(declare-function realgud-cmdbuf-mutex 'realgud-buffer-command)
 
 (defcustom realgud-file-find-function 'compilation-find-file
-;;(defcustom realgud-file-find-function 'compilation-find-file
+  ;;(defcustom realgud-file-find-function 'compilation-find-file
   "Function to call when we can't easily find file"
   :type 'function
   :group 'realgud)
 
-(defun realgud--file-matching-suffix(paths suffix)
+(defun realgud--file-matching-suffix (paths suffix)
   (seq-filter (lambda (x) (string-suffix-p suffix x)) paths))
 
-(defun realgud:file-line-count(filename)
+(defun realgud:file-line-count (filename)
   "Return the number of lines in file FILENAME, or nil FILENAME can't be
 found"
   (if (file-exists-p filename)
       (let ((file-buffer (find-file-noselect filename)))
-       (with-current-buffer-safe file-buffer
-         (line-number-at-pos (point-max))))
+        (with-current-buffer-safe
+         file-buffer (line-number-at-pos (point-max))))
     nil))
 
-(defun realgud:file-column-from-string(filename line-number source-text
-                                               &optional no-strip-blanks)
+(defun realgud:file-column-from-string
+    (filename line-number source-text &optional no-strip-blanks)
   "Return the column of the first column position of SOURCE-TEXT
 at LINE-NUMBER or nil if it is not there"
   (condition-case nil
       (when (and source-text (file-exists-p filename))
         (let ((file-buffer (find-file-noselect filename)))
-          (with-current-buffer-safe file-buffer
-            (save-excursion
-              (goto-char (point-min))
-              (forward-line (1- line-number))
-              (unless no-strip-blanks
-                (setq source-text (realgud:strip source-text)))
-              (when (search-forward source-text (pos-at-eol))
-                (goto-char (match-beginning 0))
-                (current-column))))))
-    (error nil)))
-
-(defun realgud:file-ignore(filename ignore-re-file-list)
-  (seq-find '(lambda (file-re) (string-match file-re filename)) 
ignore-re-file-list))
-
-(defun realgud:file-loc-from-line(filename line-number
-                                          &optional column-number cmd-marker 
source-text bp-num
-                                          find-file-fn directory)
+          (with-current-buffer-safe
+           file-buffer
+           (save-excursion
+             (goto-char (point-min))
+             (forward-line (1- line-number))
+             (unless no-strip-blanks
+               (setq source-text (realgud:strip source-text)))
+             (when (search-forward source-text (pos-at-eol))
+               (goto-char (match-beginning 0))
+               (current-column))))))
+    (error
+     nil)))
+
+(defun realgud:file-ignore (filename ignore-re-file-list)
+  (seq-find
+   '(lambda (file-re) (string-match file-re filename))
+   ignore-re-file-list))
+
+(defun realgud:file-loc-from-line
+    (filename
+     line-number
+     &optional
+     column-number
+     cmd-marker
+     source-text
+     bp-num
+     find-file-fn
+     directory)
   "Return a realgud-loc for FILENAME, LINE-NUMBER and the other
 optional position information.
 
@@ -87,133 +102,158 @@ If we're unable find the source code we return a string 
describing the
 problem as best as we can determine."
 
   (let* ((cmdbuf (or (realgud-get-cmdbuf) cmd-marker))
-        (ignore-re-file-list (realgud-cmdbuf-ignore-re-file-list cmdbuf))
-        (filename-remap-alist (realgud-cmdbuf-filename-remap-alist cmdbuf))
-        (remapped-filename
-         (assoc filename filename-remap-alist))
-        (mutex (realgud-cmdbuf-mutex cmdbuf))
-        (matching-file-list)
-        (buffer-files))
+         (ignore-re-file-list
+          (realgud-cmdbuf-ignore-re-file-list cmdbuf))
+         (filename-remap-alist
+          (realgud-cmdbuf-filename-remap-alist cmdbuf))
+         (remapped-filename (assoc filename filename-remap-alist))
+         (mutex (realgud-cmdbuf-mutex cmdbuf))
+         (matching-file-list)
+         (buffer-files))
 
     ;;(with-mutex
     ;; mutex
-     (when remapped-filename
-       (if (file-readable-p (cdr remapped-filename))
-          (setq filename (cdr remapped-filename))
-        ;; else remove from map since no find
-        (realgud-cmdbuf-filename-remap-alist=
-         (delq (assoc remapped-filename filename-remap-alist)
-                                         filename-remap-alist))))
-
-     (unless (and filename (file-readable-p filename))
-
-       (with-current-buffer cmdbuf
-        (cond
-         ;; Is file already listed for ignore?
-         ((realgud:file-ignore filename ignore-re-file-list)
-          (message "tracking ignored for %s" filename))
-
-         ;; If we can find the filename, e.g. "src/code.c" as a suffix of file 
in
-         ;; the list of buffers seen, use that
-         ((and
-           (setq buffer-files
-                 (with-current-buffer (marker-buffer cmd-marker)
-                   (mapcar (lambda (buf) (buffer-file-name buf))
-                           (realgud-cmdbuf-info-srcbuf-list 
realgud-cmdbuf-info))))
-           (setq matching-file-list (realgud--file-matching-suffix 
buffer-files filename))
-           (car matching-file-list)))
-
-         ;; Do we want to blacklist this?
-         ((y-or-n-p (format "Unable to locate %s\nBlacklist it for location 
tracking?" filename))
-          ;; FIXME: there has to be a simpler way to set ignore-file-list
-          (progn
-            (push filename ignore-re-file-list)
-            (realgud-cmdbuf-info-ignore-re-file-list= ignore-re-file-list)
-            (setq filename nil)
-          ))
-
-         ;; Do we have a custom find-file function?
-         (find-file-fn
-          (setq filename (funcall find-file-fn cmd-marker filename directory)))
-
-         (t
-          (let ((found-file (funcall realgud-file-find-function (point-marker) 
filename directory)))
-            (if found-file
-                (progn
-                  (setq remapped-filename (buffer-file-name found-file))
-                  (when (and remapped-filename (file-exists-p 
remapped-filename))
-                    (realgud-cmdbuf-filename-remap-alist=
-                     (cons
-                      (cons filename remapped-filename)
-                      filename-remap-alist)
-                     cmdbuf)
-                    (setq filename remapped-filename)
-                    ))
-              ;; else
-              (setq filename nil)
-              )))
-         ))))
+    (when remapped-filename
+      (if (file-readable-p (cdr remapped-filename))
+          (setq filename (cdr remapped-filename))
+        ;; else remove from map since no find
+        (realgud-cmdbuf-filename-remap-alist=
+         (delq
+          (assoc remapped-filename filename-remap-alist)
+          filename-remap-alist))))
+
+    (unless (and filename (file-readable-p filename))
+
+      (with-current-buffer cmdbuf
+        (cond
+         ;; Is file already listed for ignore?
+         ((realgud:file-ignore filename ignore-re-file-list)
+          (message "tracking ignored for %s" filename))
+
+         ;; If we can find the filename, e.g. "src/code.c" as a suffix of file 
in
+         ;; the list of buffers seen, use that
+         ((and (setq buffer-files
+                     (with-current-buffer (marker-buffer cmd-marker)
+                       (mapcar
+                        (lambda (buf) (buffer-file-name buf))
+                        (realgud-cmdbuf-info-srcbuf-list
+                         realgud-cmdbuf-info))))
+               (setq matching-file-list
+                     (realgud--file-matching-suffix
+                      buffer-files filename))
+               (car matching-file-list)))
+
+         ;; Do we want to blacklist this?
+         ((y-or-n-p
+           (format
+            "Unable to locate %s\nBlacklist it for location tracking?"
+            filename))
+          ;; FIXME: there has to be a simpler way to set ignore-file-list
+          (progn
+            (push filename ignore-re-file-list)
+            (realgud-cmdbuf-info-ignore-re-file-list=
+             ignore-re-file-list)
+            (setq filename nil)))
+
+         ;; Do we have a custom find-file function?
+         (find-file-fn
+          (setq filename
+                (funcall find-file-fn cmd-marker filename directory)))
+
+         (t
+          (let ((found-file
+                 (funcall realgud-file-find-function
+                          (point-marker)
+                          filename
+                          directory)))
+            (if found-file
+                (progn
+                  (setq remapped-filename
+                        (buffer-file-name found-file))
+                  (when (and remapped-filename
+                             (file-exists-p remapped-filename))
+                    (realgud-cmdbuf-filename-remap-alist=
+                     (cons
+                      (cons filename remapped-filename)
+                      filename-remap-alist)
+                     cmdbuf)
+                    (setq filename remapped-filename)))
+              ;; else
+              (setq filename nil))))))))
   ;;)
 
   (if filename
       (if (file-readable-p filename)
-         (if (integerp line-number)
-             (if (> line-number 0)
-                 (let ((line-count))
-                   (if (setq line-count (realgud:file-line-count filename))
-                       (if (> line-count line-number)
-                           (let* ((column-number (or column-number
-                                   (realgud:file-column-from-string filename
-                                                                   line-number
-                                                                   
source-text)))
-                                  (source-buffer (find-file-noselect filename))
-                                  (source-mark))
-
-                             ;; Set this filename as the last one seen in 
cmdbuf
-                             (realgud-cmdbuf-info-source-path= filename)
-
-                             ;; And you thought we'd never get around to
-                             ;; doing something other than validation?
-                             (with-current-buffer source-buffer
-                               (goto-char (point-min))
-                               (forward-line (1- line-number))
-                               (if (and column-number (numberp column-number))
-                                   (forward-char (1- column-number)))
-                               ;; FIXME also allow byte offset.
-                               (make-realgud-loc
-                                     :num           bp-num
-                                     :cmd-marker    cmd-marker
-                                     :filename      filename
-                                     :line-number   line-number
-                                     :column-number column-number
-                                     :source-text   source-text
-                                     :marker        (point-marker)
-                                     )
-                               ))
-                         ;; else
-                         (format "File %s has only %d lines. (Line %d 
requested.)"
-                                 filename line-count line-number))
-                     (format "Problem getting line count for file `%s'" 
filename)))
-               (format "line number %s should be greater than 0" line-number))
-           (format "%s is not an integer" line-number))
-       ;; else
-       (if filename
-           (format "File named `%s' not readable" filename))))
-  )
+          (if (integerp line-number)
+              (if (> line-number 0)
+                  (let ((line-count))
+                    (if (setq line-count
+                              (realgud:file-line-count filename))
+                        (if (> line-count line-number)
+                            (let* ((column-number
+                                    (or
+                                     column-number
+                                     (realgud:file-column-from-string
+                                      filename
+                                      line-number
+                                      source-text)))
+                                   (source-buffer
+                                    (find-file-noselect filename))
+                                   (source-mark))
+
+                              ;; Set this filename as the last one seen in 
cmdbuf
+                              (realgud-cmdbuf-info-source-path=
+                               filename)
+
+                              ;; And you thought we'd never get around to
+                              ;; doing something other than validation?
+                              (with-current-buffer source-buffer
+                                (goto-char (point-min))
+                                (forward-line (1- line-number))
+                                (if (and column-number
+                                         (numberp column-number))
+                                    (forward-char (1- column-number)))
+                                ;; FIXME also allow byte offset.
+                                (make-realgud-loc
+                                 :num bp-num
+                                 :cmd-marker cmd-marker
+                                 :filename filename
+                                 :line-number line-number
+                                 :column-number column-number
+                                 :source-text source-text
+                                 :marker (point-marker))))
+                          ;; else
+                          (format
+                           "File %s has only %d lines. (Line %d requested.)"
+                           filename line-count line-number))
+                      (format
+                       "Problem getting line count for file `%s'"
+                       filename)))
+                (format "line number %s should be greater than 0"
+                        line-number))
+            (format "%s is not an integer" line-number))
+        ;; else
+        (if filename
+            (format "File named `%s' not readable" filename)))))
 
 ;; FIXME: should allow column number to be passed in.
-(defun realgud:file-remove-ignore(path-to-stop-ignoring)
+(defun realgud:file-remove-ignore (path-to-stop-ignoring)
   "Remove `path-to-stop-ignoring' from the list of paths which
 are ignored in debugger location tracking. You might do this if you 
accidentllay
 added a a path for ignoring by mistake."
-  (interactive
-   (list (completing-read "File name to stop ignoring: "
-                   (realgud-cmdbuf-ignore-re-file-list (current-buffer))
-                   nil t)))
-  (when (member path-to-stop-ignoring (realgud-cmdbuf-ignore-re-file-list 
(current-buffer)))
+  (interactive (list
+                (completing-read
+                 "File name to stop ignoring: "
+                 (realgud-cmdbuf-ignore-re-file-list (current-buffer))
+                 nil
+                 t)))
+  (when (member
+         path-to-stop-ignoring
+         (realgud-cmdbuf-ignore-re-file-list (current-buffer)))
     (realgud-cmdbuf-info-ignore-re-file-list=
-     (delete path-to-stop-ignoring (realgud-cmdbuf-ignore-re-file-list 
(current-buffer)))))
-  )
+     (delete
+      path-to-stop-ignoring
+      (realgud-cmdbuf-ignore-re-file-list (current-buffer))))))
 
 
 (provide-me "realgud-")
diff --git a/realgud/common/loc.el b/realgud/common/loc.el
index 789242d0e2..7533900647 100644
--- a/realgud/common/loc.el
+++ b/realgud/common/loc.el
@@ -18,7 +18,8 @@
 ;; This describes a debugger location structure and has code for
 ;; working with them.
 
-(eval-when-compile (require 'cl-lib))
+(eval-when-compile
+  (require 'cl-lib))
 
 (require 'load-relative)
 (require 'loc-changes)
@@ -28,34 +29,34 @@
 ;; FIXME: removed because of recursive loads
 ;; (require-relative-list '("buffer/helper") "realgud-buffer-")
 
-(declare-function realgud:strip                  'realgud)
-(declare-function realgud-get-cmdbuf-from-srcbuf 'realgud-buffer-helper)
-(declare-function realgud-srcbuf?                'realgud-buffer-source)
+(declare-function realgud:strip 'realgud)
+(declare-function realgud-get-cmdbuf-from-srcbuf
+                  'realgud-buffer-helper)
+(declare-function realgud-srcbuf? 'realgud-buffer-source)
 
-(cl-defstruct realgud-loc
-"Our own location type. Even though a mark contains a
+(cl-defstruct
+ realgud-loc
+ "Our own location type. Even though a mark contains a
 file-name (via a buffer) and a line number (via an offset), we
 want to save the values that were seen/requested originally."
-   num           ;; If there is a number such as a breakpoint or frame
-                ;; number associated with this location, this is set.
-                ;; nil otherwise.
-   filename
-   line-number
-   column-number ;; Column offset within line
-   source-text   ;; Source text if available
-   marker        ;; Position in source code
-   cmd-marker    ;; Position in command process buffer
-)
+ num ;; If there is a number such as a breakpoint or frame
+ ;; number associated with this location, this is set.
+ ;; nil otherwise.
+ filename line-number
+ column-number ;; Column offset within line
+ source-text ;; Source text if available
+ marker ;; Position in source code
+ cmd-marker ;; Position in command process buffer
+ )
 
 (defalias 'realgud-loc? 'realgud-loc-p)
 
 ;; The below function is generic and might be found in standard
 ;; library. Or it might be moved someplace more generic.
-(defun realgud:buffer-line-no-props()
+(defun realgud:buffer-line-no-props ()
   "Returns a string containing the line that `point' is at,
 without buffer properties."
-  (buffer-substring-no-properties (pos-bol)
-                                 (pos-eol)))
+  (buffer-substring-no-properties (pos-bol) (pos-eol)))
 
 (defun realgud:loc-describe (loc)
   "Display realgud-cmdcbuf-info.
@@ -68,53 +69,57 @@ Information is put in an internal buffer called *Describe 
Debugger Session*."
   "Display realgud-cmdcbuf-info.
 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))
-       (filename (realgud-loc-filename loc)))
+        (bp-num (realgud-loc-num loc))
+        (source-text (realgud-loc-source-text loc))
+        (filename (realgud-loc-filename loc)))
     (insert "  - filename      :: ")
     (put-text-property
      (insert-text-button filename
-                        'action 'realgud:follow-event
-                        'help-echo "mouse-2: go to this file")
-     (point)
-     'file filename)
+                         'action
+                         'realgud:follow-event
+                         'help-echo
+                         "mouse-2: go to this file")
+     (point) 'file filename)
     (insert "\n")
-    (mapc 'insert
-         (list
-          (format "  - line number   :: %s\n" (realgud-loc-line-number loc))
-          (if bp-num
-              (format "  - brkpt num     :: %s\n" (realgud-loc-num loc))
-            "")
-          (if column-number
-              (format "  - column number :: %s\n"
-                      (realgud-loc-column-number loc))
-            "")
-          (if source-text
-              (format "  - source text   :: %s\n" (realgud-loc-source-text 
loc))
-            "")
-          ))
+    (mapc
+     'insert
+     (list
+      (format "  - line number   :: %s\n"
+              (realgud-loc-line-number loc))
+      (if bp-num
+          (format "  - brkpt num     :: %s\n" (realgud-loc-num loc))
+        "")
+      (if column-number
+          (format "  - column number :: %s\n"
+                  (realgud-loc-column-number loc))
+        "")
+      (if source-text
+          (format "  - source text   :: %s\n"
+                  (realgud-loc-source-text loc))
+        "")))
     ;; Make locations clickable
     (insert "  - source marker :: ")
     (put-text-property
      (insert-text-button (format "%s" (realgud-loc-marker loc))
-                        'action 'realgud:follow-event
-                        'help-echo "mouse-2: go to this source location")
-     (point)
-     'mark (realgud-loc-marker loc))
+                         'action
+                         'realgud:follow-event
+                         'help-echo
+                         "mouse-2: go to this source location")
+     (point) 'mark (realgud-loc-marker loc))
 
     (insert "\n  - cmdbuf marker :: ")
     (put-text-property
-     (insert-text-button (format "%s" (realgud-loc-cmd-marker loc))
-                        'action 'realgud:follow-event
-                        'help-echo "mouse-2: go to this command-buffer 
location")
-     (point)
-     'mark (realgud-loc-cmd-marker loc))
-    (insert "\n")
-    )
-  )
+     (insert-text-button
+      (format "%s" (realgud-loc-cmd-marker loc))
+      'action
+      'realgud:follow-event
+      'help-echo
+      "mouse-2: go to this command-buffer location")
+     (point) 'mark (realgud-loc-cmd-marker loc))
+    (insert "\n")))
 
 
-(defun realgud-loc-current(&optional source-buffer cmd-marker)
+(defun realgud-loc-current (&optional source-buffer cmd-marker)
   "Create a location object for the point in the current buffer.
    If SOURCE-BUFFER is not given, take the current buffer as the
    source buffer."
@@ -124,26 +129,22 @@ Information is put in an internal buffer called *Describe 
Debugger Session*."
   (unless (realgud-srcbuf? source-buffer)
     (error "%s is not a realgud source buffer" source-buffer))
   (unless cmd-marker
-    (setq cmd-marker
-         (realgud-get-cmdbuf-from-srcbuf source-buffer))
-    )
+    (setq cmd-marker (realgud-get-cmdbuf-from-srcbuf source-buffer)))
   (with-current-buffer source-buffer
     (let ((mark (point-marker))
-         (text (realgud:buffer-line-no-props)))
+          (text (realgud:buffer-line-no-props)))
       (make-realgud-loc
        :filename (buffer-file-name source-buffer)
        :column-number (current-column)
        :line-number (line-number-at-pos)
        :source-text text
-       :marker      mark
-       :cmd-marker cmd-marker
-       )
-      )))
+       :marker mark
+       :cmd-marker cmd-marker))))
 
-(defun realgud-loc-marker=(loc marker)
+(defun realgud-loc-marker= (loc marker)
   (setf (realgud-loc-marker loc) marker))
 
-(defun realgud-loc-goto(loc)
+(defun realgud-loc-goto (loc)
   "Position point in the buffer referred to by LOC. This may
 involve reading in a file. In the process, the marker inside LOC
 may be updated.
@@ -151,50 +152,51 @@ may be updated.
 If LOC is found, The buffer containing the location referred to,
 the source-code buffer, is returned. Otherwise, nil is returned."
   (if (realgud-loc? loc)
-      (let* ((filename    (realgud-loc-filename loc))
-            (line-number (realgud-loc-line-number loc))
-            (column-number (or (realgud-loc-column-number loc) 1))
-            (marker      (realgud-loc-marker loc))
-            (cmd-marker  (realgud-loc-cmd-marker loc))
-            (use-marker  nil)
-            (src-buffer  (marker-buffer (or marker (make-marker)))))
-       (if (and (not src-buffer) filename)
-           (setq src-buffer (find-file-noselect filename)))
-       (if cmd-marker
-           (with-current-buffer (marker-buffer cmd-marker)
-             (goto-char cmd-marker)))
-       (if src-buffer
-           (with-current-buffer src-buffer
-             (when (and marker (marker-position marker))
-               ;; A marker has been set in loc, so use that.
-               (setq use-marker 't)
-               (let ((current-text (realgud:buffer-line-no-props))
-                     (loc-text (realgud-loc-source-text loc)))
-                 (unless (and loc-text (eql column-number 1)
-                              (equal (realgud:strip current-text) 
(realgud:strip loc-text)))
-                   (loc-changes-goto line-number)
-                   (setq current-text (realgud:buffer-line-no-props))
-                   (when (equal current-text loc-text)
-                     (message "Marked location needed updating")
-                     (setq use-marker nil))
-                   )))
-             (if use-marker
-                 (goto-char (marker-position marker))
-               ;; else
-               ;; We don't have a position set in the source buffer
-               ;; so find it and go there. We use `loc-changes-goto'
-               ;; to find that spot. `loc-changes-goto' keeps a
-               ;; record of the first time we went to that spot, so
-               ;; in the face of buffer modifications, it may be more
-               ;; reliable.
-               (let ((src-marker))
-                 (loc-changes-goto line-number)
-                 (when column-number
-                   (move-to-column (1- column-number)))
-                 (setq src-marker (point-marker))
-                 (realgud-loc-marker= loc src-marker)
-                 ))))
-
-       src-buffer )))
+      (let* ((filename (realgud-loc-filename loc))
+             (line-number (realgud-loc-line-number loc))
+             (column-number (or (realgud-loc-column-number loc) 1))
+             (marker (realgud-loc-marker loc))
+             (cmd-marker (realgud-loc-cmd-marker loc))
+             (use-marker nil)
+             (src-buffer (marker-buffer (or marker (make-marker)))))
+        (if (and (not src-buffer) filename)
+            (setq src-buffer (find-file-noselect filename)))
+        (if cmd-marker
+            (with-current-buffer (marker-buffer cmd-marker)
+              (goto-char cmd-marker)))
+        (if src-buffer
+            (with-current-buffer src-buffer
+              (when (and marker (marker-position marker))
+                ;; A marker has been set in loc, so use that.
+                (setq use-marker 't)
+                (let ((current-text (realgud:buffer-line-no-props))
+                      (loc-text (realgud-loc-source-text loc)))
+                  (unless (and loc-text
+                               (eql column-number 1)
+                               (equal
+                                (realgud:strip current-text)
+                                (realgud:strip loc-text)))
+                    (loc-changes-goto line-number)
+                    (setq current-text (realgud:buffer-line-no-props))
+                    (when (equal current-text loc-text)
+                      (message "Marked location needed updating")
+                      (setq use-marker nil)))))
+              (if use-marker
+                  (goto-char (marker-position marker))
+                ;; else
+                ;; We don't have a position set in the source buffer
+                ;; so find it and go there. We use `loc-changes-goto'
+                ;; to find that spot. `loc-changes-goto' keeps a
+                ;; record of the first time we went to that spot, so
+                ;; in the face of buffer modifications, it may be more
+                ;; reliable.
+                (let ((src-marker))
+                  (loc-changes-goto line-number)
+                  (when column-number
+                    (move-to-column (1- column-number)))
+                  (setq src-marker (point-marker))
+                  (realgud-loc-marker= loc src-marker)))))
+
+        src-buffer)))
 
 (provide-me "realgud-")

Reply via email to