branch: externals/auctex commit 07b79fca8bf7114981605748735594d7b1eff0a5 Author: Arash Esbati <ar...@gnu.org> Commit: Arash Esbati <ar...@gnu.org>
; Silence the compiler * bib-cite.el: Declare external functions. (bib-find-next): Check if `xref-find-definitions' is available and use it instead of `find-tag'. * context.el: defvar `ConTeXt-extra-paragraph-commands'. (ConTeXt-numbered-section-heading) (ConTeXt-unnumbered-section-heading, ConTeXt-section-title) (ConTeXt-section-section, ConTeXt-section-ref): Wrap code in `with-no-warnings' in order to suppress warnings for dynamically scoped variables `reference', `title', `name' and `level'. * tex-bar.el (TeX-bar-TeX-buttons, TeX-bar-LaTeX-buttons): Move functions after `defcustom' forms. * tex-info.el: defvar `reftex-label-alist-builtin'. --- bib-cite.el | 19 ++++++++++-- context.el | 94 ++++++++++++++++++++++++++++---------------------------- tex-bar.el | 100 ++++++++++++++++++++++++++++++------------------------------ tex-info.el | 1 + 4 files changed, 113 insertions(+), 101 deletions(-) diff --git a/bib-cite.el b/bib-cite.el index d871cb0..8d346c3 100644 --- a/bib-cite.el +++ b/bib-cite.el @@ -592,6 +592,14 @@ (eval-when-compile (require 'cl-lib)) +;; Silence the compiler: +(declare-function dired-replace-in-string "ext:dired" + (regexp newtext string)) +(declare-function dired-split "ext:dired-aux" + (pat str &optional limit)) +(declare-function reftex-view-crossref "ext:reftex-dcr" + (&optional arg auto-how fail-quietly)) + (defgroup bib-cite nil "bib-cite, LaTeX minor-mode to display \\cite, \\ref and \\label commands." :group 'tex) @@ -973,9 +981,14 @@ documents, and the Emacs command `find-tag' doesn't allow to interactively find the next occurrence of a regexp." (interactive "P") (if (bib-master-file) ;Multi-file document - (if prev-p - (find-tag t '- t) - (find-tag t t t)) + ;; FIXME: This check for `xref-find-definitions' should be + ;; removed once AUCTeX requires Emacs >= 25.1 + (let ((func (if (fboundp 'xref-find-definitions) + 'xref-find-definitions + 'find-tag))) + (if prev-p + (funcall func t '- t) + (funcall func t t t))) (if bib-cite-search-ring ;;FIXME: Should first make sure I move off initial \ref{}. (let ((regexp (concat bib-ref-regexpc bib-cite-search-ring "}"))) diff --git a/context.el b/context.el index 87bcd38..0d65249 100644 --- a/context.el +++ b/context.el @@ -55,6 +55,9 @@ (require 'latex) ; for functions like `TeX-look-at' and `LaTeX-split-long-menu' (require 'plain-tex) ; for `plain-TeX-common-initialization' +;; Silence the compiler: +(defvar ConTeXt-extra-paragraph-commands) + (defgroup ConTeXt-macro nil "Special support for ConTeXt macros in AUCTeX." :prefix "TeX-" @@ -64,19 +67,10 @@ ;;; variables -;; 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! -(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) +;; 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) ;; others @@ -507,49 +501,53 @@ 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]'." - (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)))) + (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))))) (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]'." - (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)))) + (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))))) (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]." - (setq title (TeX-read-string "What title: "))) + (with-no-warnings + (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." - (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) + (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)) (newline) ;; If RefTeX is available, tell it that we've just made a new section (and (fboundp 'reftex-notice-new-section) @@ -559,14 +557,14 @@ 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." - - (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))) + (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)))) ;; Various diff --git a/tex-bar.el b/tex-bar.el index 3098b4d..a908695 100644 --- a/tex-bar.el +++ b/tex-bar.el @@ -117,35 +117,11 @@ alists, see variable `TeX-bar-TeX-all-button-alists'." (const bibtex) (const clean) (const spell)) - ;; (const latex-symbols-experimental) + ;; (const latex-symbols-experimental) (repeat (choice (symbol :tag "Label") (sexp :tag "General element")))) :group 'TeX-tool-bar) -(defun TeX-bar-TeX-buttons () - "Display in a buffer a list of buttons for `tex-bar.el'." - (interactive) - (let ((assqs-button-alists) - (labels)) - (dolist (m-alist TeX-bar-TeX-all-button-alists) - (setq labels nil) - (dolist (as (eval m-alist)) - (setq labels (cons (car as) labels))) - (setq assqs-button-alists (cons (cons m-alist (nreverse labels)) - assqs-button-alists))) - (setq assqs-button-alists (nreverse assqs-button-alists)) - ;; displaying results - (with-current-buffer (get-buffer-create "*TeX tool bar buttons*") - (erase-buffer) - (insert "Available buttons for TeX mode -================================") - (dolist (i assqs-button-alists) - (insert (format "\n\n`%s' provides the following buttons:\n " (car i))) - (dolist (j (cdr i)) - (insert (format " %s" j))) - (fill-region (point-at-bol) (point-at-eol)))) - (display-buffer "*TeX tool bar buttons*" t))) - (defgroup TeX-tool-bar-button-definitions nil "Collections of button definitions." :group 'TeX-tool-bar) @@ -208,6 +184,30 @@ format of the argument MEANING-ALIST in the mentioned function." :type '(alist :key-type symbol :value-type sexp) :group 'TeX-tool-bar-button-definitions) +(defun TeX-bar-TeX-buttons () + "Display in a buffer a list of buttons for `tex-bar.el'." + (interactive) + (let ((assqs-button-alists) + (labels)) + (dolist (m-alist TeX-bar-TeX-all-button-alists) + (setq labels nil) + (dolist (as (eval m-alist)) + (setq labels (cons (car as) labels))) + (setq assqs-button-alists (cons (cons m-alist (nreverse labels)) + assqs-button-alists))) + (setq assqs-button-alists (nreverse assqs-button-alists)) + ;; displaying results + (with-current-buffer (get-buffer-create "*TeX tool bar buttons*") + (erase-buffer) + (insert "Available buttons for TeX mode +================================") + (dolist (i assqs-button-alists) + (insert (format "\n\n`%s' provides the following buttons:\n " (car i))) + (dolist (j (cdr i)) + (insert (format " %s" j))) + (fill-region (point-at-bol) (point-at-eol)))) + (display-buffer "*TeX tool bar buttons*" t))) + ;;; Installation of the tool bar ;;;###autoload (defun TeX-install-toolbar () @@ -226,7 +226,7 @@ format of the argument MEANING-ALIST in the mentioned function." (defcustom TeX-bar-LaTeX-buttons '(new-file open-file dired kill-buffer save-buffer cut copy paste undo - [separator nil] latex next-error view bibtex spell) + [separator nil] latex next-error view bibtex spell) "List of buttons available in `latex-mode'. It should be a list in the same format of the BUTTONS parameter in function `toolbarx-install-toolbar', often a symbol that @@ -263,30 +263,6 @@ alists, see variable `TeX-bar-LaTeX-all-button-alists'." (sexp :tag "General element")))) :group 'TeX-tool-bar) -(defun TeX-bar-LaTeX-buttons () - "Display in a buffer a list of buttons for `tex-bar.el'." - (interactive) - (let ((assqs-button-alists) - (labels)) - (dolist (m-alist TeX-bar-LaTeX-all-button-alists) - (setq labels nil) - (dolist (as (eval m-alist)) - (setq labels (cons (car as) labels))) - (setq assqs-button-alists (cons (cons m-alist (nreverse labels)) - assqs-button-alists))) - (setq assqs-button-alists (nreverse assqs-button-alists)) - ;; displaying results - (with-current-buffer (get-buffer-create "*TeX tool bar buttons*") - (erase-buffer) - (insert "Available buttons for LaTeX mode -================================") - (dolist (i assqs-button-alists) - (insert (format "\n\n`%s' provides the following buttons:\n " (car i))) - (dolist (j (cdr i)) - (insert (format " %s" j))) - (fill-region (point-at-bol) (point-at-eol)))) - (display-buffer "*TeX tool bar buttons*" t))) - (defgroup TeX-tool-bar-button-definitions nil "Collections of button definitions." :group 'TeX-tool-bar) @@ -353,6 +329,30 @@ format of the argument MEANING-ALIST in the mentioned function." :type '(alist :key-type symbol :value-type sexp) :group 'TeX-tool-bar-button-definitions) +(defun TeX-bar-LaTeX-buttons () + "Display in a buffer a list of buttons for `tex-bar.el'." + (interactive) + (let ((assqs-button-alists) + (labels)) + (dolist (m-alist TeX-bar-LaTeX-all-button-alists) + (setq labels nil) + (dolist (as (eval m-alist)) + (setq labels (cons (car as) labels))) + (setq assqs-button-alists (cons (cons m-alist (nreverse labels)) + assqs-button-alists))) + (setq assqs-button-alists (nreverse assqs-button-alists)) + ;; displaying results + (with-current-buffer (get-buffer-create "*TeX tool bar buttons*") + (erase-buffer) + (insert "Available buttons for LaTeX mode +================================") + (dolist (i assqs-button-alists) + (insert (format "\n\n`%s' provides the following buttons:\n " (car i))) + (dolist (j (cdr i)) + (insert (format " %s" j))) + (fill-region (point-at-bol) (point-at-eol)))) + (display-buffer "*TeX tool bar buttons*" t))) + ;;; Installation of the tool bar ;;;###autoload (defun LaTeX-install-toolbar () diff --git a/tex-info.el b/tex-info.el index 22e726e..7c4b8a9 100644 --- a/tex-info.el +++ b/tex-info.el @@ -437,6 +437,7 @@ is assumed by default." (defvar reftex-level-indent) (defvar reftex-label-menu-flags) (defvar reftex-tables-dirty) +(defvar reftex-label-alist-builtin) (declare-function reftex-match-string "reftex" (n)) (declare-function reftex-section-number "reftex-parse" (&optional level star))