]> git.eshelyaron.com Git - sweep.git/commitdiff
Use 'without-restriction'.
authorEshel Yaron <me@eshelyaron.com>
Thu, 17 Aug 2023 21:39:58 +0000 (23:39 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 17 Aug 2023 21:46:33 +0000 (23:46 +0200)
* sweeprolog.el (sweeprolog-analyze-buffer)
(sweeprolog--buffer-string)
(sweeprolog-export-predicate): Use 'without-restriction' instead of
'save-restriction' and 'widen'.

sweeprolog.el

index a28723064ae37bbe691663fe0a90f431696ec33d..0968365411c8b11e5057872220def11ef7f7e611 100644 (file)
@@ -3017,17 +3017,15 @@ modified."
   (interactive (list t))
   (when (or force sweeprolog--buffer-modified)
     (sweeprolog-xref-buffer)
-    (save-restriction
-      (widen)
-      (let  ((sweeprolog--analyze-point (point)))
+    (without-restriction
+      (let ((sweeprolog--analyze-point (point)))
         (sweeprolog-analyze-region (point-min) (point-max))))
     (setq sweeprolog--buffer-modified nil)))
 
 (defun sweeprolog--buffer-string (filename)
   (when-let ((buf (find-buffer-visiting filename)))
     (with-current-buffer buf
-      (save-restriction
-        (widen)
+      (without-restriction
         (buffer-substring-no-properties
          (point-min)
          (point-max))))))
@@ -4593,8 +4591,7 @@ non-exported predicates defined in the current buffer."
                     (sweeprolog-read-exportable-predicate)
                     (read-string "Export comment: ")))
                sweeprolog-mode)
-  (save-restriction
-    (widen)
+  (without-restriction
     (save-excursion
       (goto-char (point-min))
       (unless (or (sweeprolog-at-beginning-of-top-term-p)