[slime-devel] SLIME buglet: The value NIL is not of type PACKAGE.
Michael Weber
michaelw+slime at foldr.org
Wed Jan 21 01:39:22 UTC 2004
* Helmut Eller <e9626484 at stud3.tuwien.ac.at> [2004-01-21T01:04+0100]:
> Michael Weber <michaelw+slime at foldr.org> writes:
> > M-x slime ; start SLIME
> > C-x C-f foo.lisp ; get a buffer in lisp-mode
> > C-c : ; Slime Eval:
> > <Tab> ; slime-completie-symbol
>
> Should be fixed in the CVS version. Thanks for the report.
Well, not really. The bug moved, though.
C-c :
<left> ; move cursor somewhere over "Eval:" (of the "Slime Eval:" prompt)
; one char to the left is enough here.
<tab>
; *bang*
The reason is two-fold:
1. My emacs allows me to move point over the prompt (GNU/Emacs
21.3.50.1), and access it as regular input.
2. SWANK:COMPLETIONS gets all upset about a package ("Eval") it cannot
find.
re 1: Attached is a patch (slime-minibuffer.patch), which narrows the
minibuffer, so that the prompt is not accessible. The macro
WITHOUT-MINIBUFFER-PROMPT should probably be called whenever something
wants to read from the minibuffer (at least if tab completion is
enabled).
BTW: XEmacs seems to do the Right Thing by default and does not allow
the cursor to be moved over the prompt, and it does not have
MINIBUFFER-PROMPT-END, so I conditionalized on it.
re 2: Attached is another patch (swank-completions.patch), making
SWANK:COMPLETIONS handle non-existent packages without bombing.
While I was there I removed the unneeded LET*.
I also tried to run SLIME-RUN-TESTS. Why it said "FAILED: Completion
set is as expected.", I don't know. Works for me(tm).
Here is the relevant output:
* complete-symbol
** input: (cl:compile ((cl:compile cl:compile-file cl:compile-file-pathname cl:compiled-function cl:compiled-function-p cl:compiler-macro cl:compiler-macro-function) cl:compile))
FAILED: Completion set is as expected.
** input: (cl:foobar (nil ))
Completion set is as expected.
** input: (cl::compile-file ((cl::compile-file cl::compile-file-pathname) cl::compile-file))
FAILED: Completion set is as expected.
** input: (cl:m-v-l ((cl:multiple-value-list cl:multiple-values-limit) cl:multiple-value-li))
FAILED: Completion set is as expected.
Cheers,
Michael
--
/~\ ASCII ribbon | "Using other people's Makefiles is like
\ / campaign | wearing other people's underwear."
X against | -- Volker Stolz
/ \ HTML mail |
-------------- next part --------------
Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.194
diff -u -u -r1.194 slime.el
--- slime.el 20 Jan 2004 23:53:13 -0000 1.194
+++ slime.el 21 Jan 2004 00:39:22 -0000
@@ -3187,6 +3187,21 @@
(with-output-to-temp-buffer "*Completions*"
(display-completion-list completion-set))
(slime-complete-delay-restoration)))))))
+
+
+(defmacro without-minibuffer-prompt (&rest body)
+ "Narrow minibuffer excluding the prompt, then execute BODY."
+ (if (fboundp 'minibuffer-prompt-end)
+ `(save-restriction
+ (narrow-to-region (minibuffer-prompt-end) (point-max))
+ , at body)
+ `(progn , at body)))
+
+(defun slime-minibuffer-complete-symbol ()
+ "Run SLIME-COMPLETE-SYMBOL within minibuffer."
+ (interactive)
+ (without-minibuffer-prompt
+ (slime-complete-symbol)))
(defun slime-minibuffer-respecting-message (format &rest format-args)
"Display TEXT as a message, without hiding any minibuffer contents."
@@ -3202,8 +3217,8 @@
(set-keymap-parent slime-read-expression-map minibuffer-local-map)
-(define-key slime-read-expression-map "\t" 'slime-complete-symbol)
-(define-key slime-read-expression-map "\M-\t" 'slime-complete-symbol)
+(define-key slime-read-expression-map "\t" 'slime-minibuffer-complete-symbol)
+(define-key slime-read-expression-map "\M-\t" 'slime-minibuffer-complete-symbol)
(defvar slime-read-expression-history '()
"History list of expressions read from the minibuffer.")
-------------- next part --------------
--- swank.lisp.~1.105.~ 2004-01-21 00:47:56.000000000 +0100
+++ swank.lisp 2004-01-21 02:13:53.000000000 +0100
@@ -897,27 +897,30 @@
(if n
(find-package (case-convert n))
*buffer-package* ))))
+ (unless package
+ (return-from completions (list nil "")))
+
(flet ((symbol-matches-p (symbol)
(and (compound-prefix-match name (symbol-name symbol))
(or (or internal-p (null package-name))
(symbol-external-p symbol package)))))
- (when package
(do-symbols (symbol package)
(when (symbol-matches-p symbol)
- (push symbol completions)))))
+ (push symbol completions))))
+
(let ((*print-case* (if (find-if #'upper-case-p string)
:upcase :downcase))
- (*package* package))
- (let* ((completion-set
- (mapcar (lambda (s)
- (cond (internal-p (format nil "~A::~A" package-name s))
- (package-name (format nil "~A:~A" package-name s))
- (t (format nil "~A" s))))
- ;; DO-SYMBOLS can consider the same symbol more than
- ;; once, so remove duplicates.
- (remove-duplicates (sort completions #'string<
- :key #'symbol-name)))))
- (list completion-set (longest-completion completion-set)))))))
+ (*package* package)
+ (completion-set
+ (mapcar (lambda (s)
+ (cond (internal-p (format nil "~A::~A" package-name s))
+ (package-name (format nil "~A:~A" package-name s))
+ (t (format nil "~A" s))))
+ ;; DO-SYMBOLS can consider the same symbol more than
+ ;; once, so remove duplicates.
+ (remove-duplicates (sort completions #'string<
+ :key #'symbol-name)))))
+ (list completion-set (longest-completion completion-set))))))
(defun parse-symbol-designator (string)
"Parse STRING as a symbol designator.
More information about the slime-devel
mailing list