unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#54048: 29.0.50; Wrong declaration for some align.el defcustom
@ 2022-02-17 22:37 Mauro Aranda
  2022-02-17 22:43 ` Mauro Aranda
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Aranda @ 2022-02-17 22:37 UTC (permalink / raw)
  To: 54048

Both align-region-heuristic and align-large-region allow for a nil value,
but the defcustom type only declares integer as a valid value.

The align-rules-list takes its type from the align-rules-list-type
variable, which gives a wrong default value for the "Run If" and "Valid"
optional attributes.  This can be seen with:
emacs -Q
1. M-x load library RET align
2. M-x customize-option RET align-rules-list
3. Navigate to the outer INS button and hit RET
4. Hit INS to insert and optional attribute
5. In the Value Menu for the new optional attribute, select either "Valid"
   or "Run If"
6. Emacs displays a widget-bad-default-value


In GNU Emacs 29.0.50 (build 52, i686-pc-linux-gnu, GTK+ Version 2.24.32, cairo version 1.16.0)
 of 2022-02-17 built on tbb-desktop
Repository revision: 3d0f5bc219de43ebd1789882bad483720d581a4e
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Ubuntu 18.04.6 LTS

Configured using:
 'configure --with-mailutils --with-xml2 --with-dbus'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG MODULES
NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK2 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
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-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
  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
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media rmc puny
dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg
rfc6068 epg-config gnus-util text-property-search time-date seq gv
subr-x byte-opt bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode 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 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 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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button 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 move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 8 42738 10332)
 (symbols 24 5662 1)
 (strings 16 15720 2235)
 (string-bytes 1 503602)
 (vectors 8 11124)
 (vector-slots 4 164045 37330)
 (floats 8 20 36)
 (intervals 28 199 9)
 (buffers 564 10))





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

* bug#54048: 29.0.50; Wrong declaration for some align.el defcustom
  2022-02-17 22:37 bug#54048: 29.0.50; Wrong declaration for some align.el defcustom Mauro Aranda
@ 2022-02-17 22:43 ` Mauro Aranda
  2022-02-19 12:34   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Aranda @ 2022-02-17 22:43 UTC (permalink / raw)
  To: 54048

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

tags 54048 patch
quit

Here's a patch:



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1991 bytes --]

From 381ad6c4cf55c9e74c07cf2c2d361d0fbeee7efc Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Wed, 16 Feb 2022 20:29:12 -0300
Subject: [PATCH] Fix types of some align.el defcustoms (Bug#54048)

* lisp/align.el (align-region-heuristic)
(align-large-region): Both options can be nil, but the defcustom type
didn't allow nil values.
(align-rules-list-type): The "Run If" and "Valid" attributes should be
functions, but the default value was t.  Change it to #'always.
---
 lisp/align.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/align.el b/lisp/align.el
index 2279c659b4..b054b1bac4 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -160,7 +160,8 @@ align-region-heuristic
 point we should search in looking for a region separator.  Larger
 values can mean slower performance in large files, although smaller
 values may cause unexpected behavior at times."
-  :type 'integer
+  :type '(choice (const :tag "Don't use heuristic when aligning a region" nil)
+                 integer)
   :group 'align)
 
 (defcustom align-highlight-change-face 'highlight
@@ -176,7 +177,7 @@ align-highlight-nochange-face
 (defcustom align-large-region 10000
   "If an integer, defines what constitutes a \"large\" region.
 If nil, then no messages will ever be printed to the minibuffer."
-  :type 'integer
+  :type '(choice (const :tag "Align a large region silently" nil) integer)
   :group 'align)
 
 (defcustom align-c++-modes '(c++-mode c-mode java-mode)
@@ -356,11 +357,11 @@ align-rules-list-type
 	     (cons :tag "Valid"
 		   (const :tag "(Return non-nil if rule is valid)"
 			  valid)
-		   (function :value t))
+		   (function :value always))
 	     (cons :tag "Run If"
 		   (const :tag "(Return non-nil if rule should run)"
 			  run-if)
-		   (function :value t))
+		   (function :value always))
 	     (cons :tag "Column"
 		   (const :tag "(Column to fix alignment at)" column)
 		   (choice :value comment-column
-- 
2.17.1


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

* bug#54048: 29.0.50; Wrong declaration for some align.el defcustom
  2022-02-17 22:43 ` Mauro Aranda
@ 2022-02-19 12:34   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-19 12:34 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 54048

Mauro Aranda <maurooaranda@gmail.com> writes:

> * lisp/align.el (align-region-heuristic)
> (align-large-region): Both options can be nil, but the defcustom type
> didn't allow nil values.
> (align-rules-list-type): The "Run If" and "Valid" attributes should be
> functions, but the default value was t.  Change it to #'always.

Thanks; pushed to Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2022-02-19 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-17 22:37 bug#54048: 29.0.50; Wrong declaration for some align.el defcustom Mauro Aranda
2022-02-17 22:43 ` Mauro Aranda
2022-02-19 12:34   ` Lars Ingebrigtsen

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