[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] trunk r115545: Cleanup cfengine3-mode so complete-symb
From: |
Ted Zlatanov |
Subject: |
Re: [Emacs-diffs] trunk r115545: Cleanup cfengine3-mode so complete-symbol works again. |
Date: |
Tue, 17 Dec 2013 05:33:23 -0500 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) |
On Mon, 16 Dec 2013 21:25:14 -0500 Stefan Monnier <address@hidden> wrote:
>> (defun cfengine3-completion-function ()
>> "Return completions for function name around or before point."
>> (cfengine3-make-syntax-cache)
>> - (let* ((bounds (cfengine3--current-word t))
>> + (let* ((bounds (save-excursion
>> + (let ((p (point)))
>> + (skip-syntax-backward "w_" (point-at-bol))
>> + (list (point) p))))
>> (syntax (cfengine3-make-syntax-cache))
>> (flist (assq 'functions syntax)))
SM> BTW, it would be better for cfengine3-completion-function not to call
SM> cfengine3-make-syntax-cache which can cause all kinds of processing
SM> to happen. Instead it should return a completion-table-dynamic or
SM> something like that, such that cfengine3-make-syntax-cache is only
SM> called if/when the completion-table is actually used.
I'm not sure I agree. `cfengine3-make-syntax-cache' is only expensive
the first time, unless there are problems running the
`cfengine-cf-promises' binary (should I attempt just once? but then it's
not idempotent...). After that, it's just a couple of built-in
functions to retrieve the cache from memory, if+cddr+assoc.
Or is the name a problem because it implies the cache is remade every time?
Ted