Code simplification

Simplified some code and calls, less `setq-local` delegated to `let*`
This commit is contained in:
Lucien Cartier-Tilet 2020-03-25 12:27:07 +01:00
parent ea9637ff5a
commit 3e27453523
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -73,10 +73,9 @@ table"
none the word the cursor is over" none the word the cursor is over"
(interactive) (interactive)
(let* ((beg (region-beginning)) (let* ((beg (region-beginning))
(end (region-end)) (end (region-end)))
(boundary-word (bounds-of-thing-at-point 'word)))
(if (= beg end) (if (= beg end)
boundary-word (bounds-of-thing-at-point 'word)
(cons beg end)))) (cons beg end))))
(defun conlanging//replace-char-by-table (t-correspondance-table) (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." with."
(let* ((cur-boundary (conlanging//get-boundary)) (let* ((cur-boundary (conlanging//get-boundary))
(beg (car cur-boundary)) (beg (car cur-boundary))
(end (cdr cur-boundary))) (end (cdr cur-boundary))
(setq-local regionp (regionp (buffer-substring-no-properties beg end))
(buffer-substring-no-properties beg end)) (new-regionp (conlanging//replace-string-by-char regionp
(setq-local regionp t-correspondance-table)))
(conlanging//replace-string-by-char regionp
t-correspondance-table))
(delete-region beg end) (delete-region beg end)
(goto-char beg) (goto-char beg)
(insert regionp))) (insert regionp)))