branch: externals/ergoemacs-mode
commit d5d2ba423a46b67b952c117410a7c4f1c45c6606
Author: Fidler <matthew.fid...@gmail.com>
Commit: Fidler <matthew.fid...@gmail.com>

    Create extras directory.  See Issue #452
---
 ergoemacs-map-properties.el |  2 ++
 ergoemacs-mode.el           | 12 ++++++++----
 ergoemacs-translate.el      |  5 ++++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ergoemacs-map-properties.el b/ergoemacs-map-properties.el
index 248a033..93bc19e 100644
--- a/ergoemacs-map-properties.el
+++ b/ergoemacs-map-properties.el
@@ -262,6 +262,8 @@ file."
          (extras (expand-file-name "ergoemacs-extras" user-emacs-directory))
          (file2 (expand-file-name (format "ergoemacs-%s-%s.el%s" (or other 
"global") ergoemacs--system (or (and ergoemacs--gzip ".gz") ""))
                                   extras)))
+    (if (not (file-exists-p extras))
+        (make-directory extras t))
     (or
      (and (file-readable-p file2) file2)
      (and (file-readable-p file) file)
diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index 89c39ed..5b18155 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -488,10 +488,14 @@ NO-MESSAGE doesn't tell anything about clearing the 
cache."
   (interactive)
   (setq ergoemacs-map--cache-save :remove)
   (ergoemacs-map--cache-save)
-  (dolist (ext '("svg" "png"))
-    (dolist (file (file-expand-wildcards (expand-file-name (concat "*." ext) 
(expand-file-name "bindings" (expand-file-name "ergoemacs-extras" 
user-emacs-directory)))))
-      (delete-file file)
-      (message "Remove %s, since keys may have changed." file)))
+  
+  (let ((extras (expand-file-name "ergoemacs-extras" user-emacs-directory)))
+    (if (not (file-exists-p extras))
+        (make-directory extras t))
+    (dolist (ext '("svg" "png"))
+      (dolist (file (file-expand-wildcards (expand-file-name (concat "*." ext) 
(expand-file-name "bindings" extras))))
+       (delete-file file)
+       (message "Remove %s, since keys may have changed." file))))
 
   (unless no-message
     (message "Clear cache for next startup.")))
diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el
index 7d66cd8..a3b9f88 100644
--- a/ergoemacs-translate.el
+++ b/ergoemacs-translate.el
@@ -1244,10 +1244,13 @@ If :type is :quail use the 180 length string that
   "Create SVG for LAYOUT. Optionally REREAD kbd.svg before creating svg."
   (let* ((lay (or layout ergoemacs-keyboard-layout))
          (layout (symbol-value (ergoemacs :layout  lay)))
-         (file-dir (expand-file-name "layouts" (expand-file-name 
"ergoemacs-extras" user-emacs-directory)))
+        (extras (expand-file-name "ergoemacs-extras" user-emacs-directory))
+         (file-dir (expand-file-name "layouts" extras))
          (file-name (expand-file-name (concat lay ".svg") file-dir))
          (reread reread)
          pt)
+    (if (not (file-exists-p extras))
+        (make-directory extras t))
     (if (and (file-exists-p file-name) (not reread)) file-name
       (when (eq reread :svg)
         (setq reread nil))

Reply via email to