Skip to content

additional deprecated message for eval and quoted functions #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* [Indentation] Fix the indentation for mixed matchings.
* [Indentation] Pipe |> indentation works correctly.
* [Syntax Highlighting] Fontify continuation lines assignment.
* [Deprecated] Add deprecated message for eval and quoted functions.

## v2.0.2 - 2014/10/29
* [#136](https://github.com/elixir-lang/emacs-elixir/pull/136) - Expand def of block operator regex to include non-newlines.
Expand Down
30 changes: 15 additions & 15 deletions elixir-deprecated.el
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@
:group 'elixir-deprecated)

(defun elixir-deprecated--warning (function-name message)
(message
(concat (propertize "DEPRECATION WARNING: "
'face 'elixir-deprecated--warning-face)
(propertize (format "[ %s ]\n\n" function-name)
'face 'elixir-deprecated--function-face)
message)))
(let ((buffer (get-buffer "*Warnings*")))
(when buffer
(kill-buffer buffer))
(display-warning :deprecated
(concat "\n\n"
(propertize "DEPRECATION WARNING: "
'face 'elixir-deprecated--warning-face)
(propertize (format "[ %s ]\n\n" function-name)
'face 'elixir-deprecated--function-face)
message)) :warning))

;; DEPRECATED MESSAGES FOR RELEASE 3.0.0

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

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

(provide 'elixir-deprecated)
11 changes: 8 additions & 3 deletions elixir-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ Argument FILE-NAME ."
(defun elixir-mode-compile-file ()
"Elixir mode compile and save current file."
(interactive)
(elixir-deprecated-message-compile-file)
(elixir-deprecated-use-alchemist "elixir-mode-compile-file")
(let ((compiler-output (shell-command-to-string (elixir-mode-command-compile (buffer-file-name)))))
(when (string= compiler-output "")
(message "Compiled and saved as %s" (elixir-mode-compiled-file-name)))))
Expand All @@ -510,15 +510,15 @@ Argument FILE-NAME ."
"Elixir mode interactive REPL.
Optional argument ARGS-P ."
(interactive "P")
(elixir-deprecated-message-iex)
(let ((switches (if (equal args-p nil)
'()
(split-string (read-string "Additional args: ")))))
(unless (comint-check-proc "*IEX*")
(set-buffer
(apply 'make-comint "IEX"
elixir-iex-command nil switches))))
(pop-to-buffer "*IEX*"))
(pop-to-buffer "*IEX*")
(elixir-deprecated-use-alchemist "elixir-mode-iex"))

;;;###autoload
(defun elixir-mode-open-modegithub ()
Expand Down Expand Up @@ -600,6 +600,7 @@ just return nil."
Argument BEG Start of the region.
Argument END End of the region."
(interactive (list (point) (mark)))
(elixir-deprecated-use-alchemist "elixir-mode-eval-on-region")
(unless (and beg end)
(error "The mark is not set now, so there is no region"))
(let* ((region (buffer-substring-no-properties beg end)))
Expand All @@ -608,12 +609,14 @@ Argument END End of the region."
(defun elixir-mode-eval-on-current-line ()
"Evaluate the Elixir code on the current line."
(interactive)
(elixir-deprecated-use-alchemist "elixir-mode-eval-on-current-line")
(let ((current-line (thing-at-point 'line)))
(elixir-mode--eval-string current-line)))

(defun elixir-mode-eval-on-current-buffer ()
"Evaluate the Elixir code on the current buffer."
(interactive)
(elixir-deprecated-use-alchemist "elixir-mode-eval-on-current-buffer")
(let ((current-buffer (buffer-substring-no-properties (point-max) (point-min))))
(elixir-mode--eval-string current-buffer)))

Expand All @@ -622,6 +625,7 @@ Argument END End of the region."
Argument BEG Start of the region.
Argument END End of the region."
(interactive (list (point) (mark)))
(elixir-deprecated-use-alchemist "elixir-mode-string-to-quoted-on-region")
(unless (and beg end)
(error "The mark is not set now, so there is no region"))
(let ((region (buffer-substring-no-properties beg end)))
Expand All @@ -630,6 +634,7 @@ Argument END End of the region."
(defun elixir-mode-string-to-quoted-on-current-line ()
"Get the representation of the expression on the current line."
(interactive)
(elixir-deprecated-use-alchemist "elixir-mode-string-to-quoted-on-current-line")
(let ((current-line (thing-at-point 'line)))
(elixir-mode--string-to-quoted current-line)))

Expand Down