Skip to content

Commit 18b0e86

Browse files
authored
Merge pull request #27 from emacs-languagetool/feature/mute
feat(lsp-ltex.el): Remove noises from some operations
2 parents 1552e11 + e581a25 commit 18b0e86

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
1111
* Allow latest version return `nil` value if fails.
1212
* Fix server installation on Unix system (#20)
1313
* Allow globally installed language server (#23)
14+
* Implement code actions for "Add to dictionary", "Disable rule" and "Hide false positive" (#26)
1415

1516
## 0.2.0
1617
> Released Aug 26, 2021

lsp-ltex.el

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,21 @@ The editor need to send a completion request.")
267267
;; (@* "Util" )
268268
;;
269269

270+
(defmacro lsp-ltex--mute-apply (&rest body)
271+
"Execute BODY without message."
272+
(declare (indent 0) (debug t))
273+
`(let (message-log-max)
274+
(with-temp-message (or (current-message) nil)
275+
(let ((inhibit-message t)) ,@body))))
276+
270277
(defun lsp-ltex--s-replace (old new s)
271278
"Replace OLD with NEW in S."
272279
(replace-regexp-in-string (regexp-quote old) new s t t))
273280

274281
(defun lsp-ltex--execute (cmd &rest args)
275282
"Return non-nil if CMD executed succesfully with ARGS."
276283
(save-window-excursion
277-
(let ((inhibit-message t) (message-log-max nil))
284+
(lsp-ltex--mute-apply
278285
(= 0 (shell-command (concat cmd " "
279286
(mapconcat #'shell-quote-argument
280287
(cl-remove-if #'null args)
@@ -291,15 +298,15 @@ Return the written file name, or nil if SYM is not bound."
291298
(lsp-message "[INFO] Saving `%s' to file \"%s\"" (symbol-name sym) out-file)
292299
(with-temp-buffer
293300
(prin1 (eval sym) (current-buffer))
294-
(write-file out-file))
301+
(lsp-ltex--mute-apply (write-file out-file)))
295302
out-file)))
296303

297304
(defun lsp-ltex--deserialize-symbol (sym dir &optional mutate)
298305
"Deserialize SYM from DIR, if MUTATE is non-nil, assign the object to SYM.
299306
Return the deserialized object, or nil if the SYM.el file dont exist."
300307
(let ((in-file (expand-file-name
301308
(lsp-ltex--s-replace "lsp-ltex--" ""
302-
(symbol-name sym))
309+
(symbol-name sym))
303310
dir))
304311
res)
305312
(when (file-exists-p in-file)
@@ -382,7 +389,7 @@ This is use to active language server and check if language server's existence."
382389
'ltex-ls
383390
'(:system "ltex-ls")
384391
`(:download :url ,lsp-ltex--server-download-url
385-
:store-path ,(lsp-ltex--downloaded-extension-path))))
392+
:store-path ,(lsp-ltex--downloaded-extension-path))))
386393

387394
(defcustom lsp-ltex-version (or (lsp-ltex--current-version)
388395
(lsp-ltex--latest-version)

0 commit comments

Comments
 (0)