[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: catchfilebetweentags the final version.
From: |
Uwe Brauer |
Subject: |
Re: catchfilebetweentags the final version. |
Date: |
Thu, 25 Aug 2022 18:19:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>>> "AE" == Arash Esbati <arash@gnu.org> writes:
> Hi Uwe,
> Uwe Brauer <oub@mat.ucm.es> writes:
> Please prefix your variables and functions with LaTeX-<packagename>.
>> +(defvar catchbetween-use-numeric-label t
>> + "Variable to insert automatic numerical labels.")
>> +(make-variable-buffer-local 'catchbetween-use-numeric-label)
> I think this one should be customizable variable, right? Then it should
> go in tex-style.el and look like this:
> (defcustom LaTeX-catchfilebetweentags-use-numeric-label t
> "Insert automatic numerical labels if non-nil."
> :type 'boolean)
I am confused now, I did understand you that this defcustom should go into
tex-style.el, but I see you put in
catchfilebetweentags.el
So I am a bit confused.
>> +(defvar catchbetween-counter 0
>> + "Counter for catchfilebetweentags numbers.")
>> +(make-variable-buffer-local 'catchbetween-counter)
> I suggest to initialize this one to nil and add it
> `TeX-normal-mode-reset-list' in the style hook. Then a user can reset
> the variable with 'C-u C-c C-n' if it gets out of sync. Do:
I don't understand that
so LaTeX-catchfilebetweentags-use-numeric-label should be set to nil or
t per default.
If it is nil, I don't understand your comments about
`TeX-normal-mode-reset-list' in the style hook
I thought you run customize-option if is controlled by defcustom.
I am confused. Sorry.
> I'd re-write this one, see the file attached.
>> +(defun catchbetween-environment ()
>> + "Insert a skeleton with a counter for the `LaTeX' package
>> `catchfilebetweentags'."
>> + (interactive)
>> + (save-excursion
>> + (when catchbetween-use-numeric-label
>> + (let ((fn (catchbetween-counter-inc)))
>> + (insert (concat "%<*" (format "%s" fn) ">\n\n%</" (format "%s" fn)
>> ">" ))))
>> + (unless catchbetween-use-numeric-label
>> + (insert (concat "%<*" ">\n\n%</" ">" ))))
>> + (forward-line))
>> +
>> +(defun catchbetween-insert-environment (environment)
>> + (catchbetween-environment))
So as far as I can see you rewrote catchbetween-environment
#+begin_src
(defun LaTeX-env-catchfilebetweentags (_environment)
"Insert a tag-skeleton defined by `LaTeX-catchfilebetweentags'.
ENVIRONMENT is ignored."
(let* ((fn (when LaTeX-catchfilebetweentags-use-numeric-label
(LaTeX-catchfilebetweentags-counter-inc)))
(tag (TeX-read-string
(if fn (format "Tag (default %s): " fn) "Tag: ")
nil nil (when fn (number-to-string fn)))))
(unless (bolp)
(newline)
(delete-horizontal-space))
(save-excursion
(insert (concat (format "%%<*%s>" tag)
"\n\n"
(format "%%</%s>" tag)))))
(forward-line))
#+end_src
Right? That is way above my elips knowledge, but I see you added the tag
input, which is good.
So it looks nice to me, much better than my version but I don't
understand your comments about «TeX-normal-mode-reset-list' in the style
hook»
Regards
Uwe
smime.p7s
Description: S/MIME cryptographic signature
- catchfilebetweentags the final version., Uwe Brauer, 2022/08/24
- Re: catchfilebetweentags the final version., Arash Esbati, 2022/08/24
- Re: catchfilebetweentags the final version., Arash Esbati, 2022/08/24
- Re: catchfilebetweentags the final version., Uwe Brauer, 2022/08/25
- Re: catchfilebetweentags the final version.,
Uwe Brauer <=
- Re: catchfilebetweentags the final version., Arash Esbati, 2022/08/25
- Re: catchfilebetweentags the final version., Uwe Brauer, 2022/08/26
- [a new patch] (was: catchfilebetweentags the final version.), Uwe Brauer, 2022/08/26
- Re: [a new patch], Arash Esbati, 2022/08/29
- Re: [a new patch], Uwe Brauer, 2022/08/30
- Re: [a new patch], Uwe Brauer, 2022/08/30
- Re: [a new patch], Uwe Brauer, 2022/08/30
- Re: [a new patch], Arash Esbati, 2022/08/31
- Re: [a new patch], Uwe Brauer, 2022/08/31