From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 28 11:20:59 2019 Received: (at submit) by debbugs.gnu.org; 28 Feb 2019 16:20:59 +0000 Received: from localhost ([127.0.0.1]:55416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzOQd-0006AU-BF for submit@debbugs.gnu.org; Thu, 28 Feb 2019 11:20:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzOQb-0006AF-Tg for submit@debbugs.gnu.org; Thu, 28 Feb 2019 11:20:58 -0500 Received: from lists.gnu.org ([209.51.188.17]:60955) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gzOQK-0003ry-8i for submit@debbugs.gnu.org; Thu, 28 Feb 2019 11:20:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzOQI-0007Sn-SF for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2019 11:20:40 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: **** X-Spam-Status: No, score=4.5 required=5.0 tests=BAYES_50,DATE_IN_PAST_96_XX, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzOQ8-0003kB-Sx for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2019 11:20:32 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:38872) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzOPz-0003SP-01 for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2019 11:20:23 -0500 Received: by mail-wr1-x42a.google.com with SMTP id g12so10567584wrm.5 for ; Thu, 28 Feb 2019 08:20:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=+9nlU38RU2xO5N7Ptlx6Zebjdu+h4iCpMsgMHDiDKhA=; b=m135Abe1rok0lqxZbaE4YHPCocV8kilahAVCfMI1BlU2mjTKz+FMfrr6DU5CZUlYnX zkICUhTdLFssV+J/1Gsxwmczw2v8f+/460hwIm21OoCgn2Wt3Oy5PXiw4q0V1aTzNig9 Wx2pqKIU136coW0A0U0hUw7EiKZCfxOenzGbmqp52GYAdhdzwE6QzUeB1iEyn8vE9tEj eKEOBriKBBZb1bbWt7DgfUdDYRrCme6okH+TMbLstO8iw7Qi5HMd/eiLHqbtbdxlVCrI 57WdoyLfB5FWnheWbqMIBrB1WlujnT1rikMxHwUoA5MJaAohP1XMKCtG1M5lSG6wLPJP 7KMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=+9nlU38RU2xO5N7Ptlx6Zebjdu+h4iCpMsgMHDiDKhA=; b=YRzw7neZIFbO8zBebho8w0/PySEv1qGMilqW5un4Vz/UYsLTPzLyCjeAuu/q39eZy1 Q4EJe9gcnuwV1mTy9J5fFxPvtmtw9OS1jkEsayZUb3U//RffnyISkJJq8hGg5SQ19YFf ZMbA1SnFUBGiHKmOWQJlKgQIvMxgJuBlY+c1eUevDsNPPbVTEh9SCAIv02LiM5fhcndq FOUhJXJRYktL0FVsV62/BIrUIJtC3O1AZqPp2q2E5t5EGLa9A9qbAhQOSWR7MlHd6wHG eKczZLTWgcX9YIGGWs/AFHaO6YghPWo4NjprrTjd+nbwl0JXwiWvoJTlaui19DyoQH5E 8y/Q== X-Gm-Message-State: APjAAAUUxXBvsXGLOmF/eeBLjaEOmzqSpXGUUq11S7aZKfKZcZBVkVZ/ zTYnwLFdp4MO276UNea77Gilhfk2 X-Google-Smtp-Source: APXvYqzU+tAC2XOzZFl7JtAp8U3VyuqWzG5CW188PXLUriJPqPhw0dxgthbf503xwl5ZZCJ9NqqSYQ== X-Received: by 2002:adf:dd4f:: with SMTP id u15mr108508wrm.61.1551370801071; Thu, 28 Feb 2019 08:20:01 -0800 (PST) Received: from gabor.localnet (254C45A6.nat.pool.telekom.hu. [37.76.69.166]) by smtp.gmail.com with ESMTPSA id i16sm15416163wru.16.2019.02.28.08.20.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 08:20:00 -0800 (PST) From: Braun =?ISO-8859-1?Q?G=E1bor?= To: bug-gnu-emacs@gnu.org Subject: 26.1; unload-feature doesn't remove functions locally from hooks Date: Sat, 23 Feb 2019 22:16:45 +0100 Message-ID: <11240364.O9o76ZdvQC@gabor> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 3.3 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Create in the current directory the following two files: test.el (with-temp-buffer (load-file "./test-unload.el") (add-hook 'test-hook #'test-function nil t) (unload-feature 'test-unload) (run- [...] Content analysis details: (3.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: x.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (braungb88[at]gmail.com) 2.1 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (braungb88[at]gmail.com) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.3 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Create in the current directory the following two files: test.el (with-temp-buffer (load-file "./test-unload.el") (add-hook 'test-hook #'test-function nil t) (unload-feature 'test-unload) (run- [...] Content analysis details: (2.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: x.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (braungb88[at]gmail.com) 2.1 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (braungb88[at]gmail.com) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Create in the current directory the following two files: =2D------------------------ test.el ------------------------------------- (with-temp-buffer (load-file "./test-unload.el") (add-hook 'test-hook #'test-function nil t) (unload-feature 'test-unload) (run-hooks 'test-hook)) =2D---------------------------------------------------------------------- =2D------------------------ test-unload.el ------------------------------ (defun test-function () "Test function, does nothing." nil) (provide 'test-unload) =2D---------------------------------------------------------------------- Start Emacs via emacs -Q --eval '(setq debug-on-error t)' -l test.el Expectation: Emacs starts up with no error. (`unload-feature' should remove `test-function' from `test-hook' as documented, so `(run-hooks 'test-hook)' should be a no-op.) A split frame is shown with buffer *Backtrace* having the following=20 content: =2D------------------- buffer *Backtrace* ------------------------------- Debugger entered--Lisp error: (void-function test-function) test-function() run-hooks(test-hook) (progn (load-file "./test-unload.el") (add-hook 'test-hook (function=20 test-function) nil t) (unload-feature 'test-unload) (run-hooks 'test- hook)) (unwind-protect (progn (load-file "./test-unload.el") (add-hook 'test- hook (function test-function) nil t) (unload-feature 'test-unload) (run- hooks 'test-hook)) (and (buffer-name temp-buffer) (kill-buffer temp- buffer))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn=20 (load-file "./test-unload.el") (add-hook 'test-hook (function test- function) nil t) (unload-feature 'test-unload) (run-hooks 'test-hook))=20 (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current- buffer (set-buffer temp-buffer) (unwind-protect (progn (load-file "./ test-unload.el") (add-hook 'test-hook (function test-function) nil t)=20 (unload-feature 'test-unload) (run-hooks 'test-hook)) (and (buffer-name=20 temp-buffer) (kill-buffer temp-buffer))))) eval-buffer(# nil "/run/shm/test.el" nil t) ; Reading=20 at buffer position 155 load-with-code-conversion("/run/shm/test.el" "/run/shm/test.el" nil t) load("/run/shm/test.el" nil t) command-line-1(("--eval" "(setq debug-on-error t)" "-l" "test.el")) command-line() normal-top-level() =2D---------------------------------------------------------------------- Best wishes, G=C3=A1bor Braun System information: In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.2) of 2018-12-26, modified by Debian built on x86-ubc-01 Windowing system distributor 'The X.Org Foundation', version=20 11.0.12003000 System Description: Debian GNU/Linux buster/sid Recent messages: =46or information about GNU Emacs and the GNU system, type C-h C-a. Loading /run/shm/test-unload.el (source)...done Entering debugger... Configured using: 'configure --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --enable-libsystemd --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/26.1/site- lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/ usr/share/emacs/site-lisp --with-sound=3Dalsa --without-gconf --with-mailutils --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --enable-libsystemd --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/26.1/site- lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/ usr/share/emacs/site-lisp --with-sound=3Dalsa --without-gconf --with-mailutils --with-x=3Dyes --with-x-toolkit=3Dgtk3 --with-toolkit-scroll-bars 'CFLAGS=3D-g -O2 -fdebug-prefix-map=3D/build/emacs-3ThesY/emacs-26.1+1=3D. -fstack- protector-strong -Wformat -Werror=3Dformat-security -Wall' 'CPPFLAGS=3D-Wdate-time -D_FORTIFY_SOURCE=3D2' LDFLAGS=3D-Wl,-z,relro' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LIBSYSTEMD LCMS2 Important settings: value of $LANG: hu_HU.UTF-8 locale-coding-system: utf-8-unix Major mode: Debugger Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. =46eatures: (shadow sort mail-extr emacsbug message rmc puny seq dired dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-mode easymenu cl-print debug loadhist byte-opt gv bytecomp byte-compile cl-loaddefs cl-lib cconv elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 99661 8330) (symbols 48 20573 1) (miscs 40 65 104) (strings 32 28942 1190) (string-bytes 1 759566) (vectors 16 14967) (vector-slots 8 500780 7422) (floats 8 55 154) (intervals 56 296 0) (buffers 992 14)) From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 28 13:04:10 2019 Received: (at 34686) by debbugs.gnu.org; 28 Feb 2019 18:04:11 +0000 Received: from localhost ([127.0.0.1]:55511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzQ2U-0002HE-MM for submit@debbugs.gnu.org; Thu, 28 Feb 2019 13:04:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57445) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzQ2T-0002H2-QM for 34686@debbugs.gnu.org; Thu, 28 Feb 2019 13:04:10 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzQ2K-00042E-N0; Thu, 28 Feb 2019 13:04:03 -0500 Received: from [176.228.60.248] (port=1107 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gzQ2B-0003d2-LC; Thu, 28 Feb 2019 13:03:58 -0500 Date: Thu, 28 Feb 2019 20:03:27 +0200 Message-Id: <83ef7rkcy8.fsf@gnu.org> From: Eli Zaretskii To: Braun =?utf-8?Q?G=C3=A1bor?= In-reply-to: <11240364.O9o76ZdvQC@gabor> (message from Braun =?utf-8?Q?G?= =?utf-8?Q?=C3=A1bor?= on Sat, 23 Feb 2019 22:16:45 +0100) Subject: Re: bug#34686: 26.1; unload-feature doesn't remove functions locally from hooks References: <11240364.O9o76ZdvQC@gabor> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 34686 Cc: 34686@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Braun Gábor > Date: Sat, 23 Feb 2019 22:16:45 +0100 > > Create in the current directory the following two files: > > ------------------------- test.el ------------------------------------- > (with-temp-buffer > (load-file "./test-unload.el") > (add-hook 'test-hook #'test-function nil t) > (unload-feature 'test-unload) > (run-hooks 'test-hook)) > ----------------------------------------------------------------------- > > ------------------------- test-unload.el ------------------------------ > (defun test-function () "Test function, does nothing." nil) > (provide 'test-unload) > ----------------------------------------------------------------------- > > Start Emacs via > > emacs -Q --eval '(setq debug-on-error t)' -l test.el > > Expectation: Emacs starts up with no error. > (`unload-feature' should remove `test-function' from `test-hook' as > documented, so `(run-hooks 'test-hook)' should be a no-op.) Where do you see it documented that the hook should be removed? All I see is this: Standard unloading activities include restoring old autoloads for functions defined by the library, undoing any additions that the library has made to hook variables or to ‘auto-mode-alist’[...] This says that hooks are removed if they were added by the library being unloaded. But in your example, the hook was not added by test-unload.el, it was added by test.el, a different library. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 28 14:03:56 2019 Received: (at 34686) by debbugs.gnu.org; 28 Feb 2019 19:03:56 +0000 Received: from localhost ([127.0.0.1]:55524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzQyJ-0005lj-Ta for submit@debbugs.gnu.org; Thu, 28 Feb 2019 14:03:56 -0500 Received: from mail-wr1-f47.google.com ([209.85.221.47]:34251) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzQyH-0005lU-7q for 34686@debbugs.gnu.org; Thu, 28 Feb 2019 14:03:54 -0500 Received: by mail-wr1-f47.google.com with SMTP id f14so23218124wrg.1 for <34686@debbugs.gnu.org>; Thu, 28 Feb 2019 11:03:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=Y5Z8lWa66SkxCUZxxrv625uLH4l1mb2/YrUk13P33UE=; b=WhqdkHv+Rdyzlyv3krLTrtHp/D2KlWhiCNv6GKFZ066J3ODEXzJN7pBQAwzRuJNEUT 9PYqWDEfZyya6dA5iMQ2bLUX1db1uP3p0R7YlO/rjsXoKKOiNLC+5vG91ZwGZxDq9LNj Gq04MEuvfTNwZgr0849CsSrG2M8BX97+FYMNoOrOAgzL7weT7mfSOdR/CYEMxkg2/5eS wJCkq0A5hDFwR00ipNnT42fIcQcaKpmwjTvYOjEH3tcG1++krOq9purpA9QhalPqHjvR o9uNAQv6OsSctwbfYmRa4KYmy/CO+aarvuEe0MXWd+aIWbx1OuzLkLtGJWJH3R2dIznL ceqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=Y5Z8lWa66SkxCUZxxrv625uLH4l1mb2/YrUk13P33UE=; b=euBh68vJSE41dhhGznJmX+B4w6Ghdq4G2rhWwsIz3Z2iEGVhLKMp8Rg5Lj4XL3WYyO LbSSroJhwN3kAfaZlqt8xdWxrVxqlZToXMbRGT1HAgr+EZWcG3zbCiBE/7x4w7WV9GyW 739QVsBp3Xe6JoBLIUUTEVEv34D7UPosNgD7GSLGoKH2LwRieZawQHPyGlecjsOFRsMN 9ii6vn++wqLzhhY8BOhskeS9ibu72OtPAkcN/zfDSd0ZIFkG6KjJmSgRJBtek6ce1kwL GWWjSsYqdrw1aY7uEK5124nQluRWvLDXfc3jWKta11rfMH8Thf2Nv4FbyYEX06ImZKOm 4yoA== X-Gm-Message-State: APjAAAXDRw76wFwYEHzdh4mxXEEO3NLkuwcJHrRD9a/fjZEv2HHiBojH NPco6FBRTU2c9Q1gPF+0cv9z6/y6QiI= X-Google-Smtp-Source: APXvYqykjyv0zgqPG7/56sMp1AcsibEFh+xMuAcC9SulGcAAN7vArPk8BTEJ6Z5Ot8HKKnHWPoCRaw== X-Received: by 2002:adf:efca:: with SMTP id i10mr615807wrp.265.1551380626650; Thu, 28 Feb 2019 11:03:46 -0800 (PST) Received: from rpluim-mac ([2a01:e34:ecfc:a860:c3a:aa7:7f6a:ec3a]) by smtp.gmail.com with ESMTPSA id y13sm15658855wrw.31.2019.02.28.11.03.45 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 28 Feb 2019 11:03:45 -0800 (PST) From: Robert Pluim To: Eli Zaretskii Subject: Re: bug#34686: 26.1; unload-feature doesn't remove functions locally from hooks References: <11240364.O9o76ZdvQC@gabor> <83ef7rkcy8.fsf@gnu.org> X-Debbugs-No-Ack: yes Mail-Copies-To: never Gmane-Reply-To-List: yes Date: Thu, 28 Feb 2019 20:03:44 +0100 In-Reply-To: <83ef7rkcy8.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 28 Feb 2019 20:03:27 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34686 Cc: 34686@debbugs.gnu.org, Braun =?utf-8?Q?G=C3=A1bor?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Expectation: Emacs starts up with no error. >> (`unload-feature' should remove `test-function' from `test-hook' as >> documented, so `(run-hooks 'test-hook)' should be a no-op.) > > Where do you see it documented that the hook should be removed? All I > see is this: > > Standard unloading activities include restoring old autoloads for > functions defined by the library, undoing any additions that the > library has made to hook variables or to =E2=80=98auto-mode-alist=E2=80= =99[...] > > This says that hooks are removed if they were added by the library > being unloaded. But in your example, the hook was not added by > test-unload.el, it was added by test.el, a different library. In "(elisp) Unloading" it says: Before restoring the previous definitions, =E2=80=98unload-feature=E2= =80=99 runs =E2=80=98remove-hook=E2=80=99 to remove functions in the library from = certain hooks. These hooks include variables whose names end in =E2=80=98-hoo= k=E2=80=99 (or the deprecated suffix =E2=80=98-hooks=E2=80=99), plus those listed= in =E2=80=98unload-feature-special-hooks=E2=80=99, as well as =E2=80=98au= to-mode-alist=E2=80=99. This is to prevent Emacs from ceasing to function because important hooks refer to functions that are no longer defined. and a quick look at the code confirms that it at least *tries* to do that. Robert From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 28 14:38:23 2019 Received: (at 34686) by debbugs.gnu.org; 28 Feb 2019 19:38:23 +0000 Received: from localhost ([127.0.0.1]:55539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzRVe-0006ex-Vt for submit@debbugs.gnu.org; Thu, 28 Feb 2019 14:38:23 -0500 Received: from mail-wr1-f54.google.com ([209.85.221.54]:35204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzRVb-0006eh-U8 for 34686@debbugs.gnu.org; Thu, 28 Feb 2019 14:38:21 -0500 Received: by mail-wr1-f54.google.com with SMTP id t18so23308674wrx.2 for <34686@debbugs.gnu.org>; Thu, 28 Feb 2019 11:38:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:cc:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=QQ8oP0Y59M76tEcvCxxqxxRnEdIWA4m6EI8y8ogSVvo=; b=HJPnNKUQf0bycS5VQFpG9elqUQIOLCqT5V6vCyKkUOIJ1ksR9F6sQWzDNJ85RjBLJe kaR5l9Os7TylLoEAzGt/j9AV5ZBaDwhaj3j4JzdyJXEeNO0m8fYelabDOqcL9SO1vudH Ow8LuuCgD5J/OwLn9MBE2iwI/CRBR7uDBDfSDAJmPMK93/TaU/N19kAXTF74fVvwr5za qIieNVLfYbjeG2Y5QdegKQE6Pq4eudwdr0bvAZMAFoR6pi90AiIYWhr3cKFVjjNZaRzQ 3wMAj/xsxUKxnijZBQFVxusSuidTJbJdLA9VbZ91mT1j6sFEiKlUvu2MU3hEIrmx7FJU a4Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:cc:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=QQ8oP0Y59M76tEcvCxxqxxRnEdIWA4m6EI8y8ogSVvo=; b=Pq39XXlJZxIvlEpkShmZ+NUxmRqZ0FlXXettAtGLPZIxOpdQZ5ggwMXFHHnllNpwc4 nlbokbyPktdJWUNC3ADqcMd+MvrQiUfoGJ/pYpo1cWUq/iPxd2GhAt7PL2WInAixqpNl 63E2zOsAkSGwsdXjDQHA3fdEgd74cvGBLY6pBXVPATrjdwK9roFwY9gG8Dzpoh8agVED MWqWsv86GdcK2183mprR4gEanWvhlVKBGd7oGD6gU9p3YqI1UCvfuSyQB40wuXI71u0I mKy+7PBiGn8Ubyz6Mz8td0q6fciCFoXCyxMNvl7fqlfcDRLfBYYyZZ0db4T3hc3jtCuL hIsA== X-Gm-Message-State: APjAAAUo0EzPuwM6EyfJ5ZKGfN/9TUTQMwVf820Au+IOvpaJT8V/W3PX J317nQUNBNtmOtCR4uRUBv1MVRGimvk= X-Google-Smtp-Source: APXvYqxymLAzycULv//zv2wzLFs+DfWpUCoTUG3JWRp6ntSTtACp74dgmARN22GAr/GzZAGh8eFNXg== X-Received: by 2002:adf:f845:: with SMTP id d5mr764937wrq.113.1551382693621; Thu, 28 Feb 2019 11:38:13 -0800 (PST) Received: from rpluim-mac ([2a01:e34:ecfc:a860:c3a:aa7:7f6a:ec3a]) by smtp.gmail.com with ESMTPSA id o12sm48183111wre.0.2019.02.28.11.38.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 28 Feb 2019 11:38:12 -0800 (PST) From: Robert Pluim To: Braun =?utf-8?Q?G=C3=A1bor?= Subject: Re: bug#34686: 26.1; unload-feature doesn't remove functions locally from hooks References: <11240364.O9o76ZdvQC@gabor> <83ef7rkcy8.fsf@gnu.org> <1551386357.RvjfsdQ5jE@gabor> Date: Thu, 28 Feb 2019 20:38:11 +0100 In-Reply-To: <1551386357.RvjfsdQ5jE@gabor> ("Braun \=\?utf-8\?Q\?G\=C3\=A1bor\=22\?\= \=\?utf-8\?Q\?'s\?\= message of "Thu, 28 Feb 2019 20:31:20 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34686 Cc: 34686@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) (please don=CA=BCt drop the bug address from the CC) Braun G=C3=A1bor writes: > Hi, > >> > Standard unloading activities include restoring old autoloads for >> > functions defined by the library, undoing any additions that the >> > library has made to hook variables or to =E2=80=98auto-mode-alist=E2= =80=99[...] > > Obviously, this part of the docstring of unload-feature contradicts > the info manual. >=20=20 >> In "(elisp) Unloading" it says: >>=20 >> Before restoring the previous definitions, =E2=80=98unload-feature= =E2=80=99 runs >> =E2=80=98remove-hook=E2=80=99 to remove functions in the library fr= om certain >> hooks. These hooks include variables whose names end in =E2=80=98-= hook=E2=80=99 >> (or the deprecated suffix =E2=80=98-hooks=E2=80=99), plus those lis= ted in >> =E2=80=98unload-feature-special-hooks=E2=80=99, as well as =E2=80= =98auto-mode-alist=E2=80=99. This >> is to prevent Emacs from ceasing to function because important >> hooks refer to functions that are no longer defined. >>=20 >> and a quick look at the code confirms that it at least *tries* to do >> that. > > And as far as I understand the code, it does remove functions from the=20 > global value of the hooks, but not from the buffer-local values. > > IMHO, the stated reason in the info manual (keep Emacs functioning)=20 > justifies removing functions from the hooks (both their global and local= =20 > values) which become undefined. Yes, I=CA=BCd tend to agree. Would you have a patch to offer? Thanks Robert From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 28 15:08:56 2019 Received: (at 34686) by debbugs.gnu.org; 28 Feb 2019 20:08:56 +0000 Received: from localhost ([127.0.0.1]:55551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzRzD-0007QZ-Ox for submit@debbugs.gnu.org; Thu, 28 Feb 2019 15:08:55 -0500 Received: from mail-wr1-f45.google.com ([209.85.221.45]:36735) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzRzA-0007QI-BY for 34686@debbugs.gnu.org; Thu, 28 Feb 2019 15:08:53 -0500 Received: by mail-wr1-f45.google.com with SMTP id o17so23412201wrw.3 for <34686@debbugs.gnu.org>; Thu, 28 Feb 2019 12:08:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mImHIrKZbGtV1ab7Vqdi8vM1LkOvW+MZtQBKksgezSY=; b=f3KB2bv2RYV5YBn+5zlIeVJ46J1wZeUvaXA4Oa4PnmgwALLQNy6AbSIBv/A0AcoS10 55t2e6lVBRGNA8qUp+awlloVQF8JipO5vEmDkZRRQbJzlokadXkiBiVrZKSkqTz3x92n GHDkpzxt7EvGocPO50vZxd/FASZZfrN1hPSwIlWNr+b2zMnGrsjigHYuP4pgUD4sHH73 RLK0adaouh7F55h8goM5fYlv780qNz9r68wDNVwlqVZeIWEEIn2Q1TwkgZsgWkm0bOKE fl0wcGfTFJdIBQNMzUahvkIMf27xf+RoX5B6+TdiQebPamZ6khmWw1Z0cyx6C5Vshya1 qfkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mImHIrKZbGtV1ab7Vqdi8vM1LkOvW+MZtQBKksgezSY=; b=gEWBgkwggSxkRFiCSnhILRY8HhrracdP2ASHArVyT81PSPT5hB102RY3DNdSt4F0ID UC0yZvMi7CXZZNJHzSf2/az5QV1/N11nEyIZN0iEk920vuqvdtARYPmujRNDmnq0M2yC Blb558KMSvZge4hFuylB1HY7bTEv1nFeLsJ6AfGv+M8lgewgC+gSQf6LK3hHJz5wYUOs fWKvdfYlaRmv724O8S6Ldy7VoRiIWbOrmRuBo0ecjkwCY3TRksMrD0lqsu7hxgaWyo5c OH3aXI+/DR3jydk+AKNBIogSImRJdg/dVUjis+MJYjESHryzFnsQWNpX9VfKFca6CBxZ Fn0A== X-Gm-Message-State: APjAAAViJa8QnuP96TEcKdTIaqcRMcgH0G6VKHEhaSLTkAWMmE4g1QYE qQkSn1WtAqX7i7Ej5/eE0G0= X-Google-Smtp-Source: APXvYqzq4gC4TRcvapmu0Bh5qDVCi/XsOPR0iipWqzyYq+0Dglx0hKyOp96SF/px9fNmMPXnjqSxTg== X-Received: by 2002:adf:d0c9:: with SMTP id z9mr807294wrh.132.1551384526601; Thu, 28 Feb 2019 12:08:46 -0800 (PST) Received: from gabor.localnet (254C45A6.nat.pool.telekom.hu. [37.76.69.166]) by smtp.gmail.com with ESMTPSA id h9sm45153842wrv.11.2019.02.28.12.08.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 12:08:46 -0800 (PST) From: Braun =?ISO-8859-1?Q?G=E1bor?= To: Robert Pluim Subject: Re: bug#34686: 26.1; unload-feature doesn't remove functions locally from hooks Date: Thu, 28 Feb 2019 21:08:44 +0100 Message-ID: <2634596.5C4bGIA8oR@gabor> In-Reply-To: References: <11240364.O9o76ZdvQC@gabor> <1551386357.RvjfsdQ5jE@gabor> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 34686 Cc: 34686@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) > > IMHO, the stated reason in the info manual (keep Emacs functioning) > > justifies removing functions from the hooks (both their global and=20 local > > values) which become undefined. >=20 > Yes, I=CA=BCd tend to agree. Would you have a patch to offer? What about the following? G=C3=A1bor =2D-- lisp/loadhist.el 2019-02-28 20:52:14.852487704 +0100 +++ lisp/loadhist.el 2019-02-28 20:51:40.008386599 +0100 @@ -295,7 +295,13 @@ (dolist (y unload-function-defs-list) (when (and (eq (car-safe y) 'defun) (not (get (cdr y) 'autoload))) =2D (remove-hook x (cdr y))))))) + (let ((f (cdr y))) + (remove-hook x f) + ;; Remove also from buffer-local value. + (save-current-buffer + (dolist (buf (buffer-list)) + (set-buffer buf) + (remove-hook x f t))))))))) ;; Remove any feature-symbols from auto-mode-alist as well. (dolist (y unload-function-defs-list) (when (and (eq (car-safe y) 'defun) From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 28 20:23:33 2019 Received: (at control) by debbugs.gnu.org; 1 Mar 2019 01:23:33 +0000 Received: from localhost ([127.0.0.1]:55669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzWth-0006Zr-16 for submit@debbugs.gnu.org; Thu, 28 Feb 2019 20:23:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37113) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzWtd-0006Zb-Jq for control@debbugs.gnu.org; Thu, 28 Feb 2019 20:23:31 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzWtU-0005Gw-Gt for control@debbugs.gnu.org; Thu, 28 Feb 2019 20:23:21 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gzWtT-0004Ce-8G for control@debbugs.gnu.org; Thu, 28 Feb 2019 20:23:20 -0500 Subject: control message for bug 34686 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Thu, 28 Feb 2019 20:23:19 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) forcemerge 5293 34686 From unknown Sat Aug 16 18:48:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 19 Nov 2020 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator