├── Makefile ├── .gitmodules ├── .gitignore ├── lib ├── graphene-pkg.el ├── graphene-other-defaults.el ├── graphene-windows-defaults.el ├── graphene-linux-defaults.el ├── graphene-osx-defaults.el ├── graphene-smartparens-config.el ├── graphene-env.el ├── graphene-projects.el ├── graphene-helper-functions.el ├── graphene-look.el ├── graphene-editing.el └── graphene.el ├── Cask ├── graphene-other-defaults.el ├── graphene.el ├── graphene-windows-defaults.el ├── graphene-linux-defaults.el ├── graphene-osx-defaults.el ├── graphene-smartparens-config.el ├── graphene-env.el ├── graphene-projects.el ├── graphene-helper-functions.el ├── graphene-look.el ├── README.md └── graphene-editing.el /Makefile: -------------------------------------------------------------------------------- 1 | PROJECT_LCNAME=graphene 2 | include el.mk/el.mk 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "el.mk"] 2 | path = el.mk 3 | url = https://github.com/rdallasgray/el.mk.git 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.elc 2 | TAGS 3 | .DS_Store 4 | .emacs* 5 | .cask 6 | /.#* 7 | /flycheck-* 8 | dist/ 9 | tmp/ 10 | -------------------------------------------------------------------------------- /lib/graphene-pkg.el: -------------------------------------------------------------------------------- 1 | (define-package "graphene" "1.0.0" "Friendly Emacs defaults" 2 | '((dash "2.10.0") 3 | (exec-path-from-shell "1.9") 4 | (ppd-sr-speedbar "0.0.6") 5 | (sr-speedbar "20140505") 6 | (ido-completing-read+ "4.3") 7 | (smex "3.0") 8 | (web-mode "11.2") 9 | (smartparens "1.8.0") 10 | (graphene-meta-theme "0.0.2") 11 | (flycheck "0.23") 12 | (company "0.8.12"))) 13 | -------------------------------------------------------------------------------- /Cask: -------------------------------------------------------------------------------- 1 | (source gnu) 2 | (source melpa) 3 | 4 | (package "graphene" "@VERSION" "Friendly Emacs defaults") 5 | 6 | (depends-on "company" "0.8.12") 7 | (depends-on "flycheck" "0.23") 8 | (depends-on "graphene-meta-theme" "0.0.2") 9 | (depends-on "smartparens" "1.8.0") 10 | (depends-on "web-mode" "11.2") 11 | (depends-on "smex" "3.0") 12 | (depends-on "ido-completing-read+" "4.3") 13 | (depends-on "sr-speedbar" "20140505") 14 | (depends-on "ppd-sr-speedbar" "0.0.6") 15 | (depends-on "exec-path-from-shell" "1.9") 16 | (depends-on "dash" "2.10.0") 17 | -------------------------------------------------------------------------------- /graphene-other-defaults.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-other-defaults.el --- Graphene defaults for other systems 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines extra defaults for systems not based on Linux, OS X or Windows. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (provide 'graphene-other-defaults) 37 | 38 | ;;; graphene-other-defults.el ends here 39 | -------------------------------------------------------------------------------- /lib/graphene-other-defaults.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-other-defaults.el --- Graphene defaults for other systems 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines extra defaults for systems not based on Linux, OS X or Windows. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (provide 'graphene-other-defaults) 37 | 38 | ;;; graphene-other-defults.el ends here 39 | -------------------------------------------------------------------------------- /graphene.el: -------------------------------------------------------------------------------- 1 | ;;; graphene.el --- Newbie-friendly defaults 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;@COMMENTARY 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (defgroup graphene nil 36 | "Graphene custom settings." 37 | :group 'environment) 38 | 39 | (require 'graphene-helper-functions) 40 | (require 'graphene-editing) 41 | (require 'graphene-env) 42 | (require 'graphene-projects) 43 | (require 'graphene-look) 44 | 45 | (provide 'graphene) 46 | 47 | ;;; graphene.el ends here 48 | -------------------------------------------------------------------------------- /graphene-windows-defaults.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-windows-defaults.el --- Graphene defaults for Windows systems 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines extra defaults for Windows-based systems. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | (unless graphene-default-font 36 | (setq graphene-default-font "Consolas-10")) 37 | (unless graphene-variable-pitch-font 38 | (setq graphene-variable-pitch-font "Segoe UI-10")) 39 | (unless graphene-fixed-pitch-font 40 | (setq graphene-fixed-pitch-font "Consolas-10")) 41 | 42 | (provide 'graphene-windows-defaults) 43 | 44 | ;;; graphene-windows-defaults.el ends here 45 | -------------------------------------------------------------------------------- /lib/graphene-windows-defaults.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-windows-defaults.el --- Graphene defaults for Windows systems 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines extra defaults for Windows-based systems. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | (unless graphene-default-font 36 | (setq graphene-default-font "Consolas-10")) 37 | (unless graphene-variable-pitch-font 38 | (setq graphene-variable-pitch-font "Segoe UI-10")) 39 | (unless graphene-fixed-pitch-font 40 | (setq graphene-fixed-pitch-font "Consolas-10")) 41 | 42 | (provide 'graphene-windows-defaults) 43 | 44 | ;;; graphene-windows-defaults.el ends here 45 | -------------------------------------------------------------------------------- /graphene-linux-defaults.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-linux-defaults.el --- Graphene defaults for Linux systems 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines extra defaults for Linux-based systems. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (unless graphene-default-font 37 | (setq graphene-default-font "DejaVu Sans Mono-10")) 38 | (unless graphene-variable-pitch-font 39 | (setq graphene-variable-pitch-font "Liberation Sans-10")) 40 | (unless graphene-fixed-pitch-font 41 | (setq graphene-fixed-pitch-font "DejaVu Sans Mono-10")) 42 | 43 | (provide 'graphene-linux-defaults) 44 | 45 | ;;; graphene-linux-defaults.el ends here 46 | -------------------------------------------------------------------------------- /lib/graphene-linux-defaults.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-linux-defaults.el --- Graphene defaults for Linux systems 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines extra defaults for Linux-based systems. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (unless graphene-default-font 37 | (setq graphene-default-font "DejaVu Sans Mono-10")) 38 | (unless graphene-variable-pitch-font 39 | (setq graphene-variable-pitch-font "Liberation Sans-10")) 40 | (unless graphene-fixed-pitch-font 41 | (setq graphene-fixed-pitch-font "DejaVu Sans Mono-10")) 42 | 43 | (provide 'graphene-linux-defaults) 44 | 45 | ;;; graphene-linux-defaults.el ends here 46 | -------------------------------------------------------------------------------- /graphene-osx-defaults.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-osx-defaults.el --- Graphene defaults for OS X 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines extra defaults for OS X-based systems. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (unless graphene-default-font 37 | (setq graphene-default-font "Menlo-12")) 38 | (unless graphene-variable-pitch-font 39 | (setq graphene-variable-pitch-font "Lucida Grande-12")) 40 | (unless graphene-fixed-pitch-font 41 | (setq graphene-fixed-pitch-font "Menlo-12")) 42 | 43 | (setq delete-by-moving-to-trash t) 44 | 45 | (when (memq window-system '(mac ns)) 46 | (require 'exec-path-from-shell) 47 | (exec-path-from-shell-initialize)) 48 | 49 | (provide 'graphene-osx-defaults) 50 | 51 | ;;; graphene-osx-defaults.el ends here 52 | -------------------------------------------------------------------------------- /lib/graphene-osx-defaults.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-osx-defaults.el --- Graphene defaults for OS X 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines extra defaults for OS X-based systems. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (unless graphene-default-font 37 | (setq graphene-default-font "Menlo-12")) 38 | (unless graphene-variable-pitch-font 39 | (setq graphene-variable-pitch-font "Lucida Grande-12")) 40 | (unless graphene-fixed-pitch-font 41 | (setq graphene-fixed-pitch-font "Menlo-12")) 42 | 43 | (setq delete-by-moving-to-trash t) 44 | 45 | (when (memq window-system '(mac ns)) 46 | (require 'exec-path-from-shell) 47 | (exec-path-from-shell-initialize)) 48 | 49 | (provide 'graphene-osx-defaults) 50 | 51 | ;;; graphene-osx-defaults.el ends here 52 | -------------------------------------------------------------------------------- /graphene-smartparens-config.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-smartparens-config.el --- Graphene configuration for smartparens 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | ;; 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file provides extra configuration for Smartparens (https://github.com/Fuco1/smartparens). 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (let ((pairs '(("{" nil) ("[" nil)))) 37 | (mapc 38 | (lambda (pair) 39 | (sp-pair (-first-item pair) 40 | (-last-item pair) 41 | :post-handlers 42 | '(:add ("||\n[i]" "RET")))) 43 | pairs)) 44 | 45 | ;; Fix for ruby-mode, which appears to override handlers 46 | (add-hook 'ruby-mode-hook 47 | (lambda () 48 | (sp-local-pair 'ruby-mode 49 | "{" 50 | nil 51 | :post-handlers 52 | '(:add ("||\n[i]" "RET"))))) 53 | 54 | (sp-local-pair 55 | '(markdown-mode gfm-mode) "*" "*" :unless '(sp-in-string-p) :actions '(insert wrap)) 56 | 57 | (provide 'graphene-smartparens-config) 58 | -------------------------------------------------------------------------------- /lib/graphene-smartparens-config.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-smartparens-config.el --- Graphene configuration for smartparens 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | ;; 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file provides extra configuration for Smartparens (https://github.com/Fuco1/smartparens). 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (let ((pairs '(("{" nil) ("[" nil)))) 37 | (mapc 38 | (lambda (pair) 39 | (sp-pair (-first-item pair) 40 | (-last-item pair) 41 | :post-handlers 42 | '(:add ("||\n[i]" "RET")))) 43 | pairs)) 44 | 45 | ;; Fix for ruby-mode, which appears to override handlers 46 | (add-hook 'ruby-mode-hook 47 | (lambda () 48 | (sp-local-pair 'ruby-mode 49 | "{" 50 | nil 51 | :post-handlers 52 | '(:add ("||\n[i]" "RET"))))) 53 | 54 | (sp-local-pair 55 | '(markdown-mode gfm-mode) "*" "*" :unless '(sp-in-string-p) :actions '(insert wrap)) 56 | 57 | (provide 'graphene-smartparens-config) 58 | -------------------------------------------------------------------------------- /graphene-env.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-env.el --- Graphene environment defaults 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; The environment defaults target the general Emacs environment, simplifying interactions 16 | ;; and enabling discoverability. 17 | 18 | ;;; License: 19 | 20 | ;; This program is free software; you can redistribute it and/or 21 | ;; modify it under the terms of the GNU General Public License 22 | ;; as published by the Free Software Foundation; either version 3 23 | ;; of the License, or (at your option) any later version. 24 | ;; 25 | ;; This program is distributed in the hope that it will be useful, 26 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | ;; GNU General Public License for more details. 29 | ;; 30 | ;; You should have received a copy of the GNU General Public License 31 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 32 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 33 | ;; Boston, MA 02110-1301, USA. 34 | 35 | ;;; Code: 36 | 37 | 38 | ;; Use smex to complete interactive commands 39 | (require 'smex) 40 | (smex-initialize) 41 | 42 | (global-set-key (kbd "M-x") 'smex) 43 | (global-set-key (kbd "M-X") 'smex-major-mode-commands) 44 | 45 | ;; Use ido for general completion 46 | (ido-mode 1) 47 | (ido-everywhere 1) 48 | (require 'ido-completing-read+) 49 | (ido-ubiquitous-mode t) 50 | (put 'ido-complete 'disabled nil) 51 | (put 'ido-exit-minibuffer 'disabled nil) 52 | (setq ido-enable-flex-matching t 53 | ido-auto-merge-work-directories-length nil 54 | ido-create-new-buffer 'always 55 | ido-use-filename-at-point 'guess) 56 | 57 | 58 | ;; Make buffer names unique 59 | (require 'uniquify) 60 | (setq uniquify-buffer-name-style 'forward) 61 | 62 | 63 | ;; Don't show the startup message 64 | (setq inhibit-startup-message t) 65 | 66 | 67 | ;; Save backup files in the temporary directory 68 | (setq backup-directory-alist `((".*" . ,temporary-file-directory)) 69 | auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) 70 | 71 | 72 | ;; Shorten yes/no answers to y/n 73 | (fset 'yes-or-no-p 'y-or-n-p) 74 | 75 | 76 | ;; Automatically update buffers when files change 77 | (global-auto-revert-mode t) 78 | 79 | 80 | ;; Enable 'power user' features 81 | (put 'dired-find-alternate-file 'disabled nil) 82 | (put 'upcase-region 'disabled nil) 83 | (put 'downcase-region 'disabled nil) 84 | (put 'narrow-to-region 'disabled nil) 85 | 86 | (provide 'graphene-env) 87 | 88 | ;;; graphene-env.el ends here 89 | -------------------------------------------------------------------------------- /lib/graphene-env.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-env.el --- Graphene environment defaults 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; The environment defaults target the general Emacs environment, simplifying interactions 16 | ;; and enabling discoverability. 17 | 18 | ;;; License: 19 | 20 | ;; This program is free software; you can redistribute it and/or 21 | ;; modify it under the terms of the GNU General Public License 22 | ;; as published by the Free Software Foundation; either version 3 23 | ;; of the License, or (at your option) any later version. 24 | ;; 25 | ;; This program is distributed in the hope that it will be useful, 26 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | ;; GNU General Public License for more details. 29 | ;; 30 | ;; You should have received a copy of the GNU General Public License 31 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 32 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 33 | ;; Boston, MA 02110-1301, USA. 34 | 35 | ;;; Code: 36 | 37 | 38 | ;; Use smex to complete interactive commands 39 | (require 'smex) 40 | (smex-initialize) 41 | 42 | (global-set-key (kbd "M-x") 'smex) 43 | (global-set-key (kbd "M-X") 'smex-major-mode-commands) 44 | 45 | ;; Use ido for general completion 46 | (ido-mode 1) 47 | (ido-everywhere 1) 48 | (require 'ido-completing-read+) 49 | (ido-ubiquitous-mode t) 50 | (put 'ido-complete 'disabled nil) 51 | (put 'ido-exit-minibuffer 'disabled nil) 52 | (setq ido-enable-flex-matching t 53 | ido-auto-merge-work-directories-length nil 54 | ido-create-new-buffer 'always 55 | ido-use-filename-at-point 'guess) 56 | 57 | 58 | ;; Make buffer names unique 59 | (require 'uniquify) 60 | (setq uniquify-buffer-name-style 'forward) 61 | 62 | 63 | ;; Don't show the startup message 64 | (setq inhibit-startup-message t) 65 | 66 | 67 | ;; Save backup files in the temporary directory 68 | (setq backup-directory-alist `((".*" . ,temporary-file-directory)) 69 | auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) 70 | 71 | 72 | ;; Shorten yes/no answers to y/n 73 | (fset 'yes-or-no-p 'y-or-n-p) 74 | 75 | 76 | ;; Automatically update buffers when files change 77 | (global-auto-revert-mode t) 78 | 79 | 80 | ;; Enable 'power user' features 81 | (put 'dired-find-alternate-file 'disabled nil) 82 | (put 'upcase-region 'disabled nil) 83 | (put 'downcase-region 'disabled nil) 84 | (put 'narrow-to-region 'disabled nil) 85 | 86 | (provide 'graphene-env) 87 | 88 | ;;; graphene-env.el ends here 89 | -------------------------------------------------------------------------------- /graphene-projects.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-projects.el --- Graphene defaults for project management 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines default settings and functionality for project management. 16 | ;; It uses Project-persist (https://github.com/rdallasgray/project-persist) as a base 17 | ;; for its functionality, adding just the capability to load and save desktops along with project settings, 18 | ;; and to open the speedbar at the correct directory location. 19 | 20 | ;;; License: 21 | 22 | ;; This program is free software; you can redistribute it and/or 23 | ;; modify it under the terms of the GNU General Public License 24 | ;; as published by the Free Software Foundation; either version 3 25 | ;; of the License, or (at your option) any later version. 26 | ;; 27 | ;; This program is distributed in the hope that it will be useful, 28 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | ;; GNU General Public License for more details. 31 | ;; 32 | ;; You should have received a copy of the GNU General Public License 33 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 34 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 35 | ;; Boston, MA 02110-1301, USA. 36 | 37 | ;;; Code: 38 | 39 | (defcustom graphene-project-drawer-auto t 40 | "Whether graphene should open a project drawer when a project is loaded." 41 | :type 'boolean 42 | :group 'graphene) 43 | 44 | (defcustom graphene-project-drawer-adaptor 'ppd-sr-speedbar 45 | "The adaptor graphene should use to show the project persist drawer." 46 | :type 'symbol 47 | :group 'graphene) 48 | 49 | (require 'graphene-helper-functions) 50 | (require 'project-persist) 51 | 52 | (project-persist-mode t) 53 | 54 | (require graphene-project-drawer-adaptor) 55 | 56 | (project-persist-drawer-mode graphene-project-drawer-auto) 57 | (global-set-key (kbd "C-c s") 'sr-speedbar-select-window) 58 | 59 | (defun graphene-load-project-desktop () 60 | "Load the project's desktop if available." 61 | (ignore-errors 62 | (setq default-directory project-persist-current-project-settings-dir) 63 | (message (format "Loading project desktop from %s" default-directory)) 64 | (desktop-read project-persist-current-project-settings-dir))) 65 | 66 | (add-hook 'project-persist-before-load-hook 'kill-all-buffers) 67 | (add-hook 'project-persist-after-close-hook 'kill-all-buffers) 68 | (add-hook 'project-persist-after-load-hook 'graphene-load-project-desktop) 69 | 70 | (add-hook 'project-persist-after-save-hook 71 | (lambda () 72 | (message (format "Saving project desktop in %s" project-persist-current-project-settings-dir)) 73 | (desktop-save project-persist-current-project-settings-dir))) 74 | 75 | (require 'dash) 76 | 77 | (defun emacs-process-p (pid) 78 | "If PID is the process ID of an EMACS process, return t, else nil. 79 | Also returns nil if pid is nil." 80 | (when (and pid (memq pid (list-system-processes))) 81 | (let* ((attributes (process-attributes pid)) 82 | (cmd-cell (-first (lambda (cell) (string= "comm" (car cell))) attributes))) 83 | (and cmd-cell (string-match-p "emacs" (cdr cmd-cell)))))) 84 | 85 | (defun pid-if-active-emacs-process (orig &optional dirname) 86 | (let ((pid (apply orig '(dirname)))) 87 | (when (emacs-process-p pid) pid) 88 | pid)) 89 | 90 | (advice-add 'desktop-owner :around #'pid-if-active-emacs-process) 91 | 92 | (provide 'graphene-projects) 93 | 94 | ;;; graphene-projects.el ends here 95 | -------------------------------------------------------------------------------- /lib/graphene-projects.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-projects.el --- Graphene defaults for project management 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines default settings and functionality for project management. 16 | ;; It uses Project-persist (https://github.com/rdallasgray/project-persist) as a base 17 | ;; for its functionality, adding just the capability to load and save desktops along with project settings, 18 | ;; and to open the speedbar at the correct directory location. 19 | 20 | ;;; License: 21 | 22 | ;; This program is free software; you can redistribute it and/or 23 | ;; modify it under the terms of the GNU General Public License 24 | ;; as published by the Free Software Foundation; either version 3 25 | ;; of the License, or (at your option) any later version. 26 | ;; 27 | ;; This program is distributed in the hope that it will be useful, 28 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | ;; GNU General Public License for more details. 31 | ;; 32 | ;; You should have received a copy of the GNU General Public License 33 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 34 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 35 | ;; Boston, MA 02110-1301, USA. 36 | 37 | ;;; Code: 38 | 39 | (defcustom graphene-project-drawer-auto t 40 | "Whether graphene should open a project drawer when a project is loaded." 41 | :type 'boolean 42 | :group 'graphene) 43 | 44 | (defcustom graphene-project-drawer-adaptor 'ppd-sr-speedbar 45 | "The adaptor graphene should use to show the project persist drawer." 46 | :type 'symbol 47 | :group 'graphene) 48 | 49 | (require 'graphene-helper-functions) 50 | (require 'project-persist) 51 | 52 | (project-persist-mode t) 53 | 54 | (require graphene-project-drawer-adaptor) 55 | 56 | (project-persist-drawer-mode graphene-project-drawer-auto) 57 | (global-set-key (kbd "C-c s") 'sr-speedbar-select-window) 58 | 59 | (defun graphene-load-project-desktop () 60 | "Load the project's desktop if available." 61 | (ignore-errors 62 | (setq default-directory project-persist-current-project-settings-dir) 63 | (message (format "Loading project desktop from %s" default-directory)) 64 | (desktop-read project-persist-current-project-settings-dir))) 65 | 66 | (add-hook 'project-persist-before-load-hook 'kill-all-buffers) 67 | (add-hook 'project-persist-after-close-hook 'kill-all-buffers) 68 | (add-hook 'project-persist-after-load-hook 'graphene-load-project-desktop) 69 | 70 | (add-hook 'project-persist-after-save-hook 71 | (lambda () 72 | (message (format "Saving project desktop in %s" project-persist-current-project-settings-dir)) 73 | (desktop-save project-persist-current-project-settings-dir))) 74 | 75 | (require 'dash) 76 | 77 | (defun emacs-process-p (pid) 78 | "If PID is the process ID of an EMACS process, return t, else nil. 79 | Also returns nil if pid is nil." 80 | (when (and pid (memq pid (list-system-processes))) 81 | (let* ((attributes (process-attributes pid)) 82 | (cmd-cell (-first (lambda (cell) (string= "comm" (car cell))) attributes))) 83 | (and cmd-cell (string-match-p "emacs" (cdr cmd-cell)))))) 84 | 85 | (defun pid-if-active-emacs-process (orig &optional dirname) 86 | (let ((pid (apply orig '(dirname)))) 87 | (when (emacs-process-p pid) pid) 88 | pid)) 89 | 90 | (advice-add 'desktop-owner :around #'pid-if-active-emacs-process) 91 | 92 | (provide 'graphene-projects) 93 | 94 | ;;; graphene-projects.el ends here 95 | -------------------------------------------------------------------------------- /graphene-helper-functions.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-helper-functions.el --- Graphene helper functions 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; These helper functions enable simple functionality used throughout the rest of the package. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (defun kill-default-buffer () 37 | "Kill the currently active buffer -- set to C-x k so that users are not asked which buffer they want to kill." 38 | (interactive) 39 | (let (kill-buffer-query-functions) (kill-buffer))) 40 | 41 | (global-set-key (kbd "C-x k") 'kill-default-buffer) 42 | 43 | 44 | (defun kill-buffer-if-file (buf) 45 | "Kill a buffer only if it is file-based." 46 | (when (buffer-file-name buf) 47 | (when (buffer-modified-p buf) 48 | (when (y-or-n-p (format "Buffer %s is modified - save it?" (buffer-name buf))) 49 | (save-some-buffers nil buf))) 50 | (set-buffer-modified-p nil) 51 | (kill-buffer buf))) 52 | 53 | 54 | (defun kill-all-buffers () 55 | "Kill all file-based buffers." 56 | (interactive) 57 | (mapc (lambda (buf) (kill-buffer-if-file buf)) 58 | (buffer-list))) 59 | 60 | 61 | (defun kill-buffer-and-window () 62 | "Close the current window and kill the buffer it's visiting." 63 | (interactive) 64 | (progn 65 | (kill-buffer) 66 | (delete-window))) 67 | 68 | (global-set-key (kbd "C-x C-k") 'kill-buffer-and-window) 69 | 70 | 71 | (defun create-new-buffer () 72 | "Create a new buffer named *new*[num]." 73 | (interactive) 74 | (switch-to-buffer (generate-new-buffer-name "*new*"))) 75 | 76 | (global-set-key (kbd "C-c n") 'create-new-buffer) 77 | 78 | 79 | (defun insert-semicolon-at-end-of-line () 80 | "Add a closing semicolon from anywhere in the line." 81 | (interactive) 82 | (save-excursion 83 | (end-of-line) 84 | (insert ";"))) 85 | 86 | (global-set-key (kbd "C-;") 'insert-semicolon-at-end-of-line) 87 | 88 | 89 | (defun comment-current-line-dwim () 90 | "Comment or uncomment the current line." 91 | (interactive) 92 | (save-excursion 93 | (push-mark (beginning-of-line) t t) 94 | (end-of-line) 95 | (comment-dwim nil))) 96 | 97 | (global-set-key (kbd "C-M-;") 'comment-current-line-dwim) 98 | 99 | 100 | (defun newline-anywhere () 101 | "Add a newline from anywhere in the line." 102 | (interactive) 103 | (end-of-line) 104 | (newline-and-indent)) 105 | 106 | (global-set-key (kbd "M-RET") 'newline-anywhere) 107 | 108 | 109 | (defun increase-window-height (&optional arg) 110 | "Make the window taller by one line. Useful when bound to a repeatable key combination." 111 | (interactive "p") 112 | (enlarge-window arg)) 113 | 114 | (global-set-key (kbd "C->") 'increase-window-height) 115 | 116 | 117 | (defun decrease-window-height (&optional arg) 118 | "Make the window shorter by one line. Useful when bound to a repeatable key combination." 119 | (interactive "p") 120 | (enlarge-window (- 0 arg))) 121 | 122 | (global-set-key (kbd "C-<") 'decrease-window-height) 123 | 124 | 125 | (defun decrease-window-width (&optional arg) 126 | "Make the window narrower by one column. Useful when bound to a repeatable key combination." 127 | (interactive "p") 128 | (enlarge-window (- 0 arg) t)) 129 | 130 | (global-set-key (kbd "C-,") 'decrease-window-width) 131 | 132 | 133 | (defun increase-window-width (&optional arg) 134 | "Make the window wider by one column. Useful when bound to a repeatable key combination." 135 | (interactive "p") 136 | (enlarge-window arg t)) 137 | 138 | (global-set-key (kbd "C-.") 'increase-window-width) 139 | 140 | 141 | (when window-system 142 | (defun new-emacs-instance () 143 | "Create a new instance of Emacs." 144 | (interactive) 145 | (let ((path-to-emacs 146 | (locate-file invocation-name 147 | (list invocation-directory) exec-suffixes))) 148 | (call-process path-to-emacs nil 0 nil)))) 149 | 150 | (global-set-key (kbd "C-c N") 'new-emacs-instance) 151 | 152 | 153 | (provide 'graphene-helper-functions) 154 | 155 | ;;; graphene-helper-functions.el ends here 156 | -------------------------------------------------------------------------------- /lib/graphene-helper-functions.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-helper-functions.el --- Graphene helper functions 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; These helper functions enable simple functionality used throughout the rest of the package. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (defun kill-default-buffer () 37 | "Kill the currently active buffer -- set to C-x k so that users are not asked which buffer they want to kill." 38 | (interactive) 39 | (let (kill-buffer-query-functions) (kill-buffer))) 40 | 41 | (global-set-key (kbd "C-x k") 'kill-default-buffer) 42 | 43 | 44 | (defun kill-buffer-if-file (buf) 45 | "Kill a buffer only if it is file-based." 46 | (when (buffer-file-name buf) 47 | (when (buffer-modified-p buf) 48 | (when (y-or-n-p (format "Buffer %s is modified - save it?" (buffer-name buf))) 49 | (save-some-buffers nil buf))) 50 | (set-buffer-modified-p nil) 51 | (kill-buffer buf))) 52 | 53 | 54 | (defun kill-all-buffers () 55 | "Kill all file-based buffers." 56 | (interactive) 57 | (mapc (lambda (buf) (kill-buffer-if-file buf)) 58 | (buffer-list))) 59 | 60 | 61 | (defun kill-buffer-and-window () 62 | "Close the current window and kill the buffer it's visiting." 63 | (interactive) 64 | (progn 65 | (kill-buffer) 66 | (delete-window))) 67 | 68 | (global-set-key (kbd "C-x C-k") 'kill-buffer-and-window) 69 | 70 | 71 | (defun create-new-buffer () 72 | "Create a new buffer named *new*[num]." 73 | (interactive) 74 | (switch-to-buffer (generate-new-buffer-name "*new*"))) 75 | 76 | (global-set-key (kbd "C-c n") 'create-new-buffer) 77 | 78 | 79 | (defun insert-semicolon-at-end-of-line () 80 | "Add a closing semicolon from anywhere in the line." 81 | (interactive) 82 | (save-excursion 83 | (end-of-line) 84 | (insert ";"))) 85 | 86 | (global-set-key (kbd "C-;") 'insert-semicolon-at-end-of-line) 87 | 88 | 89 | (defun comment-current-line-dwim () 90 | "Comment or uncomment the current line." 91 | (interactive) 92 | (save-excursion 93 | (push-mark (beginning-of-line) t t) 94 | (end-of-line) 95 | (comment-dwim nil))) 96 | 97 | (global-set-key (kbd "C-M-;") 'comment-current-line-dwim) 98 | 99 | 100 | (defun newline-anywhere () 101 | "Add a newline from anywhere in the line." 102 | (interactive) 103 | (end-of-line) 104 | (newline-and-indent)) 105 | 106 | (global-set-key (kbd "M-RET") 'newline-anywhere) 107 | 108 | 109 | (defun increase-window-height (&optional arg) 110 | "Make the window taller by one line. Useful when bound to a repeatable key combination." 111 | (interactive "p") 112 | (enlarge-window arg)) 113 | 114 | (global-set-key (kbd "C->") 'increase-window-height) 115 | 116 | 117 | (defun decrease-window-height (&optional arg) 118 | "Make the window shorter by one line. Useful when bound to a repeatable key combination." 119 | (interactive "p") 120 | (enlarge-window (- 0 arg))) 121 | 122 | (global-set-key (kbd "C-<") 'decrease-window-height) 123 | 124 | 125 | (defun decrease-window-width (&optional arg) 126 | "Make the window narrower by one column. Useful when bound to a repeatable key combination." 127 | (interactive "p") 128 | (enlarge-window (- 0 arg) t)) 129 | 130 | (global-set-key (kbd "C-,") 'decrease-window-width) 131 | 132 | 133 | (defun increase-window-width (&optional arg) 134 | "Make the window wider by one column. Useful when bound to a repeatable key combination." 135 | (interactive "p") 136 | (enlarge-window arg t)) 137 | 138 | (global-set-key (kbd "C-.") 'increase-window-width) 139 | 140 | 141 | (when window-system 142 | (defun new-emacs-instance () 143 | "Create a new instance of Emacs." 144 | (interactive) 145 | (let ((path-to-emacs 146 | (locate-file invocation-name 147 | (list invocation-directory) exec-suffixes))) 148 | (call-process path-to-emacs nil 0 nil)))) 149 | 150 | (global-set-key (kbd "C-c N") 'new-emacs-instance) 151 | 152 | 153 | (provide 'graphene-helper-functions) 154 | 155 | ;;; graphene-helper-functions.el ends here 156 | -------------------------------------------------------------------------------- /graphene-look.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-look.el --- Graphene defaults for the UI 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines default settings and functionality for UI-centric matters. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (defcustom graphene-default-font nil 37 | "The universal default font." 38 | :type 'string 39 | :group 'graphene) 40 | 41 | (defcustom graphene-variable-pitch-font nil 42 | "The font to use in the variable-pitch face." 43 | :type 'string 44 | :group 'graphene) 45 | 46 | (defcustom graphene-fixed-pitch-font nil 47 | "The font to use in the fixed-pitch face." 48 | :type 'string 49 | :group 'graphene) 50 | 51 | (let ((sys 52 | (cond ((eq system-type 'darwin) "osx") 53 | ((eq system-type 'gnu/linux) "linux") 54 | ((eq system-type 'windows-nt) "windows") 55 | (t "other")))) 56 | (require (intern (format "graphene-%s-defaults" sys)))) 57 | 58 | 59 | ;; Work around Emacs frame sizing bug when line-spacing 60 | ;; is non-zero, which impacts e.g. grizzl, and allow resizing when 61 | ;; vertical modes are enabled or user has customized graphene-resize-minibuffer 62 | (defcustom graphene-resize-minibuffer nil 63 | "Whether the minibuffer should be resizable." 64 | :type 'bool 65 | :group 'graphene) 66 | 67 | (defun graphene-resize-minibuffer-p () 68 | (or (-any? 'featurep '(ivy grizzl ido-vertical-mode)) 69 | graphene-resize-minibuffer)) 70 | 71 | (defun graphene-minibuffer-setup-hook () 72 | (if (graphene-resize-minibuffer-p) 73 | (set (make-local-variable 'line-spacing) 0) 74 | (setq resize-mini-windows nil))) 75 | 76 | (add-hook 'minibuffer-setup-hook 77 | 'graphene-minibuffer-setup-hook) 78 | 79 | (add-hook 'ido-minibuffer-setup-hook 80 | 'graphene-minibuffer-setup-hook) 81 | 82 | (setq redisplay-dont-pause t) 83 | 84 | (mapc (lambda (mode) 85 | (when (fboundp mode) (funcall mode -1))) 86 | '(scroll-bar-mode tool-bar-mode blink-cursor-mode)) 87 | 88 | (defvar graphene-geometry-file 89 | (expand-file-name ".graphene-geometry" user-emacs-directory) 90 | "The file where frame geometry settings are saved.") 91 | 92 | (defun graphene-load-frame-geometry () 93 | "Load saved frame geometry settings." 94 | (if (file-readable-p graphene-geometry-file) 95 | (with-temp-buffer 96 | (insert-file-contents graphene-geometry-file) 97 | (read (buffer-string))) 98 | '(100 40 0 0))) 99 | 100 | (defun graphene-save-frame-geometry () 101 | "Save current frame geometry settings." 102 | (with-temp-file graphene-geometry-file 103 | (print (graphene-get-geometry) (current-buffer)))) 104 | 105 | (defun graphene-get-geometry () 106 | "Get the current geometry of the active frame." 107 | (list (frame-width) (frame-height) (frame-parameter nil 'top) (frame-parameter nil 'left))) 108 | 109 | (defun graphene-set-geometry () 110 | "Set the default frame geometry using the values loaded from graphene-geometry-file." 111 | (let ((geom (graphene-load-frame-geometry))) 112 | (let ((f-width (nth 0 geom)) 113 | (f-height (nth 1 geom)) 114 | (f-top (nth 2 geom)) 115 | (f-left (nth 3 geom))) 116 | (setq default-frame-alist 117 | (append default-frame-alist 118 | `((width . ,f-width) 119 | (height . ,f-height) 120 | (top . ,f-top) 121 | (left . ,f-left))))))) 122 | 123 | (defun graphene-set-fonts () 124 | "Set up default fonts." 125 | (unless graphene-default-font 126 | (setq graphene-default-font (face-font 'default))) 127 | (unless graphene-variable-pitch-font 128 | (setq graphene-variable-pitch-font (face-font 'variable-pitch))) 129 | (unless graphene-fixed-pitch-font 130 | (setq graphene-fixed-pitch-font (face-font 'fixed-pitch)))) 131 | 132 | (defun graphene-look-startup-after-init () 133 | "Load defaults for the overall Graphene look -- to be called after loading the init file so as to pick up custom settings." 134 | (if window-system 135 | (progn 136 | (graphene-set-geometry) 137 | (add-hook 'kill-emacs-hook 'graphene-save-frame-geometry) 138 | (setq-default line-spacing 2) 139 | (graphene-set-fonts) 140 | (add-to-list 'default-frame-alist `(font . ,graphene-default-font)) 141 | (set-face-font 'default graphene-default-font) 142 | (set-face-font 'variable-pitch graphene-variable-pitch-font) 143 | (set-face-font 'fixed-pitch graphene-fixed-pitch-font) 144 | (add-to-list 'default-frame-alist '(internal-border-width . 0)) 145 | (set-fringe-mode '(8 . 0)) 146 | (load-theme 'graphene-meta t) 147 | (defadvice load-theme 148 | (after load-graphene-meta-theme (theme &optional no-confirm no-enable) activate) 149 | "Load the graphene theme extensions after loading a theme." 150 | (when (not (equal theme 'graphene-meta)) 151 | (load-theme 'graphene-meta t)))) 152 | (when (not (eq system-type 'darwin)) 153 | (menu-bar-mode -1)) 154 | ;; Menu bar always off in text mode 155 | (menu-bar-mode -1))) 156 | 157 | (add-hook 'after-init-hook 'graphene-look-startup-after-init) 158 | 159 | (provide 'graphene-look) 160 | 161 | ;;; graphene-look.el ends here 162 | -------------------------------------------------------------------------------- /lib/graphene-look.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-look.el --- Graphene defaults for the UI 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; This file defines default settings and functionality for UI-centric matters. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (defcustom graphene-default-font nil 37 | "The universal default font." 38 | :type 'string 39 | :group 'graphene) 40 | 41 | (defcustom graphene-variable-pitch-font nil 42 | "The font to use in the variable-pitch face." 43 | :type 'string 44 | :group 'graphene) 45 | 46 | (defcustom graphene-fixed-pitch-font nil 47 | "The font to use in the fixed-pitch face." 48 | :type 'string 49 | :group 'graphene) 50 | 51 | (let ((sys 52 | (cond ((eq system-type 'darwin) "osx") 53 | ((eq system-type 'gnu/linux) "linux") 54 | ((eq system-type 'windows-nt) "windows") 55 | (t "other")))) 56 | (require (intern (format "graphene-%s-defaults" sys)))) 57 | 58 | 59 | ;; Work around Emacs frame sizing bug when line-spacing 60 | ;; is non-zero, which impacts e.g. grizzl, and allow resizing when 61 | ;; vertical modes are enabled or user has customized graphene-resize-minibuffer 62 | (defcustom graphene-resize-minibuffer nil 63 | "Whether the minibuffer should be resizable." 64 | :type 'bool 65 | :group 'graphene) 66 | 67 | (defun graphene-resize-minibuffer-p () 68 | (or (-any? 'featurep '(ivy grizzl ido-vertical-mode)) 69 | graphene-resize-minibuffer)) 70 | 71 | (defun graphene-minibuffer-setup-hook () 72 | (if (graphene-resize-minibuffer-p) 73 | (set (make-local-variable 'line-spacing) 0) 74 | (setq resize-mini-windows nil))) 75 | 76 | (add-hook 'minibuffer-setup-hook 77 | 'graphene-minibuffer-setup-hook) 78 | 79 | (add-hook 'ido-minibuffer-setup-hook 80 | 'graphene-minibuffer-setup-hook) 81 | 82 | (setq redisplay-dont-pause t) 83 | 84 | (mapc (lambda (mode) 85 | (when (fboundp mode) (funcall mode -1))) 86 | '(scroll-bar-mode tool-bar-mode blink-cursor-mode)) 87 | 88 | (defvar graphene-geometry-file 89 | (expand-file-name ".graphene-geometry" user-emacs-directory) 90 | "The file where frame geometry settings are saved.") 91 | 92 | (defun graphene-load-frame-geometry () 93 | "Load saved frame geometry settings." 94 | (if (file-readable-p graphene-geometry-file) 95 | (with-temp-buffer 96 | (insert-file-contents graphene-geometry-file) 97 | (read (buffer-string))) 98 | '(100 40 0 0))) 99 | 100 | (defun graphene-save-frame-geometry () 101 | "Save current frame geometry settings." 102 | (with-temp-file graphene-geometry-file 103 | (print (graphene-get-geometry) (current-buffer)))) 104 | 105 | (defun graphene-get-geometry () 106 | "Get the current geometry of the active frame." 107 | (list (frame-width) (frame-height) (frame-parameter nil 'top) (frame-parameter nil 'left))) 108 | 109 | (defun graphene-set-geometry () 110 | "Set the default frame geometry using the values loaded from graphene-geometry-file." 111 | (let ((geom (graphene-load-frame-geometry))) 112 | (let ((f-width (nth 0 geom)) 113 | (f-height (nth 1 geom)) 114 | (f-top (nth 2 geom)) 115 | (f-left (nth 3 geom))) 116 | (setq default-frame-alist 117 | (append default-frame-alist 118 | `((width . ,f-width) 119 | (height . ,f-height) 120 | (top . ,f-top) 121 | (left . ,f-left))))))) 122 | 123 | (defun graphene-set-fonts () 124 | "Set up default fonts." 125 | (unless graphene-default-font 126 | (setq graphene-default-font (face-font 'default))) 127 | (unless graphene-variable-pitch-font 128 | (setq graphene-variable-pitch-font (face-font 'variable-pitch))) 129 | (unless graphene-fixed-pitch-font 130 | (setq graphene-fixed-pitch-font (face-font 'fixed-pitch)))) 131 | 132 | (defun graphene-look-startup-after-init () 133 | "Load defaults for the overall Graphene look -- to be called after loading the init file so as to pick up custom settings." 134 | (if window-system 135 | (progn 136 | (graphene-set-geometry) 137 | (add-hook 'kill-emacs-hook 'graphene-save-frame-geometry) 138 | (setq-default line-spacing 2) 139 | (graphene-set-fonts) 140 | (add-to-list 'default-frame-alist `(font . ,graphene-default-font)) 141 | (set-face-font 'default graphene-default-font) 142 | (set-face-font 'variable-pitch graphene-variable-pitch-font) 143 | (set-face-font 'fixed-pitch graphene-fixed-pitch-font) 144 | (add-to-list 'default-frame-alist '(internal-border-width . 0)) 145 | (set-fringe-mode '(8 . 0)) 146 | (load-theme 'graphene-meta t) 147 | (defadvice load-theme 148 | (after load-graphene-meta-theme (theme &optional no-confirm no-enable) activate) 149 | "Load the graphene theme extensions after loading a theme." 150 | (when (not (equal theme 'graphene-meta)) 151 | (load-theme 'graphene-meta t)))) 152 | (when (not (eq system-type 'darwin)) 153 | (menu-bar-mode -1)) 154 | ;; Menu bar always off in text mode 155 | (menu-bar-mode -1))) 156 | 157 | (add-hook 'after-init-hook 'graphene-look-startup-after-init) 158 | 159 | (provide 'graphene-look) 160 | 161 | ;;; graphene-look.el ends here 162 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Melpa Status](http://melpa.org/packages/graphene-badge.svg)](http://melpa.org/#/graphene) 2 | 3 | 4 | # Graphene 5 | Graphene is a 'starter kit' for Emacs, in the vein of 6 | [Prelude](https://github.com/bbatsov/prelude) or 7 | [emacs-starter-kit](https://github.com/technomancy/emacs-starter-kit). 8 | 9 | ![Graphene screenshot](http://s3-eu-west-1.amazonaws.com/graphene/graphene.png) 10 | 11 | It provides: 12 | - Some sensible defaults 13 | - A clean look 14 | - The basics you need to make Emacs functionality discoverable 15 | - A set of third-party packages that set the standard for the 16 | essential functionality they provide 17 | - Some plumbing to make the above 'just work', seamlessly and silently 18 | 19 | Although Graphene is intended to help users of GUI editors such as 20 | Textmate or Sublime Text find their feet quickly, it is not an attempt 21 | to turn Emacs into a sparkly GUI editor or IDE. It is minimal, 22 | lightweight, and respectful of the history and character of Emacs. 23 | 24 | # News 25 | Graphene 0.9 depends on [project-persist-drawer](https://github.com/rdallasgray/project-persist-drawer) and [ppd-sr-speedbar](https://github.com/rdallasgray/ppd-sr-speedbar) to hook a drawer into project activity. 26 | 27 | Custom variables are extended and refined -- see the relevant info documentation in the `graphene` group. 28 | 29 | ## Sensible defaults 30 | Among many other things, Graphene turns off the Emacs startup screen, 31 | turns on 32 | [line wrapping](http://www.emacswiki.org/emacs/VisualLineMode), turns 33 | off the scroll bars and tool bar (and menu bar on non-OS X systems), 34 | moves automatic backups into the temp directory -- generally clears 35 | the way of small annoyances and makes things look and work the way 36 | you'd expect. 37 | 38 | ## A clean look 39 | Graphene includes its own 'meta-theme' which works hard to unify the 40 | look of the editor across a range of packages. This theme loads on top 41 | of any 'normal' theme you want to load, so you can still choose 42 | exactly how you want your Emacs to look. 43 | 44 | It also sets more pleasant and modern default fonts appropriate to the 45 | host platform (which can be overridden), and maintains window size and 46 | position across sessions. 47 | 48 | ## Discoverability 49 | At first Emacs can appear a little opaque; it is in fact a very 50 | discoverable environment, and Graphene tries to turn this up to 51 | maximum, by using 52 | [Ido](http://emacswiki.org/emacs/InteractivelyDoThings) everywhere, 53 | [Smex](http://www.emacswiki.org/Smex) for running extended commands, 54 | and [Company](http://company-mode.github.io) for in-editor 55 | completion. These allow gradual discovery of Emacs' functionality, and 56 | gradual building of speed and fluidity. 57 | 58 | ## Essential packages 59 | The collection of packages Graphene includes prevents you having to 60 | research and discover on your own what the Emacs community has largely 61 | decided on as best-in-class packages. 62 | 63 | - [project-persist](https://github.com/rdallasgray/project-persist) 64 | Disclaimer: this is my own project, and is perhaps the exception to the 65 | above rule. It provides simple project loading and saving; 66 | Graphene adds a project 'drawer' using 67 | [Sr-Speedbar](https://github.com/emacsmirror/sr-speedbar) 68 | - [Smartparens](https://github.com/Fuco1/smartparens) 69 | For auto-pairing 70 | - [Company](http://company-mode.github.io) 71 | For code completion 72 | - [Web-mode](https://github.com/fxbois/web-mode) 73 | For mixed-mode editing 74 | - [Smex](http://www.emacswiki.org/Smex) 75 | For command completion 76 | - [Ido](http://emacswiki.org/emacs/InteractivelyDoThings) 77 | For general completion 78 | - [Flycheck](https://github.com/flycheck/flycheck) 79 | For error checking 80 | 81 | ## Installation 82 | Graphene is available on [Melpa](http://melpa.org). 83 | 84 | If you don't already have your Emacs set up to use the package 85 | installation system, let me gently point you to 86 | [Pallet](https://github.com/rdallasgray/pallet). 87 | 88 | Anyway -- your default initialisation file is in (old-school) 89 | `~/.emacs` or (new-school, and where it *should* be) 90 | `~/.emacs.d/init.el`. First, you need to set up the Emacs package 91 | system and tell it about Melpa, so create one of those files if it 92 | doesn't already exist, and add these lines to the file: 93 | 94 | ``` 95 | ;; Require Emacs' package functionality 96 | (require 'package) 97 | 98 | ;; Add the Melpa repository to the list of package sources 99 | (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) 100 | 101 | ;; Initialise the package system. 102 | (package-initialize) 103 | ``` 104 | 105 | Then either select those lines and do `M-x eval-region`, or restart 106 | Emacs. After that, do `M-x list-packages`, search for 107 | 'graphene' (either manually or using `C-s`), mark it for installation 108 | by pressing 'i', and install it by pressing 'x'. 109 | 110 | It will take a while to install itself and its various dependencies, and will 111 | probably raise a few compilation issues. You can probably safely ignore 112 | these. Once it's done, add this to your initialisation file: 113 | 114 | ``` 115 | (require 'graphene) 116 | ``` 117 | Restart Emacs, and away you go. 118 | 119 | ## How do I ... ? 120 | All of the packages Graphene includes are well-documented, and I'll 121 | refer you to them rather than retread that documentation here. That 122 | said, there are some Graphene-specific things you need to know. 123 | 124 | ### Keybindings 125 | Graphene creates some new keybindings, and alters some existing ones: 126 | 127 | - `C-x k` always kills the active buffer, rather than asking you which 128 | one you want to kill 129 | - `C-x C-k` kills the default buffer and closes its window 130 | - `C-c n` creates a new buffer 131 | - `C-c N` creates a new instance of Emacs 132 | - `C-;` adds a semicolon at the end of the line 133 | - `M-RET` creates a newline below the current line and moves to it 134 | - `C-M-;` comments or uncomments the current line 135 | - `C->` increases the height of the current window 136 | - `C-<` decreases it 137 | - `C-.` increases the width of the current window 138 | - `C-,` decreases it 139 | - `C-c s` selects the Speedbar window 140 | 141 | Graphene used to bind the standard Mac keys for various purposes 142 | (Command-n for new buffer, for instance), but no longer does. 143 | 144 | ### Projects 145 | [project-persist](https://github.com/rdallasgray/project-persist) uses 146 | the following keybindings: 147 | 148 | - `C-c P n` to create a new project 149 | - `C-c P f` to find an existing project 150 | - `C-c P k` to close the current project 151 | - `C-c P d` to delete an existing project 152 | 153 | ### Customising 154 | Try `M-x customize-group` and type 'graphene', for an idea of what can 155 | be customised; you may wish to set these programmatically in your init 156 | file, instead. 157 | 158 | ## Contributions and feedback 159 | Contributions to Graphene are very welcome, as are feedback and bug 160 | reports. The latter can be raised via the Issues section. 161 | 162 | To contribute code, fork and clone the repo. If you want to be able to 163 | build the package, run `git submodule update --init`, 164 | which will install [el.mk](http://github.com/rdallasgray/el.mk), then 165 | [install Cask](https://github.com/cask/cask) and run `cask install`. 166 | 167 | When you've created your feature, make a pull request against master 168 | in this repo. 169 | -------------------------------------------------------------------------------- /graphene-editing.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-editing.el --- Graphene editing defaults 2 | ;; 3 | ;; Copyright (c) @YEAR Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: @VERSION 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; The editing defaults target the text editing environment, with particular relevance to prog modes. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | 37 | (defvar graphene-prog-mode-hook nil 38 | "A hook to be run on entering a de facto prog mode.") 39 | 40 | (defcustom graphene-prog-mode-hooks 41 | '(prog-mode-hook 42 | csharp-mode-hook 43 | coffee-mode-hook 44 | css-mode-hook 45 | sgml-mode-hook 46 | html-mode-hook) 47 | "List of hooks to be treated as prog-mode." 48 | :type 'sexp 49 | :group 'graphene) 50 | 51 | ;; Main hook to be run on entering de facto prog modes 52 | (add-hook 'graphene-prog-mode-hook 53 | (lambda () 54 | (when graphene-indent-auto 55 | (graphene-indent)) 56 | (when graphene-linum-auto 57 | (graphene-linum)) 58 | (when graphene-pairs-auto 59 | (graphene-pairs)) 60 | (when graphene-show-pairs-auto 61 | (graphene-show-pairs)) 62 | (when graphene-completion-auto 63 | (graphene-completion)) 64 | (when graphene-errors-auto 65 | (graphene-errors)))) 66 | 67 | ;; Attach de facto prog mode hooks after loading init file 68 | (add-hook 'after-init-hook 69 | (lambda () 70 | (dolist (hook graphene-prog-mode-hooks) 71 | (add-hook hook (lambda () (run-hooks 'graphene-prog-mode-hook)))))) 72 | 73 | 74 | ;;; indenting 75 | 76 | (defcustom graphene-indent-auto t 77 | "Whether graphene should auto-indent code in prog modes." 78 | :type 'sexp 79 | :group 'graphene) 80 | 81 | (defun graphene-indent () 82 | (electric-indent-mode t)) 83 | 84 | 85 | ;;; line numbering 86 | 87 | (defcustom graphene-linum-auto t 88 | "Whether graphene should enable line numbers with prog-modes." 89 | :type 'sexp 90 | :group 'graphene) 91 | 92 | (defun graphene-linum () 93 | (display-line-numbers-mode t)) 94 | 95 | ;;; auto-pairing 96 | 97 | (defcustom graphene-pairs-auto 'global 98 | "Whether graphene should enable pair matching with prog-modes." 99 | :type 'sexp 100 | :group 'graphene) 101 | 102 | (defcustom graphene-show-pairs-auto t 103 | "Whether graphene should show matching pairs with prog-modes." 104 | :type 'sexp 105 | :group 'graphene) 106 | 107 | (defun graphene-pairs () 108 | (require 'smartparens) 109 | (smartparens-mode t)) 110 | 111 | (when (eq graphene-pairs-auto 'global) 112 | (require 'smartparens) 113 | (smartparens-global-mode t)) 114 | 115 | (defun graphene-show-pairs () 116 | (show-paren-mode nil) 117 | (setq blink-matching-paren nil) 118 | (require 'smartparens) 119 | (show-smartparens-mode) 120 | (setq sp-show-pair-delay 0)) 121 | 122 | (eval-after-load 'smartparens 123 | '(progn 124 | (require 'smartparens-config) 125 | (require 'graphene-smartparens-config) 126 | (setq sp-highlight-pair-overlay nil))) 127 | 128 | 129 | ;;; completion 130 | 131 | (defcustom graphene-completion-auto 'global 132 | "Whether graphene should enable autocomplete with prog-modes." 133 | :type 'sexp 134 | :group 'graphene) 135 | 136 | (defun graphene-completion () 137 | (require 'company) 138 | (company-mode t)) 139 | 140 | (when (eq graphene-completion-auto 'global) 141 | (require 'company) 142 | (global-company-mode t)) 143 | 144 | (eval-after-load 'company 145 | '(progn 146 | (define-key company-active-map (kbd "RET") nil) 147 | (setq company-idle-delay 0.125 148 | company-minimum-prefix-length 1 149 | company-require-match nil 150 | company-transformers '(company-sort-by-occurrence) 151 | company-dabbrev-ignore-case nil 152 | company-dabbrev-downcase nil 153 | company-frontends '(company-pseudo-tooltip-unless-just-one-frontend 154 | company-preview-frontend 155 | company-echo-metadata-frontend)))) 156 | 157 | 158 | ;;; error checking 159 | 160 | (defcustom graphene-errors-auto t 161 | "Whether graphene should highlight errors with prog-modes." 162 | :type 'sexp 163 | :group 'graphene) 164 | 165 | (defun graphene-errors () 166 | (require 'flycheck) 167 | (flycheck-mode)) 168 | 169 | (eval-after-load 'flycheck 170 | '(progn 171 | (defun graphene--flycheck-display-errors-function (errors) 172 | (mapc (lambda (err) 173 | (message "FlyC: %s" (flycheck-error-message err)) (sit-for 1)) 174 | errors)) 175 | (setq flycheck-highlighting-mode nil 176 | flycheck-display-errors-function 'graphene--flycheck-display-errors-function))) 177 | 178 | 179 | ;;; template editing 180 | 181 | (require 'web-mode) 182 | 183 | (push '("php" . "\\.phtml\\'") web-mode-engine-file-regexps) 184 | 185 | (dolist (engine-regexp web-mode-engine-file-regexps) 186 | (when (cdr engine-regexp) 187 | (add-to-list 'auto-mode-alist `(,(cdr engine-regexp) . web-mode)))) 188 | 189 | (add-hook 'web-mode-hook 190 | (lambda () 191 | (setq web-mode-disable-auto-pairing t))) 192 | 193 | 194 | ;; Delete marked text on typing 195 | (delete-selection-mode t) 196 | 197 | ;; Soft-wrap lines 198 | (global-visual-line-mode t) 199 | 200 | ;; Don't use tabs for indent; replace tabs with two spaces. 201 | (setq-default tab-width 2) 202 | (setq-default indent-tabs-mode nil) 203 | 204 | ;; Better scrolling with mouse wheel/trackpad. 205 | (unless (and (boundp 'mac-mouse-wheel-smooth-scroll) mac-mouse-wheel-smooth-scroll) 206 | (global-set-key [wheel-down] (lambda () (interactive) (scroll-up-command 1))) 207 | (global-set-key [wheel-up] (lambda () (interactive) (scroll-down-command 1))) 208 | (global-set-key [double-wheel-down] (lambda () (interactive) (scroll-up-command 2))) 209 | (global-set-key [double-wheel-up] (lambda () (interactive) (scroll-down-command 2))) 210 | (global-set-key [triple-wheel-down] (lambda () (interactive) (scroll-up-command 4))) 211 | (global-set-key [triple-wheel-up] (lambda () (interactive) (scroll-down-command 4)))) 212 | 213 | ;; Character encodings default to utf-8. 214 | (prefer-coding-system 'utf-8) 215 | (set-language-environment 'utf-8) 216 | (set-default-coding-systems 'utf-8) 217 | (set-terminal-coding-system 'utf-8) 218 | (set-selection-coding-system 'utf-8) 219 | 220 | ;; apply syntax highlighting to all buffers 221 | (global-font-lock-mode t) 222 | 223 | ;; auto json-mode 224 | (push '("\\.json\\'" . json-mode) auto-mode-alist) 225 | 226 | ;; 2-space indent for CSS 227 | (setq css-indent-offset 2) 228 | 229 | ;; Default Ruby filetypes 230 | (dolist (regex 231 | '("\\.watchr$" "\\.arb$" "\\.rake$" "\\.gemspec$" "\\.ru$" "Rakefile$" 232 | "Gemfile$" "Capfile$" "Guardfile$" "Rakefile$" "Cheffile$" "Vagrantfile$" 233 | "Berksfile$" "\\.builder$")) 234 | (add-to-list 'auto-mode-alist `(,regex . ruby-mode))) 235 | 236 | (provide 'graphene-editing) 237 | 238 | ;;; graphene-editing.el ends here 239 | -------------------------------------------------------------------------------- /lib/graphene-editing.el: -------------------------------------------------------------------------------- 1 | ;;; graphene-editing.el --- Graphene editing defaults 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Graphene is a set of default settings and functionality to make Emacs a little friendlier. 15 | ;; The editing defaults target the text editing environment, with particular relevance to prog modes. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | 37 | (defvar graphene-prog-mode-hook nil 38 | "A hook to be run on entering a de facto prog mode.") 39 | 40 | (defcustom graphene-prog-mode-hooks 41 | '(prog-mode-hook 42 | csharp-mode-hook 43 | coffee-mode-hook 44 | css-mode-hook 45 | sgml-mode-hook 46 | html-mode-hook) 47 | "List of hooks to be treated as prog-mode." 48 | :type 'sexp 49 | :group 'graphene) 50 | 51 | ;; Main hook to be run on entering de facto prog modes 52 | (add-hook 'graphene-prog-mode-hook 53 | (lambda () 54 | (when graphene-indent-auto 55 | (graphene-indent)) 56 | (when graphene-linum-auto 57 | (graphene-linum)) 58 | (when graphene-pairs-auto 59 | (graphene-pairs)) 60 | (when graphene-show-pairs-auto 61 | (graphene-show-pairs)) 62 | (when graphene-completion-auto 63 | (graphene-completion)) 64 | (when graphene-errors-auto 65 | (graphene-errors)))) 66 | 67 | ;; Attach de facto prog mode hooks after loading init file 68 | (add-hook 'after-init-hook 69 | (lambda () 70 | (dolist (hook graphene-prog-mode-hooks) 71 | (add-hook hook (lambda () (run-hooks 'graphene-prog-mode-hook)))))) 72 | 73 | 74 | ;;; indenting 75 | 76 | (defcustom graphene-indent-auto t 77 | "Whether graphene should auto-indent code in prog modes." 78 | :type 'sexp 79 | :group 'graphene) 80 | 81 | (defun graphene-indent () 82 | (electric-indent-mode t)) 83 | 84 | 85 | ;;; line numbering 86 | 87 | (defcustom graphene-linum-auto t 88 | "Whether graphene should enable line numbers with prog-modes." 89 | :type 'sexp 90 | :group 'graphene) 91 | 92 | (defun graphene-linum () 93 | (setq linum-format " %4d ") 94 | (linum-mode t)) 95 | 96 | ;;; auto-pairing 97 | 98 | (defcustom graphene-pairs-auto 'global 99 | "Whether graphene should enable pair matching with prog-modes." 100 | :type 'sexp 101 | :group 'graphene) 102 | 103 | (defcustom graphene-show-pairs-auto t 104 | "Whether graphene should show matching pairs with prog-modes." 105 | :type 'sexp 106 | :group 'graphene) 107 | 108 | (defun graphene-pairs () 109 | (require 'smartparens) 110 | (smartparens-mode t)) 111 | 112 | (when (eq graphene-pairs-auto 'global) 113 | (require 'smartparens) 114 | (smartparens-global-mode t)) 115 | 116 | (defun graphene-show-pairs () 117 | (show-paren-mode nil) 118 | (setq blink-matching-paren nil) 119 | (require 'smartparens) 120 | (show-smartparens-mode) 121 | (setq sp-show-pair-delay 0)) 122 | 123 | (eval-after-load 'smartparens 124 | '(progn 125 | (require 'smartparens-config) 126 | (require 'graphene-smartparens-config) 127 | (setq sp-highlight-pair-overlay nil))) 128 | 129 | 130 | ;;; completion 131 | 132 | (defcustom graphene-completion-auto 'global 133 | "Whether graphene should enable autocomplete with prog-modes." 134 | :type 'sexp 135 | :group 'graphene) 136 | 137 | (defun graphene-completion () 138 | (require 'company) 139 | (company-mode t)) 140 | 141 | (when (eq graphene-completion-auto 'global) 142 | (require 'company) 143 | (global-company-mode t)) 144 | 145 | (eval-after-load 'company 146 | '(progn 147 | (define-key company-active-map (kbd "RET") nil) 148 | (setq company-idle-delay 0.125 149 | company-minimum-prefix-length 1 150 | company-require-match nil 151 | company-transformers '(company-sort-by-occurrence) 152 | company-dabbrev-ignore-case nil 153 | company-dabbrev-downcase nil 154 | company-frontends '(company-pseudo-tooltip-unless-just-one-frontend 155 | company-preview-frontend 156 | company-echo-metadata-frontend)))) 157 | 158 | 159 | ;;; error checking 160 | 161 | (defcustom graphene-errors-auto t 162 | "Whether graphene should highlight errors with prog-modes." 163 | :type 'sexp 164 | :group 'graphene) 165 | 166 | (defun graphene-errors () 167 | (require 'flycheck) 168 | (flycheck-mode)) 169 | 170 | (eval-after-load 'flycheck 171 | '(progn 172 | (defun graphene--flycheck-display-errors-function (errors) 173 | (mapc (lambda (err) 174 | (message "FlyC: %s" (flycheck-error-message err)) (sit-for 1)) 175 | errors)) 176 | (setq flycheck-highlighting-mode nil 177 | flycheck-display-errors-function 'graphene--flycheck-display-errors-function))) 178 | 179 | 180 | ;;; template editing 181 | 182 | (require 'web-mode) 183 | 184 | (push '("php" . "\\.phtml\\'") web-mode-engine-file-regexps) 185 | 186 | (dolist (engine-regexp web-mode-engine-file-regexps) 187 | (when (cdr engine-regexp) 188 | (add-to-list 'auto-mode-alist `(,(cdr engine-regexp) . web-mode)))) 189 | 190 | (add-hook 'web-mode-hook 191 | (lambda () 192 | (setq web-mode-disable-auto-pairing t))) 193 | 194 | 195 | ;; Delete marked text on typing 196 | (delete-selection-mode t) 197 | 198 | ;; Soft-wrap lines 199 | (global-visual-line-mode t) 200 | 201 | ;; Don't use tabs for indent; replace tabs with two spaces. 202 | (setq-default tab-width 2) 203 | (setq-default indent-tabs-mode nil) 204 | 205 | ;; Better scrolling with mouse wheel/trackpad. 206 | (unless (and (boundp 'mac-mouse-wheel-smooth-scroll) mac-mouse-wheel-smooth-scroll) 207 | (global-set-key [wheel-down] (lambda () (interactive) (scroll-up-command 1))) 208 | (global-set-key [wheel-up] (lambda () (interactive) (scroll-down-command 1))) 209 | (global-set-key [double-wheel-down] (lambda () (interactive) (scroll-up-command 2))) 210 | (global-set-key [double-wheel-up] (lambda () (interactive) (scroll-down-command 2))) 211 | (global-set-key [triple-wheel-down] (lambda () (interactive) (scroll-up-command 4))) 212 | (global-set-key [triple-wheel-up] (lambda () (interactive) (scroll-down-command 4)))) 213 | 214 | ;; Character encodings default to utf-8. 215 | (prefer-coding-system 'utf-8) 216 | (set-language-environment 'utf-8) 217 | (set-default-coding-systems 'utf-8) 218 | (set-terminal-coding-system 'utf-8) 219 | (set-selection-coding-system 'utf-8) 220 | 221 | ;; apply syntax highlighting to all buffers 222 | (global-font-lock-mode t) 223 | 224 | ;; auto json-mode 225 | (push '("\\.json\\'" . json-mode) auto-mode-alist) 226 | 227 | ;; 2-space indent for CSS 228 | (setq css-indent-offset 2) 229 | 230 | ;; Default Ruby filetypes 231 | (dolist (regex 232 | '("\\.watchr$" "\\.arb$" "\\.rake$" "\\.gemspec$" "\\.ru$" "Rakefile$" 233 | "Gemfile$" "Capfile$" "Guardfile$" "Rakefile$" "Cheffile$" "Vagrantfile$" 234 | "Berksfile$" "\\.builder$")) 235 | (add-to-list 'auto-mode-alist `(,regex . ruby-mode))) 236 | 237 | (provide 'graphene-editing) 238 | 239 | ;;; graphene-editing.el ends here 240 | -------------------------------------------------------------------------------- /lib/graphene.el: -------------------------------------------------------------------------------- 1 | ;;; graphene.el --- Newbie-friendly defaults 2 | ;; 3 | ;; Copyright (c) 2018 Robert Dallas Gray 4 | ;; 5 | ;; Author: Robert Dallas Gray 6 | ;; URL: https://github.com/rdallasgray/graphene 7 | ;; Version: 1.0.0 8 | ;; Keywords: defaults 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; [![Melpa Status](http://melpa.org/packages/graphene-badge.svg)](http://melpa.org/#/graphene) 15 | ;; 16 | ;; 17 | ;; # Graphene 18 | ;; Graphene is a 'starter kit' for Emacs, in the vein of 19 | ;; [Prelude](https://github.com/bbatsov/prelude) or 20 | ;; [emacs-starter-kit](https://github.com/technomancy/emacs-starter-kit). 21 | ;; 22 | ;; ![Graphene screenshot](http://s3-eu-west-1.amazonaws.com/graphene/graphene.png) 23 | ;; 24 | ;; It provides: 25 | ;; - Some sensible defaults 26 | ;; - A clean look 27 | ;; - The basics you need to make Emacs functionality discoverable 28 | ;; - A set of third-party packages that set the standard for the 29 | ;; essential functionality they provide 30 | ;; - Some plumbing to make the above 'just work', seamlessly and silently 31 | ;; 32 | ;; Although Graphene is intended to help users of GUI editors such as 33 | ;; Textmate or Sublime Text find their feet quickly, it is not an attempt 34 | ;; to turn Emacs into a sparkly GUI editor or IDE. It is minimal, 35 | ;; lightweight, and respectful of the history and character of Emacs. 36 | ;; 37 | ;; # News 38 | ;; Graphene 0.9 depends on [project-persist-drawer](https://github.com/rdallasgray/project-persist-drawer) and [ppd-sr-speedbar](https://github.com/rdallasgray/ppd-sr-speedbar) to hook a drawer into project activity. 39 | ;; 40 | ;; Custom variables are extended and refined -- see the relevant info documentation in the `graphene` group. 41 | ;; 42 | ;; ## Sensible defaults 43 | ;; Among many other things, Graphene turns off the Emacs startup screen, 44 | ;; turns on 45 | ;; [line wrapping](http://www.emacswiki.org/emacs/VisualLineMode), turns 46 | ;; off the scroll bars and tool bar (and menu bar on non-OS X systems), 47 | ;; moves automatic backups into the temp directory -- generally clears 48 | ;; the way of small annoyances and makes things look and work the way 49 | ;; you'd expect. 50 | ;; 51 | ;; ## A clean look 52 | ;; Graphene includes its own 'meta-theme' which works hard to unify the 53 | ;; look of the editor across a range of packages. This theme loads on top 54 | ;; of any 'normal' theme you want to load, so you can still choose 55 | ;; exactly how you want your Emacs to look. 56 | ;; 57 | ;; It also sets more pleasant and modern default fonts appropriate to the 58 | ;; host platform (which can be overridden), and maintains window size and 59 | ;; position across sessions. 60 | ;; 61 | ;; ## Discoverability 62 | ;; At first Emacs can appear a little opaque; it is in fact a very 63 | ;; discoverable environment, and Graphene tries to turn this up to 64 | ;; maximum, by using 65 | ;; [Ido](http://emacswiki.org/emacs/InteractivelyDoThings) everywhere, 66 | ;; [Smex](http://www.emacswiki.org/Smex) for running extended commands, 67 | ;; and [Company](http://company-mode.github.io) for in-editor 68 | ;; completion. These allow gradual discovery of Emacs' functionality, and 69 | ;; gradual building of speed and fluidity. 70 | ;; 71 | ;; ## Essential packages 72 | ;; The collection of packages Graphene includes prevents you having to 73 | ;; research and discover on your own what the Emacs community has largely 74 | ;; decided on as best-in-class packages. 75 | ;; 76 | ;; - [project-persist](https://github.com/rdallasgray/project-persist) 77 | ;; Disclaimer: this is my own project, and is perhaps the exception to the 78 | ;; above rule. It provides simple project loading and saving; 79 | ;; Graphene adds a project 'drawer' using 80 | ;; [Sr-Speedbar](https://github.com/emacsmirror/sr-speedbar) 81 | ;; - [Smartparens](https://github.com/Fuco1/smartparens) 82 | ;; For auto-pairing 83 | ;; - [Company](http://company-mode.github.io) 84 | ;; For code completion 85 | ;; - [Web-mode](https://github.com/fxbois/web-mode) 86 | ;; For mixed-mode editing 87 | ;; - [Smex](http://www.emacswiki.org/Smex) 88 | ;; For command completion 89 | ;; - [Ido](http://emacswiki.org/emacs/InteractivelyDoThings) 90 | ;; For general completion 91 | ;; - [Flycheck](https://github.com/flycheck/flycheck) 92 | ;; For error checking 93 | ;; 94 | ;; ## Installation 95 | ;; Graphene is available on [Melpa](http://melpa.org). 96 | ;; 97 | ;; If you don't already have your Emacs set up to use the package 98 | ;; installation system, let me gently point you to 99 | ;; [Pallet](https://github.com/rdallasgray/pallet). 100 | ;; 101 | ;; Anyway -- your default initialisation file is in (old-school) 102 | ;; `~/.emacs` or (new-school, and where it *should* be) 103 | ;; `~/.emacs.d/init.el`. First, you need to set up the Emacs package 104 | ;; system and tell it about Melpa, so create one of those files if it 105 | ;; doesn't already exist, and add these lines to the file: 106 | ;; 107 | ;; ``` 108 | ;; ;; Require Emacs' package functionality 109 | ;; (require 'package) 110 | ;; 111 | ;; ;; Add the Melpa repository to the list of package sources 112 | ;; (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) 113 | ;; 114 | ;; ;; Initialise the package system. 115 | ;; (package-initialize) 116 | ;; ``` 117 | ;; 118 | ;; Then either select those lines and do `M-x eval-region`, or restart 119 | ;; Emacs. After that, do `M-x list-packages`, search for 120 | ;; 'graphene' (either manually or using `C-s`), mark it for installation 121 | ;; by pressing 'i', and install it by pressing 'x'. 122 | ;; 123 | ;; It will take a while to install itself and its various dependencies, and will 124 | ;; probably raise a few compilation issues. You can probably safely ignore 125 | ;; these. Once it's done, add this to your initialisation file: 126 | ;; 127 | ;; ``` 128 | ;; (require 'graphene) 129 | ;; ``` 130 | ;; Restart Emacs, and away you go. 131 | ;; 132 | ;; ## How do I ... ? 133 | ;; All of the packages Graphene includes are well-documented, and I'll 134 | ;; refer you to them rather than retread that documentation here. That 135 | ;; said, there are some Graphene-specific things you need to know. 136 | ;; 137 | ;; ### Keybindings 138 | ;; Graphene creates some new keybindings, and alters some existing ones: 139 | ;; 140 | ;; - `C-x k` always kills the active buffer, rather than asking you which 141 | ;; one you want to kill 142 | ;; - `C-x C-k` kills the default buffer and closes its window 143 | ;; - `C-c n` creates a new buffer 144 | ;; - `C-c N` creates a new instance of Emacs 145 | ;; - `C-;` adds a semicolon at the end of the line 146 | ;; - `M-RET` creates a newline below the current line and moves to it 147 | ;; - `C-M-;` comments or uncomments the current line 148 | ;; - `C->` increases the height of the current window 149 | ;; - `C-<` decreases it 150 | ;; - `C-.` increases the width of the current window 151 | ;; - `C-,` decreases it 152 | ;; - `C-c s` selects the Speedbar window 153 | ;; 154 | ;; Graphene used to bind the standard Mac keys for various purposes 155 | ;; (Command-n for new buffer, for instance), but no longer does. 156 | ;; 157 | ;; ### Projects 158 | ;; [project-persist](https://github.com/rdallasgray/project-persist) uses 159 | ;; the following keybindings: 160 | ;; 161 | ;; - `C-c P n` to create a new project 162 | ;; - `C-c P f` to find an existing project 163 | ;; - `C-c P k` to close the current project 164 | ;; - `C-c P d` to delete an existing project 165 | ;; 166 | ;; ### Customising 167 | ;; Try `M-x customize-group` and type 'graphene', for an idea of what can 168 | ;; be customised; you may wish to set these programmatically in your init 169 | ;; file, instead. 170 | ;; 171 | ;; ## Contributions and feedback 172 | ;; Contributions to Graphene are very welcome, as are feedback and bug 173 | ;; reports. The latter can be raised via the Issues section. 174 | ;; 175 | ;; To contribute code, fork and clone the repo. If you want to be able to 176 | ;; build the package, run `git submodule update --init`, 177 | ;; which will install [el.mk](http://github.com/rdallasgray/el.mk), then 178 | ;; [install Cask](https://github.com/cask/cask) and run `cask install`. 179 | ;; 180 | ;; When you've created your feature, make a pull request against master 181 | ;; in this repo. 182 | 183 | ;;; License: 184 | 185 | ;; This program is free software; you can redistribute it and/or 186 | ;; modify it under the terms of the GNU General Public License 187 | ;; as published by the Free Software Foundation; either version 3 188 | ;; of the License, or (at your option) any later version. 189 | ;; 190 | ;; This program is distributed in the hope that it will be useful, 191 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 192 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 193 | ;; GNU General Public License for more details. 194 | ;; 195 | ;; You should have received a copy of the GNU General Public License 196 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 197 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 198 | ;; Boston, MA 02110-1301, USA. 199 | 200 | ;;; Code: 201 | 202 | (defgroup graphene nil 203 | "Graphene custom settings." 204 | :group 'environment) 205 | 206 | (require 'graphene-helper-functions) 207 | (require 'graphene-editing) 208 | (require 'graphene-env) 209 | (require 'graphene-projects) 210 | (require 'graphene-look) 211 | 212 | (provide 'graphene) 213 | 214 | ;;; graphene.el ends here 215 | --------------------------------------------------------------------------------