From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.bugs 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 Message-ID: <87a8rcs777.fsf@gmail.com> References: <87a8resxc4.fsf@gmail.com> <83twpmg75m.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1445432757 9846 80.91.229.3 (21 Oct 2015 13:05:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 21 Oct 2015 13:05:57 +0000 (UTC) Cc: 21710@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 21 15:05:42 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zot5H-0004S8-A9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Oct 2015 15:05:39 +0200 Original-Received: from localhost ([::1]:51435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zot5G-0006FC-Cd for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Oct 2015 09:05:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zot4l-0005b7-BH for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2015 09:05:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zot4g-00035u-8w for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2015 09:05:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zot4g-00035i-6U for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2015 09:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zot4f-0007cZ-Ql for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2015 09:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Oleh Krehel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Oct 2015 13:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21710 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21710-submit@debbugs.gnu.org id=B21710.144543269029274 (code B ref 21710); Wed, 21 Oct 2015 13:05:01 +0000 Original-Received: (at 21710) by debbugs.gnu.org; 21 Oct 2015 13:04:50 +0000 Original-Received: from localhost ([127.0.0.1]:58866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zot4T-0007c6-JA for submit@debbugs.gnu.org; Wed, 21 Oct 2015 09:04:49 -0400 Original-Received: from mail-wi0-f173.google.com ([209.85.212.173]:33503) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zot4Q-0007bu-GU for 21710@debbugs.gnu.org; Wed, 21 Oct 2015 09:04:47 -0400 Original-Received: by wijp11 with SMTP id p11so94030407wij.0 for <21710@debbugs.gnu.org>; Wed, 21 Oct 2015 06:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=ba9GUHUrxOuqlFwJoP52sm2C+A3HkncBu+894mjCLVY=; b=he7/ROX0raM4E7y2zQpt27fdbwnFBTkHTHcaUnt1ssQpgvyTeB6n5SxihKhB9hbuzC MzIiCCcEMeKt1yRTyz0dv9bqkZ/H56D0QnrI/At9EfJcdo5VuYlkP61h+s46OVEsNqgX ycouaMHGalSM6L8rLkFz+SDhHO9JfqwjABpVRD3T8n7MYQDUohMTd/bT3tPXyjZ0mczk WU6F+4H2UxYQufJqQQQnbEFjxAtXfRVwmLYldeuLA9kHBHnaDenN+oIsGsaxSkj0wsro AD2B6fiZ8l/I/2IUubceEpEMh54C9y/W6I5nTelrb4S8JhwDwrb6GXyI7mE71rO1KB40 jybg== X-Received: by 10.180.89.67 with SMTP id bm3mr11482642wib.56.1445432685729; Wed, 21 Oct 2015 06:04:45 -0700 (PDT) Original-Received: from firefly (dyn069045.nbw.tue.nl. [131.155.69.45]) by smtp.gmail.com with ESMTPSA id q1sm10314302wje.39.2015.10.21.06.04.44 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 21 Oct 2015 06:04:44 -0700 (PDT) In-Reply-To: <83twpmg75m.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 19 Oct 2015 19:22:29 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:107804 Archived-At: Eli Zaretskii 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.