=== modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-06 17:47:56 +0000 +++ lisp/ChangeLog 2014-10-07 02:18:14 +0000 @@ -1,3 +1,9 @@ +2014-10-07 Teodor Zlatanov + + * progmodes/cfengine.el (cfengine3-make-syntax-cache): Use + `process-file' instead of `call-process-shell-command'. Check if + the returned CFEngine syntax is reasonably valid (bug#18620). + 2014-10-06 Stefan Monnier * term/w32-win.el: Move all code from 32-common-fns.el here. === modified file 'lisp/progmodes/cfengine.el' --- lisp/progmodes/cfengine.el 2014-01-30 07:42:57 +0000 +++ lisp/progmodes/cfengine.el 2014-10-07 02:15:16 +0000 @@ -1238,21 +1238,25 @@ (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") + (process-file 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)))))) + + ;; if we got a valid syntax... + (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))))))) cfengine3-fallback-syntax)) (defun cfengine3-documentation-function ()