Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. (when (version< emacs-version "24.4")
  2. (defun define-error (name message &optional parent)
  3. "Define NAME as a new error signal.
  4. MESSAGE is a string that will be output to the echo area if such an error
  5. is signaled without being caught by a `condition-case'.
  6. PARENT is either a signal or a list of signals from which it inherits.
  7. Defaults to `error'."
  8. (unless parent (setq parent 'error))
  9. (let ((conditions
  10. (if (consp parent)
  11. (apply #'nconc
  12. (mapcar (lambda (parent)
  13. (cons parent
  14. (or (get parent 'error-conditions)
  15. (error "Unknown signal `%s'" parent))))
  16. parent))
  17. (cons parent (get parent 'error-conditions)))))
  18. (put name 'error-conditions
  19. (delete-dups (copy-sequence (cons name conditions))))
  20. (when message (put name 'error-message message)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement