Annotation of OpenXM_contrib/pari-2.2/emacs/pariemacs.txt, Revision 1.1.1.1
1.1 noro 1: This file refers to pari.el version 2.38
2:
3: Users that are used to previous versions should read the part concerning hooks.
4: Also, one key-binging has been changed: M-RET (meta-return) does not copy
5: the input at the end of the buffer but splits the line. The same effect can be
6: obtained via C-j. The command 'gp-copy-input is available via M-c (meta-c).
7: If your version of emacs is at least 20, then customization of most of the
8: variables is now possible through the menu-bar.
9: !! The variables 'gp-stack-size and 'gp-prime-limit are now *integers*.
10:
11: Some Notes on pari-mode
12: =======================
13:
14: pari-mode runs pari-gp as a sub process of (gnu-)emacs. Note that pari-mode
15: is *not* a mode in itself but the collection of two modes, namely
16: gp-mode and gp-script-mode described below.
17:
18: INSTALLATION.
19: =============
20:
21: pari-mode consists of four files: pariemacs.txt (this file, for information
22: only), pari.el and two files aimed at writing extensions of pari.el:
23: gp-translator.el and with-syntax.el which is an example of how to write
24: such an extension. When GP is installed, those four files are
25: placed in a convenient directory (/usr/local/lib/pari by default) and pari.el
26: is byte-compiled, producing a file pari.elc. (If this directory is not in
27: your EMACSLOADPATH, read a full path and not only "pari" in the line below.)
28:
29: To use pari-mode, users should add the following line to their .emacs:
30:
31: (autoload 'gp-mode "pari" nil t)
32: (autoload 'gp-script-mode "pari" nil t)
33: (autoload 'gp "pari" nil t)
34: (autoload 'gpman "pari" nil t)
35:
36: Some specific highlighting is then enabled when editing *.gp files
37: (gp-scripts) and three main new commands are made available:
38:
39: M-x gp starts up the pari-gp process in a new buffer, *PARI*.
40: C-u M-x gp same as M-x gp, but prompts for the command line arguments.
41: M-x gpman starts up a dvi previewer with the PARI-GP manual.
42:
43: To use gpman, you must copy (or link) the file doc/users.dvi (from the
44: standard distribution) to the directory pari.el was installed in.
45:
46: We recommend the use of emacs 20.3 or higher since the installation of
47: the menu-bar item may be quite slow with earlier versions.
48: ===========================================================================
49:
50: GP-MODE/GP-SCRIPT-MODE:
51: =======================
52:
53: The file pari.el introduces two modes. The first one, called gp-mode, is
54: patterned for executing commands under gp. You can then use gp as if you
55: had typed "gp" on your terminal, except that some more features are available,
56: in particular a full page editor (namely emacs !). The second mode is
57: gp-script-mode which helps the user to write gp-scripts (programs). Some
58: further commands are available and described below. Most of these commands
59: are available through the menu-bar item GP. Starting a gp process
60: under emacs will automatically trigger gp-mode. To use gp-script-mode, you
61: have two possibilities: either to add the following lines to your .emacs:
62:
63: (setq auto-mode-alist (cons '("\\.gp$" . gp-script-mode)
64: auto-mode-alist))
65:
66: so that any file with the suffix ".gp" will be understood as a gp-script
67: and its edition will trigger gp-script-mode, either to simply make the first
68: line of your program be
69:
70: \\ -*-gp-script-*-
71:
72: (In fact you can put anything on this first line, provided you include
73: the string "-*-gp-script-*-").
74:
75: Common commands (short description):
76:
77: KEY LISP-NAME DESCRIPTION
78: === ========= ===========
79: TAB gp-complete Complete the partly typed gp input line.
80: If your .gprc has been built with readline,
81: then the lisp-name is gp-complete2.
82: M-? gp-get-man-entry Display the manual entry for a gp command.
83: M-H gp-get-apropos Find all entries in the manual which contain
84: the string you give.
85: M-\ c gp-help-menu Some general help.
86: M-\ v gp-meta-v Display the version number of the gp file.
87: M-o gp-restore-wind-conf Strives to restore the previous window
88: configuration and to remove help windows.
89: run-gp Make gp read a file. Start a gp process
90: if required.
91: gp-get-TeX-man-entry Display a description of a given function
92: in TeX. This function will start
93: a gp process if none is running.
94: gp-cpl-file Add a file to the completion list.
95: (See gp-make-cpl-file below)
96: gp-edit-cpl-file Edit a completion file.
97: (See gp-make-cpl-file below)
98: gp-cpl-file-info Some informations on completion files.
99: C-l Update hilighting locally.
100: C-u C-l Rehilight the whole buffer, however long.
101: gp-set-simple-prompt Set the prompt to "? "
102: gp-set-time-prompt Set a prompt giving the time.
103: gp-set-date-prompt Set a prompt that gives the date.
104: gp-set-separator-prompt
105: Set a prompt with a separator
106: M-s gp-skip-to-error Strives to locate the latest error detected
107: while executing a program.
108: gp-browser Start a browser for gp commands. Only
109: available with an x window system. See
110: Help section.
111:
112:
113: Functions that are not linked with a key can be accessed through the menu-bar
114: or through M-x lisp-name.
115:
116: Commands common to gp-mode and to gp-script-mode may behave differently
117: whether a gp process is being run or not. More information is available
118: if a gp process is being run.
119:
120: The buffer *PARI* is set in gp-mode and the following extra commands are
121: available:
122:
123: KEY LISP-NAME DESCRIPTION
124: === ========= ===========
125: RET gp-send-input Copy current expression to the end,
126: and send to gp.
127: M-c gp-copy-input Copy current expression to the end.
128: M-RET gp-C-j Split the line.
129: C-j gp-C-j Split the line.
130: M-\ p gp-set-prompt Set the gp prompt.
131: M-\ t gp-meta-t \
132: M-\ d gp-meta-d |
133: M-\ r gp-meta-r |
134: M-\ w gp-meta-w |
135: M-\ x gp-meta-x \ Versions of the gp meta-commands, which
136: M-\ s gp-meta-s / prompt for arguments in the mini-buffer
137: M-\ a gp-meta-a | and display output in the help buffer.
138: M-\ b gp-meta-b |
139: M-\ m gp-meta-m |
140: M-\ k gp-meta-k |
141: M-\ q gp-meta-q /
142: M-\ \ gp-break-long-line Break a long line at col. 100, inserting \.
143: M-p gp-next-cmd Step to the next command.
144: M-n gp-previous-cmd Step to the previous command.
145: C-n next-line Step to the next line.
146: C-p previous-line Step to the previous line.
147: gp-toggle Exchange behaviour of C-p/M-p and C-n/M-n.
148: C-kp-subtract (that's the Ctrl+"-" from the numerical keypad)
149: gp-remove-last-output Erases last output.
150: M-kp-subtract (that's the Meta+"-" from the numerical keypad)
151: gp-remove-last-action Erases last input and its output.
152:
153:
154: Within a gp-script set in gp-script-mode, the following extra commands
155: are available:
156:
157: KEY LISP-NAME DESCRIPTION
158: === ========= ===========
159: M-\ z gp-run-in-region Send the marked region to the gp process,
160: starting such a process if required.
161: gp-make-cpl-file Allow use of the names of the functions
162: and of the global variables of this
163: program for completion.
164: M-x gp gp-start-usual Start a gp session with default parameters.
165: C-u M-x gp gp-start-with-parameters
166: Ask for parameters before starting a gp
167: session.
168: C-u M-o Quit editing a completion file.
169:
170: Note that most of these commands use the emacs meta key.
171: This one may be marked `left' `right' `extended character' `<>'
172: or various other markings. If your keyboard has not got a meta key. You
173: can use the escape key as a prefix.
174:
175: Thus M-\ corresponds to pressing meta and \ together, or pressing
176: ESC followed by \ .
177: ===========================================================================
178:
179: RET
180: ===
181: If point is after the last gp prompt, pressing RET sends current gp
182: expression to the gp process. If point is at some previous expression, this
183: expression (which may be several lines long) is copied to the end of the
184: buffer and then executed. If the expression is incomplete, it is *not* sent
185: to gp, and a `virtual' newline is inserted like via C-j. Since emacs does
186: not produce a syntactical analysis of your input, the definition of a
187: complete expression is fairly simple-minded : parenthesis `(' `{' and `['
188: should be properly closed, the last character should not be "\" and not be
189: within a string. If none of these criteria applies, the input is declared
190: complete, whether you were in the middle of a comment or not...
191:
192: M-RET / C-j
193: ===========
194: Introduce a `virtual' newline, so that you can have a input of gp taking
195: several lines. The same behaviour is obtained if you type \ followed by RET.
196:
197: M-c
198: ===
199: M-c, acts like RET, except that the expression is not sent to the gp
200: process. It is just copied to the end, so that it may be edited, and then
201: RET pressed, to send the new expression to gp.
202:
203: TAB
204: ===
205: TAB Tries to complete the partly typed gp command in the *PARI* buffer.
206: Note that you can use C-i instead of TAB. If GP was compiled with the
207: readline library, it knows about all symbols meaningful tp GP, plus some
208: extra keywords (bnf, nf, ell, etc.)
209:
210: Otherwise, it originally `knows' about all the standart commands of GP.
211: User-defined commands will be known to the completion system if they are
212: given as arguments to M-?. Commands to teach the system large numbers of new
213: command names will be described in the part COMPLETION FILES below and later
214: on.
215:
216: M-?
217: ===
218: M-? prompts for the name of a gp command (which may include symbolic names
219: like +). It then finds the appropriate paragraphs of section 3 of the
220: manual, strips off some of the TeX commands, and displays the result in a
221: new window. If the command is not found in the manual, sends ?command to
222: gp, and displays the output in the help window. Thus M-? also works with
223: user-defined commands. You may use space and tab to complete the
224: command name, in the mini-buffer. M-? tries to guess which command you
225: may want help for. If this is incorrect, simply delete that command,
226: and type in the command required.
227:
228: M-\ p
229: =====
230: M-\ p prompts for a new string in the mini-buffer. The command
231:
232: default(prompt,"<new string>")
233:
234: is then sent to gp, so that gp will now prompt for input with <new string>.
235: The variable gp-prompt-pattern is also reset so that RET and M-RET know
236: that gp expressions now start with <new string>. Expressions typed to the
237: old prompt are still recognised.
238:
239: Note that with this version, you can use a dynamic prompt (using %
240: constructs, which then go through strftime). See note number 5 below.
241:
242: M-\ c
243: =====
244: This shows a menu of subject headings taken from the manual, plus some
245: keywords that may lead to some interesting information. Pressing RET displays
246: the beginning of the chapter, or the list of the functions whose description
247: contains the keyword, as if the M-H command had been typed.
248:
249: M-\ \
250: =====
251: If the line is longer than 100, a \<newline> is inserted every 100
252: characters. This is necessary if the line is longer than 256 characters as gp
253: does not accept line longer than this. M-\ \ moves point to the end of the
254: current line.
255:
256: M-\
257: ===
258: The other commands on the M-\ prefix send the appropriate meta command to
259: gp. However they use the mini-buffer to read arguments (eg so that you can
260: use filename completion) and display any output in the *gp-help* buffer.
261:
262: C-kp-subtract/M-kp-subtract
263: ===========================
264: These commands are available only if you have a separate numerical keypad.
265: You should then press the Control key (respectively the Alt key) and the -
266: from this keypad.
267:
268: ===========================================================================
269:
270: HILIGHTING:
271: ===========
272:
273: If you're using X Windows on a color monitor, Emacs will use different
274: colors to display various parts when in gp-mode (when GP is running)
275: or in gp-script-mode (while editing a file with suffix .gp or after typing
276: M-x gp-script-mode). The colors chosen for hilighting can be modified and
277: customised through the menu-bar; They are then stored in a "pari-colors"
278: file. By default, this file is stored as "pari-colors.el" in the directory
279: where the help files are located (gp-gphelp-dir, chosen at Configure time).
280: If this directory is not writable (in most cases, it shouldn't be), the
281: filename defaults to ~/pari-colors.el. In the other direction, when pari.el
282: is loaded, emacs will look for "gp-gphelp-dir/pari-colors.el" if this
283: directory is writable and otherwise for "~/pari-colors.el".
284:
285: It is possible to override these default by setting the variable
286: 'pari-colors which can be set in 'pari-mode-hook (see below). Colors
287: will then be read from and written to this file.
288:
289: Troubles may occur with "}". A "}" followed by a newline indicates the
290: end of a function definition (starting with a "}"). Spaces ot tab-characters
291: are *not* allowed there. So if you use "}" in a string, simply don't
292: have it followed by a newline --- and pari.el won't get confused.
293:
294: If you usually use font-lock and not hilit19, some troubles may arise.
295: In order to (most probably) prevent them, add the following lines
296: to your .emacs file:
297:
298: (setq hilit-mode-enable-list '(gp-mode gp-script-mode))
299:
300: NOTE: in order to set the colours, emacs has to be in charge from the
301: moment you send a command until GP outputs an answer. Thus it will appear
302: to hang if you input a command which takes a long time for GP to process.
303: You can hit C-g at any time, which will not affect GP (like C-c would),
304: but will let you back in control of emacs. The output of this specific
305: command will then not be highlighted, but you can rehilight the buffer
306: by C-l.
307:
308: You can customize the setting through the menu-bar (easiest way) or by
309: modifying your .emacs, AFTER "pari" has been loaded (if you use autoload
310: then set these variables in a pari-mode-hook):
311:
312: to disable all highlighting.
313: (setq gp-no-hilit t)
314:
315: if you run emacs with a dark background (e.g. in reverse video mode)
316: (setq hilit-background-mode 'dark)
317:
318: The default colors can be quite painful to look at. In any case they
319: are easily configurable using the function hilit-translate. Emacs knows
320: about the following symbolic hilight groups:
321:
322: in gp-mode (corresponding to what default(colors,...) would do):
323: gp-error gp-history gp-prompt gp-output
324: gp-input gp-timer gp-help
325:
326: in gp-script-mode:
327: gp-control-statement gp-default-keywords gp-default-set
328: gp-input-cmd gp-string gp-function-proto
329: gp-function-args gp-comment gp-global-var
330:
331: An actual face (font shape + color) is associated to all patterns belonging
332: to a group using hilit-translate. For instance
333:
334: (hilit-translate
335: gp-string 'magenta3 ; all strings will be set in magenta3
336: gp-comment 'italic-red ; all comments in italic + red
337: gp-timer 'hex-ffff60 ; timer output set in RGB color (ff ff 60)
338: gp-prompt 'default ; don't highlight the prompt
339: )
340: See the documentation of hilit-lookup-face-create for valid face names.
341:
342: In practice, you could include the following code in your .emacs:
343:
344: (setq pari-mode-hook
345: (function (lambda ()
346: ... ; as above for instance
347: (if gp-can-hilit
348: (progn
349: (hilit-translate gp-prompt 'tomato4)
350: (hilit-translate gp-timer 'default)
351: (hilit-translate gp-string 'tomato4)
352: (hilit-translate gp-comment 'default))))))
353:
354: There is no need to separate gp-mode from gp-script-mode.
355:
356:
357: ===========================================================================
358:
359: COMPLETION / COMPLETION FILES:
360: ==============================
361:
362: See also the description of the TAB key above.
363:
364: Initially, emacs "knows" all the symbols can are listed by the command
365: gphelp -k "", i.e. essentially all the standard function/variable names.
366: If gp has been built with readline, it knows also some extra symbols.
367: In this case and while editing gp-scripts, emacs will try to start
368: a gp-session in the background and ask readline. Note that it is
369: compulsory for gphelp to be available and that the behaviour will
370: be better if a gp-process can be started.
371:
372: A "completion file", also denoted by "a file in gp-menu format", is a file
373: which contains the string "###" at the beginning of a line. Anything
374: before the first occurence of this string is ignored. Lines starting by
375: this string are considered as commented. Then each non commented line below
376: the first "###" contains a string which will be fed to the completion
377: system. For instance if a file containing:
378:
379: ### Function names:
380: my_function
381: facilitate
382:
383: is send to the completion system through the menu-bar item
384: [GP/Complete/Use Also File...], then the two strings "my_function" and
385: "facilitate" will be known for completion and the completions of "fa"
386: will be "factor" or "facilitate".
387:
388: Completion files relative to a gp-script "program-name" will be called
389: "program-name.cpl" and automatically loaded when editting "program-name".
390:
391: You can tell emacs to also use the function/global-variable names of your
392: script (program) through the menu-bar item [Gp Completion-File Make/Update].
393: To avoid the writing of too many files, it is *not* stored in a file
394: unless you ask to edit it.
395:
396: A file stored in the variable gp-additional-cpl-file is loaded while
397: starting as an additional completion file. It can be set in a hook. Default
398: value is the empty string.
399: ===========================================================================
400:
401: HELP:
402: =====
403:
404: Help is available through two distinct forms, in text or in TeX, and
405: essentially through the menu-bar. In TeX form you can see a TeX version
406: of the manual (via xdvi or something similar), while in text form, a
407: browser is available which starts on an independant frame. In TeX, you
408: can see the tutorial file, and in text, you have access to a survey of
409: the chapter headings of the manual.
410:
411: Furthermore, you can ask for specific help on a given function in both
412: forms, and in text, you can ask for the list of all commands that contain
413: a given string in their description. All these menu-bar items have fairly
414: self-descriptive name, except maybe the last one which is called via
415: [GP/Info on Subject...].
416:
417: ===========================================================================
418:
419: CUSTOMIZATION:
420: ==============
421:
422: From version 2.31 onwards, some environment variables can be set via
423: the menu-bar provided you use a version of emacs which is at least 20.
424: Otherwise, you can use the classical way through a hook as explained
425: in the note number 3 below. Assuming you do have custom.el,
426: the item to be used is [Help/Customize/Specific-Group],
427: and the group to choose is gp. You can then modify the shown variables,
428: and save them for future sessions: they will be stored in your .emacs
429: file under the shape:
430:
431: (custom-set-variables
432: ; To select where the colors are stored:
433: '(pari-colors "~/pari-colors.el")
434: ; To select a file containing possible completions:
435: '(gp-additional-cpl-file "")
436: ; To set parameters of gp:
437: '(gp-stack-size 10000000)
438: '(gp-prime-limit 500000)
439: ; To ask gp to not/always ask for arguments:
440: '(gp-prompt-for-args nil)
441: ; To ask/remove tutorial help:
442: '(gp-tutorial-requiredp t)
443: ; To set/remove hilighting:
444: '(gp-no-hilit nil)
445: ; To set/remove the menu-bar item [GP/Colors]:
446: '(gp-no-color-item nil)
447: ; To set/remove both menu-bars:
448: '(gp-no-menu-bar nil)
449: ; To keep the PARI buffer when quitting:
450: '(gp-keep-PARI-buffer-when-quitting t)
451: ; To have mistakes displayed on a separate window:
452: '(gp-no-separate-window-for-mistakes nil)
453: ; To define GP-browser style (1, 2 or 3):
454: '(gp-browser-style 3)
455: ; To set locked mode:
456: '(gp-locked-modep t))
457: (custom-set-faces)
458:
459: Within the customization-window, you should save these values for them
460: to become valid. Note that the variables having something to do with the
461: menu-bar will affect only the next session since this menu-bar is
462: computed at the beginning of each session. The same applies to 'gp-no-hilit
463: since it is only used at the beginning of the session to set 'gp-can-hilit
464: which is in fact the relevant variable.
465:
466: ===========================================================================
467:
468: LISP EXPRESSIONS IN GP-SCRIPTS:
469: ===============================
470:
471: A new functionnality of version 2.21 is the possibility to introduce
472: emacs-lisp-commands inside a gp-script. Emacs lisp commands can be inserted
473: anywhere and will be executed prior to sending the file to gp. The file
474: should be edited for emacs to take care of these commands. They are to be
475: surrounded by "/*@" and "*/", like in
476:
477: /*@
478: (setq gp-prompt-pattern (gp-make-gp-prompt-pattern "^NewOne: "))
479: */
480:
481: An additional cookie is the string "\\@" which, when located in a program at
482: the beginning of a line and followed by a newline is understood as
483: emacs-should-not-wait-for-output-of-the-program, which is convenient
484: while working with lengthy programs that give partial answers.
485: In fact, the effect of "\\@" can be obtained by writing
486:
487: /*@ (setq gp-should-wait-for-outpup nil) */
488:
489: This variable is automatically reset to t after the output.
490: Concerning this functionnality, a hook gp-input-filter-hook is run whenever
491: an input is sent to gp. It can be set in the .emacs and can be modified in
492: the file itself. For instance, if the file "with-syntax.el" contains the
493: function 'translate, we can use
494:
495: /*@
496: (load-file "with-syntax.el")
497: (setq gp-input-filter-hook (list 'translate))
498: */
499:
500: By "translation" we mean applying some transformations to a gp-script before
501: sending it to gp. There is a general file "pari-translator.el" which contains
502: functions handy for writing such a translator. An exemple is provided by the
503: file "with-syntax.el" which enables one to use the syntax "with(foo,to_do)"
504: in a gp-program. Details can be found in this file. It is possible to write
505: a file translating gp-syntax-old-version into gp-syntax-new-version. More
506: complicated and a project is to write a file translating simple MuPAD-syntax
507: into gp-syntax.
508:
509: ===========================================================================
510:
511: HANDLING OF MISTAKES:
512: =====================
513:
514: If you edit a program, execute it (or part of it) via the menu-bar,
515: and an error is found, then emacs will try to locate the typo in your
516: script. Note that this script should be in a visible window. Sometimes,
517: the place shown will not be the proper one and you can ask for the next
518: matching occurence by selecting the menu-item "Skip-to-error". Incidentally,
519: this function will also start the search even if the buffer is not visible,
520: in which case the search will start from the begining of the buffer and not
521: from point-location.
522:
523: In the *PARI* buffer, mistake will be displayed on a separate window,
524: so as not to crowd your session. However you can disable this behaviour
525: by setting the variable 'gp-no-separate-window-for-mistakes to t.
526: Exception to this is a \r command whose output will never go to a
527: separate window.
528:
529: Alternatively, you can delete last output through the key C-kp-subtract
530: (Control and the - from the numerical keypad), and all of last input and
531: out via M-kp-subtract.
532:
533: ===========================================================================
534:
535: LOCKED MODE:
536: ============
537:
538: While working with gp, it is often convenient to pick up a previous input
539: and modify it. The trouble with this method is that the first input is
540: destroyed and your file becomes less readable. You can use M-c to copy the
541: input arounf the cursor to the end and then modify it, but you may be
542: lazier than that... With the locked mode, any tentative modification of an
543: earlier input will result in the copying of this input to the end of your
544: file and the modification is carried out there. That's the meaning of the
545: variable 'gp-locked-mode which is t (true) by default. You can set it to
546: nil (false) if this behaviour is not what you expect.
547:
548: ===========================================================================
549: Notes
550: =====
551:
552: 1) You may edit previous expressions, and then type RET to send them to gp.
553: However if you want the *PARI* buffer to contain a script of a valid gp
554: session, you may prefer to use M-RET to copy the expression to the end
555: of the buffer, before editing it.
556:
557: 2) M-\ c is supposed to be a version of the gp meta command \c, although
558: it does not send \c to gp.
559: M-\ p does not correspond to the gp meta command \p but rather to the
560: command default(prompt,...). If this disturbs you it is easy enough to bind
561: M-\ p to a command that inserts \p into the *PARI* buffer. The command
562: gp-set-prompt can then be bound to any key sequence that you wish.
563: All the other commands on the M-\ prefix do work by sending a gp meta
564: command to the *PARI* buffer.
565:
566: 3) pari-mode-hook/gp-mode-hook/gp-script-mode-hook:
567: Individual users can customise gp-mode without having to make copies of
568: the file pari.el and most of this customization is automatically done
569: (see the CUSTOMIZATION section above).
570: For more specific purposes there are *three* hooks, namely gp-mode-hook,
571: gp-script-mode-hook and an additional hook 'pari-mode-hook common to both
572: modes. You should mostly use pari-mode-hook but can use also the two more
573: specialised gp-mode-hook which will be run by the gp command and
574: gp-script-mode-hook which will be run while starting a gp-script, both
575: in addition to pari-mode-hook. Essentially the only example where
576: gp-mode-hook *has to* be used rather than pari-mode-hook is when
577: setting the prompt via gp-set-prompt (see end of this note and next one).
578: The format is:
579:
580: (setq pari-mode-hook
581: (function (lambda ()
582: ... commands to run when starting up gp ...
583: )))
584:
585: An example is:
586:
587: (setq pari-mode-hook
588: (function (lambda ()
589: (define-key gp-map "\M-\\p" 'gp-meta-p)
590: (define-key gp-map "\M-p" 'gp-set-prompt)
591: (setq gp-stack-size 1000000)
592: (setq gp-prime-limit 2000)
593: (gp-cpl-file my-file)
594: )))
595:
596: This:
597: Binds a function which sends \p to gp (which would need to be defined
598: somewhere else), to M-\ p.
599: Binds gp-set-prompt to M-p.
600: Defines the default stack size and prime limit as 10000 and 2000.
601:
602: Let the completion system use all the commands listed in the
603: file my-file.
604:
605: In case, customization is not possible through the menu-bar, (see
606: section CUSTOMIZATION), here is a generic way to set pari-mode-hook:
607: (setq pari-mode-hook
608: (function (lambda ()
609: ; To select where the colors are stored:
610: (setq pari-colors "~/")
611: ; To select a file containing possible completions:
612: (setq gp-additional-cpl-file "")
613: ; To ask/remove tutorial help:
614: (setq gp-tutorial-requiredp t)
615: ; To set/remove hilighting:
616: (setq gp-no-hilit nil)
617: ; To set/remove the menu-bar item [GP/Colors]:
618: (setq gp-no-color-item nil)
619: ; To set/remove both menu-bars:
620: (setq gp-no-menu-bar nil)
621: ; To set parameters of gp:
622: (setq gp-stack-size 10000000)
623: (setq gp-prime-limit 500000)
624: ; To ask gp to not/always ask for arguments:
625: (setq gp-prompt-for-args nil)
626: ; To ensure a proper default for completion:
627: (setq gp-complete-choice 'gp-complete)
628: ; To keep the PARI buffer when quitting:
629: (setq gp-keep-PARI-buffer-when-quitting t)
630: ; To have mistakes displayed on a separate window:
631: (setq gp-no-separate-window-for-mistakes nil)
632: ; To define GP-browser style (1, 2 or 3):
633: (setq gp-browser-style 3)
634: ; To set locked mode:
635: (setq gp-locked-modep t)
636: )))
637:
638: A change in prompt, which has not gone to the .gprc (see below), *has to*
639: use the gp-mode-hook. It reads
640:
641: (setq gp-mode-hook
642: (function (lambda ()
643: ; Select a new prompt:
644: ; (gp-set-prompt "...")
645: )))
646:
647: And for instance '...(get-set-prompt "(%R) gp > "))))' will set the
648: prompt to "(%R) gp > " as soon as you enter gp.
649:
650: 4) Command line arguments.
651: The gp executable file is specified in the variable gp-file-name. This
652: is set in the file pari.el, but users can override this setting, either
653: in their pari-mode-hook, or by using the C-u prefix to gp. In either case,
654: the full path name need not be given if gp is in a directory specified
655: in your PATH variable (or the equivalent in csh).
656: The variables gp-stack-size and gp-prime-limit should be set to integers
657: specifying the arguments to gp. See the above example.
658:
659: If these variables are set to "", then the appropriate flags
660: "-s" or "-p" are *not* sent to gp.
661: If RET is typed in response to any of the prompts produced by C-u M-x gp
662: then the default value, ie., the value of gp-file-name, gp-stack-size,
663: or gp-prime-limit, is assumed.
664: If a space is sent to the prompt (ie SPC RET) then the appropriate argument
665: is not sent to gp, even if the default is non-empty.
666:
667: People who often use different settings for these arguments, may like
668: either to add the line
669:
670: (setq gp-prompt-for-args t)
671: to their gp-mode-hook, or to use the command (outside the gp-mode-hook)
672: (custom-set-variables
673: '(gp-prompt-for-args t))
674: This makes M-x gp act like C-u M-x gp.
675:
676: 5) Prompt.
677: Emacs needs to know at all time what your prompt looks like: it's stored
678: at all times in gp-prompt-pattern. If you must change your prompt
679: (e.g. with default(prompt,...)) without telling emacs, emacs
680: will try to understand what you mean, and else tell you it has not
681: succeeded. What you *cannot* use is the command "default(prompt,fn())"
682: where "fn" is a gp-function which evaluates to a string. Emacs
683: will accept it though, but won't modify the prompt-pattern, so it
684: may lead to errors.
685:
686: If you intend to change your prompt in your .gprc and not in an
687: emacs session, you have to modify the gp-prompt-pattern regular
688: expression yourself (AFTER loading pari.el in your .emacs). For instance:
689:
690: (setq gp-prompt-pattern
691: (concat "^> [\C-j\t ]*\\|" gp-prompt-pattern))
692:
693: caters for a 'prompt = "> "' in .gprc. If you use autoload, put this
694: command in 'pari-mode-hook and *not* in 'gp-mode-hook (see the note 3
695: for the way to proceed). Don't forget to anchor your prompt
696: at the beginning of the line (the '^' at the beginning). And don't forget
697: to concatenate the old pattern as well. A more complicated one is to deal
698: with 'prompt = "(%R) gp > "':
699:
700: (setq gp-prompt-pattern
701: (concat "^([0-9][0-9]:[0-9][0-9]) gp > [\C-j\t ]*\\|" gp-prompt-pattern))
702:
703: 6) Emacs Version.
704: pari.el till version 2.23 has been written for emacs 19.34. There is
705: a small problem with emacs 20.3 and pari.el 2.24 onward takes care of
706: that, while still being usable with emacs 19.34. However, if you use
707: a version of emacs below 20.3, the installation of the menu-bar item
708: may be quite slow (some 20s on fast machines), while it is instantaneous
709: with emacs 20.3 or higher. There may be troubles with XEmacs as far as
710: colors are concerned, but nothing that I know of.
711: ===========================================================================
712:
713: Modified: Olivier Ramare 1-July-2000 version 2.37
714: Modified: Olivier Ramare 29-October-1999 version 2.33
715: Modified: Olivier Ramare 4-September-1999 version 2.32.
716: Modified: Olivier Ramare 23-June-1999 version 2.31.
717: Modified: Olivier Ramare 15-Marsh-1999 version 2.28.
718: Modified: Olivier Ramare 28-January-1999 version 2.24.
719: Modified: Karim Belabas 13-January-1998 version 2.19.
720: Modified from the original file pari.txt written by David Carlisle
721:
722: 1-July-2000 version 2.38 (This file refers to pari.el version 2.38)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>