[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Output filenames and the inconsistency of the `file` variable
From: |
Al Haji-Ali |
Subject: |
Re: Output filenames and the inconsistency of the `file` variable |
Date: |
Tue, 25 Aug 2020 22:32:10 +0100 |
User-agent: |
mu4e 1.5.5; emacs 27.1 |
Hi Ikumi,
>> Would changing that to calling the appropriate filename function be
>> acceptable in my contribution?
>
> Probably yes, provided that your contribution is careful enough not to
> break compatibility with existing codes including users' customization.
>
To start with, I think the first change is to ensure that the variable `file`
(or the lexically-scoped alternative) is not used as a string. Since this is an
internal variable, I think user config is not an issue.
For the existing AUCTeX code, as far as I can see, the places where the
dynamically-scoped `file` is used as a string are only two: tex.el:1168 and
tex.el:1192
So thest are the only changes needed:
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -531,9 +531,9 @@ remember to add /Library/TeX/texbin/ to your PATH"
""))))
;; Now start the process
- (setq file (funcall file))
- (TeX-process-set-variable file 'TeX-command-next TeX-command-Show)
- (funcall hook name command file)))
+ (let ((filename (funcall file)))
+ (TeX-process-set-variable filename 'TeX-command-next TeX-command-Show)
+ (funcall hook name command filename))))
(defvar TeX-command-text) ;Dynamically scoped.
(defvar TeX-command-pos) ;Dynamically scoped.
diff --git a/tex.el b/tex.el
index 9a1d1b6d..9e651966 100644
--- a/tex.el
+++ b/tex.el
@@ -1165,7 +1165,7 @@ entry in `TeX-view-program-list-builtin'."
(get-file-buffer (TeX-region-file t)))
(current-buffer))
(pdf-sync-forward-search))
- (let ((pdf (concat file "." (TeX-output-extension))))
+ (let ((pdf (funcall file (TeX-output-extension))))
(pop-to-buffer (or (find-buffer-visiting pdf)
(find-file-noselect pdf))))))
@@ -1189,7 +1189,7 @@ viewer."
(require 'url-util)
(let* ((uri (concat "file://" (url-encode-url
(expand-file-name
- (concat file "." (TeX-output-extension))))))
+ (funcall file (TeX-output-extension))))))
(owner (dbus-call-method
:session (format "org.%s.%s.Daemon" de app)
(format "/org/%s/%s/Daemon" de app)
> Recently, there were some
> discussions in this list about moving to lexical scope:
> https://lists.gnu.org/archive/html/auctex-devel/2020-08/msg00008.html
> So the situation with respect to this dynamically-scoped variables may
> be much different in future AUCTeX.
Without the changes above, the lexically-scoped variable would still have to
serve the two functions (being a function and a string) which I think is not
ideal.
-- Al
- Output filenames and the inconsistency of the `file` variable, Al Haji-Ali, 2020/08/23
- Re: Output filenames and the inconsistency of the `file` variable, Ikumi Keita, 2020/08/25
- Re: Output filenames and the inconsistency of the `file` variable,
Al Haji-Ali <=
- Re: Output filenames and the inconsistency of the `file` variable, Ikumi Keita, 2020/08/26
- Re: Output filenames and the inconsistency of the `file` variable, Al Haji-Ali, 2020/08/26
- Re: Output filenames and the inconsistency of the `file` variable, Ikumi Keita, 2020/08/26
- Re: Output filenames and the inconsistency of the `file` variable, Al Haji-Ali, 2020/08/26
- Re: Output filenames and the inconsistency of the `file` variable, Ikumi Keita, 2020/08/27
- Re: Output filenames and the inconsistency of the `file` variable, Al Haji-Ali, 2020/08/27
- Re: Output filenames and the inconsistency of the `file` variable, Ikumi Keita, 2020/08/27
- Re: Output filenames and the inconsistency of the `file` variable, Al Haji-Ali, 2020/08/28