1 ;;; footnote.el --- Footnote support for message mode -*- coding: iso-latin-1;-*-
3 ;; Copyright (C) 1997, 2000 by Free Software Foundation, Inc.
5 ;; Author: Steven L Baur <steve@xemacs.org>
6 ;; Keywords: mail, news
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 ;; This file provides footnote[1] support for message-mode in emacsen.
29 ;; footnote-mode is implemented as a minor mode.
31 ;; [1] Footnotes look something like this. Along with some decorative
35 ;; Reasonable Undo support.
36 ;; more language styles.
42 (defvar filladapt-token-table
))
44 (defgroup footnote nil
45 "Support for footnotes in mail and news messages."
49 (defcustom footnote-mode-line-string
" FN"
50 "*String to display in modes section of the mode-line."
53 (defcustom footnote-mode-hook nil
54 "*Hook functions run when footnote-mode is activated."
58 (defcustom footnote-narrow-to-footnotes-when-editing nil
59 "*If set, narrow to footnote text body while editing a footnote."
63 (defcustom footnote-prompt-before-deletion t
64 "*If set, prompt before deleting a footnote.
65 There is currently no way to undo deletions."
69 (defcustom footnote-spaced-footnotes t
70 "If set true it will put a blank line between each footnote.
71 If nil, no blank line will be inserted."
75 (defcustom footnote-use-message-mode t
76 "*If non-nil assume Footnoting will be done in message-mode."
80 (defcustom footnote-body-tag-spacing
2
81 "*Number of blanks separating a footnote body tag and its text."
85 (defvar footnote-prefix
[(control ?c
) ?
!]
86 "*When not using message mode, the prefix to bind in `mode-specific-map'")
88 ;;; Interface variables that probably shouldn't be changed
90 (defconst footnote-section-tag
"Footnotes: "
91 "*Tag inserted at beginning of footnote section.")
93 (defcustom footnote-section-tag-regexp
"Footnotes\\(\\[.\\]\\)?: "
94 "*Regexp which indicates the start of a footnote section.
95 See also `footnote-section-tag'."
99 ;; The following three should be consumed by footnote styles.
100 (defcustom footnote-start-tag
"["
101 "*String used to denote start of numbered footnote."
105 (defcustom footnote-end-tag
"]"
106 "*String used to denote end of numbered footnote."
110 (defvar footnote-signature-separator
(if (boundp 'message-signature-separator
)
111 message-signature-separator
113 "*String used to recognize .signatures.")
115 ;;; Private variables
117 (defvar footnote-style-number nil
118 "Footnote style represented as an index into footnote-style-alist.")
119 (make-variable-buffer-local 'footnote-style-number
)
121 (defvar footnote-text-marker-alist nil
122 "List of markers pointing to text of footnotes in message buffer.")
123 (make-variable-buffer-local 'footnote-text-marker-alist
)
125 (defvar footnote-pointer-marker-alist nil
126 "List of markers pointing to footnote pointers in message buffer.")
127 (make-variable-buffer-local 'footnote-pointer-marker-alist
)
129 (defvar footnote-mouse-highlight
'highlight
130 "Text property name to enable mouse over highlight.")
132 (defvar footnote-mode nil
133 "Variable indicating whether footnote minor mode is active.")
134 (make-variable-buffer-local 'footnote-mode
)
138 (defconst footnote-numeric-regexp
"[0-9]"
139 "Regexp for digits.")
141 (defun Footnote-numeric (n)
142 "Numeric footnote style.
143 Use Arabic numerals for footnoting."
147 (defconst footnote-english-upper
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
148 "Upper case English alphabet.")
150 (defconst footnote-english-upper-regexp
"[A-Z]"
151 "Regexp for upper case English alphabet.")
153 (defun Footnote-english-upper (n)
154 "Upper case English footnoting.
155 Wrapping around the alphabet implies successive repetitions of letters."
156 (let* ((ltr (mod (1- n
) (length footnote-english-upper
)))
157 (rep (/ (1- n
) (length footnote-english-upper
)))
158 (chr (char-to-string (aref footnote-english-upper ltr
)))
161 (setq rc
(concat rc chr
))
166 (defconst footnote-english-lower
"abcdefghijklmnopqrstuvwxyz"
167 "Lower case English alphabet.")
169 (defconst footnote-english-lower-regexp
"[a-z]"
170 "Regexp of lower case English alphabet.")
172 (defun Footnote-english-lower (n)
173 "Lower case English footnoting.
174 Wrapping around the alphabet implies successive repetitions of letters."
175 (let* ((ltr (mod (1- n
) (length footnote-english-lower
)))
176 (rep (/ (1- n
) (length footnote-english-lower
)))
177 (chr (char-to-string (aref footnote-english-lower ltr
)))
180 (setq rc
(concat rc chr
))
185 (defconst footnote-roman-lower-list
186 '((1 .
"i") (5 .
"v") (10 .
"x")
187 (50 .
"l") (100 .
"c") (500 .
"d") (1000 .
"m"))
188 "List of roman numerals with their values.")
190 (defconst footnote-roman-lower-regexp
"[ivxlcdm]"
191 "Regexp of roman numerals.")
193 (defun Footnote-roman-lower (n)
194 "Generic Roman number footnoting."
195 (Footnote-roman-common n footnote-roman-lower-list
))
198 (defconst footnote-roman-upper-list
199 '((1 .
"I") (5 .
"V") (10 .
"X")
200 (50 .
"L") (100 .
"C") (500 .
"D") (1000 .
"M"))
201 "List of roman numerals with their values.")
203 (defconst footnote-roman-upper-regexp
"[IVXLCDM]"
204 "Regexp of roman numerals. Not complete")
206 (defun Footnote-roman-upper (n)
207 "Generic Roman number footnoting."
208 (Footnote-roman-common n footnote-roman-upper-list
))
210 (defun Footnote-roman-common (n footnote-roman-list
)
211 "Lower case Roman footnoting."
212 (let* ((our-list footnote-roman-list
)
213 (rom-lngth (length our-list
))
219 ;; find surrounding numbers
220 (while (and (<= count-high
(1- rom-lngth
))
221 (>= n
(car (nth count-high our-list
))))
222 ;; (message "Checking %d" (car (nth count-high our-list)))
223 (setq count-high
(1+ count-high
)))
224 (setq rom-high count-high
)
225 (setq rom-low
(1- count-high
))
226 ;; find the appropriate divisor (if it exists)
227 (while (and (= rom-div -
1)
228 (< count-low rom-high
))
229 (when (or (> n
(- (car (nth rom-high our-list
))
230 (/ (car (nth count-low our-list
))
232 (= n
(- (car (nth rom-high our-list
))
233 (car (nth count-low our-list
)))))
234 (setq rom-div count-low
))
235 ;; (message "Checking %d and %d in div loop" rom-high count-low)
236 (setq count-low
(1+ count-low
)))
237 ;;(message "We now have high: %d, low: %d, div: %d, n: %d"
238 ;; rom-high rom-low (if rom-div rom-div -1) n)
239 (let ((rom-low-pair (nth rom-low our-list
))
240 (rom-high-pair (nth rom-high our-list
))
241 (rom-div-pair (if (not (= rom-div -
1)) (nth rom-div our-list
) nil
)))
242 ;; (message "pairs are: rom-low: %S, rom-high: %S, rom-div: %S"
243 ;; rom-low-pair rom-high-pair rom-div-pair)
245 ((< n
0) (error "Footnote-roman-common called with n < 0"))
247 ((= n
(car rom-low-pair
)) (cdr rom-low-pair
))
248 ((= n
(car rom-high-pair
)) (cdr rom-high-pair
))
249 ((= (car rom-low-pair
) (car rom-high-pair
))
250 (concat (cdr rom-low-pair
)
251 (Footnote-roman-common
252 (- n
(car rom-low-pair
))
253 footnote-roman-list
)))
254 ((>= rom-div
0) (concat (cdr rom-div-pair
) (cdr rom-high-pair
)
255 (Footnote-roman-common
256 (- n
(- (car rom-high-pair
)
258 footnote-roman-list
)))
259 (t (concat (cdr rom-low-pair
)
260 (Footnote-roman-common
261 (- n
(car rom-low-pair
))
262 footnote-roman-list
)))))))
266 (defconst footnote-latin-regexp
"¹²³ºª§¶"
267 "Regexp for Latin-1 footnoting characters.")
269 (defun Footnote-latin (n)
270 "Latin-1 footnote style.
271 Use a range of Latin-1 non-ASCII characters for footnoting."
272 (string (aref footnote-latin-regexp
273 (mod (1- n
) (length footnote-latin-regexp
)))))
275 ;;; list of all footnote styles
276 (defvar footnote-style-alist
277 `((numeric Footnote-numeric
,footnote-numeric-regexp
)
278 (english-lower Footnote-english-lower
,footnote-english-lower-regexp
)
279 (english-upper Footnote-english-upper
,footnote-english-upper-regexp
)
280 (roman-lower Footnote-roman-lower
,footnote-roman-lower-regexp
)
281 (roman-upper Footnote-roman-upper
,footnote-roman-upper-regexp
)
282 (latin Footnote-latin
,footnote-latin-regexp
))
283 "Styles of footnote tags available.
284 By default only boring Arabic numbers, English letters and Roman Numerals
286 See footnote-han.el, footnote-greek.el and footnote-hebrew.el for more
289 (defcustom footnote-style
'numeric
290 "*Style used for footnoting.
291 numeric == 1, 2, 3, ...
292 english-lower == a, b, c, ...
293 english-upper == A, B, C, ...
294 roman-lower == i, ii, iii, iv, v, ...
295 roman-upper == I, II, III, IV, V, ...
296 latin == ¹ ² ³ º ª § ¶
297 See also variables `footnote-start-tag' and `footnote-end-tag'."
298 :type
(cons 'choice
(mapcar (lambda (x) (list 'const
(car x
)))
299 footnote-style-alist
))
302 ;;; Style utilities & functions
303 (defun Footnote-style-p (style)
304 "Return non-nil if style is a valid style known to footnote-mode."
305 (assq style footnote-style-alist
))
307 (defun Footnote-index-to-string (index)
308 "Convert a binary index into a string to display as a footnote.
309 Conversion is done based upon the current selected style."
310 (let ((alist (if (Footnote-style-p footnote-style
)
311 (assq footnote-style footnote-style-alist
)
312 (nth 0 footnote-style-alist
))))
313 (funcall (nth 1 alist
) index
)))
315 (defun Footnote-current-regexp ()
316 "Return the regexp of the index of the current style."
317 (concat (nth 2 (or (assq footnote-style footnote-style-alist
)
318 (nth 0 footnote-style-alist
))) "*"))
320 (defun Footnote-refresh-footnotes (&optional index-regexp
)
321 "Redraw all footnotes.
322 You must call this or arrange to have this called after changing footnote
325 (setq index-regexp
(Footnote-current-regexp)))
327 ;; Take care of the pointers first
328 (let ((i 0) locn alist
)
329 (while (setq alist
(nth i footnote-pointer-marker-alist
))
330 (setq locn
(cdr alist
))
332 (goto-char (car locn
))
333 (search-backward footnote-start-tag nil t
)
334 (when (looking-at (concat
335 (regexp-quote footnote-start-tag
)
336 "\\(" index-regexp
"\\)"
337 (regexp-quote footnote-end-tag
)))
338 (replace-match (concat
340 (Footnote-index-to-string (1+ i
))
343 (setq locn
(cdr locn
)))
346 ;; Now take care of the text section
348 (while (setq alist
(nth i footnote-text-marker-alist
))
349 (goto-char (cdr alist
))
350 (when (looking-at (concat
351 (regexp-quote footnote-start-tag
)
352 "\\(" index-regexp
"\\)"
353 (regexp-quote footnote-end-tag
)))
354 (replace-match (concat
356 (Footnote-index-to-string (1+ i
))
361 (defun Footnote-assoc-index (key alist
)
362 "Give index of key in alist."
363 (let ((i 0) (max (length alist
)) rc
)
364 (while (and (null rc
)
366 (when (eq key
(car (nth i alist
)))
371 (defun Footnote-cycle-style ()
372 "Select next defined footnote style."
374 (let ((old (Footnote-assoc-index footnote-style footnote-style-alist
))
375 (max (length footnote-style-alist
))
380 (setq footnote-style
(car (nth idx footnote-style-alist
)))
381 (Footnote-refresh-footnotes (nth 2 (nth old footnote-style-alist
)))))
383 (defun Footnote-set-style (&optional style
)
384 "Select a specific style."
386 (list (intern (completing-read
388 obarray
#'Footnote-style-p
'require-match
))))
389 (setq footnote-style style
))
391 ;; Internal functions
392 (defun Footnote-insert-numbered-footnote (arg &optional mousable
)
393 "Insert numbered footnote at (point)."
394 (let* ((start (point))
396 (insert-before-markers (concat footnote-start-tag
397 (Footnote-index-to-string arg
)
401 (add-text-properties start end
402 (list 'footnote-number arg
))
404 (add-text-properties start end
405 (list footnote-mouse-highlight t
)))))
407 (defun Footnote-renumber (from to pointer-alist text-alist
)
408 "Renumber a single footnote."
409 (let* ((posn-list (cdr pointer-alist
)))
410 (setcar pointer-alist to
)
411 (setcar text-alist to
)
413 (goto-char (car posn-list
))
414 (search-backward footnote-start-tag nil t
)
415 (when (looking-at (format "%s%s%s"
416 (regexp-quote footnote-start-tag
)
417 (Footnote-current-regexp)
418 (regexp-quote footnote-end-tag
)))
419 (add-text-properties (match-beginning 0) (match-end 0)
420 (list 'footnote-number to
))
421 (replace-match (format "%s%s%s"
423 (Footnote-index-to-string to
)
425 (setq posn-list
(cdr posn-list
)))
426 (goto-char (cdr text-alist
))
427 (when (looking-at (format "%s%s%s"
428 (regexp-quote footnote-start-tag
)
429 (Footnote-current-regexp)
430 (regexp-quote footnote-end-tag
)))
431 (add-text-properties (match-beginning 0) (match-end 0)
432 (list 'footnote-number to
))
433 (replace-match (format "%s%s%s"
435 (Footnote-index-to-string to
)
436 footnote-end-tag
) nil t
))))
439 (defun Footnote-narrow-to-footnotes ()
440 "Restrict text in buffer to show only text of footnotes."
441 (interactive) ; testing
442 (goto-char (point-max))
443 (when (re-search-backward footnote-signature-separator nil t
)
445 (when (re-search-backward (concat "^" footnote-section-tag-regexp
) nil t
)
446 (narrow-to-region (point) end
)))))
448 (defun Footnote-goto-char-point-max ()
449 "Move to end of buffer or prior to start of .signature."
450 (goto-char (point-max))
451 (or (re-search-backward footnote-signature-separator nil t
)
454 (defun Footnote-insert-text-marker (arg locn
)
455 "Insert a marker pointing to footnote arg, at buffer location locn."
456 (let ((marker (make-marker)))
457 (unless (assq arg footnote-text-marker-alist
)
458 (set-marker marker locn
)
459 (setq footnote-text-marker-alist
460 (cons (cons arg marker
) footnote-text-marker-alist
))
461 (setq footnote-text-marker-alist
462 (Footnote-sort footnote-text-marker-alist
)))))
464 (defun Footnote-insert-pointer-marker (arg locn
)
465 "Insert a marker pointing to footnote arg, at buffer location locn."
466 (let ((marker (make-marker))
468 (set-marker marker locn
)
469 (if (setq alist
(assq arg footnote-pointer-marker-alist
))
471 (cons marker
(cdr alist
)))
472 (setq footnote-pointer-marker-alist
473 (cons (cons arg
(list marker
)) footnote-pointer-marker-alist
))
474 (setq footnote-pointer-marker-alist
475 (Footnote-sort footnote-pointer-marker-alist
)))))
477 (defun Footnote-insert-footnote (arg)
478 "Insert a footnote numbered arg, at (point)."
480 (Footnote-insert-pointer-marker arg
(point))
481 (Footnote-insert-numbered-footnote arg t
)
482 (Footnote-goto-char-point-max)
483 (if (re-search-backward (concat "^" footnote-section-tag-regexp
) nil t
)
485 (when footnote-narrow-to-footnotes-when-editing
486 (Footnote-narrow-to-footnotes))
487 (Footnote-goto-footnote (1- arg
)) ; evil, FIXME (less evil now)
488 ;; (message "Inserting footnote %d" arg)
491 (when (re-search-forward
492 (if footnote-spaced-footnotes
495 (regexp-quote footnote-start-tag
)
496 (Footnote-current-regexp)
497 (regexp-quote footnote-end-tag
)))
499 (unless (beginning-of-line) t
))
500 (goto-char (point-max)))))
501 (unless (looking-at "^$")
505 (insert footnote-section-tag
"\n"))
506 (let ((old-point (point)))
507 (Footnote-insert-numbered-footnote arg nil
)
508 (Footnote-insert-text-marker arg old-point
)))
510 (defun Footnote-sort (list)
511 (sort list
(lambda (e1 e2
)
512 (< (car e1
) (car e2
)))))
514 (defun Footnote-text-under-cursor ()
515 "Return the number of footnote if in footnote text.
516 Nil is returned if the cursor is not positioned over the text of
518 (when (and (let ((old-point (point)))
521 (Footnote-narrow-to-footnotes)
522 (and (>= old-point
(point-min))
523 (<= old-point
(point-max))))))
524 (>= (point) (cdar footnote-text-marker-alist
)))
527 (while (and (setq alist-txt
(nth i footnote-text-marker-alist
))
529 (when (< (point) (cdr alist-txt
))
530 (setq rc
(car (nth (1- i
) footnote-text-marker-alist
))))
534 (setq rc
(car (nth (1- i
) footnote-text-marker-alist
))))
537 (defun Footnote-under-cursor ()
538 "Return the number of the footnote underneath the cursor.
539 Nil is returned if the cursor is not over a footnote."
540 (or (get-text-property (point) 'footnote-number
)
541 (Footnote-text-under-cursor)))
545 (defun Footnote-make-hole ()
548 (notes (length footnote-pointer-marker-alist
))
549 alist-ptr alist-txt rc
)
551 (setq alist-ptr
(nth i footnote-pointer-marker-alist
))
552 (setq alist-txt
(nth i footnote-text-marker-alist
))
553 (when (< (point) (- (cadr alist-ptr
) 3))
555 (setq rc
(car alist-ptr
)))
557 (message "Renumbering from %s to %s"
558 (Footnote-index-to-string (car alist-ptr
))
559 (Footnote-index-to-string
560 (1+ (car alist-ptr
))))
561 (Footnote-renumber (car alist-ptr
)
568 (defun Footnote-add-footnote (&optional arg
)
569 "Add a numbered footnote.
570 The number the footnote receives is dependent upon the relative location
571 of any other previously existing footnotes.
572 If the variable `footnote-narrow-to-footnotes-when-editing' is set,
573 the buffer is narrowed to the footnote body. The restriction is removed
574 by using `Footnote-back-to-message'."
577 (if footnote-text-marker-alist
578 (if (< (point) (cadar (last footnote-pointer-marker-alist
)))
579 (setq num
(Footnote-make-hole))
580 (setq num
(1+ (caar (last footnote-text-marker-alist
)))))
582 (message "Adding footnote %d" num
)
583 (Footnote-insert-footnote num
)
584 (insert-before-markers (make-string footnote-body-tag-spacing ?
))
585 (let ((opoint (point)))
587 (insert-before-markers
588 (if footnote-spaced-footnotes
591 (when footnote-narrow-to-footnotes-when-editing
592 (Footnote-narrow-to-footnotes)))
593 ;; Emacs/XEmacs bug? save-excursion doesn't restore point when using
594 ;; insert-before-markers.
595 (goto-char opoint
))))
597 (defun Footnote-delete-footnote (&optional arg
)
598 "Delete a numbered footnote.
599 With no parameter, delete the footnote under (point). With arg specified,
600 delete the footnote with that number."
603 (setq arg
(Footnote-under-cursor)))
605 (or (not footnote-prompt-before-deletion
)
606 (y-or-n-p (format "Really delete footnote %d?" arg
))))
607 (let (alist-ptr alist-txt locn
)
608 (setq alist-ptr
(assq arg footnote-pointer-marker-alist
))
609 (setq alist-txt
(assq arg footnote-text-marker-alist
))
610 (unless (and alist-ptr alist-txt
)
611 (error "Can't delete footnote %d" arg
))
612 (setq locn
(cdr alist-ptr
))
615 (goto-char (car locn
))
617 (start (search-backward footnote-start-tag nil t
)))
618 (kill-region start end
)))
619 (setq locn
(cdr locn
)))
621 (goto-char (cdr alist-txt
))
622 (kill-region (point) (search-forward "\n\n" nil t
)))
623 (setq footnote-pointer-marker-alist
624 (delq alist-ptr footnote-pointer-marker-alist
))
625 (setq footnote-text-marker-alist
626 (delq alist-txt footnote-text-marker-alist
))
627 (Footnote-renumber-footnotes)
628 (when (and (null footnote-text-marker-alist
)
629 (null footnote-pointer-marker-alist
))
631 (let* ((end (Footnote-goto-char-point-max))
632 (start (1- (re-search-backward
633 (concat "^" footnote-section-tag-regexp
)
636 (when (looking-at "\n")
638 (kill-region start
(if (< end
(point-max))
642 (defun Footnote-renumber-footnotes (&optional arg
)
643 "Renumber footnotes, starting from 1."
647 (notes (length footnote-pointer-marker-alist
))
650 (setq alist-ptr
(nth i footnote-pointer-marker-alist
))
651 (setq alist-txt
(nth i footnote-text-marker-alist
))
652 (unless (eq (1+ i
) (car alist-ptr
))
653 (Footnote-renumber (car alist-ptr
) (1+ i
) alist-ptr alist-txt
))
656 (defun Footnote-goto-footnote (&optional arg
)
657 "Jump to the text of a footnote.
658 With no parameter, jump to the text of the footnote under (point). With arg
659 specified, jump to the text of that footnote."
663 (setq footnote
(assq arg footnote-text-marker-alist
))
664 (when (setq arg
(Footnote-under-cursor))
665 (setq footnote
(assq arg footnote-text-marker-alist
))))
667 (goto-char (cdr footnote
))
670 (goto-char (point-max))
671 (re-search-backward (concat "^" footnote-section-tag-regexp
))
673 (error "I don't see a footnote here.")))))
675 (defun Footnote-back-to-message (&optional arg
)
676 "Move cursor back to footnote referent.
677 If the cursor is not over the text of a footnote, point is not changed.
678 If the buffer was narrowed due to `footnote-narrow-to-footnotes-when-editing'
679 being set it is automatically widened."
681 (let ((note (Footnote-text-under-cursor)))
683 (when footnote-narrow-to-footnotes-when-editing
685 (goto-char (cadr (assq note footnote-pointer-marker-alist
))))))
687 (defvar footnote-mode-map nil
688 "Keymap used for footnote minor mode.")
691 (unless footnote-mode-map
692 (setq footnote-mode-map
(make-sparse-keymap))
693 (define-key footnote-mode-map
"a" 'Footnote-add-footnote
)
694 (define-key footnote-mode-map
"b" 'Footnote-back-to-message
)
695 (define-key footnote-mode-map
"c" 'Footnote-cycle-style
)
696 (define-key footnote-mode-map
"d" 'Footnote-delete-footnote
)
697 (define-key footnote-mode-map
"g" 'Footnote-goto-footnote
)
698 (define-key footnote-mode-map
"r" 'Footnote-renumber-footnotes
)
699 (define-key footnote-mode-map
"s" 'Footnote-set-style
))
701 (defvar footnote-minor-mode-map nil
702 "Keymap used for binding footnote minor mode.")
704 (unless footnote-minor-mode-map
705 (define-key global-map footnote-prefix footnote-mode-map
))
708 (defun footnote-mode (&optional arg
)
709 "Toggle footnote minor mode.
714 \\[Footnote-renumber-footnotes] Footnote-renumber-footnotes
715 \\[Footnote-goto-footnote] Footnote-goto-footnote
716 \\[Footnote-delete-footnote] Footnote-delete-footnote
717 \\[Footnote-cycle-style] Footnote-cycle-style
718 \\[Footnote-back-to-message] Footnote-back-to-message
719 \\[Footnote-add-footnote] Footnote-add-footnote
722 ;; (filladapt-mode t)
724 (if (null arg
) (not footnote-mode
)
725 (> (prefix-numeric-value arg
) 0)))
727 ;; (Footnote-setup-keybindings)
728 (make-local-variable 'footnote-style
)
729 (if (fboundp 'force-mode-line-update
)
730 (force-mode-line-update)
731 (set-buffer-modified-p (buffer-modified-p)))
733 (when (boundp 'filladapt-token-table
)
734 ;; add tokens to filladapt to match footnotes
735 ;; 1] xxxxxxxxxxx x x x or [1] x x x x x x x
736 ;; xxx x xx xxx xxxx x x x xxxxxxxxxx
737 (let ((bullet-regexp (concat (regexp-quote footnote-start-tag
)
739 (regexp-quote footnote-end-tag
)
741 (unless (assoc bullet-regexp filladapt-token-table
)
742 (setq filladapt-token-table
743 (append filladapt-token-table
744 (list (list bullet-regexp
'bullet
)))))))
746 (run-hooks 'footnote-mode-hook
)))
748 (unless (assq 'footnote-mode minor-mode-alist
)
749 (setq minor-mode-alist
750 (cons '(footnote-mode footnote-mode-line-string
)
755 ;;; footnote.el ends here