bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56260: 29.0.50; Provide a way to define shortdoc groups without load


From: daanturo
Subject: bug#56260: 29.0.50; Provide a way to define shortdoc groups without loading shortdoc.el
Date: Mon, 27 Jun 2022 22:06:29 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]