From 81212e7c60e439f313078e46a0eceb172d09a49f Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Wed, 24 Aug 2022 18:22:53 +0200 Subject: [PATCH] Remove redundant let, ensure the whole buffer is checked for auto-id Redundant let was left over from past refactoring. This commit removes it. It also ensures the search for auto-id:t is made throughout the whole buffer. --- org-unique-id.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/org-unique-id.el b/org-unique-id.el index 9a93835..f15b800 100644 --- a/org-unique-id.el +++ b/org-unique-id.el @@ -128,13 +128,13 @@ This function executes `org-unique-id' when the buffer’s major mode is `org-mode', when the buffer is not read-only, and if \\='auto-id:t\\' is found in an #+OPTIONS line." (interactive) - (let ((case-fold-search t)) - (when (and (eq major-mode 'org-mode) - (eq buffer-read-only nil) - (save-excursion - (let ((case-fold-search t)) - (re-search-forward "^#\\+OPTIONS:.*auto-id:t" (point-max) t)))) - (org-unique-id)))) + (when (and (eq major-mode 'org-mode) + (eq buffer-read-only nil) + (save-excursion + (goto-char (point-min)) + (let ((case-fold-search t)) + (re-search-forward "^#\\+OPTIONS:.*auto-id:t" (point-max) t)))) + (org-unique-id))) (provide 'org-unique-id)