all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo Liu <sdl.web@gmail.com>
To: 18620@debbugs.gnu.org
Subject: bug#18620: 25.0.50; cfengine3-make-syntax-cache
Date: Tue, 07 Oct 2014 11:22:46 +0800	[thread overview]
Message-ID: <m3bnpoimwp.fsf@gmail.com> (raw)
In-Reply-To: <m21tqk7gr6.fsf@lifelogs.com> (Ted Zlatanov's message of "Mon, 06 Oct 2014 22:31:09 -0400")

On 2014-10-06 22:31 -0400, Ted Zlatanov wrote:
> Thanks for catching this, I had not noticed it sooner. Please see the
> patch below; does it work for you? If so I will commit and close the
> bug.

cfengine3-make-syntax-cache may still return a regexp and it won't fall
back on cfengine3-fallback-syntax when `cf-promises -s json' fails; how
about something along these lines?

=== modified file 'lisp/progmodes/cfengine.el'
--- lisp/progmodes/cfengine.el	2014-01-30 07:42:57 +0000
+++ lisp/progmodes/cfengine.el	2014-10-07 03:10:44 +0000
@@ -1231,29 +1231,31 @@
   (setq cfengine-mode-syntax-cache nil))
 
 (defun cfengine3-make-syntax-cache ()
-  "Build the CFEngine 3 syntax cache.
+  "Build the CFEngine 3 syntax cache and return it.
 Calls `cfengine-cf-promises' with \"-s json\""
-  (let ((syntax (cddr (assoc cfengine-cf-promises cfengine-mode-syntax-cache))))
-    (if cfengine-cf-promises
-        (or syntax
-            (with-demoted-errors
-                (with-temp-buffer
-                  (call-process-shell-command cfengine-cf-promises
-                                              nil   ; no input
-                                              t     ; current buffer
-                                              nil   ; no redisplay
-                                              "-s" "json")
-                  (goto-char (point-min))
-                  (setq syntax (json-read))
-                  (setq cfengine-mode-syntax-cache
-                        (cons (cons cfengine-cf-promises syntax)
-                              cfengine-mode-syntax-cache))
-                  (setq cfengine-mode-syntax-functions-regex
-                        (regexp-opt (mapcar (lambda (def)
-                                              (format "%s" (car def)))
-                                            (cdr (assq 'functions syntax)))
-                                    'symbols))))))
-    cfengine3-fallback-syntax))
+  (or (cddr (assoc cfengine-cf-promises cfengine-mode-syntax-cache))
+      (when cfengine-cf-promises
+        (with-demoted-errors "cfengine3-make-syntax-cache: %S"
+          (with-temp-buffer
+            (process-file cfengine-cf-promises
+                          nil           ; no input
+                          t             ; current buffer
+                          nil           ; no redisplay
+                          "-s" "json")
+            (goto-char (point-min))
+            (let ((syntax (json-read)))
+              (when (and (listp syntax)
+                         (assq 'functions syntax))
+                (setq cfengine-mode-syntax-cache
+                      (cons (cons cfengine-cf-promises syntax)
+                            cfengine-mode-syntax-cache))
+                (setq cfengine-mode-syntax-functions-regex
+                      (regexp-opt (mapcar (lambda (def)
+                                            (format "%s" (car def)))
+                                          (cdr (assq 'functions syntax)))
+                                  'symbols))
+                syntax)))))
+      cfengine3-fallback-syntax))
 
 (defun cfengine3-documentation-function ()
   "Document CFengine 3 functions around point.
@@ -1265,7 +1267,6 @@
 
 (defun cfengine3-completion-function ()
   "Return completions for function name around or before point."
-  (cfengine3-make-syntax-cache)
   (let* ((bounds (save-excursion
                    (let ((p (point)))
                      (skip-syntax-backward "w_" (point-at-bol))

>
> LL> 3. cf-promises doesn't have -s option in Centos 6.5 (cfengine 3.3)
>
> I think that's all right, we will default to the fallback syntax. The
> `-s' option was added after 3.3 but IMO the fallback syntax is good
> enough for all 3.x work.
>
> (Unfortunately the Red Hat ecosystem has no CFEngine package maintainers
> so to get the latest you have to install from the official CFEngine
> package repo as directed by their website.)

Agreed. Sad to see this and the cf community seems not very active. BTW,
do you know if CF is still part of GNU? I only see version 2 on GNU¹.

>
> Thanks
> Ted

Thanks,
Leo

Footnotes: 
¹  http://www.gnu.org/software/cfengine/





  reply	other threads:[~2014-10-07  3:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03 10:28 bug#18620: 25.0.50; cfengine3-make-syntax-cache Leo Liu
2014-10-07  2:31 ` Ted Zlatanov
2014-10-07  3:22   ` Leo Liu [this message]
2014-10-08 13:51     ` Ted Zlatanov
2014-10-08 16:03       ` Leo Liu
2014-10-09 13:20         ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3bnpoimwp.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=18620@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.