Permalink
Browse files

Define add-import-languages, and a function find-language which deter…

…mines the current buffer's language based on the name of the Major Mode.
  • Loading branch information...
1 parent 3449b52 commit e241cae5918e58e2fa3dd38c14fe0c9ccb77582e @wfarr committed Apr 23, 2009
Showing with 19 additions and 0 deletions.
  1. +19 −0 add-import.el
View
@@ -2,6 +2,25 @@
(require 'thingatpt)
+(defvar add-import-languages
+ '(
+ ;; (lang . '(finder getter keyword wrapper ending_punctuation))
+ (perl . ("[:alpha:]:\\->" "[[:alpha:]:]+" "use" nil ";"))
+ (ruby . ("[:alpha:]:" "[[:alpha:]:]+" "require" "'" nil))
+ )
+ )
+
+(defun find-language ()
+ ;; check major mode
+ (cond (major-mode
+ (let* ((current-mode (symbol-name major-mode)))
+ (string-match "^\\([[:alpha:]-]+\\)\\-mode" current-mode)
+ (match-string 1 current-mode))))
+;;TODO
+;; check file extension
+;; check shebang
+)
+
(defun bounds-of-module-at-point ()
"Determine where a module name starts for (thing-at-point 'perl-module)"
(save-excursion

0 comments on commit e241cae

Please sign in to comment.