all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Error in post-command-hook (completion-in-region--postch): (wrong-type-argument stringp nil)
@ 2012-08-24  8:25 Tassilo Horn
  2012-08-24  9:44 ` Thien-Thi Nguyen
  2012-08-24 15:46 ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Tassilo Horn @ 2012-08-24  8:25 UTC (permalink / raw
  To: emacs-devel

Hi all,

I'm writing a completion at point function for nREPL (which is about the
same as SLIME/Swank is for Common Lisp).  However, if my function is in
`completion-at-point-functions' I frequently get the error in the
subject, and as a annoying result `completion-in-region-mode' isn't
toggled off anymore.

I've read the docs about completion at point several times, and my
function looks good to me.  It'll always return

  (START END (LIST-OF-STRINGS))

with valid positions and the completions really being strings, or nil if
there's no possible completion.

--8<---------------cut here---------------start------------->8---
(defun nrepl-complete-at-point ()
  (interactive)
  (let ((sap (symbol-at-point)))
    (when (and sap (not (in-string-p)))
      (nrepl-send-string "(require 'complete.core)" "user" 'identity)
      (let ((form (format "(complete.core/completions \"%s\" *ns*)" sap))
	    (bounds (bounds-of-thing-at-point 'symbol)))
	(let ((completions (car (read-from-string
				 (plist-get (nrepl-send-string-sync form nrepl-buffer-ns)
					    :value)))))
	  (when completions
	    ;; TODO: Remove me again!
	    (assert (null (remove-if 'stringp completions)))
	    (list (car bounds) (cdr bounds) completions)))))))
--8<---------------cut here---------------end--------------->8---


Looking at the definition of `completion-in-region--postch' the only
place where the error might be triggered is in the

  (funcall completion-in-region-mode--predicate)

line.  The value of that is

--8<---------------cut here---------------start------------->8---
completion-in-region-mode--predicate is a variable defined in `minibuffer.el'.
Its value is #[0 "\301 \242\300=\207"
    [9284 nrepl-complete-at-point]
    2 "\n\n(fn)"]
--8<---------------cut here---------------end--------------->8---

There are no other function in `completion-at-point-functions'.

I'm happy for any pointers!

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-08-24 18:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-24  8:25 Error in post-command-hook (completion-in-region--postch): (wrong-type-argument stringp nil) Tassilo Horn
2012-08-24  9:44 ` Thien-Thi Nguyen
2012-08-24 11:23   ` Tassilo Horn
2012-08-24 13:07     ` Thien-Thi Nguyen
2012-08-24 16:23       ` Tassilo Horn
2012-08-24 16:58         ` Thien-Thi Nguyen
2012-08-24 18:12           ` Tassilo Horn
2012-08-24 15:46 ` Stefan Monnier
2012-08-24 18:20   ` Tassilo Horn

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.