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: Arash Esbati
Subject: Re: add filename to tag for catchfilebetweentags
Date: Tue, 13 Dec 2022 09:52:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50

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

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?

> +         (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?

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

Best, Arash



reply via email to

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