From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: prevent hook vanishing Date: Fri, 18 May 2018 08:59:39 -0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1526659191 12021 195.159.176.226 (18 May 2018 15:59:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 18 May 2018 15:59:51 +0000 (UTC) Cc: akrl@sdf.org To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 18 17:59:47 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJhnH-000327-7h for geh-help-gnu-emacs@m.gmane.org; Fri, 18 May 2018 17:59:47 +0200 Original-Received: from localhost ([::1]:39715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJhpO-0003R2-4M for geh-help-gnu-emacs@m.gmane.org; Fri, 18 May 2018 12:01:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJhnM-0002Tv-KJ for help-gnu-emacs@gnu.org; Fri, 18 May 2018 11:59:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJhnM-0001It-1s for help-gnu-emacs@gnu.org; Fri, 18 May 2018 11:59:52 -0400 Original-Received: from mail-qt0-x230.google.com ([2607:f8b0:400d:c0d::230]:46049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJhnL-0001Ie-TO for help-gnu-emacs@gnu.org; Fri, 18 May 2018 11:59:52 -0400 Original-Received: by mail-qt0-x230.google.com with SMTP id j42-v6so10853712qtj.12 for ; Fri, 18 May 2018 08:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UFq1LCUJwf37uOgzzAlh0V6RckpMKAwEmlTzQRdU/Vw=; b=NKm7X63KRvwVTsby9v7lgXI47908QSM1/EGHYaE9p8WA7ETbLpW+t9Op626TpbgFUc 8IiV5++wR3qPZZok8aK+u/V97/yZn7llcaXsrlx71NdjJsPgGpr9IFkXmlM6dhdaHRBi rCjD8yA7nV1nZ/dwZqtxRbqtCzGmVjhL19nWNPZWJF7BHC/ISVk/BX8vWN0IqWtFBgqr qzK45jUlOyFknCZbe5uFK/8WjV2TP7zVwL7fo34DPqcemdwLlljkgWe40mt7MJgQtH9L yiZ3jblw4IvyHMb58QLU2TIVPNB462mNosINcjifyQOgKddsg8f5Jh2UBs8LEuNkZefX ONzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UFq1LCUJwf37uOgzzAlh0V6RckpMKAwEmlTzQRdU/Vw=; b=Edh2w0TsBuwRSio0AgSVgU/NkGbC+dra0076Acvz6E7iS3FuQr//imcxGo/dJfAsFV Umw72v7n0m3fn4gW23ijKminJJIT4ZaFQgZUjwb68NdtigcxkUgpB6Y0NBBNFG8bJSgr PueraIsXNuoa8AcpbDhcZU2hGuGmz+Q7zREjdukRxAelEMbwfHPBc37T8Sx6QED+a8cp ykoNMYy7FWQDOcCSyaNxid/ZcyJ1+XKeMugE96WAzDtGoJ7uncEjl0R/SOBFYeMzh0/r 0XEjDj0Do5+Wfp5CKci1Wwbfg9ILwqowMDNsssUFLWNSxbxIa6e34Kd+mM2HWwCYjxWa mN5w== X-Gm-Message-State: ALKqPwcWL4gA1Zk5tQBFlYlqvc3O7vAb9SkENEnDTKk1jzrxnw7FXim+ kHvv5N0rjCGFos7JMBHajaYvvGmhcABz+oU/x6Jtgpf1 X-Google-Smtp-Source: AB8JxZqoSf2XNAiFMxjZONGqObP705cybJo2/D+p7AYpl8ZNaqf1YmrgdIehzPtmKAZA5byXzfjzNsaMjV47UyctWKM= X-Received: by 2002:a0c:bd25:: with SMTP id m37-v6mr9402719qvg.209.1526659190940; Fri, 18 May 2018 08:59:50 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::230 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116768 Archived-At: akrl wrote: > > Why not use `condition-case' in your hook function to catch the error > > and respond appropriately? (There are also `with-demoted-errors' and > > `ignore-errors', if there's nothing that needs to be except to suppress > > the error) > Doesn't quite work. I wrap the hooked code around using ignore-errors, > then for instance if I get the following error (from *Messages*): > "Symbol's value as variable is void" > the hook is wiped out. Hm, then you may have another problem. The following simple example works for me: (defun boom-after-change (&rest _) (ignore-errors (error (message "Boom!")))) (add-hook 'after-change-functions #'boom-after-change nil t) Hope that helps John