From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zhiwei Chen Newsgroups: gmane.emacs.devel Subject: Re: Simulating mouse-clicks Date: Mon, 20 Sep 2021 02:30:28 +0800 Message-ID: <87wnnccta3.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9599"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Ag Ibragimov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 19 20:35:04 2021 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 1mS1eZ-0002I5-Oc for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Sep 2021 20:35:03 +0200 Original-Received: from localhost ([::1]:38102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mS1eW-0001zA-Rs for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Sep 2021 14:35:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mS1aJ-0006Lc-Ck for emacs-devel@gnu.org; Sun, 19 Sep 2021 14:30:46 -0400 Original-Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:39459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mS1aE-0000dy-7q for emacs-devel@gnu.org; Sun, 19 Sep 2021 14:30:38 -0400 Original-Received: by mail-pg1-x530.google.com with SMTP id g184so15108610pgc.6 for ; Sun, 19 Sep 2021 11:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=2YgtFSIdXfFuuNcEbMsVoDjeWAW3HQxdC4T1cw2WevI=; b=FrD/XqvcBGS+NkvEkWCWJzWxWJe7nlAVkVFGPH4qKihif/Rex+mfUeTBfyZubNg10N UjtWnv4RBv4+CWqkTsyqKqWty+gvWHJbo5ITenQatrtASYeNuXbMrMVEDSRmRcbBD9sK E+O9v8jpFFfMZX5bwp/o1O9FqpwBBX0mhFgZ6NjS4XeT2uurULjPXUm4H63PwfiBM1AX QEePZkXXAf24Ft/5Cy0+IbNnI46QOMmIj+lvKiP6MJDpeh5lg55hR3lZf7iWyr1l9mHl l+BeA1s3om1ylVCpfPT01ItX86Ptrix5dOk1OVbsQU81tUDE5blvN/S5bw5ID/pg7ab1 XUsQ== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=2YgtFSIdXfFuuNcEbMsVoDjeWAW3HQxdC4T1cw2WevI=; b=UQNfhUC/mot1nW/6SHXNeU3F3Hf7Ouql3UcyRSvyUJSq/0j8zLIlppeWde4W9bAVLs JlKCqvtADknfMIitYpZ8WsoCHxwhSqERksbazLLzlYlIW2WKIG3YM1BiC7/Hw4Don2i3 6YiBJ7id8UcVtmiG+Bh2+yP3NM7EKhW+PRx7O3ztnVqwdp+7gzd2lf+slgpDee99q4X0 EH6/ZROZ9fUhrKx9OntYSyKc+XjWoRp0S+ugTFjrQdt/vzfnlWBHe28C90fTamt2Ko93 gGCqgcOGMq0SMmZzOJRnQpzQ7FgCAWW50ZTD+icP5lRdKO0Qei+o9zwVKc9Qliw+Db4o 3FwA== X-Gm-Message-State: AOAM5307Yn+FudcD1XFYqu0kM/chEGxpSdyHSjy+kdrG8SR8crOFAxIf zjvEXtwkwXp7PVE2q+m0EwDhCCLoMEg= X-Google-Smtp-Source: ABdhPJx9dC1e712wqbGDgrnocbbhHR3OOxkltmlkxD8lNfkV38XNjzSfFbcWdYF3LaIt+9F08nzpNw== X-Received: by 2002:aa7:96db:0:b0:43b:64f4:21e9 with SMTP id h27-20020aa796db000000b0043b64f421e9mr21292883pfq.52.1632076231141; Sun, 19 Sep 2021 11:30:31 -0700 (PDT) Original-Received: from Youmu (192.69.92.236.16clouds.com. [192.69.92.236]) by smtp.gmail.com with ESMTPSA id s25sm10593564pfm.138.2021.09.19.11.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Sep 2021 11:30:30 -0700 (PDT) In-Reply-To: (Ag Ibragimov's message of "Sat, 18 Sep 2021 16:54:00 -0500") Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=condy0919@gmail.com; helo=mail-pg1-x530.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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:275076 Archived-At: Ag Ibragimov writes: > Can someone share an example, Emacs Lisp snippet where mouse-click gets > simulated, e.g., programmatically clicking mouse-1 in current window. I > can't figure this out. Thanks! #+begin_src elisp (defun left-is-clicked () (interactive) (message "mouse left button is clicked")) (global-set-key (kbd "") #'left-is-clicked) (defun simulate-left-click () (interactive) (push '(t . mouse-1) unread-command-events)) (global-set-key (kbd "C-c d") #'simulate-left-click) #+end_src Press C-c d to see the result, bro. -- Zhiwei Chen