all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Stephen Berman <Stephen.Berman@gmx.net>
Cc: emacs-pretest-bug@gnu.org, emacs-devel@gnu.org
Subject: Re: invisible
Date: Sun, 18 Nov 2007 16:27:09 +0100	[thread overview]
Message-ID: <474059CD.1060107@gmx.at> (raw)
In-Reply-To: <87zlxc5r2f.fsf@escher.local.home>

[-- Attachment #1: Type: text/plain, Size: 3212 bytes --]

 >>>(put-text-property 6 7 `invisible t)
 >>>(put-text-property 12 13 `invisible t)
 >>>(put-text-property 18 19 `invisible t)
 >>>(put-text-property 24 25 `invisible t)
 >>>(put-text-property 30 31 `invisible t)

These will cause problems with `forward-line'.

I'd propose to use

(add-text-properties 6 7 '(invisible t rear-nonsticky t))
(add-text-properties 12 13 '(invisible t rear-nonsticky t))
(add-text-properties 18 19 '(invisible t rear-nonsticky t))
(add-text-properties 24 25 '(invisible t rear-nonsticky t))
(add-text-properties 30 31 '(invisible t rear-nonsticky t))

instead.

 >>>C-p beginning of line4.  Why did we skip line5?
 >>>C-p beginning of line2.  Skipped line3.

See above.  Verify by running (forward-line -1) on these.  Your results
may differ according to the value of `track-eol'.

 >>This behavior still exists in GNU Emacs 23.0.50.4 (i686-pc-linux-gnu,
 >>GTK+ Version 2.12.0) of 2007-11-09 on escher.[1]  In addition, starting
 >>with the cursor at (point-min), the line number indicator in the mode
 >>line displays L1, and it continues to display L1 as you advance either
 >>by C-n or by C-f until it reaches the `l' of `line7', then it changes to
 >>L7.  From there if you type C-b moving point to just after `6', the mode
 >>line displays L6.  Now continuing backwards either by C-p or C-b the
 >>mode line usually continues to display L6, even at (point-min).  Typing
 >>C-b again here then changes the display to L1.

We have been discussing this at the beginning of this year but I don't
recall the thread.  I seem to recall that Emacs tries to optimize line
number calculations as long as the buffer is not modified.

 > In current development Emacs, the cursor stays put, i.e., C-p is a no-op
 > here; the same goes for every position in line 3, except the beginning
 > of the line: here C-p goes to the beginning of line 1 (the parenthetical
 > comment doesn't make sense, unless it is a typo for line 1, or maybe he
 > means the mode line should display L2 instead of L3, even though the
 > cursor stays put).

This seems like a bug in `line-move-finish', please try the attached
patch (untested).

 >>At the beginning of line 3, C-e goes to "i" in line 3.
 >>	(should go to the end of line 3)
 >
 >
 > In current development Emacs, the cursor goes to the end of line 1
 > (anywhere else on line 3, C-e goes to the end of line 3).  On the other
 > hand, C-a at the beginning of line 3 goes to "i" in line 3 (elsewhere it
 > goes to the beginning of the line, so that repeatedly typing C-a
 > starting from the beginning of line 3 makes the cursor oscillate between
 > the first and second columns of the line).
 >
 >
 >>(2) If line-move-ignore-invisible is t:
 >>
 >>At the end of line 1, C-n goes to the beginning of line 3.
 >>	(should go to the end of line 3)
 >>At the end of line 4, C-p goes to the beginning of line 3.
 >>	(should go to the end of line 3)
 >>At the beginning of the line 3, C-e goes to "i" in line 3.
 >>	(should go to the end of line 3)

There's likely also a bug in `line-move-to-column': `move-to-column'
apparently skips invisible text (I didn't find any documentation for
that).  I tried to fix it in a really awkward way in the same patch.

[-- Attachment #2: simple.patch --]
[-- Type: text/plain, Size: 1681 bytes --]

*** simple.el.~1.888.~	Sat Nov 10 09:23:20 2007
--- simple.el	Sun Nov 18 16:02:42 2007
***************
*** 3862,3868 ****
  	     (save-excursion
  	       ;; Like end-of-line but ignores fields.
  	       (skip-chars-forward "^\n")
! 	       (while (and (not (eobp)) (invisible-p (point)))
  		 (goto-char (next-char-property-change (point)))
  		 (skip-chars-forward "^\n"))
  	       (point))))
--- 3862,3869 ----
  	     (save-excursion
  	       ;; Like end-of-line but ignores fields.
  	       (skip-chars-forward "^\n")
! 	       (while (and line-move-ignore-invisible
! 			   (not (eobp)) (invisible-p (point)))
  		 (goto-char (next-char-property-change (point)))
  		 (skip-chars-forward "^\n"))
  	       (point))))
***************
*** 3940,3948 ****
  This function works only in certain cases,
  because what we really need is for `move-to-column'
  and `current-column' to be able to ignore invisible text."
!   (if (zerop col)
!       (beginning-of-line)
      (move-to-column col))

    (when (and line-move-ignore-invisible
  	     (not (bolp)) (invisible-p (1- (point))))
--- 3941,3956 ----
  This function works only in certain cases,
  because what we really need is for `move-to-column'
  and `current-column' to be able to ignore invisible text."
!   (cond
!    ((zerop col)
!     (beginning-of-line))
!    (line-move-ignore-invisible
      (move-to-column col))
+    (t
+     ;; Tedious.
+     (save-restriction
+       (narrow-to-region (line-beginning-position) (line-end-position))
+       (move-to-column col))))

    (when (and line-move-ignore-invisible
  	     (not (bolp)) (invisible-p (1- (point))))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-11-18 15:27 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           ` martin rudalics [this message]
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                                               ` invisible martin rudalics
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=474059CD.1060107@gmx.at \
    --to=rudalics@gmx.at \
    --cc=Stephen.Berman@gmx.net \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-pretest-bug@gnu.org \
    /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 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.