comparison lisp/cmdloop.el @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents 023b83f4e54b
children 37bdd24225ef
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
1 ;;; cmdloop.el --- support functions for the top-level command loop. 1 ;;; cmdloop.el --- support functions for the top-level command loop.
2 2
3 ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 2001 Ben Wing.
4 5
5 ;; Author: Richard Mlynarik 6 ;; Author: Richard Mlynarik
6 ;; Date: 8-Jul-92 7 ;; Date: 8-Jul-92
7 ;; Maintainer: XEmacs Development Team 8 ;; Maintainer: XEmacs Development Team
8 ;; Keywords: internal, dumped 9 ;; Keywords: internal, dumped
127 (defcustom errors-deactivate-region nil 128 (defcustom errors-deactivate-region nil
128 "*Non-nil means that errors will cause the region to be deactivated." 129 "*Non-nil means that errors will cause the region to be deactivated."
129 :type 'boolean 130 :type 'boolean
130 :group 'editing-basics) 131 :group 'editing-basics)
131 132
133 (defvar breakpoint-on-error nil
134 "Break into the C debugger when an unhandled error occurs noninteractively.
135 This happens by calling `force-debugging-signal'. This can be very
136 useful when debugging noninteractive errors in tricky situations,
137 e.g. makefiles, since you can set this variable using an environment
138 variable, like this:
139
140 \(using csh) setenv XEMACSDEBUG '(setq breakpoint-on-error t)'
141 \(using bash) export XEMACSDEBUG='(setq breakpoint-on-error t)'
142
143 XEMACSDEBUG is also useful for setting `stack-trace-on-error'. which will
144 display a Lisp backtrace when exiting noninteractively due to an unhandled
145 error.")
146
132 (defun command-error (error-object) 147 (defun command-error (error-object)
133 (let* ((old-debug-on-error debug-on-error) 148 ;; if you want a backtrace before exiting, set stack-trace-on-error.
134 (inhibit-quit t) 149 (let* ((inhibit-quit t)
135 (debug-on-error nil) 150 (debug-on-error nil)
136 (etype (car-safe error-object))) 151 (etype (car-safe error-object)))
137 (setq quit-flag nil) 152 (setq quit-flag nil)
138 (setq standard-output t) 153 (setq standard-output t)
139 (setq standard-input t) 154 (setq standard-input t)
160 (t 'command-error))) 175 (t 'command-error)))
161 (display-error error-object t) 176 (display-error error-object t)
162 177
163 (if (noninteractive) 178 (if (noninteractive)
164 (progn 179 (progn
165 (if old-debug-on-error 180 (when breakpoint-on-error
166 (progn 181 (force-debugging-signal))
167 (message "Backtrace:\n\n")
168 (backtrace)
169 (message "\n")))
170 (message "%s exiting\n." emacs-program-name) 182 (message "%s exiting\n." emacs-program-name)
171 (kill-emacs -1))) 183 (kill-emacs -1)))
172 t)) 184 t))
173 185
174 (defun describe-last-error () 186 (defun describe-last-error ()