Remove some packages

This commit is contained in:
Gergely Polonkai 2016-10-14 15:27:47 +02:00
parent 3ce02ba00c
commit f2524d8617
13 changed files with 0 additions and 747 deletions

View File

@ -1,15 +0,0 @@
;;; gitconfig-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
;;;### (autoloads nil nil ("gitconfig.el") (22500 1787 601913 796000))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; gitconfig-autoloads.el ends here

View File

@ -1 +0,0 @@
(define-package "gitconfig" "20130718.235" "Emacs lisp interface to work with git-config variables" 'nil :keywords '("git" "gitconfig" "git-config"))

View File

@ -1,228 +0,0 @@
;;; gitconfig.el --- Emacs lisp interface to work with git-config variables
;;
;; Filename: gitconfig.el
;; Description: Emacs lisp interface to work with git-config variables
;; Author: Samuel Tonini
;; Maintainer: Samuel Tonini
;; Version: 1.0.0
;; Package-Version: 20130718.235
;; URL:
;; Keywords: git, gitconfig, git-config
;; 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, 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 this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;; Commentary:
;;
;; Manual Installation:
;;
;; (add-to-list 'load-path "~/path/to/gitconfig.el/")
;; (require 'gitconfig)
;;
;; Interesting variables are:
;;
;; `gitconfig-git-command'
;;
;; The shell command for <git>
;;
;; `gitconfig-buffer-name'
;;
;; Name of the <git> output buffer.
;;
;; Interactive functions are:
;;
;; M-x gitconfig-execute-command
;;
;; Run <git config> with custom ARGUMENTS and display it in `gitconfig-buffer-name'
;;
;; Non-Interactive functions are:
;;
;; `gitconfig-current-inside-git-repository-p'
;;
;; Return t if `default-directory' is a git repository
;;
;; `gitconfig-path-to-git-repository'
;;
;; Return the absolute path of the current git repository
;;
;; `gitconfig-get-variables'
;;
;; Get all variables for the given LOCATION
;; and return it as a hash table
;;
;; `gitconfig-set-variable'
;;
;; Set a specific LOCATION variable with a given NAME and VALUE
;;
;; `gitconfig-get-variable'
;;
;; Return a specific LOCATION variable for the given NAME
;;
;; `gitconfig-delete-variable'
;;
;; Delete a specific LOCATION variable for the given NAME
;;
;; `gitconfig-get-local-variables'
;;
;; Return all <git config --local --list> variables as hash table
;;
;; `gitconfig-get-global-variables'
;;
;; Return all <git config --global --list> variables as hash table
;;
;; `gitconfig-get-system-variables'
;;
;; Return all <git config --system --list> variables as hash table
;;
;; `gitconfig-get-local-variable'
;;
;; Return a specific <git config --local --list> variable by the given NAME
;;
;; `gitconfig-get-global-variable'
;;
;; Return a specific <git config --global --list> variable by the given NAME
;;
;; `gitconfig-get-system-variable'
;;
;; Return a specific <git config --system --list> variable by the given NAME
;;
;;; Code:
(defcustom gitconfig-git-command "git"
"The shell command for git"
:type 'string
:group 'gitconfig)
(defvar gitconfig-buffer-name "*GITCONFIG*"
"Name of the git output buffer.")
(defun gitconfig--get-keys (hash)
"Return all keys for given HASH"
(let (keys)
(maphash (lambda (key value) (setq keys (cons key keys))) hash)
keys))
(defun gitconfig--get-buffer (name)
"Get and kills a buffer if exists and returns a new one."
(let ((buffer (get-buffer name)))
(when buffer (kill-buffer buffer))
(generate-new-buffer name)))
(defun gitconfig--buffer-setup (buffer)
"Setup the gitconfig buffer before display."
(display-buffer buffer)
(with-current-buffer buffer
(setq buffer-read-only nil)
(local-set-key "q" 'quit-window)))
(defun gitconfig-current-inside-git-repository-p ()
"Return t if the `default-directory' is a <git> repository"
(let ((inside-work-tree (shell-command-to-string
(format "%s rev-parse --is-inside-work-tree"
gitconfig-git-command))))
(string= (replace-regexp-in-string "\n" "" inside-work-tree nil t) "true")))
(defun gitconfig-path-to-git-repository ()
"Return the absolute path of the current git repository"
(let ((path-to-git-repo (shell-command-to-string
(format "%s rev-parse --show-toplevel"
gitconfig-git-command))))
(replace-regexp-in-string "\n" "" path-to-git-repo nil t)))
(defun gitconfig--execute-command (arguments)
(unless (gitconfig-current-inside-git-repository-p)
(user-error "Fatal: Not a git repository (or any of the parent directories): .git"))
(shell-command-to-string (format "%s config %s" gitconfig-git-command arguments)))
(defun gitconfig-get-variables (location)
"Get all variables for the given LOCATION and return it as a hash table"
(let ((config-string (gitconfig--execute-command (format "--%s --list" location)))
(variable-hash (make-hash-table :test 'equal)))
(setq config-string (split-string config-string "\n"))
(delete "" config-string)
(mapcar (lambda (x) (puthash (car (split-string x "="))
(car (last (split-string x "=")))
variable-hash)) config-string)
variable-hash))
(defun gitconfig-set-variable (location name value)
"Set a specific LOCATION variable with a given NAME and VALUE"
(unless (gitconfig-current-inside-git-repository-p)
(user-error "Fatal: Not a git repository (or any of the parent directories): .git"))
(let ((exit-status (shell-command
(format "%s config --%s --replace-all %s %s"
gitconfig-git-command location name value))))
(unless (= exit-status 0)
(user-error (format "Error: key does not contain a section: %s" name)))
t))
(defun gitconfig-get-variable (location name)
"Return a specific LOCATION variable for the given NAME"
(when (string= name "")
(user-error "Error: variable does not exist."))
(let ((variable (gitconfig--execute-command (format "--%s --get %s" location name))))
(when (string-match "^error: " variable)
(user-error variable))
(if (string-match "\n+" variable)
(replace-match "" t t variable)
variable)))
(defun gitconfig-delete-variable (location name)
"Delete a specific LOCATION variable for the given NAME"
(unless (gitconfig-current-inside-git-repository-p)
(user-error "Fatal: Not a git repository (or any of the parent directories): .git"))
(let ((exit-status (shell-command
(format "%s config --%s --unset-all %s"
gitconfig-git-command location name))))
(unless (= exit-status 0)
(user-error (format "Error: key does not contain a section: %s" name)))
t))
(defun gitconfig-execute-command (arguments)
"Run <git config> with custom ARGUMENTS and display it in buffer"
(interactive "Mgit config: ")
(let ((buffer (gitconfig--get-buffer gitconfig-buffer-name)))
(shell-command (format "%s config %s" gitconfig-git-command arguments) buffer)
(gitconfig--buffer-setup buffer)))
(defun gitconfig-get-local-variables ()
"Return all <git config --local --list> variables as hash table"
(gitconfig-get-variables "local"))
(defun gitconfig-get-global-variables ()
"Return all <git config --global --list> variables as hash table"
(gitconfig-get-variables "global"))
(defun gitconfig-get-system-variables ()
"Return all <git config --system --list> variables as hash table"
(gitconfig-get-variables "system"))
(defun gitconfig-get-local-variable (name)
"Return a specific <git config --local --list> variable by the given NAME"
(gitconfig-get-variable "local" name))
(defun gitconfig-get-global-variable (name)
"Return a specific <git config --global --list> variable by the given NAME"
(gitconfig-get-variable "global" name))
(defun gitconfig-get-system-variable (name)
"Return a specific <git config --system --list> variable by the given NAME"
(gitconfig-get-variable "system" name))
(provide 'gitconfig)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; gitconfig.el ends here

View File

@ -1,16 +0,0 @@
;;; gnome-calendar-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
;;;### (autoloads nil nil ("gnome-calendar.el") (22490 32826 162208
;;;;;; 449000))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; gnome-calendar-autoloads.el ends here

View File

@ -1 +0,0 @@
(define-package "gnome-calendar" "20140112.359" "Integration with the GNOME Shell calendar" 'nil :keywords '("gnome" "calendar"))

View File

@ -1,87 +0,0 @@
;;; gnome-calendar.el --- Integration with the GNOME Shell calendar
;; Copyright (C) 2013-2014 Nicolas Petton
;;
;; Author: Nicolas Petton <petton.nicolas@gmail.com>
;; Keywords: gnome calendar
;; Package-Version: 20140112.359
;; Package: gnome-calendar
;; Version: 0.2
;; gnome-calendar 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, or (at
;; your option) any later version.
;;
;; gnome-calendar.el 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.
;;
;;; Commentary:
;;; GNOME Shell calendar integration
;;; Code:
(require 'dbus)
(defvar gsc-gnome-calendar-dbus-object nil)
(defvar gsc-get-items-function nil "function to be called to retrieve items")
(defun gnome-shell-calendar-register-service (function)
"Register to the GnomeShell calendar service.
FUNCTION is called to fill the Gnome calendar with items."
(setq gsc-get-items-function function)
(dbus-register-service :session
"org.gnome.Shell.CalendarServer"
:replace-existing)
(setq gsc-gnome-calendar-dbus-object
(dbus-register-method :session
"org.gnome.Shell.CalendarServer"
"/org/gnome/Shell/CalendarServer"
"org.gnome.Shell.CalendarServer"
"GetEvents"
'gsc-select-items)))
(defun gnome-shell-calendar-unregister-service ()
"Unregister from the DBus service"
(when gsc-gnome-calendar-dbus-object
(dbus-unregister-object gsc-gnome-calendar-dbus-object)
(dbus-unregister-service :session "org.gnome.Shell.CalendarServer")
(setq gsc-gnome-calendar-dbus-object nil)))
(defun gsc-select-items (since until force-reload)
(let ((day-since (floor (time-to-number-of-days (seconds-to-time since))))
(day-until (floor (time-to-number-of-days (seconds-to-time until))))
(items (funcall gsc-get-items-function))
selected-items)
(dolist (item items)
(let ((day (floor (time-to-number-of-days (cdr item)))))
(when (and (>= day day-since)
(<= day day-until))
(add-to-list 'selected-items item))))
(list :array (gsc-items-to-dbus-entries selected-items))))
(defun gsc-items-to-dbus-entries (items)
(mapcar (lambda (item)
(list :struct
""
(car item)
""
:boolean (not (gsc-item-has-time-p item))
:int64 (floor (time-to-seconds (cdr item)))
:int64 (+ 1 (floor (time-to-seconds (cdr item))))
(list :array :signature "{sv}")))
items))
(defun gsc-item-has-time-p (item)
(let ((time (decode-time (cdr item))))
(or (not (= 0 (nth 0 time)))
(not (= 0 (nth 1 time)))
(not (= 0 (nth 2 time))))))
(provide 'gnome-calendar)
;;; gnome-calendar.el ends here

View File

@ -1,38 +0,0 @@
;;; org-jekyll-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "org-jekyll" "org-jekyll.el" (22505 22508 389691
;;;;;; 181000))
;;; Generated autoloads from org-jekyll.el
(autoload 'org-jekyll-export-current-entry "org-jekyll" "\
\(fn)" t nil)
(autoload 'org-jekyll-export-blog "org-jekyll" "\
Export all entries in project files that have a :blog: keyword
and an :on: datestamp. Property drawers are exported as
front-matters, outline entry title is the exported document
title.
\(fn)" t nil)
(autoload 'org-jekyll-export-project "org-jekyll" "\
Export all entries in project files that have a :blog: keyword
and an :on: datestamp. Property drawers are exported as
front-matters, outline entry title is the exported document
title.
\(fn PROJECT-NAME)" t nil)
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; org-jekyll-autoloads.el ends here

View File

@ -1,2 +0,0 @@
;;; -*- no-byte-compile: t -*-
(define-package "org-jekyll" "20130508.239" "Export jekyll-ready posts form org-mode entries" '((org "8.0")) :url "http://juanreyero.com/open/org-jekyll/" :keywords '("hypermedia"))

View File

@ -1,257 +0,0 @@
;;; org-jekyll.el --- Export jekyll-ready posts form org-mode entries
;;;
;;; Author: Juan Reyero
;;; Version: 0.4
;; Package-Version: 20130508.239
;;; Keywords: hypermedia
;;; Package-Requires: ((org "8.0"))
;;; Homepage: http://juanreyero.com/open/org-jekyll/
;;; Repository: http://github.com/juanre/org-jekyll
;;; Public clone: git://github.com/juanre/org-jekyll.git
;;;
;;; Commentary:
;;;
;;; Extract subtrees from your org-publish project files that have
;;; a :blog: keyword and an :on: property with a timestamp, and
;;; export them to a subdirectory _posts of your project's publishing
;;; directory in the year-month-day-title.html format that Jekyll
;;; expects. Properties are passed over as yaml front-matter in the
;;; exported files. The title of the subtree is the title of the
;;; entry. The title of the post is a link to the post's page.
;;;
;;; Look at http://orgmode.org/worg/org-tutorials/org-jekyll.html for
;;; more info on how to integrate org-mode with Jekyll, and for the
;;; inspiration of the main function down there.
;;;
;;; Code:
;;(require 'ox-html)
(defvar org-jekyll-category nil
"Specify a property which, if defined in the entry, is used as
a category: the post is written to category/_posts. Ignored if
nil. Use \"lang\" if you want to send posts in different
languages to different directories.")
(defvar org-jekyll-lang-subdirs nil
"Make it an assoc list indexed by language if you want to
bypass the category subdir definition and build blog subdirs per
language.")
(defvar org-jekyll-localize-dir nil
"If non-nil and the lang property is set in the entry,
org-jekyll will look for a lang.yml file in this directory and
include it in the front matter of the exported entry.")
(defvar org-jekyll-new-buffers nil
"Buffers created to visit org-publish project files looking for blog posts.")
(defun org-jekyll-publish-dir (project &optional category)
"Where does the project go, by default a :blog-publishing-directory
entry in the org-publish-project-alist."
(princ category)
(if org-jekyll-lang-subdirs
(let ((pdir (plist-get (cdr project) :blog-publishing-directory))
(langdir (cdr (assoc category org-jekyll-lang-subdirs))))
(if langdir
(concat pdir (cdr (assoc category org-jekyll-lang-subdirs))
"_posts/")
(let ((ppdir (plist-get (cdr project) :blog-publishing-directory)))
(unless ppdir
(setq ppdir (plist-get (cdr project) :publishing-directory)))
(concat ppdir
(if category (concat category "/") "")
"_posts/"))))
(let ((pdir (plist-get (cdr project) :blog-publishing-directory)))
(unless pdir
(setq pdir (plist-get (cdr project) :publishing-directory)))
(concat pdir
(if category (concat category "/") "")
"_posts/"))))
(defun org-jekyll-site-root (project)
"Site root, like http://yoursite.com, from which blog
permalinks follow. Needed to replace entry titles with
permalinks that RSS agregators and google buzz know how to
follow. Looks for a :site-root entry in the org-publish-project-alist."
(or (plist-get (cdr project) :site-root)
""))
(defun org-get-jekyll-file-buffer (file)
"Get a buffer visiting FILE. If the buffer needs to be
created, add it to the list of buffers which might be released
later. Copied from org-get-agenda-file-buffer, and modified
the list that holds buffers to release."
(let ((buf (org-find-base-buffer-visiting file)))
(if buf
buf
(progn (setq buf (find-file-noselect file))
(if buf (push buf org-jekyll-new-buffers))
buf))))
(defun org-jekyll-slurp-yaml (fname)
(remove "---" (if (file-exists-p fname)
(split-string (with-temp-buffer
(insert-file-contents fname)
(buffer-string))
"\n" t))))
(defun ensure-directories-exist (fname)
(let ((dir (file-name-directory fname)))
(unless (file-accessible-directory-p dir)
(make-directory dir t)))
fname)
(defun org-jekyll-sanitize-string (str project)
(if (plist-get (cdr project) :jekyll-sanitize-permalinks)
(progn (setq str (downcase str))
(dolist (c '(("á" . "a")
("é" . "e")
("í" . "i")
("ó" . "o")
("ú" . "u")
("à" . "a")
("è" . "e")
("ì" . "i")
("ò" . "o")
("ù" . "u")
("ñ" . "n")
("ç" . "s")
("\\$" . "S")
("" . "E")))
(setq str (replace-regexp-in-string (car c) (cdr c) str)))
(replace-regexp-in-string "[^abcdefghijklmnopqrstuvwxyz-]" ""
(replace-regexp-in-string " +" "-" str)))
str))
(defun org-jekyll-export-entry (project)
(let* ((props (org-entry-properties nil 'standard))
(time (cdr (or (assoc "on" props)
(assoc "ON" props))))
(lang (cdr (or (assoc "lang" props)
(assoc "LANG" props))))
(category (if org-jekyll-category
(cdr (assoc org-jekyll-category props))
nil))
(yaml-front-matter (copy-alist props)))
(unless (assoc "layout" yaml-front-matter)
(push '("layout" . "post") yaml-front-matter))
(when time
(let* ((heading (org-get-heading t))
(title (replace-regexp-in-string "[:=\(\)\?]" ""
(replace-regexp-in-string
"[ \t]" "-" heading)))
(str-time (and (string-match "\\([[:digit:]\-]+\\) " time)
(match-string 1 time)))
(to-file (format "%s-%s.html" str-time
(org-jekyll-sanitize-string title project)))
(org-buffer (current-buffer))
(yaml-front-matter (cons (cons "title" heading)
yaml-front-matter))
html)
(org-narrow-to-subtree)
(let ((level (- (org-reduced-level (org-outline-level)) 1))
(top-level org-html-toplevel-hlevel)
(contents (buffer-substring (point-min) (point-max)))
(site-root (org-jekyll-site-root project)))
;; Without the promotion the header with which the headline
;; is exported depends on the level. With the promotion it
;; fails when the entry is not visible (ie, within a folded
;; entry).
(dotimes (n level nil) (org-promote-subtree))
(setq html
(replace-regexp-in-string
(format "<h%d id=\"sec-1\">\\(.+\\)</h%d>"
top-level top-level)
(format
"<h%d id=\"sec-1\"><a href=\"%s{{ page.url }}\">\\1</a></h%d>"
top-level site-root top-level)
(with-current-buffer
(org-html-export-as-html nil t t t
'(:tags nil
:table-of-contents nil))
(buffer-string))))
(set-buffer org-buffer)
(delete-region (point-min) (point-max))
(insert contents)
(save-buffer))
(widen)
(with-temp-file (ensure-directories-exist
(expand-file-name
to-file (org-jekyll-publish-dir project category)))
(when yaml-front-matter
(insert "---\n")
(mapc (lambda (pair)
(insert (format "%s: %s\n" (car pair) (cdr pair))))
yaml-front-matter)
(if (and org-jekyll-localize-dir lang)
(mapc (lambda (line)
(insert (format "%s\n" line)))
(org-jekyll-slurp-yaml (concat org-jekyll-localize-dir
lang ".yml"))))
(insert "---\n\n"))
(insert html))))))
; Evtl. needed to keep compiler happy:
(declare-function org-publish-get-project-from-filename "org-publish"
(filename &optional up))
;;;###autoload
(defun org-jekyll-export-current-entry ()
(interactive)
(save-excursion
(let ((project (org-publish-get-project-from-filename buffer-file-name)))
(org-back-to-heading t)
(org-jekyll-export-entry project))))
;;;###autoload
(defun org-jekyll-export-blog ()
"Export all entries in project files that have a :blog: keyword
and an :on: datestamp. Property drawers are exported as
front-matters, outline entry title is the exported document
title. "
(interactive)
(save-excursion
(setq org-jekyll-new-buffers nil)
(let ((project (org-publish-get-project-from-filename (buffer-file-name))))
(mapc
(lambda (jfile)
(if (string= (file-name-extension jfile) "org")
(with-current-buffer (org-get-jekyll-file-buffer jfile)
;; It fails for non-visible entries, CONTENT visibility
;; mode ensures that all of them are visible.
(message (concat "org-jekyll: publishing " jfile ))
(org-content)
(org-map-entries (lambda () (org-jekyll-export-entry project))
"blog|BLOG"))))
(org-publish-get-base-files project)))
(org-release-buffers org-jekyll-new-buffers)))
;;;###autoload
(defun org-jekyll-export-project (project-name)
"Export all entries in project files that have a :blog: keyword
and an :on: datestamp. Property drawers are exported as
front-matters, outline entry title is the exported document
title. "
(interactive)
(save-excursion
(setq org-jekyll-new-buffers nil)
(let ((project (assoc project-name org-publish-project-alist)))
(mapc
(lambda (jfile)
(if (string= (file-name-extension jfile) (plist-get (cdr project)
:base-extension))
(with-current-buffer (org-get-jekyll-file-buffer jfile)
;; It fails for non-visible entries, CONTENT visibility
;; mode ensures that all of them are visible.
(message (concat "org-jekyll: publishing " jfile ))
(org-content)
(org-map-entries (lambda () (org-jekyll-export-entry project))
"blog|BLOG"))))
(org-publish-get-base-files project)))
(org-release-buffers org-jekyll-new-buffers)))
(provide 'org-jekyll)
;;; org-jekyll.el ends here

View File

@ -1,16 +0,0 @@
;;; projectile-direnv-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
;;;### (autoloads nil nil ("projectile-direnv.el") (22490 46091 998412
;;;;;; 740000))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; projectile-direnv-autoloads.el ends here

View File

@ -1 +0,0 @@
(define-package "projectile-direnv" "20160305.1738" "Set environment variables from .envrc" '((emacs "24") (s "1.11.0") (dash "2.12.0") (projectile "0.13.0")) :url "https://github.com/christianromney/projectile-direnv" :keywords '("convenience"))

View File

@ -1,81 +0,0 @@
;;; projectile-direnv.el --- Set environment variables from .envrc -*- lexical-binding: t; -*-
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Author: Christian Romney <crommney@pointslope.com>
;; URL: https://github.com/christianromney/projectile-direnv
;; Package-Version: 20160305.1738
;; Keywords: convenience
;; Version: 0.1.0
;; Package-Requires: ((emacs "24") (s "1.11.0") (dash "2.12.0") (projectile "0.13.0"))
;; 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 this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; I want to launch Emacs as a GUI and have it automatically
;; set the same environment variables that direnv sets for me
;; at the shell when I am in a Projectile project.
;;
;; See README.org for more info.
;;
;;; Code:
(require 's)
(require 'dash)
(require 'projectile)
(defvar projectile-direnv-envrc nil
"Contains the path to the last loaded .envrc")
(defun projectile-direnv-parse-export (line)
"Parses a single line of the form export VAR=VAL into a cons
cell where the car is the var name and the cdr is its value."
(let* ((parts (s-split "=" line))
(varname (car (last (s-split " " (car parts)))))
(varval (car (last parts))))
(cons varname varval)))
(defun projectile-direnv-read-file-as-string (filename)
"Returns a the file's contents as a string"
(with-temp-buffer
(insert-file-contents filename)
(buffer-string)))
(defun projectile-direnv-set-env-var (pair)
"Sets an environment variable. Expects a pair of (VARNAME . VALUE)"
(setenv (car pair) (cdr pair)))
(defun projectile-direnv-list-exports (exports)
"Returns a string of the form '+VAR1 +VAR2' listing the exported envvars"
(s-join " " (-map (lambda (e) (s-append (car e) "+")) exports)))
(defun projectile-direnv-export-variables ()
"Reads a .envrc file in the Projectile project root, and sets
environment variables for any defined exports"
(interactive)
(when (projectile-project-p)
(let ((envrc (expand-file-name ".envrc" (projectile-project-root))))
(when (and (file-exists-p envrc)
(not (string= envrc projectile-direnv-envrc)))
(let* ((contents (projectile-direnv-read-file-as-string envrc))
(lines (s-split "\n" contents))
(exports (-filter (lambda (l) (s-starts-with? "export" l)) lines))
(envvars (-map #'projectile-direnv-parse-export exports)))
(setq projectile-direnv-envrc envrc)
(-each envvars #'projectile-direnv-set-env-var)
(message "projectile-direnv: export %s" (projectile-direnv-list-exports envvars)))))))
(provide 'projectile-direnv)
;;; projectile-direnv.el ends here

View File

@ -71,10 +71,8 @@
git-gutter
git-messenger
git-timemachine
gitconfig
gitconfig-mode
gitignore-mode
gnome-calendar
gnugo
gobgen
google
@ -110,11 +108,9 @@
nyan-prompt
org
org-bullets
org-jekyll
org-projectile
origami
projectile
projectile-direnv
sass-mode
smart-mode-line
smart-mode-line-powerline-theme