Re: move-lines.el: a lazy programmer's package to move lines around
Philip Kaludercic <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
Pedro Andres Aranda Gutierrez <[email protected]> writes: > Hi Philip, > > On Wed, 2 Sept 2026 at 18:14, Philip Kaludercic <[email protected]> wrote: > >> "Pedro A. Aranda" <[email protected]> writes: >> >> > Hi >> > >> > I'm back from my Internet-free month and ready to start a fruitful >> > discussion. >> > >> > First of all, thanks for the interest and the encouragement. It was a >> > temptation to take my computer to the holidays and work on this, but I >> > resisted :-) >> > >> > Things that have come up and I've been maturing: >> > >> > 1.- landscape: I need to start browsing ELPA to find other packages >> > that could implement something like this. I recognise that I've been >> > using move-text for too long to look for alternatives. >> >> Also recall that transpose-lines exists in Emacs. >> > > Right.. part of the motivation for move-lines was that I didn't manage to > tame transpose-lines for my purpose. > I tried, but I got lost calculating all necessary points (four if memory > serves me well) Yes, two for the first range and two for the second. > and I found it easier > to delete and extract and then re-insert. In the end (transpose-subr-1), that is what a command like transpose-lines does as well. >> 2.- (maybe this should be first) my motivation: I was using move-text >> > to move one or more lines. When writing pure text, a paragraph is just >> > a block of lines and when I needed to move a sentence, I'd select the >> > sentence, kill it to the kill-buffer and yank it at its new position. >> > move-text wasn't intuitive for this and I never tried to hard to learn >> > how to do it. >> >> Have you taken a look at Embark or my do-at-point package? It might >> provide some inspiration. It might be interesting to provide some >> generalized tranpose-thing command. >> > > Hmmm... that could be a good exercise :-) > Don't know if my emacs Lisp is enough for that. If you have any questions how some code works (especially if it is part of do-at-point, but I ought to manage Embark as well), I am glad to help. >> > 3.- repeat-maps: Never used them, but happy to learn how to use them :-) >> > >> > My main concern is that I don't know how to write one for the situation: >> > >> > Currently, I'm using C-S-up and C-S-down and I think I would be able >> > to write a repeat-map for this. However, suppose user uses C-S-up and >> > C-S-down to mark paragraphs and wants to remap move-lines-up and >> > move-lines-down. Is there a way to reflect the new bindings in a repeat >> map? >> >> They would also have to update the repeat map in that case. >> >> > 4.- Contributing the code: there are already a couple lines of mine in >> > Emacs plain and I'm contributing a bit more to org-mode, so I don't >> > think it would be a problem. >> >> What is this in reference to? Have you signed the FSF copyright >> assignment? >> > > I signed the FSF paperwork a couple of years ago to add the flat-button > type to the faces and > there are also a couple contribs to manual of mine. > I'm currently maintaining ox-latex.el and ox-beamer.el in org-mode. Ah OK, I don't have access to the copyright file so I wanted to double-check since it wasn't clear to me from the message above. >> > Best, /PA >> > >> > >> > On 11/08/2026 06:44, Richard Stallman wrote: >> >> [[[ To any NSA and FBI agents reading my email: please consider ]]] >> >> [[[ whether defending the US Constitution against all enemies, ]]] >> >> [[[ foreign or domestic, requires you to follow Snowden's example. ]]] >> >> > >>> What exactly is your concern here? Having a command that >> >> can move >> >> > >>> around text in an interactive setting is useful in general, >> but also not >> >> > >>> something that we expect to be upgraded and extended >> extensively, so >> >> > >>> having it stable and complete in core sounds like a good idea >> to me, >> >> That's what I thought, too, when I first saw this. Also, I think it >> >> is worth some effort and discussion to choose a command interface that >> >> is very natural and easy for people to remember. >> >> That could make the difference between a useful feature and a very >> >> handy feature. >> >> >> > > Best, /PA