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

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

[elpa] externals/realgud 4d9c31b 119/140: Improve realgud:attach-cmd-buf


From: Rocky Bernstein
Subject: [elpa] externals/realgud 4d9c31b 119/140: Improve realgud:attach-cmd-buffer...
Date: Sat, 25 May 2019 19:35:47 -0400 (EDT)

branch: externals/realgud
commit 4d9c31b9eef5db339fc0769fbdec3fbbb1191d82
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    Improve realgud:attach-cmd-buffer...
    
    And add %U specifier for url's
---
 realgud/common/attach.el | 19 +++++++++++++++++--
 realgud/common/send.el   | 10 +++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/realgud/common/attach.el b/realgud/common/attach.el
index 971da46..91ee8ee 100644
--- a/realgud/common/attach.el
+++ b/realgud/common/attach.el
@@ -17,6 +17,8 @@
 ;;; Emacs Commands to associate or attach a source buffer to a command
 ;;; buffer and vice versa.
 
+(eval-when-compile (require 'cl-seq))   ;For cl-remove-if-not.
+
 (require 'load-relative)
 (require-relative-list  '("buffer/command" "buffer/source")
                        "realgud-buffer-")
@@ -27,6 +29,9 @@
 (declare-function realgud-srcbuf-init-or-update       'realgud-source)
 (declare-function realgud-short-key-mode-setup        'realgud-shortkey)
 
+;; (defvar realgud:attach-cmdbuf-history nil "minibuffer command buffer 
history list'.")
+
+
 ;;;###autoload
 (defun realgud:attach-source-buffer(srcbuf)
   "Associate a source buffer with the current command buffer"
@@ -49,10 +54,15 @@
   )
 
 ;;;###autoload
-(defun realgud:attach-command-buffer(cmdbuf)
+(defun realgud:attach-cmd-buffer(cmdbuf)
   "Associate a command buffer with the current source buffer"
 
-  (interactive "bcommand buffer: ")
+  (interactive
+   (list
+    (completing-read "Choose a realgud command buffer: "
+                    (realgud:attach-list-command-buffers) nil t nil
+                    nil nil)))
+                    ;; realgud:attach-cmdbuf-history (car-safe 
realgud:attach-cmdbuf-history))))
   (if (stringp cmdbuf) (setq cmdbuf (get-buffer cmdbuf)))
   (let* ((srcbuf (current-buffer))
         (shortkey-mode?))
@@ -62,9 +72,14 @@
       (unless (get-buffer-process (current-buffer))
        (warn "Can't find a process for command buffer %s" (current-buffer)))
       (setq shortkey-mode? (realgud-sget 'cmdbuf-info 'src-shortkey?)))
+    ;; (add-to-list 'realgud:attach-cmdbuf-history (buffer-name cmdbuf))
     (realgud-cmdbuf-add-srcbuf srcbuf)
     (realgud-srcbuf-init-or-update srcbuf cmdbuf)
     (if shortkey-mode? (realgud-short-key-mode-setup 't)))
   )
 
+(defun realgud:attach-list-command-buffers()
+  (mapcar 'buffer-name (cl-remove-if-not 'realgud-cmdbuf? (buffer-list))))
+
+
 (provide-me "realgud-")
diff --git a/realgud/common/send.el b/realgud/common/send.el
index 4c112c1..f1c6659 100644
--- a/realgud/common/send.el
+++ b/realgud/common/send.el
@@ -135,6 +135,7 @@ taken from current buffer, or OPT-BUFFER if non-nil.  Some
   %F -- Name without directory or extension of current source file.
   %x -- Name of current source file.
   %X -- Expanded name of current source file.
+  %U -- Expanded name of current source file stripping file://.
   %d -- Directory of current source file.
   %l -- Number of current source line.
   %c -- Fully qualified class name derived from the expression
@@ -150,7 +151,7 @@ taken from current buffer, or OPT-BUFFER if non-nil.  Some
         result)
     (while (and fmt-str
                (let ((case-fold-search nil))
-                 (string-match "\\([^%]*\\)%\\([dfFlpqxXs]\\)" fmt-str)))
+                 (string-match "\\([^%]*\\)%\\([dfFlpqxUXs]\\)" fmt-str)))
       (let* ((key-str (match-string 2 fmt-str))
             (key (string-to-char key-str)))
        (setq result
@@ -197,10 +198,17 @@ taken from current buffer, or OPT-BUFFER if non-nil.  Some
                ((eq key ?x)
                 (or (and src-file-name src-file-name)
                     "*source-file-not-found-for-%x"))
+
                ((eq key ?X)
                 (or (and src-file-name (expand-file-name src-file-name))
                     "*source-file-not-found-for-%X"))
 
+               ((eq key ?U)
+                (if (string-match src-file-name "^file://")
+                    (setq src-file-name (substring 7)))
+                (or (and src-file-name (expand-file-name src-file-name))
+                    "*source-file-not-found-for-%X"))
+
                ;; ((eq key ?e)
                ;;  (gud-find-expr))
                ;; ((eq key ?a)



reply via email to

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