Mercurial > emacs
comparison lisp/progmodes/ada-mode.el @ 71924:c09c379b85d4
(ada-mode): Rewrite ff-special-constructs init.
author | Thien-Thi Nguyen <ttn@gnuvola.org> |
---|---|
date | Sun, 16 Jul 2006 21:11:47 +0000 |
parents | 2a4ed80e93ba |
children | e1bac685e6a0 02e39decdc84 8a8e69664178 |
comparison
equal
deleted
inserted
replaced
71923:6d714c43de54 | 71924:c09c379b85d4 |
---|---|
1206 'ada-search-directories-internal) | 1206 'ada-search-directories-internal) |
1207 (setq ff-post-load-hook 'ada-set-point-accordingly | 1207 (setq ff-post-load-hook 'ada-set-point-accordingly |
1208 ff-file-created-hook 'ada-make-body) | 1208 ff-file-created-hook 'ada-make-body) |
1209 (add-hook 'ff-pre-load-hook 'ada-which-function-are-we-in) | 1209 (add-hook 'ff-pre-load-hook 'ada-which-function-are-we-in) |
1210 | 1210 |
1211 ;; Some special constructs for find-file.el | 1211 ;; Some special constructs for find-file.el. |
1212 ;; We do not need to add the construction for 'with', which is in the | |
1213 ;; standard find-file.el | |
1214 (make-local-variable 'ff-special-constructs) | 1212 (make-local-variable 'ff-special-constructs) |
1215 | 1213 (mapc (lambda (pair) |
1216 ;; Go to the parent package : | 1214 (add-to-list 'ff-special-constructs pair)) |
1217 (add-to-list 'ff-special-constructs | 1215 `( |
1218 (cons (eval-when-compile | 1216 ;; Go to the parent package. |
1219 (concat "^\\(private[ \t]\\)?[ \t]*package[ \t]+" | 1217 (,(eval-when-compile |
1220 "\\(body[ \t]+\\)?" | 1218 (concat "^\\(private[ \t]\\)?[ \t]*package[ \t]+" |
1221 "\\(\\(\\sw\\|[_.]\\)+\\)\\.\\(\\sw\\|_\\)+[ \t\n]+is")) | 1219 "\\(body[ \t]+\\)?" |
1222 (lambda () | 1220 "\\(\\(\\sw\\|[_.]\\)+\\)\\.\\(\\sw\\|_\\)+[ \t\n]+is")) |
1223 (if (fboundp 'ff-get-file) | 1221 . ,(lambda () |
1224 (if (boundp 'fname) | 1222 (ff-get-file |
1225 (set 'fname (ff-get-file | 1223 ada-search-directories-internal |
1226 ada-search-directories-internal | 1224 (ada-make-filename-from-adaname (match-string 3)) |
1227 (ada-make-filename-from-adaname | 1225 ada-spec-suffixes))) |
1228 (match-string 3)) | 1226 ;; A "separate" clause. |
1229 ada-spec-suffixes))))))) | 1227 ("^separate[ \t\n]*(\\(\\(\\sw\\|[_.]\\)+\\))" |
1230 ;; Another special construct for find-file.el : when in a separate clause, | 1228 . ,(lambda () |
1231 ;; go to the correct package. | 1229 (ff-get-file |
1232 (add-to-list 'ff-special-constructs | 1230 ada-search-directories-internal |
1233 (cons "^separate[ \t\n]*(\\(\\(\\sw\\|[_.]\\)+\\))" | 1231 (ada-make-filename-from-adaname (match-string 1)) |
1234 (lambda () | 1232 ada-spec-suffixes))) |
1235 (if (fboundp 'ff-get-file) | 1233 ;; A "with" clause. |
1236 (if (boundp 'fname) | 1234 ("^with[ \t]+\\([a-zA-Z0-9_\\.]+\\)" |
1237 (setq fname (ff-get-file | 1235 . ,(lambda () |
1238 ada-search-directories-internal | 1236 (ff-get-file |
1239 (ada-make-filename-from-adaname | 1237 ada-search-directories-internal |
1240 (match-string 1)) | 1238 (ada-make-filename-from-adaname (match-string 1)) |
1241 ada-spec-suffixes))))))) | 1239 ada-spec-suffixes))) |
1242 | 1240 )) |
1243 ;; Another special construct, that redefines the one in find-file.el. The | |
1244 ;; old one can handle only one possible type of extension for Ada files | |
1245 ;; remove from the list the standard "with..." that is put by find-file.el, | |
1246 ;; since it uses the old ada-spec-suffix variable | |
1247 ;; This one needs to replace the standard one defined in find-file.el (with | |
1248 ;; Emacs <= 20.4), since that one uses the old variable ada-spec-suffix | |
1249 (let ((old-construct | |
1250 (assoc "^with[ \t]+\\([a-zA-Z0-9_\\.]+\\)" ff-special-constructs)) | |
1251 (new-cdr | |
1252 (lambda () | |
1253 (if (fboundp 'ff-get-file) | |
1254 (if (boundp 'fname) | |
1255 (set 'fname (ff-get-file | |
1256 ada-search-directories-internal | |
1257 (ada-make-filename-from-adaname | |
1258 (match-string 1)) | |
1259 ada-spec-suffixes))))))) | |
1260 (if old-construct | |
1261 (setcdr old-construct new-cdr) | |
1262 (add-to-list 'ff-special-constructs | |
1263 (cons "^with[ \t]+\\([a-zA-Z0-9_\\.]+\\)" | |
1264 new-cdr)))) | |
1265 | 1241 |
1266 ;; Support for outline-minor-mode | 1242 ;; Support for outline-minor-mode |
1267 (set (make-local-variable 'outline-regexp) | 1243 (set (make-local-variable 'outline-regexp) |
1268 "\\([ \t]*\\(procedure\\|function\\|package\\|if\\|while\\|for\\|declare\\|case\\|end\\|begin\\|loop\\)\\|--\\)") | 1244 "\\([ \t]*\\(procedure\\|function\\|package\\|if\\|while\\|for\\|declare\\|case\\|end\\|begin\\|loop\\)\\|--\\)") |
1269 (set (make-local-variable 'outline-level) 'ada-outline-level) | 1245 (set (make-local-variable 'outline-level) 'ada-outline-level) |