From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii 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 20:02:33 +0300 Message-ID: <83r3koupcm.fsf@gnu.org> References: <87a8resxc4.fsf@gmail.com> <83twpmg75m.fsf@gnu.org> <87a8rcs777.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1445447003 7050 80.91.229.3 (21 Oct 2015 17:03:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 21 Oct 2015 17:03:23 +0000 (UTC) Cc: 21710@debbugs.gnu.org To: Oleh Krehel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 21 19:03:11 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 1Zown8-0005DN-Nr for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Oct 2015 19:03:10 +0200 Original-Received: from localhost ([::1]:52926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zown7-0002To-PH for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Oct 2015 13:03:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zown3-0002Ti-5V for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2015 13:03:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zowmz-0005p2-Vp for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2015 13:03:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zowmz-0005ox-TB for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2015 13:03:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zowmz-0006Zr-Ju for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2015 13:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Oct 2015 17:03: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.144544695925254 (code B ref 21710); Wed, 21 Oct 2015 17:03:01 +0000 Original-Received: (at 21710) by debbugs.gnu.org; 21 Oct 2015 17:02:39 +0000 Original-Received: from localhost ([127.0.0.1]:59623 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zowmd-0006ZE-5G for submit@debbugs.gnu.org; Wed, 21 Oct 2015 13:02:39 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:53524) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zowma-0006Z4-3m for 21710@debbugs.gnu.org; Wed, 21 Oct 2015 13:02:37 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NWK00500XG8DE00@a-mtaout23.012.net.il> for 21710@debbugs.gnu.org; Wed, 21 Oct 2015 20:02:34 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NWK005KQY098290@a-mtaout23.012.net.il>; Wed, 21 Oct 2015 20:02:34 +0300 (IDT) In-reply-to: <87a8rcs777.fsf@gmail.com> X-012-Sender: halo1@inter.net.il 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:107809 Archived-At: > From: Oleh Krehel > Cc: 21710@debbugs.gnu.org > Date: Wed, 21 Oct 2015 15:05:16 +0200 > > 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. It doesn't. It inserts the character at point. The problem is that the inserted character becomes invisible because the overlay becomes applicable to it. > "C-e" should complement this behavior, starting from: > > * |foo... > * bar... > > pressing "C-e" should result in: > > * foo|... > * bar... If that's what you want, you need to program that into the mode. The default effect of C-e is to put point one character before the newline on the same visible line, which is _after_ the invisible text. IOW, this is not a bug, but perhaps a missing feature. > And from the state above, pressing "C-d" should result in: > (user-error "Overlay read-only"), instead of deleting hidden characters. Once again, you need to program that. By default, C-d just deletes the character at point. > > 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? Some minimal Lisp-level documentation is in "(elisp) Adjusting Point. For the gory details, see the function adjust_point_for_property in keyboard.c. > I'd like to help in fixing this bug, if it's not too complicated. It's not a bug in point adjustment, strictly speaking: that part does its job as intended. The problem is with the fact that the inserted character becomes invisible. > 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. Then why does it work correctly on the last heading?