unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42246: 28.0.50; lisp/allout-widgets.el: Resolve missing button-region keymap bindings
@ 2020-07-07 14:49 Ken Manheimer
       [not found] ` <handler.42246.B.159413341028906.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Ken Manheimer @ 2020-07-07 14:49 UTC (permalink / raw)
  To: 42246


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

In the current development version of allout-widgets.el, some useful global
bindings are missing when the cursor is in the icon area of a topic. The
attached patch rectifies this by inheriting the button-area (and body-area)
keymaps from both the (current-global-keymap) and (current-local-keymap).

To replicate the problem before applying the patch, visit
lisp/allout-widgets.el and activate allout-mode and allout-widgets-mode.
Then position the cursor on a bullet icon by hitting `Ctrl-A' twice, or by
using the mouse. Then try to go to the beginning of the buffer by hitting
`Esc-<', and you will see `M-< is undefined'.

(This is the last of the items I already had on my allout-widgets queue
pending resolution.)

Ken

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

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Mark set
Allout mode enabled in current buffer
Allout-Widgets mode enabled in current buffer
M-< is undefined
M-x is undefined

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: ELisp/d

Minor modes in effect:
  allout-widgets-mode: t
  allout-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  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 password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date subr-x seq byte-opt
gv bytecomp byte-compile cconv 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 wid-edit allout
vc-git diff-mode easymenu easy-mmode cl-loaddefs cl-lib 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 102984 8403)
 (symbols 48 7749 1)
 (strings 32 19900 839)
 (string-bytes 1 648936)
 (vectors 16 12072)
 (vector-slots 8 151162 12185)
 (floats 8 26 40)
 (intervals 56 5234 202)
 (buffers 992 12))

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

[-- Attachment #2: 0001-Resolve-missing-button-region-keymap-bindings.patch --]
[-- Type: application/octet-stream, Size: 4298 bytes --]

From b6954b4d848b70458403c729d73075904208fd57 Mon Sep 17 00:00:00 2001
From: Ken Manheimer <ken.manheimer@gmail.com>
Date: Tue, 7 Jul 2020 10:32:03 -0400
Subject: [PATCH] Resolve missing button-region keymap bindings.

* lisp/allout-widgets.el (allout-item-icon-keymap,
allout-item-body-keymap, allout-cue-span-keymap, allout-widgets-mode):
Inherit from both (current-local-map) and (current-global-map). This
provides for missing global bindings when inheriting from
just (current-local-map), eg Esc-<.
---
 lisp/allout-widgets.el | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el
index fbdddca7d7..2aa01737de 100644
--- a/lisp/allout-widgets.el
+++ b/lisp/allout-widgets.el
@@ -415,15 +415,17 @@ allout-escaped-prefix-regexp
 ;;;_   , Widget element formatting
 ;;;_    = allout-item-icon-keymap
 (defvar allout-item-icon-keymap
-  (let ((km (make-sparse-keymap)))
+  (let ((km (make-sparse-keymap))
+        (as-parent (if (current-local-map)
+                       (make-composed-keymap (current-local-map)
+                                             (current-global-map))
+                     (current-global-map))))
+    ;; The keymap parent is reset on the each local var when mode starts.
+    (set-keymap-parent km as-parent)
     (dolist (digit '("0" "1" "2" "3"
                      "4" "5" "6" "7" "8" "9"))
       (define-key km digit 'digit-argument))
     (define-key km "-" 'negative-argument)
-;;    (define-key km [(return)] 'allout-tree-expand-command)
-;;    (define-key km [(meta return)] 'allout-toggle-torso-command)
-;;    (define-key km [(down-mouse-1)] 'allout-item-button-click)
-;;    (define-key km [(down-mouse-2)] 'allout-toggle-torso-event-command)
     ;; Override underlying mouse-1 and mouse-2 bindings in icon territory:
     (define-key km [(mouse-1)] (lambda () (interactive) nil))
     (define-key km [(mouse-2)] (lambda () (interactive) nil))
@@ -433,17 +435,16 @@ allout-item-icon-keymap
 
     km)
   "General tree-node key bindings.")
+(make-variable-buffer-local 'allout-item-icon-keymap)
 ;;;_    = allout-item-body-keymap
 (defvar allout-item-body-keymap
   (let ((km (make-sparse-keymap))
-        (local-map (current-local-map)))
-;;    (define-key km [(control return)] 'allout-tree-expand-command)
-;;    (define-key km [(meta return)] 'allout-toggle-torso-command)
-    ;; XXX We need to reset this per buffer's mode; we do so in
-    ;; allout-widgets-mode.
-    (if local-map
-        (set-keymap-parent km local-map))
-
+        (as-parent (if (current-local-map)
+                       (make-composed-keymap (current-local-map)
+                                             (current-global-map))
+                     (current-global-map))))
+    ;; The keymap parent is reset on the each local var when mode starts.
+    (set-keymap-parent km as-parent)
     km)
   "General key bindings for the text content of outline items.")
 (make-variable-buffer-local 'allout-item-body-keymap)
@@ -456,6 +457,7 @@ allout-cue-span-keymap
     (set-keymap-parent km allout-item-icon-keymap)
     km)
   "Keymap used in the item cue area - the space between the icon and headline.")
+(make-variable-buffer-local 'allout-cue-span-keymap)
 ;;;_    = allout-escapes-category
 (defvar allout-escapes-category nil
   "Symbol for category of text property used to hide escapes of prefix-like
@@ -566,8 +568,13 @@ allout-widgets-mode
         (add-to-invisibility-spec '(allout-torso . t))
         (add-to-invisibility-spec 'allout-escapes)
 
-        (if (current-local-map)
-            (set-keymap-parent allout-item-body-keymap (current-local-map)))
+        (let ((as-parent (if (current-local-map)
+                             (make-composed-keymap (current-local-map)
+                                                   (current-global-map))
+                           (current-global-map))))
+          (set-keymap-parent allout-item-body-keymap as-parent)
+          ;; allout-cue-span-keymap uses allout-item-icon-keymap as parent.
+          (set-keymap-parent allout-item-icon-keymap as-parent))
 
         (add-hook 'allout-exposure-change-functions
                   'allout-widgets-exposure-change-recorder nil 'local)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#42246: Acknowledgement (28.0.50; lisp/allout-widgets.el: Resolve missing button-region keymap bindings)
       [not found] ` <handler.42246.B.159413341028906.ack@debbugs.gnu.org>
@ 2020-07-20 19:17   ` Ken Manheimer
  0 siblings, 0 replies; 2+ messages in thread
From: Ken Manheimer @ 2020-07-20 19:17 UTC (permalink / raw)
  To: 42246-done

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

Fix committed in dd7c191291c8eb1afeac0f1512745491c5c7a317 and pushed to
main repository main and (mistakenly; won't do this again) emacs-27 branches

On Tue, Jul 7, 2020 at 10:51 AM GNU bug Tracking System <
help-debbugs@gnu.org> wrote:

> Thank you for filing a new bug report with debbugs.gnu.org.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
>  bug-gnu-emacs@gnu.org
>
> If you wish to submit further information on this problem, please
> send it to 42246@debbugs.gnu.org.
>
> Please do not send mail to help-debbugs@gnu.org unless you wish
> to report a problem with the Bug-tracking system.
>
> --
> 42246: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=42246
> GNU Bug Tracking System
> Contact help-debbugs@gnu.org with problems
>

[-- Attachment #2: Type: text/html, Size: 1751 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-20 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 14:49 bug#42246: 28.0.50; lisp/allout-widgets.el: Resolve missing button-region keymap bindings Ken Manheimer
     [not found] ` <handler.42246.B.159413341028906.ack@debbugs.gnu.org>
2020-07-20 19:17   ` bug#42246: Acknowledgement (28.0.50; lisp/allout-widgets.el: Resolve missing button-region keymap bindings) Ken Manheimer

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).