unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Removing unloaded functions from auto-mode-alist.
Date: Tue, 19 Apr 2005 18:25:25 +0200	[thread overview]
Message-ID: <85ll7e68ei.fsf@lola.goethe.zz> (raw)
In-Reply-To: <87zmvu6ba2.fsf@xs4all.nl> (Lute Kamstra's message of "Tue, 19 Apr 2005 17:23:17 +0200")

Lute Kamstra <Lute.Kamstra.lists@xs4all.nl> writes:

> unload-feature removes functions it is unloading from hooks.  What
> about removing these functions from auto-mode-alist as well?
>
> Index: lisp/loadhist.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/loadhist.el,v
> retrieving revision 1.32
> diff -c -r1.32 loadhist.el
> *** lisp/loadhist.el	19 Apr 2005 15:08:05 -0000	1.32
> --- lisp/loadhist.el	19 Apr 2005 15:15:19 -0000
> ***************
> *** 189,195 ****
>   			(memq x unload-feature-special-hooks)))	; Known abnormal hooks etc.
>   	   (dolist (y unload-hook-features-list)
>   	     (when (eq (car-safe y) 'defun)
> ! 	       (remove-hook x (cdr y))))))))
>       (when (fboundp 'elp-restore-function) ; remove ELP stuff first
>         (dolist (elt unload-hook-features-list)
>   	(when (symbolp elt)
> --- 189,200 ----
>   			(memq x unload-feature-special-hooks)))	; Known abnormal hooks etc.
>   	   (dolist (y unload-hook-features-list)
>   	     (when (eq (car-safe y) 'defun)
> ! 	       (remove-hook x (cdr y)))))))
> !       ;; Remove any feature-symbols from auto-mode-alist as well.
> !       (dolist (elt unload-hook-features-list)
> ! 	(when (eq (car-safe elt) 'defun)
> ! 	  (setq auto-mode-alist 
> ! 		(rassq-delete-all (cdr elt) auto-mode-alist)))))
>       (when (fboundp 'elp-restore-function) ; remove ELP stuff first
>         (dolist (elt unload-hook-features-list)
>   	(when (symbolp elt)

Actually, _both_ sound like a spectacularly bad idea if the unloaded
function gets replaced by a restored autoload.  I don't know the code
well enough.

Actually, stupid question in that area: does anybody think the
following code more than duely insane?  This is at the start of a file
with generated autoloads:

(provide 'auctex)
;;;###autoload (defmacro TeX-define () (read (current-buffer)) nil)
(defmacro TeX-define ()
  (let ((form (read (current-buffer))) symbol)
    (if (stringp (nth 3 form))
	(setcar (nthcdr 3 form)
		(format (nth 3 form) "AUCTeX 11.3")))
    (if (and (eq (car form) 'autoload)
	     (fboundp (setq symbol (nth 1 (nth 1 form))))
	     (eq (car (symbol-function symbol)) 'autoload))
	`(progn (defalias ',symbol '(autoload ,@(nthcdr 2 form)))
		(put ',symbol 'autoload ',(cdr (symbol-function symbol))))
      form)))


And the autoloads in the original are then something like

;;;###autoload
(TeX-define)
;;;###autoload
(defun tex-mode (arg)
   "This is a function from %s"
   ...)

Here is the rationale: I want people to be able to put AUCTeX into the
TeX tree and have it preloaded.  The TeX-define autoloads are placed
before definitions that are potentially _conflicting_ with
tex-mode.el.  I want to give people the option of having AUCTeX in the
tree, and enabled by default on the site (with require 'auctex), while
people that don't like it can get rid of it of the autoloads for
AUCTeX completely with (unload-feature 'auctex).  The Doc string gets
salted with version info.

Does anybody see any problems with that approach apart from the fact
that it is crazy as anything?

The autoload cookie in the above file is just for the purpose that
somebody actually extracts autoloads from the AUCTeX tree.  In that
case, the cookie (auctex.el is conveniently alphabetically first and
gets extracted as the first package) will disable _all_ autoload
actions for such conflicting functions: they only spring into action
when (require 'auctex) is actually executed.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  reply	other threads:[~2005-04-19 16:25 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-19 15:23 Removing unloaded functions from auto-mode-alist Lute Kamstra
2005-04-19 16:25 ` David Kastrup [this message]
2005-04-19 17:44   ` Stefan Monnier
2005-04-19 21:28     ` David Kastrup
2005-04-19 21:58       ` Stefan Monnier
2005-04-19 22:33         ` David Kastrup
2005-04-20 18:52           ` Stefan Monnier
2005-04-24 20:24             ` Lute Kamstra
2005-04-24 20:50               ` David Kastrup
2005-04-24 21:51                 ` Lute Kamstra
2005-04-24 22:00                   ` David Kastrup
2005-04-24 23:37                     ` Lute Kamstra
2005-04-25  0:07                       ` David Kastrup
2005-04-26 10:04                       ` Richard Stallman
2005-04-20 19:22           ` Lute Kamstra
2005-04-19 23:01         ` Stefan Monnier
2005-04-19 23:14         ` Lute Kamstra
2005-04-19 23:24           ` David Kastrup
2005-04-20 18:41             ` Stefan Monnier
2005-04-20 19:00               ` David Kastrup
2005-04-20 19:18                 ` Stefan Monnier
2005-04-20 19:50                   ` David Kastrup
2005-04-20 19:29               ` Lute Kamstra
2005-04-20 14:57           ` Richard Stallman
2005-04-20 15:59             ` Lute Kamstra
2005-04-21 15:30               ` Richard Stallman
2005-04-21 16:35                 ` Lute Kamstra
2005-04-22 20:51                   ` David Kastrup
2005-04-23 21:00                     ` Lute Kamstra
2005-04-23 22:10                       ` David Kastrup
2005-04-24 20:21                         ` Lute Kamstra
2005-04-24 20:32                           ` David Kastrup
2005-04-24 20:52                             ` Lute Kamstra
2005-04-25 16:05                             ` Richard Stallman
2005-04-23 22:24                     ` Richard Stallman
2005-04-20 14:57         ` Richard Stallman
2005-04-20 15:02           ` Stefan Monnier
2005-04-20 15:57             ` David Kastrup
2005-04-20 18:37               ` Stefan Monnier
2005-04-20 19:19                 ` David Kastrup
2005-04-20 20:11                   ` Stefan Monnier
2005-04-20 20:25                     ` David Kastrup
2005-04-20 20:57                       ` Stefan Monnier
2005-04-20 21:33                         ` David Kastrup
2005-04-20 16:25             ` Andreas Schwab
2005-04-20 16:57               ` David Kastrup
2005-04-20 22:47                 ` Andreas Schwab
2005-04-20 22:58                   ` David Kastrup
2005-04-21  9:56                     ` Andreas Schwab
2005-04-21 10:12                       ` David Kastrup
2005-04-21 11:50                         ` Andreas Schwab
2005-04-21 19:56                         ` Richard Stallman
2005-04-21 20:13                           ` David Kastrup
2005-04-23 16:15                             ` Richard Stallman
2005-04-23 16:23                               ` David Kastrup
2005-04-23 16:15                           ` Richard Stallman
2005-04-21 11:41                       ` Johan Vromans
2005-04-20 15:43           ` David Kastrup
2005-04-21 15:30             ` Richard Stallman
2005-04-21 17:46               ` David Kastrup
2005-04-23 16:15                 ` Richard Stallman
2005-04-19 22:00       ` Lute Kamstra
2005-04-19 23:22       ` Andreas Schwab
2005-04-19 23:33         ` David Kastrup
2005-04-19 21:05   ` Lute Kamstra
2005-04-20 14:57     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85ll7e68ei.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).