branch: externals/auctex commit c2a40eb8e32ac79e779bf7d7c0b2c896a08736bb Author: Ikumi Keita <ik...@ikumi.que.jp> Commit: Ikumi Keita <ik...@ikumi.que.jp>
Use built-in functions for similar functions * tex.el (TeX-split-string): Simplify by `split-string' and mark obsolete. (TeX-assoc): Simplify by `assoc-string' and mark obsolete. * doc/changes.texi (News in 13.0): Add announce that these functions are removed in future release. * latex.el (LaTeX-split-bibs, LaTeX-auto-cleanup) (LaTeX-209-to-2e): * style/babel.el (LaTeX-babel-active-languages): Replace `TeX-split-string' by `split-string'. * tex-buf.el (TeX-command-query, TeX-printer-query): Replace `TeX-assoc' by `assoc-string'. --- doc/changes.texi | 12 +++++++++--- latex.el | 10 +++++----- style/babel.el | 4 ++-- tex-buf.el | 4 ++-- tex.el | 42 +++++++++++------------------------------- 5 files changed, 29 insertions(+), 43 deletions(-) diff --git a/doc/changes.texi b/doc/changes.texi index 39cd713..109c4da 100644 --- a/doc/changes.texi +++ b/doc/changes.texi @@ -12,6 +12,12 @@ @itemize @bullet @item +Two functions @code{TeX-split-string} and @code{TeX-assoc} are now +obsolete and will be removed in future release. If your personal code +uses these functions, use @code{split-string} and @code{assoc-string} +instead. + +@item Since @AUCTeX{} 12.2, @kbd{C-x C-w} accidentally disabled the parse on save in that buffer, even when you enabled @code{TeX-auto-save} option. This bug was fixed. @@ -20,9 +26,9 @@ This bug was fixed. @AUCTeX{} now requires GNU Emacs 24.3 or higher. @item -Old implementations for viewers were discarded, as stated long before. -The variables @code{TeX-output-view-style} and @code{TeX-view-style} -have no effect now. The former placeholders @samp{%v} and @samp{%vv} in +Old implementations for viewers were discarded, as announced long before. +The variables @code{TeX-output-view-style} and @code{TeX-view-style} have +no effect now. The former placeholders @samp{%v} and @samp{%vv} in @code{TeX-command-list} are ignored. @item diff --git a/latex.el b/latex.el index 643021d..68ed0f3 100644 --- a/latex.el +++ b/latex.el @@ -1733,7 +1733,7 @@ This is necessary since index entries may contain commands and stuff.") (defun LaTeX-split-bibs (match) "Extract bibliography resources from MATCH. Split the string at commas and remove Biber file extensions." - (let ((bibs (TeX-split-string " *, *" (TeX-match-buffer match)))) + (let ((bibs (split-string (TeX-match-buffer match) " *, *"))) (dolist (bib bibs) (LaTeX-add-bibliographies (replace-regexp-in-string (concat "\\(?:\\." @@ -1841,7 +1841,7 @@ The value is actually the tail of the list of options given to PACKAGE." ;; Cleanup BibTeX/Biber files (setq LaTeX-auto-bibliography (apply #'append (mapcar (lambda (arg) - (TeX-split-string "," arg)) + (split-string arg ",")) LaTeX-auto-bibliography))) ;; Reset class and packages options for the current buffer @@ -1865,8 +1865,8 @@ The value is actually the tail of the list of options given to PACKAGE." ;; Treat documentclass/documentstyle specially. (if (or (string-equal "package" class) (string-equal "Package" class)) - (dolist (elt (TeX-split-string - "\\([ \t\r\n]\\|%[^\n\r]*[\n\r]\\|,\\)+" style)) + (dolist (elt (split-string + style "\\([ \t\r\n]\\|%[^\n\r]*[\n\r]\\|,\\)+")) ;; Append style to the style list. (add-to-list 'TeX-auto-file elt t) ;; Append to `LaTeX-provided-package-options' the name of the @@ -6856,7 +6856,7 @@ function would return non-nil and `(match-string 1)' would return (point-max) t) (setq optstr (TeX-match-buffer 1) docstyle (TeX-match-buffer 2) - optlist (TeX-split-string "," optstr)) + optlist (split-string optstr ",")) (if (search-forward-regexp "\\\\documentstyle{\\([^}]*\\)}" (point-max) t) diff --git a/style/babel.el b/style/babel.el index 548f2c8..9206dac 100644 --- a/style/babel.el +++ b/style/babel.el @@ -115,7 +115,7 @@ ;; take the car of `LaTeX-provided-class-options'. (cdr (car LaTeX-provided-class-options)) (cdr (assoc "babel" LaTeX-provided-package-options)))) - (setq elt (TeX-split-string "=" elt)) + (setq elt (split-string elt "=")) (if (equal (car elt) "main") ;; Starting from version 3.9 of `babel' package, languages can be set ;; with the following syntax: @@ -126,7 +126,7 @@ (setq main-language (car (cdr elt))) ;; Get rid of the modifiers (`medieval' and `notilde' in the above ;; example). - (setq elt (car (TeX-split-string "\\." (car elt)))) + (setq elt (car (split-string (car elt) "\\."))) (if (member elt LaTeX-babel-language-list) ;; Append element to `active-languages' to respect loading order. ;; `babel' package uses as default language the last loaded one, diff --git a/tex-buf.el b/tex-buf.el index 24d287c..f0e26bc 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -877,7 +877,7 @@ omitted) and `TeX-region-file'." (TeX-mode-specific-command-list major-mode) nil t nil 'TeX-command-history default)))) ;; If the answer is "latex" it will not be expanded to "LaTeX" - (setq answer (car-safe (TeX-assoc answer TeX-command-list))) + (setq answer (car-safe (assoc-string answer TeX-command-list t))) (if (and answer (not (string-equal answer ""))) answer @@ -906,7 +906,7 @@ QUEUE is non-nil when we are checking for the printer queue." (format " (default %s)" TeX-printer-default) "")) TeX-printer-list)) "")) - (setq printer (or (car-safe (TeX-assoc printer TeX-printer-list)) + (setq printer (or (car-safe (assoc-string printer TeX-printer-list t)) printer)) (not (if (or (null printer) (string-equal "" printer)) (setq printer TeX-printer-default) diff --git a/tex.el b/tex.el index b4a76b9..dcdabf6 100644 --- a/tex.el +++ b/tex.el @@ -2570,36 +2570,19 @@ be relative to that." :group 'TeX-file :type 'string) +;; Compatibility alias (defun TeX-split-string (regexp string) - "Return a list of strings. -Given REGEXP the STRING is split into sections which in string was -separated by REGEXP. - -Examples: - - (TeX-split-string \"\:\" \"abc:def:ghi\") - -> (\"abc\" \"def\" \"ghi\") - - (TeX-split-string \" +\" \"dvips -Plw -p3 -c4 testfile.dvi\") - - -> (\"dvips\" \"-Plw\" \"-p3\" \"-c4\" \"testfile.dvi\") - -If REGEXP is nil, or \"\", an error will occur." - - (let ((start 0) result match) - (while (setq match (string-match regexp string start)) - (push (substring string start match) result) - (setq start (match-end 0))) - (push (substring string start) result) - (nreverse result))) + (split-string string regexp)) +(make-obsolete 'TeX-split-string + "use (split-string STRING REGEXP) instead." "AUCTeX 13.0") (defun TeX-parse-path (env) "Return a list if private TeX directories found in environment variable ENV." (let* ((value (getenv env)) (entries (and value - (TeX-split-string - (if (string-match ";" value) ";" ":") - value))) + (split-string + value + (if (string-match ";" value) ";" ":")))) (global (append '("/" "\\") (mapcar #'file-name-as-directory TeX-macro-global))) @@ -4725,14 +4708,11 @@ Return nil if ELT is not a member of LIST." (when (member elt list) (throw 'found t))))) +;; Compatibility alias (defun TeX-assoc (key list) - "Return non-nil if KEY is `equal' to the car of an element of LIST. -Like assoc, except case insensitive." - (let ((case-fold-search t)) - (TeX-member key list - (lambda (a b) - (string-match (concat "^" (regexp-quote a) "$") - (car b)))))) + (assoc-string key list t)) +(make-obsolete 'TeX-assoc + "use (assoc-string KEY LIST t) instead." "AUCTeX 13.0") (defun TeX-match-buffer (n) "Return the substring corresponding to the N'th match.