>>>>> Ikumi Keita <ik...@ikumi.que.jp> writes:
> I'd like to discuss the abbrev table of doctex mode.

[...]

> Consequently, the abbrevs defined in latex mode abbrev table
> aren't available in doctex mode buffer.

> That doesn't seem reasonable to me. Is there any reason that abbrevs for
> latex mode should be disabled in doctex mode?

Assuming that there is no particular reason, I propose to apply the
attached change. I'll commit it soon if no objection.

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine

>From d486947cd8231c00d671ea42612ad3ebbc062d44 Mon Sep 17 00:00:00 2001
From: Ikumi Keita <ik...@ikumi.que.jp>
Date: Tue, 22 Aug 2023 00:07:56 +0900
Subject: [PATCH] Enable LaTeX abbrevs in docTeX mode buffer.

* latex.el (): Enable LaTeX abbrevs in docTeX mode buffer.
* doc/changes.texi: Mention the above change.
Update copyright year.
---
 doc/changes.texi | 4 +++-
 latex.el         | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/changes.texi b/doc/changes.texi
index 467af2a5..f9e7ee58 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -1,5 +1,5 @@
 @c This is part of the AUCTeX manual.
-@c Copyright (C) 1994-2002, 2004-2010, 2012-2022 Free Software
+@c Copyright (C) 1994-2002, 2004-2010, 2012-2023 Free Software
 @c Foundation, Inc.
 @c See file auctex.texi for copying conditions.
 @include macros.texi
@@ -14,6 +14,8 @@
 @item
 @AUCTeX{} now requires GNU Emacs 26.1 or higher.
 
+@item
+Now @LaTeX{} abbreves are available in doc@TeX{} mode buffers.
 @end itemize
 
 @heading News in 13.2
diff --git a/latex.el b/latex.el
index 42bbf410..d855b5c5 100644
--- a/latex.el
+++ b/latex.el
@@ -8040,6 +8040,12 @@ runs the hooks in `docTeX-mode-hook'."
   (TeX-set-mode-name)
   (funcall TeX-install-font-lock))
 
+;; Enable LaTeX abbrevs in docTeX mode buffer.
+(let ((p (abbrev-table-get doctex-mode-abbrev-table :parents)))
+  (or (memq latex-mode-abbrev-table p)
+      (abbrev-table-put doctex-mode-abbrev-table :parents
+                        (cons latex-mode-abbrev-table p))))
+
 ;;This is actually a mess: to fit the scheme properly, our derived
 ;;mode definition would have had to be made for TeX-doctex-mode in the
 ;;first place, but then we could not have used define-derived-mode, or
-- 
2.41.0

Reply via email to