branch: elpa/racket-mode
commit 1c909cfffc92b55f378d8483244ef7d966da330e
Author: Greg Hendershott <[email protected]>
Commit: Greg Hendershott <[email protected]>

    Use Emacs display-warning when available
---
 racket-cmd.el       | 15 +++++++++------
 racket-hash-lang.el |  3 ++-
 racket-util.el      | 14 ++++++++++++++
 racket-xp.el        |  3 ++-
 4 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/racket-cmd.el b/racket-cmd.el
index 4ff46f57b7a..ab690801cd9 100644
--- a/racket-cmd.el
+++ b/racket-cmd.el
@@ -182,10 +182,11 @@ Intended to be called after a (ready) notification from 
back end."
     (message "{%s} %s" (process-name proc) (substring event 0 -1))))
 
 (defun racket--cmd-process-stderr-filter (proc string)
-  "Show back end process stderr via `message'.
+  "Show back end process stderr to user.
 Won't show noise like \"process finished\" if stderr process
 sentinel is `ignore'."
-  (message "{%s} %s\n" proc string))
+  (racket--log-warning (format "{%s} %s" (process-name proc) string)
+                       '(back-end)))
 
 (defun racket--cmd-process-filter (proc string)
   "Read and dispatch sexprs as they become available from process output."
@@ -362,13 +363,15 @@ mistake."
                             (with-current-buffer buf (funcall callback v))))
              (`(error ,m) (let ((print-length nil) ;for %S
                                 (print-level nil))
-                            (message "Exception for command %S with repl-id %S 
from %S to %S:\n%s"
-                                     command-sexpr repl-session-id buf name 
m)))
+                            (racket--log-warning (format "Exception for 
command %S with repl-id %S from %S to %S:\n%s"
+                                                         command-sexpr 
repl-session-id buf name m)
+                                                 '(back-end))))
              (`(break)    nil)
              (v           (let ((print-length nil) ;for %S
                                 (print-level nil))
-                            (message "Unknown response to command %S with 
repl-id %S from %S to %S:\n%S"
-                                     command-sexpr repl-session-id buf name 
v)))))
+                            (racket--log-warning (format "Unknown response to 
command %S with repl-id %S from %S to %S:\n%S"
+                                                         command-sexpr 
repl-session-id buf name v)
+                                                 '(back-end))))))
        #'ignore))))
 
 (defun racket--cmd/await (repl-session-id command-sexpr)
diff --git a/racket-hash-lang.el b/racket-hash-lang.el
index 334a6acfe29..fb9e4ea3342 100644
--- a/racket-hash-lang.el
+++ b/racket-hash-lang.el
@@ -345,7 +345,8 @@ A discussion of the information provided by a Racket 
language:
        (setq-local buffer-read-only nil))
       (t
        (prog-mode) ;wipes all local variables including buffer-read-only
-       (message "hash-lang support not available; needs newer 
syntax-color-lib")))))  )
+       (racket--log-warning "hash-lang support not available; needs newer 
syntax-color-lib"
+                            '(hash-lang))))))  )
 
 (defun racket--hash-lang-delete ()
   (when racket--hash-lang-id
diff --git a/racket-util.el b/racket-util.el
index 23d903858a3..999124702e2 100644
--- a/racket-util.el
+++ b/racket-util.el
@@ -261,6 +261,20 @@ whether it would shadow an end user binding in the global 
map.")
     "-"
     str)))
 
+(defun racket--log (message sub-types level)
+  "Use `display-warning' when available else `message'."
+  (if (fboundp 'display-warning)
+      (display-warning (cons 'racket-mode sub-types)
+                       message
+                       level)
+    (message "%s" message)))
+
+(defsubst racket--log-warning (message &optional sub-types)
+  (racket--log message sub-types :warning))
+
+(defsubst racket--log-debug (message &optional sub-types)
+  (racket--log message sub-types :debug))
+
 (provide 'racket-util)
 
 ;; racket-util.el ends here
diff --git a/racket-xp.el b/racket-xp.el
index 40cd6040ff0..0b7647d5bec 100644
--- a/racket-xp.el
+++ b/racket-xp.el
@@ -265,7 +265,8 @@ commands directly to whatever keys you prefer.
          (if (< (buffer-size) racket-xp-buffer-size-limit)
              (racket--xp-annotate)
            (setq-local racket-xp-after-change-refresh-delay nil)
-           (message "Extremely large buffer; 
racket-xp-after-change-refresh-delay locally set to nil"))
+           (racket--log-warning "Extremely large buffer; 
racket-xp-after-change-refresh-delay locally set to nil"
+                                '(xp)))
          (add-hook 'after-change-functions
                    #'racket--xp-after-change-hook
                    t t)

Reply via email to