[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org d5fc159bf7 15/31: Fix compiler warnings
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org d5fc159bf7 15/31: Fix compiler warnings |
Date: |
Sat, 29 Jan 2022 04:58:04 -0500 (EST) |
branch: externals/org
commit d5fc159bf7d73db807b09cda1ca8d831966701e1
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
Fix compiler warnings
---
lisp/org-persist.el | 68 ++++++++++++++++++++++++++++-------------------------
1 file changed, 36 insertions(+), 32 deletions(-)
diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index 8c97ac3762..fad67e84c0 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -271,32 +271,45 @@ FORMAT and ARGS are passed to `message'."
(- (float-time) start-time)
"Writing to %S" file)))
+(defmacro org-persist-gc:generic (container collection)
+ "Garbage collect CONTAINER data from COLLECTION."
+ `(let* ((c (org-persist--normalize-container ,container))
+ (gc-func-symbol (intern (format "org-persist-gc:%s" (car c)))))
+ (unless (fboundp gc-func-symbol)
+ (error "org-persist: GC function %s not defined"
+ gc-func-symbol))
+ (funcall gc-func-symbol c ,collection)))
+
;;;; Working with index
(defmacro org-persist-collection-let (collection &rest body)
"Bind container and associated from COLLECTION and execute BODY."
(declare (debug (form body)) (indent 1))
- `(let* ((container (plist-get ,collection :container))
- (associated (plist-get ,collection :associated))
- (path (plist-get associated :file))
- (inode (plist-get associated :inode))
- (hash (plist-get associated :hash))
- (key (plist-get associated :key)))
- ,@body))
+ `(with-no-warnings
+ ;; FIXME: We only need to suppress warnings about unused
+ ;; let-bindings. However, it is unclear how to achieve it with
+ ;; `with-suppressed-warnings'.
+ (let* ((container (plist-get ,collection :container))
+ (associated (plist-get ,collection :associated))
+ (path (plist-get associated :file))
+ (inode (plist-get associated :inode))
+ (hash (plist-get associated :hash))
+ (key (plist-get associated :key)))
+ ,@body)))
(defun org-persist--find-index (collection)
- "Find COLLECTION in `org-persist--index'."
- (org-persist-collection-let collection
- (and org-persist--index-hash
- (catch :found
- (dolist (cont (cons container container))
- (let (r)
- (setq r (or (gethash (cons cont associated)
org-persist--index-hash)
- (and path (gethash (cons cont (list :file path))
org-persist--index-hash))
- (and inode (gethash (cons cont (list :inode inode))
org-persist--index-hash))
- (and hash (gethash (cons cont (list :hash hash))
org-persist--index-hash))
- (and key (gethash (cons cont (list :key key))
org-persist--index-hash))))
- (when r (throw :found r))))))))
+"Find COLLECTION in `org-persist--index'."
+(org-persist-collection-let collection
+ (and org-persist--index-hash
+ (catch :found
+ (dolist (cont (cons container container))
+ (let (r)
+ (setq r (or (gethash (cons cont associated)
org-persist--index-hash)
+ (and path (gethash (cons cont (list :file path))
org-persist--index-hash))
+ (and inode (gethash (cons cont (list :inode inode))
org-persist--index-hash))
+ (and hash (gethash (cons cont (list :hash hash))
org-persist--index-hash))
+ (and key (gethash (cons cont (list :key key))
org-persist--index-hash))))
+ (when r (throw :found r))))))))
(defun org-persist--add-to-index (collection &optional hash-only)
"Add or update COLLECTION in `org-persist--index'.
@@ -537,8 +550,8 @@ COLLECTION is the plist holding data collectin."
(defalias 'org-persist-write:version #'ignore)
-(defun org-persist-write:file (container collection)
- "Write file CONTAINER according to COLLECTION."
+(defun org-persist-write:file (_ collection)
+ "Write file container according to COLLECTION."
(org-persist-collection-let collection
(when (and path (file-exists-p path))
(let* ((persist-file (plist-get collection :persist-file))
@@ -552,8 +565,8 @@ COLLECTION is the plist holding data collectin."
(copy-file path file-copy 'overwrite))
(format "%s-file.%s" persist-file ext)))))
-(defun org-persist-write:url (container collection)
- "Write url CONTAINER according to COLLECTION."
+(defun org-persist-write:url (_ collection)
+ "Write url container according to COLLECTION."
(org-persist-collection-let collection
(when path
(let* ((persist-file (plist-get collection :persist-file))
@@ -746,15 +759,6 @@ Do nothing in an indirect buffer."
(unless (buffer-base-buffer (current-buffer))
(org-persist-write-all (current-buffer))))
-(defmacro org-persist-gc:generic (container collection)
- "Garbage collect CONTAINER data from COLLECTION."
- `(let* ((c (org-persist--normalize-container ,container))
- (gc-func-symbol (intern (format "org-persist-gc:%s" (car c)))))
- (unless (fboundp gc-func-symbol)
- (error "org-persist: GC function %s not defined"
- gc-func-symbol))
- (funcall gc-func-symbol c ,collection)))
-
(defalias 'org-persist-gc:elisp #'ignore)
(defalias 'org-persist-gc:index #'ignore)
- [elpa] externals/org 2a4e5a8e58 02/31: org-persist--normalize-associated: Use cache to calculate buffer hash, (continued)
- [elpa] externals/org 2a4e5a8e58 02/31: org-persist--normalize-associated: Use cache to calculate buffer hash, ELPA Syncer, 2022/01/29
- [elpa] externals/org 703df9310a 07/31: org-persist: Cleanup on removal and version mismatch, ELPA Syncer, 2022/01/29
- [elpa] externals/org dafa32da49 06/31: org-persist: Update index version, ELPA Syncer, 2022/01/29
- [elpa] externals/org f963d617a4 14/31: Fix checkdoc warnings, ELPA Syncer, 2022/01/29
- [elpa] externals/org 9b650938e7 13/31: org-persist: Provide human readable access time and make sure it exist, ELPA Syncer, 2022/01/29
- [elpa] externals/org 1869a37a2c 10/31: Fix org-persist--remove-from-index, ELPA Syncer, 2022/01/29
- [elpa] externals/org aca62116da 12/31: org-persist-write: Update buffer hash on save, ELPA Syncer, 2022/01/29
- [elpa] externals/org edd7f2962f 01/31: org-persist: Reimplement using more generic approach, ELPA Syncer, 2022/01/29
- [elpa] externals/org 7c2d93560c 03/31: org-persist-default-expiry: Introduce and change default, ELPA Syncer, 2022/01/29
- [elpa] externals/org 1084566322 08/31: Fix org-persist-unregister, ELPA Syncer, 2022/01/29
- [elpa] externals/org d5fc159bf7 15/31: Fix compiler warnings,
ELPA Syncer <=
- [elpa] externals/org 203420504e 11/31: org-persist-load:elisp: fix loading, ELPA Syncer, 2022/01/29
- [elpa] externals/org fca80139ee 18/31: org-persist: Fix compatibility with Emacs 27, ELPA Syncer, 2022/01/29
- [elpa] externals/org dc52c0fe99 17/31: Fix native-comp warnings, ELPA Syncer, 2022/01/29
- [elpa] externals/org f3bd1dcb77 20/31: org-persist: Fix compiler warnings, ELPA Syncer, 2022/01/29
- [elpa] externals/org 1bc8389871 21/31: org-persist-read: Check expiry, ELPA Syncer, 2022/01/29
- [elpa] externals/org 6b175fb227 27/31: org-persist-register: Make return value meaningful with :write-immidiately, ELPA Syncer, 2022/01/29
- [elpa] externals/org f0e0716f54 28/31: org-element: Use new cache container format, ELPA Syncer, 2022/01/29
- [elpa] externals/org 19a383d9f4 29/31: org-persist-write-all: Speed up writing, ELPA Syncer, 2022/01/29
- [elpa] externals/org ac5742f296 31/31: Merge branch 'feature/org-persist-new-tidy', ELPA Syncer, 2022/01/29
- [elpa] externals/org 38a681fdae 05/31: org-element-cache-reset: Do not persist caches for non-file buffers, ELPA Syncer, 2022/01/29