all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#73792: 30; Confusion in loaddefs-generate--*-prefixes
@ 2024-10-13 15:12 Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-10-13 15:49 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-13 15:12 UTC (permalink / raw)
  To: 73792

Hello,

This comment confused me

,----
| (defun loaddefs-generate--make-prefixes (defs file)
|   ;; Remove the defs that obey the rule that file foo.el (or
|   ;; foo-mode.el) uses "foo-" as prefix.  Then compute a small set of
|   ;; prefixes that cover all the remaining definitions.
|   (let* ((tree (let ((tree radix-tree-empty))
|                  (dolist (def defs)
|                    (setq tree (radix-tree-insert tree def t)))
|                  tree))
|          (prefixes nil))
`----

as I could not see anything being removed here.

Digging through history I learned this comment was lifted from older
code shown below and removed in 1d4e90341782030cc7d8c29c639450b079587908,
where it was followed by commented code that would actually have done
that.

,----
| (defun autoload--make-defs-autoload (defs file)
| 
|   ;; Remove the defs that obey the rule that file foo.el (or
|   ;; foo-mode.el) uses "foo-" as prefix.
|   ;; FIXME: help--symbol-completion-table still doesn't know how to use
|   ;; the rule that file foo.el (or foo-mode.el) uses "foo-" as prefix.
|   ;;(let ((prefix
|   ;;       (concat (substring file 0 (string-match "-mode\\'" file)) "-")))
|   ;;  (dolist (def (prog1 defs (setq defs nil)))
|   ;;    (unless (string-prefix-p prefix def)
|   ;;      (push def defs))))
| 
|   ;; Then compute a small set of prefixes that cover all the
|   ;; remaining definitions.
`----

Thus, the first sentence (and the following "Then") should be removed
from the new comment.

----
And now for something completely different... (As in "here you might
want to *add* a comment" ;P )

loaddefs-generate--compute-prefixes ignores definitions with an
autoload cookie:

,----
|             (when (save-excursion
|                     (goto-char (match-beginning 0))
|                     (or (bobp)
|                         (progn
|                           (forward-line -1)
|                           (not (looking-at ";;;###autoload")))))
|               (push name prefs))))))
`----

Why?!

I might overlook something, but it seems that the old implementation
in pre-1d4e90341782030cc7d8c29c639450b079587908 autoloads.el didn't
do that.

     Cheers,
     Jonas





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

* bug#73792: 30; Confusion in loaddefs-generate--*-prefixes
  2024-10-13 15:12 bug#73792: 30; Confusion in loaddefs-generate--*-prefixes Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-13 15:49 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2024-10-13 15:49 UTC (permalink / raw)
  To: Jonas Bernoulli, Lars Ingebrigtsen, Stefan Monnier; +Cc: 73792

> Date: Sun, 13 Oct 2024 17:12:23 +0200
> From:  Jonas Bernoulli via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Hello,
> 
> This comment confused me
> 
> ,----
> | (defun loaddefs-generate--make-prefixes (defs file)
> |   ;; Remove the defs that obey the rule that file foo.el (or
> |   ;; foo-mode.el) uses "foo-" as prefix.  Then compute a small set of
> |   ;; prefixes that cover all the remaining definitions.
> |   (let* ((tree (let ((tree radix-tree-empty))
> |                  (dolist (def defs)
> |                    (setq tree (radix-tree-insert tree def t)))
> |                  tree))
> |          (prefixes nil))
> `----
> 
> as I could not see anything being removed here.
> 
> Digging through history I learned this comment was lifted from older
> code shown below and removed in 1d4e90341782030cc7d8c29c639450b079587908,
> where it was followed by commented code that would actually have done
> that.
> 
> ,----
> | (defun autoload--make-defs-autoload (defs file)
> | 
> |   ;; Remove the defs that obey the rule that file foo.el (or
> |   ;; foo-mode.el) uses "foo-" as prefix.
> |   ;; FIXME: help--symbol-completion-table still doesn't know how to use
> |   ;; the rule that file foo.el (or foo-mode.el) uses "foo-" as prefix.
> |   ;;(let ((prefix
> |   ;;       (concat (substring file 0 (string-match "-mode\\'" file)) "-")))
> |   ;;  (dolist (def (prog1 defs (setq defs nil)))
> |   ;;    (unless (string-prefix-p prefix def)
> |   ;;      (push def defs))))
> | 
> |   ;; Then compute a small set of prefixes that cover all the
> |   ;; remaining definitions.
> `----
> 
> Thus, the first sentence (and the following "Then") should be removed
> from the new comment.
> 
> ----
> And now for something completely different... (As in "here you might
> want to *add* a comment" ;P )
> 
> loaddefs-generate--compute-prefixes ignores definitions with an
> autoload cookie:
> 
> ,----
> |             (when (save-excursion
> |                     (goto-char (match-beginning 0))
> |                     (or (bobp)
> |                         (progn
> |                           (forward-line -1)
> |                           (not (looking-at ";;;###autoload")))))
> |               (push name prefs))))))
> `----
> 
> Why?!
> 
> I might overlook something, but it seems that the old implementation
> in pre-1d4e90341782030cc7d8c29c639450b079587908 autoloads.el didn't
> do that.

I've added people who might know the answers.





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

end of thread, other threads:[~2024-10-13 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-13 15:12 bug#73792: 30; Confusion in loaddefs-generate--*-prefixes Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-13 15:49 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.