unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Manheimer <ken.manheimer@gmail.com>
To: 42218@debbugs.gnu.org
Subject: bug#42218: 28.0.50; Fix for missed item undecoration on allout-widgets-mode deactivation
Date: Sun, 5 Jul 2020 17:04:56 -0400	[thread overview]
Message-ID: <CAAT_zTGG7taOrhJ25Jbo_DnJm4-UXEcgK+9J90kbjqZ34pRBfA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 3982 bytes --]

The attached patch fixes the bug described below.

In the current version (the current Gnu emacs repository master) of
allout-widgets-mode, exiting the mode fails to undecorate the first item if
it's at the start of the buffer. You can confirm this by creating a simple
outline like the following (indented to distinguish it, the bullets need to
be at the left margin in the actual text):

* First item
.* Second item


Then activate allout-mode and allout-widgets-mode, and then
deactivate allout-widgets-mode. The widget decorations will not be properly
removed from the first item.

The attached patch rectifies this bug so all decorations are properly
removed.


In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30,
cairo version 1.15.10)
 of 2020-07-04 built on gram
Repository revision: 5d1bac0ac951e25d0b0b39a9919f13053162d5df
Repository branch: master
Windowing system distributor 'HC-Consult', version 11.0.12005001
System Description: Ubuntu 18.04.4 LTS

Recent messages:
Allout-Widgets mode disabled in current buffer
M-o C-x o is undefined
Quit
Mark set [2 times]
Quit
Allout mode enabled in current buffer
Allout-Widgets mode enabled in current buffer
M-x is undefined
M-p is undefined
Allout-Widgets mode disabled in current buffer

Configured using:
 'configure --with-gnutls=ifavailable --with-x-toolkit=yes
 --with-xpm=ifavailable --with-jpeg=ifavailable --with-gif=ifavailable
 --with-tiff=ifavailable'

Configured features:
PNG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY FREETYPE HARFBUZZ
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS PDUMPER

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  allout-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils allout-widgets
pcase wid-edit allout ffap thingatpt url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json subr-x map seq
byte-opt gv bytecomp byte-compile cconv url-vars vc-git diff-mode
easymenu easy-mmode cl-loaddefs cl-lib bug-reference tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 74548 7639)
 (symbols 48 8879 1)
 (strings 32 23418 2064)
 (string-bytes 1 775322)
 (vectors 16 13294)
 (vector-slots 8 168908 9258)
 (floats 8 33 150)
 (intervals 56 369 0)
 (buffers 992 15))

[-- Attachment #1.2: Type: text/html, Size: 4643 bytes --]

[-- Attachment #2: 0001-Rectify-allout-widgets-region-undecoration-so-item-a.patch --]
[-- Type: application/octet-stream, Size: 2308 bytes --]

From 186125cd62f88a817aa0872c1be72d4d104270b9 Mon Sep 17 00:00:00 2001
From: Ken Manheimer <ken.manheimer@gmail.com>
Date: Sun, 5 Jul 2020 16:38:13 -0400
Subject: [PATCH] Rectify allout-widgets region undecoration so item at start
 is not missed.

* lisp/allout-widgets.el (allout-widgets-undecorate-region):
Reorganize the loop so an item at the start is not skipped.
---
 lisp/allout-widgets.el | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el
index fbdddca7d7..bdfcaa2e55 100644
--- a/lisp/allout-widgets.el
+++ b/lisp/allout-widgets.el
@@ -2050,19 +2050,22 @@ allout-item-actual-position
 ;;;_   > allout-widgets-undecorate-region (start end)
 (defun allout-widgets-undecorate-region (start end)
   "Eliminate widgets and decorations for all items in region from START to END."
-  (let ((next start)
-        widget)
+  (let (done next widget
+        (end (or end (point-max))))
     (save-excursion
       (goto-char start)
-      (while (<  (setq next (next-single-char-property-change next
-                                                              'display
-                                                              (current-buffer)
-                                                              end))
-                 end)
-        (goto-char next)
-        (when (setq widget (allout-get-item-widget))
-          ;; if the next-property/overly progression got us to a widget:
-          (allout-widgets-undecorate-item widget t))))))
+      (while (not done)
+        (when (and (allout-on-current-heading-p)
+                   (setq widget (allout-get-item-widget)))
+            (if widget
+                (allout-widgets-undecorate-item widget t)))
+        (goto-char (setq next
+                         (next-single-char-property-change (point)
+                                                           'display
+                                                           (current-buffer)
+                                                           end)))
+        (if (>= next end)
+            (setq done t))))))
 ;;;_   > allout-widgets-undecorate-text (text)
 (defun allout-widgets-undecorate-text (text)
   "Eliminate widgets and decorations for all items in TEXT."
-- 
2.17.1


             reply	other threads:[~2020-07-05 21:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-05 21:04 Ken Manheimer [this message]
2020-07-18  7:43 ` bug#42218: 28.0.50; Fix for missed item undecoration on allout-widgets-mode deactivation Eli Zaretskii
2020-07-20 17:56   ` Ken Manheimer
2020-07-20 18:38     ` Eli Zaretskii
2020-07-20 18:58       ` Ken Manheimer
2020-07-20 19:24         ` Eli Zaretskii
2020-07-20 19:28           ` Eli Zaretskii
2020-07-20 20:09             ` Ken Manheimer
2020-07-21  2:24               ` Eli Zaretskii
2020-07-21 15:17                 ` Ken Manheimer
2020-07-21 16:34                   ` Eli Zaretskii
     [not found] ` <handler.42218.B.159398312421153.ack@debbugs.gnu.org>
2020-07-20 19:15   ` bug#42218: Acknowledgement (28.0.50; Fix for missed item undecoration on allout-widgets-mode deactivation) Ken Manheimer

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=CAAT_zTGG7taOrhJ25Jbo_DnJm4-UXEcgK+9J90kbjqZ34pRBfA@mail.gmail.com \
    --to=ken.manheimer@gmail.com \
    --cc=42218@debbugs.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).