Mercurial > hg
view contrib/hg-test-mode.el @ 33501:7008f6819002
context: name files relative to cwd in warning messages
I was several directories deep in the kernel tree, ran `hg add`, and got the
warning about the size of one of the files. I noticed that it suggested undoing
the add with a specific revert command. The problem is, it would have failed
since the path printed was relative to the repo root instead of cwd. While
here, I just fixed the other messages too. As an added benefit, these messages
now look the same as the verbose/inexact messages for the corresponding command.
I don't think most of these messages are reachable (typically the corresponding
cmdutil function does the check). I wasn't able to figure out why the keyword
tests were failing when using pathto()- I couldn't cause an absolute path to be
used by manipulating the --cwd flag on a regular add. (I did notice that
keyword is adding the file without holding wlock.)
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 11 Jul 2017 00:40:29 -0400 |
parents | 7fce964be27d |
children | b6a757de2fff |
line wrap: on
line source
;; hg-test-mode.el - Major mode for editing Mercurial tests ;; ;; Copyright 2014 Matt Mackall <mpm@selenic.com> ;; "I have no idea what I'm doing" ;; ;; This software may be used and distributed according to the terms of the ;; GNU General Public License version 2 or any later version. ;; ;; To enable, add something like the following to your .emacs: ;; ;; (if (file-exists-p "~/hg/contrib/hg-test-mode.el") ;; (load "~/hg/contrib/hg-test-mode.el")) (defvar hg-test-mode-hook nil) (defvar hg-test-mode-map (let ((map (make-keymap))) (define-key map "\C-j" 'newline-and-indent) map) "Keymap for hg test major mode") (add-to-list 'auto-mode-alist '("\\.t\\'" . hg-test-mode)) (defconst hg-test-font-lock-keywords-1 (list '("^ \\(\\$\\|>>>\\) " 1 font-lock-builtin-face) '("^ \\(>\\|\\.\\.\\.\\) " 1 font-lock-constant-face) '("^ \\([[][0-9]+[]]\\)$" 1 font-lock-warning-face) '("^ \\(.*?\\)\\(\\( [(][-a-z]+[)]\\)*\\)$" 1 font-lock-string-face) '("\\$?\\(HG\\|TEST\\)\\w+=?" . font-lock-variable-name-face) '("^ \\(.*?\\)\\(\\( [(][-a-z]+[)]\\)+\\)$" 2 font-lock-type-face) '("^#.*" . font-lock-preprocessor-face) '("^\\([^ ].*\\)$" 1 font-lock-comment-face) ) "Minimal highlighting expressions for hg-test mode") (defvar hg-test-font-lock-keywords hg-test-font-lock-keywords-1 "Default highlighting expressions for hg-test mode") (defvar hg-test-mode-syntax-table (let ((st (make-syntax-table))) (modify-syntax-entry ?\" "w" st) ;; disable standard quoting st) "Syntax table for hg-test mode") (defun hg-test-mode () (interactive) (kill-all-local-variables) (use-local-map hg-test-mode-map) (set-syntax-table hg-test-mode-syntax-table) (set (make-local-variable 'font-lock-defaults) '(hg-test-font-lock-keywords)) (setq major-mode 'hg-test-mode) (setq mode-name "hg-test") (run-hooks 'hg-test-mode-hook)) (provide 'hg-test-mode)