comparison lisp/simple.el @ 793:e38acbeb1cae

[xemacs-hg @ 2002-03-29 04:46:17 by ben] lots o' fixes etc/ChangeLog: New file. Separated out all entries for etc/ into their own ChangeLog. Includes entries for the following files: etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad, etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL, etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS, etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL, etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se, etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh, etc/custom/example-themes/europe-theme.el, etc/custom/example-themes/ex-custom-file, etc/custom/example-themes/example-theme.el, etc/e/eterm.ti, etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1, etc/gnuserv.README, etc/package-index.LATEST.gpg, etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm, etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs, etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E, etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm, etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm, etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar, etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1, etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL, etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el, etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\* unicode/unicode-consortium/8859-16.TXT: New file. mule/english.el: Define this charset now, since a bug was fixed that formerly prevented it. mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be integers. Makefile.in.in: Always include gui.c, to fix compile error when TTY-only. EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo(). Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate nearly all uses of Lisp_String * in favor of Lisp_Object, and correct macros so most of them favor Lisp_Object. Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings, but at level `debug' (usually ignored). Use it when instantiating specifiers, so problems can be debugged. Move log-warning-minimum-level into C so that we can optimize ERROR_ME_DEBUG_WARN. Fix warning levels consistent with new definitions. Add default_ and parent fields to char table; not yet implemented. New fun Dynarr_verify(); use for further error checking on Dynarrs. Rearrange code at top of lisp.h in conjunction with dynarr changes. Fix eifree(). Use Eistrings in various places (format_event_object(), where_is_to_char(), and callers thereof) to avoid fixed-size strings buffers. New fun write_eistring(). Reindent and fix GPM code to follow standards. Set default MS Windows font to Lucida Console (same size as Courier New but less interline spacing, so more lines fit). Increase default frame size on Windows to 50 lines. (If that's too big for the workspace, the frame will be shrunk as necessary.) Fix problem with text files with no newlines (). (Change `convert-eol' coding system to use `nil' for autodetect, consistent with make-coding-system.) Correct compile warnings in vm-limit.c. Fix handling of reverse-direction charsets to avoid errors when opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el. Recode some object printing methods to use write_fmt_string() instead of a fixed buffer and sprintf. Turn on display of png comments as warnings (level `info'), now that they're unobtrusive. Revamped the sound documentation. Fixed bug in redisplay w.r.t. hscroll/truncation/continuation glyphs causing jumping up and down of the lines, since they're bigger than the line size. (It was seen most obviously when there's a horizontal scroll bar, e.g. do C-h a glyph or something like that.) The problem was that the glyph-contrib-p setting on glyphs was ignored even if it was set properly, which it wasn't until now.
author ben
date Fri, 29 Mar 2002 04:49:13 +0000
parents 79940b592197
children 2b676dc88c66
comparison
equal deleted inserted replaced
792:4e83fdb13eb9 793:e38acbeb1cae
4215 ;;Subsumed by view-lossage 4215 ;;Subsumed by view-lossage
4216 ;; Not really, I'm adding it back by popular demand. -slb 4216 ;; Not really, I'm adding it back by popular demand. -slb
4217 (defun show-message-log () 4217 (defun show-message-log ()
4218 "Show the \" *Message-Log*\" buffer, which contains old messages and errors." 4218 "Show the \" *Message-Log*\" buffer, which contains old messages and errors."
4219 (interactive) 4219 (interactive)
4220 (pop-to-buffer (get-buffer-create " *Message-Log*"))) 4220 (view-lossage t))
4221 4221
4222 (defvar log-message-filter-function 'log-message-filter 4222 (defvar log-message-filter-function 'log-message-filter
4223 "Value must be a function of two arguments: a symbol (label) and 4223 "Value must be a function of two arguments: a symbol (label) and
4224 a string (message). It should return non-nil to indicate a message 4224 a string (message). It should return non-nil to indicate a message
4225 should be logged. Possible values include 'log-message-filter and 4225 should be logged. Possible values include 'log-message-filter and
4256 (goto-char (point-max)) 4256 (goto-char (point-max))
4257 ;(insert (concat (upcase (symbol-name label)) ": " message "\n")) 4257 ;(insert (concat (upcase (symbol-name label)) ": " message "\n"))
4258 (let (extent) 4258 (let (extent)
4259 ;; Mark multiline message with an extent, which `view-lossage' 4259 ;; Mark multiline message with an extent, which `view-lossage'
4260 ;; will recognize. 4260 ;; will recognize.
4261 (when (string-match "\n" message) 4261 (save-match-data
4262 (setq extent (make-extent (point) (point))) 4262 (when (string-match "\n" message)
4263 (set-extent-properties extent '(end-open nil message-multiline t))) 4263 (setq extent (make-extent (point) (point)))
4264 (set-extent-properties extent '(end-open nil message-multiline t)))
4265 )
4264 (insert message "\n") 4266 (insert message "\n")
4265 (when extent 4267 (when extent
4266 (set-extent-property extent 'end-open t))) 4268 (set-extent-property extent 'end-open t)))
4267 (when (> (point-max) (max log-message-max-size (point-min))) 4269 (when (> (point-max) (max log-message-max-size (point-min)))
4268 ;; Trim log to ~90% of max size. 4270 ;; Trim log to ~90% of max size.
4332 (push msg log) 4334 (push msg log)
4333 (setcdr s (cdr (cdr s)))) 4335 (setcdr s (cdr (cdr s))))
4334 (setq s (cdr s)))))) 4336 (setq s (cdr s))))))
4335 ;; (possibly) log each removed message 4337 ;; (possibly) log each removed message
4336 (while log 4338 (while log
4337 (condition-case e 4339 (with-trapping-errors
4338 (run-hook-with-args 'remove-message-hook 4340 :operation 'remove-message-hook
4339 (car (car log)) (cdr (car log))) 4341 :class 'message-log
4340 (error (setq remove-message-hook nil) 4342 :error-form (progn
4341 (lwarn 'message-log 'warning 4343 (setq remove-message-hook nil)
4342 "Error caught in `remove-message-hook': %s" 4344 (let ((inhibit-read-only t))
4343 (error-message-string e)) 4345 (erase-buffer " *Echo Area*")))
4344 (let ((inhibit-read-only t)) 4346 :resignal t
4345 (erase-buffer " *Echo Area*")) 4347 (run-hook-with-args 'remove-message-hook
4346 (signal (car e) (cdr e)))) 4348 (car (car log)) (cdr (car log))))
4347 (setq log (cdr log))))) 4349 (setq log (cdr log)))))
4348 4350
4349 (defun append-message (label message &optional frame stdout-p) 4351 (defun append-message (label message &optional frame stdout-p)
4350 (or frame (setq frame (selected-frame))) 4352 (or frame (setq frame (selected-frame)))
4351 ;; Add a new entry to the message-stack, or modify an existing one 4353 ;; Add a new entry to the message-stack, or modify an existing one
4438 "Minimum level of warnings that should be logged. 4440 "Minimum level of warnings that should be logged.
4439 The warnings in levels below this are completely ignored, as if they never 4441 The warnings in levels below this are completely ignored, as if they never
4440 happened. 4442 happened.
4441 4443
4442 The recognized warning levels, in decreasing order of priority, are 4444 The recognized warning levels, in decreasing order of priority, are
4443 'emergency, 'alert, 'critical, 'error, 'warning, 'notice, 'info, and 4445 'emergency, 'critical, 'error, 'warning, 'alert, 'notice, 'info, and
4444 'debug. 4446 'debug.
4445 4447
4446 See also `display-warning-minimum-level'. 4448 See also `display-warning-minimum-level'.
4447 4449
4448 You can also control which warnings are displayed on a class-by-class 4450 You can also control which warnings are displayed on a class-by-class
4449 basis. See `display-warning-suppressed-classes' and 4451 basis. See `display-warning-suppressed-classes' and
4450 `log-warning-suppressed-classes'." 4452 `log-warning-suppressed-classes'.
4451 :type '(choice (const emergency) (const alert) (const critical) 4453
4452 (const error) (const warning) (const notice) 4454 For a description of the meaning of the levels, see `display-warning.'"
4455 :type '(choice (const emergency) (const critical)
4456 (const error) (const warning) (const alert) (const notice)
4453 (const info) (const debug)) 4457 (const info) (const debug))
4454 :group 'warnings) 4458 :group 'warnings)
4455 4459
4456 (defcustom display-warning-minimum-level 'info 4460 (defcustom display-warning-minimum-level 'warning
4457 "Minimum level of warnings that should be displayed. 4461 "Minimum level of warnings that cause the warnings buffer to be displayed.
4458 The warnings in levels below this will be generated, but not 4462 Warnings at this level or higher will force the *Warnings* buffer, in which
4459 displayed. 4463 the warnings are logged, to be displayed. The warnings in levels below
4464 this, but at least as high as `log-warning-suppressed-classes', will be
4465 shown in the minibuffer.
4460 4466
4461 The recognized warning levels, in decreasing order of priority, are 4467 The recognized warning levels, in decreasing order of priority, are
4462 'emergency, 'alert, 'critical, 'error, 'warning, 'notice, 'info, and 4468 'emergency, 'critical, 'error, 'warning, 'alert, 'notice, 'info, and
4463 'debug. 4469 'debug.
4464 4470
4465 See also `log-warning-minimum-level'. 4471 See also `log-warning-minimum-level'.
4466 4472
4467 You can also control which warnings are displayed on a class-by-class 4473 You can also control which warnings are displayed on a class-by-class
4468 basis. See `display-warning-suppressed-classes' and 4474 basis. See `display-warning-suppressed-classes' and
4469 `log-warning-suppressed-classes'." 4475 `log-warning-suppressed-classes'.
4470 :type '(choice (const emergency) (const alert) (const critical) 4476
4471 (const error) (const warning) (const notice) 4477 For a description of the meaning of the levels, see `display-warning.'"
4478 :type '(choice (const emergency) (const critical)
4479 (const error) (const warning) (const alert) (const notice)
4472 (const info) (const debug)) 4480 (const info) (const debug))
4473 :group 'warnings) 4481 :group 'warnings)
4474 4482
4475 (defvar log-warning-suppressed-classes nil 4483 (defvar log-warning-suppressed-classes nil
4476 "List of classes of warnings that shouldn't be logged or displayed. 4484 "List of classes of warnings that shouldn't be logged or displayed.
4498 4506
4499 (defvar warning-count 0 4507 (defvar warning-count 0
4500 "Count of the number of warning messages displayed so far.") 4508 "Count of the number of warning messages displayed so far.")
4501 4509
4502 (defconst warning-level-alist '((emergency . 8) 4510 (defconst warning-level-alist '((emergency . 8)
4503 (alert . 7) 4511 (critical . 7)
4504 (critical . 6) 4512 (error . 6)
4505 (error . 5) 4513 (warning . 5)
4506 (warning . 4) 4514 (alert . 4)
4507 (notice . 3) 4515 (notice . 3)
4508 (info . 2) 4516 (info . 2)
4509 (debug . 1))) 4517 (debug . 1)))
4510 4518
4511 (defun warning-level-p (level) 4519 (defun warning-level-p (level)
4512 "Non-nil if LEVEL specifies a warning level." 4520 "Non-nil if LEVEL specifies a warning level."
4513 (and (symbolp level) (assq level warning-level-alist))) 4521 (and (symbolp level) (assq level warning-level-alist)))
4522
4523 (defun warning-level-< (level1 level2)
4524 "Non-nil if warning level LEVEL1 is lower than LEVEL2."
4525 (check-argument-type 'warning-level-p level1)
4526 (check-argument-type 'warning-level-p level2)
4527 (< (cdr (assq level1 warning-level-alist))
4528 (cdr (assq level2 warning-level-alist))))
4514 4529
4515 ;; If you're interested in rewriting this function, be aware that it 4530 ;; If you're interested in rewriting this function, be aware that it
4516 ;; could be called at arbitrary points in a Lisp program (when a 4531 ;; could be called at arbitrary points in a Lisp program (when a
4517 ;; built-in function wants to issue a warning, it will call out to 4532 ;; built-in function wants to issue a warning, it will call out to
4518 ;; this function the next time some Lisp code is evaluated). Therefore, 4533 ;; this function the next time some Lisp code is evaluated). Therefore,
4533 4548
4534 (add-hook 'after-init-hook 'after-init-display-warnings) 4549 (add-hook 'after-init-hook 'after-init-display-warnings)
4535 4550
4536 (defun display-warning (class message &optional level) 4551 (defun display-warning (class message &optional level)
4537 "Display a warning message. 4552 "Display a warning message.
4538 CLASS should be a symbol describing what sort of warning this is, such 4553
4539 as `resource' or `key-mapping'. A list of such symbols is also 4554 \[This is the most basic entry point for displaying a warning. In practice,
4540 accepted. (Individual classes can be suppressed; see 4555 `lwarn' or `warn' are probably more convenient for most usages.]
4541 `display-warning-suppressed-classes'.) Optional argument LEVEL can 4556
4542 be used to specify a priority for the warning, other than default priority 4557 CLASS should be a symbol describing what sort of warning this is, such as
4543 `warning'. (See `display-warning-minimum-level'). The message is 4558 `resource' or `key-mapping' -- this refers, more or less, to the module in
4544 inserted into the *Warnings* buffer, which is made visible at appropriate 4559 which the warning is generated and serves to group warnings together with
4545 times." 4560 similar semantics. A list of such symbols is also accepted.
4561
4562 Optional argument LEVEL can be used to specify a priority for the warning,
4563 other than default priority `warning'. The currently defined levels are,
4564 from highest to lowest:
4565
4566 Level Meaning
4567 -----------------------------------------------------------------------------
4568 emergency A fatal or near-fatal error. XEmacs is likely to crash.
4569
4570 critical A serious, nonrecoverable problem has occurred -- e.g., the
4571 loss of a major subsystem, such as the crash of the X server
4572 when XEmacs is connected to the server.
4573
4574 error A warning about a problematic condition that should be fixed,
4575 and XEmacs cannot work around it -- it causes a failure of an
4576 operation. (In most circumstances, consider just signalling
4577 an error). However, there is no permanent damage and the
4578 situation is ultimately recoverable.
4579
4580 warning A warning about a problematic condition that should be fixed,
4581 but XEmacs can work around it.
4582
4583 \[By default, warnings above here, as well as being logged, cause the
4584 *Warnings* buffer to be forcibly displayed, so that the warning (and
4585 previous warnings, since often a whole series of warnings are issued at
4586 once) can be examined in detail. Also, the annoying presence of the
4587 *Warnings* buffer will encourage people to go out and fix the
4588 problem. Warnings below here are displayed in the minibuffer as well as
4589 logged in the *Warnings* buffer. but the *Warnings* buffer will not be
4590 forcibly shown, as these represent conditions the user is not expected to
4591 fix.]
4592
4593 alert A warning about a problematic condition that can't easily be
4594 fixed (often having to do with the external environment), and
4595 causes a failure. We don't force the *Warnings* buffer to be
4596 displayed because the purpose of doing that is to force the
4597 user to fix the problem so that the buffer no longer appears.
4598 When the problem is outside the user's control, forcing the
4599 buffer is pointless and annoying.
4600
4601 notice A warning about a problematic condition that can't easily be
4602 fixed (often having to do with the external environment),
4603 but XEmacs can work around it.
4604
4605 info Random info about something new or unexpected that was noticed;
4606 does not generally indicate a problem.
4607
4608 \[By default, warnings below here are ignored entirely. All warnings above
4609 here are logged in the *Warnings* buffer.]
4610
4611 debug A debugging notice; normally, not seen at all.
4612
4613 NOTE: `specifier-instance' outputs warnings at level `debug' when errors occur
4614 in the process of trying to instantiate a particular instantiator. If you
4615 want to see these, change `log-warning-minimum-level'.
4616
4617 There are two sets of variables. One controls the lower level (see the
4618 above diagram) -- i.e. ignored entirely. One controls the upper level --
4619 whether the *Warnings* buffer is forcibly displayed. In particular:
4620
4621 `display-warning-minimum-level' sets the upper level (see above), and
4622 `log-warning-minimum-level' the lower level.
4623
4624 Individual classes can be suppressed. `log-warning-suppressed-classes'
4625 specifies a list of classes where warnings on those classes will be treated
4626 as if their level is below `log-warning-minimum-level' (i.e. they will be
4627 ignored completely), regardless of their actual level. Similarly,
4628 `display-warning-suppressed-classes' specifies a list of classes where
4629 warnings on those classes will be treated as if their level is below
4630 `display-warning-minimum-level', but above `log-warning-minimum-level' so
4631 long as they're not listed in that variable as well."
4546 (or level (setq level 'warning)) 4632 (or level (setq level 'warning))
4547 (or (listp class) (setq class (list class))) 4633 (or (listp class) (setq class (list class)))
4548 (check-argument-type 'warning-level-p level) 4634 (check-argument-type 'warning-level-p level)
4549 (if (and (not (featurep 'infodock)) 4635 (if (and (not (featurep 'infodock))
4550 (not init-file-loaded)) 4636 (not init-file-loaded))
4571 ;; to get the C code's attention. 4657 ;; to get the C code's attention.
4572 (incf display-warning-tick)) 4658 (incf display-warning-tick))
4573 (with-current-buffer buffer 4659 (with-current-buffer buffer
4574 (goto-char (point-max)) 4660 (goto-char (point-max))
4575 (incf warning-count) 4661 (incf warning-count)
4576 (princ (format "(%d) (%s/%s) " 4662 (let ((start (point)))
4577 warning-count 4663 (princ (format "(%d) (%s/%s) "
4578 (mapconcat 'symbol-name class ",") 4664 warning-count
4579 level) 4665 (mapconcat 'symbol-name class ",")
4580 buffer) 4666 level)
4581 (princ message buffer) 4667 buffer)
4582 (terpri buffer) 4668 (princ message buffer)
4583 (terpri buffer))))))) 4669 (terpri buffer)
4670 (terpri buffer)
4671 (let ((ex (make-extent start (point))))
4672 (set-extent-properties ex
4673 `(warning t warning-count ,warning-count
4674 warning-class ,class
4675 warning-level ,level)))))
4676 (message "%s: %s" (capitalize (symbol-name level)) message))))))
4584 4677
4585 (defun warn (&rest args) 4678 (defun warn (&rest args)
4586 "Display a warning message. 4679 "Display a formatted warning message at default class and level.
4587 The message is constructed by passing all args to `format'. The message 4680 The message is constructed by passing all args to `format'. The message
4588 is placed in the *Warnings* buffer, which will be popped up at the next 4681 is placed in the *Warnings* buffer, which will be popped up at the next
4589 redisplay. The class of the warning is `warning'. See also 4682 redisplay. The class of the warning is `general'; the level is `warning'.
4590 `display-warning'." 4683
4591 (display-warning 'warning (apply 'format args))) 4684 See `display-warning' for more info."
4685 (display-warning 'default (apply 'format args)))
4592 4686
4593 (defun lwarn (class level &rest args) 4687 (defun lwarn (class level &rest args)
4594 "Display a labeled warning message. 4688 "Display a formatted warning message at specified class and level.
4595 CLASS should be a symbol describing what sort of warning this is, such 4689 The message is constructed by passing all args to `format'. The message
4596 as `resource' or `key-mapping'. A list of such symbols is also 4690 is placed in the *Warnings* buffer, which will be popped up at the next
4597 accepted. (Individual classes can be suppressed; see 4691 redisplay.
4598 `display-warning-suppressed-classes'.) If non-nil, LEVEL can be used 4692
4599 to specify a priority for the warning, other than default priority 4693 See `display-warning' for more info."
4600 `warning'. (See `display-warning-minimum-level'). The message is
4601 inserted into the *Warnings* buffer, which is made visible at appropriate
4602 times.
4603
4604 The rest of the arguments are passed to `format'."
4605 (display-warning class (apply 'format args) 4694 (display-warning class (apply 'format args)
4606 (or level 'warning))) 4695 (or level 'warning)))
4607 4696
4608 (defvar warning-marker nil) 4697 (defvar warning-marker nil)
4609 4698
4636 "Return the printable name of this instance of Emacs." 4725 "Return the printable name of this instance of Emacs."
4637 (cond ((featurep 'infodock) "InfoDock") 4726 (cond ((featurep 'infodock) "InfoDock")
4638 ((featurep 'xemacs) "XEmacs") 4727 ((featurep 'xemacs) "XEmacs")
4639 (t "Emacs"))) 4728 (t "Emacs")))
4640 4729
4641 (defun debug-print (format &rest args) 4730 (defun debug-print-1 (&rest args)
4731 "Send a debugging-type string to standard output.
4732 If the first argument is a string, it is considered to be a format
4733 specifier if there are sufficient numbers of other args, and the string is
4734 formatted using (apply #'format args). Otherwise, each argument is printed
4735 individually in a numbered list."
4736 (let ((standard-output 'external-debugging-output)
4737 (fmt (condition-case nil
4738 (and (stringp (first args))
4739 (apply #'format args))
4740 (error nil))))
4741 (if fmt
4742 (progn
4743 (prin1 (apply #'format args))
4744 (terpri))
4745 (princ "--> ")
4746 (let ((i 1))
4747 (dolist (sgra args)
4748 (if (> i 1) (princ " "))
4749 (princ (format "%d. " i))
4750 (prin1 sgra)
4751 (incf i))
4752 (terpri)))))
4753
4754 (defun debug-print (&rest args)
4642 "Send a string to the debugging output. 4755 "Send a string to the debugging output.
4643 The string is formatted using (apply #'format FORMAT ARGS)." 4756 If the first argument is a string, it is considered to be a format
4644 (princ (apply #'format format args) 'external-debugging-output)) 4757 specifier if there are sufficient numbers of other args, and the string is
4758 formatted using (apply #'format args). Otherwise, each argument is printed
4759 individually in a numbered list."
4760 (let ((standard-output 'external-debugging-output))
4761 (apply #'debug-print-1 args)))
4762
4763 (defun debug-backtrace ()
4764 "Send a backtrace to the debugging output."
4765 (let ((standard-output 'external-debugging-output))
4766 (backtrace nil t)
4767 (terpri)))
4645 4768
4646 ;;; simple.el ends here 4769 ;;; simple.el ends here