unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Oleh Krehel <ohwoeowho@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 21710@debbugs.gnu.org
Subject: bug#21710: 25.0.50; self-insert-command before a folded outline inserts after the outline
Date: Wed, 21 Oct 2015 15:05:16 +0200	[thread overview]
Message-ID: <87a8rcs777.fsf@gmail.com> (raw)
In-Reply-To: <83twpmg75m.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 19 Oct 2015 19:22:29 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

> The reason for this is that on all header lines but the last inserting
> the first 't' makes it invisible.

This isn't a good behavior. `self-insert-command' should not put text
into an invisible region. Instead it should put it ahead of it.

"C-e" should complement this behavior, starting from:

* |foo...
* bar...

pressing "C-e" should result in:

* foo|...
* bar...

And from the state above, pressing "C-d" should result in:
(user-error "Overlay read-only"), instead of deleting hidden characters.

Actually, the points above are often a source of confusion and
frustration. I wouldn't be surprised that this bug was reported before.
Currently, I work around this problem either by unfolding all outlines
while I'm editing, or transforming "foo|" into "foot|" with "C-b ot C-d"
instead of a simple "t".

> Then point adjustment kicks in, and moves point out of the
> invisible region, so the second 't' is inserted at the end of the
> sub-level text.

Can you point me to a place where I can read up on this point
adjustment? I'd like to help in fixing this bug, if it's not too
complicated. So far, I'm looking at this code:

(defun outline-flag-region (from to flag)
  "Hide or show lines from FROM to TO, according to FLAG.
If FLAG is nil then text is shown, while if FLAG is t the text is hidden."
  (remove-overlays from to 'invisible 'outline)
  (when flag
    ;; We use `front-advance' here because the invisible text begins at the
    ;; very end of the heading, before the newline, so text inserted at FROM
    ;; belongs to the heading rather than to the entry.
    (let ((o (make-overlay from to nil 'front-advance)))
      (overlay-put o 'evaporate t)
      (overlay-put o 'invisible 'outline)
      (overlay-put o 'isearch-open-invisible
		   (or outline-isearch-open-invisible-function
		       'outline-isearch-open-invisible))))
  ;; Seems only used by lazy-lock.  I.e. obsolete.
  (run-hooks 'outline-view-change-hook))

The comment about `front-advance' implies that what I proposed above was
the intended behavior, which is broken currently.







  reply	other threads:[~2015-10-21 13:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19 15:16 bug#21710: 25.0.50; self-insert-command before a folded outline inserts after the outline Oleh Krehel
2015-10-19 16:22 ` Eli Zaretskii
2015-10-21 13:05   ` Oleh Krehel [this message]
2015-10-21 17:02     ` Eli Zaretskii
2021-08-15 17:01 ` Lars Ingebrigtsen
2021-08-15 17:32   ` Eli Zaretskii
2021-08-15 18:12     ` Lars Ingebrigtsen
2021-08-15 18:30       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8rcs777.fsf@gmail.com \
    --to=ohwoeowho@gmail.com \
    --cc=21710@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).