Hi all, Here is (re)newenvironment input support in latex.el: ,---- | '("newenvironment" TeX-arg-define-environment | [ "Number of arguments"] t t) | '("renewenvironment" TeX-arg-environment | [ "Number of arguments"] t t) `---- Note the two `t's in each entry. This leaves two empty "{}"s when the user types C-c C-m newenvironment RET some-env-name RET RET, but the point is left inside the second "{}" then. It doesn't make much sense for me. I'd say most users expect that the point is in the first "{}".
I'd propose to apply the attached fix, which also includes removal of duplication of code. (The deleted portion is inside "else" clause of `(if (string-equal LaTeX-version "2")', but it wouldn't fail for LaTeX 2.09 document because `TeX-arg-define-macro-arguments' takes care of it.) Any comments? Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine
diff --git a/latex.el b/latex.el index 744257e3..b81fa424 100644 --- a/latex.el +++ b/latex.el @@ -2403,9 +2403,9 @@ string." optional)) (defun TeX-arg-define-macro-arguments (optional &optional prompt) - "Prompt for the number of arguments for a LaTeX macro. If this -is non-zero, also prompt for the default value for the first -argument. + "Prompt for the number of arguments for a LaTeX macro. +If this is non-zero, also prompt for the default value for the +first argument. If OPTIONAL is non-nil, insert the resulting value as an optional argument, otherwise as a mandatory one. Use PROMPT as the prompt @@ -8092,17 +8092,17 @@ function would return non-nil and `(match-string 1)' would return '("newcommand" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t) '("renewcommand" TeX-arg-macro [ TeX-arg-define-macro-arguments ] t) '("newenvironment" TeX-arg-define-environment - [ "Number of arguments"] t t) + [ TeX-arg-define-macro-arguments ] 2) '("renewenvironment" TeX-arg-environment - [ "Number of arguments"] t t) + [ TeX-arg-define-macro-arguments ] 2) '("providecommand" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t) '("providecommand*" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t) '("newcommand*" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t) '("renewcommand*" TeX-arg-macro [ TeX-arg-define-macro-arguments ] t) '("newenvironment*" TeX-arg-define-environment - [ "Number of arguments"] t t) + [ TeX-arg-define-macro-arguments ] 2) '("renewenvironment*" TeX-arg-environment - [ "Number of arguments"] t t) + [ TeX-arg-define-macro-arguments ] 2) '("newtheorem" TeX-arg-define-environment [ TeX-arg-environment "Numbered like" ] t [ (TeX-arg-eval progn (if (eq (save-excursion @@ -8543,22 +8543,6 @@ function would return non-nil and `(match-string 1)' would return (setq TeX-font-list LaTeX-font-list) (setq TeX-font-replace-function #'TeX-font-replace-macro) (TeX-add-symbols - '("newcommand" TeX-arg-define-macro - [ TeX-arg-define-macro-arguments ] t) - '("renewcommand" TeX-arg-macro - [ TeX-arg-define-macro-arguments ] t) - '("providecommand" TeX-arg-define-macro - [ TeX-arg-define-macro-arguments ] t) - '("providecommand*" TeX-arg-define-macro - [ TeX-arg-define-macro-arguments ] t) - '("newcommand*" TeX-arg-define-macro - [ TeX-arg-define-macro-arguments ] t) - '("renewcommand*" TeX-arg-macro - [ TeX-arg-define-macro-arguments ] t) - '("newenvironment" TeX-arg-define-environment - [ TeX-arg-define-macro-arguments ] t t) - '("renewenvironment" TeX-arg-environment - [ TeX-arg-define-macro-arguments ] t t) '("usepackage" LaTeX-arg-usepackage) '("RequirePackage" LaTeX-arg-usepackage) '("ProvidesPackage" (TeX-arg-file-name-sans-extension "Package name")