home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / utility / text / emacsdif.lha / emacs-18.58 / lisp / amiga-init.el < prev    next >
Encoding:
Text File  |  1992-05-16  |  4.4 KB  |  149 lines

  1. (load "amiga-mouse")
  2. (load "amiga-menu")
  3. (global-set-key "\C-\\A" 'previous-line)
  4. (global-set-key "\C-\\B" 'next-line)
  5. (global-set-key "\C-\\D" 'backward-char)
  6. (global-set-key "\C-\\C" 'forward-char)
  7. (global-set-key "\C-\\?~" 'info)
  8. (global-set-key "\C-\\T" 'scroll-down)
  9. (global-set-key "\C-\\S" 'scroll-up)
  10. (global-set-key "\C-\\ @" 'forward-word)
  11. (global-set-key "\C-\\ A" 'backward-word)
  12. (global-set-key "\C-\\\M-A" 'beginning-of-buffer)
  13. (global-set-key "\C-\\\M-B" 'end-of-buffer)
  14. (global-set-key "\C-\\\M-D" 'beginning-of-line)
  15. (global-set-key "\C-\\\M-C" 'end-of-line)
  16. (global-set-key "\C-\\\M- \M-@" 'forward-sexp)
  17. (global-set-key "\C-\\\M- \M-A" 'backward-sexp)
  18. (global-set-key "\C-z" 'amiga-iconify)
  19.  
  20. (defun scroll-down-1 ()
  21.   "Move up one line on screen"
  22.   (interactive)
  23.   (scroll-down 1))
  24.  
  25. (defun scroll-up-1 ()
  26.   "Move down one line on screen"
  27.   (interactive)
  28.   (scroll-up 1))
  29.  
  30. (global-set-key "\C-\\\M-T" 'scroll-down-1)
  31. (global-set-key "\C-\\\M-S" 'scroll-up-1)
  32.  
  33. ;; ARexx stuff
  34.  
  35. (setq amiga-arexx-processing nil)
  36. (setq amiga-arexx-errors nil)
  37. (defvar amiga-arexx-failat 5
  38.   "Return level from which arexx commands returns cause errors")
  39.  
  40. (defun amiga-arexx-process ()
  41.   (interactive)
  42.   (if (not amiga-arexx-processing)
  43.       (progn
  44.     (setq amiga-arexx-processing t)
  45.     (condition-case nil ; Avoid blocking of processing in case of bugs
  46.         (let (arexxcmd)
  47.           (while (setq arexxcmd (amiga-arexx-get-event))
  48.         (if (listp arexxcmd)
  49.             (setq amiga-arexx-errors (cons arexxcmd amiga-arexx-errors))
  50.             (let ((rc 0) result)
  51.               (condition-case err ; detect errors in arexx command
  52.               (let ((expr (car (read-from-string arexxcmd))))
  53.                 (setq result (prin1-to-string (eval expr))))
  54.             (error (progn
  55.                  (setq rc 20)
  56.                  (setq result (prin1-to-string err)))))
  57.               (amiga-arexx-reply rc result)))))
  58.       (error nil))
  59.     (setq amiga-arexx-processing nil))))
  60.  
  61. (defun amiga-arexx-wait-command (id)
  62.   "Waits for a pending ARexx commands to complete.
  63. Also processes any pending ARexx requests during this interval."
  64.   (amiga-arexx-process)
  65.   (while (amiga-arexx-check-command id)
  66.     (amiga-arexx-wait)
  67.     (amiga-arexx-process)))
  68.  
  69. (defconst amiga-arexx-error-messages
  70. ["No cause"
  71. "Program not found"
  72. "Execution galted"
  73. "Insufficient memory"
  74. "Invalid character"
  75. "Unmatched quote"
  76. "Unterminated comment"
  77. "Clause too long"
  78. "Invalid token"
  79. "Symbol or string too long"
  80. "Invalid message packet"
  81. "Command string error"
  82. "Error return from function"
  83. "Host environment not found"
  84. "Requested library not found"
  85. "Function not found"
  86. "Function did not return value"
  87. "Wrong number of arguments"
  88. "Invalid argument to function"
  89. "Invalid PROCEDURE"
  90. "Unexpected THEN or WHEN"
  91. "Unexpected ELSE or OTHERWISE"
  92. "Unexpected BREAK, LEAVE or ITERATE"
  93. "Invalid statement in SELECT"
  94. "Missing or multiple THEN"
  95. "Missing OTHERWISE"
  96. "Missing or unexpected END"
  97. "Symbol mismatch"
  98. "Invalid DO syntax"
  99. "Incomplete IF or SELECT"
  100. "Label not found"
  101. "Symbol expected"
  102. "Symbol or string expected"
  103. "Invalid keyword"
  104. "Required keyword missing"
  105. "Extraneous characters"
  106. "Keyword conflict"
  107. "Invalid template"
  108. "Invalid TRACE request"
  109. "Unitialized variable"
  110. "Invalid variable name"
  111. "Invalid expression"
  112. "Unbalanced parentheses"
  113. "Nesting limit exceeded"
  114. "Invalid expression result"
  115. "Expression required"
  116. "Boolean value not 0 or 1"
  117. "Arithmetic conversion error"
  118. "Invalid operand"
  119. ]
  120. "The arexx error messages, sorted by number")
  121.  
  122. (defun amiga-arexx-do-command (str as-file)
  123.   "Sends ARexx command str (like amiga-arexx-send-command) but waits
  124. for all pending commands to complete (including this one)."
  125.   (interactive "sARexx command: 
  126. P")
  127.   (let ((id (amiga-arexx-send-command str as-file)))
  128.     (amiga-arexx-wait-command id)
  129.     (let ((err (assq id amiga-arexx-errors)))
  130.       (if err
  131.       (let ((severity (car (cdr err))))
  132.         (setq amiga-arexx-errors (delq err amiga-arexx-errors))
  133.         (if (>= severity amiga-arexx-failat)
  134.         (let* ((error-code (car (cdr (cdr err))))
  135.                (error-message
  136.             (if (< error-code (length amiga-arexx-error-messages))
  137.                 (aref amiga-arexx-error-messages error-code)
  138.                 (format nil "Unknown error %d" error-code))))
  139.           (error "Arexx command failed, level %d, cause %s"
  140.              severity error-message))))))))
  141.  
  142. (global-set-key "\C-\\X" 'amiga-arexx-process)
  143. (setq amiga-arexx-initialized t) ;; ARexx commands can now be processed.
  144.  
  145. (setq completion-ignore-case t)
  146. ;; Default is no numbered versions on Amiga, because directory searches are too
  147. ;; slow.
  148. (setq version-control 'never) 
  149.