mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 17:11:41 -05:00
Add ein:debug global switch
This commit is contained in:
parent
81334a86e8
commit
3385c6fb47
1 changed files with 12 additions and 5 deletions
17
ein-log.el
17
ein-log.el
|
@ -92,16 +92,23 @@
|
|||
(get-buffer-create (format ein:log-buffer-name-template name)))
|
||||
(ein:log 'verbose "Start logging."))
|
||||
|
||||
;; FIXME: this variable must go to somewhere more central
|
||||
(defvar ein:debug nil
|
||||
"Set to non-`nil' to raise errors instead of suppressing it.
|
||||
Change the behavior of `ein:log-ignore-errors'.")
|
||||
|
||||
(defmacro ein:log-ignore-errors (&rest body)
|
||||
"Execute BODY; if an error occurs, log the error and return nil.
|
||||
Otherwise, return result of last form in BODY."
|
||||
(declare (debug t) (indent 0))
|
||||
`(condition-case err
|
||||
`(if ein:debug
|
||||
(progn ,@body)
|
||||
(error
|
||||
(ein:log 'debug "Error: %S" err)
|
||||
(ein:log 'error (error-message-string err))
|
||||
nil)))
|
||||
(condition-case err
|
||||
(progn ,@body)
|
||||
(error
|
||||
(ein:log 'debug "Error: %S" err)
|
||||
(ein:log 'error (error-message-string err))
|
||||
nil))))
|
||||
|
||||
(defun ein:log-del ()
|
||||
"Kill buffer `ein:log-buffer'."
|
||||
|
|
Loading…
Add table
Reference in a new issue