From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.devel Subject: Re: Suppressing beginning/end-of-buffer error messages (WAS: GNU Emacs raison d'etre) Date: Fri, 22 May 2020 08:46:16 -0400 Message-ID: References: <5230692c-c665-a330-7a12-e59fa25d97dd@gmail.com> <112aecd7-8165-6cae-ef69-08d14d843841@yandex.ru> <5d158a63-7173-424c-9d9f-ce7856f1eae7@default> <4bb36686-34e7-4ac8-898c-74e254902349@default> <29f65907-affb-481e-82f3-62522a766f69@default> <83sgfybn22.fsf@gnu.org> <1701f0b1-a481-bb45-08b8-99da4a6139fc@gmx.at> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="54363"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs developers To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 22 14:47:20 2020 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 1jc755-000E2p-W6 for ged-emacs-devel@m.gmane-mx.org; Fri, 22 May 2020 14:47:19 +0200 Original-Received: from localhost ([::1]:37428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jc755-0006Xz-1n for ged-emacs-devel@m.gmane-mx.org; Fri, 22 May 2020 08:47:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jc74Q-00061q-EN for emacs-devel@gnu.org; Fri, 22 May 2020 08:46:38 -0400 Original-Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]:34802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jc74P-000737-Dt for emacs-devel@gnu.org; Fri, 22 May 2020 08:46:38 -0400 Original-Received: by mail-oi1-x22e.google.com with SMTP id w4so9204805oia.1 for ; Fri, 22 May 2020 05:46:37 -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=tV618HKuCE2TDH8yjqupDHqbBhE1u1s05Aje3PCi5d0=; b=keCe+lIDTppqG4hqURg0fDyxxTDsOvQ81+skOXDla/bv78fGI20ZEJv20Vye9c0t7E gm+rRO6Z9b74YCRYyA6lN4hh703QMvugn4WOdB+j1AhN3LC5JgwSMGeY8nvjsMX6aQBz NEH/0TgKglUTt1jq23jtoxFBknCEdDkedpxaLqfIzD/uUQGD/PZ7VHxYAFsoFR7p0Hon wNTpyJLvIxohp3qxEi+ZR8Fz219nWgQAj0gyOpi+LLGOXBqzTMcGHOJp97ZefC9BtI7D JxxiYEDGvF5mSGJ3OPUNQe5YpYvNm28s87d1JwWU9l3Ohv6Aa0gRbcWKYkNT4fO6X0YX 0XRQ== 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=tV618HKuCE2TDH8yjqupDHqbBhE1u1s05Aje3PCi5d0=; b=ki9wrWM2Tyd3MbmWIwRV7EmucKPd+ynm4n3LsK6tEtUjsNVLoQj2xaLR9WSmZYI23L mBK6EXiyF0DgcFWUjt/+JS43P9lCHy1oYAkP65IaPflEGocK/nI5SxBHAUfcjZiSaK8G DPJqJhlArJkOnwZQnEtu1S5N0yXRFQffj3EN18m6RXZRWCJ/pfW5Y8Nyspz+H3vCDiJ/ /1F199joLnktK8bXxK4bzjHUzl+Uj1G0N1EP3/jVmNqwcASeHIVl/Wof4vLwS+fTsCum xpAioD6Nn9hMCzEaPuyskjsdm0JiisMVN7+Peqmke2gh3LLJkU+i8wzfjgFmI8I83pm1 enPg== X-Gm-Message-State: AOAM5300FqO0G4rrSminxpu0r6Au/7lOzKRzpcfWdpA90KO45h3z0w95 zJZlkTNkUQgsxf8h2vZkdH8SiTikFBhvlTz9ihc= X-Google-Smtp-Source: ABdhPJwJhzQ8/NlStBxUjc3QSGK5uDuHHsKb6EBIrzg6KJ0hRvA1HpkdMmG676eQlozOrYdC9DnXlbjz8zN+U0F7cww= X-Received: by 2002:aca:bd08:: with SMTP id n8mr2284016oif.173.1590151596296; Fri, 22 May 2020 05:46:36 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=npostavs@gmail.com; helo=mail-oi1-x22e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:251218 Archived-At: On Fri, 22 May 2020 at 05:30, martin rudalics wrote: > > (defun ignore-edge-of-buffer-errors (default-fun error context signaller) > > (unless (memq (car error) '(beginning-of-buffer end-of-buffer)) > > (funcall default-fun error context signaller))) > > (add-function :around command-error-function > > #'ignore-edge-of-buffer-errors) > > That will save me a lot of trouble. > > I suppose it would also work when I set 'command-error-function' to > 'ignore-edge-of-buffer-errors' right away but the advice is probably > cleaner. If you set directly, then getting hold of the original value of command-error-function becomes bit trickier. The following should do the same, but I prefer the add-function version since it depends less on the order of evaluation. (defvar original-command-error-function command-error-function) (defun ignore-edge-of-buffer-errors (error context signaller) (unless (memq (car error) '(beginning-of-buffer end-of-buffer)) (funcall original-command-error-function error context signaller))) (setq command-error-function #'ignore-edge-of-buffer-errors) (alternatively, you can hardcode command-error-default-function, but then you lose other additions to command-error-function, like help-command-error-confusable-suggestions)