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"
(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)))