From 75a25e91576b2d99310cdd3b5d8957b8a168bd44 Mon Sep 17 00:00:00 2001 From: brotzeit Date: Thu, 26 Jul 2018 13:47:47 +0200 Subject: [PATCH 1/6] remove unnecessary when --- rustic-util.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rustic-util.el b/rustic-util.el index b0481d16..5e71cb7c 100644 --- a/rustic-util.el +++ b/rustic-util.el @@ -166,7 +166,7 @@ `(,rls ,@(-remove-first (lambda (mode) (when (symbolp (car mode)) - (when (eq (car mode) 'rust-mode)))) + (eq (car mode) 'rust-mode))) eglot-server-programs))))) ;; don't allow formatting with rls (let ((feature :documentFormattingProvider)) From 74f307a0e1df37b0997b8d80537d161f0a63570e Mon Sep 17 00:00:00 2001 From: brotzeit Date: Thu, 26 Jul 2018 15:55:08 +0200 Subject: [PATCH 2/6] Revert "require packages" This reverts commit 7e4606b760ed22213097cb4f56e366cbe3219c8b. --- rustic-lsp.el | 3 +++ rustic-racer.el | 1 + rustic.el | 3 --- test/rustic-rust-mode-test.el | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/rustic-lsp.el b/rustic-lsp.el index b297da08..296b5eac 100644 --- a/rustic-lsp.el +++ b/rustic-lsp.el @@ -3,8 +3,11 @@ ;;; Code: (require 'cl-lib) +(require 'json) (require 'font-lock) (require 'xref) +(require 'dash) +(require 'markdown-mode) (defvar lsp-rust--config-options (make-hash-table)) (defvar lsp-rust--diag-counters (make-hash-table)) diff --git a/rustic-racer.el b/rustic-racer.el index 45d8e77f..0afc71f6 100644 --- a/rustic-racer.el +++ b/rustic-racer.el @@ -1,5 +1,6 @@ ;;; rustic-racer.el --- Racer support -*-lexical-binding: t-*- +(require 'dash) (require 'etags) (require 's) (require 'f) diff --git a/rustic.el b/rustic.el index 89ee918c..77c39fbb 100644 --- a/rustic.el +++ b/rustic.el @@ -20,11 +20,8 @@ (require 'url-vars)) (require 'json) -(require 'markdown-mode) (require 'newcomment) -(require 'dash) - (require 'rustic-compile) (require 'rustic-cargo) (require 'rustic-util) diff --git a/test/rustic-rust-mode-test.el b/test/rustic-rust-mode-test.el index 748fb4dd..0fadb561 100644 --- a/test/rustic-rust-mode-test.el +++ b/test/rustic-rust-mode-test.el @@ -2,6 +2,7 @@ (require 'cl) (require 'imenu) +(require 'f) (defun rustic-test-group-str-by-face (str) "Fontify `STR' in rust-mode and group it by face, returning a From 589ddc64d293226f0185955c9d55c5879948a3f7 Mon Sep 17 00:00:00 2001 From: brotzeit Date: Fri, 27 Jul 2018 11:07:10 +0200 Subject: [PATCH 3/6] add rustic-compilation-regexps-panic for error matching --- rustic-compile.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rustic-compile.el b/rustic-compile.el index 5d38991f..4754e8cc 100644 --- a/rustic-compile.el +++ b/rustic-compile.el @@ -105,10 +105,13 @@ Error matching regexes from compile.el are removed." (cons 'rustic-arrow rustic-compilation-regexps-arrow)) (add-to-list 'compilation-error-regexp-alist-alist (cons 'rustic-colon rustic-compilation-regexps-colon)) + (add-to-list 'compilation-error-regexp-alist-alist + (cons 'rustic-panic rustic-compilation-regexps-panic)) (setq-local compilation-error-regexp-alist nil) (add-to-list 'compilation-error-regexp-alist 'rustic-arrow) (add-to-list 'compilation-error-regexp-alist 'rustic-colon) + (add-to-list 'compilation-error-regexp-alist 'rustic-panic) (add-hook 'compilation-filter-hook #'rustic-insert-errno-button nil t)) @@ -133,12 +136,9 @@ Error matching regexes from compile.el are removed." (cons re '(1 2 3 0)))) ;; 0 for info type "Create hyperlink in compilation buffers for file paths containing ':::'.") -;; Match test run failures and panics during compilation as -;; compilation warnings -(defvar rustic-cargo-compilation-regexps +(defvar rustic-compilation-regexps-panic '("^\\s-+thread '[^']+' panicked at \\('[^']+', \\([^:]+\\):\\([0-9]+\\)\\)" 2 3 nil nil 1) - "Specifications for matching panics in cargo test invocations. -See `compilation-error-regexp-alist' for help on their format.") + "Match test run failures and panics during compilation.") ;;;;;;;;;;;;;;;;;;;;;;;; From f30d01032d0e1ce34f9142c13077f148753602a6 Mon Sep 17 00:00:00 2001 From: brotzeit Date: Fri, 27 Jul 2018 11:30:02 +0200 Subject: [PATCH 4/6] use compilation-arguments instead of rustic-compilation-arguments --- rustic-compile.el | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/rustic-compile.el b/rustic-compile.el index 4754e8cc..326bc7e7 100644 --- a/rustic-compile.el +++ b/rustic-compile.el @@ -115,9 +115,6 @@ Error matching regexes from compile.el are removed." (add-hook 'compilation-filter-hook #'rustic-insert-errno-button nil t)) -(defvar rustic-compilation-directory nil - "Directory to restore to when doing `rustic-recompile'.") - (defvar rustic-compilation-regexps-arrow (let ((file "\\([^\n]+\\)") (start-line "\\([0-9]+\\)") @@ -150,8 +147,8 @@ Error matching regexes from compile.el are removed." (defvar rustic-compilation-buffer-name "*rust-compilation*" "Buffer name for rust compilation process buffers.") -(defvar rustic-compilation-arguments nil - "Arguments that were given to `rustic-compile'.") +(defvar rustic-compilation-directory nil + "Directory to restore to when doing `rustic-recompile'.") (defun rustic-compilation-start (command buffer process mode directory &optional sentinel) (let* ((buf (get-buffer-create buffer)) @@ -355,10 +352,10 @@ buffers are formatted after saving if `rustic-format-on-save' is t." If called without arguments use `rustic-compile-command'. Otherwise use provided argument ARG and store it in -`rustic-compilation-arguments'." +`compilation-arguments'." (interactive "P") (let* ((command (if arg - (setq rustic-compilation-arguments + (setq compilation-arguments (read-from-minibuffer "Compile command: ")) rustic-compile-command)) (buffer-name rustic-compilation-buffer-name) @@ -374,9 +371,9 @@ Otherwise use provided argument ARG and store it in (defun rustic-recompile () "Re-compile the program using the last `rustic-compile' arguments." (interactive) - (let* ((command (if (not rustic-compilation-arguments) + (let* ((command (if (not compilation-arguments) rustic-compile-command - rustic-compilation-arguments)) + compilation-arguments)) (buffer-name rustic-compilation-buffer-name) (proc-name rustic-compilation-process-name) (mode 'rustic-compilation-mode) From 015b2f86706d40a5c04a5d345ff92bd91ad2b926 Mon Sep 17 00:00:00 2001 From: brotzeit Date: Fri, 27 Jul 2018 11:44:27 +0200 Subject: [PATCH 5/6] add docstrings --- rustic-compile.el | 2 +- rustic-util.el | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rustic-compile.el b/rustic-compile.el index 326bc7e7..0611dcd0 100644 --- a/rustic-compile.el +++ b/rustic-compile.el @@ -259,7 +259,7 @@ Translate STRING with `xterm-color-filter'." (error "Cannot have two rust processes at once"))) (defun rustic-save-some-buffers () - "Unlike `save-some-buffers', only project related files are considered. + "Unlike `save-some-buffers', only consider project related files. The variable `buffer-save-without-query' can be used for customization and buffers are formatted after saving if `rustic-format-on-save' is t." diff --git a/rustic-util.el b/rustic-util.el index 5e71cb7c..7ea949d4 100644 --- a/rustic-util.el +++ b/rustic-util.el @@ -159,6 +159,7 @@ ;; RLS (defun rustic-setup-eglot () + "Configure eglot for rustic." ;; replace rust-mode with rustic (let ((rls '(rustic-mode . (eglot-rls "rls")))) (unless (member rls eglot-server-programs) From 3345d416f30f2051a91b3b80f34f9690da7110fc Mon Sep 17 00:00:00 2001 From: brotzeit Date: Fri, 27 Jul 2018 15:30:45 +0200 Subject: [PATCH 6/6] bump version --- rustic.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rustic.el b/rustic.el index 77c39fbb..5267f5e9 100644 --- a/rustic.el +++ b/rustic.el @@ -1,6 +1,6 @@ ;;; rustic.el --- A major emacs mode for editing Rust source code -*-lexical-binding: t-*- -;; Version: 0.6.2 +;; Version: 0.7 ;; Author: Mozilla ;; ;; Keywords: languages