Some Notes on pari-mode ======================= pari-mode runs pari-gp as a sub process of (gnu-)emacs. INSTALATION. =========== pari-mode consists of three files: pari.txt, pari.el and pari.menu. 1) pari.menu should be placed in any convenient directory, and pari.el edited accordingly (see below). 2) pari.el should be installed in a directory in your EMACSLOADPATH. At the top of the file five constants are declared. gp-chap3, gp-dvi-preview, gp-man-dvi, gp-file-name, gp-menu These declarations must be edited to refer to the pathnames of the relevant files at your site. pari.el should then by byte-compiled (using M-x byte-compile-file in emacs). This should produce a compiled version pari.elc. 3) pari.txt (this file) is for information only. USE === To use pari-mode, users should add the following two lines to their .emacs (autoload 'gp "pari" " pari-gp" t) (autoload 'gpman "pari" " pari-gp manual" t) Or alternatively, if you always want pari to be loaded, just add the line (load "pari" nil t) In either case, three new commands are made available. M-x gp This starts up the pari-gp process in a new buffer, *PARI*. C-u M-x gp The same as M-x gp, but prompts for the command line arguments. M-x gpman This starts up a dvi previewer with the PARI-GP manual. =========================================================================== PARI-MODE ========= Inside the buffer *PARI*, the following extra commands are available. KEY LISP-NAME DESCRIPTION === ========= =========== RET gp-send-input Copy current expression to the end, and send to gp. M-RET gp-copy-input Copy current expression to the end. M-? gp-get-man-entry Display the manual entry for a gp command. M-\ p gp-set-prompt Set the gp prompt. M-\ c gp-help-menu Menu driven help. (Uses the file pari.menu.) M-\ t gp-meta-t \ M-\ d gp-meta-d | M-\ r gp-meta-r | M-\ w gp-meta-w | M-\ v gp-meta-v | M-\ x gp-meta-x \ Versions of the gp meta-commands, which M-\ s gp-meta-s / prompt for arguments in the mini-buffer M-\ a gp-meta-a | and display output in the help buffer. M-\ b gp-meta-b | M-\ m gp-meta-m | M-\ k gp-meta-k | M-\ q gp-meta-q / M-\ \ gp-break-long-line Break a long line at col. 100, inserting \. Note that most of these commands use the emacs meta key. This may be marked `left' `right' `extended character' `<>' or various other markings. If your keyboard has not got a meta key. You can use the escape key as a prefix. Thus M-\ corresponds to pressing meta and \ together, or pressing ESC followed by \ . =========================================================================== RET === If point is after the last gp-prompt, pressing RET sends current gp expression to the gp process. If point is at some previous expression, this expression (which may be several lines long) is copied to the end of the buffer and then executed. M-RET ===== M-RET, acts like RET, except that the expression is not sent to the gp process. It is just copied to the end, so that it may be edited, and then RET pressed, to send the new expression to gp. M-? === M-? prompts for the name of a gp command (which may include symbolic names like +). It then finds the appropriate paragraphs of section 3 of the manual, strips off some of the TeX commands, and displays the result in a new window. If the command is not found in the manual, sends ?command to gp, and displays the output in the help window. Thus M-? also works with user-defined commands. M-\ p ===== M-\ p prompts for a new string in the mini-buffer. The command \prompt= is then sent to gp, so that gp will now prompt for input with . The variable gp-prompt-string is also reset so that RET and M-RET, know that gp expressions now start with . Expressions typed to the old prompt are still recognised. M-\ c ===== This shows a menu of subject headings. Pressing RET selects the menu of commands for that heading. Pressing RET by one of the commands displays the manual entry for that command, as if M-? command had been typed. (Instructions are displayed in the mini-buffer.) M-\ \ ===== If the line is longer than 100, a \ is inserted every 100 characters. This is necessary if the line is longer than 256 characters as gp can not accept line longer than this. M-\ \ moves point to the end of the current line. M-\ === The other comands on the M-\ prefix send the appropriate meta command to gp. However they use the mini-buffer to read arguments (eg so that you can use filename completion) and display any output in the *gp-help* buffer. =========================================================================== Notes ===== 1) You may edit previous expressions, and then type RET to send them to gp. However if you want the *PARI* buffer to contain a script of a valid gp session, you may prefer to use M-RET to copy the expression to the end of the buffer, before editing it. 2) M-\ c is supposed to be a version of the gp meta comand \c, although it does not send \c to gp. M-\ p does not correspond to the gp meta command \p but rather to the command \prompt= . If this disturbs you it is easy enough to bind M-\ p to a command that inserts \p into the *PARI* buffer. The command gp-set-prompt can then be bound to any key sequence that you wish. All the other commands on the M-\ prefix do work by sending a gp meta command to the *PARI* buffer. 3) The menu of commands produced by M-\ c is contained in the file pari.menu. The functions do not assume any particular grouping of the gp functions into sections. Also the same gp command can appear in more than one section ( ^ already appears in two sections). The format of the file should be clear, and it can easily be edited to suit your requirements. There should be no blank lines at the beginning, and the file should end with a line just containing ###. The pari.menu file distributed is based on the table of contents of the user manual. 4) gp-mode-hook. Individual users can customise gp-mode without having to make copies of the file pari.el. In your .emacs define a gp-mode-hook, this will be run by the gp command. The format is: (setq gp-mode-hook (function (lambda () < list of commands to run when starting up gp > ))) An example is: (setq gp-mode-hook (function (lambda () (define-key gp-map "\M-\\p" 'gp-meta-p) (define-key gp-map "\M-p" 'gp-set-prompt) (setq gp-stack-size "1000000") (setq gp-prime-limit "2000") (setq gp-menu "my-menu") ))) This: Binds a function which sends \p to gp (which would need to be defined somewhere else), to M-\ p. Binds gp-set-prompt to M-p. Defines the default stack size and prime limit as 10000 and 2000. Defines the menu file to be my-menu rather than the file pari.menu. 5) Command line arguments. The gp executable file is specified in the variable gp-file-name. This is set in the file pari.el, but users can override this setting, either in their gp-mode-hook, or by using the C-u prefix to gp. In either case, the full path name need not be given if gp is in a directory specified in your PATH variable (or the equivalent in csh). The variables gp-stack-size, gp-buffer-size and gp-prime-limit should be set to strings specifying the arguments to gp. See the above example. If these variables are set to "", then the appropriate flags "-s", "-b" or "-p" are *not* sent to gp. If RET is typed in response to any of the prompts produced by C-u M-x gp then the default value, ie., the value of gp-file-name, gp-stack-size, gp-buffer-size or gp-prime-limit, is assumed. If a space is sent to the prompt (ie SPC RET) then the appropriate argument is not sent to gp, even if the default is non-empty. Developers of pari-gp, and others who often use different settings for these arguments, may like to add the line (setq gp-prompt-for-args t) to their gp-mode-hook. Setting this variable to a non-nil value such as t makes M-x gp act like C-u M-x gp. =========================================================================== David Carlisle 16/12/91 ( This file refers to pari.el version 2.9 )