names icon indicating copy to clipboard operation
names copied to clipboard

Manually rewriting files is boring and error-prone

Open DamienCassou opened this issue 10 years ago • 1 comments

When trying to use names, removing all the prefixes manually is boring, even in Emacs. This can't be done automatically (e.g., with a non-interactive search/replace) because:

  1. references to functions and variables in docstrings must not be changed
  2. it is easy for a call to a global function (e.g., emacs lisp length function) to become a call to a local function (e.g., when removing the prefix of mypackage-length):
(defun mypackage-length (foo)
  (length foo))

will easily be replaced by this non-working code:

(defun length (foo)
  (length foo)) ;; <-- should have been ::length instead

DamienCassou avatar Dec 11 '14 14:12 DamienCassou

At the moment, names is more adequate for new packages than existing ones. I would love to offer a feature like the one you suggest, unfortunately it's also quite a challenge.

My guess is that something like this will have to make use of the code-walker. A simple replace-regexp won't do.

Malabarba avatar Dec 11 '14 15:12 Malabarba