Hello, thanks for maintaining this wonderful software

I am having an issue where TeX-fold-* functions will not fold my
~\cite~, ~\parencite~ and ~\textcite~ macros properly. They fold to
"[c]", "(c)" and "c" respectively.

For a brief period they worked (folded to "[authoryear]", "(authoryear)"
and "authoryear" respectively), but since then I can't seem to see
anything that might be interfering with it. Please see below for my
relevant AUCTeX config:

;; AUCTeX - TeX and LaTeX
(use-package auctex
:ensure '(auctex :repo "https://github.com/emacs-straight/auctex.git"; ;; 
"https://git.savannah.gnu.org/git/auctex.git";
:branch "master"
:pre-build (("make" "elpa"))
:build (:not elpaca--compile-info)
:files ("*.el" "doc/*.info*" "etc" "images" "latex" "style")
:version (lambda () (require 'auctex) AUCTeX-version))
:init
(add-to-list 'auto-mode-alist '("\\.tex\\'" . LaTeX-mode))
(add-to-list 'major-mode-remap-alist '((latex-mode . LaTeX-mode)
(tex-mode . TeX-mode)))
:hook ((LaTeX-mode . electric-pair-mode)
(LaTeX-mode . visual-line-mode)
(LaTeX-mode . reftex-mode)
(LaTeX-mode . TeX-fold-mode))
:config
(add-hook 'find-file-hook #'TeX-fold-buffer)
;; Also fold parencite
(defun kb-TeX-fold-textcite-display (keys &rest _args)
"Fold display for a \\cite{KEYS} macro.
KEYS are the citation key(s), as a comma-delimited list. Return string
of the form \"[XYZ99]\" or \"[XYZ99, Optional Citation Text]\", formed
using authors' last names and the the publication year."
(let* ((citation (car (TeX-fold-macro-nth-arg
1 (point)
(TeX-fold-item-end (point) 'macro)
'(?\[ . ?\]))))
(key-list (split-string keys "[ \f\t\n\r\v,]+"))
(references (delq nil (mapcar #'TeX-fold--bib-abbrev key-list)))
(joined-references (string-join references ", ")))
(concat ""
(if (string-empty-p joined-references)
"c" joined-references)
(when citation
(format ", %s" citation))
"")))
(defun kb-TeX-fold-parencite-display (keys &rest _args)
"Fold display for a \\cite{KEYS} macro.
KEYS are the citation key(s), as a comma-delimited list. Return string
of the form \"[XYZ99]\" or \"[XYZ99, Optional Citation Text]\", formed
using authors' last names and the the publication year."
(let* ((citation (car (TeX-fold-macro-nth-arg
1 (point)
(TeX-fold-item-end (point) 'macro)
'(?\[ . ?\]))))
(key-list (split-string keys "[ \f\t\n\r\v,]+"))
(references (delq nil (mapcar #'TeX-fold--bib-abbrev key-list)))
(joined-references (string-join references ", ")))
(concat "("
(if (string-empty-p joined-references)
"c" joined-references)
(when citation
(format ", %s" citation))
")")))
(setq LaTeX-fold-macro-spec-list
`((kb-TeX-fold-parencite-display ("parencite"))
(kb-TeX-fold-textcite-display ("textcite"))))
:custom
;; Folding
(TeX-fold-auto t) ; Auto fold macros on insert
(TeX-outline-extra '(("[ \t]*\\\\\\(bib\\)?item\\b" 7)
("\\\\bibliography\\b" 2)))
(TeX-auto-save t)
(TeX-parse-self t)
(LaTeX-indent-level 4)
(LaTeX-item-indent 0))

Things I've tried:
- ~emacs -Q~ > ~package-install RET auctex RET~ > ~TeX-fold-mode~ >
~TeX-fold-buffer~
- Above but with the full above configuration
- Rerunning ~latex~, ~biber~, ~latexmk~ and all permutations of these
- ~edebug~ on ~TeX-fold-cite-display~, which reveals that
~TeX-fold-macro-nth-arg~ returns ~nil~ when evaluating ~TeX-fold-macro~
on a ~\cite~ macro.

Thank you for any help!
Kai

Emacs : GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, 
cairo version 1.18.0)
of 2025-07-21
Package: 14.1.0

current state:
==============
(setq
window-system 'pgtk
LaTeX-version "2e"
TeX-style-path '("~/.emacs.d/auctex/" 
"/home/289845i/.emacs.d/elpaca/builds/auctex/style"
"/home/289845i/.emacs.d/auctex/auto" "/home/289845i/.emacs.d/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)%' %(output-dir) %t"
TeX-run-TeX nil (plain-TeX-mode AmSTeX-mode Texinfo-mode) :help "Run plain TeX")
("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil (LaTeX-mode docTeX-mode) :help "Run 
LaTeX")
("Makeinfo" "makeinfo %(extraopts) %(o-dir) %t" TeX-run-compile nil 
(Texinfo-mode) :help
"Run Makeinfo with Info output")
("Makeinfo HTML" "makeinfo %(extraopts) %(o-dir) --html %t" TeX-run-compile nil 
(Texinfo-mode)
:help "Run Makeinfo with HTML output")
("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %(output-dir) %t" 
TeX-run-TeX nil
(AmSTeX-mode) :help "Run AMSTeX")
("ConTeXt" "%(cntxcom) --once %(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 %(O?aux)" TeX-run-BibTeX nil
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode ConTeXt-mode) 
:help
"Run BibTeX")
("Biber" "biber %(output-dir) %s" TeX-run-Biber nil
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run 
Biber")
("Texindex" "texindex %s.??" TeX-run-command nil (Texinfo-mode) :help "Run 
Texindex")
("Texi2dvi" "%(PDF)texi2dvi %t" TeX-run-command nil (Texinfo-mode) :help
"Run Texi2dvi or Texi2pdf")
("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
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help
"Generate PostScript file")
("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help
"Convert DVI file to PostScript")
("Dvipdfmx" "dvipdfmx -o %(O?pdf) %d" TeX-run-dvipdfmx nil
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help
"Convert DVI file to PDF with dvipdfmx")
("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help
"Convert PostScript file to PDF")
("LaTeXMk"
"latexmk %(latexmk-out) %(file-line-error) %(output-dir) %`%(extraopts) 
%S%(mode)%' %t"
TeX-run-TeX nil (LaTeX-mode docTeX-mode) :help "Run LaTeXMk")
("Glossaries" "makeglossaries %(d-dir) %s" TeX-run-command nil
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help
"Run makeglossaries to create glossary file")
("Index" "makeindex %(O?idx)" TeX-run-index nil
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help
"Run makeindex to create index file")
("upMendex" "upmendex %(O?idx)" TeX-run-index t
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help
"Run upmendex to create index file")
("Xindy" "texindy %s" TeX-run-command nil
(plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :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"))
)
_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex
  • bug#79076: 14.... Kai Bagley via bug-auctex via Bug reporting list for AUCTeX
    • bug#79076... Paul Nelson
      • bug#7... Paul Nelson
        • b... Kai Bagley via bug-auctex via Bug reporting list for AUCTeX
          • ... Paul Nelson
            • ... Kai Bagley via bug-auctex via Bug reporting list for AUCTeX
              • ... Paul Nelson
                • ... Kai Bagley via bug-auctex via Bug reporting list for AUCTeX
                • ... Paul D. Nelson
                • ... Kai Bagley via bug-auctex via Bug reporting list for AUCTeX
                • ... Paul D. Nelson

Reply via email to