Subject: bug#14402: closed (Re: bug#14402: Imenu does not work any more on trunk)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 15 May 2013 00:54:02 +0000

Your bug report

#14402: f90-mode broken in multiple ways by trunk r112519

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
14402: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14402
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#14402: Imenu does not work any more on trunk
From: Stefan Monnier <[email-masked]>
To: Glenn Morris <[email-masked]>
Cc: [email-masked], Angelo Graziosi <[email-masked]>
Date: Tue, 14 May 2013 20:53:20 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

>> C-x C-f foo.f90 RET
>> program foo
>> end<TAB>
>> it should complete in "end program foo" instead it stays to "end".
>> "end" is only indented,

I just installed the patch below which seems to fix this.

> This is all breakage from r112519.
> Specifically, f90-looking-at-program-block-end is broken (and who knows
> what else).

Interestingly, the bug was caused by the fact that the old code relied
on a bug in the handling of the \> regexp: more specifically \> treated
(string-match "ab\\>?" foo) as (string-match "a\\(?:b\\>\\)?" foo)
instead of the expected (string-match "ab\\(?:\\>\\)?" foo).

        Stefan

=== modified file 'lisp/progmodes/f90.el'
--- lisp/progmodes/f90.el	2013-05-14 19:29:35 +0000
+++ lisp/progmodes/f90.el	2013-05-15 00:40:06 +0000
@@ -842,14 +842,14 @@
 
 ;; Regexps for finding program structures.
 (defconst f90-blocks-re
-  (concat "\\(block[ \t]*data\\|"
+  (concat "\\(\\(?:block[ \t]*data\\|"
           (regexp-opt '("do" "if" "interface" "function" "module" "program"
                         "select" "subroutine" "type" "where" "forall"
                         ;; F2003.
                         "enum" "associate"
                         ;; F2008.
                         "submodule" "block" "critical"))
-          "\\)\\_>")
+          "\\)\\_>\\)")
   "Regexp potentially indicating a \"block\" of F90 code.")
 
 (defconst f90-program-block-re

Subject: Imenu does not work any more on trunk
From: Angelo Graziosi <[email-masked]>
To: bug-emacs <[email-masked]>
Cc: Stefan Monnier <[email-masked]>
Date: Tue, 14 May 2013 19:36:37 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

The trunk revision #112579 shows an issue *very* similar to that 
described in bug #9199 [*]: same way to reproduce it, same result.

In my ~/.emacs.d/init.el I have something like this:

;; c-mode
(add-hook 'c-mode-hook
	  '(lambda()
	     ;; No indent for open bracket
	     (c-set-offset 'substatement-open 0)

	     ;; Add index of func. to menu bar
	     (imenu-add-to-menubar "Functions")
	     )
	  )

[...]

;; f90-mode
(add-hook 'f90-mode-hook
	  '(lambda()
	     ;; Add index of func. to menu bar
	     (imenu-add-to-menubar "Program-Units")
	     )
	  )

[...]

(setq imenu-auto-rescan t)
(setq imenu-auto-rescan-maxout 500000)

[...]

This time the issue shows up also in other programming modes. The Emacs 
buffer displays this error message:

Error in menu-bar-update-hook (imenu-update-menubar): 
(wrong-type-argument stringp ("Types" f90-imenu-type-matcher 1))

This issue is not shown by rev. 112494 I have build on May 07, 2013.

Ciao,
   Angelo.

---
[*] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9199