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

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

[elpa] master 51cd14b 173/215: Clarify %p in documentation of expand-for


From: Rocky Bernstein
Subject: [elpa] master 51cd14b 173/215: Clarify %p in documentation of expand-format
Date: Sat, 30 Jul 2016 14:49:03 +0000 (UTC)

branch: master
commit 51cd14bb7ac6e8cf8fc2a817d09f956a13e36b7b
Author: Clément Pit--Claudel <address@hidden>
Commit: Clément Pit--Claudel <address@hidden>

    Clarify %p in documentation of expand-format
    
    Also ensure %s formats nil as an empty string (for consistency with %p).
---
 realgud/common/send.el |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/realgud/common/send.el b/realgud/common/send.el
index 39ac519..648632b 100644
--- a/realgud/common/send.el
+++ b/realgud/common/send.el
@@ -118,9 +118,10 @@ results into the command buffer."
 
 
 (defun realgud-expand-format (fmt-str &optional opt-str opt-buffer)
-  "Expands commands format characters inside FMT-STRING using values
-from the debugging session. OPT-STR is an optional string.
-Some %-escapes in the string arguments are expanded. These are:
+  "Expands commands format characters inside FMT-STR.
+OPT-STR is an optional string (used with %p and %s).  Values are
+taken from current buffer, or OPT-BUFFER if non-nil.  Some
+%-escapes in the string arguments are expanded.  These are:
 
   %f -- Name without directory of current source file.
   %F -- Name without directory or extension of current source file.
@@ -128,13 +129,12 @@ Some %-escapes in the string arguments are expanded. 
These are:
   %X -- Expanded name of current source file.
   %d -- Directory of current source file.
   %l -- Number of current source line.
-  %p -- Numeric prefix argument converted to a string
-        If no prefix argument %p is the null string.
   %c -- Fully qualified class name derived from the expression
         surrounding point.
-  %s -- value of opt-str.
+  %p -- Value of OPT-STR, converted to string using `int-to-string'
+  %s -- Value of OPT-STR.
 
-"
+%p and %s are replaced by an empty string if OPT-STR is nil."
   (let* ((buffer (or opt-buffer (current-buffer)))
         (srcbuf (realgud-get-srcbuf buffer))
         (src-file-name (and srcbuf (buffer-file-name srcbuf)))
@@ -182,9 +182,9 @@ Some %-escapes in the string arguments are expanded. These 
are:
                ;;  (gud-read-address))
                ;; ((eq key ?c)
                ;;   (gud-find-class srcbuf))
-               ((eq key ?p) (if opt-str (int-to-string opt-str) ""))
-               ((eq key ?s) opt-str)
-               (t key)))))
+                ((eq key ?p) (if opt-str (int-to-string opt-str) ""))
+                ((eq key ?s) (or opt-str ""))
+                (t key)))))
       (setq fmt-str (substring fmt-str (match-end 2))))
     ;; There might be text left in FMT-STR when the loop ends.
     (concat result fmt-str)))



reply via email to

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