Skip to content

Commit 7c83899

Browse files
committed
additional deprecated message for eval and quoted functions
1 parent 2781086 commit 7c83899

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

elixir-deprecated.el

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,25 @@
3939
:group 'elixir-deprecated)
4040

4141
(defun elixir-deprecated--warning (function-name message)
42-
(message
43-
(concat (propertize "DEPRECATION WARNING: "
42+
(let ((buffer (get-buffer "*Warnings*")))
43+
(when buffer
44+
(kill-buffer buffer)))
45+
(warn
46+
(concat "\n\n"
47+
(propertize "DEPRECATION WARNING: "
4448
'face 'elixir-deprecated--warning-face)
4549
(propertize (format "[ %s ]\n\n" function-name)
4650
'face 'elixir-deprecated--function-face)
4751
message)))
4852

4953
;; DEPRECATED MESSAGES FOR RELEASE 3.0.0
5054

51-
(defun elixir-deprecated-message-compile-file ()
52-
(elixir-deprecated--warning "elixir-mode-compile-file"
53-
"This function will be removed in version 3.0.0.\n
55+
(defvar elixir-deprecated--alchemist-message "This function will be removed in version 3.0.0.\n
5456
Please use the package *alchemist.el* for compilation functionality.\n
55-
Alchemist: http://www.github.com/tonini/alchemist.el"))
57+
Alchemist: http://www.github.com/tonini/alchemist.el")
5658

57-
(defun elixir-deprecated-message-iex ()
58-
(elixir-deprecated--warning "elixir-mode-iex"
59-
"This function will be removed in version 3.0.0.\n
60-
Please use the package *alchemist.el* for IEx integration functionality.\n
61-
Alchemist: http://www.github.com/tonini/alchemist.el"))
59+
(defun elixir-deprecated-use-alchemist (function-name)
60+
(elixir-deprecated--warning function-name
61+
elixir-deprecated--alchemist-message))
6262

6363
(provide 'elixir-deprecated)

elixir-mode.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ Argument FILE-NAME ."
488488
(defun elixir-mode-compile-file ()
489489
"Elixir mode compile and save current file."
490490
(interactive)
491-
(elixir-deprecated-message-compile-file)
491+
(elixir-deprecated-use-alchemist "elixir-mode-compile-file")
492492
(let ((compiler-output (shell-command-to-string (elixir-mode-command-compile (buffer-file-name)))))
493493
(when (string= compiler-output "")
494494
(message "Compiled and saved as %s" (elixir-mode-compiled-file-name)))))
@@ -510,7 +510,7 @@ Argument FILE-NAME ."
510510
"Elixir mode interactive REPL.
511511
Optional argument ARGS-P ."
512512
(interactive "P")
513-
(elixir-deprecated-message-iex)
513+
(elixir-deprecated-use-alchemist "elixir-mode-iex")
514514
(let ((switches (if (equal args-p nil)
515515
'()
516516
(split-string (read-string "Additional args: ")))))
@@ -600,6 +600,7 @@ just return nil."
600600
Argument BEG Start of the region.
601601
Argument END End of the region."
602602
(interactive (list (point) (mark)))
603+
(elixir-deprecated-use-alchemist "elixir-mode-eval-on-region")
603604
(unless (and beg end)
604605
(error "The mark is not set now, so there is no region"))
605606
(let* ((region (buffer-substring-no-properties beg end)))
@@ -608,12 +609,14 @@ Argument END End of the region."
608609
(defun elixir-mode-eval-on-current-line ()
609610
"Evaluate the Elixir code on the current line."
610611
(interactive)
612+
(elixir-deprecated-use-alchemist "elixir-mode-eval-on-current-line")
611613
(let ((current-line (thing-at-point 'line)))
612614
(elixir-mode--eval-string current-line)))
613615

614616
(defun elixir-mode-eval-on-current-buffer ()
615617
"Evaluate the Elixir code on the current buffer."
616618
(interactive)
619+
(elixir-deprecated-use-alchemist "elixir-mode-eval-on-current-buffer")
617620
(let ((current-buffer (buffer-substring-no-properties (point-max) (point-min))))
618621
(elixir-mode--eval-string current-buffer)))
619622

@@ -622,6 +625,7 @@ Argument END End of the region."
622625
Argument BEG Start of the region.
623626
Argument END End of the region."
624627
(interactive (list (point) (mark)))
628+
(elixir-deprecated-use-alchemist "elixir-mode-string-to-quoted-on-region")
625629
(unless (and beg end)
626630
(error "The mark is not set now, so there is no region"))
627631
(let ((region (buffer-substring-no-properties beg end)))
@@ -630,6 +634,7 @@ Argument END End of the region."
630634
(defun elixir-mode-string-to-quoted-on-current-line ()
631635
"Get the representation of the expression on the current line."
632636
(interactive)
637+
(elixir-deprecated-use-alchemist "elixir-mode-string-to-quoted-on-current-line")
633638
(let ((current-line (thing-at-point 'line)))
634639
(elixir-mode--string-to-quoted current-line)))
635640

0 commit comments

Comments
 (0)