[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/flymake-refactor 745b721 1/4: Adjust flymake's UI/
From: |
João Távora |
Subject: |
[Emacs-diffs] scratch/flymake-refactor 745b721 1/4: Adjust flymake's UI/backend split started in earlier commit |
Date: |
Tue, 22 Aug 2017 21:38:17 -0400 (EDT) |
branch: scratch/flymake-refactor
commit 745b72110f03d4ac908ff3c04416dd3eafd1696b
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Adjust flymake's UI/backend split started in earlier commit
A previous commit of 2017-08-17, titled "Split flymake.el into
flymake-proc.el and flymake-ui.el" still left some definitions in the
wrong file, so ensure that nothing in flymake-ui.el needs anything in
flymake-proc.el, and reduce the number of things that the latter needs
to know about the former.
Also, the earlier commit prematurely renamed the interactive command
flymake-start-syntax-check to flymake-proc-start-syntax-check. Undo
that.
* lisp/progmodes/flymake-ui.el (flymake-new-err-info): Move to
flymake-proc.el. (flymake-fix-line-numbers): Move from
flymake-proc.el. (flymake--start-syntax-check): Set
`flymake-check-start-time'.
* lisp/progmodes/flymake-proc.el (flymake-fix-line-numbers): Move to
flymake-ui.el. (flymake-start-syntax-check): Rename to original name
from `flymake-proc-start-syntax-check'.
(flymake-start-syntax-check-process): Don't set
flymake-check-start-time. (flymake-backends): Use
`flymake-start-syntax-check'. (flymake-new-err-info): Move from
flymake-ui.el
---
lisp/progmodes/flymake-proc.el | 28 +++++-----------------------
lisp/progmodes/flymake-ui.el | 24 +++++++++++++++++++++---
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 3055555..f00ac1e 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -480,6 +480,9 @@ It's flymake process filter."
(flymake-parse-err-lines
flymake-new-err-info lines))))
+(defvar-local flymake-new-err-info nil
+ "Same as `flymake-err-info', effective when a syntax check is in progress.")
+
(defun flymake-parse-residual ()
"Parse residual if it's non empty."
(when flymake-output-residual
@@ -489,26 +492,6 @@ It's flymake process filter."
(list flymake-output-residual)))
(setq flymake-output-residual nil)))
-(defun flymake-fix-line-numbers (err-info-list min-line max-line)
- "Replace line numbers with fixed value.
-If line-numbers is less than MIN-LINE, set line numbers to MIN-LINE.
-If line numbers is greater than MAX-LINE, set line numbers to MAX-LINE.
-The reason for this fix is because some compilers might report
-line number outside the file being compiled."
- (let* ((count (length err-info-list))
- (err-info nil)
- (line 0))
- (while (> count 0)
- (setq err-info (nth (1- count) err-info-list))
- (setq line (flymake-er-get-line err-info))
- (when (or (< line min-line) (> line max-line))
- (setq line (if (< line min-line) min-line max-line))
- (setq err-info-list (flymake-set-at err-info-list (1- count)
- (flymake-er-make-er line
-
(flymake-er-get-line-err-info-list err-info)))))
- (setq count (1- count))))
- err-info-list)
-
(defun flymake-parse-err-lines (err-info-list lines)
"Parse err LINES, store info in ERR-INFO-LIST."
(let* ((count (length lines))
@@ -716,7 +699,7 @@ Return its components if so, nil otherwise."
(error
(flymake-log 1 "Failed to delete dir %s, error ignored" dir-name))))
-(defun flymake-proc-start-syntax-check ()
+(defun flymake-start-syntax-check ()
"Start syntax checking for current buffer."
(interactive)
(flymake-log 3 "flymake is running: %s" flymake-is-running)
@@ -759,7 +742,6 @@ Return its components if so, nil otherwise."
(setq flymake-is-running t)
(setq flymake-last-change-time nil)
- (setq flymake-check-start-time (float-time))
(flymake-report-status nil "*")
(flymake-log 2 "started process %d, command=%s, dir=%s"
@@ -1091,7 +1073,7 @@ Use CREATE-TEMP-F for creating temp copy."
(add-to-list 'flymake-backends
`(flymake-proc-can-syntax-check-buffer
.
- flymake-proc-start-syntax-check))
+ flymake-start-syntax-check))
(provide 'flymake-proc)
;;; flymake-proc.el ends here
diff --git a/lisp/progmodes/flymake-ui.el b/lisp/progmodes/flymake-ui.el
index bae9759..c5b9ee0 100644
--- a/lisp/progmodes/flymake-ui.el
+++ b/lisp/progmodes/flymake-ui.el
@@ -132,9 +132,6 @@ possibly asynchronously." :group 'flymake :type 'alist)
(defvar-local flymake-err-info nil
"Sorted list of line numbers and lists of err info in the form (file,
err-text).")
-(defvar-local flymake-new-err-info nil
- "Same as `flymake-err-info', effective when a syntax check is in progress.")
-
(defun flymake-log (level text &rest args)
"Log a message at level LEVEL.
If LEVEL is higher than `flymake-log-level', the message is
@@ -451,6 +448,26 @@ For the format of LINE-ERR-INFO, see
`flymake-ler-make-ler'."
(flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status
%s, warning %s"
(buffer-name) status warning))
+(defun flymake-fix-line-numbers (err-info-list min-line max-line)
+ "Replace line numbers with fixed value.
+If line-numbers is less than MIN-LINE, set line numbers to MIN-LINE.
+If line numbers is greater than MAX-LINE, set line numbers to MAX-LINE.
+The reason for this fix is because some compilers might report
+line number outside the file being compiled."
+ (let* ((count (length err-info-list))
+ (err-info nil)
+ (line 0))
+ (while (> count 0)
+ (setq err-info (nth (1- count) err-info-list))
+ (setq line (flymake-er-get-line err-info))
+ (when (or (< line min-line) (> line max-line))
+ (setq line (if (< line min-line) min-line max-line))
+ (setq err-info-list (flymake-set-at err-info-list (1- count)
+ (flymake-er-make-er line
+
(flymake-er-get-line-err-info-list err-info)))))
+ (setq count (1- count))))
+ err-info-list)
+
(defvar-local flymake--backend nil
"The currently active backend selected by `flymake-mode'")
@@ -461,6 +478,7 @@ For the format of LINE-ERR-INFO, see
`flymake-ler-make-ler'."
(throw 'done (cdr candidate))))))
(defun flymake--start-syntax-check ()
+ (setq flymake-check-start-time (float-time))
(funcall flymake--backend))
;;;###autoload