From 827ca90020b25ed812a2aa0d992c0b184f63479f Mon Sep 17 00:00:00 2001 From: Sean O'Rourke Date: Mon, 30 Jan 2012 14:29:39 -0700 Subject: [PATCH] retrieve shortcut list from inferior process. --- ChangeLog | 2 ++ lib/Sepia.pm | 2 +- sepia.el | 18 +++++------------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d8a00d..d9f079d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * sepia.el (sepia-complete-symbol): Finally fix method completion to not delete invocant. + (sepia-shortcuts): retrieve shortcuts dynamically. + (sepia-complete-symbol): use it. 2011-11-16 Sean O'Rourke diff --git a/lib/Sepia.pm b/lib/Sepia.pm index 09eaa15..97255a1 100644 --- a/lib/Sepia.pm +++ b/lib/Sepia.pm @@ -33,7 +33,7 @@ interface. =cut -$VERSION = '0.992'; +$VERSION = '0.992_01'; BEGIN { if ($] >= 5.012) { eval 'no warnings "deprecated"'; # undo some of the 5.12 suck. diff --git a/sepia.el b/sepia.el index 717710f..09980f0 100644 --- a/sepia.el +++ b/sepia.el @@ -979,17 +979,9 @@ REPL shortcuts." (interactive) (error "TODO")) -(defvar sepia-shortcuts - '( -"break" "eval" "lsbreak" "quit" "size" "wantarray" -"cd" "format" "methods" "reload" "strict" "who" -"debug" "freload" "package" "restart" "test" -"define" "help" "pdl" "save" "time" -"delete" "load" "pwd" "shell" "undef" -) - "List of currently-defined REPL shortcuts. - -XXX: this needs to be updated whenever you add one on the Perl side.") +(defun sepia-shortcuts () + "Return a list of current Sepia shortcuts." + (sepia-eval "sort keys %Sepia::REPL" 'list-context)) (defun sepia-complete-symbol () "Try to complete the word at point. @@ -1025,10 +1017,10 @@ The function is intended to be bound to \\M-TAB, like (when (eq major-mode 'sepia-repl-mode) (save-excursion (comint-bol) - (when (looking-at ",\\([a-z]+\\)$") + (when (looking-at ",\\([a-z]*\\)$") (let ((str (match-string 1))) (setq len (length str) - completions (all-completions str sepia-shortcuts)))))) + completions (all-completions str (sepia-shortcuts))))))) ;; 1 - Look for a method call: (unless completions (setq meth (sepia-simple-method-before-point)) -- 2.11.4.GIT