[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat ba2918d6d3 21/27: Add file-backup-file-names
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat ba2918d6d3 21/27: Add file-backup-file-names |
Date: |
Sat, 5 Mar 2022 04:57:28 -0500 (EST) |
branch: externals/compat
commit ba2918d6d30022118e2f88d4394aeafb9b58166d
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Add file-backup-file-names
---
MANUAL | 1 +
compat-28.el | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/MANUAL b/MANUAL
index 16b42cd83d..b4577489ac 100644
--- a/MANUAL
+++ b/MANUAL
@@ -355,6 +355,7 @@ provided by compat by default:
- Function ~color-values-from-color-spec~ :: Defined in ~xfaces.c~.
- Function ~file-modes-number-to-symbolic~ :: See [[info:elisp#Changing
Files][(elisp) Changing
Files]].
+- Function ~file-backup-file-names~ :: See [[info:elisp#Backup Names][(elisp)
Backup Names]].
These functions are prefixed with ~compat~ prefix, and are only loaded
when ~compat-28~ is required:
diff --git a/compat-28.el b/compat-28.el
index 6324126e8c..27b1dba7a2 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -663,6 +663,27 @@ the leading `-' char."
(if (zerop (logand 1 mode)) ?- ?x)
(if (zerop (logand 1 mode)) ?T ?t))))
+(compat-defun file-backup-file-names (filename)
+ "Return a list of backup files for FILENAME.
+The list will be sorted by modification time so that the most
+recent files are first."
+ ;; `make-backup-file-name' will get us the right directory for
+ ;; ordinary or numeric backups. It might create a directory for
+ ;; backups as a side-effect, according to `backup-directory-alist'.
+ (let* ((filename (file-name-sans-versions
+ (make-backup-file-name (expand-file-name filename))))
+ (dir (file-name-directory filename)))
+ (sort
+ (seq-filter
+ (lambda (candidate)
+ (and (backup-file-name-p candidate)
+ (string= (file-name-sans-versions candidate) filename)))
+ (mapcar
+ (lambda (file)
+ (concat dir file))
+ (file-name-all-completions (file-name-nondirectory filename) dir)))
+ #'file-newer-than-file-p)))
+
;;;; Defined in minibuffer.el
(compat-defun format-prompt (prompt default &rest format-args)
- [elpa] externals/compat 3f511afce0 12/27: Add directory-files-recursively, (continued)
- [elpa] externals/compat 3f511afce0 12/27: Add directory-files-recursively, ELPA Syncer, 2022/03/05
- [elpa] externals/compat efa6e171e5 13/27: Document define-advice as not implemented, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 441539ae8b 11/27: Add face-spec-set, ELPA Syncer, 2022/03/05
- [elpa] externals/compat b3b75333b1 14/27: Document generators as not implemented, ELPA Syncer, 2022/03/05
- [elpa] externals/compat c4893fa014 15/27: Document bufferpos-to-filepos as not implemented, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 35072b3d25 22/27: Fix if-let and add tests, ELPA Syncer, 2022/03/05
- [elpa] externals/compat ece91a5b89 03/27: Add function-put, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 9034bcc0ac 05/27: Fix broken markup in some deftest docstrings, ELPA Syncer, 2022/03/05
- [elpa] externals/compat c8bc47b671 18/27: Add replace-string-in-region, ELPA Syncer, 2022/03/05
- [elpa] externals/compat a92aec7251 19/27: Add file-modes-number-to-symbolic, ELPA Syncer, 2022/03/05
- [elpa] externals/compat ba2918d6d3 21/27: Add file-backup-file-names,
ELPA Syncer <=
- [elpa] externals/compat 15ca463a9e 20/27: Document that null-device and path-separator are not implemented, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 6b14d5fa3b 24/27: Exclude the generated manual from the repository, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 63ac5dd347 16/27: Add assoc-delete-all, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 8eb72a2739 25/27: Convert JSON advice for Emacs 28 to prefixed functions, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 9fa3fbab8a 27/27: Fix (provide) in compat-tests.el, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 5514de45e1 26/27: Rewrite test macros to generate more individual tests, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 212f8c7c77 17/27: Add color-values-from-color-spec, ELPA Syncer, 2022/03/05
- [elpa] externals/compat 158edd3161 23/27: Mark all currently untested functions, ELPA Syncer, 2022/03/05