diff options
author | Franck Cuny <franck.cuny@gmail.com> | 2018-08-11 17:30:58 -0700 |
---|---|---|
committer | Franck Cuny <franck.cuny@gmail.com> | 2018-08-11 17:30:58 -0700 |
commit | 42b668ec735afba772b39e82e08eb36ee8231671 (patch) | |
tree | d666a38a7ea9506b793bef7dc79d6b20e6e428ee | |
parent | [emacs] Automatically update elpa packages. (diff) | |
download | emacs.d-42b668ec735afba772b39e82e08eb36ee8231671.tar.gz |
[emacs] Move back some configs to init.el
Simplify by moving important variables and functions to the main init file.
-rw-r--r-- | configs/rcs/emacs.d/config/fcuny-base.el | 69 | ||||
-rw-r--r-- | configs/rcs/emacs.d/init.el | 74 |
2 files changed, 71 insertions, 72 deletions
diff --git a/configs/rcs/emacs.d/config/fcuny-base.el b/configs/rcs/emacs.d/config/fcuny-base.el deleted file mode 100644 index 2d0788c..0000000 --- a/configs/rcs/emacs.d/config/fcuny-base.el +++ /dev/null @@ -1,69 +0,0 @@ -(defvar fcuny-path-home (getenv "HOME") - "Path to the user's home directory.") - -(defvar fcuny-path-workspace (expand-file-name "workspace" fcuny-path-home) - "Path to the workspace.") - -(defvar fcuny-path-go (expand-file-name "go" fcuny-path-workspace) - "Path to GOPATH.") - -(defvar fcuny-path-go-bin (expand-file-name "bin" fcuny-path-go) - "Path to the go binaries.") - -(defvar fcuny-path-git-twitter (expand-file-name "git.twitter.biz" fcuny-path-workspace) - "Path to twitter's git repositories.") - -(defvar fcuny-path-git-github (expand-file-name "github.com" fcuny-path-workspace) - "Path to github's git repositories.") - -(defvar fcuny-path-svn-twitter (expand-file-name "svn.twitter.biz" fcuny-path-workspace) - "Path to twitter's SVN repositories.") - -(defvar fcuny-path-puppet-linter-svn (expand-file-name "twitter-ops/utilities/puppet/.puppet-lint.rc" - fcuny-path-svn-twitter) - "Path to the linter's configuration for twitter-ops.") - -(defvar fcuny-path-emacs-var (expand-file-name "var" user-emacs-directory) - "Path to some files for Emacs.") - -(defvar fcuny-path-emacs-elpa (expand-file-name "elpa" fcuny-path-emacs-var) - "Path to elpa's local files.") - -(defvar fcuny-projects-ignored-dirs '(".git" ".svn" "target" "elpa") - "Ignore the following directories when browsing with projectile.") - -(defvar fcuny-bookmarks-dir (expand-file-name "bookmarks" fcuny-path-emacs-var) - "Path to save the bookmarks") - -(defvar fcuny-custom-settings (expand-file-name "emacs-custom.el" fcuny-path-emacs-var) - "Path to emacs custom variables.") - -(defun fcuny-rename-this-buffer-and-file () - "Renames current buffer and file it is visiting." - (interactive) - (let ((name (buffer-name)) - (filename (buffer-file-name)) - (read-file-name-function 'read-file-name-default)) - (if (not (and filename (file-exists-p filename))) - (error "Buffer '%s' is not visiting a file!" name) - (let ((new-name (read-file-name "New name: " filename))) - (cond ((get-buffer new-name) - (error "A buffer named '%s' already exists!" new-name)) - (t - (rename-file filename new-name 1) - (rename-buffer new-name) - (set-visited-file-name new-name) - (set-buffer-modified-p nil) - (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) - -(defun fc/check-work-machine-p () - "Returns t if this is a work machine" - (string-match "tw-mbp.*" (system-name))) - -(defun fc/check-source-p () - "Finds if the current python file is in the `source' repository." - (and (executable-find "check.pex") - (buffer-file-name) - (string-match "source/.*\.py$" (buffer-file-name)))) - -(provide 'fcuny-base) diff --git a/configs/rcs/emacs.d/init.el b/configs/rcs/emacs.d/init.el index 757a45e..f0d4ac5 100644 --- a/configs/rcs/emacs.d/init.el +++ b/configs/rcs/emacs.d/init.el @@ -19,6 +19,77 @@ (package-refresh-contents) (package-install 'use-package)) +(require 'use-package) + +;; set a number of custom variables +(defvar fcuny-path-home (getenv "HOME") + "Path to the user's home directory.") + +(defvar fcuny-path-workspace (expand-file-name "workspace" fcuny-path-home) + "Path to the workspace.") + +(defvar fcuny-path-go (expand-file-name "go" fcuny-path-workspace) + "Path to GOPATH.") + +(defvar fcuny-path-go-bin (expand-file-name "bin" fcuny-path-go) + "Path to the go binaries.") + +(defvar fcuny-path-git-twitter (expand-file-name "git.twitter.biz" fcuny-path-workspace) + "Path to twitter's git repositories.") + +(defvar fcuny-path-git-github (expand-file-name "github.com" fcuny-path-workspace) + "Path to github's git repositories.") + +(defvar fcuny-path-svn-twitter (expand-file-name "svn.twitter.biz" fcuny-path-workspace) + "Path to twitter's SVN repositories.") + +(defvar fcuny-path-puppet-linter-svn (expand-file-name "twitter-ops/utilities/puppet/.puppet-lint.rc" fcuny-path-svn-twitter) + "Path to the linter's configuration for twitter-ops.") + +(defvar fcuny-path-emacs-var (expand-file-name "var" user-emacs-directory) + "Path to some files for Emacs.") + +(defvar fcuny-path-emacs-elpa (expand-file-name "elpa" fcuny-path-emacs-var) + "Path to elpa's local files.") + +(defvar fcuny-projects-ignored-dirs '(".git" ".svn" "target" "elpa") + "Ignore the following directories when browsing with projectile.") + +(defvar fcuny-bookmarks-dir (expand-file-name "bookmarks" fcuny-path-emacs-var) + "Path to save the bookmarks") + +(defvar fcuny-custom-settings (expand-file-name "emacs-custom.el" fcuny-path-emacs-var) + "Path to emacs custom variables.") + +;; a few custom functions +(defun fcuny-rename-this-buffer-and-file () + "Renames current buffer and file it is visiting." + (interactive) + (let ((name (buffer-name)) + (filename (buffer-file-name)) + (read-file-name-function 'read-file-name-default)) + (if (not (and filename (file-exists-p filename))) + (error "Buffer '%s' is not visiting a file!" name) + (let ((new-name (read-file-name "New name: " filename))) + (cond ((get-buffer new-name) + (error "A buffer named '%s' already exists!" new-name)) + (t + (rename-file filename new-name 1) + (rename-buffer new-name) + (set-visited-file-name new-name) + (set-buffer-modified-p nil) + (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) + +(defun fc/check-work-machine-p () + "Returns t if this is a work machine" + (string-match "tw-mbp.*" (system-name))) + +(defun fc/check-source-p () + "Finds if the current python file is in the `source' repository." + (and (executable-find "check.pex") + (buffer-file-name) + (string-match "source/.*\.py$" (buffer-file-name)))) + (defun fcuny/init-load-path () "Load custom configurations." (let* ((before load-path) @@ -29,9 +100,6 @@ (fcuny/init-load-path) -(require 'use-package) - -(use-package fcuny-base) (use-package fcuny-basic-settings) (use-package fcuny-darwin :if (memq window-system '(mac ns))) (use-package fcuny-linux :if (string-equal system-type "gnu/linux")) |