From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tak Kunihiro Newsgroups: gmane.emacs.bugs Subject: bug#50067: Context menus Date: Wed, 25 Aug 2021 08:43:29 +0900 (JST) Message-ID: <20210825.084329.2103284747365062473.tkk@misasa.okayama-u.ac.jp> References: <87wnociu41.fsf@mail.linkov.net> <20210824.191259.1858282353329289005.tkk@misasa.okayama-u.ac.jp> <877dgalpsr.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30636"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mattiase@acm.org, alan@idiocy.org, 50067@debbugs.gnu.org, larsi@gnus.org, tkk@misasa.okayama-u.ac.jp To: juri@linkov.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 25 01:44:11 2021 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 1mIg5T-0007ob-3D for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Aug 2021 01:44:11 +0200 Original-Received: from localhost ([::1]:42116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIg5R-0004AL-5X for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Aug 2021 19:44:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIg5K-00049x-6m for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 19:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIg5J-0005Hy-V2 for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 19:44:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mIg5J-0000JG-Q6 for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 19:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tak Kunihiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Aug 2021 23:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50067 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 50067-submit@debbugs.gnu.org id=B50067.16298486291165 (code B ref 50067); Tue, 24 Aug 2021 23:44:01 +0000 Original-Received: (at 50067) by debbugs.gnu.org; 24 Aug 2021 23:43:49 +0000 Original-Received: from localhost ([127.0.0.1]:45363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIg57-0000Ij-3b for submit@debbugs.gnu.org; Tue, 24 Aug 2021 19:43:49 -0400 Original-Received: from mx0a-00602c01.pphosted.com ([205.220.162.67]:27052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIg53-0000IZ-5s for 50067@debbugs.gnu.org; Tue, 24 Aug 2021 19:43:48 -0400 Original-Received: from pps.filterd (m0238148.ppops.net [127.0.0.1]) by mx0a-00602c01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 17OKvSXe025354; Wed, 25 Aug 2021 08:43:39 +0900 Original-Received: from mlsec.cc.okayama-u.ac.jp (mlsec.cc.okayama-u.ac.jp [150.46.12.254]) by mx0a-00602c01.pphosted.com with ESMTP id 3amfqjsajq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Aug 2021 08:43:38 +0900 Original-Received: from jlsv301.okayama-u.ac.jp (unknown [150.46.12.5]) by mlsec.cc.okayama-u.ac.jp with smtp id 20f6_48dc_2a6edbab_f127_4f61_bf5d_d41f054cd3f1; Wed, 25 Aug 2021 08:43:30 +0900 Original-Received: from localhost (vesta.misasa.okayama-u.ac.jp [150.46.48.154]) by jlsv301.okayama-u.ac.jp (Postfix) with ESMTPSA id 355607600CA; Wed, 25 Aug 2021 08:43:31 +0900 (JST) In-Reply-To: <877dgalpsr.fsf@mail.linkov.net> X-Mailer: Mew version 6.8 on Emacs 26.3 X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 11 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 4 Rules triggered EDT_SA_AU_PASS=0, EDT_SA_DN_PASS=0, EDT_SA_TS_PASS=0, RV6963=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6963> : inlines <7226> : streams <1899767> : uri <3310827> X-Proofpoint-ORIG-GUID: JnCrwFzVTSCpVt_60DkVWFXZTJvilkox X-Proofpoint-GUID: JnCrwFzVTSCpVt_60DkVWFXZTJvilkox X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10086 signatures=668682 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 phishscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108240147 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:212581 Archived-At: * flyspell menu It is handy to show 'flyspell-correct-word when click on typo word. However, menu is embedded inside of pre existing 'flyspell-correct-word and it is hard to collect menu. Since popup-menu interface can accept both menu and function with `e', it's good to utilize 'flyspell-correct-word. How about something like below to interrupt evaluation of context-menu-functions in the middle when one of context-menu-functions returns symbol instead of menu? diff --git a/lisp/mouse.el b/lisp/mouse.el index 6332d9fcec..23f0dda3e8 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -308,7 +308,7 @@ context-menu-map (run-hook-wrapped 'context-menu-functions (lambda (fun) (setq menu (funcall fun menu)) - nil)) + (not (keymapp menu)))) (when (functionp context-menu-filter-function) (setq menu (funcall context-menu-filter-function menu))) menu)) Then function something below will pop word choices. (defun context-menu-spell (menu) "Return 'flyspell-correct-word when word under mouse click is incorrect." (let ((faces-at-point (mapcar (lambda (xxx) (overlay-get xxx 'face)) (overlays-at (posn-point (event-start last-input-event)))))) (if (or (member 'flyspell-incorrect faces-at-point) (member 'flyspell-duplicate faces-at-point)) #'flyspell-correct-word menu))) (setq context-menu-functions '(context-menu-spell ;; flyspell context-menu-undo context-menu-region context-menu-local context-menu-minor))