Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (require 'smalltalk-mode)
- (setq auto-mode-alist
- (append '(("\\.st\\'" . smalltalk-mode))
- auto-mode-alist))
- (defun smalltalk-narrow-to-object ()
- ;;(interactive)
- (let* ((from (save-excursion (or (search-backward "! !" (point-min) t) (point-min))))
- (to (save-excursion (or (progn (search-forward "! !" (point-max) t)) (point-max)))))
- (narrow-to-region from to)))
- (defun go-to-next-class ()
- (interactive)
- (widen)
- (let ((to (save-excursion (or (search-forward "! !" (point-max) t) (point-max)))))
- (when (not (= to (point-max)))
- (search-forward "! !" (point-max) t)
- (re-search-forward "^\\w" (point-max) t))
- (smalltalk-narrow-to-object)))
- (defun go-to-prev-class ()
- (interactive)
- (widen)
- (let ((to (save-excursion (or (search-backward "! !" (point-min) t) (point-min)))))
- (when (not (= to (point-min)))
- (search-backward "! !" (point-min) t)
- (re-search-backward "\\w" (point-min) t))
- (smalltalk-narrow-to-object)))
- (add-hook 'smalltalk-mode-hook
- (lambda ()
- (local-set-key (kbd "C-c n") 'go-to-next-class)
- (local-set-key (kbd "C-c p") 'go-to-prev-class)
- (local-set-key (kbd "C-c a") 'widen)))
Add Comment
Please, Sign In to add comment