Optimize +prog-ligatures-alist
But preserve regexp-opt forms for users who want to contribute.
This commit is contained in:
parent
8f4684a69b
commit
bc0477c3ba
1 changed files with 28 additions and 28 deletions
|
@ -51,34 +51,34 @@ besides what is listed.")
|
||||||
|
|
||||||
;;; Automatic font-specific ligatures
|
;;; Automatic font-specific ligatures
|
||||||
(defvar +prog-ligatures-alist
|
(defvar +prog-ligatures-alist
|
||||||
(eval-when-compile
|
'((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)") ; (regexp-opt '("!!" "!=" "!=="))
|
||||||
`((?! . ,(regexp-opt '("!!" "!=" "!==")))
|
(?# . "\\(?:#\\(?:###?\\|_(\\|[#(:=?[_{]\\)\\)") ; (regexp-opt '("##" "###" "####" "#(" "#:" "#=" "#?" "#[" "#_" "#_(" "#{"))
|
||||||
(?# . ,(regexp-opt '("##" "###" "####" "#(" "#:" "#=" "#?" "#[" "#_" "#_(" "#{")))
|
(?$ . "\\(?:\\$>>?\\)") ; (regexp-opt '("$>" "$>>"))
|
||||||
(?$ . ,(regexp-opt '("$>" "$>>")))
|
(?% . "\\(?:%%%?\\)") ; (regexp-opt '("%%" "%%%"))
|
||||||
(?% . ,(regexp-opt '("%%" "%%%")))
|
(?& . "\\(?:&&&?\\)") ; (regexp-opt '("&&" "&&&"))
|
||||||
(?& . ,(regexp-opt '("&&" "&&&")))
|
(?* . "\\(?:\\*\\(?:\\*[*/]\\|[)*/>]\\)?\\)") ; (regexp-opt '("*" "**" "***" "**/" "*/" "*>" "*)"))
|
||||||
(?* . ,(regexp-opt '("*" "**" "***" "**/" "*/" "*>" "*)")))
|
(?+ . "\\(?:\\+\\(?:\\+\\+\\|[+:>]\\)?\\)") ; (regexp-opt '("+" "++" "+++" "+>" "+:"))
|
||||||
(?+ . ,(regexp-opt '("+" "++" "+++" "+>" "+:")))
|
(?- . "\\(?:-\\(?:-\\(?:->\\|[>-]\\)\\|<[<-]\\|>[>-]\\|[:<>|}~-]\\)\\)") ; (regexp-opt '("--" "---" "-->" "--->" "->-" "-<" "-<-" "-<<" "->" "->>" "-}" "-~" "-:" "-|"))
|
||||||
(?- . ,(regexp-opt '("--" "---" "-->" "--->" "->-" "-<" "-<-" "-<<" "->" "->>" "-}" "-~" "-:" "-|")))
|
(?. . "\\(?:\\.\\(?:\\.[.<]\\|[.=>-]\\)\\)") ; (regexp-opt '(".-" ".." "..." "..<" ".=" ".>"))
|
||||||
(?. . ,(regexp-opt '(".-" ".." "..." "..<" ".=" ".>")))
|
(?/ . "\\(?:/\\(?:\\*\\*\\|//\\|==\\|[*/=>]\\)\\)") ; (regexp-opt '("/*" "/**" "//" "///" "/=" "/==" "/>"))
|
||||||
(?/ . ,(regexp-opt '("/*" "/**" "//" "///" "/=" "/==" "/>")))
|
(?: . "\\(?::\\(?:::\\|[+:<=>]\\)?\\)") ; (regexp-opt '(":" "::" ":::" ":=" ":<" ":=" ":>" ":+"))
|
||||||
(?: . ,(regexp-opt '(":" "::" ":::" ":=" ":<" ":=" ":>" ":+")))
|
(?\; . ";;") ; (regexp-opt '(";;"))
|
||||||
(?0 . "0\\(?:\\(x[a-fA-F0-9]\\).?\\)") ; Tries to match the x in 0xDEADBEEF
|
(?0 . "0\\(?:\\(x[a-fA-F0-9]\\).?\\)") ; Tries to match the x in 0xDEADBEEF
|
||||||
;; (?x . ,(regexp-opt '("x"))) ; Also tries to match the x in 0xDEADBEEF
|
;; (?x . "x") ; Also tries to match the x in 0xDEADBEEF
|
||||||
(?\; . ,(regexp-opt '(";;")))
|
;; (regexp-opt '("<!--" "<$" "<$>" "<*" "<*>" "<**>" "<+" "<+>" "<-" "<--" "<---" "<->" "<-->" "<--->" "</" "</>" "<<" "<<-" "<<<" "<<=" "<=" "<=<" "<==" "<=>" "<===>" "<>" "<|" "<|>" "<~" "<~~" "<." "<.>" "<..>"))
|
||||||
(?< . ,(regexp-opt '("<!--" "<$" "<$>" "<*" "<*>" "<**>" "<+" "<+>" "<-" "<--" "<---" "<->" "<-->" "<--->" "</" "</>" "<<" "<<-" "<<<" "<<=" "<=" "<=<" "<==" "<=>" "<===>" "<>" "<|" "<|>" "<~" "<~~" "<." "<.>" "<..>")))
|
(?< . "\\(?:<\\(?:!--\\|\\$>\\|\\*\\(?:\\*?>\\)\\|\\+>\\|-\\(?:-\\(?:->\\|[>-]\\)\\|[>-]\\)\\|\\.\\(?:\\.?>\\)\\|/>\\|<[<=-]\\|=\\(?:==>\\|[<=>]\\)\\||>\\|~~\\|[$*+./<=>|~-]\\)\\)")
|
||||||
(?= . ,(regexp-opt '("=/=" "=:=" "=<<" "==" "===" "==>" "=>" "=>>")))
|
(?= . "\\(?:=\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\|[=>]\\)\\)") ; (regexp-opt '("=/=" "=:=" "=<<" "==" "===" "==>" "=>" "=>>"))
|
||||||
(?> . ,(regexp-opt '(">-" ">->" ">:" ">=" ">=>" ">>" ">>-" ">>=" ">>>")))
|
(?> . "\\(?:>\\(?:->\\|=>\\|>[=>-]\\|[:=>-]\\)\\)") ; (regexp-opt '(">-" ">->" ">:" ">=" ">=>" ">>" ">>-" ">>=" ">>>"))
|
||||||
(?? . ,(regexp-opt '("??" "?." "?:" "?=")))
|
(?? . "\\(?:\\?[.:=?]\\)") ; (regexp-opt '("??" "?." "?:" "?="))
|
||||||
(?\[ . ,(regexp-opt '("[]" "[|]" "[|")))
|
(?\[ . "\\(?:\\[\\(?:|]\\|[]|]\\)\\)") ; (regexp-opt '("[]" "[|]" "[|"))
|
||||||
(?\\ . ,(regexp-opt '("\\\\" "\\\\\\" "\\\\n")))
|
(?\\ . "\\(?:\\\\\\\\[\\n]?\\)") ; (regexp-opt '("\\\\" "\\\\\\" "\\\\n"))
|
||||||
(?^ . ,(regexp-opt '("^=" "^==")))
|
(?^ . "\\(?:\\^==?\\)") ; (regexp-opt '("^=" "^=="))
|
||||||
(?w . ,(regexp-opt '("www" "wwww")))
|
(?w . "\\(?:wwww?\\)") ; (regexp-opt '("www" "wwww"))
|
||||||
(?{ . ,(regexp-opt '("{-" "{|" "{||" "{|}" "{||}")))
|
(?{ . "\\(?:{\\(?:|\\(?:|}\\|[|}]\\)\\|[|-]\\)\\)") ; (regexp-opt '("{-" "{|" "{||" "{|}" "{||}"))
|
||||||
(?| . ,(regexp-opt '("|=" "|>" "||" "||=" "|->" "|=>" "|]" "|}" "|-")))
|
(?| . "\\(?:|\\(?:->\\|=>\\||=\\|[]=>|}-]\\)\\)") ; (regexp-opt '("|=" "|>" "||" "||=" "|->" "|=>" "|]" "|}" "|-"))
|
||||||
(?_ . ,(regexp-opt '("_|_" "__")))
|
(?_ . "\\(?:_\\(?:|?_\\)\\)") ; (regexp-opt '("_|_" "__"))
|
||||||
(?\( . ,(regexp-opt '("(*")))
|
(?\( . "\\(?:(\\*\\)") ; (regexp-opt '("(*"))
|
||||||
(?~ . ,(regexp-opt '("~-" "~=" "~>" "~@" "~~" "~~>")))))
|
(?~ . "\\(?:~\\(?:~>\\|[=>@~-]\\)\\)")) ; (regexp-opt '("~-" "~=" "~>" "~@" "~~" "~~>"))
|
||||||
"An alist of all ligatures used by `+prog-ligatures-modes'.
|
"An alist of all ligatures used by `+prog-ligatures-modes'.
|
||||||
|
|
||||||
The car is the character ASCII number, cdr is a regex which will call
|
The car is the character ASCII number, cdr is a regex which will call
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue