Signed-off-by: Werner Fink <wer...@suse.de>
---
 latex.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/latex.el b/latex.el
index 5c6a8510..0f970949 100644
--- a/latex.el
+++ b/latex.el
@@ -2030,7 +2030,7 @@ TYPE is one of the symbols mac or env."
                 ;; over [>=] and a balanced {}
                 ((looking-at-p "[>=]")
                  (forward-char 1)
-                 (with-syntax-table syntax (forward-sexp)))
+                 (with-syntax-table syntax (ignore-errors (forward-sexp))))
                 ;; Mandatory arguments:
                 ;; m: Ask for input with "Text" as prompt
                 ((looking-at-p "m")
@@ -2046,7 +2046,7 @@ TYPE is one of the symbols mac or env."
                 ;; R<token1><token2>{default}
                 ((looking-at-p "R")
                  (re-search-forward "R\\(.\\)\\(.\\)" (+ (point) 3) t)
-                 (with-syntax-table syntax (forward-sexp))
+                 (with-syntax-table syntax (ignore-errors (forward-sexp)))
                  (push `(TeX-arg-string nil nil nil nil
                                         ,(match-string-no-properties 1)
                                         ,(match-string-no-properties 2))
@@ -2070,12 +2070,12 @@ TYPE is one of the symbols mac or env."
                 ;; O{default}
                 ((looking-at-p "O")
                  (forward-char 1)
-                 (with-syntax-table syntax (forward-sexp))
+                 (with-syntax-table syntax (ignore-errors (forward-sexp)))
                  (push (vector "Text") args))
                 ;; D<token1><token2>{default}
                 ((looking-at-p "D")
                  (re-search-forward "D\\(.\\)\\(.\\)" (+ (point) 3) t)
-                 (with-syntax-table syntax (forward-sexp))
+                 (with-syntax-table syntax (ignore-errors (forward-sexp)))
                  (push (vector #'TeX-arg-string nil nil nil nil
                                (match-string-no-properties 1)
                                (match-string-no-properties 2))
@@ -2107,7 +2107,7 @@ TYPE is one of the symbols mac or env."
                          ,(match-string-no-properties 1))
                        args)
                  (when (looking-at-p TeX-grop)
-                   (with-syntax-table syntax (forward-sexp))))
+                   (with-syntax-table syntax (ignore-errors (forward-sexp)))))
                 ;; Finished:
                 (t nil))))
       (if (eq type 'env)
-- 
2.43.0


>From 26c22d66eea3307106da436edb7ad7fc4e3abe8f Mon Sep 17 00:00:00 2001
From: Werner Fink <wer...@suse.de>
Date: Tue, 7 May 2024 09:01:17 +0200
Subject: [PATCH 2/3] Enable initial reset for LaTeX classes

Enable initial reset for LaTeX classes to load the class mode
at creation of the document.  The declared variable is called
LaTeX-global-class-files and not TeX-global-class-files.

Signed-off-by: Werner Fink <wer...@suse.de>
---
 latex.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/latex.el b/latex.el
index 0f970949..957586c2 100644
--- a/latex.el
+++ b/latex.el
@@ -2714,7 +2714,7 @@ Initialized once at the first time you prompt for a LaTeX 
class.
 May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.")
 
 ;; Add the variable to `TeX-normal-mode-reset-list':
-(add-to-list 'TeX-normal-mode-reset-list 'TeX-global-class-files)
+(add-to-list 'TeX-normal-mode-reset-list 'LaTeX-global-class-files)
 
 (defcustom TeX-arg-input-file-search t
   "If `TeX-arg-input-file' should search for files.
-- 
2.43.0


>From f9c892d072b6fd58b934c46ed334381e8e6f4786 Mon Sep 17 00:00:00 2001
From: Werner Fink <wer...@suse.de>
Date: Tue, 7 May 2024 09:17:30 +0200
Subject: [PATCH 3/3] Update dinbrief class

Nowadays UTF-8 is standard, also port the features of the letter class
to dinbrief class.

Signed-off-by: Werner Fink <wer...@suse.de>
---
 style/dinbrief.el | 45 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/style/dinbrief.el b/style/dinbrief.el
index c3108466..49e1071c 100644
--- a/style/dinbrief.el
+++ b/style/dinbrief.el
@@ -32,14 +32,26 @@
 (require 'tex)
 (require 'latex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
+(defvar LaTeX-dinbrief-class-options
+  '("10pt" "11pt" "12pt" "norm" "a4paper" "a5paper" "b5paper"
+    "letterpaper" "legalpaper" "executivepaper" "twoside"
+    "addresshigh" "addressstd" "onecolumn" "twocolumn")
+  "Package options for the letter class.")
+
 (TeX-add-style-hook
  "dinbrief"
  (lambda ()
-   (add-hook 'LaTeX-document-style-hook
-             #'LaTeX-dinbrief-style)
    (LaTeX-add-environments
     '("letter" LaTeX-dinbrief-env-recipient)
     "dinquote")
+   (add-hook 'LaTeX-document-style-hook
+             #'LaTeX-dinbrief-style)
+   (setq LaTeX-default-document-environment "letter")
    (TeX-add-symbols
     '("address" "Absender")
     '("postremark" "Postvermerk")
@@ -61,7 +73,22 @@
     '("backaddress" "Retouradresse")
     '("signature" "Unterschrift")
     '("opening" "Anrede")
-    '("closing" "Schluss")))
+    '("closing" "Schluss"))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("subject" "{")
+                                ("address" "{")
+                                ("signature" "{")
+                                ("opening" "{")
+                                ("closing" "{")
+                                ("location" "{")
+                                ("handling" "{")
+                                ("cc" "{")
+                                ("encl" "{")
+                                ("ps" "{"))
+                              'function)))
  TeX-dialect)
 
 (defmacro LaTeX-dinbrief-insert (&rest args)
@@ -77,17 +104,9 @@
         (beginning-of-line 1))
     (open-line 2)
     (indent-relative-first-indent-point)
-    (LaTeX-dinbrief-insert TeX-esc "usepackage"
-                           LaTeX-optop "latin1,utf8" LaTeX-optcl
-                           TeX-grop "inputenc" TeX-grcl)
-    (newline-and-indent)
-    (LaTeX-dinbrief-insert TeX-esc "usepackage"
-                           LaTeX-optop "T1" LaTeX-optcl
-                           TeX-grop "fontenc" TeX-grcl)
-    (indent-relative-first-indent-point)
     (LaTeX-dinbrief-insert TeX-esc "usepackage"
                            TeX-grop "ngerman" TeX-grcl))
-  (TeX-run-style-hooks "inputenc" "fontenc" "ngerman"))
+  (TeX-run-style-hooks "ngerman"))
 
 (defun LaTeX-dinbrief-env-recipient (environment)
   "Insert ENVIRONMENT and prompt for recipient and address."
@@ -246,7 +265,7 @@
   (let ((ctime-string (current-time-string))
         (month-alist '(("Jan" . "Januar")
                        ("Feb" . "Februar")
-                       ("Mar" . "M\\\"arz")
+                       ("Mar" . "März")
                        ("Apr" . "April")
                        ("May" . "Mai")
                        ("Jun" . "Juni")
-- 
2.43.0


Reply via email to