You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
205 lines
3.8 KiB
EmacsLisp
205 lines
3.8 KiB
EmacsLisp
(defun replace-pairs-region (Begin End Pairs) ;; modified xah
|
|
(let ((case-fold-search nil) ($tempMapPoints nil) ($changeLog nil))
|
|
(dotimes (i (length Pairs)) (push (char-to-string (+ #xe000 i)) $tempMapPoints))
|
|
(save-excursion
|
|
(save-restriction
|
|
(narrow-to-region Begin End)
|
|
(dotimes (i (length Pairs))
|
|
(goto-char (point-min))
|
|
(while (search-forward (elt (elt Pairs i) 0) nil t)
|
|
(replace-match (elt $tempMapPoints i) t t)))
|
|
(dotimes (i (length Pairs))
|
|
(goto-char (point-min))
|
|
(while (search-forward (elt $tempMapPoints i) nil t)
|
|
(push (vector (point)
|
|
(elt (elt Pairs i) 0)
|
|
(elt (elt Pairs i) 1)) $changeLog)
|
|
(replace-match (elt (elt Pairs i) 1) t t)))))
|
|
$changeLog))
|
|
|
|
(defun al-bhed (*begin *end)
|
|
(interactive
|
|
(if (use-region-p)
|
|
(list (region-beginning) (region-end))
|
|
(list (line-beginning-position) (line-end-position))))
|
|
(replace-pairs-region
|
|
*begin
|
|
*end
|
|
'(
|
|
["a" "y"]
|
|
["b" "p"]
|
|
["c" "l"]
|
|
["d" "t"]
|
|
["e" "a"]
|
|
["f" "v"]
|
|
["g" "k"]
|
|
["h" "r"]
|
|
["i" "e"]
|
|
["j" "z"]
|
|
["k" "g"]
|
|
["l" "m"]
|
|
["m" "s"]
|
|
["n" "h"]
|
|
["o" "u"]
|
|
["p" "b"]
|
|
["q" "x"]
|
|
["r" "n"]
|
|
["s" "c"]
|
|
["t" "d"]
|
|
["u" "i"]
|
|
["v" "j"]
|
|
["w" "f"]
|
|
["x" "q"]
|
|
["y" "o"]
|
|
["z" "w"]
|
|
["A" "Y"]
|
|
["B" "P"]
|
|
["C" "L"]
|
|
["D" "T"]
|
|
["E" "A"]
|
|
["F" "V"]
|
|
["G" "K"]
|
|
["H" "R"]
|
|
["I" "E"]
|
|
["J" "Z"]
|
|
["K" "G"]
|
|
["L" "M"]
|
|
["M" "S"]
|
|
["N" "H"]
|
|
["O" "U"]
|
|
["P" "B"]
|
|
["Q" "X"]
|
|
["R" "N"]
|
|
["S" "C"]
|
|
["T" "D"]
|
|
["U" "I"]
|
|
["V" "J"]
|
|
["W" "F"]
|
|
["X" "Q"]
|
|
["Y" "O"]
|
|
["Z" "W"])))
|
|
|
|
(defun de-al-bhed (*begin *end)
|
|
(interactive
|
|
(if (use-region-p)
|
|
(list (region-beginning) (region-end))
|
|
(list (line-beginning-position) (line-end-position))))
|
|
(replace-pairs-region
|
|
*begin
|
|
*end
|
|
'(
|
|
["y" "a"]
|
|
["p" "b"]
|
|
["l" "c"]
|
|
["t" "d"]
|
|
["a" "e"]
|
|
["v" "f"]
|
|
["k" "g"]
|
|
["r" "h"]
|
|
["e" "i"]
|
|
["z" "j"]
|
|
["g" "k"]
|
|
["m" "l"]
|
|
["s" "m"]
|
|
["h" "n"]
|
|
["u" "o"]
|
|
["b" "p"]
|
|
["x" "q"]
|
|
["n" "r"]
|
|
["c" "s"]
|
|
["d" "t"]
|
|
["i" "u"]
|
|
["j" "v"]
|
|
["f" "w"]
|
|
["q" "x"]
|
|
["o" "y"]
|
|
["w" "z"]
|
|
["Y" "A"]
|
|
["P" "B"]
|
|
["L" "C"]
|
|
["T" "D"]
|
|
["A" "E"]
|
|
["V" "F"]
|
|
["K" "G"]
|
|
["R" "H"]
|
|
["E" "I"]
|
|
["Z" "J"]
|
|
["G" "K"]
|
|
["M" "L"]
|
|
["S" "M"]
|
|
["H" "N"]
|
|
["U" "O"]
|
|
["B" "P"]
|
|
["X" "Q"]
|
|
["N" "R"]
|
|
["C" "S"]
|
|
["D" "T"]
|
|
["I" "U"]
|
|
["J" "V"]
|
|
["F" "W"]
|
|
["Q" "X"]
|
|
["O" "Y"]
|
|
["W" "Z"])))
|
|
|
|
(defun redact (*begin *end)
|
|
(interactive
|
|
(if (use-region-p)
|
|
(list (region-beginning) (region-end))
|
|
(list (line-beginning-position) (line-end-position))))
|
|
(replace-pairs-region
|
|
*begin
|
|
*end
|
|
'(
|
|
["a" "x"]
|
|
["b" "x"]
|
|
["c" "x"]
|
|
["d" "x"]
|
|
["e" "x"]
|
|
["f" "x"]
|
|
["g" "x"]
|
|
["h" "x"]
|
|
["i" "x"]
|
|
["j" "x"]
|
|
["k" "x"]
|
|
["l" "x"]
|
|
["m" "x"]
|
|
["n" "x"]
|
|
["o" "x"]
|
|
["p" "x"]
|
|
["q" "x"]
|
|
["r" "x"]
|
|
["s" "x"]
|
|
["t" "x"]
|
|
["u" "x"]
|
|
["v" "x"]
|
|
["w" "x"]
|
|
["x" "x"]
|
|
["y" "x"]
|
|
["z" "x"]
|
|
["A" "x"]
|
|
["B" "x"]
|
|
["C" "x"]
|
|
["D" "x"]
|
|
["E" "x"]
|
|
["F" "x"]
|
|
["G" "x"]
|
|
["H" "x"]
|
|
["I" "x"]
|
|
["J" "x"]
|
|
["K" "x"]
|
|
["L" "x"]
|
|
["M" "x"]
|
|
["N" "x"]
|
|
["O" "x"]
|
|
["P" "x"]
|
|
["Q" "x"]
|
|
["R" "x"]
|
|
["S" "x"]
|
|
["T" "x"]
|
|
["U" "x"]
|
|
["V" "x"]
|
|
["W" "x"]
|
|
["X" "x"]
|
|
["Y" "x"]
|
|
["Z" "x"])))
|