* How to know the value of a non interactive function?
@ 2008-10-01 12:33 Rodolfo Medina
2008-10-01 11:55 ` Anders Wirzenius
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Rodolfo Medina @ 2008-10-01 12:33 UTC (permalink / raw)
To: help-gnu-emacs
Pardon the basicness of my question: I wish to know what value is returned by
the `window-height' function in my buffer: how can I achieve that?
Thanks for any help
Rodolfo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to know the value of a non interactive function?
2008-10-01 12:33 How to know the value of a non interactive function? Rodolfo Medina
@ 2008-10-01 11:55 ` Anders Wirzenius
2008-10-01 12:13 ` Tassilo Horn
[not found] ` <mailman.20312.1222863226.18990.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 9+ messages in thread
From: Anders Wirzenius @ 2008-10-01 11:55 UTC (permalink / raw)
To: help-gnu-emacs
Rodolfo Medina <rodolfo.medina@gmail.com> writes:
> Pardon the basicness of my question: I wish to know what value is returned by
> the `window-height' function in my buffer: how can I achieve that?
>
> Thanks for any help
> Rodolfo
type
(window-height)
in the buffer and press C-xC-e
--
Anders
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to know the value of a non interactive function?
2008-10-01 12:33 How to know the value of a non interactive function? Rodolfo Medina
2008-10-01 11:55 ` Anders Wirzenius
@ 2008-10-01 12:13 ` Tassilo Horn
[not found] ` <mailman.20312.1222863226.18990.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 9+ messages in thread
From: Tassilo Horn @ 2008-10-01 12:13 UTC (permalink / raw)
To: help-gnu-emacs
Rodolfo Medina <rodolfo.medina@gmail.com> writes:
Hi Rodolfo,
> Pardon the basicness of my question: I wish to know what value is
> returned by the `window-height' function in my buffer: how can I
> achieve that?
With `M-:' you can evaluate arbitrary lisp code which has access to the
current environment (buffer with point and mark, window, etc.) where you
hit `M-:'. So in your case
M-: (window-height)
should do the trick. (BTW: With M-TAB you have autocompletion for any
known lisp symbol there.)
Bye,
Tassilo
--
Richard Stallman gets 9 bits to the byte.
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.20312.1222863226.18990.help-gnu-emacs@gnu.org>]
* window-height function lies! (was: How to know the value of a non interactive function?)
[not found] ` <mailman.20312.1222863226.18990.help-gnu-emacs@gnu.org>
@ 2008-10-01 16:58 ` Rodolfo Medina
2008-10-01 17:50 ` window-height function lies! Nikolaj Schumacher
[not found] ` <mailman.20348.1222883432.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 9+ messages in thread
From: Rodolfo Medina @ 2008-10-01 16:58 UTC (permalink / raw)
To: help-gnu-emacs
Rodolfo Medina <rodolfo.medina@gmail.com> writes:
>> Pardon the basicness of my question: I wish to know what value is
>> returned by the `window-height' function in my buffer: how can I
>> achieve that?
Anders Wirzenius <anders@no.email.thanks.invalid> writes:
> type
> (window-height)
> in the buffer and press C-xC-e
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Or in the *scratch* buffer, and only there, C-j.
Tassilo Horn <tassilo@member.fsf.org> writes:
> With `M-:' you can evaluate arbitrary lisp code which has access to the
> current environment (buffer with point and mark, window, etc.) where you
> hit `M-:'. So in your case
>
> M-: (window-height)
>
> should do the trick.
Thanks to Anders, Peter and Tassilo for their help.
But, the remarkable result is that, the value returned by window-height turns
to be *false* when the buffer contains a line longer that the screen width (a
line that continues on the following line). Besides, window-height fails in
info buffers and TeX mode buffers, that contain chapter and node titles with
bigger characters.
This is probably related to the malfunction of the
`scroll-preserve-screen-position' variable and of all lisp codes (pager.el,
scroll-in-place.el, etc.) that want to keep point `in place' when scrolling
(see my thread on the matter).
The problem seems to me to be quite a serious one. Comments (and possible
solutions) welcome upon this matter.
Thanks
Rodolfo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: window-height function lies!
2008-10-01 16:58 ` window-height function lies! (was: How to know the value of a non interactive function?) Rodolfo Medina
@ 2008-10-01 17:50 ` Nikolaj Schumacher
[not found] ` <mailman.20348.1222883432.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 9+ messages in thread
From: Nikolaj Schumacher @ 2008-10-01 17:50 UTC (permalink / raw)
To: Rodolfo Medina; +Cc: help-gnu-emacs
Rodolfo Medina <rodolfo.medina@gmail.com> wrote:
> But, the remarkable result is that, the value returned by
> window-height turns to be *false* when the buffer contains a line
> longer that the screen width (a line that continues on the following
> line).
I was a little confused by this sentence at first. Because no matter
how long I made the lines, `window-height' remained the same. But then
I understood, you think it should get smaller, because fewer lines are
displayed, right? However `window-height' is related to the window and
independent of the buffer. It relates to `move-to-window-line', not
`goto-line'.
You might want to use:
(1+ (count-lines (window-start) (window-end)))
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.20348.1222883432.18990.help-gnu-emacs@gnu.org>]
* Re: window-height function lies!
[not found] ` <mailman.20348.1222883432.18990.help-gnu-emacs@gnu.org>
@ 2008-10-01 19:13 ` Rodolfo Medina
2008-10-01 19:47 ` Nikolaj Schumacher
2008-10-01 22:21 ` Bind the value of a function to a variable (was: window-height function lies!) Rodolfo Medina
1 sibling, 1 reply; 9+ messages in thread
From: Rodolfo Medina @ 2008-10-01 19:13 UTC (permalink / raw)
To: help-gnu-emacs
Rodolfo Medina <rodolfo.medina@gmail.com> wrote:
>> But, the remarkable result is that, the value returned by
>> window-height turns to be *false* when the buffer contains a line
>> longer that the screen width (a line that continues on the following
>> line).
Nikolaj Schumacher <me@nschum.de> writes:
> I was a little confused by this sentence at first. Because no matter
> how long I made the lines, `window-height' remained the same. But then
> I understood, you think it should get smaller, because fewer lines are
> displayed, right?
Yes, that's right.
> However `window-height' is related to the window and
> independent of the buffer. It relates to `move-to-window-line', not
> `goto-line'.
>
> You might want to use:
>
> (1+ (count-lines (window-start) (window-end)))
All right that works for `too long' lines. But still window-height fails in
info buffers and TeX mode buffers, that contain chapter and node titles with
bigger characters. Any way to solve that?
Thanks
Rodolfo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: window-height function lies!
2008-10-01 19:13 ` Rodolfo Medina
@ 2008-10-01 19:47 ` Nikolaj Schumacher
0 siblings, 0 replies; 9+ messages in thread
From: Nikolaj Schumacher @ 2008-10-01 19:47 UTC (permalink / raw)
To: Rodolfo Medina; +Cc: help-gnu-emacs
Rodolfo Medina <rodolfo.medina@gmail.com> wrote:
> All right that works for `too long' lines. But still window-height fails in
> info buffers and TeX mode buffers, that contain chapter and node titles with
> bigger characters. Any way to solve that?
I don't have much experience with differently sized characters, but it
should still work. `count-lines' will measure actual lines, and
`window-height' will measure the window height in "regular" lines.
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 9+ messages in thread
* Bind the value of a function to a variable (was: window-height function lies!)
[not found] ` <mailman.20348.1222883432.18990.help-gnu-emacs@gnu.org>
2008-10-01 19:13 ` Rodolfo Medina
@ 2008-10-01 22:21 ` Rodolfo Medina
2008-10-01 22:21 ` Bind the value of a function to a variable Nikolaj Schumacher
1 sibling, 1 reply; 9+ messages in thread
From: Rodolfo Medina @ 2008-10-01 22:21 UTC (permalink / raw)
To: help-gnu-emacs
Nikolaj Schumacher <me@nschum.de> writes:
> You might want to use:
>
> (1+ (count-lines (window-start) (window-end)))
Thanks.
I want to try to bind this to a variable, but don't know the right syntax. I
want to do something like:
(setq scroll-default-lines (1+ (count-lines (window-start) (window-end))))
, but get error. How can I do that the right way?
Thanks
Rodolfo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bind the value of a function to a variable
2008-10-01 22:21 ` Bind the value of a function to a variable (was: window-height function lies!) Rodolfo Medina
@ 2008-10-01 22:21 ` Nikolaj Schumacher
0 siblings, 0 replies; 9+ messages in thread
From: Nikolaj Schumacher @ 2008-10-01 22:21 UTC (permalink / raw)
To: Rodolfo Medina; +Cc: help-gnu-emacs
Rodolfo Medina <rodolfo.medina@gmail.com> wrote:
> Thanks.
> I want to try to bind this to a variable, but don't know the right syntax. I
> want to do something like:
>
> (setq scroll-default-lines (1+ (count-lines (window-start) (window-end))))
>
> , but get error. How can I do that the right way?
What error do you get?
You are correctly /assigning/ the value to a variable. To /bind/ a
variable, you'll need to use `let'.
(let ((scroll-default-lines
(1+ (count-lines (window-start) (window-end)))))
;; use scroll-default-lines here
(setq scroll-default-lines 'something-else))
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-10-01 22:21 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-01 12:33 How to know the value of a non interactive function? Rodolfo Medina
2008-10-01 11:55 ` Anders Wirzenius
2008-10-01 12:13 ` Tassilo Horn
[not found] ` <mailman.20312.1222863226.18990.help-gnu-emacs@gnu.org>
2008-10-01 16:58 ` window-height function lies! (was: How to know the value of a non interactive function?) Rodolfo Medina
2008-10-01 17:50 ` window-height function lies! Nikolaj Schumacher
[not found] ` <mailman.20348.1222883432.18990.help-gnu-emacs@gnu.org>
2008-10-01 19:13 ` Rodolfo Medina
2008-10-01 19:47 ` Nikolaj Schumacher
2008-10-01 22:21 ` Bind the value of a function to a variable (was: window-height function lies!) Rodolfo Medina
2008-10-01 22:21 ` Bind the value of a function to a variable Nikolaj Schumacher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).