This is an automated email from the git hooks/post-receive script. bengen pushed a commit to branch master in repository sepia.
commit b13628524fe0c6d1e5e528d6d3eb91b8bd3b7df3 Author: Hilko Bengen <ben...@debian.org> Date: Thu May 24 22:28:14 2007 +0200 Imported Debian patch 0.73-1 --- ChangeLog | 22 +++++++++ META.yml | 2 +- debian/changelog | 13 ++++++ lib/Sepia.pm | 137 +++++++++++++++++++++++++++++++++++++++---------------- sepia.el | 33 +++++++++----- 5 files changed, 155 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ea9ed4..ce8bf18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2007-05-23 Sean O'Rourke <sorou...@cs.ucsd.edu> + + * lib/Sepia.pm (_apropos_re): handle empty completions. + (columnate): pretty-print ",who" output. + + * sepia.el (sepia-complete-symbol): bury stale completions buffer; + suggested by Hilko Bengen. + +2007-05-17 Sean O'Rourke <sorou...@cs.ucsd.edu> + + * lib/Sepia.pm (_completions1): Fix infinite recursion. + (repl): typo; clarify ambiguous vs. unrecognized shortcuts. + +2007-05-15 Sean O'Rourke <sorou...@cs.ucsd.edu> + + * sepia.el (sepia-dwim): don't try to jump to location when + looking up module docs. + + * lib/Sepia.pm: use $::__ instead of $Sepia::__ + (repl_quit): new command. + (repl): add banner. + 2007-05-12 Sean O'Rourke <sorou...@cs.ucsd.edu> * VERSION: 0.72 diff --git a/META.yml b/META.yml index 0227425..60f7bd1 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Sepia -version: 0.72 +version: 0.73 abstract: Simple Emacs-Perl InterAction license: perl generated_by: ExtUtils::MakeMaker version 6.31 diff --git a/debian/changelog b/debian/changelog index 08fdfa0..362e0f4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +sepia (0.73-1) unstable; urgency=low + + * New upstream release + + -- Hilko Bengen <ben...@debian.org> Thu, 24 May 2007 22:28:14 +0200 + +sepia (0.72-2) unstable; urgency=low + + * Fix for deep recursion when trying to autocomplete empty symbol + * Change keybinding for sepia-indent-or-complete to M-TAB + + -- Hilko Bengen <ben...@debian.org> Thu, 17 May 2007 09:42:12 +0200 + sepia (0.72-1) unstable; urgency=low * New upstream release diff --git a/lib/Sepia.pm b/lib/Sepia.pm index 14b10b3..8ce4006 100644 --- a/lib/Sepia.pm +++ b/lib/Sepia.pm @@ -4,9 +4,20 @@ package Sepia; Sepia - Simple Emacs-Perl Interface +=head1 SYNOPSIS + +From inside Emacs: + + M-x load-library RET sepia RET + M-x sepia-init RET + +At the prompt in the C<*perl-interaction*> buffer: + + main @> ,help + =cut -$VERSION = '0.72'; +$VERSION = '0.73'; @ISA = qw(Exporter); require Exporter; @@ -45,9 +56,14 @@ BEGIN { } } -=over 4 +=head1 DESCRIPTION + +Sepia is a set of features to make Emacs a better tool for Perl +development. This package contains the Perl side of the +implementation, including all user-serviceable parts (for the +cross-referencing facility see L<Sepia::Xref>). -=item C<@compls = completions($string [, $type])> +=head2 C<@compls = completions($string [, $type])> Find a list of completions for C<$string> with glob type $type. Completion operates on word subparts separated by [:_], so @@ -59,6 +75,7 @@ sub _apropos_re($) { # Do that crazy multi-word identifier completion thing: my $re = shift; + return qr/.*/ if $re eq ''; if (wantarray) { map { s/(?:^|(?<=[A-Za-z\d]))(([^A-Za-z\d])\2*)/[A-Za-z\\d]*$2+/g; @@ -75,13 +92,13 @@ sub _apropos_re($) sub _completions1 { no strict; + print STDERR "_completions1(@_)\n"; my $stash = shift; - if (@_ == 1) { - map { - "$stash$_" - } grep /$_[0]/, keys %$stash; + my $re = shift || ''; + $re = qr/$re/; + if (@_ == 0 || !defined $_[0]) { + map "$stash$_", grep /$re/, keys %$stash; } else { - my $re = shift; map { _completions1("$stash$_", @_); } grep /$re.*::$/, keys %$stash; @@ -143,7 +160,7 @@ sub completions @ret; } -=item C<@locs = location(@names)> +=head2 C<@locs = location(@names)> Return a list of [file, line, name] triples, one for each function name in C<@names>. @@ -189,7 +206,7 @@ sub location return @x; } -=item C<@matches = apropos($name [, $is_regex])> +=head2 C<@matches = apropos($name [, $is_regex])> Search for function C<$name>, either in all packages or, if C<$name> is qualified, only in one package. If C<$is_regex> is true, the @@ -249,7 +266,7 @@ sub apropos } } -=item C<@names = mod_subs($pack)> +=head2 C<@names = mod_subs($pack)> Find subs in package C<$pack>. @@ -265,7 +282,7 @@ sub mod_subs } } -=item C<@decls = mod_decls($pack)> +=head2 C<@decls = mod_decls($pack)> Generate a list of declarations for all subroutines in package C<$pack>. @@ -285,7 +302,7 @@ sub mod_decls return wantarray ? @ret : join '', @ret; } -=item C<$info = module_info($module, $type)> +=head2 C<$info = module_info($module, $type)> Emacs-called function to get module information. @@ -311,7 +328,7 @@ sub module_info($$) } } -=item C<$file = mod_file($mod)> +=head2 C<$file = mod_file($mod)> Find the likely file owner for module C<$mod>. @@ -327,7 +344,7 @@ sub mod_file $m ? $INC{"$m.pm"} : undef; } -=item C<@mods = package_list> +=head2 C<@mods = package_list> Gather a list of all distributions on the system. XXX UNUSED @@ -348,7 +365,7 @@ sub package_list sort inst->modules; } -=item C<@mods = module_list> +=head2 C<@mods = module_list> Gather a list of all packages (.pm files, really) installed on the system, grouped by distribution. XXX UNUSED @@ -368,7 +385,7 @@ sub module_list } @_; } -=item C<@mods = doc_list> +=head2 C<@mods = doc_list> Gather a list of all documented packages (.?pm files, really) installed on the system, grouped by distribution. XXX UNUSED @@ -386,7 +403,7 @@ sub doc_list } @_; } -=item C<lexicals($subname)> +=head2 C<lexicals($subname)> Return a list of C<$subname>'s lexical variables. Note that this includes all nested scopes -- I don't know if or how Perl @@ -404,7 +421,7 @@ sub lexicals } grep B::class($_) ne 'SPECIAL', $names->ARRAY; } -=item C<$lisp = tolisp($perl)> +=head2 C<$lisp = tolisp($perl)> Convert a Perl scalar to some ELisp equivalent. @@ -439,10 +456,11 @@ sub tolisp($) } } -=item C<printer(\@res [, $iseval])> +=head2 C<printer(\@res [, $iseval])> Print C<@res> appropriately on the current filehandle. If C<$iseval> -is true, use terse format. Otherwise, use human-readable format. +is true, use terse format. Otherwise, use human-readable format, +which can use either L<Data::Dumper>, L<YAML>, or L<Data::Dump>. =cut @@ -462,7 +480,7 @@ sub print_dumper sub print_plain { no strict; - $__ = "@res"; + $::__ = "@res"; } sub print_yaml @@ -495,25 +513,26 @@ sub printer @__ = @res; my $str; if ($iseval) { - $__ = "@res"; + $::__ = "@res"; } elsif (@res == 1 && (ref $res[0]) =~ /^PDL/) { - $__ = "$res[0]"; + $::__ = "$res[0]"; } else { - $__ = $PRINTER->(); + $::__ = $PRINTER->(); } if ($iseval) { - print ';;;', length $__, "\n$__\n"; + print ';;;', length $::__, "\n$::__\n"; } else { - print "=> $__\n"; + print "=> $::__\n"; } } -=item C<repl(\*FH)> +=head2 C<repl(\*FH)> Execute a command interpreter on FH. The prompt has a few bells and whistles, including: - * Obviously-incomplete lines are treated as multiline input. + * Obviously-incomplete lines are treated as multiline input (press + 'return' twice or 'C-c' to discard). * C<die> is overridden to enter a recursive interpreter at the point C<die> is called. From within this interpreter, you can examine a @@ -524,19 +543,23 @@ Behavior is controlled in part through the following package-globals: =over 4 +=item C<$PACKAGE> -- evaluation package + +=item C<$PRINTER> -- result printer (default: print_dumper) + =item C<$PS1> -- the default prompt =item C<$STOPDIE> -- true to enter the inspector on C<die()> =item C<$STOPWARN> -- true to enter the inspector on C<warn()> -=item C<%REPL> -- maps shortcut names to handlers - -=item C<$PACKAGE> -- evaluation package +=item C<$STRICT> -- whether 'use strict' is applied to input =item C<$WANTARRAY> -- evaluation context -=item C<$PRINTER> -- result printer (default: print_dumper) +=item C<%REPL> -- maps shortcut names to handlers + +=item C<%REPL_DOC> -- maps shortcut names to documentation =back @@ -559,6 +582,7 @@ BEGIN { wantarray => \&Sepia::repl_wantarray, format => \&Sepia::repl_format, strict => \&Sepia::repl_strict, + quit => \&Sepia::repl_quit, ); %REPL_DOC = ( cd => @@ -572,6 +596,8 @@ BEGIN { 'methods X List methods for reference or package X', package => 'package PACKAGE Set evaluation package to PACKAGE', + quit => + 'quit Quit the REPL', strict => 'strict [0|1] Turn \'use strict\' mode on or off', wantarray => @@ -685,10 +711,28 @@ sub who } grep !/::$/ && !/^(?:_<|[^\w])/, keys %{$pack.'::'}; } + +sub columnate +{ + my $len = 0; + my $width = $ENV{COLUMNS} || 80; + for (@_) { + $len = length if $len < length; + } + my $nc = int($width / ($len+1)) || 1; + my $nr = @_ / $nc + (@_ % $nc ? 1 : 0); + my $fmt = ('%-'.($len+1).'s') x $nc . "\n"; + my @incs = map { $_ * $nr } 0..$nc-1; + my $str = ''; + for my $r (0..$nr) { + $str .= sprintf $fmt, map { $_ || '' } @_[map { $r + $_ } @incs]; + } + $str +} + sub repl_who { - my @who = who @_; - Sepia::printer(\@who); + print columnate who @_; 0; } @@ -740,6 +784,11 @@ sub repl_package 0; } +sub repl_quit +{ + 1; +} + sub debug_help { print <<EOS; @@ -838,7 +887,10 @@ sub repl } CORE::warn(@_); }; - + print <<EOS; +Sepia version $Sepia::VERSION. +Press ",h" for help, or "^D" or ",q" to exit. +EOS print prompt; my @sigs = qw(INT TERM PIPE ALRM); local @SIG{@sigs}; @@ -867,16 +919,23 @@ sub repl }; if ($buf =~ /^,(\S+)\s*(.*)/s) { ## Inspector shortcuts - if (exists $Sepia::RK{$1}) { + my $short = $1; + if (exists $Sepia::RK{$short}) { my $ret; my $arg = $2; chomp $arg; - ($ret, @res) = $Sepia::REPL{$Sepia::RK{$1}}->($arg, wantarray); + ($ret, @res) = $Sepia::REPL{$Sepia::RK{$short}}->($arg, wantarray); if ($ret) { return wantarray ? @res : $res[0]; } } else { - print "Unrecignized shortcut '$1'\n"; + if (grep /^$short/, keys %Sepia::REPL) { + print "Ambiguous shortcut '$short': ", + join(', ', sort grep /^$short/, keys %Sepia::REPL), + "\n"; + } else { + print "Unrecognized shortcut '$short'\n"; + } $buf = ''; print prompt; next repl; diff --git a/sepia.el b/sepia.el index 87634e9..33157e9 100644 --- a/sepia.el +++ b/sepia.el @@ -558,18 +558,22 @@ to this location." (interactive "P") (multiple-value-bind (type obj) (sepia-ident-at-point) (sepia-set-found nil type) - (let ((ret - (cond - ((member type '(?% ?$ ?@)) (xref-var-defs obj)) - ((or (equal type ?&) - (let (case-fold-search) - (string-match "^[^A-Z]" obj))) - (list (sepia-location obj))) - (t `((,(sepia-w3m-perldoc-this obj) 1 nil nil)))))) - (if display-p - (sepia-show-locations ret) - (sepia-set-found ret type) - (sepia-next))))) + (let* (module-doc-p + (ret + (cond + ((member type '(?% ?$ ?@)) (xref-var-defs obj)) + ((or (equal type ?&) + (let (case-fold-search) + (string-match "^[^A-Z]" obj))) + (list (sepia-location obj))) + (t + (setq module-doc-p t) + `((,(sepia-w3m-perldoc-this obj) 1 nil nil)))))) + (unless module-doc-p + (if display-p + (sepia-show-locations ret) + (sepia-set-found ret type) + (sepia-next)))))) (defun sepia-rebuild () "Rebuild the Xref database." @@ -819,12 +823,17 @@ The function is intended to be bound to \\M-TAB, like (1 ;; (delete-ident-at-point) (delete-region (- (point) len) (point)) (insert (if type (string type) "") (car completions)) + ;; Hide stale completions buffer (stolen from lisp.el). + (let ((win (get-buffer-window "*Completions*" 0))) + (if win (with-selected-window win (bury-buffer)))) t) (t (let ((old name) (new (try-completion "" completions))) (if (string= new old) (with-output-to-temp-buffer "*Completions*" (display-completion-list completions)) + (let ((win (get-buffer-window "*Completions*" 0))) + (if win (with-selected-window win (bury-buffer)))) (delete-region (- (point) len) (point)) (insert (if type (string type) "") new))) t))) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/sepia.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits