Ivan Andrus committed d36eddd

Added sage-site-packages-find-original
Fixes #23

  • Participants
  • Parent commits 29b8b77

Comments (0)

Files changed (2)

File emacs/sage-mode.el

   "Warn if sage FILE is in site-packages and offer to find current branch version."
   (let ((f (buffer-file-name (current-buffer))))
     (and f (string-match sage-site-packages-regexp f)
-         (if (y-or-n-p "This is a sage site-packages file, open the real file? ")
-             (sage-jump-to-development-version)
-           (push '(:propertize "SAGE-SITE-PACKAGES-FILE:" face font-lock-warning-face)
-                 mode-line-buffer-identification)))))
+         (let ((should-jump (if (eq sage-site-packages-find-original 'query)
+				(y-or-n-p "This is a sage site-packages file, open the real file? ")
+			      sage-site-packages-find-original)))
+	   (if should-jump
+	       (sage-jump-to-development-version)
+	     (push '(:propertize "SAGE-SITE-PACKAGES-FILE:" face font-lock-warning-face)
+		   mode-line-buffer-identification))))))
 (defun sage-development-version (filename)
   "If FILENAME is in site-packages, current branch version, else FILENAME."

File emacs/sage.el

   :group 'sage-build
   :type 'string)
+(defcustom sage-site-packages-find-original 'query
+  "If non-nil automatically jump to the development version of files.
+Such files are identified by `sage-site-packages-regexp'.  If equal to
+the symbol query then ask every time."
+  :group 'sage
+  :type '(choice (const :tag "Always" t)
+		 (const :tag "Never" nil)
+		 (const :tag "Ask" query)))
 (defgroup sage-view nil "Typeset Sage output on the fly"
   :group 'sage
   :prefix "sage-view-"