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

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

Re: basic navigation


From: Platon Pronko
Subject: Re: basic navigation
Date: Wed, 5 Jul 2023 08:16:35 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

On 2023-07-05 07:55, Samuel Wales wrote:
***** basic navigation and killing
i am wondering if there are packages that can do this kind
of thing better.

this applies to any editing.  here is an example.  suppose i
am on an org-mode heading, with point at ^.

never mind the actual text.  my goal is to transform it to
this.

    *** ^gather and do physical

so i do the first thing that comes to mind: c-backspace
which runs backward-kill-word in my emacs 27.1.

there are of course many other things i can do, instead,
such as go to bol, use delete-char, etc., but i want to
illustrate basic word killing with this example.  what
occurs is this, successively.

    *** --- /various to do/ and to ^gather and do physical
    *** --- /various to do/ and ^gather and do physical
    *** --- /various to do/ ^gather and do physical
    *** --- /various to ^gather and do physical

i don't particularly mind the command's ignorance of org
syntax here.

    *** --- /various ^gather and do physical
    *** --- /^gather and do physical

and then once more to get rid of the --- syntax, which is a
bit of an emacs editing disaster.  what i wanted was to have
it produce what i set out to do.  maybe naive, but i wonder
if there might be different killing/nav paradigms.

i've been vexed by this since the 1980s with only sporadic
attempts to see if i can improve on it.  time to rely on
others for some ideas and possible existing packages.
please be gentle with me.  am cognitively impaired.


In this particular situation I'd do it like this: C-space, C-a, 4x C-f, C-w 
(set mark, move to beginning of the line, move 4 characters forward, delete 
selection).
Or alternatively C-space, C-a, M-4 C-f, C-w (same thing but automate repetitive 
C-f).

Actually, you can use (setq org-special-ctrl-a/e t), then you can drop 4x C-f 
because C-a will take you to beginning of the heading automatically.

If you need to do this particular thing often you can make a macro out of it, 
or a small interactive function.

By the way, there's also C-0 C-k (kill to the beginning of the line), but that 
will also remove the heading asterisks, which is probably not intended.

--
Best regards,
Platon Pronko
PGP 2A62D77A7A2CB94E




reply via email to

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