Subject: [PATCH] gnu: emacs-volatile-highlights: Emit deprecation messages.

From: Hilton Chain <[email-masked]>
Date: Thu, 22 Sep 2022 09:23:15 +0800

* gnu/packages/patches/emacs-volatile-highlights-use-cl-lib.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/emacs-xyz.scm (emacs-volatile-highlights)[patches]: Add
emacs-volatile-highlights-use-cl-lib.patch
---
 gnu/local.mk                                  |   1 +
 gnu/packages/emacs-xyz.scm                    |   6 +-
 ...emacs-volatile-highlights-use-cl-lib.patch | 159 ++++++++++++++++++
 3 files changed, 165 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/emacs-volatile-highlights-use-cl-lib.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ef1bae5f3c..d85c5992da 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1054,6 +1054,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/emacs-source-date-epoch.patch		\
   %D%/packages/patches/emacs-telega-path-placeholder.patch	\
   %D%/packages/patches/emacs-telega-test-env.patch		\
+  %D%/packages/patches/emacs-volatile-highlights-use-cl-lib.patch	\
   %D%/packages/patches/emacs-wordnut-require-adaptive-wrap.patch	\
   %D%/packages/patches/emacs-yasnippet-fix-tests.patch	\
   %D%/packages/patches/emacs-kv-fix-tests.patch	\
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 32e4c33f16..05ec770637 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -32319,7 +32319,11 @@ (define-public emacs-volatile-highlights
              (file-name (git-file-name name version))
              (sha256
               (base32
-               "1dsa6769lphyyv7yg92vkkpk395w52q4m7hdn8xy7s6lh5c6a955"))))
+               "1dsa6769lphyyv7yg92vkkpk395w52q4m7hdn8xy7s6lh5c6a955"))
+             (patches
+              (search-patches
+               ;; https://github.com/k-talo/volatile-highlights.el/pull/22
+               "emacs-volatile-highlights-use-cl-lib.patch"))))
     (build-system emacs-build-system)
     (home-page "http://github.com/k-talo/volatile-highlights.el")
     (synopsis "Emacs minor mode for visual feedback on some operations")
diff --git a/gnu/packages/patches/emacs-volatile-highlights-use-cl-lib.patch b/gnu/packages/patches/emacs-volatile-highlights-use-cl-lib.patch
new file mode 100644
index 0000000000..daf1eb6faa
--- /dev/null
+++ b/gnu/packages/patches/emacs-volatile-highlights-use-cl-lib.patch
@@ -0,0 +1,159 @@
+From f5801779ba3e8f52020a34313fdfaa55f6c0c967 Mon Sep 17 00:00:00 2001
+From: Joerg Bornemann <[email-masked]>
+Date: Fri, 14 Jan 2022 22:31:39 +0100
+Subject: [PATCH 1/3] Use cl-lib instead of the deprecated cl package
+
+---
+ volatile-highlights.el | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/volatile-highlights.el b/volatile-highlights.el
+index e946afd..c1d7f2e 100644
+--- a/volatile-highlights.el
++++ b/volatile-highlights.el
+@@ -195,7 +195,7 @@
+ (defconst vhl/version "1.8")
+ 
+ (eval-when-compile
+-  (require 'cl)
++  (require 'cl-lib)
+   (require 'easy-mmode)
+   (require 'advice))
+ 
+@@ -409,7 +409,7 @@ Optional args are the same as `vhl/add-range'."
+   (let ((fn-on  (intern (format "vhl/ext/%s/on" sym)))
+         (fn-off (intern (format "vhl/ext/%s/off" sym)))
+         (cust-name (intern (format "vhl/use-%s-extension-p" sym))))
+-    (pushnew sym vhl/.installed-extensions)
++    (cl-pushnew sym vhl/.installed-extensions)
+     (eval `(defcustom ,cust-name t
+              ,(format "A flag if highlighting support for `%s' is on or not." sym)
+              :type 'boolean
+@@ -532,34 +532,34 @@ would be listed in english.
+ This is included as a private support function for generating
+ lists of symbols to be included docstrings of auto-generated
+ extensions."
+-  (assert (listp items))
++  (cl-assert (listp items))
+   (cond ((null items)
+          ;; Zero items
+          "")
+         ((null (cdr items))
+          ;; One item
+-         (assert (stringp (first items)))
+-         (format "%s" (first items)))
++         (cl-assert (stringp (cl-first items)))
++         (format "%s" (cl-first items)))
+         ((null (cddr items))
+          ;; Two items
+-         (assert (stringp (first items)))
+-         (assert (stringp (second items)))
++         (cl-assert (stringp (cl-first items)))
++         (cl-assert (stringp (cl-second items)))
+          (apply 'format "%s and %s" items))
+         ((null (cdddr items))
+          ;; Three items
+-         (assert (stringp (first items)))
+-         (assert (stringp (second items)))
+-         (assert (stringp (third items)))
++         (cl-assert (stringp (cl-first items)))
++         (cl-assert (stringp (cl-second items)))
++         (cl-assert (stringp (third items)))
+          (apply 'format "%s, %s, and %s" items))
+         (t
+          ;; 4 or more items
+-         (format "%s, %s" (first items) (vhl/.make-list-string (rest items)))))))
++         (format "%s, %s" (cl-first items) (vhl/.make-list-string (rest items)))))))
+ 
+ ;; The following makes it trivial to define simple vhl extensions
+ (defmacro vhl/define-extension (name &rest functions)
+   "Define a VHL extension called NAME that applies standard VHL
+   advice to each of FUNCTIONS."
+-  (assert (first functions))
++  (cl-assert (cl-first functions))
+   (let* ((name-string (symbol-name (eval name)))
+          (function-list-string (vhl/.make-list-string
+                                 (mapcar (lambda (f) (format "`%s'" (symbol-name (eval f))))
+
+From 1480383952ac46b7d76df749a8ff7565303bc184 Mon Sep 17 00:00:00 2001
+From: Joerg Bornemann <[email-masked]>
+Date: Fri, 14 Jan 2022 22:31:32 +0100
+Subject: [PATCH 2/3] Use lexical-binding to get rid of lexical-let
+
+This should be safe as the byte compiler does not warn about free
+variables.
+---
+ volatile-highlights.el | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/volatile-highlights.el b/volatile-highlights.el
+index d12b336..e946afd 100644
+--- a/volatile-highlights.el
++++ b/volatile-highlights.el
+@@ -1,4 +1,4 @@
+-;;; volatile-highlights.el --- Minor mode for visual feedback on some operations.
++;;; volatile-highlights.el --- Minor mode for visual feedback on some operations. -*- lexical-binding: t; -*-
+ 
+ ;; Copyright (C) 2001, 2010-2016 K-talo Miyazaki, all rights reserved.
+ 
+@@ -671,7 +671,7 @@ extensions."
+   "Turn on volatile highlighting for `occur'."
+   (interactive)
+ 
+-  (lexical-let ((*occur-str* nil)) ;; Text in current line.
++  (let ((*occur-str* nil)) ;; Text in current line.
+     (defun vhl/ext/occur/.pre-hook-fn ()
+       (save-excursion
+         (let* ((bol (progn (beginning-of-line) (point)))
+
+From 5e017d2e4a88acc562d90775cf9c746be2d7f277 Mon Sep 17 00:00:00 2001
+From: Joerg Bornemann <[email-masked]>
+Date: Fri, 14 Jan 2022 22:31:19 +0100
+Subject: [PATCH 3/3] Fix trailing whitespace
+
+---
+ volatile-highlights.el | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/volatile-highlights.el b/volatile-highlights.el
+index cb46897..d12b336 100644
+--- a/volatile-highlights.el
++++ b/volatile-highlights.el
+@@ -106,7 +106,7 @@
+ ;;
+ ;;   (vhl/define-extension 'vip 'vip-yank)
+ ;;   (vhl/install-extension 'vip)
+-;;   
++;;
+ ;; - evil-mode
+ ;;
+ ;;   (vhl/define-extension 'evil 'evil-paste-after 'evil-paste-before
+@@ -826,16 +826,16 @@ extensions."
+   (defadvice hs-show-block (around vhl/ext/hideshow/vhl/around-hook (&optional end))
+     (let* ((bol (save-excursion (progn (beginning-of-line) (point))))
+            (eol (save-excursion (progn (end-of-line) (point))))
+-           (ov-folded (car (delq nil 
++           (ov-folded (car (delq nil
+                                  (mapcar #'(lambda (ov)
+                                              (and (overlay-get ov 'hs)
+                                                   ov))
+                                          (overlays-in bol (1+ eol))))))
+            (boov (and ov-folded (overlay-start ov-folded)))
+            (eoov (and ov-folded (overlay-end ov-folded))))
+-    
++
+       ad-do-it
+-    
++
+       (when (and boov eoov)
+         (vhl/add-range boov eoov))))
+   (ad-activate 'hs-show-block))
+@@ -843,7 +843,7 @@ extensions."
+ (defun vhl/ext/hideshow/on ()
+   "Turn on volatile highlighting for `hideshow'."
+   (interactive)
+-  
++
+   (cond
+    ((featurep 'hideshow)
+     (vhl/ext/hideshow/.activate))

base-commit: 1a1ff7ed8fdaae58aff0e8625399cd7354038ca3
-- 
2.37.3