88 lines
3.3 KiB
EmacsLisp
88 lines
3.3 KiB
EmacsLisp
;;; cedet-settings.el --- CEDET settings -*- lexical-binding: t -*-
|
|
|
|
;;; Commentary:
|
|
;; CEDET Collection of Emacs Development Tools
|
|
;; ede, semantic, srecode
|
|
;; https://github.com/syl20bnr/spacemacs/tree/develop/layers/%2Bemacs/semantic
|
|
|
|
;; Requirements:
|
|
;; needs Semantic Refactor for langs
|
|
;; https://github.com/tuhdo/semantic-refactor
|
|
|
|
;;; Code:
|
|
(use-package ede
|
|
:defer t
|
|
:config
|
|
;; ede/base.el
|
|
(setq ede-project-placeholder-cache-file (concat user-cache-directory "cedet/ede-projects.el")))
|
|
|
|
(use-package semantic
|
|
:defer t
|
|
:config
|
|
;; semantic/db-file.el
|
|
(setq semanticdb-default-save-directory (concat user-cache-directory "cedet/semanticdb"))
|
|
;; create the `semanticdb-default-save-directory' if not exists
|
|
(make-directory semanticdb-default-save-directory t)
|
|
|
|
(add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode)
|
|
(add-to-list 'semantic-default-submodes 'global-semantic-mru-bookmark-mode)
|
|
(add-to-list 'semantic-default-submodes 'global-semantic-idle-scheduler-mode)
|
|
(add-to-list 'semantic-default-submodes 'global-semantic-idle-summary-mode)
|
|
|
|
;; shows function interface/class/namespace at the top
|
|
(add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
|
|
(semantic-mode 1)
|
|
|
|
;; semantic hack
|
|
;; semantic with company-cafp attempts to uncompress and parse tons of .el.gz files
|
|
;; hack to not disable semantic-mode and company-mode
|
|
;; https://github.com/company-mode/company-mode/issues/525#issuecomment-254981015
|
|
(add-hook 'semantic-mode-hook
|
|
(lambda ()
|
|
(dolist (x (default-value 'completion-at-point-functions))
|
|
(when (string-prefix-p "semantic-" (symbol-name x))
|
|
(remove-hook 'completion-at-point-functions x)))))
|
|
)
|
|
|
|
(use-package srecode
|
|
:defer t
|
|
:config
|
|
;; srecode/map.el
|
|
(setq srecode-map-save-file (concat user-cache-directory "cedet/srecode-map.el")))
|
|
|
|
(use-package srefactor ;; https://melpa.org/#/srefactor
|
|
:load-path (lambda() (concat user-emacs-directory "lisp/srefactor"))
|
|
:defer 2) ;; Loads after 2 seconds of idle time.
|
|
|
|
(use-package srefactor-lisp
|
|
:after (srefactor))
|
|
|
|
;; https://github.com/company-mode/company-mode/issues/525#issuecomment-348635719
|
|
;; http://ergoemacs.org/emacs/elisp_determine_cursor_inside_string_or_comment.html
|
|
;; (defun inside-string-q ()
|
|
;; "Returns non-nil if inside string, else nil.
|
|
;; Result depends on syntax table's string quote character."
|
|
;; (interactive)
|
|
;; (let ((result (nth 3 (syntax-ppss))))
|
|
;; (message "%s" result)
|
|
;; result))
|
|
;; (defun inside-comment-q ()
|
|
;; "Returns non-nil if inside comment, else nil.
|
|
;; Result depends on syntax table's comment character."
|
|
;; (interactive)
|
|
;; (let ((result (nth 4 (syntax-ppss))))
|
|
;; (message "%s" result)
|
|
;; result))
|
|
;; (defun semantic-completion-advice (adviced-f &rest r)
|
|
;; "Check if POINT it's inside a string or comment before calling semantic-*"
|
|
;; (if (or (inside-string-q) (inside-comment-q))
|
|
;; (not (message "Oleeee! do not call function, we're inside a string or comment!"))
|
|
;; (apply adviced-f r)))
|
|
;; (advice-add 'semantic-analyze-completion-at-point-function :around #'semantic-completion-advice)
|
|
|
|
(use-package stickyfunc-enhance ;; https://melpa.org/#/stickyfunc-enhance
|
|
:after (semantic))
|
|
|
|
(provide 'cedet-settings)
|
|
;;; cedet-settings.el ends here
|