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

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

[nongnu] elpa/cider 1c1ef926cd: `lein.sh`: honor `XDG_CACHE_HOME`


From: ELPA Syncer
Subject: [nongnu] elpa/cider 1c1ef926cd: `lein.sh`: honor `XDG_CACHE_HOME`
Date: Mon, 6 Nov 2023 03:59:19 -0500 (EST)

branch: elpa/cider
commit 1c1ef926cda1533ab211ce8cab3ca70b019d5a36
Author: vemv <vemv@users.noreply.github.com>
Commit: vemv <vemv@users.noreply.github.com>

    `lein.sh`: honor `XDG_CACHE_HOME`
    
    Closes https://github.com/clojure-emacs/cider/issues/3572
---
 CHANGELOG.md |  1 +
 lein.sh      | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff9913af84..8bea8400d1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@
 - CIDER [Inspector](https://docs.cider.mx/cider/debugging/inspector.html): 
display Java class/method/field info when available.
   - This info is available when 
[enrich-classpath](https://docs.cider.mx/cider/config/basic_config.html#use-enrich-classpath)
 is active.
 - `cider-popup-buffer-display`: honor `special-display-buffer-names` if 
customized for a given CIDER buffer name (e.g. `*cider-inspect*`), avoiding the 
double-rendering of the given buffer.
+- [#3572](https://github.com/clojure-emacs/cider/issues/3572): `lein.sh`: 
honor `XDG_CACHE_HOME`. 
 - Bump the injected `cider-nrepl` to 
[0.43.0](https://github.com/clojure-emacs/cider-nrepl/blob/v0.43.0/CHANGELOG.md#0430-2023-11-04).
   - Improves performance for exception handling and other use cases.
 
diff --git a/lein.sh b/lein.sh
index 811e1263f0..028e1675a5 100755
--- a/lein.sh
+++ b/lein.sh
@@ -13,12 +13,26 @@ shift
 output=$(2>&1 "$lein" "$@")
 cmd=$(grep "\s-cp\s"<<< "$output")
 
+function cache_root() {
+  local cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}"
+  cache_dir="${cache_dir/#\~/$HOME}"
+  mkdir -p "$cache_dir" 2>/dev/null
+  if [[ -w "$cache_dir" ]]; then
+    echo "${cache_dir%/}"
+  else
+    return 1
+  fi
+}
+
 if grep --silent "\s-cp\s"<<< "$cmd"; then
   eval "$cmd"
 else
   # Print errors:
-  mkdir -p ~/.emacs.d
-  echo "$output" >> ~/.emacs.d/cider-error.log
+  if cache_dir=$(cache_root); then
+    logfile="$cache_dir"/cider-enrich-classpath-error.log
+    echo "$output" >> "$logfile"
+    echo "Could not activate enrich-classpath. Error report available at 
$logfile"
+  fi
   no_enrich=()
   for arg in "$@"; do
     if [ "$arg" == "cider.enrich-classpath.plugin-v2/middleware" ]; then



reply via email to

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