Fix the behavior of C-a when visible-mode is active

* lisp/org.el (org-truely-invisible-p): New function.
(org-beginning-of-line): Use `org-truely-invisible-p'.

Sebastien Vauban writes:

> I'm reporting some movement problem I've observed. When on any line, let's say
> the last clock one:
>
> - `C-e' moves the cursor to the end of it
> - `C-a' moves the cursor at the level of `LOGBOOK'.
>
> --8<---------------cut here---------------start------------->8---
> **** Emails and News
>     :PROPERTIES:
>     :ID:       62849012-ae7a-4885-a552-b34516d3fd06
>     :Effort:   1:00
>     :END:
>     :LOGBOOK:
>     CLOCK: [2010-06-01 Tue 08:35]--[2010-06-01 Tue 09:20] =>  0:45
>     CLOCK: [2010-06-02 Wed 09:10]--[2010-06-02 Wed 10:20] =>  1:10
>     CLOCK: [2010-06-03 Thu 09:25]--[2010-06-03 Thu 10:20] =>  0:55
>     CLOCK: [2010-06-04 Fri 09:00]--[2010-06-04 Fri 10:00] =>  1:00
>     CLOCK: [2010-06-07 Mon 09:05]--[2010-06-07 Mon 10:25] =>  1:20
>     CLOCK: [2010-06-08 Tue 09:05]--[2010-06-08 Tue 10:30] =>  1:25
>     CLOCK: [2010-06-09 Wed 09:05]--[2010-06-09 Wed 10:20] =>  1:15
>     CLOCK: [2010-06-10 Thu 09:05]--[2010-06-10 Thu 10:20] =>  1:15
>     CLOCK: [2010-06-11 Fri 09:15]--[2010-06-11 Fri 10:00] =>  0:45
>     CLOCK: [2010-06-14 Mon 09:15]--[2010-06-14 Mon 10:10] =>  0:55
>     :END:
> --8<---------------cut here---------------end--------------->8---
>
> This is -- at least -- true whenever `M-x visible-mode' is enabled.
This commit is contained in:
Carsten Dominik 2010-06-25 08:23:25 +02:00
parent ae20361475
commit 732884dbeb
1 changed files with 13 additions and 2 deletions

View File

@ -18560,8 +18560,8 @@ beyond the end of the headline."
(if (bobp)
nil
(backward-char 1)
(if (org-invisible-p)
(while (and (not (bobp)) (org-invisible-p))
(if (org-truely-invisible-p)
(while (and (not (bobp)) (org-truely-invisible-p))
(backward-char 1)
(beginning-of-line 1))
(forward-char 1))))
@ -18779,6 +18779,17 @@ interactive command with similar behavior."
(outline-invisible-p)
(get-char-property (point) 'invisible)))
(defun org-truely-invisible-p ()
"Check if point is at a character currently not visible.
This version does not only check the character property, but also
`visible-mode'."
;; Early versions of noutline don't have `outline-invisible-p'.
(if (org-bound-and-true-p visible-mode)
nil
(if (fboundp 'outline-invisible-p)
(outline-invisible-p)
(get-char-property (point) 'invisible))))
(defun org-invisible-p2 ()
"Check if point is at a character currently not visible."
(save-excursion