branch: externals/realgud commit c64a4fd61e59a32272f2052818e2000dee3d8066 Merge: aa933eb 37ba671 Author: rocky <ro...@gnu.org> Commit: rocky <ro...@gnu.org>
Merge branch 'print' --- realgud/common/track.el | 3 ++- realgud/common/utils.el | 14 +++++++++----- test/test-track.el | 6 +++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/realgud/common/track.el b/realgud/common/track.el index eeeb3e9..088e1cc 100644 --- a/realgud/common/track.el +++ b/realgud/common/track.el @@ -189,7 +189,8 @@ message." (defun realgud:eval-command-p(text) "Checks the TEXT if the command that was ran was an eval command." - (string-prefix-p (realgud:get-command-name "eval") (realgud:get-output-command text))) + (let ((cmd-name (realgud:get-command-name "eval"))) + (and (stringp cmd-name) (string-prefix-p (realgud:get-command-name "eval") (realgud:get-output-command text))))) (defun realgud:truncate-eval-message(text) "Truncates the TEXT to the size of realgud-eval-message-print-length." diff --git a/realgud/common/utils.el b/realgud/common/utils.el index e6aec5a..1971e98 100644 --- a/realgud/common/utils.el +++ b/realgud/common/utils.el @@ -30,11 +30,15 @@ (t (append (realgud:flatten (car mylist)) (realgud:flatten (cdr mylist)))))) -;; From https://stackoverflow.com/questions/12999530/is-there-a-function-that-joins-a-string-into-a-delimited-string -(defun realgud:join-string (list joiner) - (if (< emacs-major-version 25) - (mapconcat 'identity list joiner) - (string-join list joiner))) +(if (or (< emacs-major-version 24) + (and (= emacs-major-version 24) (<= emacs-minor-version 3))) + ;; From + ;; https://stackoverflow.com/questions/12999530/is-there-a-function-that-joins-a-string-into-a-delimited-string + (defun realgud:join-string (list joiner) + (mapconcat 'identity list joiner)) + (progn + (require 'subr-x) + (defalias 'realgud:join-string 'string-join))) (defun realgud:canonic-major-mode() "Return diff --git a/test/test-track.el b/test/test-track.el index c3f8f9d..cbc4da0 100644 --- a/test/test-track.el +++ b/test/test-track.el @@ -105,8 +105,12 @@ trepan: That's all, folks... (note "realgud:eval-command-p") (setq test-command-name-hash (make-hash-table :test 'equal)) -(puthash "eval" "eval" test-command-name-hash) (set (make-local-variable 'realgud-command-name-hash) test-command-name-hash) + +;; We haven't set "eval" in command-name-hash so this should fail +(assert-nil (realgud:eval-command-p "eval 'cow'\n'cow'\n(pdb)")) + +(puthash "eval" "eval" test-command-name-hash) (assert-t (realgud:eval-command-p "eval 'cow'\n'cow'\n(pdb)")) (assert-nil (realgud:eval-command-p "next 1"))