diff options
| author | Leo Liu | 2011-05-10 16:20:21 +0800 |
|---|---|---|
| committer | Leo Liu | 2011-05-10 16:20:21 +0800 |
| commit | b40448691347ceef93c4bba74a623c61fcbc19a1 (patch) | |
| tree | df8c445aaead1109afb332fa57a0d4c12fe20526 | |
| parent | 9e2dd53f1654b39fd8b9732e57fd29b913988ecc (diff) | |
| download | emacs-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/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/mail/footnote.el | 26 |
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 @@ | |||
| 1 | 2011-05-10 Leo Liu <sdl.web@gmail.com> | 1 | 2011-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 | ||
| 5 | 2011-05-10 Glenn Morris <rgm@gnu.org> | 9 | 2011-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. | ||
| 304 | Use 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. |
| 303 | By default only boring Arabic numbers, English letters and Roman Numerals | 323 | By default only boring Arabic numbers, English letters and Roman Numerals |
| 304 | are available. | 324 | are available. |
| @@ -313,8 +333,12 @@ english-upper == A, B, C, ... | |||
| 313 | roman-lower == i, ii, iii, iv, v, ... | 333 | roman-lower == i, ii, iii, iv, v, ... |
| 314 | roman-upper == I, II, III, IV, V, ... | 334 | roman-upper == I, II, III, IV, V, ... |
| 315 | latin == ¹ ² ³ º ª § ¶ | 335 | latin == ¹ ² ³ º ª § ¶ |
| 336 | unicode == ¹, ², ³, ... | ||
| 316 | See also variables `footnote-start-tag' and `footnote-end-tag'. | 337 | See also variables `footnote-start-tag' and `footnote-end-tag'. |
| 317 | 338 | ||
| 339 | Note: some characters in the unicode style may not show up | ||
| 340 | properly if the default font does not contain those characters. | ||
| 341 | |||
| 318 | Customizing this variable has no effect on buffers already | 342 | Customizing this variable has no effect on buffers already |
| 319 | displaying footnotes. To change the style of footnotes in such a | 343 | displaying footnotes. To change the style of footnotes in such a |
| 320 | buffer use the command `Footnote-set-style'." | 344 | buffer use the command `Footnote-set-style'." |