From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bob Newell Newsgroups: gmane.emacs.help Subject: Re: I'd like to advise a /keybinding/, how do I do it? Date: Wed, 28 Apr 2021 14:29:45 -1000 Organization: Avi Gobbler Publishing Message-ID: <878s52lypy.fsf@emailmessageidheader.nil> References: <87lf930ymd.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19859"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 29 02:31:03 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1lbua7-00052e-2z for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 29 Apr 2021 02:31:03 +0200 Original-Received: from localhost ([::1]:58468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbua5-0006HJ-Cz for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 28 Apr 2021 20:31:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbuZ4-0006Gy-1w for help-gnu-emacs@gnu.org; Wed, 28 Apr 2021 20:29:58 -0400 Original-Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:44616) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbuYw-0004Fj-9Q for help-gnu-emacs@gnu.org; Wed, 28 Apr 2021 20:29:57 -0400 Original-Received: by mail-pl1-x62f.google.com with SMTP id y1so18156883plg.11 for ; Wed, 28 Apr 2021 17:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bobnewell-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:organization:references:date:in-reply-to:message-id :user-agent:mime-version; bh=+3F0/KfHAh/jCahq7wuzaeGzmaQ4W/p95+rnMMSlcas=; b=b0lyfQcaKJANgZHK7pkg2gKPG7MtvWizUTD1BxKCKySNp2LOFp6rD2QtH0EIn9T9jF mrhmt2Cw0qMS564sYD0UwddhD/9gu5PdH+KaXWBm4Pud+VTAuavmESfJbPweLHN0GJCl IMdkGYlK11NZzx1l5qeAwJhxKOns8y7IBRRs3NAhgFJGYqC8jwzDIJ9/+kOI2ZUNiGqW GTLNCgpA5G5R+QTwUDWZm08hki63s9gszWeZ2gb2bObfYi/i2fHXjcLSg5w2TbKrgu7Z 3Q2MRRs4Syt1Ht3CycZTlsjzQ4EDFjhA1S+M4w2B/2skDYiZ6pMSkWSLJEeW0UrGccYl Jk+w== 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:organization:references:date :in-reply-to:message-id:user-agent:mime-version; bh=+3F0/KfHAh/jCahq7wuzaeGzmaQ4W/p95+rnMMSlcas=; b=Wh5AuI5N/aKPN5Iif2PYCvIc9yINKsFM9nsR6d9X0GmbnjbtddyP1rE+fQLmFnjfrc pOTuUCS8yUnMTEhVsGoWnZiEa5y6CLtSgBncr02oOnwDtnFPglmRqka/RcL9x5p7+E/m VaqJqALfW+oo9dk0nxH4eY72/IpkX4pBrOdtpAefaG9R7rq+admfS8f/k3mzUKp+B0Je 81LQigBE4oxA81IFDmwxsuw51gkemWFHJ8yURWN4/MxGfCT7CMscoYA9VfWB/GcpZbwX bivRlF7R8IDibwMNDqU8Bx+wXfVVgwcSQMrDWO9UHRdEKot4Y5Cz1B4qLUz86qJlrj6w UEeA== X-Gm-Message-State: AOAM531vug03D8Z27IzD4HFN7bM6fvFn/KluKsaYidvbvBvMA7EAubFP UFTcTpEuo+eZROZx72jg8Q4jWd2Plq5s47H8 X-Google-Smtp-Source: ABdhPJxH6yePGl+dUOZEbvEimhpN/qAqztgl892X2940hFyRbcrC2xfm+y9+z4OVsif5b+Xzs3jZqw== X-Received: by 2002:a17:90a:5313:: with SMTP id x19mr3512024pjh.109.1619656186898; Wed, 28 Apr 2021 17:29:46 -0700 (PDT) Original-Received: from localhost (udp074583uds.hawaiiantel.net. [141.239.251.8]) by smtp.gmail.com with ESMTPSA id g34sm715197pgg.59.2021.04.28.17.29.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 17:29:46 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Wed, 28 Apr 2021 10:33:31 -0400") Received-SPF: none client-ip=2607:f8b0:4864:20::62f; envelope-from=bobnewell@bobnewell.net; helo=mail-pl1-x62f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129190 Archived-At: >> A "finishing" action is often bound to C-c C-c (sending an email and >> commiting something to Git come to mind), so I'd like to advise whatever >> C-c C-c calls to check the buffer for occurrences of a string like TODO. > Or you could do it by advising the command bound to the particular key I've done this when I want the underlying command to be affected in all cases. For instance I don't wish send out an email until I've verified that I have a network connection, so I advise "message-send" and "message-send-and-exit" rather than the associated keystrokes. But be at least a little wary. Sometimes the keystrokes fool you about the underlying function. In my Gnus reply buffer right now, C-h k on C-c C-c shows 'orgtbl-ctrl-c-ctrl-c'. > Or you could do it with a minor-mode map (i.e. without modifying any I've done this on several occasions when I don't want to mess with the use of a command outside of a particular minor mode. That's a less common case, I think, but still very useful for certain things. -- Bob Newell Honolulu, Hawai`i - Via GNU/Linux/Emacs/Gnus/BBDB