aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2007-04-15 17:21:21 +0000
committerChong Yidong2007-04-15 17:21:21 +0000
commit3715ab231d69d2ee3c2339457edd1cdeb50f6d7a (patch)
treefccfb5a65e8350883cabdc8df1632127c6434a93
parent807707ad9e9f4b19710b97d6d77437f6e089185d (diff)
downloademacs-3715ab231d69d2ee3c2339457edd1cdeb50f6d7a.tar.gz
emacs-3715ab231d69d2ee3c2339457edd1cdeb50f6d7a.zip
(footnote-current-style): New var.
(Footnote-index-to-string, Footnote-current-regexp) (Footnote-cycle-style, Footnote-set-style): Use it instead of footnote-style. (footnote-mode): Make footnote-current style buffer-local instead of footnote-style, and initialize it to footnote-style. (footnote-style): Update docstring.
-rw-r--r--lisp/mail/footnote.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index 9e3a375c50d..2e10f1ec308 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -294,7 +294,7 @@ See footnote-han.el, footnote-greek.el and footnote-hebrew.el for more
294exciting styles.") 294exciting styles.")
295 295
296(defcustom footnote-style 'numeric 296(defcustom footnote-style 'numeric
297 "*Style used for footnoting. 297 "*Default style used for footnoting.
298numeric == 1, 2, 3, ... 298numeric == 1, 2, 3, ...
299english-lower == a, b, c, ... 299english-lower == a, b, c, ...
300english-upper == A, B, C, ... 300english-upper == A, B, C, ...
@@ -306,6 +306,10 @@ See also variables `footnote-start-tag' and `footnote-end-tag'."
306 footnote-style-alist)) 306 footnote-style-alist))
307 :group 'footnote) 307 :group 'footnote)
308 308
309(defvar footnote-current-style
310 "Style used for footnoting in the current buffer.
311The possible values are the same as in `footnote-style'.")
312
309;;; Style utilities & functions 313;;; Style utilities & functions
310(defun Footnote-style-p (style) 314(defun Footnote-style-p (style)
311 "Return non-nil if style is a valid style known to footnote-mode." 315 "Return non-nil if style is a valid style known to footnote-mode."
@@ -314,14 +318,14 @@ See also variables `footnote-start-tag' and `footnote-end-tag'."
314(defun Footnote-index-to-string (index) 318(defun Footnote-index-to-string (index)
315 "Convert a binary index into a string to display as a footnote. 319 "Convert a binary index into a string to display as a footnote.
316Conversion is done based upon the current selected style." 320Conversion is done based upon the current selected style."
317 (let ((alist (if (Footnote-style-p footnote-style) 321 (let ((alist (if (Footnote-style-p footnote-current-style)
318 (assq footnote-style footnote-style-alist) 322 (assq footnote-current-style footnote-style-alist)
319 (nth 0 footnote-style-alist)))) 323 (nth 0 footnote-style-alist))))
320 (funcall (nth 1 alist) index))) 324 (funcall (nth 1 alist) index)))
321 325
322(defun Footnote-current-regexp () 326(defun Footnote-current-regexp ()
323 "Return the regexp of the index of the current style." 327 "Return the regexp of the index of the current style."
324 (concat (nth 2 (or (assq footnote-style footnote-style-alist) 328 (concat (nth 2 (or (assq footnote-current-style footnote-style-alist)
325 (nth 0 footnote-style-alist))) "*")) 329 (nth 0 footnote-style-alist))) "*"))
326 330
327(defun Footnote-refresh-footnotes (&optional index-regexp) 331(defun Footnote-refresh-footnotes (&optional index-regexp)
@@ -378,13 +382,13 @@ styles."
378(defun Footnote-cycle-style () 382(defun Footnote-cycle-style ()
379 "Select next defined footnote style." 383 "Select next defined footnote style."
380 (interactive) 384 (interactive)
381 (let ((old (Footnote-assoc-index footnote-style footnote-style-alist)) 385 (let ((old (Footnote-assoc-index footnote-current-style footnote-style-alist))
382 (max (length footnote-style-alist)) 386 (max (length footnote-style-alist))
383 idx) 387 idx)
384 (setq idx (1+ old)) 388 (setq idx (1+ old))
385 (when (>= idx max) 389 (when (>= idx max)
386 (setq idx 0)) 390 (setq idx 0))
387 (setq footnote-style (car (nth idx footnote-style-alist))) 391 (setq footnote-current-style (car (nth idx footnote-style-alist)))
388 (Footnote-refresh-footnotes (nth 2 (nth old footnote-style-alist))))) 392 (Footnote-refresh-footnotes (nth 2 (nth old footnote-style-alist)))))
389 393
390(defun Footnote-set-style (&optional style) 394(defun Footnote-set-style (&optional style)
@@ -393,7 +397,7 @@ styles."
393 (list (intern (completing-read 397 (list (intern (completing-read
394 "Footnote Style: " 398 "Footnote Style: "
395 obarray #'Footnote-style-p 'require-match)))) 399 obarray #'Footnote-style-p 'require-match))))
396 (setq footnote-style style)) 400 (setq footnote-current-style style))
397 401
398;; Internal functions 402;; Internal functions
399(defun Footnote-insert-numbered-footnote (arg &optional mousable) 403(defun Footnote-insert-numbered-footnote (arg &optional mousable)
@@ -733,7 +737,7 @@ key binding
733 (> (prefix-numeric-value arg) 0))) 737 (> (prefix-numeric-value arg) 0)))
734 (when footnote-mode 738 (when footnote-mode
735 ;; (Footnote-setup-keybindings) 739 ;; (Footnote-setup-keybindings)
736 (make-local-variable 'footnote-style) 740 (set (make-local-variable 'footnote-current-style) footnote-style)
737 (if (fboundp 'force-mode-line-update) 741 (if (fboundp 'force-mode-line-update)
738 (force-mode-line-update) 742 (force-mode-line-update)
739 (set-buffer-modified-p (buffer-modified-p))) 743 (set-buffer-modified-p (buffer-modified-p)))