unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 68334@debbugs.gnu.org
Subject: bug#68334: 29.1; tool-bar-make-keymap-1 does not work on terminals
Date: Mon, 08 Jan 2024 13:39:25 -0800	[thread overview]
Message-ID: <e14c1ba418b262e37591f27b1f820bf7@finder.org> (raw)

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

I'd like tool-bar-make-keymap-1 to return a sensible keymap on 
terminals.  This is only a small change from current code, patch 
attached.

Context:  I am writing a package that displays toolbars attached to an 
Emacs window instead of attached to the frame.  You can see the package 
at <https://github.com/chaosemer/window-tool-bar>.

There's no intrinsic reason toolbars can't be useful in terminals and 
adding additional (usually ignored) keymap entries seems very safe.

   -- MJF

In GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.37,
  cairo version 1.16.0) of 2023-09-11, modified by Debian built on melete
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
  'configure --build x86_64-linux-gnu --prefix=/usr
  --sharedstatedir=/var/lib --libexecdir=/usr/libexec
  --localstatedir=/var/lib --infodir=/usr/share/info
  --mandir=/usr/share/man --with-libsystemd --with-pop=yes
  
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.1/site-lisp:/usr/share/emacs/site-lisp
  --with-sound=alsa --without-gconf --with-mailutils
  --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
  --sharedstatedir=/var/lib --libexecdir=/usr/libexec
  --localstatedir=/var/lib --infodir=/usr/share/info
  --mandir=/usr/share/man --with-libsystemd --with-pop=yes
  
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.1/site-lisp:/usr/share/emacs/site-lisp
  --with-sound=alsa --without-gconf --with-mailutils
  --with-native-compilation --with-pgtk 'CFLAGS=-g -O2
  -ffile-prefix-map=/build/emacs-N816CI/emacs-29.1+1=. 
-fstack-protector-strong
  -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
  -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

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

Major mode: ELisp/l

Minor modes in effect:
   global-window-tool-bar-mode: t
   window-tool-bar-mode: t
   pixel-scroll-precision-mode: t
   recentf-mode: t
   global-subword-mode: t
   subword-mode: t
   global-form-feed-st-mode: t
   form-feed-st-mode: t
   icomplete-mode: t
   fido-mode: t
   electric-pair-mode: t
   delete-selection-mode: t
   cua-mode: t
   bar-cursor-mode: t
   url-handler-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   context-menu-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   window-divider-mode: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr smerge-mode diff pulse jka-compr help-fns
radix-tree find-func xref project misearch multi-isearch mm-archive
gnutls network-stream url-cache url-http url-auth url-gw nsm emacsbug
ediff-vers ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help
ediff-init ediff-util vc-hg vc-svn vc-dir ewoc vc checkdoc lisp-mnt
vc-git diff-mode vc-dispatcher cursor-sensor finder-inf comp comp-cstr
cl-extra help-mode markdown-mode rx color thingatpt noutline outline
cus-edit pp cus-start cus-load window-tool-bar easy-mmode tab-line
pixel-scroll recentf tree-widget wid-edit cap-words superword subword
form-feed-st icomplete elec-pair delsel cua-base bar-cursor ls-lisp
advice log-edit message sendmail yank-media puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util
time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader pcvs-util add-log warnings icons compile text-property-search
comint ansi-osc ansi-color ring init-dir bar-cursor-autoloads
benchmark-init-autoloads dired-icon-autoloads form-feed-st-autoloads
init-dir-autoloads markdown-mode-autoloads modus-themes-autoloads
package-lint-autoloads compat-autoloads info slime-autoloads
window-tool-bar-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core password-cache json map byte-opt bytecomp byte-compile
url-vars modus-vivendi-theme modus-themes cl-macs pcase subr-x
cl-loaddefs cl-lib gv rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 604030 131636)
  (symbols 48 25469 2)
  (strings 32 156826 21765)
  (string-bytes 1 7239778)
  (vectors 16 41746)
  (vector-slots 8 769733 48672)
  (floats 8 276 1190)
  (intervals 56 4786 466)
  (buffers 984 33))

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-tool-bar.el-tool-bar-make-keymap-1-Populate-on-.patch --]
[-- Type: text/x-diff; name=0001-lisp-tool-bar.el-tool-bar-make-keymap-1-Populate-on-.patch, Size: 1333 bytes --]

From b01cdf53a45a60332de48285d510790907152ea8 Mon Sep 17 00:00:00 2001
From: Jared Finder <jared@finder.org>
Date: Mon, 8 Jan 2024 13:20:25 -0800
Subject: [PATCH] * lisp/tool-bar.el (tool-bar-make-keymap-1): Populate on
 terminals

---
 lisp/tool-bar.el | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index 4ca81fb01e0..36a80522c83 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -180,15 +180,14 @@ tool-bar-make-keymap-1
 			 (consp image-exp)
 			 (not (eq (car image-exp) 'image))
 			 (fboundp (car image-exp)))
-		(if (not (display-images-p))
-		    (setq bind nil)
-		  (let ((image (eval image-exp)))
-		    (unless (and image (image-mask-p image))
-		      (setq image (append image '(:mask heuristic))))
-		    (setq bind (copy-sequence bind)
-			  plist (nthcdr (if (consp (nth 4 bind)) 5 4)
-					bind))
-		    (plist-put plist :image image))))
+		(let ((image (and (display-images-p)
+                                  (eval image-exp))))
+		  (unless (and image (image-mask-p image))
+		    (setq image (append image '(:mask heuristic))))
+		  (setq bind (copy-sequence bind)
+			plist (nthcdr (if (consp (nth 4 bind)) 5 4)
+				      bind))
+		  (plist-put plist :image image)))
 	      bind))
 	  (or map tool-bar-map)))
 
-- 
2.39.2


             reply	other threads:[~2024-01-08 21:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-08 21:39 Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-01-08 23:04 ` bug#68334: window-tool-bar (bug#68334) Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09 13:06   ` Eli Zaretskii
2024-01-09  4:57 ` bug#68334: 29.1; tool-bar-make-keymap-1 does not work on terminals Stefan Kangas
2024-01-09  7:58   ` Juri Linkov
2024-01-09 13:13   ` Eli Zaretskii
2024-01-09 18:39     ` Stefan Kangas
2024-01-09 18:57       ` Eli Zaretskii
2024-01-09 19:08         ` Stefan Kangas
2024-01-09 19:28           ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09 19:56             ` Eli Zaretskii
2024-01-10  7:24             ` Juri Linkov
2024-01-09 12:40 ` Eli Zaretskii
2024-01-10 22:59   ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-11 10:51     ` 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=e14c1ba418b262e37591f27b1f820bf7@finder.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=68334@debbugs.gnu.org \
    --cc=jared@finder.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).