ncalexan committed a9649ad

Commit before new release.

Comments (0)

Files changed (3)


+;;;; `Cython' mode.
   `((,(concat "\\<\\(NULL"
      1 font-lock-keyword-face t))))


 ;; buffers.
 (require 'python)
+(require 'sage)
 (add-to-list 'auto-mode-alist '("\\.pyx\\'" . pyrex-mode))
 (add-to-list 'auto-mode-alist '("\\.pxd\\'" . pyrex-mode))
-(define-derived-mode pyrex-mode python-mode "Pyrex"
+(define-derived-mode pyrex-mode sage-mode "Pyrex"
   (set (make-local-variable 'outline-regexp)
        (rx (* space) (or "class" "def" "cdef" "cpdef" "elif" "else" "except" "finally"
 			 "for" "if" "try" "while" "with")
     (unless bos (python-beginning-of-statement))
     (looking-at (rx (and (or "if" "else" "elif" "while" "for" "def" "cdef" "cpdef"
-			     "class" "try" "except" "finally" "with")
+			     "class" "try" "except" "finally" "with"
+			     "EXAMPLES:" "TESTS:" "INPUT:" "OUTPUT:")
 (defadvice python-open-block-statement-p 
   ;; this strange incantation calls the original python-open-block-statement
   ;; unless we're in a derived mode.  The (setq ad-return-value ...) is how
   ;; one modifies the return value of advised functions.
-  (if (not (pyrex-mode-p))
+  (if (not (or (sage-mode-p) (pyrex-mode-p)))
     (setq ad-return-value (apply 'pyrex-open-block-statement-p rest))))


   (message "Waiting for sage: prompt...")
   (with-current-buffer sage-buffer
     (let* ((sprocess (get-buffer-process sage-buffer))
-	    (success nil)
-	    (timeout 0))
+	   (success nil)
+	   (timeout 0))
       (while (progn
 	       (if (not (eq (process-status sprocess) 'run))
 		   (error "SAGE process has died unexpectedly.")
   "Delete output from interpreter since last input, moving it to *sage-output* buffer.
 Does not delete the prompt."
+  (with-current-buffer sage-buffer
   (let ((proc (get-buffer-process (current-buffer)))
 	(replacement nil)
 	(saved nil)
 	(insert saved))
       ;; and possibly display the output-buffer, either in status bar or onscreen
       (if (with-current-buffer output-buffer (> (point-max) (point-min)))
-	  (display-buffer output-buffer)))))
+	  (display-buffer output-buffer))))))
 ;;;_* SAGE process management
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.