Skip to content

Commit

Permalink
Re-added rename-module.
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Bingham committed May 7, 2018
1 parent 7763552 commit 4de5b99
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions traad.el
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,26 @@ necessary. Return the history buffer."
(cons "path" (buffer-file-name))
(cons "offset" (traad--adjust-point (point))))))

;;;###autoload
(defun traad-rename-module (new-name)
"Rename the current module."
(interactive
(list
(read-string "New name: ")))
(deferred:$
(traad--fetch-perform
(buffer-file-name)
"/refactor/rename"
:data (list (cons "name" new-name)
(cons "path" (buffer-file-name))))

(deferred:nextc it
(lambda (_)
(let* ((dir-name (file-name-directory (buffer-file-name)))
(new-name (expand-file-name (concat dir-name "/" new-name ".py"))))
(kill-buffer (current-buffer))
(switch-to-buffer (find-file new-name)))))))

;;;###autoload
(defun traad-move ()
"Call the correct form of `move` based on the type of thing at the point."
Expand Down

0 comments on commit 4de5b99

Please sign in to comment.