From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Doug Davis Newsgroups: gmane.emacs.bugs Subject: bug#46610: Interactive mode tagging for python.el navigation functions Date: Wed, 17 Feb 2021 23:46:32 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38908"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.15; emacs 28.0.50 To: 46610@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 18 05:47: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 1lCbDa-0009zb-EC for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 Feb 2021 05:47:11 +0100 Original-Received: from localhost ([::1]:50312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCbDZ-0000I1-3V for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Feb 2021 23:47:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCbDS-0000Hp-P9 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 23:47:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34001) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCbDS-0007HE-Hs for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 23:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lCbDS-0003Pw-F8 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 23:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Doug Davis Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Feb 2021 04:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46610 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161362360213108 (code B ref -1); Thu, 18 Feb 2021 04:47:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Feb 2021 04:46:42 +0000 Original-Received: from localhost ([127.0.0.1]:45547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCbD7-0003PL-Ds for submit@debbugs.gnu.org; Wed, 17 Feb 2021 23:46:41 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:51922) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCbD5-0003PE-N2 for submit@debbugs.gnu.org; Wed, 17 Feb 2021 23:46:40 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCbD5-0000Fx-8D for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 23:46:39 -0500 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:58627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCbD2-00075W-VE for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 23:46:38 -0500 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 374F6ACF for ; Wed, 17 Feb 2021 23:46:35 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 17 Feb 2021 23:46:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddavis.io; h= from:to:subject:date:message-id:mime-version:content-type; s= fm1; bh=fqKXLxZKvfg9OwsGz2jxwl/9oyR3a8i3uDKcDoYOrWo=; b=kwlvODu6 VQLdwdsj6x6pkvlZ9R0M7V53Jads+Tl95IEpsGO5KAtxqC0KDCTgZCy3B+puR7Bc HfpUknfjXyVQzDHlAEwW9E8SD39fi0my7MiRCYv7dS1aDCjrdEmo9AnzHY28hiSI lQpArsynHSKEFvl6dKON6OOBoOYS/JnfTQjuRWA4FmsHiCjwAdLFCwH7eNS+H2I1 crzkL4dlKhZlr8bqsaMCiiWDB0njMREp1YYUOS8Tl85KtB47eju0CNPMZrMB5Oo4 DCrD+oWxtG1EWnQKVJtemlXXa1G4OFBJPtatAG9qiupGWMqVdUBZ3e1WAR4ZW8E0 P5+6y1bQoFM0uw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=fqKXLxZKvfg9OwsGz2jxwl/9oyR3a 8i3uDKcDoYOrWo=; b=AKQIjoRjdlQdQkKDKpR46uIWX3irsTf32jG68OpzbR17P p8KluQTndP4PMelBAyvRs0k2HAJFcpyYaP5vLDIfeZIrUWWLCkLxoqZTBE9H6HXc NXPm+4EmDNt4phqjggOLQT6MyDvBF4y2uThsfijlvWZDHAkjWT70cziI9/P8vPM4 rp8Fcr1dnauYrVqUanwyLJ6PPYFbzvGgY076N3XvzgDSSFqAGY9birxtYWcBONRF pBG5t0U4xz7xyUV6ssdf+MnOYdP70pdbfv2jr5W5N58VxnzKWdu6FPP59PtWoqj/ gbt66EPejhF1iCdmxhP1106QLaZ98qBe3uPnG/DSw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrjeefgdejhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfgfhvffufffkgggtsehmtderredtre dtnecuhfhrohhmpeffohhughcuffgrvhhishcuoeguuggrvhhishesuggurghvihhsrdhi oheqnecuggftrfgrthhtvghrnhepudekjeejjeeliedvtedvudffhfdvfeduuddvtdeuvd fgkeeludffleefheethedunecukfhppedvgedrleekrdejiedrkedtnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepuggurghvihhsseguuggrvh hishdrihho X-ME-Proxy: Original-Received: from localhost (c-24-98-76-80.hsd1.ga.comcast.net [24.98.76.80]) by mail.messagingengine.com (Postfix) with ESMTPA id 72D80108005F for ; Wed, 17 Feb 2021 23:46:34 -0500 (EST) Received-SPF: pass client-ip=64.147.123.25; envelope-from=ddavis@ddavis.io; helo=wout2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:200233 Archived-At: --=-=-= Content-Type: text/plain This is my first stab at adding some interactive mode tagging for python.el. I think that the navigation functions are the best place to start; they have no use except on buffers where Python code exists and it's expected that python-mode is enabled. (sent in my copyright assignment paperwork today) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Do-interactive-mode-tagging-for-python.el-navigation.patch >From 945fa0b60174b168c7d928b36844ebe6c73bf253 Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Wed, 17 Feb 2021 23:37:00 -0500 Subject: [PATCH] Do interactive mode tagging for python.el navigation functions. * lisp/progmodes/python.el (navigation functions): add python-mode to `interactive' declarations for all interactive functions. --- lisp/progmodes/python.el | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index afb96974b1..7506043a19 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1506,7 +1506,7 @@ python-nav-beginning-of-defun (defun python-nav-end-of-defun () "Move point to the end of def or class. Returns nil if point is not in a def or class." - (interactive) + (interactive nil python-mode) (let ((beg-defun-indent) (beg-pos (point))) (when (or (python-info-looking-at-beginning-of-defun) @@ -1577,19 +1577,19 @@ python-nav-backward-defun "Navigate to closer defun backward ARG times. Unlikely `python-nav-beginning-of-defun' this doesn't care about nested definitions." - (interactive "^p") + (interactive "^p" python-mode) (python-nav--forward-defun (- (or arg 1)))) (defun python-nav-forward-defun (&optional arg) "Navigate to closer defun forward ARG times. Unlikely `python-nav-beginning-of-defun' this doesn't care about nested definitions." - (interactive "^p") + (interactive "^p" python-mode) (python-nav--forward-defun (or arg 1))) (defun python-nav-beginning-of-statement () "Move to start of current statement." - (interactive "^") + (interactive "^" python-mode) (forward-line 0) (let* ((ppss (syntax-ppss)) (context-point @@ -1613,7 +1613,7 @@ python-nav-end-of-statement Optional argument NOEND is internal and makes the logic to not jump to the end of line when moving forward searching for the end of the statement." - (interactive "^") + (interactive "^" python-mode) (let (string-start bs-pos (last-string-end 0)) (while (and (or noend (goto-char (line-end-position))) (not (eobp)) @@ -1654,7 +1654,7 @@ python-nav-end-of-statement (defun python-nav-backward-statement (&optional arg) "Move backward to previous statement. With ARG, repeat. See `python-nav-forward-statement'." - (interactive "^p") + (interactive "^p" python-mode) (or arg (setq arg 1)) (python-nav-forward-statement (- arg))) @@ -1662,7 +1662,7 @@ python-nav-forward-statement "Move forward to next statement. With ARG, repeat. With negative argument, move ARG times backward to previous statement." - (interactive "^p") + (interactive "^p" python-mode) (or arg (setq arg 1)) (while (> arg 0) (python-nav-end-of-statement) @@ -1677,7 +1677,7 @@ python-nav-forward-statement (defun python-nav-beginning-of-block () "Move to start of current block." - (interactive "^") + (interactive "^" python-mode) (let ((starting-pos (point))) (if (progn (python-nav-beginning-of-statement) @@ -1701,7 +1701,7 @@ python-nav-beginning-of-block (defun python-nav-end-of-block () "Move to end of current block." - (interactive "^") + (interactive "^" python-mode) (when (python-nav-beginning-of-block) (let ((block-indentation (current-indentation))) (python-nav-end-of-statement) @@ -1717,7 +1717,7 @@ python-nav-end-of-block (defun python-nav-backward-block (&optional arg) "Move backward to previous block of code. With ARG, repeat. See `python-nav-forward-block'." - (interactive "^p") + (interactive "^p" python-mode) (or arg (setq arg 1)) (python-nav-forward-block (- arg))) @@ -1725,7 +1725,7 @@ python-nav-forward-block "Move forward to next block of code. With ARG, repeat. With negative argument, move ARG times backward to previous block." - (interactive "^p") + (interactive "^p" python-mode) (or arg (setq arg 1)) (let ((block-start-regexp (python-rx line-start (* whitespace) block-start)) @@ -1878,7 +1878,7 @@ python-nav-forward-sexp argument SKIP-PARENS-P force sexp motion to ignore parenthesized expressions when looking at them in either direction (forced to t in interactive calls)." - (interactive "^p") + (interactive "^p" python-mode) (or arg (setq arg 1)) ;; Do not follow parens on interactive calls. This hack to detect ;; if the function was called interactively copes with the way @@ -1912,7 +1912,7 @@ python-nav-backward-sexp argument SKIP-PARENS-P force sexp motion to ignore parenthesized expressions when looking at them in either direction (forced to t in interactive calls)." - (interactive "^p") + (interactive "^p" python-mode) (or arg (setq arg 1)) (python-nav-forward-sexp (- arg) safe skip-parens-p)) @@ -1922,7 +1922,7 @@ python-nav-forward-sexp-safe backward N times. With optional argument SKIP-PARENS-P force sexp motion to ignore parenthesized expressions when looking at them in either direction (forced to t in interactive calls)." - (interactive "^p") + (interactive "^p" python-mode) (python-nav-forward-sexp arg t skip-parens-p)) (defun python-nav-backward-sexp-safe (&optional arg skip-parens-p) @@ -1931,7 +1931,7 @@ python-nav-backward-sexp-safe forward N times. With optional argument SKIP-PARENS-P force sexp motion to ignore parenthesized expressions when looking at them in either direction (forced to t in interactive calls)." - (interactive "^p") + (interactive "^p" python-mode) (python-nav-backward-sexp arg t skip-parens-p)) (defun python-nav--up-list (&optional dir) @@ -1977,7 +1977,7 @@ python-nav-up-list With ARG, do this that many times. A negative argument means move backward but still to a less deep spot. This command assumes point is not in a string or comment." - (interactive "^p") + (interactive "^p" python-mode) (or arg (setq arg 1)) (while (> arg 0) (python-nav--up-list 1) @@ -1991,7 +1991,7 @@ python-nav-backward-up-list With ARG, do this that many times. A negative argument means move forward but still to a less deep spot. This command assumes point is not in a string or comment." - (interactive "^p") + (interactive "^p" python-mode) (or arg (setq arg 1)) (python-nav-up-list (- arg))) @@ -1999,7 +1999,7 @@ python-nav-if-name-main "Move point at the beginning the __main__ block. When \"if __name__ == \\='__main__\\=':\" is found returns its position, else returns nil." - (interactive) + (interactive nil python-mode) (let ((point (point)) (found (catch 'found (goto-char (point-min)) -- 2.30.1 --=-=-=--