branch: externals/auctex-cont-latexmk commit b5bd4c52576a030c06783090f149e6f3befd90a4 Author: Paul Nelson <ultr...@gmail.com> Commit: Paul Nelson <ultr...@gmail.com>
indentation --- czm-tex-compile.el | 75 +++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/czm-tex-compile.el b/czm-tex-compile.el index 6989cb71bf..12c0233682 100644 --- a/czm-tex-compile.el +++ b/czm-tex-compile.el @@ -105,7 +105,8 @@ Used for navigating LaTeX warnings in the log file." "Helper function to navigate warnings in the log file. DIRECTION should be either \='next or \='previous." (let* ((tex-file (buffer-file-name)) - (log-file (concat (file-name-sans-extension tex-file) ".log")) + (log-file (concat (file-name-sans-extension tex-file) + ".log")) (file-modification-time (nth 5 (file-attributes log-file))) (last-navigation-time (car czm-tex-compile--log-state)) (log-pos (cdr czm-tex-compile--log-state)) @@ -114,47 +115,47 @@ DIRECTION should be either \='next or \='previous." (insert-file-contents log-file) (save-excursion) (if (or (null last-navigation-time) - (time-less-p last-navigation-time file-modification-time)) - (goto-char (if (eq direction 'previous) + (time-less-p last-navigation-time file-modification-time)) + (goto-char (if (eq direction 'previous) (point-max) (point-min))) - (goto-char log-pos)) + (goto-char log-pos)) (let ((search-fn - (if (eq direction 'previous) + (if (eq direction 'previous) #'re-search-backward #'re-search-forward))) (when (eq direction 'next) (forward-line 2)) - (when (funcall search-fn - (concat "^" - (regexp-opt - '("! " - "LaTeX Warning: ")) - "[^ ]") - nil t) - (goto-char (match-beginning 0)) - (let ((error-p (looking-at "! "))) - (setq last-navigation-time (current-time)) - (setq description - (if error-p - (buffer-substring-no-properties - (point) + (when (funcall search-fn + (concat "^" + (regexp-opt + '("! " + "LaTeX Warning: ")) + "[^ ]") + nil t) + (goto-char (match-beginning 0)) + (let ((error-p (looking-at "! "))) + (setq last-navigation-time (current-time)) + (setq description + (if error-p + (buffer-substring-no-properties + (point) (line-end-position)) - (czm-tex-compile--paragraph-as-line))) - (if error-p - (progn - (save-excursion - (re-search-forward "^l\\.\\([0-9]+\\) " nil t) - (let ((line-number (when (match-string 1) + (czm-tex-compile--paragraph-as-line))) + (if error-p + (progn + (save-excursion + (re-search-forward "^l\\.\\([0-9]+\\) " nil t) + (let ((line-number (when (match-string 1) (string-to-number (match-string 1)))) - (line-prefix (buffer-substring-no-properties - (point) + (line-prefix (buffer-substring-no-properties + (point) (line-end-position)))) - (setq line (cons line-number line-prefix))))) - (when (string-match "input line \\([0-9]+\\)" description) - (setq line (string-to-number (match-string 1 description))))) + (setq line (cons line-number line-prefix))))) + (when (string-match "input line \\([0-9]+\\)" description) + (setq line (string-to-number (match-string 1 description))))) (forward-line -1) - ;; (forward-line (if (eq direction 'previous) -1 1)) - (setq log-pos (point)))))) + ;; (forward-line (if (eq direction 'previous) -1 1)) + (setq log-pos (point)))))) (setq-local czm-tex-compile--log-state (cons last-navigation-time log-pos)) (when line (let ((pos @@ -168,12 +169,12 @@ DIRECTION should be either \='next or \='previous." (forward-line (1- line-number))) (when (consp line) (when-let* ((search-string (cdr line)) - (truncated-search-string - (if (< (length search-string) + (truncated-search-string + (if (< (length search-string) 3) - search-string - (substring search-string 3)))) - (search-forward truncated-search-string nil t))) + search-string + (substring search-string 3)))) + (search-forward truncated-search-string nil t))) (point))))) (unless (<= (point-min) pos (point-max))