From: Andreas Roehler <andreas.roehler@easy-emacs.de>
To: "Stephen J. Turnbull" <stephen@xemacs.org>
Cc: martin rudalics <rudalics@gmx.at>, Richard Stallman <rms@gnu.org>,
emacs-devel <emacs-devel@gnu.org>
Subject: Re: footnote-style latin doesn't renumber
Date: Wed, 18 Apr 2007 10:56:55 +0200 [thread overview]
Message-ID: <4625DD57.40007@easy-emacs.de> (raw)
In-Reply-To: <87ejmirwym.fsf@uwakimon.sk.tsukuba.ac.jp>
Stephen J. Turnbull schrieb:
> Andreas Roehler writes:
>
> > BTW Is footnote.el at the right place in /mail? IMO
> > it's a text-mode.
>
> Historically it was developed for use with MUAs. It's clearly a
> "minor" mode, but it conflicts with almost all interesting text major
> modes because they are used to edit formats that provide their own
> footnoting capabilities. Thus, "mail". YMMV, of course, but the case
> for moving it seems pretty weak to me.
>
>
As it's available with text-mode, it's no important question.
Below a new footnote-init.el: Bugs fixed which
occurred if `footnote-init' was called with buffer
without footnotes.
Have a nice day.
Andreas Roehler
;;; footnote-init.el --- Reads in existing footnotes
;; Version 1.1
;; Copyright (C) 2007 Andreas Roehler
;; Author: Andreas Roehler <andreas.roehler@easy-emacs.de>
;; Keywords: wp, mail, news
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary: Provides a `footnote-init' usable as
;;; footnote-mode-hook, which reads in existing
;;; footnodes. Customize `footnote-mode-hook' with this
;;; function should do the right thing when switching
;;; footnote-mode on.
;; Changes to previous version: Bugs fixed which
;; occurred if `footnote-init' was called with buffer
;; without footnotes.
;;; Code:
(require 'footnote)
(defvar footnote-regexp nil
"`footnote-regexp' in effect after `footnote-init' is called
Possible values are defined in footnote-style-alist:
`footnote-numeric-regexp', footnote-english-lower-regexp etc. ")
(defun footnote-init (&optional ispec)
"Let's footnote take notice of already existing footnotes"
(interactive "p")
(unless footnote-mode (footnote-mode))
(let ((documents-footnote-style (footnote-what-style ispec)))
(setq footnote-regexp (concat (nth 2 documents-footnote-style) "+"))
(footnote-init-markers t)
(Footnote-set-style (nth 0 documents-footnote-style))))
(defun footnote-what-style (&optional ispec)
"Returns style in effect according footnote-style-alist:
default is (numeric Footnote-numeric ,footnote-numeric-regexp)"
(interactive "p")
(let((length-fn-start-tag (length footnote-start-tag))
(length-fn-end-tag (length footnote-end-tag))
style-in-effect found)
(save-excursion
(goto-char (point-min))
(when
(search-forward footnote-start-tag nil t 1)
(goto-char (match-beginning 0))
(setq found (buffer-substring-no-properties (+ length-fn-start-tag
(point)) (- (re-search-forward footnote-end-tag (line-end-position) t 1)
length-fn-end-tag)))
(dolist (styles footnote-style-alist)
(when
(string-match (nth 2 styles) found)
(setq style-in-effect styles))))
(when ispec
(message "Footnote style in effect: %s" style-in-effect)))
style-in-effect))
(defun footnote-init-markers (&optional ispec)
" "
(interactive "p")
(save-excursion
(let ((count 0)
(footnote-section-tag-pos
(or
(search-forward footnote-section-tag nil t 1)
(re-search-forward footnote-section-tag-regexp nil t 1))))
(goto-char (point-min))
(when footnote-section-tag-pos
(while (re-search-forward (concat footnote-start-tag footnote-regexp
footnote-end-tag) footnote-section-tag-pos t 1)
(setq count (1+ count))
(Footnote-insert-pointer-marker count (point)))
(setq count 0)
(while (re-search-forward (concat footnote-start-tag footnote-regexp
footnote-end-tag) nil t 1)
(setq count (1+ count))
(Footnote-insert-text-marker count (point)))
(when ispec
(message "footnote-pointer-marker-alist:
%s\nfootnote-text-marker-alist: %s" footnote-pointer-marker-alist
footnote-text-marker-alist))
footnote-pointer-marker-alist
footnote-text-marker-alist))))
(provide 'footnote-init)
;;; footnote-init.el ends here
next prev parent reply other threads:[~2007-04-18 8:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 7:32 footnote-style latin doesn't renumber Andreas Roehler
2007-04-11 12:48 ` martin rudalics
2007-04-12 6:50 ` Andreas Roehler
2007-04-12 8:16 ` martin rudalics
2007-04-12 16:53 ` Andreas Roehler
2007-04-12 20:48 ` martin rudalics
2007-04-13 12:30 ` Andreas Roehler
2007-04-14 8:59 ` martin rudalics
2007-04-16 12:00 ` Andreas Roehler
2007-04-18 6:04 ` Andreas Roehler
2007-04-18 14:42 ` Chong Yidong
2007-04-19 10:17 ` Andreas Roehler
2007-04-18 6:06 ` Andreas Roehler
2007-04-18 6:57 ` Stephen J. Turnbull
2007-04-18 8:56 ` Andreas Roehler [this message]
2007-04-13 1:38 ` Stephen J. Turnbull
2007-04-13 12:13 ` Andreas Roehler
2007-04-13 1:41 ` Richard Stallman
2007-04-13 12:11 ` Andreas Roehler
2007-04-13 13:42 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4625DD57.40007@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--cc=emacs-devel@gnu.org \
--cc=rms@gnu.org \
--cc=rudalics@gmx.at \
--cc=stephen@xemacs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.