Re: Abbrev table in doctex mode

2023-08-22 Thread Ikumi Keita
> Ikumi Keita  writes:
>> 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.

Done.

Bye,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine



master d486947c: Enable LaTeX abbrevs in docTeX mode buffer.

2023-08-22 Thread Ikumi Keita
branch: master
commit d486947cd8231c00d671ea42612ad3ebbc062d44
Author: Ikumi Keita 
Commit: Ikumi Keita 

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



bug#65462: 13.2; preview clears overlays when killing an indirect buffer

2023-08-22 Thread Paul Nelson
Take any latex document with sufficiently many equations.  After cloning an
indirect buffer ("C-x 4 c") and killing that indirect buffer (e.g., "C-x 4
0"), many of the overlays in the original buffer become invisible.  Indeed,
one can check that the relevant subfolder of =_region_.prv= is rendered
empty, so the overlays that remain visible are just those that have been
cached.

This is undesirable: if one attempts to simultaneously use preview and
indirect buffers, one eventually has to regenerate all previews after
killing any indirect buffer.

The issue is that killing the indirect buffer calls
~preview-kill-buffer-cleanup~, which in turn calls ~preview-clearout~.

In my local version, I wrapped ~preview-kill-buffer-cleanup~ with ~(unless
(buffer-base-buffer) ...)~, as follows, so that it doesn't clearout
indirect buffers.  This has resolved the issue for me, but I imagine it
could be useful for others who use both AUCTeX and indirect buffers.

#+begin_src elisp
(defun preview-kill-buffer-cleanup ( buf)
  "This is a cleanup function just for use in hooks.
Cleans BUF or current buffer.  The difference to
`preview-clearout-buffer' is that previews
associated with the last buffer modification time are
kept."
  (with-current-buffer (or buf (current-buffer))
(unless (buffer-base-buffer); do not clearout indirect buffers
  (save-restriction
(widen)
(preview-clearout (point-min) (point-max) (visited-file-modtime))
#+end_src



Emacs  : GNU Emacs 30.0.50 (build 2, x86_64-apple-darwin21.6.0, NS
appkit-2113.60 Version 12.6 (Build 21G115))
 of 2023-08-11
Package: 13.2

current state:
==
(setq
 AUCTeX-date "2023-08-18"
 window-system 'ns
 LaTeX-version "2e"
 TeX-style-path '("/usr/local/var/auctex"
"/Users/paulnelson/.emacs.d/elpaca/builds/auctex/auctex/style"
  "/Users/paulnelson/.emacs.d/auctex/auto"
"/Users/paulnelson/.emacs.d/auctex/style" "auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master "~/doit/preview-master.tex"
 TeX-command-list '(("TeX" "%(PDF)%(tex) %(file-line-error) %`%(extraopts)
%S%(PDFout)%(mode)%' %(output-dir) %t"
 TeX-run-TeX nil (plain-tex-mode ams-tex-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 (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 %(O?aux)" TeX-run-BibTeX nil
 (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode context-mode) :help "Run BibTeX")
("Biber" "biber %(output-dir) %s" TeX-run-Biber nil
 (plain-tex-mode latex-mode doctex-mode ams-tex-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 ams-tex-mode
texinfo-mode) :help "Generate PostScript file")
("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil
 (plain-tex-mode latex-mode doctex-mode ams-tex-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 ams-tex-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 ams-tex-mode
texinfo-mode) :help
 "Convert PostScript file to PDF")
("Glossaries" "makeglossaries %(d-dir) %s"
TeX-run-command nil
 

Re: verbatim shorthand problem

2023-08-22 Thread Mandar Mitra
Arash Esbati wrote (Fri, Aug 18, 2023 at 01:46:12PM +0200):
> Werner LEMBERG  writes:
> 
> > ... the phrase *shouldn't* is not something I really like :-)
> 
> I thought so ;-)
> 
> I installed a change (fe3ef154) and now fancyvrb.el supports verbatim
> characters OOTB.  Note that you have to set `LaTeX-fancyvrb-chars'.  Do
> you want to give it a roll?

I'm facing a fontification problem with \lstinline + beamer. Just wondering if 
it might be vaguely related to your fix for fancyvrb.el. I have the following 
line in a frame environment:

\lstinline[language=C,basicstyle=\ttfamily]{for (i=0; i<8; i++) printf("%c\n", 
str1[i]);} \\

The attached screenshot suggests that the closing ] of str1[i] somehow throws 
fontification off-track.

If this does NOT sound like an "Ah, of course" type problem, then I'll try and 
put together an MWE starting with emacs -Q. Could you please let me know?

Many thanks,
Mandar.

lstinline.pdf
Description: Adobe PDF document


Re: Abbrev table in doctex mode

2023-08-22 Thread Ikumi Keita
> Ikumi Keita  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 
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