Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [refactoring]

The tag has no usage guidance.

1
vote
0answers
51 views

Tools for refactoring c++ code

What tools do you use to refactor c++ code? For example, how do you rename a variable or function that is spread across files? If the problem isn't language specific, there are text-based tools that ...
3
votes
2answers
71 views

function to convert python dict arg to kwargs?

I would like to be able to start with code like this: def foo(a, b, {"c": 1, 'd': 2, "e": 3}): then execute some emacs function with my cursor anywhere between the {} characters, and rewrite the ...
1
vote
1answer
153 views

Is there a package for semantic refactoring

Is there a package that allows syntax aware refactoring in python or c++. For example, extracting a value as a parameter, into a function signature, extracting a block as a function (passing local ...
2
votes
3answers
117 views

Reorder function definitions in a file

Adapting to a rather functional programming style, I often end up with files consisting of a lot of individual function definitions. Oftentimes, I then decide at some later point that I want to ...
2
votes
2answers
177 views

Refactoring javascript

How can I rename functions project wide? I am using spacemacs and also with tern, and it look like tern can only rename variables.
0
votes
0answers
47 views

Inline variable in Haskell

Is there any way to inline a top-level definition or let binding in Haskell? I can't find any built-in solutions in vanilla haskell mode, HaRe, or Intero.
2
votes
1answer
804 views

Spacemacs, python, refactoring - Change name of variable

I know that there are ways in emacs to refactor python scripts and e.g. change the name of a variable. What is the best way to do this in spacemacs? The standard refactoring only seems to offer a few ...
2
votes
3answers
188 views

Emacs lisp refactoring - add variable to surrounding let

Context Call me an uncultured non-functional programmer (or call emacs-lisp and uncultured non-functional language), but when I code in elisp I tend to use the following pattern (Edit: As an ...
11
votes
2answers
228 views

Search/replace-like feature for swapping text

I frequently find myself trying to replace e.g. foo with bar and bar with foo in a buffer. The way I usually do it is either: 3 query-replaces: aaa -> @@@, bbb -> aaa, @@@ -> bbb give up on ...
3
votes
1answer
1k views

How to edit multiple files at once?

Is there a way to open multiple buffers that are open at the same time? The idea is to be able to refactor code and variable names in multiple files at once. I know that dired-do-find-regexp-and-...
5
votes
1answer
188 views

Support to refactor/convert source into literate programming with org-mode/babel?

I'm thinking of using literate programming to investigate large amount, or hard to understand source code. For the purpose, I'd like refactor the source code into literate programming text with org-...
12
votes
3answers
3k views

How do I refactor across a project in emacs (change method name everywhere)?

I want to rewrite parts of an opensource project. This includes renaming methods. How can I do that efficiently in emacs across the whole project? I would rather not use hacks such as search and ...
5
votes
0answers
247 views

Ropemacs default refactoring

I'm performing a large python refactor, and one component of that is renaming many variables from camelCase to snake_case. I'd like to hook a camel-to-snake conversion function (which I already have) ...