unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52969: Shortdoc "string" group leads to backtrace
@ 2022-01-02 23:09 Stefan Kangas
  2022-01-03  7:34 ` Stefan Kangas
  2022-01-03 18:56 ` Stefan Kangas
  0 siblings, 2 replies; 9+ messages in thread
From: Stefan Kangas @ 2022-01-02 23:09 UTC (permalink / raw)
  To: 52969

On master, emacs -Q:

    M-x shortdoc-display-group RET string RET

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  split-string(nil "\n")
  shortdoc--display-function((truncate-string-to-width :eval
(truncate-string-to-width "foobar" 3) :eval (truncate-string-to-width
"你好bar" 5)))
  #f(compiled-function (data) #<bytecode
0x16a14e336dff84a8>)((truncate-string-to-width :eval
(truncate-string-to-width "foobar" 3) :eval (truncate-string-to-width
"你好bar" 5)))
  mapc(#f(compiled-function (data) #<bytecode 0x16a14e336dff84a8>)
("Making Strings" (make-string :args (length init) :eval "(make-string
5 ?x)") (string :eval "(string ?a ?b ?c)") (concat :eval (concat "foo"
"bar" "zot")) (string-join :no-manual t :eval (string-join '("foo"
"bar" "zot") " ")) (mapconcat :eval (mapconcat (lambda (a) (concat "["
a "]")) '("foo" "bar" "zot") " ")) (string-pad :eval (string-pad "foo"
5) :eval (string-pad "foobar" 5) :eval (string-pad "foo" 5 45 t))
(mapcar :eval (mapcar #'identity "123")) (format :eval (format "This
number is %d" 4)) "Manipulating Strings" (substring :eval (substring
"foobar" 0 3) :eval (substring "foobar" 3)) (string-limit :eval
(string-limit "foobar" 3) :eval (string-limit "foobar" 3 t) :eval
(string-limit "foobar" 10) :eval (string-limit "fo好" 3 nil 'utf-8))
(truncate-string-to-width :eval (truncate-string-to-width "foobar" 3)
:eval (truncate-string-to-width "你好bar" 5)) (split-string :eval
(split-string "foo bar") :eval (split-string "|foo|bar|" "|") :eval
(split-string "|foo|bar|" "|" t)) (split-string-and-unquote :eval
(split-string-and-unquote "foo \"bar zot\""))
(split-string-shell-command :eval (split-string-shell-command "ls
/tmp/'foo bar'")) (string-lines :eval (string-lines "foo\n\nbar")
:eval (string-lines "foo\n\nbar" t)) (string-replace :eval
(string-replace "foo" "bar" "foozot")) (replace-regexp-in-string :eval
(replace-regexp-in-string "[a-z]+" "_" "*foo*")) (string-trim :args
(string) :doc "Trim STRING of leading and trailing white space." :eval
(string-trim " foo ")) (string-trim-left :eval (string-trim-left
"oofoo" "o+")) (string-trim-right :eval (string-trim-right "barkss"
"s+")) (string-truncate-left :no-manual t :eval (string-truncate-left
"longstring" 8)) (string-remove-suffix :no-manual t :eval
(string-remove-suffix "bar" "foobar")) (string-remove-prefix
:no-manual t :eval (string-remove-prefix "foo" "foobar"))
(string-chop-newline :eval (string-chop-newline "foo\n"))
(string-clean-whitespace :eval (string-clean-whitespace " foo   bar
")) (string-fill :eval (string-fill "Three short words" 12) :eval
(string-fill "Long-word" 3)) (reverse :eval (reverse "foo"))
(substring-no-properties :eval (substring-no-properties (propertize
"foobar" 'face 'bold) 0 3)) (try-completion :eval (try-completion
"foo" '("foobar" "foozot" "gazonk"))) "Unicode Strings"
(string-glyph-split :eval (string-glyph-split "Hello,
👼🏻🧑🏼‍🤝‍🧑🏻")) (string-glyph-compose :eval (string-glyph-compose
"Å")) (string-glyph-decompose :eval (string-glyph-decompose "Å"))
"Predicates for Strings" (string-equal :eval (string-equal "foo"
"foo")) (eq :eval (eq "foo" "foo")) (eql :eval (eql "foo" "foo"))
(equal :eval (equal "foo" "foo")) (cl-equalp :eval (cl-equalp "Foo"
"foo")) (stringp :eval "(stringp ?a)") (string-empty-p :no-manual t
:eval (string-empty-p "")) (string-blank-p :no-manual t :eval
(string-blank-p " \n")) (string-lessp :eval (string-lessp "foo"
"bar")) (string-greaterp :eval (string-greaterp "foo" "bar"))
(string-version-lessp :eval (string-version-lessp "pic4.png"
"pic32.png")) (string-prefix-p :eval (string-prefix-p "foo" "foobar"))
(string-suffix-p :eval (string-suffix-p "bar" "foobar")) "Case
Manipulation" ...))
  shortdoc-display-group("string")
  funcall-interactively(shortdoc-display-group "string")
  command-execute(shortdoc-display-group record)
  execute-extended-command(nil "shortdoc-display-group" "short")
  funcall-interactively(execute-extended-command nil
"shortdoc-display-group" "short")
  command-execute(execute-extended-command)





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

* bug#52969: Shortdoc "string" group leads to backtrace
  2022-01-02 23:09 bug#52969: Shortdoc "string" group leads to backtrace Stefan Kangas
@ 2022-01-03  7:34 ` Stefan Kangas
  2022-01-03 20:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-03 18:56 ` Stefan Kangas
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Kangas @ 2022-01-03  7:34 UTC (permalink / raw)
  To: 52969; +Cc: Stefan Monnier

Stefan Kangas <stefan@marxist.se> writes:

> On master, emacs -Q:
>
>     M-x shortdoc-display-group RET string RET
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   split-string(nil "\n")
>   shortdoc--display-function((truncate-string-to-width :eval

We get nil here because on master, after emacs -Q:

    (documentation 'rx)
    => nil

Whereas on the emacs-28 branch:

    (documentation 'rx)
    => "Translate regular expressions REGEXPS ..."

Bisecting points to this commit:

    59732a83c8875c8986d2221600d559a24d8309cc is the first bad commit
    commit 59732a83c8875c8986d2221600d559a24d8309cc
    Author: Stefan Monnier <monnier@iro.umontreal.ca>
    Date:   Thu Dec 30 23:17:45 2021 -0500

        Don't store docstrings of preloaded .el files in etc/DOC

This always works, even with that commit:

    (progn (rx "foo")
           (documentation 'rx))
    => "Translate regular expressions REGEXPS ..."





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

* bug#52969: Shortdoc "string" group leads to backtrace
  2022-01-02 23:09 bug#52969: Shortdoc "string" group leads to backtrace Stefan Kangas
  2022-01-03  7:34 ` Stefan Kangas
@ 2022-01-03 18:56 ` Stefan Kangas
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Kangas @ 2022-01-03 18:56 UTC (permalink / raw)
  To: 52969

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

Stefan Kangas <stefan@marxist.se> writes:

> On master, emacs -Q:
>
>     M-x shortdoc-display-group RET string RET

BTW, I will be happy to push this test once we can fix this bug:

[-- Attachment #2: 0001-New-test-shortdoc-all-groups-work.patch --]
[-- Type: text/x-diff, Size: 1165 bytes --]

From 5c213aaec4bf536e2e7ff6e9656e645de43da2f1 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Mon, 3 Jan 2022 19:44:06 +0100
Subject: [PATCH] New test shortdoc-all-groups-work

* test/lisp/emacs-lisp/shortdoc-tests.el
(shortdoc-all-groups-work): New test.  See Bug#52969.
---
 test/lisp/emacs-lisp/shortdoc-tests.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/lisp/emacs-lisp/shortdoc-tests.el b/test/lisp/emacs-lisp/shortdoc-tests.el
index 1c4125e301..326d43eead 100644
--- a/test/lisp/emacs-lisp/shortdoc-tests.el
+++ b/test/lisp/emacs-lisp/shortdoc-tests.el
@@ -44,6 +44,14 @@ shortdoc-examples
                 (should (shortdoc-tests--tree-contains expr fun))))
             (setq props (cddr props))))))))
 
+(ert-deftest shortdoc-all-groups-work ()
+  "Test that all defined shortdoc groups display correctly."
+  (dolist (group (mapcar (lambda (x) (car x)) shortdoc--groups))
+    (unwind-protect
+        (shortdoc-display-group group)
+      (when-let ((buf (get-buffer (format "*Shortdoc %s*" group))))
+        (kill-buffer buf)))))
+
 (provide 'shortdoc-tests)
 
 ;;; shortdoc-tests.el ends here
-- 
2.30.2


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

* bug#52969: Shortdoc "string" group leads to backtrace
  2022-01-03  7:34 ` Stefan Kangas
@ 2022-01-03 20:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-03 20:37     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-03 20:33 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 52969

> We get nil here because on master, after emacs -Q:
>
>     (documentation 'rx)
>     => nil

Oh, indeed we now drop the docstrings from the autoloads in
`lisp/loaddefs.el`.  I see a few ways out of that:

1- Forget about autoloads's docstrings altogether (i.e. always load the
   autoload's target when we need the docstring).
2- Revert part of 59732a83c8 so that we still keep the docstrings of
   `lisp/loaddefs.el` in etc/DOC.
3- Byte-compile `lisp/loaddefs.el`.

I pushed a patch which does n°2.


        Stefan






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

* bug#52969: Shortdoc "string" group leads to backtrace
  2022-01-03 20:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-03 20:37     ` Lars Ingebrigtsen
  2022-01-03 21:05       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-03 20:37 UTC (permalink / raw)
  To: 52969; +Cc: stefan, monnier

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> 1- Forget about autoloads's docstrings altogether (i.e. always load the
>    autoload's target when we need the docstring).
> 2- Revert part of 59732a83c8 so that we still keep the docstrings of
>    `lisp/loaddefs.el` in etc/DOC.
> 3- Byte-compile `lisp/loaddefs.el`.
>
> I pushed a patch which does n°2.

Are there any disadvantages to doing n°3?  I liked the simplifications
in 59732a83c8.

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





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

* bug#52969: Shortdoc "string" group leads to backtrace
  2022-01-03 20:37     ` Lars Ingebrigtsen
@ 2022-01-03 21:05       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-03 21:19         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-05 15:53         ` Lars Ingebrigtsen
  0 siblings, 2 replies; 9+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-03 21:05 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52969, Stefan Kangas

Lars Ingebrigtsen [2022-01-03 21:37:42] wrote:
> Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>> 1- Forget about autoloads's docstrings altogether (i.e. always load the
>>    autoload's target when we need the docstring).
>> 2- Revert part of 59732a83c8 so that we still keep the docstrings of
>>    `lisp/loaddefs.el` in etc/DOC.
>> 3- Byte-compile `lisp/loaddefs.el`.
>> I pushed a patch which does n°2.
> Are there any disadvantages to doing n°3?
> I liked the simplifications in 59732a83c8.

I haven't tried yet.  I installed n°2 because it's the "safe choice".
We can still choose n°3 and/or n°1 which both have a wider impact.
I liked the simplifications in 59732a83c8 as well, and we do keep some
of them.

As for disadvantages to n°3, I remember trying it out some months ago but
I can't remember why nor can I remember why I haven't kept this change
in my local hacks.  Sorry.

IOW, someone will have to try it.
Of course, there are the obvious disadvantages of spending time to
compile `loaddefs.el` and the added space used by `loaddefs.elc`, tho
a lot of it would be recovered by the space saved in etc/DOC.


        Stefan






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

* bug#52969: Shortdoc "string" group leads to backtrace
  2022-01-03 21:05       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-03 21:19         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-05 15:53         ` Lars Ingebrigtsen
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-03 21:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52969, Stefan Kangas

> As for disadvantages to n°3, I remember trying it out some months ago but
> I can't remember why nor can I remember why I haven't kept this change
> in my local hacks.  Sorry.

I seem to remember that one of the motivations for trying it out had to
do with having an `;;;###autoload` cookie on a piece of code which used an
autoloaded macro, so loading `loaddef.el` would cause (auto)loading the
package which provides the macro.

Byte compiling `loaddefs.el` was a way to fix this problem.


        Stefan






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

* bug#52969: Shortdoc "string" group leads to backtrace
  2022-01-03 21:05       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-03 21:19         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-05 15:53         ` Lars Ingebrigtsen
  2022-01-05 15:55           ` Lars Ingebrigtsen
  1 sibling, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-05 15:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 52969, Stefan Kangas

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> IOW, someone will have to try it.
> Of course, there are the obvious disadvantages of spending time to
> compile `loaddefs.el` and the added space used by `loaddefs.elc`, tho
> a lot of it would be recovered by the space saved in etc/DOC.

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I seem to remember that one of the motivations for trying it out had to
> do with having an `;;;###autoload` cookie on a piece of code which used an
> autoloaded macro, so loading `loaddef.el` would cause (auto)loading the
> package which provides the macro.
>
> Byte compiling `loaddefs.el` was a way to fix this problem.

Right.  So I guess somebody just has to try it again and see whether
there's any reasons not to byte-compile the file.  I'll open a new bug
report.

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





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

* bug#52969: Shortdoc "string" group leads to backtrace
  2022-01-05 15:53         ` Lars Ingebrigtsen
@ 2022-01-05 15:55           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-05 15:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 52969, Stefan Kangas

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Right.  So I guess somebody just has to try it again and see whether
> there's any reasons not to byte-compile the file.  I'll open a new bug
> report.

(And I'm closing this bug report.)

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





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

end of thread, other threads:[~2022-01-05 15:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-02 23:09 bug#52969: Shortdoc "string" group leads to backtrace Stefan Kangas
2022-01-03  7:34 ` Stefan Kangas
2022-01-03 20:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-03 20:37     ` Lars Ingebrigtsen
2022-01-03 21:05       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-03 21:19         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-05 15:53         ` Lars Ingebrigtsen
2022-01-05 15:55           ` Lars Ingebrigtsen
2022-01-03 18:56 ` Stefan Kangas

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