GNU bug report logs - #56260
29.0.50; Provide a way to define shortdoc groups without loading shortdoc.el

Previous Next

Package: emacs;

Reported by: daanturo <daanturo <at> gmail.com>

Date: Mon, 27 Jun 2022 15:07:01 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: daanturo <daanturo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Provide a way to define shortdoc groups without loading
 shortdoc.el
Date: Mon, 27 Jun 2022 22:06:29 +0700
Currently to use `define-short-documentation-group`, we must first load
`shortdoc.el`, but loading it isn't exactly a cheap task: my startup is
slowed down by ~0.0186s.

We can achieve this with an autoloaded progn:

```elisp

;; Allow registering shortdoc groups without loading this file

;;;###autoload
(progn
  (defvar shortdoc--groups nil)

  (defmacro define-short-documentation-group (group &rest functions)
    ;; docstring
    (declare (indent defun))
    `(progn
       (setq shortdoc--groups (delq (assq ',group shortdoc--groups)
                                    shortdoc--groups))
       (push (cons ',group ',functions) shortdoc--groups))))

```

-- 
Daanturo.





This bug report was last modified 3 years and 59 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.