aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2011-05-10 16:20:21 +0800
committerLeo Liu2011-05-10 16:20:21 +0800
commitb40448691347ceef93c4bba74a623c61fcbc19a1 (patch)
treedf8c445aaead1109afb332fa57a0d4c12fe20526
parent9e2dd53f1654b39fd8b9732e57fd29b913988ecc (diff)
downloademacs-b40448691347ceef93c4bba74a623c61fcbc19a1.tar.gz
emacs-b40448691347ceef93c4bba74a623c61fcbc19a1.zip
Add a new footnote style unicode
See also the discussion thread in: http://thread.gmane.org/gmane.emacs.devel/139221
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/mail/footnote.el26
2 files changed, 29 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 07a39ea8302..927a3256c84 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,10 @@
12011-05-10 Leo Liu <sdl.web@gmail.com> 12011-05-10 Leo Liu <sdl.web@gmail.com>
2 2
3 * mail/footnote.el: Convert to utf-8 encoding. 3 * mail/footnote.el: Convert to utf-8 encoding.
4 (footnote-unicode-string, footnote-unicode-regexp): New variable.
5 (Footnote-unicode): New function.
6 (footnote-style-alist): Add unicode style to the list.
7 (footnote-style): Doc fix.
4 8
52011-05-10 Glenn Morris <rgm@gnu.org> 92011-05-10 Glenn Morris <rgm@gnu.org>
6 Stefan Monnier <monnier@iro.umontreal.ca> 10 Stefan Monnier <monnier@iro.umontreal.ca>
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index c225e4263a8..8dac3be0e5f 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -291,6 +291,25 @@ Use a range of Latin-1 non-ASCII characters for footnoting."
291 (string (aref footnote-latin-string 291 (string (aref footnote-latin-string
292 (mod (1- n) (length footnote-latin-string))))) 292 (mod (1- n) (length footnote-latin-string)))))
293 293
294;; Unicode
295
296(defconst footnote-unicode-string "⁰¹²³⁴⁵⁶⁷⁸⁹"
297 "String of unicode footnoting characters.")
298
299(defconst footnote-unicode-regexp (concat "[" footnote-unicode-string "]+")
300 "Regexp for unicode footnoting characters.")
301
302(defun Footnote-unicode (n)
303 "Unicode footnote style.
304Use unicode characters for footnoting."
305 (let (modulus result done)
306 (while (not done)
307 (setq modulus (mod n 10)
308 n (truncate n 10))
309 (and (zerop n) (setq done t))
310 (push (aref footnote-unicode-string modulus) result))
311 (apply #'string result)))
312
294;;; list of all footnote styles 313;;; list of all footnote styles
295(defvar footnote-style-alist 314(defvar footnote-style-alist
296 `((numeric Footnote-numeric ,footnote-numeric-regexp) 315 `((numeric Footnote-numeric ,footnote-numeric-regexp)
@@ -298,7 +317,8 @@ Use a range of Latin-1 non-ASCII characters for footnoting."
298 (english-upper Footnote-english-upper ,footnote-english-upper-regexp) 317 (english-upper Footnote-english-upper ,footnote-english-upper-regexp)
299 (roman-lower Footnote-roman-lower ,footnote-roman-lower-regexp) 318 (roman-lower Footnote-roman-lower ,footnote-roman-lower-regexp)
300 (roman-upper Footnote-roman-upper ,footnote-roman-upper-regexp) 319 (roman-upper Footnote-roman-upper ,footnote-roman-upper-regexp)
301 (latin Footnote-latin ,footnote-latin-regexp)) 320 (latin Footnote-latin ,footnote-latin-regexp)
321 (unicode Footnote-unicode ,footnote-unicode-regexp))
302 "Styles of footnote tags available. 322 "Styles of footnote tags available.
303By default only boring Arabic numbers, English letters and Roman Numerals 323By default only boring Arabic numbers, English letters and Roman Numerals
304are available. 324are available.
@@ -313,8 +333,12 @@ english-upper == A, B, C, ...
313roman-lower == i, ii, iii, iv, v, ... 333roman-lower == i, ii, iii, iv, v, ...
314roman-upper == I, II, III, IV, V, ... 334roman-upper == I, II, III, IV, V, ...
315latin == ¹ ² ³ º ª § ¶ 335latin == ¹ ² ³ º ª § ¶
336unicode == ¹, ², ³, ...
316See also variables `footnote-start-tag' and `footnote-end-tag'. 337See also variables `footnote-start-tag' and `footnote-end-tag'.
317 338
339Note: some characters in the unicode style may not show up
340properly if the default font does not contain those characters.
341
318Customizing this variable has no effect on buffers already 342Customizing this variable has no effect on buffers already
319displaying footnotes. To change the style of footnotes in such a 343displaying footnotes. To change the style of footnotes in such a
320buffer use the command `Footnote-set-style'." 344buffer use the command `Footnote-set-style'."