Mercurial > dotfiles
changeset 479:601884c45f8a
emacs: switch to from-hg hg-test-mode config
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Thu, 21 Feb 2019 20:35:10 -0500 |
parents | 6bcdbe7b8e42 |
children | 4c5814d3cfd8 |
files | .elisp/settings/40.modes.el .elisp/settings/50.compilation-tweaks.el |
diffstat | 2 files changed, 6 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/.elisp/settings/40.modes.el +++ b/.elisp/settings/40.modes.el @@ -110,3 +110,9 @@ point." ;; Tempfiles from mutt should be edited in mail-mode. (add-to-list 'auto-mode-alist '("/mutt" . mail-mode)) + +(if (file-exists-p "~/Programming/hg/crew/contrib/hg-test-mode.el") + (progn + (load "~/Programming/hg/crew/contrib/hg-test-mode.el") + (add-to-list 'auto-mode-alist '("\\.t$'" . hg-test-mode)) + (add-hook 'hg-test-mode-hook 'af-no-clean-whitespace)))
deleted file mode 100644 --- a/.elisp/settings/50.compilation-tweaks.el +++ /dev/null @@ -1,75 +0,0 @@ -(require 'compile) - -(setq af--hg-test-traceback "^\\+ File ['\"]\\([^'\"]+\\)['\"], line \\([0-9]+\\),") - -(setq compilation-error-regexp-alist-alist - (cons `(mercurial-test-output-tb ,af--hg-test-traceback 1 2) - (assq-delete-all 'mercurial-test-output-tb - compilation-error-regexp-alist-alist))) - -(setq af--hg-check-code-error-re " \\([^:\n]+\\):\\([0-9]+\\):$") - -(setq compilation-error-regexp-alist-alist - (cons `(mercurial-check-code-output ,af--hg-check-code-error-re 1 2) - (assq-delete-all 'mercurial-check-code-output - compilation-error-regexp-alist-alist))) - -(add-to-list 'compilation-error-regexp-alist 'mercurial-test-output-tb) -(add-to-list 'compilation-error-regexp-alist 'mercurial-check-code-output) - -;; to debug: -;;(setq compilation-error-regexp-alist '(mercurial-check-code-output -;; mercurial-test-output-tb)) - - -;; stolen from compile-tests.el -(defun af--compile--test-error-line (test) - (erase-buffer) - (setq compilation-locs (make-hash-table)) - (insert (car test)) - (compilation-parse-errors (point-min) (point-max)) - (let ((msg (get-text-property (nth 1 test) 'compilation-message))) - (should msg) - (let ((loc (compilation--message->loc msg)) - (col (nth 2 test)) - (line (nth 3 test)) - (file (nth 4 test)) - (type (nth 5 test)) - end-col end-line) - (if (consp col) - (setq end-col (cdr col) col (car col))) - (if (consp line) - (setq end-line (cdr line) line (car line))) - (should (equal (compilation--loc->col loc) col)) - (should (equal (compilation--loc->line loc) line)) - (when file - (should (equal (caar (compilation--loc->file-struct loc)) file))) - (when end-col - (should (equal (car (cadr (nth 2 (compilation--loc->file-struct loc)))) - end-col))) - (should (equal (car (nth 2 (compilation--loc->file-struct loc))) - (or end-line line))) - (when type - (should (equal type (compilation--message->type msg))))) - msg)) - -(defvar af--compile-tests--test-regexps-data - ;; The computed column numbers are zero-indexed, so subtract 1 from - ;; what's reported in the string. The end column numbers are for - ;; the character after, so it matches what's reported in the string. - '(;;hg test-check-code - ("+ contrib/debugshell.py:37:" 1 nil 37 "contrib/debugshell.py") - ("+ File \"/tmp/hg/mercurial/commands.py\", line 3115, in help_" - 1 nil 3115 "/tmp/hg/mercurial/commands.py") - )) - -(require 'ert) -(ert-deftest af--hg-error-cases () - "Test hg-specific compilation-mode regular expressions" - (with-temp-buffer - (font-lock-mode -1) - (mapc #'af--compile--test-error-line af--compile-tests--test-regexps-data))) - -;; To run tests: -;; -;; emacs -batch -l .elisp/settings/50.compilation-tweaks.el -f ert-run-tests-batch-and-exit