* Re: footnote-style latin doesn't renumber
2007-04-14 8:59 ` martin rudalics
@ 2007-04-16 12:00 ` Andreas Roehler
2007-04-18 6:04 ` Andreas Roehler
2007-04-18 6:06 ` Andreas Roehler
2 siblings, 0 replies; 20+ messages in thread
From: Andreas Roehler @ 2007-04-16 12:00 UTC (permalink / raw)
To: martin rudalics
Cc: Chong Yidong, Stephen J. Turnbull, Richard Stallman,
Stefan Monnier, emacs-devel
Herewith correct renumbering of already existing
footnotes should be possible. Footnote-init reads in existing
footnodes. Customize `footnote-mode-hook' with this
function should do the right thing when
footnote-mode is switched on.
Footnote-init.el needs a patched footnote.el.
This patch IMO is needed in any case, to get renumbering work so
far.
Patch below.
Andreas Roehler
BTW Is footnote.el at the right place in /mail? IMO
it's a text-mode.
*** footnote.el Mon Apr 16 10:03:44 2007
--- footnote.el Mon Apr 16 11:26:30 2007
***************
*** 360,365 ****
--- 360,368 ----
(let ((i 0) alist)
(while (setq alist (nth i footnote-text-marker-alist))
(goto-char (cdr alist))
+ ;; 2007-04-16 a.roehler@web.de changed section start
+ (search-backward footnote-start-tag nil t)
+ ;; 2007-04-16 a.roehler@web.de changed section end
(when (looking-at (concat
(regexp-quote footnote-start-tag)
"\\(" index-regexp "\\)"
***************
*** 437,442 ****
--- 440,448 ----
footnote-end-tag)))
(setq posn-list (cdr posn-list)))
(goto-char (cdr text-alist))
+ ;; 2007-04-16 a.roehler@web.de changed section start
+ (search-backward footnote-start-tag nil t)
+ ;; 2007-04-16 a.roehler@web.de changed section end
(when (looking-at (format "%s%s%s"
(regexp-quote footnote-start-tag)
(Footnote-current-regexp)
;;;;;;;;;;; patch ends here
;;; footnote-init.el --- Reads in existing footnotes
;; 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.
;;
;;; Code:
(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))
(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))
(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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: footnote-style latin doesn't renumber
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-18 6:06 ` Andreas Roehler
2 siblings, 1 reply; 20+ messages in thread
From: Andreas Roehler @ 2007-04-18 6:04 UTC (permalink / raw)
To: martin rudalics
Cc: Stephen J. Turnbull, emacs-devel, Eli Zaretskii, Richard Stallman
This message will be sent twice for testing. You may
savely discard one.
BTW: Don't see a need to keep footnote-init.el
separatly, probably it's more convenient to merge it
with footnote.el.
20070416-an-ed.txt
Herewith correct renumbering of already existing
footnotes should be possible. Footnote-init reads in existing
footnodes. Customize `footnote-mode-hook' with this
function should do the right thing when switching
footnote-mode on.
Footnote-init.el needs a patched footnote.el.
Patch is needed in any case, to get renumbering work so
far.
Patch below.
Andreas Roehler
BTW Is footnote.el at the right place in /mail? IMO
it's a text-mode.
*** footnote.el Mon Apr 16 10:03:44 2007
--- footnote.el Mon Apr 16 11:26:30 2007
***************
*** 360,365 ****
--- 360,368 ----
(let ((i 0) alist)
(while (setq alist (nth i footnote-text-marker-alist))
(goto-char (cdr alist))
+ ;; 2007-04-16 a.roehler@web.de changed section start
+ (search-backward footnote-start-tag nil t)
+ ;; 2007-04-16 a.roehler@web.de changed section end
(when (looking-at (concat
(regexp-quote footnote-start-tag)
"\\(" index-regexp "\\)"
***************
*** 437,442 ****
--- 440,448 ----
footnote-end-tag)))
(setq posn-list (cdr posn-list)))
(goto-char (cdr text-alist))
+ ;; 2007-04-16 a.roehler@web.de changed section start
+ (search-backward footnote-start-tag nil t)
+ ;; 2007-04-16 a.roehler@web.de changed section end
(when (looking-at (format "%s%s%s"
(regexp-quote footnote-start-tag)
(Footnote-current-regexp)
;;;;;;;;;;; patch ends here
;;; footnote-init.el --- Reads in existing footnotes
;; 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.
;;
;;; 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))
(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))
(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
martin rudalics schrieb:
> > After opening a buffer and inserting a first footnote I
> > changed via customize `footnote-style' from `numeric'
> > to `english-lower.'
> >
> > That's the way, user will proceed with some
> > probability, i.e. discovering after first footnote,
> > that the style is not convenient.
> >
> > C-h v ...
> >
> > footnote-style is a variable defined in `footnote.el'.
> > Its value is numeric
> > Local in buffer ein.txt; global value is english-lower
> >
> > Next insertion brought the following:
> >
> > [a]
> >
> > [1]
>
> This is contradictory: The local value is 'numeric and the "next
> insertion" produces an 'english-lower foontnote. Please try to
> reproduce that.
>
> >
> > Footnotes:
> > [a]
> > [1] asd
> >
> > IMHO that shows two errors:
> >
> > - style is not taken
>
> "style was taken", otherwise it would have inserted a number. However,
> style should _not_ have been "taken" just because you customized
> `footnote-style'.
>
> > - no renumbering
>
> It should have inserted another number with renumbering.
>
> >
> > Use of `Footnote-set-style' with the same buffer didn't
> > work correct either
> >
> > [B]
> > [a]
> > [D]
> > [1]
> > [F]
> > Footnotes:
> > [a]
> > [B]
> > [D]
> > [1] asd
> >
> > [F]
> > Once a footnote in a certain style inserted, your bound
> > to it presently.
>
> I assume you mean that you cannot change a footnote's style any more
> once you have inserted it in a buffer. That's a missing feature you
> could try to implement (ATR).
>
> > Remarkable beside here is the missing [C].
>
> I think some matching algorithm messes up case of footnotes here.
>
> > IMHO keeping `footnote-style' buffer-local from the
> > beginning isn't the right thing.
>
> What is "the beginning"?
>
> > It should be a global value basicly.
>
> It is.
>
> > When toggling footnode-mode, than mode should check,
> >
> > - if buffer contains footnotes in global style, then read them in,
> > update numbering
>
> Suppose your buffer contains text like
>
> ....... [1] ........ [1] ..........
>
> [1] footnote text
>
> You would have to decide which of the [1]s in the first line references
> the footnote (or print a warning about ambiguous references).
>
> > - if buffer contains footnotes in a not global style
> > then
> >
> > warn
> > make recognised style buffer local
>
> Yes.
>
> >
> > (or offer changing global value?)
>
> No.
>
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: footnote-style latin doesn't renumber
2007-04-18 6:04 ` Andreas Roehler
@ 2007-04-18 14:42 ` Chong Yidong
2007-04-19 10:17 ` Andreas Roehler
0 siblings, 1 reply; 20+ messages in thread
From: Chong Yidong @ 2007-04-18 14:42 UTC (permalink / raw)
To: Andreas Roehler
Cc: martin rudalics, Stephen J. Turnbull, Eli Zaretskii,
Richard Stallman, emacs-devel
Andreas Roehler <andreas.roehler@easy-emacs.de> writes:
> Herewith correct renumbering of already existing footnotes should be
> possible. Footnote-init reads in existing footnodes. Customize
> `footnote-mode-hook' with this function should do the right thing
> when switching footnote-mode on.
I think this will have to wait till after the release.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: footnote-style latin doesn't renumber
2007-04-18 14:42 ` Chong Yidong
@ 2007-04-19 10:17 ` Andreas Roehler
0 siblings, 0 replies; 20+ messages in thread
From: Andreas Roehler @ 2007-04-19 10:17 UTC (permalink / raw)
To: Chong Yidong
Cc: martin rudalics, Eli Zaretskii, Stephen J. Turnbull,
Richard Stallman, emacs-devel
Chong Yidong schrieb:
> Andreas Roehler <andreas.roehler@easy-emacs.de> writes:
>
>
>> Herewith correct renumbering of already existing footnotes should be
>> possible. Footnote-init reads in existing footnodes. Customize
>> `footnote-mode-hook' with this function should do the right thing
>> when switching footnote-mode on.
>>
>
> I think this will have to wait till after the release.
>
>
>
Please send a notice then or
take the last published version from gnu.emacs.sources, which will be
fixed as possible.
Thanks
Andreas Roehler
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: footnote-style latin doesn't renumber
2007-04-14 8:59 ` martin rudalics
2007-04-16 12:00 ` Andreas Roehler
2007-04-18 6:04 ` Andreas Roehler
@ 2007-04-18 6:06 ` Andreas Roehler
2007-04-18 6:57 ` Stephen J. Turnbull
2 siblings, 1 reply; 20+ messages in thread
From: Andreas Roehler @ 2007-04-18 6:06 UTC (permalink / raw)
To: martin rudalics; +Cc: Eli Zaretskii, Richard Stallman, emacs-devel
This message will be sent twice for testing. You may
savely discard one.
BTW: Don't see a need to keep footnote-init.el
separatly, probably it's more convenient to merge it
with footnote.el.
20070416-an-ed.txt
Herewith correct renumbering of already existing
footnotes should be possible. Footnote-init reads in existing
footnodes. Customize `footnote-mode-hook' with this
function should do the right thing when switching
footnote-mode on.
Footnote-init.el needs a patched footnote.el.
Patch is needed in any case, to get renumbering work so
far.
Patch below.
Andreas Roehler
BTW Is footnote.el at the right place in /mail? IMO
it's a text-mode.
*** footnote.el Mon Apr 16 10:03:44 2007
--- footnote.el Mon Apr 16 11:26:30 2007
***************
*** 360,365 ****
--- 360,368 ----
(let ((i 0) alist)
(while (setq alist (nth i footnote-text-marker-alist))
(goto-char (cdr alist))
+ ;; 2007-04-16 a.roehler@web.de changed section start
+ (search-backward footnote-start-tag nil t)
+ ;; 2007-04-16 a.roehler@web.de changed section end
(when (looking-at (concat
(regexp-quote footnote-start-tag)
"\\(" index-regexp "\\)"
***************
*** 437,442 ****
--- 440,448 ----
footnote-end-tag)))
(setq posn-list (cdr posn-list)))
(goto-char (cdr text-alist))
+ ;; 2007-04-16 a.roehler@web.de changed section start
+ (search-backward footnote-start-tag nil t)
+ ;; 2007-04-16 a.roehler@web.de changed section end
(when (looking-at (format "%s%s%s"
(regexp-quote footnote-start-tag)
(Footnote-current-regexp)
;;;;;;;;;;; patch ends here
;;; footnote-init.el --- Reads in existing footnotes
;; 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.
;;
;;; 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))
(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))
(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
martin rudalics schrieb:
> > After opening a buffer and inserting a first footnote I
> > changed via customize `footnote-style' from `numeric'
> > to `english-lower.'
> >
> > That's the way, user will proceed with some
> > probability, i.e. discovering after first footnote,
> > that the style is not convenient.
> >
> > C-h v ...
> >
> > footnote-style is a variable defined in `footnote.el'.
> > Its value is numeric
> > Local in buffer ein.txt; global value is english-lower
> >
> > Next insertion brought the following:
> >
> > [a]
> >
> > [1]
>
> This is contradictory: The local value is 'numeric and the "next
> insertion" produces an 'english-lower foontnote. Please try to
> reproduce that.
>
> >
> > Footnotes:
> > [a]
> > [1] asd
> >
> > IMHO that shows two errors:
> >
> > - style is not taken
>
> "style was taken", otherwise it would have inserted a number. However,
> style should _not_ have been "taken" just because you customized
> `footnote-style'.
>
> > - no renumbering
>
> It should have inserted another number with renumbering.
>
> >
> > Use of `Footnote-set-style' with the same buffer didn't
> > work correct either
> >
> > [B]
> > [a]
> > [D]
> > [1]
> > [F]
> > Footnotes:
> > [a]
> > [B]
> > [D]
> > [1] asd
> >
> > [F]
> > Once a footnote in a certain style inserted, your bound
> > to it presently.
>
> I assume you mean that you cannot change a footnote's style any more
> once you have inserted it in a buffer. That's a missing feature you
> could try to implement (ATR).
>
> > Remarkable beside here is the missing [C].
>
> I think some matching algorithm messes up case of footnotes here.
>
> > IMHO keeping `footnote-style' buffer-local from the
> > beginning isn't the right thing.
>
> What is "the beginning"?
>
> > It should be a global value basicly.
>
> It is.
>
> > When toggling footnode-mode, than mode should check,
> >
> > - if buffer contains footnotes in global style, then read them in,
> > update numbering
>
> Suppose your buffer contains text like
>
> ....... [1] ........ [1] ..........
>
> [1] footnote text
>
> You would have to decide which of the [1]s in the first line references
> the footnote (or print a warning about ambiguous references).
>
> > - if buffer contains footnotes in a not global style
> > then
> >
> > warn
> > make recognised style buffer local
>
> Yes.
>
> >
> > (or offer changing global value?)
>
> No.
>
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
>
martin rudalics schrieb:
> > After opening a buffer and inserting a first footnote I
> > changed via customize `footnote-style' from `numeric'
> > to `english-lower.'
> >
> > That's the way, user will proceed with some
> > probability, i.e. discovering after first footnote,
> > that the style is not convenient.
> >
> > C-h v ...
> >
> > footnote-style is a variable defined in `footnote.el'.
> > Its value is numeric
> > Local in buffer ein.txt; global value is english-lower
> >
> > Next insertion brought the following:
> >
> > [a]
> >
> > [1]
>
> This is contradictory: The local value is 'numeric and the "next
> insertion" produces an 'english-lower foontnote. Please try to
> reproduce that.
>
> >
> > Footnotes:
> > [a]
> > [1] asd
> >
> > IMHO that shows two errors:
> >
> > - style is not taken
>
> "style was taken", otherwise it would have inserted a number. However,
> style should _not_ have been "taken" just because you customized
> `footnote-style'.
>
> > - no renumbering
>
> It should have inserted another number with renumbering.
>
> >
> > Use of `Footnote-set-style' with the same buffer didn't
> > work correct either
> >
> > [B]
> > [a]
> > [D]
> > [1]
> > [F]
> > Footnotes:
> > [a]
> > [B]
> > [D]
> > [1] asd
> >
> > [F]
> > Once a footnote in a certain style inserted, your bound
> > to it presently.
>
> I assume you mean that you cannot change a footnote's style any more
> once you have inserted it in a buffer. That's a missing feature you
> could try to implement (ATR).
>
> > Remarkable beside here is the missing [C].
>
> I think some matching algorithm messes up case of footnotes here.
>
> > IMHO keeping `footnote-style' buffer-local from the
> > beginning isn't the right thing.
>
> What is "the beginning"?
>
> > It should be a global value basicly.
>
> It is.
>
> > When toggling footnode-mode, than mode should check,
> >
> > - if buffer contains footnotes in global style, then read them in,
> > update numbering
>
> Suppose your buffer contains text like
>
> ....... [1] ........ [1] ..........
>
> [1] footnote text
>
> You would have to decide which of the [1]s in the first line references
> the footnote (or print a warning about ambiguous references).
>
> > - if buffer contains footnotes in a not global style
> > then
> >
> > warn
> > make recognised style buffer local
>
> Yes.
>
> >
> > (or offer changing global value?)
>
> No.
>
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: footnote-style latin doesn't renumber
2007-04-18 6:06 ` Andreas Roehler
@ 2007-04-18 6:57 ` Stephen J. Turnbull
2007-04-18 8:56 ` Andreas Roehler
0 siblings, 1 reply; 20+ messages in thread
From: Stephen J. Turnbull @ 2007-04-18 6:57 UTC (permalink / raw)
To: Andreas Roehler
Cc: martin rudalics, Eli Zaretskii, Richard Stallman, emacs-devel
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.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: footnote-style latin doesn't renumber
2007-04-18 6:57 ` Stephen J. Turnbull
@ 2007-04-18 8:56 ` Andreas Roehler
0 siblings, 0 replies; 20+ messages in thread
From: Andreas Roehler @ 2007-04-18 8:56 UTC (permalink / raw)
To: Stephen J. Turnbull; +Cc: martin rudalics, Richard Stallman, emacs-devel
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
^ permalink raw reply [flat|nested] 20+ messages in thread