Hi Uwe, could you try this and let me know what shows up in *Messages*?

--8<---------------cut here---------------start------------->8---
(defun my-after-insert-environment-hook (new-env beg end)
  "Hook to run after a LaTeX environment is modified."
  (message "Test: %s" (symbol-name last-command))
  (unless (equal last-command 'LaTeX-environment)
    (when (equal new-env "equation")
      (unless (save-excursion (goto-char beg)
                              (search-forward "\\label{" end t))
        (save-excursion
          (goto-char beg)
          (forward-line 1)
          (open-line 1)
          (reftex-label)
          (LaTeX-indent-line))))
    (when (equal (substring new-env -1) "*")
      (save-restriction
        (narrow-to-region beg end)
        (save-excursion
          (goto-char (point-min))
          (LaTeX--strip-labels))))))
--8<---------------cut here---------------end--------------->8---

Reply via email to