[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24073: 24.5; outline-on-heading-p sees any invisible text property a
From: |
Paul Rankin |
Subject: |
bug#24073: 24.5; outline-on-heading-p sees any invisible text property as outline inviisble |
Date: |
Tue, 26 Jul 2016 18:12:33 +1000 |
When attempting to use `outline' to collapse a heading that begins with a
character with any invisible text property, the heading is mistakenly treated
as invisible, when only a heading with the `outline' invisible text property
should be considered invisible (i.e. collapsed).
To reproduce:
1. emacs -Q
2. insert ";;; heading"
3. M-: (outline-on-heading-p)
=> t
4. C-a
5. M-: (put-text-property (point) (1+ (point)) 'invisible 'foo)
6. M-; (outline-on-heading-p)
=> nil
Expected results:
(outline-on-heading-p)
=> t
Actual results:
(outline-on-heading-p)
=> nil
Solution:
The function outline-on-heading-p checks bolp for an invisible property, but
not specifically the `outline' invisible property:
(defun outline-on-heading-p (&optional invisible-ok)
"Return t if point is on a (visible) heading line.
If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
(save-excursion
(beginning-of-line)
(and (bolp) (or invisible-ok (not (outline-invisible-p)))
(looking-at outline-regexp))))
Instead, it should check for only the `outline' invisible text property:
(defun outline-on-heading-p (&optional invisible-ok)
"Return t if point is on a (visible) heading line.
If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
(save-excursion
(beginning-of-line)
(and (bolp) (or invisible-ok (not (eq (outline-invisible-p)
'outline)))
(looking-at outline-regexp))))
--
Paul W. Rankin
www.paulwrankin.com
- bug#24073: 24.5; outline-on-heading-p sees any invisible text property as outline inviisble,
Paul Rankin <=