From 21016520838b7398559f004872f0964478f17b06 Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Sun, 26 May 2024 10:05:19 +0200 Subject: [PATCH] Remove 'save-match-data' from 'csv--unquote-value'. As per its doc string, 'save-match-data' should only be used to save one's own match data, not the caller's. --- csv-mode.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/csv-mode.el b/csv-mode.el index ebcd9da..37bff30 100644 --- a/csv-mode.el +++ b/csv-mode.el @@ -1408,14 +1408,13 @@ point is assumed to be at the beginning of the line." "Remove quotes around VALUE. If VALUE contains escaped quote characters, un-escape them. If VALUE is not quoted, return it unchanged." - (save-match-data - (let ((quote-regexp (apply #'concat `("[" ,@csv-field-quotes "]")))) - (if-let (((string-match (concat "^\\(" quote-regexp "\\)\\(.*\\)\\(" quote-regexp "\\)$") value)) - (quote-char (match-string 1 value)) - ((equal quote-char (match-string 3 value))) - (unquoted (match-string 2 value))) - (replace-regexp-in-string (concat quote-char quote-char) quote-char unquoted) - value)))) + (let ((quote-regexp (apply #'concat `("[" ,@csv-field-quotes "]")))) + (if-let (((string-match (concat "^\\(" quote-regexp "\\)\\(.*\\)\\(" quote-regexp "\\)$") value)) + (quote-char (match-string 1 value)) + ((equal quote-char (match-string 3 value))) + (unquoted (match-string 2 value))) + (replace-regexp-in-string (concat quote-char quote-char) quote-char unquoted) + value))) (defun csv-parse-current-row () "Parse the current CSV line. -- 2.45.1