Use regexp-opt to define bibtex-autokey-transcriptions. (Bug#39686)

This commit is contained in:
Roland Winkler 2020-03-06 09:37:55 +01:00
parent 3f9c340de0
commit cb1877321b

View file

@ -1006,32 +1006,36 @@ See `bibtex-generate-autokey' for details."
:type 'boolean) :type 'boolean)
(defvar bibtex-autokey-transcriptions (defvar bibtex-autokey-transcriptions
'(;; language specific characters (nconc
("\\\\aa" . "a") ; \aa -> a (mapcar (lambda (a) (cons (regexp-opt (car a)) (cdr a)))
("\\\\AA" . "A") ; \AA -> A '(;; language specific characters
("\\\"a\\|\\\\\\\"a\\|\\\\ae" . "ae") ; "a,\"a,\ae -> ae (("\\aa") . "a") ; \aa -> a
("\\\"A\\|\\\\\\\"A\\|\\\\AE" . "Ae") ; "A,\"A,\AE -> Ae (("\\AA") . "A") ; \AA -> A
("\\\\i" . "i") ; \i -> i (("\"a" "\\\"a" "\\ae") . "ae") ; "a,\"a,\ae -> ae
("\\\\j" . "j") ; \j -> j (("\"A" "\\\"A" "\\AE") . "Ae") ; "A,\"A,\AE -> Ae
("\\\\l" . "l") ; \l -> l (("\\i") . "i") ; \i -> i
("\\\\L" . "L") ; \L -> L (("\\j") . "j") ; \j -> j
("\\\"o\\|\\\\\\\"o\\|\\\\o\\|\\\\oe" . "oe") ; "o,\"o,\o,\oe -> oe (("\\l") . "l") ; \l -> l
("\\\"O\\|\\\\\\\"O\\|\\\\O\\|\\\\OE" . "Oe") ; "O,\"O,\O,\OE -> Oe (("\\L") . "L") ; \L -> L
("\\\"s\\|\\\\\\\"s\\|\\\\3" . "ss") ; "s,\"s,\3 -> ss (("\"o" "\\\"o" "\\o" "\\oe") . "oe") ; "o,\"o,\o,\oe -> oe
("\\\"u\\|\\\\\\\"u" . "ue") ; "u,\"u -> ue (("\"O" "\\\"O" "\\O" "\\OE") . "Oe") ; "O,\"O,\O,\OE -> Oe
("\\\"U\\|\\\\\\\"U" . "Ue") ; "U,\"U -> Ue (("\"s" "\\\"s" "\\3") . "ss") ; "s,\"s,\3 -> ss
;; accents (("\"u" "\\\"u") . "ue") ; "u,\"u -> ue
("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" . "") (("\"U" "\\\"U") . "Ue") ; "U,\"U -> Ue
;; braces, quotes, concatenation. ;; hyphen, accents
("[`'\"{}#]" . "") (("\\-" "\\`" "\\'" "\\^" "\\~" "\\=" "\\." "\\u" "\\v"
("\\\\-" . "") ; \- -> "\\H" "\\t" "\\c" "\\d" "\\b") . "")
;; spaces ;; space
("\\\\?[ \t\n]+\\|~" . " ")) (("~") . " ")))
;; more spaces
'(("[\s\t\n]*\\(?:\\\\\\)?[\s\t\n]+" . " ")
;; braces, quotes, concatenation.
("[`'\"{}#]" . "")))
"Alist of (OLD-REGEXP . NEW-STRING) pairs. "Alist of (OLD-REGEXP . NEW-STRING) pairs.
Used by the default values of `bibtex-autokey-name-change-strings' and Used as default values of `bibtex-autokey-name-change-strings' and
`bibtex-autokey-titleword-change-strings'. Defaults to translating some `bibtex-autokey-titleword-change-strings'. Defaults to translating some
language specific characters to their ASCII transcriptions, and language specific characters to their ASCII transcriptions, and
removing any character accents.") removing any accent characters.")
(defcustom bibtex-autokey-name-change-strings (defcustom bibtex-autokey-name-change-strings
bibtex-autokey-transcriptions bibtex-autokey-transcriptions