From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Greg Hill Newsgroups: gmane.emacs.help Subject: Re: looking for something like isearch-forward-column Date: Mon, 29 Sep 2003 16:19:12 -0700 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Trace: sea.gmane.org 1064877749 31897 80.91.224.253 (29 Sep 2003 23:22:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 29 Sep 2003 23:22:29 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 30 01:22:27 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A47LX-0001qe-00 for ; Tue, 30 Sep 2003 01:22:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A47LK-0003jx-Hx for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Sep 2003 19:22:14 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 1A47Ku-0003jf-8y for help-gnu-emacs@gnu.org; Mon, 29 Sep 2003 19:21:48 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 1A47KN-0003Vq-QC for help-gnu-emacs@gnu.org; Mon, 29 Sep 2003 19:21:46 -0400 Original-Received: from [153.105.4.30] (helo=synergymicro.com) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A47KM-0003Ly-Vj for help-gnu-emacs@gnu.org; Mon, 29 Sep 2003 19:21:15 -0400 Original-Received: from synergy.synergy.encinitas.ca.us ([153.105.4.29]) by synergymicro.com (8.9.3/8.9.3) with ESMTP id QAA10841 for ; Mon, 29 Sep 2003 16:22:28 -0700 Original-Received: from [198.17.100.22] (G_Hill_Mac [198.17.100.22]) by synergy.synergy.encinitas.ca.us (8.12.8/8.12.8) with ESMTP id h8TNLDJt015159 for ; Mon, 29 Sep 2003 16:21:13 -0700 In-Reply-To: Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:12878 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12878 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 ^... > >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 -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