]> git.eshelyaron.com Git - emacs.git/commitdiff
(compilation-parse-errors-function): Remove obsolete var
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 21 Jul 2022 22:39:11 +0000 (18:39 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 21 Jul 2022 22:59:57 +0000 (18:59 -0400)
* lisp/progmodes/compile.el (compilation-parse-errors-function): Remove.
(compilation--parse-region): Simplify accordingly.
(compilation--compat-parse-errors): Remove function, not used any more.
(compilation-error-list, compilation-parsing-end)
(compilation-old-error-list): Remove vars, not used any more.
(compilation-last-buffer): Mark as obsolete (sadly, forgot to do that
back in Emacs-22).

* lisp/textmodes/tex-mode.el: Remove old code that was needed for
Emacs<24.

* lisp/progmodes/prolog.el (prolog-consult-compile): Remove long-dead code.
(compilation-parse-errors-function): Remove declaration, not used any more.
(prolog-parse-sicstus-compilation-errors): Remove function, not used any more.

etc/NEWS
lisp/obsolete/rcompile.el
lisp/progmodes/compile.el
lisp/progmodes/grep.el
lisp/progmodes/prolog.el
lisp/progmodes/verilog-mode.el
lisp/textmodes/tex-mode.el

index 5da0fdb769384835cac45dcc1ebba3bd073cf917..6d4fce12371c60aa9f44685e8d04e874de0660b0 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2313,6 +2313,10 @@ Use 'exif-parse-file' and 'exif-field' instead.
 ** 'insert-directory' alternatives should not change the free disk space line.
 This change is now applied in 'dired-insert-directory'.
 
+---
+** 'compilation-last-buffer' is (finally) declared obsolete.
+It's been obsolete since Emacs-22.1, actually.
+
 ---
 ** Some functions and variables obsolete since Emacs 24 have been removed:
 'Info-edit-map', 'allout-abbreviate-flattened-numbering',
@@ -2324,6 +2328,7 @@ This change is now applied in 'dired-insert-directory'.
 'chart-map', 'comint-dynamic-complete',
 'comint-dynamic-complete-as-filename',
 'comint-dynamic-simple-complete', 'command-history-map',
+'compilation-parse-errors-function',
 'completion-annotate-function', 'condition-case-no-debug',
 'count-lines-region', 'data-debug-map', 'deferred-action-list',
 'deferred-action-function', 'dired-x-submit-report',
index fbfc0c6bbca16486c928e1eeab739d7de7599b8d..ceffb072cb46c73732184ace904b6d2b4f76d42c 100644 (file)
@@ -167,7 +167,7 @@ See \\[compile]."
     (compilation-start compile-command)
     ;; Set comint-file-name-prefix in the compilation buffer so
     ;; compilation-parse-errors will find referenced files by Tramp.
-    (with-current-buffer compilation-last-buffer
+    (with-current-buffer next-error-last-buffer
       (when (fboundp 'tramp-make-tramp-file-name)
        (set (make-local-variable 'comint-file-name-prefix)
             (funcall
index 9f33186d8b1016bf671bc8c7490f885a0570a1e9..c71a50d4fde5ac6a575cedbb59c7995686e8e05c 100644 (file)
@@ -979,11 +979,6 @@ Faces `compilation-error-face', `compilation-warning-face',
 (defvar compilation-leave-directory-face 'font-lock-builtin-face
   "Face name to use for leaving directory messages.")
 
-;; Used for compatibility with the old compile.el.
-(defvar compilation-parse-errors-function nil)
-(make-obsolete-variable 'compilation-parse-errors-function
-                       'compilation-error-regexp-alist "24.1")
-
 (defcustom compilation-auto-jump-to-first-error nil
   "If non-nil, automatically jump to the first error during compilation."
   :type '(choice (const :tag "Never" nil)
@@ -1519,34 +1514,28 @@ RULE is the name (symbol) of the rule used or nil if anonymous.
             (and proc (memq (process-status proc) '(run open))))
       (setq end (line-beginning-position))))
   (compilation--remove-properties start end)
-  (if compilation-parse-errors-function
-      ;; An old package!  Try the compatibility code.
-      (progn
-        (goto-char start)
-        (compilation--compat-parse-errors end))
-
-    ;; compilation-directory-matcher is the only part that really needs to be
-    ;; parsed sequentially.  So we could split it out, handle directories
-    ;; like syntax-propertize, and the rest as font-lock-keywords.  But since
-    ;; we want to have it work even when font-lock is off, we'd then need to
-    ;; use our own compilation-parsed text-property to keep track of the parts
-    ;; that have already been parsed.
-    (goto-char start)
-    (while (re-search-forward (car compilation-directory-matcher)
-                              end t)
-      (compilation--flush-directory-cache (match-beginning 0) (match-end 0))
-      (when compilation-debug
-        (font-lock-append-text-property
-         (match-beginning 0) (match-end 0)
-         'compilation-debug
-         (vector 'directory compilation-directory-matcher)))
-      (dolist (elt (cdr compilation-directory-matcher))
-        (add-text-properties (match-beginning (car elt))
-                             (match-end (car elt))
-                             (compilation-directory-properties
-                              (car elt) (cdr elt)))))
-
-    (compilation-parse-errors start end)))
+  ;; compilation-directory-matcher is the only part that really needs to be
+  ;; parsed sequentially.  So we could split it out, handle directories
+  ;; like syntax-propertize, and the rest as font-lock-keywords.  But since
+  ;; we want to have it work even when font-lock is off, we'd then need to
+  ;; use our own compilation-parsed text-property to keep track of the parts
+  ;; that have already been parsed.
+  (goto-char start)
+  (while (re-search-forward (car compilation-directory-matcher)
+                            end t)
+    (compilation--flush-directory-cache (match-beginning 0) (match-end 0))
+    (when compilation-debug
+      (font-lock-append-text-property
+       (match-beginning 0) (match-end 0)
+       'compilation-debug
+       (vector 'directory compilation-directory-matcher)))
+    (dolist (elt (cdr compilation-directory-matcher))
+      (add-text-properties (match-beginning (car elt))
+                           (match-end (car elt))
+                           (compilation-directory-properties
+                            (car elt) (cdr elt)))))
+
+  (compilation-parse-errors start end))
 
 (defun compilation--note-type (type)
   "Note that a new message with severity TYPE was seen.
@@ -3259,73 +3248,11 @@ TRUE-DIRNAME is the `file-truename' of DIRNAME, if given."
                (if (eq v fs) (remhash k compilation-locs)))
              compilation-locs)))
 
-;;; Compatibility with the old compile.el.
-
-(defvaralias 'compilation-last-buffer 'next-error-last-buffer)
-(defvar compilation-parsing-end (make-marker))
-(defvar compilation-error-list nil)
-(defvar compilation-old-error-list nil)
-
-(defun compilation--compat-parse-errors (limit)
-  (when compilation-parse-errors-function
-    ;; FIXME: We should remove the rest of the compilation keywords
-    ;; but we can't do that from here because font-lock is using
-    ;; the value right now.  --Stef
-    (save-excursion
-      (setq compilation-error-list nil)
-      ;; Reset compilation-parsing-end each time because font-lock
-      ;; might force us the re-parse many times (typically because
-      ;; some code adds some text-property to the output that we
-      ;; already parsed).  You might say "why reparse", well:
-      ;; because font-lock has just removed the `compilation-message' property
-      ;; so have to do it all over again.
-      (if compilation-parsing-end
-         (set-marker compilation-parsing-end (point))
-       (setq compilation-parsing-end (point-marker)))
-      (condition-case nil
-         ;; Ignore any error: we're calling this function earlier than
-         ;; in the old compile.el so things might not all be setup yet.
-         (funcall compilation-parse-errors-function limit nil)
-       (error nil))
-      (dolist (err (if (listp compilation-error-list) compilation-error-list))
-       (let* ((src (car err))
-              (dst (cdr err))
-              (loc (cond ((markerp dst)
-                           (cons nil
-                                 (compilation--make-cdrloc nil nil dst)))
-                         ((consp dst)
-                           (cons (nth 2 dst)
-                                 (compilation--make-cdrloc
-                                  (nth 1 dst)
-                                  (cons (cdar dst) (caar dst))
-                                  nil))))))
-         (when loc
-           (goto-char src)
-           ;; (put-text-property src (line-end-position)
-            ;;                    'font-lock-face 'font-lock-warning-face)
-           (put-text-property src (line-end-position)
-                              'compilation-message
-                               (compilation--make-message loc 2 nil nil)))))))
-  (goto-char limit)
-  nil)
-
-;; Beware! this is not only compatibility code.  New code also uses it.  --Stef
 (defun compilation-forget-errors ()
   ;; In case we hit the same file/line specs, we want to recompute a new
   ;; marker for them, so flush our cache.
   (clrhash compilation-locs)
   (setq compilation-gcpro nil)
-  ;; FIXME: the old code reset the directory-stack, so maybe we should
-  ;; put a `directory change' marker of some sort, but where?  -stef
-  ;;
-  ;; FIXME: The old code moved compilation-current-error (which was
-  ;; virtually represented by a mix of compilation-parsing-end and
-  ;; compilation-error-list) to point-min, but that was only meaningful for
-  ;; the internal uses of compilation-forget-errors: all calls from external
-  ;; packages seem to be followed by a move of compilation-parsing-end to
-  ;; something equivalent to point-max.  So we heuristically move
-  ;; compilation-current-error to point-max (since the external package
-  ;; won't know that it should do it).  --Stef
   (setq compilation-current-error nil)
   (let* ((proc (get-buffer-process (current-buffer)))
         (mark (if proc (process-mark proc)))
@@ -3344,6 +3271,10 @@ TRUE-DIRNAME is the `file-truename' of DIRNAME, if given."
               (or compilation-auto-jump-to-first-error
                   (eq compilation-scroll-output 'first-error))))
 
+(define-obsolete-variable-alias 'compilation-last-buffer
+  ;; Sadly, we forgot to declare this obsolete back then :-(
+  'next-error-last-buffer "29.1 (tho really since 22.1)")
+
 (provide 'compile)
 
 ;;; compile.el ends here
index 423de7d5818f7e3680a10d54559aaacaec129afc..c01d7e997ecf48f107673ff976311c3d96d3eddf 100644 (file)
@@ -345,12 +345,12 @@ See `compilation-error-screen-columns'."
 
 (defalias 'kill-grep #'kill-compilation)
 
-;; override compilation-last-buffer
+;; override next-error-last-buffer
 (defvar grep-last-buffer nil
   "The most recent grep buffer.
 A grep buffer becomes most recent when you select Grep mode in it.
 Notice that using \\[next-error] or \\[compile-goto-error] modifies
-`compilation-last-buffer' rather than `grep-last-buffer'.")
+`next-error-last-buffer' rather than `grep-last-buffer'.")
 
 (defvar grep-match-face        'match
   "Face name to use for grep matches.")
index 5aba95d4c79feb0b0b33f89d7e48382c8f0e3fa9..e3ddf28bbbeab58d7171ae56b878c23ebc3da467 100644 (file)
@@ -1620,8 +1620,6 @@ Used for temporary files.")
 (defvar prolog-consult-compile-real-file nil
   "The file name of the buffer to compile/consult.")
 
-(defvar compilation-parse-errors-function)
-
 (defun prolog-consult-compile (compilep file &optional first-line)
   "Consult/compile FILE.
 If COMPILEP is non-nil, perform compilation, otherwise perform CONSULTING.
@@ -1647,14 +1645,14 @@ This function must be called from the source code buffer."
       ;; Setting up font-locking for this buffer
       (setq-local font-lock-defaults
                   '(prolog-font-lock-keywords nil nil ((?_ . "w"))))
-      (if (eq prolog-system 'sicstus)
-          ;; FIXME: This looks really problematic: not only is this using
-          ;; the old compilation-parse-errors-function, but
-          ;; prolog-parse-sicstus-compilation-errors only accepts one argument
-          ;; whereas compile.el calls it with 2 (and did so at least since
-          ;; Emacs-20).
-          (setq-local compilation-parse-errors-function
-                      'prolog-parse-sicstus-compilation-errors))
+      ;; (if (eq prolog-system 'sicstus)
+      ;;     ;; FIXME: This looks really problematic: not only is this using
+      ;;     ;; the old compilation-parse-errors-function, but
+      ;;     ;; prolog-parse-sicstus-compilation-errors only accepts one
+      ;;     ;; argument whereas compile.el calls it with 2 (and did so at
+      ;;     ;; least since Emacs-20).
+      ;;     (setq-local compilation-parse-errors-function
+      ;;                 #'prolog-parse-sicstus-compilation-errors))
       (setq buffer-read-only nil)
       (insert command-string "\n"))
     (display-buffer buffer)
@@ -1685,40 +1683,41 @@ This function must be called from the source code buffer."
 
 (defvar compilation-error-list)
 
-(defun prolog-parse-sicstus-compilation-errors (limit)
-  "Parse the prolog compilation buffer for errors.
-Argument LIMIT is a buffer position limiting searching.
-For use with the `compilation-parse-errors-function' variable."
-  (setq compilation-error-list nil)
-  (message "Parsing SICStus error messages...")
-  (let (filepath dir file errorline)
-    (while
-        (re-search-backward
-         "{\\([a-zA-Z ]* ERROR\\|Warning\\):.* in line[s ]*\\([0-9]+\\)"
-         limit t)
-      (setq errorline (string-to-number (match-string 2)))
-      (save-excursion
-        (re-search-backward
-         "{\\(consulting\\|compiling\\|processing\\) \\(.*\\)\\.\\.\\.}"
-         limit t)
-        (setq filepath (match-string 2)))
-
-      ;; ###### Does this work with SICStus under Windows
-      ;; (i.e. backslashes and stuff?)
-      (if (string-match "\\(.*/\\)\\([^/]*\\)$" filepath)
-          (progn
-            (setq dir (match-string 1 filepath))
-            (setq file (match-string 2 filepath))))
-
-      (setq compilation-error-list
-            (cons
-             (cons (save-excursion
-                     (beginning-of-line)
-                     (point-marker))
-                   (list (list file dir) errorline))
-             compilation-error-list)
-            ))
-    ))
+;; FIXME: This has been obsolete since Emacs-20!
+;; (defun prolog-parse-sicstus-compilation-errors (limit)
+;;   "Parse the prolog compilation buffer for errors.
+;; Argument LIMIT is a buffer position limiting searching.
+;; For use with the `compilation-parse-errors-function' variable."
+;;   (setq compilation-error-list nil)
+;;   (message "Parsing SICStus error messages...")
+;;   (let (filepath dir file errorline)
+;;     (while
+;;         (re-search-backward
+;;          "{\\([a-zA-Z ]* ERROR\\|Warning\\):.* in line[s ]*\\([0-9]+\\)"
+;;          limit t)
+;;       (setq errorline (string-to-number (match-string 2)))
+;;       (save-excursion
+;;         (re-search-backward
+;;          "{\\(consulting\\|compiling\\|processing\\) \\(.*\\)\\.\\.\\.}"
+;;          limit t)
+;;         (setq filepath (match-string 2)))
+
+;;       ;; ###### Does this work with SICStus under Windows
+;;       ;; (i.e. backslashes and stuff?)
+;;       (if (string-match "\\(.*/\\)\\([^/]*\\)$" filepath)
+;;           (progn
+;;             (setq dir (match-string 1 filepath))
+;;             (setq file (match-string 2 filepath))))
+
+;;       (setq compilation-error-list
+;;             (cons
+;;              (cons (save-excursion
+;;                      (beginning-of-line)
+;;                      (point-marker))
+;;                    (list (list file dir) errorline))
+;;              compilation-error-list)
+;;             ))
+;;     ))
 
 (defun prolog-consult-compile-filter (process output)
   "Filter function for Prolog compilation PROCESS.
index 31d50a1882e6b85aec86a716c33ec83c2f848c2b..9ab129d4474bf7d5efa0e4a1b9350ad17a0c3286 100644 (file)
@@ -5458,7 +5458,7 @@ For example:
 becomes:
         // surefire lint_line_off UDDONX"
   (interactive)
-  (let ((buff (if (boundp 'next-error-last-buffer)
+  (let ((buff (if (boundp 'next-error-last-buffer) ;Added to Emacs-22.1
                   next-error-last-buffer
                 compilation-last-buffer)))
     (when (buffer-live-p buff)
index d34133f8564525cee11b9537ddb24f4f5d8a4c1b..e6c0f8c28c04508a996f342712aef961cc7f7009 100644 (file)
@@ -2496,10 +2496,8 @@ Only applies the FSPEC to the args part of FORMAT."
     (let (shell-dirtrack-verbose)
       (tex-send-command tex-shell-cd-command dir)))
   (with-current-buffer (process-buffer (tex-send-command cmd))
-    (setq compilation-last-buffer (current-buffer))
-    (compilation-forget-errors)
-    ;; Don't parse previous compilations.
-    (set-marker compilation-parsing-end (1- (point-max))))
+    (setq next-error-last-buffer (current-buffer))
+    (compilation-forget-errors))
   (tex-display-shell)
   (setq tex-last-buffer-texed (current-buffer)))
 \f