CHANGE HISTORY of pari.el ======================== ==== Version 1 (90) Modified Annete Hoffman's code, replacing her help routines by the system searching the TeX source of the manual. Added support for editing and re-entering previous expressions. ==== Version 2 (23/11/90) gp-get-man-entry fixed to work with the 1.34 version of the manual (the TeX format for entries such as + * etc had changed) gp-send-input and gp-copy-input now do the right thing on previous commands of the form ?command or \parameter= (they just send one line) Regexp for end of expression changed from "time =" to "time", so that it also matches "timer on" and "timer off". ==== Version 2.1 (27/11/90) Changed bin-dir to gp-file-name, mainly so that all global variables start with gp-. (let ((auto-load-alist nil))) in gp-get-man-entry to stop it loading TeX-mode. Various functions added bound to the M-\ key prefix. These shadow the gp meta commands \c \d \t \w \r . M-\ p this was on M-p, sets gp prompt. M-\ c Starts up a menu-driven version of gp-get-man-entry. M-\ t Like \t in gp, but the output is sent to another buffer. M-\ d Like \d in gp, but the output is sent to another buffer. M-\ w Like \w in gp, but allows use of file-name completion in the mini-buffer. M-\ r Like \r in gp, but allows use of file-name completion in the mini-buffer. The menu feature requires a file (pari.menu) the pathname for this is set in the new global variable gp-menu. I made pari.menu by editing users.toc, the TeX source for the table of contents of the manual. This file may be edited by hand, so as to group the gp commands under any desired headings. (The first word of each heading must be unique) ==== Version 2.2 (2/12/90) Renamed gp-meta-dt to gp-meta-command. Replaced (sit-for 1) in gp-meta-command by gp-wait-for-output. (sit-for 1) was too long for short output like \v, but not long enough for commands like \x if the last object was large. Replaced the two kill-line's in gp-meta-command by delete-regions, so as not to mess up the kill-ring. Also replaced a (forward-line -1) by (beginning-of-line) so that only the last line deleted. Simplified the process sentinels. gp-sentinel now kills all related buffers such as *gp-help* if they are present when gp quits. Added a few more of gp's meta commands. M-\ v Like \v in gp, but the output is sent to another buffer. M-\ x Like \x in gp, but the output is sent to another buffer. M-\ s Like \s in gp, but the output is sent to another buffer. (prompts for an argument, just hit RET to send \s) M-\ b Like \b in gp, but the output is sent to another buffer. (prompts for an argument, just hit RET to send \b) M-\ k Like \k in gp, but asks for confimation. M-\ q Like \q in gp, but asks for confimation. Added (ding) to gp-help-menu, when point wraps arround buffer. Took out the (if gp-map nil) stuff. The gp-map is now set up at the `outer level'. Added ! <-> fact to the special cases of gp-get-man-entry Added gp-interupt, bound to C-c Replaced the nested (if )'s in gp-get-man-entry by a (cond ) Modified gp-help-menu, so that the whole line of the section is significant, previous version only used the first word. ==== Version 2.3 (5/12/90) Let (gp) take a prefix argument. Any non-nil argument causes gp to prompt for the stack size and prime limit. NOTE With pari 1.35 the syntax will change. The following four lines in the definition of gp will be have to be changed. Delete the second two lines, and take the comment ;; pari 1.35 out of the first two lines. ;; pari 1.35 " -s " (read-input "stack size ? ") ;; pari 1.35 " -p " (read-input "prime limit ? "))) " " (read-input "stack size ? ") " " (read-input "prime limit ? "))) The file will then need to be (re-) byte-compiled. Changed the name of the variable gp-arguments to gp-default-arguments. ==== Version 2.4 (6/12/90) Added (run-hooks 'gp-mode-hook) to (gp). Individual users can now set up their preferences in gp-mode-hook in their .emacs. Added (run-hooksÿÿÿÿÿÿ x>uP”ÓèP”ΰP”ɸhook specifies a different version of the manual, and (gpman) is called before (gp). ==== Version 2.5 (20/12/90) Added det2 <-> det to the special cases of (gp-get-man-entry). Also added det2 to the file pari.menu. Modified (gp-get-man-entry). ========================== So that if no entry is found, it calls (gp-meta-command "?fn"). To make this work, took the (concat "\\" ) out of (gp-meta-command) and replaced eg (gp-meta-command "s") by (gp-meta-command "\\s"). So (gp-get-man-entry) now works with user-defined functions. Re-did (gp-send-input) and (gp-copy-input). ========================================= (gp-send-input) now calls (gp-copy-input) to save on duplication of most of the code. Method for determining the extent of the current expression changed. Previous versions searched back to a prompt, then if the first non space character was \ or ? sent one line, otherwise searched forward to the next prompt or error message. This failed spectacularly if the expression involved commands such as print or texprint. Also they did not treat the last expression very well, hence the need to use LFD when entering the last expression. Now, search back to a prompt, then if the first non space is {, search forward to the next } (or prompt/error message in case of bad expressions) otherwise search forward for the first line which does not end with a \ character. The markers last-input-end last-input-start is no longer needed. So removed from various points. These new versions also let you edit ALL lines of the last expression. So the section of pari.txt suggesting the use of LFD is deleted. However can not now send eg, {print("}")}, but do you want to? In any case expressions involving "}" still work if used with the \ convention. (gp-set-prompt) modified so that the new gp-prompt-string matches the new prompt AND all the old prompts. The section of pari.txt suggesting that this is only used once is deleted. (while) loop moved inside (gp-wait-for-output), so that the waiting *is* actually done by this function. (gp-meta-command) now sends string directly to pari-process, rather than inserting in *PARI* and calling (gp-send-input). ==== Version 2.6 (14/2/91) (gp-send-input) modified to send three \n's. This flushes out the output of \c. The old version of (gp-send-input) became confused when RET was pressed in response to the prompt: ---- (type return to continue) ---- (gp-meta-r) renamed to (gp-meta-R) and bound to M-\ R. A new (gp-meta-r) brings the file into emacs, and then sends the file to pari via (process-send-region). This causes function definitions, multi-line expressions and white space to be read correctly. These next changes were made in response to H. Cohen's mail (29/1/91). gp-prompt-pattern now does not start with "^", so it matches prompts that are not at the beginning of a line. This can happen with, eg: for(k=1,5,print1(k," ")) (gp-set-prompt) modified so as not to add a "^" to the user supplied string. (gp-copy-input) would have worked unchanged with the new prompt regexp, except that help commands are not understood. ?cos would have been interpreted as "cos" typed to the prompt "?". So I modified the algorithm for finding the start of the expression to the following: Search back to the prompt. Then move to the beginning of that line and search forward to a prompt. Thus if two `prompts' appear on one line, then the expression is taken to start after the FIRST. So: ? ?cos Is taken as the expression "?cos" typed to the first "?" prompt. (gp-process-sentinel) modified so as NOT to kill the *PARI* buffer. It deletes the window, but leaves the buffer in emacs. It also inserts any message from the exiting process at the end of the buffer. Other buffers eg pari.menu are still killed. (gp-meta-q) no longer asks for confirmation before killing the pari buffers, as *PARI* is not now killed by (gp-process-sentinel). (gp t) now asks for the gp file name and buffer size as well as the stack size and prime limit. The variable gp-default-argument replaced by the three variables: gp-stack-size, gp-buffer-size and gp-prime-limit. Just pressing RET in response to a prompt causes the argument to be set to the default. gp-stack-size should be a string representing the stack size, or "" in which case the "-s" argument is not sent to gp. As a special case if a space is sent to the prompt, the stack-size argument is not sent to gp. This allows (gp t) to a override non-empty default setting of gp-stack-size. Similarly for gp-buffer-size and gp-prime-limit. This has been simplified by the introduction of the `internal' function (gp-read-input) which deals with the handling of default argument strings. The command sent to the shell to start gp is now inserted in *PARI* buffer for the user's information. Back to me ... (gp-sentinel) modified to work correctly with alternative menu and TeX files. It now uses the variables gp-menu and gp-chap3. gp-prompt-pattern initialsed with defvar rather than defconst. Added new variable, gp-prompt-for-args. If users set this to a non-nil value in their gp-mode-hook, M-x gp acts like C-u M-x gp. Replaced instances of (delete-region (point-min) (point-max)) by (erase-buffer) at various points. (gp-meta-k) rewritten. (No change to its functionality.) (gpman) now uses (set-buffer) rather than (switch-to-buffer). ==== Version 2.7 (20/2/91) Undid the change to (gp-send-input) made in V2.6. Sending three consecutive new-lines does not work with pari 1.34.95 (aka 1.35) --- it causes three prompts to be printed. Instead of the above, add "---- (type return to continue) ----" to the regexp gp-prompt-pattern. Actually this causes two new-lines to be sent to this prompt (but who cares). Changed pari-process to gp-process, so that now all global variables have names starting with gp- Initialise gp-stack-size etc to "4000000" rather than "". This means that the default is for gp to have the argument "-s 4000000" rather than no argument. These are equivalent, but it makes the use of C-u M-x gp easier to describe. Moved (gp-meta-R) back to (gp-meta-r) (\r seems to work better in pari 1.34.95). ==== Version 2.7 (10/3/91) Take the version of 2.7 from the official release of pari-1.35. This is the same as my version except for the initial values of gp-man-dvi etc. ==== Version 2.8 (22/4/91) Added (message) commands to (gpman) and (gp-man-sentinel). Changed regexp for end of expression in (gp-copy-input) from "}" to "}$" This is more in line with what gp accepts and also allows expressions of the form: {print("}")} Redo the help menu. This is now a major mode rather than a lisp-loop. This has the advantage that the user can move around the menu using standard emacs commands, or the mouse as well as using SPC and DEL. Also can switch to/from the pari.menu buffer using standard commands. This involves the new keymap gp-menu-map, The help command is now (gp-menu), bound to M-\ c in *PARI* buffer. The commands (gp-menu-quit) (gp-menu-select) (gp-menu-previous) (gp-menu-next) are more or less taken straight from the main loop of 2.7 (gp-menu-main) is 2.7's (gp-main-menu) except that it is (interactive). (gp-menu-scroll) is a new command, bound to s, which scrolls the help window. (gp-menu-info) is just (message ). Replaced the (other-window 1) commands in (gp-meta-command) and (gp-get-man-entry) by (let ((wind (selected-window)) ... (select-window wind)) so that you return to the correct window when more than two windows are visible. Introduced (gp-replace a b) this replaces a by b everywhere in the current buffer. Removed each of the (goto-char (point-min)) (perform-replace ...) in (gp-get-man-entry) by (gp-replace ...). This saves the overheads of messing about with the mark, and (message) that the standard emacs replace functions do. Added the command (gp-break-long-line) after mail from H. Cohen. gp will not accept lines longer than 256 chars. gp-break-long-line (bound to M-\ \) breaks the current line at column 100, inserting \ as necessary. ==== Version 2.8+ (24/4/91) (Modification sent to H. Cohen) (gp-send-input) now uses a temporary file, gp-temp-file, which is read using \r if the expression contains more than 255 chars. This gets around the following two problems. 1) gp can not accept more than 255 chars in one line. 2) emacs can not send any string of more than 1500 or so characters using process-send-region. (gp-sentinel) modified to remove the file gp-temp-file if it exists. ==== Version 2.9 (13/12/91) Made (gp-break-long-line) base line-length on (screen width). The following changes were in response to Henri Cohen's mail of 13/12/91. Changed the regexp for "last expresion" in (gp-copy-input) so that: %[number] = Must come at the beginning of a line, and be followed by a space to be considered to be the result of gp returning a value. *** Must be the first thing on the line except for spaces to be considered an error message. So now you can enter the expressions %1 == %2 and print("***"). Added (let (shell-file-name "/bin/sh" ... to (gp-sentinel), hopefully this will avoid problems with people who alias rm to rm -i in their .\(k\|c\|ba\)shrc files. Added gp-meta-a and gp-meta-m identical to gp-meta-b except they send \a and \b. Bound them to M-\ a and M-\ m. ==== Version 2.9+ (16/12/91) Moved the call to (delete-windows-on "*PARI*") further down (gp-sentinel) so that the *PARI* buffer is never displayed after quiting gp. With the previous version, the current buffer could get set to the menu buffer, which was then immediately killed, causing the *PARI* buffer to be redisplayed. Modified the regexp in (gp-copy-input) for "time" and "unused characters" to match "***". Thus you can now enter print("time") ==== Version 2.10 (3/6/92) New version prompted by the release of pari-1.37! Replaced the shell-file-name stuff introduced in 2.9 by a call to (delete-file) Set process-mark in (gp-meta-command), and added (save-excursion) so that it works if not at the end of the buffer. Added completion functions. In the *PARI* buffer M-TAB calls (gp-complete) which will attempt to complete a fuction name. Repeating this causes a list of possible completions to be displayed. (gp-get-man-entry) if called interactively (M-?) now defaults to the word before point, and uses completion (with SPACE or TAB) in the minbuffer to enter the function name. Initially completion will only work on the functions listed in pari.menu. If M-? is used on a user-defined function, then the completion functions will `know' this new function. (gp-add-symbol) has been added to (gp-get-man-entry). Two new functions may be used in a gp-mode-hook (or interactively) to teach the completion system about more user-defined commands. (gp-completion-list "fooa" "foob" "fooc") Will let completion work for these three commands. (gp-completion-file my-command-file) Will add all the commands listed in the file, my-command-file. This should have the same format as pari.menu. one command per line, comments start with #, ALL TEXT BEFORE THE FIRST COMMENT IS IGNORED. The completion symbols are stored in the obarray gp-c-array, this has size gp-max-completions, which should be set large enough to store all possible command names. ==== Version 2.10+ (4/6/92) Replaced (gp-last-word) and [^ \t] by (forward-word +/- 1) in by gp-get-man-entry and gp-complete. gp-last-word deleted. It was originally like this, I changed it, but it is better this way now that save-excursion is used in gp-get-man-entry. Removed gp-max-completions which was incorrectly documented as "Maximum number of command names that may be used in completion" Actually any number of symbols can go in each `bucket' of the hash table, so this is not a hard limit. Array size now set directly (to 509). ==== Version 2.10++ (5/6/92) After mail from Henri Cohen: Added the : back to the prompt in (gp-get-man-entry.) Re-did (gp-complete). Now the help window does appear if there are possible further completions, even if some progress has been made. The window is deleted if a unique completion has been found. (Back to me.) Modified (gp-get-man-entry) so that if no definition is found the help window is not displayed. Modified (gp-get-man-entry) so that \vers is replaced by gp-version, a new variable set at the top of the file. ==== Version 2.11 (9/6/92) Got back a version of 2.10+ from H. Cohen, incorporating the new (gp-complete) Merged in the new (gp-get-man-entry) from 2.10++, and renamed to 2.11, so we should now be back in step. Modified (gp) to get gp-version from the start-up banner printed by gp. gp-version now not defined at top of file. Modified (gp) to check that gp is actually running, not just that gp-process is non-nil. This helps me when debugging, gp-sentinel is supposed to clear gp-process, but if there are errors in the elisp, it may not be called at the right time. Modified (gp-get-man-entry) to only offer a default function name If the word before point is already in the completion array. (H.C. complained that the initial default of 30000 was not very helpful!) ==== Version 2.11+ (10/6/92) Allow (gp-complete) to complete words beginning with "\" Added (gp-completion-list "\\precision" "\\serieslength" "\\format") So that these standard parameters may be completed. (Not \prompt, as if you change the prompt other than by M-\ p, pari.el will become very confused. Add (if (get-buffer "*gp-help*" .... to (gp-complete) to check the help buffer exists before deleting its window. ==== Version 2.12 (11/8/92) Modify (gp-complete) so completing on the single character `\` works as expected. Fixed typo in (gp-complete) `(' in wrong place in case (1) of possible completions. Modify (gp-get-man-entry) so that it does not put the default into the minibuffer, only into the prompt string. This is better, as if you know what function you want, you can M-? and then type ahead with the function name, without having to check that a default entry needs to be deleted first. ==== Version 2.12+ (4/9/92) Modify (gp-wait-for-output) so that it does not wait if gp is not running. Previous version went into an infinite loop looking for the version number if gp could not start for some reason. Like someone moving all the X-window libs! Slightly modified the prompt offered by (gp-get-man-entry). (downcase) the string returned by (buffer-substring) in (gp-complete) and (gp-get-man-entry). This enables completion to work on Mma style ForPrime etc. This required modifying (gp-complete) only to insert the NEW part of the completion, leaving the original, possibly uppercase, string in the *PARI* buffer. This showed up a `feature' of gp. ?COS does not work, so add (downcase) before (gp-get-man-entry) passes ?fn to gp. Add (downcase) to (gp-add-symbol). === Version 2.14 (28/10/96) (K.B.) Fixed gp-set-prompt for gp2 (use default()) Added the switch -emacs on command line so that gp knows who is in charge. Defined gp-complete2 to use gp built-in readline completion instead of ours Bound to gp-complete2. \M- to gp-complete (should be suppressed) Look for system messages (between *******) at beginning === Version 2.15 (01/01/97) (K.B.) Wrote pari.el.in added backward-kill-word-if-far-enough === Version 2.16 (30/03/97) (K.B.) fixed completion with respect to special characters (removed backward-kill-word-if-far-enough) === Version 2.17 (14/04/97) (K.B.) wrote compile: creation of pari.elc by Configure. === Version 2.18 (28/11/97) (K.B.) now that prompt is guaranteed to be in first column, change algorithm in gp-copy-input and anchor prompt (add ^ at beginning of regexp) === Version 2.19 (06/01/98) (K.B.) add color support for PARI buffer and gp scripts (hilit19) new major mode gp-script-mode enabled for *.gp files. remove system messages support (introduced 2.14) gp-version now set by Configure. fixed pari.menu, added special cases to gp-get-man-entry removed all the (downcase ...) send readline commands to GP only in gp-complete2 now. removed gp-completion-list === Version 2.20 (18/01/98) (K.B.) fixed gp-timer regexp. put back @completionfun@ removed inadvertently in 2.19. fixed gp-wait-for-output so that it flushes regularly its buffer (tnx again Gerhard!) === Version 2.21 (18/02/98) (K.B.) increased the priority of gp-string for highlighting. === Version 2.22 (17/03/98) (K.B.) added [+++] (from default(lines,...)) to the error patterns. removed gp-temp-file send all text to gp directly (the 1k limit has been removed)