Commits

Nicolas M. Thiéry committed b1b00b3

Draft of update for compatibility with sage-mode 6.0

Comments (0)

Files changed (1)

emacs/sage-mode.el

     (nth 0 lst))))
 
 (defun sage-current-branch-link ()
-  "Return the current Sage branch link, i.e., the target of devel/sage."
+  "Return the current Sage branch link, i.e., the target of devel/sage. Meaningless with Sage 6.0."
   (interactive)
   (save-match-data
     (let ((lst (split-string (shell-command-to-string (concat sage-command " -branch")))))
 	"main"))))
 
 (defun sage-current-branch ()
-  "Return the current Sage branch name."
+  "Return the current Sage branch name. Meaningless with Sage 6.0."
   (interactive)
   (save-match-data
     (if (and (inferior-sage-mode-p)
 (defun sage-current-devel-root ()
   (interactive)
   "Return the current Sage branch directory."
-  (format "%s/devel/sage-%s" (sage-root) (sage-current-branch)))
+  (format "%s/src" (sage-root)))
 
 ;;;_* Sage major mode for editing Sage library code
 
 ;;     (add-to-list 'grep-files-aliases '("py" . "{*.py,*.pyx}"))
 ;;     (add-to-list 'grep-files-aliases '("pyx" . "{*.py,*.pyx}"))))
 
-;;;_ + Make devel/sage files play nicely, and don't jump into site-packages if possible
+;;;_ + Make src/sage files play nicely, and don't jump into site-packages if possible
 
 ;;; It's annoying to get lost in sage/.../site-packages version of files when
 ;;; `sage-find-symbol' and friends jump to files.  It's even more annoying when
 ;;; the file is not correctly recognized as sage source!
 
-(add-to-list 'auto-mode-alist '("devel/sage.*?\\.py\\'" . sage-mode))
-(add-to-list 'auto-mode-alist '("devel/sage.*?\\.pyx\\'" . pyrex-mode))
+(add-to-list 'auto-mode-alist '("src/sage.*?\\.py\\'" . sage-mode))
+(add-to-list 'auto-mode-alist '("src/sage.*?\\.pyx\\'" . pyrex-mode))
 
 (defvar sage-site-packages-regexp "\\(local/lib/python[0-9.]*/site-packages.*?\\)/sage"
   "Regexp to match sage site-packages files.
 
-Match group 1 will be replaced with devel/sage-branch")
+Match group 1 will be replaced with src")
 
 (add-hook 'find-file-hook 'sage-warn-if-site-packages-file)
 (defun sage-warn-if-site-packages-file()
     (let* ((match (string-match sage-site-packages-regexp filename)))
       (if (and filename match)
 	  ;; handle current branch somewhat intelligiently
-	  (let* ((base (concat (substring filename 0 (match-beginning 1)) "devel/"))
-		 (branch (or (file-symlink-p (concat base "sage")) "sage")))
-	    (concat base branch (substring filename (match-end 1))))
+	  (concat (substring filename 0 (match-beginning 1)) "src" (substring filename (match-end 1)))
 	filename))))
 
 (defun sage-jump-to-development-version ()
 (defadvice hg-root
   (before eshell-hg-root (&optional path))
   "Use current directory in eshell-mode for hg-root if possible.
-Use current devel directory in inferior-sage-mode for hg-root if possible."
+Use current devel directory in inferior-sage-mode for hg-root if possible.
+Meaningless with Sage 6.0."
   (when (derived-mode-p 'eshell-mode)	; buffer local in eshell buffers
     (ad-set-arg 0 default-directory))
   (when (inferior-sage-mode-p) ; buffer local in inferior sage buffers