diff options
author | jao <jao@gnu.org> | 2022-10-08 20:03:57 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-10-08 20:03:57 +0100 |
commit | 67984ac8d0ab91e02ef5674c525de0cde8cd24b1 (patch) | |
tree | 16ba7d7ea8a458c27623efe71783325073eeec45 /elisp | |
parent | b734a239ff9b8fde292e956174fd3356583fc76f (diff) | |
download | geiser-67984ac8d0ab91e02ef5674c525de0cde8cd24b1.tar.gz geiser-67984ac8d0ab91e02ef5674c525de0cde8cd24b1.tar.bz2 |
geiser-log clean-ups
- geiser-log: Obsoleting some -p flags and lexical binding
- geiser-eval: Ensuring logs for asynchronous retorts
- geiser-debug: don't bail on no output with errors
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-debug.el | 2 | ||||
-rw-r--r-- | elisp/geiser-eval.el | 4 | ||||
-rw-r--r-- | elisp/geiser-log.el | 35 |
3 files changed, 26 insertions, 15 deletions
diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el index 9b60732..70f3e39 100644 --- a/elisp/geiser-debug.el +++ b/elisp/geiser-debug.el @@ -260,7 +260,7 @@ buffer.") (geiser-debug--insert-res res))) (when (or err key output) (or (geiser-debug--display-error impl module key output) - (insert "\n" (if key (format "%s\n" key) "") output "\n"))) + (insert "\n" (if key (format "%s\n" key) "") (or output "") "\n"))) (when after (goto-char (point-max)) (insert "\nExpression evaluated was:\n\n") diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el index abf0b5c..6463f80 100644 --- a/elisp/geiser-eval.el +++ b/elisp/geiser-eval.el @@ -130,7 +130,7 @@ module-exports, autodoc, callers, callees and generic-methods.") (and geiser-eval--default-connection-function (funcall geiser-eval--default-connection-function))) -(defsubst geiser-eval--log (s) +(defun geiser-eval--log (s) (geiser-log--info "RETORT: %S" s) s) @@ -143,7 +143,7 @@ module-exports, autodoc, callers, callees and generic-methods.") (geiser-con--send-string (geiser-eval--connection) (geiser-eval--code-str code) (lambda (s) - (setq geiser-eval--async-retort s) + (setq geiser-eval--async-retort (geiser-eval--log s)) (funcall cont s)) buffer)) diff --git a/elisp/geiser-log.el b/elisp/geiser-log.el index 2573138..389e7ca 100644 --- a/elisp/geiser-log.el +++ b/elisp/geiser-log.el @@ -1,4 +1,4 @@ -;;; geiser-log.el -- logging utilities +;;; geiser-log.el -- logging utilities -*- lexical-binding: t; -*- ;; Copyright (C) 2009, 2010, 2012, 2019, 2021, 2022 Jose Antonio Ortega Ruiz @@ -40,16 +40,24 @@ (defvar geiser-log--max-message-size 20480 "Maximum size of individual Geiser log messages.") -(defvar geiser-log-verbose-p nil - "Log purely informational messages. Useful for debugging.") +(defvar geiser-log-verbose nil + "Log purely informational messages.") -(defvar geiser-log-verbose-debug-p nil +(defvar geiser-log-verbose-debug nil "Log very verbose informational messages. Useful only for debugging.") -(defvar geiser-log--inhibit-p nil +(defvar geiser-log--inhibit nil "Set this to t to inhibit all log messages") +(define-obsolete-variable-alias + 'geiser-log-verbose-p 'geiser-log-verbose "0.26.2") + +(define-obsolete-variable-alias + 'geiser-log-verbose-debug-p 'geiser-log-verbose-debug "0.26.2") + + + ;;; Log buffer and mode: @@ -84,7 +92,7 @@ ;;; Logging functions: (defun geiser-log--msg (type &rest args) - (unless geiser-log--inhibit-p + (unless geiser-log--inhibit (geiser-log--with-buffer (goto-char (point-max)) (insert (geiser--shorten-str (format "\n%s: %s\n" type @@ -98,11 +106,11 @@ (apply 'geiser-log--msg 'ERROR args)) (defsubst geiser-log--info (&rest args) - (when geiser-log-verbose-p + (when geiser-log-verbose (apply 'geiser-log--msg 'INFO args) "")) (defsubst geiser-log--debug (&rest args) - (when geiser-log-verbose-debug-p + (when geiser-log-verbose-debug (apply 'geiser-log--msg 'DEBUG args) "")) @@ -110,9 +118,12 @@ (defun geiser-show-logs (&optional arg) "Show Geiser log messages. + With prefix, activates all logging levels." (interactive "P") - (when arg (setq geiser-log-verbose-p t)) + (setq geiser-log-verbose t) + (when arg + (setq geiser-log-verbose-debug t)) (geiser-log--pop-to-buffer)) (defun geiser-log-clear () @@ -123,13 +134,13 @@ With prefix, activates all logging levels." (defun geiser-log-toggle-verbose () "Toggle verbose logs" (interactive) - (setq geiser-log-verbose-p (not geiser-log-verbose-p)) + (setq geiser-log-verbose (not geiser-log-verbose)) (message "Geiser verbose logs %s" - (if geiser-log-verbose-p "enabled" "disabled"))) + (if geiser-log-verbose "enabled" "disabled"))) (defun geiser-log--deactivate () (interactive) - (setq geiser-log-verbose-p nil) + (setq geiser-log-verbose nil) (when (eq (current-buffer) (geiser-log--buffer)) (View-quit))) |