From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 28 11:36:21 2019 Received: (at submit) by debbugs.gnu.org; 28 Nov 2019 16:36:21 +0000 Received: from localhost ([127.0.0.1]:59052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iaMmC-0005sA-TM for submit@debbugs.gnu.org; Thu, 28 Nov 2019 11:36:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:46268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iaGj4-0000ZP-4f for submit@debbugs.gnu.org; Thu, 28 Nov 2019 05:08:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51105) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaGj2-0006Qu-3P for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2019 05:08:41 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaGiy-0000lb-RR for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2019 05:08:38 -0500 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]:34457) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iaGiy-0000NM-L4 for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2019 05:08:36 -0500 Received: by mail-il1-x12e.google.com with SMTP id p6so23797098ilp.1 for ; Thu, 28 Nov 2019 02:08:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=ifFimLlKj2lqrMFpWRzXQrqWgQmhJ0jYFD1A2+QoXBA=; b=avMPrTx0qhkh8UyQPYdxymLPUGcc1k5bDfSB4hhPqD+u04JBZtxxjf36KGL5Y/iON3 eyChVfyJ17mwYy5mG4yQWAOkkBH5SMh/ifGGdt3BNcQwEefHI7l0nK5QKxxlnTbZ/fT8 TS4g/ZoRCKFWvPJt/ADfgiWKVqlXW9Fg1Jm5Cr+434ICgYtmZzVIEGgSrTgiHqxqzxqW 0DAkFoBoosvAavwa/RQVeGgAknpbEkX+2SH5mHs0NWFoTFXxLNk/osJyheoIxE+qFuKD k7O9cNDQx2pIpWEznQN9rXpzJuqPoEy1VztEDaETjti9a+NqdHMlhcE2KI46mXXj0bTJ r/uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ifFimLlKj2lqrMFpWRzXQrqWgQmhJ0jYFD1A2+QoXBA=; b=Rnjgj/wPexOkkOCKUL7L5AnNsbX3q2Jhu8sY8N5NhGnzk5WXBv3v1V8BXquR6Vg3Lw Q+MX1e1YHmsBM8WT/CnObjRF2YQZ/3l1qEJzZ96vK5R37SyFzSglhkJ5pKVYnFU3FzlG SmqRYRMFmQ3OTUpng/0eGK8GRD4NgzDmrR+0TUW4RIzDe3VBVNDuCSeq/KuvbaiYPfE6 CqDEfgqhte4mY0DOodpZx9eBsViivRBzM2NiqGhO5xbvqknFWOOHhYjsQA/ic8uLhNnF yD/pjV5hsBoR4hPT8XTXbCuFzR7m8zPsrlUol5Gy0F+7yxbPJV8O4JW8iscC4SJg0jQt w38w== X-Gm-Message-State: APjAAAU0tl3JUQ+yDjeCcOtjlSAmALwCfTiZXd5FflyKJnpNAl9Jc2Pr WvC+Tmdn/RgZ3xeC6NL1EF/mS6toiTcVZe22BpO4G6anT1E= X-Google-Smtp-Source: APXvYqzO5udPeW9qL6dyn0dPucounPcl30nUKttBGyfgMQAMROwgDTyQV1QHzBkxH7QSIhgQQIjsK3xqrhCLYyIjNko= X-Received: by 2002:a05:6e02:8e7:: with SMTP id n7mr48038146ilt.302.1574935708819; Thu, 28 Nov 2019 02:08:28 -0800 (PST) MIME-Version: 1.0 From: Salvatore Filippone Date: Thu, 28 Nov 2019 10:08:17 +0000 Message-ID: Subject: f90.el matching END statements To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::12e X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 28 Nov 2019 11:36:20 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Dear All, I have recently run into an issue with f90.el, version 26.2 distributed with fedora 30. The issue is with the autocompletion feature; Fortran 2008 has introduced submodules; among the changes entailed by this, it is now possible to have a piece of code like the following: -------------------- interface module subroutine foo(bar) integer :: bar end subroutine foo end interface --------------------- Now, if I hit TAB on the first "end" the autocompletion feature tries to insert end module subroutine which is wrong, whereas I would like to insert end subroutine foo I have found a fix for this. I changed file f90.el:1385-1386 from ------------- ((and (not (looking-at "module[ \t]*procedure\\_>")) (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>")) -------------- to -------------- ((and (not (or (looking-at "module[ \t]*procedure\\_>") (looking-at "module[ \t]*subroutine\\_>"))) (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>")) --------------- and I got the desired behaviour. It is quite possible that somebody on this list will have a better solution, but this does the job. Hope this helps Salvatore Filippone From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 15 21:55:17 2020 Received: (at 38415-done) by debbugs.gnu.org; 16 Jan 2020 02:55:17 +0000 Received: from localhost ([127.0.0.1]:36576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1irvJV-00049n-4h for submit@debbugs.gnu.org; Wed, 15 Jan 2020 21:55:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38507) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1irvJT-00049X-SV for 38415-done@debbugs.gnu.org; Wed, 15 Jan 2020 21:55:16 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48077) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1irvJO-0007Gt-Li for 38415-done@debbugs.gnu.org; Wed, 15 Jan 2020 21:55:10 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1irvJM-0007Ev-MI; Wed, 15 Jan 2020 21:55:09 -0500 From: Glenn Morris To: 38415-done@debbugs.gnu.org Subject: Re: bug#38415: f90.el matching END statements References: X-Spook: Swine nitrate Illegal immigrants Infection hackers Soviet X-Ran: j6 (Salvatore Filippone's message of "Thu, 28 Nov 2019 10:08:17 +0000") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 38415-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Version: 27.1 Thanks for the report. I think this fixes it: commit 3b0d1a5 Date: Wed Jan 15 18:47:51 2020 -0800 f90: handle F2008 module function * lisp/progmodes/f90.el (f90-font-lock-keywords-1) (f90-looking-at-program-block-start): Handle F2008 "module function" and subroutine. (Bug#38415) * test/lisp/progmodes/f90-tests.el (f90-test-bug38415): New test. diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 92fba1c..9f61b8a 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -539,8 +539,10 @@ f90-font-lock-keywords-1 read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t)) ;; Other functions and declarations. Named interfaces = F2003. ;; F2008: end submodule submodule_name. - '("\\_<\\(\\(?:end[ \t]*\\)?\\(program\\|\\(?:sub\\)?module\\|\ -function\\|associate\\|subroutine\\|interface\\)\\|use\\|call\\)\ + ;; F2008: module function|subroutine NAME. + '("\\_<\\(\\(?:end[ \t]*\\)?\\(program\\|\ +\\(?:module[ \t]*\\)?\\(?:function\\|subroutine\\)\\|\ +\\(?:sub\\)?module\\|associate\\|interface\\)\\|use\\|call\\)\ \\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?" (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) ;; F2008: submodule (parent_name) submodule_name. @@ -1381,14 +1383,19 @@ f90-looking-at-program-block-start (cond ((looking-at "\\(program\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>") (list (match-string 1) (match-string 2))) - ((and (not (looking-at "module[ \t]*procedure\\_>")) + ((and (not (looking-at "module[ \t]*\\(procedure\\|function\\|subroutine\\)\\_>")) (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>")) (list (match-string 1) (match-string 2))) ((looking-at "\\(submodule\\)[ \t]*([^)\n]+)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>") (list (match-string 1) (match-string 2))) - ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)")) - (looking-at "[^!'\"&\n]*\\(function\\|subroutine\\)[ \t]+\ + ((and (not (looking-at "end[ \t]*\\(function\\|procedure\\|subroutine\\)")) + (looking-at "[^!'\"&\n]*\\(?:module[ \t]*\\)?\ +\\(function\\|subroutine\\)[ \t]+\ \\(\\(?:\\sw\\|\\s_\\)+\\)")) + ;; TODO: In F2008 "module procedure foo" may or may not start a block, + ;; It is impossible to tell the difference without parsing state. +;;; (looking-at "[^!'\"&\n]*module[ \t]*\\(procedure\\)[ \t]+\ +;;;\\(\\(?:\\sw\\|\\s_\\)+\\)"))) (list (match-string 1) (match-string 2))))) ;; Following will match an un-named main program block; however ;; one needs to check if there is an actual PROGRAM statement after diff --git a/test/lisp/progmodes/f90-tests.el b/test/lisp/progmodes/f90-tests.el index 540082c..b6fbac3 100644 --- a/test/lisp/progmodes/f90-tests.el +++ b/test/lisp/progmodes/f90-tests.el @@ -277,4 +277,24 @@ f90-test-indent (forward-line -2) (should (= 2 (current-indentation))))) ; type is +(ert-deftest f90-test-bug38415 () + "Test for https://debbugs.gnu.org/38415 ." + (with-temp-buffer + (f90-mode) + (setq-local f90-smart-end 'no-blink) + (insert "module function foo(x) +real :: x +end") + (f90-indent-line) + (should (equal " function foo" + (buffer-substring (point) (line-end-position)))) + (goto-char (point-max)) + (insert "\nmodule subroutine bar(x) +real :: x +end") + (f90-indent-line) + (should (equal " subroutine bar" + (buffer-substring (point) (line-end-position)))))) + + ;;; f90-tests.el ends here From unknown Fri Jun 20 18:18:38 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 13 Feb 2020 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator