all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Customization maxima mode
@ 2008-06-19  9:53 Lorenzo Isella
  2008-06-19 21:11 ` Nikolaj Schumacher
  2008-06-19 22:21 ` David Hansen
  0 siblings, 2 replies; 5+ messages in thread
From: Lorenzo Isella @ 2008-06-19  9:53 UTC (permalink / raw)
  To: help-gnu-emacs

Dear All,
I use emacs, among other things, also to edit some simple batch files
for the computer-algebra system maxima
(http://maxima.sourceforge.net/). Thanks to this mailing list, I
managed to add some simple customization to other modules (python,
aucted, R etc...), but for some reason this fails for maxima-mode.
An example from my .emacs file:

  (defun insert-round () "custom redefined insert-round" (interactive)
     (insert "()")       ; typing "(" automatically insert "()"
     (backward-char 1)) ;and go between them: no more matching problems!

(local-set-key "(" 'insert-round)

(add-hook 'Maxima-mode-hook
         (lambda () (local-set-key "(" 'insert-round)))


(setq auto-mode-alist (cons '("\\.max" . maxima-mode) auto-mode-alist))
;(setq load-path (cons "/usr/share/maxima/5.9.0/emacs" load-path ))
(autoload 'maxima "maxima" "Running Maxima interactively" t)
(autoload 'maxima-mode "maxima" "Maxima editing mode" t)

So, how comes that when editing e.g. file calculations.max, typing (
does not autocomplete to () and cursor in between the brackets?
I suppose I must be making a trivial mistake; a similar procedure
gives no trouble with a .py file for instance.
I should add that the maxima mode seems to be recognized (I have
syntax highlighting and so on).
Many thanks for your help

Lorenzo




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Customization maxima mode
       [not found] <mailman.13565.1213869210.18990.help-gnu-emacs@gnu.org>
@ 2008-06-19 19:59 ` Rupert Swarbrick
  0 siblings, 0 replies; 5+ messages in thread
From: Rupert Swarbrick @ 2008-06-19 19:59 UTC (permalink / raw)
  To: help-gnu-emacs

"Lorenzo Isella" <lorenzo.isella@gmail.com> writes:

> An example from my .emacs file:
>
>   (defun insert-round () "custom redefined insert-round" (interactive)
>      (insert "()")       ; typing "(" automatically insert "()"
>      (backward-char 1)) ;and go between them: no more matching problems!
>
> (local-set-key "(" 'insert-round)
>
> (add-hook 'Maxima-mode-hook
>          (lambda () (local-set-key "(" 'insert-round)))
>
>
> (setq auto-mode-alist (cons '("\\.max" . maxima-mode) auto-mode-alist))
> ;(setq load-path (cons "/usr/share/maxima/5.9.0/emacs" load-path ))
> (autoload 'maxima "maxima" "Running Maxima interactively" t)
> (autoload 'maxima-mode "maxima" "Maxima editing mode" t)
>
> So, how comes that when editing e.g. file calculations.max, typing (
> does not autocomplete to () and cursor in between the brackets?
> I suppose I must be making a trivial mistake; a similar procedure
> gives no trouble with a .py file for instance.

Yep :) It's capitalization: you want maxima-mode-hook.

Note that 

   C-h a "Maxima.*mode-hook"

(without the quotes) comes up with it uncapitalized.

Also, (quick + dirty check) something that I do to check what's bound to
a hook is put a space after the quote temporarily:

(add-hook ' Maxima-mode-hook

and C-x C-e after the variable name. With maxima-mode-hook, you should
see nil or possibly maxima-font-setup. With the capital, you get an
error.



Rupert


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Customization maxima mode
  2008-06-19  9:53 Lorenzo Isella
@ 2008-06-19 21:11 ` Nikolaj Schumacher
  2008-06-19 22:15   ` Lorenzo Isella
  2008-06-19 22:21 ` David Hansen
  1 sibling, 1 reply; 5+ messages in thread
From: Nikolaj Schumacher @ 2008-06-19 21:11 UTC (permalink / raw)
  To: Lorenzo Isella; +Cc: help-gnu-emacs

"Lorenzo Isella" <lorenzo.isella@gmail.com> wrote:

> (add-hook 'Maxima-mode-hook
>          (lambda () (local-set-key "(" 'insert-round)))

Are you sure the hook name is capitalized?

regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Customization maxima mode
  2008-06-19 21:11 ` Nikolaj Schumacher
@ 2008-06-19 22:15   ` Lorenzo Isella
  0 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Isella @ 2008-06-19 22:15 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

Nikolaj Schumacher wrote:
> "Lorenzo Isella" <lorenzo.isella@gmail.com> wrote:
>
>   
>> (add-hook 'Maxima-mode-hook
>>          (lambda () (local-set-key "(" 'insert-round)))
>>     
>
> Are you sure the hook name is capitalized?
>
> regards,
> Nikolaj Schumacher
>
>   
You are absolutely right; now everything works fine.
Thanks

Lorenzo




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Customization maxima mode
  2008-06-19  9:53 Lorenzo Isella
  2008-06-19 21:11 ` Nikolaj Schumacher
@ 2008-06-19 22:21 ` David Hansen
  1 sibling, 0 replies; 5+ messages in thread
From: David Hansen @ 2008-06-19 22:21 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, 19 Jun 2008 11:53:23 +0200 Lorenzo Isella wrote:

>   (defun insert-round () "custom redefined insert-round" (interactive)
>      (insert "()")       ; typing "(" automatically insert "()"
>      (backward-char 1)) ;and go between them: no more matching problems!

There's `insert-pair'.

David





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-06-19 22:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.13565.1213869210.18990.help-gnu-emacs@gnu.org>
2008-06-19 19:59 ` Customization maxima mode Rupert Swarbrick
2008-06-19  9:53 Lorenzo Isella
2008-06-19 21:11 ` Nikolaj Schumacher
2008-06-19 22:15   ` Lorenzo Isella
2008-06-19 22:21 ` David Hansen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.