branch: master commit b6ac53b667b8a057db0f31a6348ca373338b9561 Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
* packages/math-symbol-lists/msl-build.el: Add copyright and license While I was there I also fixed the following: Use lexical-binding. Require cl-lib since it's used, and stop using `cl`. Fix namespace to always start with "msl-". Wrap toplevel operations into a `defun` since files in `load-path` may be loaded gratuitously by Emacs. * packages/math-symbol-lists/math-symbol-lists.el: Update license address. --- packages/math-symbol-lists/math-symbol-lists.el | 11 ++-- packages/math-symbol-lists/msl-build.el | 67 +++++++++++++++++-------- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/packages/math-symbol-lists/math-symbol-lists.el b/packages/math-symbol-lists/math-symbol-lists.el index 1a37854..26c432a 100644 --- a/packages/math-symbol-lists/math-symbol-lists.el +++ b/packages/math-symbol-lists/math-symbol-lists.el @@ -21,9 +21,7 @@ ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth -;; Floor, Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @@ -2835,6 +2833,11 @@ AucTeX/latex.el, but it doesn't include AMS symbols. See also ("mathunder" "\\underbrace" 9183 "⏟") ("mathunder" "\\underbracket" 9141 "⎵") ("mathunder" "\\underparen" 9181 "⏝")) + ;; FIXME: Describe the expected shape of the contents (i.e. a list of + ;; 4-tuples, but I'm not sure what those 4 elements mean: + ;; - why is the first a string rather than a symbol? + ;; - What's the difference between the 3rd and the 4th (other than: one is + ;; a char and the other is a single-char string)? "Extended list of mathematical symbols. This list does not include about 190 of the standard LaTeX math commands in `math-symbol-list-basic' because of the conflicting @@ -3566,7 +3569,7 @@ names between latex and unicode-math standard.") "Mathematical symbols from various LaTeX packages. Each element is of the form - (package class command unicode symbol conflict) + (PACKAGE CLASS COMMAND UNICODE SYMBOL CONFLICT) CONFLICT is a Boolean that indicates that this command conflicts or generates different symbol from math-unicode package. Thus the diff --git a/packages/math-symbol-lists/msl-build.el b/packages/math-symbol-lists/msl-build.el index 202c4bd..63c9fd4 100644 --- a/packages/math-symbol-lists/msl-build.el +++ b/packages/math-symbol-lists/msl-build.el @@ -1,6 +1,29 @@ -;; functions to build symbol lists +;;; msl-build.el --- functions to build symbol lists -*- lexical-binding:t -*- -(require 'cl) +;; Copyright (C) 2019 Free Software Foundation, Inc. + +;; Author: Vitalie Spinu <spinu...@gmail.com> + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'cl-lib) ;; IMPORT UTILITIES ;; @@ -58,7 +81,7 @@ If LATEX is non-nil, give package and latex command instead of unicode-math command. If ALIAS is non-nil give package and latex command from alias field. " - (flet ((code (el) (if no-parse (car el) (string-to-number (car el) 16)))) + (cl-flet ((code (el) (if no-parse (car el) (string-to-number (car el) 16)))) (let ((sl (delq nil (cond (latex (mapcan (lambda (el) @@ -100,28 +123,27 @@ command from alias field. " el)) list))) -;; this is how you build those -(setq tt (msl--LUCR-read-file "./data/unimathsymbols.txt")) - -;; extra aliases for basic symbols -(setq tt2 (msl--LUCR-filter-LaTeX-aliases tt)) -(msl--LUCR-to-msl tt2 nil t) +;; this is how you build those +(defun msl--build-things () + (let* ((tt (msl--LUCR-read-file "./data/unimathsymbols.txt")) + ;; extra aliases for basic symbols + (tt2 (msl--LUCR-filter-LaTeX-aliases tt))) + (msl--LUCR-to-msl tt2 nil t) -;; extended -(msl--LUCR-to-msl tt) -;; packages -(msl--LUCR-to-msl tt t) -;; aliases -(msl--LUCR-to-msl tt nil t) + ;; extended + (msl--LUCR-to-msl tt) + ;; packages + (msl--LUCR-to-msl tt t) + ;; aliases + (msl--LUCR-to-msl tt nil t))) ;; SUBSCRIPTS and SUPERSCRIPTS -(defvar subscripts ) -(defvar superscripts "ⱽª²³¹ºʰʱʲʳʴʵʶʷʸˠˡˢˣᴬᴭᴮᴯᴰᴱᴲᴳᴴᴵᴶᴷᴸᴹᴺᴻᴼᴽᴾᴿᵀᵁᵂᵃᵄᵅᵆᵇᵈᵉᵊᵋᵌᵍᵎᵏᵐᵑᵒᵓᵔᵕᵖᵗᵘᵙᵚᵛᵜᵝᵞᵟᵠᵡᵸᶛᶜᶝᶞᶟᶠᶡᶢᶣᶤᶥᶦᶧᶨᶩᶪᶫᶬᶭᶮᶯᶰᶱᶲᶳᶴᶵᶶᶷᶸᶹᶺᶻᶼᶽᶾᶿ⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ") +(defvar msl-superscripts "ⱽª²³¹ºʰʱʲʳʴʵʶʷʸˠˡˢˣᴬᴭᴮᴯᴰᴱᴲᴳᴴᴵᴶᴷᴸᴹᴺᴻᴼᴽᴾᴿᵀᵁᵂᵃᵄᵅᵆᵇᵈᵉᵊᵋᵌᵍᵎᵏᵐᵑᵒᵓᵔᵕᵖᵗᵘᵙᵚᵛᵜᵝᵞᵟᵠᵡᵸᶛᶜᶝᶞᶟᶠᶡᶢᶣᶤᶥᶦᶧᶨᶩᶪᶫᶬᶭᶮᶯᶰᶱᶲᶳᶴᶵᶶᶷᶸᶹᶺᶻᶼᶽᶾᶿ⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ") ;; taken from https://github.com/tpapp/company-unicode-subsuper/blob/master/company-unicode-subsuper.el -(defconst unicode-name-table +(defconst msl-unicode-name-table '((?β . "beta") (?γ . "gamma") (?δ . "delta") @@ -133,13 +155,14 @@ command from alias field. " (?− . "-")) ; replace #x2212 with minus sign "table for entering characters outside the ASCII range. Follows conventions of LaTeX for Greek letters, but without the \\ prefix.") -(defun gen-scirpted-alist (char-str type prefix) +(defun msl-gen-scripted-alist (char-str type prefix) (mapcar (lambda (c) (let* ((dec (cdr (get-char-code-property c 'decomposition))) - (plain (or (cdr (assoc (car dec) unicode-name-table)) dec))) + (plain (or (cdr (assoc (car dec) msl-unicode-name-table)) dec))) (list type (concat prefix plain) c (char-to-string c)))) char-str)) -(gen-scirpted-alist "₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ" "subscript" "_") -(gen-scirpted-alist "⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁⱽᵂᵝᵞᵟᶿᶥᵠᵡ" "superscripts" "^") +(msl-gen-scripted-alist "₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ" "subscript" "_") +(msl-gen-scripted-alist "⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁⱽᵂᵝᵞᵟᶿᶥᵠᵡ" "superscripts" "^") +;;; msl-build.el ends here