bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64696: 30.0.50; indent-to inherits preceding text properties, includ


From: Ihor Radchenko
Subject: bug#64696: 30.0.50; indent-to inherits preceding text properties, including 'invisible
Date: Thu, 20 Jul 2023 09:10:02 +0000

Eli Zaretskii <eliz@gnu.org> writes:

>> > Invisible text is skipped by current-column.
>> 
>> I am not sure if I understand what you mean by "skipped".
>
> "Skipped" means that the invisible text is not counted as occupying
> columns on display.  It is skipped without incrementing the column
> count.  See this part of scan_for_column:

In my tests, invisible overlay property does not appear to affect things.

>> Consider the following file in outline-mode:
>> [...]
>
> Please make it easier for me to follow the questions you are asking
> and provide helpful responses by (a) making the recipes as simple as
> possible, and (b) by describing them in full detail.  "Folded",
> "unfolded heading", "applied invisible text property", etc. -- all
> those might be crystal clear to you, but they aren't so to me, and
> require me to guess (and err) what exactly did you do and how.

Sure.
You can do M-x yant/full-test after evaluating the code below

(defun yant/test-indent-columns ()
  (visible-mode -1)
  (search-forward "word")
  (warn "Moved point after first 'word'")
  (warn "1:: current-column = %d" (current-column))
  (redisplay)
  (warn "redisplayed")
  (warn "2:: current-column = %d" (current-column))
  (indent-to 50)
  (warn "Indented to column 50")
  (warn "3:: current-column = %d" (current-column))
  (redisplay)
  (warn "redisplayed")
  (warn "4:: current-column = %d" (current-column))
  (visible-mode +1)
  (warn "Enabled visible mode")
  (warn "5:: current-column = %d" (current-column))
  (redisplay)
  (warn "redisplayed")
  (warn "6:: current-column = %d" (current-column))
  (visible-mode -1)
  (read-char "Press any key")
  (kill-buffer))

(defun yant/test-init-buffer ()
  (switch-to-buffer (get-buffer-create "*Test*"))
  (delete-other-windows)
  (unless (eq major-mode 'outline-mode) (outline-mode))
  (erase-buffer)
  (insert "\n")
  (insert "* Test\n")
  (insert "word word\n")
  (goto-char (point-min)))

(defun yant/full-test ()
  (interactive)
  (when (get-buffer "*Warnings*")
    (with-current-buffer "*Warnings*" (with-silent-modifications 
(erase-buffer))))
  (yant/test-init-buffer)
  (warn "We are going to indent second 'word' to column 50 and check 
`current-column'.")
  (outline-show-all)
  (warn "Test #1:: Everything visible.")
  (read-char "Press any key to start the test")
  (yant/test-indent-columns)
  (yant/test-init-buffer)
  (warn "Test #2:: 'word' is inside folded heading (hidden using overlays).")
  (outline-cycle-buffer)
  (read-char "Press any key to start the test")
  (yant/test-indent-columns)
  (yant/test-init-buffer)
  (warn "Test #3:: 'word' is hidden applying 'invisible text property to 
heading body.")
  (outline-show-all)
  (save-excursion
    (search-forward "Test")
    (with-silent-modifications (put-text-property (point) (point-max) 
'invisible t)))
  (read-char "Press any key to start the test")
  (yant/test-indent-columns)
  (yant/test-init-buffer)
  (warn "Test #4:: 'word' is hidden applying non-sticky 'invisible text 
property to heading body.")
  (outline-show-all)
  (save-excursion
    (search-forward "Test")
    (with-silent-modifications (put-text-property (point) (point-max) 
'invisible t))
    (with-silent-modifications (put-text-property (point) (point-max) 
'rear-nonsticky '(invisible))))
  (read-char "Press any key to continue")
  (yant/test-indent-columns))


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]