From 5ffa4bb187762068ae330e45befdb49eb4ae43a9 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Sun, 11 May 2014 16:59:28 -0700 Subject: [PATCH 01/10] Pull Prelude's custom variables into a new file This is so we can define a custom variable to use in prelude-core --- core/prelude-custom.el | 69 ++++++++++++++++++++++++++++++++++++++++++ core/prelude-editor.el | 32 -------------------- init.el | 1 + 3 files changed, 70 insertions(+), 32 deletions(-) create mode 100644 core/prelude-custom.el diff --git a/core/prelude-custom.el b/core/prelude-custom.el new file mode 100644 index 0000000..095b583 --- /dev/null +++ b/core/prelude-custom.el @@ -0,0 +1,69 @@ +;;; prelude-custom.el --- Emacs Prelude: Prelude's customizable variables. +;; +;; Copyright © 2011-2013 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: https://github.com/bbatsov/prelude +;; Version: 1.0.0 +;; Keywords: convenience + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Refinements of the core editing experience in Emacs. + +;;; License: + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 3 +;; of the License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +;; customize +(defgroup prelude nil + "Emacs Prelude configuration." + :prefix "prelude-" + :group 'convenience) + +(defcustom prelude-auto-save t + "Non-nil values enable Prelude's auto save." + :type 'boolean + :group 'prelude) + +(defcustom prelude-guru t + "Non-nil values enable guru-mode." + :type 'boolean + :group 'prelude) + +(defcustom prelude-whitespace t + "Non-nil values enable Prelude's whitespace visualization." + :type 'boolean + :group 'prelude) + +(defcustom prelude-clean-whitespace-on-save t + "Cleanup whitespace from file before it's saved. +Will only occur if prelude-whitespace is also enabled." + :type 'boolean + :group 'prelude) + +(defcustom prelude-flyspell t + "Non-nil values enable Prelude's flyspell support." + :type 'boolean + :group 'prelude) + +(provide 'prelude-custom) + +;;; prelude-custom.el ends here diff --git a/core/prelude-editor.el b/core/prelude-editor.el index 9a31dd7..276a544 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -32,38 +32,6 @@ ;;; Code: -;; customize -(defgroup prelude nil - "Emacs Prelude configuration." - :prefix "prelude-" - :group 'convenience) - -(defcustom prelude-auto-save t - "Non-nil values enable Prelude's auto save." - :type 'boolean - :group 'prelude) - -(defcustom prelude-guru t - "Non-nil values enable guru-mode." - :type 'boolean - :group 'prelude) - -(defcustom prelude-whitespace t - "Non-nil values enable Prelude's whitespace visualization." - :type 'boolean - :group 'prelude) - -(defcustom prelude-clean-whitespace-on-save t - "Cleanup whitespace from file before it's saved. -Will only occur if prelude-whitespace is also enabled." - :type 'boolean - :group 'prelude) - -(defcustom prelude-flyspell t - "Non-nil values enable Prelude's flyspell support." - :type 'boolean - :group 'prelude) - ;; Death to the tabs! However, tabs historically indent to the next ;; 8-character offset; specifying anything else will cause *mass* ;; confusion, as it will change the appearance of every existing file. diff --git a/init.el b/init.el index 4482efa..af0e492 100644 --- a/init.el +++ b/init.el @@ -100,6 +100,7 @@ by Prelude.") ;; the core stuff (require 'prelude-packages) (require 'prelude-ui) +(require 'prelude-custom) (require 'prelude-core) (require 'prelude-mode) (require 'prelude-editor) From 57ef5bb24957cb5edf37dadba755f067cd6f82ed Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Sun, 11 May 2014 17:01:38 -0700 Subject: [PATCH 02/10] Add new prelude custom variable for user-init-file This way the prelude-find-user-init-file can actually take you to a useful file (instead of to init.el) --- core/prelude-core.el | 2 +- core/prelude-custom.el | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index 5832930..def4edc 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -553,7 +553,7 @@ This follows freedesktop standards, should work in X servers." (defun prelude-find-user-init-file () "Edit the `user-init-file', in another window." (interactive) - (find-file-other-window user-init-file)) + (find-file-other-window prelude-user-init-file)) (defun prelude-find-shell-init-file () "Edit the shell init file in another window." diff --git a/core/prelude-custom.el b/core/prelude-custom.el index 095b583..ad453e7 100644 --- a/core/prelude-custom.el +++ b/core/prelude-custom.el @@ -64,6 +64,15 @@ Will only occur if prelude-whitespace is also enabled." :type 'boolean :group 'prelude) +(defcustom prelude-user-init-file (concat user-emacs-directory + "personal/") + "Path to your personal customization file. + +Since Prelude recommends you only put personal customizations in +the personal folder." + :type 'string + :group 'prelude) + (provide 'prelude-custom) ;;; prelude-custom.el ends here From eba385e3d9fc114179f0991c66069532f745a6c7 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Sun, 11 May 2014 17:09:24 -0700 Subject: [PATCH 03/10] Fix checkdoc problems with new custom file --- core/prelude-custom.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/prelude-custom.el b/core/prelude-custom.el index ad453e7..2fdc313 100644 --- a/core/prelude-custom.el +++ b/core/prelude-custom.el @@ -44,7 +44,7 @@ :group 'prelude) (defcustom prelude-guru t - "Non-nil values enable guru-mode." + "Non-nil values enable `guru-mode'." :type 'boolean :group 'prelude) @@ -55,7 +55,7 @@ (defcustom prelude-clean-whitespace-on-save t "Cleanup whitespace from file before it's saved. -Will only occur if prelude-whitespace is also enabled." +Will only occur if `prelude-whitespace' is also enabled." :type 'boolean :group 'prelude) From d2b954b04ce81afafce1ab17f7a8f62fba0c6f5d Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Sun, 11 May 2014 17:10:01 -0700 Subject: [PATCH 04/10] Add comment documenting load dependency --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.el b/init.el index af0e492..beea1cd 100644 --- a/init.el +++ b/init.el @@ -100,7 +100,7 @@ by Prelude.") ;; the core stuff (require 'prelude-packages) (require 'prelude-ui) -(require 'prelude-custom) +(require 'prelude-custom) ;; Needs to be loaded before core and editor (require 'prelude-core) (require 'prelude-mode) (require 'prelude-editor) From 7bb680b1dff048fc0284e00a91cc495204321a82 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Sun, 11 May 2014 17:46:08 -0700 Subject: [PATCH 05/10] Add to documentation for new variable Describe a simple and easy way to specify which file should be used as the "init-file." --- core/prelude-custom.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/prelude-custom.el b/core/prelude-custom.el index 2fdc313..d617a24 100644 --- a/core/prelude-custom.el +++ b/core/prelude-custom.el @@ -69,7 +69,9 @@ Will only occur if `prelude-whitespace' is also enabled." "Path to your personal customization file. Since Prelude recommends you only put personal customizations in -the personal folder." +the personal folder. This can be easily set to the desired buffer +in lisp by putting `(setq prelude-user-init-file buffer-file-name)' +in the file that should be accessed with `prelude-find-user-init-file'." :type 'string :group 'prelude) From b30cc884b9d29df5c79bbc2b5b1ba01cff612205 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Wed, 14 May 2014 19:50:01 -0700 Subject: [PATCH 06/10] Rewrite the doc string to be less bad --- core/prelude-custom.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/prelude-custom.el b/core/prelude-custom.el index d617a24..2a87c7a 100644 --- a/core/prelude-custom.el +++ b/core/prelude-custom.el @@ -67,11 +67,12 @@ Will only occur if `prelude-whitespace' is also enabled." (defcustom prelude-user-init-file (concat user-emacs-directory "personal/") "Path to your personal customization file. - -Since Prelude recommends you only put personal customizations in -the personal folder. This can be easily set to the desired buffer +Prelude recommends you only put personal customizations in the +personal folder. This variable allows you to specify a specific +folder as the one that should be visited when running +`prelude-find-user-init-file'. This can be easily set to the desired buffer in lisp by putting `(setq prelude-user-init-file buffer-file-name)' -in the file that should be accessed with `prelude-find-user-init-file'." +in the desired elisp file." :type 'string :group 'prelude) From c380a3f0018a859265eec8465774b8c74e1d2bcb Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Wed, 14 May 2014 19:50:37 -0700 Subject: [PATCH 07/10] Update prelude-find-user-init-file docstring To reference the variable that it actually pulls from now --- core/prelude-core.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index def4edc..568e6f8 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -551,7 +551,7 @@ This follows freedesktop standards, should work in X servers." (error "Only X server is supported"))) (defun prelude-find-user-init-file () - "Edit the `user-init-file', in another window." + "Edit the `prelude-user-init-file', in another window." (interactive) (find-file-other-window prelude-user-init-file)) From 1ac728d6a7ceffd7fbc8c061c6195c37f1ab9c5a Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Thu, 15 May 2014 13:43:51 -0700 Subject: [PATCH 08/10] Use expand-file-name instead of concat --- core/prelude-custom.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/prelude-custom.el b/core/prelude-custom.el index 2a87c7a..e5cd193 100644 --- a/core/prelude-custom.el +++ b/core/prelude-custom.el @@ -64,8 +64,8 @@ Will only occur if `prelude-whitespace' is also enabled." :type 'boolean :group 'prelude) -(defcustom prelude-user-init-file (concat user-emacs-directory - "personal/") +(defcustom prelude-user-init-file (expand-file-name "personal/" + user-emacs-directory) "Path to your personal customization file. Prelude recommends you only put personal customizations in the personal folder. This variable allows you to specify a specific From 3896e421d031fd69271efc6be00adb7280ea8dcc Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Thu, 15 May 2014 13:48:24 -0700 Subject: [PATCH 09/10] Find user-init-file when given prefix arg --- core/prelude-core.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index 568e6f8..c96a8b5 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -550,10 +550,12 @@ This follows freedesktop standards, should work in X servers." '(2 "_NET_WM_STATE_FULLSCREEN" 0)) (error "Only X server is supported"))) -(defun prelude-find-user-init-file () - "Edit the `prelude-user-init-file', in another window." - (interactive) - (find-file-other-window prelude-user-init-file)) +(defun prelude-find-user-init-file (arg) + "Edit the `prelude-user-init-file', in another window. +With a prefix argument ARG, find the `user-init-file' instead." + (interactive "P") + (if arg (find-file-other-window user-init-file) + (find-file-other-window prelude-user-init-file))) (defun prelude-find-shell-init-file () "Edit the shell init file in another window." From ab06782c9bebf90533e74380054dd6b758a9df75 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Thu, 15 May 2014 13:54:38 -0700 Subject: [PATCH 10/10] Make prefix argument optional It seems to be the general style of how prefix args are done... --- core/prelude-core.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index c96a8b5..525c876 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -550,7 +550,7 @@ This follows freedesktop standards, should work in X servers." '(2 "_NET_WM_STATE_FULLSCREEN" 0)) (error "Only X server is supported"))) -(defun prelude-find-user-init-file (arg) +(defun prelude-find-user-init-file (&optional arg) "Edit the `prelude-user-init-file', in another window. With a prefix argument ARG, find the `user-init-file' instead." (interactive "P")