Subject: bug#42799: 12.2.0; reftex?: R2L, Hebrew: automatically labeling does not work for sections

From: Uwe Brauer <[email-masked]>
Date: Mon, 10 Aug 2020 14:27:08 +0200

Hi

I am not sure whether this is more of a reftex bug. It is my
understanding that even then, sending a Auctex bug is maybe correct if
not tell me and I will resend the bug report to the GNU emacs bug mailing list.

My refetex setting is as follows:

(setq reftex-extra-bindings t)		;must be before (require 'reftex) otherwise it does not work
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
;;  plug it into auctex
(setq reftex-plug-into-AUCTeX t)
(setq reftex-initialize-temporary-buffers t)

Steps to reproduce, see the following file:
,----
| 
| \documentclass[12pt]{article}
| \usepackage{fontspec}
| \setmainfont[Script=Hebrew]{Simple CLM}
| \usepackage{bidi}
| \begin{document}
| \section{Introduction}
| \label{sec:introduction}
| \setRL 
| 
| \end{document}
| 
| %%% Local Variables:
| %%% mode: latex
| %%% TeX-engine: xetex
| %%% End:
`----

Running LaTeX-section before \setRL and writing Introduction inserts
 \section{Introduction}
 \label{sec:introduction}

Doing the same after \setRL

LaTeX-section
now inserting the hebrew word mavo מבוא either by turning in the
X-window environment globally a hebrew keyboard, or much better, running 
(set-input-method "hebrew" t) 
in the minibuffer or 
  (set-input-method "hebrew-phonetic-qwerty" t)

And then typing the word מאוא
results in 

\section{מבוא}
\label{sec:}

But is should be 

\section{מבוא}
\label{sec:מבוא}

Regards

Uwe Brauer 

==============
(setq
 AUCTeX-date "2019-10-31"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("/home/oub/emacs/site-lisp/packages/auctex-git/auctex/style" "auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master t
 TeX-command-list '(("TeX" "%(PDF)%(tex) %(file-line-error) %(extraopts) %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil
                     (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain TeX")
                    ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX")
                    ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with Info output")
                    ("Makeinfo HTML" "makeinfo %(extraopts) --html %t" TeX-run-compile nil (texinfo-mode) :help
                     "Run Makeinfo with HTML output")
                    ("AmSTeX" "amstex %(PDFout) %(extraopts) %`%S%(mode)%' %t" TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
                    ("ConTeXt" "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t" TeX-run-TeX nil (context-mode) :help
                     "Run ConTeXt once")
                    ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t" TeX-run-TeX nil (context-mode) :help
                     "Run ConTeXt until completion")
                    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
                    ("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file")
                    ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command)
                    ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t t :help "Generate PostScript file")
                    ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t :help "Convert DVI file to PostScript")
                    ("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil t :help "Convert DVI file to PDF with dvipdfmx")
                    ("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t :help "Convert PostScript file to PDF")
                    ("Index" "makeindex %s" TeX-run-index nil t :help "Run makeindex to create index file")
                    ("makegloss" "makeindex %s.nlo -s nomencl.ist -o %s.nls" TeX-run-command t t)
                    ("pandoclatex2odt"
                     "/home/oub/.cabal/bin/pandoc -s -R -f latex --toc %s.tex --reference-odt=/home/oub/ALLES/Templates/preferences.odt -t odt -o %O" TeX-run-command t t)
                    ("pandoclatex2docx"
                     "/home/oub/.cabal/bin/pandoc -s -R -f latex  %s.tex --reference-docx=/home/oub/ALLES/Templates/preferences.docx -t docx -o %D" TeX-run-command t t)
                    ("" "" TeX-run-command nil t) ("oolatex" "/usr/share/tex4ht/oolatex %t" TeX-run-command t t)
                    ("Xindy" "texindy %s" TeX-run-command nil t :help "Run xindy to create index file")
                    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness")
                    ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for common mistakes")
                    ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document")
                    ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files")
                    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files")
                    ("Other" "" TeX-run-command t t :help "Run an arbitrary command"))
 )