From b7f34e626d01c492a9131168f072415cd53fceef Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Sat, 5 Dec 2020 13:41:30 +0100 Subject: [PATCH] add pre settings --- init | 4 +- settings/cedet-settings.el | 88 +++++++++++++++++++++++++++++++++++++- settings/pre-settings.el | 55 ++++++++++++++++++++++++ 3 files changed, 144 insertions(+), 3 deletions(-) mode change 120000 => 100644 settings/cedet-settings.el create mode 100644 settings/pre-settings.el diff --git a/init b/init index 5d8cafa5..a216488d 100644 --- a/init +++ b/init @@ -10,9 +10,9 @@ (require 'pre-settings "~/.config/emacs/settings/pre-settings.el") ;; use-package delight functions variables (require 'which-key-settings) ;; https://melpa.org/#/which-key (require 'general-settings) ;; requires which-key -(require 'gui-settings) ;; emacs modeline indent rainbow focus +(require 'gui-settings) ;; emacs modeline indent rainbow focus dashboard (require 'my-settings) -(require 'theme-settings) ;; fonts emojify +(require 'theme-settings) ;; spacemacs-theme fonts emojify (require 'popwin-settings) ;; https://melpa.org/#/popwin (require 'toolbar-settings) (require 'deft-settings) ;; https://melpa.org/#/deft diff --git a/settings/cedet-settings.el b/settings/cedet-settings.el deleted file mode 120000 index ff412acf..00000000 --- a/settings/cedet-settings.el +++ /dev/null @@ -1 +0,0 @@ -/home/daniel/Sync/dotfiles/.config/emacs/settings/cedet-settings.el \ No newline at end of file diff --git a/settings/cedet-settings.el b/settings/cedet-settings.el new file mode 100644 index 00000000..a59e7648 --- /dev/null +++ b/settings/cedet-settings.el @@ -0,0 +1,87 @@ +;;; 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 diff --git a/settings/pre-settings.el b/settings/pre-settings.el new file mode 100644 index 00000000..b501c59a --- /dev/null +++ b/settings/pre-settings.el @@ -0,0 +1,55 @@ +;;; pre-settings.el --- Summary -*- lexical-binding: t -*- +;;; Commentary: +;;; Code: +(mapc (lambda (item) (add-to-list 'load-path item)) + '( + "~/.config/emacs/settings" ;; path where settings files are kept + "~/.config/emacs/lisp" ;; personal elisp lib dir, for manually installed packages + "~/.config/emacs/lisp/dash" + "~/.config/emacs/lisp/with-editor" + "~/.config/emacs/lisp/hydra" ;; required by treemacs org-ref + "~/.config/emacs/lisp/async" ;; https://melpa.org/#/async required by ob-async + "~/.config/emacs/lisp/persist" ;; https://elpa.gnu.org/packages/persist.html required by org-drill + "~/.config/emacs/lisp/use-package" ;; https://melpa.org/#/use-package + )) + +(setq gc-cons-threshold (* 50 1000 1000)) ;; Make startup faster by reducing the frequency of garbage collection. The default is 800 kilobytes. Measured in bytes. Will be decreased again at the end. +;; count startup time +(add-hook 'emacs-startup-hook ;; Use a hook so the message doesn't get clobbered by other messages. + (lambda () + (message + "Emacs ready in %s with %d garbage collections." + (format "%.2f seconds" (float-time (time-subtract after-init-time before-init-time))) + gcs-done))) + +(require 'use-package) ;; requires bind-key +(setq use-package-verbose t) +(use-package delight) ;; used for use-package :delight, see delight-delighted-modes + +;; +;; functions +;; +(defun my-font-installed-p (font-name) + "Check if font with FONT-NAME is available." + (when (find-font (font-spec :name "all-the-icons")) t)) + +;; +;; variables +;; +(defvar running-on-windows + (memq system-type '(windows-nt cygwin32 cygwin)) + "Non-nil if and only if we're running on Windows. +Both Win32 and Cygwin count.") +(setq user-emacs-directory "~/.config/emacs/") +(defconst user-cache-directory + (file-name-as-directory (concat user-emacs-directory ".cache")) + "My Emacs storage area for persistent files.") +;; create the `user-cache-directory' if not exists +(make-directory user-cache-directory t) +(defvar my-dbusp + (and (boundp 'dbus-compiled-version) ;; t on WSL Debian machine + (if (require 'dbus) (dbus-ping :session "org.freedesktop.Notifications"))) ;; is not enough + "Check if DBus is available.") + +(provide 'pre-settings) +;;; pre-settings.el ends here