From 8de8b15a8a0add704f0e66b7743c68a5315c6cd1 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 15 Jul 2015 08:16:27 +0200 Subject: [PATCH] more package updates related to melpa and upgrade to Emacs25. --- .../ac-helm-20140919.917/ac-helm-autoloads.el | 29 + elpa/ac-helm-20140919.917/ac-helm-pkg.el | 1 + elpa/ac-helm-20140919.917/ac-helm.el | 118 + elpa/ac-helm-readme.txt | 25 + elpa/epl-20150517.433/epl-autoloads.el | 15 + elpa/epl-20150517.433/epl-pkg.el | 1 + elpa/epl-20150517.433/epl.el | 695 +++ elpa/epl-readme.txt | 84 + .../fullscreen-mode-autoloads.el | 51 + .../fullscreen-mode-pkg.el | 1 + .../fullscreen-mode.el | 95 + elpa/fullscreen-mode-readme.txt | 4 + .../git-commit-autoloads.el | 35 + .../git-commit-pkg.el | 1 + elpa/git-commit-20150701.1326/git-commit.el | 655 +++ elpa/gnupg/pubring.gpg | Bin 0 -> 999 bytes elpa/gnupg/secring.gpg | 0 elpa/gnupg/trustdb.gpg | Bin 0 -> 1200 bytes .../helm-aws-autoloads.el | 29 + elpa/helm-aws-20141206.1208/helm-aws-pkg.el | 1 + elpa/helm-aws-20141206.1208/helm-aws.el | 125 + elpa/helm-aws-readme.txt | 6 + .../helm-git-autoloads.el | 18 + elpa/helm-git-20120630.1403/helm-git-pkg.el | 1 + elpa/helm-git-20120630.1403/helm-git.el | 127 + elpa/helm-git-readme.txt | 6 + elpa/helm-gitlab-readme.txt | 1 + elpa/helm-gtags-readme.txt | 22 + .../helm-projectile-autoloads.el | 80 + .../helm-projectile-pkg.el | 1 + .../helm-projectile.el | 841 +++ elpa/helm-projectile-readme.txt | 6 + elpa/ht-20140122.1555/ht-autoloads.el | 18 + elpa/ht-20140122.1555/ht-pkg.el | 1 + elpa/ht-20140122.1555/ht.el | 281 + .../impatient-mode-autoloads.el | 12 +- .../impatient-mode-pkg.el | 2 +- .../impatient-mode.el | 10 +- .../index.html | 4 +- .../jquery.js | 0 .../loading.html | 0 .../keyfreq-20141124.805/keyfreq-autoloads.el | 48 + elpa/keyfreq-20141124.805/keyfreq-pkg.el | 1 + elpa/keyfreq-20141124.805/keyfreq.el | 511 ++ elpa/keyfreq-readme.txt | 9 + .../langtool-autoloads.el | 32 + elpa/langtool-20150609.2131/langtool-pkg.el | 1 + elpa/langtool-20150609.2131/langtool.el | 775 +++ elpa/let-alist-1.0.4.signed | 1 + elpa/let-alist-1.0.4/let-alist-autoloads.el | 49 + elpa/let-alist-1.0.4/let-alist-pkg.el | 1 + elpa/let-alist-1.0.4/let-alist.el | 170 + .../markdown-mode-autoloads.el | 33 + .../markdown-mode-pkg.el | 1 + .../markdown-mode.el | 4896 +++++++++++++++++ .../mustache-autoloads.el | 19 + elpa/mustache-20131117.1407/mustache-lex.el | 151 + elpa/mustache-20131117.1407/mustache-parse.el | 55 + elpa/mustache-20131117.1407/mustache-pkg.el | 4 + .../mustache-20131117.1407/mustache-render.el | 140 + elpa/mustache-20131117.1407/mustache.el | 65 + .../mustache-mode-autoloads.el | 22 + .../mustache-mode-pkg.el | 1 + .../mustache-mode.el | 252 + .../paradox-20150611.645/paradox-autoloads.el | 74 + .../paradox-commit-list.el | 234 + elpa/paradox-20150611.645/paradox-core.el | 157 + elpa/paradox-20150611.645/paradox-execute.el | 388 ++ elpa/paradox-20150611.645/paradox-github.el | 370 ++ elpa/paradox-20150611.645/paradox-menu.el | 843 +++ elpa/paradox-20150611.645/paradox-pkg.el | 12 + elpa/paradox-20150611.645/paradox.el | 223 + elpa/paradox-readme.txt | 70 + elpa/pkg-info-20140610.630/pkg-info-pkg.el | 1 - .../pkg-info-autoloads.el | 14 +- elpa/pkg-info-20150517.443/pkg-info-pkg.el | 1 + .../pkg-info.el | 62 +- .../projectile-autoloads.el | 256 + .../projectile-20150701.121/projectile-pkg.el | 1 + elpa/projectile-20150701.121/projectile.el | 2701 +++++++++ elpa/projectile-readme.txt | 6 + .../rainbow-delimiters-autoloads.el | 57 - .../rainbow-delimiters-pkg.el | 1 - .../rainbow-delimiters.el | 595 -- .../rainbow-delimiters-autoloads.el | 32 + .../rainbow-delimiters-pkg.el | 1 + .../rainbow-delimiters.el | 293 + .../rainbow-mode-autoloads.el | 30 + elpa/rainbow-mode-0.11/rainbow-mode-pkg.el | 1 + elpa/rainbow-mode-0.11/rainbow-mode.el | 1243 +++++ elpa/s-20140910.334/s-autoloads.el | 15 + elpa/s-20140910.334/s-pkg.el | 1 + elpa/s-20140910.334/s.el | 605 ++ elpa/seq-1.4/seq-pkg.el | 1 - .../seq-autoloads.el | 7 +- elpa/seq-20150515.214/seq-pkg.el | 1 + elpa/{seq-1.4 => seq-20150515.214}/seq.el | 188 +- elpa/smartrep-readme.txt | 3 + elpa/spinner-1.3.1.signed | 1 + elpa/spinner-1.3.1/spinner-autoloads.el | 58 + elpa/spinner-1.3.1/spinner-pkg.el | 1 + elpa/spinner-1.3.1/spinner.el | 343 ++ elpa/sx-20150702.818/sx-auth.el | 196 + elpa/sx-20150702.818/sx-autoloads.el | 146 + elpa/sx-20150702.818/sx-babel.el | 133 + elpa/sx-20150702.818/sx-button.el | 209 + elpa/sx-20150702.818/sx-cache.el | 119 + elpa/sx-20150702.818/sx-compose.el | 355 ++ elpa/sx-20150702.818/sx-encoding.el | 179 + elpa/sx-20150702.818/sx-favorites.el | 83 + elpa/sx-20150702.818/sx-filter.el | 170 + elpa/sx-20150702.818/sx-inbox.el | 216 + elpa/sx-20150702.818/sx-interaction.el | 565 ++ elpa/sx-20150702.818/sx-load.el | 56 + elpa/sx-20150702.818/sx-method.el | 184 + elpa/sx-20150702.818/sx-networks.el | 105 + elpa/sx-20150702.818/sx-notify.el | 86 + elpa/sx-20150702.818/sx-pkg.el | 11 + elpa/sx-20150702.818/sx-question-list.el | 674 +++ elpa/sx-20150702.818/sx-question-mode.el | 308 ++ elpa/sx-20150702.818/sx-question-print.el | 793 +++ elpa/sx-20150702.818/sx-question.el | 236 + elpa/sx-20150702.818/sx-request.el | 338 ++ elpa/sx-20150702.818/sx-search.el | 153 + elpa/sx-20150702.818/sx-site.el | 68 + elpa/sx-20150702.818/sx-switchto.el | 63 + elpa/sx-20150702.818/sx-tab.el | 286 + elpa/sx-20150702.818/sx-tag.el | 179 + elpa/sx-20150702.818/sx-time.el | 84 + elpa/sx-20150702.818/sx-user.el | 203 + elpa/sx-20150702.818/sx.el | 505 ++ elpa/sx-readme.txt | 1 + elpa/with-editor-20150701.1246/dir | 18 + .../with-editor-autoloads.el | 16 + .../with-editor-pkg.el | 8 + elpa/with-editor-20150701.1246/with-editor.el | 687 +++ .../with-editor.info | 323 ++ 137 files changed, 26522 insertions(+), 763 deletions(-) create mode 100644 elpa/ac-helm-20140919.917/ac-helm-autoloads.el create mode 100644 elpa/ac-helm-20140919.917/ac-helm-pkg.el create mode 100644 elpa/ac-helm-20140919.917/ac-helm.el create mode 100644 elpa/ac-helm-readme.txt create mode 100644 elpa/epl-20150517.433/epl-autoloads.el create mode 100644 elpa/epl-20150517.433/epl-pkg.el create mode 100644 elpa/epl-20150517.433/epl.el create mode 100644 elpa/epl-readme.txt create mode 100644 elpa/fullscreen-mode-20130524.956/fullscreen-mode-autoloads.el create mode 100644 elpa/fullscreen-mode-20130524.956/fullscreen-mode-pkg.el create mode 100644 elpa/fullscreen-mode-20130524.956/fullscreen-mode.el create mode 100644 elpa/fullscreen-mode-readme.txt create mode 100644 elpa/git-commit-20150701.1326/git-commit-autoloads.el create mode 100644 elpa/git-commit-20150701.1326/git-commit-pkg.el create mode 100644 elpa/git-commit-20150701.1326/git-commit.el create mode 100644 elpa/gnupg/pubring.gpg create mode 100644 elpa/gnupg/secring.gpg create mode 100644 elpa/gnupg/trustdb.gpg create mode 100644 elpa/helm-aws-20141206.1208/helm-aws-autoloads.el create mode 100644 elpa/helm-aws-20141206.1208/helm-aws-pkg.el create mode 100644 elpa/helm-aws-20141206.1208/helm-aws.el create mode 100644 elpa/helm-aws-readme.txt create mode 100644 elpa/helm-git-20120630.1403/helm-git-autoloads.el create mode 100644 elpa/helm-git-20120630.1403/helm-git-pkg.el create mode 100644 elpa/helm-git-20120630.1403/helm-git.el create mode 100644 elpa/helm-git-readme.txt create mode 100644 elpa/helm-gitlab-readme.txt create mode 100644 elpa/helm-gtags-readme.txt create mode 100644 elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el create mode 100644 elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el create mode 100644 elpa/helm-projectile-20150621.1322/helm-projectile.el create mode 100644 elpa/helm-projectile-readme.txt create mode 100644 elpa/ht-20140122.1555/ht-autoloads.el create mode 100644 elpa/ht-20140122.1555/ht-pkg.el create mode 100644 elpa/ht-20140122.1555/ht.el rename elpa/{impatient-mode-20140908.2000 => impatient-mode-20150501.247}/impatient-mode-autoloads.el (62%) rename elpa/{impatient-mode-20140908.2000 => impatient-mode-20150501.247}/impatient-mode-pkg.el (67%) rename elpa/{impatient-mode-20140908.2000 => impatient-mode-20150501.247}/impatient-mode.el (96%) rename elpa/{impatient-mode-20140908.2000 => impatient-mode-20150501.247}/index.html (95%) rename elpa/{impatient-mode-20140908.2000 => impatient-mode-20150501.247}/jquery.js (100%) rename elpa/{impatient-mode-20140908.2000 => impatient-mode-20150501.247}/loading.html (100%) create mode 100644 elpa/keyfreq-20141124.805/keyfreq-autoloads.el create mode 100644 elpa/keyfreq-20141124.805/keyfreq-pkg.el create mode 100644 elpa/keyfreq-20141124.805/keyfreq.el create mode 100644 elpa/keyfreq-readme.txt create mode 100644 elpa/langtool-20150609.2131/langtool-autoloads.el create mode 100644 elpa/langtool-20150609.2131/langtool-pkg.el create mode 100644 elpa/langtool-20150609.2131/langtool.el create mode 100644 elpa/let-alist-1.0.4.signed create mode 100644 elpa/let-alist-1.0.4/let-alist-autoloads.el create mode 100644 elpa/let-alist-1.0.4/let-alist-pkg.el create mode 100644 elpa/let-alist-1.0.4/let-alist.el create mode 100644 elpa/markdown-mode-20150703.1903/markdown-mode-autoloads.el create mode 100644 elpa/markdown-mode-20150703.1903/markdown-mode-pkg.el create mode 100644 elpa/markdown-mode-20150703.1903/markdown-mode.el create mode 100644 elpa/mustache-20131117.1407/mustache-autoloads.el create mode 100644 elpa/mustache-20131117.1407/mustache-lex.el create mode 100644 elpa/mustache-20131117.1407/mustache-parse.el create mode 100644 elpa/mustache-20131117.1407/mustache-pkg.el create mode 100644 elpa/mustache-20131117.1407/mustache-render.el create mode 100644 elpa/mustache-20131117.1407/mustache.el create mode 100644 elpa/mustache-mode-20141024.732/mustache-mode-autoloads.el create mode 100644 elpa/mustache-mode-20141024.732/mustache-mode-pkg.el create mode 100644 elpa/mustache-mode-20141024.732/mustache-mode.el create mode 100644 elpa/paradox-20150611.645/paradox-autoloads.el create mode 100644 elpa/paradox-20150611.645/paradox-commit-list.el create mode 100644 elpa/paradox-20150611.645/paradox-core.el create mode 100644 elpa/paradox-20150611.645/paradox-execute.el create mode 100644 elpa/paradox-20150611.645/paradox-github.el create mode 100644 elpa/paradox-20150611.645/paradox-menu.el create mode 100644 elpa/paradox-20150611.645/paradox-pkg.el create mode 100644 elpa/paradox-20150611.645/paradox.el create mode 100644 elpa/paradox-readme.txt delete mode 100644 elpa/pkg-info-20140610.630/pkg-info-pkg.el rename elpa/{pkg-info-20140610.630 => pkg-info-20150517.443}/pkg-info-autoloads.el (90%) create mode 100644 elpa/pkg-info-20150517.443/pkg-info-pkg.el rename elpa/{pkg-info-20140610.630 => pkg-info-20150517.443}/pkg-info.el (82%) create mode 100644 elpa/projectile-20150701.121/projectile-autoloads.el create mode 100644 elpa/projectile-20150701.121/projectile-pkg.el create mode 100644 elpa/projectile-20150701.121/projectile.el create mode 100644 elpa/projectile-readme.txt delete mode 100644 elpa/rainbow-delimiters-20140329.934/rainbow-delimiters-autoloads.el delete mode 100644 elpa/rainbow-delimiters-20140329.934/rainbow-delimiters-pkg.el delete mode 100644 elpa/rainbow-delimiters-20140329.934/rainbow-delimiters.el create mode 100644 elpa/rainbow-delimiters-20150320.17/rainbow-delimiters-autoloads.el create mode 100644 elpa/rainbow-delimiters-20150320.17/rainbow-delimiters-pkg.el create mode 100644 elpa/rainbow-delimiters-20150320.17/rainbow-delimiters.el create mode 100644 elpa/rainbow-mode-0.11/rainbow-mode-autoloads.el create mode 100644 elpa/rainbow-mode-0.11/rainbow-mode-pkg.el create mode 100644 elpa/rainbow-mode-0.11/rainbow-mode.el create mode 100644 elpa/s-20140910.334/s-autoloads.el create mode 100644 elpa/s-20140910.334/s-pkg.el create mode 100644 elpa/s-20140910.334/s.el delete mode 100644 elpa/seq-1.4/seq-pkg.el rename elpa/{seq-1.4 => seq-20150515.214}/seq-autoloads.el (62%) create mode 100644 elpa/seq-20150515.214/seq-pkg.el rename elpa/{seq-1.4 => seq-20150515.214}/seq.el (72%) create mode 100644 elpa/smartrep-readme.txt create mode 100644 elpa/spinner-1.3.1.signed create mode 100644 elpa/spinner-1.3.1/spinner-autoloads.el create mode 100644 elpa/spinner-1.3.1/spinner-pkg.el create mode 100644 elpa/spinner-1.3.1/spinner.el create mode 100644 elpa/sx-20150702.818/sx-auth.el create mode 100644 elpa/sx-20150702.818/sx-autoloads.el create mode 100644 elpa/sx-20150702.818/sx-babel.el create mode 100644 elpa/sx-20150702.818/sx-button.el create mode 100644 elpa/sx-20150702.818/sx-cache.el create mode 100644 elpa/sx-20150702.818/sx-compose.el create mode 100644 elpa/sx-20150702.818/sx-encoding.el create mode 100644 elpa/sx-20150702.818/sx-favorites.el create mode 100644 elpa/sx-20150702.818/sx-filter.el create mode 100644 elpa/sx-20150702.818/sx-inbox.el create mode 100644 elpa/sx-20150702.818/sx-interaction.el create mode 100644 elpa/sx-20150702.818/sx-load.el create mode 100644 elpa/sx-20150702.818/sx-method.el create mode 100644 elpa/sx-20150702.818/sx-networks.el create mode 100644 elpa/sx-20150702.818/sx-notify.el create mode 100644 elpa/sx-20150702.818/sx-pkg.el create mode 100644 elpa/sx-20150702.818/sx-question-list.el create mode 100644 elpa/sx-20150702.818/sx-question-mode.el create mode 100644 elpa/sx-20150702.818/sx-question-print.el create mode 100644 elpa/sx-20150702.818/sx-question.el create mode 100644 elpa/sx-20150702.818/sx-request.el create mode 100644 elpa/sx-20150702.818/sx-search.el create mode 100644 elpa/sx-20150702.818/sx-site.el create mode 100644 elpa/sx-20150702.818/sx-switchto.el create mode 100644 elpa/sx-20150702.818/sx-tab.el create mode 100644 elpa/sx-20150702.818/sx-tag.el create mode 100644 elpa/sx-20150702.818/sx-time.el create mode 100644 elpa/sx-20150702.818/sx-user.el create mode 100644 elpa/sx-20150702.818/sx.el create mode 100644 elpa/sx-readme.txt create mode 100644 elpa/with-editor-20150701.1246/dir create mode 100644 elpa/with-editor-20150701.1246/with-editor-autoloads.el create mode 100644 elpa/with-editor-20150701.1246/with-editor-pkg.el create mode 100644 elpa/with-editor-20150701.1246/with-editor.el create mode 100644 elpa/with-editor-20150701.1246/with-editor.info diff --git a/elpa/ac-helm-20140919.917/ac-helm-autoloads.el b/elpa/ac-helm-20140919.917/ac-helm-autoloads.el new file mode 100644 index 00000000..5b2bd63c --- /dev/null +++ b/elpa/ac-helm-20140919.917/ac-helm-autoloads.el @@ -0,0 +1,29 @@ +;;; ac-helm-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (ac-complete-with-helm) "ac-helm" "ac-helm.el" +;;;;;; (21793 7937 0 0)) +;;; Generated autoloads from ac-helm.el + +(autoload 'ac-complete-with-helm "ac-helm" "\ +Select `auto-complete' candidates by `helm'. +It is useful to narrow candidates. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("ac-helm-pkg.el") (21793 7937 70647 0)) + +;;;*** + +(provide 'ac-helm-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; ac-helm-autoloads.el ends here diff --git a/elpa/ac-helm-20140919.917/ac-helm-pkg.el b/elpa/ac-helm-20140919.917/ac-helm-pkg.el new file mode 100644 index 00000000..be2c58fa --- /dev/null +++ b/elpa/ac-helm-20140919.917/ac-helm-pkg.el @@ -0,0 +1 @@ +(define-package "ac-helm" "20140919.917" "Helm interface for auto-complete" (quote ((helm "1.6.3") (auto-complete "1.4.0") (popup "0.5.0") (cl-lib "0.5")))) diff --git a/elpa/ac-helm-20140919.917/ac-helm.el b/elpa/ac-helm-20140919.917/ac-helm.el new file mode 100644 index 00000000..08e2c51c --- /dev/null +++ b/elpa/ac-helm-20140919.917/ac-helm.el @@ -0,0 +1,118 @@ +;;; ac-helm.el --- Helm interface for auto-complete + +;; Copyright (C) 2009 rubikitch +;; Copyright (C) 2013 Yasuyuki Oka + +;; Author: rubikitch +;; Yasuyuki Oka +;; Maintainer: Yasuyuki Oka +;; Version: 2.2 +;; Package-Version: 20140919.917 +;; Package-Requires: ((helm "1.6.3")(auto-complete "1.4.0")(popup "0.5.0") (cl-lib "0.5")) +;; Keywords: completion, convenience, helm + +;; This file 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 2, or (at your option) +;; any later version. + +;; This file 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. + +;;; Commentary: + +;; Auto Complete with Helm. It enables us to narrow candidates +;; with helm interface. If you have helm-match-plugin.el, +;; candidates can be narrowed many times. + +;; Commands: +;; +;; Below are complete command list: +;; +;; `ac-complete-with-helm' +;; Select auto-complete candidates by `helm'. +;; +;; Customizable Options: +;; +;; Below are customizable option list: +;; + +;; Installation: + +;; Add the following to your emacs init file: +;; +;; (require 'ac-helm) ;; Not necessary if using ELPA package +;; (global-set-key (kbd "C-:") 'ac-complete-with-helm) +;; (define-key ac-complete-mode-map (kbd "C-:") 'ac-complete-with-helm) + +;; That's all. + +;;; Code: + +(require 'helm) +(require 'helm-match-plugin nil t) +(require 'helm-elisp) +(require 'auto-complete) +(require 'cl-lib) +(require 'popup) + +;;;###autoload +(defun ac-complete-with-helm () + "Select `auto-complete' candidates by `helm'. +It is useful to narrow candidates." + (interactive) + (unless ac-completing + (call-interactively 'auto-complete)) + (with-helm-show-completion ac-point (point) + (helm :sources 'helm-source-auto-complete-candidates + :buffer "*helm auto-complete*"))) + +(defun helm-auto-complete-init () + (helm-attrset 'ac-candidates ac-candidates) + (helm-attrset 'menu-width + (popup-preferred-width ac-candidates)) + (helm-attrset 'ac-prefix ac-prefix) + (when (<= (length ac-candidates) 1) + (helm-exit-minibuffer)) + (ac-abort)) + +(defun helm-auto-complete-action (string) + (delete-char (- (length (helm-attr 'ac-prefix)))) + (insert string) + (prog1 (let ((action (get-text-property 0 'action string))) + (if action (funcall action))) + ;; for GC + (helm-attrset 'ac-candidates nil))) + +(defun helm-auto-complete-candidates () + (cl-loop for x in (helm-attr 'ac-candidates) collect + (cons + (helm-aif (get-text-property 0 'action x) + (format "%s%s <%s>" + x + ;; padding + (make-string (- (helm-attr 'menu-width) (length x)) ? ) + ;; action function name + it) + x) + x))) + +(defvar helm-source-auto-complete-candidates + '((name . "Auto Complete") + (init . helm-auto-complete-init) + (candidates . helm-auto-complete-candidates) + (action . helm-auto-complete-action) + (persistent-action . popup-item-show-help) + (ac-candidates) + (menu-width))) + +(provide 'ac-helm) + +;;; ac-helm.el ends here diff --git a/elpa/ac-helm-readme.txt b/elpa/ac-helm-readme.txt new file mode 100644 index 00000000..7d4aa332 --- /dev/null +++ b/elpa/ac-helm-readme.txt @@ -0,0 +1,25 @@ +Auto Complete with Helm. It enables us to narrow candidates +with helm interface. If you have helm-match-plugin.el, +candidates can be narrowed many times. + +Commands: + +Below are complete command list: + + `ac-complete-with-helm' + Select auto-complete candidates by `helm'. + +Customizable Options: + +Below are customizable option list: + + +Installation: + +Add the following to your emacs init file: + +(require 'ac-helm) ;; Not necessary if using ELPA package +(global-set-key (kbd "C-:") 'ac-complete-with-helm) +(define-key ac-complete-mode-map (kbd "C-:") 'ac-complete-with-helm) + +That's all. diff --git a/elpa/epl-20150517.433/epl-autoloads.el b/elpa/epl-20150517.433/epl-autoloads.el new file mode 100644 index 00000000..b6f00858 --- /dev/null +++ b/elpa/epl-20150517.433/epl-autoloads.el @@ -0,0 +1,15 @@ +;;; epl-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) + +;;;### (autoloads nil nil ("epl.el") (21908 14282 24908 0)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; epl-autoloads.el ends here diff --git a/elpa/epl-20150517.433/epl-pkg.el b/elpa/epl-20150517.433/epl-pkg.el new file mode 100644 index 00000000..f50c3751 --- /dev/null +++ b/elpa/epl-20150517.433/epl-pkg.el @@ -0,0 +1 @@ +(define-package "epl" "20150517.433" "Emacs Package Library" '((cl-lib "0.3")) :url "http://github.com/cask/epl" :keywords '("convenience")) diff --git a/elpa/epl-20150517.433/epl.el b/elpa/epl-20150517.433/epl.el new file mode 100644 index 00000000..a06c8dcc --- /dev/null +++ b/elpa/epl-20150517.433/epl.el @@ -0,0 +1,695 @@ +;;; epl.el --- Emacs Package Library -*- lexical-binding: t; -*- + +;; Copyright (C) 2013-2015 Sebastian Wiesner +;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2015 Free Software + +;; Author: Sebastian Wiesner +;; Maintainer: Johan Andersson +;; Sebastian Wiesner +;; Version: 0.9-cvs +;; Package-Version: 20150517.433 +;; Package-Requires: ((cl-lib "0.3")) +;; Keywords: convenience +;; URL: http://github.com/cask/epl + +;; This file is NOT part of GNU Emacs. + +;; 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 . + +;;; Commentary: + +;; A package management library for Emacs, based on package.el. + +;; The purpose of this library is to wrap all the quirks and hassle of +;; package.el into a sane API. + +;; The following functions comprise the public interface of this library: + +;;; Package directory selection + +;; `epl-package-dir' gets the directory of packages. + +;; `epl-default-package-dir' gets the default package directory. + +;; `epl-change-package-dir' changes the directory of packages. + +;;; Package system management + +;; `epl-initialize' initializes the package system and activates all +;; packages. + +;; `epl-reset' resets the package system. + +;; `epl-refresh' refreshes all package archives. + +;; `epl-add-archive' adds a new package archive. + +;;; Package objects + +;; Struct `epl-requirement' describes a requirement of a package with `name' and +;; `version' slots. + +;; `epl-requirement-version-string' gets a requirement version as string. + +;; Struct `epl-package' describes an installed or installable package with a +;; `name' and some internal `description'. + +;; `epl-package-version' gets the version of a package. + +;; `epl-package-version-string' gets the version of a package as string. + +;; `epl-package-summary' gets the summary of a package. + +;; `epl-package-requirements' gets the requirements of a package. + +;; `epl-package-directory' gets the installation directory of a package. + +;; `epl-package-from-buffer' creates a package object for the package contained +;; in the current buffer. + +;; `epl-package-from-file' creates a package object for a package file, either +;; plain lisp or tarball. + +;; `epl-package-from-descriptor-file' creates a package object for a package +;; description (i.e. *-pkg.el) file. + +;;; Package database access + +;; `epl-package-installed-p' determines whether a package is installed, either +;; built-in or explicitly installed. + +;; `epl-package-outdated-p' determines whether a package is outdated, that is, +;; whether a package with a higher version number is available. + +;; `epl-built-in-packages', `epl-installed-packages', `epl-outdated-packages' +;; and `epl-available-packages' get all packages built-in, installed, outdated, +;; or available for installation respectively. + +;; `epl-find-built-in-package', `epl-find-installed-packages' and +;; `epl-find-available-packages' find built-in, installed and available packages +;; by name. + +;; `epl-find-upgrades' finds all upgradable packages. + +;; `epl-built-in-p' return true if package is built-in to Emacs. + +;;; Package operations + +;; `epl-install-file' installs a package file. + +;; `epl-package-install' installs a package. + +;; `epl-package-delete' deletes a package. + +;; `epl-upgrade' upgrades packages. + +;;; Code: + +(require 'cl-lib) +(require 'package) + + +(unless (fboundp #'define-error) + ;; `define-error' for 24.3 and earlier, copied from subr.el + (defun define-error (name message &optional parent) + "Define NAME as a new error signal. +MESSAGE is a string that will be output to the echo area if such an error +is signaled without being caught by a `condition-case'. +PARENT is either a signal or a list of signals from which it inherits. +Defaults to `error'." + (unless parent (setq parent 'error)) + (let ((conditions + (if (consp parent) + (apply #'append + (mapcar (lambda (parent) + (cons parent + (or (get parent 'error-conditions) + (error "Unknown signal `%s'" parent)))) + parent)) + (cons parent (get parent 'error-conditions))))) + (put name 'error-conditions + (delete-dups (copy-sequence (cons name conditions)))) + (when message (put name 'error-message message))))) + +(defsubst epl--package-desc-p (package) + "Whether PACKAGE is a `package-desc' object. + +Like `package-desc-p', but return nil, if `package-desc-p' is not +defined as function." + (and (fboundp 'package-desc-p) (package-desc-p package))) + + +;;; EPL errors +(define-error 'epl-error "EPL error") + +(define-error 'epl-invalid-package "Invalid EPL package" 'epl-error) + +(define-error 'epl-invalid-package-file "Invalid EPL package file" + 'epl-invalid-package) + + +;;; Package directory +(defun epl-package-dir () + "Get the directory of packages." + package-user-dir) + +(defun epl-default-package-dir () + "Get the default directory of packages." + (eval (car (get 'package-user-dir 'standard-value)))) + +(defun epl-change-package-dir (directory) + "Change the directory of packages to DIRECTORY." + (setq package-user-dir directory) + (epl-initialize)) + + +;;; Package system management +(defvar epl--load-path-before-initialize nil + "Remember the load path for `epl-reset'.") + +(defun epl-initialize (&optional no-activate) + "Load Emacs Lisp packages and activate them. + +With NO-ACTIVATE non-nil, do not activate packages." + (setq epl--load-path-before-initialize load-path) + (package-initialize no-activate)) + +(defalias 'epl-refresh 'package-refresh-contents) + +(defun epl-add-archive (name url) + "Add a package archive with NAME and URL." + (add-to-list 'package-archives (cons name url))) + +(defun epl-reset () + "Reset the package system. + +Clear the list of installed and available packages, the list of +package archives and reset the package directory." + (setq package-alist nil + package-archives nil + package-archive-contents nil + load-path epl--load-path-before-initialize) + (when (boundp 'package-obsolete-alist) ; Legacy package.el + (setq package-obsolete-alist nil)) + (epl-change-package-dir (epl-default-package-dir))) + + +;;; Package structures +(cl-defstruct (epl-requirement + (:constructor epl-requirement-create)) + "Structure describing a requirement. + +Slots: + +`name' The name of the required package, as symbol. + +`version' The version of the required package, as version list." + name + version) + +(defun epl-requirement-version-string (requirement) + "The version of a REQUIREMENT, as string." + (package-version-join (epl-requirement-version requirement))) + +(cl-defstruct (epl-package (:constructor epl-package-create)) + "Structure representing a package. + +Slots: + +`name' The package name, as symbol. + +`description' The package description. + +The format package description varies between package.el +variants. For `package-desc' variants, it is simply the +corresponding `package-desc' object. For legacy variants, it is +a vector `[VERSION REQS DOCSTRING]'. + +Do not access `description' directly, but instead use the +`epl-package' accessors." + name + description) + +(defmacro epl-package-as-description (var &rest body) + "Cast VAR to a package description in BODY. + +VAR is a symbol, bound to an `epl-package' object. This macro +casts this object to the `description' object, and binds the +description to VAR in BODY." + (declare (indent 1)) + (unless (symbolp var) + (signal 'wrong-type-argument (list #'symbolp var))) + `(if (epl-package-p ,var) + (let ((,var (epl-package-description ,var))) + ,@body) + (signal 'wrong-type-argument (list #'epl-package-p ,var)))) + +(defsubst epl-package--package-desc-p (package) + "Whether the description of PACKAGE is a `package-desc'." + (epl--package-desc-p (epl-package-description package))) + +(defun epl-package-version (package) + "Get the version of PACKAGE, as version list." + (epl-package-as-description package + (cond + ((fboundp 'package-desc-version) (package-desc-version package)) + ;; Legacy + ((fboundp 'package-desc-vers) + (let ((version (package-desc-vers package))) + (if (listp version) version (version-to-list version)))) + (:else (error "Cannot get version from %S" package))))) + +(defun epl-package-version-string (package) + "Get the version from a PACKAGE, as string." + (package-version-join (epl-package-version package))) + +(defun epl-package-summary (package) + "Get the summary of PACKAGE, as string." + (epl-package-as-description package + (cond + ((fboundp 'package-desc-summary) (package-desc-summary package)) + ((fboundp 'package-desc-doc) (package-desc-doc package)) ; Legacy + (:else (error "Cannot get summary from %S" package))))) + +(defsubst epl-requirement--from-req (req) + "Create a `epl-requirement' from a `package-desc' REQ." + (let ((version (cadr req))) + (epl-requirement-create :name (car req) + :version (if (listp version) version + (version-to-list version))))) + +(defun epl-package-requirements (package) + "Get the requirements of PACKAGE. + +The requirements are a list of `epl-requirement' objects." + (epl-package-as-description package + (mapcar #'epl-requirement--from-req (package-desc-reqs package)))) + +(defun epl-package-directory (package) + "Get the directory PACKAGE is installed to. + +Return the absolute path of the installation directory of +PACKAGE, or nil, if PACKAGE is not installed." + (cond + ((fboundp 'package-desc-dir) + (package-desc-dir (epl-package-description package))) + ((fboundp 'package--dir) + (package--dir (symbol-name (epl-package-name package)) + (epl-package-version-string package))) + (:else (error "Cannot get package directory from %S" package)))) + +(defun epl-package-->= (pkg1 pkg2) + "Determine whether PKG1 is before PKG2 by version." + (not (version-list-< (epl-package-version pkg1) + (epl-package-version pkg2)))) + +(defun epl-package--from-package-desc (package-desc) + "Create an `epl-package' from a PACKAGE-DESC. + +PACKAGE-DESC is a `package-desc' object, from recent package.el +variants." + (if (and (fboundp 'package-desc-name) + (epl--package-desc-p package-desc)) + (epl-package-create :name (package-desc-name package-desc) + :description package-desc) + (signal 'wrong-type-argument (list 'epl--package-desc-p package-desc)))) + +(defun epl-package--parse-info (info) + "Parse a package.el INFO." + (if (epl--package-desc-p info) + (epl-package--from-package-desc info) + ;; For legacy package.el, info is a vector [NAME REQUIRES DESCRIPTION + ;; VERSION COMMENTARY]. We need to re-shape this vector into the + ;; `package-alist' format [VERSION REQUIRES DESCRIPTION] to attach it to the + ;; new `epl-package'. + (let ((name (intern (aref info 0))) + (info (vector (aref info 3) (aref info 1) (aref info 2)))) + (epl-package-create :name name :description info)))) + +(defun epl-package-from-buffer (&optional buffer) + "Create an `epl-package' object from BUFFER. + +BUFFER defaults to the current buffer. + +Signal `epl-invalid-package' if the buffer does not contain a +valid package file." + (let ((info (with-current-buffer (or buffer (current-buffer)) + (condition-case err + (package-buffer-info) + (error (signal 'epl-invalid-package (cdr err))))))) + (epl-package--parse-info info))) + +(defun epl-package-from-lisp-file (file-name) + "Parse the package headers the file at FILE-NAME. + +Return an `epl-package' object with the header metadata." + (with-temp-buffer + (insert-file-contents file-name) + (condition-case err + (epl-package-from-buffer (current-buffer)) + ;; Attach file names to invalid package errors + (epl-invalid-package + (signal 'epl-invalid-package-file (cons file-name (cdr err)))) + ;; Forward other errors + (error (signal (car err) (cdr err)))))) + +(defun epl-package-from-tar-file (file-name) + "Parse the package tarball at FILE-NAME. + +Return a `epl-package' object with the meta data of the tarball +package in FILE-NAME." + (condition-case nil + ;; In legacy package.el, `package-tar-file-info' takes the name of the tar + ;; file to parse as argument. In modern package.el, it has no arguments + ;; and works on the current buffer. Hence, we just try to call the legacy + ;; version, and if that fails because of a mismatch between formal and + ;; actual arguments, we use the modern approach. To avoid spurious + ;; signature warnings by the byte compiler, we suppress warnings when + ;; calling the function. + (epl-package--parse-info (with-no-warnings + (package-tar-file-info file-name))) + (wrong-number-of-arguments + (with-temp-buffer + (insert-file-contents-literally file-name) + ;; Switch to `tar-mode' to enable extraction of the file. Modern + ;; `package-tar-file-info' relies on `tar-mode', and signals an error if + ;; called in a buffer with a different mode. + (tar-mode) + (epl-package--parse-info (with-no-warnings + (package-tar-file-info))))))) + +(defun epl-package-from-file (file-name) + "Parse the package at FILE-NAME. + +Return an `epl-package' object with the meta data of the package +at FILE-NAME." + (if (string-match-p (rx ".tar" string-end) file-name) + (epl-package-from-tar-file file-name) + (epl-package-from-lisp-file file-name))) + +(defun epl-package--parse-descriptor-requirement (requirement) + "Parse a REQUIREMENT in a package descriptor." + ;; This function is only called on legacy package.el. On package-desc + ;; package.el, we just let package.el do the work. + (cl-destructuring-bind (name version-string) requirement + (list name (version-to-list version-string)))) + +(defun epl-package-from-descriptor-file (descriptor-file) + "Load a `epl-package' from a package DESCRIPTOR-FILE. + +A package descriptor is a file defining a new package. Its name +typically ends with -pkg.el." + (with-temp-buffer + (insert-file-contents descriptor-file) + (goto-char (point-min)) + (let ((sexp (read (current-buffer)))) + (unless (eq (car sexp) 'define-package) + (error "%S is no valid package descriptor" descriptor-file)) + (if (and (fboundp 'package-desc-from-define) + (fboundp 'package-desc-name)) + ;; In Emacs snapshot, we can conveniently call a function to parse the + ;; descriptor + (let ((desc (apply #'package-desc-from-define (cdr sexp)))) + (epl-package-create :name (package-desc-name desc) + :description desc)) + ;; In legacy package.el, we must manually deconstruct the descriptor, + ;; because the load function has eval's the descriptor and has a lot of + ;; global side-effects. + (cl-destructuring-bind + (name version-string summary requirements) (cdr sexp) + (epl-package-create + :name (intern name) + :description + (vector (version-to-list version-string) + (mapcar #'epl-package--parse-descriptor-requirement + ;; Strip the leading `quote' from the package list + (cadr requirements)) + summary))))))) + + +;;; Package database access +(defun epl-package-installed-p (package) + "Determine whether a PACKAGE is installed. + +PACKAGE is either a package name as symbol, or a package object." + (let ((name (if (epl-package-p package) + (epl-package-name package) + package)) + (version (when (epl-package-p package) + (epl-package-version package)))) + (package-installed-p name version))) + +(defun epl--parse-built-in-entry (entry) + "Parse an ENTRY from the list of built-in packages. + +Return the corresponding `epl-package' object." + (if (fboundp 'package--from-builtin) + ;; In package-desc package.el, convert the built-in package to a + ;; `package-desc' and convert that to an `epl-package' + (epl-package--from-package-desc (package--from-builtin entry)) + (epl-package-create :name (car entry) :description (cdr entry)))) + +(defun epl-built-in-packages () + "Get all built-in packages. + +Return a list of `epl-package' objects." + ;; This looks mighty strange, but it's the only way to force package.el to + ;; build the list of built-in packages. Without this, `package--builtins' + ;; might be empty. + (package-built-in-p 'foo) + (mapcar #'epl--parse-built-in-entry package--builtins)) + +(defun epl-find-built-in-package (name) + "Find a built-in package with NAME. + +NAME is a package name, as symbol. + +Return the built-in package as `epl-package' object, or nil if +there is no built-in package with NAME." + (when (package-built-in-p name) + ;; We must call `package-built-in-p' *before* inspecting + ;; `package--builtins', because otherwise `package--builtins' might be + ;; empty. + (epl--parse-built-in-entry (assq name package--builtins)))) + +(defun epl-package-outdated-p (package) + "Determine whether a PACKAGE is outdated. + +A package is outdated, if there is an available package with a +higher version. + +PACKAGE is either a package name as symbol, or a package object. +In the former case, test the installed or built-in package with +the highest version number, in the later case, test the package +object itself. + +Return t, if the package is outdated, or nil otherwise." + (let* ((package (if (epl-package-p package) + package + (or (car (epl-find-installed-packages package)) + (epl-find-built-in-package package)))) + (available (car (epl-find-available-packages + (epl-package-name package))))) + (and package available (version-list-< (epl-package-version package) + (epl-package-version available))))) + +(defun epl--parse-package-list-entry (entry) + "Parse a list of packages from ENTRY. + +ENTRY is a single entry in a package list, e.g. `package-alist', +`package-archive-contents', etc. Typically it is a cons cell, +but the exact format varies between package.el versions. This +function tries to parse all known variants. + +Return a list of `epl-package' objects parsed from ENTRY." + (let ((descriptions (cdr entry))) + (cond + ((listp descriptions) + (sort (mapcar #'epl-package--from-package-desc descriptions) + #'epl-package-->=)) + ;; Legacy package.el has just a single package in an entry, which is a + ;; standard description vector + ((vectorp descriptions) + (list (epl-package-create :name (car entry) + :description descriptions))) + (:else (error "Cannot parse entry %S" entry))))) + +(defun epl-installed-packages () + "Get all installed packages. + +Return a list of package objects." + (apply #'append (mapcar #'epl--parse-package-list-entry package-alist))) + +(defsubst epl--filter-outdated-packages (packages) + "Filter outdated packages from PACKAGES." + (let (res) + (dolist (package packages) + (when (epl-package-outdated-p package) + (push package res))) + (nreverse res))) + +(defun epl-outdated-packages () + "Get all outdated packages, as in `epl-package-outdated-p'. + +Return a list of package objects." + (epl--filter-outdated-packages (epl-installed-packages))) + +(defsubst epl--find-package-in-list (name list) + "Find a package by NAME in a package LIST. + +Return a list of corresponding `epl-package' objects." + (let ((entry (assq name list))) + (when entry + (epl--parse-package-list-entry entry)))) + +(defun epl-find-installed-package (name) + "Find the latest installed package by NAME. + +NAME is a package name, as symbol. + +Return the installed package with the highest version number as +`epl-package' object, or nil, if no package with NAME is +installed." + (car (epl-find-installed-packages name))) +(make-obsolete 'epl-find-installed-package 'epl-find-installed-packages "0.7") + +(defun epl-find-installed-packages (name) + "Find all installed packages by NAME. + +NAME is a package name, as symbol. + +Return a list of all installed packages with NAME, sorted by +version number in descending order. Return nil, if there are no +packages with NAME." + (epl--find-package-in-list name package-alist)) + +(defun epl-available-packages () + "Get all packages available for installation. + +Return a list of package objects." + (apply #'append (mapcar #'epl--parse-package-list-entry + package-archive-contents))) + +(defun epl-find-available-packages (name) + "Find available packages for NAME. + +NAME is a package name, as symbol. + +Return a list of available packages for NAME, sorted by version +number in descending order. Return nil, if there are no packages +for NAME." + (epl--find-package-in-list name package-archive-contents)) + +(cl-defstruct (epl-upgrade + (:constructor epl-upgrade-create)) + "Structure describing an upgradable package. +Slots: + +`installed' The installed package + +`available' The package available for installation." + installed + available) + +(defun epl-find-upgrades (&optional packages) + "Find all upgradable PACKAGES. + +PACKAGES is a list of package objects to upgrade, defaulting to +all installed packages. + +Return a list of `epl-upgrade' objects describing all upgradable +packages." + (let ((packages (or packages (epl-installed-packages))) + upgrades) + (dolist (pkg packages) + (let* ((version (epl-package-version pkg)) + (name (epl-package-name pkg)) + ;; Find the latest available package for NAME + (available-pkg (car (epl-find-available-packages name))) + (available-version (when available-pkg + (epl-package-version available-pkg)))) + (when (and available-version (version-list-< version available-version)) + (push (epl-upgrade-create :installed pkg + :available available-pkg) + upgrades)))) + (nreverse upgrades))) + +(defalias 'epl-built-in-p 'package-built-in-p) + + +;;; Package operations + +(defalias 'epl-install-file 'package-install-file) + +(defun epl-package-install (package &optional force) + "Install a PACKAGE. + +PACKAGE is a `epl-package' object. If FORCE is given and +non-nil, install PACKAGE, even if it is already installed." + (when (or force (not (epl-package-installed-p package))) + (if (epl-package--package-desc-p package) + (package-install (epl-package-description package)) + ;; The legacy API installs by name. We have no control over versioning, + ;; etc. + (package-install (epl-package-name package))))) + +(defun epl-package-delete (package) + "Delete a PACKAGE. + +PACKAGE is a `epl-package' object to delete." + ;; package-delete allows for packages being trashed instead of fully deleted. + ;; Let's prevent his silly behavior + (let ((delete-by-moving-to-trash nil)) + ;; The byte compiler will warn us that we are calling `package-delete' with + ;; the wrong number of arguments, since it can't infer that we guarantee to + ;; always call the correct version. Thus we suppress all warnings when + ;; calling `package-delete'. I wish there was a more granular way to + ;; disable just that specific warning, but it is what it is. + (if (epl-package--package-desc-p package) + (with-no-warnings + (package-delete (epl-package-description package))) + ;; The legacy API deletes by name (as string!) and version instead by + ;; descriptor. Hence `package-delete' takes two arguments. For some + ;; insane reason, the arguments are strings here! + (let ((name (symbol-name (epl-package-name package))) + (version (epl-package-version-string package))) + (with-no-warnings + (package-delete name version)) + ;; Legacy package.el does not remove the deleted package + ;; from the `package-alist', so we do it manually here. + (let ((pkg (assq (epl-package-name package) package-alist))) + (when pkg + (setq package-alist (delq pkg package-alist)))))))) + +(defun epl-upgrade (&optional packages preserve-obsolete) + "Upgrade PACKAGES. + +PACKAGES is a list of package objects to upgrade, defaulting to +all installed packages. + +The old versions of the updated packages are deleted, unless +PRESERVE-OBSOLETE is non-nil. + +Return a list of all performed upgrades, as a list of +`epl-upgrade' objects." + (let ((upgrades (epl-find-upgrades packages))) + (dolist (upgrade upgrades) + (epl-package-install (epl-upgrade-available upgrade) 'force) + (unless preserve-obsolete + (epl-package-delete (epl-upgrade-installed upgrade)))) + upgrades)) + +(provide 'epl) + +;;; epl.el ends here diff --git a/elpa/epl-readme.txt b/elpa/epl-readme.txt new file mode 100644 index 00000000..7e7c9859 --- /dev/null +++ b/elpa/epl-readme.txt @@ -0,0 +1,84 @@ +A package management library for Emacs, based on package.el. + +The purpose of this library is to wrap all the quirks and hassle of +package.el into a sane API. + +The following functions comprise the public interface of this library: + +Package directory selection + +`epl-package-dir' gets the directory of packages. + +`epl-default-package-dir' gets the default package directory. + +`epl-change-package-dir' changes the directory of packages. + +Package system management + +`epl-initialize' initializes the package system and activates all +packages. + +`epl-reset' resets the package system. + +`epl-refresh' refreshes all package archives. + +`epl-add-archive' adds a new package archive. + +Package objects + +Struct `epl-requirement' describes a requirement of a package with `name' and +`version' slots. + +`epl-requirement-version-string' gets a requirement version as string. + +Struct `epl-package' describes an installed or installable package with a +`name' and some internal `description'. + +`epl-package-version' gets the version of a package. + +`epl-package-version-string' gets the version of a package as string. + +`epl-package-summary' gets the summary of a package. + +`epl-package-requirements' gets the requirements of a package. + +`epl-package-directory' gets the installation directory of a package. + +`epl-package-from-buffer' creates a package object for the package contained +in the current buffer. + +`epl-package-from-file' creates a package object for a package file, either +plain lisp or tarball. + +`epl-package-from-descriptor-file' creates a package object for a package +description (i.e. *-pkg.el) file. + +Package database access + +`epl-package-installed-p' determines whether a package is installed, either +built-in or explicitly installed. + +`epl-package-outdated-p' determines whether a package is outdated, that is, +whether a package with a higher version number is available. + +`epl-built-in-packages', `epl-installed-packages', `epl-outdated-packages' +and `epl-available-packages' get all packages built-in, installed, outdated, +or available for installation respectively. + +`epl-find-built-in-package', `epl-find-installed-packages' and +`epl-find-available-packages' find built-in, installed and available packages +by name. + +`epl-find-upgrades' finds all upgradable packages. + +`epl-built-in-p' return true if package is built-in to Emacs. + +Package operations + +`epl-install-file' installs a package file. + +`epl-package-install' installs a package. + +`epl-package-delete' deletes a package. + +`epl-upgrade' upgrades packages. diff --git a/elpa/fullscreen-mode-20130524.956/fullscreen-mode-autoloads.el b/elpa/fullscreen-mode-20130524.956/fullscreen-mode-autoloads.el new file mode 100644 index 00000000..a93a798f --- /dev/null +++ b/elpa/fullscreen-mode-20130524.956/fullscreen-mode-autoloads.el @@ -0,0 +1,51 @@ +;;; fullscreen-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (fullscreen-mode fullscreen-mode-fullscreen-toggle +;;;;;; fullscreen-mode-windowed fullscreen-mode-fullscreen) "fullscreen-mode" +;;;;;; "fullscreen-mode.el" (21697 19209 0 0)) +;;; Generated autoloads from fullscreen-mode.el + +(autoload 'fullscreen-mode-fullscreen "fullscreen-mode" "\ +Sets frame's fullscreen parameter to fullboth + +\(fn)" t nil) + +(autoload 'fullscreen-mode-windowed "fullscreen-mode" "\ +Set frame's fullscreen parameter back to it's previous windowed state + +\(fn)" t nil) + +(autoload 'fullscreen-mode-fullscreen-toggle "fullscreen-mode" "\ +Toggles the frame's fullscreen state + +\(fn)" t nil) + +(defvar fullscreen-mode nil "\ +Non-nil if Fullscreen mode is enabled. +See the command `fullscreen-mode' for a description of this minor mode.") + +(custom-autoload 'fullscreen-mode "fullscreen-mode" nil) + +(autoload 'fullscreen-mode "fullscreen-mode" "\ +Provides fullscreen-mode-toggle, bound to F11 that toggles the frame between fullscreen and windowed. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("fullscreen-mode-pkg.el") (21697 19209 +;;;;;; 854137 0)) + +;;;*** + +(provide 'fullscreen-mode-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; fullscreen-mode-autoloads.el ends here diff --git a/elpa/fullscreen-mode-20130524.956/fullscreen-mode-pkg.el b/elpa/fullscreen-mode-20130524.956/fullscreen-mode-pkg.el new file mode 100644 index 00000000..1e318040 --- /dev/null +++ b/elpa/fullscreen-mode-20130524.956/fullscreen-mode-pkg.el @@ -0,0 +1 @@ +(define-package "fullscreen-mode" "20130524.956" "fullscreen window support for Emacs" (quote nil)) diff --git a/elpa/fullscreen-mode-20130524.956/fullscreen-mode.el b/elpa/fullscreen-mode-20130524.956/fullscreen-mode.el new file mode 100644 index 00000000..73e70f8e --- /dev/null +++ b/elpa/fullscreen-mode-20130524.956/fullscreen-mode.el @@ -0,0 +1,95 @@ +;;; fullscreen-mode.el --- fullscreen window support for Emacs + +;; Author: Ryan Mulligan +;; Version: 20130524.956 +;; X-Original-Version: 0.0.1 +;; URL: https://github.com/ryantm/fullscreen-mode +;; Keywords: fullscreen, fullscreen-mode + +;; This file is not part of GNU Emacs. + +;;; Install: + +;; Install package +;; (package-install 'fullscreen-mode) +;; +;; Enable minor mode +;; (fullscreen-mode 1) + +;;; Commentary: + +;; Global minor mode that provides +;; `fullscreen-mode-fullscreen-toggle', +;; which toggles the frame between fullscreen and windowed. +;; `fullscreen-mode-fullscreen-toggle' is bound to F11. + +;;; 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. + +;;; Code: +(defvar fullscreen-mode-windowed-frame-state (make-hash-table :weakness 'key) + "Hash keyed by frames with the value of the fullscreen frame parameter before going to fullscreen. + Stored so fullscreen-mode-toggle can go back to it.") + +(defun fullscreen-mode-windowed-frame-state-update () + "Save fullscreen-windowed-frame-state with the current frame-parameter state" + (let ((fullscreen-frame-parameter (frame-parameter nil 'fullscreen))) + (if (not (equal fullscreen-frame-parameter 'fullboth)) + (puthash + (selected-frame) + fullscreen-frame-parameter + fullscreen-mode-windowed-frame-state)))) + +(defun fullscreen-mode-windowed-frame-state-restore () + "Restore the frame-parameter stored in fullscreen-windowed-frame-state" + (let ((fullscreen-frame-parameter (gethash (selected-frame) fullscreen-mode-windowed-frame-state))) + (set-frame-parameter nil 'fullscreen fullscreen-frame-parameter))) + +(defun fullscreen-mode-fullscreen-p () + "Predicate for fullscreen frame parameter being set to 'fullboth" + (equal (frame-parameter nil 'fullscreen) 'fullboth)) + +;;;###autoload +(defun fullscreen-mode-fullscreen () + "Sets frame's fullscreen parameter to fullboth" + (interactive) + (fullscreen-mode-windowed-frame-state-update) + (set-frame-parameter nil 'fullscreen 'fullboth)) + +;;;###autoload +(defun fullscreen-mode-windowed () + "Set frame's fullscreen parameter back to it's previous windowed state" + (interactive) + (fullscreen-mode-windowed-frame-state-restore)) + +;;;###autoload +(defun fullscreen-mode-fullscreen-toggle () + "Toggles the frame's fullscreen state" + (interactive) + (if (fullscreen-mode-fullscreen-p) + (fullscreen-mode-windowed) + (fullscreen-mode-fullscreen))) + +(defvar fullscreen-mode-map + (let ((m (make-sparse-keymap))) + (define-key m (kbd "") 'fullscreen-mode-fullscreen-toggle) + m) + "Keymap for `fullscreen-mode'.") + +;;;###autoload +(define-minor-mode fullscreen-mode + "Provides fullscreen-mode-toggle, bound to F11 that toggles the frame between fullscreen and windowed." + :global t + :keymap fullscreen-mode-map) + +(provide 'fullscreen-mode) +;;; fullscreen-mode.el ends here diff --git a/elpa/fullscreen-mode-readme.txt b/elpa/fullscreen-mode-readme.txt new file mode 100644 index 00000000..59eed7d7 --- /dev/null +++ b/elpa/fullscreen-mode-readme.txt @@ -0,0 +1,4 @@ +Global minor mode that provides +`fullscreen-mode-fullscreen-toggle', +which toggles the frame between fullscreen and windowed. +`fullscreen-mode-fullscreen-toggle' is bound to F11. diff --git a/elpa/git-commit-20150701.1326/git-commit-autoloads.el b/elpa/git-commit-20150701.1326/git-commit-autoloads.el new file mode 100644 index 00000000..722b20ae --- /dev/null +++ b/elpa/git-commit-20150701.1326/git-commit-autoloads.el @@ -0,0 +1,35 @@ +;;; git-commit-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) + +;;;### (autoloads nil "git-commit" "git-commit.el" (21910 48889 0 +;;;;;; 0)) +;;; Generated autoloads from git-commit.el + +(defvar global-git-commit-mode t "\ +Non-nil if Global-Git-Commit mode is enabled. +See the command `global-git-commit-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `global-git-commit-mode'.") + +(custom-autoload 'global-git-commit-mode "git-commit" nil) + +(autoload 'global-git-commit-mode "git-commit" "\ +Edit Git commit messages. +This global mode arranges for `git-commit-setup' to be called +when a Git commit message file is opened. That usually happens +when Git uses the Emacsclient as $GIT_EDITOR to have the user +provide such a commit message. + +\(fn &optional ARG)" t nil) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; git-commit-autoloads.el ends here diff --git a/elpa/git-commit-20150701.1326/git-commit-pkg.el b/elpa/git-commit-20150701.1326/git-commit-pkg.el new file mode 100644 index 00000000..ebebfad4 --- /dev/null +++ b/elpa/git-commit-20150701.1326/git-commit-pkg.el @@ -0,0 +1 @@ +(define-package "git-commit" "20150701.1326" "Edit Git commit messages" '((emacs "24.4") (dash "2.10.0") (with-editor "2.1.0")) :url "https://github.com/magit/magit" :keywords '("git" "tools" "vc")) diff --git a/elpa/git-commit-20150701.1326/git-commit.el b/elpa/git-commit-20150701.1326/git-commit.el new file mode 100644 index 00000000..8f629f21 --- /dev/null +++ b/elpa/git-commit-20150701.1326/git-commit.el @@ -0,0 +1,655 @@ +;;; git-commit.el --- Edit Git commit messages -*- lexical-binding: t; -*- + +;; Copyright (C) 2010-2015 The Magit Project Contributors +;; +;; You should have received a copy of the AUTHORS.md file which +;; lists all contributors. If not, see http://magit.vc/authors. + +;; Authors: Jonas Bernoulli +;; Sebastian Wiesner +;; Florian Ragwitz +;; Marius Vollmer +;; Maintainer: Jonas Bernoulli + +;; Package-Requires: ((emacs "24.4") (dash "2.10.0") (with-editor "2.1.0")) +;; Keywords: git tools vc +;; Package-Version: 20150701.1326 +;; Homepage: https://github.com/magit/magit + +;; This file is not part of GNU Emacs. + +;; This file 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 file 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 file. If not, see . + +;;; Commentary: + +;; This package assists the user in writing good Git commit messages. + +;; While Git allows for the message to be provided on the command +;; line, it is preferable to tell Git to create the commit without +;; actually passing it a message. Git then invokes the `$GIT_EDITOR' +;; (or if that is undefined `$EDITOR') asking the user to provide the +;; message by editing the file ".git/COMMIT_EDITMSG" (or another file +;; in that directory, e.g. ".git/MERGE_MSG" for merge commits). + +;; When `global-git-commit-mode' is enabled, which it is by default, +;; then opening such a file causes the features described below, to +;; be enabled in that buffer. Normally this would be done using a +;; major-mode but to allow the use of any major-mode, as the user sees +;; fit, it is done here by running a setup function, which among other +;; things turns on the preferred major-mode, by default `text-mode'. + +;; Git waits for the `$EDITOR' to finish and then either creates the +;; commit using the contents of the file as commit message, or, if the +;; editor process exited with a non-zero exit status, aborts without +;; creating a commit. Unfortunately Emacsclient (which is what Emacs +;; users should be using as `$EDITOR' or at least as `$GIT_EDITOR') +;; does not differentiate between "successfully" editing a file and +;; aborting; not out of the box that is. + +;; By making use of the `with-editor' package this package provides +;; both ways of finish an editing session. In either case the file +;; is saved, but Emacseditor's exit code differs. +;; +;; C-c C-c Finish the editing session successfully by returning +;; with exit code 0. Git then creates the commit using +;; the message it finds in the file. +;; +;; C-c C-k Aborts the edit editing session by returning with exit +;; code 1. Git then aborts the commit. + +;; Aborting the commit does not cause the message to be lost, but +;; relying solely on the file not being tampered with is risky. This +;; package additionally stores all aborted messages for the duration +;; of the current session (i.e. until you close Emacs). To get back +;; an aborted message use M-p and M-n while editing a message. +;; +;; M-p Replace the buffer contents with the previous message +;; from the message ring. Of course only after storing +;; the current content there too. +;; +;; M-n Replace the buffer contents with the next message from +;; the message ring, after storing the current content. + +;; Some support for pseudo headers as used in some projects is +;; provided by these commands: +;; +;; C-c C-s Insert a Signed-off-by header. +;; C-C C-a Insert a Acked-by header. +;; C-c C-t Insert a Tested-by header. +;; C-c C-r Insert a Reviewed-by header. +;; C-c C-o Insert a Cc header. +;; C-c C-p Insert a Reported-by header. +;; C-c M-s Insert a Suggested-by header. + +;; When Git requests a commit message from the user, it does so by +;; having her edit a file which initially contains some comments, +;; instructing her what to do, and providing useful information, such +;; as which files were modified. These comments, even when left +;; intact by the user, do not become part of the commit message. This +;; package ensures these comments are propertizes as such and further +;; prettifies them by using different faces for various parts, such as +;; files. + +;; Finally this package highlights style errors, like lines that are +;; to long, or when the second line is not empty. It may even nag you +;; when you attempt to finish the commit without having fixed these +;; issues. Some people like that nagging, I don't, so you'll have to +;; enable it. Which brings me to the last point. Like any +;; respectable Emacs package, this one too is highly customizable: +;; +;; M-x customize-group RET git-commit RET + +;;; Code: +;;;; Dependencies + +(require 'dash) +(require 'log-edit) +(require 'ring) +(require 'server) +(require 'with-editor) + +(eval-when-compile (require 'recentf)) + +;;;; Declarations + +(defvar flyspell-generic-check-word-predicate) + +;;; Options +;;;; Variables + +(defgroup git-commit nil + "Edit Git commit messages." + :prefix "git-commit-" + :group 'tools) + +;;;###autoload +(define-minor-mode global-git-commit-mode + "Edit Git commit messages. +This global mode arranges for `git-commit-setup' to be called +when a Git commit message file is opened. That usually happens +when Git uses the Emacsclient as $GIT_EDITOR to have the user +provide such a commit message." + :group 'git-commit + :type 'boolean + :global t + :init-value t + :initialize (lambda (symbol exp) + (custom-initialize-default symbol exp) + (when global-git-commit-mode + (add-hook 'find-file-hook 'git-commit-setup-check-buffer))) + (if global-git-commit-mode + (add-hook 'find-file-hook 'git-commit-setup-check-buffer) + (remove-hook 'find-file-hook 'git-commit-setup-check-buffer))) + +(defcustom git-commit-major-mode 'text-mode + "Major mode used to edit Git commit messages. +The major mode configured here is turned on by the minor mode +`git-commit-mode'." + :group 'git-commit + :type '(choice (function-item text-mode) + (const :tag "No major mode"))) + +(defcustom git-commit-setup-hook + '(git-commit-save-message + git-commit-setup-changelog-support + git-commit-turn-on-auto-fill + git-commit-propertize-diff + with-editor-usage-message) + "Hook run at the end of `git-commit-setup'." + :group 'git-commit + :type 'hook + :options '(magit-revert-buffers + git-commit-save-message + git-commit-setup-changelog-support + git-commit-turn-on-auto-fill + git-commit-turn-on-flyspell + git-commit-propertize-diff + with-editor-usage-message)) + +(defcustom git-commit-finish-query-functions + '(git-commit-check-style-conventions) + "List of functions called to query before performing commit. + +The commit message buffer is current while the functions are +called. If any of them returns nil, then the commit is not +performed and the buffer is not killed. The user should then +fix the issue and try again. + +The functions are called with one argument. If it is non-nil +then that indicates that the user used a prefix argument to +force finishing the session despite issues. Functions should +usually honor this wish and return non-nil." + :options '(git-commit-check-style-conventions) + :type 'hook + :group 'git-commit) + +(defcustom git-commit-summary-max-length 50 + "Fontify characters beyond this column in summary lines as errors." + :group 'git-commit + :safe 'numberp + :type 'number) + +(defcustom git-commit-fill-column 72 + "Automatically wrap commit message lines beyond this column." + :group 'git-commit + :safe 'numberp + :type 'number) + +(defcustom git-commit-known-pseudo-headers + '("Signed-off-by" "Acked-by" "Cc" + "Suggested-by" "Reported-by" "Tested-by" "Reviewed-by") + "A list of Git pseudo headers to be highlighted." + :group 'git-commit + :safe (lambda (val) (and (listp val) (-all-p 'stringp val))) + :type '(repeat string)) + +;;;; Faces + +(defgroup git-commit-faces nil + "Faces for highlighting Git commit messages." + :prefix "git-commit-" + :group 'git-commit + :group 'faces) + +(defface git-commit-summary + '((t :inherit font-lock-type-face)) + "Face used for the summary in commit messages." + :group 'git-commit-faces) + +(defface git-commit-overlong-summary + '((t :inherit font-lock-warning-face)) + "Face used for the tail of overlong commit message summaries." + :group 'git-commit-faces) + +(defface git-commit-nonempty-second-line + '((t :inherit font-lock-warning-face)) + "Face used for non-whitespace on the second line of commit messages." + :group 'git-commit-faces) + +(defface git-commit-note + '((t :inherit font-lock-string-face)) + "Face used for notes in commit messages." + :group 'git-commit-faces) + +(defface git-commit-pseudo-header + '((t :inherit font-lock-string-face)) + "Font used for pseudo headers in commit messages." + :group 'git-commit-faces) + +(defface git-commit-known-pseudo-header + '((t :inherit font-lock-keyword-face)) + "Face used for the keywords of known pseudo headers in commit messages." + :group 'git-commit-faces) + +(defface git-commit-comment-branch + '((t :inherit font-lock-variable-name-face)) + "Face used for branch names in commit message comments." + :group 'git-commit-faces) + +(defface git-commit-comment-detached + '((t :inherit git-commit-comment-branch)) + "Face used for detached `HEAD' in commit message comments." + :group 'git-commit-faces) + +(defface git-commit-comment-heading + '((t :inherit git-commit-known-pseudo-header)) + "Face used for headings in commit message comments." + :group 'git-commit-faces) + +(defface git-commit-comment-file + '((t :inherit git-commit-pseudo-header)) + "Face used for file names in commit message comments." + :group 'git-commit-faces) + +(defface git-commit-comment-action + '((t :inherit git-commit-comment-branch)) + "Face used for actions in commit message comments." + :group 'git-commit-faces) + +;;; Keymap + +(defvar git-commit-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c C-s") 'git-commit-signoff) + (define-key map (kbd "C-c C-a") 'git-commit-ack) + (define-key map (kbd "C-c C-t") 'git-commit-test) + (define-key map (kbd "C-c C-r") 'git-commit-review) + (define-key map (kbd "C-c C-o") 'git-commit-cc) + (define-key map (kbd "C-c C-p") 'git-commit-reported) + (define-key map (kbd "C-c C-i") 'git-commit-suggested) + (define-key map (kbd "C-c M-s") 'git-commit-save-message) + (define-key map (kbd "M-p") 'git-commit-prev-message) + (define-key map (kbd "M-n") 'git-commit-next-message) + ;; Old bindings to avoid confusion + (define-key map (kbd "C-c C-x s") 'git-commit-signoff) + (define-key map (kbd "C-c C-x a") 'git-commit-ack) + (define-key map (kbd "C-c C-x t") 'git-commit-test) + (define-key map (kbd "C-c C-x r") 'git-commit-review) + (define-key map (kbd "C-c C-x o") 'git-commit-cc) + (define-key map (kbd "C-c C-x p") 'git-commit-reported) + map) + "Key map used by `git-commit-mode'.") + +;;; Menu + +(require 'easymenu) +(easy-menu-define git-commit-mode-menu git-commit-mode-map + "Git Commit Mode Menu" + '("Commit" + ["Previous" git-commit-prev-message t] + ["Next" git-commit-next-message t] + "-" + ["Ack" git-commit-ack :active t + :help "Insert an 'Acked-by' header"] + ["Sign-Off" git-commit-signoff :active t + :help "Insert a 'Signed-off-by' header"] + ["Tested-by" git-commit-test :active t + :help "Insert a 'Tested-by' header"] + ["Reviewed-by" git-commit-review :active t + :help "Insert a 'Reviewed-by' header"] + ["CC" git-commit-cc t + :help "Insert a 'Cc' header"] + ["Reported" git-commit-reported :active t + :help "Insert a 'Reported-by' header"] + ["Suggested" git-commit-suggested t + :help "Insert a 'Suggested-by' header"] + "-" + ["Save" git-commit-save-message t] + ["Cancel" with-editor-cancel t] + ["Commit" with-editor-finish t])) + +;;; Hooks + +(defconst git-commit-filename-regexp "/\\(\ +\\(\\(COMMIT\\|NOTES\\|PULLREQ\\|TAG\\)_EDIT\\|MERGE_\\|\\)MSG\ +\\|BRANCH_DESCRIPTION\\)\\'") + +(eval-after-load 'recentf + '(add-to-list 'recentf-exclude git-commit-filename-regexp)) + +(defun git-commit-setup-font-lock-in-buffer () + (and buffer-file-name + (string-match-p git-commit-filename-regexp buffer-file-name) + (git-commit-setup-font-lock))) + +(add-hook 'after-change-major-mode-hook 'git-commit-setup-font-lock-in-buffer) + +(defun git-commit-setup-check-buffer () + (and buffer-file-name + (string-match-p git-commit-filename-regexp buffer-file-name) + (git-commit-setup))) + +(defun git-commit-setup () + (when git-commit-major-mode + (funcall git-commit-major-mode)) + (setq with-editor-show-usage nil) + (with-editor-mode 1) + (add-hook 'with-editor-finish-query-functions + 'git-commit-finish-query-functions nil t) + (add-hook 'with-editor-pre-finish-hook + 'git-commit-save-message nil t) + (add-hook 'with-editor-pre-cancel-hook + 'git-commit-save-message nil t) + (setq with-editor-cancel-message + 'git-commit-cancel-message) + (make-local-variable 'log-edit-comment-ring-index) + (git-commit-mode 1) + (git-commit-setup-font-lock) + (when (boundp 'save-place) + (setq save-place nil)) + (save-excursion + (goto-char (point-min)) + (when (= (line-beginning-position) + (line-end-position)) + (open-line 1))) + (run-hooks 'git-commit-setup-hook) + (set-buffer-modified-p nil)) + +(defun git-commit-setup-font-lock () + (let ((table (make-syntax-table (syntax-table)))) + (when comment-start + (modify-syntax-entry (string-to-char comment-start) "." table)) + (modify-syntax-entry ?# "." table) + (modify-syntax-entry ?\" "." table) + (modify-syntax-entry ?\' "." table) + (modify-syntax-entry ?` "." table) + (set-syntax-table table)) + (setq-local comment-start + (or (ignore-errors + (car (process-lines "git" "config" "core.commentchar"))) + "#")) + (setq-local comment-start-skip (format "^%s+[\s\t]*" comment-start)) + (setq-local comment-end-skip "\n") + (setq-local comment-use-syntax nil) + (setq-local font-lock-multiline t) + (font-lock-add-keywords nil (git-commit-mode-font-lock-keywords) t)) + +(define-minor-mode git-commit-mode + "Auxiliary minor mode used when editing Git commit messages. +This mode is only responsible for setting up some key bindings. +Don't use it directly, instead enable `global-git-commit-mode'." + :lighter "") + +(put 'git-commit-mode 'permanent-local t) + +(defun git-commit-setup-changelog-support () + "Treat ChangeLog entries as paragraphs." + (setq-local paragraph-start (concat paragraph-start "\\|\\*\\|("))) + +(defun git-commit-turn-on-auto-fill () + "Unconditionally turn on Auto Fill mode. +And set `fill-column' to `git-commit-fill-column'." + (setq fill-column git-commit-fill-column) + (turn-on-auto-fill)) + +(defun git-commit-turn-on-flyspell () + "Unconditionally turn on Flyspell mode. +Also prevent comments from being checked and +finally check current non-comment text." + (require 'flyspell) + (turn-on-flyspell) + (setq flyspell-generic-check-word-predicate + 'git-commit-flyspell-verify) + (flyspell-buffer)) + +(defun git-commit-flyspell-verify () + (not (memq (get-text-property (point) 'face) + '(font-lock-comment-face font-lock-comment-delimiter-face + git-commit-comment-branch git-commit-comment-detached + git-commit-comment-heading git-commit-comment-file + git-commit-comment-action git-commit-pseudo-header + git-commit-known-pseudo-header)))) + +(defun git-commit-finish-query-functions (force) + (run-hook-with-args-until-failure + 'git-commit-finish-query-functions force)) + +(defun git-commit-check-style-conventions (force) + "Check for violations of certain basic style conventions. +For each violation ask the user if she wants to proceed anyway. +This makes sure the summary line isn't to long and that the +second line is empty." + (or force + (save-excursion + (goto-char (point-min)) + (re-search-forward (git-commit-summary-regexp) nil t) + (if (equal (match-string 1) "") + t ; Just try; we don't know whether --allow-empty-message was used. + (and (or (equal (match-string 2) "") + (y-or-n-p "Summary line is too long. Commit anyway? ")) + (or (equal (match-string 3) "") + (y-or-n-p "Second line is not empty. Commit anyway? "))))))) + +(defun git-commit-cancel-message () + (message + (concat "Commit canceled" + (and (memq 'git-commit-save-message with-editor-pre-cancel-hook) + ". Message saved to `log-edit-comment-ring'")))) + +;;; History + +(defun git-commit-prev-message (arg) + "Cycle backward through message history, after saving current message. +With a numeric prefix ARG, go back ARG comments." + (interactive "*p") + (when (and (git-commit-save-message) (> arg 0)) + (setq log-edit-comment-ring-index + (log-edit-new-comment-index + arg (ring-length log-edit-comment-ring)))) + (save-restriction + (goto-char (point-min)) + (narrow-to-region (point) + (if (re-search-forward (concat "^" comment-start)) + (max 1 (- (point) 2)) + (point-max))) + (log-edit-previous-comment arg))) + +(defun git-commit-next-message (arg) + "Cycle forward through message history, after saving current message. +With a numeric prefix ARG, go forward ARG comments." + (interactive "*p") + (git-commit-prev-message (- arg))) + +(defun git-commit-save-message () + "Save current message to `log-edit-comment-ring'." + (interactive) + (--when-let (git-commit-buffer-message) + (unless (ring-member log-edit-comment-ring it) + (ring-insert log-edit-comment-ring it)))) + +(defun git-commit-buffer-message () + (let ((flush (concat "^" comment-start)) + (str (buffer-substring-no-properties (point-min) (point-max)))) + (with-temp-buffer + (insert str) + (goto-char (point-min)) + (flush-lines flush) + (goto-char (point-max)) + (unless (eq (char-before) ?\n) + (insert ?\n)) + (setq str (buffer-string))) + (unless (string-match "\\`[ \t\n\r]*\\'" str) + (when (string-match "\\`\n\\{2,\\}" str) + (setq str (replace-match "\n" t t str))) + (when (string-match "\n\\{2,\\}\\'" str) + (setq str (replace-match "\n" t t str))) + str))) + +;;; Headers + +(defun git-commit-ack (name mail) + "Insert a header acknowledging that you have looked at the commit." + (interactive (git-commit-self-ident)) + (git-commit-insert-header "Acked-by" name mail)) + +(defun git-commit-review (name mail) + "Insert a header acknowledging that you have reviewed the commit." + (interactive (git-commit-self-ident)) + (git-commit-insert-header "Reviewed-by" name mail)) + +(defun git-commit-signoff (name mail) + "Insert a header to sign off the commit." + (interactive (git-commit-self-ident)) + (git-commit-insert-header "Signed-off-by" name mail)) + +(defun git-commit-test (name mail) + "Insert a header acknowledging that you have tested the commit." + (interactive (git-commit-self-ident)) + (git-commit-insert-header "Tested-by" name mail)) + +(defun git-commit-cc (name mail) + "Insert a header mentioning someone who might be interested." + (interactive (git-commit-read-ident)) + (git-commit-insert-header "Cc" name mail)) + +(defun git-commit-reported (name mail) + "Insert a header mentioning the person who reported the issue." + (interactive (git-commit-read-ident)) + (git-commit-insert-header "Reported-by" name mail)) + +(defun git-commit-suggested (name mail) + "Insert a header mentioning the person who suggested the change." + (interactive (git-commit-read-ident)) + (git-commit-insert-header "Suggested-by" name mail)) + +(defun git-commit-self-ident () + (list (or (getenv "GIT_AUTHOR_NAME") + (getenv "GIT_COMMITTER_NAME") + (ignore-errors (car (process-lines "git" "config" "user.name"))) + user-full-name + (read-string "Name: ")) + (or (getenv "GIT_AUTHOR_EMAIL") + (getenv "GIT_COMMITTER_EMAIL") + (getenv "EMAIL") + (ignore-errors (car (process-lines "git" "config" "user.email"))) + (read-string "Email: ")))) + +(defun git-commit-read-ident () + (list (read-string "Name: ") + (read-string "Email: "))) + +(defun git-commit-insert-header (header name email) + (setq header (format "%s: %s <%s>" header name email)) + (save-excursion + (goto-char (point-max)) + (cond ((re-search-backward "^[-a-zA-Z]+: [^<]+? <[^>]+>" nil t) + (end-of-line) + (insert ?\n header) + (unless (= (char-after) ?\n) + (insert ?\n))) + (t + (while (re-search-backward (concat "^" comment-start) nil t)) + (unless (looking-back "\n\n") + (insert ?\n)) + (insert header ?\n))) + (unless (or (eobp) (= (char-after) ?\n)) + (insert ?\n)))) + +;;; Font-Lock + +(defconst git-commit-comment-headings + '("Changes to be committed:" + "Untracked files:" + "Changed but not updated:" + "Changes not staged for commit:" + "Unmerged paths:")) + +(defun git-commit-summary-regexp () + (concat + ;; Leading empty lines and comments + (format "\\`\\(?:^\\(?:\\s-*\\|%s.*\\)\n\\)*" comment-start) + ;; Summary line + (format "\\(.\\{0,%d\\}\\)\\(.*\\)" git-commit-summary-max-length) + ;; Non-empty non-comment second line + (format "\\(?:\n%s\\|\n\\(.*\\)\\)?" comment-start))) + +(defun git-commit-mode-font-lock-keywords () + `(;; Comments + (,(format "^%s.*" comment-start) + (0 'font-lock-comment-face)) + (,(format "^%s On branch \\(.*\\)" comment-start) + (1 'git-commit-comment-branch t)) + (,(format "^%s Not currently on any branch." comment-start) + (1 'git-commit-comment-detached t)) + (,(format "^%s %s" comment-start + (regexp-opt git-commit-comment-headings t)) + (1 'git-commit-comment-heading t)) + (,(format "^%s\t\\(?:\\([^:\n]+\\):\\s-+\\)?\\(.*\\)" comment-start) + (1 'git-commit-comment-action t t) + (2 'git-commit-comment-file t)) + ;; Pseudo headers + (,(format "^\\(%s:\\)\\( .*\\)" + (regexp-opt git-commit-known-pseudo-headers)) + (1 'git-commit-known-pseudo-header) + (2 'git-commit-pseudo-header)) + ("^[-a-zA-Z]+: [^<]+? <[^>]+>" + (0 'git-commit-pseudo-header)) + ;; Summary + (,(git-commit-summary-regexp) + (1 'git-commit-summary t)) + ;; - Note (overrides summary) + ("\\[.+?\\]" + (0 'git-commit-note t)) + ;; - Non-empty second line (overrides summary and note) + (,(git-commit-summary-regexp) + (2 'git-commit-overlong-summary t t) + (3 'git-commit-nonempty-second-line t t)))) + +(defun git-commit-propertize-diff () + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^diff --git" nil t) + (let ((buffer (current-buffer))) + (insert + (with-temp-buffer + (insert + (with-current-buffer buffer + (prog1 (buffer-substring-no-properties (point) (point-max)) + (delete-region (point) (point-max))))) + (diff-mode) + (let (font-lock-verbose font-lock-support-mode) + (font-lock-fontify-buffer)) + (let (next (pos (point-min))) + (while (setq next (next-single-property-change pos 'face)) + (put-text-property pos next 'font-lock-face + (get-text-property pos 'face)) + (setq pos next))) + (buffer-string))))))) + +;;; git-commit.el ends soon +(provide 'git-commit) +;; Local Variables: +;; indent-tabs-mode: nil +;; End: +;;; git-commit.el ends here diff --git a/elpa/gnupg/pubring.gpg b/elpa/gnupg/pubring.gpg new file mode 100644 index 0000000000000000000000000000000000000000..e76e68522f36382fa5897866680fdb5afc73abdb GIT binary patch literal 999 zcmVo1 zeEGS=1j7e873T7%K)`}qIuNnP{x>4UtLXEl1iTjeSt^2jzB3(@v!TDpEzd;3uCk(= z8z>F%0qVrqpCDWJvZifZOj!AtNLe*rwg{TJ`JALM#aVIp!mVwU{Ozwo8g`~(sa7%> z-Z0d;oW26&cJqnN5@FbgcWbGu(e7vgokxC{5?tU>m?(h;{W=7r+w*ddPlNvXW+(pJx=iF{fa8{*jK@6&5-E;Nd6=ar7(xY2|E1q zFQ<}PY3zpPs8-ikO_L1i-`Ysh9xEm=qILOYt2*h4=vuIQ9%d)St_4` zeBg&x9x_6m!L$$SNkx}REJo?@cES)k2&)C-3cZ=0C-GUAe99dL-Qvi!D2AK?9s`;! zY4|XPB6V6RkPpwTH7h2Mh4y5C9^WM&vc*X*52vttTx0%r&jurh!m}$UC6hda?|a*% zI=s&dEOn3kc{AK8xgrr-<8B(r+;?RsTl@Xn3{Ibr(&`b^3;SL^4FrvM3xjzh!A7)ilhmm`{s{TD{V=v@S_Jo`}D;W9L(QE0Ue=tjLYw2JwgX~ovCd00RWby0OiT6o#*&9KcJZt&YvWX Va-Ur7=MI9D^M5%6S97oe00W!$*(Lx0 literal 0 HcmV?d00001 diff --git a/elpa/gnupg/secring.gpg b/elpa/gnupg/secring.gpg new file mode 100644 index 00000000..e69de29b diff --git a/elpa/gnupg/trustdb.gpg b/elpa/gnupg/trustdb.gpg new file mode 100644 index 0000000000000000000000000000000000000000..7b853f3dedaa1fcf8c3063249db6fd4e47ea558a GIT binary patch literal 1200 zcmZQfFGy!*W@Ke#VqgfhKYN7%J7DC(E{-8OstzMazyhP;G8!(R5ExAdl%)dz25SVT literal 0 HcmV?d00001 diff --git a/elpa/helm-aws-20141206.1208/helm-aws-autoloads.el b/elpa/helm-aws-20141206.1208/helm-aws-autoloads.el new file mode 100644 index 00000000..75891bc7 --- /dev/null +++ b/elpa/helm-aws-20141206.1208/helm-aws-autoloads.el @@ -0,0 +1,29 @@ +;;; helm-aws-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (helm-aws) "helm-aws" "helm-aws.el" (21889 46341 +;;;;;; 0 0)) +;;; Generated autoloads from helm-aws.el + +(autoload 'helm-aws "helm-aws" "\ + + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("helm-aws-pkg.el") (21889 46341 288795 +;;;;;; 0)) + +;;;*** + +(provide 'helm-aws-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; helm-aws-autoloads.el ends here diff --git a/elpa/helm-aws-20141206.1208/helm-aws-pkg.el b/elpa/helm-aws-20141206.1208/helm-aws-pkg.el new file mode 100644 index 00000000..aca696ba --- /dev/null +++ b/elpa/helm-aws-20141206.1208/helm-aws-pkg.el @@ -0,0 +1 @@ +(define-package "helm-aws" "20141206.1208" "Manage AWS EC2 server instances directly from Emacs" (quote ((helm "1.5.3")))) diff --git a/elpa/helm-aws-20141206.1208/helm-aws.el b/elpa/helm-aws-20141206.1208/helm-aws.el new file mode 100644 index 00000000..7312499c --- /dev/null +++ b/elpa/helm-aws-20141206.1208/helm-aws.el @@ -0,0 +1,125 @@ +;;; helm-aws.el --- Manage AWS EC2 server instances directly from Emacs + +;; Copyright (C) 2014 istib + +;; Author: istib +;; URL: https://github.com/istib/helm-aws +;; Package-Version: 20141206.1208 +;; Version: 20141205.1 +;; X-Original-Version: 0.2 +;; Package-Requires: ((helm "1.5.3")) +;; Keywords: + +;; This file is not part of GNU Emacs + +;; This file 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. + +;; For a full copy of the GNU General Public License +;; see . + +;;; Commentary: + +;; Manage AWS EC2 server instances directly from Emacs + +;; A call to `helm-aws' will show a list of running instances on your configured +;; AWS account. Helm actions to launch a terminal, dired, or ping are accessible. +;; +;; Requires a configured installation of AWS command-line interface (http://aws.amazon.com/cli/) + + +;;; Code: +(require 'json) + +(defvar aws-user-account + "ubuntu" + "User account name for AWS servers. Assuming that your PEM keys are placed on each instance") + +(defvar aws-ec2-command + "aws ec2 describe-instances" + "Command to list instances. Run `aws configure` to set up AWS cli") + +(defun aws-run-ec2-command () + "returns json" + (let ((aws-result-buffer (generate-new-buffer-name "*aws-ec2*"))) + (with-temp-buffer + (shell-command aws-ec2-command (current-buffer) nil) + (buffer-substring-no-properties (point-min) (point-max))))) + +(defun aws-parse-server-list (input) + "" + (let* ((json-object-type 'plist) + (aws-json (json-read-from-string input)) + (reservations (plist-get aws-json :Reservations)) + (instances (mapcar (lambda (el) (plist-get el :Instances)) reservations)) + (instance-vector (cdr instances)) ;; drop first, as it's metadata + (instance-list (mapcar (lambda (x) (elt x 0)) instance-vector))) + instance-list)) + +(defun aws-is-instance-active-p (instance) + "predicate that determines whether the given instance is running" + (let* ((state (plist-get instance :State)) + (code (plist-get state :Code))) + (eq code 16))) + +(defun aws-format-instance-string (instance) + "Constructs a human-friendly string of a server instance - showing name, IP and launch date" + (let* ((ip (plist-get instance :PrivateIpAddress)) + (tags (elt (plist-get instance :Tags) 0)) + (name (plist-get tags :Value)) + (launch-time (plist-get instance :LaunchTime)) + (launch-date (car (split-string launch-time "T")))) + (concat name " - " ip " - " launch-date))) + +(defun aws-get-ip-from-instance-string (instance-str) + "extracts IP address back from constructed string" + (let* ((components (split-string instance-str " - "))) + (cadr components))) + +(defun aws-get-active-instances () + "used to populate list in helm-aws" + (let* ((aws-result (aws-run-ec2-command)) + (instance-list (aws-parse-server-list aws-result)) + (active-instances (-filter 'aws-is-instance-active-p instance-list))) + (mapcar 'aws-format-instance-string active-instances))) + +(defun aws-ssh-into-instance (ip-address) + "Use SSH to connect to remote instance" + (let ((switches (list ip-address "-l" aws-user-account))) + (set-buffer (apply 'make-term "ssh" "ssh" nil switches)) + (term-mode) + (term-char-mode) + (switch-to-buffer "*ssh*"))) + +(defun aws-find-file-on-instance (ip-address) + "Use dired to access directory structure of remote instance" + (let ((path (concat "/ssh:" aws-user-account "@" ip-address ":"))) + (find-file path))) + + +;;;###autoload +(defun helm-aws () + (interactive) + (let ((choices (aws-get-active-instances))) + (helm + :sources '((name . "EC2 Instances") + (candidates . choices) + (action . (("SSH" . (lambda (instance-str) + (aws-ssh-into-instance (aws-get-ip-from-instance-string instance-str)))) + ("Dired" . (lambda (instance-str) + (aws-find-file-on-instance (aws-get-ip-from-instance-string instance-str)))) + ("Ping" . (lambda (instance-str) + (ping (aws-get-ip-from-instance-string instance-str)))) + ("Insert IP into buffer" . (lambda (instance-str) + (insert (aws-get-ip-from-instance-string instance-str)))))))))) + +(provide 'helm-aws) + +;;; helm-aws.el ends here diff --git a/elpa/helm-aws-readme.txt b/elpa/helm-aws-readme.txt new file mode 100644 index 00000000..42d8664b --- /dev/null +++ b/elpa/helm-aws-readme.txt @@ -0,0 +1,6 @@ +Manage AWS EC2 server instances directly from Emacs + +A call to `helm-aws' will show a list of running instances on your configured +AWS account. Helm actions to launch a terminal, dired, or ping are accessible. + +Requires a configured installation of AWS command-line interface (http://aws.amazon.com/cli/) diff --git a/elpa/helm-git-20120630.1403/helm-git-autoloads.el b/elpa/helm-git-20120630.1403/helm-git-autoloads.el new file mode 100644 index 00000000..a5dd6de9 --- /dev/null +++ b/elpa/helm-git-20120630.1403/helm-git-autoloads.el @@ -0,0 +1,18 @@ +;;; helm-git-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil nil ("helm-git-pkg.el" "helm-git.el") (21792 +;;;;;; 6079 675972 0)) + +;;;*** + +(provide 'helm-git-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; helm-git-autoloads.el ends here diff --git a/elpa/helm-git-20120630.1403/helm-git-pkg.el b/elpa/helm-git-20120630.1403/helm-git-pkg.el new file mode 100644 index 00000000..cbbddda0 --- /dev/null +++ b/elpa/helm-git-20120630.1403/helm-git-pkg.el @@ -0,0 +1 @@ +(define-package "helm-git" "20120630.1403" "Helm extension for Git." (quote nil)) diff --git a/elpa/helm-git-20120630.1403/helm-git.el b/elpa/helm-git-20120630.1403/helm-git.el new file mode 100644 index 00000000..d2a23960 --- /dev/null +++ b/elpa/helm-git-20120630.1403/helm-git.el @@ -0,0 +1,127 @@ +;;; helm-git.el --- Helm extension for Git. + +;; Copyright (C) 2012 Marian Schubert + +;; Author : Marian Schubert +;; URL : https://github.com/maio/helm-git +;; Package-Version: 20120630.1403 +;; Version : 1.1 +;; Keywords : helm, git + +;; This file is NOT part of GNU 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, 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. + +;;; Commentary: +;; +;; Helm Git extension makes opening files from current Git repository +;; fast and easy. It uses Git binary (using magit) to get list of +;; project files so it's prety fast even for large projects with +;; thousands of files. It also takes into account .gitignore file so +;; that you only get real project files. Magit should also make it +;; usable on wide variety of OS. +;; +;;; Code: + +(require 'helm-locate) +(require 'magit) + +(defun helm-git-file-name-localname (path) + (if (file-remote-p path) + (tramp-file-name-localname (tramp-dissect-file-name path)) + path)) + +(defun helm-git-git-dir () + "This function is required because magit-git-dir doesn't always return tramp path." + (if (file-remote-p default-directory) + (let ((path (tramp-dissect-file-name default-directory))) + (tramp-make-tramp-file-name + (tramp-file-name-method path) + (tramp-file-name-user path) + (tramp-file-name-host path) + (helm-git-file-name-localname (magit-git-dir)))) + (magit-git-dir))) + +(defun helm-git-root-dir () + (expand-file-name ".." (helm-git-git-dir))) + +(defun helm-git-root-p (candidate) + (setq candidate (expand-file-name candidate)) + (let ((default-directory (if (file-directory-p candidate) + (file-name-as-directory candidate) + (file-name-as-directory + helm-ff-default-directory)))) + (stringp (condition-case nil + (helm-git-root-dir) + (error nil))))) + +(defun helm-git-file-full-path (name) + (expand-file-name name (helm-git-root-dir))) + +(defun helm-git-find-file (name) + (find-file (helm-git-file-full-path name))) + +(defun helm-c-git-files () + (magit-git-lines "ls-files" "--full-name" + "--" (helm-git-file-name-localname (helm-git-root-dir)))) + +;; [NOTE] When value is changed need to restart emacs. +(defvar helm-git-ff-action-index 4 + "Add list git files action in `helm-c-source-find-files' at this index.") + +(defun helm-ff-git-find-files (candidate) + (let ((default-directory (file-name-as-directory + (if (file-directory-p candidate) + (expand-file-name candidate) + (file-name-directory candidate))))) + (helm-run-after-quit + #'(lambda (d) + (let ((default-directory d)) + (helm-git-find-files))) + default-directory))) + +(when (require 'helm-files) + (helm-add-action-to-source-if + "List git files" + 'helm-ff-git-find-files + helm-c-source-find-files + 'helm-git-root-p + helm-git-ff-action-index)) + +(defvar helm-c-source-git-files + `((name . "Git files list") + (init . (lambda () + (helm-init-candidates-in-buffer + "*helm git*" (helm-c-git-files)))) + (candidates-in-buffer) + (keymap . ,helm-generic-files-map) + (help-message . helm-generic-file-help-message) + (mode-line . helm-generic-file-mode-line-string) + (match helm-c-match-on-basename) + (type . file) + (action . (lambda (candidate) + (helm-git-find-file candidate)))) + "Helm Git files source definition") + +(defun helm-git-find-files () + (interactive) + (helm :sources '(helm-c-source-git-files))) + +(provide 'helm-git) + +;;; helm-git.el ends here diff --git a/elpa/helm-git-readme.txt b/elpa/helm-git-readme.txt new file mode 100644 index 00000000..fd9c7077 --- /dev/null +++ b/elpa/helm-git-readme.txt @@ -0,0 +1,6 @@ +Helm Git extension makes opening files from current Git repository +fast and easy. It uses Git binary (using magit) to get list of +project files so it's prety fast even for large projects with +thousands of files. It also takes into account .gitignore file so +that you only get real project files. Magit should also make it +usable on wide variety of OS. diff --git a/elpa/helm-gitlab-readme.txt b/elpa/helm-gitlab-readme.txt new file mode 100644 index 00000000..682ac22b --- /dev/null +++ b/elpa/helm-gitlab-readme.txt @@ -0,0 +1 @@ +Provides a Helm interface to Gitlab diff --git a/elpa/helm-gtags-readme.txt b/elpa/helm-gtags-readme.txt new file mode 100644 index 00000000..26aa68eb --- /dev/null +++ b/elpa/helm-gtags-readme.txt @@ -0,0 +1,22 @@ +`helm-gtags.el' is a `helm' interface of GNU Global. +`helm-gtags.el' is not compatible `anything-gtags.el', but `helm-gtags.el' +is designed for fast search. + + +To use this package, add these lines to your init.el or .emacs file: + + ;; Enable helm-gtags-mode + (add-hook 'c-mode-hook 'helm-gtags-mode) + (add-hook 'c++-mode-hook 'helm-gtags-mode) + (add-hook 'asm-mode-hook 'helm-gtags-mode) + + ;; Set key bindings + (eval-after-load "helm-gtags" + '(progn + (define-key helm-gtags-mode-map (kbd "M-t") 'helm-gtags-find-tag) + (define-key helm-gtags-mode-map (kbd "M-r") 'helm-gtags-find-rtag) + (define-key helm-gtags-mode-map (kbd "M-s") 'helm-gtags-find-symbol) + (define-key helm-gtags-mode-map (kbd "M-g M-p") 'helm-gtags-parse-file) + (define-key helm-gtags-mode-map (kbd "C-c <") 'helm-gtags-previous-history) + (define-key helm-gtags-mode-map (kbd "C-c >") 'helm-gtags-next-history) + (define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack))) diff --git a/elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el b/elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el new file mode 100644 index 00000000..2b2d9fec --- /dev/null +++ b/elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el @@ -0,0 +1,80 @@ +;;; helm-projectile-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (helm-projectile helm-projectile-ag helm-projectile-ack +;;;;;; helm-projectile-grep helm-projectile-off helm-projectile-on +;;;;;; helm-projectile-find-other-file helm-projectile-find-file-dwim +;;;;;; helm-projectile-fuzzy-match) "helm-projectile" "helm-projectile.el" +;;;;;; (21906 14465 0 0)) +;;; Generated autoloads from helm-projectile.el + +(defvar helm-projectile-fuzzy-match t "\ +Enable fuzzy matching for Helm Projectile commands. +This needs to be set before loading helm-projectile.") + +(custom-autoload 'helm-projectile-fuzzy-match "helm-projectile" t) + +(autoload 'helm-projectile-find-file-dwim "helm-projectile" "\ +Find file at point based on context. + +\(fn)" t nil) + +(autoload 'helm-projectile-find-other-file "helm-projectile" "\ +Switch between files with the same name but different extensions using Helm. +With FLEX-MATCHING, match any file that contains the base name of current file. +Other file extensions can be customized with the variable `projectile-other-file-alist'. + +\(fn &optional FLEX-MATCHING)" t nil) + +(autoload 'helm-projectile-on "helm-projectile" "\ +Turn on helm-projectile key bindings. + +\(fn)" t nil) + +(autoload 'helm-projectile-off "helm-projectile" "\ +Turn off helm-projectile key bindings. + +\(fn)" t nil) + +(autoload 'helm-projectile-grep "helm-projectile" "\ +Helm version of projectile-grep. + +\(fn)" t nil) + +(autoload 'helm-projectile-ack "helm-projectile" "\ +Helm version of projectile-ack. + +\(fn)" t nil) + +(autoload 'helm-projectile-ag "helm-projectile" "\ +Helm version of projectile-ag. + +\(fn &optional OPTIONS)" t nil) + +(autoload 'helm-projectile "helm-projectile" "\ +Use projectile with Helm instead of ido. + +With a prefix ARG invalidates the cache first. +If invoked outside of a project, displays a list of known projects to jump. + +\(fn &optional ARG)" t nil) + +(eval-after-load 'projectile '(progn (define-key projectile-command-map (kbd "h") 'helm-projectile))) + +;;;*** + +;;;### (autoloads nil nil ("helm-projectile-pkg.el") (21906 14465 +;;;;;; 971196 0)) + +;;;*** + +(provide 'helm-projectile-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; helm-projectile-autoloads.el ends here diff --git a/elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el b/elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el new file mode 100644 index 00000000..70b771da --- /dev/null +++ b/elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el @@ -0,0 +1 @@ +(define-package "helm-projectile" "20150621.1322" "Helm integration for Projectile" (quote ((helm "1.4.0") (projectile "0.12.0") (dash "1.5.0") (cl-lib "0.3")))) diff --git a/elpa/helm-projectile-20150621.1322/helm-projectile.el b/elpa/helm-projectile-20150621.1322/helm-projectile.el new file mode 100644 index 00000000..fb51fce9 --- /dev/null +++ b/elpa/helm-projectile-20150621.1322/helm-projectile.el @@ -0,0 +1,841 @@ +;;; helm-projectile.el --- Helm integration for Projectile + +;; Copyright (C) 2011-2015 Bozhidar Batsov + +;; Author: Bozhidar Batsov +;; URL: https://github.com/bbatsov/projectile +;; Package-Version: 20150621.1322 +;; Created: 2011-31-07 +;; Keywords: project, convenience +;; Version: 0.12.0 +;; Package-Requires: ((helm "1.4.0") (projectile "0.12.0") (dash "1.5.0") (cl-lib "0.3")) + +;; This file is NOT part of GNU 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, 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. + +;;; Commentary: +;; +;; This library provides easy project management and navigation. The +;; concept of a project is pretty basic - just a folder containing +;; special file. Currently git, mercurial and bazaar repos are +;; considered projects by default. If you want to mark a folder +;; manually as a project just create an empty .projectile file in +;; it. See the README for more details. +;; +;;; Code: + +(require 'projectile) +(require 'helm-locate) +(require 'helm-buffers) +(require 'helm-files) +(require 'cl-lib) + +(declare-function eshell "eshell") +(declare-function helm-do-ag "helm-ag") +(defvar helm-ag-base-command) + +(defgroup helm-projectile nil + "Helm support for projectile." + :prefix "helm-projectile-" + :group 'projectile + :link `(url-link :tag "helm-projectile homepage" "https://github.com/bbatsov/projectile")) + +(defvar helm-projectile-current-project-root) + +;;;###autoload +(defcustom helm-projectile-fuzzy-match t + "Enable fuzzy matching for Helm Projectile commands. +This needs to be set before loading helm-projectile." + :group 'helm-projectile + :type 'boolean) + +(defun helm-projectile-coerce-file (candidate) + (with-current-buffer (helm-candidate-buffer) + (expand-file-name candidate (projectile-project-root)))) + +(defmacro helm-projectile-define-key (keymap key def &rest bindings) + "In KEYMAP, define key sequence KEY1 as DEF1, KEY2 as DEF2 ..." + (declare (indent defun)) + (let ((ret '(progn))) + (while key + (push + `(define-key ,keymap ,key + (lambda () + (interactive) + (helm-quit-and-execute-action ,def))) + ret) + (setq key (pop bindings) + def (pop bindings))) + (reverse ret))) + +(defun helm-projectile-hack-actions (actions &rest prescription) + "Given a Helm action list and a prescription, return a hacked +Helm action list, after applying the PRESCRIPTION. + +The Helm action list ACTIONS is of the form: + +\(\(DESCRIPTION1 . FUNCTION1\) + \(DESCRIPTION2 . FUNCTION2\) + ... + \(DESCRIPTIONn . FUNCTIONn\)\) + +PRESCRIPTION is in the form: + +\(INSTRUCTION1 INSTRUCTION2 ... INSTRUCTIONn\) + +If an INSTRUCTION is a symbol, the action with function name +INSTRUCTION is deleted. + +If an INSTRUCTION is of the form \(FUNCTION1 . FUNCTION2\), the +action with function name FUNCTION1 will change it's function to +FUNCTION2. + +If an INSTRUCTION is of the form \(FUNCTION . DESCRIPTION\), and +if an action with function name FUNCTION exists in the original +Helm action list, the action in the Helm action list, with +function name FUNCTION will change it's description to +DESCRIPTION. Otherwise, (FUNCTION . DESCRIPTION) will be added to +the action list. + +Please check out how `helm-projectile-file-actions' is defined +for an example of how this function is being used." + (let* ((to-delete (cl-remove-if (lambda (entry) (listp entry)) prescription)) + (actions (cl-delete-if (lambda (action) (memq (cdr action) to-delete)) + (copy-alist actions))) + new) + (cl-dolist (action actions) + (when (setq new (cdr (assq (cdr action) prescription))) + (if (stringp new) + (setcar action new) + (setcdr action new)))) + ;; Add new actions from PRESCRIPTION + (setq new nil) + (cl-dolist (instruction prescription) + (when (and (listp instruction) + (null (rassq (car instruction) actions)) + (symbolp (car instruction)) (stringp (cdr instruction))) + (push (cons (cdr instruction) (car instruction)) new))) + (append actions (nreverse new)))) + +(defun helm-projectile-vc (dir) + "A Helm action for jumping to project root using `vc-dir' or Magit. +DIR is a directory to be switched" + (let ((projectile-require-project-root nil)) + (projectile-vc dir))) + +(defun helm-projectile-compile-project (dir) + "A Helm action for compile a project. +DIR is the project root." + (let ((helm--reading-passwd-or-string t) + (default-directory dir)) + (projectile-compile-project helm-current-prefix-arg dir))) + +(defun helm-projectile-remove-known-project (_ignore) + "Delete selected projects. +_IGNORE means the argument does not matter. +It is there because Helm requires it." + (let* ((projects (helm-marked-candidates :with-wildcard t)) + (len (length projects))) + (with-helm-display-marked-candidates + helm-marked-buffer-name + projects + (if (not (y-or-n-p (format "Delete *%s projects(s)" len))) + (message "(No deletion performed)") + (progn + (mapc (lambda (p) + (delete p projectile-known-projects)) + projects) + (projectile-save-known-projects)) + (message "%s projects(s) deleted" len))))) + +(defvar helm-source-projectile-projects + (helm-build-in-buffer-source "Projectile projects" + :data (lambda () + (if (projectile-project-p) + (cons (abbreviate-file-name (projectile-project-root)) + (projectile-relevant-known-projects)) + projectile-known-projects)) + :fuzzy-match helm-projectile-fuzzy-match + :keymap (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (helm-projectile-define-key map + (kbd "C-d") 'dired + (kbd "M-g") 'helm-projectile-vc + (kbd "M-e") 'helm-projectile-switch-to-eshell + (kbd "C-s") 'helm-find-files-grep + (kbd "M-c") 'helm-projectile-compile-project + (kbd "M-D") 'helm-projectile-remove-known-project) + map) + :mode-line helm-ff-mode-line-string + :action '(("Switch to project" . + (lambda (project) + (let ((projectile-completion-system 'helm)) + (projectile-switch-project-by-name project)))) + ("Open Dired in project's directory `C-d'" . dired) + ("Open project root in vc-dir or magit `M-g'" . helm-projectile-vc) + ("Switch to Eshell `M-e'" . helm-projectile-switch-to-eshell) + ("Grep in projects `C-s'. With C-u, recurse" . helm-find-files-grep) + ("Compile project `M-c'. With C-u, new compile command" + . helm-projectile-compile-project) + ("Remove project(s) `M-D'" . helm-projectile-remove-known-project))) + "Helm source for known projectile projects.") + +(define-key helm-etags-map (kbd "C-c p f") (lambda () + (interactive) + (helm-run-after-quit 'helm-projectile-find-file nil))) + +(defun helm-projectile-find-files-eshell-command-on-file-action (_candidate) + (interactive) + (let* ((helm-ff-default-directory (file-name-directory _candidate))) + (helm-find-files-eshell-command-on-file _candidate))) + +(defun helm-projectile-ff-etags-select-action (_candidate) + (interactive) + (let* ((helm-ff-default-directory (file-name-directory _candidate))) + (helm-ff-etags-select _candidate))) + +(defun helm-projectile-switch-to-eshell (dir) + (interactive) + (let* ((projectile-require-project-root nil) + (helm-ff-default-directory (file-name-directory (projectile-expand-root dir)))) + (helm-ff-switch-to-eshell dir))) + +(defun helm-projectile-files-in-current-dired-buffer () + "Return a list of files (only) in the current dired buffer." + (let (flist) + (cl-flet ((fpush (fname) (push fname flist))) + (save-excursion + (let (file buffer-read-only) + (goto-char (point-min)) + (while (not (eobp)) + (save-excursion + (and (not (eolp)) + (setq file (dired-get-filename t t)) ; nil on non-file + (progn (end-of-line) + (funcall #'fpush file)))) + (forward-line 1))))) + (mapcar 'file-truename (nreverse flist)))) + +(defun helm-projectile-all-dired-buffers () + "Get all current Dired buffers." + (mapcar (lambda (b) + (with-current-buffer b (buffer-name))) + (-filter (lambda (b) + (with-current-buffer b + (and (eq major-mode 'dired-mode) + (buffer-name)))) + (buffer-list)))) + +(defvar helm-projectile-virtual-dired-remote-enable nil + "Enable virtual Dired manager in remote host. Disabled by default.") + +(defun helm-projectile-dired-files-new-action (candidate) + "Create a Dired buffer from chosen files. +CANDIDATE is the selected file, but choose the marked files if available." + (if (and (file-remote-p (projectile-project-root)) + (not helm-projectile-virtual-dired-remote-enable)) + (message "Virtual Dired manager is disabled in remote host. Enable with %s." + (propertize "helm-projectile-virtual-dired-remote-enable" 'face 'font-lock-keyword-face)) + (let ((new-name (completing-read "Select or enter a new buffer name: " + (helm-projectile-all-dired-buffers))) + (helm--reading-passwd-or-string t) + (files (-filter (lambda (f) + (not (string= f ""))) + (mapcar (lambda (file) + (replace-regexp-in-string (projectile-project-root) "" file)) + (helm-marked-candidates :with-wildcard t)))) + (default-directory (projectile-project-root))) + ;; create a unique buffer that is unique to any directory in default-directory + ;; or opened buffer; when Dired is passed with a non-existence directory name, + ;; it only creates a buffer and insert everything. If a new name user supplied + ;; exists as default-directory, Dired throws error when insert anything that + ;; does not exist in current directory. + (with-current-buffer (dired (cons (make-temp-name new-name) + (if files + files + (list candidate)))) + (when (get-buffer new-name) + (kill-buffer new-name)) + (rename-buffer new-name))))) + +(defun helm-projectile-dired-files-add-action (candidate) + "Add files to a Dired buffer. +CANDIDATE is the selected file. Used when no file is explicitly marked." + (if (and (file-remote-p (projectile-project-root)) + (not helm-projectile-virtual-dired-remote-enable)) + (message "Virtual Dired manager is disabled in remote host. Enable with %s." + (propertize "helm-projectile-virtual-dired-remote-enable" 'face 'font-lock-keyword-face)) + (if (eq (with-helm-current-buffer major-mode) 'dired-mode) + (let* ((helm--reading-passwd-or-string t) + (root (projectile-project-root)) ; store root for later use + (dired-buffer-name (or (and (eq major-mode 'dired-mode) (buffer-name)) + (completing-read "Select a Dired buffer:" + (helm-projectile-all-dired-buffers)))) + (dired-files (with-current-buffer dired-buffer-name + (helm-projectile-files-in-current-dired-buffer))) + (marked-files (helm-marked-candidates :with-wildcard t)) + (files (sort (mapcar (lambda (file) + (replace-regexp-in-string (projectile-project-root) "" file)) + (cl-nunion (if marked-files + marked-files + (list candidate)) + dired-files + :test #'string-equal)) + 'string-lessp))) + (kill-buffer dired-buffer-name) + ;; Rebind default-directory because after killing a buffer, we + ;; could be in any buffer and default-directory is set to that + ;; random buffer + ;; + ;; Also use saved root directory, because after killing a buffer, + ;; we could be outside of current project + (let ((default-directory root)) + (with-current-buffer (dired (cons (make-temp-name dired-buffer-name) + (if files + (mapcar (lambda (file) + (replace-regexp-in-string root "" file)) + files) + (list candidate)))) + (rename-buffer dired-buffer-name)))) + (error "You're not in a Dired buffer to add.")))) + +(defun helm-projectile-dired-files-delete-action (candidate) + "Delete selected entries from a Dired buffer. +CANDIDATE is the selected file. Used when no file is explicitly marked." + (if (and (file-remote-p (projectile-project-root)) + (not helm-projectile-virtual-dired-remote-enable)) + (message "Virtual Dired manager is disabled in remote host. Enable with %s." + (propertize "helm-projectile-virtual-dired-remote-enable" 'face 'font-lock-keyword-face)) + (let* ((helm--reading-passwd-or-string t) + (root (projectile-project-root)) + (dired-buffer-name (with-helm-current-buffer (buffer-name))) + (dired-files (with-current-buffer dired-buffer-name + (helm-projectile-files-in-current-dired-buffer))) + (files (sort (cl-set-exclusive-or (helm-marked-candidates :with-wildcard t) + dired-files + :test #'string-equal) #'string-lessp))) + (kill-buffer dired-buffer-name) + ;; similar reason to `helm-projectile-dired-files-add-action' + (let ((default-directory root)) + (with-current-buffer (dired (cons (make-temp-name dired-buffer-name) + (if files + (mapcar (lambda (file) + (replace-regexp-in-string root "" file)) + files) + (list candidate)))) + (rename-buffer dired-buffer-name)))))) + +(defvar helm-projectile-find-file-map + (let ((map (copy-keymap helm-find-files-map))) + (helm-projectile-define-key map + (kbd "C-c f") 'helm-projectile-dired-files-new-action + (kbd "C-c a") 'helm-projectile-dired-files-add-action + (kbd "M-e") 'helm-projectile-switch-to-eshell + (kbd "M-.") 'helm-projectile-ff-etags-select-action + (kbd "M-!") 'helm-projectile-find-files-eshell-command-on-file-action) + (define-key map (kbd "") 'helm-previous-source) + (define-key map (kbd "") 'helm-next-source) + map) + "Mapping for file commands in Helm Projectile.") + +(defvar helm-projectile-file-actions + (helm-projectile-hack-actions + (cdr (assq 'action (or helm-source-find-files + (helm-make-source "Find files" 'helm-source-ffiles)))) + ;; Delete these actions + 'helm-ff-browse-project + 'helm-insert-file-name-completion-at-point + 'helm-ff-find-sh-command + 'helm-ff-cache-add-file + ;; Substitute these actions + '(helm-ff-switch-to-eshell . helm-projectile-switch-to-eshell) + '(helm-ff-etags-select . helm-projectile-ff-etags-select-action) + '(helm-find-files-eshell-command-on-file + . helm-projectile-find-files-eshell-command-on-file-action) + ;; Change action descriptions + '(helm-find-file-as-root . "Find file as root `C-c r'") + ;; New actions + '(helm-projectile-dired-files-new-action + . "Create Dired buffer from files `C-c f'") + '(helm-projectile-dired-files-add-action + . "Add files to Dired buffer `C-c a'")) + "Action for files.") + +(defun helm-projectile-build-dwim-source (candidates) + "Dynamically build a Helm source definition for Projectile files based on context with CANDIDATES." + "" + (helm-build-in-buffer-source "Projectile files" + :data candidates + :fuzzy-match helm-projectile-fuzzy-match + :coerce 'helm-projectile-coerce-file + :action-transformer 'helm-find-files-action-transformer + :keymap helm-projectile-find-file-map + :help-message helm-ff-help-message + :mode-line helm-ff-mode-line-string + :action helm-projectile-file-actions)) + +(defvar helm-source-projectile-files-list + (helm-build-in-buffer-source "Projectile files" + :data (lambda () + (condition-case nil + (projectile-current-project-files) + (error nil))) + :fuzzy-match helm-projectile-fuzzy-match + :coerce 'helm-projectile-coerce-file + :keymap helm-projectile-find-file-map + :help-message 'helm-ff-help-message + :mode-line helm-ff-mode-line-string + :action helm-projectile-file-actions + ) + "Helm source definition for Projectile files.") + +(defvar helm-source-projectile-files-in-all-projects-list + (helm-build-in-buffer-source "Projectile files in all Projects" + :data (lambda () + (condition-case nil + (let ((projectile-require-project-root nil)) + (projectile-all-project-files)) + (error nil))) + :coerce 'helm-projectile-coerce-file + :keymap helm-find-files-map + :help-message 'helm-ff-help-message + :mode-line helm-ff-mode-line-string + :action helm-projectile-file-actions + ) + "Helm source definition for all Projectile files in all projects.") + +(defvar helm-projectile-dired-file-actions + (helm-projectile-hack-actions + helm-projectile-file-actions + ;; New actions + '(helm-projectile-dired-files-delete-action . "Remove entry(s) from Dired buffer `C-c d'"))) + +(defvar helm-source-projectile-dired-files-list + (helm-build-in-buffer-source "Projectile files in current Dired buffer" + :data (lambda () + (condition-case nil + (if (and (file-remote-p (projectile-project-root)) + (not helm-projectile-virtual-dired-remote-enable)) + nil + (let ((default-directory (projectile-project-root))) + (when (eq major-mode 'dired-mode) + (mapcar (lambda (file) + (replace-regexp-in-string default-directory "" file)) + (helm-projectile-files-in-current-dired-buffer))))) + (error nil))) + :coerce 'helm-projectile-coerce-file + :filter-one-by-one (lambda (file) + (let ((default-directory (projectile-project-root))) + (helm-ff-filter-candidate-one-by-one file))) + :action-transformer 'helm-find-files-action-transformer + :keymap (let ((map (copy-keymap helm-projectile-find-file-map))) + (helm-projectile-define-key map + (kbd "C-c d") 'helm-projectile-dired-files-delete-action) + map) + :help-message 'helm-ff-help-message + :mode-line helm-ff-mode-line-string + :action helm-projectile-dired-file-actions) + "Helm source definition for Projectile delete files.") + +(defun helm-projectile-dired-find-dir (dir) + "Jump to a selected directory DIR from helm-projectile." + (dired (expand-file-name dir (projectile-project-root))) + (run-hooks 'projectile-find-dir-hook)) + +(defun helm-projectile-dired-find-dir-other-window (dir) + "Jump to a selected directory DIR from helm-projectile." + (dired-other-window (expand-file-name dir (projectile-project-root))) + (run-hooks 'projectile-find-dir-hook)) + +(defvar helm-source-projectile-directories-list + (helm-build-in-buffer-source "Projectile directories" + :data (lambda () + (condition-case nil + (if projectile-find-dir-includes-top-level + (append '("./") (projectile-current-project-dirs)) + (projectile-current-project-dirs)) + (error nil))) + :fuzzy-match helm-projectile-fuzzy-match + :coerce 'helm-projectile-coerce-file + :action-transformer 'helm-find-files-action-transformer + :keymap (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (helm-projectile-define-key map + (kbd "") 'helm-previous-source + (kbd "") 'helm-next-source + (kbd "C-c o") 'helm-projectile-dired-find-dir-other-window + (kbd "M-e") 'helm-projectile-switch-to-eshell + (kbd "C-c f") 'helm-projectile-dired-files-new-action + (kbd "C-c a") 'helm-projectile-dired-files-add-action + (kbd "C-s") 'helm-find-files-grep) + map) + :help-message 'helm-ff-help-message + :mode-line helm-ff-mode-line-string + :action '(("Open Dired" . helm-projectile-dired-find-dir) + ("Open Dired in other window `C-c o'" . helm-projectile-dired-find-dir) + ("Switch to Eshell `M-e'" . helm-projectile-switch-to-eshell) + ("Grep in projects `C-s C-u Recurse'" . helm-find-files-grep) + ("Create Dired buffer from files `C-c f'" . helm-projectile-dired-files-new-action) + ("Add files to Dired buffer `C-c a'" . helm-projectile-dired-files-add-action))) + "Helm source for listing project directories.") + +(defvar helm-projectile-buffers-list-cache nil) + +(defclass helm-source-projectile-buffer (helm-source-sync helm-type-buffer) + ((init :initform (lambda () + ;; Issue #51 Create the list before `helm-buffer' creation. + (setq helm-projectile-buffers-list-cache (condition-case nil + (cdr (projectile-project-buffer-names)) + (error nil))) + (let ((result (cl-loop for b in helm-projectile-buffers-list-cache + maximize (length b) into len-buf + maximize (length (with-current-buffer b + (symbol-name major-mode))) + into len-mode + finally return (cons len-buf len-mode)))) + (unless helm-buffer-max-length + (setq helm-buffer-max-length (car result))) + (unless helm-buffer-max-len-mode + ;; If a new buffer is longer that this value + ;; this value will be updated + (setq helm-buffer-max-len-mode (cdr result)))))) + (candidates :initform helm-projectile-buffers-list-cache) + (matchplugin :initform nil) + (match :initform 'helm-buffers-match-function) + (persistent-action :initform 'helm-buffers-list-persistent-action) + (keymap :initform helm-buffer-map) + (volatile :initform t) + (mode-line :initform helm-buffer-mode-line-string) + (persistent-help + :initform + "Show this buffer / C-u \\[helm-execute-persistent-action]: Kill this buffer"))) + +(defvar helm-source-projectile-buffers-list (helm-make-source "Project buffers" 'helm-source-projectile-buffer)) + +(defvar helm-source-projectile-recentf-list + (helm-build-in-buffer-source "Projectile recent files" + :data (lambda () + (condition-case nil + (projectile-recentf-files) + (error nil))) + :fuzzy-match helm-projectile-fuzzy-match + :coerce 'helm-projectile-coerce-file + :keymap helm-projectile-find-file-map + :help-message 'helm-ff-help-message + :mode-line helm-ff-mode-line-string + :action helm-projectile-file-actions + ) + "Helm source definition for recent files in current project.") + +(defvar helm-source-projectile-files-and-dired-list + '(helm-source-projectile-dired-files-list + helm-source-projectile-files-list)) + +(defvar helm-source-projectile-directories-and-dired-list + '(helm-source-projectile-dired-files-list + helm-source-projectile-directories-list)) + +(defcustom helm-projectile-sources-list + '(helm-source-projectile-buffers-list + helm-source-projectile-files-list + helm-source-projectile-projects + ) + "Default sources for `helm-projectile'." + :group 'helm-projectile) + +(defmacro helm-projectile-command (command source prompt &optional not-require-root) + "Template for generic helm-projectile commands. +COMMAND is a command name to be appended with \"helm-projectile\" prefix. +SOURCE is a Helm source that should be Projectile specific. +PROMPT is a string for displaying as a prompt. +NOT-REQUIRE-ROOT specifies the command doesn't need to be used in a +project root." + `(defun ,(intern (concat "helm-projectile-" command)) (&optional arg) + "Use projectile with Helm for finding files in project + +With a prefix ARG invalidates the cache first." + (interactive "P") + (if (projectile-project-p) + (projectile-maybe-invalidate-cache arg) + (unless ,not-require-root + (error "You're not in a project"))) + (let ((helm-ff-transformer-show-only-basename nil) + ;; for consistency, we should just let Projectile take care of ignored files + (helm-boring-file-regexp-list nil)) + (helm :sources ,source + :buffer "*helm projectile*" + :prompt (projectile-prepend-project-name ,prompt))))) + +(helm-projectile-command "switch-project" 'helm-source-projectile-projects "Switch to project: " t) +(helm-projectile-command "find-file" helm-source-projectile-files-and-dired-list "Find file: ") +(helm-projectile-command "find-file-in-known-projects" 'helm-source-projectile-files-in-all-projects-list "Find file in projects: ") +(helm-projectile-command "find-dir" helm-source-projectile-directories-and-dired-list "Find dir: ") +(helm-projectile-command "recentf" 'helm-source-projectile-recentf-list "Recently visited file: ") +(helm-projectile-command "switch-to-buffer" 'helm-source-projectile-buffers-list "Switch to buffer: ") + +;;;###autoload +(defun helm-projectile-find-file-dwim () + "Find file at point based on context." + (interactive) + (let* ((project-files (projectile-current-project-files)) + (files (projectile-select-files project-files))) + (if (= (length files) 1) + (find-file (expand-file-name (car files) (projectile-project-root))) + (helm :sources (helm-projectile-build-dwim-source (if (> (length files) 1) + files + project-files)) + :buffer "*helm projectile*" + :prompt (projectile-prepend-project-name "Find file: "))))) + +;;;###autoload +(defun helm-projectile-find-other-file (&optional flex-matching) + "Switch between files with the same name but different extensions using Helm. +With FLEX-MATCHING, match any file that contains the base name of current file. +Other file extensions can be customized with the variable `projectile-other-file-alist'." + (interactive "P") + (-if-let (other-files (projectile-get-other-files (buffer-file-name) + (projectile-current-project-files) + flex-matching)) + (if (= (length other-files) 1) + (find-file (expand-file-name (car other-files) (projectile-project-root))) + (progn + (let* ((helm-ff-transformer-show-only-basename nil)) + (helm :sources (helm-build-in-buffer-source "Projectile other files" + :data other-files + :coerce 'helm-projectile-coerce-file + :keymap (let ((map (copy-keymap helm-find-files-map))) + (define-key map (kbd "") 'helm-previous-source) + (define-key map (kbd "") 'helm-next-source) + map) + :help-message helm-ff-help-message + :mode-line helm-ff-mode-line-string + :action helm-projectile-file-actions) + :buffer "*helm projectile*" + :prompt (projectile-prepend-project-name "Find other file: "))))) + (error "No other file found"))) + +(defun helm-projectile-grep-or-ack (&optional use-ack-p ack-ignored-pattern ack-executable) + "Perform helm-grep at project root. +USE-ACK-P indicates whether to use ack or not. +ACK-IGNORED-PATTERN is a file regex to exclude from searching. +ACK-EXECUTABLE is the actual ack binary name. +It is usually \"ack\" or \"ack-grep\". +If it is nil, or ack/ack-grep not found then use default grep command." + (let* ((default-directory (projectile-project-root)) + (helm-ff-default-directory (projectile-project-root)) + (follow (and helm-follow-mode-persistent + (assoc-default 'follow helm-source-grep))) + (helm-grep-in-recurse t) + (grep-find-ignored-files (-union (projectile-ignored-files-rel) grep-find-ignored-files)) + (grep-find-ignored-directories (-union (projectile-ignored-directories-rel) grep-find-ignored-directories)) + (helm-grep-default-command (if use-ack-p + (concat ack-executable " -H --no-group --no-color " ack-ignored-pattern " %p %f") + "grep -a -r %e -n%cH -e %p %f .")) + (helm-grep-default-recurse-command helm-grep-default-command) + (helm-source-grep + (helm-build-async-source + (capitalize (helm-grep-command t)) + :header-name (lambda (name) + (let ((name (if use-ack-p + "Helm Projectile Ack" + "Helm Projectile Grep"))) + (concat name " " "(C-c ? Help)"))) + :candidates-process 'helm-grep-collect-candidates + :filter-one-by-one 'helm-grep-filter-one-by-one + :candidate-number-limit 9999 + :nohighlight t + :mode-line helm-grep-mode-line-string + ;; We need to specify keymap here and as :keymap arg [1] + ;; to make it available in further resuming. + :keymap helm-grep-map + :history 'helm-grep-history + :action (helm-make-actions + "Find file" 'helm-grep-action + "Find file other frame" 'helm-grep-other-frame + (lambda () (and (locate-library "elscreen") + "Find file in Elscreen")) + 'helm-grep-jump-elscreen + "Save results in grep buffer" 'helm-grep-save-results + "Find file other window" 'helm-grep-other-window) + :persistent-action 'helm-grep-persistent-action + :persistent-help "Jump to line (`C-u' Record in mark ring)" + :requires-pattern 2))) + (helm + :sources 'helm-source-grep + :input (if (region-active-p) + (buffer-substring-no-properties (region-beginning) (region-end)) + (thing-at-point 'symbol)) + :buffer (format "*helm %s*" (if use-ack-p + "ack" + "grep")) + :default-directory (projectile-project-root) + :keymap helm-grep-map + :history 'helm-grep-history + :truncate-lines t))) + +;;;###autoload +(defun helm-projectile-on () + "Turn on helm-projectile key bindings." + (interactive) + (message "Turn on helm-projectile key bindings") + (helm-projectile-toggle 1)) + +;;;###autoload +(defun helm-projectile-off () + "Turn off helm-projectile key bindings." + (interactive) + (message "Turn off helm-projectile key bindings") + (helm-projectile-toggle -1)) + +;;;###autoload +(defun helm-projectile-grep () + "Helm version of projectile-grep." + (interactive) + (if (projectile-project-p) + (funcall'run-with-timer 0.01 nil + #'helm-projectile-grep-or-ack nil) + (error "You're not in a project"))) + +;;;###autoload +(defun helm-projectile-ack () + "Helm version of projectile-ack." + (interactive) + (if (projectile-project-p) + (let ((ack-ignored (mapconcat + 'identity + (-union (-map (lambda (path) + (concat "--ignore-dir=" (file-name-nondirectory (directory-file-name path)))) + (projectile-ignored-directories)) + (-map (lambda (path) + (concat "--ignore-file=match:" (shell-quote-argument path))) + (projectile-ignored-files))) " ")) + (helm-ack-grep-executable (cond + ((executable-find "ack") "ack") + ((executable-find "ack-grep") "ack-grep") + (t (error "ack or ack-grep is not available."))))) + (funcall 'run-with-timer 0.01 nil + #'helm-projectile-grep-or-ack t ack-ignored helm-ack-grep-executable)) + (error "You're not in a project"))) + +;;;###autoload +(defun helm-projectile-ag (&optional options) + "Helm version of projectile-ag." + (interactive (if current-prefix-arg (list (read-string "option: " "" 'helm-ag-command-history)))) + (if (require 'helm-ag nil 'noerror) + (if (projectile-project-p) + (let* ((grep-find-ignored-files (-union (projectile-ignored-files-rel) grep-find-ignored-files)) + (grep-find-ignored-directories (-union (projectile-ignored-directories-rel) grep-find-ignored-directories)) + (ignored (mapconcat (lambda (i) + (concat "--ignore " i)) + (append grep-find-ignored-files grep-find-ignored-directories) + " ")) + (helm-ag-command-option options) + (helm-ag-base-command (concat helm-ag-base-command " " ignored))) + (helm-do-ag (projectile-project-root))) + (error "You're not in a project")) + (error "helm-ag not available"))) + +(defun helm-projectile-commander-bindings () + (def-projectile-commander-method ?a + "Run ack on project." + (call-interactively 'helm-projectile-ack)) + + (def-projectile-commander-method ?A + "Find ag on project." + (call-interactively 'helm-projectile-ag)) + + (def-projectile-commander-method ?f + "Find file in project." + (helm-projectile-find-file)) + + (def-projectile-commander-method ?b + "Switch to project buffer." + (helm-projectile-switch-to-buffer)) + + (def-projectile-commander-method ?d + "Find directory in project." + (helm-projectile-find-dir)) + + (def-projectile-commander-method ?g + "Run grep on project." + (helm-projectile-grep)) + + (def-projectile-commander-method ?s + "Switch project." + (helm-projectile-switch-project)) + + (def-projectile-commander-method ?e + "Find recently visited file in project." + (helm-projectile-recentf))) + +(defun helm-projectile-toggle (toggle) + "Toggle Helm version of Projectile commands." + (if (> toggle 0) + (progn + (setq projectile-switch-project-action 'helm-projectile-find-file) + (define-key projectile-command-map (kbd "a") 'helm-projectile-find-other-file) + (define-key projectile-command-map (kbd "f") 'helm-projectile-find-file) + (define-key projectile-command-map (kbd "F") 'helm-projectile-find-file-in-known-projects) + (define-key projectile-command-map (kbd "g") 'helm-projectile-find-file-dwim) + (define-key projectile-command-map (kbd "d") 'helm-projectile-find-dir) + (define-key projectile-command-map (kbd "p") 'helm-projectile-switch-project) + (define-key projectile-command-map (kbd "e") 'helm-projectile-recentf) + (define-key projectile-command-map (kbd "b") 'helm-projectile-switch-to-buffer) + (define-key projectile-command-map (kbd "s g") 'helm-projectile-grep) + (define-key projectile-command-map (kbd "s a") 'helm-projectile-ack) + (define-key projectile-command-map (kbd "s s") 'helm-projectile-ag) + (helm-projectile-commander-bindings)) + (progn + (setq projectile-switch-project-action 'projectile-find-file) + (define-key projectile-command-map (kbd "a") 'projectile-find-other-file) + (define-key projectile-command-map (kbd "f") 'projectile-find-file) + (define-key projectile-command-map (kbd "F") 'projectile-find-file-in-known-projects) + (define-key projectile-command-map (kbd "g") 'helm-projectile-find-file-dwim) + (define-key projectile-command-map (kbd "d") 'projectile-find-dir) + (define-key projectile-command-map (kbd "p") 'projectile-switch-project) + (define-key projectile-command-map (kbd "e") 'projectile-recentf) + (define-key projectile-command-map (kbd "b") 'projectile-switch-to-buffer) + (define-key projectile-command-map (kbd "s g") 'projectile-grep) + (define-key projectile-command-map (kbd "s s") 'projectile-ag) + (projectile-commander-bindings)))) + +;;;###autoload +(defun helm-projectile (&optional arg) + "Use projectile with Helm instead of ido. + +With a prefix ARG invalidates the cache first. +If invoked outside of a project, displays a list of known projects to jump." + (interactive "P") + (if (projectile-project-p) + (projectile-maybe-invalidate-cache arg)) + (let ((helm-ff-transformer-show-only-basename nil)) + (helm :sources helm-projectile-sources-list + :buffer "*helm projectile*" + :prompt (projectile-prepend-project-name (if (projectile-project-p) + "pattern: " + "Switch to project: "))))) + +;;;###autoload +(eval-after-load 'projectile + '(progn + (define-key projectile-command-map (kbd "h") 'helm-projectile))) + +(provide 'helm-projectile) + +;;; helm-projectile.el ends here diff --git a/elpa/helm-projectile-readme.txt b/elpa/helm-projectile-readme.txt new file mode 100644 index 00000000..f3969faf --- /dev/null +++ b/elpa/helm-projectile-readme.txt @@ -0,0 +1,6 @@ +This library provides easy project management and navigation. The +concept of a project is pretty basic - just a folder containing +special file. Currently git, mercurial and bazaar repos are +considered projects by default. If you want to mark a folder +manually as a project just create an empty .projectile file in +it. See the README for more details. diff --git a/elpa/ht-20140122.1555/ht-autoloads.el b/elpa/ht-20140122.1555/ht-autoloads.el new file mode 100644 index 00000000..0a7f388a --- /dev/null +++ b/elpa/ht-20140122.1555/ht-autoloads.el @@ -0,0 +1,18 @@ +;;; ht-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil nil ("ht-pkg.el" "ht.el") (21490 25514 19539 +;;;;;; 0)) + +;;;*** + +(provide 'ht-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; ht-autoloads.el ends here diff --git a/elpa/ht-20140122.1555/ht-pkg.el b/elpa/ht-20140122.1555/ht-pkg.el new file mode 100644 index 00000000..a83f4b92 --- /dev/null +++ b/elpa/ht-20140122.1555/ht-pkg.el @@ -0,0 +1 @@ +(define-package "ht" "20140122.1555" "The missing hash table library for Emacs" (quote nil)) diff --git a/elpa/ht-20140122.1555/ht.el b/elpa/ht-20140122.1555/ht.el new file mode 100644 index 00000000..d536a18d --- /dev/null +++ b/elpa/ht-20140122.1555/ht.el @@ -0,0 +1,281 @@ +;;; ht.el --- The missing hash table library for Emacs + +;; Copyright (C) 2013 Wilfred Hughes + +;; Author: Wilfred Hughes +;; Version: 20140122.1555 +;; X-Original-Version: 2.0 +;; Keywords: hash table, hash map, hash + +;; 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 . + +;;; Commentary: + +;; The missing hash table utility library for Emacs. +;; +;; See documentation on https://github.com/Wilfred/ht.el + +;;; Code: + +(eval-when-compile (require 'cl)) ;; dolist + +(defmacro ht (&rest pairs) + "Create a hash table with the key-value pairs given. +Keys are compared with `equal'. + +\(fn (KEY-1 VALUE-1) (KEY-2 VALUE-2) ...)" + (let* ((table-symbol (make-symbol "ht-temp")) + (assignments + (mapcar + (lambda (pair) `(ht-set! ,table-symbol ,@pair)) + pairs))) + `(let ((,table-symbol (ht-create))) + ,@assignments + ,table-symbol))) + +(defun ht-create (&optional test) + "Create an empty hash table. + +TEST indicates the function used to compare the hash +keys. Default is `equal'. It can be `eq', `eql', `equal' or a +user-supplied test created via `define-hash-table-test'." + (make-hash-table :test (or test 'equal))) + +(defun ht<-alist (alist) + "Create a hash table with initial values according to ALIST." + (let ((h (ht-create))) + ;; the first key-value pair in an alist gets precedence, so we + ;; start from the end of the list: + (dolist (pair (reverse alist) h) + (let ((key (car pair)) + (value (cdr pair))) + (ht-set! h key value))))) + +(defalias 'ht-from-alist 'ht<-alist) + +;; based on the excellent -partition from dash.el, but we aim to be self-contained +(defun ht/group-pairs (list) + "Return a new list with the items in LIST grouped into pairs. +Errors if LIST doesn't contain an even number of elements." + (let ((result) + (sublist) + (len 0)) + + (while list + ;; take the head of LIST and push onto SUBLIST + (setq sublist (cons (car list) sublist)) + (setq list (cdr list)) + + (setq len (1+ len)) + + (when (= len 2) + ;; push this two-item list onto RESULT + (setq result (cons (nreverse sublist) result)) + (setq sublist nil) + (setq len 0))) + + (when sublist (error "Expected an even number of elements")) + (nreverse result))) + +(defun ht<-plist (plist) + "Create a hash table with initial values according to PLIST." + (let ((h (ht-create))) + (dolist (pair (ht/group-pairs plist) h) + (let ((key (car pair)) + (value (cadr pair))) + (ht-set! h key value))))) + +(defalias 'ht-from-plist 'ht<-plist) + +(defun ht-get (table key &optional default) + "Look up KEY in TABLE, and return the matching value. +If KEY isn't present, return DEFAULT (nil if not specified)." + (gethash key table default)) + +(defun ht-set! (table key value) + "Associate KEY in TABLE with VALUE." + (puthash key value table) + nil) + +(defalias 'ht-set 'ht-set!) + +(defun ht-update! (table from-table) + "Update TABLE according to every key-value pair in FROM-TABLE." + (maphash + (lambda (key value) (puthash key value table)) + from-table) + nil) + +(defalias 'ht-update 'ht-update!) + +(defun ht-merge (&rest tables) + "Crete a new tables that includes all the key-value pairs from TABLES. +If multiple have tables have the same key, the value in the last +table is used." + (let ((merged (ht-create))) + (mapc (lambda (table) (ht-update! merged table)) tables) + merged)) + +(defun ht-remove! (table key) + "Remove KEY from TABLE." + (remhash key table)) + +(defalias 'ht-remove 'ht-remove!) + +(defun ht-clear! (table) + "Remove all keys from TABLE." + (clrhash table) + nil) + +(defalias 'ht-clear 'ht-clear!) + +(defun ht-map (function table) + "Apply FUNCTION to each key-value pair of TABLE, and make a list of the results. +FUNCTION is called with two arguments, KEY and VALUE." + (let (results) + (maphash + (lambda (key value) + (push (funcall function key value) results)) + table) + results)) + +(defmacro ht-amap (form table) + "Anaphoric version of `ht-map'. +For every key-value pair in TABLE, evaluate FORM with the +variables KEY and VALUE bound." + `(ht-map (lambda (key value) ,form) ,table)) + +(defun ht-keys (table) + "Return a list of all the keys in TABLE." + (ht-amap key table)) + +(defun ht-values (table) + "Return a list of all the values in TABLE." + (ht-amap value table)) + +(defun ht-items (table) + "Return a list of two-element lists '(key value) from TABLE." + (ht-amap (list key value) table)) + +(defalias 'ht-each 'maphash + "Apply FUNCTION to each key-value pair of TABLE. +Returns nil, used for side-effects only.") + +(defmacro ht-aeach (form table) + "Anaphoric version of `ht-each'. +For every key-value pair in TABLE, evaluate FORM with the +variables key and value bound." + `(ht-each (lambda (key value) ,form) ,table)) + +(defun ht->plist (table) + "Return a flat list '(key1 value1 key2 value2...) from TABLE. + +Note that hash tables are unordered, so this cannot be an exact +inverse of `ht<-plist'. The following is not guaranteed: + +\(let ((data '(a b c d))) + (equalp data + (ht->plist (ht<-plist data))))" + (apply 'append (ht-items table))) + +(defalias 'ht-to-plist 'ht->plist) + +(defun ht-copy (table) + "Return a shallow copy of TABLE (keys and values are shared)." + (copy-hash-table table)) + +(defun ht->alist (table) + "Return a list of two-element lists '(key . value) from TABLE. + +Note that hash tables are unordered, so this cannot be an exact +inverse of `ht<-alist'. The following is not guaranteed: + +\(let ((data '((a . b) (c . d)))) + (equalp data + (ht->alist (ht<-alist data))))" + (ht-amap (cons key value) table)) + +(defalias 'ht-to-alist 'ht->alist) + +(defalias 'ht? 'hash-table-p) + +(defalias 'ht-p 'hash-table-p) + +(defun ht-contains? (table key) + "Return 't if TABLE contains KEY." + (not (eq (ht-get table key 'ht--not-found) 'ht--not-found))) + +(defalias 'ht-contains-p 'ht-contains?) + +(defun ht-size (table) + "Return the actual number of entries in TABLE." + (hash-table-count table)) + +(defun ht-empty? (table) + "Return true if the actual number of entries in TABLE is zero." + (zerop (ht-size table))) + +(defun ht-select (function table) + "Return a hash table containing all entries in TABLE for which +FUNCTION returns a truthy value. + +FUNCTION is called with two arguments, KEY and VALUE." + (let ((results (ht-create))) + (ht-each + (lambda (key value) + (when (funcall function key value) + (ht-set! results key value))) + table) + results)) + +(defun ht-reject (function table) + "Return a hash table containing all entries in TABLE for which +FUNCTION returns a falsy value. + +FUNCTION is called with two arguments, KEY and VALUE." + (let ((results (ht-create))) + (ht-each + (lambda (key value) + (unless (funcall function key value) + (ht-set! results key value))) + table) + results)) + +(defun ht-reject! (function table) + "Delete entries from TABLE for which FUNCTION returns a falsy value. + +FUNCTION is called with two arguments, KEY and VALUE." + (ht-each + (lambda (key value) + (when (funcall function key value) + (remhash key table))) + table) + nil) + +(defalias 'ht-delete-if 'ht-reject!) + +(defun ht-find (function table) + "Return (key, value) from TABLE for which FUNCTION returns a truthy value. +Return nil otherwise. + +FUNCTION is called with two arguments, KEY and VALUE." + (catch 'break + (ht-each + (lambda (key value) + (when (funcall function key value) + (throw 'break (list key value)))) + table))) + +(provide 'ht) +;;; ht.el ends here diff --git a/elpa/impatient-mode-20140908.2000/impatient-mode-autoloads.el b/elpa/impatient-mode-20150501.247/impatient-mode-autoloads.el similarity index 62% rename from elpa/impatient-mode-20140908.2000/impatient-mode-autoloads.el rename to elpa/impatient-mode-20150501.247/impatient-mode-autoloads.el index 83dd25aa..20a7c9d9 100644 --- a/elpa/impatient-mode-20140908.2000/impatient-mode-autoloads.el +++ b/elpa/impatient-mode-20150501.247/impatient-mode-autoloads.el @@ -1,10 +1,10 @@ ;;; impatient-mode-autoloads.el --- automatically extracted autoloads ;; ;;; Code: - +(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads (impatient-mode) "impatient-mode" "impatient-mode.el" -;;;;;; (21595 16735 0 0)) +;;;### (autoloads nil "impatient-mode" "impatient-mode.el" (21908 +;;;;;; 14231 0 0)) ;;; Generated autoloads from impatient-mode.el (autoload 'impatient-mode "impatient-mode" "\ @@ -14,16 +14,14 @@ Serves the buffer live over HTTP. ;;;*** -;;;### (autoloads nil nil ("impatient-mode-pkg.el") (21595 16735 -;;;;;; 291260 0)) +;;;### (autoloads nil nil ("impatient-mode-pkg.el") (21908 14231 +;;;;;; 202947 0)) ;;;*** -(provide 'impatient-mode-autoloads) ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 ;; End: ;;; impatient-mode-autoloads.el ends here diff --git a/elpa/impatient-mode-20140908.2000/impatient-mode-pkg.el b/elpa/impatient-mode-20150501.247/impatient-mode-pkg.el similarity index 67% rename from elpa/impatient-mode-20140908.2000/impatient-mode-pkg.el rename to elpa/impatient-mode-20150501.247/impatient-mode-pkg.el index 56070dd0..094bc919 100644 --- a/elpa/impatient-mode-20140908.2000/impatient-mode-pkg.el +++ b/elpa/impatient-mode-20150501.247/impatient-mode-pkg.el @@ -1,4 +1,4 @@ -(define-package "impatient-mode" "20140908.2000" "Serve buffers live over HTTP" +(define-package "impatient-mode" "20150501.247" "Serve buffers live over HTTP" '((cl-lib "0.3") (simple-httpd "1.4.0") (htmlize "1.40")) diff --git a/elpa/impatient-mode-20140908.2000/impatient-mode.el b/elpa/impatient-mode-20150501.247/impatient-mode.el similarity index 96% rename from elpa/impatient-mode-20140908.2000/impatient-mode.el rename to elpa/impatient-mode-20150501.247/impatient-mode.el index 80210c0a..0e41363c 100644 --- a/elpa/impatient-mode-20140908.2000/impatient-mode.el +++ b/elpa/impatient-mode-20150501.247/impatient-mode.el @@ -119,8 +119,9 @@ buffer." "Visit the buffer in a browser." (interactive) (impatient-mode) - (browse-url (format "http://%s:%d/imp/live/%s" - system-name httpd-port (buffer-name)))) + (browse-url + (format "http://%s:%d/imp/live/%s/" + (system-name) httpd-port (url-hexify-string (buffer-name))))) (defun imp-buffer-enabled-p (buffer) "Return t if buffer has impatient-mode enabled." @@ -180,6 +181,7 @@ buffer." ((not (imp-buffer-enabled-p buffer)) (imp--private proc buffer-name)) ((and (not (string= file "./")) buffer-dir) (let* ((full-file-name (expand-file-name file buffer-dir)) + (mime-type (httpd-get-mime (file-name-extension full-file-name))) (live-buffer (cl-remove-if-not (lambda (buf) (equal full-file-name (buffer-file-name buf))) (imp--buffer-list)))) @@ -188,9 +190,9 @@ buffer." (with-temp-buffer (insert-buffer-substring (cl-first live-buffer)) (if (imp--should-not-cache-p path) - (httpd-send-header proc "text/plain" 200 + (httpd-send-header proc mime-type 200 :Cache-Control "no-cache") - (httpd-send-header proc "text/plain" 200 + (httpd-send-header proc mime-type 200 :Cache-Control "max-age=60, must-revalidate"))) (httpd-send-file proc full-file-name req)))) diff --git a/elpa/impatient-mode-20140908.2000/index.html b/elpa/impatient-mode-20150501.247/index.html similarity index 95% rename from elpa/impatient-mode-20140908.2000/index.html rename to elpa/impatient-mode-20150501.247/index.html index 3d2d831f..6d92b0b9 100644 --- a/elpa/impatient-mode-20140908.2000/index.html +++ b/elpa/impatient-mode-20150501.247/index.html @@ -96,8 +96,8 @@ // now we need to tweak the stylesheet links so that firefox will refresh them properly $('link', frameToDocument(iframeJQ[0])).each(function(index, el) { var href = $(el).attr('href'); - // don't refresh the random data:text stylesheets that chrome inserts - if(href && href.indexOf('data:text') != 0) { + // Only refresh impatient-mode hosted content + if(href && !/^[a-zA-z]+:\/\//.exec(href)) { $(el).attr('href', $(el).attr('href') + '?' + new Date().getTime()); } }); diff --git a/elpa/impatient-mode-20140908.2000/jquery.js b/elpa/impatient-mode-20150501.247/jquery.js similarity index 100% rename from elpa/impatient-mode-20140908.2000/jquery.js rename to elpa/impatient-mode-20150501.247/jquery.js diff --git a/elpa/impatient-mode-20140908.2000/loading.html b/elpa/impatient-mode-20150501.247/loading.html similarity index 100% rename from elpa/impatient-mode-20140908.2000/loading.html rename to elpa/impatient-mode-20150501.247/loading.html diff --git a/elpa/keyfreq-20141124.805/keyfreq-autoloads.el b/elpa/keyfreq-20141124.805/keyfreq-autoloads.el new file mode 100644 index 00000000..bbcc769b --- /dev/null +++ b/elpa/keyfreq-20141124.805/keyfreq-autoloads.el @@ -0,0 +1,48 @@ +;;; keyfreq-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) + +;;;### (autoloads nil "keyfreq" "keyfreq.el" (21908 14229 0 0)) +;;; Generated autoloads from keyfreq.el + +(defvar keyfreq-mode nil "\ +Non-nil if Keyfreq mode is enabled. +See the command `keyfreq-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `keyfreq-mode'.") + +(custom-autoload 'keyfreq-mode "keyfreq" nil) + +(autoload 'keyfreq-mode "keyfreq" "\ +Keyfreq mode records number of times each command was +called making it possible to access usage statistics through +various keyfreq-* functions. + +\(fn &optional ARG)" t nil) + +(defvar keyfreq-autosave-mode nil "\ +Non-nil if Keyfreq-Autosave mode is enabled. +See the command `keyfreq-autosave-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `keyfreq-autosave-mode'.") + +(custom-autoload 'keyfreq-autosave-mode "keyfreq" nil) + +(autoload 'keyfreq-autosave-mode "keyfreq" "\ +Keyfreq Autosave mode automatically saves +`keyfreq-table' every `keyfreq-autosave-timeout' seconds +and when emacs is killed. + +\(fn &optional ARG)" t nil) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; keyfreq-autoloads.el ends here diff --git a/elpa/keyfreq-20141124.805/keyfreq-pkg.el b/elpa/keyfreq-20141124.805/keyfreq-pkg.el new file mode 100644 index 00000000..7dc8d355 --- /dev/null +++ b/elpa/keyfreq-20141124.805/keyfreq-pkg.el @@ -0,0 +1 @@ +(define-package "keyfreq" "20141124.805" "track command frequencies" 'nil) diff --git a/elpa/keyfreq-20141124.805/keyfreq.el b/elpa/keyfreq-20141124.805/keyfreq.el new file mode 100644 index 00000000..1e2853b3 --- /dev/null +++ b/elpa/keyfreq-20141124.805/keyfreq.el @@ -0,0 +1,511 @@ +;;; keyfreq.el --- track command frequencies +;; Package-Version: 20141124.805 +;; -*- coding: utf-8 -*- +;; +;; Copyright 2009-2010 by David Capello +;; Copyright 2008 by Xah Lee +;; Copyright 2006 by Michal Nazarewicz +;; Copyright 2006 by Ryan Yeske +;; +;; Author: Ryan Yeske, Michal Nazarewicz (mina86/AT/mina86.com) +;; Maintainer: David Capello, Xah lee +;; Created: 2006 +;; +;; Keyfreq 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 2 of the License, or +;; (at your option) any later version. +;; +;; Version 1.5 - 2014-11 - David Capello +;; * Support cl-lib or cl +;; * Minor doc fixes +;; +;; Version 1.4 - 2010-09 - David Capello +;; * Renamed from command-frequency to keyfreq +;; * Now keyfreq-table holds "deltas" +;; * Removed a lot of "facility" functions to keep the code simple. +;; * Rename keyfreq-summarize-all-modes -> keyfreq-groups-major-modes. +;; * Added keyfreq-filter-major-mode +;; * Added lock file to avoid overwrite the file by two processes at +;; the same time. +;; +;; Version 1.3 - 2009-09 - David Capello +;; * Added keyfreq-summarize-all-modes +;; +;; Version 1.2 - 2009-09 - David Capello +;; * Now each hash hash-key is a (major-mode . command) cons. Now only +;; symbols are recorded. +;; +;; Version 1.1 - 2008-09 +;; - Replaced the use of this-command var by real-last-command, so +;; that the commands backward-kill-word, kill-word, kill-line, +;; kill-region, do not all get counted as kill-region. Changed +;; post-command-hook to pre-command-hook +;; +;; Version 1.0 - 2007 +;; - Made into a full featured minor mode. Added full doc +;; strings. Added feature to save and read to disk the frequency +;; hash table. Added ability to set user preference using emacs's +;; customization system. Code is ~400 lines. This version is made by +;; Michal Nazarewicz in 2007. +;; +;; Version 0.1 - 2006 +;; - First version by Ryan Yeske. A quick hack of about 40 lines. +;; + +;;; Commentary: +;; +;; HOW TO USE IT? +;; +;; Include the following lines in your .emacs file: +;; +;; (require 'keyfreq) +;; (keyfreq-mode 1) +;; (keyfreq-autosave-mode 1) +;; +;; And use `keyfreq-show' to see how many times you used a command. +;; +;;; Code: + +(if (featurep 'cl-lib) + (require 'cl-lib) + (require 'cl)) +;; (require 'json)? + +(defgroup keyfreq nil + "Customization group for Keyfreq mode. +This mode stores number of times each command was called and +provides it as a statistical data." + :package-version '(keyfreq . "1.5") + :group 'local + :prefix "keyfreq") + +;;;###autoload +(define-minor-mode keyfreq-mode + "Keyfreq mode records number of times each command was +called making it possible to access usage statistics through +various keyfreq-* functions." + :global t + :init-value nil + :lighter nil + :keymap nil + :group 'keyfreq + + (if keyfreq-mode + (add-hook 'pre-command-hook 'keyfreq-pre-command-hook) + (remove-hook 'pre-command-hook 'keyfreq-pre-command-hook))) + + +(defcustom keyfreq-buffer "*frequencies*" + "Buffer where frequencies are displayed." + :group 'keyfreq + :type 'string) + + +(defcustom keyfreq-file "~/.emacs.keyfreq" + "File `keyfreq-table' is saved to/loaded from by +`keyfreq-table-save' and `keyfreq-table-load' functions +by default." + :group 'keyfreq + :type 'file) + +(defcustom keyfreq-file-lock "~/.emacs.keyfreq.lock" + "Lock file to update the `keyfreq-file'." + :group 'keyfreq + :type 'file) + + +(defvar keyfreq-table (make-hash-table :test 'equal :size 128) + "Hash table storing number of times each command was called in each major mode +since the last time the frequencies were saved in `keyfreq-file'.") + + +(defun keyfreq-pre-command-hook () + "Record command execution in `keyfreq-table' hash." + (let ((command real-last-command) count) + (when (and command (symbolp command)) + (setq count (gethash (cons major-mode command) keyfreq-table)) + (puthash (cons major-mode command) (if count (1+ count) 1) + keyfreq-table)))) + + +(defun keyfreq-groups-major-modes (table) + "Group major modes in TABLE by command. +Return a hash table where each entry has COMMAND as key and +COUNTER as value." + (let ((new-table (make-hash-table :test 'equal :size 128))) + (maphash (lambda (k v) + (puthash (cdr k) (+ (gethash (cdr k) new-table 0) v) new-table)) + table) + new-table)) + + +(defun keyfreq-filter-major-mode (table major-mode) + "Leave the frequencies of the specified major mode. +Return a hash table where each entry has COMMAND as key and +COUNTER as value." + + (let ((new-table (make-hash-table :test 'equal :size 128))) + (maphash (lambda (k v) + (when (eq (car k) major-mode) + (puthash (cdr k) (+ (gethash (cdr k) new-table 0) v) new-table))) + table) + new-table)) + + +(defun keyfreq-used-major-modes (table) + "Return a list with the used major modes (major modes +contained in the TABLE)." + (let ((list)) + (maphash (lambda (k v) + (add-to-list 'list (car k))) + table) + list)) + + +(defun keyfreq-list (table &optional reverse limit) + "Return a cons which car is sum of times any command was used +and cdr is a list of (command . count) pairs. + +If REVERSE is nil, sort it starting from the most used command; +if it is `no-sort' the list is not sorted; if it is non-nil and +not `no-sort', sort it from the least used commands. If LIMIT is +a positive number, only commands which were used more then LIMIT +times will be added. If it is a negative number, only commands +which were used less then -LIMIT times will be added." + + (let (l (sum 0)) + (maphash + (cond + ((or (not (numberp limit)) (= limit 0)) + (lambda (k v) (setq l (cons (cons k v) l) sum (+ sum v)))) + ((= limit -1) (lambda (k v) (setq sum (+ sum v)))) + ((< limit 0) + (setq limit (- limit)) + (lambda (k v) (setq sum (+ sum v)) + (if (< v limit) (setq l (cons (cons k v) l))))) + (t + (lambda (k v) (setq sum (+ sum v)) + (if (> v limit) (setq l (cons (cons k v) l)))))) + table) + (cons sum + (cond + ((equal reverse 'no-sort) l) + (reverse (sort l (lambda (a b) (< (cdr a) (cdr b))))) + (t (sort l (lambda (a b) (> (cdr a) (cdr b))))))))) + + +(defun keyfreq-format-list (list &optional func) + "Return formatted string with command usage statistics. + +The LIST is the `keyfreq-table' converted to a list using the `keyfreq-list'. + +If FUNC is nil each line contains number of times command was +called and the command; if it is t percentage usage is added in +the middle; if it is 'raw each line will contain number an +command separated by single line (with no formatting) otherwise +FUNC must be a function returning a string which will be called +for each entry with three arguments: number of times command was +called, percentage usage and the command." + (let* ((sum (car list)) + (max-len + (reduce (lambda (a b) (max a (length (symbol-name (car b))))) + (cdr list) + :initial-value 0))) + (mapconcat + (cond + ((not func) (lambda (e) (format "%7d %s\n" (cdr e) (car e)))) + ((equal func t) + (lambda (e) (format (concat "%7d %6.2f%% %- " + (format "%d" max-len) + "s %s\n") + (cdr e) (/ (* 1e2 (cdr e)) sum) (car e) + (ignore-errors (keyfreq-where-is (car e)))))) + ((equal func 'raw) (lambda (e) (format "%d %s\n" (cdr e) (car e)))) + (t (lambda (e) (funcall func (cdr e) (/ (* 1e2 (cdr e)) sum) (car e))))) + (cdr list) ""))) + +(defun keyfreq-where-is (command) + (mapconcat 'key-description + (where-is-internal command) + ", ")) + +(defun keyfreq-show (&optional major-mode-symbol) + "Show command usage statistics in `keyfreq-buffer'. + +If MAJOR-MODE-SYMBOL is given, the function shows the statistics +for that particular major mode only. + +With a universal argument, the major-mode of the current buffer +is used as MAJOR-MODE-SYMBOL argument." + (interactive (list (cond (current-prefix-arg major-mode) + (t nil)))) + + (let ((table (copy-hash-table keyfreq-table))) + ;; Merge with the values in `keyfreq-file' + (keyfreq-table-load table) + + (let* ((list (keyfreq-list + (cond + (major-mode-symbol (keyfreq-filter-major-mode table major-mode-symbol)) + (t (keyfreq-groups-major-modes table))))) + (formatted-list (keyfreq-format-list list t))) + + ;; Display the table + (display-message-or-buffer (concat (if major-mode-symbol + (concat "For " (symbol-name major-mode)) + (concat "For all major modes")) + ":\n\n" + formatted-list) + keyfreq-buffer) + ))) + + +(defun keyfreq-html (filename &optional confirm) + "Save an HTML file as FILENAME with all the statistics of each mode." + + (interactive + (list (if buffer-file-name + (read-file-name "Write HTML file: " + nil nil nil nil) + (read-file-name "Write HTML file: " default-directory + (expand-file-name + (file-name-nondirectory (buffer-name)) + default-directory) + nil nil)) + (not current-prefix-arg))) + + (and confirm + (file-exists-p filename) + (or (y-or-n-p (format "File `%s' exists; overwrite? " filename)) + (error "Canceled"))) + + (let ((table (copy-hash-table keyfreq-table)) + (htmltable (lambda (list) + (insert "\n") + (insert "\n") + (insert "\n") + (keyfreq-format-list list + (lambda (count perc command) + (insert (format "\n" count perc command)))) + (insert "\n") + (insert "
TimesPercetageCommand
%d%.2f%%%s
\n")))) + + ;; Merge with the values in `keyfreq-file' + (keyfreq-table-load table) + + (with-temp-file filename + (insert "\n\n") + (insert "

Keyfreq Report

\n") + (insert "
    \n") + (insert "
  • All major modes
  • \n") + (mapc + (lambda (major-mode-symbol) + (insert (format "
  • %s
  • \n" + (symbol-name major-mode-symbol) + (symbol-name major-mode-symbol)))) + (keyfreq-used-major-modes table)) + (insert "
\n") + + (insert "

All major modes

\n") + (funcall htmltable (keyfreq-list (keyfreq-groups-major-modes table))) + + (mapc + (lambda (major-mode-symbol) + (insert (format "

%s

\n" + (symbol-name major-mode-symbol) + (symbol-name major-mode-symbol))) + (funcall htmltable (keyfreq-list (keyfreq-filter-major-mode table major-mode-symbol)))) + (keyfreq-used-major-modes table)) + + (insert "\n\n") + ) + )) + + +(defun keyfreq-json-encode (table) + "Return a JSON representation of the table of frequencies." + (require 'json) + (let ((commands-indexes (make-hash-table :test 'equal :size 128)) + commands-list frequencies-matrix i) + + ;; Build the "commands" property of the JSON object. + (setq i 0) + (maphash + (lambda (command-symbol counter) + (add-to-list 'commands-list command-symbol t) + (puthash command-symbol i commands-indexes) + (setq i (+ i 1)) + ) + (keyfreq-groups-major-modes table)) + + ;; Build the "frequencies" property. + (mapc + (lambda (major-mode-symbol) + (let ((cmd-count-pairs '())) + (keyfreq-format-list (keyfreq-list (keyfreq-filter-major-mode table major-mode-symbol)) + (lambda (count perc command) + (add-to-list 'cmd-count-pairs (gethash command commands-indexes) t) + (add-to-list 'cmd-count-pairs count t))) + (add-to-list 'frequencies-matrix major-mode-symbol t) + (add-to-list 'frequencies-matrix (append cmd-count-pairs nil) t))) + (keyfreq-used-major-modes table)) + + (json-encode `((:format . 1) + (:commands . ,commands-list) + (:frequencies . ,frequencies-matrix))))) + + +(defun keyfreq-json (filename &optional confirm) + "Save a file (as FILENAME) with a JSON structure of the data." + + (interactive + (list (if buffer-file-name + (read-file-name "Write JSON file: " + nil nil nil nil) + (read-file-name "Write JSON file: " default-directory + (expand-file-name + (file-name-nondirectory (buffer-name)) + default-directory) + nil nil)) + (not current-prefix-arg))) + + (and confirm + (file-exists-p filename) + (or (y-or-n-p (format "File `%s' exists; overwrite? " filename)) + (error "Canceled"))) + + (let ((table (copy-hash-table keyfreq-table))) + + ;; Merge with the values in `keyfreq-file' + (keyfreq-table-load table) + + (with-temp-file filename + (insert (keyfreq-json-encode table))))) + + +(defun keyfreq-file-owner () + "Return the PID of the Emacs process that owns the table file lock file." + (let (owner) + (and (file-exists-p keyfreq-file-lock) + (with-temp-buffer + (insert-file-contents-literally keyfreq-file-lock) + (goto-char (point-min)) + (setq owner (read (current-buffer))) + (integerp owner)) + owner))) + + +(defun keyfreq-file-claim-lock () + (write-region (number-to-string (emacs-pid)) nil + keyfreq-file-lock nil 'nomessage)) + + +(defun keyfreq-file-release-lock () + (when (file-exists-p keyfreq-file-lock) + (delete-file keyfreq-file-lock))) + + +(defun keyfreq-file-is-unlocked () + ;; If the lock file exists.... + (if (file-exists-p keyfreq-file-lock) + ;; If the process which has the lock does not exist + (if (not (memql (keyfreq-file-owner) (list-system-processes))) + ;; Delete the lock + (delete-file keyfreq-file-lock))) + ;; Check again the lock existence (just in case...) + (not (file-exists-p keyfreq-file-lock))) + + +(defun keyfreq-table-save (table) + "Append all values from the specified TABLE into the +`keyfreq-file' as a sexp of an alist. Then resets the TABLE +if it was successfully merged." + + ;; Check that the lock file does not exist + (when (keyfreq-file-is-unlocked) + ;; Lock the file + (keyfreq-file-claim-lock) + + ;; Check that we have the lock + (if (eq (keyfreq-file-owner) (emacs-pid)) + (unwind-protect + (progn + ;; Load values and merge them with the current keyfreq-table + (keyfreq-table-load table) + + ;; Write the new frequencies + (with-temp-file keyfreq-file + (let ((print-level nil) + (print-length nil)) + (prin1 (cdr (keyfreq-list table 'no-sort)) (current-buffer))))) + + ;; Release the lock and reset the hash table. + (keyfreq-file-release-lock) + (clrhash table)) + ))) + + +(defun keyfreq-table-load (table) + "Load all values from the `keyfreq-file' and add them in the TABLE. +The table is not reset, so the values are appended to the table." + + ;; Does `keyfreq-file' exist? + (if (file-exists-p keyfreq-file) + ;; Load sexp + (let ((l (with-temp-buffer + (insert-file-contents keyfreq-file) + (goto-char (point-min)) + (read (current-buffer))))) + + ;; Add the values in the table + (while (and (listp l) l) + (if (listp (car l)) + (puthash (caar l) (+ (gethash (caar l) table 0) (cdar l)) table)) + (setq l (cdr l))) + ))) + +;;;###autoload +(define-minor-mode keyfreq-autosave-mode + "Keyfreq Autosave mode automatically saves +`keyfreq-table' every `keyfreq-autosave-timeout' seconds +and when emacs is killed." + :global t + :init-value nil + :lighter nil + :keymap nil + :group 'keyfreq + + (when keyfreq-autosave--timer + (cancel-timer keyfreq-autosave--timer) + (setq keyfreq-autosave--timer nil)) + + (if keyfreq-autosave-mode + (progn + (setq keyfreq-autosave--timer + (run-at-time t keyfreq-autosave-timeout + 'keyfreq-autosave--do)) + (add-hook 'kill-emacs-hook 'keyfreq-autosave--do)) + (remove-hook 'kill-emacs-hook 'keyfreq-autosave--do))) + + +(defcustom keyfreq-autosave-timeout 600 + "How often in seconds `keyfreq-table' should be saved +when `keyfreq-autosave-mode' is enabled. Setting this +value will take effect only after (re)enabling +`keyfreq-autosave-mode'." + :group 'keyfreq + :type 'number) + + +(defvar keyfreq-autosave--timer nil) + + +(defun keyfreq-autosave--do () + "Function executed periodically to save the `keyfreq-table' in `keyfreq-file'." + (keyfreq-table-save keyfreq-table)) + + +(provide 'keyfreq) + +;;; keyfreq.el ends here diff --git a/elpa/keyfreq-readme.txt b/elpa/keyfreq-readme.txt new file mode 100644 index 00000000..1b87f32b --- /dev/null +++ b/elpa/keyfreq-readme.txt @@ -0,0 +1,9 @@ +HOW TO USE IT? + +Include the following lines in your .emacs file: + + (require 'keyfreq) + (keyfreq-mode 1) + (keyfreq-autosave-mode 1) + +And use `keyfreq-show' to see how many times you used a command. diff --git a/elpa/langtool-20150609.2131/langtool-autoloads.el b/elpa/langtool-20150609.2131/langtool-autoloads.el new file mode 100644 index 00000000..478985ab --- /dev/null +++ b/elpa/langtool-20150609.2131/langtool-autoloads.el @@ -0,0 +1,32 @@ +;;; langtool-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) + +;;;### (autoloads nil "langtool" "langtool.el" (21908 14228 0 0)) +;;; Generated autoloads from langtool.el + +(defalias 'langtool-check 'langtool-check-buffer) + +(autoload 'langtool-check-buffer "langtool" "\ +Check context current buffer and light up errors. +Optional \\[universal-argument] read LANG name. + +You can change the `langtool-default-language' to apply all session. +Restrict to selection when region is activated. + +\(fn &optional LANG)" t nil) + +(autoload 'langtool-switch-default-language "langtool" "\ +Switch `langtool-read-lang-name' to LANG + +\(fn LANG)" t nil) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; langtool-autoloads.el ends here diff --git a/elpa/langtool-20150609.2131/langtool-pkg.el b/elpa/langtool-20150609.2131/langtool-pkg.el new file mode 100644 index 00000000..a9b68b90 --- /dev/null +++ b/elpa/langtool-20150609.2131/langtool-pkg.el @@ -0,0 +1 @@ +(define-package "langtool" "20150609.2131" "Grammar check utility using LanguageTool" '((cl-lib "0.3")) :url "https://github.com/mhayashi1120/Emacs-langtool" :keywords '("docs")) diff --git a/elpa/langtool-20150609.2131/langtool.el b/elpa/langtool-20150609.2131/langtool.el new file mode 100644 index 00000000..6fce1c7e --- /dev/null +++ b/elpa/langtool-20150609.2131/langtool.el @@ -0,0 +1,775 @@ +;;; langtool.el --- Grammar check utility using LanguageTool + +;; Author: Masahiro Hayashi +;; Keywords: docs +;; Package-Version: 20150609.2131 +;; URL: https://github.com/mhayashi1120/Emacs-langtool +;; Emacs: GNU Emacs 24 or later +;; Version: 1.3.1 +;; Package-Requires: ((cl-lib "0.3")) + +;; 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 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. + +;;; Commentary: + +;; ## Install: + +;; Install LanguageTool (and java) +;; http://www.languagetool.org/ + +;; Put this file into load-path'ed directory, and byte compile it if +;; desired. And put the following expression into your ~/.emacs. +;; +;; (require 'langtool) +;; (setq langtool-language-tool-jar "/path/to/languagetool-commandline.jar") +;; +;; If you use old version of LanguageTool, may be: +;; +;; (setq langtool-language-tool-jar "/path/to/LanguageTool.jar") +;; +;; Alternatively, you can set the classpath where LanguageTool's jars reside: +;; +;; (require 'langtool) +;; (setq langtool-java-classpath +;; "/usr/share/languagetool:/usr/share/java/languagetool/*") + +;; This setting is optional +;; +;; (global-set-key "\C-x4w" 'langtool-check) +;; (global-set-key "\C-x4W" 'langtool-check-done) +;; (global-set-key "\C-x4l" 'langtool-switch-default-language) +;; (global-set-key "\C-x44" 'langtool-show-message-at-point) +;; (global-set-key "\C-x4c" 'langtool-correct-buffer) +;; +;; Currently GNU java version not works. +;; +;; (setq langtool-java-bin "/path/to/java") +;; +;; Maybe you want to specify your mother tongue. +;; +;; (setq langtool-mother-tongue "en") + +;; ## Usage: + +;; * To check current buffer and show warnings. +;; +;; M-x langtool-check + +;; * To correct marker follow LanguageTool suggestions. +;; +;; M-x langtool-correct-buffer + +;; * Goto warning point and +;; +;; M-x langtool-show-message-at-point + +;; * To finish checking. All langtool marker is removed. +;; +;; M-x langtool-check-done + +;;; TODO: + +;; * process coding system (test on Windows) +;; * check only docstring (emacs-lisp-mode) +;; or using (derived-mode-p 'prog-mode) and only string and comment +;; * I don't know well about java. But GNU libgcj version not works.. +;; * java encoding <-> elisp encoding + +;;; Code: + +(require 'cl-lib) +(require 'compile) + +(defgroup langtool nil + "Customize langtool" + :prefix "langtool-" + :group 'applications) + +(defvar current-prefix-arg) +(defvar unread-command-events) +(defvar locale-language-names) + +(defface langtool-errline + '((((class color) (background dark)) (:background "Firebrick4")) + (((class color) (background light)) (:background "LightPink")) + (t (:bold t))) + "Face used for marking error lines." + :group 'langtool) + +(defcustom langtool-java-bin "java" + "*Executing java command." + :group 'langtool + :type 'file) + +(defcustom langtool-language-tool-jar nil + "*LanguageTool jar file." + :group 'langtool + :type 'file) + +(defcustom langtool-java-classpath nil + "Custom classpath to use when executing languagetool" + :group 'langtool + :type 'string) + +(defcustom langtool-default-language nil + "*Language name pass to LanguageTool." + :group 'langtool + :type 'string) + +(defcustom langtool-mother-tongue nil + "*Your mothertongue Language name pass to LanguageTool." + :group 'langtool + :type 'string) + +(defcustom langtool-disabled-rules nil + "*Disabled rules pass to LanguageTool. +String that separated by comma or list of string. +" + :group 'langtool + :type '(choice + (list string) + string)) + +(defvar langtool-local-disabled-rules nil) +(make-variable-buffer-local 'langtool-local-disabled-rules) + +(defvar langtool-temp-file nil) +(make-variable-buffer-local 'langtool-temp-file) + +(defconst langtool-output-regexp + (eval-when-compile + (concat + "^[0-9]+\\.) Line \\([0-9]+\\), column \\([0-9]+\\), Rule ID: \\(.*\\)\n" + "Message: \\(.*\\)\n" + "\\(?:Suggestion: \\(.*\\)\n\\)?" + ;; As long as i can read + ;; src/dev/de/danielnaber/languagetool/dev/wikipedia/OutputDumpHandler.java + "\\(\\(?:.*\\)\n\\(?:[ ^]+\\)\\)\n" + "\n?" ; last result have no new-line + ))) + +(defvar langtool-buffer-process nil) +(make-variable-buffer-local 'langtool-buffer-process) + +(defvar langtool-mode-line-message nil) +(make-variable-buffer-local 'langtool-mode-line-message) +(put 'langtool-mode-line-message 'risky-local-variable t) + +(defvar langtool-error-buffer-name " *LanguageTool Errors* ") + +(defun langtool-region-active-p () + (cond + ((fboundp 'region-active-p) + (funcall 'region-active-p)) + (t + (and transient-mark-mode mark-active)))) + +(defun langtool-goto-next-error () + "Obsoleted function. Should use `langtool-correct-buffer'. +Goto next error." + (interactive) + (let ((overlays (langtool--overlays-region (point) (point-max)))) + (langtool--goto-error + overlays + (lambda (ov) (< (point) (overlay-start ov)))))) + +(defun langtool-goto-previous-error () + "Obsoleted function. Should use `langtool-correct-buffer'. +Goto previous error." + (interactive) + (let ((overlays (langtool--overlays-region (point-min) (point)))) + (langtool--goto-error + (reverse overlays) + (lambda (ov) (< (overlay-end ov) (point)))))) + +(defun langtool-show-message-at-point () + "Show error details at point" + (interactive) + (let ((msgs (langtool--current-error-messages))) + (if (null msgs) + (message "No errors") + (let ((buf (get-buffer-create langtool-error-buffer-name))) + (with-current-buffer buf + (erase-buffer) + (mapc + (lambda (msg) (insert msg "\n")) + msgs)) + (save-window-excursion + (display-buffer buf) + (let* ((echo-keystrokes) + (event (read-event))) + (setq unread-command-events (list event)))))))) + +(defun langtool-check-done () + "Finish LanguageTool process and cleanup existing colorized texts." + (interactive) + (when langtool-buffer-process + (delete-process langtool-buffer-process)) + (kill-local-variable 'langtool-buffer-process) + (kill-local-variable 'langtool-mode-line-message) + (kill-local-variable 'langtool-local-disabled-rules) + (langtool--clear-buffer-overlays) + (message "Cleaned up LanguageTool.")) + +;;;###autoload +(defalias 'langtool-check 'langtool-check-buffer) + +;;;###autoload +(defun langtool-check-buffer (&optional lang) + "Check context current buffer and light up errors. +Optional \\[universal-argument] read LANG name. + +You can change the `langtool-default-language' to apply all session. +Restrict to selection when region is activated. +" + (interactive + (when current-prefix-arg + (list (langtool-read-lang-name)))) + (langtool--check-command) + ;; probablly ok... + (when (listp mode-line-process) + (add-to-list 'mode-line-process '(t langtool-mode-line-message))) + (let* ((file (buffer-file-name)) + (region-p (langtool-region-active-p)) + (begin (and region-p (region-beginning))) + (finish (and region-p (region-end)))) + (when region-p + (deactivate-mark)) + (unless langtool-temp-file + (setq langtool-temp-file (make-temp-file "langtool-"))) + (when (or (null file) (buffer-modified-p) region-p) + (save-restriction + (widen) + (let ((coding-system-for-write buffer-file-coding-system)) + (write-region begin finish langtool-temp-file nil 'no-msg)) + (setq file langtool-temp-file))) + ;; clear previous check + (langtool--clear-buffer-overlays) + (let ((command langtool-java-bin) + args) + (setq args (list "-c" (langtool--java-coding-system buffer-file-coding-system) + "-l" (or lang langtool-default-language) + "-d" (langtool--disabled-rules))) + (if langtool-java-classpath + (setq args (append (list "-cp" langtool-java-classpath + "org.languagetool.commandline.Main") + args)) + (setq args (append + (list "-jar" (expand-file-name langtool-language-tool-jar)) + args))) + (when langtool-mother-tongue + (setq args (append args (list "-m" langtool-mother-tongue)))) + (setq args (append args (list file))) + (langtool--debug "Command" "%s: %s" command args) + (let* ((buffer (langtool--process-create-buffer)) + (proc (apply 'start-process "LanguageTool" buffer command args))) + (set-process-filter proc 'langtool--process-filter) + (set-process-sentinel proc 'langtool--process-sentinel) + (process-put proc 'langtool-source-buffer (current-buffer)) + (process-put proc 'langtool-region-begin begin) + (process-put proc 'langtool-region-finish finish) + (setq langtool-buffer-process proc) + (setq langtool-mode-line-message + (list " LanguageTool" + (propertize ":run" 'face compilation-info-face))))))) + +;;;###autoload +(defun langtool-switch-default-language (lang) + "Switch `langtool-read-lang-name' to LANG" + (interactive (list (langtool-read-lang-name))) + (setq langtool-default-language lang) + (message "Now default language is `%s'" lang)) + +(defun langtool-correct-buffer () + "Execute interactive correction after `langtool-check'" + (interactive) + (let ((ovs (langtool--overlays-region (point-min) (point-max)))) + (if (null ovs) + (message "No error found. %s" + (substitute-command-keys + (concat + "Type \\[langtool-check-done] to finish checking " + "or type \\[langtool-check] to re-check buffer"))) + (barf-if-buffer-read-only) + (langtool--correction ovs)))) + +(defvar langtool--debug nil) +(defun langtool-toggle-debug () + "Toggle LanguageTool debugging." + (interactive) + (setq langtool--debug (not langtool--debug)) + (if langtool--debug + (message "LanguageTool debug ON.") + (message "LanguageTool debug off."))) + +(defun langtool--debug (key fmt &rest args) + (when langtool--debug + (let ((buf (get-buffer-create "*LanguageTool Debug*"))) + (with-current-buffer buf + (goto-char (point-max)) + (insert "---------- [" key "] ----------\n") + (insert (apply 'format fmt args) "\n"))))) + +(defun langtool--goto-error (overlays predicate) + (catch 'done + (mapc + (lambda (ov) + (when (funcall predicate ov) + (goto-char (overlay-start ov)) + (throw 'done t))) + overlays) + nil)) + +(defun langtool-read-lang-name () + (completing-read "Lang: " + (or (mapcar 'list (langtool--available-languages)) + locale-language-names))) + +(defun langtool--create-overlay (tuple) + (let ((line (nth 0 tuple)) + (col (nth 1 tuple)) + (len (nth 2 tuple)) + (sugs (nth 3 tuple)) + (msg (nth 4 tuple)) + (message (nth 5 tuple)) + (rule-id (nth 6 tuple)) + (context (nth 7 tuple))) + (goto-char (point-min)) + (forward-line (1- line)) + (let ((start (line-beginning-position)) + (end (line-end-position))) + ;; 1. sketchy move to column that is indicated by LanguageTool. + ;; 2. fuzzy match to reported sentence which indicated by ^^^ like string. + (move-to-column col) + (cl-destructuring-bind (start . end) + (langtool--fuzzy-search context len) + (let ((ov (make-overlay start end))) + (overlay-put ov 'langtool-simple-message msg) + (overlay-put ov 'langtool-message message) + (overlay-put ov 'langtool-suggestions sugs) + (overlay-put ov 'langtool-rule-id rule-id) + (overlay-put ov 'priority 1) + (overlay-put ov 'face 'langtool-errline)))))) + +;;FIXME +;;http://sourceforge.net/tracker/?func=detail&aid=3054895&group_id=110216&atid=655717 +(defun langtool--fuzzy-search (context-regexp length) + (let* ((regexp (concat ".*?" context-regexp)) + (default (cons (point) (+ (point) length)))) + (or (and (null regexp) + (cons (point) (+ (point) length))) + (and (looking-at regexp) + (cons (match-beginning 1) (match-end 1))) + (let ((beg (min (line-beginning-position) (- (point) 20)))) + (cl-loop while (and (not (bobp)) + (<= beg (point))) + ;; backward just sentence length to search sentence after point + do (condition-case nil + (backward-char length) + (beginning-of-buffer nil)) + if (looking-at regexp) + return (cons (match-beginning 1) (match-end 1)))) + default))) + +(defun langtool--current-error-messages () + (remove nil + (mapcar + (lambda (ov) + (overlay-get ov 'langtool-message)) + (overlays-at (point))))) + +(defun langtool--clear-buffer-overlays () + (mapc + (lambda (ov) + (delete-overlay ov)) + (langtool--overlays-region (point-min) (point-max)))) + +(defun langtool--overlays-region (start end) + (sort + (remove + nil + (mapcar + (lambda (ov) + (when (overlay-get ov 'langtool-message) + ov)) + (overlays-in start end))) + (lambda (ov1 ov2) + (< (overlay-start ov1) (overlay-start ov2))))) + +(defun langtool--check-command () + (when (or (null langtool-java-bin) + (not (executable-find langtool-java-bin))) + (error "java command is not found")) + (unless langtool-java-classpath + (when (or (null langtool-language-tool-jar) + (not (file-readable-p langtool-language-tool-jar))) + (error "langtool jar file is not found"))) + (when langtool-buffer-process + (error "Another process is running"))) + +(defun langtool--disabled-rules () + (let ((custom langtool-disabled-rules) + (locals langtool-local-disabled-rules)) + (cond + ((stringp custom) + (mapconcat 'identity + (cons custom locals) + ",")) + (t + (mapconcat 'identity + (append custom locals) + ","))))) + +(defun langtool--process-create-buffer () + (generate-new-buffer " *LanguageTool* ")) + +(defun langtool--process-filter (proc event) + (langtool--debug "Filter" "%s" event) + (with-current-buffer (process-buffer proc) + (goto-char (point-max)) + (insert event) + (let ((min (or (process-get proc 'langtool-process-done) + (point-min))) + (buffer (process-get proc 'langtool-source-buffer)) + (begin (process-get proc 'langtool-region-begin)) + (finish (process-get proc 'langtool-region-finish)) + n-tuple) + (goto-char min) + (while (re-search-forward langtool-output-regexp nil t) + (let* ((line (string-to-number (match-string 1))) + (column (1- (string-to-number (match-string 2)))) + (rule-id (match-string 3)) + (suggest (match-string 5)) + (msg1 (match-string 4)) + ;; rest of line. Point the raw message. + (msg2 (match-string 6)) + (message + (concat "Rule ID: " rule-id "\n" + msg1 "\n\n" + msg2)) + (suggestions (and suggest (split-string suggest "; "))) + (context (langtool--pointed-context-regexp msg2)) + (len (langtool--pointed-length msg2))) + (setq n-tuple (cons + (list line column len suggestions + msg1 message rule-id context) + n-tuple)))) + (process-put proc 'langtool-process-done (point)) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (save-excursion + (save-restriction + (when (and begin finish) + (narrow-to-region begin finish)) + (mapc + (lambda (tuple) + (langtool--create-overlay tuple)) + (nreverse n-tuple))))))))) + +;;FIXME sometimes LanguageTool says wrong column. +(defun langtool--pointed-context-regexp (message) + (when (string-match "\\(.*\\)\n\\( *\\)\\(\\^+\\)" message) + (let* ((msg1 (match-string 1 message)) + (pre (length (match-string 2 message))) + (len (length (match-string 3 message))) + (end (+ pre len)) + (sentence (substring msg1 pre end)) + (regexp (cond + ((string-match "^[[:space:]]+$" sentence) + ;; invalid sentence only have whitespace, + ;; search with around sentence. + (concat + "\\(" + (let* ((count (length sentence)) + (spaces (format "[[:space:]\n]\\{%d\\}" count))) + spaces) + "\\)" + ;; considered truncated spaces that is caused by + ;; `langtool--sentence-to-fuzzy' + "[[:space:]]*?" + ;; to match the correct block + ;; suffix of invalid spaces. + (langtool--sentence-to-fuzzy + (let ((from (min end (length msg1)))) + ;;TODO magic number. + (substring msg1 from (min (length msg1) (+ from 20))))))) + (t + (concat "\\(" + (langtool--sentence-to-fuzzy sentence) + "\\)"))))) + regexp))) + +(defun langtool--sentence-to-fuzzy (sentence) + (mapconcat 'regexp-quote + ;; this sentence is reported by LanguageTool + (split-string sentence " +") + ;; LanguageTool interpreted newline as space. + "[[:space:]\n]+?")) + +(defun langtool--pointed-length (message) + (or + (and (string-match "\n\\( *\\)\\(\\^+\\)" message) + (length (match-string 2 message))) + ;; never through here, but if return nil from this function make stop everything. + 1)) + +(defun langtool--process-sentinel (proc event) + (when (memq (process-status proc) '(exit signal)) + (let ((source (process-get proc 'langtool-source-buffer)) + (code (process-exit-status proc)) + (pbuf (process-buffer proc)) + dead marks msg face) + (when (/= code 0) + (setq face compilation-error-face)) + (cond + ((buffer-live-p source) + (with-current-buffer source + (setq marks (langtool--overlays-region (point-min) (point-max))) + (setq face (if marks compilation-info-face compilation-warning-face)) + (setq langtool-buffer-process nil) + (setq langtool-mode-line-message + (list " LanguageTool" + (propertize ":exit" 'face face))))) + (t (setq dead t))) + (cond + (dead) + ((/= code 0) + (let ((msg + (if (buffer-live-p pbuf) + ;; Get first line of output. + (with-current-buffer pbuf + (goto-char (point-min)) + (buffer-substring (point) (point-at-eol))) + "Buffer was dead"))) + (message "LanguageTool exited abnormally with code %d (%s)" + code msg))) + (marks + (message "%s" + (substitute-command-keys + "Type \\[langtool-correct-buffer] to correct buffer."))) + (t + (message "LanguageTool successfully finished with no error."))) + (when (buffer-live-p pbuf) + (kill-buffer pbuf))))) + +(defun langtool--available-languages () + (when (stringp langtool-language-tool-jar) + (let ((dir (expand-file-name "rules" (file-name-directory langtool-language-tool-jar)))) + (when (file-directory-p dir) + (remove nil + (mapcar + (lambda (f) + (when (file-directory-p f) + (file-name-nondirectory f))) + (directory-files dir t "^[^.].$"))))))) + +;;FIXME +;; http://java.sun.com/j2se/1.5.0/ja/docs/ja/guide/intl/encoding.doc.html +(defun langtool--java-coding-system (coding-system) + (let* ((cs (coding-system-base coding-system)) + (csname (symbol-name cs)) + (aliases (langtool--coding-system-aliases cs)) + (names (mapcar 'symbol-name aliases)) + tmp) + (cond + ((string-match "utf-8" csname) + "utf8") + ((or (string-match "euc.*jp" csname) + (string-match "japanese-iso-.*8bit" csname)) + "eucjp") + ((string-match "shift.jis" csname) + "sjis") + ((string-match "iso.*2022.*jp" csname) + "iso2022jp") + ((setq tmp + (cl-loop for x in names + if (string-match "iso-8859-\\([0-9]+\\)" x) + return x)) + (concat "ISO8859_" (match-string 1 tmp))) + ((memq cs '(us-ascii raw-text undecided no-conversion)) + "ascii") + ((memq cs '(cyrillic-koi8)) + "koi8-r") + ((setq tmp + (cl-loop for x in names + if (string-match "^windows-[0-9]+$" x) + return x)) + tmp) + (t + ;; default guessed as ascii + "ascii")))) + +(defun langtool--coding-system-aliases (coding-system) + (if (fboundp 'coding-system-aliases) + ;; deceive elint + (funcall 'coding-system-aliases coding-system) + (coding-system-get coding-system 'alias-coding-systems))) + +(defun langtool--correction (overlays) + (let ((conf (current-window-configuration))) + (unwind-protect + (let ((next (car overlays))) + (while (setq next (langtool--correction-loop next overlays)))) + (langtool--expire-buffer-overlays) + (set-window-configuration conf) + (kill-buffer (langtool--correction-buffer))))) + +(defun langtool--correction-loop (ov overlays) + (let* ((suggests (overlay-get ov 'langtool-suggestions)) + (msg (overlay-get ov 'langtool-simple-message)) + (alist (langtool--correction-popup msg suggests))) + (catch 'next + (while (progn + (goto-char (overlay-start ov)) + (let (message-log-max) + (message (concat "C-h or ? for more options; " + "SPC to leave unchanged, " + "Digit to replace word"))) + (let* ((echo-keystrokes) ; suppress echoing + (c (downcase (read-char))) + (pair (assq c alist))) + (cond + (pair + (let ((sug (nth 1 pair))) + ;;TODO when region contains newline. + ;; -> insert newline after suggestion. + (delete-region (overlay-start ov) (overlay-end ov)) + (insert sug) + (langtool--erase-overlay ov)) + nil) + ((memq c '(?q)) + (keyboard-quit)) + ((memq c '(?c)) + (langtool--erase-overlay ov) + nil) + ((memq c '(?e)) + (message (substitute-command-keys + "Type \\[exit-recursive-edit] to finish the edit.")) + (recursive-edit) + ;; stay current cursor and wait next user command. + (throw 'next ov)) + ((memq c '(?i)) + (let ((rule (overlay-get ov 'langtool-rule-id))) + (unless (member rule langtool-local-disabled-rules) + (setq langtool-local-disabled-rules + (cons rule langtool-local-disabled-rules))) + (langtool--ignore-rule rule overlays)) + nil) + ((memq c '(?\C-h ?\?)) + (langtool--correction-help) + t) + ((memq c '(?\d)) + (throw 'next (langtool--prev-overlay ov overlays))) + ((memq c '(?\s)) nil) + (t (ding) t))))) + ;; next item + (langtool--next-overlay ov overlays)))) + +(defun langtool--expire-buffer-overlays () + (mapc + (lambda (o) + (unless (overlay-get o 'face) + (delete-overlay o))) + (langtool--overlays-region (point-min) (point-max)))) + +(defun langtool--ignore-rule (rule overlays) + (cl-loop for ov in overlays + do (let ((r (overlay-get ov 'langtool-rule-id))) + (when (equal r rule) + (langtool--erase-overlay ov))))) + +(defun langtool--erase-overlay (ov) + (overlay-put ov 'face nil)) + +(defun langtool--next-overlay (current overlays) + (cl-loop for o in (cdr (memq current overlays)) + if (overlay-get o 'face) + return o)) + +(defun langtool--prev-overlay (current overlays) + (cl-loop for o in (cdr (memq current (reverse overlays))) + if (overlay-get o 'face) + return o)) + +(defvar langtool--correction-keys + [?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9]) + +(defface langtool-correction-face + '((((class mono)) (:inverse-video t :bold t :underline t)) + (t (:background "red1" :foreground "yellow" :bold t))) + "Face used to visualize correction." + :group 'langtool) + +(defun langtool--correction-popup (msg suggests) + (let ((buf (langtool--correction-buffer))) + (delete-other-windows) + (let ((win (split-window))) + (set-window-buffer win buf)) + (with-current-buffer buf + (let ((inhibit-read-only t)) + (erase-buffer) + (insert msg "\n\n") + (cl-loop for s in suggests + for c across langtool--correction-keys + do (progn + (insert "(" c ") ") + (let ((start (point))) + (insert s) + ;; colorize suggestion. + ;; suggestion may contains whitespace. + (let ((ov (make-overlay start (point)))) + (overlay-put ov 'face 'langtool-correction-face))) + (insert "\n")) + collect (list c s)))))) + +(defun langtool--correction-help () + (let ((help-1 "[q/Q]uit correction; [c/C]lear the colorized text; ") + (help-2 "[i/I]gnore the rule over current session.") + (help-3 "[e/E]dit the buffer manually") + (help-4 "SPC skip; DEL move backward;") + ) + (save-window-excursion + (unwind-protect + (let ((resize-mini-windows 'grow-only)) + (select-window (minibuffer-window)) + (erase-buffer) + (message nil) + ;;(set-minibuffer-window (selected-window)) + (enlarge-window 2) + (insert (concat help-1 "\n" help-2 "\n" help-3 "\n" help-4)) + (sit-for 5)) + (erase-buffer))))) + +(defun langtool--correction-buffer () + (get-buffer-create "*Langtool Correction*")) + +;; initialize custom variables guessed from environment. +(let ((env (or (getenv "LANG") + (getenv "LC_ALL"))) + lang mt) + (and env + (string-match "^\\(..\\)_" env) + (setq lang (downcase (match-string 1 env))) + (member lang (langtool--available-languages)) + (setq mt lang)) + (unless langtool-mother-tongue + (setq langtool-mother-tongue mt)) + (unless langtool-default-language + (setq langtool-default-language (or mt "en")))) + +(provide 'langtool) + +;;; langtool.el ends here diff --git a/elpa/let-alist-1.0.4.signed b/elpa/let-alist-1.0.4.signed new file mode 100644 index 00000000..281ce60f --- /dev/null +++ b/elpa/let-alist-1.0.4.signed @@ -0,0 +1 @@ +Good signature from 474F05837FBDEF9B GNU ELPA Signing Agent (trust undefined) created at 2015-06-12T11:05:02+0200 using DSA \ No newline at end of file diff --git a/elpa/let-alist-1.0.4/let-alist-autoloads.el b/elpa/let-alist-1.0.4/let-alist-autoloads.el new file mode 100644 index 00000000..375b5612 --- /dev/null +++ b/elpa/let-alist-1.0.4/let-alist-autoloads.el @@ -0,0 +1,49 @@ +;;; let-alist-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) + +;;;### (autoloads nil "let-alist" "let-alist.el" (21908 10928 0 0)) +;;; Generated autoloads from let-alist.el + +(autoload 'let-alist "let-alist" "\ +Let-bind dotted symbols to their cdrs in ALIST and execute BODY. +Dotted symbol is any symbol starting with a `.'. Only those present +in BODY are let-bound and this search is done at compile time. + +For instance, the following code + + (let-alist alist + (if (and .title .body) + .body + .site + .site.contents)) + +essentially expands to + + (let ((.title (cdr (assq 'title alist))) + (.body (cdr (assq 'body alist))) + (.site (cdr (assq 'site alist))) + (.site.contents (cdr (assq 'contents (cdr (assq 'site alist)))))) + (if (and .title .body) + .body + .site + .site.contents)) + +If you nest `let-alist' invocations, the inner one can't access +the variables of the outer one. You can, however, access alists +inside the original alist by using dots inside the symbol, as +displayed in the example above. + +\(fn ALIST &rest BODY)" nil t) + +(put 'let-alist 'lisp-indent-function '1) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; let-alist-autoloads.el ends here diff --git a/elpa/let-alist-1.0.4/let-alist-pkg.el b/elpa/let-alist-1.0.4/let-alist-pkg.el new file mode 100644 index 00000000..ff29474e --- /dev/null +++ b/elpa/let-alist-1.0.4/let-alist-pkg.el @@ -0,0 +1 @@ +(define-package "let-alist" "1.0.4" "Easily let-bind values of an assoc-list by their names" 'nil :url "http://elpa.gnu.org/packages/let-alist.html" :keywords '("extensions" "lisp")) diff --git a/elpa/let-alist-1.0.4/let-alist.el b/elpa/let-alist-1.0.4/let-alist.el new file mode 100644 index 00000000..dbf31e02 --- /dev/null +++ b/elpa/let-alist-1.0.4/let-alist.el @@ -0,0 +1,170 @@ +;;; let-alist.el --- Easily let-bind values of an assoc-list by their names -*- lexical-binding: t; -*- + +;; Copyright (C) 2014-2015 Free Software Foundation, Inc. + +;; Author: Artur Malabarba +;; Maintainer: Artur Malabarba +;; Version: 1.0.4 +;; Keywords: extensions lisp +;; Prefix: let-alist +;; Separator: - + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +;;; Commentary: + +;; This package offers a single macro, `let-alist'. This macro takes a +;; first argument (whose value must be an alist) and a body. +;; +;; The macro expands to a let form containing body, where each dotted +;; symbol inside body is let-bound to their cdrs in the alist. Dotted +;; symbol is any symbol starting with a `.'. Only those present in +;; the body are let-bound and this search is done at compile time. +;; +;; For instance, the following code +;; +;; (let-alist alist +;; (if (and .title .body) +;; .body +;; .site +;; .site.contents)) +;; +;; essentially expands to +;; +;; (let ((.title (cdr (assq 'title alist))) +;; (.body (cdr (assq 'body alist))) +;; (.site (cdr (assq 'site alist))) +;; (.site.contents (cdr (assq 'contents (cdr (assq 'site alist)))))) +;; (if (and .title .body) +;; .body +;; .site +;; .site.contents)) +;; +;; If you nest `let-alist' invocations, the inner one can't access +;; the variables of the outer one. You can, however, access alists +;; inside the original alist by using dots inside the symbol, as +;; displayed in the example above by the `.site.contents'. +;; +;;; Code: + + +(defun let-alist--deep-dot-search (data) + "Return alist of symbols inside DATA that start with a `.'. +Perform a deep search and return an alist where each car is the +symbol, and each cdr is the same symbol without the `.'." + (cond + ((symbolp data) + (let ((name (symbol-name data))) + (when (string-match "\\`\\." name) + ;; Return the cons cell inside a list, so it can be appended + ;; with other results in the clause below. + (list (cons data (intern (replace-match "" nil nil name))))))) + ((not (consp data)) nil) + (t (append (let-alist--deep-dot-search (car data)) + (let-alist--deep-dot-search (cdr data)))))) + +(defun let-alist--access-sexp (symbol variable) + "Return a sexp used to access SYMBOL inside VARIABLE." + (let* ((clean (let-alist--remove-dot symbol)) + (name (symbol-name clean))) + (if (string-match "\\`\\." name) + clean + (let-alist--list-to-sexp + (mapcar #'intern (nreverse (split-string name "\\."))) + variable)))) + +(defun let-alist--list-to-sexp (list var) + "Turn symbols LIST into recursive calls to `cdr' `assq' on VAR." + `(cdr (assq ',(car list) + ,(if (cdr list) (let-alist--list-to-sexp (cdr list) var) + var)))) + +(defun let-alist--remove-dot (symbol) + "Return SYMBOL, sans an initial dot." + (let ((name (symbol-name symbol))) + (if (string-match "\\`\\." name) + (intern (replace-match "" nil nil name)) + symbol))) + + +;;; The actual macro. +;;;###autoload +(defmacro let-alist (alist &rest body) + "Let-bind dotted symbols to their cdrs in ALIST and execute BODY. +Dotted symbol is any symbol starting with a `.'. Only those present +in BODY are let-bound and this search is done at compile time. + +For instance, the following code + + (let-alist alist + (if (and .title .body) + .body + .site + .site.contents)) + +essentially expands to + + (let ((.title (cdr (assq 'title alist))) + (.body (cdr (assq 'body alist))) + (.site (cdr (assq 'site alist))) + (.site.contents (cdr (assq 'contents (cdr (assq 'site alist)))))) + (if (and .title .body) + .body + .site + .site.contents)) + +If you nest `let-alist' invocations, the inner one can't access +the variables of the outer one. You can, however, access alists +inside the original alist by using dots inside the symbol, as +displayed in the example above." + (declare (indent 1) (debug t)) + (let ((var (make-symbol "alist"))) + `(let ((,var ,alist)) + (let ,(mapcar (lambda (x) `(,(car x) ,(let-alist--access-sexp (car x) var))) + (delete-dups (let-alist--deep-dot-search body))) + ,@body)))) + +;;;; ChangeLog: + +;; 2015-06-11 Artur Malabarba +;; +;; * let-alist (let-alist--deep-dot-search): Fix cons +;; +;; 2015-03-07 Artur Malabarba +;; +;; let-alist: Update copyright +;; +;; 2014-12-22 Artur Malabarba +;; +;; packages/let-alist: Use `make-symbol' instead of `gensym'. +;; +;; 2014-12-20 Artur Malabarba +;; +;; packages/let-alist: Enable access to deeper alists +;; +;; 2014-12-14 Artur Malabarba +;; +;; let-alist.el: Add lexical binding. Version bump. +;; +;; 2014-12-11 Artur Malabarba +;; +;; let-alist: New package +;; + + +(provide 'let-alist) + +;;; let-alist.el ends here diff --git a/elpa/markdown-mode-20150703.1903/markdown-mode-autoloads.el b/elpa/markdown-mode-20150703.1903/markdown-mode-autoloads.el new file mode 100644 index 00000000..227ef9b5 --- /dev/null +++ b/elpa/markdown-mode-20150703.1903/markdown-mode-autoloads.el @@ -0,0 +1,33 @@ +;;; markdown-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) + +;;;### (autoloads nil "markdown-mode" "markdown-mode.el" (21913 4078 +;;;;;; 0 0)) +;;; Generated autoloads from markdown-mode.el + +(autoload 'markdown-mode "markdown-mode" "\ +Major mode for editing Markdown files. + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) + +(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode)) + +(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) + +(autoload 'gfm-mode "markdown-mode" "\ +Major mode for editing GitHub Flavored Markdown files. + +\(fn)" t nil) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; markdown-mode-autoloads.el ends here diff --git a/elpa/markdown-mode-20150703.1903/markdown-mode-pkg.el b/elpa/markdown-mode-20150703.1903/markdown-mode-pkg.el new file mode 100644 index 00000000..b777e46e --- /dev/null +++ b/elpa/markdown-mode-20150703.1903/markdown-mode-pkg.el @@ -0,0 +1 @@ +(define-package "markdown-mode" "20150703.1903" "Emacs Major mode for Markdown-formatted text files" 'nil :url "http://jblevins.org/projects/markdown-mode/" :keywords '("markdown" "github flavored markdown" "itex")) diff --git a/elpa/markdown-mode-20150703.1903/markdown-mode.el b/elpa/markdown-mode-20150703.1903/markdown-mode.el new file mode 100644 index 00000000..b5365008 --- /dev/null +++ b/elpa/markdown-mode-20150703.1903/markdown-mode.el @@ -0,0 +1,4896 @@ +;;; markdown-mode.el --- Emacs Major mode for Markdown-formatted text files + +;; Copyright (C) 2007-2015 Jason R. Blevins +;; Copyright (C) 2007, 2009 Edward O'Connor +;; Copyright (C) 2007 Conal Elliott +;; Copyright (C) 2008 Greg Bognar +;; Copyright (C) 2008 Dmitry Dzhus +;; Copyright (C) 2008 Bryan Kyle +;; Copyright (C) 2008 Ben Voui +;; Copyright (C) 2009 Ankit Solanki +;; Copyright (C) 2009 Hilko Bengen +;; Copyright (C) 2009 Peter Williams +;; Copyright (C) 2010 George Ogata +;; Copyright (C) 2011 Eric Merritt +;; Copyright (C) 2011 Philippe Ivaldi +;; Copyright (C) 2011 Jeremiah Dodds +;; Copyright (C) 2011 Christopher J. Madsen +;; Copyright (C) 2011 Shigeru Fukaya +;; Copyright (C) 2011 Joost Kremers +;; Copyright (C) 2011-2012 Donald Ephraim Curtis +;; Copyright (C) 2012 Akinori Musha +;; Copyright (C) 2012 Zhenlei Jia +;; Copyright (C) 2012 Peter Jones +;; Copyright (C) 2013 Matus Goljer +;; Copyright (C) 2015 Google, Inc. (Contributor: Samuel Freilich ) +;; Copyright (C) 2015 Antonis Kanouras + +;; Author: Jason R. Blevins +;; Maintainer: Jason R. Blevins +;; Created: May 24, 2007 +;; Version: 2.0 +;; Package-Version: 20150703.1903 +;; Keywords: Markdown, GitHub Flavored Markdown, itex +;; URL: http://jblevins.org/projects/markdown-mode/ + +;; This file is not part of GNU Emacs. + +;; 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 2, 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, write to the Free Software +;; Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; markdown-mode is a major mode for editing [Markdown][]-formatted +;; text files in GNU Emacs. markdown-mode is free software, licensed +;; under the GNU GPL. +;; +;; [Markdown]: http://daringfireball.net/projects/markdown/ +;; +;; The latest stable version is markdown-mode 2.0, released on March 24, 2013: +;; +;; * [markdown-mode.el][] +;; * [Screenshot][][^theme] +;; * [Release notes][] +;; +;; [markdown-mode.el]: http://jblevins.org/projects/markdown-mode/markdown-mode.el +;; [Screenshot]: http://jblevins.org/projects/markdown-mode/screenshots/20130131-002.png +;; [Release notes]: http://jblevins.org/projects/markdown-mode/rev-2-0 +;; +;; [^theme]: The theme used in the screenshot is +;; [color-theme-twilight](https://github.com/crafterm/twilight-emacs). +;; +;; markdown-mode is also available in several package managers, including: +;; +;; * Debian Linux: [emacs-goodies-el][] +;; * Ubuntu Linux: [emacs-goodies-el][emacs-goodies-el-ubuntu] +;; * RedHat and Fedora Linux: [emacs-goodies][] +;; * NetBSD: [textproc/markdown-mode][] +;; * Arch Linux (AUR): [emacs-markdown-mode-git][] +;; * MacPorts: [markdown-mode.el][macports-package] ([pending][macports-ticket]) +;; * FreeBSD: [textproc/markdown-mode.el][freebsd-port] +;; +;; [emacs-goodies-el]: http://packages.debian.org/emacs-goodies-el +;; [emacs-goodies-el-ubuntu]: http://packages.ubuntu.com/search?keywords=emacs-goodies-el +;; [emacs-goodies]: https://apps.fedoraproject.org/packages/emacs-goodies +;; [textproc/markdown-mode]: http://pkgsrc.se/textproc/markdown-mode +;; [emacs-markdown-mode-git]: https://aur.archlinux.org/packages/emacs-goodies-el/ +;; [macports-package]: https://trac.macports.org/browser/trunk/dports/editors/markdown-mode.el/Portfile +;; [macports-ticket]: http://trac.macports.org/ticket/35716 +;; [freebsd-port]: http://svnweb.freebsd.org/ports/head/textproc/markdown-mode.el +;; +;; The latest development version can be downloaded directly +;; ([markdown-mode.el][devel.el]) or it can be obtained from the +;; (browsable and clonable) Git repository at +;; . The entire repository, +;; including the full project history, can be cloned via the Git protocol +;; by running +;; +;; git clone git://jblevins.org/git/markdown-mode.git +;; +;; [devel.el]: http://jblevins.org/git/markdown-mode.git/plain/markdown-mode.el + +;;; Installation: + +;; Make sure to place `markdown-mode.el` somewhere in the load-path and add +;; the following lines to your `.emacs` file to associate markdown-mode +;; with `.text`, `.markdown`, and `.md` files: +;; +;; (autoload 'markdown-mode "markdown-mode" +;; "Major mode for editing Markdown files" t) +;; (add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode)) +;; (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) +;; (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) +;; +;; There is no official Markdown file extension, nor is there even a +;; _de facto_ standard, so you can easily add, change, or remove any +;; of the file extensions above as needed. + +;;; Usage: + +;; Keybindings are grouped by prefixes based on their function. For +;; example, the commands for inserting links are grouped under `C-c +;; C-a`, where the `C-a` is a mnemonic for the HTML `` tag. In +;; other cases, the connection to HTML is not direct. For example, +;; commands dealing with headings begin with `C-c C-t` (mnemonic: +;; titling). The primary commands in each group will are described +;; below. You can obtain a list of all keybindings by pressing `C-c +;; C-h`. Movement and shifting commands tend to be associated with +;; paired delimiters such as `M-{` and `M-}` or `C-c <` and `C-c >`. +;; Outline navigation keybindings the same as in `org-mode'. Finally, +;; commands for running Markdown or doing maintenance on an open file +;; are grouped under the `C-c C-c` prefix. The most commonly used +;; commands are described below. You can obtain a list of all +;; keybindings by pressing `C-c C-h`. +;; +;; * Hyperlinks: `C-c C-a` +;; +;; In this group, `C-c C-a l` inserts an inline link of the form +;; `[text](url)`. The link text is determined as follows. First, +;; if there is an active region (i.e., when transient mark mode is +;; on and the mark is active), use it as the link text. Second, +;; if the point is at a word, use that word as the link text. In +;; these two cases, the original text will be replaced with the +;; link and point will be left at the position for inserting a +;; URL. Otherwise, insert empty link markup and place the point +;; for inserting the link text. +;; +;; `C-c C-a L` inserts a reference link of the form `[text][label]` +;; and, optionally, a corresponding reference label definition. +;; The link text is determined in the same way as with an inline +;; link (using the region, when active, or the word at the point), +;; but instead of inserting empty markup as a last resort, the +;; link text will be read from the minibuffer. The reference +;; label will be read from the minibuffer in both cases, with +;; completion from the set of currently defined references. To +;; create an implicit reference link, press `RET` to accept the +;; default, an empty label. If the entered referenced label is +;; not defined, additionally prompt for the URL and (optional) +;; title. If a URL is provided, a reference definition will be +;; inserted in accordance with `markdown-reference-location'. +;; If a title is given, it will be added to the end of the +;; reference definition and will be used to populate the title +;; attribute when converted to XHTML. +;; +;; `C-c C-a u` inserts a bare url, delimited by angle brackets. When +;; there is an active region, the text in the region is used as the +;; URL. If the point is at a URL, that url is used. Otherwise, +;; insert angle brackets and position the point in between them +;; for inserting the URL. +;; +;; `C-c C-a f` inserts a footnote marker at the point, inserts a +;; footnote definition below, and positions the point for +;; inserting the footnote text. Note that footnotes are an +;; extension to Markdown and are not supported by all processors. +;; +;; `C-c C-a w` behaves much like the inline link insertion command +;; and inserts a wiki link of the form `[[WikiLink]]`. If there +;; is an active region, use the region as the link text. If the +;; point is at a word, use the word as the link text. If there is +;; no active region and the point is not at word, simply insert +;; link markup. Note that wiki links are an extension to Markdown +;; and are not supported by all processors. +;; +;; * Images: `C-c C-i` +;; +;; `C-c C-i i` inserts markup for an inline image, using the +;; active region or the word at point, if any, as the alt text. +;; `C-c C-i I` behaves similarly and inserts a reference-style +;; image. +;; +;; * Styles: `C-c C-s` +;; +;; `C-c C-s e` inserts markup to make a region or word italic (`e` +;; for `` or emphasis). If there is an active region, make +;; the region italic. If the point is at a non-italic word, make +;; the word italic. If the point is at an italic word or phrase, +;; remove the italic markup. Otherwise, simply insert italic +;; delimiters and place the cursor in between them. Similarly, +;; use `C-c C-s s` for bold (``) and `C-c C-s c` for +;; inline code (``). +;; +;; `C-c C-s b` inserts a blockquote using the active region, if any, +;; or starts a new blockquote. `C-c C-s C-b` is a variation which +;; always operates on the region, regardless of whether it is +;; active or not. The appropriate amount of indentation, if any, +;; is calculated automatically given the surrounding context, but +;; may be adjusted later using the region indentation commands. +;; +;; `C-c C-s p` behaves similarly for inserting preformatted code +;; blocks, with `C-c C-s C-p` being the region-only counterpart. +;; +;; * Headings: `C-c C-t` +;; +;; All heading insertion commands use the text in the active +;; region, if any, as the heading text. Otherwise, if the current +;; line is not blank, they use the text on the current line. +;; Finally, the setext commands will prompt for heading text if +;; there is no active region and the current line is blank. +;; +;; `C-c C-t h` inserts a heading with automatically chosen type and +;; level (both determined by the previous heading). `C-c C-t H` +;; behaves similarly, but uses setext (underlined) headings when +;; possible, still calculating the level automatically. +;; In cases where the automatically-determined level is not what +;; you intended, the level can be quickly promoted or demoted +;; (as described below). Alternatively, a `C-u` prefix can be +;; given to insert a heading promoted by one level or a `C-u C-u` +;; prefix can be given to insert a heading demoted by one level. +;; +;; To insert a heading of a specific level and type, use `C-c C-t 1` +;; through `C-c C-t 6` for atx (hash mark) headings and `C-c C-t !` or +;; `C-c C-t @` for setext headings of level one or two, respectively. +;; Note that `!` is `S-1` and `@` is `S-2`. +;; +;; If the point is at a heading, these commands will replace the +;; existing markup in order to update the level and/or type of the +;; heading. To remove the markup of the heading at the point, +;; press `C-c C-k` to kill the heading and press `C-y` to yank the +;; heading text back into the buffer. +;; +;; * Horizontal Rules: `C-c -` +;; +;; `C-c -` inserts a horizontal rule. By default, insert the +;; first string in the list `markdown-hr-strings' (the most +;; prominent rule). With a `C-u` prefix, insert the last string. +;; With a numeric prefix `N`, insert the string in position `N` +;; (counting from 1). +;; +;; * Markdown and Maintenance Commands: `C-c C-c` +;; +;; *Compile:* `C-c C-c m` will run Markdown on the current buffer +;; and show the output in another buffer. *Preview*: `C-c C-c p` +;; runs Markdown on the current buffer and previews, stores the +;; output in a temporary file, and displays the file in a browser. +;; *Export:* `C-c C-c e` will run Markdown on the current buffer +;; and save the result in the file `basename.html`, where +;; `basename` is the name of the Markdown file with the extension +;; removed. *Export and View:* press `C-c C-c v` to export the +;; file and view it in a browser. **For both export commands, the +;; output file will be overwritten without notice.** +;; *Open:* `C-c C-c o` will open the Markdown source file directly +;; using `markdown-open-command'. +;; +;; To summarize: +;; +;; - `C-c C-c m`: `markdown-command' > `*markdown-output*` buffer. +;; - `C-c C-c p`: `markdown-command' > temporary file > browser. +;; - `C-c C-c e`: `markdown-command' > `basename.html`. +;; - `C-c C-c v`: `markdown-command' > `basename.html` > browser. +;; - `C-c C-c w`: `markdown-command' > kill ring. +;; - `C-c C-c o`: `markdown-open-command'. +;; +;; `C-c C-c c` will check for undefined references. If there are +;; any, a small buffer will open with a list of undefined +;; references and the line numbers on which they appear. In Emacs +;; 22 and greater, selecting a reference from this list and +;; pressing `RET` will insert an empty reference definition at the +;; end of the buffer. Similarly, selecting the line number will +;; jump to the corresponding line. +;; +;; `C-c C-c n` renumbers any ordered lists in the buffer that are +;; out of sequence. +;; +;; `C-c C-c ]` completes all headings and normalizes all horizontal +;; rules in the buffer. +;; +;; * Following Links: `C-c C-o` +;; +;; Press `C-c C-o` when the point is on an inline or reference +;; link to open the URL in a browser. When the point is at a +;; wiki link, open it in another buffer (in the current window, +;; or in the other window with the `C-u` prefix). Use `M-p` and +;; `M-n` to quickly jump to the previous or next link of any type. +;; +;; * Jumping: `C-c C-j` +;; +;; Use `C-c C-j` to jump from the object at point to its counterpart +;; elsewhere in the text, when possible. Jumps between reference +;; links and definitions; between footnote markers and footnote +;; text. If more than one link uses the same reference name, a +;; new buffer will be created containing clickable buttons for jumping +;; to each link. You may press `TAB` or `S-TAB` to jump between +;; buttons in this window. +;; +;; * Promotion and Demotion: `C-c C--` and `C-c C-=` +;; +;; Headings, horizontal rules, and list items can be promoted and +;; demoted, as well as bold and italic text. For headings, +;; "promotion" means *decreasing* the level (i.e., moving from +;; `

` to `

`) while "demotion" means *increasing* the +;; level. For horizontal rules, promotion and demotion means +;; moving backward or forward through the list of rule strings in +;; `markdown-hr-strings'. For bold and italic text, promotion and +;; demotion means changing the markup from underscores to asterisks. +;; Press `C-c C--` or `M-LEFT` to promote the element at the point +;; if possible. +;; +;; To remember these commands, note that `-` is for decreasing the +;; level (promoting), and `=` (on the same key as `+`) is for +;; increasing the level (demoting). Similarly, the left and right +;; arrow keys indicate the direction that the atx heading markup +;; is moving in when promoting or demoting. +;; +;; * Completion: `C-c C-]` +;; +;; Complete markup is in normalized form, which means, for +;; example, that the underline portion of a setext header is the +;; same length as the heading text, or that the number of leading +;; and trailing hash marks of an atx header are equal and that +;; there is no extra whitespace in the header text. `C-c C-]` +;; completes the markup at the point, if it is determined to be +;; incomplete. +;; +;; * Editing Lists: `M-RET`, `M-UP`, `M-DOWN`, `M-LEFT`, and `M-RIGHT` +;; +;; New list items can be inserted with `M-RET`. This command +;; determines the appropriate marker (one of the possible +;; unordered list markers or the next number in sequence for an +;; ordered list) and indentation level by examining nearby list +;; items. If there is no list before or after the point, start a +;; new list. Prefix this command by `C-u` to decrease the +;; indentation by one level. Prefix this command by `C-u C-u` to +;; increase the indentation by one level. +;; +;; Existing list items can be moved up or down with `M-UP` or +;; `M-DOWN` and indented or exdented with `M-RIGHT` or `M-LEFT`. +;; +;; * Shifting the Region: `C-c <` and `C-c >` +;; +;; Text in the region can be indented or exdented as a group using +;; `C-c >` to indent to the next indentation point (calculated in +;; the current context), and `C-c <` to exdent to the previous +;; indentation point. These keybindings are the same as those for +;; similar commands in `python-mode'. +;; +;; * Killing Elements: `C-c C-k` +;; +;; Press `C-c C-k` to kill the thing at point and add important +;; text, without markup, to the kill ring. Possible things to +;; kill include (roughly in order of precedece): inline code, +;; headings, horizonal rules, links (add link text to kill ring), +;; images (add alt text to kill ring), angle URIs, email +;; addresses, bold, italics, reference definitions (add URI to +;; kill ring), footnote markers and text (kill both marker and +;; text, add text to kill ring), and list items. +;; +;; * Outline Navigation: `C-c C-n`, `C-c C-p`, `C-c C-f`, `C-c C-b`, and `C-c C-u` +;; +;; Navigation between headings is possible using `outline-mode'. +;; Use `C-c C-n` and `C-c C-p` to move between the next and previous +;; visible headings. Similarly, `C-c C-f` and `C-c C-b` move to the +;; next and previous visible headings at the same level as the one +;; at the point. Finally, `C-c C-u` will move up to a lower-level +;; (higher precedence) visible heading. +;; +;; * Movement by Paragraph or Block: `M-{` and `M-}` +;; +;; The definition of a "paragraph" is slightly different in +;; markdown-mode than, say, text-mode, because markdown-mode +;; supports filling for list items and respects hard line breaks, +;; both of which break paragraphs. So, markdown-mode overrides +;; the usual paragraph navigation commands `M-{` and `M-}` so that +;; with a `C-u` prefix, these commands jump to the beginning or +;; end of an entire block of text, respectively, where "blocks" +;; are separated by one or more lines. +;; +;; * Movement by Defun: `C-M-a`, `C-M-e`, and `C-M-h` +;; +;; The usual Emacs commands can be used to move by defuns +;; (top-level major definitions). In markdown-mode, a defun is a +;; section. As usual, `C-M-a` will move the point to the +;; beginning of the current or preceding defun, `C-M-e` will move +;; to the end of the current or following defun, and `C-M-h` will +;; put the region around the entire defun. +;; +;; As noted, many of the commands above behave differently depending +;; on whether Transient Mark mode is enabled or not. When it makes +;; sense, if Transient Mark mode is on and the region is active, the +;; command applies to the text in the region (e.g., `C-c C-s s` makes the +;; region bold). For users who prefer to work outside of Transient +;; Mark mode, since Emacs 22 it can be enabled temporarily by pressing +;; `C-SPC C-SPC`. When this is not the case, many commands then +;; proceed to look work with the word or line at the point. +;; +;; When applicable, commands that specifically act on the region even +;; outside of Transient Mark mode have the same keybinding as their +;; standard counterpart, but the letter is uppercase. For example, +;; `markdown-insert-blockquote' is bound to `C-c C-s b` and only acts on +;; the region in Transient Mark mode while `markdown-blockquote-region' +;; is bound to `C-c C-s B` and always applies to the region (when nonempty). +;; +;; Note that these region-specific functions are useful in many +;; cases where it may not be obvious. For example, yanking text from +;; the kill ring sets the mark at the beginning of the yanked text +;; and moves the point to the end. Therefore, the (inactive) region +;; contains the yanked text. So, `C-y` followed by `C-c C-s C-b` will +;; yank text and turn it into a blockquote. +;; +;; markdown-mode attempts to be flexible in how it handles +;; indentation. When you press `TAB` repeatedly, the point will cycle +;; through several possible indentation levels corresponding to things +;; you might have in mind when you press `RET` at the end of a line or +;; `TAB`. For example, you may want to start a new list item, +;; continue a list item with hanging indentation, indent for a nested +;; pre block, and so on. Exdention is handled similarly when backspace +;; is pressed at the beginning of the non-whitespace portion of a line. +;; +;; markdown-mode supports outline-minor-mode as well as org-mode-style +;; visibility cycling for atx- or hash-style headings. There are two +;; types of visibility cycling: Pressing `S-TAB` cycles globally between +;; the table of contents view (headings only), outline view (top-level +;; headings only), and the full document view. Pressing `TAB` while the +;; point is at a heading will cycle through levels of visibility for the +;; subtree: completely folded, visible children, and fully visible. +;; Note that mixing hash and underline style headings will give undesired +;; results. + +;;; Customization: + +;; Although no configuration is *necessary* there are a few things +;; that can be customized. The `M-x customize-mode` command +;; provides an interface to all of the possible customizations: +;; +;; * `markdown-command' - the command used to run Markdown (default: +;; `markdown`). This variable may be customized to pass +;; command-line options to your Markdown processor of choice. +;; +;; * `markdown-command-needs-filename' - set to `t' if +;; `markdown-command' does not accept standard input (default: +;; `nil'). When `nil', `markdown-mode' will pass the Markdown +;; content to `markdown-command' using standard input (`stdin`). +;; When set to `t', `markdown-mode' will pass the name of the file +;; as the final command-line argument to `markdown-command'. Note +;; that in the latter case, you will only be able to run +;; `markdown-command' from buffers which are visiting a file. +;; +;; * `markdown-open-command' - the command used for calling a standalone +;; Markdown previewer which is capable of opening Markdown source files +;; directly (default: `nil'). This command will be called +;; with a single argument, the filename of the current buffer. +;; A representative program is the Mac app [Marked 2][], a +;; live-updating Markdown previewer which can be [called from a +;; simple shell script](http://jblevins.org/log/marked-2-command). +;; +;; * `markdown-hr-strings' - list of strings to use when inserting +;; horizontal rules. Different strings will not be distinguished +;; when converted to HTML--they will all be converted to +;; `
`--but they may add visual distinction and style to plain +;; text documents. To maintain some notion of promotion and +;; demotion, keep these sorted from largest to smallest. +;; +;; * `markdown-bold-underscore' - set to a non-nil value to use two +;; underscores for bold instead of two asterisks (default: `nil'). +;; +;; * `markdown-italic-underscore' - set to a non-nil value to use +;; underscores for italic instead of asterisks (default: `nil'). +;; +;; * `markdown-indent-function' - the function to use for automatic +;; indentation (default: `markdown-indent-line'). +;; +;; * `markdown-indent-on-enter' - set to a non-nil value to +;; automatically indent new lines when the enter key is pressed +;; (default: `t') +;; +;; * `markdown-wiki-link-alias-first' - set to a non-nil value to +;; treat aliased wiki links like `[[link text|PageName]]` +;; (default: `t'). When set to nil, they will be treated as +;; `[[PageName|link text]]'. +;; +;; * `markdown-uri-types' - a list of protocol schemes (e.g., "http") +;; for URIs that `markdown-mode' should highlight. +;; +;; * `markdown-enable-math' - syntax highlighting for LaTeX +;; fragments (default: `nil'). Set this to `t' to turn on math +;; support by default. Math support can be toggled later using +;; the function `markdown-enable-math'." +;; +;; * `markdown-css-paths' - CSS files to link to in XHTML output +;; (default: `nil`). +;; +;; * `markdown-content-type' - when set to a nonempty string, an +;; `http-equiv` attribute will be included in the XHTML `` +;; block (default: `""`). If needed, the suggested values are +;; `application/xhtml+xml` or `text/html`. See also: +;; `markdown-coding-system'. +;; +;; * `markdown-coding-system' - used for specifying the character +;; set identifier in the `http-equiv` attribute when included +;; (default: `nil'). See `markdown-content-type', which must +;; be set before this variable has any effect. When set to `nil', +;; `buffer-file-coding-system' will be used to automatically +;; determine the coding system string (falling back to +;; `iso-8859-1' when unavailable). Common settings are `utf-8' +;; and `iso-latin-1'. +;; +;; * `markdown-xhtml-header-content' - additional content to include +;; in the XHTML `` block (default: `""`). +;; +;; * `markdown-xhtml-standalone-regexp' - a regular expression which +;; `markdown-mode' uses to determine whether the output of +;; `markdown-command' is a standalone XHTML document or an XHTML +;; fragment (default: `"^\\(<\\?xml\\|`. +;; +;; For GFM preview can be powered by setting `markdown-command' to +;; use [Docter][]. This may also be configured to work with [Marked 2][] +;; for `markdown-open-command'. +;; +;; [GFM]: http://github.github.com/github-flavored-markdown/ +;; [Docter]: https://github.com/alampros/Docter + +;;; Acknowledgments: + +;; markdown-mode has benefited greatly from the efforts of the +;; following people: +;; +;; * Cyril Brulebois for Debian packaging. +;; * Conal Elliott for a font-lock regexp patch. +;; * Edward O'Connor for a font-lock regexp fix and +;; GitHub Flavored Markdown mode (`gfm-mode'). +;; * Greg Bognar for menus and running +;; `markdown' with an active region. +;; * Daniel Burrows for filing Debian bug #456592. +;; * Peter S. Galbraith for maintaining `emacs-goodies-el`. +;; * Dmitry Dzhus for undefined reference checking. +;; * Carsten Dominik for `org-mode', from which the +;; visibility cycling functionality was derived, and for a bug fix +;; related to `orgtbl-mode'. +;; * Bryan Kyle for indentation code. +;; * Ben Voui for font-lock face customizations. +;; * Ankit Solanki for `longlines.el` +;; compatibility and custom CSS. +;; * Hilko Bengen for proper XHTML output. +;; * Jose A. Ortega Ruiz for Emacs 23 fixes. +;; * Nelson Minar for `html-helper-mode', from which +;; comment matching functions were derived. +;; * Alec Resnick for bug reports. +;; * Joost Kremers for footnote-handling +;; functions, bug reports regarding indentation, and +;; fixes for byte-compilation warnings. +;; * Peter Williams for `fill-paragraph' +;; enhancements. +;; * George Ogata for fixing several +;; byte-compilation warnings. +;; * Eric Merritt for wiki link features. +;; * Philippe Ivaldi for XHTML preview +;; customizations and XHTML export. +;; * Jeremiah Dodds for supporting +;; Markdown processors which do not accept input from stdin. +;; * Werner Dittmann for bug reports +;; regarding the `cl` dependency and `auto-fill-mode' and indentation. +;; * Scott Pfister for generalizing the space +;; substitution character for mapping wiki links to filenames. +;; * Marcin Kasperski for a patch to +;; escape shell commands. +;; * Christopher J. Madsen for patches to fix a match +;; data bug and to prefer `visual-line-mode' in `gfm-mode'. +;; * Shigeru Fukaya for better adherence to +;; Emacs Lisp coding conventions. +;; * Donald Ephraim Curtis for fixing the `fill-paragraph' +;; regexp, refactoring the compilation and preview functions, +;; heading font-lock generalizations, list renumbering, +;; and kill ring save. +;; * Kevin Porter for wiki link handling in `gfm-mode'. +;; * Max Penet and Peter Eisentraut +;; for an autoload token for `gfm-mode'. +;; * Ian Yang for improving the reference definition regex. +;; * Akinori Musha for an imenu index function. +;; * Michael Sperber for XEmacs fixes. +;; * Francois Gannaz for suggesting charset +;; declaration in XHTML output. +;; * Zhenlei Jia for smart exdention function. +;; * Matus Goljer for improved wiki link following +;; and GFM code block insertion. +;; * Peter Jones for link following functions. +;; * Bryan Fink for a bug report regarding +;; externally modified files. +;; * Vegard Vesterheim for a bug fix +;; related to `orgtbl-mode'. +;; * Makoto Motohashi for before- and after- +;; export hooks, unit test improvements, and updates to support +;; wide characters. +;; * Michael Dwyer for `gfm-mode' underscore regexp. +;; * Chris Lott for suggesting reference label +;; completion. +;; * Gunnar Franke for a completion bug report. +;; * David Glasser for a `paragraph-separate' fix. +;; * Daniel Brotsky for better auto-fill defaults. +;; * Samuel Freilich for improved filling +;; behavior regarding list items, footnotes, and reference +;; definitions, improved killing of footnotes, and numerous other +;; tests and bug fixes. +;; * Antonis Kanouras for strike through support. +;; * Tim Visher for multiple CSS files and other +;; general improvements. +;; * Matt McClure for a patch to prevent +;; overwriting source files with .html extensions upon export. +;; * Roger Bolsius for ordered list improvements. +;; * Google's Open Source Programs Office for recognizing the project with +;; a monetary contribution in June 2015. + +;;; Bugs: + +;; Although markdown-mode is developed and tested primarily using +;; GNU Emacs 24, compatibility with earlier Emacsen is also a +;; priority. +;; +;; If you find any bugs in markdown-mode, please construct a test case +;; or a patch and email me at . + +;;; History: + +;; markdown-mode was written and is maintained by Jason Blevins. The +;; first version was released on May 24, 2007. +;; +;; * 2007-05-24: Version 1.1 +;; * 2007-05-25: Version 1.2 +;; * 2007-06-05: [Version 1.3][] +;; * 2007-06-29: Version 1.4 +;; * 2007-10-11: [Version 1.5][] +;; * 2008-06-04: [Version 1.6][] +;; * 2009-10-01: [Version 1.7][] +;; * 2011-08-12: [Version 1.8][] +;; * 2011-08-15: [Version 1.8.1][] +;; * 2013-01-25: [Version 1.9][] +;; * 2013-03-24: [Version 2.0][] +;; +;; [Version 1.3]: http://jblevins.org/projects/markdown-mode/rev-1-3 +;; [Version 1.5]: http://jblevins.org/projects/markdown-mode/rev-1-5 +;; [Version 1.6]: http://jblevins.org/projects/markdown-mode/rev-1-6 +;; [Version 1.7]: http://jblevins.org/projects/markdown-mode/rev-1-7 +;; [Version 1.8]: http://jblevins.org/projects/markdown-mode/rev-1-8 +;; [Version 1.8.1]: http://jblevins.org/projects/markdown-mode/rev-1-8-1 +;; [Version 1.9]: http://jblevins.org/projects/markdown-mode/rev-1-9 +;; [Version 2.0]: http://jblevins.org/projects/markdown-mode/rev-2-0 + + +;;; Code: + +(require 'easymenu) +(require 'outline) +(require 'thingatpt) +(eval-when-compile (require 'cl)) + + +;;; Constants ================================================================= + +(defconst markdown-mode-version "2.0" + "Markdown mode version number.") + +(defconst markdown-output-buffer-name "*markdown-output*" + "Name of temporary buffer for markdown command output.") + + +;;; Global Variables ========================================================== + +(defvar markdown-reference-label-history nil + "History of used reference labels.") + + +;;; Customizable Variables ==================================================== + +(defvar markdown-mode-hook nil + "Hook run when entering Markdown mode.") + +(defvar markdown-before-export-hook nil + "Hook run before running Markdown to export XHTML output. +The hook may modify the buffer, which will be restored to it's +original state after exporting is complete.") + +(defvar markdown-after-export-hook nil + "Hook run after XHTML output has been saved. +Any changes to the output buffer made by this hook will be saved.") + +(defgroup markdown nil + "Major mode for editing text files in Markdown format." + :prefix "markdown-" + :group 'wp + :link '(url-link "http://jblevins.org/projects/markdown-mode/")) + +(defcustom markdown-command "markdown" + "Command to run markdown." + :group 'markdown + :type 'string) + +(defcustom markdown-command-needs-filename nil + "Set to non-nil if `markdown-command' does not accept input from stdin. +Instead, it will be passed a filename as the final command line +option. As a result, you will only be able to run Markdown from +buffers which are visiting a file." + :group 'markdown + :type 'boolean) + +(defcustom markdown-open-command nil + "Command used for opening Markdown files directly. +For example, a standalone Markdown previewer. This command will +be called with a single argument: the filename of the current +buffer." + :group 'markdown + :type 'string) + +(defcustom markdown-hr-strings + '("-------------------------------------------------------------------------------" + "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *" + "---------------------------------------" + "* * * * * * * * * * * * * * * * * * * *" + "---------" + "* * * * *") + "Strings to use when inserting horizontal rules. +The first string in the list will be the default when inserting a +horizontal rule. Strings should be listed in decreasing order of +prominence (as in headings from level one to six) for use with +promotion and demotion functions." + :group 'markdown + :type 'list) + +(defcustom markdown-bold-underscore nil + "Use two underscores for bold instead of two asterisks." + :group 'markdown + :type 'boolean) + +(defcustom markdown-italic-underscore nil + "Use underscores for italic instead of asterisks." + :group 'markdown + :type 'boolean) + +(defcustom markdown-indent-function 'markdown-indent-line + "Function to use to indent." + :group 'markdown + :type 'function) + +(defcustom markdown-indent-on-enter t + "Automatically indent new lines when enter key is pressed. +When this variable is set to t, pressing RET will call +`newline-and-indent'. When set to nil, define RET to call +`newline' as usual. In the latter case, you can still use +auto-indentation by pressing \\[newline-and-indent]." + :group 'markdown + :type 'boolean) + +(defcustom markdown-wiki-link-alias-first t + "When non-nil, treat aliased wiki links like [[alias text|PageName]]. +Otherwise, they will be treated as [[PageName|alias text]]." + :group 'markdown + :type 'boolean) + +(defcustom markdown-uri-types + '("acap" "cid" "data" "dav" "fax" "file" "ftp" "gopher" "http" "https" + "imap" "ldap" "mailto" "mid" "modem" "news" "nfs" "nntp" "pop" "prospero" + "rtsp" "service" "sip" "tel" "telnet" "tip" "urn" "vemmi" "wais") + "Link types for syntax highlighting of URIs." + :group 'markdown + :type 'list) + +(defcustom markdown-enable-math nil + "Syntax highlighting for inline LaTeX and itex expressions. +Set this to a non-nil value to turn on math support by default. +Math support can be toggled later using `markdown-enable-math' +or \\[markdown-enable-math]." + :group 'markdown + :type 'boolean + :safe 'booleanp) + +(defcustom markdown-css-paths nil + "URL of CSS file to link to in the output XHTML." + :group 'markdown + :type 'list) + +(defcustom markdown-content-type "" + "Content type string for the http-equiv header in XHTML output. +When set to a non-empty string, insert the http-equiv attribute. +Otherwise, this attribute is omitted." + :group 'markdown + :type 'string) + +(defcustom markdown-coding-system nil + "Character set string for the http-equiv header in XHTML output. +Defaults to `buffer-file-coding-system' (and falling back to +`iso-8859-1' when not available). Common settings are `utf-8' +and `iso-latin-1'. Use `list-coding-systems' for more choices." + :group 'markdown + :type 'coding-system) + +(defcustom markdown-xhtml-header-content "" + "Additional content to include in the XHTML block." + :group 'markdown + :type 'string) + +(defcustom markdown-xhtml-standalone-regexp + "^\\(<\\?xml\\|\\).*$" + "Regular expression for matching blockquote lines.") + +(defconst markdown-regex-line-break + "[^ \n\t][ \t]*\\( \\)$" + "Regular expression for matching line breaks.") + +(defconst markdown-regex-wiki-link + "\\(?:^\\|[^\\]\\)\\(\\[\\[\\([^]|]+\\)\\(|\\([^]]+\\)\\)?\\]\\]\\)" + "Regular expression for matching wiki links. +This matches typical bracketed [[WikiLinks]] as well as 'aliased' +wiki links of the form [[PageName|link text]]. In this regular +expression, group 1 matches the entire link, including square +brackets, group 2 matches the first component of the wiki link +and group 4 matches the second component, after the pipe, when +present. The meanings of the first and second components depend +on the value of `markdown-wiki-link-alias-first'.") + +(defconst markdown-regex-uri + (concat (regexp-opt markdown-uri-types) ":[^]\t\n\r<>,;() ]+") + "Regular expression for matching inline URIs.") + +(defconst markdown-regex-angle-uri + (concat "\\(<\\)\\(" (regexp-opt markdown-uri-types) ":[^]\t\n\r<>,;()]+\\)\\(>\\)") + "Regular expression for matching inline URIs in angle brackets.") + +(defconst markdown-regex-email + "<\\(\\(\\sw\\|\\s_\\|\\s.\\)+@\\(\\sw\\|\\s_\\|\\s.\\)+\\)>" + "Regular expression for matching inline email addresses.") + +(defconst markdown-regex-link-generic + (concat "\\(?:" markdown-regex-wiki-link + "\\|" markdown-regex-link-inline + "\\|" markdown-regex-link-reference + "\\|" markdown-regex-angle-uri "\\)") + "Regular expression for matching any recognized link.") + +(defconst markdown-regex-block-separator + "\\(\\`\\|\\(\n[ \t]*\n\\)[^\n \t]\\)" + "Regular expression for matching block boundaries.") + +(defconst markdown-regex-math-inline + "\\(^\\|[^\\]\\)\\(\\$\\($\\([^\\$]\\|\\\\.\\)*\\$\\|\\([^\\$]\\|\\\\.\\)*\\)\\$\\)" + "Regular expression for itex $..$ or $$..$$ math mode expressions.") + +(defconst markdown-regex-math-display + "^\\\\\\[\\(.\\|\n\\)*?\\\\\\]$" + "Regular expression for itex \[..\] display mode expressions.") + +(defconst markdown-regex-multimarkdown-metadata + "^\\([[:alpha:]][[:alpha:] _-]*?\\):[ \t]*\\(.*\\)$" + "Regular expression for matching MultiMarkdown metadata.") + +(defconst markdown-regex-pandoc-metadata + "^\\(%\\)[ \t]*\\(.*\\)$" + "Regular expression for matching Pandoc metadata.") + +(defvar markdown-mode-font-lock-keywords-basic + (list + (cons 'markdown-match-gfm-code-blocks '((1 markdown-pre-face) + (2 markdown-language-keyword-face t t) + (3 markdown-pre-face) + (4 markdown-pre-face))) + (cons 'markdown-match-fenced-code-blocks '((0 markdown-pre-face))) + (cons 'markdown-match-pre-blocks '((0 markdown-pre-face))) + (cons markdown-regex-blockquote 'markdown-blockquote-face) + (cons markdown-regex-header-1-setext '((1 markdown-header-face-1) + (2 markdown-header-rule-face))) + (cons markdown-regex-header-2-setext '((1 markdown-header-face-2) + (2 markdown-header-rule-face))) + (cons markdown-regex-header-6-atx '((1 markdown-header-delimiter-face) + (2 markdown-header-face-6) + (3 markdown-header-delimiter-face))) + (cons markdown-regex-header-5-atx '((1 markdown-header-delimiter-face) + (2 markdown-header-face-5) + (3 markdown-header-delimiter-face))) + (cons markdown-regex-header-4-atx '((1 markdown-header-delimiter-face) + (2 markdown-header-face-4) + (3 markdown-header-delimiter-face))) + (cons markdown-regex-header-3-atx '((1 markdown-header-delimiter-face) + (2 markdown-header-face-3) + (3 markdown-header-delimiter-face))) + (cons markdown-regex-header-2-atx '((1 markdown-header-delimiter-face) + (2 markdown-header-face-2) + (3 markdown-header-delimiter-face))) + (cons markdown-regex-header-1-atx '((1 markdown-header-delimiter-face) + (2 markdown-header-face-1) + (3 markdown-header-delimiter-face))) + (cons 'markdown-match-multimarkdown-metadata '((1 markdown-metadata-key-face) + (2 markdown-metadata-value-face))) + (cons 'markdown-match-pandoc-metadata '((1 markdown-comment-face) + (2 markdown-metadata-value-face))) + (cons markdown-regex-hr 'markdown-header-face) + (cons 'markdown-match-comments '((0 markdown-comment-face))) + (cons 'markdown-match-code '((0 markdown-inline-code-face))) + (cons markdown-regex-angle-uri 'markdown-link-face) + (cons markdown-regex-uri 'markdown-link-face) + (cons markdown-regex-email 'markdown-link-face) + (cons markdown-regex-list '(2 markdown-list-face)) + (cons markdown-regex-footnote 'markdown-footnote-face) + (cons markdown-regex-link-inline '((1 markdown-link-face t t) + (2 markdown-link-face t) + (4 markdown-url-face t) + (6 markdown-link-title-face t t))) + (cons markdown-regex-link-reference '((1 markdown-link-face t t) + (2 markdown-link-face t) + (4 markdown-reference-face t))) + (cons markdown-regex-reference-definition '((1 markdown-reference-face t) + (2 markdown-url-face t) + (3 markdown-link-title-face t))) + (cons markdown-regex-bold '(2 markdown-bold-face)) + (cons markdown-regex-line-break '(1 markdown-line-break-face prepend)) + ) + "Syntax highlighting for Markdown files.") + +(defvar markdown-mode-font-lock-keywords-core + (list + (cons markdown-regex-italic '(2 markdown-italic-face)) + ) + "Additional syntax highlighting for Markdown files. +Includes features which are overridden by some variants.") + +(defconst markdown-mode-font-lock-keywords-math + (list + ;; Math mode $..$ or $$..$$ + (cons markdown-regex-math-inline '(2 markdown-math-face)) + ;; Display mode equations with brackets: \[ \] + (cons markdown-regex-math-display 'markdown-math-face) + ;; Equation reference (eq:foo) + (cons "(eq:[[:alnum:]:_]+)" 'markdown-reference-face) + ;; Equation reference \eqref{foo} + (cons "\\\\eqref{[[:alnum:]:_]+}" 'markdown-reference-face)) + "Syntax highlighting for LaTeX and itex fragments.") + +(defvar markdown-mode-font-lock-keywords nil + "Default highlighting expressions for Markdown mode. +This variable is defined as a buffer-local variable for dynamic +extension support.") + +;; Footnotes +(defvar markdown-footnote-counter 0 + "Counter for footnote numbers.") +(make-variable-buffer-local 'markdown-footnote-counter) + +(defconst markdown-footnote-chars + "[[:alnum:]-]" + "Regular expression maching any character that is allowed in a footnote identifier.") + +(defconst markdown-regex-footnote-definition + (concat "^\\[\\(\\^" markdown-footnote-chars "*?\\)\\]:\\(?:[ \t]+\\|$\\)") + "Regular expression matching a footnote definition, capturing the label.") + + +;;; Compatibility ============================================================= + +(defun markdown-replace-regexp-in-string (regexp rep string) + "Replace ocurrences of REGEXP with REP in STRING. +This is a compatibility wrapper to provide `replace-regexp-in-string' +in XEmacs 21." + (if (featurep 'xemacs) + (replace-in-string string regexp rep) + (replace-regexp-in-string regexp rep string))) + +;; `markdown-use-region-p' is a compatibility function which checks +;; for an active region, with fallbacks for older Emacsen and XEmacs. +(eval-and-compile + (cond + ;; Emacs 23 and newer + ((fboundp 'use-region-p) + (defalias 'markdown-use-region-p 'use-region-p)) + ;; Older Emacsen + ((and (boundp 'transient-mark-mode) (boundp 'mark-active)) + (defun markdown-use-region-p () + "Compatibility wrapper to provide `use-region-p'." + (and transient-mark-mode mark-active))) + ;; XEmacs + ((fboundp 'region-active-p) + (defalias 'markdown-use-region-p 'region-active-p)))) + +(defun markdown-use-buttons-p () + "Determine whether this Emacs supports buttons." + (or (featurep 'button) (locate-library "button"))) + + +;;; Markdown Parsing Functions ================================================ + +(defun markdown-cur-line-blank-p () + "Return t if the current line is blank and nil otherwise." + (save-excursion + (beginning-of-line) + (re-search-forward "^\\s *$" (line-end-position) t))) + +(defun markdown-prev-line-blank-p () + "Return t if the previous line is blank and nil otherwise. +If we are at the first line, then consider the previous line to be blank." + (or (= (line-beginning-position) (point-min)) + (save-excursion + (forward-line -1) + (markdown-cur-line-blank-p)))) + +(defun markdown-next-line-blank-p () + "Return t if the next line is blank and nil otherwise. +If we are at the last line, then consider the next line to be blank." + (or (= (line-end-position) (point-max)) + (save-excursion + (forward-line 1) + (markdown-cur-line-blank-p)))) + +(defun markdown-prev-line-indent-p () + "Return t if the previous line is indented and nil otherwise." + (save-excursion + (if (= (line-beginning-position) (point-min)) + nil + (forward-line -1) + (goto-char (line-beginning-position)) + (if (re-search-forward "^\\s " (line-end-position) t) t)))) + +(defun markdown-cur-line-indent () + "Return the number of leading whitespace characters in the current line." + (save-match-data + (save-excursion + (goto-char (line-beginning-position)) + (re-search-forward "^[ \t]+" (line-end-position) t) + (current-column)))) + +(defun markdown-prev-line-indent () + "Return the number of leading whitespace characters in the previous line. +Return 0 if the current line is the first line in the buffer." + (save-excursion + (if (= (line-beginning-position) (point-min)) + 0 + (forward-line -1) + (markdown-cur-line-indent)))) + +(defun markdown-next-line-indent () + "Return the number of leading whitespace characters in the next line. +Return 0 if line is the last line in the buffer." + (save-excursion + (if (= (line-end-position) (point-max)) + 0 + (forward-line 1) + (markdown-cur-line-indent)))) + +(defun markdown-cur-non-list-indent () + "Return beginning position of list item text (not including the list marker). +Return nil if the current line is not the beginning of a list item." + (save-match-data + (save-excursion + (beginning-of-line) + (when (re-search-forward markdown-regex-list (line-end-position) t) + (current-column))))) + +(defun markdown-prev-non-list-indent () + "Return position of the first non-list-marker on the previous line." + (save-excursion + (forward-line -1) + (markdown-cur-non-list-indent))) + +(defun markdown-new-baseline-p () + "Determine if the current line begins a new baseline level." + (save-excursion + (beginning-of-line) + (save-match-data + (or (looking-at markdown-regex-header) + (looking-at markdown-regex-hr) + (and (null (markdown-cur-non-list-indent)) + (= (markdown-cur-line-indent) 0) + (markdown-prev-line-blank-p)))))) + +(defun markdown-search-backward-baseline () + "Search backward baseline point with no indentation and not a list item." + (end-of-line) + (let (stop) + (while (not (or stop (bobp))) + (re-search-backward markdown-regex-block-separator nil t) + (when (match-end 2) + (goto-char (match-end 2)) + (cond + ((markdown-new-baseline-p) + (setq stop t)) + ((looking-at markdown-regex-list) + (setq stop nil)) + (t (setq stop t))))))) + +(defun markdown-update-list-levels (marker indent levels) + "Update list levels given list MARKER, block INDENT, and current LEVELS. +Here, MARKER is a string representing the type of list, INDENT is an integer +giving the indentation, in spaces, of the current block, and LEVELS is a +list of the indentation levels of parent list items. When LEVELS is nil, +it means we are at baseline (not inside of a nested list)." + (cond + ;; New list item at baseline. + ((and marker (null levels)) + (setq levels (list indent))) + ;; List item with greater indentation (four or more spaces). + ;; Increase list level. + ((and marker (>= indent (+ (car levels) 4))) + (setq levels (cons indent levels))) + ;; List item with greater or equal indentation (less than four spaces). + ;; Do not increase list level. + ((and marker (>= indent (car levels))) + levels) + ;; Lesser indentation level. + ;; Pop appropriate number of elements off LEVELS list (e.g., lesser + ;; indentation could move back more than one list level). Note + ;; that this block need not be the beginning of list item. + ((< indent (car levels)) + (while (and (> (length levels) 1) + (< indent (+ (cadr levels) 4))) + (setq levels (cdr levels))) + levels) + ;; Otherwise, do nothing. + (t levels))) + +(defun markdown-calculate-list-levels () + "Calculate list levels at point. +Return a list of the form (n1 n2 n3 ...) where n1 is the +indentation of the deepest nested list item in the branch of +the list at the point, n2 is the indentation of the parent +list item, and so on. The depth of the list item is therefore +the length of the returned list. If the point is not at or +immediately after a list item, return nil." + (save-excursion + (let ((first (point)) levels indent pre-regexp) + ;; Find a baseline point with zero list indentation + (markdown-search-backward-baseline) + ;; Search for all list items between baseline and LOC + (while (and (< (point) first) + (re-search-forward markdown-regex-list first t)) + (setq pre-regexp (format "^\\( \\|\t\\)\\{%d\\}" (1+ (length levels)))) + (beginning-of-line) + (cond + ;; Make sure this is not a header or hr + ((markdown-new-baseline-p) (setq levels nil)) + ;; Make sure this is not a line from a pre block + ((looking-at pre-regexp)) + ;; If not, then update levels + (t + (setq indent (markdown-cur-line-indent)) + (setq levels (markdown-update-list-levels (match-string 2) + indent levels)))) + (end-of-line)) + levels))) + +(defun markdown-prev-list-item (level) + "Search backward from point for a list item with indentation LEVEL. +Set point to the beginning of the item, and return point, or nil +upon failure." + (let (bounds indent prev) + (setq prev (point)) + (forward-line -1) + (setq indent (markdown-cur-line-indent)) + (while + (cond + ;; Stop at beginning of buffer + ((bobp) (setq prev nil)) + ;; Continue if current line is blank + ((markdown-cur-line-blank-p) t) + ;; List item + ((and (looking-at markdown-regex-list) + (setq bounds (markdown-cur-list-item-bounds))) + (cond + ;; Continue at item with greater indentation + ((> (nth 3 bounds) level) t) + ;; Stop and return point at item of equal indentation + ((= (nth 3 bounds) level) + (setq prev (point)) + nil) + ;; Stop and return nil at item with lesser indentation + ((< (nth 3 bounds) level) + (setq prev nil) + nil))) + ;; Continue while indentation is the same or greater + ((>= indent level) t) + ;; Stop if current indentation is less than list item + ;; and the next is blank + ((and (< indent level) + (markdown-next-line-blank-p)) + (setq prev nil)) + ;; Stop at a header + ((looking-at markdown-regex-header) (setq prev nil)) + ;; Stop at a horizontal rule + ((looking-at markdown-regex-hr) (setq prev nil)) + ;; Otherwise, continue. + (t t)) + (forward-line -1) + (setq indent (markdown-cur-line-indent))) + prev)) + +(defun markdown-next-list-item (level) + "Search forward from point for the next list item with indentation LEVEL. +Set point to the beginning of the item, and return point, or nil +upon failure." + (let (bounds indent prev next) + (setq next (point)) + (forward-line) + (setq indent (markdown-cur-line-indent)) + (while + (cond + ;; Stop at end of the buffer. + ((eobp) (setq prev nil)) + ;; Continue if the current line is blank + ((markdown-cur-line-blank-p) t) + ;; List item + ((and (looking-at markdown-regex-list) + (setq bounds (markdown-cur-list-item-bounds))) + (cond + ;; Continue at item with greater indentation + ((> (nth 3 bounds) level) t) + ;; Stop and return point at item of equal indentation + ((= (nth 3 bounds) level) + (setq next (point)) + nil) + ;; Stop and return nil at item with lesser indentation + ((< (nth 3 bounds) level) + (setq next nil) + nil))) + ;; Continue while indentation is the same or greater + ((>= indent level) t) + ;; Stop if current indentation is less than list item + ;; and the previous line was blank. + ((and (< indent level) + (markdown-prev-line-blank-p)) + (setq next nil)) + ;; Stop at a header + ((looking-at markdown-regex-header) (setq next nil)) + ;; Stop at a horizontal rule + ((looking-at markdown-regex-hr) (setq next nil)) + ;; Otherwise, continue. + (t t)) + (forward-line) + (setq indent (markdown-cur-line-indent))) + next)) + +(defun markdown-cur-list-item-end (level) + "Move to the end of the current list item with nonlist indentation LEVEL. +If the point is not in a list item, do nothing." + (let (indent) + (forward-line) + (setq indent (markdown-cur-line-indent)) + (while + (cond + ;; Stop at end of the buffer. + ((eobp) nil) + ;; Continue if the current line is blank + ((markdown-cur-line-blank-p) t) + ;; Continue while indentation is the same or greater + ((>= indent level) t) + ;; Stop if current indentation is less than list item + ;; and the previous line was blank. + ((and (< indent level) + (markdown-prev-line-blank-p)) + nil) + ;; Stop at a new list item of the same or lesser indentation + ((looking-at markdown-regex-list) nil) + ;; Stop at a header + ((looking-at markdown-regex-header) nil) + ;; Stop at a horizontal rule + ((looking-at markdown-regex-hr) nil) + ;; Otherwise, continue. + (t t)) + (forward-line) + (setq indent (markdown-cur-line-indent))) + ;; Don't skip over whitespace for empty list items (marker and + ;; whitespace only), just move to end of whitespace. + (if (looking-back (concat markdown-regex-list "\\s-*")) + (goto-char (match-end 3)) + (skip-syntax-backward "-")))) + +(defun markdown-cur-list-item-bounds () + "Return bounds and indentation of the current list item. +Return a list of the form (begin end indent nonlist-indent marker). +If the point is not inside a list item, return nil. +Leave match data intact for `markdown-regex-list'." + (let (cur prev-begin prev-end indent nonlist-indent marker) + ;; Store current location + (setq cur (point)) + ;; Verify that cur is between beginning and end of item + (save-excursion + (end-of-line) + (when (re-search-backward markdown-regex-list nil t) + (setq prev-begin (match-beginning 0)) + (setq indent (length (match-string 1))) + (setq nonlist-indent (length (match-string 0))) + (setq marker (concat (match-string 2) (match-string 3))) + (save-match-data + (markdown-cur-list-item-end nonlist-indent) + (setq prev-end (point))) + (when (and (>= cur prev-begin) + (<= cur prev-end) + nonlist-indent) + (list prev-begin prev-end indent nonlist-indent marker)))))) + +(defun markdown-bounds-of-thing-at-point (thing) + "Call `bounds-of-thing-at-point' for THING with slight modifications. +Does not include trailing newlines when THING is 'line. Handles the +end of buffer case by setting both endpoints equal to the value of +`point-max', since an empty region will trigger empty markup insertion. +Return bounds of form (beg . end) if THING is found, or nil otherwise." + (let* ((bounds (bounds-of-thing-at-point thing)) + (a (car bounds)) + (b (cdr bounds))) + (when bounds + (when (eq thing 'line) + (cond ((and (eobp) (markdown-cur-line-blank-p)) + (setq a b)) + ((char-equal (char-before b) ?\^J) + (setq b (1- b))))) + (cons a b)))) + +(defun markdown-reference-definition (reference) + "Find out whether Markdown REFERENCE is defined. +REFERENCE should include the square brackets, like [this]. +When REFERENCE is defined, return a list of the form (text start end) +containing the definition text itself followed by the start and end +locations of the text. Otherwise, return nil. +Leave match data for `markdown-regex-reference-definition' +intact additional processing." + (let ((reference (downcase reference))) + (save-excursion + (goto-char (point-min)) + (catch 'found + (while (re-search-forward markdown-regex-reference-definition nil t) + (when (string= reference (downcase (match-string-no-properties 1))) + (throw 'found + (list (match-string-no-properties 2) + (match-beginning 2) (match-end 2))))))))) + +(defun markdown-get-defined-references () + "Return a list of all defined reference labels (including square brackets)." + (save-excursion + (goto-char (point-min)) + (let (refs) + (while (re-search-forward markdown-regex-reference-definition nil t) + (let ((target (match-string-no-properties 1))) + (add-to-list 'refs target t))) + refs))) + +(defun markdown-code-at-point-p () + "Return non-nil if the point is at an inline code fragment. +Return nil otherwise. Set match data according to +`markdown-match-code' upon success. +This function searches the block for a code fragment that +contains the point using `markdown-match-code'. We do this +because `thing-at-point-looking-at' does not work reliably with +`markdown-regex-code'." + (interactive) + (save-excursion + (let ((old-point (point)) + (end-of-block (progn (markdown-end-of-block) (point))) + found) + (markdown-beginning-of-block) + (while (and (markdown-match-code end-of-block) + (setq found t) + (< (match-end 0) old-point))) + (and found ; matched something + (<= (match-beginning 0) old-point) ; match contains old-point + (>= (match-end 0) old-point))))) + + +;;; Markdown Font Lock Matching Functions ===================================== + +(defun markdown-match-comments (last) + "Match HTML comments from the point to LAST." + (cond ((search-forward "") + (make-local-variable 'comment-start-skip) + (setq comment-start-skip "