Skip to content

Commit

Permalink
Merge pull request #4 from brotzeit/new
Browse files Browse the repository at this point in the history
v0.7
  • Loading branch information
brotzeit authored Jul 27, 2018
2 parents 797a400 + 3345d41 commit 9a7bd1e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
27 changes: 12 additions & 15 deletions rustic-compile.el
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ 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))

(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]+\\)")
Expand All @@ -133,12 +133,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.")


;;;;;;;;;;;;;;;;;;;;;;;;
Expand All @@ -150,8 +147,8 @@ See `compilation-error-regexp-alist' for help on their format.")
(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))
Expand Down Expand Up @@ -262,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."
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions rustic-lsp.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions rustic-racer.el
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
;;; rustic-racer.el --- Racer support -*-lexical-binding: t-*-

(require 'dash)
(require 'etags)
(require 's)
(require 'f)
Expand Down
3 changes: 2 additions & 1 deletion rustic-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,15 @@
;; 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)
(setq eglot-server-programs
`(,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))
Expand Down
5 changes: 1 addition & 4 deletions rustic.el
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions test/rustic-rust-mode-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a7bd1e

Please sign in to comment.