GNU bug report logs -
#56837
28.1.90; `current-indentation' sometimes returns zero inside invisible text
Previous Next
Full log
Message #10 received at 56837 <at> debbugs.gnu.org (full text, mbox):
> From: Ihor Radchenko <yantar92 <at> gmail.com>
> Date: Sat, 30 Jul 2022 15:56:39 +0800
>
> 1. emacs -Q
> 2. M-x outline-mode
> 3. Insert
>
> * something
> a
> * else
>
> 4. Move point to "* <point>something"
> 5. <TAB> to fold the outline
> 6. M-: (save-excursion (search-forward " a") (current-indentation))
> ;; => 2
> 7. M-: (remove-from-invisibility-spec '(outline . t))
> 8. M-: (add-to-invisibility-spec '(outline))
> 9. M-: (save-excursion (search-forward " a") (current-indentation))
> ;; => 0; expected: => 2
I don't understand what is the purpose of asking about indentation of
a line that is completely invisible. current-indentation skips
invisible characters, so if everything is invisible, why do you expect
any useful result?
Technically, the difference between the two results is because
current-indentation tries to account for the ellipsis (which is
present in the first case but not in the second). But that's not
relevant to the larger issue at hand here.
Bottom line: I think you are hitting undefined behavior here.
This bug report was last modified 2 years and 160 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.