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

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

RE: How add one to column # on modeline (%c) so starts from _1_?


From: Victor Kirk
Subject: RE: How add one to column # on modeline (%c) so starts from _1_?
Date: Tue, 8 Oct 2002 10:39:57 +0100

> '(: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.




reply via email to

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