Skip to main content

Questions tagged [refactoring]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer

After refactoring elisp code, is there some help in finding unused code, mostly functions and variables?

Dealing with a one-file elisp package, I wonder if there is a nice way to see unused functions and variables after some major refactoring. I can go through the code and do xref-find-references. But ...
Harald's user avatar
  • 328
1 vote
0 answers

Org-mode+Babel: Refactor across files or code blocks

I'm refactoring my Emacs config files so that they are generated with org-babel-tangle. I am able to do everything I need but I really miss better refactoring support. As an example, after I define a ...
pgpb.padilla's user avatar
1 vote
0 answers

How to override a value inside a function temporarily?

There is this function in tide: ;; Defined in ~/.emacs.d/.local/straight/repos/tide/tide.el (defun tide-rename-file () "Rename current file and all it's references in other files." (...
Jose V's user avatar
  • 141
1 vote
0 answers

How to locate all unused Lisp functions / variables

I am converting a few old libraries into one new library using different names for all of the functions, macros, variables, etc. Some of the functions / variables will never be used, and I would like ...
lawlist's user avatar
  • 19.2k
1 vote
0 answers

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 ...
hrkrshnn's user avatar
  • 439
3 votes
2 answers

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 ...
billc's user avatar
  • 173
3 votes
2 answers

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 ...
Alex Petrosyan's user avatar
2 votes
3 answers

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 ...
Simon Fromme's user avatar
3 votes
2 answers

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.
zer09's user avatar
  • 185
0 votes
0 answers

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.
Matthew Piziak's user avatar
2 votes
1 answer

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 ...
pandita's user avatar
  • 235
2 votes
3 answers

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 ...
Att Righ's user avatar
  • 775
11 votes
2 answers

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 ...
T. Verron's user avatar
  • 4,293
4 votes
2 answers

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-...
Jules's user avatar
  • 1,225
5 votes
1 answer

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-...
Yu Shen's user avatar
  • 481
25 votes
7 answers

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 ...
The Unfun Cat's user avatar
5 votes
0 answers

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) ...
Matthew Piziak's user avatar