unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29759: 25.2; "exciting footnote styles" promised, but unavailable
@ 2017-12-17 21:31 Boruch Baum
  2017-12-18 15:41 ` bug#29759: 25.2 Updated Code Boruch Baum
  2017-12-22 14:44 ` bug#29759: 25.2; "exciting footnote styles" promised, but unavailable Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Boruch Baum @ 2017-12-17 21:31 UTC (permalink / raw)
  To: 29759

The docstring for variable `footnote-style-alist' promises, "See
footnote-han.el, footnote-greek.el and footnote-hebrew.el for more
exciting styles"; However, those files neither seem to be installed with
emacs, nor appear when I perform a google search for them.

Attached is a patch for Hebrew footnotes, for the benefit of all who
might be 'excited' by such things. For the rest of us, please consider
providing / restoring those files to emacs, or consider applying this
code.


(defconst footnote-hebrew-regex "[אבגדהוזחטיכלמנסעפצקרשת]+")
(defconst footnote-hebrew '(
  ("א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט")
  ("י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ")
  ("ק" "ר" "ש" "ת" "תק" "תר"" תש" "תת" "תתק")))
(defun Footnote-hebrew(n)
  "Supports 9999 footnotes, then rolls over."
  (let*
    ((n (+ (mod n 10000) (/ n 10000)))
     (thousands (/ n 1000))
     (hundreds (/ (mod n 1000) 100))
     (tens (/ (mod n 100) 10))
     (units (mod n 10))
     (special (if (not (= tens 1)) nil
               (or (when (= units 5) "טו")
               (when (= units 6) "טז")))))
   (concat
     (when (/= 0 thousands) (concat (nth (1- thousands) (nth 0 footnote-hebrew)) "'"))
     (when (/= 0 hundreds) (nth (1- hundreds) (nth 2 footnote-hebrew)))
     (if special special
      (concat
        (when (/= 0 tens) (nth (1- tens) (nth 1 footnote-hebrew)))
        (when (/= 0 units) (nth (1- units) (nth 0 footnote-hebrew))))))))
(add-to-list 'footnote-style-alist `(hebrew Footnote-hebrew ,footnote-hebrew-regex) t)


VERSION INFORMATION
===================
In GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.20)
 of 2017-09-11, modified by Debian built on trouble
System Description:	Devuan GNU/Linux 1.0 (jessie)

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0





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

* bug#29759: 25.2 Updated Code
  2017-12-17 21:31 bug#29759: 25.2; "exciting footnote styles" promised, but unavailable Boruch Baum
@ 2017-12-18 15:41 ` Boruch Baum
  2017-12-22 14:44 ` bug#29759: 25.2; "exciting footnote styles" promised, but unavailable Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Boruch Baum @ 2017-12-18 15:41 UTC (permalink / raw)
  To: 29759

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

Thie code update renames the style to 'hebrew-numeric', adds a second
(rarely used) style, and comments a failed attempt to improve the style
regex.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0

[-- Attachment #2: 25.2 Hebrew footnote styles: Updated Code --]
[-- Type: text/plain, Size: 1936 bytes --]

(defconst footnote-hebrew-numeric-regex "[אבגדהוזחטיכלמנסעפצקרשת']+")
; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?")
(defconst footnote-hebrew-numeric '(
  ("א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט")
  ("י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ")
  ("ק" "ר" "ש" "ת" "תק" "תר"" תש" "תת" "תתק")))
(defun Footnote-hebrew-numeric(n)
  "Supports 9999 footnotes, then rolls over."
  (let*
    ((n (+ (mod n 10000) (/ n 10000)))
     (thousands (/ n 1000))
     (hundreds (/ (mod n 1000) 100))
     (tens (/ (mod n 100) 10))
     (units (mod n 10))
     (special (if (not (= tens 1)) nil
               (or (when (= units 5) "טו")
               (when (= units 6) "טז")))))
   (concat
     (when (/= 0 thousands) (concat (nth (1- thousands) (nth 0 footnote-hebrew-numeric)) "'"))
     (when (/= 0 hundreds) (nth (1- hundreds) (nth 2 footnote-hebrew-numeric)))
     (if special special
      (concat
        (when (/= 0 tens) (nth (1- tens) (nth 1 footnote-hebrew-numeric)))
        (when (/= 0 units) (nth (1- units) (nth 0 footnote-hebrew-numeric))))))))
(add-to-list 'footnote-style-alist `(hebrew-numeric Footnote-hebrew-numeric ,footnote-hebrew-numeric-regex) t)

(defconst footnote-hebrew-symbolic-regex "[אבגדהוזחטיכלמנסעפצקרשת]")
(defconst footnote-hebrew-symbolic '(
 "א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט" "י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ" "ק" "ר" "ש" "ת"))
(defun Footnote-hebrew-symbolic(n)
  "Only 22 elements, per the style of eg. 'פירוש שפתי חכמים על רש\"י'.
Proceeds from `י' to `כ', from `צ' to `ק'. After `ת', rolls over to `א'."
  (nth (mod (1- n) 22) footnote-hebrew-symbolic))
(add-to-list 'footnote-style-alist `(hebrew-symbolic Footnote-hebrew-symbolic ,footnote-hebrew-symbolic-regex) t)

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

* bug#29759: 25.2; "exciting footnote styles" promised, but unavailable
  2017-12-17 21:31 bug#29759: 25.2; "exciting footnote styles" promised, but unavailable Boruch Baum
  2017-12-18 15:41 ` bug#29759: 25.2 Updated Code Boruch Baum
@ 2017-12-22 14:44 ` Eli Zaretskii
  2017-12-24 20:02   ` Boruch Baum
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-12-22 14:44 UTC (permalink / raw)
  To: Boruch Baum; +Cc: 29759-done

> Date: Sun, 17 Dec 2017 16:31:14 -0500
> From: Boruch Baum <boruch_baum@gmx.com>
> 
> The docstring for variable `footnote-style-alist' promises, "See
> footnote-han.el, footnote-greek.el and footnote-hebrew.el for more
> exciting styles"; However, those files neither seem to be installed with
> emacs, nor appear when I perform a google search for them.

I've removed that reference on the release branch.

> The code update renames the style to 'hebrew-numeric', adds a second
> (rarely used) style, and comments a failed attempt to improve the style
> regex.

Thanks, pushed to the master branch.

(Of course, to have Hebrew-style footnotes be rendered correctly,
starting at the left side of the window, one needs to either replace
the "Footnotes" header with something like "הערות שוליים", or insert a
newline after "Footnotes:".  But footnote.el doesn't yet support
localized headers.)





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

* bug#29759: 25.2; "exciting footnote styles" promised, but unavailable
  2017-12-22 14:44 ` bug#29759: 25.2; "exciting footnote styles" promised, but unavailable Eli Zaretskii
@ 2017-12-24 20:02   ` Boruch Baum
  2017-12-25 16:00     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Boruch Baum @ 2017-12-24 20:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 29759-done

On 2017-12-22 16:44, Eli Zaretskii wrote:
> I've removed that reference on the release branch.
> ...
> Thanks, pushed to the master branch.

Compare your response to that of libre-office[א]: no-fuss, completed in
a few days, compared to a four-year drawn-out process involving too much
educating.

> (Of course, to have Hebrew-style footnotes be rendered correctly,
> starting at the left side of the window, one needs to either replace
> the "Footnotes" header with something like "הערות שוליים", or insert a
> newline after "Footnotes:".  But footnote.el doesn't yet support
> localized headers.)

I'm not sure what you mean[ב]. Variable 'footnote-section-tag' can be set
to a localized string, either by evaluation or through
customize-variable. What is annoying for me now is using RTL footnotes
in an LTR document, because the footnote section keeps bouncing between LTR
and RTL whenever emacs prompts me for word-completion candidates (I
think that would be 'company-mode').



הערות:

[א] https://bugs.documentfoundation.org/show_bug.cgi?id=66212

[ב] נראה לי בסדר.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0





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

* bug#29759: 25.2; "exciting footnote styles" promised, but unavailable
  2017-12-24 20:02   ` Boruch Baum
@ 2017-12-25 16:00     ` Eli Zaretskii
  2017-12-25 18:20       ` Boruch Baum
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-12-25 16:00 UTC (permalink / raw)
  To: Boruch Baum; +Cc: 29759

> Date: Sun, 24 Dec 2017 15:02:58 -0500
> From: Boruch Baum <boruch_baum@gmx.com>
> Cc: 29759-done@debbugs.gnu.org
> 
> On 2017-12-22 16:44, Eli Zaretskii wrote:
> > I've removed that reference on the release branch.
> > ...
> > Thanks, pushed to the master branch.
> 
> Compare your response to that of libre-office[א]: no-fuss, completed in
> a few days, compared to a four-year drawn-out process involving too much
> educating.

I hope you like our process better ;-)

> > (Of course, to have Hebrew-style footnotes be rendered correctly,
> > starting at the left side of the window, one needs to either replace
> > the "Footnotes" header with something like "הערות שוליים", or insert a
> > newline after "Footnotes:".  But footnote.el doesn't yet support
> > localized headers.)
> 
> I'm not sure what you mean[ב]. Variable 'footnote-section-tag' can be set
> to a localized string, either by evaluation or through
> customize-variable.

Right, I missed that.  But then at least the Hebrew styles should also
automatically set that variable (and footnote-section-tag-regexp),
don't you agree?  Or do we envision someone using a Hebrew style, but
writing predominantly LTR text for the footnotes themselves?

> What is annoying for me now is using RTL footnotes in an LTR
> document, because the footnote section keeps bouncing between LTR
> and RTL whenever emacs prompts me for word-completion candidates (I
> think that would be 'company-mode').

Sounds like a bug.  Company mode solves some tricky display issues, so
maybe there's something there that doesn't work well with bidi.
Please make a separate bug report, preferably starting from "emacs -Q"
and loading the required add-on packages as needed.

Thanks.





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

* bug#29759: 25.2; "exciting footnote styles" promised, but unavailable
  2017-12-25 16:00     ` Eli Zaretskii
@ 2017-12-25 18:20       ` Boruch Baum
  0 siblings, 0 replies; 6+ messages in thread
From: Boruch Baum @ 2017-12-25 18:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 29759

On 2017-12-25 18:00, Eli Zaretskii wrote:
> ... the Hebrew styles should also automatically set that variable (and
> footnote-section-tag-regexp), don't you agree? Or do we envision
> someone using a Hebrew style, but writing predominantly LTR text for
> the footnotes themselves?

I see your point, and can only think of two reasons not to:

1] The user may have already customized the tag and its regexp for some
   other string for Hebrew documents (maybe something like  נ.ב.).

2] The user may have decided on a language neutral section tag, maybe a
   string of "=" or "━".

My guess, though, is that you're correct, because most emacs users who
write Hebrew footnotes will also be writing לע"ז and would welcome
the auto-switch. I'll let you make the final decision, and will code it
into the Hebrew functions.

> > What is annoying for me now is using RTL footnotes in an LTR
> > document, because the footnote section keeps bouncing between LTR
> > and RTL whenever emacs prompts me for word-completion candidates (I
> > think that would be 'company-mode').
>
> Sounds like a bug.  Company mode solves some tricky display issues, so
> maybe there's something there that doesn't work well with bidi.
> Please make a separate bug report, preferably starting from "emacs -Q"
> and loading the required add-on packages as needed.

I've been trying that now, but can't reproduce it in a clean `emacs -Q'.
The specific company mode is `company-dabbrev'. More homework ...

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0





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

end of thread, other threads:[~2017-12-25 18:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-17 21:31 bug#29759: 25.2; "exciting footnote styles" promised, but unavailable Boruch Baum
2017-12-18 15:41 ` bug#29759: 25.2 Updated Code Boruch Baum
2017-12-22 14:44 ` bug#29759: 25.2; "exciting footnote styles" promised, but unavailable Eli Zaretskii
2017-12-24 20:02   ` Boruch Baum
2017-12-25 16:00     ` Eli Zaretskii
2017-12-25 18:20       ` Boruch Baum

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