auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] [elpa] externals/auctex ef1f670 27/30: ; Partially revert


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex ef1f670 27/30: ; Partially revert silencing the compiler
Date: Fri, 25 Sep 2020 11:00:16 -0400 (EDT)

branch: externals/auctex
commit ef1f6708812606f66b5a562bb2be754412baa74f
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>

    ; Partially revert silencing the compiler
    
    * context.el (ConTeXt-numbered-section-heading)
    (ConTeXt-unnumbered-section-heading, ConTeXt-section-title)
    (ConTeXt-section-section, ConTeXt-section-ref): Revert wrapping
    function body in `with-no-warnings'.
    Restore and comment out defvar'ing of dynamically scoped variables
    `reference', `title', `name' and `level'.
    
    * latex.el (LaTeX-section-heading, LaTeX-section-title)
    (LaTeX-section-toc, LaTeX-section-section, LaTeX-section-label):
    Revert wrapping function body in `with-no-warnings'.
    Restore and comment out defvar'ing of dynamically
    scoped variables `title', `name', `level' and `toc'.
    
    * style/exam.el (LaTeX-exam-insert-item):
    * style/ifluatex.el (LaTeX-ifluatex-set-exit-mark): Revert
    wrapping function body in `with-no-warnings'.
---
 context.el        | 93 +++++++++++++++++++++++++++++--------------------------
 latex.el          | 76 +++++++++++++++++++++++----------------------
 style/exam.el     | 29 +++++++++--------
 style/ifluatex.el |  3 +-
 4 files changed, 103 insertions(+), 98 deletions(-)

diff --git a/context.el b/context.el
index 0d65249..626da22 100644
--- a/context.el
+++ b/context.el
@@ -1,6 +1,6 @@
 ;;; context.el --- Support for ConTeXt documents.
 
-;; Copyright (C) 2003-2006, 2008, 2010, 2012, 2014-2018
+;; Copyright (C) 2003-2006, 2008, 2010, 2012, 2014-2020
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: Berend de Boer <berend@pobox.com>
@@ -67,10 +67,20 @@
 
 ;;; variables
 
-;; Dynamically scoped vars used in certain macro's.  `done-mark' is
-;; marked special; `reference', `title', `name' and `level' are
-;; pacified via `with-no-warnings' in the respective functions.
-(defvar done-mark)     ; Position of point afterwards, default nil (meaning 
end)
+;; Dynamically scoped vars used in certain macro's.
+;; BEWARE: We used to give them a global nil value, but this can mess up poor
+;; unrelated packages using those same vars but expecting them to be
+;; lexically scoped.
+;; So don't give them a global value, which makes sure the effect of `defvar'
+;; localized to this file!
+;; N.B.: These forms are commented out since they produce a "lack of
+;; prefix" warning during byte-compilation.  This way they produce
+;; only a "reference to free variable" one.
+;; (defvar done-mark) ; Position of point afterwards, default nil (meaning end)
+;; (defvar reference) ; Used by `ConTeXt-section-ref' and 
`ConTeXt-section-section'.
+;; (defvar title) ; Used by `ConTeXt-section-title' and 
`ConTeXt-section-section'.
+;; (defvar name)
+;; (defvar level)
 
 ;; others
 
@@ -501,53 +511,49 @@ in your .emacs file."
   "Hook to prompt for ConTeXt section name.
 Insert this hook into `ConTeXt-numbered-section-hook' to allow the user to 
change
 the name of the sectioning command inserted with `\\[ConTeXt-section]'."
-  (with-no-warnings
-    (let ((string (completing-read
-                  (concat "Select level (default " name "): ")
-                  ConTeXt-numbered-section-list
-                  nil nil nil)))
-      ;; Update name
-      (if (not (zerop (length string)))
-         (setq name string)))))
+  (let ((string (completing-read
+                (concat "Select level (default " name "): ")
+                ConTeXt-numbered-section-list
+                nil nil nil)))
+    ;; Update name
+    (if (not (zerop (length string)))
+       (setq name string))))
 
 (defun ConTeXt-unnumbered-section-heading ()
   "Hook to prompt for ConTeXt section name.
 Insert this hook into `ConTeXt-unnumbered-section-hook' to allow the user to 
change
 the name of the sectioning command inserted with `\\[ConTeXt-section]'."
-  (with-no-warnings
-    (let ((string (completing-read
-                  (concat "Select level (default " name "): ")
-                  ConTeXt-unnumbered-section-list
-                  nil nil nil)))
-      ;; Update name
-      (if (not (zerop (length string)))
-         (setq name string)))))
+  (let ((string (completing-read
+                (concat "Select level (default " name "): ")
+                ConTeXt-unnumbered-section-list
+                nil nil nil)))
+    ;; Update name
+    (if (not (zerop (length string)))
+       (setq name string))))
 
 (defun ConTeXt-section-title ()
   "Hook to prompt for ConTeXt section title.
 Insert this hook into `ConTeXt-(un)numbered-section-hook' to allow the user to 
change
 the title of the section inserted with `\\[ConTeXt-section]."
-  (with-no-warnings
-    (setq title (TeX-read-string "What title: "))))
+  (setq title (TeX-read-string "What title: ")))
 
 (defun ConTeXt-section-section ()
   "Hook to insert ConTeXt section command into the file.
 Insert this hook into `ConTeXt-section-hook' after those hooks which sets
 the `name', `title', and `reference' variables, but before those hooks which
 assumes the section already is inserted."
-  (with-no-warnings
-    (insert TeX-esc name)
-    (cond ((null reference))
-         ((zerop (length reference))
-          (insert ConTeXt-optop)
-          (set-marker done-mark (point))
-          (insert ConTeXt-optcl))
-         (t
-          (insert ConTeXt-optop reference ConTeXt-optcl)))
-    (insert TeX-grop)
-    (if (zerop (length title))
-       (set-marker done-mark (point)))
-    (insert title TeX-grcl))
+  (insert TeX-esc name)
+  (cond ((null reference))
+       ((zerop (length reference))
+        (insert ConTeXt-optop)
+        (set-marker done-mark (point))
+        (insert ConTeXt-optcl))
+       (t
+        (insert ConTeXt-optop reference ConTeXt-optcl)))
+  (insert TeX-grop)
+  (if (zerop (length title))
+      (set-marker done-mark (point)))
+  (insert title TeX-grcl)
   (newline)
   ;; If RefTeX is available, tell it that we've just made a new section
   (and (fboundp 'reftex-notice-new-section)
@@ -557,14 +563,13 @@ assumes the section already is inserted."
   "Hook to insert a reference after the sectioning command.
 Insert this hook into `ConTeXt-section-hook' to prompt for a label to be
 inserted after the sectioning command."
-  (with-no-warnings
-    (setq reference (completing-read
-                    (TeX-argument-prompt t nil
-                                         "Comma separated list of references")
-                    (LaTeX-label-list) nil nil))
-    ;; No reference or empty string entered?
-    (if (string-equal "" reference)
-       (setq reference nil))))
+  (setq reference (completing-read
+                  (TeX-argument-prompt t nil
+                                       "Comma separated list of references")
+                  (LaTeX-label-list) nil nil))
+  ;; No reference or empty string entered?
+  (if (string-equal "" reference)
+      (setq reference nil)))
 
 
 ;; Various
diff --git a/latex.el b/latex.el
index 2e9e848..923d27a 100644
--- a/latex.el
+++ b/latex.el
@@ -126,8 +126,15 @@ This depends on `LaTeX-insert-into-comments'."
 
 ;;; Sections
 
-;; Declare dynamically scoped var.
-(defvar done-mark)
+;; Declare dynamically scoped vars.
+;; N.B.: These forms are commented out since they produce a "lack of
+;; prefix" warning during byte-compilation.  This way they produce
+;; only a "reference to free variable" one.
+;; (defvar title)
+;; (defvar name)
+;; (defvar level)
+;; (defvar done-mark)
+;; (defvar toc)
 
 (defun LaTeX-section (arg)
   "Insert a template for a LaTeX section.
@@ -450,35 +457,32 @@ no label is inserted."
   "Hook to prompt for LaTeX section name.
 Insert this hook into `LaTeX-section-hook' to allow the user to change
 the name of the sectioning command inserted with `\\[LaTeX-section]'."
-  (with-no-warnings
-    (let ((string (completing-read
-                  (concat "Level (default " name "): ")
-                  LaTeX-section-list
-                  nil nil nil nil name)))
-      ;; Update name
-      (if (not (zerop (length string)))
-         (setq name string))
-      ;; Update level
-      (setq level (LaTeX-section-level name)))))
+  (let ((string (completing-read
+                (concat "Level (default " name "): ")
+                LaTeX-section-list
+                nil nil nil nil name)))
+    ;; Update name
+    (if (not (zerop (length string)))
+       (setq name string))
+    ;; Update level
+    (setq level (LaTeX-section-level name))))
 
 (defun LaTeX-section-title ()
   "Hook to prompt for LaTeX section title.
 Insert this hook into `LaTeX-section-hook' to allow the user to change
 the title of the section inserted with `\\[LaTeX-section]."
-  (with-no-warnings
-    (setq title (TeX-read-string "Title: " title))
-    (let ((region (and (TeX-active-mark)
-                      (cons (region-beginning) (region-end)))))
-      (when region (delete-region (car region) (cdr region))))))
+  (setq title (TeX-read-string "Title: " title))
+  (let ((region (and (TeX-active-mark)
+                    (cons (region-beginning) (region-end)))))
+    (when region (delete-region (car region) (cdr region)))))
 
 (defun LaTeX-section-toc ()
   "Hook to prompt for the LaTeX section entry in the table of content .
 Insert this hook into `LaTeX-section-hook' to allow the user to insert
 a different entry for the section in the table of content."
-  (with-no-warnings
-    (setq toc (TeX-read-string "Toc Entry: "))
-    (if (zerop (length toc))
-       (setq toc nil))))
+  (setq toc (TeX-read-string "Toc Entry: "))
+  (if (zerop (length toc))
+      (setq toc nil)))
 
 (defun LaTeX-section-section ()
   "Hook to insert LaTeX section command into the file.
@@ -495,19 +499,18 @@ assume that the section is already inserted."
                     "begin")
             (line-beginning-position 0) t))
     (LaTeX-newline))
-  (with-no-warnings
-    (insert TeX-esc name)
-    (cond ((null toc))
-         ((zerop (length toc))
-          (insert LaTeX-optop)
-          (set-marker done-mark (point))
-          (insert LaTeX-optcl))
-         (t
-          (insert LaTeX-optop toc LaTeX-optcl)))
-    (insert TeX-grop)
-    (if (zerop (length title))
-       (set-marker done-mark (point)))
-    (insert title TeX-grcl))
+  (insert TeX-esc name)
+  (cond ((null toc))
+       ((zerop (length toc))
+        (insert LaTeX-optop)
+        (set-marker done-mark (point))
+        (insert LaTeX-optcl))
+       (t
+        (insert LaTeX-optop toc LaTeX-optcl)))
+  (insert TeX-grop)
+  (if (zerop (length title))
+      (set-marker done-mark (point)))
+  (insert title TeX-grcl)
   (LaTeX-newline)
   ;; If RefTeX is available, tell it that we've just made a new section
   (and (fboundp 'reftex-notice-new-section)
@@ -519,9 +522,8 @@ Insert this hook into `LaTeX-section-hook' to prompt for a 
label to be
 inserted after the sectioning command.
 
 The behaviour of this hook is controlled by variable `LaTeX-section-label'."
-  (with-no-warnings
-    (and (LaTeX-label name 'section)
-        (LaTeX-newline))))
+  (and (LaTeX-label name 'section)
+       (LaTeX-newline)))
 
 ;;; Environments
 
diff --git a/style/exam.el b/style/exam.el
index e84203f..76bff4b 100644
--- a/style/exam.el
+++ b/style/exam.el
@@ -51,21 +51,20 @@
 (defun LaTeX-exam-insert-item ()
   "Insert a new item in an environment from exam class.
 Item inserted depends on the environment."
-  (with-no-warnings
-    (TeX-insert-macro
-     (cond ((string= environment "questions")
-            "question")
-           ((string= environment "parts")
-            "part")
-           ((string= environment "subparts")
-            "subpart")
-           ((string= environment "subsubparts")
-            "subsubpart")
-          ((member environment '("choices" "oneparchoices"
-                                 "checkboxes" "oneparcheckboxes"))
-           "choice")
-           ;; Fallback
-           (t "item")))))
+  (TeX-insert-macro
+   (cond ((string= environment "questions")
+          "question")
+         ((string= environment "parts")
+          "part")
+         ((string= environment "subparts")
+          "subpart")
+         ((string= environment "subsubparts")
+          "subsubpart")
+        ((member environment '("choices" "oneparchoices"
+                               "checkboxes" "oneparcheckboxes"))
+         "choice")
+         ;; Fallback
+         (t "item"))))
 
 (defun LaTeX-exam-insert-label (_optional &optional name type)
   "Indent the line and query/insert a label incl. the \"\\label\" macro.
diff --git a/style/ifluatex.el b/style/ifluatex.el
index 736e5ca..246bc22 100644
--- a/style/ifluatex.el
+++ b/style/ifluatex.el
@@ -36,8 +36,7 @@
 
 (defun LaTeX-ifluatex-set-exit-mark (_optional)
   "Discard OPTIONAL and set exit-mark to current point."
-  (with-no-warnings
-    (set-marker exit-mark (point))))
+  (set-marker exit-mark (point)))
 
 (TeX-add-style-hook
     "ifluatex"



reply via email to

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