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

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

looping over characters in a string in elisp?


From: Roy Smith
Subject: looping over characters in a string in elisp?
Date: Wed, 25 Dec 2002 18:53:54 -0500
User-agent: MT-NewsWatcher/3.1 (PPC)

I'm probably being dense, but I can't figure out how to loop over each 
character in a string in elisp (I'm using emacs 20.5.1).  I know I can 
use mapchar to map a function to each character, but I'm looking for 
something that lets me do (essentially):

(while char in string
   (do stuff)
)
>From help-gnu-emacs-bounces@gnu.org  Wed Dec 25 19:35:09 2002
Path: 
shelby.stanford.edu!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!newsfeed.mathworks.com!news.tele.dk!not-for-mail
Newsgroups: gnu.emacs.help
References: <roy-722F9F.18535425122002@reader1.panix.com>
From: Jesper Harder <harder@myrealbox.com>
X-Face: ^RrvqCr7c,P$zTR:QED"@h9+BTm-"fjZJJ-3=OU7.)i/K]<.J88}s>'Z_$r;
        <N5ksn~%wJ@2pjF}="tV;FBsdpFarSWA<oYkZsViGf:F^SD-KXhvFxh;~]?)SWm~+u};
        0=x}<vOm&5J+?]yB2d]q4x8\0g7SX
Organization: http://purl.org/harder/
Mail-Copies-To: never
Date: Thu, 26 Dec 2002 01:32:33 +0100
Message-ID: <m3wulxoc0u.fsf@defun.localdomain>
User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50
 (i686-pc-linux-gnu)
Cancel-Lock: sha1:M3osTqMm4OxUCyb+dKkWVrtTi68=
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Lines: 20
NNTP-Posting-Host: 195.215.96.182
X-Trace: 1040862841 dtext01.news.tele.dk 47419 195.215.96.182
X-Complaints-To: abuse@post.tele.dk
Xref: shelby.stanford.edu gnu.emacs.help:108482
To: help-gnu-emacs@gnu.org
Subject: Re: looping over characters in a string in elisp?
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1b5
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
List-Archive: <http://mail.gnu.org/pipermail/help-gnu-emacs>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
X-List-Received-Date: Thu, 26 Dec 2002 00:35:09 -0000

Roy Smith <roy@panix.com> writes:

> I can't figure out how to loop over each character in a string in
> elisp (I'm using emacs 20.5.1).  I know I can use mapchar to map a
> function to each character, but I'm looking for something that lets me
> do (essentially):
>
> (while char in string
>    (do stuff))

Here's two different ways:

(require 'cl)
(setq str "Test!")

(dolist (char (append str nil))
  (print char))

(dotimes (i (length str))
  (print (aref str i)))
>From help-gnu-emacs-bounces@gnu.org  Thu Dec 26 01:50:11 2002
Path: 
shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!tleepslib.sk.tsukuba.ac.JP!not-for-mail
From: "Stephen J. Turnbull" <stephen@xemacs.org>
Newsgroups: comp.emacs.xemacs,gnu.emacs.help
Date: Thu, 26 Dec 2002 15:45:27 +0900
Organization: The XEmacs Project
Lines: 20
Message-ID: <871y45pixb.fsf@tleepslib.sk.tsukuba.ac.jp>
References: <3DFE426B.40509@mcw.edu> <3DFF46E3.9070508@mcw.edu>
NNTP-Posting-Host: tleepslib.sk.tsukuba.ac.jp (130.158.98.109)
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: fu-berlin.de 1040885186 6845433 130.158.98.109 (16 [117150])
User-Agent: Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.4 (Military
 Intelligence, i686-pc-linux)
Cancel-Lock: sha1:+4dflFpwkQyxcnQUAEA9SrvFhd0=
Xref: shelby.stanford.edu comp.emacs.xemacs:69216 gnu.emacs.help:108483
To: help-gnu-emacs@gnu.org
Subject: Re: EFS for editing HTML via ftp problem
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1b5
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
List-Archive: <http://mail.gnu.org/pipermail/help-gnu-emacs>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
X-List-Received-Date: Thu, 26 Dec 2002 06:50:11 -0000

>>>>> "Rodney" == Rodney Sparapani <rsparapa@mcw.edu> writes:

    Rodney> I decided to test the same server with emacs (ange-ftp)
    Rodney> and it seems to be having the same problem.  I'll have to
    Rodney> dig into the EFS settings to see if there is something
    Rodney> there that might help.

M-x report-efs-bug

gives a lot of diagnostic information.  Attempt the connection, then
do the bug report.  I suspect your server is whacked, but it may just
be a new configuration that EFS doesn't know about.  The EFS
maintainers will want to know about it (but Mike at least is not going
to be available until about Jan 4).

-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.
>From codefox@ftml.net Thu Dec 26 03:24:21 2002
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13)
        id 18RTJO-0003yu-00
        for help-gnu-emacs@gnu.org; Thu, 26 Dec 2002 03:24:14 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13)
        id 18RTJM-0003xR-00
        for help-gnu-emacs@gnu.org; Thu, 26 Dec 2002 03:24:12 -0500
Received: from ny2.fastmail.fm ([66.111.4.3] helo=server2.fastmail.fm)
        by monty-python.gnu.org with esmtp (Exim 4.10.13)
        id 18RTJC-0003uj-00
        for help-gnu-emacs@gnu.org; Thu, 26 Dec 2002 03:24:02 -0500
Received: from server2.fastmail.fm (localhost [127.0.0.1])
        by fastmail.fm (Postfix) with ESMTP id 8439E2619B
        for <help-gnu-emacs@gnu.org>; Thu, 26 Dec 2002 03:24:00 -0500 (EST)
Received: from 127.0.0.1 ([127.0.0.1] helo=server2.fastmail.fm) by fastmail.fm
  with SMTP; Thu, 26 Dec 2002 03:24:00 -0500
Received: by server2.fastmail.fm (Postfix, from userid 99)
        id 7E8D937647; Thu, 26 Dec 2002 03:24:00 -0500 (EST)
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="ISO-8859-1"
MIME-Version: 1.0
X-Mailer: MIME::Lite 1.2  (F2.71; T1.001; A1.51; B2.12; Q2.03)
From: "Code Fox" <codefox@ftml.net>
To: help-gnu-emacs@gnu.org
Date: Thu, 26 Dec 2002 13:54:00 +0530
X-Epoch: 1040891040
X-Sasl-enc: cnpSaQk4aFoaW/z2g6mloA
Message-Id: <20021226082400.7E8D937647@server2.fastmail.fm>
Subject: Line numbers on the left side
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1b5
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
List-Archive: <http://mail.gnu.org/pipermail/help-gnu-emacs>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
X-List-Received-Date: Thu, 26 Dec 2002 08:24:21 -0000

Is it possible to have line numbers displayed on the left side of the
emacs editor? Of course, the mode-line displays the line number where the
cursor is, but I'd like to know if it's possible to have line numbers
displayed on the side.

Thanks.

-- 
http://fastmail.fm - Does exactly what it says on the tin



reply via email to

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