bug#42624: emacs 26.3 : tex-mode.el : tex & latex compile failures

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#42624: emacs 26.3 : tex-mode.el : tex & latex compile failures

_RDS_
emacs /path/to/src.tex -> C-c C-f -> ok
  buffer *tex-shell* pwd -> /path/to

emacs /path/to -> C-x d -> src.tex -> C-c C-f -> src.tex not found
(many other variations lead to similar failure)
  buffer *tex-shell* pwd -> /tmp

Problem traced to function tex-send-tex-command(...).
It does *not* change directory to location of src.tex

Remove or comment out this conditional stanza

  (unless (or (equal dir (let ((buf (tex-shell-buf-no-error)))
                           (and buf (with-current-buffer buf
                                      default-directory))))
     (not dir))
    (let (shell-dirtrack-verbose)
      (tex-send-command tex-shell-cd-command dir)))

Replace with

  (let (shell-dirtrack-verbose) (tex-send-command tex-shell-cd-command dir))

solves this error. Proper solution requires unless... to be repaired.

Reply | Threaded
Open this post in threaded view
|

bug#42624: emacs 26.3 : tex-mode.el : tex & latex compile failures

_RDS_

Alternative repair. In the troublesome lines

  (unless (or (equal dir (let ((buf (tex-shell-buf-no-error)))
                           (and buf (with-current-buffer buf
                                      default-directory))))
      (not dir))
    (let (shell-dirtrack-verbose)
      (tex-send-command tex-shell-cd-command dir)))

change

   equal dir -> equal "garbage" in the line with unless.

This will force the cd command to always execute.

Here's the patch I made

--- tex-mode.0.el 2020-07-31 16:22:30.380924724 -0700
+++ tex-mode.1.el 2020-07-31 14:00:36.344874591 -0700
@@ -2482,7 +2482,8 @@
     (tex-send-tex-command compile-command dir)))
 
 (defun tex-send-tex-command (cmd &optional dir)
-  (unless (or (equal dir (let ((buf (tex-shell-buf-no-error)))
+  (setq nodir "garbage") ;; dir -> nodir  force a cd  nodir!=dir
+  (unless (or (equal nodir (let ((buf (tex-shell-buf-no-error)))
                            (and buf (with-current-buffer buf
                                       default-directory))))
        (not dir))


Reply | Threaded
Open this post in threaded view
|

bug#42624: Additional solutions

_RDS_
In reply to this post by _RDS_
I have found two other code modifications that fix the problem.

(define-derived-mode tex-shell shell-mode "TeX-Shell" ;; line 2000
  (setq-local compilation-error-regexp-alist tex-error-regexp-alist)
  (setq-local default-directory "") ;; My addition; most anything(?) inside quotes is ok
  (compilation-shell-minor-mode t))

or

(defun tex-send-tex-command (cmd &optional dir) ;; line 2484
  (unless (or (equal dir (let ((buf)) ;; removed (tex-shell-buf-no-error) ;; buf is nil
                           (and buf (with-current-buffer buf
                                      default-directory))))

Among all the proposals (& there are certainly more), I can *not* choose because I do not understand all the conditions that must be satisfied for proper functioning of the entire module. My choices work for my restricted situations. That is probably not enough for more general cases.

RDS

Reply | Threaded
Open this post in threaded view
|

bug#42624: More info

_RDS_
In reply to this post by _RDS_
More info

The function tex-file() is ok. It yields the correct tex/latex command, file name, & directory. The trouble is the routines that create the tex-shell. Note that the function tex-set-buffer-directory(...) is *never* called. If it is used thusly

(defun tex-send-tex-command (cmd &optional dir) ;; line 2484
  (setq default-directory (tex-set-buffer-directory "*tex-shell*" "/tmp")) ;; new statement here
  (unless (or (equal dir (let ((buf (tex-shell-buf-no-error)))
                           (and buf (with-current-buffer buf
                                      default-directory))))

it works; yet another solution. This new addition could certainly be placed elsewhere as well.

RDS

Reply | Threaded
Open this post in threaded view
|

bug#42624: emacs - tex-mode.el - build failure - not a bug

_RDS_
In reply to this post by _RDS_
A test using a Fedora 32 Live image + emacs + texlive-collection-latex could not replicate the build failure described on this reporter's machine. The latter has some problem with configuration or missing packages. As such, these postings should be removed; it is not a bug.
Reply | Threaded
Open this post in threaded view
|

bug#42570: emacs - tex-mode.el - build failure - not a bug

Lars Ingebrigtsen
RDS <[hidden email]> writes:

> A test using a Fedora 32 Live image + emacs + texlive-collection-latex
> could not replicate the build failure described on this reporter's
> machine. The latter has some problem with configuration or missing
> packages. As such, these postings should be removed; it is not a bug.

OK; closing the bug report.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no