I finally got round to doing something about automatic case adjustment in GPRs.

Below is a first hack, not yet even incorporated in my .emacs.

Two gotchas:

(1) I’ve been using Project’Project_Dir to access the current directory, useful 
because compiling & linking are done from the Object_Dir:

     for Runtime ("ada") use Project'Project_Dir & "../arduino-due”;

     package Linker is
        for Map_File_Option use "-Wl,-Map," & Project'Project_Dir;
     end Linker;

   but “project” is now a keyword, & ends up in lower case. It turns out you 
can use the actual project name instead.

(2) “external_as_list” is a keyword for GPR but not for Ada! It ends up as 
“External_As_list”. I ended up making it a full case exception.

================
;;; gpr-hook.el
;;; adding casing to gpr-mode.

(require 'gpr-mode)

(defconst gpr-keywords
 '(
   "abstract"
   "aggregate"
   "case"
   "configuration"
   "end"
   "extends"
   "external"
   "external_as_list"
   "for"
   "is"
   "library"
   "limited"
   "null"
   "others"
   "package"
   "project"
   "renames"
   "standard"
   "type"
   "use"
   "when"
   )
 "List of GPR-mode keywords.")

(defun my-gpr-hook-function ()
 "Set gpr-mode up for casing."
 (ada-case-activate-keys gpr-mode-map)
 (set (make-local-variable 'ada-keywords) gpr-keywords)
 )

(add-hook 'gpr-mode-hook 'my-gpr-hook-function)


_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to