[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix 86dbead 107/192: add a helper function to detect
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix 86dbead 107/192: add a helper function to detect kiwix profile directory accessible. |
Date: |
Sat, 19 Dec 2020 00:41:43 -0500 (EST) |
branch: externals/kiwix
commit 86dbead6c0017beefd92a0b64a0bb5f5d12c5b16
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
add a helper function to detect kiwix profile directory accessible.
Fix kiwix profile directory not accessible issue.
---
kiwix.el | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index 2d3e544..6335208 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -60,20 +60,29 @@
:type 'string
:group 'kiwix)
+;;;###autoload
+(defun kiwix-dir-detect ()
+ "Detect Kiwix profile directory exist."
+ (let ((kiwix-dir (concat (getenv "HOME") "/.www.kiwix.org/kiwix")))
+ (unless (not (file-accessible-directory-p kiwix-dir))
+ (warn "ERROR: Kiwix profile directory \".www.kiwix.org/kiwix\" is not
accessible."))))
+
(defcustom kiwix-default-data-profile-name
- (car (directory-files
- (concat
- (getenv "HOME") "/.www.kiwix.org/kiwix")
- nil
- ".*\\.default"
- ))
+ (when (kiwix-dir-detect)
+ (car (directory-files
+ (concat
+ (getenv "HOME") "/.www.kiwix.org/kiwix")
+ nil
+ ".*\\.default"
+ )))
"Specify the default Kiwix data profile path."
:type 'string
:group 'kiwix)
(defcustom kiwix-default-data-path
- (concat
- (getenv "HOME") "/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name)
+ (when (kiwix-dir-detect)
+ (concat
+ (getenv "HOME") "/.www.kiwix.org/kiwix/" kiwix-default-data-profile-name))
"Specify the default Kiwix data path."
:type 'string
:group 'kiwix)
@@ -90,10 +99,11 @@
:group 'kiwix)
(defvar kiwix-libraries
- (mapcar #'(lambda (var)
- (replace-regexp-in-string "\.zim" "" var))
- (directory-files
- (concat kiwix-default-data-path "/data/content/") nil ".*\.zim"))
+ (when (kiwix-dir-detect)
+ (mapcar #'(lambda (var)
+ (replace-regexp-in-string "\.zim" "" var))
+ (directory-files
+ (concat kiwix-default-data-path "/data/content/") nil ".*\.zim")))
"A list of Kiwix libraries.")
;; - examples:
- [elpa] externals/kiwix 121d98a 093/192: fix void function org-link-set-parameters., (continued)
- [elpa] externals/kiwix 121d98a 093/192: fix void function org-link-set-parameters., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 686bac6 068/192: fix query validating regexp, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 47d968a 069/192: update add org-mode link functions to Org-mode 9.0, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 3dab002 077/192: only capitalize the first word of string., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 6fb8354 078/192: Merge branch 'release/v0.5.2', Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 43e0547 083/192: Merge branch 'release/v0.6.0', Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 6a7fc40 097/192: Merge branch 'hotfix/void-function-org-link-set-parameters-2', Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 2ab63c9 098/192: Merge tag 'void-function-org-link-set-parameters-2' into develop, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 6e43812 102/192: fix void functions by adding autoload cookies., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 5aa6c3a 105/192: `string-empty-p` depends on (emacs "24.4"), Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 86dbead 107/192: add a helper function to detect kiwix profile directory accessible.,
Stefan Monnier <=
- [elpa] externals/kiwix 44a44cb 110/192: autoload org related functions, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix f7535e0 112/192: format code, remove dangling parentheses, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 183b133 114/192: update usage comments, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 658038e 113/192: fix kiwix libraries data structure duplicate when re-evaluate., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 30559cc 116/192: add option for specifying default library, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix efcfd99 117/192: fix default libraries directory, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 39b96cb 119/192: let kiwix-launch-server support start Docker container, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 4b093e0 128/192: add autoload cookies for some necessary functions, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix c662f3d 129/192: roll the version to release, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 5fbf5bc 141/192: use symbol under point or region text as initial input for Ivy, Stefan Monnier, 2020/12/19