ctietze,
@ctietze@mastodon.social avatar

I understand transpose-char, transpose-word, and transpose-sexp in

I don't understand transpose-lines. (C-x C-t)

It doesn't seem to drag along what I expect.

leadore,

@ctietze
org-mode has M-S-up or down (org-shiftmetaup / -down, which calls org-drag-line-forward when point is on normal text) It moves the line you're on in a way that is much more intuitive.

I'm almost always in org-mode so I haven't done it, but you could copy that same code from org-drag-line-forward into a custom function so you'd have the same functionality in other modes. It's in org.el.
(custom function bc if you called it directly it wouldn't work if org-mode hadn't been loaded).

ctietze,
@ctietze@mastodon.social avatar

@leadore One of the first functions I conjured in Elisp was a move line up/down function :)

I totally forgot about the transpose-* functions and figured that maybe I could use these to do the job.

Nah

leadore,

@ctietze I need to stop replying to any emacs posts because I always misinterpret what they are saying/asking for.

ctietze,
@ctietze@mastodon.social avatar

@leadore To be fair I also didn't add a disclaimer like "I don't need a fix for humanly intelligible line transposition", so your helpful 'fix' for my confusion was received well :)

leadore,

@ctietze That's ok, you don't have to do that. It was me reading too much into it.

mrFred489,
@mrFred489@fosstodon.org avatar

@ctietze for me it drags along the line above the cursor. I agree that that seems counterintuitive.

ctietze,
@ctietze@mastodon.social avatar

@mrFred489 Yeah. To drag the line you're looking at, you need to go beyond its line break.

1: Drag me
2: |

Where | denotes the cursor

Then it drags the "drag me" line. I can kind of see how the string parsing led to this, but why this is intentional, I can't tell

  • All
  • Subscribed
  • Moderated
  • Favorites
  • emacs
  • ngwrru68w68
  • DreamBathrooms
  • modclub
  • GTA5RPClips
  • InstantRegret
  • magazineikmin
  • Youngstown
  • thenastyranch
  • rosin
  • slotface
  • mdbf
  • khanakhh
  • kavyap
  • anitta
  • tester
  • normalnudes
  • Leos
  • cisconetworking
  • osvaldo12
  • everett
  • Durango
  • tacticalgear
  • provamag3
  • megavids
  • ethstaker
  • cubers
  • JUstTest
  • lostlight
  • All magazines