From 03cfe0c92472be4a234fd155160e5d4f7c9ea89e Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Thu, 17 Aug 2023 23:39:58 +0200 Subject: [PATCH] Use 'without-restriction'. * sweeprolog.el (sweeprolog-analyze-buffer) (sweeprolog--buffer-string) (sweeprolog-export-predicate): Use 'without-restriction' instead of 'save-restriction' and 'widen'. --- sweeprolog.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sweeprolog.el b/sweeprolog.el index a287230..0968365 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -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) -- 2.39.5