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

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

[elpa] externals/auto-overlays f17a94b 88/93: Switch auto-overlays over


From: Stefan Monnier
Subject: [elpa] externals/auto-overlays f17a94b 88/93: Switch auto-overlays over to cl-lib and lexical binding.
Date: Mon, 14 Dec 2020 13:00:44 -0500 (EST)

branch: externals/auto-overlays
commit f17a94b6f93a30853d3732bedf928c554f00378f
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>

    Switch auto-overlays over to cl-lib and lexical binding.
---
 auto-overlay-flat.el   |  5 ++---
 auto-overlay-line.el   |  4 ++--
 auto-overlay-nested.el |  7 ++++---
 auto-overlay-self.el   | 25 +++++++++++--------------
 auto-overlay-word.el   |  2 +-
 auto-overlays.el       | 33 ++++++++++++++++-----------------
 6 files changed, 36 insertions(+), 40 deletions(-)

diff --git a/auto-overlay-flat.el b/auto-overlay-flat.el
index cf1d37f..e50ceac 100644
--- a/auto-overlay-flat.el
+++ b/auto-overlay-flat.el
@@ -1,4 +1,4 @@
-;;; auto-overlay-flat.el --- flat start/end-delimited automatic overlays
+;;; auto-overlay-flat.el --- flat start/end-delimited automatic overlays    
-*- lexical-binding: t; -*-
 
 
 ;; Copyright (C) 2005-2015  Free Software Foundation, Inc
@@ -148,8 +148,7 @@
 
 
      (t ;; if we're an end-match, look for next end-match...
-      (let ((o-start (overlay-get o-parent 'start))
-           (o-end (auto-o-next-flat-match o-self 'end)))
+      (let ((o-end (auto-o-next-flat-match o-self 'end)))
        (cond
         ;; if there is one, match parent with it
         (o-end
diff --git a/auto-overlay-line.el b/auto-overlay-line.el
index fd0dc4e..8afbb4e 100644
--- a/auto-overlay-line.el
+++ b/auto-overlay-line.el
@@ -1,4 +1,4 @@
-;;; auto-overlay-line.el --- automatic overlays for single lines
+;;; auto-overlay-line.el --- automatic overlays for single lines    -*- 
lexical-binding: t; -*-
 
 
 ;; Copyright (C) 2005-2015  Free Software Foundation, Inc
@@ -59,7 +59,7 @@
     o-new))
 
 
-(defun auto-o-schedule-extend-line (o-self modified &rest unused)
+(defun auto-o-schedule-extend-line (o-self modified &rest _unused)
   ;; All line overlay modification hooks are set to this function, which
   ;; schedules `auto-o-extend-line' to run after any suicide functions have
   ;; been called, but before the overlays are updated.
diff --git a/auto-overlay-nested.el b/auto-overlay-nested.el
index f64f287..af23c25 100644
--- a/auto-overlay-nested.el
+++ b/auto-overlay-nested.el
@@ -1,4 +1,4 @@
-;;; auto-overlay-nested.el --- nested start/end-delimited automatic overlays
+;;; auto-overlay-nested.el --- nested start/end-delimited automatic overlays   
 -*- lexical-binding: t; -*-
 
 
 ;; Copyright (C) 2005-2015  Free Software Foundation, Inc
@@ -115,7 +115,7 @@
     (cond
      ((eq (auto-o-edge o-match) 'start)
       (setq pos (overlay-get o-match 'delim-end))
-      (setq o-new (make-overlay pos pos nil nil 'rear-advance))
+      (setq o-new (make-overlay pos (if unmatched (point-max) pos) nil nil 
'rear-advance))
       (overlay-put o-new 'auto-overlay t)
       (overlay-put o-new 'set-id (overlay-get o-match 'set-id))
       (overlay-put o-new 'definition-id (overlay-get o-match 'definition-id))
@@ -123,7 +123,8 @@
 
      ((eq (auto-o-edge o-match) 'end)
       (setq pos (overlay-get o-match 'delim-start))
-      (setq o-new (make-overlay pos pos nil nil 'rear-advance))
+      (setq o-new (make-overlay (if unmatched (point-min) pos) pos nil nil
+      'rear-advance))
       (overlay-put o-new 'auto-overlay t)
       (overlay-put o-new 'set-id (overlay-get o-match 'set-id))
       (overlay-put o-new 'definition-id (overlay-get o-match 'definition-id))
diff --git a/auto-overlay-self.el b/auto-overlay-self.el
index 19df8a7..c2201a3 100644
--- a/auto-overlay-self.el
+++ b/auto-overlay-self.el
@@ -1,4 +1,4 @@
-;;; auto-overlay-self.el --- self-delimited automatic overlays
+;;; auto-overlay-self.el --- self-delimited automatic overlays    -*- 
lexical-binding: t; -*-
 
 
 ;; Copyright (C) 2005-2015  Free Software Foundation, Inc
@@ -296,19 +296,16 @@
   ;; is null, all overlays after O-START are included.
 
   (when (null end) (setq end (point-max)))
-  (let (overlay-list)
-    ;; create list of all overlays corresponding to same entry between O-START
-    ;; and END
-    (setq overlay-list
-         ;; Note: We subtract 1 from start and add 1 to end to catch overlays
-         ;;       that end at start or start at end. This seems to give the
-         ;;       same results as the old version of `auto-o-self-list'
-         ;;       (above) in all circumstances.
-         (sort (auto-overlays-in
-                (1- (overlay-get o-start 'delim-start)) (1+ end)
-                `(eq set-id ,(overlay-get o-start 'set-id))
-                `(eq definition-id ,(overlay-get o-start 'definition-id)))
-               #'auto-overlay-<))))
+  ;; create list of all overlays corresponding to same entry between O-START 
and END
+  ;; Note: We subtract 1 from start and add 1 to end to catch overlays that
+  ;;       end at start or start at end. This seems to give the same results
+  ;;       as the old version of `auto-o-self-list' (above) in all
+  ;;       circumstances.
+  (sort (auto-overlays-in
+        (1- (overlay-get o-start 'delim-start)) (1+ end)
+        `(eq set-id ,(overlay-get o-start 'set-id))
+        `(eq definition-id ,(overlay-get o-start 'definition-id)))
+       #'auto-overlay-<))
 
 
 ;;; auto-overlay-self.el ends here
diff --git a/auto-overlay-word.el b/auto-overlay-word.el
index f3471d0..15637c7 100644
--- a/auto-overlay-word.el
+++ b/auto-overlay-word.el
@@ -1,4 +1,4 @@
-;;; auto-overlay-word.el --- automatic overlays for single "words"
+;;; auto-overlay-word.el --- automatic overlays for single "words"    -*- 
lexical-binding: t; -*-
 
 
 ;; Copyright (C) 2005-2015  Free Software Foundation, Inc
diff --git a/auto-overlays.el b/auto-overlays.el
index 9c165cb..a977854 100644
--- a/auto-overlays.el
+++ b/auto-overlays.el
@@ -1,4 +1,4 @@
-;;; auto-overlays.el --- Automatic regexp-delimited overlays
+;;; auto-overlays.el --- Automatic regexp-delimited overlays    -*- 
lexical-binding: t; -*-
 
 
 ;; Copyright (C) 2005-2015  Free Software Foundation, Inc
@@ -28,13 +28,13 @@
 
 ;;; Code:
 
+(require 'cl-lib)
+
 (defvar auto-overlay-regexps nil)
 (make-variable-buffer-local 'auto-overlay-regexps)
 (defvar auto-overlay-load-hook nil)
 (defvar auto-overlay-unload-hook nil)
 
-(eval-when-compile (require 'cl))
-
 
 ;; (defvar auto-overlay-list nil)
 ;; (make-variable-buffer-local 'auto-overlay-list)
@@ -590,7 +590,7 @@ Only overlays that satisfy all property tests are returned."
   (auto-overlay-trigger-update start)
   (unless (= start end) (auto-overlay-trigger-update end))
 
-  (let (overlay-list function prop-list value-list result)
+  (let (overlay-list function prop-list value-list)
     ;; check properties of each overlay in region
     (dolist (o (overlays-in start end))
       (catch 'failed
@@ -927,7 +927,7 @@ assumed to be 'start. ID property is a symbol that can be 
used to
 uniquely identify REGEXP (see `auto-overlay-unload-regexp')."
 
   (let ((defs (assq definition-id (auto-o-get-set set-id)))
-       regexp-id rgxp edge exclusive props)
+       regexp-id)
     (when (null defs)
       (error "Definition \"%s\" not found in auto-overlay regexp set %s"
             (symbol-name definition-id) (symbol-name set-id)))
@@ -1000,7 +1000,7 @@ from the current buffer. Returns the deleted definition."
                                `(eq definition-id ,definition-id)))))
     ;; delete definition
     (let ((olddef (assq definition-id (auto-o-get-set set-id)))
-          def-id class regexps regexp edge regexp-id props)
+          def-id class regexps)
       ;; safe to delete by side effect here because definition is guaranteed
       ;; not to be the first element of the list (the first two elements of a
       ;; regexp set are always the set-id and the buffer list)
@@ -1410,14 +1410,13 @@ overlays were saved."
 
 
 
-(defun auto-o-schedule-update (start &optional end unused set-id)
+(defun auto-o-schedule-update (start &optional end _unused _set-id)
   ;; Schedule `auto-overlay-update' of lines between positions START and END
-  ;; (including lines containing START and END), optionally restricted to
-  ;; SET-ID. If END is not supplied, schedule update for just line containing
-  ;; START. The update will be run by `auto-o-run-after-change-functions'
-  ;; after buffer modification is complete. This function is assigned to
-  ;; `after-change-functions'.
-
+  ;; (including lines containing START and END). If END is not supplied,
+  ;; schedule update for just line containing START. The update will be run by
+  ;; `auto-o-run-after-change-functions' after buffer modification is
+  ;; complete. This function is assigned to `after-change-functions'.
+  ;; FIXME: Optionally allow argument to restrict to SET-ID?
   (save-restriction
     (widen)   ; need to widen, since goto-line goes to absolute line
     (setq start (line-number-at-pos start))
@@ -1477,7 +1476,7 @@ overlays were saved."
 
 
 
-(defun auto-o-schedule-suicide (o-self &optional modified &rest unused)
+(defun auto-o-schedule-suicide (o-self &optional modified &rest _unused)
   ;; Schedule `auto-o-suicide' to run after buffer modification is
   ;; complete. It will be run by `auto-o-run-after-change-functions'. Assigned
   ;; to overlay modification and insert in-front/behind hooks.
@@ -1501,7 +1500,7 @@ overlays were saved."
 
   (save-restriction
     (widen)
-    (let (definition-id regexp-id class def regexp group priority
+    (let (definition-id regexp-id regexp group priority
           o-match o-overlap o-new beg end)
       (unless start-line (setq start-line (line-number-at-pos)))
       (save-excursion
@@ -1528,8 +1527,8 @@ overlays were saved."
                  (setq definition-id (pop def))
                  (when (or (null definition-ids)
                            (memq definition-id definition-ids))
-                   (setq class (pop def))
-
+                   (pop def)
+                   
                    ;; check all regexps for current definition
                    (dotimes (rank (length def))
                      (setq regexp-id (car (nth rank def)))



reply via email to

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