aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-04-24 15:06:27 +0000
committerStefan Monnier2008-04-24 15:06:27 +0000
commit5d16fdd706141e307e6cd01df1232e68e41b4be9 (patch)
tree0711196365edd9e243798c261e621b8e95cccd8f
parent8b026efe106f29ccaa539cba0a1ac5d2b9d74cf1 (diff)
downloademacs-5d16fdd706141e307e6cd01df1232e68e41b4be9.tar.gz
emacs-5d16fdd706141e307e6cd01df1232e68e41b4be9.zip
(f90-mode-syntax-table): Don't set ` as word syntax.
(f90-mode-abbrev-table): Use the new :regexp feature. Merge defvar and mapc into define-abbrev-table. (f90-imenu-type-matcher): Remove unused `l'. (f90-imenu-generic-expression): Remove unused `not-ib'. (f90-prepare-abbrev-list-buffer): Use with-current-buffer. (f90-change-keywords): Use restore-buffer-modified-p.
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/progmodes/f90.el155
2 files changed, 86 insertions, 83 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5a66b24a547..06471e1e5e9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12008-04-24 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/f90.el (f90-mode-syntax-table): Don't set ` as word syntax.
4 (f90-mode-abbrev-table): Use the new :regexp feature.
5 Merge defvar and mapc into define-abbrev-table.
6 (f90-imenu-type-matcher): Remove unused `l'.
7 (f90-imenu-generic-expression): Remove unused `not-ib'.
8 (f90-prepare-abbrev-list-buffer): Use with-current-buffer.
9 (f90-change-keywords): Use restore-buffer-modified-p.
10
12008-04-24 Glenn Morris <rgm@gnu.org> 112008-04-24 Glenn Morris <rgm@gnu.org>
2 12
3 * net/goto-addr.el (goto-address-prog-mode): 13 * net/goto-addr.el (goto-address-prog-mode):
@@ -20,8 +30,8 @@
20 30
212008-04-24 Tom Tromey <tromey@redhat.com> 312008-04-24 Tom Tromey <tromey@redhat.com>
22 32
23 * emacs-lisp/easy-mmode.el (easy-mmode-define-keymap): Document 33 * emacs-lisp/easy-mmode.el (easy-mmode-define-keymap):
24 keywords. Add :suppress. 34 Document keywords. Add :suppress.
25 * pcvs-defs.el (cvs-mode-map): Use :suppress. 35 * pcvs-defs.el (cvs-mode-map): Use :suppress.
26 36
27 * net/goto-addr.el (goto-address-unfontify): New function. 37 * net/goto-addr.el (goto-address-unfontify): New function.
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index 7346c77de5a..38f3bacf002 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -623,10 +623,13 @@ Can be overridden by the value of `font-lock-maximum-decoration'.")
623 (let ((table (make-syntax-table))) 623 (let ((table (make-syntax-table)))
624 (modify-syntax-entry ?\! "<" table) ; begin comment 624 (modify-syntax-entry ?\! "<" table) ; begin comment
625 (modify-syntax-entry ?\n ">" table) ; end comment 625 (modify-syntax-entry ?\n ">" table) ; end comment
626 ;; FIXME: This goes against the convention: it should be "_".
626 (modify-syntax-entry ?_ "w" table) ; underscore in names 627 (modify-syntax-entry ?_ "w" table) ; underscore in names
627 (modify-syntax-entry ?\' "\"" table) ; string quote 628 (modify-syntax-entry ?\' "\"" table) ; string quote
628 (modify-syntax-entry ?\" "\"" table) ; string quote 629 (modify-syntax-entry ?\" "\"" table) ; string quote
629 (modify-syntax-entry ?\` "w" table) ; for abbrevs 630 ;; FIXME: We used to set ` to word syntax for the benefit of abbrevs, but
631 ;; we do not need it any more. Not sure if it should be "_" or "." now.
632 (modify-syntax-entry ?\` "_" table)
630 (modify-syntax-entry ?\r " " table) ; return is whitespace 633 (modify-syntax-entry ?\r " " table) ; return is whitespace
631 (modify-syntax-entry ?+ "." table) ; punctuation 634 (modify-syntax-entry ?+ "." table) ; punctuation
632 (modify-syntax-entry ?- "." table) 635 (modify-syntax-entry ?- "." table)
@@ -866,7 +869,7 @@ Used in the F90 entry in `hs-special-modes-alist'.")
866(defun f90-imenu-type-matcher () 869(defun f90-imenu-type-matcher ()
867 "Search backward for the start of a derived type. 870 "Search backward for the start of a derived type.
868Set subexpression 1 in the match-data to the name of the type." 871Set subexpression 1 in the match-data to the name of the type."
869 (let (found l) 872 (let (found)
870 (while (and (re-search-backward "^[ \t0-9]*type[ \t]*" nil t) 873 (while (and (re-search-backward "^[ \t0-9]*type[ \t]*" nil t)
871 (not (setq found 874 (not (setq found
872 (save-excursion 875 (save-excursion
@@ -881,7 +884,8 @@ Set subexpression 1 in the match-data to the name of the type."
881(defvar f90-imenu-generic-expression 884(defvar f90-imenu-generic-expression
882 (let ((good-char "[^!\"\&\n \t]") (not-e "[^e!\n\"\& \t]") 885 (let ((good-char "[^!\"\&\n \t]") (not-e "[^e!\n\"\& \t]")
883 (not-n "[^n!\n\"\& \t]") (not-d "[^d!\n\"\& \t]") 886 (not-n "[^n!\n\"\& \t]") (not-d "[^d!\n\"\& \t]")
884 (not-ib "[^i(!\n\"\& \t]") (not-s "[^s!\n\"\& \t]")) 887 ;; (not-ib "[^i(!\n\"\& \t]") (not-s "[^s!\n\"\& \t]")
888 )
885 (list 889 (list
886 '(nil "^[ \t0-9]*program[ \t]+\\(\\sw+\\)" 1) 890 '(nil "^[ \t0-9]*program[ \t]+\\(\\sw+\\)" 1)
887 '("Modules" "^[ \t0-9]*module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1) 891 '("Modules" "^[ \t0-9]*module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1)
@@ -922,81 +926,71 @@ Set subexpression 1 in the match-data to the name of the type."
922 926
923 927
924;; Abbrevs have generally two letters, except standard types `c, `i, `r, `t. 928;; Abbrevs have generally two letters, except standard types `c, `i, `r, `t.
925(defvar f90-mode-abbrev-table 929(define-abbrev-table 'f90-mode-abbrev-table
926 (progn 930 (mapcar (lambda (e) (list (car e) (cdr e) nil :system t))
927 (define-abbrev-table 'f90-mode-abbrev-table nil) 931 '(("`al" . "allocate" )
928 f90-mode-abbrev-table) 932 ("`ab" . "allocatable" )
929 "Abbrev table for F90 mode.") 933 ("`ai" . "abstract interface")
930 934 ("`as" . "assignment" )
931;; Not in defvar because user abbrevs may be restored before this file loads. 935 ("`asy" . "asynchronous" )
932(mapc 936 ("`ba" . "backspace" )
933 (lambda (e) 937 ("`bd" . "block data" )
934 (condition-case nil 938 ("`c" . "character" )
935 (define-abbrev f90-mode-abbrev-table (car e) (cdr e) nil :count 0 939 ("`cl" . "close" )
936 :system t) 940 ("`cm" . "common" )
937 (wrong-number-of-arguments ; Emacs 22 941 ("`cx" . "complex" )
938 (define-abbrev f90-mode-abbrev-table (car e) (cdr e) nil 0 t)))) 942 ("`cn" . "contains" )
939 '(("`al" . "allocate" ) 943 ("`cy" . "cycle" )
940 ("`ab" . "allocatable" ) 944 ("`de" . "deallocate" )
941 ("`ai" . "abstract interface") 945 ("`df" . "define" )
942 ("`as" . "assignment" ) 946 ("`di" . "dimension" )
943 ("`asy" . "asynchronous" ) 947 ("`dp" . "double precision")
944 ("`ba" . "backspace" ) 948 ("`dw" . "do while" )
945 ("`bd" . "block data" ) 949 ("`el" . "else" )
946 ("`c" . "character" ) 950 ("`eli" . "else if" )
947 ("`cl" . "close" ) 951 ("`elw" . "elsewhere" )
948 ("`cm" . "common" ) 952 ("`em" . "elemental" )
949 ("`cx" . "complex" ) 953 ("`e" . "enumerator" )
950 ("`cn" . "contains" ) 954 ("`eq" . "equivalence" )
951 ("`cy" . "cycle" ) 955 ("`ex" . "external" )
952 ("`de" . "deallocate" ) 956 ("`ey" . "entry" )
953 ("`df" . "define" ) 957 ("`fl" . "forall" )
954 ("`di" . "dimension" ) 958 ("`fo" . "format" )
955 ("`dp" . "double precision") 959 ("`fu" . "function" )
956 ("`dw" . "do while" ) 960 ("`fa" . ".false." )
957 ("`el" . "else" ) 961 ("`im" . "implicit none")
958 ("`eli" . "else if" ) 962 ("`in" . "include" )
959 ("`elw" . "elsewhere" ) 963 ("`i" . "integer" )
960 ("`em" . "elemental" ) 964 ("`it" . "intent" )
961 ("`e" . "enumerator" ) 965 ("`if" . "interface" )
962 ("`eq" . "equivalence" ) 966 ("`lo" . "logical" )
963 ("`ex" . "external" ) 967 ("`mo" . "module" )
964 ("`ey" . "entry" ) 968 ("`na" . "namelist" )
965 ("`fl" . "forall" ) 969 ("`nu" . "nullify" )
966 ("`fo" . "format" ) 970 ("`op" . "optional" )
967 ("`fu" . "function" ) 971 ("`pa" . "parameter" )
968 ("`fa" . ".false." ) 972 ("`po" . "pointer" )
969 ("`im" . "implicit none") 973 ("`pr" . "print" )
970 ("`in" . "include" ) 974 ("`pi" . "private" )
971 ("`i" . "integer" ) 975 ("`pm" . "program" )
972 ("`it" . "intent" ) 976 ("`pr" . "protected" )
973 ("`if" . "interface" ) 977 ("`pu" . "public" )
974 ("`lo" . "logical" ) 978 ("`r" . "real" )
975 ("`mo" . "module" ) 979 ("`rc" . "recursive" )
976 ("`na" . "namelist" ) 980 ("`rt" . "return" )
977 ("`nu" . "nullify" ) 981 ("`rw" . "rewind" )
978 ("`op" . "optional" ) 982 ("`se" . "select" )
979 ("`pa" . "parameter" ) 983 ("`sq" . "sequence" )
980 ("`po" . "pointer" ) 984 ("`su" . "subroutine" )
981 ("`pr" . "print" ) 985 ("`ta" . "target" )
982 ("`pi" . "private" ) 986 ("`tr" . ".true." )
983 ("`pm" . "program" ) 987 ("`t" . "type" )
984 ("`pr" . "protected" ) 988 ("`vo" . "volatile" )
985 ("`pu" . "public" ) 989 ("`wh" . "where" )
986 ("`r" . "real" ) 990 ("`wr" . "write" )))
987 ("`rc" . "recursive" ) 991 "Abbrev table for F90 mode."
988 ("`rt" . "return" ) 992 ;; Accept ` as the first char of an abbrev. Also allow _ in abbrevs.
989 ("`rw" . "rewind" ) 993 :regexp "\\(?:[^[:word:]_`]\\|^\\)\\(`?[[:word:]_]+\\)[^[:word:]_]*")
990 ("`se" . "select" )
991 ("`sq" . "sequence" )
992 ("`su" . "subroutine" )
993 ("`ta" . "target" )
994 ("`tr" . ".true." )
995 ("`t" . "type" )
996 ("`vo" . "volatile" )
997 ("`wh" . "where" )
998 ("`wr" . "write" )))
999
1000 994
1001;;;###autoload 995;;;###autoload
1002(defun f90-mode () 996(defun f90-mode ()
@@ -2102,8 +2096,7 @@ Any other key combination is executed normally."
2102 2096
2103(defun f90-prepare-abbrev-list-buffer () 2097(defun f90-prepare-abbrev-list-buffer ()
2104 "Create a buffer listing the F90 mode abbreviations." 2098 "Create a buffer listing the F90 mode abbreviations."
2105 (save-excursion 2099 (with-current-buffer (get-buffer-create "*Abbrevs*")
2106 (set-buffer (get-buffer-create "*Abbrevs*"))
2107 (erase-buffer) 2100 (erase-buffer)
2108 (insert-abbrev-table-description 'f90-mode-abbrev-table t) 2101 (insert-abbrev-table-description 'f90-mode-abbrev-table t)
2109 (goto-char (point-min)) 2102 (goto-char (point-min))
@@ -2172,7 +2165,7 @@ CHANGE-WORD should be one of 'upcase-word, 'downcase-word, 'capitalize-word."
2172 (funcall change-word -1) 2165 (funcall change-word -1)
2173 (or (string= saveword (buffer-substring back-point ref-point)) 2166 (or (string= saveword (buffer-substring back-point ref-point))
2174 (setq modified t)))) 2167 (setq modified t))))
2175 (or modified (set-buffer-modified-p nil)))))) 2168 (or modified (restore-buffer-modified-p nil))))))
2176 2169
2177 2170
2178(defun f90-current-defun () 2171(defun f90-current-defun ()