This is an automated email from the git hooks/post-receive script. bengen pushed a commit to branch master in repository sepia.
commit b1e940d17ec55fb3ab8a2051c8bfefdd59a75d5e Author: Hilko Bengen <ben...@debian.org> Date: Sat May 26 16:22:31 2007 +0200 Imported Debian patch 0.73-2 --- debian/changelog | 7 +++++++ lib/Sepia.pm | 61 ++++++++++++++++++++++++++++++++------------------------ sepia.el | 20 ++++++++++++++++--- 3 files changed, 59 insertions(+), 29 deletions(-) diff --git a/debian/changelog b/debian/changelog index 362e0f4..f89923e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +sepia (0.73-2) unstable; urgency=low + + * Upstream fix for autocompletion (in general and for scalars in + particular) + + -- Hilko Bengen <ben...@debian.org> Sat, 26 May 2007 16:22:31 +0200 + sepia (0.73-1) unstable; urgency=low * New upstream release diff --git a/lib/Sepia.pm b/lib/Sepia.pm index 8ce4006..9c89d3d 100644 --- a/lib/Sepia.pm +++ b/lib/Sepia.pm @@ -92,7 +92,6 @@ sub _apropos_re($) sub _completions1 { no strict; - print STDERR "_completions1(@_)\n"; my $stash = shift; my $re = shift || ''; $re = qr/$re/; @@ -119,45 +118,55 @@ sub completions { no strict; my ($str, $type, $infunc) = @_; - my @ret = map { s/^:://; $_ } ($type ? do { - (grep { defined *{$_}{$type} } _completions $str), - (defined $infunc && defined *{$infunc}{CODE}) ? do { + my @ret; + + if (!$type) { + @ret = grep { + defined *{$_}{CODE} || defined *{$_}{IO} + || (/::$/ && defined *{$_}{HASH}); + } _completions $str; + } else { + @ret = grep { + $type eq 'SCALAR' ? defined ${$_} : defined *{$_}{$type} + } _completions $str; + if (defined $infunc && defined *{$infunc}{CODE}) { my ($apre) = _apropos_re($str); my $st = $sigil{$type}; - grep { + push @ret, grep { (my $tmp = $_) =~ s/^\Q$st//; $tmp =~ /$apre/; } lexicals($infunc); - } : (); - } : do { - grep { - defined *{$_}{CODE} || defined *{$_}{IO} - || (/::$/ && defined *{$_}{HASH}); - } _completions $str; - }); - if (!@ret && $str !~ /[^\w\d]/) { + } + } + ## Complete "simple" sequences as abbreviations, e.g.: ## wtci -> Want_To_Complete_It, NOT ## -> WaTCh_trIpe + if (!@ret && $str !~ /[^\w\d]/) { my $broad = join '.*', map "\\b$_", split '', $str; - @ret = map { s/^:://; $_ } ($type ? do { - (grep { defined *{$_}{$type} } _completions1 '::', qr/$broad/), - (defined $infunc && defined *{$infunc}{CODE}) ? do { - my ($apre) = _apropos_re($str); + if ($type) { + @ret = grep { + defined *{$_}{CODE} || defined *{$_}{IO} + || (/::$/ && defined *{$_}{HASH}); + } _completions1 '::', qr/$broad/; + } else { + @ret = grep { + $type eq 'SCALAR' ? defined ${$_} : defined *{$_}{$type} + } _completions1 '::', qr/$broad/; + } + if (defined $infunc && defined *{$infunc}{CODE}) { my $st = $sigil{$type}; grep { (my $tmp = $_) =~ s/^\Q$st//; - $tmp =~ /$apre/; + $tmp =~ /$broad/; } lexicals($infunc); - } : (); - } : do { - grep { - defined *{$_}{CODE} || defined *{$_}{IO} - || (/::$/ && defined *{$_}{HASH}); - } _completions1 '::', qr/$broad/; - }) } - @ret; + } + ## XXX: Control characters, $", and $1, etc. confuse Emacs, so + ## remove them. + grep { + !looks_like_number $_ && !/^[^\w\d_]$/ && !/^_</ && !/^[[:cntrl:]]/ + } map { s/^:://; $_ } @ret; } =head2 C<@locs = location(@names)> diff --git a/sepia.el b/sepia.el index 33157e9..1276d86 100644 --- a/sepia.el +++ b/sepia.el @@ -800,6 +800,21 @@ annoying in larger programs. The function is intended to be bound to \\M-TAB, like ``lisp-complete-symbol''." (interactive) + (let ((win (get-buffer-window "*Completions*" 0))) + (when (and (eq last-command this-command) + win (window-live-p win) (window-buffer win) + (buffer-name (window-buffer win))) + ;; If this command was repeated, and + ;; there's a fresh completion window with a live buffer, + ;; and this command is repeated, scroll that window. + (with-current-buffer (window-buffer win) + (if (pos-visible-in-window-p (point-max) win) + (set-window-start win (point-min)) + (save-selected-window + (select-window win) + (scroll-up)))) + (return t)) + (multiple-value-bind (type name) (sepia-ident-at-point) (let ((len (+ (if type 1 0) (length name))) (completions (xref-completions @@ -824,8 +839,7 @@ The function is intended to be bound to \\M-TAB, like (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)))) + (if win (with-selected-window win (bury-buffer))) t) (t (let ((old name) (new (try-completion "" completions))) @@ -837,7 +851,7 @@ The function is intended to be bound to \\M-TAB, like (delete-region (- (point) len) (point)) (insert (if type (string type) "") new))) t))) - )) + ))) (defun sepia-indent-or-complete () "Indent the current line or complete the symbol around point. -- 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