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

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

[nongnu] elpa/package-lint a78eb9a77d 2/2: Merge pull request #262 from


From: ELPA Syncer
Subject: [nongnu] elpa/package-lint a78eb9a77d 2/2: Merge pull request #262 from minad/dump-compat-symbols
Date: Wed, 14 Feb 2024 10:00:36 -0500 (EST)

branch: elpa/package-lint
commit a78eb9a77dc1c6f0ffee6704b99621d10ca44be0
Merge: a6a74293db d14e152edc
Author: Steve Purcell <steve@sanityinc.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #262 from minad/dump-compat-symbols
    
    Add tools/compat-dump.el which generates data/compat-symbols
---
 data/compat-symbols |  1 +
 package-lint.el     | 44 +++++++++++++++-----------------------------
 tools/compat-dump   | 21 +++++++++++++++++++++
 3 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/data/compat-symbols b/data/compat-symbols
new file mode 100644
index 0000000000..a757a98a5f
--- /dev/null
+++ b/data/compat-symbols
@@ -0,0 +1 @@
+((file-has-changed-p--hash-table set-transient-map-timer 
set-transient-map-timeout lisp-directory color-luminance-dark-limit 
read-answer-short read-char-from-minibuffer-map-hash 
read-char-from-minibuffer-map read-char-history major-mode--suspended 
regexp-unmatchable mouse-select-region-move-to-beginning mounted-file-systems 
gensym-counter text-quoting-style) ert-with-temp-directory ert-with-temp-file 
cl-once-only cl-with-gensyms cl-constantly count-sentences read-multiple-choice 
buttoniz [...]
\ No newline at end of file
diff --git a/package-lint.el b/package-lint.el
index 49aa936e20..e491b0fe7d 100644
--- a/package-lint.el
+++ b/package-lint.el
@@ -7,7 +7,7 @@
 ;; URL: https://github.com/purcell/package-lint
 ;; Keywords: lisp
 ;; Version: 0.21
-;; Package-Requires: ((cl-lib "0.5") (emacs "24.4") (let-alist "1.0.6") 
(compat "29.1"))
+;; Package-Requires: ((emacs "24.4") (let-alist "1.0.6"))
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -110,14 +110,18 @@ SYMBOL-NAME-MATCH PACKAGE VERSION?) where PACKAGE is the 
name of
 a backport library shipping the feature and VERSION is an
 optional minimum version containing the feature.")
 
+(defun package-lint--load-data (file)
+  "Load sexp data from FILE."
+  (with-temp-buffer
+    (insert-file-contents
+     (expand-file-name file
+                       (if load-file-name
+                           (file-name-directory load-file-name)
+                         default-directory)))
+    (read (current-buffer))))
+
 (defconst package-lint-symbol-info
-  (let* ((stdlib-changes (with-temp-buffer
-                           (insert-file-contents
-                            (expand-file-name "data/stdlib-changes"
-                                              (if load-file-name
-                                                  (file-name-directory 
load-file-name)
-                                                default-directory)))
-                           (read (current-buffer))))
+  (let* ((stdlib-changes (package-lint--load-data "data/stdlib-changes"))
          (info (make-hash-table)))
     (pcase-dolist (`(,version . ,data) stdlib-changes)
       (pcase-dolist (`(,syms . ,action)
@@ -172,33 +176,15 @@ symbol such as `variable-added'.")
   (let-alist (package-lint-symbol-info sym)
     (or .function-added .function-removed)))
 
-(defconst package-lint--supported-symbols
-  (let (symbols functions)
-    (dolist (ver '(25 26 27 28 29))
-      (let ((el-path (locate-library (format "compat-%d.el" ver) t)))
-        (unless el-path
-          (error "compat package not installed"))
-        (with-temp-buffer
-          (insert-file-contents el-path)
-          (goto-char (point-min))
-          (while (search-forward-regexp (rx line-start
-                                            "(compat-" (group (or "defun" 
"defmacro" "defvar" "defalias"))
-                                            (+ space)
-                                            symbol-start
-                                            (group (+? any))
-                                            symbol-end)
-                                        nil t)
-            (pcase (match-string 1)
-              ("defvar" (push (intern (match-string 2)) symbols))
-              ((or "defun" "defmacro" "defalias") (push (intern (match-string 
2)) functions)))))))
-    (cons symbols functions))
+(defconst package-lint--compat-symbols
+  (package-lint--load-data "data/compat-symbols")
   "A cons cell of (VARS . FUNCTIONS) supported by \"compat\".")
 
 (defun package-lint--supported-by-compat (type sym)
   "Return non-nil if SYM is supported by the \"compat\" package.
 TYPE is `function' or `variable'."
   (memq sym (pcase type
-              (`function (cdr package-lint--supported-symbols))
+              (`function (cdr package-lint--compat-symbols))
               (_ nil))))
 
 (defconst package-lint--sane-prefixes
diff --git a/tools/compat-dump b/tools/compat-dump
new file mode 100755
index 0000000000..058d3cf38f
--- /dev/null
+++ b/tools/compat-dump
@@ -0,0 +1,21 @@
+#!/usr/bin/env -S emacs -Q --script
+(unless (string-suffix-p "/package-lint/" default-directory)
+  (error "Not in the package-lint directory"))
+(let (symbols functions)
+  (dolist (file (directory-files "../compat/" t "compat-[0-9]+\\.el$"))
+    (with-temp-buffer
+      (insert-file-contents file)
+      (goto-char (point-min))
+      (while (search-forward-regexp (rx line-start
+                                        "(compat-" (group (or "defun" 
"defmacro" "defvar" "defalias"))
+                                        (+ space)
+                                        symbol-start
+                                        (group (+? any))
+                                        symbol-end)
+                                    nil t)
+        (pcase (match-string 1)
+          ("defvar" (push (intern (match-string 2)) symbols))
+          ((or "defun" "defmacro" "defalias") (push (intern (match-string 2)) 
functions))))))
+  (with-temp-buffer
+    (insert (prin1-to-string (cons symbols functions)))
+    (write-region (point-min) (point-max) "data/compat-symbols" nil 'quiet)))



reply via email to

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