emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/phps-mode 55d59ee365 207/212: More work on cache suppor


From: Christian Johansson
Subject: [elpa] externals/phps-mode 55d59ee365 207/212: More work on cache support
Date: Wed, 26 Jan 2022 01:51:27 -0500 (EST)

branch: externals/phps-mode
commit 55d59ee365db248d5938d251dd4da297751959e6
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    More work on cache support
---
 TODO.md                   |  2 ++
 phps-mode-cache.el        |  2 +-
 phps-mode-lex-analyzer.el | 30 +++++++++++++++---------------
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/TODO.md b/TODO.md
index 58c2a82ef1..31100a4eea 100644
--- a/TODO.md
+++ b/TODO.md
@@ -20,3 +20,5 @@
 * Imenu-generation of conditionally defined functions and classes
 * Cache elisp data in file-system
 
+Save to cache after incremental edits as well
+
diff --git a/phps-mode-cache.el b/phps-mode-cache.el
index af05116715..783a027ae5 100644
--- a/phps-mode-cache.el
+++ b/phps-mode-cache.el
@@ -23,7 +23,7 @@
     (let ((filename
            (expand-file-name
             (replace-regexp-in-string
-             "\\(/\\|@\\|:\\)" "_"
+             "\\(/\\|@\\|:\\|\\.\\|-\\)" "_"
              key)
             directory-filename)))
       filename)))
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 9d01c1bffc..d6b884cb11 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -682,7 +682,7 @@
                              incremental-nest-location-stack
                              head-tokens
                              force-synchronous
-                             buffer-file-name)
+                             (if (buffer-modified-p) nil buffer-file-name))
 
                             (phps-mode-debug-message
                              (message "Incremental tokens: %s" 
incremental-tokens)))
@@ -1069,12 +1069,15 @@
   ;; to enable nice presentation
   (require 'phps-mode-macros)
 
-  (let ((loaded-from-cache))
-    (when (and
-           (not end)
-           filename)
-      (let ((cache-key
-             (format "lex-%s" filename)))
+  (let ((loaded-from-cache)
+        (cache-key))
+
+    ;; Load cache if possible
+    (when filename
+      (setq
+       cache-key
+       (format "lex-%s" filename))
+      (unless end
         (when
             (phps-mode-cache-test-p
              cache-key
@@ -1199,14 +1202,11 @@
                imenu-index
                bookkeeping-index)))
 
-          (when (and
-                 (not end)
-                 filename)
-            (let ((cache-key
-                   (format "lex-%s" filename)))
-              (phps-mode-cache-save
-               data
-               cache-key)))
+          ;; Save cache if possible
+          (when cache-key
+            (phps-mode-cache-save
+             data
+             cache-key))
 
           data)))))
 



reply via email to

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