auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: add filename to tag for catchfilebetweentags


From: Uwe Brauer
Subject: Re: add filename to tag for catchfilebetweentags
Date: Tue, 13 Dec 2022 10:29:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>>> "AE" == Arash Esbati <arash@gnu.org> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>> We discussed this some time ago I am using this patch for some time
>> now.
>> 
>> Any objections to apply it?

> Thanks for the change.  I have some comments.  First, you have some
> trailing spaces in your file; applying your change, Git says:

   -> git apply ../catchfilebetweentag-file-name.patch
> ../catchfilebetweentag-file-name.patch:27: trailing whitespace.
>   (setq LaTeX-catchfilebetweentags-counter
> ../catchfilebetweentag-file-name.patch:35: trailing whitespace.
> ;; similar way reftex does this.
> warning: 2 lines add whitespace errors.

> Doesn't HG warns you about these?  You can run

>   M-x whitespace-cleanup RET

Oops sorry


> after editing the file.

>> # HG changeset patch
>> # User Uwe Brauer <oub@mat.ucm.es>
>> # Date 1669793258 -3600
>> #      Wed Nov 30 08:27:38 2022 +0100
>> # Node ID 65dcebb49bb529b0462a6026364c1216ed18bdfa
>> # Parent  b8c8bd65a9cce48e9f5998b3951cd6e9b9c71faf
>> Add filename as a prefix to the counter for catchfilebetweentags
>> 
>> * style/catchfilebetweentags.el (LaTeX-env-catchfilebetweentags):
>> Add filename as a prefix to the counter, in a similar way RefTeX does this.
>> 
>> diff --git a/style/catchfilebetweentags.el b/style/catchfilebetweentags.el
>> --- a/style/catchfilebetweentags.el
>> +++ b/style/catchfilebetweentags.el
>> [...]
>> (defun LaTeX-env-catchfilebetweentags (_environment)
>> "Insert a tag-skeleton defined by `LaTeX-catchfilebetweentags'.
>> ENVIRONMENT is ignored."
>> -  (let* ((fn (when LaTeX-catchfilebetweentags-use-numeric-label
>> +;; The following code, adds the file name as a prefix to the tag, in a
>> +;; similar way reftex does this. 
>> +  (let* ((myfile (file-name-sans-extension (file-name-nondirectory 
>> (buffer-file-name (current-buffer)))))

> Can we rename `myfile' to `file' please?  And rearrange the code to have
> a shorter line length?


Ok.


>> +         (fn (when LaTeX-catchfilebetweentags-use-numeric-label
>> (LaTeX-catchfilebetweentags-counter-inc)))
>> -         (tag  (TeX-read-string
>> +         (tag
>> +         (concat myfile ":"
>> +          (TeX-read-string
>> (if fn (format "Tag (default %s): " fn) "Tag: ")
>> nil nil (when fn (number-to-string fn)))))
>> +         (number-to-string fn))

> What is the last form (number-to-string fn) for?  You're let-binding the
> value of `fn' to `number-to-string'.  Is this a typo?


I have to check this, it has been some time now that I wrote it but I
recall that I had to fiddle quite a bit to make it to work.

>> (unless (bolp)
>> (newline)
>> (delete-horizontal-space))

> Best, Arash

-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]