Make 'finish' work.
[sepia.git] / sepia.texi
blobf58453642fb7846400a797b8efbfa7102c9eb6ef
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 * Related Work::                
67 @end menu
69 @node Getting Started, Philosophy, Introduction, Introduction
70 @section Getting Started
72 To install Sepia, its Emacs Lisp files must be in Emacs'
73 @code{load-path}, and the @file{lib} directory must be in Perl's
74 @code{@@INC}.  Assuming that Sepia has been unpacked in
75 @file{~/sepia}, it can be installed by adding the following lines to
76 @file{~/.emacs}:
78 @example
79 (add-to-list 'load-path "~/sepia")
80 (setq sepia-perl5lib (list (expand-file-name "~/sepia/lib")))
81 (defalias 'perl-mode 'sepia-mode)
82 (require 'sepia)
83 @end example
85 Then to bring up the interactive Perl prompt, type @kbd{M-x sepia-repl}.
87 @node Philosophy, Related Work, Getting Started, Introduction
88 @section Philosophy
90 A development environment should support three activities: code
91 spelunking, interaction, and customization.  Emacs as an environment for
92 developing Emacs Lisp thoroughly supports all of them: It has commands
93 to visit individual functions' code and documentation, commands to
94 evaluate or step through expressions, and an architecture that
95 encourages customization in Emacs Lisp.  As an environment for Perl,
96 however, it is lacking: there is limited interactivity with the Perl
97 debugger, and reasonable documentation browsing, but no support for
98 navigating, editing, and re-evaluating code.  Sepia attempts to remedy
99 the situation.
101 Modern IDEs also support these three activities, but do so awkwardly.
102 Rather than having functions to visit definitions (@kbd{find-function})
103 and search for functions (@kbd{apropos}), they clutter the screen with
104 class and file trees.  Rather than supporting interactive evaluation of
105 small pieces of code, they perform background semantic checking on whole
106 projects and highlight errors.  Rather than allowing minor
107 customizations to grow organically into features, they support limited
108 configuration files and baroque plug-in APIs.  Sepia tries to adhere to
109 the apparent Emacs philosophy that rich semantic information should be
110 unobtrusive, and that the best way to build working code is to start
111 by experimenting with small pieces.
113 Language support packages for Emacs vary widely in the degree to which
114 they make use of or replace existing Emacs features.  Minimal modes
115 provide keyword-based syntax highlighting and an unadorned comint buffer
116 as an interpreter.  Others provide their own specialized equivalents of
117 comint, eldoc, completion, and other Emacs features.  Sepia takes a
118 third approach by trying to do as much as possible with existing Emacs
119 features, even when they are not optimal for Perl.  For example, it uses
120 comint to communicate with the subprocess, eldoc to display
121 documentation, and grep to list source locations.
123 This approach has three advantages: First, it maximizes the number of
124 features that can be supported with limited development time.  Second,
125 it respects users' settings.  A seasoned Emacs user may have changed
126 hundreds of settings, so a mode that reimplements features will have to
127 support equivalent settings, and will force the user to re-specify them.
128 Finally, this approach respects decades of development spent, as Neal
129 Stephenson put it, ``focused with maniacal intensity on the deceptively
130 simple-seeming problem of editing text.''  Many non-obvious choices go
131 into making a polished interface, and while a reimplementation gets rid
132 of accumulated cruft, it must rediscover these hidden trade-offs.
134 Anyways, I hope you enjoy using Sepia.  Its development style is strange
135 for someone used Perl's typical mix of one-liners and edit-save-run, but
136 once you are accustomed to it, you may find it very effective.
138 @node Related Work,  , Philosophy, Introduction
139 @comment  node-name,  next,  previous,  up
140 @section Related Work
142 A number of more-or-less related Emacs extensions are currently under
143 development.  Here is a list of the ones I have heard about, along with
144 my brief impression of how they differ from Sepia.  Since I use none of
145 them regularly, these impressions should be taken with a grain of salt.
147 @table @cite
149 @item PDE
151 PDE is similar to Sepia in offering an interactive Lisp-like development
152 environment interfacing with a long-running Perl process.  It seems more
153 ambitious, and therefore a bit more invasive.
155 @url{http://search.cpan.org/search?query=pde&mode=module}
157 @item Devel::PerlySense
159 Devel::PerlySense offers a more Eclipse-like development environment,
160 with offline code analysis via @acronym{PPI}.
162 @url{http://search.cpan.org/search?query=devel::perlysense&mode=module}
164 @item Emacs::EPL
166 Emacs::EPL is a low-level IPC interface between Emacs and Perl.  Sepia
167 was originally based on Emacs::EPL, but the current
168 @command{comint}-based implementation proved more maintainable.
170 @url{http://search.cpan.org/search?query=emacs::epl&mode=module}
172 @end table
174 @c ============================================================
175 @node Editing, Interactive Perl, Introduction, Top
176 @chapter Editing
177 @findex sepia-mode
179 Sepia's first contribution is a set of commands to explore a Perl
180 codebase.  These include commands to browse and display documentation,
181 to find function definitions, and to query a cross-reference database of
182 function and variable uses.  Sepia also provides intelligent symbol
183 completion.
185 @menu
186 * Completion::                  
187 * Navigation::                  
188 * Documentation::               
189 @end menu
191 @node Completion, Navigation, Editing, Editing
192 @section Completion
194 Sepia implements partial-word completion that communicates with the
195 inferior Perl process.  For example, @samp{%S:X:v_u} completes to
196 @samp{%Sepia::Xref::var_use} when Sepia is loaded.  This completion only
197 operates on functions and global variables known to the Perl
198 interpreter, so it works best when code and interpreter are in sync.
200 More precisely, completion examines the text before point and tries each
201 of the following in turn, using the first successful approach:
203 @enumerate
204 @item
205 If the text looks like a method call (e.g. @samp{$object->f} or
206 @samp{Class->f}), complete on methods.
208 @item
209 If it looks like a variable (e.g. @samp{%hash} or @samp{$scalar}),
210 complete on variables.
212 @item
213 Complete on modules and functions.
215 @item
216 Otherwise, complete on Perl built-in operators.
217 @end enumerate
219 For each of the first three cases, completions candidates are first
220 generated by splitting the text on characters @code{[:_]} and matching
221 the resulting word parts.  For example, @samp{X:a_b} will complete to
222 all symbols matching @samp{^X[^:]*:+a[^:_]*_b} such as @samp{Xref::a_bug}
223 and @samp{X::always_bites_me}.  If no matches result, the text is
224 treated as an acronym.  For example, @samp{dry} will complete to
225 @samp{dont_repeat_yourself}.
227 Completion is performed by the following commands:
228 @table @kbd
229 @item M-x sepia-complete-symbol
230 @findex sepia-complete-symbol
231 Complete the symbol before point as described above.  Note that this
232 does not consider lexical scope, and is always case-sensitive,
233 independent of @code{completion-ignore-case}.
235 @item TAB
236 @itemx M-x sepia-indent-or-complete
237 @findex sepia-indent-or-complete
238 First try to reindent the current line.  If its indentation does not
239 change, then try to expand an abbrev at point (unless
240 @code{sepia-indent-expand-abbrev} is @code{nil}).  If no abbrev is
241 expanded, then call @code{sepia-complete-symbol}.
243 @end table
245 @node Navigation, Documentation, Completion, Editing
246 @section Navigation
248 Sepia provides several commands for navigating program source.  All of
249 them rely on information from the inferior Perl process, so it is
250 important both that it be running, and that its internal representation
251 of the program match the program source.  The commands marked (Xref)
252 below also rely on a cross-reference database, which must be explicitly
253 rebuilt by calling @code{xref-rebuild} when the program changes.
255 There are two basic kinds of navigation commands.  The first kind jumps
256 directly to the first matching location when possible, prompting only if
257 no such location is found.  These commands find only a single location.
259 @c direct-jump commands
260 @table @kbd
262 @item M-. M-.
263 @itemx M-x sepia-dwim
264 @findex sepia-dwim
265 Guess what kind of identifier is at point, and try to do the right
266 thing: for a function, find its definition(s); for a variable, find its
267 uses; for a module, view its documentation; otherwise, prompt for the
268 name of a function to visit.  @code{sepia-dwim} automatically goes to
269 the first function definition or variable use found.
271 @item M-. l
272 @itemx M-x sepia-location
273 @findex sepia-location
274 Jump directly to the definition of the function at point, prompting if
275 point is not on a known function.  If multiple definitions are found,
276 choose one arbitrarily.  This function is similar to @code{sepia-defs},
277 and the two should probably be merged.
279 @item M-. j
280 @itemx M-x sepia-jump-to-symbol
281 @findex sepia-jump-to-symbol
282 Navigate to a function using ``ido'' interactive completion.  Within
283 interactive completion, press @key{:} to descend into a package,
284 @key{DEL} to ascend to a parent package, and @key{RET} to go to the
285 currently-selected function.
287 @end table
289 The second kind of navigation commands always prompts the user -- though
290 usually with a sensible default value -- and finds multiple locations.
291 When called with a prefix argument, these commands present their results
292 in a @code{grep-mode} buffer.  When called @emph{without} a prefix
293 argument, they place all results on the found-location ring and jump
294 directly to the first.  The remaining locations can be cycled through by
295 calls to @code{sepia-next}.
297 @c prompt-and-go commands
298 @table @kbd
299 @item M-. f @var{name} @key{RET}
300 @itemx M-x sepia-defs
301 @findex sepia-defs
302 Find definition(s) of function @var{name}.
304 @item M-. m @var{name} @key{RET}
305 @itemx M-x sepia-module-find @var{name} @key{RET}
306 @findex sepia-module-find
307 Find the source of module @var{name}.
309 @item M-. a @var{regexp} @key{RET}
310 @itemx M-x sepia-apropos @var{regexp} @key{RET}
311 @findex sepia-apropos
312 Find definitions of all functions whose names match @var{regexp}.
314 @item M-. c @var{name} @key{RET}
315 @itemx M-x sepia-callers @var{name} @key{RET}
316 @findex sepia-callers
317 (Xref) Find calls to function @var{name}.
319 @item M-. C @var{name} @key{RET}
320 @itemx M-x sepia-callees @var{name} @key{RET}
321 @findex sepia-callees
322 (Xref) Find the definitions of functions called by @var{name}.
324 @item M-. v @var{name} @key{RET}
325 @itemx M-x sepia-var-uses @var{name} @key{RET}
326 @findex sepia-var-uses
327 (Xref) Find uses of the global variable @var{name}.
329 @item M-. V @var{name} @key{RET}
330 @itemx M-x sepia-var-defs @var{name} @key{RET}
331 @findex sepia-var-defs
332 (Xref) Find definitions of global variable @var{name}.  Since Perl's
333 global variables are not declared, this is rarely useful
335 @c XXX: broken, so don't mention it.
336 @c @item M-. A @var{regexp} @key{RET}
337 @c @itemx M-x sepia-var-apropos
338 @c @findex sepia-var-apropos
339 @c Find definitions of all variables whose names match @var{regexp}.  Since
340 @c this function does not handle lexical variables, and since Perl's global
341 @c variables are not declared, this is rarely useful.
343 @end table
345 Finally, there are several other navigation-related commands that do not
346 fit into either of the above categories.
348 @c other commands
349 @table @kbd
350 @item M-,
351 @itemx M-x sepia-next
352 @findex sepia-next
353 Cycle through the definitions found by the previous @key{M-.} search.
355 @item M-. r
356 @itemx M-x sepia-rebuild
357 @findex sepia-rebuild
358 Rebuild the cross-reference database by walking the op-tree and
359 stashes.
361 @item M-. t
362 @itemx M-x find-tag
363 Execute the @code{find-tag} command typically bound to @key{M-.}.
365 @end table
367 @node Documentation,  , Navigation, Editing
368 @section Documentation
370 Sepia can be used to browse installed modules' documentation, to format
371 and display the current buffer's POD, and to browse the list of modules
372 installed on the system.
374 @table @kbd
375 @item M-. d @var{name} @key{RET}
376 @itemx M-x sepia-perldoc-this
377 @findex sepia-perldoc-this
378 View documentation for module @var{name} or Perl manual page @var{name}.
380 @item C-c C-d
381 @itemx M-x sepia-view-pod
382 @findex sepia-view-pod
383 Format and view the current buffer's documentation.
385 @item sepia-package-list
386 @findex sepia-package-list
387 Browse a tree of installed packages.  This lists only the top-level
388 packages from installed distributions, so if package @code{My::Stuff}
389 also provides @code{My::Stuff::Details}, it will not be displayed.  When
390 Emacs-w3m is available, each module is linked to its documentation.
392 @item sepia-module-list
393 @findex sepia-module-list
394 Browse a tree of both top-level and internal packages, like
395 @code{sepia-package-list}.
397 @end table
399 @findex sepia-install-eldoc
400 Sepia also integrates with eldoc (at least in GNU Emacs >= 22).
401 Documentation for Perl operators and control structures is taken from
402 CPerl mode.  Sepia will also display documentation for user-defined
403 functions if their POD is formatted in the standard way, with functions
404 described in a ``=head2'' or ``=item'' entry.  To load user
405 documentation, visit the relevant file and type @kbd{M-x
406 sepia-doc-update}.
408 If @code{Module::CoreList} is available, Sepia's eldoc function will
409 also display the first version of Perl with which a module was shipped.
410 This is intended to give the programmer a sense of when he is creating
411 external dependencies.
413 @c ============================================================
414 @node Interactive Perl, CPAN browsing, Editing, Top
415 @chapter Interactive Perl
417 @findex sepia-repl
418 Sepia's second main contribution is an interactive interface (REPL) to
419 an inferior Perl process.  The interface is based on GUD mode, and
420 inherits many of its bindings; this chapter discusses only the Sepia
421 extensions.  To start or switch to the repl, type @kbd{M-x sepia-repl}.
422 As in Sepia mode, @key{TAB} in the REPL performs partial-word completion
423 with @code{sepia-complete-symbol}.
425 Sepia also provides a number of other ways to evaluate pieces of code in
426 Perl, and commands to process buffer text using the inferior process.
428 @menu
429 * Shortcuts::                   
430 * Debugger::                    
431 * Evaluation::                  
432 * Mutilation::                  
433 * Scratchpad::                  
434 @end menu
436 @node Shortcuts, Debugger, Interactive Perl, Interactive Perl
437 @section Shortcuts
439 ``Shortcuts'' are commands handled specially by the REPL rather than
440 being evaluated as Perl code.  They either communicate with the REPL
441 function, or provide a convenient interface to variables in the Sepia
442 package.  Shortcuts are prefixed by a comma (@key{,}), and may be
443 abbreviated to the shortest unique prefix.
445 @table @kbd
446 @item cd @var{dir}
447 Change Perl's current directory to @var{dir}.
449 @item debug [@var{val}]
450 Turn Sepia debugger hook on or off, or toggle if @var{val} is missing.
452 @item define @var{name} ['@var{doc}'] @var{body...}
453 Define @var{name} as a shortcut for Perl code @var{body}, with optional
454 documentation @var{doc}, surrounded by single quotes.  @var{body} is
455 passed the raw command-line text as its first argument.
457 @item delete
458 Delete the current breakpoint.
460 @item format @var{type}
461 Set the output format to @var{type}, either ``dumper'' (using
462 @code{Data::Dumper}), ``dump'' (@code{Data::Dump}), ``yaml''
463 (@code{YAML}), or ``plain'' (stringification).  Default: ``dumper''.
465 @item help
466 Display a list of shortcuts.
468 @item lsbreak
469 List breakpoints.
471 @item methods @var{name} [@var{regexp}]
472 Display a list of functions defined in package @var{name} and its
473 @code{ISA}-ancestors matching optional pattern @var{regexp}.
475 @item package @var{name}
476 Set the default evaluation package to @var{name}.
478 @item pwd
479 Show the process's current working directory.
481 @item quit
482 Exit the inferior Perl process.
484 @item reload
485 Reload @file{Sepia.pm} and recursively invoke the REPL.  This command is
486 mostly of interest when working on Sepia itself.
488 @item shell [@var{command}]
489 Execute shell command @var{command}, displaying its standard output and
490 standard error.
492 @item strict [@var{val}]
493 Set evaluation strictness to @var{val}, or toggle it if @var{val} is not
494 given.  Note that turning strictness off and on clears the REPL's
495 lexical environment.
497 @item undef @var{name}
498 Undefine shortcut @var{name}.  @strong{Warning}: this can equally be
499 used to remove built-in shortcuts.
501 @item wantarray [@var{val}]
502 Set the evaluation context to @var{val}, or toggle between scalar and
503 array context.
505 @item who @var{package} [@var{regexp}]
506 @itemx who [@var{regexp}]
507 List identifiers in @var{package} (main by default) matching
508 optional @var{regexp}.
510 @end table
512 @node Debugger, Evaluation, Shortcuts, Interactive Perl
513 @section Debugger
515 Sepia uses Perl's debugger hooks and GUD mode to support conditional
516 breakpoints and single-stepping, and overrides Perl's @code{die()} to
517 invoke the debugger rather than unwind the stack.  This makes it
518 possible to produce a backtrace, inspect and modify global variables,
519 and even continue execution when a program tries to kill itself.  If the
520 PadWalker module is available, Sepia also provides functions to inspect
521 and modify lexical variables.
523 The debugger has its own set of shortcuts, also prefixed by a comma.
525 @table @kbd
526 @item backtrace
527 Show a backtrace.
529 @item break @var{file}:@var{line} [@var{expr}]
530 Set a breakpoint in @var{file} at @var{line}.  If @var{expr} is
531 supplied, stop only if it evaluates to true.
533 @item down @var{n}
534 @itemx up @var{n}
535 Move the current stack frame up or down by @var{n} (or one) frames.
537 @item inspect [@var{n}]
538 Inspect lexicals in the current frame or frame @var{n}, counting upward
539 from 1.
541 @item lsbreak
542 List breakpoints.
544 @item next [@var{n}]
545 Advance @var{n} (or one) lines, skipping subroutine calls.
547 @item quit
548 @itemx die
549 @itemx warn
550 Continue as the program would have executed without debugger
551 intervention, dying if the debugger was called from @code{die()}.
553 @item return @var{expr}
554 Continue execution as if @code{die()} had returned the value of
555 @var{expr}, which is evaluated in the global environment.
557 @item step [@var{n}]
558 Step forward @var{n} (or one) lines, descending into subroutines.
560 @item xreturn @var{sub} @var{expr}
561 Return @var{expr} from the innermost call to @var{sub}.  This is a
562 somewhat dangerous and experimental feature, but is probably more useful
563 than returning a value from @code{die()}.
565 @end table
567 @node Evaluation, Mutilation, Debugger, Interactive Perl
568 @section Evaluation
570 When interactive Perl is running, Sepia can evaluate regions of code in
571 the inferior Perl process.  The following commands assume that this
572 process has already been started by calling @code{sepia-repl}.
574 @table @kbd
575 @item C-M-x
576 @itemx M-x sepia-eval-defun
577 @findex sepia-eval-defun
578 Evaluate the function around point in the inferior Perl process.  If it
579 contains errors, jump to the location of the first.
581 @item C-c C-l
582 @itemx M-x sepia-load-file
583 @findex sepia-load-file
584 Save the current buffer, then reload its file and if warnings or errors
585 occur, display an error buffer.  With a prefix argument, also rebuild
586 the cross-reference index.
588 @item C-c e
589 @itemx M-x sepia-eval-expression @key{RET} @var{expr} @key{RET}
590 @findex sepia-eval-expression
591 Evaluate @var{expr} in scalar context and echo the result.  With a
592 prefix argument, evaluate in list context.
594 @item C-c!
595 @itemx sepia-set-cwd
596 @findex sepia-set-cwd
597 Set the REPL's working directory to the current buffer's directory.
599 @end table
601 @node Mutilation, Scratchpad, Evaluation, Interactive Perl
602 @section Mutilation
604 Sepia contains several functions to operate on regions of text using the
605 interactive Perl process.  These functions can be used like standard
606 one-liners (e.g. @samp{perl -pe ...}), with the advantage that all of
607 the functions and variables in the interactive session are available.
609 @table @kbd
610 @item M-x sepia-perl-pe-region @key{RET} @var{code} @key{RET}
611 @findex sepia-perl-pe-region
612 Evaluate @var{code} on each line in the region with @code{$_} bound to
613 the line text, collecting the resulting values of @code{$_}.  With a
614 prefix argument, replace the region with the result.
616 @item M-x sepia-perl-ne-region @key{RET} @var{code} @key{RET}
617 @findex sepia-perl-ne-region
618 Evaluate @var{code} as above, but collect the results instead.
620 @item M-x sepia-perlize-region @key{RET} @var{code} @key{RET}
621 @findex sepia-perlize-region
622 Evaluate @var{code} once with @code{$_} bound to the entire region,
623 collecting the final value of @code{$_}.  With a prefix argument,
624 replace the region.
626 @end table
628 @node Scratchpad,  , Mutilation, Interactive Perl
629 @section Scratchpad
631 @findex sepia-scratch
632 Sepia also supports a scratchpad, another form of interaction inspired
633 by Emacs' @code{*scratch*} buffer.  To create or switch to the
634 scratchpad, type @kbd{M-x sepia-scratch}.  Scratchpad mode is exactly
635 like Sepia mode, except @key{C-j} evaluates the current line and prints
636 the result on the next line.
638 @c ============================================================
639 @node  CPAN browsing, Customization, Interactive Perl, Top
640 @chapter CPAN browsing
642 Sepia has rudimentary support for browsing documentation and installing
643 modules from CPAN.  To list modules with names matching a pattern, call
644 @code{sepia-cpan-search}.  In the @code{*sepia-cpan*} buffer, the
645 pressing the single keys listed below on the module-name buttons will
646 perform the corresponding action on the named module.
648 @table @kbd
649 @item s
650 @itemx M-x sepia-cpan-search @key{RET} @var{pattern} @key{RET}
651 @findex sepia-cpan-search
652 List modules whose names match @var{pattern}.
654 @item r
655 @itemx M-x sepia-cpan-readme @key{RET} @var{module} @key{RET}
656 @findex sepia-cpan-readme
657 Fetch and display @var{module}'s README file.
659 @item d
660 @itemx M-x sepia-cpan-doc @key{RET} @var{module} @key{RET}
661 @findex sepia-cpan-doc
662 Browse @var{module}'s documentation on @url{http://search.cpan.org}.
664 @item i
665 @itemx M-x sepia-cpan-install @key{RET} @var{module} @key{RET}
666 @findex sepia-cpan-install
667 Install @var{module} and its prerequisites.  This feature is not yet
668 well tested.
670 @end table
672 @c ============================================================
673 @node Customization, Internals, CPAN browsing, Top
674 @chapter Customization
676 While Sepia can be customized in both the Perl and Emacs Lisp, most of
677 the user-accessible configuration is in the latter.
679 @menu
680 * Emacs Variables::             
681 * Perl Variables::              
682 @end menu
684 @node Emacs Variables, Perl Variables, Customization, Customization
685 @section Emacs Variables
687 Since Sepia tries where possible to reuse existing Emacs functionality,
688 its behavior should already be covered by existing customizations.  The
689 two variables most likely to need customization are
690 @kbd{sepia-program-name} and @kbd{sepia-perl5lib}.  General Sepia mode
691 configuration can be done with @kbd{sepia-mode-hook}, while
692 REPL-specific configuration can be done with @kbd{sepia-repl-mode-hook}.
694 @table @kbd
696 @item sepia-complete-methods
697 If non-@code{nil}, @code{sepia-complete-symbol} will complete
698 simple method calls of the form @code{$x->} or @code{Module->}.  Since
699 the former requires evaluation of @code{$x}, this can be disabled.
700 Default: @code{T}.
702 @item sepia-eval-defun-include-decls
703 If non-@code{nil}, attempt to generate a declaration list for
704 @code{sepia-eval-defun}.  This is necessary when evaluating some code,
705 such as that calling functions without parentheses, because the presence
706 of declarations affects the parsing of barewords.  Default: @code{T}.
708 @item sepia-indent-expand-abbrev
709 If non-@code{nil}, @code{sepia-indent-or-complete} will, if
710 reindentation does not change the current line, expand an abbreviation
711 before point rather than performing completion.  Only if no abbreviation
712 is found will it perform completion.  Default: @code{T}.
714 @item sepia-module-list-function
715 The function to view a tree of installed modules.  Default:
716 @code{w3m-find-file} if Emacs-w3m is installed, or
717 @code{browse-url-of-buffer} otherwise.
719 @item sepia-perldoc-function
720 The function called to view installed modules' documentation.  Default:
721 @code{w3m-perldoc} if Emacs-w3m is installed, or @code{cperl-perldoc}
722 otherwise.
724 @item sepia-perl5lib
725 A list of directories to include in @code{PERL5LIB} when starting
726 interactive Perl.  Default: @code{nil}.
728 @item sepia-prefix-key
729 The prefix to use for for functions in @code{sepia-keymap}.  Default:
730 @key{M-.}.
732 @item sepia-program-name
733 The Perl program name for interactive Perl.  Default: ``perl''.
735 @item sepia-use-completion
736 If non-@code{nil}, various Sepia functions will generate completion
737 candidates from interactive Perl when called interactively.  This may be
738 slow or undesirable in some situations.  Default: @code{T}.
740 @item sepia-view-pod-function
741 The function called to view the current buffer's documentation.
742 Default: @code{sepia-w3m-view-pod} if Emacs-w3m is available, or
743 @code{sepia-perldoc-buffer} otherwise.
745 @end table
747 @node Perl Variables,  , Emacs Variables, Customization
748 @section Perl Variables
750 When Sepia starts up, it evaluates the Perl script in @file{~/.sepiarc}.
751 The following variables in the Sepia package control various aspects of
752 interactive evaluation.
754 @table @code
756 @item $PACKAGE
757 The package in which user input is evaluated, determined automatically
758 when code is evaluated from a buffer.  Default: @code{main}.
760 @item $PRINTER
761 The function called to format interactive output, normally set with the
762 @code{printer} shortcut.
764 @item $PRINT_PRETTY
765 If true, format some values nicely independent of the value of
766 @code{$PRINTER}.  Currently, this means columnating lists of simple
767 scalars.  Default: true.
769 @item $PS1
770 The trailing end of the prompt string, which should end with ``> ''.
771 Default: @code{"> "}.
773 @item $STOPDIE
774 If true, calls to @code{die} from interactive code will invoke the Sepia
775 debugger.  Default: true.
777 @item $STOPWARN
778 If true, calls to @code{warn} from interactive code will invoke the
779 Sepia debugger.  Default: false.
781 @item $WANTARRAY
782 If true, evaluate interactive expressions in list context.  Default: true.
784 @end table
786 Additional REPL shortcuts can be defined with
787 @kbd{Sepia::define_shortcut}.  For example
789 @example
790 Sepia::define_shortcut time => sub @{ print scalar localtime, "\n"; 0 @},
791     'Display the current time.';
792 @end example
794 defines a shortcut ``time'' that displays the current time.  For
795 details, see the code in @file{Sepia.pm}.
797 @c ============================================================
798 @node Internals, Credits, Customization, Top
799 @chapter Internals
801 Many things remain unexplained except by the code itself, and some
802 details mentioned above should probably be given less prominence.  For
803 developer documentation, please see the POD for @code{Sepia} and
804 @code{Sepia::Xref}, and the doc-strings in @file{sepia.el}.
806 @node Credits, Function Index, Internals, Top
807 @unnumbered Credits
809 @table @asis
810 @item Hilko Bengen
811 Found and motivated me to fix a bunch of bugs, created Debian packages.
813 @item Ævar Arnfjörð Bjarmason
814 Miscellaneous fixes.  Tested unicode support.
816 @item Ye Wenbin
817 Found and fixed numerous bugs.
819 @item Free Software
820 Portions of the code were lifted from Emacs-w3m, SLIME, ido, and
821 B::Xref, all of which are Free software.
823 @end table
825 @c ============================================================
826 @node Function Index,  , Credits, Top
827 @unnumbered Function Index
828 @printindex fn
830 @bye