unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* footnote-style latin  doesn't renumber
@ 2007-04-11  7:32 Andreas Roehler
  2007-04-11 12:48 ` martin rudalics
  0 siblings, 1 reply; 20+ messages in thread
From: Andreas Roehler @ 2007-04-11  7:32 UTC (permalink / raw)
  To: emacs-devel


Hi,

AFAIS `footnote' doesn't renumber

if footnote-style is customised as "latin", whereas
with "numeric" it does.

Is the setting

(defconst footnote-latin-regexp "¹²³ºª§¶"
...

correct?

Below an example text, the second footnote was inserted
last, the third footnoted should be renumbered, but isn't:

ads[¹]f


as[²]df


as[²]df

Footnotes:
[¹]  foo

[²]  baz

[²]  bar


In GNU Emacs 22.0.97.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2007-04-05 on kiste

Suse 10.0

Windowing system distributor `The X.Org Foundation', version 11.0.60802000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
C-x C-f p r o g <tab> e i m <backspace> <backspace>
m a c s / e i n . e m l <return> M-x m e s s a g e
- m o <tab> <return> M-x f o o t n o <tab> <return>
M-x e r a d a <backspace> <backspace> s a <backspace>
e - b <tab> <return> y <help-echo> a r f <return> <return>
a s d f <return> <return> a s d f <up> <up> <up> <up>
<left> C-c ! a f o o <up> <up> <up> <up> <up> <down>
<down> <left> <left> C-c ! a b a r <up> <up> <up> <up>
<up> <up> <up> <left> <left> C-c ! a b a z <f8> C-x
k <return> y e s <return> C-x C-f <up> <return> M-x
e r a s e - b <tab> <return> M-x c u s t o <tab> -
v a r <tab> <return> f o o t n o <tab> s t y <tab>
<return> <down-mouse-1> <help-echo> <help-echo> <help-echo>
<help-echo> <down-mouse-1> <mouse-1> <help-echo> M-+
C-x b <return> a d s f <return> <return> <return> a
s d f <return> <return> <return> a s d f <up> <up>
<up> <up> <up> <up> <left> C-c ! a f o o <up> <up>
<up> <left> <left> C-c ! a b a r <up> <up> <up> <up>
<up> <up> <up> <up> <left> <left> C-c ! a b a z C-x
C-w <M-backspace> <M-backspace> t e x t e / <return>
M-x r e p o r t - e m a c s - b u g <return>

Recent messages:
Mark set
Adding footnote 2
Mark set
Renumbering from ² to ³
Adding footnote 2
Mark set
Wrote /home/speck/texte/ein.eml
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  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
  0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2007-04-11 12:48 UTC (permalink / raw)
  To: Andreas Roehler; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

Thanks for the precise report.

> Is the setting
> 
> (defconst footnote-latin-regexp "¹²³ºª§¶"
> ...
> 
> correct?

No.  Please try the attached patch.  If my mailer mangles the
characters try to set them by hand (I renamed footnote-latin-regexp
to footnote-latin-string and defined footnote-latin-regexp anew).




[-- Attachment #2: footnote.patch --]
[-- Type: text/plain, Size: 1674 bytes --]

*** footnote.el	Tue Jan 23 06:41:02 2007
--- footnote.el	Wed Apr 11 14:36:44 2007
***************
*** 267,280 ****

  ;; Latin-1

! (defconst footnote-latin-regexp "¹²³ºª§¶"
    "Regexp for Latin-1 footnoting characters.")

  (defun Footnote-latin (n)
    "Latin-1 footnote style.
  Use a range of Latin-1 non-ASCII characters for footnoting."
!   (string (aref footnote-latin-regexp
! 		(mod (1- n) (length footnote-latin-regexp)))))

  ;;; list of all footnote styles
  (defvar footnote-style-alist
--- 267,283 ----

  ;; Latin-1

! (defconst footnote-latin-string "¹²³ºª§¶"
!   "String of Latin-1 footnoting characters.")
! 
! (defconst footnote-latin-regexp (concat "[" footnote-latin-string "]")
    "Regexp for Latin-1 footnoting characters.")

  (defun Footnote-latin (n)
    "Latin-1 footnote style.
  Use a range of Latin-1 non-ASCII characters for footnoting."
!   (string (aref footnote-latin-string
! 		(mod (1- n) (length footnote-latin-string)))))

  ;;; list of all footnote styles
  (defvar footnote-style-alist
***************
*** 654,660 ****
        (while (< i notes)
  	(setq alist-ptr (nth i footnote-pointer-marker-alist))
  	(setq alist-txt (nth i footnote-text-marker-alist))
! 	(unless (eq (1+ i) (car alist-ptr))
  	  (Footnote-renumber (car alist-ptr) (1+ i) alist-ptr alist-txt))
  	(setq i (1+ i))))))

--- 657,663 ----
        (while (< i notes)
  	(setq alist-ptr (nth i footnote-pointer-marker-alist))
  	(setq alist-txt (nth i footnote-text-marker-alist))
! 	(unless (= (1+ i) (car alist-ptr))
  	  (Footnote-renumber (car alist-ptr) (1+ i) alist-ptr alist-txt))
  	(setq i (1+ i))))))


[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
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-11 12:48 ` martin rudalics
@ 2007-04-12  6:50   ` Andreas Roehler
  2007-04-12  8:16     ` martin rudalics
  0 siblings, 1 reply; 20+ messages in thread
From: Andreas Roehler @ 2007-04-12  6:50 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel

martin rudalics schrieb:
> Thanks for the precise report.
>
>> Is the setting
>>
>> (defconst footnote-latin-regexp "¹²³ºª§¶"
>> ...
>>
>> correct?
>
> No.  Please try the attached patch.  If my mailer mangles the
> characters try to set them by hand (I renamed footnote-latin-regexp
> to footnote-latin-string and defined footnote-latin-regexp anew).
>
>

Thanks caring for this.

However, now customizing `footnote-style' to `latin'
doesn't take effect any more.

Stays `numeric'.

Andreas Roehler

Emacs -Q, yesterday's CVS

In GNU Emacs 22.0.97.2 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2007-04-11 on kiste
Windowing system distributor `The X.Org Foundation', version 11.0.60802000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
<help-echo> <help-echo> C-x C-f p r o g <tab> e m <tab>
/ v e r f <backspace> a <tab> f o o t n <tab> e l <return>
M-x e v a l - b <tab> <return> C-x C-f <M-backspace>
e i n . e m l <return> M-x e r a s <tab> <return> !
a s d f <return> <return> a d s f <return> <return>
<return> d d d M-x f o t <backspace> p o t <backspace>
<backspace> <backspace> o p t <backspace> <backspace>
t n <tab> <return> <up> <up> <up> <up> <up> <left>
M-x c u t s <backspace> <backspace> s t o m <tab> -
v a r <tab> <return> f o o t n <tab> s t y <tab> <return>
<down-mouse-1> <help-echo> <help-echo> <help-echo>
<down-mouse-1> <mouse-1> <help-echo> <help-echo> C-x
b <return> C-c ! a M-x r e p o r t - e m <tab> <re
turn>

Recent messages:
Creating customization items...
Creating customization items ...done
Resetting customization items...done
Creating customization setup...done
To install your edits, invoke [State] and choose the Set operation
Adding footnote 1
Mark set
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-12  6:50   ` Andreas Roehler
@ 2007-04-12  8:16     ` martin rudalics
  2007-04-12 16:53       ` Andreas Roehler
  2007-04-13  1:41       ` Richard Stallman
  0 siblings, 2 replies; 20+ messages in thread
From: martin rudalics @ 2007-04-12  8:16 UTC (permalink / raw)
  To: Andreas Roehler; +Cc: emacs-devel

 > However, now customizing `footnote-style' to `latin'
 > doesn't take effect any more.
 >
 > Stays `numeric'.

I didn't change anything there.  Observe that `footnote-style' is made
buffer-local when you invoke `footnote-mode'.  Hence you would have to
tell me whether

(1) customizing `footnote-style' fails (i.e., the global value
doesn't get set), or

(2) setting the buffer-local value fails.

I suspect that you customized `footnote-style' _after_ invoking
`footnote-mode' in some buffer.  In this case the customization won't
have any effect in that buffer.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-12  8:16     ` martin rudalics
@ 2007-04-12 16:53       ` Andreas Roehler
  2007-04-12 20:48         ` martin rudalics
  2007-04-13  1:38         ` Stephen J. Turnbull
  2007-04-13  1:41       ` Richard Stallman
  1 sibling, 2 replies; 20+ messages in thread
From: Andreas Roehler @ 2007-04-12 16:53 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel


>
>
> I suspect that you customized `footnote-style' _after_ invoking
> `footnote-mode' in some buffer.
That's true.

Then another topic arrives, which seems more serious
than seldom used latin style:

Footnote variables aren't known, until `footnote-mode'
is loaded. It will be loaded usually with the buffer,
where footnotes are to be inserted.

But after loading, changing the style will not be possible?

Indeed I had to open another buffer after customization.

That's uncomfortable.

Must `footnote-style' be a local variable?


;;;;;;;

Latin style numbering doesn't seem fixed. Here is what I got
inserting serveral footnotes:

[¹][¹][²] [²][º][ª][§]
[¹]
Footnotes:
[¹]  ddd

[²]  dddd

[¹]  asdf

[²]  asdf

[º]  sffff

[ª]  afasdf

[§]  sssss

[¹]  aSDFASDF

;;;;;;;;;

Symbols after "3" seem odd to me. After "§" it starts
numbering again with "1". Strange.

Maybe I ignore what latin-style means?

Thanks

Andreas Roehler




GNU Emacs 22.0.97.2 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 
2007-04-11 on kiste

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-12 16:53       ` Andreas Roehler
@ 2007-04-12 20:48         ` martin rudalics
  2007-04-13 12:30           ` Andreas Roehler
  2007-04-13  1:38         ` Stephen J. Turnbull
  1 sibling, 1 reply; 20+ messages in thread
From: martin rudalics @ 2007-04-12 20:48 UTC (permalink / raw)
  To: Andreas Roehler; +Cc: emacs-devel

 > Footnote variables aren't known, until `footnote-mode'
 > is loaded. It will be loaded usually with the buffer,
 > where footnotes are to be inserted.
 >
 > But after loading, changing the style will not be possible?

Not by _customizing_ it.  You can set the style for the current buffer
with `Footnote-set-style'.  `footnote-style' is made buffer-local via

(make-local-variable 'footnote-style)

in `footnote-mode'. Hence it won't give you the familiar

This variable automatically becomes buffer-local when set outside Custom.
However, setting it through Custom sets the default value.

text you see when `make-variable-buffer-local' is used.

 > Indeed I had to open another buffer after customization.
 >
 > That's uncomfortable.
 >
 > Must `footnote-style' be a local variable?

Try by yourself: Insert a couple of foontnotes in a buffer, do
`Footnote-set-style' to another style, and insert one more footnote.

 > Symbols after "3" seem odd to me. After "§" it starts
 > numbering again with "1". Strange.
 >
 > Maybe I ignore what latin-style means?

It might be useful for inserting up to three footnotes on a single page
(I hate footnotes).

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-12 16:53       ` Andreas Roehler
  2007-04-12 20:48         ` martin rudalics
@ 2007-04-13  1:38         ` Stephen J. Turnbull
  2007-04-13 12:13           ` Andreas Roehler
  1 sibling, 1 reply; 20+ messages in thread
From: Stephen J. Turnbull @ 2007-04-13  1:38 UTC (permalink / raw)
  To: Andreas Roehler; +Cc: emacs-devel

Andreas Roehler writes:

 > Symbols after "3" seem odd to me. After "§" it starts
 > numbering again with "1". Strange.
 > 
 > Maybe I ignore what latin-style means?

It means "footnotes labeled with characters available in Latin-1".
That means with a very small number of footnotes you can get pretty
superscript numerals for the labels.

The use of non-numeric labels is due to the fact that you can only
count to 3 with Latin-1 superscripts, and recycling when you run out
of labels is common to all of the "set of characters"-based footnote
styles.

IIRC there is an option that allows doubling the footnote label when
recycling, but that would look strange with numeric labels.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-12  8:16     ` martin rudalics
  2007-04-12 16:53       ` Andreas Roehler
@ 2007-04-13  1:41       ` Richard Stallman
  2007-04-13 12:11         ` Andreas Roehler
  2007-04-13 13:42         ` Stefan Monnier
  1 sibling, 2 replies; 20+ messages in thread
From: Richard Stallman @ 2007-04-13  1:41 UTC (permalink / raw)
  To: martin rudalics; +Cc: andreas.roehler, emacs-devel

Does this change make it easier to customize the variable?  (You will
need rebuild Emacs after doing `cd lisp; make autoloads'.)

*** footnote.el	21 Jan 2007 01:36:13 -0500	1.15
--- footnote.el	12 Apr 2007 17:50:50 -0400	
***************
*** 277,282 ****
--- 277,283 ----
  		(mod (1- n) (length footnote-latin-regexp)))))
  
  ;;; list of all footnote styles
+ ;;;###autoload
  (defvar footnote-style-alist
    `((numeric Footnote-numeric ,footnote-numeric-regexp)
      (english-lower Footnote-english-lower ,footnote-english-lower-regexp)
***************
*** 290,295 ****
--- 291,297 ----
  See footnote-han.el, footnote-greek.el and footnote-hebrew.el for more
  exciting styles.")
  
+ ;;;###autoload
  (defcustom footnote-style 'numeric
    "*Style used for footnoting.
  numeric == 1, 2, 3, ...

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-13  1:41       ` Richard Stallman
@ 2007-04-13 12:11         ` Andreas Roehler
  2007-04-13 13:42         ` Stefan Monnier
  1 sibling, 0 replies; 20+ messages in thread
From: Andreas Roehler @ 2007-04-13 12:11 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Thanks.

Autoload seems a good idea, but didn't help in that
case.

(`footnote-numeric-regexp' needed an autoload too... )

;;;;;;;;

`footnote-mode' isn't able to read in existing
footnotes.

AFAIS `footnote-pointer-marker-alist' and
`footnote-text-marker-alist' must be set in order to
enable this.

See a first draft (working, but still unfinished,
hardcoded simply "[0-9]+") of a `footnote-init' below.

In order to set mentioned marker lists, `footnote-init'
must know about the footnote style/regexp.

So far

Andreas Roehler

;;;;;;;;;

(defun footnote-init ()
  " "
  (interactive)
  (save-excursion
    (let (last-pos)
      (let ((count 0))
    (goto-char (point-min))
    (while (and
        (re-search-forward (concat footnote-start-tag "[0-9]+" 
footnote-end-tag) nil t 1)
        (progn
          (goto-char (match-beginning 0))
          (save-match-data
            (re-search-forward (regexp-quote footnote-start-tag) nil t 1))
          (setq count (1+ count))
          (eq count
              ;; number-at-point seems defective at the moment
              (string-to-number
               (buffer-substring-no-properties (point) (progn 
(skip-chars-forward "[0-9]")(point)))))))
      (setq last-pos (point))
      (Footnote-insert-pointer-marker count (point))))
      ;; now init footnote-text-marker-alist
      (goto-char last-pos)
      (let ((count 0))
    (while (and
        (re-search-forward (concat footnote-start-tag "[0-9]+" 
footnote-end-tag) nil t 1)
        (progn
          (save-excursion
            (goto-char (match-beginning 0))
            (save-match-data
              (re-search-forward (regexp-quote footnote-start-tag) nil t 
1))
            (setq count (1+ count))
            (eq count
            ;; number-at-point seems defective at the moment
            (string-to-number
             (buffer-substring-no-properties (point) (progn 
(skip-chars-forward "[0-9]")(point))))))))
      (Footnote-insert-text-marker count (point)))))))

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-13  1:38         ` Stephen J. Turnbull
@ 2007-04-13 12:13           ` Andreas Roehler
  0 siblings, 0 replies; 20+ messages in thread
From: Andreas Roehler @ 2007-04-13 12:13 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: emacs-devel

Stephen J. Turnbull schrieb:
> Andreas Roehler writes:
>
>  > Symbols after "3" seem odd to me. After "§" it starts
>  > numbering again with "1". Strange.
>  > 
>  > Maybe I ignore what latin-style means?
>
> It means "footnotes labeled with characters available in Latin-1".
> That means with a very small number of footnotes you can get pretty
> superscript numerals for the labels.
>
> The use of non-numeric labels is due to the fact that you can only
> count to 3 with Latin-1 superscripts, and recycling when you run out
> of labels is common to all of the "set of characters"-based footnote
> styles.
>
> IIRC there is an option that allows doubling the footnote label when
> recycling, but that would look strange with numeric labels.
>
>
>   

Thanks.

As footnote will mostly be used by none-programmers,
maybe it's better to rename this style.

Usually a latin style with numbers will conceived as
Roman, which is not at stake here.

Maybe rename to "superscript"?

Too I think it's a strange selection of chars.

Learned meanwhile a wider range of unicode
superscript numbers is available.

U+2070 ^(0), U+2074 to U+207F

However, only manage

Char: ^(4) (70905, #o212371, #x114f9, file ...)

to get displayed.

(With GNU Emacs 22.0.97.1, but it might be my fault...)

So maybe integrating this char and drop the rest is a
step forward?


Andreas Roehler

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-12 20:48         ` martin rudalics
@ 2007-04-13 12:30           ` Andreas Roehler
  2007-04-14  8:59             ` martin rudalics
  0 siblings, 1 reply; 20+ messages in thread
From: Andreas Roehler @ 2007-04-13 12:30 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel


>
> (I hate footnotes).
>
>
>
They may link you with the universe, with eternity...

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]

Footnotes:
[a] 

[1]  asd

IMHO that shows two errors:

- style is not taken
- no 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.

Remarkable beside here is the missing [C].

IMHO keeping `footnote-style' buffer-local from the
beginning isn't the right thing.

It should be a global value basicly.

When toggling footnode-mode, than mode should check,

- if buffer contains footnotes in global style, then read them in,
  update numbering   

- if buffer contains footnotes in a not global style
  then

  warn
  make recognised style buffer local

  (or offer changing global value?)

Please see my other responses from today in this
thread.

Thanks

Andreas Roehler

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-13  1:41       ` Richard Stallman
  2007-04-13 12:11         ` Andreas Roehler
@ 2007-04-13 13:42         ` Stefan Monnier
  1 sibling, 0 replies; 20+ messages in thread
From: Stefan Monnier @ 2007-04-13 13:42 UTC (permalink / raw)
  To: rms; +Cc: martin rudalics, andreas.roehler, emacs-devel

> Does this change make it easier to customize the variable?  (You will
> need rebuild Emacs after doing `cd lisp; make autoloads'.)

The problem he describes is not related to whether variables are autoloaded
or not.  Please do not autoload variables without a good reason.


        Stefan

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: footnote-style latin  doesn't renumber
  2007-04-13 12:30           ` Andreas Roehler
@ 2007-04-14  8:59             ` martin rudalics
  2007-04-16 12:00               ` Andreas Roehler
                                 ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: martin rudalics @ 2007-04-14  8:59 UTC (permalink / raw)
  To: Andreas Roehler; +Cc: emacs-devel

 > 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.

^ 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
  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-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

* 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

end of thread, other threads:[~2007-04-19 10:17 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).