[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why post-command-hook so difficult to debug?
From: |
Tassilo Horn |
Subject: |
Re: Why post-command-hook so difficult to debug? |
Date: |
Fri, 24 Aug 2012 08:11:13 +0200 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux) |
Leo <address@hidden> writes:
> On 2012-08-24 02:37 +0800, Tassilo Horn wrote:
>> Anyway, could you please elaborate what was the 100 miles away function
>> in your case? Maybe it's similar here...
>
> Check the entries in completion-at-point-functions.
,----
| completion-at-point-functions is a variable defined in `minibuffer.el'.
| Its value is (nrepl-complete-at-point tags-completion-at-point-function)
`----
`nrepl-complete-at-point' is the completion at point function I've just
written. To my best understanding and debugging, it always returns
completely valid
(START END (COMPLETION-STRING-LIST))
triples or nil if there's no completion. The definition is
--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
(list (car bounds) (cdr bounds) completions)))))))
--8<---------------cut here---------------end--------------->8---
For example, I have (ide|) in my clojure buffer and try to complete (|
is point, here). The function returns
(1232 1235 ("identical?" "identity"))
and the common prefix is completed: (identi). Then, my function is
immediately ran again (why?) and my function returns
(1232 1238 ("identical?" "identity"))
1235 and 1238 are the current location of point in these examples.
I tried removing `tags-completion-at-point-function' from
`completion-at-point-functions' but the error persists. So it seems I'm
the culprit although I cannot spot the problem...
Bye,
Tassilo