all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#66947: 30.0.50; Implement missing functions for custom-icon widget
@ 2023-11-05 10:20 Mauro Aranda
  2023-11-05 10:26 ` Mauro Aranda
  2023-11-05 14:24 ` Stefan Kangas
  0 siblings, 2 replies; 7+ messages in thread
From: Mauro Aranda @ 2023-11-05 10:20 UTC (permalink / raw)
  To: 66947

There are some missing functions for the custom-icon widget to actually
work when customizing icons:
:custom-mark-to-save
:custom-reset-current
:custom-reset-saved
:custom-state-set-and-redraw
:custom-reset-standard
:custom-mark-to-reset-standard

I'll send a patch.


In GNU Emacs 30.0.50 (build 60, x86_64-pc-linux-gnu, GTK+ Version
  3.24.33, cairo version 1.16.0) of 2023-11-04 built on tbb-desktop
Repository revision: 5ab5dfd64c85cee8c8d37e988519045e11f46a98
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12201001
System Description: Ubuntu 22.04.3 LTS

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

Important settings:
   value of $LC_MONETARY: es_AR.UTF-8
   value of $LC_NUMERIC: es_AR.UTF-8
   value of $LC_TIME: es_AR.UTF-8
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
   bug-reference-prog-mode: t
   auto-insert-mode: t
   global-hl-line-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   minibuffer-regexp-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:
/home/tbb/.emacs.d/elpa/transient-20230919.2146/transient hides 
/home/tbb/code/emacs/emacs/lisp/transient

Features:
(shadow sort mail-extr emacsbug log-edit add-log disp-table cus-start
bug-reference smerge-mode diff whitespace vc-hg vc-bzr vc-src vc-sccs
vc-svn vc-cvs vc-rcs log-view pcvs-util misearch multi-isearch
cursor-sensor timezone network-stream url-http url-gw nsm url-cache
url-auth hiddenquote-clarin hiddenquote eieio-base vc-git diff-mode
easy-mmode dired-aux oc-basic cl-extra help-mode org-habit ol-eww eww
url-queue thingatpt mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus
nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig
gnus-sum shr pixel-fill kinsoku url-file svg dom gnus-group gnus-undo
gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time gnus-spec gnus-int gnus-range message sendmail yank-media
puny rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win
ol-docview doc-view filenotify jka-compr image-mode exif dired
dired-loaddefs ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi
vc-theme time-theme hiddenquote-theme epkg-theme emms-theme
egerrit-theme autoinsert gnus nnheader gnus-util text-property-search
mail-utils range mm-util mail-prsvr org-journal-theme org-journal
org-crypt epa derived epg rfc6068 epg-config cal-iso ox-odt rng-loc
rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar org-agenda ox-html table
ox-ascii ox-publish ox org-element org-persist xdg org-id org-refile
avl-tree generator org-clock org ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-macro org-src ob-comint org-pcomplete pcomplete org-list
org-footnote org-faces org-entities noutline outline ob-emacs-lisp
ob-core ob-eval org-cycle org-table ol rx org-fold org-fold-core
org-keys oc org-loaddefs find-func cal-menu calendar cal-loaddefs
org-version org-compat org-macs format-spec newsticker newst-treeview
tree-widget newst-plainview newst-reader newst-ticker newst-backend
iso8601 time-date octave smie comint ansi-osc ansi-color ring vc
vc-dispatcher cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs dbus xml social-theme org-theme
holidays-theme mail-theme dired-theme faces-theme modus-vivendi-theme
modus-themes questionable-theme hl-line intermediate-user-theme
basic-theme clean-gui-theme cus-edit pp cus-load icons wid-edit
finder-inf debbugs-autoloads magit-autoloads pcase git-commit-autoloads
magit-section-autoloads dash-autoloads org-journal-autoloads
poke-line-autoloads transient-autoloads with-editor-autoloads info
compat-autoloads package-theme 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 cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib server
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen 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 lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process emacs)

Memory information:
((conses 16 620447 113666) (symbols 48 38880 2)
  (strings 32 195288 7328) (string-bytes 1 5409657) (vectors 16 73200)
  (vector-slots 8 1538727 103227) (floats 8 389 370)
  (intervals 56 5017 341) (buffers 992 25))






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

* bug#66947: 30.0.50; Implement missing functions for custom-icon widget
  2023-11-05 10:20 bug#66947: 30.0.50; Implement missing functions for custom-icon widget Mauro Aranda
@ 2023-11-05 10:26 ` Mauro Aranda
  2024-01-10 17:55   ` Stefan Kangas
  2023-11-05 14:24 ` Stefan Kangas
  1 sibling, 1 reply; 7+ messages in thread
From: Mauro Aranda @ 2023-11-05 10:26 UTC (permalink / raw)
  To: 66947

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

tags 66947 patch
quit


Patch attached.


[-- Attachment #2: 0001-Implement-missing-functions-for-custom-icon-widget.patch --]
[-- Type: text/x-patch, Size: 3904 bytes --]

From ffb296a5c45f5173d7edff4dbf6b29a38a92dac2 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Sun, 5 Nov 2023 07:23:55 -0300
Subject: [PATCH] Implement missing functions for custom-icon widget

* lisp/cus-edit.el (custom-icon-reset-saved, custom-icon-mark-to-save)
(custom-icon-state-set-and-redraw, custom-icon-reset-standard)
(custom-icon-mark-to-reset-standard): New functions.
(custom-icon, custom-icon-extended-menu): Register and add them to the
menu.  (Bug#66947)
---
 lisp/cus-edit.el | 58 +++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 55 insertions(+), 3 deletions(-)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 6442ffeac24..4b8de6b9468 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -5389,9 +5389,49 @@ 'custom-icon
   :hidden-states '(standard)
   :action #'custom-icon-action
   :custom-set #'custom-icon-set
-  :custom-reset-current #'custom-redraw)
-  ;; Not implemented yet.
-  ;; :custom-reset-saved 'custom-icon-reset-saved)
+  :custom-mark-to-save #'custom-icon-mark-to-save
+  :custom-reset-current #'custom-redraw
+  :custom-reset-saved #'custom-icon-reset-saved
+  :custom-state-set-and-redraw #'custom-icon-state-set-and-redraw
+  :custom-reset-standard #'custom-icon-reset-standard
+  :custom-mark-to-reset-standard #'custom-icon-mark-to-reset-standard)
+
+(defun custom-icon-mark-to-save (widget)
+  "Mark user customization for icon edited by WIDGET to be saved later."
+  (let* ((icon (widget-value widget))
+         (value (custom--icons-widget-value
+                 (car (widget-get widget :children)))))
+    (custom-push-theme 'theme-icon icon 'user 'set value)))
+
+(defun custom-icon-reset-saved (widget)
+  "Restore icon customized by WIDGET to the icon's default attributes.
+
+If there's a theme value for the icon, resets to that.  Otherwise, resets to
+its standard value."
+  (let* ((icon (widget-value widget)))
+    (custom-push-theme 'theme-icon icon 'user 'reset)
+    (custom-icon-state-set widget)
+    (custom-redraw widget)))
+
+(defun custom-icon-state-set-and-redraw (widget)
+  "Set state of icon widget WIDGET and redraw it with up-to-date settings."
+  (custom-icon-state-set widget)
+  (custom-redraw-magic widget))
+
+(defun custom-icon-reset-standard (widget)
+  "Reset icon edited by WIDGET to its standard value."
+  (let* ((icon (widget-value widget))
+         (themes (get icon 'theme-icon)))
+    (dolist (theme themes)
+      (custom-push-theme 'theme-icon icon (car theme) 'reset))
+    (custom-save-all))
+  (widget-put widget :custom-state 'unknown)
+  (custom-redraw widget))
+
+(defun custom-icon-mark-to-reset-standard (widget)
+  "Reset icon edited by WIDGET to its standard value."
+  ;; Don't mark for now, there aren't that many icons.
+  (custom-icon-reset-standard widget))
 
 (defvar custom-icon-extended-menu
   (let ((map (make-sparse-keymap)))
@@ -5410,6 +5450,18 @@ custom-icon-extended-menu
                   :enable (memq
                            (widget-get custom-actioned-widget :custom-state)
                            '(modified changed))))
+    (define-key-after map [custom-icon-reset-saved]
+      '(menu-item "Revert This Session's Customization"
+                  custom-icon-reset-saved
+                  :enable (memq
+                           (widget-get custom-actioned-widget :custom-state)
+                           '(modified set changed rogue))))
+    (when (or custom-file init-file-user)
+      (define-key-after map [custom-icon-reset-standard]
+        '(menu-item "Erase Customization" custom-icon-reset-standard
+                    :enable (memq
+                             (widget-get custom-actioned-widget :custom-state)
+                             '(modified set changed saved rogue)))))
     map)
   "A menu for `custom-icon' widgets.
 Used in `custom-icon-action' to show a menu to the user.")
-- 
2.34.1


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

* bug#66947: 30.0.50; Implement missing functions for custom-icon widget
  2023-11-05 10:20 bug#66947: 30.0.50; Implement missing functions for custom-icon widget Mauro Aranda
  2023-11-05 10:26 ` Mauro Aranda
@ 2023-11-05 14:24 ` Stefan Kangas
  2023-11-05 22:38   ` Mauro Aranda
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2023-11-05 14:24 UTC (permalink / raw)
  To: Mauro Aranda, 66947

Mauro Aranda <maurooaranda@gmail.com> writes:

> There are some missing functions for the custom-icon widget to actually
> work when customizing icons:
> :custom-mark-to-save
> :custom-reset-current
> :custom-reset-saved
> :custom-state-set-and-redraw
> :custom-reset-standard
> :custom-mark-to-reset-standard
>
> I'll send a patch.

Thanks.  Is this patch intended for emacs-29, like the last one?





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

* bug#66947: 30.0.50; Implement missing functions for custom-icon widget
  2023-11-05 14:24 ` Stefan Kangas
@ 2023-11-05 22:38   ` Mauro Aranda
  0 siblings, 0 replies; 7+ messages in thread
From: Mauro Aranda @ 2023-11-05 22:38 UTC (permalink / raw)
  To: Stefan Kangas, 66947

On 5/11/23 11:24, Stefan Kangas wrote:
 > Mauro Aranda <maurooaranda@gmail.com> writes:
 >
 >> There are some missing functions for the custom-icon widget to actually
 >> work when customizing icons:
 >> :custom-mark-to-save
 >> :custom-reset-current
 >> :custom-reset-saved
 >> :custom-state-set-and-redraw
 >> :custom-reset-standard
 >> :custom-mark-to-reset-standard
 >>
 >> I'll send a patch.
 >
 > Thanks.  Is this patch intended for emacs-29, like the last one?

Ideally, yes.  It doesn't solve serious bugs, but it completes, I think,
the Customizing icons functionality.

It does solve some bugs, like:
emacs
(require 'outline)
M-x customize-group RET outlines
Edit an option and an icon.
Action the State button and select Save for Future Sessions
That errors with:
widget-apply: Symbol’s function definition is void: nil

That's because of a :custom-mark-to-save function missing for the
custom-icon widget.






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

* bug#66947: 30.0.50; Implement missing functions for custom-icon widget
  2023-11-05 10:26 ` Mauro Aranda
@ 2024-01-10 17:55   ` Stefan Kangas
  2024-01-10 18:20     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2024-01-10 17:55 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 66947, eliz

Mauro Aranda <maurooaranda@gmail.com> writes:

> tags 66947 patch
> quit
>
>
> Patch attached.

Eli, Mauro has submitted this patch, and proposed it for emacs-29.

Could you please take a look and see what you think?  I'm not myself
familiar enough with cus-edit.el to feel comfortable pushing this to the
release branch.  See also his reasoning in the rest of this thread.

Thanks in advance.





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

* bug#66947: 30.0.50; Implement missing functions for custom-icon widget
  2024-01-10 17:55   ` Stefan Kangas
@ 2024-01-10 18:20     ` Eli Zaretskii
  2024-01-10 18:27       ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-01-10 18:20 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 66947, maurooaranda

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Wed, 10 Jan 2024 09:55:59 -0800
> Cc: 66947@debbugs.gnu.org, eliz@gnu.org
> 
> Mauro Aranda <maurooaranda@gmail.com> writes:
> 
> > tags 66947 patch
> > quit
> >
> >
> > Patch attached.
> 
> Eli, Mauro has submitted this patch, and proposed it for emacs-29.
> 
> Could you please take a look and see what you think?  I'm not myself
> familiar enough with cus-edit.el to feel comfortable pushing this to the
> release branch.  See also his reasoning in the rest of this thread.

It's a relatively large changeset, but since this is basically broken
in Emacs 29, I don't think we can do worse.  So it's okay to install
this on the emacs-29 branch, thanks.





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

* bug#66947: 30.0.50; Implement missing functions for custom-icon widget
  2024-01-10 18:20     ` Eli Zaretskii
@ 2024-01-10 18:27       ` Stefan Kangas
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Kangas @ 2024-01-10 18:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 66947-done, maurooaranda

Eli Zaretskii <eliz@gnu.org> writes:

> It's a relatively large changeset, but since this is basically broken
> in Emacs 29, I don't think we can do worse.  So it's okay to install
> this on the emacs-29 branch, thanks.

Thanks, pushed to emacs-29 and closing the bug.





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

end of thread, other threads:[~2024-01-10 18:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-05 10:20 bug#66947: 30.0.50; Implement missing functions for custom-icon widget Mauro Aranda
2023-11-05 10:26 ` Mauro Aranda
2024-01-10 17:55   ` Stefan Kangas
2024-01-10 18:20     ` Eli Zaretskii
2024-01-10 18:27       ` Stefan Kangas
2023-11-05 14:24 ` Stefan Kangas
2023-11-05 22:38   ` Mauro Aranda

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.