Skip to content
Snippets Groups Projects
Commit 962b4c92 authored by llaffont's avatar llaffont
Browse files

Premiere version fonctionnelle du refactoring extract-method

parent 0d030cb7
Branches
Tags
No related merge requests found
......@@ -6,6 +6,7 @@
(let (
(current-dir (file-name-directory (symbol-file 'refactoring-extract-method)))
(file-name (buffer-file-name (current-buffer)))
(point (region-beginning))
(start-line (line-number-at-pos (region-beginning)))
(end-line (line-number-at-pos (region-end)))
(refactoring-command)
......@@ -19,16 +20,30 @@
(shell-command
refactoring-command
(switch-to-buffer refactoring-buffer)
refactoring-buffer
)
(if (y-or-n-p "Apply refactoring ?")
(progn
(shell-command
(concat refactoring-command "|patch -p1")))
)
(progn
(switch-to-buffer patched-file-buffer)
(erase-buffer)
(shell-command
(concat refactoring-command "|patch -p1 -o -") patched-file-buffer refactoring-buffer)
(goto-char point)
)
)
(kill-buffer)
(revert-buffer)
(kill-buffer refactoring-buffer)
(switch-to-buffer patched-file-buffer)
)
)
)
(defun refactoring-revert-buffer-keep-undo(buffer)
"Revert buffer but keep undo history."
(switch-to-buffer buffer)
(let ((inhibit-read-only t))
(erase-buffer)
(insert-file-contents (buffer-file-name))
(set-visited-file-modtime (visited-file-modtime))
(set-buffer-modified-p nil)))
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment