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

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

Re: List line numbers for easy navigation


From: Heime
Subject: Re: List line numbers for easy navigation
Date: Thu, 18 Apr 2024 23:10:32 +0000

On Friday, April 19th, 2024 at 10:06 AM, Heime <heimeborgia@protonmail.com> 
wrote:

> On Friday, April 19th, 2024 at 9:16 AM, Stephen Berman stephen.berman@gmx.net 
> wrote:
> 
> > On Thu, 18 Apr 2024 21:02:56 +0000 Heime heimeborgia@protonmail.com wrote:
> > 
> > > On Friday, April 19th, 2024 at 8:54 AM, Stephen Berman
> > > stephen.berman@gmx.net wrote:
> > > 
> > > > On Thu, 18 Apr 2024 20:38:44 +0000 Heime heimeborgia@protonmail.com 
> > > > wrote:
> > 
> > [...]
> > 
> > > > > Suppose I am writing some code at row 1358 and want to check on two 
> > > > > functions,
> > > > > one starting at row 355, the other at row 589. I want to go to the 
> > > > > row and add
> > > > > the current row to the list (Will do this three times). Then have a 
> > > > > command to
> > > > > navigate between them. Call command te get me to the respective row.
> > > > 
> > > > You can do this with existing Emacs commands: `M-g M-g' (or` M-g g') to
> > > > get prompted for a line number and then jump to it, and then you can use
> > > > the mark ring (info "(emacs) Mark Ring") or registers (info "(emacs)
> > > > Position Registers") to navigate between positions. Why reinvent the
> > > > wheel?
> > > > 
> > > > Steve Berman
> > > 
> > > Because I am finding that going to the marks with the current keybindings
> > > difficult to remember. Perhaps I can make a new easier command that takes
> > > care of the marks for me and help me use the existing emacs commands 
> > > without
> > > too much struggle.
> > 
> > Then I can only suggest reading those sections of the Emacs manual and
> > if necessary looking at the source code of the functions (I think most
> > of the are Lisp functions in simple.el). Then maybe you can put
> > something together for yourself, though I suspect it won't be easy to
> > get something that works as well as the existing commands. One other
> > tip: if what you really want to do is navigate between existing
> > functions or other named pieces of code, then using `M-.' and` M-,' is
> > probably the most efficient way, see (info "(emacs) Looking Up 
> > Identifiers").
> > 
> > Steve Berman
> 
> 
> I know that C-<SPC> calls the command (set-mark-command ARG)
> 
> 
> But have no idea of the commands associated with "C-<SPC> C-<SPC>" and with 
> "C-u C-<SPC>". Would like a command I can
> 
> call with M-x that does the marking functionality.

Have done some code, but does not work very well

(defun tema-mark ()
  (interactive)
  (save-excursion
    (move-beginning-of-line nil)
    (set-mark-command nil)
    (move-end-of-line nil)))

(defun tema-move ()
  (interactive)
  (set-mark-command 1))

I would like the ability to name a line and then 
move to the named line.  What can I do ?



reply via email to

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