From d889e335e5587e1162cd2b4240c8239fabac4ce5 Mon Sep 17 00:00:00 2001 Date: Mon, 9 May 2011 12:22:13 +0800 Subject: [PATCH] Add a new footnote style `unicode' --- lisp/mail/footnote.el | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-) diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el index c9899ca7..dc967ec8 100644 --- a/lisp/mail/footnote.el +++ b/lisp/mail/footnote.el @@ -292,6 +292,25 @@ (defun Footnote-latin (n) (string (aref footnote-latin-string (mod (1- n) (length footnote-latin-string))))) +;; Unicode + +(defconst footnote-unicode-string "⁰¹²³⁴⁵⁶⁷⁸⁹" + "String of unicode footnoting characters.") + +(defconst footnote-unicode-regexp (concat "[" footnote-unicode-string "]+") + "Regexp for unicode footnoting characters.") + +(defun Footnote-unicode (n) + "Unicode footnote style. +Use unicode characters for footnoting." + (let (modulus result done) + (while (not done) + (setq modulus (mod n 10) + n (truncate n 10)) + (and (zerop n) (setq done t)) + (push (aref footnote-unicode-string modulus) result)) + (apply #'string result))) + ;;; list of all footnote styles (defvar footnote-style-alist `((numeric Footnote-numeric ,footnote-numeric-regexp) @@ -299,7 +318,8 @@ (defvar footnote-style-alist (english-upper Footnote-english-upper ,footnote-english-upper-regexp) (roman-lower Footnote-roman-lower ,footnote-roman-lower-regexp) (roman-upper Footnote-roman-upper ,footnote-roman-upper-regexp) - (latin Footnote-latin ,footnote-latin-regexp)) + (latin Footnote-latin ,footnote-latin-regexp) + (unicode Footnote-unicode ,footnote-unicode-regexp)) "Styles of footnote tags available. By default only boring Arabic numbers, English letters and Roman Numerals are available. @@ -314,6 +334,7 @@ (defcustom footnote-style 'numeric roman-lower == i, ii, iii, iv, v, ... roman-upper == I, II, III, IV, V, ... latin == ¹ ² ³ º ª § ¶ +unicode == ¹, ², ³, ... See also variables `footnote-start-tag' and `footnote-end-tag'. Customizing this variable has no effect on buffers already -- 1.7.5-rc2