Skip to content

Commit

Permalink
Cleanup patch; Moving defvar to toplevel
Browse files Browse the repository at this point in the history
Move `defvar`s used to silence warnings outside of eval-when-compile.
Make sure they don't actually give a value to the var.

* pg-init.el: Simplify.
Use (if t ...) to avoid running `require` at compile-time.
Don't add subdirs to load-path here since this code is never used.
(pg-init--script-full-path, pg-init--pg-root):
Inline their definition into their sole user.

* generic/proof-utils.el (proof-resize-window-tofit):
Inline definitions of window-leftmost-p and window-rightmost-p previously
in proof-compat.el.

* lib/proof-compat.el (proof-running-on-win32): Remove, not used.
(mac-key-mode): Remove, there's no carbon-emacs-package-version in
Emacs≥24.3.
(pg-custom-undeclare-variable): Use dolist.
(save-selected-frame): Remove, save-selected-window also saves&restores
the selected frame at the same time.  Update all users (which already
used save-selected-window around it).
(window-leftmost-p, window-rightmost-p, window-bottom-p)
(find-coding-system): Remove, unused.

* hol-light/hol-light.el (caml-font-lock-keywords): Don't try to defvar
it to a dummy value and...
(hol-light): ...check its existence before using it instead.

* coq/coq.el (coq-may-use-prettify): Simplify initialization.
  • Loading branch information
monnier authored and cpitclaudel committed Dec 12, 2018
1 parent 05df29f commit a921439
Show file tree
Hide file tree
Showing 23 changed files with 110 additions and 202 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
nohup.out
TAGS
ChangeLog
proof-general-autoloads.el
*.elc
*~
9 changes: 4 additions & 5 deletions coq/coq-compile-common.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand All @@ -26,10 +26,9 @@
(require 'coq-system)
(require 'compile)

(eval-when-compile
;;(defvar coq-pre-v85 nil)
(defvar coq-confirm-external-compilation); defpacustom
(defvar coq-compile-parallel-in-background)) ; defpacustom
;;(defvar coq-pre-v85 nil)
(defvar coq-confirm-external-compilation); defpacustom
(defvar coq-compile-parallel-in-background) ; defpacustom

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
Expand Down
5 changes: 2 additions & 3 deletions coq/coq-indent.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand Down Expand Up @@ -33,8 +33,7 @@
; ,@body
; (message "%.06f" (float-time (time-since time)))))

(eval-when-compile
(defvar coq-script-indent))
(defvar coq-script-indent)

(defconst coq-any-command-regexp
(proof-regexp-alt-list coq-keywords))
Expand Down
7 changes: 3 additions & 4 deletions coq/coq-local-vars.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand All @@ -22,9 +22,8 @@
(eval-when-compile
(require 'cl))

(eval-when-compile
(defvar coq-prog-name)
(defvar coq-load-path))
(defvar coq-prog-name)
(defvar coq-load-path)


(defconst coq-local-vars-doc nil
Expand Down
5 changes: 2 additions & 3 deletions coq/coq-par-compile.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand Down Expand Up @@ -37,8 +37,7 @@
(eval-when-compile
(require 'proof-compat))

(eval-when-compile
(defvar queueitems)) ; dynamic scope in p-s-extend-queue-hook
(defvar queueitems) ; dynamic scope in p-s-extend-queue-hook

(require 'coq-compile-common)

Expand Down
5 changes: 2 additions & 3 deletions coq/coq-seq-compile.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand All @@ -27,8 +27,7 @@
(eval-when-compile
(require 'proof-compat))

(eval-when-compile
(defvar queueitems)) ; dynamic scope in p-s-extend-queue-hook
(defvar queueitems) ; dynamic scope in p-s-extend-queue-hook

(require 'coq-compile-common)

Expand Down
7 changes: 3 additions & 4 deletions coq/coq-system.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand All @@ -29,9 +29,8 @@
(require 'cl)
(require 'proof-compat))

(eval-when-compile
(defvar coq-prog-args)
(defvar coq-debug))
(defvar coq-prog-args)
(defvar coq-debug)

;; Arbitrary arguments can already be passed through _CoqProject.
;; However this is not true for all assistants, so we don't modify the
Expand Down
72 changes: 33 additions & 39 deletions coq/coq.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand All @@ -28,21 +28,20 @@
(require 'span)
(require 'outline)
(require 'newcomment)
(require 'etags)
(unless (proof-try-require 'smie)
(defvar smie-indent-basic)
(defvar smie-rules-function))
(defvar proof-info) ; dynamic scope in proof-tree-urgent-action
(defvar action) ; dynamic scope in coq-insert-as stuff
(defvar string) ; dynamic scope in coq-insert-as stuff
(defvar old-proof-marker)
(defvar coq-keymap)
(defvar coq-one-command-per-line)
(defvar coq-auto-insert-as) ; defpacustom
(defvar coq-time-commands) ; defpacustom
(defvar coq-use-project-file) ; defpacustom
(defvar coq-use-editing-holes) ; defpacustom
(defvar coq-hide-additional-subgoals))
(require 'etags))
(defvar smie-indent-basic)
(defvar smie-rules-function)
(defvar proof-info) ; dynamic scope in proof-tree-urgent-action
(defvar action) ; dynamic scope in coq-insert-as stuff
(defvar string) ; dynamic scope in coq-insert-as stuff
(defvar old-proof-marker)
(defvar coq-keymap)
(defvar coq-one-command-per-line)
(defvar coq-auto-insert-as) ; defpacustom
(defvar coq-time-commands) ; defpacustom
(defvar coq-use-project-file) ; defpacustom
(defvar coq-use-editing-holes) ; defpacustom
(defvar coq-hide-additional-subgoals)

(require 'proof)
(require 'coq-system) ; load path, option, project file etc.
Expand All @@ -66,11 +65,8 @@

;; prettify is in emacs > 24.4
;; FIXME: this should probably be done like for smie above.
(defvar coq-may-use-prettify nil) ; may become t below
(eval-when-compile
(if (fboundp 'prettify-symbols-mode)
(defvar coq-may-use-prettify t)
(defvar prettify-symbols-alist nil)))
(defvar coq-may-use-prettify (fboundp 'prettify-symbols-mode))
(defvar prettify-symbols-alist)


;; ----- coq-shell configuration options
Expand Down Expand Up @@ -911,22 +907,21 @@ This is mapped to control/shift mouse-1, unless coq-remap-mouse-1
is nil (t by default)."
(interactive "e")
(save-selected-window
(save-selected-frame
(save-excursion
(mouse-set-point event)
(let* ((id (coq-id-at-point))
(notat (coq-notation-at-position (point)))
(modifs (event-modifiers event))
(shft (member 'shift modifs))
(ctrl (member 'control modifs))
(cmd (when (or id notat)
(if (and ctrl shft) (if id "Check" "Locate")
(if shft (if id "About" "Locate")
(if ctrl (if id "Print" "Locate")))))))
(proof-shell-invisible-command
(format (concat cmd " %s . ")
;; Notation need to be surrounded by ""
(if id id (concat "\"" notat "\"")))))))))
(save-excursion
(mouse-set-point event)
(let* ((id (coq-id-at-point))
(notat (coq-notation-at-position (point)))
(modifs (event-modifiers event))
(shft (member 'shift modifs))
(ctrl (member 'control modifs))
(cmd (when (or id notat)
(if (and ctrl shft) (if id "Check" "Locate")
(if shft (if id "About" "Locate")
(if ctrl (if id "Print" "Locate")))))))
(proof-shell-invisible-command
(format (concat cmd " %s . ")
;; Notation need to be surrounded by ""
(if id id (concat "\"" notat "\""))))))))

(defun coq-guess-or-ask-for-string (s &optional dontguess)
"Asks for a coq identifier with message S.
Expand Down Expand Up @@ -1211,8 +1206,7 @@ Printing All set."
(coq-ask-do-show-all "Show goal number" "Show" t))

;; Check
(eval-when-compile
(defvar coq-auto-adapt-printing-width)); defpacustom
(defvar coq-auto-adapt-printing-width); defpacustom

;; Since Printing Width is a synchronized option in coq (?) it is retored
;; silently to a previous value when retracting. So we reset the stored width
Expand Down
8 changes: 4 additions & 4 deletions generic/pg-goals.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand All @@ -20,9 +20,9 @@
(eval-when-compile
(require 'easymenu) ; easy-menu-add, etc
(require 'cl) ; incf
(require 'span) ; span-*
(defvar proof-goals-mode-menu) ; defined by macro below
(defvar proof-assistant-menu)) ; defined by macro in proof-menu
(require 'span)) ; span-*
(defvar proof-goals-mode-menu) ; defined by macro below
(defvar proof-assistant-menu) ; defined by macro in proof-menu

(require 'pg-assoc)

Expand Down
8 changes: 4 additions & 4 deletions generic/pg-response.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand All @@ -24,9 +24,9 @@

(eval-when-compile
(require 'easymenu) ; easy-menu-add
(require 'proof-utils) ; deflocal, proof-eval-when-ready-for-assistant
(defvar proof-response-mode-menu nil)
(defvar proof-assistant-menu nil))
(require 'proof-utils)) ; deflocal, proof-eval-when-ready-for-assistant
(defvar proof-response-mode-menu)
(defvar proof-assistant-menu)

(require 'pg-assoc)
(require 'span)
Expand Down
9 changes: 4 additions & 5 deletions generic/pg-user.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand Down Expand Up @@ -863,10 +863,9 @@ The function `substitute-command-keys' is called on the argument."
(interactive "e")
(if proof-query-identifier-command
(save-selected-window
(save-selected-frame
(save-excursion
(mouse-set-point event)
(pg-identifier-near-point-query))))))
(save-excursion
(mouse-set-point event)
(pg-identifier-near-point-query)))))

;;;###autoload
(defun pg-identifier-near-point-query ()
Expand Down
2 changes: 0 additions & 2 deletions generic/proof-autoloads.el
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

;;; Code:

(eval-when-compile
(require 'cl))

(eval-when-compile
(require 'pg-vars)
Expand Down
7 changes: 3 additions & 4 deletions generic/proof-menu.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand All @@ -19,9 +19,8 @@
;;; Code:
(require 'cl) ; mapcan

(eval-when-compile
(defvar proof-assistant-menu) ; defined by macro in proof-menu-define-specific
(defvar proof-mode-map))
(defvar proof-assistant-menu) ; defined by macro in proof-menu-define-specific
(defvar proof-mode-map)

(require 'proof-utils) ; proof-deftoggle, proof-eval-when-ready-for-assistant
(require 'proof-useropts)
Expand Down
8 changes: 4 additions & 4 deletions generic/proof-script.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand All @@ -30,9 +30,9 @@
(require 'proof-syntax) ; utils for manipulating syntax

(eval-when-compile
(require 'easymenu)
(defvar proof-mode-menu nil)
(defvar proof-assistant-menu nil))
(require 'easymenu))
(defvar proof-mode-menu)
(defvar proof-assistant-menu)

(declare-function proof-shell-strip-output-markup "proof-shell"
(string &optional push))
Expand Down
10 changes: 4 additions & 6 deletions generic/proof-shell.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is part of Proof General.

;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003, 2012, 2014 Free Software Foundation, Inc.
;; Portions © Copyright 2003-2018 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
Expand Down Expand Up @@ -34,9 +34,8 @@
(declare-function proof-tree-urgent-action "proof-tree" (flags))
(declare-function proof-tree-handle-delayed-output "proof-tree"
(old-proof-marker cmd flags span))
(eval-when-compile
;; without the nil initialization the compiler still warns about this variable
(defvar proof-tree-external-display nil))
;; without the nil initialization the compiler still warns about this variable
(defvar proof-tree-external-display)

(require 'scomint)
(require 'pg-response)
Expand Down Expand Up @@ -454,8 +453,7 @@ process command."
;; Call multiple-frames-enable in case we need to fire up
;; new frames (NB: sets specifiers to remove modeline)
(save-selected-window
(save-selected-frame
(proof-multiple-frames-enable)))))
(proof-multiple-frames-enable))))

(message "Starting %s process... done." proc))))

Expand Down
Loading

0 comments on commit a921439

Please sign in to comment.