[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: invisible
From: |
martin rudalics |
Subject: |
Re: invisible |
Date: |
Tue, 27 Nov 2007 19:46:23 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
It turns out that it's also a good behavior in the sense that you can
get the other two behaviors (ignore all invisible text properties and
obey all invisible text properties) in the following way:
(let ((buffer-invisibility-spec nil)) (current-column))
It's not just neat, it's splendid. We can dispense with that
rear-nonstickyness and DTRT with plain rear-sticky, invisible
text. Stephen, please try with the attached patch, it should
work out of the box.
*** simple.el.~1.888.~ Sat Nov 10 09:23:20 2007
--- simple.el Tue Nov 27 19:39:14 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))))
***************
*** 3936,3971 ****
(setq repeat t))))))
(defun line-move-to-column (col)
! "Try to find column COL, considering invisibility.
! 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))))
! (let ((normal-location (point))
! (normal-column (current-column)))
! ;; If the following character is currently invisible,
! ;; skip all characters with that same `invisible' property value.
! (while (and (not (eobp))
! (invisible-p (point)))
! (goto-char (next-char-property-change (point))))
! ;; Have we advanced to a larger column position?
! (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)))
! ;; Otherwise, go to the place we originally found
! ;; and move back over invisible text.
! ;; that will get us to the same place on the screen
! ;; but with a more reasonable buffer position.
! (goto-char normal-location)
! (let ((line-beg (save-excursion (beginning-of-line) (point))))
! (while (and (not (bolp)) (invisible-p (1- (point))))
! (goto-char (previous-char-property-change (point) line-beg))))))))
(defun move-end-of-line (arg)
"Move point to end of current line as displayed.
--- 3937,3975 ----
(setq repeat t))))))
(defun line-move-to-column (col)
! "Try to find column COL, considering invisibility."
! (cond
! ((zerop col)
! (beginning-of-line))
! (line-move-ignore-invisible
! (move-to-column col)
! (when (and (not (bolp)) (invisible-p (1- (point))))
! (let ((normal-location (point))
! (normal-column (current-column)))
! ;; If the following character is currently invisible, skip all
! ;; characters with that same `invisible' property value.
! (while (and (not (eobp)) (invisible-p (point)))
! (goto-char (next-char-property-change (point))))
! ;; Have we advanced to a larger column position?
! (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)))
! ;; Otherwise, go to the place we originally found and move
! ;; back over invisible text. That will get us to the same
! ;; place on the screen but with a more reasonable buffer
! ;; position.
! (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))))))))
! (t
! (let ((buffer-invisibility-spec nil))
! ;; Don't ignore invisible text when `line-move-ignore-invisible'
! ;; is nil.
! (move-to-column col)))))
!
(defun move-end-of-line (arg)
"Move point to end of current line as displayed.
- Re: invisible, (continued)
- Re: invisible, Stefan Monnier, 2007/11/25
- Re: invisible, martin rudalics, 2007/11/26
- Re: invisible, Stefan Monnier, 2007/11/26
- Re: invisible, martin rudalics, 2007/11/26
- Re: invisible, Stefan Monnier, 2007/11/26
- Re: invisible, martin rudalics, 2007/11/27
- Re: invisible,
martin rudalics <=
- Re: invisible, Stefan Monnier, 2007/11/27
- Re: invisible, martin rudalics, 2007/11/28
- Re: invisible, Stefan Monnier, 2007/11/28
- Re: invisible, martin rudalics, 2007/11/28
- Re: invisible, Stephen Berman, 2007/11/28
- Re: invisible, martin rudalics, 2007/11/29
- Re: invisible, Stefan Monnier, 2007/11/29
- Re: invisible, Richard Stallman, 2007/11/28
- Re: invisible, martin rudalics, 2007/11/29
- Re: invisible, Stefan Monnier, 2007/11/29