auctex
[Top][All Lists]
Advanced

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

Re: Cannot expand string in command on 13.0.3


From: Ikumi Keita
Subject: Re: Cannot expand string in command on 13.0.3
Date: Wed, 13 Jan 2021 17:29:04 +0900

Hi Tak-san,

>>>>> Tak Kunihiro <tkk@misasa.okayama-u.ac.jp> writes:
> Real sesame-TeX-jobname and sesame-TeX-outdir are shown below.

> It seems I have to write sesame-TeX-target-region-p,
> as shown below, without calling (TeX-active-master-with-quotes nil t).

It seems to me that you want to discriminate whether typeset is done on
region or not by `sesame-TeX-target-region-p'.  If this guess is
correct, you can refer to the value of the variable
`TeX-current-process-region-p', which is t when typesetting the region
and nil when typesetting the whole document.

> (defun sesame-TeX-jobname ()
>   "Return option `-jobname' according to target file (where command will be) 
> to be used in `TeX-expand-list'."
>   ;; | TeX-target            | return              |
>   ;; |-----------------------+---------------------|
>   ;; | _region_intro_figure0 | -jobname="figure3_" |
>   ;; | manuscript or report  | <nothing>           |
>   (if (sesame-TeX-target-region-p)
>       ;; (format "\"%s_\"" (file-name-sans-extension 
> (TeX-current-file-name-master-relative)))
>       (format " -jobname=%s_" (shell-quote-argument (file-name-base 
> buffer-file-name))) ; figure3_
>     "")) ; there is no point to give something when option is empty

(defun sesame-TeX-jobname ()
  "Return option `-jobname' according to target file (where command will be) to 
be used in `TeX-expand-list'."
  ;; | TeX-target            | return              |
  ;; |-----------------------+---------------------|
  ;; | _region_intro_figure0 | -jobname="figure3_" |
  ;; | manuscript or report  | <nothing>           |
  (if TeX-current-process-region-p
      ;; (format "\"%s_\"" (file-name-sans-extension 
(TeX-current-file-name-master-relative)))
      (format " -jobname=%s_" (shell-quote-argument (file-name-base 
buffer-file-name))) ; figure3_
    "")) ; there is no point to give something when option is empty

> (defun sesame-TeX-outdir (&optional looptex-p)
>   "Return option `-outdir' according to target file.
> The returned values are used in `TeX-expand-list'.  With
> LOOPTEX-P non-nil, it is deflected to `sesame-junk-dir'.  Three
> possible outdirs are <master-dir> where master-file is,
> <master-dir>/<subdir> where subfile is, and <junk-dir>."
>   ;; | case | looptex-p | subcompile-p | return                |
>   ;; |------+-----------+--------------+-----------------------|
>   ;; |    1 | f         | f            | <master-dir>          |
>   ;; |    2 | f         | t            | <master-dir>/<subdir> |
>   ;; |    3 | t         | f            | <junk-dir>            |
>   ;; |    4 | t         | t            | <junk-dir>            |
>   (let* ((subcompile-p (sesame-TeX-target-region-p))
>          (subdir
>           (or (file-name-directory (TeX-current-file-name-master-relative)) 
> ""))
>          (outdir (if looptex-p
>                      (directory-file-name (sesame-junk-dir))
>                    (if subcompile-p
>                        (directory-file-name subdir)
>                      ""))))
>     (if (string= outdir "")
>         "" ; there is no point to give something when option is empty
>       (format " -outdir=%s" (shell-quote-argument outdir)))))

(defun sesame-TeX-outdir (&optional looptex-p)
  "Return option `-outdir' according to target file.
The returned values are used in `TeX-expand-list'.  With
LOOPTEX-P non-nil, it is deflected to `sesame-junk-dir'.  Three
possible outdirs are <master-dir> where master-file is,
<master-dir>/<subdir> where subfile is, and <junk-dir>."
  ;; | case | looptex-p | subcompile-p | return                |
  ;; |------+-----------+--------------+-----------------------|
  ;; |    1 | f         | f            | <master-dir>          |
  ;; |    2 | f         | t            | <master-dir>/<subdir> |
  ;; |    3 | t         | f            | <junk-dir>            |
  ;; |    4 | t         | t            | <junk-dir>            |
  (let* ((subdir
          (or (file-name-directory (TeX-current-file-name-master-relative)) ""))
         (outdir (if looptex-p
                     (directory-file-name (sesame-junk-dir))
                   (if TeX-current-process-region-p
                       (directory-file-name subdir)
                     ""))))
    (if (string= outdir "")
        "" ; there is no point to give something when option is empty
      (format " -outdir=%s" (shell-quote-argument outdir)))))

> I think that to call (TeX-active-master-with-quotes nil t) should not
> change results and this does not happen on 12.3.1.

If I remember correclty, 12.3.1 doesn't have
`TeX-active-master-with-quotes' but instead
`TeX--master-or-region-file-with-extra-quotes', does it? They are
different functions, so they work differently.

Regards,
Ikumi Keita



reply via email to

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