unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* looking for something like isearch-forward-column
@ 2003-09-29 22:06 Joel Graber
  2003-09-29 23:19 ` Greg Hill
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Graber @ 2003-09-29 22:06 UTC (permalink / raw)



I use gnu emacs version 21.2.1 usually on linux redhat system.
to view very wide column oriented datafiles 
I'd like to be able to isearch forward and backward for
a character in the same column as the cursor.

I've googled and found several similar questions in *emacs* 
groups but no satisfactory answers.

My latest direction is to start by making it a macro
to call isearch-forward-regexp ^...<letter>

Example text file:
0123
LLLxLLLLL line 1
LHLLLLLLL line 2
LLLLLHLLL line 3
LHLLLLLLL line 4
LLLHLLLLL line 5

If my cursor is on the x in line 1 column 3.
and I want to find where is the next H in this column
(which is in line 5)
and I press a key bound to a macro,
I need it to query me what character to search for,
then convert it a call to isearch-forward-regexp 
for string ^...H

How do I insert <current-column>-1 number of .
into the regexp in the macro?

Or is there lisp code to support this already maybe?

thanks,
-- 
Joel Graber   

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: looking for something like isearch-forward-column
  2003-09-29 22:06 looking for something like isearch-forward-column Joel Graber
@ 2003-09-29 23:19 ` Greg Hill
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Hill @ 2003-09-29 23:19 UTC (permalink / raw)


At 5:06 PM -0500 9/29/03, Joel Graber wrote:
>I use gnu emacs version 21.2.1 usually on linux redhat system.
>to view very wide column oriented datafiles
>I'd like to be able to isearch forward and backward for
>a character in the same column as the cursor.
>
>I've googled and found several similar questions in *emacs*
>groups but no satisfactory answers.
>
>My latest direction is to start by making it a macro
>to call isearch-forward-regexp ^...<letter>
>
>Example text file:
>0123
>LLLxLLLLL line 1
>LHLLLLLLL line 2
>LLLLLHLLL line 3
>LHLLLLLLL line 4
>LLLHLLLLL line 5
>
>If my cursor is on the x in line 1 column 3.
>and I want to find where is the next H in this column
>(which is in line 5)
>and I press a key bound to a macro,
>I need it to query me what character to search for,
>then convert it a call to isearch-forward-regexp
>for string ^...H
>
>How do I insert <current-column>-1 number of .
>into the regexp in the macro?
>
>Or is there lisp code to support this already maybe?
>
>thanks,
>--
>Joel Graber

Joel,

Something like this function bound to a key should get you close to 
what you are trying to do.  You might want to add a (backward-char) 
after the (re-search-forward ...) to leave the cursor in the same 
column as where you started.

(defun next-char-this-col (char)
   (interactive "sFind Char: ")
   (re-search-forward (concat "^.\\{" (int-to-string (current-column)) 
"\\}" char)))

--Greg

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-29 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-29 22:06 looking for something like isearch-forward-column Joel Graber
2003-09-29 23:19 ` Greg Hill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).