comparison
[sepia.git] / sepia.texi
blobec229a400473db7f338e50780d4c056d04961577
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename sepia.info
4 @settitle SEPIA: Simple Emacs Perl Integration
5 @dircategory Emacs
6 @direntry
7 * Sepia: (sepia).    Simple Emacs Perl Integration.
8 @end direntry
9 @c %**end of header
11 @titlepage
12 @title Sepia: Simple Emacs Perl Integration
13 @author Sean O'Rourke
14 @end titlepage
16 @macro kbinding{key,cmd}
17 @item \key\ `\cmd\'
18 @kindex \key\
19 @end macro
21 @macro fitem{name}
22 @item \name\
23 @findex \name\
24 @end macro
26 @macro xxx{stuff}
27 @b{XXX: \stuff\}
28 @end macro
30 @node Top, Introduction, (dir), (dir)
32 @ifinfo
33 @top SEPIA
34 @end ifinfo
36 @ifhtml
37 @image{Sepia,,,,jpg}
38 @end ifhtml
40 Sepia is a set of Perl development tools for Emacs supporting code
41 navigation and interactive evaluation.
43 @menu
44 * Introduction::                
45 * Editing::                     
46 * Interactive Perl::            
47 * CPAN browsing::               
48 * Customization::               
49 * Internals::                   
50 * Credits::                     
51 * Function Index::              
52 @end menu
54 @c ============================================================
55 @node Introduction, Editing, Top, Top
56 @chapter Introduction
58 Sepia is a set of tools for Perl development in Emacs.  Its goal is to
59 extend CPerl mode to support fast code navigation and interactive
60 development.  It is inspired by Emacs' current support for a number of
61 other languages, including Lisp, Python, and Emacs Lisp.
63 @menu
64 * Getting Started::             
65 * Philosophy::                  
66 @end menu
68 @node Getting Started, Philosophy, Introduction, Introduction
69 @section Getting Started
71 To install Sepia, its Emacs Lisp files must be in Emacs'
72 @code{load-path}, and the @file{lib} directory must be in Perl's
73 @code{@@INC}.  Assuming that Sepia has been unpacked in
74 @file{~/sepia}, it can be installed by adding the following lines to
75 @file{~/.emacs}:
77 @example
78 (add-to-list 'load-path "~/sepia")
79 (setq sepia-perl5lib (list (expand-file-name "~/sepia/lib")))
80 (defalias 'perl-mode 'sepia-mode)
81 (require 'sepia)
82 @end example
84 Then to bring up the interactive Perl prompt, type @kbd{M-x sepia-repl}.
86 @node Philosophy,  , Getting Started, Introduction
87 @section Philosophy
89 A development environment should support three activities: code
90 spelunking, interaction, and customization.  Emacs as an environment for
91 developing Emacs Lisp thoroughly supports all of them: It has commands
92 to visit individual functions' code and documentation, commands to
93 evaluate or step through expressions, and an architecture that
94 encourages customization in Emacs Lisp.  As an environment for Perl,
95 however, it is lacking: there is limited interactivity with the Perl
96 debugger, and reasonable documentation browsing, but no support for
97 navigating, editing, and re-evaluating code.  Sepia attempts to remedy
98 the situation.
100 Modern IDEs also support these three activities, but do so awkwardly.
101 Rather than having functions to visit definitions (@kbd{find-function})
102 and search for functions (@kbd{apropos}), they clutter the screen with
103 class and file trees.  Rather than supporting interactive evaluation of
104 small pieces of code, they perform background semantic checking on whole
105 projects and highlight errors.  Rather than allowing minor
106 customizations to grow organically into features, they support limited
107 configuration files and baroque plug-in APIs.  Sepia tries to adhere to
108 the apparent Emacs philosophy that rich semantic information should be
109 unobtrusive, and that the best way to build working code is to start
110 by experimenting with small pieces.
112 Language support packages for Emacs vary widely in the degree to which
113 they make use of or replace existing Emacs features.  Minimal modes
114 provide keyword-based syntax highlighting and an unadorned comint buffer
115 as an interpreter.  Others provide their own specialized equivalents of
116 comint, eldoc, completion, and other Emacs features.  Sepia takes a
117 third approach by trying to do as much as possible with existing Emacs
118 features, even when they are not optimal for Perl.  For example, it uses
119 comint to communicate with the subprocess, eldoc to display
120 documentation, and grep to list source locations.
122 This approach has three advantages: First, it maximizes the number of
123 features that can be supported with limited development time.  Second,
124 it respects users' settings.  A seasoned Emacs user may have changed
125 hundreds of settings, so a mode that reimplements features will have to
126 support equivalent settings, and will force the user to re-specify them.
127 Finally, this approach respects decades of development spent, as Neal
128 Stephenson put it, ``focused with maniacal intensity on the deceptively
129 simple-seeming problem of editing text.''  Many non-obvious choices go
130 into making a polished interface, and while a reimplementation gets rid
131 of accumulated cruft, it must rediscover these hidden trade-offs.
133 Anyways, I hope you enjoy using Sepia.  Its development style is strange
134 for someone used Perl's typical mix of one-liners and edit-save-run, but
135 once you are accustomed to it, you may find it very effective.
137 @c ============================================================
138 @node Editing, Interactive Perl, Introduction, Top
139 @chapter Editing
140 @findex sepia-mode
142 Sepia's first contribution is a set of commands to explore a Perl
143 codebase.  These include commands to browse and display documentation,
144 to find function definitions, and to query a cross-reference database of
145 function and variable uses.  Sepia also provides intelligent symbol
146 completion.
148 @menu
149 * Completion::                  
150 * Navigation::                  
151 * Documentation::               
152 @end menu
154 @node Completion, Navigation, Editing, Editing
155 @section Completion
157 Sepia implements partial-word completion that communicates with the
158 inferior Perl process.  For example, @samp{%S:X:v_u} completes to
159 @samp{%Sepia::Xref::var_use} when Sepia is loaded.  This completion only
160 operates on functions and global variables known to the Perl
161 interpreter, so it works best when code and interpreter are in sync.
163 More precisely, completion examines the text before point and tries each
164 of the following in turn, using the first successful approach:
166 @enumerate
167 @item
168 If the text looks like a method call (e.g. @samp{$object->f} or
169 @samp{Class->f}), complete on methods.
171 @item
172 If it looks like a variable (e.g. @samp{%hash} or @samp{$scalar}),
173 complete on variables.
175 @item
176 Complete on modules and functions.
178 @item
179 Otherwise, complete on Perl built-in operators.
180 @end enumerate
182 For each of the first three cases, completions candidates are first
183 generated by splitting the text on characters @code{[:_]} and matching
184 the resulting word parts.  For example, @samp{X:a_b} will complete to
185 all symbols matching @samp{^X[^:]*:+a[^:_]*_b} such as @samp{Xref::a_bug}
186 and @samp{X::always_bites_me}.  If no matches result, the text is
187 treated as an acronym.  For example, @samp{dry} will complete to
188 @samp{dont_repeat_yourself}.
190 Completion is performed by the following commands:
191 @table @kbd
192 @item M-x sepia-complete-symbol
193 @findex sepia-complete-symbol
194 Complete the symbol before point as described above.  Note that this
195 does not consider lexical scope, and is always case-sensitive,
196 independent of @code{completion-ignore-case}.
198 @item TAB
199 @itemx M-x sepia-indent-or-complete
200 @findex sepia-indent-or-complete
201 First try to reindent the current line.  If its indentation does not
202 change, then try to expand an abbrev at point (unless
203 @code{sepia-indent-expand-abbrev} is @code{nil}).  If no abbrev is
204 expanded, then call @code{sepia-complete-symbol}.
206 @end table
208 @node Navigation, Documentation, Completion, Editing
209 @section Navigation
211 Sepia provides several commands for navigating program source.  All of
212 them rely on information from the inferior Perl process, so it is
213 important both that it be running, and that its internal representation
214 of the program match the program source.  The commands marked (Xref)
215 below also rely on a cross-reference database, which must be explicitly
216 rebuilt by calling @code{xref-rebuild} when the program changes.
218 There are two basic kinds of navigation commands.  The first kind jumps
219 directly to the first matching location when possible, prompting only if
220 no such location is found.  These commands find only a single location.
222 @c direct-jump commands
223 @table @kbd
225 @item M-. M-.
226 @itemx M-x sepia-dwim
227 @findex sepia-dwim
228 Guess what kind of identifier is at point, and try to do the right
229 thing: for a function, find its definition(s); for a variable, find its
230 uses; for a module, view its documentation; otherwise, prompt for the
231 name of a function to visit.  @code{sepia-dwim} automatically goes to
232 the first function definition or variable use found.
234 @item M-. l
235 @itemx M-x sepia-location
236 @findex sepia-location
237 Jump directly to the definition of the function at point, prompting if
238 point is not on a known function.  If multiple definitions are found,
239 choose one arbitrarily.  This function is similar to @code{sepia-defs},
240 and the two should probably be merged.
242 @item M-. j
243 @itemx M-x sepia-jump-to-symbol
244 @findex sepia-jump-to-symbol
245 Navigate to a function using ``ido'' interactive completion.  Within
246 interactive completion, press @key{:} to descend into a package,
247 @key{DEL} to ascend to a parent package, and @key{RET} to go to the
248 currently-selected function.
250 @end table
252 The second kind of navigation commands always prompts the user -- though
253 usually with a sensible default value -- and finds multiple locations.
254 When called with a prefix argument, these commands present their results
255 in a @code{grep-mode} buffer.  When called @emph{without} a prefix
256 argument, they place all results on the found-location ring and jump
257 directly to the first.  The remaining locations can be cycled through by
258 calls to @code{sepia-next}.
260 @c prompt-and-go commands
261 @table @kbd
262 @item M-. f @var{name} @key{RET}
263 @itemx M-x sepia-defs
264 @findex sepia-defs
265 Find definition(s) of function @var{name}.
267 @item M-. m @var{name} @key{RET}
268 @itemx M-x sepia-module-find @var{name} @key{RET}
269 @findex sepia-module-find
270 Find the source of module @var{name}.
272 @item M-. a @var{regexp} @key{RET}
273 @itemx M-x sepia-apropos @var{regexp} @key{RET}
274 @findex sepia-apropos
275 Find definitions of all functions whose names match @var{regexp}.
277 @item M-. c @var{name} @key{RET}
278 @itemx M-x sepia-callers @var{name} @key{RET}
279 @findex sepia-callers
280 (Xref) Find calls to function @var{name}.
282 @item M-. C @var{name} @key{RET}
283 @itemx M-x sepia-callees @var{name} @key{RET}
284 @findex sepia-callees
285 (Xref) Find the definitions of functions called by @var{name}.
287 @item M-. v @var{name} @key{RET}
288 @itemx M-x sepia-var-uses @var{name} @key{RET}
289 @findex sepia-var-uses
290 (Xref) Find uses of the global variable @var{name}.
292 @item M-. V @var{name} @key{RET}
293 @itemx M-x sepia-var-defs @var{name} @key{RET}
294 @findex sepia-var-defs
295 (Xref) Find definitions of global variable @var{name}.  Since Perl's
296 global variables are not declared, this is rarely useful
298 @c XXX: broken, so don't mention it.
299 @c @item M-. A @var{regexp} @key{RET}
300 @c @itemx M-x sepia-var-apropos
301 @c @findex sepia-var-apropos
302 @c Find definitions of all variables whose names match @var{regexp}.  Since
303 @c this function does not handle lexical variables, and since Perl's global
304 @c variables are not declared, this is rarely useful.
306 @end table
308 Finally, there are several other navigation-related commands that do not
309 fit into either of the above categories.
311 @c other commands
312 @table @kbd
313 @item M-,
314 @itemx M-x sepia-next
315 @findex sepia-next
316 Cycle through the definitions found by the previous @key{M-.} search.
318 @item M-. r
319 @itemx M-x sepia-rebuild
320 @findex sepia-rebuild
321 Rebuild the cross-reference database by walking the op-tree and
322 stashes.
324 @item M-. t
325 @itemx M-x find-tag
326 Execute the @code{find-tag} command typically bound to @key{M-.}.
328 @end table
330 @node Documentation,  , Navigation, Editing
331 @section Documentation
333 Sepia can be used to browse installed modules' documentation, to format
334 and display the current buffer's POD, and to browse the list of modules
335 installed on the system.
337 @table @kbd
338 @item M-. d @var{name} @key{RET}
339 @itemx M-x sepia-perldoc-this
340 @findex sepia-perldoc-this
341 View documentation for module @var{name} or Perl manual page @var{name}.
343 @item C-c C-d
344 @itemx M-x sepia-view-pod
345 @findex sepia-view-pod
346 Format and view the current buffer's documentation.
348 @item sepia-package-list
349 @findex sepia-package-list
350 Browse a tree of installed packages.  This lists only the top-level
351 packages from installed distributions, so if package @code{My::Stuff}
352 also provides @code{My::Stuff::Details}, it will not be displayed.  When
353 Emacs-w3m is available, each module is linked to its documentation.
355 @item sepia-module-list
356 @findex sepia-module-list
357 Browse a tree of both top-level and internal packages, like
358 @code{sepia-package-list}.
360 @end table
362 @findex sepia-install-eldoc
363 Sepia also integrates with eldoc (at least in GNU Emacs >= 22).
364 Documentation for Perl operators and control structures is taken from
365 CPerl mode.  Sepia will also display documentation for user-defined
366 functions if their POD is formatted in the standard way, with functions
367 described in a ``=head2'' or ``=item'' entry.  To load user
368 documentation, visit the relevant file and type @kbd{M-x
369 sepia-doc-update}.
371 If @code{Module::CoreList} is available, Sepia's eldoc function will
372 also display the first version of Perl with which a module was shipped.
373 This is intended to give the programmer a sense of when he is creating
374 external dependencies.
376 @c ============================================================
377 @node Interactive Perl, CPAN browsing, Editing, Top
378 @chapter Interactive Perl
380 @findex sepia-repl
381 Sepia's second main contribution is an interactive interface (REPL) to
382 an inferior Perl process.  The interface is based on GUD mode, and
383 inherits many of its bindings; this chapter discusses only the Sepia
384 extensions.  To start or switch to the repl, type @kbd{M-x sepia-repl}.
385 As in Sepia mode, @key{TAB} in the REPL performs partial-word completion
386 with @code{sepia-complete-symbol}.
388 Sepia also provides a number of other ways to evaluate pieces of code in
389 Perl, and commands to process buffer text using the inferior process.
391 @menu
392 * Shortcuts::                   
393 * Debugger::                    
394 * Evaluation::                  
395 * Mutilation::                  
396 * Scratchpad::                  
397 @end menu
399 @node Shortcuts, Debugger, Interactive Perl, Interactive Perl
400 @section Shortcuts
402 ``Shortcuts'' are commands handled specially by the REPL rather than
403 being evaluated as Perl code.  They either communicate with the REPL
404 function, or provide a convenient interface to variables in the Sepia
405 package.  Shortcuts are prefixed by a comma (@key{,}), and may be
406 abbreviated to the shortest unique prefix.
408 @table @kbd
409 @item cd @var{dir}
410 Change Perl's current directory to @var{dir}.
412 @item debug [@var{val}]
413 Turn Sepia debugger hook on or off, or toggle if @var{val} is missing.
415 @item define @var{name} ['@var{doc}'] @var{body...}
416 Define @var{name} as a shortcut for Perl code @var{body}, with optional
417 documentation @var{doc}, surrounded by single quotes.  @var{body} is
418 passed the raw command-line text as its first argument.
420 @item delete
421 Delete the current breakpoint.
423 @item format @var{type}
424 Set the output format to @var{type}, either ``dumper'' (using
425 @code{Data::Dumper}), ``dump'' (@code{Data::Dump}), ``yaml''
426 (@code{YAML}), or ``plain'' (stringification).  Default: ``dumper''.
428 @item help
429 Display a list of shortcuts.
431 @item lsbreak
432 List breakpoints.
434 @item methods @var{name} [@var{regexp}]
435 Display a list of functions defined in package @var{name} and its
436 @code{ISA}-ancestors matching optional pattern @var{regexp}.
438 @item package @var{name}
439 Set the default evaluation package to @var{name}.
441 @item pwd
442 Show the process's current working directory.
444 @item quit
445 Exit the inferior Perl process.
447 @item reload
448 Reload @file{Sepia.pm} and recursively invoke the REPL.  This command is
449 mostly of interest when working on Sepia itself.
451 @item shell [@var{command}]
452 Execute shell command @var{command}, displaying its standard output and
453 standard error.
455 @item strict [@var{val}]
456 Set evaluation strictness to @var{val}, or toggle it if @var{val} is not
457 given.  Note that turning strictness off and on clears the REPL's
458 lexical environment.
460 @item undef @var{name}
461 Undefine shortcut @var{name}.  @strong{Warning}: this can equally be
462 used to remove built-in shortcuts.
464 @item wantarray [@var{val}]
465 Set the evaluation context to @var{val}, or toggle between scalar and
466 array context.
468 @item who @var{package} [@var{regexp}]
469 @itemx who [@var{regexp}]
470 List identifiers in @var{package} (main by default) matching
471 optional @var{regexp}.
473 @end table
475 @node Debugger, Evaluation, Shortcuts, Interactive Perl
476 @section Debugger
478 Sepia uses Perl's debugger hooks and GUD mode to support conditional
479 breakpoints and single-stepping, and overrides Perl's @code{die()} to
480 invoke the debugger rather than unwind the stack.  This makes it
481 possible to produce a backtrace, inspect and modify global variables,
482 and even continue execution when a program tries to kill itself.  If the
483 PadWalker module is available, Sepia also provides functions to inspect
484 and modify lexical variables.
486 The debugger has its own set of shortcuts, also prefixed by a comma.
488 @table @kbd
489 @item backtrace
490 Show a backtrace.
492 @item break @var{file}:@var{line} [@var{expr}]
493 Set a breakpoint in @var{file} at @var{line}.  If @var{expr} is
494 supplied, stop only if it evaluates to true.
496 @item down @var{n}
497 @itemx up @var{n}
498 Move the current stack frame up or down by @var{n} (or one) frames.
500 @item inspect [@var{n}]
501 Inspect lexicals in the current frame or frame @var{n}, counting upward
502 from 1.
504 @item lsbreak
505 List breakpoints.
507 @item next [@var{n}]
508 Advance @var{n} (or one) lines, skipping subroutine calls.
510 @item quit
511 @itemx die
512 @itemx warn
513 Continue as the program would have executed without debugger
514 intervention, dying if the debugger was called from @code{die()}.
516 @item return @var{expr}
517 Continue execution as if @code{die()} had returned the value of
518 @var{expr}, which is evaluated in the global environment.
520 @item step [@var{n}]
521 Step forward @var{n} (or one) lines, descending into subroutines.
523 @item xreturn @var{sub} @var{expr}
524 Return @var{expr} from the innermost call to @var{sub}.  This is a
525 somewhat dangerous and experimental feature, but is probably more useful
526 than returning a value from @code{die()}.
528 @end table
530 @node Evaluation, Mutilation, Debugger, Interactive Perl
531 @section Evaluation
533 When interactive Perl is running, Sepia can evaluate regions of code in
534 the inferior Perl process.  The following commands assume that this
535 process has already been started by calling @code{sepia-repl}.
537 @table @kbd
538 @item C-M-x
539 @itemx M-x sepia-eval-defun
540 @findex sepia-eval-defun
541 Evaluate the function around point in the inferior Perl process.  If it
542 contains errors, jump to the location of the first.
544 @item C-c C-l
545 @itemx M-x sepia-load-file
546 @findex sepia-load-file
547 Save the current buffer, then reload its file and if warnings or errors
548 occur, display an error buffer.  With a prefix argument, also rebuild
549 the cross-reference index.
551 @item C-c e
552 @itemx M-x sepia-eval-expression @key{RET} @var{expr} @key{RET}
553 @findex sepia-eval-expression
554 Evaluate @var{expr} in scalar context and echo the result.  With a
555 prefix argument, evaluate in list context.
557 @item C-c!
558 @itemx sepia-set-cwd
559 @findex sepia-set-cwd
560 Set the REPL's working directory to the current buffer's directory.
562 @end table
564 @node Mutilation, Scratchpad, Evaluation, Interactive Perl
565 @section Mutilation
567 Sepia contains several functions to operate on regions of text using the
568 interactive Perl process.  These functions can be used like standard
569 one-liners (e.g. @samp{perl -pe ...}), with the advantage that all of
570 the functions and variables in the interactive session are available.
572 @table @kbd
573 @item M-x sepia-perl-pe-region @key{RET} @var{code} @key{RET}
574 @findex sepia-perl-pe-region
575 Evaluate @var{code} on each line in the region with @code{$_} bound to
576 the line text, collecting the resulting values of @code{$_}.  With a
577 prefix argument, replace the region with the result.
579 @item M-x sepia-perl-ne-region @key{RET} @var{code} @key{RET}
580 @findex sepia-perl-ne-region
581 Evaluate @var{code} as above, but collect the results instead.
583 @item M-x sepia-perlize-region @key{RET} @var{code} @key{RET}
584 @findex sepia-perlize-region
585 Evaluate @var{code} once with @code{$_} bound to the entire region,
586 collecting the final value of @code{$_}.  With a prefix argument,
587 replace the region.
589 @end table
591 @node Scratchpad,  , Mutilation, Interactive Perl
592 @section Scratchpad
594 @findex sepia-scratch
595 Sepia also supports a scratchpad, another form of interaction inspired
596 by Emacs' @code{*scratch*} buffer.  To create or switch to the
597 scratchpad, type @kbd{M-x sepia-scratch}.  Scratchpad mode is exactly
598 like Sepia mode, except @key{C-j} evaluates the current line and prints
599 the result on the next line.
601 @c ============================================================
602 @node  CPAN browsing, Customization, Interactive Perl, Top
603 @chapter CPAN browsing
605 Sepia has rudimentary support for browsing documentation and installing
606 modules from CPAN.  To list modules with names matching a pattern, call
607 @code{sepia-cpan-search}.  In the @code{*sepia-cpan*} buffer, the
608 pressing the single keys listed below on the module-name buttons will
609 perform the corresponding action on the named module.
611 @table @kbd
612 @item s
613 @itemx M-x sepia-cpan-search @key{RET} @var{pattern} @key{RET}
614 @findex sepia-cpan-search
615 List modules whose names match @var{pattern}.
617 @item r
618 @itemx M-x sepia-cpan-readme @key{RET} @var{module} @key{RET}
619 @findex sepia-cpan-readme
620 Fetch and display @var{module}'s README file.
622 @item d
623 @itemx M-x sepia-cpan-doc @key{RET} @var{module} @key{RET}
624 @findex sepia-cpan-doc
625 Browse @var{module}'s documentation on @url{http://search.cpan.org}.
627 @item i
628 @itemx M-x sepia-cpan-install @key{RET} @var{module} @key{RET}
629 @findex sepia-cpan-install
630 Install @var{module} and its prerequisites.  This feature is not yet
631 well tested.
633 @end table
635 @c ============================================================
636 @node Customization, Internals, CPAN browsing, Top
637 @chapter Customization
639 While Sepia can be customized in both the Perl and Emacs Lisp, most of
640 the user-accessible configuration is in the latter.
642 @menu
643 * Emacs Variables::             
644 * Perl Variables::              
645 @end menu
647 @node Emacs Variables, Perl Variables, Customization, Customization
648 @section Emacs Variables
650 Since Sepia tries where possible to reuse existing Emacs functionality,
651 its behavior should already be covered by existing customizations.  The
652 two variables most likely to need customization are
653 @kbd{sepia-program-name} and @kbd{sepia-perl5lib}.  General Sepia mode
654 configuration can be done with @kbd{sepia-mode-hook}, while
655 REPL-specific configuration can be done with @kbd{sepia-repl-mode-hook}.
657 @table @kbd
659 @item sepia-complete-methods
660 If non-@code{nil}, @code{sepia-complete-symbol} will complete
661 simple method calls of the form @code{$x->} or @code{Module->}.  Since
662 the former requires evaluation of @code{$x}, this can be disabled.
663 Default: @code{T}.
665 @item sepia-eval-defun-include-decls
666 If non-@code{nil}, attempt to generate a declaration list for
667 @code{sepia-eval-defun}.  This is necessary when evaluating some code,
668 such as that calling functions without parentheses, because the presence
669 of declarations affects the parsing of barewords.  Default: @code{T}.
671 @item sepia-indent-expand-abbrev
672 If non-@code{nil}, @code{sepia-indent-or-complete} will, if
673 reindentation does not change the current line, expand an abbreviation
674 before point rather than performing completion.  Only if no abbreviation
675 is found will it perform completion.  Default: @code{T}.
677 @item sepia-module-list-function
678 The function to view a tree of installed modules.  Default:
679 @code{w3m-find-file} if Emacs-w3m is installed, or
680 @code{browse-url-of-buffer} otherwise.
682 @item sepia-perldoc-function
683 The function called to view installed modules' documentation.  Default:
684 @code{w3m-perldoc} if Emacs-w3m is installed, or @code{cperl-perldoc}
685 otherwise.
687 @item sepia-perl5lib
688 A list of directories to include in @code{PERL5LIB} when starting
689 interactive Perl.  Default: @code{nil}.
691 @item sepia-prefix-key
692 The prefix to use for for functions in @code{sepia-keymap}.  Default:
693 @key{M-.}.
695 @item sepia-program-name
696 The Perl program name for interactive Perl.  Default: ``perl''.
698 @item sepia-use-completion
699 If non-@code{nil}, various Sepia functions will generate completion
700 candidates from interactive Perl when called interactively.  This may be
701 slow or undesirable in some situations.  Default: @code{T}.
703 @item sepia-view-pod-function
704 The function called to view the current buffer's documentation.
705 Default: @code{sepia-w3m-view-pod} if Emacs-w3m is available, or
706 @code{sepia-perldoc-buffer} otherwise.
708 @end table
710 @node Perl Variables,  , Emacs Variables, Customization
711 @section Perl Variables
713 When Sepia starts up, it evaluates the Perl script in @file{~/.sepiarc}.
714 The following variables in the Sepia package control various aspects of
715 interactive evaluation.
717 @table @code
719 @item $PACKAGE
720 The package in which user input is evaluated, determined automatically
721 when code is evaluated from a buffer.  Default: @code{main}.
723 @item $PRINTER
724 The function called to format interactive output, normally set with the
725 @code{printer} shortcut.
727 @item $PRINT_PRETTY
728 If true, format some values nicely independent of the value of
729 @code{$PRINTER}.  Currently, this means columnating lists of simple
730 scalars.  Default: true.
732 @item $PS1
733 The trailing end of the prompt string, which should end with ``> ''.
734 Default: @code{"> "}.
736 @item $STOPDIE
737 If true, calls to @code{die} from interactive code will invoke the Sepia
738 debugger.  Default: true.
740 @item $STOPWARN
741 If true, calls to @code{warn} from interactive code will invoke the
742 Sepia debugger.  Default: false.
744 @item $WANTARRAY
745 If true, evaluate interactive expressions in list context.  Default: true.
747 @end table
749 Additional REPL shortcuts can be defined with
750 @kbd{Sepia::define_shortcut}.  For example
752 @example
753 Sepia::define_shortcut time => sub @{ print scalar localtime, "\n"; 0 @},
754     'Display the current time.';
755 @end example
757 defines a shortcut ``time'' that displays the current time.  For
758 details, see the code in @file{Sepia.pm}.
760 @c ============================================================
761 @node Internals, Credits, Customization, Top
762 @chapter Internals
764 Many things remain unexplained except by the code itself, and some
765 details mentioned above should probably be given less prominence.  For
766 developer documentation, please see the POD for @code{Sepia} and
767 @code{Sepia::Xref}, and the doc-strings in @file{sepia.el}.
769 @node Credits, Function Index, Internals, Top
770 @unnumbered Credits
772 @table @asis
773 @item Hilko Bengen
774 Found and motivated me to fix a bunch of bugs, created Debian packages.
776 @item Ævar Arnfjörð Bjarmason
777 Miscellaneous fixes.  Tested unicode support.
779 @item Ye Wenbin
780 Found and fixed numerous bugs.
782 @item Free Software
783 Portions of the code were lifted from Emacs-w3m, SLIME, ido, and
784 B::Xref, all of which are Free software.
786 @end table
788 @c ============================================================
789 @node Function Index,  , Credits, Top
790 @unnumbered Function Index
791 @printindex fn
793 @bye