Re: [sage-devel] inferior sage in emacs, bug?

2012-04-11 Thread Ivan Andrus

On Apr 11, 2012, at 12:28 AM, Benjamin Jones wrote:

 I cloned the hg repo and produced an spkg from that directory. I see
 the problem now.
 
 I've got the correct spkg file now, and emacs doesn't complain on
 loading a .py file, but now I get another error after `M-x sage`:
 Unknown button type `help-xref'

Do you mean that you downloaded a pre-made spkg, or that you rebuilt the spkg 
from mercurial?  

The reason I ask is that there is a commit since the latest stable version [1] 
which seems to be related.

OTOH, if making it from mercurial doesn't give a correct spkg, then I'll have 
to fix that.

-Ivan

[1] https://bitbucket.org/ncalexan/sage-mode/changeset/4e9e72fc639f

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] inferior sage in emacs, bug?

2012-04-10 Thread Ezequiel Birman
Are sage-mode inferior-sage-mode and sage-view still supported?

I (kind of) managed to get an Inferior Sage. Is there a way to eval last
expresion in sage-mode instead of the whole buffer (C-c C-r)?

I am using latest sage (4.8) and sage-mode cloned from mercurial
repo.  (by the way, I've built and installed sage-mode python packages in
the default location: /usr/lib/python2.7/site-packages/ Should I move
them under the sage dir hierarchy? ie. overwrite the old python packages
installed by sage 4.8?)

After 'M-x sage' i got this error:

 compilation-forget-errors: Wrong type argument: hash-table-p, nil

and buffer *SAGE-main* is in commint-run mode. No inferior-sage-mode.

The problem seems to lie in python-send-command. I'm not quite sure, but
i've added

 ;;; hack to avoid error in python-send-command
 (add-hook 'sage-startup-before-prompt-hook (lambda () 
(compilation-minor-mode 1)))

which initializes a hash table needed by compilation-mode, to my .emacs.

Now, after 'M-x sage' *SAGE-main* pops-up properly but i still get:

 comint-redirect-send-command-to-process: No prompt found or
 `comint-prompt-regexp' not set properly

but comint-prompt-regexp local value for buffer *SAGE-main* is:

 
^\\(?:\\(?:\\(?:(\\(?:[Pg]db)\\)\\|\\.\\.\\.\\(?:\\.\\.\\)?\\|\\|ipdb\\|sage:\\)\\)
 \\)+

Here is a portion of my .emacs:

 sage-mode
;;; https://bitbucket.org/ncalexan/sage-mode
;;; http://wiki.sagemath.org/sage-mode
;;(add-to-list 'load-path /usr/local/share/sage/data/emacs)
(add-to-list 'load-path /usr/local/src/sage/sage-mode/emacs)
(require 'sage)
(setq sage-command /usr/local/share/sage/sage)

;; If you want sage-view to typeset all your output and have plot()
;; commands inline, uncomment the following line and configure sage-view:
(autoload 'sage-view sage-view  t)

;; (add-hook 'sage-startup-before-prompt-hook
;;(lambda ()
;;  (set (make-local-variable 'compilation-locs)
;;   (make-hash-table :test 'equal :weakness 'value

;; (remove-hook 'sage-startup-before-prompt-hook 
'sage-send-startup-before-prompt-command)

(add-hook 'inferior-sage-mode-hook
  (function
   (lambda ()
 ;;(setq comint-redirect-perform-sanity-check t)
 (sage-view)
 ;; (sage-view-enable-inline-output)
 ;; (sage-view-enable-inline-plots)
 )))

;;; hack to avoid error in python-send-command
(add-hook 'sage-startup-before-prompt-hook
  (lambda () (compilation-minor-mode 1)))
  
(add-hook 'sage-mode-hook
  '(lambda () ; taken from 
http://www.cs.caltech.edu/courses/cs11/material/python/misc/python_style_guide.html#TABS
 (set-variable 'py-indent-offset 4)
 (set-variable 'py-smart-indentation nil)
 (set-variable 'indent-tabs-mode nil)))

Thank you

-- 
Ezequiel Birman

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] inferior sage in emacs, bug?

2012-04-10 Thread Florent Hivert
  Hi,

On Tue, Apr 10, 2012 at 06:38:54PM -0300, Ezequiel Birman wrote:
 Are sage-mode inferior-sage-mode and sage-view still supported?

Sure ! Though I'm not the main maintainer.

 I (kind of) managed to get an Inferior Sage. Is there a way to eval last
 expresion in sage-mode instead of the whole buffer (C-c C-r)?
 
 I am using latest sage (4.8) and sage-mode cloned from mercurial
 repo.  (by the way, I've built and installed sage-mode python packages in
 the default location: /usr/lib/python2.7/site-packages/ Should I move
 them under the sage dir hierarchy? ie. overwrite the old python packages
 installed by sage 4.8?)

If you are cloning from mercurial, you are probably missing the auto-generated
autoload file named sage-load.el which is used to load the different emacs
lisp files. Two solutions:

1 - either install the spkg from http://wiki.sagemath.org/sage-mode which
contains the missing file.

OR

2 - regenerate the file yourself. It is done by the command
sage-update-autoloads; but it assume that your sage mode is installed in
 ~/emacs/sage/emacs/. See the end of sage.el

Cheers,

Florent

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] inferior sage in emacs, bug?

2012-04-10 Thread Benjamin Jones
On Tue, Apr 10, 2012 at 4:38 PM, Ezequiel Birman
stormwa...@espiga4.com.ar wrote:
 Are sage-mode inferior-sage-mode and sage-view still supported?

 I (kind of) managed to get an Inferior Sage. Is there a way to eval last
 expresion in sage-mode instead of the whole buffer (C-c C-r)?

 I am using latest sage (4.8) and sage-mode cloned from mercurial
 repo.  (by the way, I've built and installed sage-mode python packages in
 the default location: /usr/lib/python2.7/site-packages/ Should I move
 them under the sage dir hierarchy? ie. overwrite the old python packages
 installed by sage 4.8?)



I was playing around with sage-mode recently too, but I couldn't even
get it to load. I did `sage -f sage-mode-0.7.spkg` and added the lines
{{{
(add-to-list 'load-path (expand-file-name
/Users/jonesbe/sage/sage-4.8/data/emacs))
(require 'sage sage)
(setq sage-command /Users/jonesbe/sage/sage-4.8/sage)
}}}

to my .emacs file, but when I load a python or sage script now, I get
an error: File error: Cannot open load file, sage-load. I don't see
a sage-load.el file anywhere in the spkg.

--
Benjamin Jones

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] inferior sage in emacs, bug?

2012-04-10 Thread Florent Hivert
Hi, 

 I was playing around with sage-mode recently too, but I couldn't even
 get it to load. I did `sage -f sage-mode-0.7.spkg` and added the lines
 {{{
 (add-to-list 'load-path (expand-file-name
 /Users/jonesbe/sage/sage-4.8/data/emacs))
 (require 'sage sage)
 (setq sage-command /Users/jonesbe/sage/sage-4.8/sage)
 }}}
 
 to my .emacs file, but when I load a python or sage script now, I get
 an error: File error: Cannot open load file, sage-load. I don't see
 a sage-load.el file anywhere in the spkg.

Where did you get the spkg ? I just downloaded the spkg from
http://wiki.sagemath.org/sage-mode?action=AttachFiledo=viewtarget=sage-mode-0.7.spkg
and the file is there:

$ wget -q 
'http://wiki.sagemath.org/sage-mode?action=AttachFiledo=gettarget=sage-mode-0.7.spkg'
 -O sage-mode-0.7.spkg
$ tar tf sage-mode-0.7.spkg | grep sage-load
sage-mode-0.7/emacs/sage-load.el

Cheers,

Florent

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] inferior sage in emacs, bug?

2012-04-10 Thread Benjamin Jones
On Tue, Apr 10, 2012 at 5:23 PM, Florent Hivert florent.hiv...@lri.fr wrote:
    Hi,

 I was playing around with sage-mode recently too, but I couldn't even
 get it to load. I did `sage -f sage-mode-0.7.spkg` and added the lines
 {{{
 (add-to-list 'load-path (expand-file-name
 /Users/jonesbe/sage/sage-4.8/data/emacs))
 (require 'sage sage)
 (setq sage-command /Users/jonesbe/sage/sage-4.8/sage)
 }}}

 to my .emacs file, but when I load a python or sage script now, I get
 an error: File error: Cannot open load file, sage-load. I don't see
 a sage-load.el file anywhere in the spkg.

 Where did you get the spkg ? I just downloaded the spkg from
 http://wiki.sagemath.org/sage-mode?action=AttachFiledo=viewtarget=sage-mode-0.7.spkg
 and the file is there:

 $ wget -q 
 'http://wiki.sagemath.org/sage-mode?action=AttachFiledo=gettarget=sage-mode-0.7.spkg'
  -O sage-mode-0.7.spkg
 $ tar tf sage-mode-0.7.spkg | grep sage-load
 sage-mode-0.7/emacs/sage-load.el

 Cheers,

 Florent

I cloned the hg repo and produced an spkg from that directory. I see
the problem now.

I've got the correct spkg file now, and emacs doesn't complain on
loading a .py file, but now I get another error after `M-x sage`:
Unknown button type `help-xref'

Thanks for the help, Florent.

--
Benjamin Jones

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] inferior sage in emacs, bug?

2012-04-10 Thread Florent Hivert
  Hi

 I've got the correct spkg file now, and emacs doesn't complain on
 loading a .py file, but now I get another error after `M-x sage`:
 Unknown button type `help-xref'

Hum ! As I said, I'm not the maintainer of the package and this is going
quickly out of my expertise range...

I would guess that the problem is now with your emacs install. As far as I
understand, on my computer this is defined in standard with emacs in the file
/usr/share/emacs/23.1/lisp/help-mode.elc
which is distributed in the base emacs package (emacs-23.1-18.1.x86_64.rpm
on an outdated OpenSuSE 11.3).

Cheers,

Florent

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] inferior sage in emacs, bug?

2012-04-10 Thread Benjamin Jones
On Tue, Apr 10, 2012 at 5:56 PM, Florent Hivert florent.hiv...@lri.fr wrote:
      Hi

 I've got the correct spkg file now, and emacs doesn't complain on
 loading a .py file, but now I get another error after `M-x sage`:
 Unknown button type `help-xref'

 Hum ! As I said, I'm not the maintainer of the package and this is going
 quickly out of my expertise range...

 I would guess that the problem is now with your emacs install. As far as I
 understand, on my computer this is defined in standard with emacs in the file
    /usr/share/emacs/23.1/lisp/help-mode.elc
 which is distributed in the base emacs package (emacs-23.1-18.1.x86_64.rpm
 on an outdated OpenSuSE 11.3).

 Cheers,

 Florent


Yes, that could be it. I'm using emacs 23.3.1 on Mac OS X which I
installed using the Homebrew project (brew install emacs).
It seems that help-xref is referred to in my distribution at:

/usr/local/Cellar/emacs/23.3b/share/emacs/23.3/lisp/loaddefs.el

but I can't find where it's defined. For example, this appears in loaddefs.el:

{{{
(autoload 'help-xref-button help-mode \
Make a hyperlink for cross-reference text previously matched.
MATCH-NUMBER is the subexpression of interest in the last matched
regexp.  TYPE is the type of button to use.  Any remaining arguments are
passed to the button's help-function when it is invoked.
See `help-make-xrefs'.

\(fn MATCH-NUMBER TYPE rest ARGS) nil nil)
}}}

So it turns out if I load a .py file, then enable help-mode `M-x
help-mode`, and then load sage mode `M-x sage-mode` I get no
complaints out of emacs.

--
Benjamin Jones

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org