From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Error in post-command-hook (completion-in-region--postch): (wrong-type-argument stringp nil) Date: Fri, 24 Aug 2012 10:25:37 +0200 Message-ID: <87393cd7cu.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1345796754 20106 80.91.229.3 (24 Aug 2012 08:25:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Aug 2012 08:25:54 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 24 10:25:55 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T4pDF-0002x7-AV for ged-emacs-devel@m.gmane.org; Fri, 24 Aug 2012 10:25:53 +0200 Original-Received: from localhost ([::1]:54797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4pDD-0003xK-B2 for ged-emacs-devel@m.gmane.org; Fri, 24 Aug 2012 04:25:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4pD6-0003xD-HP for emacs-devel@gnu.org; Fri, 24 Aug 2012 04:25:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4pD1-0002YM-Vi for emacs-devel@gnu.org; Fri, 24 Aug 2012 04:25:44 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:46452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4pD1-0002YE-P4 for emacs-devel@gnu.org; Fri, 24 Aug 2012 04:25:39 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id D06EDD24CF for ; Fri, 24 Aug 2012 10:25:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at uni-koblenz.de Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pkStvrAv443r for ; Fri, 24 Aug 2012 10:25:38 +0200 (CEST) X-CHKRCPT: Envelopesender noch tsdh@gnu.org Original-Received: from thinkpad.tsdh.de (tsdh.uni-koblenz.de [141.26.67.142]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 29DD8D24CE for ; Fri, 24 Aug 2012 10:25:38 +0200 (CEST) Mail-Followup-To: emacs-devel@gnu.org User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 141.26.64.15 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152794 Archived-At: 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