From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: brubar.cs@gmail.com Newsgroups: gmane.emacs.bugs Subject: bug#22272: 24.5; nonfunctional Emacs with a bad global mode (post-command-hook). Date: Wed, 30 Dec 2015 08:28:04 +0100 Message-ID: <87fuykxunv.fsf@tosh-laptop.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1451459422 31184 80.91.229.3 (30 Dec 2015 07:10:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Dec 2015 07:10:22 +0000 (UTC) To: 22272@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 30 08:10:12 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aEAtg-0003Xe-Dg for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Dec 2015 08:10:12 +0100 Original-Received: from localhost ([::1]:51391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEAtf-0000aR-Fj for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Dec 2015 02:10:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEAtb-0000aB-Dx for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:10:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEAtW-0007S1-Ca for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:10:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEAtW-0007Rt-9U for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aEAtW-00057M-5k for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: brubar.cs@gmail.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Dec 2015 07:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.145145935819595 (code B ref -1); Wed, 30 Dec 2015 07:10:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Dec 2015 07:09:18 +0000 Original-Received: from localhost ([127.0.0.1]:49297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEAsn-00055y-QQ for submit@debbugs.gnu.org; Wed, 30 Dec 2015 02:09:18 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58493) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEAsm-00055n-De for submit@debbugs.gnu.org; Wed, 30 Dec 2015 02:09:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEAsg-0006yA-4c for submit@debbugs.gnu.org; Wed, 30 Dec 2015 02:09:11 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:50821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEAsg-0006y6-1H for submit@debbugs.gnu.org; Wed, 30 Dec 2015 02:09:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEAse-0000Vx-Ku for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:09:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEAsZ-0006wz-KQ for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:09:08 -0500 Original-Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:34258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEAsZ-0006ws-B4 for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:09:03 -0500 Original-Received: by mail-wm0-x22d.google.com with SMTP id u188so30788741wmu.1 for ; Tue, 29 Dec 2015 23:09:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=j2PLTpNiPXAPWb88xGW9T0DZGrBX0tMdGLP3X9QAdzE=; b=NgXiBzYv5HMUSMEeXdu6VdjrfYlu2tGb173aUg9+m8AIYUh7RoujZZwQDCxvwT4UC4 CnrkkZ9F9WUlnRpTkn0ZJRji/ULlf5EvuhCdLjn9XnwIRxhq20Ov9VPvqF5YSZXHhqOl TlWfCcd74FpsXW9t9Mnss3AvPgwxtZtjyWxGfrOLwQA8WHQBYeP5PaQ8JIo3rE2oosVA 8F1Rer7Tr5XGen0ZhDsVv5/eop4A16kjMNqr50z/POKFTwWT/C53CMK6AG8ELTnTpoqr cZZrNJCur+v7Pyt6zgEpRyxkbLQmvt1HAmoAuygzKsOnkrGYmxtHwklT0oJ4bxWhhND1 PiMg== X-Received: by 10.195.11.129 with SMTP id ei1mr79610196wjd.80.1451459342527; Tue, 29 Dec 2015 23:09:02 -0800 (PST) Original-Received: from tosh-laptop (sta21-6-78-240-71-23.fbx.proxad.net. [78.240.71.23]) by smtp.gmail.com with ESMTPSA id bh6sm64234818wjb.0.2015.12.29.23.09.00 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 29 Dec 2015 23:09:01 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111008 Archived-At: Hi, This report is about a possible improvement. The "bug" arises only after a programming mistake. Please find attached a recipe to reproduce a stupid thing I've done. I was trying to define a new global minor mode. I ended up placing a function that raises an unhandled error in `post-command-hook'. Then, I had to kill my Emacs; I found no other way to recover control. As the `post-command-hook' documentation says, Emacs could probably do better here by discarding my non-working code. To reproduce and *KILL YOUR EMACS*, launch a *NEW* Emacs like that: emacs -Q --load test-kill-your-emacs-with-global-mode.el A-NEW-FILE.txt --eval '(insert "modified")' --funcall BAD-global-mode I'm reporting this only to improve Emacs. I obviously fixed my code and Emacs is awesome again! Thanks, Bruno. In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.9) of 2015-09-22 on tosh-laptop Windowing system distributor `The X.Org Foundation', version 11.0.11704000 Configured using: `configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --disable-silent-rules --libdir=/usr/lib64 --program-suffix=-emacs-24 --infodir=/usr/share/info/emacs-24 --localstatedir=/var --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp --with-gameuser=:gamestat --without-compress-install --with-file-notification=inotify --enable-acl --with-dbus --without-gnutls --without-gpm --without-hesiod --without-kerberos --without-kerberos5 --with-xml2 --without-selinux --without-wide-int --with-zlib --with-sound=alsa --with-x --without-ns --without-gconf --without-gsettings --without-toolkit-scroll-bars --without-gif --with-jpeg --with-png --with-rsvg --without-tiff --with-xpm --with-imagemagick --with-xft --without-libotf --without-m17n-flt --with-x-toolkit=gtk3 GENTOO_PACKAGE=app-editors/emacs-24.5 'CFLAGS=-O2 -pipe -march=native' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'' Important settings: value of $LC_CTYPE: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: tooltip-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 line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils help-mode easymenu time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer 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 make-network-process dbusbind inotify dynamic-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 73069 6963) (symbols 48 17625 0) (miscs 40 44 138) (strings 32 9420 4003) (string-bytes 1 259885) (vectors 16 8991) (vector-slots 8 384143 17302) (floats 8 64 195) (intervals 56 372 4) (buffers 960 13) (heap 1024 36263 750)) ===File ~/WorkingDirectory/Community/Emacs/Gnu-Emacs/test-kill-your-emacs-with-global-mode.el=== ;; WARNING WARNING WARNING WARNING ;; ;; Make your Emacs *UNUSABLE* ;; ;; WARNING WARNING WARNING WARNING ;; ;; BUG report: nonfunctional Emacs with a bad global mode (post-command-hook). ;; ;; What follows is a recipe to reproduce a stupid thing I've done. ;; The problem is that I had to kill my emacs; I found no other way to ;; recover control. ;; ;; The following code reproduces the problem: it ends up placing a ;; function that raises an unhandled error in `post-command-hook'. ;; ;; As the `post-command-hook' documentation says, Emacs could probably ;; do better here by discarding my stupid code. ;; ;; Do not use like this: ;; ;; emacs -Q --load test-kill-your-emacs-with-global-mode.el A-NEW-FILE.txt --eval '(insert "modified")' --funcall BAD-global-mode ;; ;; ;; (define-minor-mode BAD-minor-mode "BAD minor mode." ) (define-globalized-minor-mode BAD-global-mode BAD-minor-mode identity "BAD global mode." ) ============================================================