I did some hacking today and put together a quick major-mode for fink .info files I know that others are working on this, but I thought it would be good to just get some code up, however crude. In emacs21 there's a nifty fink menu that validates the .info file. (M-x fink-validate)
I'm not much of a lisp coder, so if others want to correct bugs or rewrite substantial portions, I don't mind.



Here's a portion of my .emacs file. I put my working lisp code in ~/emacs.


(add-to-list 'load-path "~/emacs")
(autoload 'fink-mode "fink-mode" "Fink info file editing mode." t)
(setq auto-mode-alist
        (append (list (cons "\\.info$" 'fink-mode))
               auto-mode-alist))
(add-hook `fink-mode-hook `turn-on-font-lock)


---fink-mode.el--


(defvar fink-startup-message t
  "*Non-nil means display a message when fink mode is loaded.")
(defconst fink-mode-version "0.1")

(defvar fink-mode-abbrev-table nil)

(defvar fink-mode-map nil
  "Keymap used in fink mode.")

(defconst fink-keywords
'("Package" "Version" "Revision" "Epoch" "Description" "Type"
"License" "Maintainer" "Depends" "BuildDepends" "Provides"
"Conflicts" "Replaces" "Recomends" "Suggests" "Enhances" "Pre-Depends"
"Essential" "Build" "BuildDependsOnly" "CustomMirror" "Source"
"SourceDirectory" "NoSourceDirectory" "SourceRename" "Source-MD5"
"TarFilesRename" "UpdateConfigGuess" "UpdateConfigGuessInDirs"
"UpdateLibtool" "UpdateLibtoolInDirs" "UpdatePoMakefile" "Patch"
"PatchScript" "SetENVVAR" "NoSetENVVAR" "ConfigureParams" "GCC"
"CompileScript" "NoPerlTests" "UpdatePOD" "InstallScript" "JarFiles"
"DocFiles" "Shlibs" "RuntimeVars" "SplitOff" "Files" "PreInstScript"
"PostInstScript" "PreRmScript" "PostRmScript" "ConfFiles" "InfoDocs"
"DaemonicFile" "DaemonicName" "Homepage" "DescDetail" "DescUsage"
"DescPackaging" "DescPort"
)
"List of Fink Field Names")


(defconst fink-keywords-regexp
  (concat "\\<\\(" (regexp-opt fink-keywords) "\\)\\>")
  "Regexp for Fink keywords.")

(defvar fink-font-lock-keywords
  (list
   ;; highlight keywords
   (list fink-keywords-regexp 1 'font-lock-keyword-face))
"Regular expressions to highlight in Fink Mode.")


(defun fink-validate () "Validate the info file." (interactive) (shell-command (concat "fink validate " buffer-file-name)) )


(defun fink-mode () "Major mode for editing fink programs." (interactive) ;; (if fink-startup-message (message "Emacs fink mode version %s by Jeremy Erwin." fink-mode-version) )

(kill-all-local-variables)
(setq major-mode 'fink-mode)
(setq mode-name "Fink")
;(setq local-abbrev-table fink-mode-abbrev-table)
;(set-syntax-table fink-mode-syntax-table)


(require 'font-lock) (set (make-local-variable 'font-lock-defaults) fink-font-lock-keywords) (turn-on-font-lock)

(define-key global-map [menu-bar fink]
  (cons "Fink" (make-sparse-keymap "Fink")))

;; Define specific subcommands in this menu.
(define-key global-map
  [menu-bar fink validate]
  '("Validate Buffer" . fink-validate))

;;(defvar menu-bar-fink (make-sparse-keymap "Fink"))
;;(define-key global-map
 ;;     [menu-bar-fink validate]
 ;;     '("Validate buffer" . fink-validate))

(run-hooks 'fink-mode-hook))

(provide 'fink-mode)
---------



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to