From 3e274535230a39693b1e79cda332026128689ed2 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Wed, 25 Mar 2020 12:27:07 +0100 Subject: [PATCH] Code simplification Simplified some code and calls, less `setq-local` delegated to `let*` --- funcs.el | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/funcs.el b/funcs.el index 493cfa8..b083fbb 100644 --- a/funcs.el +++ b/funcs.el @@ -73,10 +73,9 @@ table" none the word the cursor is over" (interactive) (let* ((beg (region-beginning)) - (end (region-end)) - (boundary-word (bounds-of-thing-at-point 'word))) + (end (region-end))) (if (= beg end) - boundary-word + (bounds-of-thing-at-point 'word) (cons beg end)))) (defun conlanging//replace-char-by-table (t-correspondance-table) @@ -87,12 +86,10 @@ second element of the pair the string it has to be replaced with." (let* ((cur-boundary (conlanging//get-boundary)) (beg (car cur-boundary)) - (end (cdr cur-boundary))) - (setq-local regionp - (buffer-substring-no-properties beg end)) - (setq-local regionp - (conlanging//replace-string-by-char regionp - t-correspondance-table)) + (end (cdr cur-boundary)) + (regionp (buffer-substring-no-properties beg end)) + (new-regionp (conlanging//replace-string-by-char regionp + t-correspondance-table))) (delete-region beg end) (goto-char beg) (insert regionp)))