help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pushing and popping the mark


From: Francis Belliveau
Subject: Re: pushing and popping the mark
Date: Sat, 9 May 2015 08:49:48 -0400

Sam,

First let me say that emacs is so engrained in my finger tips that I find it 
difficult to decipher keystroke speak.  I do not have time to try your 
keystrokes to get the fill feel of what your are doing.

Although I do not fully follow what you are doing, two things come to mind.

First would C-X C-X (swap point and mark) rather than C-U C-Space (pop mark) to 
help reduce things a little.  It is certainly easier to type.

Second, whenever I have something repetitive like this to do, I usually define 
a temporary keyboard macro to help out.  You just need to be creative about 
where in the process the macro starts and ends.

I would think something like:
1. Position curser at yank location.
2. C-Space to mark the location
3. Position curser at start of cut location.
4. Mark and select text to be cut.
5. C-X( to start keyboard macro.
6. C-W to cut the text
7. C-X C-X to swap to paste location
8. C-Y to yank the text
9. C-X) to end keyboard macro.

Now you have.
  A. Perform the first 4 steps.
  B. C-Xe to execute the macro.

As opposed what I see as your 7 steps, this takes 9 steps the first time, then 
5 steps  for every repeat after that.
Not much of a savings, but with a lot of repeats it does helps and it certainly 
gets around the finger tangles.

The one that I use a lot is to paste something at the beginning of a line like 
when turning an enumerated list into a switch statement:
After priming the pump with a "M-W C-E :” I create a macro that looks something 
like:
C-N C-A C-Y C-E:

Fran


> On May 9, 2015, at 7:30 AM, Sam Halliday <sam.halliday@gmail.com> wrote:
> 
> To answer my own question, with an alternative, below:
> 
> On Saturday, 9 May 2015 12:18:39 UTC+1, Sam Halliday  wrote:
>> I have found myself doing some repetitive editing recently that I am sure 
>> can be optimised.
>> 
>> Let's say I have a chunk of existing text (in the middle of the buffer), and 
>> a bunch of new text (at the bottom of the buffer) with bits of text that I 
>> want to selectively kill and then yank into the existing text.
>> 
>> So the workflow looks like this:
>> 
>> 1. go to "new text", kill some relevant text
>> 2. go to "existing text", yank
>> 3. repeat
>> 
>> 
>> In terms of keys strokes this means:
>> 
>> 1. `C-U SPACE` (now near relevant "new text") then unavoidable manual 
>> keystrokes to select/kill
>> 2. `C-SPACE C-SPACE`, then `C-U SPACE` (does nothing) to add this location 
>> to the mark ring and ignore that mark in the ring.
>> 3. `C-U SPACE` (now near relevant "existing text") then unavoidable manual 
>> keystrokes to yank
>> 4. `C-SPACE C-SPACE`, then `C-U SPACE` (does nothing) to add this location 
>> to the mark ring
>> 
>> Actually, my fingers can confused and end up just using pageup/down :-/
>> 
>> Obviously, steps 2 and 4 are undesirable. Is there a single command that I 
>> can perform to effectively save the current point, then go to the second 
>> mark in the mark ring?
> 
> 
> The workflow can also be optimised by opening a second frame into the same 
> buffer. That helps a lot because `C-x o` then jumps to approximately the 
> locations where I was wanting to set the marks anyway. However, it then 
> requires me to split my screen... which is sometimes not ideal.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]