From 29af214a75a3d77e603c377e1247a3ca85c130c5 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Wed, 10 Jan 2024 16:24:53 +0100 Subject: [PATCH 1/8] Fix fontification of cgroup2 in fstab (bug#68367) * lisp/generic-x.el (etc-fstab-generic-mode): Add cgroup2. --- lisp/generic-x.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/generic-x.el b/lisp/generic-x.el index b4ae0225943..373bfad92dd 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -1491,6 +1491,7 @@ like an INI file. You can add this hook to `find-file-hook'." "cd9660" "cfs" "cgroup" + "cgroup2" "cifs" "coda" "coherent" From 1bbb610821eb143e0828d2541a3f856d29d67b6f Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Sun, 5 Nov 2023 07:23:55 -0300 Subject: [PATCH 2/8] 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 62564f6dfcb..12eea0fa0e5 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -5348,9 +5348,49 @@ The following properties have special meanings for this widget: :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))) @@ -5369,6 +5409,18 @@ The following properties have special meanings for this widget: :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.") From 4fadbfe300a338f8e6e167331bc7ca0bbca26dbc Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Fri, 22 Sep 2023 20:45:00 -0300 Subject: [PATCH 3/8] Add examples to the Widget manual * doc/misc/widget.texi (Widget Gallery, Defining New Widgets): Add examples. (Bug#66229) --- doc/misc/widget.texi | 206 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) diff --git a/doc/misc/widget.texi b/doc/misc/widget.texi index 93b7606b01e..82d89449dd2 100644 --- a/doc/misc/widget.texi +++ b/doc/misc/widget.texi @@ -1384,6 +1384,15 @@ a specific way. If present, @var{value} is used to initialize the @code{:value} property. When created, it inserts the value as a string in the buffer. +@noindent +Example: + +@lisp +(widget-create 'item :tag "Today is" :format "%t: %v\n" + (format-time-string "%d-%m-%Y")) +@end lisp + + By default, it has the following properties: @table @code @@ -1428,6 +1437,20 @@ The @var{value}, if present, is used to initialize the @code{:value} property. The value should be a string, which will be inserted in the buffer. +@noindent +Example: + +@lisp +(widget-create 'link + :button-prefix "" + :button-suffix "" + :tag "Mail yourself" + :action #'(lambda (widget &optional _event) + (compose-mail-other-window (widget-value widget))) + user-mail-address) +@end lisp + + By default, it has the following properties: @table @code @@ -1471,6 +1494,29 @@ A widget to represent a link to a web page. Its super is the It overrides the @code{:action} property to open up the @var{url} specified. +@noindent +Example: + +@lisp +(widget-create 'url-link + :button-prefix "" + :button-suffix "" + ;; Return appropriate face. + :button-face-get (lambda (widget) + (if (widget-get widget :visited) + 'link-visited + 'link)) + :format "%[%t%]" + :tag "Browse this manual" + :action (lambda (widget &optional _event) + (widget-put widget :visited t) + ;; Takes care of redrawing the widget. + (widget-value-set widget (widget-value widget)) + ;; And then call the original function. + (widget-url-link-action widget)) + "https://www.gnu.org/software/emacs/manual/html_mono/widget.html") +@end lisp + @node info-link @subsection The @code{info-link} Widget @findex info-link@r{ widget} @@ -1487,6 +1533,17 @@ A widget to represent a link to an info file. Its super is the It overrides the @code{:action} property, to a function to start the built-in Info reader on @var{address}, when invoked. +@noindent +Example: + +@lisp +(widget-create 'info-link + :button-prefix "" + :button-suffix "" + :tag "Browse this manual" + "(widget) info-link"))) +@end lisp + @node function-link @subsection The @code{function-link} Widget @findex function-link@r{ widget} @@ -1502,6 +1559,17 @@ A widget to represent a link to an Emacs function. Its super is the It overrides the @code{:action} property, to a function to describe @var{function}. +@noindent +Example: + +@lisp +(widget-create 'function-link + :button-prefix "" + :button-suffix "" + :tag "Describe the function that gets called" + #'widget-function-link-action) +@end lisp + @node variable-link @subsection The @code{variable-link} Widget @findex variable-link@r{ widget} @@ -1517,6 +1585,17 @@ A widget to represent a link to an Emacs variable. Its super is the It overrides the @code{:action} property, to a function to describe @var{var}. +@noindent +Example: + +@lisp +(widget-create 'variable-link + :button-prefix "" + :button-suffix "" + :tag "What setting controlls button-prefix?" + 'widget-button-prefix) +@end lisp + @node face-link @subsection The @code{face-link} Widget @findex face-link@r{ widget} @@ -1532,6 +1611,17 @@ A widget to represent a link to an Emacs face. Its super is the It overrides the @code{:action} property, to a function to describe @var{face}. +@noindent +Example: + +@lisp +(widget-create 'face-link + :button-prefix "" + :button-suffix "" + :tag "Which face is this one?" + 'widget-button) +@end lisp + @node file-link @subsection The @code{file-link} Widget @findex file-link@r{ widget} @@ -1547,6 +1637,19 @@ A widget to represent a link to a file. Its super is the It overrides the @code{:action} property, to a function to find the file @var{file}. +@noindent +Example: + +@lisp +(let ((elisp-files (directory-files user-emacs-directory t ".el$"))) + (dolist (file elisp-files) + (widget-create 'file-link + :button-prefix "" + :button-suffix "" + file) + (widget-insert "\n"))) +@end lisp + @node emacs-library-link @subsection The @code{emacs-library-link} Widget @findex emacs-library-link@r{ widget} @@ -1562,6 +1665,17 @@ A widget to represent a link to an Emacs Lisp file. Its super is the It overrides the @code{:action} property, to a function to find the file @var{file}. +@noindent +Example: + +@lisp +(widget-create 'emacs-library-link + :button-prefix "" + :button-suffix "" + :tag "Show yourself, Widget Library!" + "wid-edit.el") +@end lisp + @node emacs-commentary-link @subsection The @code{emacs-commentary-link} Widget @findex emacs-commentary-link@r{ widget} @@ -1577,6 +1691,17 @@ file. Its super is the @code{link} widget. It overrides the @code{:action} property, to a function to find the file @var{file} and put point in the Comment section. +@noindent +Example: + +@lisp +(widget-create 'emacs-commentary-link + :button-prefix "" + :button-suffix "" + :tag "Check our good friend Customize" + "cus-edit.el") +@end lisp + @node push-button @subsection The @code{push-button} Widget @findex push-button@r{ widget} @@ -2009,6 +2134,29 @@ A widget that can toggle between two states. Its super is the The widget has two possible states, @samp{on} and @samp{off}, which correspond to a @code{t} or @code{nil} value, respectively. +@noindent +Example: + +@lisp +(widget-insert "Press the button to activate/deactivate the field: ") +(widget-create 'toggle + :notify (lambda (widget &rest _ignored) + (widget-apply widget-example-field + (if (widget-value widget) + :activate + :deactivate)))) +(widget-insert "\n") +(setq widget-example-field + (widget-create 'editable-field + :deactivate (lambda (widget) + (widget-specify-inactive + widget + (widget-field-start widget) + (widget-get widget :to))))) +(widget-apply widget-example-field :deactivate))) +@end lisp + + It either overrides or adds the following properties: @table @code @@ -2148,6 +2296,21 @@ The @var{type} arguments represent each checklist item. The widget's value will be a list containing the values of all checked @var{type} arguments. +@noindent +Example: + +@lisp +(widget-create 'checklist + :notify (lambda (widget child &optional _event) + (funcall + (widget-value (widget-get-sibling child)) + 'toggle)) + :value (list 'tool-bar-mode 'menu-bar-mode) + '(item :tag "Tool-bar" tool-bar-mode) + '(item :tag "Menu-bar" menu-bar-mode)))) +@end lisp + + It either overrides or adds the following properties: @table @code @@ -2899,6 +3062,49 @@ The predefined functions @code{widget-types-convert-widget} and @code{widget-value-convert-widget} can be used here. @end table +@noindent +Example: + +@lisp +(defvar widget-ranged-integer-map + (let ((map (copy-keymap widget-keymap))) + (define-key map [up] #'widget-ranged-integer-increase) + (define-key map [down] #'widget-ranged-integer-decrease) + map)) + +(define-widget 'ranged-integer 'integer + "A ranged integer widget." + :min-value most-negative-fixnum + :max-value most-positive-fixnum + :keymap widget-ranged-integer-map) + +(defun widget-ranged-integer-change (widget how) + "Change the value of the ranged-integer WIDGET, according to HOW." + (let* ((value (widget-value widget)) + (newval (cond + ((eq how 'up) + (if (< (1+ value) (widget-get widget :max-value)) + (1+ value) + (widget-get widget :max-value))) + ((eq how 'down) + (if (> (1- value) (widget-get widget :min-value)) + (1- value) + (widget-get widget :min-value))) + (t (error "HOW has a bad value")))) + (inhibit-read-only t)) + (widget-value-set widget newval))) + +(defun widget-ranged-integer-increase (widget) + "Increase the value of the ranged-integer WIDGET." + (interactive (list (widget-at))) + (widget-ranged-integer-change widget 'up)) + +(defun widget-ranged-integer-decrease (widget) + "Decrease the value of the ranged-integer WIDGET." + (interactive (list (widget-at))) + (widget-ranged-integer-change widget 'down)) +@end lisp + @node Inspecting Widgets @chapter Inspecting Widgets @cindex widget browser From 824cf54951c076e2b6a0e3a8e6fb1342cf58b8b6 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 11 Jan 2024 00:25:38 +0100 Subject: [PATCH 4/8] ; * etc/TODO: Add item to make play-sound non-blocking. --- etc/TODO | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/TODO b/etc/TODO index ee069e3930b..a672b6b5b72 100644 --- a/etc/TODO +++ b/etc/TODO @@ -156,6 +156,8 @@ from. ** Make back_comment use syntax-ppss or equivalent +* Make play-sound asynchronous and non-blocking + ** Consider improving src/sysdep.c's search for a fqdn https://lists.gnu.org/r/emacs-devel/2007-04/msg00782.html From 63411709a8dbad8b17c7f1e0cfed99f4aeb174a1 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 11 Jan 2024 00:32:15 +0100 Subject: [PATCH 5/8] ; Fix typos --- doc/misc/widget.texi | 2 +- etc/TODO | 2 +- lisp/progmodes/python.el | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/misc/widget.texi b/doc/misc/widget.texi index 82d89449dd2..d4f2ba1e76c 100644 --- a/doc/misc/widget.texi +++ b/doc/misc/widget.texi @@ -1592,7 +1592,7 @@ Example: (widget-create 'variable-link :button-prefix "" :button-suffix "" - :tag "What setting controlls button-prefix?" + :tag "What setting controls button-prefix?" 'widget-button-prefix) @end lisp diff --git a/etc/TODO b/etc/TODO index a672b6b5b72..9b3796515d2 100644 --- a/etc/TODO +++ b/etc/TODO @@ -156,7 +156,7 @@ from. ** Make back_comment use syntax-ppss or equivalent -* Make play-sound asynchronous and non-blocking +** Make play-sound asynchronous and non-blocking ** Consider improving src/sysdep.c's search for a fqdn https://lists.gnu.org/r/emacs-devel/2007-04/msg00782.html diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3247291b6ee..9849fde8588 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1107,7 +1107,7 @@ fontified." (defun python--treesit-fontify-union-types (node override start end &optional type-regex &rest _) "Fontify nested union types in the type hints. -For examlpe, Lvl1 | Lvl2[Lvl3[Lvl4[Lvl5 | None]], Lvl2]. This +For example, Lvl1 | Lvl2[Lvl3[Lvl4[Lvl5 | None]], Lvl2]. This structure is represented via nesting binary_operator and subscript nodes. This function iterates over all levels and highlight identifier nodes. If TYPE-REGEX is not nil fontify type @@ -1265,7 +1265,7 @@ fontified." (subscript (identifier) @font-lock-type-face) (subscript (attribute attribute: (identifier) @font-lock-type-face))])) - ;; Patern matching: case [str(), pack0.Type0()]. Take only the + ;; Pattern matching: case [str(), pack0.Type0()]. Take only the ;; last identifier. (class_pattern (dotted_name (identifier) @font-lock-type-face :anchor)) From 70a09325d658b4618856adac82abc5f66a11a22f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 11 Jan 2024 08:22:14 +0200 Subject: [PATCH 6/8] ; Fix last change in widget.texi * doc/misc/widget.texi (url-link, toggle, Defining New Widgets): Divide @example's into @group's. (Bug#66229) --- doc/misc/widget.texi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/misc/widget.texi b/doc/misc/widget.texi index d4f2ba1e76c..cfb9d2211cf 100644 --- a/doc/misc/widget.texi +++ b/doc/misc/widget.texi @@ -1498,6 +1498,7 @@ specified. Example: @lisp +@group (widget-create 'url-link :button-prefix "" :button-suffix "" @@ -1515,6 +1516,7 @@ Example: ;; And then call the original function. (widget-url-link-action widget)) "https://www.gnu.org/software/emacs/manual/html_mono/widget.html") +@end group @end lisp @node info-link @@ -2138,6 +2140,7 @@ correspond to a @code{t} or @code{nil} value, respectively. Example: @lisp +@group (widget-insert "Press the button to activate/deactivate the field: ") (widget-create 'toggle :notify (lambda (widget &rest _ignored) @@ -2146,6 +2149,8 @@ Example: :activate :deactivate)))) (widget-insert "\n") +@end group +@group (setq widget-example-field (widget-create 'editable-field :deactivate (lambda (widget) @@ -2154,6 +2159,7 @@ Example: (widget-field-start widget) (widget-get widget :to))))) (widget-apply widget-example-field :deactivate))) +@end group @end lisp @@ -3066,18 +3072,23 @@ The predefined functions @code{widget-types-convert-widget} and Example: @lisp +@group (defvar widget-ranged-integer-map (let ((map (copy-keymap widget-keymap))) (define-key map [up] #'widget-ranged-integer-increase) (define-key map [down] #'widget-ranged-integer-decrease) map)) +@end group +@group (define-widget 'ranged-integer 'integer "A ranged integer widget." :min-value most-negative-fixnum :max-value most-positive-fixnum :keymap widget-ranged-integer-map) +@end group +@group (defun widget-ranged-integer-change (widget how) "Change the value of the ranged-integer WIDGET, according to HOW." (let* ((value (widget-value widget)) @@ -3093,16 +3104,21 @@ Example: (t (error "HOW has a bad value")))) (inhibit-read-only t)) (widget-value-set widget newval))) +@end group +@group (defun widget-ranged-integer-increase (widget) "Increase the value of the ranged-integer WIDGET." (interactive (list (widget-at))) (widget-ranged-integer-change widget 'up)) +@end group +@group (defun widget-ranged-integer-decrease (widget) "Decrease the value of the ranged-integer WIDGET." (interactive (list (widget-at))) (widget-ranged-integer-change widget 'down)) +@end group @end lisp @node Inspecting Widgets From 0c01f97b73cffc373944fd2720e42520e86bc2e4 Mon Sep 17 00:00:00 2001 From: Xiyue Deng Date: Wed, 27 Dec 2023 12:35:39 -0800 Subject: [PATCH 7/8] Wrap @pxref of Abbrevs in parentheses (bug#68375) * doc/lispref/symbols.texi (Shorthands): Wrap `@pxref{Abbrevs}' in parentheses. Copyright-paperwork-exempt: yes --- doc/lispref/symbols.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index dccd9694b2e..dfbcf903e7d 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -669,7 +669,7 @@ name} (@pxref{Symbol Components}). It is useful to think of shorthands as @emph{abbreviating} the full names of intended symbols. Despite this, do not confuse shorthands with the -Abbrev system @pxref{Abbrevs}. +Abbrev system (@pxref{Abbrevs}). @cindex namespace etiquette Shorthands make Emacs Lisp's @dfn{namespacing etiquette} easier to work From 99efe5c80f9d90de6540ef6f78504c0413947a25 Mon Sep 17 00:00:00 2001 From: Xiyue Deng Date: Tue, 2 Jan 2024 16:31:30 -0800 Subject: [PATCH 8/8] Fix count of no-op functions (bug#68375) It looks like there are actually three kinds of no-op functions. * doc/lispref/functions.texi (Calling Functions): Fix count and plural of no-op functions. Copyright-paperwork-exempt: yes --- doc/lispref/functions.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index a32b92955c5..eac5b91e76a 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -980,8 +980,8 @@ lists) and call them using @code{funcall} or @code{apply}. Functions that accept function arguments are often called @dfn{functionals}. Sometimes, when you call a functional, it is useful to supply a no-op -function as the argument. Here are two different kinds of no-op -function: +function as the argument. Here are three different kinds of no-op +functions: @defun identity argument This function returns @var{argument} and has no side effects.