unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69745: [PATCH] Fix incorrect Edebug docstrings
@ 2024-03-12  9:13 Matt
  2024-03-12 12:59 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Matt @ 2024-03-12  9:13 UTC (permalink / raw)
  To: 69745

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

Hi,

When edebug-print-length and edebug-print-level are nil, they default to print-level and print-length.  The docstrings currently say the opposite, that edebug defaults to the print variables if non-nil.

Thank you
--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at https://liberapay.com/org-mode


[-- Attachment #2: fix-incorrect-edebug-docstring.diff --]
[-- Type: application/octet-stream, Size: 838 bytes --]

diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 4c7dbb4ef8c..a33593dca4c 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -193,10 +193,10 @@ Use this with caution since it is not debugged."
 
 
 (defcustom edebug-print-length 50
-  "If non-nil, default value of `print-length' for printing results in Edebug."
+  "If nil, default value of `print-length' is used for printing results in Edebug."
   :type '(choice integer (const nil)))
 (defcustom edebug-print-level 50
-  "If non-nil, default value of `print-level' for printing results in Edebug."
+  "If nil, default value of `print-level' is used for printing results in Edebug."
   :type '(choice integer (const nil)))
 (defcustom edebug-print-circle t
   "If non-nil, default value of `print-circle' for printing results in Edebug."

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

* bug#69745: [PATCH] Fix incorrect Edebug docstrings
  2024-03-12  9:13 bug#69745: [PATCH] Fix incorrect Edebug docstrings Matt
@ 2024-03-12 12:59 ` Andreas Schwab
  2024-03-15 17:22   ` Matt
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2024-03-12 12:59 UTC (permalink / raw)
  To: Matt; +Cc: 69745

On Mär 12 2024, Matt wrote:

> When edebug-print-length and edebug-print-level are nil, they default to print-level and print-length.  The docstrings currently say the opposite, that edebug defaults to the print variables if non-nil.

That's not correct.  The edebug-print-* variables, when non-nil,
override the corresponding print-* variables during printing (see
edebug-safe-prin1-to-string).  When they are nil, they have no effect.

>  (defcustom edebug-print-length 50
> -  "If non-nil, default value of `print-length' for printing results in Edebug."
> +  "If nil, default value of `print-length' is used for printing results in Edebug."

That fails to say what happens if it is non-nil, which is the actual
relevant information.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





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

* bug#69745: [PATCH] Fix incorrect Edebug docstrings
  2024-03-12 12:59 ` Andreas Schwab
@ 2024-03-15 17:22   ` Matt
  2024-03-16 10:43     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Matt @ 2024-03-15 17:22 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 69745

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


 ---- On Tue, 12 Mar 2024 13:59:58 +0100  Andreas Schwab  wrote --- 
 > On Mär 12 2024, Matt wrote:
 > 
 > > When edebug-print-length and edebug-print-level are nil, they default to print-level and print-length.  The docstrings currently say the opposite, that edebug defaults to the print variables if non-nil.
 > 
 > That's not correct.  The edebug-print-* variables, when non-nil,
 > override the corresponding print-* variables during printing (see
 > edebug-safe-prin1-to-string).  When they are nil, they have no effect.
 > 
 > >  (defcustom edebug-print-length 50
 > > -  "If non-nil, default value of `print-length' for printing results in Edebug."
 > > +  "If nil, default value of `print-length' is used for printing results in Edebug."
 > 
 > That fails to say what happens if it is non-nil, which is the actual
 > relevant information.

Thanks for taking the time to review this.  

You are correct in the functioning.  The problem is the current docstrings are ambiguous.  Consider the current description for 'edebug-print-length':

"If non-nil, default value of ‘print-length’ for printing results in Edebug."

This has, at least, two possible interpretations:

1. "If non-nil, USE THE VALUE OF EDEBUG-PRINT-LENGTH FOR THE default value of 'print-length' for printing results in Edebug."  
2. "If non-nil, USE THE default value of 'print-length' for printing results in Edebug."  
 
As you point out, the first meaning is the intended one based on the implementation.  I read it according to the second interpretation.

Without getting hung up on why it's ambiguous, I hope I've made the case that it is ambiguous.

I've updated the patch to use the same wording as 'print-length' and 'print-level' which hopefully makes things clear.   The current docstring felt it necessary to explicitly mention "for printing results in Edebug" and I've tried to preserve that in the suggested changes.

--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at https://liberapay.com/org-mode


[-- Attachment #2: v02-fix-incorrect-edebug-docstring.diff --]
[-- Type: application/octet-stream, Size: 931 bytes --]

diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 4c7dbb4ef8c..8be066d0f61 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -193,10 +193,12 @@ Use this with caution since it is not debugged."
 
 
 (defcustom edebug-print-length 50
-  "If non-nil, default value of `print-length' for printing results in Edebug."
+  "Maximum length of list to print before abbreviating while in `edebug-mode'.
+When nil, behave according to `print-length'."
   :type '(choice integer (const nil)))
 (defcustom edebug-print-level 50
-  "If non-nil, default value of `print-level' for printing results in Edebug."
+  "Maximum depth of list nesting to print before abbreviating while in `edebug-mode'.
+When nil, behave according to `print-level'."
   :type '(choice integer (const nil)))
 (defcustom edebug-print-circle t
   "If non-nil, default value of `print-circle' for printing results in Edebug."

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

* bug#69745: [PATCH] Fix incorrect Edebug docstrings
  2024-03-15 17:22   ` Matt
@ 2024-03-16 10:43     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-03-16 10:43 UTC (permalink / raw)
  To: Matt; +Cc: 69745-done, schwab

> Cc: 69745 <69745@debbugs.gnu.org>
> Date: Fri, 15 Mar 2024 18:22:55 +0100
> From: Matt <matt@excalamus.com>
> 
> Thanks for taking the time to review this.  
> 
> You are correct in the functioning.  The problem is the current docstrings are ambiguous.  Consider the current description for 'edebug-print-length':
> 
> "If non-nil, default value of ‘print-length’ for printing results in Edebug."
> 
> This has, at least, two possible interpretations:
> 
> 1. "If non-nil, USE THE VALUE OF EDEBUG-PRINT-LENGTH FOR THE default value of 'print-length' for printing results in Edebug."  
> 2. "If non-nil, USE THE default value of 'print-length' for printing results in Edebug."  
>  
> As you point out, the first meaning is the intended one based on the implementation.  I read it according to the second interpretation.
> 
> Without getting hung up on why it's ambiguous, I hope I've made the case that it is ambiguous.
> 
> I've updated the patch to use the same wording as 'print-length' and 'print-level' which hopefully makes things clear.   The current docstring felt it necessary to explicitly mention "for printing results in Edebug" and I've tried to preserve that in the suggested changes.

Thanks, I installed a variant of this on the emacs-29 branch, and I'm
therefore closing this bug.





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

end of thread, other threads:[~2024-03-16 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12  9:13 bug#69745: [PATCH] Fix incorrect Edebug docstrings Matt
2024-03-12 12:59 ` Andreas Schwab
2024-03-15 17:22   ` Matt
2024-03-16 10:43     ` Eli Zaretskii

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