Browse files

Personal: Add dome to oppdrag-mode, use fast-keys in expand region

  • Loading branch information...
1 parent f3beafc commit 3533dcb061499a68c3438c32e1ddcd3c2e071157 @magnars committed Mar 15, 2013
Showing with 2 additions and 99 deletions.
  1. +1 −95 site-lisp/oppdrag-mode.el
  2. +0 −4 users/fimasvee/init.el
  3. +1 −0 users/fimasvee/project-mappings.el
View
96 site-lisp/oppdrag-mode.el
@@ -45,7 +45,7 @@ in an exploded war, re-deploy the file."
(defun oppdrag--setup-js-quirks ()
(when (string-match-p "oppdrag-services" (buffer-file-name))
(fci-mode 1)
- (setq js2-additional-externs '("FINN" "testCase" "cull" "bane"))
+ (setq js2-additional-externs '("FINN" "testCase" "cull" "dome" "bane"))
(setq js2r-path-to-tests "/test/javascript/tests/")
(setq js2r-path-to-sources "/main/webapp/oppdrag/scripts/")
(setq js2r-test-suffix "Test")
@@ -64,99 +64,5 @@ in an exploded war, re-deploy the file."
(add-hook 'js2-mode-hook 'oppdrag--setup-js-quirks)
-(defun strapon-transform-mod ()
- (interactive)
- (save-excursion
- (let (internal extra-bg beg)
- (end-of-line)
- (search-backward "class=\"mod")
- (search-forward "mod mod")
- (setq internal (looking-at "_2nd"))
- (setq extra-bg (cond
- ((looking-at "_3rd") " bg-pale-blue")
- ((looking-at "Att") " bg-pissyellow")
- ((looking-at "Tip") " bg-snotgreen")
- ((looking-at "Admin") " bg-firm contrast")
- ((looking-at "Neutral") " bg-lt-gray")
- (t "")))
- (er/mark-symbol)
- (delete-region (region-beginning) (region-end))
- (delete-char -1)
- (when internal
- (insert " internal"))
- (setq beg (point))
- (search-forward ">")
- (er/mark-inner-tag)
- (kill-region (region-beginning) (region-end))
- (newline)
- (insert "<div class=\"inner" extra-bg "\">")
- (yank)
- (insert "</div>")
- (newline)
- (indent-region beg (1+ (point))))))
-
-(defun strapon-transform-request-mapping ()
- (interactive)
- (save-excursion
- (let (method-name method-signature beg)
- (end-of-line)
-
- (search-backward "@RequestMapping")
- (forward-line 1)
- (search-forward "(")
- (er/mark-inside-pairs)
- (setq method-signature
- (let (case-fold-search)
- (--> (buffer-substring (region-beginning) (region-end))
- (split-string it "\\s ")
- (--select (s-matches? "^[a-z]" it) it)
- (--reject (s-matches? "long" it) it)
- (s-join " " it)
- (s-collapse-whitespace it))))
- (deactivate-mark)
-
- (forward-char -1)
- (er/mark-symbol)
- (setq method-name (buffer-substring (region-beginning) (region-end)))
- (deactivate-mark)
-
- (search-backward "@RequestMapping")
- (setq beg (point))
- (search-forward "{")
- (while (er--point-inside-string-p)
- (search-forward "{"))
- (copy-region-as-kill beg (point))
- (goto-char beg)
-
- (new-line-above)
- (new-line-above)
- (let ((p (point)))
- (yank)
-
- (insert "
- model.addAttribute(\"strappedOn\", true);
- return " method-name "(" method-signature ") + \"-strapon\";
- }")
-
- (search-backward "@RequestMapping")
- (search-forward "\.")
- (replace-match "-strapon.")
-
- (forward-line 1)
- (search-forward "(")
- (replace-match "Strapon(")
- (search-forward "@RequestMapping")
- (indent-region p (point))))))
-
-(defun strapon-create-strapon-jsp ()
- (interactive)
- (write-file
- (s-replace ".jsp" "-strapon.jsp" (buffer-file-name))
- t))
-
-(f6 (strapon-transform-mod))
-(f7 (strapon-transform-request-mapping))
-(f12 (strapon-create-strapon-jsp))
-
(provide 'oppdrag-mode)
;;; oppdrag-mode.el ends here
View
4 users/fimasvee/init.el
@@ -2,10 +2,6 @@
(setq-default js2-basic-offset 2)
(setq js-indent-level 2)
-;; My taste in expand-region behavior
-(setq expand-region-fast-keys-enabled nil)
-(setq er--show-expansion-message t)
-
;; Disallow scrolling with mouse wheel
(mouse-wheel-mode -1)
View
1 users/fimasvee/project-mappings.el
@@ -200,6 +200,7 @@
(defun custom-persp/adventur-master ()
(interactive)
(custom-persp "adventur-master"
+ (require 'adventur-mode)
(find-file "~/projects/eventyr/master/notat.org")))
(define-key persp-mode-map (kbd "C-x p m") 'custom-persp/adventur-master)

0 comments on commit 3533dcb

Please sign in to comment.