emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r99727: Close bug#1835.


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r99727: Close bug#1835.
Date: Fri, 09 Apr 2010 19:12:03 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99727
committer: Glenn Morris <address@hidden>
branch nick: emacs-23
timestamp: Fri 2010-04-09 19:12:03 -0700
message:
  Close bug#1835.
  
  * progmodes/fortran.el (fortran-match-and-skip-declaration):
  New function.
  (fortran-font-lock-keywords-3): Use it.  (Bug#1835)
modified:
  lisp/ChangeLog
  lisp/progmodes/fortran.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-04-07 06:08:27 +0000
+++ b/lisp/ChangeLog    2010-04-10 02:12:03 +0000
@@ -1,3 +1,9 @@
+2010-04-10  Glenn Morris  <address@hidden>
+
+       * progmodes/fortran.el (fortran-match-and-skip-declaration):
+       New function.
+       (fortran-font-lock-keywords-3): Use it.  (Bug#1835)
+
 2010-04-07  Kenichi Handa  <address@hidden>
 
        * language/indian.el (malayalam-composable-pattern): Fix previous

=== modified file 'lisp/progmodes/fortran.el'
--- a/lisp/progmodes/fortran.el 2010-01-13 08:35:10 +0000
+++ b/lisp/progmodes/fortran.el 2010-04-10 02:12:03 +0000
@@ -403,6 +403,28 @@
            '("^ *\\([0-9]+\\)" . font-lock-constant-face)))
   "Medium level highlighting for Fortran mode.")
 
+;; See bug#1835. Never really looked into _why_ this matters...
+(defun fortran-match-and-skip-declaration (limit)
+  "Like `font-lock-match-c-style-declaration-item-and-skip-to-next'.
+The only difference is, it returns t in a case when the default returns nil."
+  (when (looking-at "[ \n\t*]*\\(\\sw+\\)[ \t\n]*\\(((?\\)?")
+    (when (and (match-end 2) (> (- (match-end 2) (match-beginning 2)) 1))
+      (let ((pos (point)))
+       (skip-chars-backward " \t\n")
+       (skip-syntax-backward "w")
+       (unless (looking-at "\\(\\sw+\\)[ \t\n]*\\sw+[ \t\n]*\\(((?\\)?")
+         (goto-char pos)
+         (looking-at "[ \n\t*]*\\(\\sw+\\)[ \t\n]*\\(((?\\)?"))))
+    (save-match-data
+      (condition-case nil
+         (save-restriction
+           (narrow-to-region (point-min) limit)
+           (goto-char (match-end 1))
+           (while (not (looking-at "[ \t\n]*\\(\\(,\\)\\|;\\|\\'\\)"))
+             (goto-char (or (scan-sexps (point) 1) (point-max))))
+            (goto-char (match-end 2)))
+       (error t)))))
+
 (defvar fortran-font-lock-keywords-3
   (append
    fortran-font-lock-keywords-1
@@ -412,7 +434,7 @@
           ;; Type specifier.
           '(1 font-lock-type-face)
           ;; Declaration item (or just /.../ block name).
-          `(font-lock-match-c-style-declaration-item-and-skip-to-next
+          `(fortran-match-and-skip-declaration
             ;; Start after any *(...) expression.
             (condition-case nil
                 (and (match-beginning ,(1+ (regexp-opt-depth


reply via email to

[Prev in Thread] Current Thread [Next in Thread]