From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "T.V Raman" Newsgroups: gmane.emacs.devel Subject: Re: Why does signaling an error not call set-message-function? Date: Tue, 05 Apr 2022 09:07:15 -0700 Message-ID: References: <87tub8hsax.fsf@blind.guru> <83h777ep5r.fsf@gnu.org> <87sfqrg2hf.fsf@blind.guru> <83bkxfen5h.fsf@gnu.org> <837d83ekeu.fsf@gnu.org> <834k37ejk5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=gb18030 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5141"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Eli Zaretskii , mlang@blind.guru, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 05 18:08:47 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nblja-0001AH-F2 for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Apr 2022 18:08:46 +0200 Original-Received: from localhost ([::1]:58910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nbljZ-0006UP-7V for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Apr 2022 12:08:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbliE-0004pe-0o for emacs-devel@gnu.org; Tue, 05 Apr 2022 12:07:22 -0400 Original-Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:38825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nbliC-0006vx-B8 for emacs-devel@gnu.org; Tue, 05 Apr 2022 12:07:21 -0400 Original-Received: by mail-pj1-x1030.google.com with SMTP id s14-20020a17090a880e00b001caaf6d3dd1so3003780pjn.3 for ; Tue, 05 Apr 2022 09:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=6jAUEkzRYrzkxkyU+v+mgcZukAmTdst6ia02J+mhNkk=; b=nnOTuss7MTAXzXVi0hZo0hzEHDrcM0IYOoRl+WVcq0/yiC8UCLwF6q5Dtut+SweEyq npfIgEAf4cjPsCsLt18jlnxQGtVkyQWO0GZg5UMSFU5XtwcYsXHp+P573JPTtI55Kaqv Rc35SV/6SKwMONobC+AJPBz3SVisLekJ6gop+1wHPxKKOgKRTRB2XSMN18q/ryJHw5t/ QL/K7X2YAPznuOyHNS0L4Z+ig8iizwzT5zpQd9tmYSrn6jVf/Dw24UaUjVWx98IUTnK5 UaZ++jV51T8AIZtj+i3Y51GxynwYY9aPZTKP1CYbPtW+h5WoRkAlYBlMUUwkHt1hh6pH zKzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=6jAUEkzRYrzkxkyU+v+mgcZukAmTdst6ia02J+mhNkk=; b=VVs+ZhzN0brdTR76rG4aLWkbkkTZgaQdnXTYFaL5C3GqXCfS5iokAgON9h8ZIIjnGh JZraEqiROKNYKSVm0k2rySpxH+0t5tbYNXvUhDoFOMxyGio/+YrPD94S6F3gx76IjcDi c2xMHYFCrW8d5teK3VXFEhO8Zy14Slz+bhSzoByHKiuhQ5aXC0nZaGNkmlTesrbNNcey eqwUxpPRTVzPgFTRsyBVZhilpbz6q8mF2Hfod+THkh561UjNynHQBYbrGx6FVNJEqGL1 +GM4L3VJgMvX3MkPoNPAvtmQ4B5mZFNCPLBjX+3+d4zfVRbdIXvm4WsZ6gUmRq35JwSZ uATw== X-Gm-Message-State: AOAM531oHqFUQ2qpXnOgUW+YPopYDzBVK2GNGNrEB3t25+/d7vjAQGxc 1aLhM9oR79Hb58NYOvSv4rQjyO36DRMl6w== X-Google-Smtp-Source: ABdhPJx5tea4e1P2xCuh6BXBHBLnBbdSiGYLcIH6c59UcDr8uT3+YMvOvY/BWjFWTh9+cRY774mq2g== X-Received: by 2002:a17:90a:e7c6:b0:1c7:443:3fdf with SMTP id kb6-20020a17090ae7c600b001c704433fdfmr5035360pjb.3.1649174838399; Tue, 05 Apr 2022 09:07:18 -0700 (PDT) Original-Received: from raman-glaptop (c-24-4-174-65.hsd1.ca.comcast.net. [24.4.174.65]) by smtp.gmail.com with ESMTPSA id f16-20020a056a00229000b004fabe756ba6sm17845270pfe.54.2022.04.05.09.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 09:07:17 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 05 Apr 2022 10:19:41 -0400") Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=raman@google.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -175 X-Spam_score: -17.6 X-Spam_bar: ----------------- X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:287821 Archived-At: Stefan Monnier writes: Emacspeak in module emacspeak-advice.el https://github.com/tvraman/emacspeak/blob/master/lisp/emacspeak-advice.el#L= 819 uses the following lines to handle this: (defun emacspeak-error-handler (data context _calling-function) "Emacspeak custom error handler." (emacspeak-auditory-icon 'warn-user) (message "%s %s" (or context " ") (error-message-string data))) =20 >>> I don't see a problem running arbitrary ELisp code at that time. >>> After all, we already exited the error-signaling context >> We did? > > You made me doubt, but indeed I see: > > Lisp_Object > command_loop_2 (Lisp_Object handlers) > { > register Lisp_Object val; >=20=20=20=20=20 > do > val =3D internal_condition_case (command_loop_1, handlers, cmd_er= ror); > while (!NILP (val)); >=20=20=20=20=20 > return Qnil; > } > > So `cmd_error` is run after we exit the error-signaling context. > Also while looking at it, I saw tht `cmd_error` then calls > `cmd_error_internal` which calls `command-error-function`: > > command-error-function is a variable defined in =A1=AEC source code= =A1=AF. >=20=20=20=20=20 > Its value is =A1=AEhelp-command-error-confusable-suggestions=A1=AF >=20=20=20=20=20 > Function to output error messages. > Called with three arguments: > - the error data, a list of the form (SIGNALED-CONDITION . SIGNAL-DAT= A) > such as what =A1=AEcondition-case=A1=AF would bind its variable to, > - the context (a string which normally goes at the start of the messa= ge), > - the Lisp function within which the error was signaled. >=20=20=20=20=20 > Also see =A1=AEset-message-function=A1=AF (which controls how non-err= or messages > are displayed). > > So we do already allow running arbitrary ELisp code in there ;-) > > > Stefan > > --=20 Thanks, --Raman(I Search, I Find, I Misplace, I Research) =817=A94 Id: kg:/m/0285kf1 =950=DC8