[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/osm 01dc16ac90 9/9: Add osm-max-cache
From: |
ELPA Syncer |
Subject: |
[elpa] externals/osm 01dc16ac90 9/9: Add osm-max-cache |
Date: |
Fri, 22 Dec 2023 12:58:28 -0500 (EST) |
branch: externals/osm
commit 01dc16ac90d2e4f44d6e5843eb7f738332e5e329
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Add osm-max-cache
---
CHANGELOG.org | 1 +
osm.el | 17 +++++++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 2fc37479ed..d2a9c84e61 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -14,6 +14,7 @@
- Unify ~osm-bookmark-set~ and ~osm-bookmark-set-click~.
- Add distance measurement for manual track. Press ~S-<mouse-1>~
(~osm-mouse-track~)
to place the pins of the track.
+- Add ~osm-max-cache~ to keep image cache size in check.
* Version 1.0 (2023-12-01)
diff --git a/osm.el b/osm.el
index b8f3f0eab3..b4912d498d 100644
--- a/osm.el
+++ b/osm.el
@@ -226,7 +226,11 @@ Should be at least 7 days according to the server usage
policies."
:type '(choice (const nil) natnum))
(defcustom osm-max-tiles 256
- "Size of tile memory cache."
+ "Number of tiles to keep in the memory cache."
+ :type '(choice (const nil) natnum))
+
+(defcustom osm-max-cache 64
+ "Image cache size in megabytes."
:type '(choice (const nil) natnum))
(defun osm--menu-item (menu &optional name)
@@ -1101,7 +1105,6 @@ xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'>
(defun osm--revert (&rest _)
"Revert osm buffers."
- (clear-image-cache t)
(setq osm--tile-cache nil)
(dolist (buf (buffer-list))
(when (eq (buffer-local-value 'major-mode buf) #'osm-mode)
@@ -1158,14 +1161,14 @@ xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'>
(defun osm--update ()
"Update map display."
(osm--barf-unless-osm)
+ (osm--purge-tile-cache)
+ (osm--purge-directory)
(osm--rename-buffer)
(osm--update-sizes)
(osm--update-header)
(osm--update-buffer)
(osm--update-copyright)
- (osm--process-download-queue)
- (osm--purge-tile-cache)
- (osm--purge-directory))
+ (osm--process-download-queue))
(defun osm--update-sizes ()
"Update window sizes."
@@ -1257,7 +1260,9 @@ xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'>
(maphash (lambda (k v) (push (cons (car v) k) items)) osm--tile-cache)
(setq items (sort items #'car-less-than-car))
(dotimes (_ (- (hash-table-count osm--tile-cache) osm-max-tiles))
- (remhash (cdr (pop items)) osm--tile-cache)))))
+ (remhash (cdr (pop items)) osm--tile-cache))))
+ (when (and osm-max-cache (> (image-cache-size) (* 1024 1024 osm-max-cache)))
+ (clear-image-cache t)))
(defun osm--bookmark-record-default ()
"Make osm bookmark record."
- [elpa] externals/osm updated (2b62c42f15 -> 01dc16ac90), ELPA Syncer, 2023/12/22
- [elpa] externals/osm a1df32a268 2/9: Do not use osm-bookmark-click for selection, ELPA Syncer, 2023/12/22
- [elpa] externals/osm 3bd1266561 1/9: Rename variable and function, ELPA Syncer, 2023/12/22
- [elpa] externals/osm f0159ee7d9 5/9: Remove osm-bookmark-click, ELPA Syncer, 2023/12/22
- [elpa] externals/osm 88cb802d82 4/9: osm--fetch-location-data: Remove id argument, ELPA Syncer, 2023/12/22
- [elpa] externals/osm 9651d597a9 3/9: Simplify pin selection, ELPA Syncer, 2023/12/22
- [elpa] externals/osm 30684d1481 6/9: Various refactorings, ELPA Syncer, 2023/12/22
- [elpa] externals/osm 01dc16ac90 9/9: Add osm-max-cache,
ELPA Syncer <=
- [elpa] externals/osm 83aadc823d 7/9: Shorten some names, ELPA Syncer, 2023/12/22
- [elpa] externals/osm 4e31c4feae 8/9: Shorten variable names, ELPA Syncer, 2023/12/22