From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Re: How add one to column # on modeline (%c) so starts from _1_? Date: Wed, 9 Oct 2002 10:34:11 -0400 (EDT) Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <20021008123341.A25649@spawar.navy.mil> Reply-To: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1034174231 31061 127.0.0.1 (9 Oct 2002 14:37:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 9 Oct 2002 14:37:11 +0000 (UTC) Cc: Victor Kirk , Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17zHxT-00084U-00 for ; Wed, 09 Oct 2002 16:37:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17zHxW-0003WJ-00; Wed, 09 Oct 2002 10:37:10 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17zHwl-0002VD-00 for help-gnu-emacs@gnu.org; Wed, 09 Oct 2002 10:36:23 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17zHuq-00087y-00 for help-gnu-emacs@gnu.org; Wed, 09 Oct 2002 10:34:26 -0400 Original-Received: from adsl-65-43-211-62.dsl.bcvloh.ameritech.net ([65.43.211.62] helo=heidegger.mousecar.net) by monty-python.gnu.org with esmtp (Exim 4.10) id 17zHul-00083c-00 for help-gnu-emacs@gnu.org; Wed, 09 Oct 2002 10:34:19 -0400 Original-Received: from localhost (ken@localhost) by heidegger.mousecar.net (8.11.6/8.11.6) with ESMTP id g99EYBP19515; Wed, 9 Oct 2002 10:34:12 -0400 X-Authentication-Warning: heidegger.mousecar.net: ken owned process doing -bs X-X-Sender: Original-To: In-Reply-To: <20021008123341.A25649@spawar.navy.mil> Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:2414 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:2414 It's generally a good idea to be clear about the "big picture" surrounding the issue at hand. I'm not sure what it is in this case, but I'm guessing that you're wanting the modeline to show the column number of the cursor (in emacs-speak: the "point"). It might also be wagered that this is more for the sake of intellectual curiosity. If the goal is the first, you could put this in your ~/.emacs: ; set line numbering on (setq-default line-number-mode t) If the goal is more the second, you might want to have a look at the elisp source now and again as you compose your code. hth, ken -- AMD crashes? See http://cleveland.lug.net/~ken/amd-problem/. Spake seberino@spawar.navy.mil at 12:33 (UTC-0700) on Tue, 8 Oct 2002: = Thanks for the help!!!!! = = I implemented your suggestion in my mode line def.... = = (setq default-mode-line-format (list "" = 'mode-line-buffer-identification = " " = (system-name) = " " = '(:eval (format "%s" (+ (string-to-int "%c") 1))) = "Line %l Col %c")) = = Indeed the eval part delivers a "1". The problem is that the "1" is = not updated as columnn number changes.... it just stays "1" for all = time.... = = What did you mean by "column-number-mode"??? Perhaps that would = solve problem of updating the eval line continuously???? = = Chris = = = On Tue, Oct 08, 2002 at 10:39:57AM +0100, Victor Kirk wrote: = > = > = > > '(:eval "%c + 1") = > = > > The above will print "0 + 1" on the modeline when in the first column. = > = > This is because it thre result is a string which contains those characters. = > What you need to do is = > = > o convert %c to an int - (string-to-int "%c") = > o add one to this value - (+ (string-to-int "%c") 1) = > o Return the result as a string (format "%s" (+ (string-to-int "%c") 1)) = > = > > How can I tell Emacs to evaluate the *addition* in quotes rather = > > than just interpret it as a /string/???? = > = > Thus try = > = > (:eval (format "%s" (+ (string-to-int "%c") 1))) = > = > And don't forget to use column-number-mode! = > = > Vic = > -- = > = > = > = > This message, including attachments, is intended only for the use by the = > person(s) to whom it is addressed. It may contain information which is = > privileged and confidential. Copying or use by anybody else is not = > authorised. If you are not the intended recipient, please contact the sender = > as soon as possible. The views expressed in this communication may not = > necessarily be the views held by Serco Integrated Transport. = > = > = > _______________________________________________ = > Help-gnu-emacs mailing list = > Help-gnu-emacs@gnu.org = > http://mail.gnu.org/mailman/listinfo/help-gnu-emacs = =