.emacs-my
changeset 1497 9a881de3da24
parent 1494 874f705f7be4
child 1500 6401d60fd71e
equal deleted inserted replaced
1496:4b336f352950 1497:9a881de3da24
  3197   (setq-local company-backends '((company-semantic company-capf company-dabbrev-code)))
  3197   (setq-local company-backends '((company-semantic company-capf company-dabbrev-code)))
  3198   (company-mode 1))
  3198   (company-mode 1))
  3199 (when (and (featurep 'semantic) (featurep 'company))
  3199 (when (and (featurep 'semantic) (featurep 'company))
  3200   (add-hook 'java-mode-hook #'my/company-java-setup))
  3200   (add-hook 'java-mode-hook #'my/company-java-setup))
  3201 
  3201 
       
  3202 (defvar my/java-exeption-dirs nil
       
  3203   "List of dirs to look by `my/java-exeption'.")
       
  3204 
       
  3205 (defun my/java-exeption ()
       
  3206   "Look at current line if it like Java exaption and try find file using `my/java-exeption-dirs'"
       
  3207   (interactive)
       
  3208   (save-excursion
       
  3209     (let ( path file line end )
       
  3210       (forward-line 1)
       
  3211       (backward-char 1)
       
  3212       (setq end (point))
       
  3213       (forward-line 0)
       
  3214       (if (not (re-search-forward "^\\s-+at \\([a-zA-Z0-9.$]+\\)(\\([^.]+\\)\\.java:\\([1-9][0-9]*\\))" end t))
       
  3215           (message "Current line doesn't look like Java exeption or lack necessary information...")
       
  3216         (setq file (match-string 2))
       
  3217         (setq line (match-string 3))
       
  3218         (setq path (match-string 1))
       
  3219         (setq path (replace-regexp-in-string (concat "\\." file ".*") "" path))
       
  3220         (setq path (replace-regexp-in-string "\\." "/" path))
       
  3221         (setq path (cl-some (lambda (dir)
       
  3222                               (let ((full-path (format "%s/%s/%s.java" dir path file)))
       
  3223                                 (when (file-exists-p full-path) full-path)))
       
  3224                             my/java-exeption-dirs))
       
  3225         (if (not path)
       
  3226             (message "Can't find file %s.java" file)
       
  3227           (find-file-other-window path)
       
  3228           (goto-line (string-to-int line)))))))
       
  3229 
       
  3230 (my--eval-after-load log4-hi-mode
       
  3231   (define-key log4-hi-mode-map [C-return] #'my/java-exeption))
       
  3232 
  3202 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3233 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3203 (message "Pascal")
  3234 (message "Pascal")
  3204 
  3235 
  3205 (eval-when 'compile (require 'pascal))
  3236 (eval-when 'compile (require 'pascal))
  3206 
  3237