* Re: [Emacs-diffs] trunk r115545: Cleanup cfengine3-mode so complete-symbol works again.
[not found] <E1VsaP2-0000uL-EZ@vcs.savannah.gnu.org>
@ 2013-12-17 2:25 ` Stefan Monnier
2013-12-17 10:33 ` Ted Zlatanov
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2013-12-17 2:25 UTC (permalink / raw)
To: Ted Zlatanov; +Cc: emacs-devel
> (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)))
BTW, it would be better for cfengine3-completion-function not to call
cfengine3-make-syntax-cache which can cause all kinds of processing
to happen. Instead it should return a completion-table-dynamic or
something like that, such that cfengine3-make-syntax-cache is only
called if/when the completion-table is actually used.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Emacs-diffs] trunk r115545: Cleanup cfengine3-mode so complete-symbol works again.
2013-12-17 2:25 ` [Emacs-diffs] trunk r115545: Cleanup cfengine3-mode so complete-symbol works again Stefan Monnier
@ 2013-12-17 10:33 ` Ted Zlatanov
0 siblings, 0 replies; 2+ messages in thread
From: Ted Zlatanov @ 2013-12-17 10:33 UTC (permalink / raw)
To: emacs-devel
On Mon, 16 Dec 2013 21:25:14 -0500 Stefan Monnier <monnier@IRO.UMontreal.CA> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-17 10:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <E1VsaP2-0000uL-EZ@vcs.savannah.gnu.org>
2013-12-17 2:25 ` [Emacs-diffs] trunk r115545: Cleanup cfengine3-mode so complete-symbol works again Stefan Monnier
2013-12-17 10:33 ` Ted Zlatanov
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.