all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How force evaluation of this string's math *before* print?....
@ 2002-10-07 17:53 seberino
  0 siblings, 0 replies; 8+ messages in thread
From: seberino @ 2002-10-07 17:53 UTC (permalink / raw)


On modeline I have this element....

'(:eval "%c + 1")

%c is the column number of the cursor....

How can I tell Emacs to evaluate the addition
in quotes above??? Right now it literally prints
"+ 1" all the time rather than adding it to
column number (%c).

Chris
-- 
_______________________________________

Dr. Christian Seberino
SPAWAR Systems Center San Diego
Code 2363
49590 Lassing Rd. Rm. A339
San Diego, CA 92152-6147
U.S.A.

Phone: (619) 553-7940
Fax:   (619) 553-1269
Email: seberino@spawar.navy.mil
_______________________________________

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

* Re: How force evaluation of this string's math *before* print?....
       [not found] <mailman.1034013252.7639.help-gnu-emacs@gnu.org>
@ 2002-10-09 17:06 ` Jesper Harder
  2002-10-09 19:54   ` seberino
       [not found]   ` <mailman.1034193309.19968.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Jesper Harder @ 2002-10-09 17:06 UTC (permalink / raw)


seberino@spawar.navy.mil writes:

> On modeline I have this element....
>
> '(:eval "%c + 1")
>
> How can I tell Emacs to evaluate the addition in quotes above??? Right
> now it literally prints "+ 1" all the time rather than adding it to
> column number (%c).

You can do it like this:

   '(:eval (format "%d" (1+ (current-column))))

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

* Re: How force evaluation of this string's math *before* print?....
  2002-10-09 17:06 ` How force evaluation of this string's math *before* print? Jesper Harder
@ 2002-10-09 19:54   ` seberino
       [not found]   ` <mailman.1034193309.19968.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: seberino @ 2002-10-09 19:54 UTC (permalink / raw)
  Cc: help-gnu-emacs

Jesper

Thank you so much!! I implemented your suggestion and it gave
me a column number on my mode line that indeed updates itself
as I move around my document!!!

Can I ask you one last question? I noticed that often
the column number will *not* be updated with this
suggestion.  For some reason, on some
lines, the column number is not updated when I move right and
left with the cursor until some event forces an update.
For example, when I change
line numbers that seems to force an update of the column number.
Often pressing right/left arrow *does* effect an update of
column number on modeline but not always.

Thanks again,

Chris



On Wed, Oct 09, 2002 at 07:06:32PM +0200, Jesper Harder wrote:
> seberino@spawar.navy.mil writes:
> 
> > On modeline I have this element....
> >
> > '(:eval "%c + 1")
> >
> > How can I tell Emacs to evaluate the addition in quotes above??? Right
> > now it literally prints "+ 1" all the time rather than adding it to
> > column number (%c).
> 
> You can do it like this:
> 
>    '(:eval (format "%d" (1+ (current-column))))
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

-- 
_______________________________________

Dr. Christian Seberino
SPAWAR Systems Center San Diego
Code 2363
49590 Lassing Rd. Rm. A339
San Diego, CA 92152-6147
U.S.A.

Phone: (619) 553-7940
Fax:   (619) 553-1269
Email: seberino@spawar.navy.mil
_______________________________________

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

* Re: How force evaluation of this string's math *before* print?....
       [not found]   ` <mailman.1034193309.19968.help-gnu-emacs@gnu.org>
@ 2002-10-09 21:21     ` Barry Margolin
  2002-10-09 22:54       ` Michael Slass
  2002-10-09 21:24     ` Jesper Harder
  1 sibling, 1 reply; 8+ messages in thread
From: Barry Margolin @ 2002-10-09 21:21 UTC (permalink / raw)


In article <mailman.1034193309.19968.help-gnu-emacs@gnu.org>,
 <seberino@spawar.navy.mil> wrote:
>Jesper
>
>Thank you so much!! I implemented your suggestion and it gave
>me a column number on my mode line that indeed updates itself
>as I move around my document!!!
>
>Can I ask you one last question? I noticed that often
>the column number will *not* be updated with this
>suggestion.  For some reason, on some
>lines, the column number is not updated when I move right and
>left with the cursor until some event forces an update.
>For example, when I change
>line numbers that seems to force an update of the column number.
>Often pressing right/left arrow *does* effect an update of
>column number on modeline but not always.

The :eval stuff will only be executed when Emacs thinks that something has
changed that requires recomputing the mode line.

-- 
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

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

* Re: How force evaluation of this string's math *before* print?....
       [not found]   ` <mailman.1034193309.19968.help-gnu-emacs@gnu.org>
  2002-10-09 21:21     ` Barry Margolin
@ 2002-10-09 21:24     ` Jesper Harder
  1 sibling, 0 replies; 8+ messages in thread
From: Jesper Harder @ 2002-10-09 21:24 UTC (permalink / raw)


seberino@spawar.navy.mil writes:

> I noticed that often the column number will *not* be updated with this
> suggestion.  For some reason, on some lines, the column number is not
> updated when I move right and left with the cursor until some event
> forces an update.  For example, when I change line numbers that seems
> to force an update of the column number.  Often pressing right/left
> arrow *does* effect an update of column number on modeline but not
> always.

I don't know any other solution than to turn on column-number-mode.

Exactly when Emacs updates the mode-line seems to be hard-wired in Emacs
and appears to depend on whether column-number-mode is turned on.

However, this will also display the zero-based column number (which you
probably don't want).

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

* Re: How force evaluation of this string's math *before* print?....
  2002-10-09 21:21     ` Barry Margolin
@ 2002-10-09 22:54       ` Michael Slass
  2002-10-10  1:08         ` seberino
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Slass @ 2002-10-09 22:54 UTC (permalink / raw)


Barry Margolin <barmar@genuity.net> writes:

>In article <mailman.1034193309.19968.help-gnu-emacs@gnu.org>,
> <seberino@spawar.navy.mil> wrote:
>>Jesper
>>
>>Thank you so much!! I implemented your suggestion and it gave
>>me a column number on my mode line that indeed updates itself
>>as I move around my document!!!
>>
>>Can I ask you one last question? I noticed that often
>>the column number will *not* be updated with this
>>suggestion.  For some reason, on some
>>lines, the column number is not updated when I move right and
>>left with the cursor until some event forces an update.
>>For example, when I change
>>line numbers that seems to force an update of the column number.
>>Often pressing right/left arrow *does* effect an update of
>>column number on modeline but not always.
>
>The :eval stuff will only be executed when Emacs thinks that something has
>changed that requires recomputing the mode line.


This will probably work, although I shudder to think what it will do
to your emacs's performance.

(add-hook 'post-command-hook
          (lambda () (force-mode-line-update)))




-- 
Mike Slass

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

* Re: How force evaluation of this string's math *before* print?....
  2002-10-09 22:54       ` Michael Slass
@ 2002-10-10  1:08         ` seberino
  2002-10-10  1:57           ` Michael Slass
  0 siblings, 1 reply; 8+ messages in thread
From: seberino @ 2002-10-10  1:08 UTC (permalink / raw)
  Cc: help-gnu-emacs

Indeed it works.  Thanks.  I noticed that column number
is updated for all cursor movements.

Is there any way to move the (force-mode-line-update) 
up the "things to do list" for every keystroke???

The reason I'm asking is that the *line number* is updated
immediately after it changes, but, column number is noticeably
slower to update...... there is a noticeable fraction of
a second between cursor movement and column number updating.

Thanks,

Chris

On Wed, Oct 09, 2002 at 10:54:21PM +0000, Michael Slass wrote:
> Barry Margolin <barmar@genuity.net> writes:
> 
> >In article <mailman.1034193309.19968.help-gnu-emacs@gnu.org>,
> > <seberino@spawar.navy.mil> wrote:
> >>Jesper
> >>
> >>Thank you so much!! I implemented your suggestion and it gave
> >>me a column number on my mode line that indeed updates itself
> >>as I move around my document!!!
> >>
> >>Can I ask you one last question? I noticed that often
> >>the column number will *not* be updated with this
> >>suggestion.  For some reason, on some
> >>lines, the column number is not updated when I move right and
> >>left with the cursor until some event forces an update.
> >>For example, when I change
> >>line numbers that seems to force an update of the column number.
> >>Often pressing right/left arrow *does* effect an update of
> >>column number on modeline but not always.
> >
> >The :eval stuff will only be executed when Emacs thinks that something has
> >changed that requires recomputing the mode line.
> 
> 
> This will probably work, although I shudder to think what it will do
> to your emacs's performance.
> 
> (add-hook 'post-command-hook
>           (lambda () (force-mode-line-update)))
> 
> 
> 
> 
> -- 
> Mike Slass
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

-- 
_______________________________________

Dr. Christian Seberino
SPAWAR Systems Center San Diego
Code 2363
49590 Lassing Road, Room A339
San Diego, CA 92152-6147
U.S.A.

Phone: (619) 553-7940
Fax:   (619) 553-1269
Email: seberino@spawar.navy.mil
_______________________________________

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

* Re: How force evaluation of this string's math *before* print?....
  2002-10-10  1:08         ` seberino
@ 2002-10-10  1:57           ` Michael Slass
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Slass @ 2002-10-10  1:57 UTC (permalink / raw)
  Cc: Michael Slass, help-gnu-emacs

seberino@spawar.navy.mil writes:

>Indeed it works.  Thanks.  I noticed that column number
>is updated for all cursor movements.
>
>Is there any way to move the (force-mode-line-update) 
>up the "things to do list" for every keystroke???
>
>The reason I'm asking is that the *line number* is updated
>immediately after it changes, but, column number is noticeably
>slower to update...... there is a noticeable fraction of
>a second between cursor movement and column number updating.
>
>Thanks,

,----[ C-h f add-hook RET ]
| add-hook is a compiled Lisp function in `subr'.
| (add-hook HOOK FUNCTION &optional APPEND LOCAL)
| 
| Add to the value of HOOK the function FUNCTION.
| FUNCTION is not added if already present.
| FUNCTION is added (if necessary) at the beginning of the hook list
| unless the optional argument APPEND is non-nil, in which case
| FUNCTION is added at the end.
|
| <snip>
`----

What I sent will add the force-mode-line-update to the beginning of
the post-command-hook.  Since the line number update is happening as
part of some less-transparent method (the same method which updates
the zero-indexed column number that you don't like from
column-number-mode), I don't know how to hook in before it.

-- 
Mike Slass

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

end of thread, other threads:[~2002-10-10  1:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1034013252.7639.help-gnu-emacs@gnu.org>
2002-10-09 17:06 ` How force evaluation of this string's math *before* print? Jesper Harder
2002-10-09 19:54   ` seberino
     [not found]   ` <mailman.1034193309.19968.help-gnu-emacs@gnu.org>
2002-10-09 21:21     ` Barry Margolin
2002-10-09 22:54       ` Michael Slass
2002-10-10  1:08         ` seberino
2002-10-10  1:57           ` Michael Slass
2002-10-09 21:24     ` Jesper Harder
2002-10-07 17:53 seberino

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.