[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tex.el compiler warnings
From: |
Arash Esbati |
Subject: |
tex.el compiler warnings |
Date: |
Tue, 18 Aug 2020 22:44:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 |
Hi all,
I'd like to install the following patch which silences almost all
compiler warnings coming from tex.el. Main features are:
1) Require texmathp
2) defvar all variables
3) use `with-no-warnings' for 2 function `TeX-pdf-tools-sync-view' and
`TeX-evince-sync-view-1'.
Any comments? Best, Arash
--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index b954eba1..f5e7ac51 100644
--- a/tex.el
+++ b/tex.el
@@ -35,6 +35,7 @@
(require 'tex-site)
(eval-when-compile
(require 'cl-lib))
+(require 'texmathp)
;; Silence the compiler for functions:
(declare-function dbus-ignore-errors "ext:dbus"
@@ -65,6 +66,50 @@
(declare-function spell-buffer "ext:text-mode"
t)
+;; Silence the compiler for variables:
+;; tex.el: Variables defined somewhere in this file:
+(defvar TeX-PDF-from-DVI)
+(defvar TeX-PDF-mode)
+(defvar TeX-PDF-mode-parsed)
+(defvar TeX-all-extensions)
+(defvar TeX-command-default)
+(defvar TeX-default-extension)
+(defvar TeX-esc)
+(defvar TeX-interactive-mode)
+(defvar TeX-macro-global)
+(defvar TeX-mode-map)
+(defvar TeX-mode-p)
+(defvar TeX-output-extension)
+(defvar TeX-output-extension)
+(defvar TeX-source-correlate-mode)
+(defvar TeX-source-specials-places)
+(defvar TeX-source-specials-tex-flags)
+(defvar TeX-synctex-tex-flags)
+(defvar exit-mark)
+(defvar last-optional-rejected)
+;; Variables defined in other AUCTeX libraries:
+;; latex.el:
+(defvar BibLaTeX-global-style-files)
+(defvar BibTeX-global-files)
+(defvar BibTeX-global-style-files)
+(defvar LaTeX-default-verb-delimiter)
+(defvar LaTeX-global-class-files)
+(defvar LaTeX-optcl)
+(defvar LaTeX-optop)
+(defvar TeX-Biber-global-files)
+(defvar TeX-global-input-files)
+;; tex-buf.el
+(defvar TeX-current-process-region-p)
+(defvar TeX-region)
+(defvar TeX-region-orig-buffer)
+;; tex-ispell.el
+(defvar TeX-ispell-verb-delimiters)
+;; graphicx.el
+(defvar LaTeX-includegraphics-global-files)
+;; Others:
+(defvar tex--prettify-symbols-alist) ; tex-mode.el
+(defvar Info-file-list-for-emacs) ; info.el
+
(defgroup TeX-file nil
"Files used by AUCTeX."
:group 'AUCTeX)
@@ -1188,15 +1233,16 @@ entry in `TeX-view-program-list-builtin'."
(error "PDF Tools only work with PDF output"))
(add-hook 'pdf-sync-backward-redirect-functions
#'TeX-source-correlate-handle-TeX-region)
- (if (and TeX-source-correlate-mode
- (fboundp 'pdf-sync-forward-search))
- (with-current-buffer (or (when TeX-current-process-region-p
- (get-file-buffer (TeX-region-file t)))
- (current-buffer))
- (pdf-sync-forward-search))
- (let ((pdf (concat file "." (TeX-output-extension))))
- (pop-to-buffer (or (find-buffer-visiting pdf)
- (find-file-noselect pdf))))))
+ (with-no-warnings
+ (if (and TeX-source-correlate-mode
+ (fboundp 'pdf-sync-forward-search))
+ (with-current-buffer (or (when TeX-current-process-region-p
+ (get-file-buffer (TeX-region-file t)))
+ (current-buffer))
+ (pdf-sync-forward-search))
+ (let ((pdf (concat file "." (TeX-output-extension))))
+ (pop-to-buffer (or (find-buffer-visiting pdf)
+ (find-file-noselect pdf)))))))
(defcustom TeX-view-evince-keep-focus nil
"Whether Emacs retains the focus when viewing PDF files with Evince.
@@ -1216,38 +1262,39 @@ for the Evince-compatible entries in
DE is the name of the desktop environment, APP is the name of
viewer."
(require 'url-util)
- (let* ((uri (concat "file://" (url-encode-url
- (expand-file-name
- (concat file "." (TeX-output-extension))))))
- (owner (dbus-call-method
- :session (format "org.%s.%s.Daemon" de app)
- (format "/org/%s/%s/Daemon" de app)
- (format "org.%s.%s.Daemon" de app)
- "FindDocument"
- uri
- t)))
- (if owner
- (with-current-buffer (or (when TeX-current-process-region-p
- (get-file-buffer (TeX-region-file t)))
- (current-buffer))
- (dbus-call-method
- :session owner
- (format "/org/%s/%s/Window/0" de app)
- (format "org.%s.%s.Window" de app)
- "SyncView"
- (buffer-file-name)
- (list :struct :int32 (1+ (TeX-current-offset))
- ;; FIXME: Using `current-column' here is dubious.
- ;; Most of CJK letters count as occupying 2 columns,
- ;; so the column number is not equal to the number of
- ;; the characters counting from the beginning of a
- ;; line. What is the right number to specify here?
- ;; number of letters? bytes in UTF8? or other?
- :int32 (1+ (current-column)))
- :uint32 0)
- (when TeX-view-evince-keep-focus
- (select-frame-set-input-focus (selected-frame))))
- (error "Couldn't find the %s instance for %s" (capitalize app) uri))))
+ (with-no-warnings
+ (let* ((uri (concat "file://" (url-encode-url
+ (expand-file-name
+ (concat file "." (TeX-output-extension))))))
+ (owner (dbus-call-method
+ :session (format "org.%s.%s.Daemon" de app)
+ (format "/org/%s/%s/Daemon" de app)
+ (format "org.%s.%s.Daemon" de app)
+ "FindDocument"
+ uri
+ t)))
+ (if owner
+ (with-current-buffer (or (when TeX-current-process-region-p
+ (get-file-buffer (TeX-region-file t)))
+ (current-buffer))
+ (dbus-call-method
+ :session owner
+ (format "/org/%s/%s/Window/0" de app)
+ (format "org.%s.%s.Window" de app)
+ "SyncView"
+ (buffer-file-name)
+ (list :struct :int32 (1+ (TeX-current-offset))
+ ;; FIXME: Using `current-column' here is dubious.
+ ;; Most of CJK letters count as occupying 2 columns,
+ ;; so the column number is not equal to the number of
+ ;; the characters counting from the beginning of a
+ ;; line. What is the right number to specify here?
+ ;; number of letters? bytes in UTF8? or other?
+ :int32 (1+ (current-column)))
+ :uint32 0)
+ (when TeX-view-evince-keep-focus
+ (select-frame-set-input-focus (selected-frame))))
+ (error "Couldn't find the %s instance for %s" (capitalize app) uri)))))
(defun TeX-atril-sync-view ()
"Run `TeX-evince-sync-view-1', which see, set up for Atril."
--8<---------------cut here---------------end--------------->8---
- tex.el compiler warnings,
Arash Esbati <=