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

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

[nongnu] elpa/logview 1d1524f491 221/259: Add checks for Emacs 29 forgot


From: ELPA Syncer
Subject: [nongnu] elpa/logview 1d1524f491 221/259: Add checks for Emacs 29 forgotten in commit 75c4945 before using new macros.
Date: Fri, 31 Jan 2025 07:02:16 -0500 (EST)

branch: elpa/logview
commit 1d1524f4912549bcfc8ba9a56765ba6e62bd8c6b
Author: Paul Pogonyshev <pogonyshev@gmail.com>
Commit: Paul Pogonyshev <pogonyshev@gmail.com>

    Add checks for Emacs 29 forgotten in commit 75c4945 before using new macros.
---
 logview.el      | 28 ++++++++++++++++------------
 test/logview.el | 11 ++++++++++-
 2 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/logview.el b/logview.el
index 610adb5b59..16a5df32eb 100644
--- a/logview.el
+++ b/logview.el
@@ -920,18 +920,22 @@ Original point restrictions, if any, will not be possible 
to find
 inside BODY.  In most cases (also if not sure) you should use
 macro `logview--std-temporarily-widening' instead."
   (declare (indent 0) (debug t))
-  `(save-restriction
-     ;; {LOCKED-NARROWING}
-     ;; "Hurr-durr, mah security, you cannot unlock without knowing the tag."  
Try all
-     ;; tags I could find in Emacs source code.  Normally this should be 
enough, but there
-     ;; is obviously no guarantee as macro `with-restriction' is part of 
public Elisp
-     ;; interface now.
-     (without-restriction
-       :label 'long-line-optimizations-in-fontification-functions
-       (without-restriction
-         :label 'long-line-optimizations-in-command-hooks
-         (logview--do-widen)
-         ,@body))))
+  (if (boundp 'without-restriction)
+      `(save-restriction
+         ;; {LOCKED-NARROWING}
+         ;; "Hurr-durr, mah security, you cannot unlock without knowing the 
tag."  Try all
+         ;; tags I could find in Emacs source code.  Normally this should be 
enough, but
+         ;; there is obviously no guarantee as macro `with-restriction' is 
part of public
+         ;; Elisp interface now.
+         (without-restriction
+           :label 'long-line-optimizations-in-fontification-functions
+           (without-restriction
+             :label 'long-line-optimizations-in-command-hooks
+             (logview--do-widen)
+             ,@body)))
+    `(save-restriction
+       (logview--do-widen)
+       ,@body)))
 
 (defun logview--do-widen ()
   (widen)
diff --git a/test/logview.el b/test/logview.el
index 93895d629d..5e2e5d2155 100644
--- a/test/logview.el
+++ b/test/logview.el
@@ -27,6 +27,15 @@
 (defvar inhibit-message)
 
 
+(defmacro logview--test-with-restriction (start end locking-label &rest body)
+  (if (boundp 'with-restriction)
+      `(with-restriction ,start ,end
+         :label ,locking-label
+         ,@body)
+    `(progn (narrow-to-region ,start ,end)
+            ,@body)))
+
+
 (ert-deftest logview--temporarily-widening ()
   (with-temp-buffer
     (insert "foo bar baz")
@@ -39,7 +48,7 @@
     ;; Testing without emulation, with real Emacs-imposed locking seems 
unfeasible, since
     ;; relevant font-locking code is not activated in batch mode.
     (dolist (tag '(long-line-optimizations-in-fontification-functions 
long-line-optimizations-in-command-hooks))
-      (with-restriction 5 8
+      (logview--test-with-restriction 5 8
         :label tag
         (should (string= (buffer-string) "bar"))
         (logview--temporarily-widening



reply via email to

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