]>
Commit | Line | Data |
---|---|---|
53e6db90 DC |
1 | ;ELC\1c\0\0\0 |
2 | ;;; Compiled | |
3 | ;;; in Emacs version 28.2 | |
4 | ;;; with all optimizations. | |
5 | ||
6 | ||
7 | ||
8 | (require 'diff-mode) | |
9 | #@98 Saved windows configuration, so that we can restore it after `elpy-refactor' has done its thing.\1f | |
10 | (defvar elpy-refactor--saved-window-configuration nil (#$ . 105)) | |
11 | #@80 Line and column number of the position we were at before starting refactoring.\1f | |
12 | (defvar elpy-refactor--saved-pos nil (#$ . 274)) | |
13 | #@73 Keep track of the buffers modified by the current refactoring sessions.\1f | |
14 | (defvar elpy-refactor--modified-buffers nil (#$ . 408)) | |
15 | #@49 Apply DIFF, looking for the files in PROJ-PATH.\1f | |
16 | (defalias 'elpy-refactor--apply-diff #[(proj-path diff) "\306`!`\307 Z\18\19r\310\311!q\210\312 \210\313\1a\314 \210\vc\210)\f\15eb\210\315 \210)\31618\0eb\210 Sy\210\317 \210\bu0\202:\0\210\320*\207" [current-col current-line inhibit-read-only diff proj-path default-directory line-number-at-pos line-beginning-position get-buffer-create " *Elpy Refactor*" elpy-refactor-mode t erase-buffer elpy-refactor--apply-whole-diff (error) beginning-of-line nil] 3 (#$ . 542)]) | |
17 | #@84 Display DIFF in a `diff-mode' window. | |
18 | ||
19 | DIFF files should be relative to PROJ-PATH.\1f | |
20 | (defalias 'elpy-refactor--display-diff #[(proj-path diff) "\306 \10\307`\310\"`\311 ZD\11\312\12r\313\314!q\210\315 \210\310\e\316 \210\317\320\321!\322\323#\324\261\ 2\210\325ed\326#\210eb\210\327\330\312\310#\203B\0\331\332\312\310#\210\2021\0db\210\fc\210)\r\16\"eb\210\333 \203_\0\334\335p!!\210\336 \202f\0\337\340!\210\341p!)\207" [elpy-refactor--saved-window-configuration elpy-refactor--saved-pos elpy-refactor--modified-buffers inhibit-read-only diff proj-path current-window-configuration line-number-at-pos t line-beginning-position nil get-buffer-create "*Elpy Refactor*" elpy-refactor-mode erase-buffer propertize substitute-command-keys "\\[diff-file-next] and \\[diff-file-prev] -- Move between files\n\\[diff-hunk-next] and \\[diff-hunk-prev] -- Move between hunks\n\\[diff-split-hunk] -- Split the current hunk at point\n\\[elpy-refactor--apply-hunk] -- Apply the current hunk\n\\[diff-kill-hunk] -- Kill the current hunk\n\\[elpy-refactor--apply-whole-diff] -- Apply the whole diff\n\\[elpy-refactor--quit] -- Quit\n" face bold "\n\n" align-regexp "\\(\\s-*\\) -- " search-forward " -- " replace-match " " diff--some-hunks-p select-window display-buffer diff-hunk-next message "No differences to validate" kill-buffer default-directory] 4 (#$ . 1054)]) | |
21 | #@39 The key map for `elpy-refactor-mode'.\1f | |
22 | (defvar elpy-refactor-mode-map (byte-code "\301 \18\302\b\303\304#\210\302\b\305\306#\210\302\b\307\310#\210\302\b\311\312#\210\302\b\313\312#\210\302\b\314\315#\210\302\b\316\315#\210\b)\207" [map make-sparse-keymap define-key "\ 3\ 3" elpy-refactor--apply-hunk "\ 3\ 1" elpy-refactor--apply-whole-diff "\ 3\18" diff-kill-hunk "q" elpy-refactor--quit "\ 3\v" "h" describe-mode "?"] 4) (#$ . 2399)) | |
23 | (defvar elpy-refactor-mode-hook nil) | |
24 | (byte-code "\300\301N\204\f\0\302\300\301\303#\210\304\305!\204\18\0\302\305\306\307#\210\300\207" [elpy-refactor-mode-hook variable-documentation put "Hook run after entering Elpy Refactor mode.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" boundp elpy-refactor-mode-map definition-name elpy-refactor-mode] 4) | |
25 | (defvar elpy-refactor-mode-map (make-sparse-keymap)) | |
26 | (byte-code "\301\302N\204\ e\0\303\301\302\304\305!#\210\306\307!\204\1f\0\303\307\310\311#\210\312\313 !\210\307\302N\204-\0\303\307\302\304\314!#\210\306\300!\204B\0\303\300\310\311#\210\315\316\300\317\"\210\b!\210\300\302N\204P\0\303\300\302\304\320!#\210\303\311\321\322#\210\303\311\323\324#\207" [elpy-refactor-mode-abbrev-table elpy-refactor-mode-map variable-documentation put purecopy "Keymap for `elpy-refactor-mode'." boundp elpy-refactor-mode-syntax-table definition-name elpy-refactor-mode (lambda (#1=#:def-tmp-var) (defvar elpy-refactor-mode-syntax-table #1#)) make-syntax-table "Syntax table for `elpy-refactor-mode'." (lambda (#1#) (defvar elpy-refactor-mode-abbrev-table #1#)) define-abbrev-table nil "Abbrev table for `elpy-refactor-mode'." derived-mode-parent diff-mode custom-mode-group elpy] 5) | |
27 | #@277 Mode to display refactoring actions and ask confirmation from the user. | |
28 | ||
29 | \{elpy-refactor-mode-map} | |
30 | ||
31 | In addition to any hooks its parent mode `diff-mode' might have run, | |
32 | this mode runs the hook `elpy-refactor-mode-hook', as the final or | |
33 | penultimate step during initialization.\1f | |
34 | (defalias 'elpy-refactor-mode #[nil "\306\300!\210\307\18\310 \210\311\11\312\12\310\313N\203\e\0\314\311\313\310\313N#\210\315\v!\204'\0\316\v\317 \"\210\320\f!\211\1d\2036\0\r\321 =\203<\0\322\f\323 \"\210)\324\ e\1d\325\"\204V\0\ e\1d\ e\1e=\204V\0\326\ e\1d\325\ e\1eC#\210\327\v!\210\330\f!\210\ e\1d\16\1e\331\332!\210)\333\334!\207" [delay-mode-hooks major-mode mode-name elpy-refactor-mode-map elpy-refactor-mode-syntax-table parent make-local-variable t diff-mode elpy-refactor-mode "Elpy Refactor" mode-class put keymap-parent set-keymap-parent current-local-map char-table-parent standard-syntax-table set-char-table-parent syntax-table abbrev-table-get :parents abbrev-table-put use-local-map set-syntax-table view-mode 1 run-mode-hooks elpy-refactor-mode-hook elpy-refactor-mode-abbrev-table local-abbrev-table] 6 (#$ . 4105) nil]) | |
35 | #@25 Apply the current hunk.\1f | |
36 | (defalias 'elpy-refactor--apply-hunk #[nil "\212\302 \210)\303\304 !\211\18\203\1d\0\b \235\203\19\0 \210\202\1d\0\b B\11)\305 \210\306 ?\205)\0\307 \207" [buf elpy-refactor--modified-buffers diff-apply-hunk find-buffer-visiting diff-find-file-name diff-hunk-kill diff--some-hunks-p elpy-refactor--quit] 3 (#$ . 5185) nil]) | |
37 | #@32 Apply the whole diff and quit.\1f | |
38 | (defalias 'elpy-refactor--apply-whole-diff #[nil "eb\210\302 \210\303 \203;\0\304\305 !\211\18\203#\0\b \235\203\1f\0 \210\202#\0\b B\11)\30614\0\212\307 \210)\310 0\210\202\ 6\0\210\302 \210\202\ 6\0\311 \207" [buf elpy-refactor--modified-buffers diff-hunk-next diff--some-hunks-p find-buffer-visiting diff-find-file-name (error) diff-apply-hunk diff-hunk-kill elpy-refactor--quit] 3 (#$ . 5523) nil]) | |
39 | #@31 Quit the refactoring session.\1f | |
40 | (defalias 'elpy-refactor--quit #[nil "\b\305\19\211\1a\203\1a\0\n@\11r q\210\306 \210)\nA\211\12\204\b\0*\305\10\307p!\210\v\203+\0\310\v!\210\305\13\f\205?\0eb\210\f@Sy\210\fA@u\210\305\211\14\207" [elpy-refactor--modified-buffers buf --dolist-tail-- elpy-refactor--saved-window-configuration elpy-refactor--saved-pos nil basic-save-buffer kill-buffer set-window-configuration] 3 (#$ . 5944) nil]) | |
41 | #@134 Rename the symbol at point to NEW-NAME. | |
42 | ||
43 | With a prefix argument (or if DONTASK is non-nil), | |
44 | do not display the diff before applying.\1f | |
45 | (defalias 'elpy-refactor-rename #[(new-name &optional dontask) "\b\203\n\0\306\b!\204\ e\0\307\310!\210\311\312\313\314!\"\210\315\19\316\b!\1a\317\320\n\"\e\317\304\n\"\1c\317\302\n\"\1a\f\2044\0\307\321!\202`\0\f\322\230\203@\0\307\323!\202`\0\r\204I\0\ e\18\203\\\0\311\324\313\314!\b#\210\325\v\n\"\210\311\326!\202`\0\327\v\n\"-\207" [new-name elpy-rpc-timeout diff proj-path success dontask elpy-refactor--is-valid-symbol-p error "'%s' is not a valid python symbol" message "Gathering occurences of '%s'..." thing-at-point symbol 10 elpy-rpc-get-rename-diff alist-get project_path "Refactoring failed for some reason" "Not available" "This functionnality needs jedi > 0.17.0, please update" "Replacing '%s' with '%s'..." elpy-refactor--apply-diff "Done" elpy-refactor--display-diff current-prefix-arg] 4 (#$ . 6356) (list (let ((old-name (thing-at-point 'symbol))) (if (or (not old-name) (not (elpy-refactor--is-valid-symbol-p old-name))) (error "No symbol at point") (read-string (format "New name for '%s': " (thing-at-point 'symbol)) (thing-at-point 'symbol)))))]) | |
46 | #@56 Extract the current region to a new variable NEW-NAME.\1f | |
47 | (defalias 'elpy-refactor-extract-variable #[(new-name) "\306 \203\n\0\307 \202\14\0\310\311!\206\13\0\312\313!@\306 \203\1e\0\314 \202\"\0\310\311!A\18\19\315\n!\2040\0\316\317!\205\227\0\212 b\210\320 )\e\212\bb\210\320 )\1c\212 b\210`\321 Z)\1d\212\bb\210`\321 Z)\1e\1c\322\n\v\f\r\ e\1c%\1e\16\323\324\ e\16\"\1e\1d\323\325\ e\16\"\1e\15\323\326\ e\16\"\1e\16\ e\15\204\7f\0\312\327!\202\225\0\ e\15\330\230\203\214\0\312\331!\202\225\0\332 \210\333\ e\1d\ e\16\".\b*\207" [end beg new-name line-beg line-end col-beg region-active-p region-beginning bounds-of-thing-at-point symbol error "No symbol at point" region-end elpy-refactor--is-valid-symbol-p y-or-n-p "'%s' does not appear to be a valid python symbol. Are you sure you want to use it? " line-number-at-pos line-beginning-position elpy-rpc-get-extract-variable-diff alist-get project_path success diff "We could not extract the selection as a variable" "Not available" "This functionnality needs jedi > 0.17.0, please update" deactivate-mark elpy-refactor--apply-diff col-end proj-path] 6 (#$ . 7538) "sNew name: "]) | |
48 | #@56 Extract the current region to a new function NEW-NAME.\1f | |
49 | (defalias 'elpy-refactor-extract-function #[(new-name) "\306 \204 \0\307\310!\210\311\b!\204\15\0\312\313!\205x\0\212\314 b\210\315 )\19\212\316 b\210\315 )\1a\212\314 b\210`\317 Z)\e\212\316 b\210`\317 Z)\1c\320\b \n\v\f%\1d\321\322\r\"\1e\19\321\323\r\"\1e\13\321\305\r\"\1d\ e\13\204a\0\307\324!\202v\0\ e\13\325\230\203n\0\307\326!\202v\0\327 \210\330\ e\19\r\".\b\207" [new-name line-beg line-end col-beg col-end diff region-active-p error "No selection" elpy-refactor--is-valid-symbol-p y-or-n-p "'%s' does not appear to be a valid python symbol. Are you sure you want to use it? " region-beginning line-number-at-pos region-end line-beginning-position elpy-rpc-get-extract-function-diff alist-get project_path success "We could not extract the selection as a function" "Not available" "This functionnality needs jedi > 0.17.0, please update" deactivate-mark elpy-refactor--apply-diff proj-path] 6 (#$ . 8594) "sNew function name: "]) | |
50 | #@31 Inline the variable at point.\1f | |
51 | (defalias 'elpy-refactor-inline #[nil "\303 \18\304\305\b\"\19\304\302\b\"\1a\304\300\b\"\18\n\204\1f\0\306\307\310\311!\"\202/\0\n\312\230\203+\0\306\313!\202/\0\314 \b\",\207" [diff proj-path success elpy-rpc-get-inline-diff alist-get project_path error "We could not inline the variable '%s'" thing-at-point symbol "Not available" "This functionnality needs jedi > 0.17.0, please update" elpy-refactor--apply-diff] 4 (#$ . 9548) nil]) | |
52 | #@46 Return t if SYMBOL is a valid python symbol.\1f | |
53 | (defalias 'elpy-refactor--is-valid-symbol-p #[(symbol) "\301\302\b\"\303=\207" [symbol string-match "^[a-zA-Z_][a-zA-Z0-9_]*$" 0] 3 (#$ . 10004)]) | |
54 | (byte-code "\300\301!\204\v\0\302\301\303\"\210\304\305!\207" [fboundp diff--some-hunks-p defalias #[nil "\212eb\210\301\b\302\303#)\207" [diff-hunk-header-re re-search-forward nil t] 4] provide elpy-refactor] 3) |