emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118074: * lisp/progmodes/cfengine.el (cfengine3-mak


From: Leo Liu
Subject: [Emacs-diffs] trunk r118074: * lisp/progmodes/cfengine.el (cfengine3-make-syntax-cache): Always
Date: Wed, 08 Oct 2014 16:18:25 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118074
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18620
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Wed 2014-10-08 23:34:58 +0800
message:
  * lisp/progmodes/cfengine.el (cfengine3-make-syntax-cache): Always
  return a syntax.  Replace call-process-shell-command with
  process-file.  Ensure cfengine-mode-syntax-functions-regex is
  always set.  Ensure cache when cfengine-cf-promises fails.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/cfengine.el     
cfengine.el-20091113204419-o5vbwnq5f7feedwu-2944
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-10-07 03:20:33 +0000
+++ b/lisp/ChangeLog    2014-10-08 15:34:58 +0000
@@ -1,3 +1,11 @@
+2014-10-08  Leo Liu  <address@hidden>
+
+       * progmodes/cfengine.el (cfengine3-make-syntax-cache): Always
+       return a syntax.  Replace call-process-shell-command with
+       process-file.  Ensure cfengine-mode-syntax-functions-regex is
+       always set.  Ensure cache when cfengine-cf-promises fails.
+       (Bug#18620)
+
 2014-10-07  Glenn Morris  <address@hidden>
 
        * font-lock.el (font-lock-fontify-buffer): Fix interactive-only markup.

=== modified file 'lisp/progmodes/cfengine.el'
--- a/lisp/progmodes/cfengine.el        2014-01-30 07:42:57 +0000
+++ b/lisp/progmodes/cfengine.el        2014-10-08 15:34:58 +0000
@@ -1231,29 +1231,32 @@
   (setq cfengine-mode-syntax-cache nil))
 
 (defun cfengine3-make-syntax-cache ()
-  "Build the CFEngine 3 syntax cache.
-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))
+  "Build the CFEngine 3 syntax cache and return the syntax.
+Calls `cfengine-cf-promises' with \"-s json\"."
+  (or (cdr (assoc cfengine-cf-promises cfengine-mode-syntax-cache))
+      (let ((syntax (or (when cfengine-cf-promises
+                          (with-demoted-errors "cfengine3-make-syntax-cache: 
%S"
+                            (with-temp-buffer
+                              (or (zerop (process-file cfengine-cf-promises
+                                                       nil ; no input
+                                                       t   ; output
+                                                       nil ; no redisplay
+                                                       "-s" "json"))
+                                  (error "%s" (buffer-substring
+                                               (point-min)
+                                               (progn (goto-char (point-min))
+                                                      (line-end-position)))))
+                              (goto-char (point-min))
+                              (json-read))))
+                        cfengine3-fallback-syntax)))
+        (push (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)))
 
 (defun cfengine3-documentation-function ()
   "Document CFengine 3 functions around point.
@@ -1265,7 +1268,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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]