From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#52973: Adding a few context-menu-mode commands Date: Mon, 03 Jan 2022 23:12:53 +0200 Organization: LINKOV.NET Message-ID: <868rvwsezi.fsf@mail.linkov.net> References: <87o84tp69h.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35220"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 52973@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 03 22:21:14 2022 Return-path: Envelope-to: geb-bug-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 1n4UlW-0008zY-8v for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Jan 2022 22:21:14 +0100 Original-Received: from localhost ([::1]:35742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4UlV-0007Wj-4r for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Jan 2022 16:21:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4UlK-0007TY-VA for bug-gnu-emacs@gnu.org; Mon, 03 Jan 2022 16:21:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53099) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4UlK-0003iZ-KG for bug-gnu-emacs@gnu.org; Mon, 03 Jan 2022 16:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n4UlK-00007a-H3 for bug-gnu-emacs@gnu.org; Mon, 03 Jan 2022 16:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Jan 2022 21:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52973 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 52973-submit@debbugs.gnu.org id=B52973.1641244834391 (code B ref 52973); Mon, 03 Jan 2022 21:21:02 +0000 Original-Received: (at 52973) by debbugs.gnu.org; 3 Jan 2022 21:20:34 +0000 Original-Received: from localhost ([127.0.0.1]:36409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4Ukf-00005u-AQ for submit@debbugs.gnu.org; Mon, 03 Jan 2022 16:20:34 -0500 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:60209) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4Ukc-00005e-TA for 52973@debbugs.gnu.org; Mon, 03 Jan 2022 16:20:19 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 0DA3C60009; Mon, 3 Jan 2022 21:20:11 +0000 (UTC) In-Reply-To: <87o84tp69h.fsf@posteo.net> (Philip Kaludercic's message of "Mon, 03 Jan 2022 08:34:18 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:223608 Archived-At: > I am attaching a few patches adding a few features for > context-menu-mode, that I mentioned and explained here: > https://ruzkuku.com/texts/emacs-mouse.html. > > Would it be OK to add these to Emacs itself? Thanks, it would be beneficial to enrich the packages with the context-menus. Man-context-menu is a good addition to the package man.el, and hi-lock-context-menu to hi-lock.el. However, mouse-online-search-at-point looks out of place in mouse.el. Since it relies on eww, wouldn't the right place for it be in eww.el? > +(defun Man-at-mouse (e) > ... > +(defun Man-context-menu (menu click) > + "Populate MENU with commands that open a man page at point." > + (save-excursion > + (mouse-set-point click) > + (when (save-excursion It seems the second 'save-excursion' is superfluous? > + (skip-syntax-backward "^ ") > + (and (looking-at > + "[[:space:]]*\\([[:alnum:]_-]+([[:alnum:]]+)\\)") > + (match-string 1))) > + (define-key-after menu [man-separator] menu-bar-separator) > + (define-key-after menu [man-at-mouse] > + '(menu-item "Open man page" man-at-mouse Typo: the command name is capitalized 'Man-at-mouse'. > + (mouse-set-point click) > + (when (symbol-at-point) This can be simplified to: (thing-at-mouse click 'symbol)