From: martin rudalics <rudalics@gmx.at>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: invisible
Date: Wed, 28 Nov 2007 23:41:23 +0100 [thread overview]
Message-ID: <474DEE93.1080102@gmx.at> (raw)
In-Reply-To: <jwvzlwy2n8b.fsf-monnier+emacs@gnu.org>
> But how are lines and columns counted? Does an invisible newline cause
> the intended column numbersto fall back to 0? Does an invisible "a"
> cause the intended column numnber to stay put or to be incremented by 1?
We are talking about the default `line-move-ignore-invisible' t case, I
presume. `col' is the column to move to (presumably the `goal-column'
but I didn't check this). This code starts with
(move-to-column col)
and the first question is whether we can find a case where this fails to
DTRT. Apparently it might fail in the case
(when (and (not (bolp)) (invisible-p (1- (point))))
which raises the question whether `move-to-column' would move to a
position following invisible text. As I know now it does so iff that
text has a rear-nonsticky property (but I don't know about overlays).
Next our code goes into a loop
(while (and (not (eobp)) (invisible-p (point)))
(goto-char (next-char-property-change (point))))
which just skips invisible text and we can conclude that lines are _not_
counted. Moreover, it's strange that `move-to-column' didn't skip that
invisible text as well, but maybe it's a newline. The following piece
of code is contrived and I leave it as an exercise to anyone interested
to find out what it's intended to do:
(if (> (current-column) normal-column)
;; We have made some progress towards the desired column.
;; See if we can make any further progress.
(line-move-to-column (+ (current-column) (- col normal-column)))
This must have been the motivation to splice out `line-move-to-column'
back in 2001 - make it callable recursively. I don't understand the ">"
here (`normal-column' is the column `move-to-column' moved to before).
And I completely fail to understand the argument calculation: Suppose
the desired `col' is 17 and `move-to-column' moved to column 14 on that
line because everything after 14 was invisible. Also suppose the
invisible text ends at the end of some line hence `current-column' would
report 0 - or can you imagine `current-column' to report anything but
zero in this case? Now should we move to column 3 here - or what am I
missing?
The else part goes as
(goto-char normal-location)
(let ((line-beg (line-beginning-position)))
(while (and (not (bolp)) (invisible-p (1- (point))))
(goto-char
(previous-char-property-change (point) line-beg))))))))
which simply moves to the first visible position on the line where
`move-to-column' stopped. IIUC `move-to-column' never stops at a
position following invisible text unless it's rear-nonsticky, hence this
loop would be needed only to handle that special case.
All this got you is more questions asked than answered :-(
next prev parent reply other threads:[~2007-11-28 22:41 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20040225.150142.12214540.kazu@iijlab.net>
[not found] ` <q5gvfluxljk.fsf@lucent.com>
[not found] ` <200402282128.i1SLSuY15359@raven.dms.auburn.edu>
[not found] ` <200402290224.i1T2Oip15705@raven.dms.auburn.edu>
2007-11-09 21:59 ` invisible Stephen Berman
2007-11-18 0:35 ` invisible Stephen Berman
2007-11-18 15:27 ` invisible martin rudalics
2007-11-23 12:24 ` invisible Stephen Berman
2007-11-23 14:25 ` invisible martin rudalics
2007-11-23 18:19 ` invisible Stephen Berman
2007-11-23 19:59 ` invisible martin rudalics
2007-11-23 20:31 ` invisible Stephen Berman
2007-11-23 21:52 ` invisible martin rudalics
2007-11-23 23:04 ` invisible Stephen Berman
2007-11-24 9:33 ` invisible martin rudalics
2007-11-24 10:11 ` invisible Johan Bockgård
2007-11-24 10:30 ` invisible martin rudalics
2007-11-24 10:34 ` invisible martin rudalics
2007-11-24 19:50 ` invisible Stephen Berman
2007-11-24 22:26 ` invisible martin rudalics
2007-11-26 3:25 ` invisible Stefan Monnier
2007-11-26 8:02 ` invisible martin rudalics
2007-11-26 15:17 ` invisible Stefan Monnier
2007-11-26 19:10 ` invisible martin rudalics
2007-11-26 20:19 ` invisible Stefan Monnier
2007-11-26 3:20 ` invisible Stefan Monnier
2007-11-26 7:59 ` invisible martin rudalics
2007-11-26 15:29 ` invisible Stefan Monnier
2007-11-26 19:09 ` invisible martin rudalics
2007-11-26 20:16 ` invisible Stefan Monnier
2007-11-27 13:11 ` invisible martin rudalics
2007-11-27 18:46 ` invisible martin rudalics
2007-11-27 22:44 ` invisible Stefan Monnier
2007-11-28 9:16 ` invisible martin rudalics
2007-11-28 19:20 ` invisible Stefan Monnier
2007-11-28 22:41 ` martin rudalics [this message]
2007-11-28 23:23 ` invisible Stephen Berman
2007-11-29 10:15 ` invisible martin rudalics
2007-11-29 16:13 ` invisible Stefan Monnier
2007-11-29 1:04 ` invisible Richard Stallman
2007-11-29 10:26 ` invisible martin rudalics
2007-11-29 15:57 ` invisible Stefan Monnier
2007-11-29 16:36 ` invisible martin rudalics
2007-11-29 18:53 ` invisible Stefan Monnier
2007-11-29 19:55 ` invisible martin rudalics
2007-11-30 17:19 ` invisible martin rudalics
2007-11-30 18:59 ` invisible Stefan Monnier
2007-11-30 22:09 ` invisible martin rudalics
2007-12-01 3:11 ` invisible Stefan Monnier
2007-12-01 9:44 ` invisible martin rudalics
2007-12-01 20:41 ` invisible Stefan Monnier
2007-12-02 1:15 ` invisible Johan Bockgård
2007-12-02 9:47 ` invisible martin rudalics
2007-11-23 14:37 ` invisible martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=474DEE93.1080102@gmx.at \
--to=rudalics@gmx.at \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).