diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-goto.el b/emacs.d/elpa/alchemist-20150201.2244/alchemist-goto.el deleted file mode 100644 index 7a8c2b9..0000000 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-goto.el +++ /dev/null @@ -1,231 +0,0 @@ -;;; alchemist-goto.el --- Functionality to jump modules and function definitions - -;; Copyright © 2015 Samuel Tonini - -;; Author: Samuel Tonini . - -;;; Commentary: - -;; Functionality to jump modules and function definitions - -;;; Code: - -(defgroup alchemist-goto nil - "Functionality to jump modules and function definitions." - :prefix "alchemist-goto-" - :group 'alchemist) - -(defcustom alchemist-goto-erlang-source-dir "" - "Path to the erlang source code." - :type 'string - :group 'alchemist-goto) - -(defcustom alchemist-goto-elixir-source-dir "" - "Path to the elixir source code." - :type 'string - :group 'alchemist-goto) - -(defun alchemist-goto--extract-module (code) - "Extract module from CODE." - (let* ((parts (split-string code "\\.")) - (function (car (last parts))) - (case-fold-search nil)) - (when (string-match-p "^[a-z]+" function) - (delete function parts)) - (unless (string-match-p "^[a-z]+" (car parts)) - (mapconcat 'concat parts ".")))) - -(defun alchemist-goto--extract-function (code) - "Extract function from CODE." - (let* ((parts (split-string code "\\.")) - (function (car (last parts))) - (case-fold-search nil)) - (when (and function - (string-match-p "^[a-z]+" function)) - function))) - -(defun alchemist-goto--build-elixir-ex-core-file (file) - (when (string-match "\\/\\(lib\\/.+\\/lib\\)\\/.+\.ex$" file) - (let* ((file (substring-no-properties file (match-beginning 1))) - (source-directory (expand-file-name alchemist-goto-elixir-source-dir))) - (concat source-directory file)))) - -(defun alchemist-goto--build-elixir-erl-core-file (file) - (when (string-match "\\/\\(lib\\/.+\\/src\\)\\/.+\.erl$" file) - (let* ((file (substring-no-properties file (match-beginning 1))) - (source-directory (expand-file-name alchemist-goto-elixir-source-dir))) - (concat source-directory file)))) - -(defun alchemist-goto--build-erlang-core-file (file) - (when (string-match "\\/\\(lib\\/.+\\/src\\)\\/.+\.erl$" file) - (let* ((file (substring-no-properties file (match-beginning 1))) - (source-directory (expand-file-name alchemist-goto-erlang-source-dir))) - (concat source-directory file)))) - -(defun alchemist-goto--elixir-file-p (file) - (string-match-p "\\.ex\\(s\\)?$" file)) - -(defun alchemist-goto--erlang-file-p (file) - (string-match-p "\\.erl$" file)) - -(defun alchemist-goto--get-full-path-of-alias (module) - (let* ((aliases (mapcar (lambda (m) - (when (string= module (car (cdr m))) - (car m))) (alchemist-goto--alises-of-current-buffer))) - (aliases (delete nil aliases))) - (if aliases - (car aliases) - module))) - -(defun alchemist-goto--open-definition (expr) - (let* ((module (alchemist-goto--extract-module expr)) - (module (alchemist-goto--get-full-path-of-alias module)) - (module (if module module "AlchemistGoto")) - (function (alchemist-goto--extract-function expr)) - (function (if function function "\"\"")) - (file (alchemist-goto--get-module-source module function))) - (ring-insert find-tag-marker-ring (point-marker)) - (cond ((equal file nil) - (message "Don't know how to find: %s" expr)) - ((file-exists-p file) - (alchemist-goto--open-file file module function)) - ((alchemist-goto--elixir-file-p file) - (let* ((elixir-source-file (alchemist-goto--build-elixir-ex-core-file file))) - (if (file-exists-p elixir-source-file) - (alchemist-goto--open-file elixir-source-file module function) - (message "Don't know how to find: %s" expr)))) - ((alchemist-goto--erlang-file-p file) - (let* ((elixir-source-file (alchemist-goto--build-elixir-erl-core-file file)) - (erlang-source-file (alchemist-goto--build-erlang-core-file file))) - (cond ((file-exists-p elixir-source-file) - (alchemist-goto--open-file elixir-source-file module function)) - ((file-exists-p erlang-source-file) - (alchemist-goto--open-file erlang-source-file module function)) - (t - (message "Don't know how to find: %s" expr))))) - (t - (pop-tag-mark) - (message "Don't know how to find: %s" expr))))) - -(defun alchemist-goto--open-file (file module function) - (let* ((buf (find-file-noselect file))) - (switch-to-buffer buf) - (beginning-of-buffer) - (cond ((alchemist-goto--elixir-file-p file) - (alchemist-goto--jump-to-elixir-source module function)) - ((alchemist-goto--erlang-file-p file) - (alchemist-goto--jump-to-erlang-source module function))))) - -(defun alchemist-goto--jump-to-elixir-source (module function) - (let ((function (replace-regexp-in-string "\?" "\\?" function))) - (when (re-search-forward (format "^\s+\\(defp?\s+%s\(\\|defmacrop?\s+%s\(\\)" function function function) nil t) - (goto-char (match-beginning 0))) - (when (re-search-forward (format "\\(defmodule\\|defimpl\\|defprotocol\\)\s+%s\s+do" module) nil t) - (goto-char (match-beginning 0))))) - -(defun alchemist-goto--jump-to-erlang-source (module function) - (when (re-search-forward (format "\\(^%s\(\\)" function) nil t) - (goto-char (match-beginning 0))) - (when (re-search-forward (format "\\(^-module\(%s\)\\)" (substring module 1)) nil t) - (goto-char (match-beginning 0)))) - -(defun alchemist-goto--clear-output (output) - (let* ((output (replace-regexp-in-string "source-file-path:" "" output)) - (output (replace-regexp-in-string "\n" "" output)) - (output (alchemist--utils-clear-ansi-sequences output)) - (output (if (string= output "") nil output))) - output)) - -(defun alchemist-goto--debug-message (output) - (alchemist-message (format "== ALCHEMIST GOTO FAILED ==\n== OUTPUT BEGIN:\n%s== OUTPUT END:" - output))) - -(defun alchemist-goto--report-errors (output) - (when (and (not (string-match-p "source-file-path:" output)) - (not (string= (alchemist--utils-clear-ansi-sequences - (replace-regexp-in-string "\n" "" output)) ""))) - (when alchemist-complete-debug-mode - (alchemist-goto--debug-message output)))) - -(defun alchemist-goto--runner () - (if (alchemist-project-p) - (format "%s run --no-compile" alchemist-mix-command) - alchemist-execute-command)) - -(defun alchemist-goto--get-module-source (module function) - (let* ((default-directory (if (alchemist-project-p) - (alchemist-project-root) - default-directory)) - (source-file (shell-command-to-string (format "%s -e '%s'" - (alchemist-goto--runner) - (alchemist-goto--get-module-source-code module function))))) - (alchemist-goto--report-errors source-file) - (alchemist-goto--clear-output source-file))) - -(defun alchemist-goto--get-module-source-code (module function) - (format " -defmodule Source do - def find(module, function) do - cond do - Code.ensure_loaded?(module) -> - IO.puts source(module) - List.keymember?(Kernel.module_info[:exports], function, 0) -> - IO.puts source(Kernel) - true -> - IO.puts \"\" - end - end - - defp source(module) do - source = module.module_info(:compile)[:source] - - case source do - nil -> nil - source -> \"source-file-path:\" <> List.to_string(source) - end - end -end - -Source.find(%s, :%s)" module function)) - -(defun alchemist-goto--alises-of-current-buffer () - (let* ((aliases '())) - (save-excursion - (goto-char (point-min)) - (while (re-search-forward "^\s+alias\s+\\([-_A-Za-z0-9,\.\?!\]+\\)\\(\s*,\s*as:\s*\\)?\\([-_A-Za-z0-9,\.\?!\]+\\)?\n" nil t) - (let* ((alias (match-string 1)) - (as (if (match-string 3) (match-string 3) nil)) - (as (if as as (car (last (split-string alias "\\.")))))) - (setq aliases (append aliases (list (list alias as))))))) - aliases)) - -(defun alchemist-goto-definition-at-point () - "Jump to the elixir expression definition at point." - (interactive) - (let (p1 p2) - (skip-chars-backward "-_A-Za-z0-9.?!:") - (setq p1 (point)) - (skip-chars-forward "-_A-Za-z0-9.?!:") - (setq p2 (point)) - (alchemist-goto--open-definition (buffer-substring-no-properties p1 p2)))) - -(defalias 'alchemist-goto-jump-back 'pop-tag-mark) - -(provide 'alchemist-goto) - -;;; alchemist-goto.el ends here diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-help.el b/emacs.d/elpa/alchemist-20150201.2244/alchemist-help.el deleted file mode 100644 index 10c7d9e..0000000 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-help.el +++ /dev/null @@ -1,264 +0,0 @@ -;;; alchemist-help.el --- Functionality for Elixir documentation lookup -*- lexical-binding: t -*- - -;; Copyright © 2014-2015 Samuel Tonini - -;; Author: Samuel Tonini . - -;;; Commentary: - -;; Functionality for Elixir documentation lookup. - -;;; Code: - -(defgroup alchemist-help nil - "Functionality for Elixir documentation lookup." - :prefix "alchemist-help-" - :group 'alchemist) - -;; Variables - -(defcustom alchemist-help-ansi-color-docs t - "If t, `alchemist-help' will present ansi colored documentation." - :type 'boolean - :group 'alchemist-help) - -(defcustom alchemist-help-buffer-name "*elixir help*" - "Name of the Elixir help buffer." - :type 'string - :group 'alchemist-help) - -(defvar alchemist-help-mix-run-command "mix run" - "The shell command for 'mix run'.") - -(defvar alchemist-help-search-history '() - "Storage for the search history.") - -(defvar alchemist-help-current-search-text '() - "Stores the current search.") - -;; Faces - -(defface alchemist-help--key-face - '((t (:inherit font-lock-variable-name-face :bold t :foreground "red"))) - "Fontface for the letter keys in the summary." - :group 'alchemist-help) - -(defun alchemist-help--load-ansi-color-setting () - (let ((config (gethash "ansi-color-docs" (alchemist-project-config)))) - (if config - (intern config) - alchemist-help-ansi-color-docs))) - -(defun alchemist-help--exp-at-point () - "Return the expression under the cursor." - (let (p1 p2) - (save-excursion - (skip-chars-backward "-_A-Za-z0-9.?!:") - (setq p1 (point)) - (skip-chars-forward "-_A-Za-z0-9.?!:") - (setq p2 (point)) - (buffer-substring-no-properties p1 p2)))) - -(defun alchemist-help--start-help-process (exp callback) - (let* ((buffer (get-buffer-create "alchemist-help-buffer")) - (command (alchemist-help--eval-string-command (alchemist-help--build-code-for-search exp))) - (proc (start-process-shell-command "alchemist-help-proc" buffer command))) - (set-process-sentinel proc (lambda (process signal) - (when (equal signal "finished\n") - (funcall callback (alchemist-utils--get-buffer-content (process-buffer process)))) - (alchemist-utils--erase-buffer (process-buffer process)))))) - -(defun alchemist-help--execute (search) - (let ((last-directory default-directory) - (last-buffer (current-buffer))) - (alchemist-complete search (lambda (candidates) - (if candidates - (let* ((search (alchemist-complete--completing-prompt search candidates))) - (setq alchemist-help-current-search-text search) - (alchemist-help--start-help-process search (lambda (output) - (alchemist-help--initialize-buffer output) - (with-current-buffer last-buffer - (cd last-directory))))) - (message "No documentation found for '%s'" search)))))) - -(defun alchemist-help--execute-without-complete (search) - (setq alchemist-help-current-search-text search) - (let ((last-directory default-directory) - (last-buffer (current-buffer))) - (alchemist-help--start-help-process search (lambda (output) - (alchemist-help--initialize-buffer output) - (with-current-buffer last-buffer - (cd last-directory)))))) - -(defun alchemist-help--build-code-for-search (string) - (format "import IEx.Helpers - -Application.put_env(:iex, :colors, [enabled: %s]) - -h(%s)" (if (alchemist-help--load-ansi-color-setting) "true" "false") string)) - -(defun alchemist-help--eval-string-command (string) - (when (alchemist-project-p) - (alchemist-project--establish-root-directory)) - (let* ((compile-option (if (and (alchemist-project-p) - (alchemist-project--load-compile-when-needed-setting)) - "" - "--no-compile")) - (command (if (alchemist-project-p) - (format "%s %s -e \"%s\"" alchemist-help-mix-run-command compile-option string) - (format "%s -e \"%s\"" alchemist-execute-command string)))) - command)) - -(defun alchemist-help--bad-search-output-p (string) - (let ((match (or (string-match-p "No documentation for " string) - (string-match-p "Invalid arguments for h helper" string) - (string-match-p "** (TokenMissingError)" string) - (string-match-p "** (SyntaxError)" string) - (string-match-p "** (FunctionClauseError)" string) - (string-match-p "** (CompileError)" string) - (string-match-p "Could not load module" string)))) - (if match - t - nil))) - -(defun alchemist-help--initialize-buffer (content) - (pop-to-buffer alchemist-help-buffer-name) - (setq buffer-undo-list nil) - (let ((inhibit-read-only t) - (buffer-undo-list t)) - (cond ((alchemist-help--bad-search-output-p content) - (message (propertize - (format "No documentation for [ %s ] found." alchemist-help-current-search-text) - 'face 'alchemist-help--key-face))) - (t - (erase-buffer) - (insert content) - (unless (memq 'alchemist-help-current-search-text alchemist-help-search-history) - (add-to-list 'alchemist-help-search-history alchemist-help-current-search-text)))) - (delete-matching-lines "do not show this result in output" (point-min) (point-max)) - (delete-matching-lines "^Compiled lib\\/" (point-min) (point-max)) - (ansi-color-apply-on-region (point-min) (point-max)) - (toggle-read-only 1) - (alchemist-help-minor-mode 1))) - -(defun alchemist-help-minor-mode-key-binding-summary () - (interactive) - (message - (concat "[" (propertize "q" 'face 'alchemist-help--key-face) - "]-quit [" - (propertize "e" 'face 'alchemist-help--key-face) - "]-search-at-point [" - (propertize "m" 'face 'alchemist-help--key-face) - "]-search-marked-region [" - (propertize "s" 'face 'alchemist-help--key-face) - "]-search [" - (propertize "h" 'face 'alchemist-help--key-face) - "]-history [" - (propertize "?" 'face 'alchemist-help--key-face) - "]-keys"))) - -(defun alchemist-help-search-at-point () - "Search through `alchemist-help' with the expression under the cursor." - (interactive) - (alchemist-help--execute (alchemist-help--exp-at-point))) - -(defun alchemist-help-search-marked-region (begin end) - "Run `alchemist-help' with the marked region. -Argument BEGIN where the mark starts. -Argument END where the mark ends." - (interactive "r") - (let ((region (filter-buffer-substring begin end))) - (alchemist-help--execute region))) - -(defun alchemist-help--elixir-modules-to-list (str) - (let* ((modules (split-string str)) - (modules (mapcar (lambda (m) - (when (string-match-p "Elixir\\." m) - (replace-regexp-in-string "Elixir\\." "" m))) modules)) - (modules (delete nil modules)) - (modules (cl-sort modules 'string-lessp :key 'downcase)) - (modules (delete-dups modules))) - modules) - ) - -(defun alchemist-help--get-modules () - (let* ((elixir-code " -defmodule AlchemistModule do - def get_modules do - modules = Enum.map(:code.all_loaded, fn({m, _}) -> Atom.to_string(m) end) - - if :code.get_mode() === :interactive do - modules ++ get_modules_from_applications() - else - modules - end - end - - defp get_modules_from_applications do - for {app, _, _} <- :application.loaded_applications, - {_, modules} = :application.get_key(app, :modules), - module <- modules, - has_doc = Code.get_docs(module, :moduledoc), elem(has_doc, 1) do - Atom.to_string(module) - end - end -end - -AlchemistModule.get_modules |> Enum.map &IO.puts/1 -") - (command (if (alchemist-project-p) - (format "%s -e \"%s\"" alchemist-help-mix-run-command elixir-code) - (format "%s -e \"%s\"" alchemist-execute-command elixir-code)))) - (when (alchemist-project-p) - - (alchemist-project--establish-root-directory)) - (alchemist-help--elixir-modules-to-list (shell-command-to-string command)))) - -(define-minor-mode alchemist-help-minor-mode - "Minor mode for displaying elixir help." - :group 'alchemist-help - :keymap '(("q" . quit-window) - ("e" . alchemist-help-search-at-point) - ("m" . alchemist-help-search-marked-region) - ("s" . alchemist-help) - ("h" . alchemist-help-history) - ("?" . alchemist-help-minor-mode-key-binding-summary))) - -(defun alchemist-help (search) - "Load Elixir documentation for SEARCH." - (interactive - (list (completing-read - "Elixir help: " - (alchemist-help--get-modules) - nil - nil - nil))) - (alchemist-help--execute (if (string-match-p "\\.$" search) - search - (concat search ".")))) - -(defun alchemist-help-history (search) - "Load Elixir from the documentation history for SEARCH." - (interactive - (list - (completing-read "Elixir help history: " alchemist-help-search-history nil nil ""))) - (alchemist-help--execute-without-complete search)) - -(provide 'alchemist-help) - -;;; alchemist-help.el ends here diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist.el b/emacs.d/elpa/alchemist-20150201.2244/alchemist.el deleted file mode 100644 index 4c488b9..0000000 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist.el +++ /dev/null @@ -1,132 +0,0 @@ -;;; alchemist.el --- Elixir tooling integration into Emacs - -;; Copyright © 2014-2015 Samuel Tonini -;; -;; Author: Samuel Tonini - -;; URL: http://www.github.com/tonini/alchemist.el -;; Version: 0.14.0-cvs -;; Package-Requires: ((emacs "24")) -;; Keywords: languages, mix, elixir, elixirc, hex - -;; 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: - -;; Alchemist integrate Elixir's tooling into Emacs - -;;; Code: - -(defgroup alchemist nil - "Elixir Tooling Integration Into Emacs." - :prefix "alchemist-" - :group 'applications - :link '(url-link :tag "Github" "https://github.com/tonini/alchemist.el") - :link '(emacs-commentary-link :tag "Commentary" "alchemist")) - -(require 'alchemist-utils) -(require 'alchemist-project) -(require 'alchemist-buffer) -(require 'alchemist-compile) -(require 'alchemist-execute) -(require 'alchemist-mix) -(require 'alchemist-hooks) -(require 'alchemist-help) -(require 'alchemist-complete) -(require 'alchemist-message) -(require 'alchemist-iex) -(require 'alchemist-eval) -(require 'alchemist-goto) - -(eval-after-load 'company - '(progn - (require 'alchemist-company))) - -(defun alchemist-mode-hook () - "Hook which enables `alchemist-mode'" - (alchemist-mode 1)) - -(defvar alchemist--version "0.14.0-cvs") - -;;;###autoload -(defun alchemist-version (&optional show-version) - "Display Alchemist's version." - (interactive) - (message "Alchemist %s" (replace-regexp-in-string "-cvs" "snapshot" alchemist--version))) - -(defvar alchemist-mode-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-c a t") 'alchemist-mix-test) - (define-key map (kbd "C-c a m t f") 'alchemist-mix-test-file) - (define-key map (kbd "C-c a m t b") 'alchemist-mix-test-this-buffer) - (define-key map (kbd "C-c a m t .") 'alchemist-mix-test-at-point) - (define-key map (kbd "C-c a c c") 'alchemist-compile) - (define-key map (kbd "C-c a c f") 'alchemist-compile-file) - (define-key map (kbd "C-c a c b") 'alchemist-compile-this-buffer) - (define-key map (kbd "C-c a e e") 'alchemist-execute) - (define-key map (kbd "C-c a e f") 'alchemist-execute-file) - (define-key map (kbd "C-c a e b") 'alchemist-execute-this-buffer) - (define-key map (kbd "C-c a h h") 'alchemist-help) - (define-key map (kbd "C-c a h e") 'alchemist-help-search-at-point) - (define-key map (kbd "C-c a h m") 'alchemist-help-search-marked-region) - (define-key map (kbd "C-c a p f") 'alchemist-project-find-test) - (define-key map (kbd "C-c a p t") 'alchemist-project-open-tests-for-current-file) - (define-key map (kbd "C-c a i i") 'alchemist-iex-run) - (define-key map (kbd "C-c a i p") 'alchemist-iex-project-run) - (define-key map (kbd "C-c a i l") 'alchemist-iex-send-current-line) - (define-key map (kbd "C-c a i c") 'alchemist-iex-send-current-line-and-go) - (define-key map (kbd "C-c a i r") 'alchemist-iex-send-region) - (define-key map (kbd "C-c a i m") 'alchemist-iex-send-region-and-go) - (define-key map (kbd "C-c a i b") 'alchemist-iex-compile-this-buffer) - (define-key map (kbd "C-c a v l") 'alchemist-eval-current-line) - (define-key map (kbd "C-c a v k") 'alchemist-eval-print-current-line) - (define-key map (kbd "C-c a v j") 'alchemist-eval-quoted-current-line) - (define-key map (kbd "C-c a v h") 'alchemist-eval-print-quoted-current-line) - (define-key map (kbd "C-c a v o") 'alchemist-eval-region) - (define-key map (kbd "C-c a v i") 'alchemist-eval-print-region) - (define-key map (kbd "C-c a v u") 'alchemist-eval-quoted-region) - (define-key map (kbd "C-c a v y") 'alchemist-eval-print-quoted-region) - (define-key map (kbd "C-c a v q") 'alchemist-eval-buffer) - (define-key map (kbd "C-c a v w") 'alchemist-eval-print-buffer) - (define-key map (kbd "C-c a v e") 'alchemist-eval-quoted-buffer) - (define-key map (kbd "C-c a v r") 'alchemist-eval-print-quoted-buffer) - (define-key map (kbd "M-.") 'alchemist-goto-definition-at-point) - (define-key map (kbd "M-,") 'alchemist-goto-jump-back) - map) - "The keymap used when `alchemist-mode' is active.") - -;;;###autoload -(define-minor-mode alchemist-mode - "Toggle alchemist mode. - -Key bindings: -\\{alchemist-mode-map}" - nil - ;; The indicator for the mode line. - " alchemist" - :group 'alchemist - :global nil - :keymap 'alchemist-mode-map - (cond (alchemist-mode - (alchemist-buffer-initialize-modeline)) - (t - (alchemist-buffer-reset-modeline)))) - -(add-hook 'elixir-mode-hook 'alchemist-mode-hook) - -(provide 'alchemist) - -;;; alchemist.el ends here diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-autoloads.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-autoloads.el similarity index 63% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-autoloads.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-autoloads.el index b68599b..49ed786 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-autoloads.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "alchemist" "alchemist.el" (21721 25170 0 0)) +;;;### (autoloads nil "alchemist" "alchemist.el" (21898 47984 0 0)) ;;; Generated autoloads from alchemist.el (autoload 'alchemist-version "alchemist" "\ @@ -21,7 +21,7 @@ Key bindings: ;;;*** -;;;### (autoloads nil "alchemist-iex" "alchemist-iex.el" (21721 25170 +;;;### (autoloads nil "alchemist-iex" "alchemist-iex.el" (21898 47984 ;;;;;; 0 0)) ;;; Generated autoloads from alchemist-iex.el @@ -40,14 +40,36 @@ Show the IEx buffer if an IEx process is already run. \(fn)" t nil) +;;;*** + +;;;### (autoloads nil "alchemist-test-mode" "alchemist-test-mode.el" +;;;;;; (21898 47984 0 0)) +;;; Generated autoloads from alchemist-test-mode.el + +(autoload 'alchemist-test-mode "alchemist-test-mode" "\ +Minor mode for Elixir ExUnit files. + +The following commands are available: + +\\{alchemist-test-mode-map} + +\(fn &optional ARG)" t nil) + +(autoload 'alchemist-test-enable-mode "alchemist-test-mode" "\ + + +\(fn)" nil nil) + +(dolist (hook '(alchemist-mode-hook)) (add-hook hook 'alchemist-test-enable-mode)) + ;;;*** ;;;### (autoloads nil nil ("alchemist-buffer.el" "alchemist-company.el" ;;;;;; "alchemist-compile.el" "alchemist-complete.el" "alchemist-eval.el" ;;;;;; "alchemist-execute.el" "alchemist-goto.el" "alchemist-help.el" ;;;;;; "alchemist-hooks.el" "alchemist-message.el" "alchemist-mix.el" -;;;;;; "alchemist-pkg.el" "alchemist-project.el" "alchemist-utils.el") -;;;;;; (21721 25170 129388 0)) +;;;;;; "alchemist-pkg.el" "alchemist-project.el" "alchemist-server.el" +;;;;;; "alchemist-utils.el") (21898 47984 781999 0)) ;;;*** diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-buffer.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-buffer.el similarity index 90% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-buffer.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-buffer.el index 8460b56..e9b2afd 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-buffer.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-buffer.el @@ -50,7 +50,7 @@ formated with the `alchemist-buffer--failed-face' face, to symbolize failing tes (make-variable-buffer-local 'alchemist-buffer--buffer-name) (defvar alchemist-buffer--error-link-options - '(elixir "^\\([-A-Za-z0-9./_]+\\):\\([0-9]+\\)\\(: warning\\)?$" 1 2 nil (3) 1) + '(elixir "\\([-A-Za-z0-9./_]+\\):\\([0-9]+\\)\\(?: warning\\)?" 1 2 nil (3) 1) "File link matcher for `compilation-error-regexp-alist-alist' (matches path/to/file:line).") ;; Faces @@ -82,6 +82,10 @@ formated with the `alchemist-buffer--failed-face' face, to symbolize failing tes (lambda () (not (string= (substring (buffer-name) 0 1) "*")))) +(defun alchemist-buffer-init-test-report (buffer status) + (when (string= "*alchemist-test-report*" (buffer-name buffer)) + (alchemist-test-mode))) + (defun alchemist-buffer--remove-dispensable-output () (delete-matching-lines "\\(-*- mode:\\|Compiled \\|elixir-compilation;\\|Elixir started\\|^$\\)" (point-min) (point-max)) (remove-hook 'compilation-filter-hook 'alchemist-buffer--remove-dispensable-output t)) @@ -132,11 +136,13 @@ Argument BUFFER-NAME for the compilation." (compilation-start (mapconcat 'concat cmdlist " ") 'alchemist-buffer-mode (lambda (b) alchemist-buffer--buffer-name)) - (setq-local compilation-error-regexp-alist-alist - (cons alchemist-buffer--error-link-options compilation-error-regexp-alist-alist)) - (setq-local compilation-error-regexp-alist (cons 'elixir compilation-error-regexp-alist)) + (set (make-local-variable 'compilation-error-regexp-alist-alist) + (cons alchemist-buffer--error-link-options compilation-error-regexp-alist-alist)) + (set (make-local-variable 'compilation-error-regexp-alist) + (cons 'elixir compilation-error-regexp-alist)) (add-hook 'compilation-filter-hook 'alchemist-buffer--handle-compilation nil t) (add-hook 'compilation-filter-hook 'alchemist-buffer--remove-dispensable-output nil t) + (add-to-list 'compilation-finish-functions 'alchemist-buffer-init-test-report) (add-to-list 'compilation-finish-functions 'alchemist-buffer--remove-dispensable-output-after-finish) (when alchemist-buffer-status-modeline (add-hook 'compilation-finish-functions 'alchemist-buffer--set-modeline-color nil t))))) diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-company.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-company.el similarity index 77% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-company.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-company.el index 2848aca..1d54663 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-company.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-company.el @@ -39,27 +39,19 @@ :type 'boolean :group 'alchemist-company) -(defun alchemist-company--show-documentation () +(defun alchemist-company--show-documentation (selected) (interactive) (company--electric-do - (let* ((selected (nth company-selection company-candidates)) - (candidate (format "%s%s" selected (alchemist-company--annotation selected)))) + (let* ((candidate (format "%s%s" selected (alchemist-company--annotation selected)))) (alchemist-help--execute-without-complete candidate)))) (put 'alchemist-company--show-documentation 'company-keep t) -(defun alchemist-company--open-definition () +(defun alchemist-company--open-definition (selected) (interactive) (company--electric-do - (let* ((selected (nth company-selection company-candidates))) - (alchemist-goto--open-definition selected)))) + (alchemist-goto--open-definition selected))) (put 'alchemist-company--open-definition 'company-keep t) -(defun alchemist-company--keybindings () - (define-key company-active-map (kbd "C-d") 'alchemist-company--show-documentation) - (define-key company-active-map (kbd "M-.") 'alchemist-company--open-definition)) - -(add-hook 'company-mode-hook 'alchemist-company--keybindings) - (defun alchemist-company--annotation (candidate) (get-text-property 0 'meta candidate)) @@ -75,8 +67,12 @@ (prefix (and (or (eq major-mode 'elixir-mode) (string= mode-name "Alchemist-IEx")) (alchemist-help--exp-at-point))) + (doc-buffer (alchemist-company--show-documentation arg)) + (location (alchemist-company--open-definition arg)) (candidates (cons :async - (lambda (cb) (alchemist-complete-candidates arg cb)))) + (lambda (cb) + (setq alchemist-server-company-callback cb) + (alchemist-server-complete-candidates arg)))) (annotation (when alchemist-company-show-annotation (alchemist-company--annotation arg))))) diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-compile.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-compile.el similarity index 88% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-compile.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-compile.el index bcc0690..5dc5369 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-compile.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-compile.el @@ -43,9 +43,9 @@ ;; Private functions (defun alchemist-compile--file (filename) - (when (not (file-exists-p filename)) - (error "The given file doesn't exists")) - (alchemist-compile (list alchemist-compile-command (expand-file-name filename)))) + (cond ((not (file-exists-p filename)) (error "The given file doesn't exist")) + ((string-match "\.exs$" filename) (error "The given file is an Elixir Script")) + (t (alchemist-compile (list alchemist-compile-command (expand-file-name filename)))))) (defun alchemist-compile--read-command (command) (read-shell-command "elixirc command: " (concat command " "))) diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-complete.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-complete.el similarity index 57% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-complete.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-complete.el index fcaed9e..c7e07c2 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-complete.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-complete.el @@ -30,18 +30,6 @@ :prefix "alchemist-complete-" :group 'alchemist) -(defvar alchemist-complete-debug-mode t) - -(defun alchemist-complete-debug-mode () - "Enables the debug mode for completion if `alchemist-complete-debug-mode' -is `nil', otherwise it disable it." - (interactive) - (setq alchemist-complete-debug-mode (not alchemist-complete-debug-mode)) - (let ((state (if alchemist-complete-debug-mode - "ENABLED" - "DISABLED"))) - (message "Alchemist complete debug mode is: %s" state))) - (defun alchemist-complete--concat-prefix-with-functions (prefix functions &optional add-prefix) (let* ((prefix (mapconcat 'concat (butlast (split-string prefix "\\.") 1) ".")) (candidates (mapcar (lambda (c) (concat prefix "." c)) (cdr functions)))) @@ -56,6 +44,9 @@ is `nil', otherwise it disable it." (defun alchemist-complete--build-candidates (a-list) (let* ((search-term (car a-list)) + (candidates (if (string-match-p "^.+\/" search-term) + a-list + (cdr a-list))) (candidates (mapcar (lambda (f) (let* ((candidate f) (meta (if (string-match-p "^.+/" f) @@ -69,7 +60,7 @@ is `nil', otherwise it disable it." (propertize (alchemist-complete--add-prefix-to-function search-term (replace-regexp-in-string "/[0-9]$" "" candidate)) 'meta meta)) (t (propertize (replace-regexp-in-string "/[0-9]$" "" candidate) 'meta meta))))) - (cdr a-list)))) + candidates))) candidates)) (defun alchemist-complete--build-help-candidates (a-list) @@ -104,58 +95,6 @@ is `nil', otherwise it disable it." (with-current-buffer buffer (delete-non-matching-lines "^cmp:" (point-min) (point-max)))) -(defun alchemist-complete--elixir-complete-code (exp) - (format " -defmodule Alchemist do - def expand(exp) do - {status, result, list } = IEx.Autocomplete.expand(Enum.reverse(exp)) - - case { status, result, list } do - { :no, _, _ } -> '' - { :yes, [], _ } -> List.insert_at(list, 0, exp) - { :yes, _, _ } -> expand(exp ++ result) - end - end -end - -Alchemist.expand('%s') |> Enum.map fn (f) -> IO.puts('cmp:' ++ f) end -" exp)) - -(defun alchemist-complete--command (exp) - (let* ((elixir-code (alchemist-complete--elixir-complete-code exp)) - (compile-option (if (and (alchemist-project-p) - (alchemist-project--load-compile-when-needed-setting)) - "" - "--no-compile")) - (command (if (alchemist-project-p) - (format "%s %s -e \"%s\"" alchemist-help-mix-run-command compile-option elixir-code) - (format "%s -e \"%s\"" alchemist-execute-command elixir-code))) - ) - (when (alchemist-project-p) - (alchemist-project--establish-root-directory)) - command)) - -(defun alchemist-complete--sentinel (proc callback &optional format-function) - (set-process-sentinel proc (lambda (process signal) - (cond ((equal signal "finished\n") - (alchemist-complete--clear-buffer (process-buffer process)) - (let* ((candidates (alchemist-complete--output-to-list - (alchemist--utils-clear-ansi-sequences - (alchemist-utils--get-buffer-content (process-buffer process))))) - (candidates (if format-function - (funcall format-function candidates) - candidates))) - (funcall callback candidates))) - (t - (when alchemist-complete-debug-mode - (alchemist-complete--debug-message (alchemist-utils--get-buffer-content (process-buffer process)))) - (funcall callback '()))) - (alchemist-utils--erase-buffer (process-buffer process))))) - -(defun alchemist-complete--debug-message (content) - (alchemist-message (format "== ALCHEMIST COMPLETION FAILED ==\n== OUTPUT BEGIN:\n%s== OUTPUT END:" - content))) - (defun alchemist-complete--completing-prompt (initial completing-collection) (let* ((completing-collection (alchemist-complete--build-help-candidates completing-collection))) (cond ((equal (length completing-collection) 1) @@ -169,17 +108,27 @@ Alchemist.expand('%s') |> Enum.map fn (f) -> IO.puts('cmp:' ++ f) end (replace-regexp-in-string "\\.$" "" initial))) (t initial)))) -(defun alchemist-complete (exp callback) - (let* ((buffer (get-buffer-create "alchemist-complete-buffer")) - (command (alchemist-complete--command exp)) - (proc (start-process-shell-command "alchemist-complete-proc" buffer command))) - (alchemist-complete--sentinel proc callback))) - -(defun alchemist-complete-candidates (exp callback) - (let* ((buffer (get-buffer-create "alchemist-complete-buffer")) - (command (alchemist-complete--command exp)) - (proc (start-process-shell-command "alchemist-complete-proc" buffer command))) - (alchemist-complete--sentinel proc callback #'alchemist-complete--build-candidates))) +(defun alchemsit-complete--dabbrev-code-candidates () + "This function uses a piece of functionality of company-dabbrev-code backend. + +Please have a look at the company-dabbrev-code function for more +detailed information." + (let ((case-fold-search company-dabbrev-code-ignore-case) + (candidates (company-dabbrev--search + (company-dabbrev-code--make-regexp alchemist-server--last-completion-exp) + company-dabbrev-code-time-limit + (pcase company-dabbrev-code-other-buffers + (`t (list major-mode)) + (`code company-dabbrev-code-modes) + (`all `all)) + t))) + (delete-dups candidates))) + +(defun alchemist-complete--serve-candidates-to-company (candidates) + (let ((candidates (if candidates + candidates + (alchemsit-complete--dabbrev-code-candidates)))) + (funcall alchemist-server-company-callback candidates))) (provide 'alchemist-complete) diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-eval.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-eval.el similarity index 76% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-eval.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-eval.el index 0921b5c..f376d65 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-eval.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-eval.el @@ -30,6 +30,8 @@ :prefix "alchemist-eval-" :group 'alchemist) +;; Private functions + (defun alchemist-eval--insert (string) (let ((lines (split-string string "\n"))) (if (> (length lines) 1) @@ -38,7 +40,8 @@ (end-of-line) (mapc (lambda (s) (newline) - (insert (format "# => %s" s))) + (insert (format "# => %s" s)) + (indent-according-to-mode)) lines))) (save-excursion (end-of-line) @@ -70,44 +73,41 @@ (cd old-directory) (alchemist-utils--remove-newline-at-end output)))) -(defun alchemist-eval--build-code-evaluation-command (file) - (format "%s -e 'IO.inspect(elem(Code.eval_string(File.read!(\"%s\")), 0))'" - (alchemist-eval--runner) - file)) +(defun alchemist-eval--expression (expression) + (let ((file (make-temp-file "alchemist-eval" nil ".exs"))) + (with-temp-file file + (insert expression)) + (alchemist-server-eval file))) + +(defun alchemist-eval--expression-and-print (expression) + (let ((file (make-temp-file "alchemist-eval" nil ".exs"))) + (with-temp-file file + (insert expression)) + (alchemist-server-eval-and-insert file))) + +(defun alchemist-eval--quote-expression (expression) + (let ((file (make-temp-file "alchemist-eval" nil ".exs"))) + (with-temp-file file + (insert expression)) + (alchemist-server-eval-quote file))) -(defun alchemist-eval--build-code-evaluation-as-quoted-command (file) - (format "%s -e 'IO.puts inspect(elem(Code.string_to_quoted(File.read!(\"%s\")), 1), pretty: true)'" - (alchemist-eval--runner) - file)) +(defun alchemist-eval--quote-expression-and-print (expression) + (let ((file (make-temp-file "alchemist-eval" nil ".exs"))) + (with-temp-file file + (insert expression)) + (alchemist-server-eval-quote-and-insert file))) -(defun alchemist-eval--runner () - (if (alchemist-project-p) - (format "%s run --no-compile" alchemist-mix-command) - alchemist-execute-command)) +;; Public functions (defun alchemist-eval-current-line () "Evaluate the Elixir code on the current line." (interactive) - (let ((current-line (thing-at-point 'line))) - (message (alchemist-eval--evaluate-code current-line)))) + (alchemist-eval--expression (thing-at-point 'line))) (defun alchemist-eval-print-current-line () "Evaluate the Elixir code on the current line and insert the result." (interactive) - (let ((current-line (thing-at-point 'line))) - (alchemist-eval--insert (alchemist-eval--evaluate-code current-line)))) - -(defun alchemist-eval-quoted-current-line () - "Get the Elixir code representation of the expression on the current line." - (interactive) - (let ((current-line (thing-at-point 'line))) - (message (alchemist-eval--evaluate-code-as-quoted current-line)))) - -(defun alchemist-eval-print-quoted-current-line () - "Get the Elixir code representation of the expression on the current line and insert the result." - (interactive) - (let ((current-line (thing-at-point 'line))) - (alchemist-eval--insert (alchemist-eval--evaluate-code-as-quoted current-line)))) + (alchemist-eval--expression-and-print (thing-at-point 'line))) (defun alchemist-eval-region (beg end) "Evaluate the Elixir code on marked region." @@ -115,7 +115,7 @@ (unless (and beg end) (error "The mark is not set now, so there is no region")) (let ((string (buffer-substring-no-properties beg end))) - (message (alchemist-eval--evaluate-code string)))) + (alchemist-eval--expression string))) (defun alchemist-eval-print-region (beg end) "Evaluate the Elixir code on marked region and insert the result." @@ -125,7 +125,30 @@ (let ((string (buffer-substring-no-properties beg end))) (when (> end beg) (exchange-point-and-mark)) - (alchemist-eval--insert (alchemist-eval--evaluate-code string)))) + (alchemist-eval--expression-and-print string))) + +(defun alchemist-eval-buffer () + "Evaluate the Elixir code in the current buffer." + (interactive) + (let ((string (buffer-substring-no-properties (point-min) (point-max)))) + (alchemist-eval--expression string))) + +(defun alchemist-eval-print-buffer () + "Evaluate the Elixir code in the current buffer and insert the result." + (interactive) + (let ((string (buffer-substring-no-properties (point-min) (point-max)))) + (end-of-buffer) + (alchemist-eval--expression-and-print string))) + +(defun alchemist-eval-quoted-current-line () + "Get the Elixir code representation of the expression on the current line." + (interactive) + (alchemist-eval--quote-expression (thing-at-point 'line))) + +(defun alchemist-eval-print-quoted-current-line () + "Get the Elixir code representation of the expression on the current line and insert the result." + (interactive) + (alchemist-eval--quote-expression-and-print (thing-at-point 'line))) (defun alchemist-eval-quoted-region (beg end) "Get the Elixir code representation of the expression on marked region." @@ -133,7 +156,7 @@ (unless (and beg end) (error "The mark is not set now, so there is no region")) (let ((string (buffer-substring-no-properties beg end))) - (message (alchemist-eval--evaluate-code-as-quoted string)))) + (alchemist-eval--quote-expression string))) (defun alchemist-eval-print-quoted-region (beg end) "Get the Elixir code representation of the expression on marked region and insert the result." @@ -143,32 +166,19 @@ (let ((string (buffer-substring-no-properties beg end))) (when (> end beg) (exchange-point-and-mark)) - (alchemist-eval--insert (alchemist-eval--evaluate-code-as-quoted string)))) - -(defun alchemist-eval-buffer () - "Evaluate the Elixir code in the current buffer." - (interactive) - (let ((string (buffer-substring-no-properties (point-min) (point-max)))) - (message (alchemist-eval--evaluate-code string)))) - -(defun alchemist-eval-print-buffer () - "Evaluate the Elixir code in the current buffer and insert the result." - (interactive) - (let ((string (buffer-substring-no-properties (point-min) (point-max)))) - (end-of-buffer) - (alchemist-eval--insert (alchemist-eval--evaluate-code string)))) + (alchemist-eval--quote-expression-and-print string))) (defun alchemist-eval-quoted-buffer () "Get the Elixir code representation of the expression in the current buffer." (interactive) (let ((string (buffer-substring-no-properties (point-min) (point-max)))) - (message (alchemist-eval--evaluate-code-as-quoted string)))) + (alchemist-eval--quote-expression string))) (defun alchemist-eval-print-quoted-buffer () "Get the Elixir code representation of the expression in the current buffer and insert result." (interactive) (let ((string (buffer-substring-no-properties (point-min) (point-max)))) - (alchemist-eval--insert (alchemist-eval--evaluate-code-as-quoted string)))) + (alchemist-eval--quote-expression-and-print string))) (provide 'alchemist-eval) diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-execute.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-execute.el similarity index 100% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-execute.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-execute.el diff --git a/emacs.d/elpa/alchemist-20150624.159/alchemist-goto.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-goto.el new file mode 100644 index 0000000..c36d0a1 --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-goto.el @@ -0,0 +1,336 @@ +;;; alchemist-goto.el --- Functionality to jump modules and function definitions + +;; Copyright © 2015 Samuel Tonini + +;; Author: Samuel Tonini . + +;;; Commentary: + +;; Functionality to jump modules and function definitions + +;;; Code: + +(require 'etags) + +(defgroup alchemist-goto nil + "Functionality to jump modules and function definitions." + :prefix "alchemist-goto-" + :group 'alchemist) + +;; Variables + +(defcustom alchemist-goto-erlang-source-dir "" + "Path to the erlang source code." + :type 'string + :group 'alchemist-goto) + +(defcustom alchemist-goto-elixir-source-dir "" + "Path to the elixir source code." + :type 'string + :group 'alchemist-goto) + +(defvar alchemist-goto--symbol-list '()) +(defvar alchemist-goto--symbol-name-and-pos '()) +(defvar alchemist-goto--symbol-list-bare '()) +(defvar alchemist-goto--symbol-name-and-pos-bare '()) + +;; Private functions + +(defun alchemist-goto--current-module-name () + "Searches backward in the current buffer until a module +declaration has been found." + (save-excursion + (let ((found-flag-p nil) + (module-name "")) + (save-match-data + (while (and (not found-flag-p) + (re-search-backward "defmodule \\([A-Za-z\._]+\\)\s+" nil t)) + (when (not (alchemist-goto--string-at-point-p)) + (setq module-name (match-string 1)) + (setq found-flag-p t)) + (when (equal 1 (line-number-at-pos (point))) + (setq found-flag-p t))) + module-name)))) + +(defun alchemist-goto--use-modules-in-the-current-module-context () + (let ((modules '()) + (context (alchemist-goto--current-module-name))) + (save-excursion + (while (re-search-backward "^\s+use\s+\\([A-Za-z0-9\.]+\\)" nil t) + (if (and (match-string 1) + (not (alchemist-goto--string-at-point-p)) + (equal context (alchemist-goto--current-module-name))) + (setq modules (add-to-list 'modules (substring-no-properties (match-string 1)))) + )) + modules))) + +(defun alchemist-goto--import-modules-in-the-current-module-context () + (let ((modules '()) + (context (alchemist-goto--current-module-name))) + (save-excursion + (while (re-search-backward "^\s+import\s+\\([A-Za-z0-9\.]+\\)" nil t) + (if (and (match-string 1) + (not (alchemist-goto--string-at-point-p)) + (equal context (alchemist-goto--current-module-name))) + (setq modules (add-to-list 'modules (substring-no-properties (match-string 1)))) + )) + modules))) + +(defun alchemist-goto--extract-module (code) + "Extract module from CODE." + (let* ((parts (split-string code "\\.")) + (function (car (last parts))) + (case-fold-search nil)) + (when (string-match-p "^[a-z_\?!]+" function) + (delete function parts)) + (unless (string-match-p "^[a-z_\?!]+" (car parts)) + (replace-regexp-in-string "\\.$" "" (mapconcat 'concat parts "."))))) + +(defun alchemist-goto--extract-function (code) + "Extract function from CODE." + (let* ((parts (split-string code "\\.")) + (function (car (last parts))) + (case-fold-search nil)) + (when (and function + (string-match-p "^[a-z_\?!]+" function)) + function))) + +(defun alchemist-goto--build-elixir-ex-core-file (file) + (when (string-match "\\/\\(lib\\/.+\\/lib\\)\\/.+\.ex$" file) + (let* ((file (substring-no-properties file (match-beginning 1))) + (source-directory (expand-file-name alchemist-goto-elixir-source-dir))) + (concat source-directory file)))) + +(defun alchemist-goto--build-elixir-erl-core-file (file) + (when (string-match "\\/\\(lib\\/.+\\/src\\)\\/.+\.erl$" file) + (let* ((file (substring-no-properties file (match-beginning 1))) + (source-directory (expand-file-name alchemist-goto-elixir-source-dir))) + (concat source-directory file)))) + +(defun alchemist-goto--build-erlang-core-file (file) + (when (string-match "\\/\\(lib\\/.+\\/src\\)\\/.+\.erl$" file) + (let* ((file (substring-no-properties file (match-beginning 1))) + (source-directory (expand-file-name alchemist-goto-erlang-source-dir))) + (concat source-directory file)))) + +(defun alchemist-goto--elixir-file-p (file) + (string-match-p "\\.ex\\(s\\)?$" file)) + +(defun alchemist-goto--erlang-file-p (file) + (string-match-p "\\.erl$" file)) + +(defun alchemist-goto--get-full-path-of-alias (module) + (if (not (alchemist-utils--empty-string-p module)) + (let* ((aliases (mapcar (lambda (m) + (when (string-match-p (format "^%s" (car (cdr m))) module) + (replace-regexp-in-string (format "^%s" (car (cdr m))) (car m) module t))) + (alchemist-goto--alises-of-current-buffer))) + (aliases (delete nil aliases))) + (if aliases + (car aliases) + module)))) + +(defun alchemist-goto--string-at-point-p (&optional complete) + "Return non-nil if cursor is at a string." + (save-excursion + (or (and (nth 3 (save-excursion + (let ((pos (point))) + (when complete + (end-of-buffer)) + (parse-partial-sexp 1 pos)))) + (nth 8 (save-excursion + (let ((pos (point))) + (when complete + (end-of-buffer)) + (parse-partial-sexp 1 pos))))) + (and (looking-at "\"\"\"\\|'''\\|\"\\|\'") + (match-beginning 0))))) + +(defun alchemist-goto--symbol-definition-p (symbol) + (alchemist-goto--fetch-symbol-definitions) + (if (member symbol alchemist-goto--symbol-list-bare) + t + nil)) + +(defun alchemist-goto--goto-symbol (symbol) + (let ((position (cdr (assoc symbol alchemist-goto--symbol-name-and-pos-bare)))) + (goto-char (if (overlayp position) (overlay-start position) position)))) + +(defun alchemist-goto-list-symbol-definitions () + "List all symbol definitions in the current file like functions/macros/modules. + +It will jump to the position of the symbol definition after selection." + (interactive) + (alchemist-goto--fetch-symbol-definitions) + (ring-insert find-tag-marker-ring (point-marker)) + (let* ((selected-def (completing-read "Symbol definitions:" alchemist-goto--symbol-list)) + (position (cdr (assoc selected-def alchemist-goto--symbol-name-and-pos)))) + (goto-char (if (overlayp position) (overlay-start position) position)))) + +(defun alchemist-goto--fetch-symbol-definitions () + (alchemist-goto--search-for-symbols "^\\s-*\\(defp?\\|defmacrop?\\|defmodule\\)\s.*")) + +(defface alchemist-goto--def-face + '((t (:inherit font-lock-constant-face))) + "" + :group 'alchemist-goto) + +(defface alchemist-goto--name-face + '((t (:bold t))) + "" + :group 'alchemist-goto) + +(defvar alchemist-goto--symbol-def-extract-regex + "^\\s-*\\(defp?\\|defmacrop?\\|defmodule\\)[ \n\t]+\\([a-z_\?!]+\\)\\(.*\\)\\(do\\|\n\\)?$") + +(defun alchemist-goto--extract-symbol (str) + (save-match-data + (when (string-match alchemist-goto--symbol-def-extract-regex str) + (let ((type (substring str (match-beginning 1) (match-end 1))) + (name (substring str (match-beginning 2) (match-end 2))) + (arguments (substring str (match-beginning 3) (match-end 3)))) + (concat + (propertize type + 'face 'alchemist-goto--def-face) + " " + (propertize name + 'face 'alchemist-goto--name-face) + (replace-regexp-in-string ",?\s+do:.*$" "" (replace-regexp-in-string "\s+do$" "" arguments))))))) + +(defun alchemist-goto--extract-symbol-bare (str) + (save-match-data + (when (string-match alchemist-goto--symbol-def-extract-regex str) + (let ((type (substring str (match-beginning 1) (match-end 1))) + (name (substring str (match-beginning 2) (match-end 2))) + (arguments (substring str (match-beginning 3) (match-end 3)))) + name)))) + +(defun alchemist-goto--get-symbol-from-position (position) + (with-current-buffer (buffer-name) + (save-excursion + (goto-char position) + (end-of-line) + (let* ((end-position (point)) + (line (buffer-substring-no-properties position end-position))) + (alchemist-goto--extract-symbol line))))) + +(defun alchemist-goto--get-symbol-from-position-bare (position) + (with-current-buffer (buffer-name) + (save-excursion + (goto-char position) + (end-of-line) + (let* ((end-position (point)) + (line (buffer-substring-no-properties position end-position))) + (alchemist-goto--extract-symbol-bare line))))) + +(defun alchemist-goto--search-for-symbols (regex) + (setq alchemist-goto--symbol-list '()) + (setq alchemist-goto--symbol-name-and-pos '()) + (with-current-buffer (buffer-name) + (save-excursion + (goto-char (point-max)) + (goto-char (point-min)) + (let () + (save-match-data + (while (re-search-forward regex nil t) + (when (not (alchemist-goto--string-at-point-p t)) + (when (alchemist-goto--get-symbol-from-position (car (match-data))) + (let* ((position (car (match-data))) + (symbol (alchemist-goto--get-symbol-from-position position)) + (symbol-bare (alchemist-goto--get-symbol-from-position-bare position))) + (setq alchemist-goto--symbol-list (append alchemist-goto--symbol-list (list symbol))) + (setq alchemist-goto--symbol-name-and-pos (append alchemist-goto--symbol-name-and-pos (list (cons symbol position)))) + (setq alchemist-goto--symbol-list-bare (append alchemist-goto--symbol-list-bare (list symbol-bare))) + (setq alchemist-goto--symbol-name-and-pos-bare (append alchemist-goto--symbol-name-and-pos-bare (list (cons symbol-bare position))))))))))))) + +(defun alchemist-goto--open-definition (expr) + (let* ((module (alchemist-goto--extract-module expr)) + (module (alchemist-goto--get-full-path-of-alias module)) + (module (if module module "nil")) + (function (alchemist-goto--extract-function expr)) + (function (if function function "\"\""))) + (ring-insert find-tag-marker-ring (point-marker)) + (cond + ((and (string-equal module "nil") + (string-equal major-mode "elixir-mode") + (alchemist-goto--symbol-definition-p function)) + (alchemist-goto--goto-symbol function)) + (t (alchemist-server-goto module function expr) + )))) + +(defun alchemist-goto--open-file (file module function) + (let* ((buf (find-file-noselect file))) + (switch-to-buffer buf) + (beginning-of-buffer) + (cond ((alchemist-goto--elixir-file-p file) + (alchemist-goto--jump-to-elixir-source module function)) + ((alchemist-goto--erlang-file-p file) + (alchemist-goto--jump-to-erlang-source module function))))) + +(defun alchemist-gogo--symbol-definition-regex (symbol) + (format "^\s+\\(defp?\s+%s\(?\\|defmacrop?\s+%s\(?\\)" symbol symbol)) + +(defun alchemist-goto--jump-to-elixir-source (module function) + (let ((function (replace-regexp-in-string "\?" "\\?" function))) + (when (re-search-forward (alchemist-gogo--symbol-definition-regex function) nil t) + (goto-char (match-beginning 0))) + (when (re-search-forward (format "\\(defmodule\\|defimpl\\|defprotocol\\)\s+%s\s+do" module) nil t) + (goto-char (match-beginning 0))))) + +(defun alchemist-goto--jump-to-erlang-source (module function) + (when (re-search-forward (format "\\(^%s\(\\)" function) nil t) + (goto-char (match-beginning 0))) + (when (re-search-forward (format "\\(^-module\(%s\)\\)" (substring module 1)) nil t) + (goto-char (match-beginning 0)))) + +(defun alchemist-goto--context-exists-p () + (interactive) + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "defmodule \\([A-Za-z\._]+\\)\s+" nil t) + t + nil))) + +(defun alchemist-goto--alises-of-current-buffer () + (let* ((aliases '())) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "^\s+alias\s+\\([-:_A-Za-z0-9,\.\?!\]+\\)\\(\s*,\s*as:\s*\\)?\\([-_A-Za-z0-9,\.\?!\]+\\)?\n" nil t) + (let* ((alias (match-string 1)) + (as (if (match-string 3) (match-string 3) nil)) + (as (if as as (car (last (split-string alias "\\.")))))) + (setq aliases (append aliases (list (list alias as))))))) + aliases)) + +;; Public functions + +(defun alchemist-goto-definition-at-point () + "Jump to the elixir expression definition at point." + (interactive) + (let (p1 p2) + (skip-chars-backward "-_A-Za-z0-9.?!:") + (setq p1 (point)) + (skip-chars-forward "-_A-Za-z0-9.?!:") + (setq p2 (point)) + (alchemist-goto--open-definition (buffer-substring-no-properties p1 p2)))) + +(defalias 'alchemist-goto-jump-back 'pop-tag-mark) + +(provide 'alchemist-goto) + +;;; alchemist-goto.el ends here diff --git a/emacs.d/elpa/alchemist-20150624.159/alchemist-help.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-help.el new file mode 100644 index 0000000..5d670cc --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-help.el @@ -0,0 +1,204 @@ +;;; alchemist-help.el --- Functionality for Elixir documentation lookup -*- lexical-binding: t -*- + +;; Copyright © 2014-2015 Samuel Tonini + +;; Author: Samuel Tonini . + +;;; Commentary: + +;; Functionality for Elixir documentation lookup. + +;;; Code: + +(defgroup alchemist-help nil + "Functionality for Elixir documentation lookup." + :prefix "alchemist-help-" + :group 'alchemist) + +;; Variables + +(defcustom alchemist-help-buffer-name "*elixir help*" + "Name of the Elixir help buffer." + :type 'string + :group 'alchemist-help) + +(defvar alchemist-help-search-history '() + "Storage for the search history.") + +(defvar alchemist-help-current-search-text '() + "Stores the current search.") + +;; Faces + +(defface alchemist-help--key-face + '((t (:inherit font-lock-variable-name-face :bold t :foreground "red"))) + "Fontface for the letter keys in the summary." + :group 'alchemist-help) + +(defun alchemist-help--exp-at-point () + "Return the expression under the cursor." + (let (p1 p2) + (save-excursion + (skip-chars-backward "-_A-Za-z0-9.?!:") + (setq p1 (point)) + (skip-chars-forward "-_A-Za-z0-9.?!:") + (setq p2 (point)) + (buffer-substring-no-properties p1 p2)))) + +(defun alchemist-help--execute (search) + (alchemist-server-help-with-complete search)) + +(defun alchemist-help--execute-without-complete (search) + (alchemist-server-help-without-complete search)) + +(defun alchemist-help--bad-search-output-p (string) + (let ((match (or (string-match-p "No documentation for " string) + (string-match-p "Invalid arguments for h helper" string) + (string-match-p "** (TokenMissingError)" string) + (string-match-p "** (SyntaxError)" string) + (string-match-p "** (FunctionClauseError)" string) + (string-match-p "** (CompileError)" string) + (string-match-p "Could not load module" string)))) + (if match + t + nil))) + +(defun alchemist-help--initialize-buffer (content) + (let ((default-directory (if (alchemist-project-root) + (alchemist-project-root) + default-directory))) + (cond + ((alchemist-help--bad-search-output-p content) + (message (propertize + (format "No documentation for [ %s ] found." alchemist-help-current-search-text) + 'face 'alchemist-help--key-face))) + (t + (if (get-buffer alchemist-help-buffer-name) + (kill-buffer alchemist-help-buffer-name)) + (pop-to-buffer alchemist-help-buffer-name) + (setq buffer-undo-list nil) + (let ((inhibit-read-only t) + (buffer-undo-list t)) + (erase-buffer) + (insert content) + (unless (memq 'alchemist-help-current-search-text alchemist-help-search-history) + (add-to-list 'alchemist-help-search-history alchemist-help-current-search-text)) + (delete-matching-lines "do not show this result in output" (point-min) (point-max)) + (delete-matching-lines "^Compiled lib\\/" (point-min) (point-max)) + (ansi-color-apply-on-region (point-min) (point-max)) + (read-only-mode 1) + (alchemist-help-minor-mode 1)))))) + +(defun alchemist-help-minor-mode-key-binding-summary () + (interactive) + (message + (concat "[" (propertize "q" 'face 'alchemist-help--key-face) + "]-quit [" + (propertize "e" 'face 'alchemist-help--key-face) + "]-search-at-point [" + (propertize "m" 'face 'alchemist-help--key-face) + "]-search-marked-region [" + (propertize "s" 'face 'alchemist-help--key-face) + "]-search [" + (propertize "h" 'face 'alchemist-help--key-face) + "]-history [" + (propertize "?" 'face 'alchemist-help--key-face) + "]-keys"))) + +(defun alchemist-help-search-at-point () + "Search through `alchemist-help' with the expression under the cursor." + (interactive) + (let* ((expr (alchemist-help--exp-at-point)) + (module (alchemist-goto--extract-module expr)) + (module (alchemist-goto--get-full-path-of-alias module)) + (module (if module module "")) + (function (alchemist-goto--extract-function expr)) + (function (if function function "")) + (expr (cond + ((and (not (alchemist-utils--empty-string-p module)) + (not (alchemist-utils--empty-string-p function))) + (format "%s.%s" module function)) + ((not (alchemist-utils--empty-string-p module)) + module) + (t + expr)))) + (alchemist-help--execute expr))) + +(defun alchemist-help-search-marked-region (begin end) + "Run `alchemist-help' with the marked region. +Argument BEGIN where the mark starts. +Argument END where the mark ends." + (interactive "r") + (let* ((expr (filter-buffer-substring begin end)) + (module (alchemist-goto--extract-module expr)) + (module (alchemist-goto--get-full-path-of-alias module)) + (module (if module module "")) + (function (alchemist-goto--extract-function expr)) + (function (if function function "")) + (expr (cond + ((and (not (alchemist-utils--empty-string-p module)) + (not (alchemist-utils--empty-string-p function))) + (format "%s.%s" module function)) + ((not (alchemist-utils--empty-string-p module)) + module) + (t + expr)))) + (alchemist-help--execute expr))) + +(defun alchemist-help--elixir-modules-to-list (str) + (let* ((modules (split-string str)) + (modules (mapcar (lambda (m) + (when (string-match-p "Elixir\\." m) + (replace-regexp-in-string "Elixir\\." "" m))) modules)) + (modules (delete nil modules)) + (modules (cl-sort modules 'string-lessp :key 'downcase)) + (modules (delete-dups modules))) + modules)) + +(defvar alchemist-help-minor-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "q") #'quit-window) + (define-key map (kbd "e") #'alchemist-help-search-at-point) + (define-key map (kbd "m") #'alchemist-help-search-marked-region) + (define-key map (kbd "s") #'alchemist-help) + (define-key map (kbd "h") #'alchemist-help-history) + (define-key map (kbd "M-.") #'alchemist-goto-definition-at-point) + (define-key map (kbd "?") #'alchemist-help-minor-mode-key-binding-summary) + map) + "Keymap for `alchemist-help-minor-mode'.") + +(define-minor-mode alchemist-help-minor-mode + "Minor mode for displaying elixir help." + :group 'alchemist-help + :keymap alchemist-help-minor-mode-map) + +(defun alchemist-help () + "Load Elixir documentation for SEARCH." + (interactive) + (alchemist-server-help)) + +(defun alchemist-help-history (search) + "Load Elixir from the documentation history for SEARCH." + (interactive + (list + (completing-read "Elixir help history: " alchemist-help-search-history nil nil ""))) + (alchemist-help--execute-without-complete search)) + +(provide 'alchemist-help) + +;;; alchemist-help.el ends here diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-hooks.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-hooks.el similarity index 100% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-hooks.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-hooks.el diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-iex.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-iex.el similarity index 79% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-iex.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-iex.el index bee1c83..3c78d67 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-iex.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-iex.el @@ -37,17 +37,40 @@ :type 'string :group 'alchemist-iex) +(defcustom alchemist-iex-prompt-read-only t + "If non-nil, the prompt will be read-only." + :type 'boolean + :group 'alchemist-iex) + (defvar alchemist-iex-buffer nil "The buffer in which the Elixir IEx process is running.") (defvar alchemist-iex-mode-hook nil "Hook for customizing `alchemist-iex-mode'.") +(defvar alchemist-iex-mode-map + (let ((map (nconc (make-sparse-keymap) comint-mode-map))) + (define-key map "\t" 'completion-at-point) + (define-key map (kbd (format "%s i r" alchemist-key-command-prefix)) 'alchemist-iex-open-input-ring) + (define-key map (kbd (format "%s i c" alchemist-key-command-prefix)) 'alchemist-iex-clear-buffer) + (define-key map (kbd (format "%s h e" alchemist-key-command-prefix)) 'alchemist-help-search-at-point) + (define-key map (kbd (format "%s h m" alchemist-key-command-prefix)) 'alchemist-help-search-marked-region) + (define-key map (kbd "M-.") 'alchemist-goto-definition-at-point) + map)) + +(eval-after-load 'company + '(progn + (defun alchemist-iex--set-company-as-completion-at-point-function () + (setq completion-at-point-functions '(company-complete))) + (add-hook 'alchemist-iex-mode-hook 'alchemist-iex--set-company-as-completion-at-point-function))) + (define-derived-mode alchemist-iex-mode comint-mode "Alchemist-IEx" - "Major mode for interacting with an Elixir IEx process." + "Major mode for interacting with an Elixir IEx process. + +\\" nil "Alchemist-IEx" - (set (make-local-variable 'comint-prompt-regexp) - "^iex(\\([0-9]+\\|[a-zA-Z_@]+\\))> ") + (set (make-local-variable 'comint-prompt-regexp) "^iex\(.+\)>") + (set (make-local-variable 'comint-prompt-read-only) alchemist-iex-prompt-read-only) (set (make-local-variable 'comint-input-autoexpand) nil)) (defun alchemist-iex-command (arg) @@ -139,6 +162,13 @@ and jump to the buffer." (let ((comint-buffer-maximum-size 0)) (comint-truncate-buffer))) +(defun alchemist-iex-open-input-ring () + "Open the buffer containing the input history." + (interactive) + (progn + (comint-dynamic-list-input-ring) + (other-window 1))) + ;;;###autoload (defalias 'run-elixir 'alchemist-iex-run) (defalias 'inferior-elixir 'alchemist-iex-run) diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-message.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-message.el similarity index 100% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-message.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-message.el diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-mix.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-mix.el similarity index 57% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-mix.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-mix.el index eed16dd..7375c82 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-mix.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-mix.el @@ -37,9 +37,23 @@ :type 'string :group 'alchemist-mix) +(defcustom alchemist-mix-test-default-options '("--exclude pending:true") + "Default options for alchemist test command." + :type '(repeat string) + :group 'alchemist-mix) + +(defcustom alchemist-mix-env nil + "The default mix env to run mix commands with. If nil, the mix env is +not set explicitly." + :type '(string boolean) + :group 'alchemist-mix) + (defvar alchemist-mix-buffer-name "*mix*" "Name of the mix output buffer.") +(defvar alchemist-mix--envs '("dev" "prod" "test") + "The list of mix envs to use as defaults.") + (defvar alchemist-mix--deps-commands '("deps" "deps.clean" "deps.compile" "deps.get" "deps.unlock" "deps.unlock") "List of all deps.* available commands.") @@ -51,9 +65,26 @@ (defvar alchemist-mix--local-install-option-types '("path" "url") "List of local.install option types.") +;; Private functions + (defun alchemist-mix--completing-read (prompt cmdlist) (completing-read prompt cmdlist nil t nil nil (car cmdlist))) +(defun alchemist-mix--test-file (filename) + "Run a specific FILENAME as argument for the mix command test." + (when (not (file-exists-p filename)) + (error "The given file doesn't exists")) + (alchemist-mix-execute `("test" ,(expand-file-name filename) ,@alchemist-mix-test-default-options) + alchemist-test-mode-buffer-name)) + +(defun alchemist-mix--commands () + (let ((mix-cmd-list (shell-command-to-string (format "%s help" alchemist-mix-command)))) + (mapcar (lambda (s) + (cdr (split-string (car (split-string s "#"))))) + (cdr (split-string mix-cmd-list "\n"))))) + +;; Public functions + (defun alchemist-mix-display-mix-buffer () "Display the mix buffer when exists." (interactive) @@ -63,12 +94,14 @@ (defun alchemist-mix-new (name) "Create a new elixir project named by NAME." (interactive "Gmix new: ") - (alchemist-mix-execute (list "new" (expand-file-name name)))) + (alchemist-mix-execute (list "new" (expand-file-name name)) + alchemist-mix-buffer-name)) (defun alchemist-mix-test () "Run the whole elixir test suite." (interactive) - (alchemist-mix-execute (list "test"))) + (alchemist-mix-execute `("test" ,@alchemist-mix-test-default-options) + alchemist-test-mode-buffer-name)) (defun alchemist-mix-test-this-buffer () "Run the current buffer through mix test." @@ -80,47 +113,44 @@ (interactive "Fmix test: ") (alchemist-mix--test-file (expand-file-name filename))) -(defun alchemist-mix--test-file (filename) - "Run a specific FILENAME as argument for the mix command test." - (when (not (file-exists-p filename)) - (error "The given file doesn't exists")) - (alchemist-mix-execute (list "test" (expand-file-name filename)))) - (defun alchemist-mix-test-at-point () "Run the test at point." (interactive) (let* ((line (line-number-at-pos (point))) (file-and-line (format "%s:%s" buffer-file-name line))) - (alchemist-mix-execute (list "test" file-and-line)))) - -(defun alchemist-mix-compile (command) - "Compile the whole elixir project." - (interactive "Mmix compile: ") - (alchemist-mix-execute (list "compile" command))) - -(defun alchemist-mix-run (command) - "Runs the given file or expression in the context of the application." - (interactive "Mmix run: ") - (alchemist-mix-execute (list "run" command))) - -(defun alchemist-mix-deps-with-prompt (command) + (alchemist-mix-execute (list "test" file-and-line) + alchemist-test-mode-buffer-name))) + +(defun alchemist-mix-compile (command &optional prefix) + "Compile the whole elixir project. Prompt for the mix env if the prefix +arg is set." + (interactive "Mmix compile: \nP") + (alchemist-mix-execute (list "compile" command) + alchemist-mix-buffer-name prefix)) + +(defun alchemist-mix-run (command &optional prefix) + "Runs the given file or expression in the context of the application. +Prompt for the mix env if the prefix arg is set." + (interactive "Mmix run: \nP") + (alchemist-mix-execute (list "run" command) + alchemist-mix-buffer-name prefix)) + +(defun alchemist-mix-deps-with-prompt (command &optional prefix) "Prompt for mix deps commands." (interactive - (list (alchemist-mix--completing-read "mix deps: " alchemist-mix--deps-commands))) - (alchemist-mix-execute (list command))) - -(defun alchemist-mix--commands () - (let ((mix-cmd-list (shell-command-to-string (format "%s help" alchemist-mix-command)))) - (mapcar (lambda (s) - (cdr (split-string (car (split-string s "#"))))) - (cdr (split-string mix-cmd-list "\n"))))) + (list (alchemist-mix--completing-read "mix deps: " alchemist-mix--deps-commands) + current-prefix-arg)) + (alchemist-mix-execute (list command) + alchemist-mix-buffer-name prefix)) -(defun alchemist-mix (command) - "Prompt for mix commands." +(defun alchemist-mix (command &optional prefix) + "Prompt for mix commands. Prompt for the mix env if the prefix arg is set." (interactive - (list (alchemist-mix--completing-read "mix: " (alchemist-mix--commands)))) + (list (alchemist-mix--completing-read "mix: " (alchemist-mix--commands)) + current-prefix-arg)) (let ((command (read-string "mix " (concat command " ")))) - (alchemist-mix-execute (list command)))) + (alchemist-mix-execute (list command) + alchemist-mix-buffer-name prefix))) (defun alchemist-mix-local-with-prompt (command) "Prompt for mix local commands." @@ -128,7 +158,8 @@ (list (alchemist-mix--completing-read "mix local: " alchemist-mix--local-commands))) (if (string= command "local.install") (call-interactively 'alchemist-mix-local-install) - (alchemist-mix-execute (list command)))) + (alchemist-mix-execute (list command) + alchemist-mix-buffer-name))) (defun alchemist-mix-local-install (path-or-url) "Prompt for mix local.install PATH-OR-URL." @@ -143,30 +174,42 @@ (defun alchemist-mix-local-install-with-path (path) "Runs local.install and prompt for a PATH as argument." (interactive "fmix local.install PATH: ") - (alchemist-mix-execute (list "local.install" path))) + (alchemist-mix-execute (list "local.install" path) + alchemist-mix-buffer-name)) (defun alchemist-mix-local-install-with-url (url) "Runs local.install and prompt for a URL as argument." (interactive "Mmix local.install URL: ") - (alchemist-mix-execute (list "local.install" url))) - -(defun alchemist-mix-hex-search (command) - "Display packages matching the given search query." - (interactive "Mmix hex.search: ") - (alchemist-mix-execute (list "hex.search" command))) - -(defun alchemist-mix-help (command) - "Show help output for a specific mix command." - (interactive "Mmix help: ") - (alchemist-mix-execute (list "help" command))) - -(defun alchemist-mix-execute (cmdlist) - "Run a mix command." - (interactive "Mmix: ") - (let ((old-directory default-directory)) + (alchemist-mix-execute (list "local.install" url) + alchemist-mix-buffer-name)) + +(defun alchemist-mix-hex-search (command &optional prefix) + "Display packages matching the given search query. Prompt for the mix env +if the prefix arg is set." + (interactive "Mmix hex.search: \nP") + (alchemist-mix-execute (list "hex.search" command) + alchemist-mix-buffer-name prefix)) + +(defun alchemist-mix-help (command &optional prefix) + "Show help output for a specific mix command. Prompt for the mix env if +the prefix arg is set." + (interactive "Mmix help: \nP") + (alchemist-mix-execute (list "help" command) + alchemist-mix-buffer-name prefix)) + +(defun alchemist-mix-execute (cmdlist buffer-name &optional prefix) + "Run a mix command. Prompt for the mix env if the prefix arg is set." + (interactive "Mmix: \nP") + (let ((old-directory default-directory) + (mix-env (if prefix + (completing-read "mix env: " + alchemist-mix--envs nil nil alchemist-mix-env) + alchemist-mix-env))) (alchemist-project--establish-root-directory) - (alchemist-buffer-run (alchemist-utils--build-runner-cmdlist (list alchemist-mix-command cmdlist)) - alchemist-mix-buffer-name) + (alchemist-buffer-run (alchemist-utils--build-runner-cmdlist + (list (if mix-env (concat "MIX_ENV=" mix-env) "") + alchemist-mix-command cmdlist)) + buffer-name) (cd old-directory))) (provide 'alchemist-mix) diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-pkg.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-pkg.el similarity index 67% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-pkg.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-pkg.el index 4497230..4cee708 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-pkg.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-pkg.el @@ -1,4 +1,4 @@ -(define-package "alchemist" "20150201.2244" "Elixir tooling integration into Emacs" +(define-package "alchemist" "20150624.159" "Elixir tooling integration into Emacs" '((emacs "24")) :url "http://www.github.com/tonini/alchemist.el" :keywords '("languages" "mix" "elixir" "elixirc" "hex")) diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-project.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-project.el similarity index 72% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-project.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-project.el index 93aa108..b643ff0 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-project.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-project.el @@ -26,69 +26,12 @@ ;;; Code: (require 'cl) -(require 'json) (defgroup alchemist-project nil "API to identify Elixir mix projects." :prefix "alchemist-help-" :group 'alchemist) -(defcustom alchemist-project-config-filename ".alchemist" - "Name of the file which holds the Elixir project setup." - :type 'string - :group 'alchemist) - -(defcustom alchemist-project-compile-when-needed nil - "When `t', it compiles the Elixir project codebase when needed. - -For example: -If documentation lookup or completion for code is made, it first tries to -compile the current Elixir project codebase. This makes sure that the -documentation and completion is always up to date with the codebase. - -Please be aware that when the compilation fails, no documentation or -completion will be work. -" - :type 'string - :group 'alchemist) - -(defun alchemist-project-toggle-compile-when-needed () - "" - (interactive) - (if alchemist-project-compile-when-needed - (setq alchemist-project-compile-when-needed nil) - (setq alchemist-project-compile-when-needed t)) - (if alchemist-project-compile-when-needed - (message "Compilation of project when needed is enabled") - (message "Compilation of project when needed is disabled"))) - -(defun alchemist-project--load-compile-when-needed-setting () - (let ((config (gethash "compile-when-needed" (alchemist-project-config)))) - (if config - (intern config) - alchemist-project-compile-when-needed))) - -(defun alchemist-project--config-filepath () - "Return the path to the config file." - (format "%s/%s" - (alchemist-project-root) - alchemist-project-config-filename)) - -(defun alchemist-project--config-exists-p () - "Check if project config file exists." - (file-exists-p (alchemist-project--config-filepath))) - -(defun alchemist-project-config () - "Return the current Elixir project configs." - (let* ((json-object-type 'hash-table) - (config (if (alchemist-project--config-exists-p) - (json-read-from-string - (with-temp-buffer - (insert-file-contents (alchemist-project--config-filepath)) - (buffer-string))) - (make-hash-table :test 'equal)))) - config)) - (defvar alchemist-project-root-indicators '("mix.exs") "list of file-/directory-names which indicate a root of a elixir project") @@ -125,16 +68,36 @@ completion will be work. (when project-root (setq default-directory project-root)))) -(defun alchemist-project-open-tests-for-current-file () - "Opens the appropriate test file for the current buffer file -in a new window." +(defun alchemist-project-toggle-file-and-tests-other-window () + "Toggle between a file and its tests in other window." + (interactive) + (if (alchemist-utils--is-test-file-p) + (alchemist--project-open-file-for-current-tests 'find-file-other-window) + (alchemist--project-open-tests-for-current-file 'find-file-other-window))) + +(defun alchemist-project-toggle-file-and-tests () + "Toggle between a file and its tests in the current window." (interactive) + (if (alchemist-utils--is-test-file-p) + (alchemist--project-open-file-for-current-tests 'find-file) + (alchemist--project-open-tests-for-current-file 'find-file))) + +(defun alchemist--project-open-file-for-current-tests (toggler) + "Open the appropriate implementation file for the current buffer by calling TOGGLER with filename." + (let* ((filename (file-relative-name (buffer-file-name) (alchemist-project-root))) + (filename (replace-regexp-in-string "^test/" "lib/" filename)) + (filename (replace-regexp-in-string "_test\.exs$" "\.ex" filename)) + (filename (format "%s/%s" (alchemist-project-root) filename))) + (funcall toggler filename))) + +(defun alchemist--project-open-tests-for-current-file (toggler) + "Opens the appropriate test file by calling TOGGLER with filename." (let* ((filename (file-relative-name (buffer-file-name) (alchemist-project-root))) (filename (replace-regexp-in-string "^lib/" "test/" filename)) (filename (replace-regexp-in-string "\.ex$" "_test\.exs" filename)) (filename (format "%s/%s" (alchemist-project-root) filename))) (if (file-exists-p filename) - (find-file-other-window filename) + (funcall toggler filename) (if (y-or-n-p "No test file found; create one now?") (alchemist-project--create-test-for-current-file filename (current-buffer)) @@ -187,7 +150,7 @@ Point is left in a convenient location." (shell-command-to-string (concat "find \"" directory - "\" -type f | grep \"_test\.exs\" | grep -v \"/.git/\" | grep -v \"/.yardoc/\"")))))))) + "\" -type f | grep \"_test\.exs\" | grep -v \"/.git/\"")))))))) (defun alchemist-project-name () "Return the name of the current Elixir project." diff --git a/emacs.d/elpa/alchemist-20150624.159/alchemist-server.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-server.el new file mode 100644 index 0000000..7753e22 --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-server.el @@ -0,0 +1,308 @@ +;;; alchemist-server.el --- -*- lexical-binding: t -*- + +;; Copyright © 2015 Samuel Tonini + +;; Author: Samuel Tonini . + +;;; Commentary: + +;; + +;;; Code: + +(defvar alchemist-server + (concat (file-name-directory load-file-name) "server/server.exs") + "Script file with alchemist server.") + +(defvar alchemist-server--processes '()) +(defvar alchemist-server--env "dev") + +(defvar alchemist-server-command + (format "elixir %s %s" alchemist-server alchemist-server--env)) + +(defun alchemist-server-start (env) + "Start alchemist server for the current mix project in specific ENV." + (interactive (list + (completing-read (format "(Alchemist-Server) run in environment: (default: %s) " alchemist-server--env) + alchemist-mix--envs nil nil nil))) + (when (alchemist-server--process-p) + (kill-process (alchemist-server--process))) + (alchemist-server--start-with-env env)) + +(defun alchemist-server--start () + (unless (alchemist-server--process-p) + (alchemist-server--start-with-env alchemist-server--env))) + +(defun alchemist-server--start-with-env (env) + (let* ((process-name (alchemist-server--process-name)) + (default-directory (if (string= process-name "alchemist-server") + default-directory + process-name)) + (server-command (format "elixir %s %s" alchemist-server env)) + (process (start-process-shell-command process-name "*alchemist-server*" server-command))) + (set-process-query-on-exit-flag process nil) + (alchemist-server--store-process process))) + +(defun alchemist-server--store-process (process) + (let ((process-name (alchemist-server--process-name))) + (if (cdr (assoc process-name alchemist-server--processes)) + (setq alchemist-server--processes + (delq (assoc process-name alchemist-server--processes) alchemist-server--processes))) + (add-to-list 'alchemist-server--processes (cons process-name process)))) + +(defun alchemist-server--process-p () + (process-live-p (alchemist-server--process))) + +(defun alchemist-server--process () + (cdr (assoc (alchemist-server--process-name) alchemist-server--processes))) + +(defun alchemist-server--process-name () + (let* ((process-name (alchemist-project-root)) + (process-name (if process-name + process-name + "alchemist-server"))) + process-name)) + +(defun alchemist-server-eval-filter (process output) + (setq alchemist-server--output (cons output alchemist-server--output)) + (if (string-match "END-OF-EVAL$" output) + (let* ((output (apply #'concat (reverse alchemist-server--output))) + (output (replace-regexp-in-string "END-OF-EVAL" "" output)) + (output (replace-regexp-in-string "\n$" "" output))) + (funcall alchemist-server-eval-callback output)))) + +(defun alchemist-server-eval-quoted-filter (process output) + (setq alchemist-server--output (cons output alchemist-server--output)) + (if (string-match "END-OF-QUOTE$" output) + (let* ((output (apply #'concat (reverse alchemist-server--output))) + (output (replace-regexp-in-string "END-OF-QUOTE" "" output)) + (output (replace-regexp-in-string "\n$" "" output))) + (funcall alchemist-server-eval-callback output)))) + +(defun alchemist-server-doc-filter (process output) + (setq alchemist-server--output (cons output alchemist-server--output)) + (if (string-match "END-OF-DOC$" output) + (let* ((string (apply #'concat (reverse alchemist-server--output))) + (string (replace-regexp-in-string "END-OF-DOC$" "" string))) + (alchemist-help--initialize-buffer string)))) + +(defun alchemist-server-complete-canidates-filter (process output) + (setq alchemist-server--output (cons output alchemist-server--output)) + (unless (alchemist-utils--empty-string-p output) + (if (string-match "END-OF-COMPLETE$" output) + (let* ((string (apply #'concat (reverse alchemist-server--output))) + (string (replace-regexp-in-string "END-OF-COMPLETE$" "" string)) + (candidates (if (not (alchemist-utils--empty-string-p string)) + (alchemist-complete--output-to-list + (alchemist--utils-clear-ansi-sequences string)) + '())) + (candidates (if candidates + (remove-duplicates candidates) + '())) + (candidates (if candidates + (alchemist-complete--build-candidates candidates) + '()))) + (alchemist-complete--serve-candidates-to-company candidates))))) + +(defun alchemist-server-complete-canidates-filter-with-context (process output) + (setq alchemist-server--output (cons output alchemist-server--output)) + (if (string-match "END-OF-COMPLETE-WITH-CONTEXT$" output) + (let* ((string (apply #'concat (reverse alchemist-server--output))) + (string (replace-regexp-in-string "END-OF-COMPLETE-WITH-CONTEXT$" "" string)) + (candidates (if (not (alchemist-utils--empty-string-p string)) + (alchemist-complete--output-to-list + (alchemist--utils-clear-ansi-sequences string)) + '())) + (candidates (if candidates + (remove-duplicates candidates) + '())) + (candidates (if candidates + (alchemist-complete--build-candidates candidates) + '()))) + (alchemist-complete--serve-candidates-to-company candidates)))) + +(defun alchemist-server-complete-filter (process output) + (with-local-quit + (setq alchemist-server--output (cons output alchemist-server--output)) + (if (string-match "END-OF-COMPLETE$" output) + (let* ((string (apply #'concat (reverse alchemist-server--output))) + (string (replace-regexp-in-string "END-OF-COMPLETE$" "" string)) + (candidates (alchemist-complete--output-to-list + (alchemist--utils-clear-ansi-sequences string)))) + (funcall alchemist-server-help-callback candidates))))) + +(defun alchemist-server-help-complete-modules-filter (process output) + (with-local-quit + (setq alchemist-server--output (cons output alchemist-server--output)) + (if (string-match "END-OF-MODULES$" output) + (let* ((output (apply #'concat (reverse alchemist-server--output))) + (modules (alchemist-help--elixir-modules-to-list output)) + (search (completing-read + "Elixir help: " + modules + nil + nil + nil))) + (alchemist-help--execute (if (string-match-p "\\.$" search) + search + (concat search "."))))))) + +(defun alchemist-server-goto-filter (process output) + (setq alchemist-server--output (cons output alchemist-server--output)) + (if (string-match "END-OF-SOURCE$" output) + (let* ((output (apply #'concat (reverse alchemist-server--output))) + (output (replace-regexp-in-string "END-OF-SOURCE" "" output)) + (output (replace-regexp-in-string "\n" "" output)) + (file (replace-regexp-in-string "source-file-path:" "" output))) + (funcall alchemist-server-goto-callback file)))) + +(defun alchemist-server-goto (module function expr) + (setq alchemist-server--output nil) + (alchemist-server--start) + (setq alchemist-server-goto-callback (lambda (file) + (cond ((alchemist-utils--empty-string-p file) + (message "Don't know how to find: %s" expr)) + ((file-exists-p file) + (alchemist-goto--open-file file module function)) + ((alchemist-goto--elixir-file-p file) + (let* ((elixir-source-file (alchemist-goto--build-elixir-ex-core-file file))) + (if (file-exists-p elixir-source-file) + (alchemist-goto--open-file elixir-source-file module function) + (message "Don't know how to find: %s" expr)))) + ((alchemist-goto--erlang-file-p file) + (let* ((elixir-source-file (alchemist-goto--build-elixir-erl-core-file file)) + (erlang-source-file (alchemist-goto--build-erlang-core-file file))) + (cond ((file-exists-p elixir-source-file) + (alchemist-goto--open-file elixir-source-file module function)) + ((file-exists-p erlang-source-file) + (alchemist-goto--open-file erlang-source-file module function)) + (t + (message "Don't know how to find: %s" expr))))) + (t + (pop-tag-mark) + (message "Don't know how to find: %s" expr))))) + (set-process-filter (alchemist-server--process) #'alchemist-server-goto-filter) + (process-send-string (alchemist-server--process) (format "SOURCE %s,%s\n" module function))) + +(defun alchemist-server-help () + (setq alchemist-server--output nil) + (alchemist-server--start) + (set-process-filter (alchemist-server--process) #'alchemist-server-help-complete-modules-filter) + (process-send-string (alchemist-server--process) "MODULES\n")) + +(defun alchemist-server-eval (exp) + (setq alchemist-server--output nil) + (alchemist-server--start) + (setq alchemist-server-eval-callback (lambda (string) + (message "%s" string))) + (set-process-filter (alchemist-server--process) #'alchemist-server-eval-filter) + (process-send-string (alchemist-server--process) (format "EVAL %s\n" exp))) + +(defun alchemist-server-eval-and-insert (exp) + (setq alchemist-server--output nil) + (alchemist-server--start) + (setq alchemist-server-eval-callback (lambda (string) + (alchemist-eval--insert string))) + (set-process-filter (alchemist-server--process) #'alchemist-server-eval-filter) + (process-send-string (alchemist-server--process) (format "EVAL %s\n" exp))) + +(defun alchemist-server-eval-quote (exp) + (setq alchemist-server--output nil) + (alchemist-server--start) + (setq alchemist-server-eval-callback (lambda (string) + (message "%s" string))) + (set-process-filter (alchemist-server--process) #'alchemist-server-eval-quoted-filter) + (process-send-string (alchemist-server--process) (format "QUOTE %s\n" exp))) + +(defun alchemist-server-eval-quote-and-insert (exp) + (setq alchemist-server--output nil) + (alchemist-server--start) + (setq alchemist-server-eval-callback (lambda (string) + (alchemist-eval--insert string))) + (set-process-filter (alchemist-server--process) #'alchemist-server-eval-quoted-filter) + (process-send-string (alchemist-server--process) (format "QUOTE %s\n" exp))) + +(defun alchemist-server-complete-candidates (exp) + (setq alchemist-server--output nil) + (setq alchemist-server--last-completion-exp exp) + (alchemist-server--start) + (if (or (equal major-mode 'alchemist-iex-mode) + (not (alchemist-goto--context-exists-p))) + (alchemist-server--iex-complete exp) + (alchemist-server--complete-with-context exp))) + +(defun alchemist-server--complete-with-context (exp) + (let* ((module (alchemist-goto--current-module-name)) + (modules '()) + (aliases (mapcar (lambda (a) + (if (not (or (alchemist-utils--empty-string-p (replace-regexp-in-string "\\.$" "" (car (cdr a)))) + (string= (replace-regexp-in-string "\\.$" "" (car (cdr a))) + (replace-regexp-in-string "\\.$" "" (car a))))) + (format "{%s, %s}" + (if (alchemist-utils--empty-string-p (replace-regexp-in-string "\\.$" "" (car (cdr a)))) + (replace-regexp-in-string "\\.$" "" (car a)) + (replace-regexp-in-string "\\.$" "" (car (cdr a)))) + (replace-regexp-in-string "\\.$" "" (car a)) + ))) (alchemist-goto--alises-of-current-buffer))) + (use-modules (alchemist-goto--use-modules-in-the-current-module-context)) + (import-modules (alchemist-goto--import-modules-in-the-current-module-context))) + (if (not (alchemist-utils--empty-string-p module)) + (push module modules)) + (push use-modules modules) + (push import-modules modules) + (if (not modules) + (progn + (set-process-filter (alchemist-server--process) #'alchemist-server-complete-canidates-filter) + (process-send-string (alchemist-server--process) (format "COMPLETE %s\n" exp))) + (progn + (set-process-filter (alchemist-server--process) #'alchemist-server-complete-canidates-filter-with-context) + (process-send-string (alchemist-server--process) (format "COMPLETE-WITH-CONTEXT %s;[%s];%s\n" + exp + (mapconcat #'identity (alchemist-utils--flatten modules) ",") + (format "[%s]" (if (mapconcat #'identity aliases ",") + (mapconcat #'identity aliases ",") + "")))))))) + +(defun alchemist-server--iex-complete (exp) + (set-process-filter (alchemist-server--process) #'alchemist-server-complete-canidates-filter) + (process-send-string (alchemist-server--process) (format "COMPLETE %s\n" exp))) + +(defun alchemist-server-help-with-complete (search) + (setq alchemist-server--output nil) + (alchemist-server--start) + (setq alchemist-server-help-callback (lambda (candidates) + (if candidates + (let* ((search (alchemist-complete--completing-prompt search candidates))) + (alchemist-server-help-without-complete search)) + (message "No documentation found for '%s'" search)) + )) + (set-process-filter (alchemist-server--process) #'alchemist-server-complete-filter) + (process-send-string (alchemist-server--process) (format "COMPLETE %s\n" search))) + +(defun alchemist-server-help-without-complete (search) + (setq alchemist-help-current-search-text search) + (setq alchemist-server--output nil) + (alchemist-server--start) + (setq alchemist-server--output nil) + (set-process-filter (alchemist-server--process) #'alchemist-server-doc-filter) + (process-send-string (alchemist-server--process) (format "DOC %s\n" search))) + + +(provide 'alchemist-server) + +;;; alchemist-server.el ends here diff --git a/emacs.d/elpa/alchemist-20150624.159/alchemist-test-mode.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-test-mode.el new file mode 100644 index 0000000..0b04d18 --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-test-mode.el @@ -0,0 +1,169 @@ +;;; alchemist-test-mode.el --- Minor mode for Elixir test files. + +;; Copyright © 2015 Samuel Tonini + +;; Author: Samuel Tonini . + +;;; Commentary: + +;; Minor mode for Elixir test files. + +;;; Code: + +(defgroup alchemist-test-mode nil + "Minor mode for Elixir ExUnit files." + :prefix "alchemist-test-mode-" + :group 'alchemist) + +;; Variables + +(defvar alchemist-test-mode-buffer-name "*alchemist-test-report*" + "Name of the test report buffer.") + +(defcustom alchemist-test-mode-highlight-tests t + "Non-nil means that specific functions for testing will +be highlighted with more significant font faces." + :type 'boolean + :group 'alchemist-test-mode) + +(defvar alchemist-test-at-point #'alchemist-mix-test-at-point) +(defvar alchemist-test-this-buffer #'alchemist-mix-test-this-buffer) +(defvar alchemist-test #'alchemist-mix-test) +(defvar alchemist-test-file #'alchemist-mix-test-file) +(defvar alchemist-test-jump-to-previous-test #'alchemist-test-mode-jump-to-previous-test) +(defvar alchemist-test-jump-to-next-test #'alchemist-test-mode-jump-to-next-test) +(defvar alchemist-test-list-tests #'alchemist-test-mode-list-tests) + +(defvar alchemist-test-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c , s") alchemist-test-at-point) + (define-key map (kbd "C-c , v") alchemist-test-this-buffer) + (define-key map (kbd "C-c , a") alchemist-test) + (define-key map (kbd "C-c , f") alchemist-test-file) + (define-key map (kbd "C-c , p") alchemist-test-jump-to-previous-test) + (define-key map (kbd "C-c , n") alchemist-test-jump-to-next-test) + (define-key map (kbd "C-c , l") alchemist-test-list-tests) + map) + "Keymap for `alchemist-test-mode'.") + +(let ((whitespace-opt "[[:space:]]*") + (whitespace "[[:space:]]+")) + (setq alchemist-test-mode--test-regex + (concat + "\\(^" whitespace-opt "test" whitespace "\\(?10:.+\\)" whitespace "do" whitespace-opt "$" + "\\|" + whitespace " [0-9]+) test .+\\)"))) + +;; Private functions + +(defun alchemist-test-mode--buffer-contains-tests-p () + "Return nil if the current buffer contains no tests, non-nil if it does." + (save-excursion + (save-match-data + (beginning-of-buffer) + (re-search-forward alchemist-test-mode--test-regex nil t)))) + +(defun alchemist-test-mode--jump-to-test (search-fn reset-fn) + "Move the point to the next/previous test, based on `search-fn' (which is the +function that searches for the next test, can be re-search-forward or +re-search-backward) and `reset-fn' (which is used when wrapping at the +beginning/end of the buffer if no results were found)." + (when (alchemist-test-mode--buffer-contains-tests-p) + (save-match-data + (unless (funcall search-fn alchemist-test-mode--test-regex nil t) + (funcall reset-fn) + (funcall search-fn alchemist-test-mode--test-regex nil t)) + (back-to-indentation)))) + +(defun alchemist-test-mode--tests-in-buffer () + "Return an alist of tests in this buffer. + +The keys in the list are the test names (e.g., the string passed to the test/2 +macro) while the values are the position at which the test matched." + (save-match-data + (save-excursion + (beginning-of-buffer) + (let ((tests '())) + (while (re-search-forward alchemist-test-mode--test-regex nil t) + (let* ((position (car (match-data))) + (matched-string (match-string 10))) + (set-text-properties 0 (length matched-string) nil matched-string) + (add-to-list 'tests (cons matched-string position) t))) + tests)))) + +;; Public functions + +(defun alchemist-test-mode-jump-to-next-test () + "Jump to the next ExUnit test. If there are no tests after the current +position, jump to the first test in the buffer. Do nothing if there are no tests +in this buffer." + (interactive) + (alchemist-test-mode--jump-to-test 're-search-forward 'beginning-of-buffer)) + +(defun alchemist-test-mode-jump-to-previous-test () + "Jump to the previous ExUnit test. If there are no tests before the current +position, jump to the last test in the buffer. Do nothing if there are no tests +in this buffer." + (interactive) + (alchemist-test-mode--jump-to-test 're-search-backward 'end-of-buffer)) + +(defun alchemist-test-mode-list-tests () + "List ExUnit tests (calls to the test/2 macro) in the current buffer and jump +to the selected one." + (interactive) + (let* ((tests (alchemist-test-mode--tests-in-buffer)) + (selected (completing-read "Test: " tests)) + (position (cdr (assoc selected tests)))) + (goto-char position) + (back-to-indentation))) + +(defun alchemist-test-mode--highlight-syntax () + (if alchemist-test-mode-highlight-tests + (font-lock-add-keywords nil + '(("^\s+\\(test\\)\s+" 1 + font-lock-variable-name-face t) + ("^\s+\\(assert[_a-z]*\\|refute[_a-z]*\\)\s+" 1 + font-lock-type-face t) + ("^\s+\\(assert[_a-z]*\\|refute[_a-z]*\\)\(" 1 + font-lock-type-face t))))) + + +;;;###autoload +(define-minor-mode alchemist-test-mode + "Minor mode for Elixir ExUnit files. + +The following commands are available: + +\\{alchemist-test-mode-map}" + :lighter "" :keymap alchemist-test-mode-map + :group 'alchemist + (when alchemist-test-mode + (alchemist-test-mode--highlight-syntax))) + +;;;###autoload +(defun alchemist-test-enable-mode () + (if (alchemist-utils--is-test-file-p) + (alchemist-test-mode))) + +;;;###autoload +(dolist (hook '(alchemist-mode-hook)) + (add-hook hook 'alchemist-test-enable-mode)) + +(provide 'alchemist-test-mode) + +;;; alchemist-test-mode.el ends here diff --git a/emacs.d/elpa/alchemist-20150201.2244/alchemist-utils.el b/emacs.d/elpa/alchemist-20150624.159/alchemist-utils.el similarity index 88% rename from emacs.d/elpa/alchemist-20150201.2244/alchemist-utils.el rename to emacs.d/elpa/alchemist-20150624.159/alchemist-utils.el index 74fbdba..f45cebc 100644 --- a/emacs.d/elpa/alchemist-20150201.2244/alchemist-utils.el +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist-utils.el @@ -79,6 +79,16 @@ It walks the directory tree until it finds a elixir project root indicator." do (setq start (match-end 0)) finally return count)) +(defun alchemist-utils--is-test-file-p () + "Check wether the visited file is a test file." + (string-match "_test\.exs$" (or (buffer-file-name) ""))) + +(defun alchemist-utils--empty-string-p (string) + (or (null string) + (let* ((string (replace-regexp-in-string "^\s+" "" string )) + (string (replace-regexp-in-string "\s+$" "" string))) + (string= string "")))) + (provide 'alchemist-utils) ;;; alchemist-utils.el ends here diff --git a/emacs.d/elpa/alchemist-20150624.159/alchemist.el b/emacs.d/elpa/alchemist-20150624.159/alchemist.el new file mode 100644 index 0000000..811a4f2 --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/alchemist.el @@ -0,0 +1,224 @@ +;;; alchemist.el --- Elixir tooling integration into Emacs + +;; Copyright © 2014-2015 Samuel Tonini +;; +;; Author: Samuel Tonini + +;; URL: http://www.github.com/tonini/alchemist.el +;; Version: 1.1.0 +;; Package-Requires: ((emacs "24")) +;; Keywords: languages, mix, elixir, elixirc, hex + +;; 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: + +;; Alchemist integrate Elixir's tooling into Emacs + +;;; Code: + +(require 'easymenu) + +(defgroup alchemist nil + "Elixir Tooling Integration Into Emacs." + :prefix "alchemist-" + :group 'applications + :link '(url-link :tag "Github" "https://github.com/tonini/alchemist.el") + :link '(emacs-commentary-link :tag "Commentary" "alchemist")) + +(defcustom alchemist-key-command-prefix + (kbd "C-c a") + "The prefix for alchemist related key commands." + :type 'string + :group 'alchemist) + +(require 'alchemist-utils) +(require 'alchemist-project) +(require 'alchemist-server) +(require 'alchemist-buffer) +(require 'alchemist-compile) +(require 'alchemist-execute) +(require 'alchemist-mix) +(require 'alchemist-hooks) +(require 'alchemist-help) +(require 'alchemist-complete) +(require 'alchemist-message) +(require 'alchemist-iex) +(require 'alchemist-eval) +(require 'alchemist-goto) +(require 'alchemist-test-mode) + +(eval-after-load 'company + '(progn + (require 'alchemist-company))) + +(defun alchemist-mode-hook () + "Hook which enables `alchemist-mode'" + (alchemist-mode 1)) + +(defvar alchemist--version "1.1.0") + +;;;###autoload +(defun alchemist-version (&optional show-version) + "Display Alchemist's version." + (interactive) + (message "Alchemist %s" (replace-regexp-in-string "-cvs" "snapshot" alchemist--version))) + +(define-prefix-command 'alchemist-mode-keymap) + +;;;###autoload +(define-minor-mode alchemist-mode + "Toggle alchemist mode. + +Key bindings: +\\{alchemist-mode-map}" + nil + ;; The indicator for the mode line. + " alchemist" + :group 'alchemist + :global nil + :keymap `((,alchemist-key-command-prefix . alchemist-mode-keymap)) + (cond (alchemist-mode + (alchemist-buffer-initialize-modeline)) + (t + (alchemist-buffer-reset-modeline)))) + +(let ((map alchemist-mode-keymap)) + (define-key map (kbd "x") 'alchemist-mix) + (define-key map (kbd "t") 'alchemist-mix-test) + (define-key map (kbd "m c") 'alchemist-mix-compile) + (define-key map (kbd "m t f") 'alchemist-mix-test-file) + (define-key map (kbd "m t b") 'alchemist-mix-test-this-buffer) + (define-key map (kbd "m t .") 'alchemist-mix-test-at-point) + (define-key map (kbd "c c") 'alchemist-compile) + (define-key map (kbd "c f") 'alchemist-compile-file) + (define-key map (kbd "c b") 'alchemist-compile-this-buffer) + (define-key map (kbd "e e") 'alchemist-execute) + (define-key map (kbd "e f") 'alchemist-execute-file) + (define-key map (kbd "e b") 'alchemist-execute-this-buffer) + (define-key map (kbd "h h") 'alchemist-help) + (define-key map (kbd "h i") 'alchemist-help-history) + (define-key map (kbd "h e") 'alchemist-help-search-at-point) + (define-key map (kbd "h m") 'alchemist-help-search-marked-region) + (define-key map (kbd "p f") 'alchemist-project-find-test) + (define-key map (kbd "p s") 'alchemist-project-toggle-file-and-tests) + (define-key map (kbd "p o") 'alchemist-project-toggle-file-and-tests-other-window) + (define-key map (kbd "i i") 'alchemist-iex-run) + (define-key map (kbd "i p") 'alchemist-iex-project-run) + (define-key map (kbd "i l") 'alchemist-iex-send-current-line) + (define-key map (kbd "i c") 'alchemist-iex-send-current-line-and-go) + (define-key map (kbd "i r") 'alchemist-iex-send-region) + (define-key map (kbd "i m") 'alchemist-iex-send-region-and-go) + (define-key map (kbd "i b") 'alchemist-iex-compile-this-buffer) + (define-key map (kbd "v l") 'alchemist-eval-current-line) + (define-key map (kbd "v k") 'alchemist-eval-print-current-line) + (define-key map (kbd "v j") 'alchemist-eval-quoted-current-line) + (define-key map (kbd "v h") 'alchemist-eval-print-quoted-current-line) + (define-key map (kbd "v o") 'alchemist-eval-region) + (define-key map (kbd "v i") 'alchemist-eval-print-region) + (define-key map (kbd "v u") 'alchemist-eval-quoted-region) + (define-key map (kbd "v y") 'alchemist-eval-print-quoted-region) + (define-key map (kbd "v q") 'alchemist-eval-buffer) + (define-key map (kbd "v w") 'alchemist-eval-print-buffer) + (define-key map (kbd "v e") 'alchemist-eval-quoted-buffer) + (define-key map (kbd "v r") 'alchemist-eval-print-quoted-buffer)) + +(define-key alchemist-mode-map (kbd "M-.") 'alchemist-goto-definition-at-point) +(define-key alchemist-mode-map (kbd "M-,") 'alchemist-goto-jump-back) +(define-key alchemist-mode-map (kbd "C-c , .") 'alchemist-goto-list-symbol-definitions) + +(easy-menu-define alchemist-mode-menu alchemist-mode-map + "Alchemist mode menu." + '("Alchemist" + ("Goto" + ["Jump to definiton at point" alchemist-goto-definition-at-point] + ["Jump back" alchemist-goto-jump-back]) + ("Evaluate" + ["Evaluate current line" alchemist-eval-current-line] + ["Evaluate current line and print" alchemist-eval-print-current-line] + ["Evaluate quoted current line" alchemist-eval-quoted-current-line] + ["Evaluate quoted current line and print" alchemist-eval-print-quoted-current-line] + "---" + ["Evaluate region" alchemist-eval-region] + ["Evaluate region and print" alchemist-eval-print-region] + ["Evaluate quoted region" alchemist-eval-quoted-region] + ["Evaluate quoted region and print" alchemist-eval-print-quoted-region] + "---" + ["Evaluate buffer" alchemist-eval-buffer] + ["Evaluate buffer and print" alchemist-eval-print-buffer] + ["Evaluate quoted buffer" alchemist-eval-quoted-buffer] + ["Evaluate quoted buffer and print" alchemist-eval-print-quoted-buffer]) + ("Compile" + ["Compile..." alchemist-compile] + ["Compile this buffer" alchemist-compile-this-buffer] + ["Compile file" alchemist-compile-file]) + ("Execute" + ["Execute..." alchemist-compile] + ["Execute this buffer" alchemist-execute-this-buffer] + ["Execute file" alchemist-execute-file]) + ("Mix" + ["Mix deps..." alchemist-mix-deps-with-prompt] + ["Mix compile..." alchemist-mix-compile] + ["Mix run..." alchemist-mix-run] + "---" + ["Mix test this buffer" alchemist-mix-test-this-buffer] + ["Mix test file..." alchemist-mix-test-file] + ["Mix test at point" alchemist-mix-test-at-point] + "---" + ["Mix..." alchemist-mix] + ["Mix new..." alchemist-mix-new] + ["Mix hex search..." alchemist-mix-hex-search] + "---" + ["Mix local..." alchemist-mix-local-with-prompt] + ["Mix local install..." alchemist-mix-local-install] + ["Mix local install (Path)..." alchemist-mix-local-install-with-path] + ["Mix local install (URL)..." alchemist-mix-local-install-with-url] + "---" + ["Display mix buffer" alchemist-mix-display-mix-buffer] + "---" + ["Mix help..." alchemist-mix-help]) + ("IEx" + ["IEx send current line" alchemist-iex-send-current-line] + ["IEx send current line and go" alchemist-iex-send-current-line-and-go] + "---" + ["IEx send last region" alchemist-iex-send-last-sexp] + ["IEx send region" alchemist-iex-send-region] + ["IEx send region and go" alchemist-iex-send-region-and-go] + "---" + ["IEx compile this buffer" alchemist-iex-compile-this-buffer] + ["IEx recompile this buffer" alchemist-iex-recompile-this-buffer] + "---" + ["IEx run" alchemist-iex-run]) + ("Project" + ["Project find all tests" alchemist-project-find-test] + ["Project toggle between file and test" alchemist-project-toggle-file-and-tests] + ["Project toggle between file and test in other window" alchemist-project-toggle-file-and-tests-other-window] + "---" + ["Project toggle compile when needed" alchemist-project-toggle-compile-when-needed + :style toggle :selected alchemist-project-compile-when-needed]) + ("Documentation" + ["Documentation search..." alchemist-help] + ["Documentation search history..." alchemist-help-history] + "---" + ["Documentation search at point..." alchemist-help-search-at-point] + ["Documentation search marked region..." alchemist-help-search-marked-region]) + )) + +(add-hook 'elixir-mode-hook 'alchemist-mode-hook) + +(provide 'alchemist) + +;;; alchemist.el ends here diff --git a/emacs.d/elpa/alchemist-20150624.159/server/case.exs b/emacs.d/elpa/alchemist-20150624.159/server/case.exs new file mode 100644 index 0000000..3131346 --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/server/case.exs @@ -0,0 +1,96 @@ +defmodule Alchemist.Case do + + alias Alchemist.Completer + alias Alchemist.Utils + alias Alchemist.Informant + + defmodule Complete do + def process! do + :ets.insert(:alchemist, {"aliases", []}) + Completer.run('') + |> Enum.map &IO.puts('cmp:' ++ &1) + print_end_of_complete_signal + end + + def process!(hint) do + :ets.insert(:alchemist, {"aliases", []}) + Completer.run(hint) + |> Enum.map &IO.puts('cmp:' ++ &1) + print_end_of_complete_signal + end + + defp print_end_of_complete_signal do + IO.puts "END-OF-COMPLETE" + end + + def process_with_context!(hint) do + [hint, modules, aliases] = String.split(hint, ";", parts: 3) + modules = Utils.clear_context_list(modules) + {modules, _} = Code.eval_string(modules) + {aliases, _} = Code.eval_string(aliases) + :ets.insert(:alchemist, {"aliases", aliases}) + + Completer.run(hint) + |> Enum.map &IO.puts('cmp:' ++ &1) + Enum.each modules, fn(module) -> + Informant.get_functions(module, hint) + |> Enum.map &IO.puts('cmp:' ++ &1) + end + IO.puts "END-OF-COMPLETE-WITH-CONTEXT" + end + end + + defmodule Modules do + def process! do + Informant.get_modules |> Enum.map &IO.puts/1 + IO.puts "END-OF-MODULES" + end + end + + defmodule Doc do + def process!(exp) do + Code.eval_string("import IEx.Helpers \nApplication.put_env(:iex, :colors, [enabled: true])\nh(#{exp})", [], __ENV__) + IO.puts "END-OF-DOC" + end + end + + defmodule Eval do + def process!(file) do + try do + File.read!("#{file}") + |> Code.eval_string + |> Tuple.to_list + |> List.first + |> IO.inspect + rescue + e -> IO.inspect e + end + IO.puts "END-OF-EVAL" + end + end + + defmodule Quote do + def process!(file) do + try do + File.read!("#{file}") + |> Code.string_to_quoted + |> Tuple.to_list + |> List.last + |> IO.inspect + rescue + e -> IO.inspect e + end + IO.puts "END-OF-QUOTE" + end + end + + defmodule Find do + def process!(exp) do + [module, function] = String.split(exp, ",", parts: 2) + module = String.to_char_list module + function = String.to_atom function + Code.eval_string("Alchemist.Source.find(#{module}, :#{function})", [], __ENV__) + IO.puts "END-OF-SOURCE" + end + end +end diff --git a/emacs.d/elpa/alchemist-20150624.159/server/completer.exs b/emacs.d/elpa/alchemist-20150624.159/server/completer.exs new file mode 100644 index 0000000..2e94a66 --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/server/completer.exs @@ -0,0 +1,340 @@ +defmodule Alchemist.Completer do + @moduledoc false + + def run(exp) do + code = case is_bitstring(exp) do + true -> exp |> String.to_char_list + _ -> exp + end + + {status, result, list } = expand(code |> Enum.reverse) + + case { status, result, list } do + { :no, _, _ } -> '' + { :yes, [], _ } -> List.insert_at(list, 0, exp) + { :yes, _, _ } -> run(code ++ result) + end + end + + def expand('') do + expand_import("") + end + + def expand([h|t]=expr) do + cond do + h === ?. and t != []-> + expand_dot(reduce(t)) + h === ?: -> + expand_erlang_modules() + identifier?(h) -> + expand_expr(reduce(expr)) + (h == ?/) and t != [] and identifier?(hd(t)) -> + expand_expr(reduce(t)) + h in '([{' -> + expand('') + true -> + no() + end + end + + defp identifier?(h) do + (h in ?a..?z) or (h in ?A..?Z) or (h in ?0..?9) or h in [?_, ??, ?!] + end + + defp expand_dot(expr) do + case Code.string_to_quoted expr do + {:ok, atom} when is_atom(atom) -> + expand_call(atom, "") + {:ok, {:__aliases__, _, list}} -> + expand_elixir_modules(list, "") + _ -> + no() + end + end + + defp expand_expr(expr) do + case Code.string_to_quoted expr do + {:ok, atom} when is_atom(atom) -> + expand_erlang_modules(Atom.to_string(atom)) + {:ok, {atom, _, nil}} when is_atom(atom) -> + expand_import(Atom.to_string(atom)) + {:ok, {:__aliases__, _, [root]}} -> + expand_elixir_modules([], Atom.to_string(root)) + {:ok, {:__aliases__, _, [h|_] = list}} when is_atom(h) -> + hint = Atom.to_string(List.last(list)) + list = Enum.take(list, length(list) - 1) + expand_elixir_modules(list, hint) + {:ok, {{:., _, [mod, fun]}, _, []}} when is_atom(fun) -> + expand_call(mod, Atom.to_string(fun)) + _ -> + no() + end + end + + defp reduce(expr) do + Enum.reverse Enum.reduce ' ([{', expr, fn token, acc -> + hd(:string.tokens(acc, [token])) + end + end + + defp yes(hint, entries) do + {:yes, String.to_char_list(hint), Enum.map(entries, &String.to_char_list/1)} + end + + defp no do + {:no, '', []} + end + + ## Formatting + + defp format_expansion([], _) do + no() + end + + defp format_expansion([uniq], hint) do + case to_hint(uniq, hint) do + "" -> yes("", to_uniq_entries(uniq)) + hint -> yes(hint, []) + end + end + + defp format_expansion([first|_]=entries, hint) do + binary = Enum.map(entries, &(&1.name)) + length = byte_size(hint) + prefix = :binary.longest_common_prefix(binary) + if prefix in [0, length] do + yes("", Enum.flat_map(entries, &to_entries/1)) + else + yes(:binary.part(first.name, prefix, length-prefix), []) + end + end + + ## Expand calls + + # :atom.fun + defp expand_call(mod, hint) when is_atom(mod) do + expand_require(mod, hint) + end + + # Elixir.fun + defp expand_call({:__aliases__, _, list}, hint) do + expand_alias(list) + |> normalize_module + |> expand_require(hint) + end + + defp expand_call(_, _) do + no() + end + + defp expand_require(mod, hint) do + format_expansion match_module_funs(mod, hint), hint + end + + defp expand_import(hint) do + funs = match_module_funs(IEx.Helpers, hint) ++ + match_module_funs(Kernel, hint) ++ + match_module_funs(Kernel.SpecialForms, hint) + format_expansion funs, hint + end + + ## Erlang modules + + defp expand_erlang_modules(hint \\ "") do + format_expansion match_erlang_modules(hint), hint + end + + defp match_erlang_modules(hint) do + for mod <- match_modules(hint, true) do + %{kind: :module, name: mod, type: :erlang} + end + end + + ## Elixir modules + + defp expand_elixir_modules([], hint) do + expand_elixir_modules(Elixir, hint, match_aliases(hint)) + end + + defp expand_elixir_modules(list, hint) do + expand_alias(list) + |> normalize_module + |> expand_elixir_modules(hint, []) + end + + defp expand_elixir_modules(mod, hint, aliases) do + aliases + |> Kernel.++(match_elixir_modules(mod, hint)) + |> Kernel.++(match_module_funs(mod, hint)) + |> format_expansion(hint) + end + + defp expand_alias([name | rest] = list) do + module = Module.concat(Elixir, name) + Enum.find_value env_aliases(), list, fn {alias, mod} -> + if alias === module do + case Atom.to_string(mod) do + "Elixir." <> mod -> + Module.concat [mod|rest] + _ -> + mod + end + end + end + end + + defp env_aliases() do + :ets.lookup(:alchemist, "aliases") + |> format_ets_aliases + end + + defp format_ets_aliases([{"aliases", []}]) do + [] + end + + defp format_ets_aliases(list) do + list + |> List.first + |> Tuple.to_list + |> List.last + end + + defp match_aliases(hint) do + for {alias, _mod} <- env_aliases(), + [name] = Module.split(alias), + starts_with?(name, hint) do + %{kind: :module, type: :alias, name: name} + end + end + + defp match_elixir_modules(module, hint) do + name = Atom.to_string(module) + depth = length(String.split(name, ".")) + 1 + base = name <> "." <> hint + + for mod <- match_modules(base, module === Elixir), + parts = String.split(mod, "."), + depth <= length(parts) do + %{kind: :module, type: :elixir, name: Enum.at(parts, depth-1)} + end + |> Enum.uniq + end + + ## Helpers + + defp normalize_module(mod) do + if is_list(mod) do + Module.concat(mod) + else + mod + end + end + + defp match_modules(hint, root) do + get_modules(root) + |> :lists.usort() + |> Enum.drop_while(& not starts_with?(&1, hint)) + |> Enum.take_while(& starts_with?(&1, hint)) + end + + defp get_modules(true) do + ["Elixir.Elixir"] ++ get_modules(false) + end + + defp get_modules(false) do + modules = Enum.map(:code.all_loaded(), &Atom.to_string(elem(&1, 0))) + case :code.get_mode() do + :interactive -> modules ++ get_modules_from_applications() + _otherwise -> modules + end + end + + defp get_modules_from_applications do + for [app] <- loaded_applications(), + {:ok, modules} = :application.get_key(app, :modules), + module <- modules do + Atom.to_string(module) + end + end + + defp loaded_applications do + # If we invoke :application.loaded_applications/0, + # it can error if we don't call safe_fixtable before. + # Since in both cases we are reaching over the + # application controller internals, we choose to match + # for performance. + :ets.match(:ac_tab, {{:loaded, :"$1"}, :_}) + end + + defp match_module_funs(mod, hint) do + case ensure_loaded(mod) do + {:module, _} -> + falist = get_module_funs(mod) + + list = Enum.reduce falist, [], fn {f, a}, acc -> + case :lists.keyfind(f, 1, acc) do + {f, aa} -> :lists.keyreplace(f, 1, acc, {f, [a|aa]}) + false -> [{f, [a]}|acc] + end + end + + for {fun, arities} <- list, + name = Atom.to_string(fun), + starts_with?(name, hint) do + %{kind: :function, name: name, arities: arities} + end |> :lists.sort() + + _otherwise -> [] + end + end + + defp get_module_funs(mod) do + if function_exported?(mod, :__info__, 1) do + if docs = Code.get_docs(mod, :docs) do + for {tuple, _line, _kind, _sign, doc} <- docs, doc != false, do: tuple + else + mod.__info__(:macros) ++ (mod.__info__(:functions) -- [__info__: 1]) + end + else + mod.module_info(:exports) + end + end + + defp ensure_loaded(Elixir), do: {:error, :nofile} + defp ensure_loaded(mod), + do: Code.ensure_compiled(mod) + + defp starts_with?(_string, ""), do: true + defp starts_with?(string, hint), do: String.starts_with?(string, hint) + + ## Ad-hoc conversions + + defp to_entries(%{kind: :module, name: name}) do + [name] + end + + defp to_entries(%{kind: :function, name: name, arities: arities}) do + for a <- :lists.sort(arities), do: "#{name}/#{a}" + end + + defp to_uniq_entries(%{kind: :module}) do + [] + end + + defp to_uniq_entries(%{kind: :function} = fun) do + to_entries(fun) + end + + defp to_hint(%{kind: :module, name: name}, hint) do + format_hint(name, hint) <> "." + end + + defp to_hint(%{kind: :function, name: name}, hint) do + format_hint(name, hint) + end + + defp format_hint(name, hint) do + hint_size = byte_size(hint) + :binary.part(name, hint_size, byte_size(name) - hint_size) + end +end diff --git a/emacs.d/elpa/alchemist-20150624.159/server/informant.exs b/emacs.d/elpa/alchemist-20150624.159/server/informant.exs new file mode 100644 index 0000000..f32f18d --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/server/informant.exs @@ -0,0 +1,55 @@ +defmodule Alchemist.Informant do + def get_functions(mod, hint) do + {mod, _} = Code.eval_string(mod) + falist = get_module_funs(mod) + + list = Enum.reduce falist, [], fn({f, a}, acc) -> + case :lists.keyfind(f, 1, acc) do + {f, aa} -> :lists.keyreplace(f, 1, acc, {f, [a|aa]}) + false -> [{f, [a]}|acc] + end + end + + case hint do + "" -> + for {fun, arities} <- list, + name = Atom.to_string(fun) do + "#{name}/#{List.first(arities)}" + end |> :lists.sort() + _otherwise -> + for {fun, arities} <- list, + name = Atom.to_string(fun), + String.starts_with?(name, hint) do + "#{name}/#{List.first(arities)}" + end |> :lists.sort() + end + end + + defp get_module_funs(mod) do + case Code.ensure_loaded(mod) do + {:module, _} -> + mod.module_info(:functions) ++ mod.__info__(:macros) + _otherwise -> + [] + end + end + + def get_modules do + modules = Enum.map(:code.all_loaded, fn({m, _}) -> Atom.to_string(m) end) + + if :code.get_mode() === :interactive do + modules ++ get_modules_from_applications() + else + modules + end + end + + defp get_modules_from_applications do + for {app, _, _} <- :application.loaded_applications, + {_, modules} = :application.get_key(app, :modules), + module <- modules, + has_doc = Code.get_docs(module, :moduledoc), elem(has_doc, 1) do + Atom.to_string(module) + end + end +end diff --git a/emacs.d/elpa/alchemist-20150624.159/server/server.exs b/emacs.d/elpa/alchemist-20150624.159/server/server.exs new file mode 100644 index 0000000..098ec99 --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/server/server.exs @@ -0,0 +1,92 @@ +Code.require_file "utils.exs", __DIR__ +Code.require_file "completer.exs", __DIR__ +Code.require_file "informant.exs", __DIR__ +Code.require_file "source.exs", __DIR__ +Code.require_file "case.exs", __DIR__ + +defmodule Alchemist.Server do + + alias Alchemist.Case + + def start([env]) do + # Preload Enum so we load basic Elixir/Erlang code + IEx.Autocomplete.expand('.munE') + :ets.new(:alchemist, [:named_table]) + loop(all_loaded(), env) + end + + def loop(loaded, env) do + line = IO.gets("") |> String.rstrip() + paths = load_paths(env) + apps = load_apps(env) + + read_input(line) + + purge_modules(loaded) + purge_paths(paths) + purge_apps(apps) + + :ets.delete_all_objects(:alchemist) + + loop(loaded, env) + end + + def read_input(line) do + case line |> String.split(" ", parts: 2) do + ["COMPLETE"] -> + Case.Complete.process! + ["COMPLETE", hint] -> + Case.Complete.process!(hint) + ["COMPLETE-WITH-CONTEXT", hint] -> + Case.Complete.process_with_context!(hint) + ["DOC", exp] -> + Case.Doc.process!(exp) + ["MODULES"] -> + Case.Modules.process! + ["EVAL", exp] -> + Case.Eval.process!(exp) + ["QUOTE", file] -> + Case.Quote.process!(file) + ["SOURCE", exp] -> + Case.Find.process!(exp) + _ -> + nil + end + end + + defp all_loaded() do + for {m,_} <- :code.all_loaded, do: m + end + + defp load_paths(env) do + for path <- Path.wildcard("_build/#{env}/lib/*/ebin") do + Code.prepend_path(path) + path + end + end + + defp load_apps(env) do + for path <- Path.wildcard("_build/#{env}/lib/*/ebin/*.app") do + app = path |> Path.basename() |> Path.rootname() |> String.to_atom + Application.load(app) + app + end + end + + defp purge_modules(loaded) do + for m <- (all_loaded() -- loaded) do + :code.delete(m) + :code.purge(m) + end + end + + defp purge_paths(paths) do + for p <- paths, do: Code.delete_path(p) + end + + defp purge_apps(apps) do + for a <- apps, do: Application.unload(a) + end +end + +Alchemist.Server.start([System.argv]) diff --git a/emacs.d/elpa/alchemist-20150624.159/server/source.exs b/emacs.d/elpa/alchemist-20150624.159/server/source.exs new file mode 100644 index 0000000..5ec5c1c --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/server/source.exs @@ -0,0 +1,46 @@ +defmodule Alchemist.Source do + def find(nil, function) do + cond do + List.keymember?(get_module_funs(Kernel), function, 0) -> + IO.puts source(Kernel) + List.keymember?(get_module_funs(Kernel.SpecialForms), function, 0) -> + IO.puts source(Kernel.SpecialForms) + true -> + IO.puts "" + end + end + + def find(module, function) do + cond do + Code.ensure_loaded?(module) -> + IO.puts source(module) + List.keymember?(Kernel.module_info[:exports], function, 0) -> + IO.puts source(Kernel) + List.keymember?(Kernel.SpecialForms.module_info[:exports], function, 0) -> + IO.puts source(Kernel.SpecialForms) + true -> + IO.puts "" + end + end + + defp source(module) do + source = module.module_info(:compile)[:source] + + case source do + nil -> nil + source -> "source-file-path:" <> List.to_string(source) + end + end + + defp get_module_funs(mod) do + if function_exported?(mod, :__info__, 1) do + if docs = Code.get_docs(mod, :docs) do + for {tuple, _line, _kind, _sign, doc} <- docs, doc != false, do: tuple + else + (mod.__info__(:functions) -- [__info__: 1]) ++ mod.__info__(:macros) + end + else + mod.module_info(:exports) + end + end +end diff --git a/emacs.d/elpa/alchemist-20150624.159/server/utils.exs b/emacs.d/elpa/alchemist-20150624.159/server/utils.exs new file mode 100644 index 0000000..3165e79 --- /dev/null +++ b/emacs.d/elpa/alchemist-20150624.159/server/utils.exs @@ -0,0 +1,6 @@ +defmodule Alchemist.Utils do + def clear_context_list(modules) do + cleared = Regex.replace ~r/\.\]/, modules, "]" + Regex.replace ~r/\.\,/, cleared, "," + end +end diff --git a/emacs.d/elpa/async-20150412.2207/async-pkg.el b/emacs.d/elpa/async-20150412.2207/async-pkg.el deleted file mode 100644 index 7d1eb8b..0000000 --- a/emacs.d/elpa/async-20150412.2207/async-pkg.el +++ /dev/null @@ -1,4 +0,0 @@ -(define-package "async" "20150412.2207" "Asynchronous processing in Emacs" 'nil) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/emacs.d/elpa/async-20150412.2207/async-autoloads.el b/emacs.d/elpa/async-20150529.529/async-autoloads.el similarity index 58% rename from emacs.d/elpa/async-20150412.2207/async-autoloads.el rename to emacs.d/elpa/async-20150529.529/async-autoloads.el index 443706e..b0268d2 100644 --- a/emacs.d/elpa/async-20150412.2207/async-autoloads.el +++ b/emacs.d/elpa/async-20150529.529/async-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "async" "async.el" (21837 24217 0 0)) +;;;### (autoloads nil "async" "async.el" (21898 47984 0 0)) ;;; Generated autoloads from async.el (autoload 'async-start-process "async" "\ @@ -68,8 +68,56 @@ returns nil. It can still be useful, however, as an argument to ;;;*** -;;;### (autoloads nil nil ("async-bytecomp.el" "async-pkg.el" "dired-async.el" -;;;;;; "smtpmail-async.el") (21837 24217 654301 0)) +;;;### (autoloads nil "async-bytecomp" "async-bytecomp.el" (21898 +;;;;;; 47984 0 0)) +;;; Generated autoloads from async-bytecomp.el + +(autoload 'async-byte-recompile-directory "async-bytecomp" "\ +Compile all *.el files in DIRECTORY asynchronously. +All *.elc files are systematically deleted before proceeding. + +\(fn DIRECTORY &optional QUIET)" nil nil) + +(defvar async-bytecomp-package-mode nil "\ +Non-nil if Async-Bytecomp-Package mode is enabled. +See the command `async-bytecomp-package-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 `async-bytecomp-package-mode'.") + +(custom-autoload 'async-bytecomp-package-mode "async-bytecomp" nil) + +(autoload 'async-bytecomp-package-mode "async-bytecomp" "\ +Byte compile asynchronously packages installed with package.el. +Async compilation of packages can be controlled by +`async-bytecomp-allowed-packages'. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "dired-async" "dired-async.el" (21898 47984 +;;;;;; 0 0)) +;;; Generated autoloads from dired-async.el + +(defvar dired-async-mode nil "\ +Non-nil if Dired-Async mode is enabled. +See the command `dired-async-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 `dired-async-mode'.") + +(custom-autoload 'dired-async-mode "dired-async" nil) + +(autoload 'dired-async-mode "dired-async" "\ +Do dired actions asynchronously. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("async-pkg.el" "smtpmail-async.el") (21898 +;;;;;; 47984 290337 0)) ;;;*** diff --git a/emacs.d/elpa/async-20150412.2207/async-bytecomp.el b/emacs.d/elpa/async-20150529.529/async-bytecomp.el similarity index 92% rename from emacs.d/elpa/async-20150412.2207/async-bytecomp.el rename to emacs.d/elpa/async-20150529.529/async-bytecomp.el index 047e605..0004347 100644 --- a/emacs.d/elpa/async-20150412.2207/async-bytecomp.el +++ b/emacs.d/elpa/async-20150529.529/async-bytecomp.el @@ -53,6 +53,7 @@ the symbol `all', in this case packages are always compiled asynchronously." (defvar async-byte-compile-log-file "~/.emacs.d/async-bytecomp.log") +;;;###autoload (defun async-byte-recompile-directory (directory &optional quiet) "Compile all *.el files in DIRECTORY asynchronously. All *.elc files are systematically deleted before proceeding." @@ -101,7 +102,7 @@ All *.elc files are systematically deleted before proceeding." (erase-buffer) (insert error-data)))))) call-back) - (message "Started compiling asynchronously directory %s" directory))) + (unless quiet (message "Started compiling asynchronously directory %s" directory)))) (defvar package-archive-contents) (declare-function package-desc-reqs "package.el" (cl-x)) @@ -131,7 +132,7 @@ All *.elc files are systematically deleted before proceeding." (delete-dups (append async-bytecomp-allowed-packages reqs))))) -(defadvice package--compile (around byte-compile-async activate) +(defadvice package--compile (around byte-compile-async) (let ((cur-package (package-desc-name pkg-desc))) (if (or (equal async-bytecomp-allowed-packages '(all)) (memq cur-package (async-bytecomp-get-allowed-pkgs))) @@ -143,6 +144,16 @@ All *.elc files are systematically deleted before proceeding." (async-byte-recompile-directory (package-desc-dir pkg-desc) t)) ad-do-it))) +;;;###autoload +(define-minor-mode async-bytecomp-package-mode + "Byte compile asynchronously packages installed with package.el. +Async compilation of packages can be controlled by +`async-bytecomp-allowed-packages'." + :group 'async + :global t + (if async-bytecomp-package-mode + (ad-activate 'package--compile) + (ad-deactivate 'package--compile))) (provide 'async-bytecomp) diff --git a/emacs.d/elpa/async-20150529.529/async-pkg.el b/emacs.d/elpa/async-20150529.529/async-pkg.el new file mode 100644 index 0000000..da89a15 --- /dev/null +++ b/emacs.d/elpa/async-20150529.529/async-pkg.el @@ -0,0 +1,4 @@ +(define-package "async" "20150529.529" "Asynchronous processing in Emacs" 'nil) +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/emacs.d/elpa/async-20150412.2207/async.el b/emacs.d/elpa/async-20150529.529/async.el similarity index 100% rename from emacs.d/elpa/async-20150412.2207/async.el rename to emacs.d/elpa/async-20150529.529/async.el diff --git a/emacs.d/elpa/async-20150412.2207/dired-async.el b/emacs.d/elpa/async-20150529.529/dired-async.el similarity index 53% rename from emacs.d/elpa/async-20150412.2207/dired-async.el rename to emacs.d/elpa/async-20150529.529/dired-async.el index 59b1d98..d37c5cb 100644 --- a/emacs.d/elpa/async-20150412.2207/dired-async.el +++ b/emacs.d/elpa/async-20150529.529/dired-async.el @@ -68,12 +68,6 @@ Should take same args as `message'." :group 'dired-async :type 'string) -(defcustom dired-async-be-async t - "When non--nil make `dired-create-file' async. -This allow to turn off async features provided to this package." - :group 'dired-async - :type 'boolean) - (defface dired-async-message '((t (:foreground "yellow"))) "Face used for mode-line message." @@ -81,17 +75,17 @@ This allow to turn off async features provided to this package." (defface dired-async-mode-message '((t (:background "Firebrick1"))) - "Face used for `dired-async-mode' lighter." + "Face used for `dired-async--modeline-mode' lighter." :group 'dired-async) -(define-minor-mode dired-async-mode +(define-minor-mode dired-async--modeline-mode "Notify mode-line that an async process run." :group 'dired-async :global t :lighter (:eval (propertize (format " [%s Async job(s) running]" (length (dired-async-processes))) 'face 'dired-async-mode-message)) - (unless dired-async-mode + (unless dired-async--modeline-mode (let ((visible-bell t)) (ding)))) (defun dired-async-mode-line-message (text &rest args) @@ -119,14 +113,14 @@ This allow to turn off async features provided to this package." (proc (car (last processes)))) (delete-process proc) (unless (> (length processes) 1) - (dired-async-mode -1)))) + (dired-async--modeline-mode -1)))) (defun dired-async-after-file-create (len-flist) "Callback function used for operation handled by `dired-create-file'." (unless (dired-async-processes) ;; Turn off mode-line notification ;; only when last process end. - (dired-async-mode -1)) + (dired-async--modeline-mode -1)) (when dired-async-operation (if (file-exists-p dired-async-log-file) (progn @@ -151,37 +145,18 @@ This allow to turn off async features provided to this package." (buffer-name b)) b)))) (when buf (kill-buffer buf)))))) -(defun dired-create-files (file-creator operation fn-list name-constructor - &optional marker-char) - "Create one or more new files from a list of existing files FN-LIST. -This function also handles querying the user, updating Dired -buffers, and displaying a success or failure message. - -FILE-CREATOR should be a function. It is called once for each -file in FN-LIST, and must create a new file, querying the user -and updating Dired buffers as necessary. It should accept three -arguments: the old file name, the new name, and an argument -OK-IF-ALREADY-EXISTS with the same meaning as in `copy-file'. - -OPERATION should be a capitalized string describing the operation -performed (e.g. `Copy'). It is used for error logging. - -FN-LIST is the list of files to copy (full absolute file names). +(defun dired-async-create-files (file-creator operation fn-list name-constructor + &optional marker-char) + "Same as `dired-create-files' but asynchronous. -NAME-CONSTRUCTOR should be a function accepting a single -argument, the name of an old file, and returning either the -corresponding new file name or nil to skip. - -Optional MARKER-CHAR is a character with which to mark every -newfile's entry, or t to use the current marker character if the -old file was marked." +See `dired-create-files' for the behavior of arguments." (setq dired-async-operation nil) (let (dired-create-files-failures failures async-fn-list - skipped (success-count 0) (total (length fn-list)) - (callback `(lambda (&optional ignore) - (dired-async-after-file-create ,(length fn-list))))) + skipped (success-count 0) (total (length fn-list)) + (callback `(lambda (&optional ignore) + (dired-async-after-file-create ,(length fn-list))))) (let (to overwrite-query - overwrite-backup-query) ; for dired-handle-overwrite + overwrite-backup-query) ; for dired-handle-overwrite (dolist (from fn-list) (setq to (funcall name-constructor from)) (if (equal to from) @@ -191,100 +166,82 @@ old file was marked." (downcase operation) from))) (if (not to) (setq skipped (cons (dired-make-relative from) skipped)) - (let* ((overwrite (file-exists-p to)) - (dired-overwrite-confirmed ; for dired-handle-overwrite - (and overwrite - (let ((help-form '(format "\ + (let* ((overwrite (file-exists-p to)) + (dired-overwrite-confirmed ; for dired-handle-overwrite + (and overwrite + (let ((help-form '(format "\ Type SPC or `y' to overwrite file `%s', DEL or `n' to skip to next, ESC or `q' to not overwrite any of the remaining files, `!' to overwrite all remaining files with no more questions." to))) - (dired-query 'overwrite-query - "Overwrite `%s'?" to)))) - ;; must determine if FROM is marked before file-creator - ;; gets a chance to delete it (in case of a move). - (actual-marker-char - (cond ((integerp marker-char) marker-char) - (marker-char (dired-file-marker from)) ; slow - (t nil)))) - ;; Handle the `dired-copy-file' file-creator specially - ;; When copying a directory to another directory or - ;; possibly to itself or one of its subdirectories. - ;; e.g "~/foo/" => "~/test/" - ;; or "~/foo/" =>"~/foo/" - ;; or "~/foo/ => ~/foo/bar/") - ;; In this case the 'name-constructor' have set the destination - ;; TO to "~/test/foo" because the old emacs23 behavior - ;; of `copy-directory' was to not create the subdirectory - ;; and instead copy the contents. - ;; With the new behavior of `copy-directory' - ;; (similar to the `cp' shell command) we don't - ;; need such a construction of the target directory, - ;; so modify the destination TO to "~/test/" instead of "~/test/foo/". - (let ((destname (file-name-directory to))) - (when (and (file-directory-p from) - (file-directory-p to) - (eq file-creator 'dired-copy-file)) - (setq to destname)) - ;; If DESTNAME is a subdirectory of FROM, not a symlink, - ;; and the method in use is copying, signal an error. - (and (eq t (car (file-attributes destname))) - (eq file-creator 'dired-copy-file) - (file-in-directory-p destname from) - (error "Cannot copy `%s' into its subdirectory `%s'" - from to))) - (if dired-async-be-async - (if overwrite - (or (and dired-overwrite-confirmed - (push (cons from to) async-fn-list)) - (progn - (push (dired-make-relative from) failures) - (dired-log "%s `%s' to `%s' failed" - operation from to))) - (push (cons from to) async-fn-list)) - (condition-case err - (progn - (funcall file-creator from to dired-overwrite-confirmed) - (if overwrite - ;; If we get here, file-creator hasn't been aborted - ;; and the old entry (if any) has to be deleted - ;; before adding the new entry. - (dired-remove-file to)) - (setq success-count (1+ success-count)) - (message "%s: %d of %d" operation success-count total) - (dired-add-file to actual-marker-char)) - (file-error ; FILE-CREATOR aborted - (progn - (push (dired-make-relative from) - failures) - (dired-log "%s `%s' to `%s' failed:\n%s\n" - operation from to err))))))))) + (dired-query 'overwrite-query + "Overwrite `%s'?" to)))) + ;; must determine if FROM is marked before file-creator + ;; gets a chance to delete it (in case of a move). + (actual-marker-char + (cond ((integerp marker-char) marker-char) + (marker-char (dired-file-marker from)) ; slow + (t nil)))) + ;; Handle the `dired-copy-file' file-creator specially + ;; When copying a directory to another directory or + ;; possibly to itself or one of its subdirectories. + ;; e.g "~/foo/" => "~/test/" + ;; or "~/foo/" =>"~/foo/" + ;; or "~/foo/ => ~/foo/bar/") + ;; In this case the 'name-constructor' have set the destination + ;; TO to "~/test/foo" because the old emacs23 behavior + ;; of `copy-directory' was to not create the subdirectory + ;; and instead copy the contents. + ;; With the new behavior of `copy-directory' + ;; (similar to the `cp' shell command) we don't + ;; need such a construction of the target directory, + ;; so modify the destination TO to "~/test/" instead of "~/test/foo/". + (let ((destname (file-name-directory to))) + (when (and (file-directory-p from) + (file-directory-p to) + (eq file-creator 'dired-copy-file)) + (setq to destname)) + ;; If DESTNAME is a subdirectory of FROM, not a symlink, + ;; and the method in use is copying, signal an error. + (and (eq t (car (file-attributes destname))) + (eq file-creator 'dired-copy-file) + (file-in-directory-p destname from) + (error "Cannot copy `%s' into its subdirectory `%s'" + from to))) + (if overwrite + (or (and dired-overwrite-confirmed + (push (cons from to) async-fn-list)) + (progn + (push (dired-make-relative from) failures) + (dired-log "%s `%s' to `%s' failed" + operation from to))) + (push (cons from to) async-fn-list)))))) ;; Handle error happening in host emacs. (cond - (dired-create-files-failures - (setq failures (nconc failures dired-create-files-failures)) - (dired-log-summary - (format "%s failed for %d file%s in %d requests" + (dired-create-files-failures + (setq failures (nconc failures dired-create-files-failures)) + (dired-log-summary + (format "%s failed for %d file%s in %d requests" operation (length failures) (dired-plural-s (length failures)) total) - failures)) - (failures - (dired-log-summary - (format "%s failed for %d of %d file%s" + failures)) + (failures + (dired-log-summary + (format "%s failed for %d of %d file%s" operation (length failures) total (dired-plural-s total)) - failures)) - (skipped - (dired-log-summary - (format "%s: %d of %d file%s skipped" + failures)) + (skipped + (dired-log-summary + (format "%s: %d of %d file%s skipped" operation (length skipped) total (dired-plural-s total)) - skipped)) - (t (message "%s: %s file%s" - operation success-count (dired-plural-s success-count)))) + skipped)) + (t (message "%s: %s file%s" + operation success-count (dired-plural-s success-count)))) ;; Start async process. - (when (and async-fn-list dired-async-be-async) + (when async-fn-list (async-start `(lambda () (require 'cl-lib) (require 'dired-aux) (require 'dired-x) ,(async-inject-variables dired-async-env-variables-regexp) @@ -298,11 +255,26 @@ ESC or `q' to not overwrite any of the remaining files, ,(dired-async-maybe-kill-ftp)) callback) ;; Run mode-line notifications while process running. - (dired-async-mode 1) + (dired-async--modeline-mode 1) (setq dired-async-operation (list operation (length async-fn-list))) - (message "%s proceeding asynchronously..." operation))) - (unless dired-async-be-async - (dired-move-to-filename))) + (message "%s proceeding asynchronously..." operation)))) + +(defadvice dired-create-files (around dired-async) + (dired-async-create-files file-creator operation fn-list + name-constructor marker-char)) + +;;;###autoload +(define-minor-mode dired-async-mode + "Do dired actions asynchronously." + :group 'dired-async + :global t + (if dired-async-mode + (if (fboundp 'advice-add) + (advice-add 'dired-create-files :override #'dired-async-create-files) + (ad-activate 'dired-create-files)) + (if (fboundp 'advice-remove) + (advice-remove 'dired-create-files #'dired-async-create-files) + (ad-deactivate 'dired-create-files)))) (provide 'dired-async) diff --git a/emacs.d/elpa/async-20150412.2207/smtpmail-async.el b/emacs.d/elpa/async-20150529.529/smtpmail-async.el similarity index 100% rename from emacs.d/elpa/async-20150412.2207/smtpmail-async.el rename to emacs.d/elpa/async-20150529.529/smtpmail-async.el diff --git a/emacs.d/elpa/auto-complete-20150408.1132/auto-complete-autoloads.el b/emacs.d/elpa/auto-complete-20150618.1949/auto-complete-autoloads.el similarity index 90% rename from emacs.d/elpa/auto-complete-20150408.1132/auto-complete-autoloads.el rename to emacs.d/elpa/auto-complete-20150618.1949/auto-complete-autoloads.el index 6fa5af7..66046c4 100644 --- a/emacs.d/elpa/auto-complete-20150408.1132/auto-complete-autoloads.el +++ b/emacs.d/elpa/auto-complete-20150618.1949/auto-complete-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "auto-complete" "auto-complete.el" (21837 24217 +;;;### (autoloads nil "auto-complete" "auto-complete.el" (21898 47983 ;;;;;; 0 0)) ;;; Generated autoloads from auto-complete.el @@ -41,7 +41,7 @@ See `auto-complete-mode' for more information on Auto-Complete mode. ;;;*** ;;;### (autoloads nil "auto-complete-config" "auto-complete-config.el" -;;;;;; (21837 24217 0 0)) +;;;;;; (21898 47983 0 0)) ;;; Generated autoloads from auto-complete-config.el (autoload 'ac-config-default "auto-complete-config" "\ @@ -51,7 +51,7 @@ See `auto-complete-mode' for more information on Auto-Complete mode. ;;;*** -;;;### (autoloads nil nil ("auto-complete-pkg.el") (21837 24217 489567 +;;;### (autoloads nil nil ("auto-complete-pkg.el") (21898 47983 747280 ;;;;;; 0)) ;;;*** diff --git a/emacs.d/elpa/auto-complete-20150408.1132/auto-complete-config.el b/emacs.d/elpa/auto-complete-20150618.1949/auto-complete-config.el similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/auto-complete-config.el rename to emacs.d/elpa/auto-complete-20150618.1949/auto-complete-config.el diff --git a/emacs.d/elpa/auto-complete-20150408.1132/auto-complete-pkg.el b/emacs.d/elpa/auto-complete-20150618.1949/auto-complete-pkg.el similarity index 62% rename from emacs.d/elpa/auto-complete-20150408.1132/auto-complete-pkg.el rename to emacs.d/elpa/auto-complete-20150618.1949/auto-complete-pkg.el index 235cec1..1b402b0 100644 --- a/emacs.d/elpa/auto-complete-20150408.1132/auto-complete-pkg.el +++ b/emacs.d/elpa/auto-complete-20150618.1949/auto-complete-pkg.el @@ -1,4 +1,4 @@ -(define-package "auto-complete" "20150408.1132" "Auto Completion for GNU Emacs" +(define-package "auto-complete" "20150618.1949" "Auto Completion for GNU Emacs" '((popup "0.5.0") (cl-lib "0.5"))) ;; Local Variables: diff --git a/emacs.d/elpa/auto-complete-20150408.1132/auto-complete.el b/emacs.d/elpa/auto-complete-20150618.1949/auto-complete.el similarity index 99% rename from emacs.d/elpa/auto-complete-20150408.1132/auto-complete.el rename to emacs.d/elpa/auto-complete-20150618.1949/auto-complete.el index 9208e47..380ac6a 100644 --- a/emacs.d/elpa/auto-complete-20150408.1132/auto-complete.el +++ b/emacs.d/elpa/auto-complete-20150618.1949/auto-complete.el @@ -204,7 +204,7 @@ Use `version-to-list' to get version component.") scheme-mode ocaml-mode tuareg-mode coq-mode haskell-mode agda-mode agda2-mode perl-mode cperl-mode python-mode ruby-mode lua-mode tcl-mode - ecmascript-mode javascript-mode js-mode js2-mode php-mode css-mode less-css-mode + ecmascript-mode javascript-mode js-mode js2-mode php-mode css-mode scss-mode less-css-mode makefile-mode sh-mode fortran-mode f90-mode ada-mode xml-mode sgml-mode web-mode ts-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/ada-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/ada-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/ada-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/ada-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/c++-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/c++-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/c++-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/c++-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/c-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/c-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/c-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/c-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/caml-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/caml-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/caml-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/caml-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/clojure-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/clojure-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/clojure-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/clojure-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/clojurescript-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/clojurescript-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/clojurescript-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/clojurescript-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/coq-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/coq-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/coq-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/coq-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/css-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/css-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/css-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/css-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/erlang-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/erlang-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/erlang-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/erlang-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/go-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/go-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/go-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/go-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/haskell-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/haskell-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/haskell-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/haskell-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/java-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/java-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/java-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/java-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/js-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/js-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/js-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/js-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/lua-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/lua-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/lua-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/lua-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/octave-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/octave-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/octave-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/octave-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/php-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/php-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/php-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/php-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/python-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/python-mode similarity index 99% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/python-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/python-mode index 108bfa5..4d7b706 100644 --- a/emacs.d/elpa/auto-complete-20150408.1132/dict/python-mode +++ b/emacs.d/elpa/auto-complete-20150618.1949/dict/python-mode @@ -57,6 +57,7 @@ __doc__ __file__ __future__ __import__ +__init__ __main__ __name__ __package__ @@ -294,6 +295,7 @@ runpy sched select selectors +self set setattr shelve diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/qml-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/qml-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/qml-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/qml-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/ruby-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/ruby-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/ruby-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/ruby-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/scala-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/scala-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/scala-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/scala-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/scheme-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/scheme-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/scheme-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/scheme-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/sclang-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/sclang-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/sclang-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/sclang-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/sh-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/sh-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/sh-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/sh-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/tcl-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/tcl-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/tcl-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/tcl-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/ts-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/ts-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/ts-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/ts-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/tuareg-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/tuareg-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/tuareg-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/tuareg-mode diff --git a/emacs.d/elpa/auto-complete-20150408.1132/dict/verilog-mode b/emacs.d/elpa/auto-complete-20150618.1949/dict/verilog-mode similarity index 100% rename from emacs.d/elpa/auto-complete-20150408.1132/dict/verilog-mode rename to emacs.d/elpa/auto-complete-20150618.1949/dict/verilog-mode diff --git a/emacs.d/elpa/company-20150503.1854/company-abbrev.el b/emacs.d/elpa/company-20150624.334/company-abbrev.el similarity index 92% rename from emacs.d/elpa/company-20150503.1854/company-abbrev.el rename to emacs.d/elpa/company-20150624.334/company-abbrev.el index a454aaa..0a849ad 100644 --- a/emacs.d/elpa/company-20150503.1854/company-abbrev.el +++ b/emacs.d/elpa/company-20150624.334/company-abbrev.el @@ -1,6 +1,6 @@ ;;; company-abbrev.el --- company-mode completion back-end for abbrev -;; Copyright (C) 2009-2011 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011, 2015 Free Software Foundation, Inc. ;; Author: Nikolaj Schumacher @@ -44,8 +44,7 @@ (candidates (nconc (delete "" (all-completions arg global-abbrev-table)) (delete "" (all-completions arg local-abbrev-table)))) - (meta (abbrev-expansion arg)) - (require-match t))) + (meta (abbrev-expansion arg)))) (provide 'company-abbrev) ;;; company-abbrev.el ends here diff --git a/emacs.d/elpa/company-20150503.1854/company-autoloads.el b/emacs.d/elpa/company-20150624.334/company-autoloads.el similarity index 85% rename from emacs.d/elpa/company-20150503.1854/company-autoloads.el rename to emacs.d/elpa/company-20150624.334/company-autoloads.el index cbdab52..57c4e2f 100644 --- a/emacs.d/elpa/company-20150503.1854/company-autoloads.el +++ b/emacs.d/elpa/company-20150624.334/company-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "company" "company.el" (21837 24216 0 0)) +;;;### (autoloads nil "company" "company.el" (21898 47982 0 0)) ;;; Generated autoloads from company.el (autoload 'company-mode "company" "\ @@ -24,6 +24,9 @@ The completion data is retrieved using `company-backends' and displayed using `company-frontends'. If you want to start a specific back-end, call it interactively or use `company-begin-backend'. +By default, the completions list is sorted alphabetically, unless the +backend chooses otherwise, or `company-transformers' changes it later. + regular keymap (`company-mode-map'): \\{company-mode-map} @@ -56,8 +59,8 @@ See `company-mode' for more information on Company mode. ;;;*** -;;;### (autoloads nil "company-abbrev" "company-abbrev.el" (21837 -;;;;;; 24216 0 0)) +;;;### (autoloads nil "company-abbrev" "company-abbrev.el" (21898 +;;;;;; 47982 0 0)) ;;; Generated autoloads from company-abbrev.el (autoload 'company-abbrev "company-abbrev" "\ @@ -67,7 +70,7 @@ See `company-mode' for more information on Company mode. ;;;*** -;;;### (autoloads nil "company-bbdb" "company-bbdb.el" (21837 24216 +;;;### (autoloads nil "company-bbdb" "company-bbdb.el" (21898 47982 ;;;;;; 0 0)) ;;; Generated autoloads from company-bbdb.el @@ -78,7 +81,7 @@ See `company-mode' for more information on Company mode. ;;;*** -;;;### (autoloads nil "company-css" "company-css.el" (21837 24216 +;;;### (autoloads nil "company-css" "company-css.el" (21898 47982 ;;;;;; 0 0)) ;;; Generated autoloads from company-css.el @@ -89,8 +92,8 @@ See `company-mode' for more information on Company mode. ;;;*** -;;;### (autoloads nil "company-dabbrev" "company-dabbrev.el" (21837 -;;;;;; 24216 0 0)) +;;;### (autoloads nil "company-dabbrev" "company-dabbrev.el" (21898 +;;;;;; 47982 0 0)) ;;; Generated autoloads from company-dabbrev.el (autoload 'company-dabbrev "company-dabbrev" "\ @@ -101,7 +104,7 @@ dabbrev-like `company-mode' completion back-end. ;;;*** ;;;### (autoloads nil "company-dabbrev-code" "company-dabbrev-code.el" -;;;;;; (21837 24216 0 0)) +;;;;;; (21898 47982 0 0)) ;;; Generated autoloads from company-dabbrev-code.el (autoload 'company-dabbrev-code "company-dabbrev-code" "\ @@ -113,7 +116,7 @@ comments or strings. ;;;*** -;;;### (autoloads nil "company-elisp" "company-elisp.el" (21837 24216 +;;;### (autoloads nil "company-elisp" "company-elisp.el" (21898 47982 ;;;;;; 0 0)) ;;; Generated autoloads from company-elisp.el @@ -124,7 +127,7 @@ comments or strings. ;;;*** -;;;### (autoloads nil "company-etags" "company-etags.el" (21837 24216 +;;;### (autoloads nil "company-etags" "company-etags.el" (21898 47982 ;;;;;; 0 0)) ;;; Generated autoloads from company-etags.el @@ -135,7 +138,7 @@ comments or strings. ;;;*** -;;;### (autoloads nil "company-files" "company-files.el" (21837 24216 +;;;### (autoloads nil "company-files" "company-files.el" (21898 47982 ;;;;;; 0 0)) ;;; Generated autoloads from company-files.el @@ -148,7 +151,7 @@ File paths with spaces are only supported inside strings. ;;;*** -;;;### (autoloads nil "company-gtags" "company-gtags.el" (21837 24216 +;;;### (autoloads nil "company-gtags" "company-gtags.el" (21898 47982 ;;;;;; 0 0)) ;;; Generated autoloads from company-gtags.el @@ -159,8 +162,8 @@ File paths with spaces are only supported inside strings. ;;;*** -;;;### (autoloads nil "company-ispell" "company-ispell.el" (21837 -;;;;;; 24216 0 0)) +;;;### (autoloads nil "company-ispell" "company-ispell.el" (21898 +;;;;;; 47982 0 0)) ;;; Generated autoloads from company-ispell.el (autoload 'company-ispell "company-ispell" "\ @@ -170,8 +173,8 @@ File paths with spaces are only supported inside strings. ;;;*** -;;;### (autoloads nil "company-keywords" "company-keywords.el" (21837 -;;;;;; 24216 0 0)) +;;;### (autoloads nil "company-keywords" "company-keywords.el" (21898 +;;;;;; 47982 0 0)) ;;; Generated autoloads from company-keywords.el (autoload 'company-keywords "company-keywords" "\ @@ -181,7 +184,7 @@ File paths with spaces are only supported inside strings. ;;;*** -;;;### (autoloads nil "company-nxml" "company-nxml.el" (21837 24216 +;;;### (autoloads nil "company-nxml" "company-nxml.el" (21898 47982 ;;;;;; 0 0)) ;;; Generated autoloads from company-nxml.el @@ -192,8 +195,8 @@ File paths with spaces are only supported inside strings. ;;;*** -;;;### (autoloads nil "company-oddmuse" "company-oddmuse.el" (21837 -;;;;;; 24216 0 0)) +;;;### (autoloads nil "company-oddmuse" "company-oddmuse.el" (21898 +;;;;;; 47982 0 0)) ;;; Generated autoloads from company-oddmuse.el (autoload 'company-oddmuse "company-oddmuse" "\ @@ -203,8 +206,8 @@ File paths with spaces are only supported inside strings. ;;;*** -;;;### (autoloads nil "company-semantic" "company-semantic.el" (21837 -;;;;;; 24216 0 0)) +;;;### (autoloads nil "company-semantic" "company-semantic.el" (21898 +;;;;;; 47982 0 0)) ;;; Generated autoloads from company-semantic.el (autoload 'company-semantic "company-semantic" "\ @@ -214,7 +217,7 @@ File paths with spaces are only supported inside strings. ;;;*** -;;;### (autoloads nil "company-tempo" "company-tempo.el" (21837 24216 +;;;### (autoloads nil "company-tempo" "company-tempo.el" (21898 47982 ;;;;;; 0 0)) ;;; Generated autoloads from company-tempo.el @@ -225,7 +228,7 @@ File paths with spaces are only supported inside strings. ;;;*** -;;;### (autoloads nil "company-xcode" "company-xcode.el" (21837 24216 +;;;### (autoloads nil "company-xcode" "company-xcode.el" (21898 47982 ;;;;;; 0 0)) ;;; Generated autoloads from company-xcode.el @@ -237,7 +240,7 @@ File paths with spaces are only supported inside strings. ;;;*** ;;;### (autoloads nil "company-yasnippet" "company-yasnippet.el" -;;;;;; (21837 24216 0 0)) +;;;;;; (21898 47982 0 0)) ;;; Generated autoloads from company-yasnippet.el (autoload 'company-yasnippet "company-yasnippet" "\ @@ -269,7 +272,7 @@ shadow back-ends that come after it. Recommended usages: ;;;### (autoloads nil nil ("company-capf.el" "company-clang.el" "company-cmake.el" ;;;;;; "company-eclim.el" "company-pkg.el" "company-template.el") -;;;;;; (21837 24216 843840 0)) +;;;;;; (21898 47982 27553 0)) ;;;*** diff --git a/emacs.d/elpa/company-20150503.1854/company-bbdb.el b/emacs.d/elpa/company-20150624.334/company-bbdb.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-bbdb.el rename to emacs.d/elpa/company-20150624.334/company-bbdb.el diff --git a/emacs.d/elpa/company-20150503.1854/company-capf.el b/emacs.d/elpa/company-20150624.334/company-capf.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-capf.el rename to emacs.d/elpa/company-20150624.334/company-capf.el diff --git a/emacs.d/elpa/company-20150503.1854/company-clang.el b/emacs.d/elpa/company-20150624.334/company-clang.el similarity index 99% rename from emacs.d/elpa/company-20150503.1854/company-clang.el rename to emacs.d/elpa/company-20150624.334/company-clang.el index d0e2b84..369f4a9 100644 --- a/emacs.d/elpa/company-20150503.1854/company-clang.el +++ b/emacs.d/elpa/company-20150624.334/company-clang.el @@ -203,11 +203,11 @@ or automatically through a custom `company-clang-prefix-guesser'." (buf (get-buffer-create "*clang-output*")) ;; Looks unnecessary in Emacs 25.1 and later. (process-adaptive-read-buffering nil)) - (with-current-buffer buf - (erase-buffer) - (setq buffer-undo-list t)) (if (get-buffer-process buf) (funcall callback nil) + (with-current-buffer buf + (erase-buffer) + (setq buffer-undo-list t)) (let ((process (apply #'start-process "company-clang" buf company-clang-executable args))) (set-process-sentinel diff --git a/emacs.d/elpa/company-20150503.1854/company-cmake.el b/emacs.d/elpa/company-20150624.334/company-cmake.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-cmake.el rename to emacs.d/elpa/company-20150624.334/company-cmake.el diff --git a/emacs.d/elpa/company-20150503.1854/company-css.el b/emacs.d/elpa/company-20150624.334/company-css.el similarity index 98% rename from emacs.d/elpa/company-20150503.1854/company-css.el rename to emacs.d/elpa/company-20150624.334/company-css.el index ec48653..28f6c2d 100644 --- a/emacs.d/elpa/company-20150503.1854/company-css.el +++ b/emacs.d/elpa/company-20150624.334/company-css.el @@ -26,6 +26,8 @@ (require 'company) (require 'cl-lib) +(declare-function web-mode-language-at-pos "web-mode" (&optional pos)) + (defconst company-css-property-alist ;; see http://www.w3.org/TR/CSS21/propidx.html '(("azimuth" angle "left-side" "far-left" "left" "center-left" "center" @@ -415,7 +417,9 @@ Returns \"\" if no property found, but feasible at this position." (interactive (list 'interactive)) (cl-case command (interactive (company-begin-backend 'company-css)) - (prefix (and (derived-mode-p 'css-mode) + (prefix (and (or (derived-mode-p 'css-mode) + (and (derived-mode-p 'web-mode) + (string= (web-mode-language-at-pos) "css"))) (or (company-grab company-css-tag-regexp 1) (company-grab company-css-pseudo-regexp 1) (company-grab company-css-property-value-regexp 2) diff --git a/emacs.d/elpa/company-20150503.1854/company-dabbrev-code.el b/emacs.d/elpa/company-20150624.334/company-dabbrev-code.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-dabbrev-code.el rename to emacs.d/elpa/company-20150624.334/company-dabbrev-code.el diff --git a/emacs.d/elpa/company-20150503.1854/company-dabbrev.el b/emacs.d/elpa/company-20150624.334/company-dabbrev.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-dabbrev.el rename to emacs.d/elpa/company-20150624.334/company-dabbrev.el diff --git a/emacs.d/elpa/company-20150503.1854/company-eclim.el b/emacs.d/elpa/company-20150624.334/company-eclim.el similarity index 97% rename from emacs.d/elpa/company-20150503.1854/company-eclim.el rename to emacs.d/elpa/company-20150624.334/company-eclim.el index 1f1beae..5627f8e 100644 --- a/emacs.d/elpa/company-20150503.1854/company-eclim.el +++ b/emacs.d/elpa/company-20150624.334/company-eclim.el @@ -1,6 +1,6 @@ ;;; company-eclim.el --- company-mode completion back-end for Eclim -;; Copyright (C) 2009, 2011, 2013 Free Software Foundation, Inc. +;; Copyright (C) 2009, 2011, 2013, 2015 Free Software Foundation, Inc. ;; Author: Nikolaj Schumacher @@ -48,7 +48,9 @@ (cl-return file))))) (defcustom company-eclim-executable - (or (executable-find "eclim") (company-eclim-executable-find)) + (or (bound-and-true-p eclim-executable) + (executable-find "eclim") + (company-eclim-executable-find)) "Location of eclim executable." :type 'file) diff --git a/emacs.d/elpa/company-20150503.1854/company-elisp.el b/emacs.d/elpa/company-20150624.334/company-elisp.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-elisp.el rename to emacs.d/elpa/company-20150624.334/company-elisp.el diff --git a/emacs.d/elpa/company-20150503.1854/company-etags.el b/emacs.d/elpa/company-20150624.334/company-etags.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-etags.el rename to emacs.d/elpa/company-20150624.334/company-etags.el diff --git a/emacs.d/elpa/company-20150503.1854/company-files.el b/emacs.d/elpa/company-20150624.334/company-files.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-files.el rename to emacs.d/elpa/company-20150624.334/company-files.el diff --git a/emacs.d/elpa/company-20150503.1854/company-gtags.el b/emacs.d/elpa/company-20150624.334/company-gtags.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-gtags.el rename to emacs.d/elpa/company-20150624.334/company-gtags.el diff --git a/emacs.d/elpa/company-20150503.1854/company-ispell.el b/emacs.d/elpa/company-20150624.334/company-ispell.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-ispell.el rename to emacs.d/elpa/company-20150624.334/company-ispell.el diff --git a/emacs.d/elpa/company-20150503.1854/company-keywords.el b/emacs.d/elpa/company-20150624.334/company-keywords.el similarity index 97% rename from emacs.d/elpa/company-20150503.1854/company-keywords.el rename to emacs.d/elpa/company-20150624.334/company-keywords.el index f426c06..a6b20c2 100644 --- a/emacs.d/elpa/company-20150503.1854/company-keywords.el +++ b/emacs.d/elpa/company-20150624.334/company-keywords.el @@ -207,6 +207,12 @@ "do" "else" "elsif" "end" "ensure" "false" "for" "if" "in" "module" "next" "nil" "not" "or" "redo" "rescue" "retry" "return" "self" "super" "then" "true" "undef" "unless" "until" "when" "while" "yield") + (scala-mode + "abstract" "case" "catch" "class" "def" "do" "else" "extends" "false" + "final" "finally" "for" "forSome" "if" "implicit" "import" "lazy" "match" + "new" "null" "object" "override" "package" "private" "protected" + "return" "sealed" "super" "this" "throw" "trait" "true" "try" "type" "val" + "var" "while" "with" "yield") ;; aliases (js2-mode . javascript-mode) (espresso-mode . javascript-mode) diff --git a/emacs.d/elpa/company-20150503.1854/company-nxml.el b/emacs.d/elpa/company-20150624.334/company-nxml.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-nxml.el rename to emacs.d/elpa/company-20150624.334/company-nxml.el diff --git a/emacs.d/elpa/company-20150503.1854/company-oddmuse.el b/emacs.d/elpa/company-20150624.334/company-oddmuse.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-oddmuse.el rename to emacs.d/elpa/company-20150624.334/company-oddmuse.el diff --git a/emacs.d/elpa/company-20150503.1854/company-pkg.el b/emacs.d/elpa/company-20150624.334/company-pkg.el similarity index 69% rename from emacs.d/elpa/company-20150503.1854/company-pkg.el rename to emacs.d/elpa/company-20150624.334/company-pkg.el index 0bc9773..a6de6ae 100644 --- a/emacs.d/elpa/company-20150503.1854/company-pkg.el +++ b/emacs.d/elpa/company-20150624.334/company-pkg.el @@ -1,4 +1,4 @@ -(define-package "company" "20150503.1854" "Modular text completion framework" +(define-package "company" "20150624.334" "Modular text completion framework" '((emacs "24.1") (cl-lib "0.5")) :url "http://company-mode.github.io/" :keywords diff --git a/emacs.d/elpa/company-20150503.1854/company-semantic.el b/emacs.d/elpa/company-20150624.334/company-semantic.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-semantic.el rename to emacs.d/elpa/company-20150624.334/company-semantic.el diff --git a/emacs.d/elpa/company-20150503.1854/company-template.el b/emacs.d/elpa/company-20150624.334/company-template.el similarity index 99% rename from emacs.d/elpa/company-20150503.1854/company-template.el rename to emacs.d/elpa/company-20150624.334/company-template.el index d90458c..02065af 100644 --- a/emacs.d/elpa/company-20150503.1854/company-template.el +++ b/emacs.d/elpa/company-20150624.334/company-template.el @@ -1,4 +1,4 @@ -;;; company-template.el +;;; company-template.el --- utility library for template expansion ;; Copyright (C) 2009, 2010, 2014-2015 Free Software Foundation, Inc. diff --git a/emacs.d/elpa/company-20150503.1854/company-tempo.el b/emacs.d/elpa/company-20150624.334/company-tempo.el similarity index 95% rename from emacs.d/elpa/company-20150503.1854/company-tempo.el rename to emacs.d/elpa/company-20150624.334/company-tempo.el index ac91988..09d1dfb 100644 --- a/emacs.d/elpa/company-20150503.1854/company-tempo.el +++ b/emacs.d/elpa/company-20150624.334/company-tempo.el @@ -1,6 +1,6 @@ ;;; company-tempo.el --- company-mode completion back-end for tempo -;; Copyright (C) 2009-2011 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011, 2015 Free Software Foundation, Inc. ;; Author: Nikolaj Schumacher @@ -56,7 +56,6 @@ (prefix (or (car (tempo-find-match-string tempo-match-finder)) "")) (candidates (all-completions arg (tempo-build-collection))) (meta (company-tempo-meta arg)) - (require-match t) (sorted t))) (provide 'company-tempo) diff --git a/emacs.d/elpa/company-20150503.1854/company-xcode.el b/emacs.d/elpa/company-20150624.334/company-xcode.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-xcode.el rename to emacs.d/elpa/company-20150624.334/company-xcode.el diff --git a/emacs.d/elpa/company-20150503.1854/company-yasnippet.el b/emacs.d/elpa/company-20150624.334/company-yasnippet.el similarity index 100% rename from emacs.d/elpa/company-20150503.1854/company-yasnippet.el rename to emacs.d/elpa/company-20150624.334/company-yasnippet.el diff --git a/emacs.d/elpa/company-20150503.1854/company.el b/emacs.d/elpa/company-20150624.334/company.el similarity index 98% rename from emacs.d/elpa/company-20150503.1854/company.el rename to emacs.d/elpa/company-20150624.334/company.el index 9163749..8500a4d 100644 --- a/emacs.d/elpa/company-20150503.1854/company.el +++ b/emacs.d/elpa/company-20150624.334/company.el @@ -366,13 +366,20 @@ from the list. progresses, unless the back-end returns t for this command. The second argument is the latest prefix. +`ignore-case': Return t here if the backend returns case-insensitive +matches. This value is used to determine the longest common prefix (as +used in `company-complete-common'), and to filter completions when fetching +them from cache. + `meta': The second argument is a completion candidate. Return a (short) documentation string for it. `doc-buffer': The second argument is a completion candidate. Return a -buffer with documentation for it. Preferably use `company-doc-buffer', +buffer with documentation for it. Preferably use `company-doc-buffer'. If +not all buffer contents pertain to this candidate, return a cons of buffer +and window start position. -`location': The second argument is a completion candidate. Return the cons +`location': The second argument is a completion candidate. Return a cons of buffer and buffer location, or of file and line number where the completion candidate was defined. @@ -389,9 +396,10 @@ will be used when rendering the popup. This command only makes sense for backends that provide non-prefix completion. `require-match': If this returns t, the user is not allowed to enter -anything not offered as a candidate. Use with care! The default value nil -gives the user that choice with `company-require-match'. Return value -`never' overrides that option the other way around. +anything not offered as a candidate. Please don't use that value in normal +backends. The default value nil gives the user that choice with +`company-require-match'. Return value `never' overrides that option the +other way around. `init': Called once for each buffer. The back-end can check for external programs and files and load any required libraries. Raising an error here @@ -701,6 +709,9 @@ The completion data is retrieved using `company-backends' and displayed using `company-frontends'. If you want to start a specific back-end, call it interactively or use `company-begin-backend'. +By default, the completions list is sorted alphabetically, unless the +backend chooses otherwise, or `company-transformers' changes it later. + regular keymap (`company-mode-map'): \\{company-mode-map} @@ -1461,10 +1472,14 @@ from the rest of the back-ends in the group, if any, will be left at the end." (setq company-prefix (company--prefix-str prefix) company-backend backend c (company-calculate-candidates company-prefix)) - ;; t means complete/unique. We don't start, so no hooks. (if (not (consp c)) - (when company--manual-action - (message "No completion found")) + (progn + (when company--manual-action + (message "No completion found")) + (when (eq c t) + ;; t means complete/unique. + ;; Run the hooks anyway, to e.g. clear the cache. + (company-cancel 'unique))) (when company--manual-action (setq company--manual-prefix prefix)) (company-update-candidates c) @@ -1508,6 +1523,7 @@ from the rest of the back-ends in the group, if any, will be left at the end." company-point nil) (when company-timer (cancel-timer company-timer)) + (company-echo-cancel t) (company-search-mode 0) (company-call-frontends 'hide) (company-enable-overriding-keymap nil)) @@ -1538,6 +1554,7 @@ from the rest of the back-ends in the group, if any, will be left at the end." (when company-timer (cancel-timer company-timer) (setq company-timer nil)) + (company-echo-cancel t) (company-uninstall-map)) (defun company-post-command () @@ -2058,11 +2075,14 @@ character, stripping the modifiers. That character must be a digit." (company--electric-do (let* ((selected (nth company-selection company-candidates)) (doc-buffer (or (company-call-backend 'doc-buffer selected) - (error "No documentation available")))) + (error "No documentation available"))) + start) + (when (consp doc-buffer) + (setq start (cdr doc-buffer) + doc-buffer (car doc-buffer))) (setq other-window-scroll-buffer (get-buffer doc-buffer)) - (with-current-buffer doc-buffer - (goto-char (point-min))) - (display-buffer doc-buffer t))))) + (let ((win (display-buffer doc-buffer t))) + (set-window-start win (if start start (point-min)))))))) (put 'company-show-doc-buffer 'company-keep t) (defun company-show-location () @@ -2330,7 +2350,7 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (while (and (not (eobp)) ; http://debbugs.gnu.org/19553 (> (setq lines-moved (vertical-motion 1)) 0) (<= (point) end)) - (let ((bound (min end (1- (point))))) + (let ((bound (min end (point)))) ;; A visual line can contain several physical lines (e.g. with outline's ;; folding overlay). Take only the first one. (push (buffer-substring beg @@ -2380,6 +2400,10 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (version< emacs-version "24.4.51.5")) ;; http://debbugs.gnu.org/18384 (cl-decf ww)) + ;; whitespace-mode with newline-mark + (when (and buffer-display-table + (aref buffer-display-table ?\n)) + (cl-decf ww (1- (length (aref buffer-display-table ?\n))))) ww)) (defun company--replacement-string (lines old column nl &optional align-top) @@ -2751,13 +2775,19 @@ Returns a negative number if the tooltip should be displayed above point." (message "")))) (defun company-echo-show-soon (&optional getter) + (company-echo-cancel) + (setq company-echo-timer (run-with-timer 0 nil 'company-echo-show getter))) + +(defun company-echo-cancel (&optional unset) (when company-echo-timer (cancel-timer company-echo-timer)) - (setq company-echo-timer (run-with-timer 0 nil 'company-echo-show getter))) + (when unset + (setq company-echo-timer nil))) -(defsubst company-echo-show-when-idle (&optional getter) - (when (sit-for company-echo-delay) - (company-echo-show getter))) +(defun company-echo-show-when-idle (&optional getter) + (company-echo-cancel) + (setq company-echo-timer + (run-with-idle-timer company-echo-delay nil 'company-echo-show getter))) (defun company-echo-format () diff --git a/emacs.d/elpa/dash-20150503.1343/dash-pkg.el b/emacs.d/elpa/dash-20150503.1343/dash-pkg.el deleted file mode 100644 index ec88d1a..0000000 --- a/emacs.d/elpa/dash-20150503.1343/dash-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "dash" "20150503.1343" "A modern list library for Emacs" 'nil :keywords '("lists")) diff --git a/emacs.d/elpa/dash-20150503.1343/dash-autoloads.el b/emacs.d/elpa/dash-20150611.922/dash-autoloads.el similarity index 82% rename from emacs.d/elpa/dash-20150503.1343/dash-autoloads.el rename to emacs.d/elpa/dash-20150611.922/dash-autoloads.el index 9ec0c9c..a0bdf0b 100644 --- a/emacs.d/elpa/dash-20150503.1343/dash-autoloads.el +++ b/emacs.d/elpa/dash-20150611.922/dash-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil nil ("dash.el") (21837 24216 457071 0)) +;;;### (autoloads nil nil ("dash.el") (21898 47981 341462 0)) ;;;*** diff --git a/emacs.d/elpa/dash-20150611.922/dash-pkg.el b/emacs.d/elpa/dash-20150611.922/dash-pkg.el new file mode 100644 index 0000000..f1b2d63 --- /dev/null +++ b/emacs.d/elpa/dash-20150611.922/dash-pkg.el @@ -0,0 +1 @@ +(define-package "dash" "20150611.922" "A modern list library for Emacs" 'nil :keywords '("lists")) diff --git a/emacs.d/elpa/dash-20150503.1343/dash.el b/emacs.d/elpa/dash-20150611.922/dash.el similarity index 98% rename from emacs.d/elpa/dash-20150503.1343/dash.el rename to emacs.d/elpa/dash-20150611.922/dash.el index 357d0df..47fb46d 100644 --- a/emacs.d/elpa/dash-20150503.1343/dash.el +++ b/emacs.d/elpa/dash-20150611.922/dash.el @@ -4,7 +4,7 @@ ;; Author: Magnar Sveen ;; Version: 2.10.0 -;; Package-Version: 20150503.1343 +;; Package-Version: 20150611.922 ;; Keywords: lists ;; This program is free software; you can redistribute it and/or modify @@ -916,31 +916,25 @@ other value (the body)." (defmacro --group-by (form list) "Anaphoric form of `-group-by'." - (declare (debug (form form))) - (let ((l (make-symbol "list")) - (v (make-symbol "value")) - (k (make-symbol "key")) - (r (make-symbol "result"))) - `(let ((,l ,list) - ,r) - ;; Convert `list' to an alist and store it in `r'. - (while ,l - (let* ((,v (car ,l)) - (it ,v) - (,k ,form) - (kv (assoc ,k ,r))) - (if kv - (setcdr kv (cons ,v (cdr kv))) - (push (list ,k ,v) ,r)) - (setq ,l (cdr ,l)))) - ;; Reverse lists in each group. - (let ((rest ,r)) - (while rest - (let ((kv (car rest))) - (setcdr kv (nreverse (cdr kv)))) - (setq rest (cdr rest)))) - ;; Reverse order of keys. - (nreverse ,r)))) + (declare (debug t)) + (let ((n (make-symbol "n")) + (k (make-symbol "k")) + (grp (make-symbol "grp"))) + `(nreverse + (-map + (lambda (,n) + (cons (car ,n) + (nreverse (cdr ,n)))) + (--reduce-from + (let* ((,k (,@form)) + (,grp (assoc ,k acc))) + (if ,grp + (setcdr ,grp (cons it (cdr ,grp))) + (push + (list ,k it) + acc)) + acc) + nil ,list))))) (defun -group-by (fn list) "Separate LIST into an alist whose keys are FN applied to the @@ -1175,16 +1169,17 @@ second item in second form, etc." (list form x))) (:else `(-> (-> ,x ,form) ,@more)))) -(defmacro ->> (x form &rest more) +(defmacro ->> (x &optional form &rest more) "Thread the expr through the forms. Insert X as the last item in the first form, making a list of it if it is not a list already. If there are more forms, insert the first form as the last item in second form, etc." - (if (null more) - (if (listp form) - `(,(car form) ,@(cdr form) ,x) - (list form x)) - `(->> (->> ,x ,form) ,@more))) + (cond + ((null form) x) + ((null more) (if (listp form) + `(,@form ,x) + (list form x))) + (:else `(->> (->> ,x ,form) ,@more)))) (defmacro --> (x form &rest more) "Thread the expr through the forms. Insert X at the position diff --git a/emacs.d/elpa/elixir-mode-20150317.1454/elixir-deprecated.el b/emacs.d/elpa/elixir-mode-20150618.1413/elixir-deprecated.el similarity index 100% rename from emacs.d/elpa/elixir-mode-20150317.1454/elixir-deprecated.el rename to emacs.d/elpa/elixir-mode-20150618.1413/elixir-deprecated.el diff --git a/emacs.d/elpa/elixir-mode-20150317.1454/elixir-mode-autoloads.el b/emacs.d/elpa/elixir-mode-20150618.1413/elixir-mode-autoloads.el similarity index 94% rename from emacs.d/elpa/elixir-mode-20150317.1454/elixir-mode-autoloads.el rename to emacs.d/elpa/elixir-mode-20150618.1413/elixir-mode-autoloads.el index 821e703..5b0946b 100644 --- a/emacs.d/elpa/elixir-mode-20150317.1454/elixir-mode-autoloads.el +++ b/emacs.d/elpa/elixir-mode-20150618.1413/elixir-mode-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "elixir-mode" "elixir-mode.el" (21837 24215 +;;;### (autoloads nil "elixir-mode" "elixir-mode.el" (21898 47980 ;;;;;; 0 0)) ;;; Generated autoloads from elixir-mode.el @@ -64,7 +64,7 @@ Major mode for editing Elixir code. ;;;*** ;;;### (autoloads nil nil ("elixir-deprecated.el" "elixir-mode-pkg.el" -;;;;;; "elixir-smie.el") (21837 24215 713052 0)) +;;;;;; "elixir-smie.el") (21898 47980 859329 0)) ;;;*** diff --git a/emacs.d/elpa/elixir-mode-20150317.1454/elixir-mode-pkg.el b/emacs.d/elpa/elixir-mode-20150618.1413/elixir-mode-pkg.el similarity index 71% rename from emacs.d/elpa/elixir-mode-20150317.1454/elixir-mode-pkg.el rename to emacs.d/elpa/elixir-mode-20150618.1413/elixir-mode-pkg.el index 4b4d0e9..d52238a 100644 --- a/emacs.d/elpa/elixir-mode-20150317.1454/elixir-mode-pkg.el +++ b/emacs.d/elpa/elixir-mode-20150618.1413/elixir-mode-pkg.el @@ -1,4 +1,4 @@ -(define-package "elixir-mode" "20150317.1454" "Major mode for editing Elixir files" 'nil :url "https://github.com/elixir-lang/emacs-elixir" :keywords +(define-package "elixir-mode" "20150618.1413" "Major mode for editing Elixir files" 'nil :url "https://github.com/elixir-lang/emacs-elixir" :keywords '("languages" "elixir")) ;; Local Variables: ;; no-byte-compile: t diff --git a/emacs.d/elpa/elixir-mode-20150317.1454/elixir-mode.el b/emacs.d/elpa/elixir-mode-20150618.1413/elixir-mode.el similarity index 80% rename from emacs.d/elpa/elixir-mode-20150317.1454/elixir-mode.el rename to emacs.d/elpa/elixir-mode-20150618.1413/elixir-mode.el index d2015e5..c7c4b31 100644 --- a/emacs.d/elpa/elixir-mode-20150317.1454/elixir-mode.el +++ b/emacs.d/elpa/elixir-mode-20150618.1413/elixir-mode.el @@ -10,7 +10,7 @@ ;; URL: https://github.com/elixir-lang/emacs-elixir ;; Created: Mon Nov 7 2011 ;; Keywords: languages elixir -;; Version: 2.3.0-cvs +;; Version: 2.2.5 ;; This file is not a part of GNU Emacs. @@ -65,14 +65,14 @@ for the Elixir programming language." "Keymap used in `elixir-mode'.") (defvar elixir-imenu-generic-expression - '(("Modules" "^\\s-*defmodule[ \n\t]+\\([A-Z][A-Za-z0-9._]+\\)\\s-+do.*$" 1) - ("Public Functions" "^\\s-*def[ \n\t]+\\([a-z0-9_]+\\)\\(([^)]*)\\)*[ \t\n]+do.*" 1) - ("Private Functions" "^\\s-*defp[ \n\t]+\\([a-z0-9_]+\\)\\(([^)]*)\\)*[ \t\n]+do.*" 1) - ("Public Macros" "^\\s-*defmacro[ \n\t]+\\([a-z0-9_]+\\)\\(([^)]*)\\)*[ \t\n]+do.*" 1) - ("Private Macros" "^\\s-*defmacrop[ \n\t]+\\([a-z0-9_]+\\)\\(([^)]*)\\)*[ \t\n]+do.*" 1) - ("Delegates" "^\\s-*defdelegate[ \n\t]+\\([a-z0-9_]+\\)\\(([^)]*)\\)*[ \t\n]+do.*" 1) - ("Overridables" "^\\s-*defoverridable[ \n\t]+\\([a-z0-9_]+\\)\\(([^)]*)\\)*[ \t\n]+do.*" 1) - ("Tests" "^\\s-*test[ \t\n]+\"?\\(:?[a-z0-9_@+() \t-]+\\)\"?[ \t\n]+do.*" 1)) + '(("Modules" "^\\s-*defmodule[ \n\t]+\\([A-Z][A-Za-z0-9._]+\\)\\s-+.*$" 1) + ("Public Functions" "^\\s-*def[ \n\t]+\\([a-z0-9_!\\?]+\\)\\(([^)]*)\\)*.*" 1) + ("Private Functions" "^\\s-*defp[ \n\t]+\\([a-z0-9_!\\?]+\\)\\(([^)]*)\\)*.*" 1) + ("Public Macros" "^\\s-*defmacro[ \n\t]+\\([a-z0-9_!\\?]+\\)\\(([^)]*)\\)*.*" 1) + ("Private Macros" "^\\s-*defmacrop[ \n\t]+\\([a-z0-9_!\\?]+\\)\\(([^)]*)\\)*.*" 1) + ("Delegates" "^\\s-*defdelegate[ \n\t]+\\([a-z0-9_]+\\)\\(([^)]*)\\)*.*" 1) + ("Overridables" "^\\s-*defoverridable[ \n\t]+\\([a-z0-9_]+\\)\\(([^)]*)\\)*.*" 1) + ("Tests" "^\\s-*test[ \t\n]+\"?\\(:?[a-z0-9_@+() \t-]+\\)\"?[ \t\n]+.*" 1)) "Imenu pattern for `elixir-mode'.") (defgroup elixir nil @@ -152,40 +152,23 @@ for the Elixir programming language." "For use with atoms & map keys." :group 'font-lock-faces) -(defun elixir-syntax-propertize-interpolation () - (let* ((beg (match-beginning 0)) - (context (save-excursion (save-match-data (syntax-ppss beg))))) - (put-text-property beg (1+ beg) 'elixir-interpolation - (cons (nth 3 context) (match-data))))) - -(defun elixir-syntax-propertize-function (start end) - (let ((case-fold-search nil)) - (goto-char start) - (remove-text-properties start end '(elixir-interpolation)) - (funcall - (syntax-propertize-rules - ((rx (group "#{" (0+ (not (any "}"))) "}")) - (0 (ignore (elixir-syntax-propertize-interpolation))))) - start end))) - -(defun elixir-match-interpolation (limit) - (let ((pos (next-single-char-property-change (point) 'elixir-interpolation - nil limit))) - (when (and pos (> pos (point))) - (goto-char pos) - (let ((value (get-text-property pos 'elixir-interpolation))) - (if (eq (car value) ?\") - (progn - (set-match-data (cdr value)) - t) - (elixir-match-interpolation limit)))))) - (eval-when-compile (defconst elixir-rx-constituents `( + (string-delimiter . ,(rx (and + ;; Match even number of backslashes. + (or (not (any ?\\ ?\' ?\")) point + ;; Quotes might be preceded by escaped quote + (and (or (not (any ?\\)) point) ?\\ + (* ?\\ ?\\) (any ?\' ?\"))) + (* ?\\ ?\\) + ;; Match single or triple quotes of any kind. + (group (or "\"" "\"\"\"" "'" "'''"))))) (atoms . ,(rx ":" (or - (one-or-more (any "a-z" "A-Z" "_" "\"" "'")) + (and + (any "a-z" "A-Z" "_" "\"" "'") + (zero-or-more (any "a-z" "A-Z" "0-9" "_" "\"" "'"))) (and "\"" (one-or-more (not (any "\""))) "\"") (and "'" (one-or-more (not (any "'"))) "'")))) (builtin . ,(rx symbol-start @@ -199,25 +182,6 @@ for the Elixir programming language." "defexception" "defstruct" "defimpl" "defcallback") symbol-end)) - (builtin-modules . ,(rx symbol-start - (or "Agent" "Application" "Atom" "Base" - "Behaviour" "Bitwise" "Builtin" "Code" "Dict" - "EEx" "Elixir" "Enum" "ExUnit" "Exception" - "File" "File.Stat" "File.Stream" "Float" - "Function" "GenEvent" "GenServer" "GenTCP" - "HashDict" "HashSet" "IO" "IO.ANSI" - "IO.Stream" "Inspect.Algebra" "Inspect.Opts" - "Integer" "Kernel" "Kernel.ParallelCompiler" - "Kernel.ParallelRequire" "Kernel.SpecialForms" - "Kernel.Typespec" "Keyword" "List" "Macro" - "Macro.Env" "Map" "Math" "Module" "Node" - "OptionParser" "OrdDict" "Path" "Port" - "Process" "Protocol" "Range" "Record" "Regex" - "Set" "Stream" "String" "StringIO" - "Supervisor" "Supervisor.Spec" "System" "Task" - "Task.Supervisor" "Tuple" "URI" - "UnboundMethod" "Version") - symbol-end)) (builtin-namespace . ,(rx symbol-start (or "import" "require" "use" "alias") symbol-end)) @@ -227,8 +191,8 @@ for the Elixir programming language." anything symbol-end)) (function-declaration . ,(rx symbol-start - (or "def" "defp") - symbol-end)) + (or "def" "defp") + symbol-end)) ;; Match `@doc' or `@moduledoc' syntax, with or without triple quotes. (heredocs . ,(rx symbol-start (or "@doc" "@moduledoc" "~s") @@ -252,12 +216,13 @@ for the Elixir programming language." ;; Finally, like other identifiers, it can be terminated with either `?' ;; or `!'. (module-names . ,(rx symbol-start + (optional "%") (one-or-more (any "A-Z")) (zero-or-more (any "A-Z" "a-z" "_" "0-9")) (zero-or-more (and "." (one-or-more (any "A-Z" "_")) - (zero-or-more (any "A-Z" "a-z" "_" "0-9")))) + (zero-or-more (any "A-Z" "a-z" "_" "0-9")))) (optional (or "!" "?")) symbol-end)) (operators1 . ,(rx symbol-start @@ -289,17 +254,94 @@ for the Elixir programming language." (t (rx-to-string (car sexps) t)))))) +(defsubst elixir-syntax-count-quotes (quote-char &optional point limit) + "Count number of quotes around point (max is 3). +QUOTE-CHAR is the quote char to count. Optional argument POINT is +the point where scan starts (defaults to current point), and LIMIT +is used to limit the scan." + (let ((i 0)) + (while (and (< i 3) + (or (not limit) (< (+ point i) limit)) + (eq (char-after (+ point i)) quote-char)) + (setq i (1+ i))) + i)) + +(defun elixir-syntax-stringify () + "Put `syntax-table' property correctly on single/triple quotes." + (let* ((num-quotes (length (match-string-no-properties 1))) + (ppss (prog2 + (backward-char num-quotes) + (syntax-ppss) + (forward-char num-quotes))) + (string-start (and (not (nth 4 ppss)) (nth 8 ppss))) + (quote-starting-pos (- (point) num-quotes)) + (quote-ending-pos (point)) + (num-closing-quotes + (and string-start + (elixir-syntax-count-quotes + (char-before) string-start quote-starting-pos)))) + (cond ((and string-start (= num-closing-quotes 0)) + ;; This set of quotes doesn't match the string starting + ;; kind. Do nothing. + nil) + ((not string-start) + ;; This set of quotes delimit the start of a string. + (put-text-property quote-starting-pos (1+ quote-starting-pos) + 'syntax-table (string-to-syntax "|"))) + ((= num-quotes num-closing-quotes) + ;; This set of quotes delimit the end of a string. + (put-text-property (1- quote-ending-pos) quote-ending-pos + 'syntax-table (string-to-syntax "|"))) + ((> num-quotes num-closing-quotes) + ;; This may only happen whenever a triple quote is closing + ;; a single quoted string. Add string delimiter syntax to + ;; all three quotes. + (put-text-property quote-starting-pos quote-ending-pos + 'syntax-table (string-to-syntax "|")))))) + + +(defun elixir-syntax-propertize-interpolation () + (let* ((beg (match-beginning 0)) + (context (save-excursion (save-match-data (syntax-ppss beg))))) + (put-text-property beg (1+ beg) 'elixir-interpolation + (cons (nth 3 context) (match-data))))) + +(defconst elixir-syntax-propertize-function + (syntax-propertize-rules + ((elixir-rx string-delimiter) + (0 (ignore (elixir-syntax-stringify)))) + ((rx (group "#{" (0+ (not (any "}"))) "}")) + (0 (ignore (elixir-syntax-propertize-interpolation)))))) + +(defun elixir-syntax-propertize-function (start end) + (let ((case-fold-search nil)) + (goto-char start) + (funcall + (syntax-propertize-rules + ((elixir-rx string-delimiter) + (0 (ignore (elixir-syntax-stringify)))) + ((rx (group "#{" (0+ (not (any "}"))) "}")) + (0 (ignore (elixir-syntax-propertize-interpolation))))) + start end))) + +(defun elixir-match-interpolation (limit) + (let ((pos (next-single-char-property-change (point) 'elixir-interpolation + nil limit))) + (when (and pos (> pos (point))) + (goto-char pos) + (let ((value (get-text-property pos 'elixir-interpolation))) + (if (eq (car value) ?\") + (progn + (set-match-data (cdr value)) + t) + (elixir-match-interpolation limit)))))) + + (defconst elixir-font-lock-keywords `( ;; String interpolation (elixir-match-interpolation 0 font-lock-variable-name-face t) - ;; Module-defining & namespace builtins - (,(elixir-rx (or builtin-declaration builtin-namespace) - space - (group module-names)) - 1 font-lock-type-face) - ;; Module attributes (,(elixir-rx (group (or heredocs (and "@" (1+ identifiers))))) @@ -316,18 +358,37 @@ for the Elixir programming language." (group identifiers)) 2 font-lock-function-name-face) - ;; Variable definitions - (,(elixir-rx (group identifiers) - (one-or-more space) - "=" - (or (one-or-more space) - (one-or-more "\n"))) - 1 font-lock-variable-name-face) - ;; Sigils (,(elixir-rx (group sigils)) 1 font-lock-builtin-face) + ;; Sigil patterns. Elixir has support for eight different sigil delimiters. + ;; This isn't a very DRY approach here but it gets the job done. + (,(elixir-rx sigils + (and "/" (group (one-or-more (not (any "/")))) "/")) + 1 font-lock-string-face) + (,(elixir-rx sigils + (and "[" (group (one-or-more (not (any "]")))) "]")) + 1 font-lock-string-face) + (,(elixir-rx sigils + (and "{" (group (one-or-more (not (any "}")))) "}")) + 1 font-lock-string-face) + (,(elixir-rx sigils + (and "(" (group (one-or-more (not (any ")")))) ")")) + 1 font-lock-string-face) + (,(elixir-rx sigils + (and "|" (group (one-or-more (not (any "|")))) "|")) + 1 font-lock-string-face) + (,(elixir-rx sigils + (and "\"" (group (one-or-more (not (any "\"")))) "\"")) + 1 font-lock-string-face) + (,(elixir-rx sigils + (and "'" (group (one-or-more (not (any "'")))) "'")) + 1 font-lock-string-face) + (,(elixir-rx sigils + (and "<" (group (one-or-more (not (any ">")))) ">")) + 1 font-lock-string-face) + ;; Regex patterns. Elixir has support for eight different regex delimiters. ;; This isn't a very DRY approach here but it gets the job done. (,(elixir-rx "~r" @@ -355,16 +416,30 @@ for the Elixir programming language." (and "<" (group (one-or-more (not (any ">")))) ">")) 1 font-lock-string-face) + ;; Modules + (,(elixir-rx (group module-names)) + 1 font-lock-type-face) + ;; Atoms and singleton-like words like true/false/nil. - (,(elixir-rx (group atoms)) + (,(elixir-rx (group atoms) + (zero-or-more space) + (optional "=")) 1 elixir-atom-face) + ;; Variable definitions + (,(elixir-rx (group identifiers) + (zero-or-more space) + "=" + (or (zero-or-more space) + (one-or-more "\n"))) + 1 font-lock-variable-name-face) + ;; Map keys (,(elixir-rx (group (and (one-or-more identifiers) ":"))) 1 elixir-atom-face) - ;; Built-in modules and pseudovariables - (,(elixir-rx (group (or builtin-modules pseudo-var))) + ;; Pseudovariables + (,(elixir-rx (group pseudo-var)) 1 font-lock-constant-face) ;; Code points @@ -405,8 +480,7 @@ Argument FILE-NAME ." (defun elixir-quoted--initialize-buffer (quoted) (pop-to-buffer elixir-quoted--buffer-name) - (setq buffer-undo-list nil) ; Get rid of undo information from - ; previous expansions + (setq buffer-undo-list nil) ; Get rid of undo information from previous expansions (let ((inhibit-read-only t) (buffer-undo-list t)) ; Ignore undo information (erase-buffer) diff --git a/emacs.d/elpa/elixir-mode-20150317.1454/elixir-smie.el b/emacs.d/elpa/elixir-mode-20150618.1413/elixir-smie.el similarity index 75% rename from emacs.d/elpa/elixir-mode-20150317.1454/elixir-smie.el rename to emacs.d/elpa/elixir-mode-20150618.1413/elixir-smie.el index e697161..348ecfd 100644 --- a/emacs.d/elpa/elixir-mode-20150317.1454/elixir-smie.el +++ b/emacs.d/elpa/elixir-mode-20150618.1413/elixir-smie.el @@ -150,6 +150,9 @@ (defvar elixir-smie--block-operator-regexp (rx "->" (0+ nonl))) +(defvar elixir-smie--oneline-def-operator-regexp + (rx "do:" (0+ nonl))) + (defvar elixir-smie--spaces-til-eol-regexp (rx (and (1+ space) eol)) "Regex representing one or more whitespace characters concluding with eol.") @@ -194,7 +197,7 @@ (forward-char) (self-call)) ((looking-at elixir-smie--spaces-til-eol-regexp) - (move-beginning-of-line 2) + (forward-char) (self-call)) ;; And if we're NOT on a blank line, move to the end of the line, and see ;; if we're looking back at a block operator. @@ -241,6 +244,9 @@ (if (elixir-smie--semi-ends-match) "MATCH-STATEMENT-DELIMITER" ";")) + ((looking-back elixir-smie--oneline-def-operator-regexp (- (point) 3) t) + (goto-char (match-beginning 0)) + ";") ((looking-back elixir-smie--block-operator-regexp (- (point) 3) t) (goto-char (match-beginning 0)) "->") @@ -264,6 +270,10 @@ (defun elixir-smie-rules (kind token) (pcase (cons kind token) + (`(:list-intro . ";") + -4) + (`(:elem . args) + -4) (`(:before . "OP") (when (and (not (smie-rule-hanging-p)) (smie-rule-prev-p "OP")) @@ -272,27 +282,67 @@ (cond ((smie-rule-sibling-p) nil) ((smie-rule-hanging-p) (smie-rule-parent elixir-smie-indent-basic)) + ((and (not (smie-rule-sibling-p)) + (not (smie-rule-hanging-p)) + (smie-rule-parent-p "do:")) + ;; Dedent the line after an OP if it's after a "do:" token, which implies + ;; a one-line function. + (smie-rule-parent + (- (+ elixir-smie-indent-basic elixir-smie-indent-basic)))) (t (smie-rule-parent)))) (`(:before . "MATCH-STATEMENT-DELIMITER") (cond + ((smie-rule-parent-p "MATCH-STATEMENT-DELIMITER") + (smie-rule-parent)) ((and (not (smie-rule-sibling-p)) + (nth 2 smie--parent) (smie-rule-hanging-p)) - (smie-rule-parent elixir-smie-indent-basic)))) + (smie-rule-parent elixir-smie-indent-basic)) + ((and (not (smie-rule-sibling-p)) + (not (nth 2 smie--parent)) + (smie-rule-hanging-p)) + (smie-rule-parent)))) (`(:before . "fn") (smie-rule-parent)) + (`(:before . "do:") + (cond + ((smie-rule-parent-p "def" "if") + (smie-rule-parent)))) (`(:before . "end") (smie-rule-parent)) ;; Closing paren on the other line (`(:before . "(") - (smie-rule-parent)) + (cond + ((smie-rule-parent-p "fn") + (smie-rule-parent elixir-smie-indent-basic)) + ;; Indent parenthesis correctly inside a block + ;; + ;; Example: + ;; + ;; def bar do + ;; () + ;; ..... + ((smie-rule-parent-p "do") + (smie-rule-parent elixir-smie-indent-basic)) + (t (smie-rule-parent)))) (`(:before . "[") (cond ((smie-rule-hanging-p) (smie-rule-parent)))) + (`(:after . "{") + (cond + ((smie-rule-hanging-p) + (smie-rule-parent elixir-smie-indent-basic)) + (t elixir-smie-indent-basic))) (`(:after . "[") (cond ((smie-rule-hanging-p) - (smie-rule-parent elixir-smie-indent-basic)))) + (smie-rule-parent elixir-smie-indent-basic)) + (t elixir-smie-indent-basic))) + (`(:before . "if") + (cond + ((smie-rule-parent-p ";") + (smie-rule-parent)))) (`(:before . "->") (cond ((smie-rule-hanging-p) @@ -324,13 +374,26 @@ (cond ((smie-rule-parent-p "after" "catch" "do" "rescue" "try") elixir-smie-indent-basic) - (t - (smie-rule-parent elixir-smie-indent-basic)))))) + (t (smie-rule-parent elixir-smie-indent-basic)))))) (`(:before . ";") (cond + ;; There is a case after an one line definition of functions/macros + ;; when an `if' keyword token is involved, where the next block `end' + ;; token will have a `if' as parent and it's hanging. + ;; + ;; Example: + ;; + ;; defmacro my_if(expr, do: if_block), do: if(expr, do: if_block, else: nil) + ;; defmacro my_if(expr, do: if_block, else: else_block) do + ;; ... + ;; end <- parent is `if` + ((and (smie-rule-parent-p "if") + (smie-rule-hanging-p)) + (smie-rule-parent)) ((smie-rule-parent-p "after" "catch" "def" "defmodule" "defp" "do" "else" "fn" "if" "rescue" "try" "unless") - (smie-rule-parent elixir-smie-indent-basic)))) + (smie-rule-parent elixir-smie-indent-basic)) + )) (`(:after . ";") (cond ((smie-rule-parent-p "def") @@ -338,11 +401,59 @@ ((smie-rule-parent-p "if") (smie-rule-parent)) ((and (smie-rule-parent-p "(") + (boundp 'smie--parent) (save-excursion (goto-char (cadr smie--parent)) (smie-rule-hanging-p))) (smie-rule-parent elixir-smie-indent-basic)))))) +(defun elixir-smie--heredoc-at-current-point-p () + "Return non-nil if cursor is at a string." + (save-excursion + (or (and (nth 3 (save-excursion + (let ((pos (point))) + (parse-partial-sexp 1 pos)))) + (nth 8 (save-excursion + (let ((pos (point))) + (parse-partial-sexp 1 pos))))) + (and (looking-at "\"\"\"") + (match-beginning 0))))) + +(defun elixir-smie--previous-line-empty-p () + "Return non-nil if the previous line is blank." + (save-excursion + (forward-line -1) + (and (eolp) (bolp)))) + +(defun elixir-smie--previous-line-indentation () + "Return the indentation of the previous line." + (save-excursion + (forward-line -1) + (current-indentation))) + +;; Add the custom function to handle indentation inside heredoc to the +;; smie-indent-functions list. The indentation function will only be +;; process inside an elixir-mode. +(defun elixir-smie--indent-inside-heredoc () + "Handle indentation inside Elixir heredocs. + +Rules: + 1. If the previous line is empty, indent as the basic indentation + at the beginning of the heredoc. + 2. If the previous line is not empty, indent as the previous line. +" + (if (eq major-mode 'elixir-mode) + (if (elixir-smie--heredoc-at-current-point-p) + (let ((indent + (save-excursion + (when (re-search-backward "^\\(\s+\\).+\"\"\"" nil t) + (string-width (match-string 1)))))) + (if (elixir-smie--previous-line-empty-p) + (goto-char indent) + (goto-char (elixir-smie--previous-line-indentation))))))) + +(add-to-list 'smie-indent-functions 'elixir-smie--indent-inside-heredoc) + (provide 'elixir-smie) ;;; elixir-smie.el ends here diff --git a/emacs.d/elpa/epl-20150326.1212/epl-pkg.el b/emacs.d/elpa/epl-20150326.1212/epl-pkg.el deleted file mode 100644 index 7ef65a8..0000000 --- a/emacs.d/elpa/epl-20150326.1212/epl-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "epl" "20150326.1212" "Emacs Package Library" '((cl-lib "0.3")) :url "http://github.com/cask/epl" :keywords '("convenience")) diff --git a/emacs.d/elpa/epl-20150326.1212/epl-autoloads.el b/emacs.d/elpa/epl-20150517.433/epl-autoloads.el similarity index 82% rename from emacs.d/elpa/epl-20150326.1212/epl-autoloads.el rename to emacs.d/elpa/epl-20150517.433/epl-autoloads.el index 58e1d16..5c8154d 100644 --- a/emacs.d/elpa/epl-20150326.1212/epl-autoloads.el +++ b/emacs.d/elpa/epl-20150517.433/epl-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil nil ("epl.el") (21837 24214 829363 0)) +;;;### (autoloads nil nil ("epl.el") (21898 47980 543985 0)) ;;;*** diff --git a/emacs.d/elpa/epl-20150517.433/epl-pkg.el b/emacs.d/elpa/epl-20150517.433/epl-pkg.el new file mode 100644 index 0000000..f50c375 --- /dev/null +++ b/emacs.d/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/emacs.d/elpa/epl-20150326.1212/epl.el b/emacs.d/elpa/epl-20150517.433/epl.el similarity index 99% rename from emacs.d/elpa/epl-20150326.1212/epl.el rename to emacs.d/elpa/epl-20150517.433/epl.el index dbe41c0..a06c8dc 100644 --- a/emacs.d/elpa/epl-20150326.1212/epl.el +++ b/emacs.d/elpa/epl-20150517.433/epl.el @@ -6,8 +6,8 @@ ;; Author: Sebastian Wiesner ;; Maintainer: Johan Andersson ;; Sebastian Wiesner -;; Version: 0.7-cvs -;; Package-Version: 20150326.1212 +;; Version: 0.9-cvs +;; Package-Version: 20150517.433 ;; Package-Requires: ((cl-lib "0.3")) ;; Keywords: convenience ;; URL: http://github.com/cask/epl diff --git a/emacs.d/elpa/erlang-20150319.456/erlang-pkg.el b/emacs.d/elpa/erlang-20150319.456/erlang-pkg.el deleted file mode 100644 index 7cee827..0000000 --- a/emacs.d/elpa/erlang-20150319.456/erlang-pkg.el +++ /dev/null @@ -1,4 +0,0 @@ -(define-package "erlang" "20150319.456" "Erlang major mode" 'nil) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/emacs.d/elpa/erlang-20150319.456/erlang-autoloads.el b/emacs.d/elpa/erlang-20150622.644/erlang-autoloads.el similarity index 96% rename from emacs.d/elpa/erlang-20150319.456/erlang-autoloads.el rename to emacs.d/elpa/erlang-20150622.644/erlang-autoloads.el index c5817f1..54809b8 100644 --- a/emacs.d/elpa/erlang-20150319.456/erlang-autoloads.el +++ b/emacs.d/elpa/erlang-20150622.644/erlang-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "erlang" "erlang.el" (21837 24214 0 0)) +;;;### (autoloads nil "erlang" "erlang.el" (21898 47979 0 0)) ;;; Generated autoloads from erlang.el (autoload 'erlang-mode "erlang" "\ @@ -118,7 +118,7 @@ editing control characters: ;;;*** -;;;### (autoloads nil "erlang-start" "erlang-start.el" (21837 24214 +;;;### (autoloads nil "erlang-start" "erlang-start.el" (21898 47979 ;;;;;; 0 0)) ;;; Generated autoloads from erlang-start.el @@ -132,7 +132,7 @@ editing control characters: ;;;### (autoloads nil nil ("erlang-eunit.el" "erlang-flymake.el" ;;;;;; "erlang-pkg.el" "erlang-skels-old.el" "erlang-skels.el" "erlang_appwiz.el") -;;;;;; (21837 24214 353646 0)) +;;;;;; (21898 47979 264219 0)) ;;;*** diff --git a/emacs.d/elpa/erlang-20150319.456/erlang-eunit.el b/emacs.d/elpa/erlang-20150622.644/erlang-eunit.el similarity index 96% rename from emacs.d/elpa/erlang-20150319.456/erlang-eunit.el rename to emacs.d/elpa/erlang-20150622.644/erlang-eunit.el index 0adeff1..a3c29c5 100644 --- a/emacs.d/elpa/erlang-20150319.456/erlang-eunit.el +++ b/emacs.d/elpa/erlang-20150622.644/erlang-eunit.el @@ -3,16 +3,17 @@ ;; ;; Copyright Ericsson AB 2009-2010. All Rights Reserved. ;; -;; The contents of this file are subject to the Erlang Public License, -;; Version 1.1, (the "License"); you may not use this file except in -;; compliance with the License. You should have received a copy of the -;; Erlang Public License along with this software. If not, it can be -;; retrieved online at http://www.erlang.org/. +;; Licensed under the Apache License, Version 2.0 (the "License"); +;; you may not use this file except in compliance with the License. +;; You may obtain a copy of the License at ;; -;; Software distributed under the License is distributed on an "AS IS" -;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -;; the License for the specific language governing rights and limitations -;; under the License. +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. ;; ;; %CopyrightEnd% ;;; diff --git a/emacs.d/elpa/erlang-20150319.456/erlang-flymake.el b/emacs.d/elpa/erlang-20150622.644/erlang-flymake.el similarity index 100% rename from emacs.d/elpa/erlang-20150319.456/erlang-flymake.el rename to emacs.d/elpa/erlang-20150622.644/erlang-flymake.el diff --git a/emacs.d/elpa/erlang-20150622.644/erlang-pkg.el b/emacs.d/elpa/erlang-20150622.644/erlang-pkg.el new file mode 100644 index 0000000..780460d --- /dev/null +++ b/emacs.d/elpa/erlang-20150622.644/erlang-pkg.el @@ -0,0 +1,4 @@ +(define-package "erlang" "20150622.644" "Erlang major mode" 'nil) +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/emacs.d/elpa/erlang-20150319.456/erlang-skels-old.el b/emacs.d/elpa/erlang-20150622.644/erlang-skels-old.el similarity index 97% rename from emacs.d/elpa/erlang-20150319.456/erlang-skels-old.el rename to emacs.d/elpa/erlang-20150622.644/erlang-skels-old.el index b88d7bc..c271cce 100644 --- a/emacs.d/elpa/erlang-20150319.456/erlang-skels-old.el +++ b/emacs.d/elpa/erlang-20150622.644/erlang-skels-old.el @@ -3,16 +3,17 @@ ;; ;; Copyright Ericsson AB 2010. All Rights Reserved. ;; -;; The contents of this file are subject to the Erlang Public License, -;; Version 1.1, (the "License"); you may not use this file except in -;; compliance with the License. You should have received a copy of the -;; Erlang Public License along with this software. If not, it can be -;; retrieved online at http://www.erlang.org/. +;; Licensed under the Apache License, Version 2.0 (the "License"); +;; you may not use this file except in compliance with the License. +;; You may obtain a copy of the License at ;; -;; Software distributed under the License is distributed on an "AS IS" -;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -;; the License for the specific language governing rights and limitations -;; under the License. +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. ;; ;; %CopyrightEnd% ;;; @@ -838,7 +839,7 @@ Please see the function `tempo-define-template'.") "Config." n n (erlang-skel-separator 2) - "%% Function: end_per_suite(Config) -> void()" n + "%% Function: end_per_suite(Config) -> term()" n "%%" n "%% Config = [tuple()]" n "%% A list of key/value pairs, holding the test case configuration." n @@ -867,7 +868,7 @@ Please see the function `tempo-define-template'.") "Config." n n (erlang-skel-separator 2) - "%% Function: end_per_testcase(TestCase, Config) -> void()" n + "%% Function: end_per_testcase(TestCase, Config) -> term()" n "%%" n "%% TestCase = atom()" n "%% Name of the test case that is finished." n @@ -993,7 +994,7 @@ Please see the function `tempo-define-template'.") "Config." n n (erlang-skel-separator 2) - "%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}" n + "%% Function: end_per_suite(Config0) -> term() | {save_config,Config1}" n "%%" n "%% Config0 = Config1 = [tuple()]" n "%% A list of key/value pairs, holding the test case configuration." n @@ -1021,7 +1022,7 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator 2) "%% Function: end_per_group(GroupName, Config0) ->" n - "%% void() | {save_config,Config1}" n + "%% term() | {save_config,Config1}" n "%%" n "%% GroupName = atom()" n "%% Name of the test case group that is finished." n @@ -1054,7 +1055,7 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator 2) "%% Function: end_per_testcase(TestCase, Config0) ->" n - "%% void() | {save_config,Config1} | {fail,Reason}" n + "%% term() | {save_config,Config1} | {fail,Reason}" n "%%" n "%% TestCase = atom()" n "%% Name of the test case that is finished." n @@ -1175,7 +1176,7 @@ Please see the function `tempo-define-template'.") "Config." n n (erlang-skel-separator 2) - "%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}" n + "%% Function: end_per_suite(Config0) -> term() | {save_config,Config1}" n "%% Config0 = Config1 = [tuple()]" n (erlang-skel-separator 2) "end_per_suite(_Config) ->" n > @@ -1193,7 +1194,7 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator 2) "%% Function: end_per_group(GroupName, Config0) ->" n - "%% void() | {save_config,Config1}" n + "%% term() | {save_config,Config1}" n "%% GroupName = atom()" n "%% Config0 = Config1 = [tuple()]" n (erlang-skel-separator 2) @@ -1212,7 +1213,7 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator 2) "%% Function: end_per_testcase(TestCase, Config0) ->" n - "%% void() | {save_config,Config1} | {fail,Reason}" n + "%% term() | {save_config,Config1} | {fail,Reason}" n "%% TestCase = atom()" n "%% Config0 = Config1 = [tuple()]" n "%% Reason = term()" n diff --git a/emacs.d/elpa/erlang-20150319.456/erlang-skels.el b/emacs.d/elpa/erlang-20150622.644/erlang-skels.el similarity index 97% rename from emacs.d/elpa/erlang-20150319.456/erlang-skels.el rename to emacs.d/elpa/erlang-20150622.644/erlang-skels.el index 78929ac..6880ec7 100644 --- a/emacs.d/elpa/erlang-20150319.456/erlang-skels.el +++ b/emacs.d/elpa/erlang-20150622.644/erlang-skels.el @@ -1,18 +1,19 @@ ;; ;; %CopyrightBegin% ;; -;; Copyright Ericsson AB 2010. All Rights Reserved. +;; Copyright Ericsson AB 2010-2014. All Rights Reserved. ;; -;; The contents of this file are subject to the Erlang Public License, -;; Version 1.1, (the "License"); you may not use this file except in -;; compliance with the License. You should have received a copy of the -;; Erlang Public License along with this software. If not, it can be -;; retrieved online at http://www.erlang.org/. +;; Licensed under the Apache License, Version 2.0 (the "License"); +;; you may not use this file except in compliance with the License. +;; You may obtain a copy of the License at ;; -;; Software distributed under the License is distributed on an "AS IS" -;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -;; the License for the specific language governing rights and limitations -;; under the License. +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. ;; ;; %CopyrightEnd% ;;; @@ -352,26 +353,25 @@ Please see the function `tempo-define-template'.") "%% @doc" n "%% Whenever a supervisor is started using supervisor:start_link/[2,3]," n "%% this function is called by the new process to find out about" n - "%% restart strategy, maximum restart frequency and child" n + "%% restart strategy, maximum restart intensity, and child" n "%% specifications." n "%%" n "%% @spec init(Args) -> {ok, {SupFlags, [ChildSpec]}} |" n "%% ignore |" n "%% {error, Reason}" n (erlang-skel-separator-end 2) - "init([]) ->" n> - "RestartStrategy = one_for_one," n> - "MaxRestarts = 1000," n> - "MaxSecondsBetweenRestarts = 3600," n - "" n> - "SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts}," n + "init([]) ->" n "" n> - "Restart = permanent," n> - "Shutdown = 2000," n> - "Type = worker," n + "SupFlags = #{strategy => one_for_one," n> + "intensity => 1," n> + "period => 5}," n "" n> - "AChild = {'AName', {'AModule', start_link, []}," n> - "Restart, Shutdown, Type, ['AModule']}," n + "AChild = #{id => 'AName'," n> + "start => {'AModule', start_link, []}," n> + "restart => permanent," n> + "shutdown => 5000," n> + "type => worker," n> + "modules => ['AModule']}," n "" n> "{ok, {SupFlags, [AChild]}}." n n @@ -379,7 +379,7 @@ Please see the function `tempo-define-template'.") "%%% Internal functions" n (erlang-skel-double-separator-end 3) ) - "*The template of an supervisor behaviour. + "*The template of a supervisor behaviour. Please see the function `tempo-define-template'.") (defvar erlang-skel-supervisor-bridge @@ -449,7 +449,7 @@ Please see the function `tempo-define-template'.") "%%% Internal functions" n (erlang-skel-double-separator-end 3) ) - "*The template of an supervisor_bridge behaviour. + "*The template of a supervisor_bridge behaviour. Please see the function `tempo-define-template'.") (defvar erlang-skel-generic-server @@ -1235,7 +1235,7 @@ Please see the function `tempo-define-template'.") "Config." n n (erlang-skel-separator-start 2) - "%% @spec end_per_suite(Config0) -> void() | {save_config,Config1}" n + "%% @spec end_per_suite(Config0) -> term() | {save_config,Config1}" n "%% Config0 = Config1 = [tuple()]" n (erlang-skel-separator-end 2) "end_per_suite(_Config) ->" n > @@ -1253,7 +1253,7 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator-start 2) "%% @spec end_per_group(GroupName, Config0) ->" n - "%% void() | {save_config,Config1}" n + "%% term() | {save_config,Config1}" n "%% GroupName = atom()" n "%% Config0 = Config1 = [tuple()]" n (erlang-skel-separator-end 2) @@ -1272,7 +1272,7 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator-start 2) "%% @spec end_per_testcase(TestCase, Config0) ->" n - "%% void() | {save_config,Config1} | {fail,Reason}" n + "%% term() | {save_config,Config1} | {fail,Reason}" n "%% TestCase = atom()" n "%% Config0 = Config1 = [tuple()]" n "%% Reason = term()" n @@ -1413,7 +1413,7 @@ Please see the function `tempo-define-template'.") "%% A list of key/value pairs, holding configuration data for the group." n "%%" n "%% @spec end_per_group(GroupName, Config0) ->" n - "%% void() | {save_config,Config1}" n + "%% term() | {save_config,Config1}" n (erlang-skel-separator-end 2) "end_per_group(_GroupName, _Config) ->" n > "ok." n n @@ -1447,7 +1447,7 @@ Please see the function `tempo-define-template'.") "%% A list of key/value pairs, holding the test case configuration." n "%%" n "%% @spec end_per_testcase(TestCase, Config0) ->" n - "%% void() | {save_config,Config1} | {fail,Reason}" n + "%% term() | {save_config,Config1} | {fail,Reason}" n (erlang-skel-separator-end 2) "end_per_testcase(_TestCase, _Config) ->" n > "ok." n n diff --git a/emacs.d/elpa/erlang-20150319.456/erlang-start.el b/emacs.d/elpa/erlang-20150622.644/erlang-start.el similarity index 100% rename from emacs.d/elpa/erlang-20150319.456/erlang-start.el rename to emacs.d/elpa/erlang-20150622.644/erlang-start.el diff --git a/emacs.d/elpa/erlang-20150319.456/erlang.el b/emacs.d/elpa/erlang-20150622.644/erlang.el similarity index 99% rename from emacs.d/elpa/erlang-20150319.456/erlang.el rename to emacs.d/elpa/erlang-20150622.644/erlang.el index 0c003ba..4aa1ab7 100644 --- a/emacs.d/elpa/erlang-20150319.456/erlang.el +++ b/emacs.d/elpa/erlang-20150622.644/erlang.el @@ -9,16 +9,17 @@ ;; ;; Copyright Ericsson AB 1996-2014. All Rights Reserved. ;; -;; The contents of this file are subject to the Erlang Public License, -;; Version 1.1, (the "License"); you may not use this file except in -;; compliance with the License. You should have received a copy of the -;; Erlang Public License along with this software. If not, it can be -;; retrieved online at http://www.erlang.org/. +;; Licensed under the Apache License, Version 2.0 (the "License"); +;; you may not use this file except in compliance with the License. +;; You may obtain a copy of the License at ;; -;; Software distributed under the License is distributed on an "AS IS" -;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -;; the License for the specific language governing rights and limitations -;; under the License. +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. ;; ;; %CopyrightEnd% ;; @@ -880,10 +881,10 @@ resulting regexp is surrounded by \\_< and \\_>." "dt_restore_tag" "dt_spread_tag" "dunlink" + "convert_time_unit" "external_size" "finish_after_on_load" "finish_loading" - "flush_monitor_message" "format_cpu_topology" "fun_info" "fun_info_mfa" @@ -913,6 +914,7 @@ resulting regexp is surrounded by \\_< and \\_>." "memory" "module_info" "monitor_node" + "monotonic_time" "nif_error" "phash" "phash2" @@ -946,13 +948,17 @@ resulting regexp is surrounded by \\_< and \\_>." "system_info" "system_monitor" "system_profile" + "system_time" "trace" "trace_delivered" "trace_info" "trace_pattern" + "time_offset" + "timestamp" "universaltime" "universaltime_to_localtime" "universaltime_to_posixtime" + "unique_integer" "yield") "Erlang built-in functions (BIFs) that needs erlang: prefix")) @@ -2444,7 +2450,10 @@ This is automagically called by the user level function `indent-region'." ;; Parse the Erlang code from the beginning of the clause to ;; the beginning of the region. (while (< (point) indent-point) - (setq state (erlang-partial-parse (point) indent-point state))) + (let ((pt (point))) + (setq state (erlang-partial-parse pt indent-point state)) + (if (= pt (point)) + (error "Illegal syntax")))) ;; Indent every line in the region (while continue (goto-char indent-point) @@ -2480,8 +2489,11 @@ This is automagically called by the user level function `indent-region'." (if (>= from-end (- (point-max) indent-point)) (setq continue nil) (while (< (point) indent-point) - (setq state (erlang-partial-parse - (point) indent-point state)))))))) + (let ((pt (point))) + (setq state (erlang-partial-parse + pt indent-point state)) + (if (= pt (point)) + (error "Illegal syntax"))))))))) (defun erlang-indent-current-buffer () @@ -2528,7 +2540,10 @@ Return nil if line starts inside string, t if in a comment." (goto-char parse-start) (erlang-beginning-of-clause)) (while (< (point) indent-point) - (setq state (erlang-partial-parse (point) indent-point state))) + (let ((pt (point))) + (setq state (erlang-partial-parse pt indent-point state)) + (if (= pt (point)) + (error "Illegal syntax")))) (erlang-calculate-stack-indent indent-point state)))) (defun erlang-show-syntactic-information () @@ -2698,12 +2713,13 @@ Value is list (stack token-start token-type in-what)." (erlang-push (list '|| token (current-column)) stack) (forward-char 2)) - ;; Bit-syntax open paren - ((looking-at "<<") + ;; Bit-syntax open. Note that map syntax allows "<<" to follow ":=" + ;; or "=>" without intervening whitespace, so handle that case here + ((looking-at "\\(:=\\|=>\\)?<<") (erlang-push (list '<< token (current-column)) stack) - (forward-char 2)) + (forward-char (- (match-end 0) (match-beginning 0)))) - ;; Bbit-syntax close paren + ;; Bit-syntax close ((looking-at ">>") (while (memq (car (car stack)) '(|| ->)) (erlang-pop stack)) @@ -4188,7 +4204,10 @@ This function is designed to be a member of a criteria list." ;; Do not return `stop' when inside a list comprehension ;; construction. (The point must be after `||'). (while (< (point) orig-point) - (setq state (erlang-partial-parse (point) orig-point state))) + (let ((pt (point))) + (setq state (erlang-partial-parse pt orig-point state)) + (if (= pt (point)) + (error "Illegal syntax")))) (if (and (car state) (eq (car (car (car state))) '||)) nil 'stop))) diff --git a/emacs.d/elpa/erlang-20150319.456/erlang_appwiz.el b/emacs.d/elpa/erlang-20150622.644/erlang_appwiz.el similarity index 100% rename from emacs.d/elpa/erlang-20150319.456/erlang_appwiz.el rename to emacs.d/elpa/erlang-20150622.644/erlang_appwiz.el diff --git a/emacs.d/elpa/find-file-in-project-20150506.33/find-file-in-project-pkg.el b/emacs.d/elpa/find-file-in-project-20150506.33/find-file-in-project-pkg.el deleted file mode 100644 index ab9c5ff..0000000 --- a/emacs.d/elpa/find-file-in-project-20150506.33/find-file-in-project-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "find-file-in-project" "20150506.33" "Find files in a project quickly." 'nil :url "http://www.emacswiki.org/cgi-bin/wiki/FindFileInProject" :keywords '("project" "convenience")) diff --git a/emacs.d/elpa/find-file-in-project-20150506.33/find-file-in-project-autoloads.el b/emacs.d/elpa/find-file-in-project-20150528.633/find-file-in-project-autoloads.el similarity index 84% rename from emacs.d/elpa/find-file-in-project-20150506.33/find-file-in-project-autoloads.el rename to emacs.d/elpa/find-file-in-project-20150528.633/find-file-in-project-autoloads.el index e226192..9031d13 100644 --- a/emacs.d/elpa/find-file-in-project-20150506.33/find-file-in-project-autoloads.el +++ b/emacs.d/elpa/find-file-in-project-20150528.633/find-file-in-project-autoloads.el @@ -4,7 +4,7 @@ (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) ;;;### (autoloads nil "find-file-in-project" "find-file-in-project.el" -;;;;;; (21837 24214 0 0)) +;;;;;; (21898 47978 0 0)) ;;; Generated autoloads from find-file-in-project.el (autoload 'ffip-current-full-filename-match-pattern-p "find-file-in-project" "\ @@ -14,16 +14,17 @@ Is current full file name (including directory) match the REGEX? (autoload 'find-file-in-project "find-file-in-project" "\ Prompt with a completing list of all files in the project to find one. +If NUM is given, only files modfied NUM days before will be selected. The project's scope is defined as the first directory containing a `ffip-project-file' (It's value is \".git\" by default. You can override this by setting the variable `ffip-project-root'. -\(fn)" t nil) +\(fn &optional NUM)" t nil) (autoload 'ffip-get-project-root-directory "find-file-in-project" "\ -Get the the full path of project root directory +Get the full path of project root directory \(fn)" nil nil) @@ -31,8 +32,9 @@ Get the the full path of project root directory Similar to find-file-in-project. But use string from selected region to search files in the project. If no region is selected, you need provide one. +If NUM is given, only files modfied NUM days before will be selected. -\(fn)" t nil) +\(fn &optional NUM)" t nil) (defalias 'ffip 'find-file-in-project) diff --git a/emacs.d/elpa/find-file-in-project-20150528.633/find-file-in-project-pkg.el b/emacs.d/elpa/find-file-in-project-20150528.633/find-file-in-project-pkg.el new file mode 100644 index 0000000..1c7fa1c --- /dev/null +++ b/emacs.d/elpa/find-file-in-project-20150528.633/find-file-in-project-pkg.el @@ -0,0 +1 @@ +(define-package "find-file-in-project" "20150528.633" "Find files in a project quickly." 'nil :url "http://www.emacswiki.org/cgi-bin/wiki/FindFileInProject" :keywords '("project" "convenience")) diff --git a/emacs.d/elpa/find-file-in-project-20150506.33/find-file-in-project.el b/emacs.d/elpa/find-file-in-project-20150528.633/find-file-in-project.el similarity index 91% rename from emacs.d/elpa/find-file-in-project-20150506.33/find-file-in-project.el rename to emacs.d/elpa/find-file-in-project-20150528.633/find-file-in-project.el index 8baa97d..2891960 100644 --- a/emacs.d/elpa/find-file-in-project-20150506.33/find-file-in-project.el +++ b/emacs.d/elpa/find-file-in-project-20150528.633/find-file-in-project.el @@ -5,7 +5,7 @@ ;; Author: Phil Hagelberg, Doug Alcorn, and Will Farrington ;; Maintainer: Chen Bin ;; URL: http://www.emacswiki.org/cgi-bin/wiki/FindFileInProject -;; Package-Version: 20150506.33 +;; Package-Version: 20150528.633 ;; Git: git://github.com/technomancy/find-file-in-project.git ;; Version: 3.5 ;; Created: 2008-03-18 @@ -232,6 +232,9 @@ This overrides variable `ffip-project-root' when set.") (defun ffip-completing-read (prompt collection) (let (rlt) (cond + ( (= 1 (length collection)) + ;; open file directly + (setq rlt (car collection))) ((fboundp 'ivy-read) (setq rlt (ivy-read prompt collection))) ((and (boundp 'ido-mode) ido-mode) @@ -240,7 +243,7 @@ This overrides variable `ffip-project-root' when set.") (setq rlt (completing-read prompt collection)))) rlt)) -(defun ffip-project-files (&optional keyword) +(defun ffip-project-files (keyword NUM) "Return an alist of all filenames in the project and their path. Files with duplicate filenames are suffixed with the name of the @@ -253,11 +256,14 @@ directory they are found in so that they are unique." (error "No project root found"))))) (cd (file-name-as-directory root)) ;; make the prune pattern more general - (setq cmd (format "%s . \\( %s \\) -prune -o -type f %s %s %s -print %s" + (setq cmd (format "%s . \\( %s \\) -prune -o -type f %s %s %s %s -print %s" (if ffip-find-executable ffip-find-executable (ffip--guess-gnu-find)) - (ffip-prune-patterns) (ffip-join-patterns) + (ffip-prune-patterns) + (ffip-join-patterns) (if keyword (concat "-name \"*" keyword "*\"") "") - ffip-find-options (ffip-limit-find-results))) + (if (and NUM (> NUM 0)) (format "-mtime -%d" NUM) "") + ffip-find-options + (ffip-limit-find-results))) (if ffip-debug (message "run cmd at %s: %s" default-directory cmd)) (setq rlt @@ -276,8 +282,8 @@ directory they are found in so that they are unique." (cd old-default-directory) rlt)) -(defun ffip-find-files (&optional keyword) - (let* ((project-files (ffip-project-files keyword)) +(defun ffip-find-files (keyword NUM) + (let* ((project-files (ffip-project-files keyword NUM)) (files (mapcar 'car project-files)) file root) (cond @@ -295,32 +301,36 @@ directory they are found in so that they are unique." (string-match-p REGEX dir))) ;;;###autoload -(defun find-file-in-project () +(defun find-file-in-project (&optional NUM) "Prompt with a completing list of all files in the project to find one. +If NUM is given, only files modfied NUM days before will be selected. The project's scope is defined as the first directory containing a `ffip-project-file' (It's value is \".git\" by default. You can override this by setting the variable `ffip-project-root'." - (interactive) - (ffip-find-files)) + + (interactive "P") + (ffip-find-files nil NUM)) ;;;###autoload (defun ffip-get-project-root-directory () - "Get the the full path of project root directory" + "Get the full path of project root directory" (expand-file-name (or ffip-project-root (ffip-project-root)))) ;;;###autoload -(defun find-file-in-project-by-selected () +(defun find-file-in-project-by-selected (&optional NUM) "Similar to find-file-in-project. But use string from selected region to search files in the project. -If no region is selected, you need provide one." - (interactive) +If no region is selected, you need provide one. +If NUM is given, only files modfied NUM days before will be selected. +" + (interactive "P") (let ((keyword (if (region-active-p) (buffer-substring-no-properties (region-beginning) (region-end)) (read-string "Enter keyword:")))) - (ffip-find-files keyword))) + (ffip-find-files keyword NUM))) ;;;###autoload (defalias 'ffip 'find-file-in-project) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-imenu.el b/emacs.d/elpa/helm-20150507.2215/helm-imenu.el deleted file mode 100644 index 2bf44c4..0000000 --- a/emacs.d/elpa/helm-20150507.2215/helm-imenu.el +++ /dev/null @@ -1,183 +0,0 @@ -;;; helm-imenu.el --- Helm interface for Imenu -*- lexical-binding: t -*- - -;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto - -;; 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 . - -;;; Code: - -(require 'cl-lib) -(require 'helm) -(require 'imenu) -(require 'helm-utils) -(require 'helm-help) - - -(defgroup helm-imenu nil - "Imenu related libraries and applications for helm." - :group 'helm) - -(defcustom helm-imenu-delimiter " / " - "Delimit types of candidates and his value in `helm-buffer'." - :group 'helm-imenu - :type 'string) - -(defcustom helm-imenu-execute-action-at-once-if-one t - "Goto the candidate when only one is remaining." - :group 'helm-imenu - :type 'boolean) - -(defcustom helm-imenu-lynx-style-map t - "Use Arrow keys to jump to occurences." - :group 'helm-imenu - :type 'boolean) - - -;;; keymap -(defvar helm-imenu-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map helm-map) - (define-key map (kbd "C-c ?") 'helm-imenu-help) - (when helm-imenu-lynx-style-map - (define-key map (kbd "") 'helm-maybe-exit-minibuffer) - (define-key map (kbd "") 'helm-execute-persistent-action)) - (delq nil map))) - - -;;; Internals -(defvar helm-cached-imenu-alist nil) -(make-variable-buffer-local 'helm-cached-imenu-alist) - -(defvar helm-cached-imenu-candidates nil) -(make-variable-buffer-local 'helm-cached-imenu-candidates) - -(defvar helm-cached-imenu-tick nil) -(make-variable-buffer-local 'helm-cached-imenu-tick) - - -(defvar helm-source-imenu nil "See (info \"(emacs)Imenu\")") - -(defclass helm-imenu-source (helm-source-sync) - ((candidates :initform 'helm-imenu-candidates) - (candidate-transformer :initform 'helm-imenu-transformer) - (persistent-action :initform 'helm-imenu-persistent-action) - (persistent-help :initform "Show this entry") - (keymap :initform helm-imenu-map) - (mode-line :initform helm-imenu-mode-line) - (action :initform 'helm-imenu-action))) - -(defcustom helm-imenu-fuzzy-match nil - "Enable fuzzy matching in `helm-source-imenu'." - :group 'helm-imenu - :type 'boolean - :set (lambda (var val) - (set var val) - (setq helm-source-imenu - (helm-make-source "Imenu" 'helm-imenu-source - :fuzzy-match helm-imenu-fuzzy-match)))) - -(defun helm-imenu-action (candidate) - "Default action for `helm-source-imenu'." - (imenu candidate) - ;; If semantic is supported in this buffer - ;; imenu used `semantic-imenu-goto-function' - ;; and position have been highlighted, - ;; no need to highlight again. - (unless (eq imenu-default-goto-function - 'semantic-imenu-goto-function) - (helm-highlight-current-line nil nil nil nil 'pulse))) - -(defun helm-imenu-persistent-action (candidate) - "Default persistent action for `helm-source-imenu'." - (imenu candidate) - (helm-highlight-current-line)) - -(defun helm-imenu-candidates () - (with-helm-current-buffer - (let ((tick (buffer-modified-tick))) - (if (eq helm-cached-imenu-tick tick) - helm-cached-imenu-candidates - (setq imenu--index-alist nil) - (prog1 (setq helm-cached-imenu-candidates - (let ((index (imenu--make-index-alist))) - (helm-imenu--candidates-1 - (delete (assoc "*Rescan*" index) index)))) - (setq helm-cached-imenu-tick tick)))))) - -(defun helm-imenu--candidates-1 (alist) - (cl-loop for elm in alist - append (if (imenu--subalist-p elm) - (helm-imenu--candidates-1 - (cl-loop for (e . v) in (cdr elm) collect - (cons (propertize - e 'helm-imenu-type (car elm)) - v))) - (and (cdr elm) ; bug in imenu, should not be needed. - (list elm))))) - -(defun helm-imenu--get-prop (item) - ;; property value of ITEM can have itself - ;; a property value which have itself a property value - ;; ...and so on; Return a list of all these - ;; properties values starting at ITEM. - (let* ((prop (get-text-property 0 'helm-imenu-type item)) - (lst (list prop item))) - (when prop - (while prop - (setq prop (get-text-property 0 'helm-imenu-type prop)) - (and prop (push prop lst))) - lst))) - -(defun helm-imenu-transformer (candidates) - (cl-loop for (k . v) in candidates - for types = (or (helm-imenu--get-prop k) - (list "Function" k)) - collect - (cons (mapconcat (lambda (x) - (propertize - x 'face (cond ((string= x "Variables") - 'font-lock-variable-name-face) - ((string= x "Function") - 'font-lock-function-name-face) - ((string= x "Types") - 'font-lock-type-face)))) - types helm-imenu-delimiter) - (cons k v)))) - -;;;###autoload -(defun helm-imenu () - "Preconfigured `helm' for `imenu'." - (interactive) - (unless helm-source-imenu - (setq helm-source-imenu - (helm-make-source "Imenu" 'helm-imenu-source - :fuzzy-match helm-imenu-fuzzy-match))) - (let ((imenu-auto-rescan t) - (str (thing-at-point 'symbol)) - (helm-execute-action-at-once-if-one - helm-imenu-execute-action-at-once-if-one)) - (helm :sources 'helm-source-imenu - :default (list (concat "\\_<" str "\\_>") str) - :candidate-number-limit 9999 - :buffer "*helm imenu*"))) - -(provide 'helm-imenu) - -;; Local Variables: -;; byte-compile-warnings: (not cl-functions obsolete) -;; coding: utf-8 -;; indent-tabs-mode: nil -;; End: - -;;; helm-imenu.el ends here diff --git a/emacs.d/elpa/helm-20150507.2215/emacs-helm.sh b/emacs.d/elpa/helm-20150623.1310/emacs-helm.sh similarity index 89% rename from emacs.d/elpa/helm-20150507.2215/emacs-helm.sh rename to emacs.d/elpa/helm-20150623.1310/emacs-helm.sh index d24128d..f3e45a7 100755 --- a/emacs.d/elpa/helm-20150507.2215/emacs-helm.sh +++ b/emacs.d/elpa/helm-20150623.1310/emacs-helm.sh @@ -20,9 +20,12 @@ # Preconfigured Emacs with a basic helm configuration. # Useful to start quickly an emacs -Q with helm. -# Run it from this directory. +# Run it from this directory or symlink it somewhere in your PATH. -TMP="/tmp/helm-cfg.el" +# If TEMP env var exists use it otherwise declare it. +[ -z $TEMP ] && declare TEMP="/tmp" + +CONF_FILE="$TEMP/helm-cfg.el" EMACS=emacs case $1 in @@ -54,13 +57,13 @@ if [ ! -e "$AUTO_FILE" ]; then fi -cat > $TMP < $CONF_FILE <\`helm-find-files'\n\ ;; - \`occur'(M-s o) =>\`helm-occur'\n\ @@ -89,8 +92,8 @@ cat > $TMP <\\[next-history-element]. When nil or not present `thing-at-point' will be used instead. -If `helm-maybe-use-default-as-input' is non--nil display will be +If `helm--maybe-use-default-as-input' is non--nil display will be updated using :default arg as input unless :input is specified, which in this case will take precedence on :default This is a string or a list, in this case the car of the list will @@ -184,10 +184,24 @@ Call `helm' with only ANY-SOURCES and ANY-BUFFER as args. ;;;*** -;;;### (autoloads nil "helm-adaptive" "helm-adaptive.el" (21837 24208 +;;;### (autoloads nil "helm-adaptive" "helm-adaptive.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-adaptive.el +(defvar helm-adaptive-mode nil "\ +Non-nil if Helm-Adaptive mode is enabled. +See the command `helm-adaptive-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 `helm-adaptive-mode'.") + +(custom-autoload 'helm-adaptive-mode "helm-adaptive" nil) + +(autoload 'helm-adaptive-mode "helm-adaptive" "\ +Toggle adaptive sorting in all sources. + +\(fn &optional ARG)" t nil) + (autoload 'helm-reset-adaptive-history "helm-adaptive" "\ Delete all `helm-adaptive-history' and his file. Useful when you have a old or corrupted `helm-adaptive-history-file'. @@ -196,7 +210,7 @@ Useful when you have a old or corrupted `helm-adaptive-history-file'. ;;;*** -;;;### (autoloads nil "helm-apt" "helm-apt.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-apt" "helm-apt.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-apt.el (autoload 'helm-apt "helm-apt" "\ @@ -207,7 +221,7 @@ With a prefix arg reload cache. ;;;*** -;;;### (autoloads nil "helm-bookmark" "helm-bookmark.el" (21837 24208 +;;;### (autoloads nil "helm-bookmark" "helm-bookmark.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-bookmark.el @@ -230,7 +244,7 @@ only if external library addressbook-bookmark.el is available. ;;;*** -;;;### (autoloads nil "helm-buffers" "helm-buffers.el" (21837 24208 +;;;### (autoloads nil "helm-buffers" "helm-buffers.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-buffers.el @@ -239,9 +253,14 @@ Preconfigured `helm' to list buffers. \(fn)" t nil) +(autoload 'helm-mini "helm-buffers" "\ +Preconfigured `helm' lightweight version (buffer -> recentf). + +\(fn)" t nil) + ;;;*** -;;;### (autoloads nil "helm-color" "helm-color.el" (21837 24208 0 +;;;### (autoloads nil "helm-color" "helm-color.el" (21898 47974 0 ;;;;;; 0)) ;;; Generated autoloads from helm-color.el @@ -252,7 +271,7 @@ Preconfigured `helm' for color. ;;;*** -;;;### (autoloads nil "helm-command" "helm-command.el" (21837 24208 +;;;### (autoloads nil "helm-command" "helm-command.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-command.el @@ -269,7 +288,7 @@ You can get help on each command by persistent action. ;;;*** -;;;### (autoloads nil "helm-config" "helm-config.el" (21837 24208 +;;;### (autoloads nil "helm-config" "helm-config.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-config.el @@ -280,28 +299,28 @@ Customize `helm'. ;;;*** -;;;### (autoloads nil "helm-dabbrev" "helm-dabbrev.el" (21837 24208 +;;;### (autoloads nil "helm-dabbrev" "helm-dabbrev.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-dabbrev.el (autoload 'helm-dabbrev "helm-dabbrev" "\ - +Preconfigured helm for dynamic abbreviations. \(fn)" t nil) ;;;*** -;;;### (autoloads nil "helm-elisp" "helm-elisp.el" (21837 24208 0 +;;;### (autoloads nil "helm-elisp" "helm-elisp.el" (21898 47974 0 ;;;;;; 0)) ;;; Generated autoloads from helm-elisp.el (autoload 'helm-lisp-completion-at-point "helm-elisp" "\ -Helm lisp symbol completion at point. +Preconfigured helm for lisp symbol completion at point. \(fn)" t nil) (autoload 'helm-complete-file-name-at-point "helm-elisp" "\ -Complete file name at point. +Preconfigured helm to complete file name at point. \(fn &optional FORCE)" t nil) @@ -311,7 +330,7 @@ Complete file name at point. \(fn)" t nil) (autoload 'helm-lisp-completion-or-file-name-at-point "helm-elisp" "\ -Complete lisp symbol or filename at point. +Preconfigured helm to complete lisp symbol or filename at point. Filename completion happen if string start after or between a double quote. \(fn)" t nil) @@ -327,7 +346,7 @@ Preconfigured `helm' to disable/enable function advices. \(fn)" t nil) (autoload 'helm-locate-library "helm-elisp" "\ - +Preconfigured helm to locate elisp libraries. \(fn)" t nil) @@ -337,29 +356,30 @@ Preconfigured `helm' for timers. \(fn)" t nil) (autoload 'helm-complex-command-history "helm-elisp" "\ - +Preconfigured helm for complex command history. \(fn)" t nil) ;;;*** ;;;### (autoloads nil "helm-elisp-package" "helm-elisp-package.el" -;;;;;; (21837 24208 0 0)) +;;;;;; (21898 47974 0 0)) ;;; Generated autoloads from helm-elisp-package.el (autoload 'helm-list-elisp-packages "helm-elisp-package" "\ - +Preconfigured helm for listing and handling emacs packages. \(fn ARG)" t nil) (autoload 'helm-list-elisp-packages-no-fetch "helm-elisp-package" "\ - +Preconfigured helm for emacs packages. +Same as `helm-list-elisp-packages' but don't fetch packages on remote. \(fn)" t nil) ;;;*** -;;;### (autoloads nil "helm-elscreen" "helm-elscreen.el" (21837 24208 +;;;### (autoloads nil "helm-elscreen" "helm-elscreen.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-elscreen.el @@ -370,7 +390,7 @@ Preconfigured helm to list elscreen. ;;;*** -;;;### (autoloads nil "helm-eshell" "helm-eshell.el" (21837 24208 +;;;### (autoloads nil "helm-eshell" "helm-eshell.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-eshell.el @@ -386,7 +406,7 @@ Preconfigured helm for eshell history. ;;;*** -;;;### (autoloads nil "helm-eval" "helm-eval.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-eval" "helm-eval.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-eval.el (autoload 'helm-eval-expression "helm-eval" "\ @@ -406,7 +426,7 @@ Preconfigured helm for `helm-source-calculation-result'. ;;;*** -;;;### (autoloads nil "helm-external" "helm-external.el" (21837 24208 +;;;### (autoloads nil "helm-external" "helm-external.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-external.el @@ -420,14 +440,15 @@ You can set your own list of commands with ;;;*** -;;;### (autoloads nil "helm-files" "helm-files.el" (21837 24208 0 +;;;### (autoloads nil "helm-files" "helm-files.el" (21898 47974 0 ;;;;;; 0)) ;;; Generated autoloads from helm-files.el (autoload 'helm-browse-project "helm-files" "\ +Preconfigured helm to browse projects. Browse files and see status of project with its vcs. Only HG and GIT are supported for now. -Fall back to `helm-find-files' or `helm-browse-project-find-files' +Fall back to `helm-browse-project-find-files' if current directory is not under control of one of those vcs. With a prefix ARG browse files recursively, with two prefix ARG rebuild the cache. @@ -436,9 +457,11 @@ If the current directory is found in the cache, start NOTE: The prefix ARG have no effect on the VCS controlled directories. Needed dependencies for VCS: - + +and + and -. +. \(fn ARG)" t nil) @@ -462,7 +485,10 @@ Run all sources defined in `helm-for-files-preferred-list'. \(fn)" t nil) (autoload 'helm-multi-files "helm-files" "\ -Same as `helm-for-files' but allow toggling from locate to others sources. +Preconfigured helm similar to `helm-for-files' but that don't run locate. +Allow toggling from locate to others sources. +This allow seeing first if what you search is in other sources before launching +locate. \(fn)" t nil) @@ -473,7 +499,7 @@ Preconfigured `helm' for `recentf'. ;;;*** -;;;### (autoloads nil "helm-font" "helm-font.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-font" "helm-font.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-font.el (autoload 'helm-select-xfont "helm-font" "\ @@ -488,7 +514,7 @@ Preconfigured helm for `ucs-names' math symbols. ;;;*** -;;;### (autoloads nil "helm-grep" "helm-grep.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-grep" "helm-grep.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-grep.el (autoload 'helm-goto-precedent-file "helm-grep" "\ @@ -501,47 +527,12 @@ Go to precedent file in helm grep/etags buffers. \(fn)" t nil) -(autoload 'helm-grep-run-save-buffer "helm-grep" "\ -Run grep save results action from `helm-do-grep-1'. - -\(fn)" t nil) - (autoload 'helm-grep-mode "helm-grep" "\ Major mode to provide actions in helm grep saved buffer. Special commands: \\{helm-grep-mode-map} -\(fn)" t nil) - -(autoload 'helm-gm-next-file "helm-grep" "\ - - -\(fn)" t nil) - -(autoload 'helm-gm-precedent-file "helm-grep" "\ - - -\(fn)" t nil) - -(autoload 'helm-grep-mode-jump "helm-grep" "\ - - -\(fn)" t nil) - -(autoload 'helm-grep-mode-jump-other-window-forward "helm-grep" "\ - - -\(fn)" t nil) - -(autoload 'helm-grep-mode-jump-other-window-backward "helm-grep" "\ - - -\(fn)" t nil) - -(autoload 'helm-grep-mode-jump-other-window "helm-grep" "\ - - \(fn)" t nil) (autoload 'helm-do-grep "helm-grep" "\ @@ -570,11 +561,11 @@ Preconfigured helm for pdfgrep. ;;;*** -;;;### (autoloads nil "helm-help" "helm-help.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-help" "helm-help.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-help.el (autoload 'helm-documentation "helm-help" "\ -Helm documentation. +Preconfigured helm for helm documentation. With a prefix arg refresh the documentation. Find here the documentation of all sources actually documented. @@ -597,22 +588,22 @@ Help command for `helm-find-files'. \(fn)" t nil) (autoload 'helm-read-file-name-help "helm-help" "\ - +Help command for `read-file-name'. \(fn)" t nil) (autoload 'helm-generic-file-help "helm-help" "\ - +Global help for helm. \(fn)" t nil) (autoload 'helm-grep-help "helm-help" "\ - +Help command for helm grep. \(fn)" t nil) (autoload 'helm-pdfgrep-help "helm-help" "\ - +Help command for pdfgrep. \(fn)" t nil) @@ -642,47 +633,47 @@ Help command for ido virtual buffers. \(fn)" t nil) (autoload 'helm-moccur-help "helm-help" "\ - +Help command for (m)occur. \(fn)" t nil) (autoload 'helm-top-help "helm-help" "\ - +Help command for top. \(fn)" t nil) (autoload 'helm-apt-help "helm-help" "\ - +Help command for helm apt. \(fn)" t nil) (autoload 'helm-el-package-help "helm-help" "\ - +Help command for emacs packages. \(fn)" t nil) (autoload 'helm-M-x-help "helm-help" "\ - +Help command for `helm-M-x'. \(fn)" t nil) (autoload 'helm-imenu-help "helm-help" "\ - +Help command for imenu. \(fn)" t nil) (autoload 'helm-color-help "helm-help" "\ - +Help command for color. \(fn)" t nil) (autoload 'helm-semantic-help "helm-help" "\ - +Help command for semantic. \(fn)" t nil) (autoload 'helm-kmacro-help "helm-help" "\ - +Help command for kmacro. \(fn)" t nil) @@ -742,7 +733,22 @@ HELM-ATTRIBUTE should be a symbol. ;;;*** -;;;### (autoloads nil "helm-imenu" "helm-imenu.el" (21837 24208 0 +;;;### (autoloads nil "helm-id-utils" "helm-id-utils.el" (21898 47974 +;;;;;; 0 0)) +;;; Generated autoloads from helm-id-utils.el + +(autoload 'helm-gid "helm-id-utils" "\ +Preconfigured helm for `gid' command line of `ID-Utils'. +Need A database created with the command `mkid' +above `default-directory'. +Need id-utils as dependency which provide `mkid', `gid' etc... +See . + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-imenu" "helm-imenu.el" (21898 47974 0 ;;;;;; 0)) ;;; Generated autoloads from helm-imenu.el @@ -751,9 +757,14 @@ Preconfigured `helm' for `imenu'. \(fn)" t nil) +(autoload 'helm-imenu-in-all-buffers "helm-imenu" "\ +Preconfigured helm for fetching imenu entries of all buffers. + +\(fn)" t nil) + ;;;*** -;;;### (autoloads nil "helm-info" "helm-info.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-info" "helm-info.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-info.el (autoload 'helm-info-at-point "helm-info" "\ @@ -764,7 +775,7 @@ With a prefix-arg insert symbol at point. ;;;*** -;;;### (autoloads nil "helm-locate" "helm-locate.el" (21837 24208 +;;;### (autoloads nil "helm-locate" "helm-locate.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-locate.el @@ -793,7 +804,7 @@ Where db_path is a filename matched by ;;;*** -;;;### (autoloads nil "helm-man" "helm-man.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-man" "helm-man.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-man.el (autoload 'helm-man-woman "helm-man" "\ @@ -804,11 +815,11 @@ With a prefix arg reinitialize the cache. ;;;*** -;;;### (autoloads nil "helm-misc" "helm-misc.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-misc" "helm-misc.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-misc.el (autoload 'helm-browse-menubar "helm-misc" "\ -Helm interface to the menubar using lacarte.el. +Preconfigured helm to the menubar using lacarte.el. \(fn)" t nil) @@ -828,12 +839,7 @@ Preconfigured `helm' to execute ratpoison commands. \(fn)" t nil) (autoload 'helm-stumpwm-commands "helm-misc" "\ - - -\(fn)" t nil) - -(autoload 'helm-mini "helm-misc" "\ -Preconfigured `helm' lightweight version (buffer -> recentf). +Preconfigured helm for stumpwm commands. \(fn)" t nil) @@ -843,13 +849,13 @@ Preconfigured `helm' for `minibuffer-history'. \(fn)" t nil) (autoload 'helm-comint-input-ring "helm-misc" "\ -Predefined `helm' that provide completion of `comint' history. +Preconfigured `helm' that provide completion of `comint' history. \(fn)" t nil) ;;;*** -;;;### (autoloads nil "helm-mode" "helm-mode.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-mode" "helm-mode.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-mode.el (autoload 'helm-comp-read "helm-mode" "\ @@ -971,7 +977,7 @@ Note: This mode is incompatible with Emacs23. ;;;*** -;;;### (autoloads nil "helm-net" "helm-net.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-net" "helm-net.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-net.el (autoload 'helm-surfraw "helm-net" "\ @@ -996,35 +1002,30 @@ Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest. ;;;*** -;;;### (autoloads nil "helm-org" "helm-org.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-org" "helm-org.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-org.el (autoload 'helm-org-agenda-files-headings "helm-org" "\ - +Preconfigured helm for org files headings. \(fn)" t nil) (autoload 'helm-org-in-buffer-headings "helm-org" "\ - +Preconfigured helm for org buffer headings. \(fn)" t nil) (autoload 'helm-org-capture-templates "helm-org" "\ - +Preconfigured helm for org templates. \(fn)" t nil) ;;;*** -;;;### (autoloads nil "helm-regexp" "helm-regexp.el" (21837 24208 +;;;### (autoloads nil "helm-regexp" "helm-regexp.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-regexp.el -(autoload 'helm-moccur-run-save-buffer "helm-regexp" "\ -Run grep save results action from `helm-do-grep-1'. - -\(fn)" t nil) - (autoload 'helm-moccur-mode "helm-regexp" "\ Major mode to provide actions in helm moccur saved buffer. @@ -1072,9 +1073,25 @@ The prefix arg can be set before calling ;;;*** -;;;### (autoloads nil "helm-ring" "helm-ring.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-ring" "helm-ring.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-ring.el +(defvar helm-push-mark-mode nil "\ +Non-nil if Helm-Push-Mark mode is enabled. +See the command `helm-push-mark-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 `helm-push-mark-mode'.") + +(custom-autoload 'helm-push-mark-mode "helm-ring" nil) + +(autoload 'helm-push-mark-mode "helm-ring" "\ +Provide an improved version of `push-mark'. +Modify the behavior of `push-mark' to update +the `global-mark-ring' after each new visit. + +\(fn &optional ARG)" t nil) + (autoload 'helm-mark-ring "helm-ring" "\ Preconfigured `helm' for `helm-source-mark-ring'. @@ -1104,7 +1121,7 @@ First call open the kill-ring browser, next calls move to next line. \(fn)" t nil) (autoload 'helm-execute-kmacro "helm-ring" "\ -Keyboard macros with helm interface. +Preconfigured helm for keyboard macros. Define your macros with `f3' and `f4'. See (info \"(emacs) Keyboard Macros\") for detailed infos. This command is useful when used with persistent action. @@ -1113,7 +1130,7 @@ This command is useful when used with persistent action. ;;;*** -;;;### (autoloads nil "helm-semantic" "helm-semantic.el" (21837 24208 +;;;### (autoloads nil "helm-semantic" "helm-semantic.el" (21898 47974 ;;;;;; 0 0)) ;;; Generated autoloads from helm-semantic.el @@ -1124,7 +1141,7 @@ If ARG is supplied, pre-select symbol at point instead of current \(fn ARG)" t nil) (autoload 'helm-semantic-or-imenu "helm-semantic" "\ -Run `helm' with `semantic' or `imenu'. +Preconfigured helm for `semantic' or `imenu'. If ARG is supplied, pre-select symbol at point instead of current semantic tag in scope. @@ -1136,7 +1153,7 @@ Fill in the symbol at point by default. ;;;*** -;;;### (autoloads nil "helm-sys" "helm-sys.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-sys" "helm-sys.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-sys.el (autoload 'helm-top "helm-sys" "\ @@ -1150,13 +1167,13 @@ Preconfigured `helm' for emacs process. \(fn)" t nil) (autoload 'helm-xrandr-set "helm-sys" "\ - +Preconfigured helm for xrandr. \(fn)" t nil) ;;;*** -;;;### (autoloads nil "helm-tags" "helm-tags.el" (21837 24208 0 0)) +;;;### (autoloads nil "helm-tags" "helm-tags.el" (21898 47974 0 0)) ;;; Generated autoloads from helm-tags.el (autoload 'helm-etags-select "helm-tags" "\ @@ -1174,7 +1191,7 @@ This function aggregates three sources of tag files: ;;;*** -;;;### (autoloads nil "helm-utils" "helm-utils.el" (21837 24208 0 +;;;### (autoloads nil "helm-utils" "helm-utils.el" (21898 47974 0 ;;;;;; 0)) ;;; Generated autoloads from helm-utils.el @@ -1210,9 +1227,9 @@ grabs the entire symbol. ;;;*** -;;;### (autoloads nil nil ("helm-aliases.el" "helm-match-plugin.el" -;;;;;; "helm-pkg.el" "helm-plugin.el" "helm-source.el") (21837 24208 -;;;;;; 503267 0)) +;;;### (autoloads nil nil ("helm-aliases.el" "helm-easymenu.el" "helm-match-plugin.el" +;;;;;; "helm-pkg.el" "helm-plugin.el" "helm-source.el") (21898 47974 +;;;;;; 974094 0)) ;;;*** diff --git a/emacs.d/elpa/helm-20150507.2215/helm-bookmark.el b/emacs.d/elpa/helm-20150623.1310/helm-bookmark.el similarity index 100% rename from emacs.d/elpa/helm-20150507.2215/helm-bookmark.el rename to emacs.d/elpa/helm-20150623.1310/helm-bookmark.el diff --git a/emacs.d/elpa/helm-20150507.2215/helm-buffers.el b/emacs.d/elpa/helm-20150623.1310/helm-buffers.el similarity index 92% rename from emacs.d/elpa/helm-20150507.2215/helm-buffers.el rename to emacs.d/elpa/helm-20150623.1310/helm-buffers.el index 6775f32..60a6505 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-buffers.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-buffers.el @@ -75,6 +75,19 @@ Only buffer names are fuzzy matched when this is enabled, "Ignore checking for `file-exists-p' on remote files." :group 'helm-buffers :type 'boolean) + +(defcustom helm-buffers-truncate-lines t + "Truncate lines in `helm-buffers-list' when non--nil." + :group 'helm-buffers + :type 'boolean) + +(defcustom helm-mini-default-sources '(helm-source-buffers-list + helm-source-recentf + helm-source-buffer-not-found) + "Default sources list used in `helm-mini'." + :group 'helm-misc + :type '(repeat (choice symbol))) + ;;; Faces ;; @@ -162,6 +175,21 @@ Only buffer names are fuzzy matched when this is enabled, (defvar helm-buffers-list-cache nil) (defvar helm-buffer-max-len-mode nil) + +(defun helm-buffers-list--init () + ;; Issue #51 Create the list before `helm-buffer' creation. + (setq helm-buffers-list-cache (funcall (helm-attr 'buffer-list))) + (let ((result (cl-loop for b in helm-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 (default-value 'helm-buffer-max-length) + (helm-set-local-variable 'helm-buffer-max-length (car result))) + (unless (default-value 'helm-buffer-max-len-mode) + (helm-set-local-variable 'helm-buffer-max-len-mode (cdr result))))) + (defclass helm-source-buffers (helm-source-sync helm-type-buffer) ((buffer-list :initarg :buffer-list @@ -169,24 +197,9 @@ Only buffer names are fuzzy matched when this is enabled, :custom function :documentation " A function with no arguments to create buffer list.") - (init :initform (lambda () - ;; Issue #51 Create the list before `helm-buffer' creation. - (setq helm-buffers-list-cache (funcall (helm-attr 'buffer-list))) - (let ((result (cl-loop for b in helm-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)))))) + (init :initform 'helm-buffers-list--init) (candidates :initform helm-buffers-list-cache) (matchplugin :initform nil) - ;(nohighlight :initform t) (match :initform 'helm-buffers-match-function) (persistent-action :initform 'helm-buffers-list-persistent-action) (resume :initform (lambda () @@ -320,9 +333,8 @@ See `ido-make-buffer-list' for more infos." (helm-buffer--show-details name name-prefix file-name size mode dir 'helm-buffer-saved-out 'helm-buffer-process nil details 'modout)) - ;; A new buffer file not already saved on disk.=>indianred2 - ((and file-name - (not (verify-visited-file-modtime buf))) + ;; A new buffer file not already saved on disk (or a deleted file) .=>indianred2 + ((and file-name (not (file-exists-p file-name))) (helm-buffer--show-details name name-prefix file-name size mode dir 'helm-buffer-not-saved 'helm-buffer-process nil details 'notsaved)) @@ -682,16 +694,20 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (defun helm-buffers-persistent-kill-1 (buffer) "Persistent action to kill buffer." - (with-current-buffer (get-buffer buffer) - (if (and (buffer-modified-p) - (buffer-file-name (current-buffer))) - (progn - (save-buffer) - (kill-buffer buffer)) - (kill-buffer buffer))) - (helm-delete-current-selection) - (with-helm-temp-hook 'helm-after-persistent-action-hook - (helm-force-update (regexp-quote (helm-get-selection nil t))))) + (if (eql (get-buffer buffer) (get-buffer helm-current-buffer)) + (progn + (message "Can't kill `helm-current-buffer' without quitting session") + (sit-for 1)) + (with-current-buffer (get-buffer buffer) + (if (and (buffer-modified-p) + (buffer-file-name (current-buffer))) + (progn + (save-buffer) + (kill-buffer buffer)) + (kill-buffer buffer))) + (helm-delete-current-selection) + (with-helm-temp-hook 'helm-after-persistent-action-hook + (helm-force-update (regexp-quote (helm-get-selection nil t)))))) (defun helm-buffers--quote-truncated-buffer (buffer) (let ((bufname (and (bufferp buffer) @@ -841,7 +857,20 @@ displayed with the `file-name-shadow' face if available." helm-source-buffer-not-found) :buffer "*helm buffers*" :keymap helm-buffer-map - :truncate-lines t)) + :truncate-lines helm-buffers-truncate-lines)) + +;;;###autoload +(defun helm-mini () + "Preconfigured `helm' lightweight version \(buffer -> recentf\)." + (interactive) + (require 'helm-files) + (unless helm-source-buffers-list + (setq helm-source-buffers-list + (helm-make-source "Buffers" 'helm-source-buffers))) + (helm :sources helm-mini-default-sources + :buffer "*helm mini*" + :ff-transformer-show-only-basename nil + :truncate-lines helm-buffers-truncate-lines)) (provide 'helm-buffers) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-color.el b/emacs.d/elpa/helm-20150623.1310/helm-color.el similarity index 80% rename from emacs.d/elpa/helm-20150507.2215/helm-color.el rename to emacs.d/elpa/helm-20150623.1310/helm-color.el index af4af76..7707c5d 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-color.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-color.el @@ -37,16 +37,15 @@ (kill-buffer "*Faces*"))) (defvar helm-source-customize-face - '((name . "Customize Face") - (init . helm-custom-faces-init) - (candidates-in-buffer) - (get-line . buffer-substring) - (action . (("Customize" - . (lambda (line) - (customize-face (intern (car (split-string line)))))) - ("Copy name" - . (lambda (line) - (kill-new (car (split-string line " " t)))))))) + (helm-build-in-buffer-source "Customize Face" + :init 'helm-custom-faces-init + :get-line 'buffer-substring + :action '(("Customize" + . (lambda (line) + (customize-face (intern (car (split-string line)))))) + ("Copy name" + . (lambda (line) + (kill-new (car (split-string line " " t))))))) "See (info \"(emacs)Faces\")") ;;; Colors browser @@ -108,19 +107,18 @@ map)) (defvar helm-source-colors - `((name . "Colors") - (init . helm-colors-init) - (candidates-in-buffer) - (get-line . buffer-substring) - (keymap . ,helm-color-map) - (persistent-help . "Kill entry in RGB format.") - (persistent-action . helm-color-kill-rgb) - (mode-line . helm-color-mode-line-string) - (action - ("Copy Name (C-c N)" . helm-color-kill-name) - ("Copy RGB (C-c R)" . helm-color-kill-rgb) - ("Insert Name (C-c n)" . helm-color-insert-name) - ("Insert RGB (C-c r)" . helm-color-insert-rgb)))) + (helm-build-in-buffer-source "Colors" + :init 'helm-colors-init + :get-line 'buffer-substring + :keymap helm-color-map + :persistent-help "Kill entry in RGB format." + :persistent-action 'helm-color-kill-rgb + :mode-line 'helm-color-mode-line-string + :action + '(("Copy Name (C-c N)" . helm-color-kill-name) + ("Copy RGB (C-c R)" . helm-color-kill-rgb) + ("Insert Name (C-c n)" . helm-color-insert-name) + ("Insert RGB (C-c r)" . helm-color-insert-rgb)))) (defun helm-colors-get-name (candidate) "Get color name." @@ -148,9 +146,8 @@ (defun helm-colors () "Preconfigured `helm' for color." (interactive) - (helm-other-buffer - '(helm-source-colors helm-source-customize-face) - "*helm colors*")) + (helm :sources '(helm-source-colors helm-source-customize-face) + :buffer "*helm colors*")) (provide 'helm-color) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-command.el b/emacs.d/elpa/helm-20150623.1310/helm-command.el similarity index 91% rename from emacs.d/elpa/helm-20150507.2215/helm-command.el rename to emacs.d/elpa/helm-20150623.1310/helm-command.el index e17d2a0..06b395b 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-command.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-command.el @@ -143,10 +143,28 @@ fuzzy matching is running its own sort function with a different algorithm." (with-helm-window (helm-display-mode-line (helm-get-current-source) 'force)))) -(defun helm-M-x-read-extended-command () +(defun helm-cmd--get-current-function-name () + (save-excursion + (beginning-of-defun) + (cadr (split-string (buffer-substring-no-properties + (point-at-bol) (point-at-eol)))))) + +(defun helm-cmd--get-preconfigured-commands (helm-directory) + (cl-loop with results + for f in (directory-files helm-directory t ".*\\.el\\'") + do (with-current-buffer (find-file-noselect f) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "Preconfigured helm" nil t) + (push (helm-cmd--get-current-function-name) results)))) + finally return results)) + +(defun helm-M-x-read-extended-command (&optional collection history) "Read command name to invoke in `helm-M-x'. Helm completion is not provided when executing or defining -kbd macros." +kbd macros. +Optional arg COLLECTION is to allow using another COLLECTION +than the default which is OBARRAY." (if (or defining-kbd-macro executing-kbd-macro) (if helm-mode (unwind-protect @@ -194,14 +212,14 @@ kbd macros." (user-error msg)) (setq current-prefix-arg nil) (helm-comp-read - "M-x " obarray + "M-x " (or collection obarray) :test 'commandp :requires-pattern helm-M-x-requires-pattern :name "Emacs Commands" :buffer "*helm M-x*" :persistent-action pers-help :persistent-help "Describe this command" - :history extended-command-history + :history (or history extended-command-history) :reverse-history helm-M-x-reverse-history :del-input nil :mode-line helm-M-x-mode-line diff --git a/emacs.d/elpa/helm-20150507.2215/helm-config.el b/emacs.d/elpa/helm-20150623.1310/helm-config.el similarity index 77% rename from emacs.d/elpa/helm-20150507.2215/helm-config.el rename to emacs.d/elpa/helm-20150623.1310/helm-config.el index 35d043c..58e29e2 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-config.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-config.el @@ -21,9 +21,11 @@ ;;; Require ;; ;; -(require 'easymenu) (require 'helm-aliases) -(require 'async-bytecomp nil t) +(declare-function async-bytecomp-package-mode "ext:async-bytecomp.el") +(when (require 'async-bytecomp nil t) + (and (fboundp 'async-bytecomp-package-mode) + (async-bytecomp-package-mode 1))) (defgroup helm-config nil @@ -81,6 +83,7 @@ (define-key map (kbd "t") 'helm-top) (define-key map (kbd "/") 'helm-find) (define-key map (kbd "i") 'helm-semantic-or-imenu) + (define-key map (kbd "I") 'helm-imenu-in-all-buffers) (define-key map (kbd "") 'helm-lisp-completion-at-point) (define-key map (kbd "p") 'helm-list-emacs-process) (define-key map (kbd "C-x r b") 'helm-filtered-bookmarks) @@ -105,6 +108,8 @@ (define-key map (kbd "C-x r i") 'helm-register) (define-key map (kbd "C-c C-x") 'helm-run-external-command) (define-key map (kbd "b") 'helm-resume) + (define-key map (kbd "M-n") 'helm-gid) + (define-key map (kbd "@") 'helm-list-elisp-packages) map)) ;; Don't override the keymap we just defined with an empty @@ -116,60 +121,8 @@ ;;; Menu -;; -;; -(easy-menu-add-item - nil '("Tools") - '("Helm" - ["Find any Files/Buffers" helm-multi-files t] - ["Helm Everywhere (Toggle)" helm-mode t] - ["Helm resume" helm-resume t] - "----" - ("Files" - ["Find files" helm-find-files t] - ["Recent Files" helm-recentf t] - ["Locate" helm-locate t] - ["Search Files with find" helm-find t] - ["Bookmarks" helm-filtered-bookmarks t]) - ("Buffers" - ["Find buffers" helm-buffers-list t]) - ("Commands" - ["Emacs Commands" helm-M-x t] - ["Externals Commands" helm-run-external-command t]) - ("Help" - ["Helm Apropos" helm-apropos t]) - ("Info" - ["Info at point" helm-info-at-point t] - ["Emacs Manual index" helm-info-emacs t] - ["Gnus Manual index" helm-info-gnus t]) - ("Org" - ["Org keywords" helm-org-keywords t] - ["Org headlines" helm-org-headlines t]) - ("Tools" - ["Occur" helm-occur t] - ["Grep" helm-do-grep t] - ["Etags" helm-etags-select t] - ["Lisp complete at point" helm-lisp-completion-at-point t] - ["Browse Kill ring" helm-show-kill-ring t] - ["Browse register" helm-register t] - ["Mark Ring" helm-all-mark-rings t] - ["Regexp handler" helm-regexp t] - ["Colors & Faces" helm-colors t] - ["Show xfonts" helm-select-xfont t] - ["Ucs Symbols" helm-ucs t] - ["Imenu" helm-imenu t] - ["Semantic or Imenu" helm-semantic-or-imenu t] - ["Google Suggest" helm-google-suggest t] - ["Eval expression" helm-eval-expression-with-eldoc t] - ["Calcul expression" helm-calcul-expression t] - ["Man pages" helm-man-woman t] - ["Top externals process" helm-top t] - ["Emacs internals process" helm-list-emacs-process t]) - "----" - ["Preferred Options" helm-configuration t]) - "Spell Checking") - -(easy-menu-add-item nil '("Tools") '("----") "Spell Checking") + +(require 'helm-easymenu) ;;;###autoload diff --git a/emacs.d/elpa/helm-20150507.2215/helm-dabbrev.el b/emacs.d/elpa/helm-20150623.1310/helm-dabbrev.el similarity index 99% rename from emacs.d/elpa/helm-20150507.2215/helm-dabbrev.el rename to emacs.d/elpa/helm-20150623.1310/helm-dabbrev.el index e30cc7e..08b525b 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-dabbrev.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-dabbrev.el @@ -257,6 +257,7 @@ but the initial search for all candidates in buffer(s)." ;;;###autoload (defun helm-dabbrev () + "Preconfigured helm for dynamic abbreviations." (interactive) (let ((dabbrev (helm-thing-before-point nil helm-dabbrev--regexp)) (limits (helm-bounds-of-thing-before-point helm-dabbrev--regexp)) diff --git a/emacs.d/elpa/helm-20150623.1310/helm-easymenu.el b/emacs.d/elpa/helm-20150623.1310/helm-easymenu.el new file mode 100644 index 0000000..23f263b --- /dev/null +++ b/emacs.d/elpa/helm-20150623.1310/helm-easymenu.el @@ -0,0 +1,89 @@ +;;; helm-easymenu.el --- Helm easymenu definitions. -*- lexical-binding: t -*- + +;; Copyright (C) 2015 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'easymenu) + +(easy-menu-add-item + nil '("Tools") + '("Helm" + ["Find any Files/Buffers" helm-multi-files t] + ["Helm Everywhere (Toggle)" helm-mode t] + ["Helm resume" helm-resume t] + "----" + ("Files" + ["Find files" helm-find-files t] + ["Recent Files" helm-recentf t] + ["Locate" helm-locate t] + ["Search Files with find" helm-find t] + ["Bookmarks" helm-filtered-bookmarks t]) + ("Buffers" + ["Find buffers" helm-buffers-list t]) + ("Commands" + ["Emacs Commands" helm-M-x t] + ["Externals Commands" helm-run-external-command t]) + ("Help" + ["Helm Apropos" helm-apropos t]) + ("Info" + ["Info at point" helm-info-at-point t] + ["Emacs Manual index" helm-info-emacs t] + ["Gnus Manual index" helm-info-gnus t]) + ("Org" + ["Org keywords" helm-org-keywords t] + ["Org headlines" helm-org-headlines t]) + ("Elpa" + ["Elisp packages" helm-list-elisp-packages t] + ["Elisp packages no fetch" helm-list-elisp-packages-no-fetch t]) + ("Tools" + ["Occur" helm-occur t] + ["Grep" helm-do-grep t] + ["Gid" helm-gid t] + ["Etags" helm-etags-select t] + ["Lisp complete at point" helm-lisp-completion-at-point t] + ["Browse Kill ring" helm-show-kill-ring t] + ["Browse register" helm-register t] + ["Mark Ring" helm-all-mark-rings t] + ["Regexp handler" helm-regexp t] + ["Colors & Faces" helm-colors t] + ["Show xfonts" helm-select-xfont t] + ["Ucs Symbols" helm-ucs t] + ["Imenu" helm-imenu t] + ["Imenu all" helm-imenu-in-all-buffers t] + ["Semantic or Imenu" helm-semantic-or-imenu t] + ["Google Suggest" helm-google-suggest t] + ["Eval expression" helm-eval-expression-with-eldoc t] + ["Calcul expression" helm-calcul-expression t] + ["Man pages" helm-man-woman t] + ["Top externals process" helm-top t] + ["Emacs internals process" helm-list-emacs-process t]) + "----" + ["Preferred Options" helm-configuration t]) + "Spell Checking") + +(easy-menu-add-item nil '("Tools") '("----") "Spell Checking") + + +(provide 'helm-easymenu) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-easymenu.el ends here diff --git a/emacs.d/elpa/helm-20150507.2215/helm-elisp-package.el b/emacs.d/elpa/helm-20150623.1310/helm-elisp-package.el similarity index 82% rename from emacs.d/elpa/helm-20150507.2215/helm-elisp-package.el rename to emacs.d/elpa/helm-20150623.1310/helm-elisp-package.el index dfb33a3..32d9514 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-elisp-package.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-elisp-package.el @@ -66,6 +66,24 @@ (package-desc-name id) (car id))))) +(defun helm-el-package-visit-homepage (candidate) + (let* ((id (get-text-property 0 'tabulated-list-id candidate)) + (pkg (if (fboundp 'package-desc-name) (package-desc-name id) + (car id))) + (desc (cadr (assoc pkg package-archive-contents))) + (extras (package-desc-extras desc)) + (url (and (listp extras) (cdr-safe (assoc :url extras))))) + (if (stringp url) + (browse-url url) + (message "Package %s has no homepage" + (propertize (symbol-name pkg) + 'face 'font-lock-keyword-face))))) + +(defun helm-el-run-visit-homepage () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-el-package-visit-homepage))) + (defun helm-el-package-install-1 (pkg-list) (cl-loop with mkd = pkg-list for p in mkd @@ -96,6 +114,11 @@ (defun helm-el-package-install (_candidate) (helm-el-package-install-1 (helm-marked-candidates))) +(defun helm-el-run-package-install () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-el-package-install))) + (defun helm-el-package-uninstall-1 (pkg-list) (cl-loop with mkd = pkg-list for p in mkd @@ -139,6 +162,11 @@ (defun helm-el-package-uninstall (_candidate) (helm-el-package-uninstall-1 (helm-marked-candidates))) +(defun helm-el-run-package-uninstall () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-el-package-uninstall))) + (defun helm-el-package-menu--find-upgrades () (cl-loop for entry in helm-el-package--tabulated-list for pkg-desc = (car entry) @@ -184,6 +212,11 @@ if (member (symbol-name (package-desc-name pkg)) pkgs) collect p))) +(defun helm-el-run-package-upgrade () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-el-package-upgrade))) + (defun helm-el-package-upgrade-all () (if helm-el-package--upgrades (with-helm-display-marked-candidates @@ -193,6 +226,11 @@ (helm-el-package-upgrade-1 helm-el-package--tabulated-list))) (message "No packages to upgrade actually!"))) +(defun helm-el-run-package-upgrade-all () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-el-package-upgrade-all))) + (defun helm-el-package-upgrade-all-action (_candidate) (helm-el-package-upgrade-all)) @@ -249,9 +287,16 @@ (defvar helm-el-package-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "M-I") 'helm-el-package-show-installed) - (define-key map (kbd "M-U") 'helm-el-package-show-upgrade) - (define-key map (kbd "M-A") 'helm-el-package-show-all) + (define-key map (kbd "M-I") 'helm-el-package-show-installed) + (define-key map (kbd "M-O") 'helm-el-package-show-uninstalled) + (define-key map (kbd "M-U") 'helm-el-package-show-upgrade) + (define-key map (kbd "M-A") 'helm-el-package-show-all) + (define-key map (kbd "C-c i") 'helm-el-run-package-install) + (define-key map (kbd "C-c r") 'helm-el-run-package-reinstall) + (define-key map (kbd "C-c d") 'helm-el-run-package-uninstall) + (define-key map (kbd "C-c u") 'helm-el-run-package-upgrade) + (define-key map (kbd "C-c U") 'helm-el-run-package-upgrade-all) + (define-key map (kbd "C-c @") 'helm-el-run-visit-homepage) (define-key map (kbd "C-c ?") 'helm-el-package-help) map)) @@ -271,16 +316,17 @@ actions))) (cond ((cdr (assq (package-desc-name pkg-desc) helm-el-package--upgrades)) - (append '(("Upgrade package" . helm-el-package-upgrade)) acts)) + (append '(("Upgrade package(s)" . helm-el-package-upgrade)) acts)) ((package-installed-p (package-desc-name pkg-desc)) - (append acts '(("Reinstall package" . helm-el-package-reinstall) - ("Uninstall" . helm-el-package-uninstall)))) - (t (append acts '(("Install" . helm-el-package-install)))))))) + (append acts '(("Reinstall package(s)" . helm-el-package-reinstall) + ("Uninstall package(s)" . helm-el-package-uninstall)))) + (t (append acts '(("Install packages(s)" . helm-el-package-install)))))))) (mode-line :initform helm-el-package-mode-line) (keymap :initform helm-el-package-map) (update :initform 'helm-el-package--update) (candidate-number-limit :initform 9999) - (action :initform '(("Describe" . helm-el-package-describe))))) + (action :initform '(("Describe package" . helm-el-package-describe) + ("Visit homepage" . helm-el-package-visit-homepage))))) (defun helm-el-package--update () (setq helm-el-package--initialized-p nil)) @@ -294,8 +340,14 @@ (package-delete pkg-desc) (package-install name)))) +(defun helm-el-run-package-reinstall () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-el-package-reinstall))) + ;;;###autoload (defun helm-list-elisp-packages (arg) + "Preconfigured helm for listing and handling emacs packages." (interactive "P") (when arg (setq helm-el-package--initialized-p nil)) (unless helm-source-list-el-package @@ -306,6 +358,8 @@ ;;;###autoload (defun helm-list-elisp-packages-no-fetch () + "Preconfigured helm for emacs packages. +Same as `helm-list-elisp-packages' but don't fetch packages on remote." (interactive) (let ((helm-el-package--initialized-p t)) (helm-list-elisp-packages nil))) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-elisp.el b/emacs.d/elpa/helm-20150623.1310/helm-elisp.el similarity index 92% rename from emacs.d/elpa/helm-20150507.2215/helm-elisp.el rename to emacs.d/elpa/helm-20150623.1310/helm-elisp.el index 7961be7..156b879 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-elisp.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-elisp.el @@ -107,6 +107,15 @@ fuzzy completion is not available in `completion-at-point'." "Face used for showing info in `helm-lisp-completion'." :group 'helm-elisp-faces) +(defcustom helm-elisp-help-function + 'helm-elisp-show-doc-modeline + "Function for displaying help for lisp symbols." + :group 'helm-elisp + :type '(choice (function :tag "Open help for the symbol." + helm-elisp-show-help) + (function :tag "Show one liner in modeline." + helm-elisp-show-doc-modeline))) + ;;; Show completion. ;; @@ -142,7 +151,8 @@ fuzzy completion is not available in `completion-at-point'." (recenter -1) (set-window-buffer (if (active-minibuffer-window) (minibuffer-selected-window) - (split-window nil upper-height)) + (split-window nil upper-height + helm-split-window-default-side)) buffer))))) (defmacro with-helm-show-completion (beg end &rest body) @@ -254,7 +264,7 @@ Return a cons \(beg . end\)." (defvar helm-lgst-len nil) ;;;###autoload (defun helm-lisp-completion-at-point () - "Helm lisp symbol completion at point." + "Preconfigured helm for lisp symbol completion at point." (interactive) (setq helm-lgst-len 0) (let* ((target (helm-thing-before-point)) @@ -284,7 +294,8 @@ Return a cons \(beg . end\)." :nomark t :fuzzy-match helm-lisp-fuzzy-completion :persistent-help "Show brief doc in mode-line" - :filtered-candidate-transformer 'helm-lisp-completion-transformer + :filtered-candidate-transformer + 'helm-lisp-completion-transformer :action `(lambda (candidate) (with-helm-current-buffer (run-with-timer @@ -299,6 +310,21 @@ Return a cons \(beg . end\)." (message "[No Match]")))) (defun helm-lisp-completion-persistent-action (candidate) + "Show documentation for the function. +Documentation is shown briefly in mode-line or completely +in other window according to the value of `helm-elisp-help-function'." + (funcall helm-elisp-help-function candidate)) + +(defun helm-elisp-show-help (candidate) + "Show full help for the function." + (let ((sym (intern-soft candidate))) + (cl-typecase sym + (fbound (describe-function sym)) + (bound (describe-variable sym)) + (face (describe-face sym))))) + +(defun helm-elisp-show-doc-modeline (candidate) + "Show brief documentation for the function in modeline." (let ((cursor-in-echo-area t) mode-line-in-non-selected-windows) (helm-show-info-in-mode-line @@ -325,13 +351,10 @@ Return a cons \(beg . end\)." (defun helm-get-first-line-documentation (sym) "Return first line documentation of symbol SYM. If SYM is not documented, return \"Not documented\"." - (let ((doc (cond ((fboundp sym) - (documentation sym t)) - ((boundp sym) - (documentation-property sym 'variable-documentation t)) - ((facep sym) - (face-documentation sym)) - (t nil)))) + (let ((doc (cl-typecase sym + (fbound (documentation sym t)) + (bound (documentation-property sym 'variable-documentation t)) + (face (face-documentation sym))))) (if (and doc (not (string= doc "")) ;; `documentation' return "\n\n(args...)" ;; for CL-style functions. @@ -345,7 +368,7 @@ If SYM is not documented, return \"Not documented\"." ;;;###autoload (defun helm-complete-file-name-at-point (&optional force) - "Complete file name at point." + "Preconfigured helm to complete file name at point." (interactive) (require 'helm-mode) (let* ((tap (thing-at-point 'filename)) @@ -356,7 +379,7 @@ If SYM is not documented, return \"Not documented\"." (end-of-line) (search-backward tap (point-at-bol) t) (setq beg (point)) - (looking-back "[^'`( ]" 1))) + (looking-back "[^'`( ]" (1- (point))))) (expand-file-name (substring-no-properties tap)))) (end (point)) @@ -383,14 +406,14 @@ If SYM is not documented, return \"Not documented\"." ;;;###autoload (defun helm-lisp-completion-or-file-name-at-point () - "Complete lisp symbol or filename at point. + "Preconfigured helm to complete lisp symbol or filename at point. Filename completion happen if string start after or between a double quote." (interactive) (let* ((tap (thing-at-point 'filename))) (if (and tap (save-excursion (end-of-line) (search-backward tap (point-at-bol) t) - (looking-back "[^'`( ]" 1))) + (looking-back "[^'`( ]" (1- (point))))) (helm-complete-file-name-at-point) (helm-lisp-completion-at-point)))) @@ -630,6 +653,7 @@ Filename completion happen if string start after or between a double quote." ;;;###autoload (defun helm-locate-library () + "Preconfigured helm to locate elisp libraries." (interactive) (helm :sources (helm-build-in-buffer-source "Elisp libraries (Scan)" :data (lambda () (helm-locate-library-scan-list)) @@ -653,53 +677,6 @@ Filename completion happen if string start after or between a double quote." (prin1-to-string val) (format "'%s" (prin1-to-string val))))))) - -;;; Type attributes -;; -;; -(let ((actions '(("Describe command" . describe-function) - ("Add command to kill ring" . helm-kill-new) - ("Go to command's definition" . find-function) - ("Debug on entry" . debug-on-entry) - ("Cancel debug on entry" . cancel-debug-on-entry) - ("Trace function" . trace-function) - ("Trace function (background)" . trace-function-background) - ("Untrace function" . untrace-function)))) - (define-helm-type-attribute 'command - `((action ("Call interactively" . helm-call-interactively) - ,@actions) - (coerce . helm-symbolify) - (persistent-action . describe-function)) - "Command. (string or symbol)") - - (define-helm-type-attribute 'function - `((action . ,actions) - (action-transformer helm-transform-function-call-interactively) - (candidate-transformer helm-mark-interactive-functions) - (coerce . helm-symbolify)) - "Function. (string or symbol)")) - -(define-helm-type-attribute 'variable - '((action - ("Describe variable" . describe-variable) - ("Add variable to kill ring" . helm-kill-new) - ("Go to variable's definition" . find-variable) - ("Set variable" . helm-set-variable)) - (coerce . helm-symbolify)) - "Variable.") - -(define-helm-type-attribute 'timer - '((action - ("Cancel Timer" . (lambda (_timer) - (let ((mkd (helm-marked-candidates))) - (cl-loop for timer in mkd - do (cancel-timer timer))))) - ("Describe Function" . (lambda (tm) (describe-function (timer--function tm)))) - ("Find Function" . (lambda (tm) (find-function (timer--function tm))))) - (persistent-action . (lambda (tm) (describe-function (timer--function tm)))) - (persistent-help . "Describe Function")) - "Timer.") - ;;; Elisp Timers. ;; @@ -817,6 +794,7 @@ Filename completion happen if string start after or between a double quote." ;;;###autoload (defun helm-complex-command-history () + "Preconfigured helm for complex command history." (interactive) (helm :sources 'helm-source-complex-command-history :buffer "*helm complex commands*")) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-elscreen.el b/emacs.d/elpa/helm-20150623.1310/helm-elscreen.el similarity index 100% rename from emacs.d/elpa/helm-20150507.2215/helm-elscreen.el rename to emacs.d/elpa/helm-20150623.1310/helm-elscreen.el diff --git a/emacs.d/elpa/helm-20150507.2215/helm-eshell.el b/emacs.d/elpa/helm-20150623.1310/helm-eshell.el similarity index 98% rename from emacs.d/elpa/helm-20150507.2215/helm-eshell.el rename to emacs.d/elpa/helm-20150623.1310/helm-eshell.el index 7b164a0..2b0deed 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-eshell.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-eshell.el @@ -178,7 +178,7 @@ The function that call this should set `helm-ec-target' to thing at point." (args (catch 'eshell-incomplete (eshell-parse-arguments beg end))) (target - (or (and (looking-back " " 1) " ") + (or (and (looking-back " " (1- (point))) " ") (buffer-substring-no-properties (save-excursion (eshell-backward-argument 1) (point)) @@ -232,7 +232,7 @@ The function that call this should set `helm-ec-target' to thing at point." :resume 'noresume :input input)) (when (and flag-empty - (looking-back " " 1)) + (looking-back " " (1- (point)))) (delete-char -1))))) (provide 'helm-eshell) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-eval.el b/emacs.d/elpa/helm-20150623.1310/helm-eval.el similarity index 74% rename from emacs.d/elpa/helm-20150507.2215/helm-eval.el rename to emacs.d/elpa/helm-20150623.1310/helm-eval.el index 183c570..175a267 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-eval.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-eval.el @@ -19,6 +19,7 @@ (require 'cl-lib) (require 'helm) (require 'eldoc) +(require 'edebug) (defgroup helm-eval nil @@ -48,9 +49,9 @@ Should take one arg: the string to display." (eldoc-fnsym-in-current-sexp . elisp--fnsym-in-current-sexp) (eldoc-get-fnsym-args-string . - elisp--get-fnsym-args-string) + elisp-get-fnsym-args-string) (eldoc-get-var-docstring . - elisp--get-var-docstring)) + elisp-get-var-docstring)) unless (fboundp f) do (defalias f a)) ;; Emacs-24. @@ -79,28 +80,27 @@ Should take one arg: the string to display." (define-key map (kbd "") 'backward-char) map)) -(defvar helm-source-evaluation-result - '((name . "Evaluation Result") - (init . (lambda () (require 'edebug))) - (dummy) - (multiline) - (mode-line . "C-RET: nl-and-indent, tab: reindent, C-tab:complete, C-p/n: next/prec-line.") - (filtered-candidate-transformer . (lambda (candidates _source) - (list - (condition-case nil - (with-helm-current-buffer - (pp-to-string - (if edebug-active - (edebug-eval-expression - (read helm-pattern)) +(defun helm-build-evaluation-result-source () + (helm-build-dummy-source "Evaluation Result" + :multiline t + :mode-line "C-RET: nl-and-indent, M-tab: reindent, C-tab:complete, C-p/n: next/prec-line." + :filtered-candidate-transformer (lambda (_candidates _source) + (list + (condition-case nil + (with-helm-current-buffer + (pp-to-string + (if edebug-active + (edebug-eval-expression + (read helm-pattern)) (eval (read helm-pattern))))) - (error "Error"))))) - (action . (("Copy result to kill-ring" . (lambda (candidate) - (kill-new - (replace-regexp-in-string - "\n" "" candidate)))) - ("copy sexp to kill-ring" . (lambda (candidate) - (kill-new helm-input))))))) + (error "Error")))) + :nohighlight t + :action '(("Copy result to kill-ring" . (lambda (candidate) + (kill-new + (replace-regexp-in-string + "\n" "" candidate)))) + ("copy sexp to kill-ring" . (lambda (_candidate) + (kill-new helm-input)))))) (defun helm-eval-new-line-and-indent () (interactive) @@ -118,7 +118,7 @@ Should take one arg: the string to display." (when (member buf helm-eldoc-active-minibuffers-list) (with-current-buffer buf (let* ((sym (save-excursion - (unless (looking-back ")\\|\"" 1) + (unless (looking-back ")\\|\"" (1- (point))) (forward-char -1)) (eldoc-current-symbol))) (info-fn (eldoc-fnsym-in-current-sexp)) @@ -141,22 +141,23 @@ Should take one arg: the string to display." ;; ;; (defvar helm-source-calculation-result - '((name . "Calculation Result") - (dummy) - (filtered-candidate-transformer . (lambda (candidates _source) - (list - (condition-case nil - (calc-eval helm-pattern) - (error "error"))))) - (action ("Copy result to kill-ring" . kill-new)))) + (helm-build-dummy-source "Calculation Result" + :filtered-candidate-transformer (lambda (_candidates _source) + (list + (condition-case nil + (calc-eval helm-pattern) + (error "error")))) + :nohighlight t + :action '(("Copy result to kill-ring" . kill-new)))) ;;;###autoload (defun helm-eval-expression (arg) "Preconfigured helm for `helm-source-evaluation-result'." (interactive "P") - (helm :sources 'helm-source-evaluation-result + (helm :sources (helm-build-evaluation-result-source) :input (when arg (thing-at-point 'sexp)) :buffer "*helm eval*" + :echo-input-in-header-line nil :history 'read-expression-history :keymap helm-eval-expression-map)) @@ -180,7 +181,8 @@ Should take one arg: the string to display." (defun helm-calcul-expression () "Preconfigured helm for `helm-source-calculation-result'." (interactive) - (helm-other-buffer 'helm-source-calculation-result "*helm calcul*")) + (helm :sources 'helm-source-calculation-result + :buffer "*helm calcul*")) (provide 'helm-eval) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-external.el b/emacs.d/elpa/helm-20150623.1310/helm-external.el similarity index 100% rename from emacs.d/elpa/helm-20150507.2215/helm-external.el rename to emacs.d/elpa/helm-20150623.1310/helm-external.el diff --git a/emacs.d/elpa/helm-20150507.2215/helm-files.el b/emacs.d/elpa/helm-20150623.1310/helm-files.el similarity index 92% rename from emacs.d/elpa/helm-20150507.2215/helm-files.el rename to emacs.d/elpa/helm-20150623.1310/helm-files.el index d14f562..234b766 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-files.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-files.el @@ -44,8 +44,11 @@ (declare-function eshell-send-input "esh-mode" (&optional use-region queue-p no-newline)) (declare-function eshell-kill-input "esh-mode") (declare-function eshell-bol "esh-mode") +(declare-function eshell-quote-argument "esh-arg.el") (declare-function helm-ls-git-ls "ext:helm-ls-git") (declare-function helm-hg-find-files-in-project "ext:helm-ls-hg") +(declare-function helm-gid "helm-id-utils.el") +(declare-function helm-ls-svn-ls "ext:helm-ls-svn") (defvar recentf-list) @@ -308,6 +311,7 @@ I.e use the -path/ipath arguments of find instead of -name/iname." (define-key map (kbd "M-g s") 'helm-ff-run-grep) (define-key map (kbd "M-g p") 'helm-ff-run-pdfgrep) (define-key map (kbd "M-g z") 'helm-ff-run-zgrep) + (define-key map (kbd "C-c g") 'helm-ff-run-gid) (define-key map (kbd "M-.") 'helm-ff-run-etags) (define-key map (kbd "M-R") 'helm-ff-run-rename-file) (define-key map (kbd "M-C") 'helm-ff-run-copy-file) @@ -465,6 +469,7 @@ Should not be used among other sources.") "Open file externally `C-c C-x, C-u to choose'" 'helm-open-file-externally "Grep File(s) `C-s, C-u Recurse'" 'helm-find-files-grep "Zgrep File(s) `M-g z, C-u Recurse'" 'helm-ff-zgrep + "Gid" 'helm-ff-gid "Switch to Eshell `M-e'" 'helm-ff-switch-to-eshell "Etags `M-., C-u reload tag file'" 'helm-ff-etags-select "Eshell command on file(s) `M-!, C-u take all marked as arguments.'" @@ -524,6 +529,8 @@ for current buffer." (save-selected-window (other-window 1) default-directory) + ;; Using the car of *ff-history allow + ;; allow staying in the directory visited instead of current. (or (car-safe helm-ff-history) default-directory)))))) (defun helm-find-files-do-action (action) @@ -554,8 +561,9 @@ ACTION must be an action supported by `helm-dired-action'." (with-helm-current-buffer (helm-read-file-name prompt - :preselect (if helm-ff-transformer-show-only-basename - (helm-basename cand) cand) + :preselect (unless (cdr ifiles) + (if helm-ff-transformer-show-only-basename + (helm-basename cand) cand)) :initial-input (helm-dwim-target-directory) :history (helm-find-files-history :comp-read nil)))))) (helm-dired-action @@ -689,7 +697,7 @@ will not be loaded first time you use this." (when (or eshell-command-aliases-list (y-or-n-p "Eshell is not loaded, run eshell-command without alias anyway? ")) (and eshell-command-aliases-list (eshell-read-aliases-list)) - (let* ((cand-list (helm-marked-candidates :with-wildcard t)) + (let* ((cand-list (helm-marked-candidates)) (default-directory (or helm-ff-default-directory ;; If candidate is an url *-ff-default-directory is nil ;; so keep value of default-directory. @@ -697,9 +705,9 @@ will not be loaded first time you use this." (command (helm-comp-read "Command: " (cl-loop for (a . c) in eshell-command-aliases-list - when (string-match "\\(\\$1\\|\\$\\*\\)$" (car c)) - collect (propertize a 'help-echo (car c)) into ls - finally return (sort ls 'string<)) + when (string-match "\\(\\$1\\|\\$\\*\\)$" (car c)) + collect (propertize a 'help-echo (car c)) into ls + finally return (sort ls 'string<)) :buffer "*helm eshell on file*" :name "Eshell command" :keymap helm-esh-on-file-map @@ -708,15 +716,16 @@ will not be loaded first time you use this." "C-c ?: Help, \\[universal-argument]: Insert output at point") :input-history 'helm-eshell-command-on-file-input-history)) - (alias-value (car (assoc-default command eshell-command-aliases-list)))) + (alias-value (car (assoc-default command eshell-command-aliases-list))) + cmd-line) (if (or (equal helm-current-prefix-arg '(16)) (equal map '(16))) ;; Two time C-u from `helm-comp-read' mean print to current-buffer. ;; i.e `eshell-command' will use this value. (setq current-prefix-arg '(16)) - ;; Else reset the value of `current-prefix-arg' - ;; to avoid printing in current-buffer. - (setq current-prefix-arg nil)) + ;; Else reset the value of `current-prefix-arg' + ;; to avoid printing in current-buffer. + (setq current-prefix-arg nil)) (if (and (or ;; One prefix-arg have been passed before `helm-comp-read'. ;; If map have been set with C-u C-u (value == '(16)) @@ -734,27 +743,30 @@ will not be loaded first time you use this." ;; Run eshell-command with ALL marked files as arguments. ;; This wont work on remote files, because tramp handlers depends ;; on `default-directory' (limitation). - (let ((mapfiles (mapconcat 'shell-quote-argument cand-list " "))) + (let ((mapfiles (mapconcat 'eshell-quote-argument cand-list " "))) (if (string-match "'%s'\\|\"%s\"\\|%s" command) - (eshell-command (format command mapfiles)) ; See [1] - (eshell-command (format "%s %s" command mapfiles)))) - - ;; Run eshell-command on EACH marked files. - ;; To work with tramp handler we have to call - ;; COMMAND on basename of each file, using - ;; its basedir as `default-directory'. - (cl-loop for f in cand-list - for dir = (and (not (string-match ffap-url-regexp f)) - (helm-basedir f)) - for file = (format "'%s'" (if (and dir (file-remote-p dir)) - (helm-basename f) f)) - for com = (if (string-match "'%s'\\|\"%s\"\\|%s" command) - ;; [1] This allow to enter other args AFTER filename - ;; i.e - (format command file) - (format "%s %s" command file)) - do (let ((default-directory (or dir default-directory))) - (eshell-command com))))))) + (setq cmd-line (format command mapfiles)) ; See [1] + (setq cmd-line (format "%s %s" command mapfiles))) + (helm-log "%S" cmd-line) + (eshell-command cmd-line)) + + ;; Run eshell-command on EACH marked files. + ;; To work with tramp handler we have to call + ;; COMMAND on basename of each file, using + ;; its basedir as `default-directory'. + (cl-loop for f in cand-list + for dir = (and (not (string-match ffap-url-regexp f)) + (helm-basedir f)) + for file = (eshell-quote-argument + (format "%s" (if (and dir (file-remote-p dir)) + (helm-basename f) f))) + for com = (if (string-match "'%s'\\|\"%s\"\\|%s" command) + ;; [1] This allow to enter other args AFTER filename + ;; i.e + (format command file) + (format "%s %s" command file)) + do (let ((default-directory (or dir default-directory))) + (eshell-command com))))))) (defun helm-find-files-eshell-command-on-file (_candidate) "Run `eshell-command' on CANDIDATE or marked candidates. @@ -1223,19 +1235,19 @@ The checksum is copied to kill-ring." (message "Checksum copied to kill-ring."))) (defun helm-ff-toggle-basename (_candidate) - (setq helm-ff-transformer-show-only-basename - (not helm-ff-transformer-show-only-basename)) - (let* ((cand (helm-get-selection nil t)) - (target (if helm-ff-transformer-show-only-basename - (helm-basename cand) cand))) - (helm-force-update (regexp-quote target)))) + (with-helm-buffer + (setq helm-ff-transformer-show-only-basename + (not helm-ff-transformer-show-only-basename)) + (let* ((cand (helm-get-selection nil t)) + (target (if helm-ff-transformer-show-only-basename + (helm-basename cand) cand))) + (helm-force-update (regexp-quote target))))) (defun helm-ff-run-toggle-basename () (interactive) (with-helm-alive-p (unless (helm-empty-source-p) - (helm-attrset 'toggle-basename '(helm-ff-toggle-basename . never-split)) - (helm-execute-persistent-action 'toggle-basename)))) + (helm-ff-toggle-basename nil)))) (cl-defun helm-reduce-file-name (fname level &key unix-close expand) "Reduce FNAME by LEVEL from end or beginning depending LEVEL value. @@ -1265,7 +1277,8 @@ If EXPAND is non--nil expand-file-name." ;; Internal (defvar helm--file-completion-sources - '("Find Files" "Read File Name" "Read File Name History") + '("Find Files" "Read File Name" "Read File Name History" + "Files from Current Directory") "Sources that use the *find-files mechanism can be added here. Sources generated by `helm-mode' don't need to be added here, it will be done automatically. @@ -1365,7 +1378,8 @@ or when `helm-pattern' is equal to \"~/\"." (helm-create-tramp-name helm-pattern) helm-pattern)) (completed-p (string= (file-name-as-directory - (expand-file-name pat)) + (expand-file-name + (substitute-in-file-name pat))) helm-ff-default-directory)) (candnum (helm-get-candidate-number))) (when (and (or @@ -1409,7 +1423,7 @@ or when `helm-pattern' is equal to \"~/\"." "Allow expanding to home/user directory or root or text yanked after pattern." (when (and (helm-file-completion-source-p) (string-match - "/\\$.*/\\|/\\./\\|/\\.\\./\\|/~.*/\\|//\\|\\(/[[:alpha:]]:/\\|\\s\\+\\)" + "/?\\$.*/\\|/\\./\\|/\\.\\./\\|/~.*/\\|//\\|\\(/[[:alpha:]]:/\\|\\s\\+\\)" helm-pattern) (with-current-buffer (window-buffer (minibuffer-window)) (eolp)) (not (string-match helm-ff-url-regexp helm-pattern))) @@ -1515,15 +1529,15 @@ purpose." ;; In some rare cases tramp can return a nil input, ;; so be sure pattern is a string for safety (Issue #476). (unless pattern (setq pattern "")) - (cond ((string-match "\\`\\$" pattern) + (cond ((string-match helm-ff-url-regexp pattern) pattern) + ((string-match "\\`\\$" pattern) (substitute-in-file-name pattern)) ((string= pattern "") "") ((string-match "\\`[.]\\{1,2\\}/\\'" pattern) (expand-file-name pattern)) ((string-match ".*\\(~?/?[.]\\{1\\}/\\)\\'" pattern) (expand-file-name default-directory)) - ((and (string-match ".*\\(~//\\|//\\)\\'" pattern) - (not (string-match helm-ff-url-regexp helm-pattern))) + ((string-match ".*\\(~//\\|//\\)\\'" pattern) (expand-file-name "/")) ; Expand to "/" or "c:/" ((string-match "\\`\\(~/\\|.*/~/\\)\\'" pattern) (expand-file-name "~/")) @@ -1643,8 +1657,9 @@ purpose." (and ffap-url-regexp (string-match ffap-url-regexp path))) (list path)) ((string= path "") (helm-ff-directory-files "/" t)) + ;; Check here if directory is accessible (not working on Windows). ((and (file-directory-p path) (not (file-readable-p path))) - (list (format "Opening directory: access denied, `%s'" path))) + (list (format "file-error: Opening directory permission denied `%s'" path))) ;; A fast expansion of PATH is made only if `helm-ff-auto-update-flag' ;; is enabled. ((and dir-p helm-ff-auto-update-flag) @@ -1657,7 +1672,7 @@ purpose." (list path)) (helm-ff-directory-files basedir t)))))) -(defsubst helm-ff-directory-files (directory &optional full) +(defun helm-ff-directory-files (directory &optional full) "List contents of DIRECTORY. Argument FULL mean absolute path. It is same as `directory-files' but always returns the @@ -1665,11 +1680,25 @@ dotted filename '.' and '..' even on root directories in Windows systems." (setq directory (file-name-as-directory (expand-file-name directory))) - (let ((ls (directory-files - directory full directory-files-no-dot-files-regexp)) + (let* (file-error + (ls (condition-case err + (directory-files + directory full directory-files-no-dot-files-regexp) + ;; Handle file-error from here for Windows + ;; because predicates like `file-readable-p' and friends + ;; seem broken on emacs for Windows systems (always returns t). + ;; This should never be called on GNU/Linux/Unix + ;; as the error is properly intercepted in + ;; `helm-find-files-get-candidates' by `file-readable-p'. + (file-error + (prog1 + (list (format "%s:%s" + (car err) + (mapconcat 'identity (cdr err) " "))) + (setq file-error t))))) (dot (concat directory ".")) (dot2 (concat directory ".."))) - (append (list dot dot2) ls))) + (append (and (not file-error) (list dot dot2)) ls))) (defun helm-ff-handle-backslash (fname) ;; Allow creation of filenames containing a backslash. @@ -1977,7 +2006,7 @@ Return candidates prefixed with basename of `helm-input' first." (attr (file-attributes file)) (type (car attr))) - (cond ((string-match "access denied" file) file) + (cond ((string-match "file-error" file) file) ( ;; A not already saved file. (and (stringp type) (not (helm-ff-valid-symlink-p file)) @@ -2020,16 +2049,18 @@ Return candidates prefixed with basename of `helm-input' first." "Action transformer for `helm-source-find-files'." (let ((str-at-point (with-helm-current-buffer (buffer-substring-no-properties - (point-at-bol) (point-at-eol))))) + (point-at-bol) (point-at-eol)))) + (fname-at-point (with-helm-current-buffer (ffap-guesser)))) (cond ((with-helm-current-buffer (eq major-mode 'message-mode)) (append actions '(("Gnus attach file(s)" . helm-ff-gnus-attach-files)))) ((save-match-data (and (not (string-match-p ffap-url-regexp str-at-point)) - (string-match "\\(.*\\):\\([0-9]+\\)\\'" str-at-point) + (string-match (concat "\\(" fname-at-point "\\):\\([0-9]+:?\\)") + str-at-point) (file-equal-p (match-string 1 str-at-point) candidate))) - (append '(("Find file to line number" . helm-ff-goto-line)) + (append '(("Find file to line number" . helm-ff-goto-linum)) actions)) ((string-match (image-file-name-regexp) candidate) (append actions @@ -2051,15 +2082,17 @@ Return candidates prefixed with basename of `helm-input' first." '(("Pdfgrep File(s)" . helm-ff-pdfgrep)))) (t actions)))) -(defun helm-ff-goto-line (candidate) +(defun helm-ff-goto-linum (candidate) "Find file CANDIDATE and maybe jump to line number found in fname at point. line number should be added at end of fname preceded with \":\". e.g \"foo:12\"." (let ((linum (let ((str (with-helm-current-buffer (buffer-substring-no-properties - (point-at-bol) (point-at-eol))))) - (when (string-match ":\\([0-9]+\\)\\'" str) - (match-string 1 str))))) + (point-at-bol) (point-at-eol)))) + (fname (with-helm-current-buffer (ffap-guesser)))) + (when (string-match + (concat "\\(" fname "\\):\\([0-9]+:?\\)") str) + (match-string 2 str))))) (find-file candidate) (and linum (not (string= linum "")) (helm-goto-line (string-to-number linum) t)))) @@ -2278,6 +2311,8 @@ Use it for non--interactive calls of `helm-find-files'." :input fname :case-fold-search helm-file-name-case-fold-search :preselect preselect + :ff-transformer-show-only-basename + helm-ff-transformer-show-only-basename :default def :prompt "Find Files or Url: " :buffer "*Helm Find Files*"))) @@ -2378,7 +2413,7 @@ Find inside `require' and `declare-function' sexp." ;;; Handle copy, rename, symlink, relsymlink and hardlink from helm. ;; ;; -(defvar dired-async-be-async) +(defvar dired-async-mode) (cl-defun helm-dired-action (candidate &key action follow (files (dired-get-marked-files))) "Execute ACTION on FILES to CANDIDATE. @@ -2401,21 +2436,23 @@ copy and rename." (dirflag (and (= (length files) 1) (file-directory-p (car files)) (not (file-directory-p candidate)))) - ;; When FOLLOW is enabled, disable helm-async. - ;; If it is globally disabled use this nil value. - (dired-async-be-async (and (boundp 'dired-async-be-async) - dired-async-be-async - (not follow)))) - (dired-create-files - fn (symbol-name action) files - ;; CANDIDATE is the destination. - (if (file-directory-p candidate) - ;; When CANDIDATE is a directory, build file-name in this directory. - ;; Else we use CANDIDATE. - #'(lambda (from) - (expand-file-name (file-name-nondirectory from) candidate)) - #'(lambda (_from) candidate)) - marker) + (dired-async-state (if (and (boundp 'dired-async-mode) + dired-async-mode) + 1 -1))) + (and follow (fboundp 'dired-async-mode) (dired-async-mode -1)) + (unwind-protect + (dired-create-files + fn (symbol-name action) files + ;; CANDIDATE is the destination. + (if (file-directory-p candidate) + ;; When CANDIDATE is a directory, build file-name in this directory. + ;; Else we use CANDIDATE. + #'(lambda (from) + (expand-file-name (file-name-nondirectory from) candidate)) + #'(lambda (_from) candidate)) + marker) + (and (fboundp 'dired-async-mode) + (dired-async-mode dired-async-state))) (push (file-name-as-directory (if (file-directory-p candidate) (expand-file-name candidate) @@ -2887,9 +2924,10 @@ Set `recentf-max-saved-items' to a bigger value if default is too small.") ;;;###autoload (defun helm-browse-project (arg) - "Browse files and see status of project with its vcs. + "Preconfigured helm to browse projects. +Browse files and see status of project with its vcs. Only HG and GIT are supported for now. -Fall back to `helm-find-files' or `helm-browse-project-find-files' +Fall back to `helm-browse-project-find-files' if current directory is not under control of one of those vcs. With a prefix ARG browse files recursively, with two prefix ARG rebuild the cache. @@ -2898,9 +2936,11 @@ If the current directory is found in the cache, start NOTE: The prefix ARG have no effect on the VCS controlled directories. Needed dependencies for VCS: - + +and + and -." +." (interactive "P") (cond ((and (require 'helm-ls-git nil t) (fboundp 'helm-ls-git-root-dir) @@ -2910,11 +2950,24 @@ and (fboundp 'helm-hg-root) (helm-hg-root)) (helm-hg-find-files-in-project)) - (t (let ((cur-dir (helm-current-directory))) - (if (or arg (gethash cur-dir helm--browse-project-cache)) + ((and (require 'helm-ls-svn nil t) + (fboundp 'helm-ls-svn-root-dir) + (helm-ls-svn-root-dir)) + (helm-ls-svn-ls)) + (t (let ((cur-dir (helm-browse-project-get--root-dir + (helm-current-directory)))) + (if (or arg (gethash cur-dir helm--browse-project-cache)) (helm-browse-project-find-files cur-dir (equal arg '(16))) - (helm :sources (helm-browse-project-build-buffers-source cur-dir) - :buffer "*helm browse project*")))))) + (helm :sources (helm-browse-project-build-buffers-source cur-dir) + :buffer "*helm browse project*")))))) + +(defun helm-browse-project-get--root-dir (directory) + (cl-loop with dname = (file-name-as-directory directory) + while (and dname (not (gethash dname helm--browse-project-cache))) + if (file-remote-p dname) + do (setq dname nil) else + do (setq dname (helm-basedir (substring dname 0 (1- (length dname))))) + finally return (or dname (file-name-as-directory directory)))) (defun helm-ff-browse-project (_candidate) "Browse project in current directory. @@ -2927,6 +2980,15 @@ See `helm-browse-project'." (with-helm-alive-p (helm-quit-and-execute-action 'helm-ff-browse-project))) +(defun helm-ff-gid (_candidate) + (with-helm-default-directory helm-ff-default-directory + (helm-gid))) + +(defun helm-ff-run-gid () + (interactive) + (with-helm-alive-p + (helm-quit-and-execute-action 'helm-ff-gid))) + ;;; session.el files ;; ;; session (http://emacs-session.sourceforge.net/) is an alternative to @@ -2958,7 +3020,8 @@ Colorize only symlinks, directories and files." (string-match ffap-url-regexp i))) (not (string-match helm-ff-url-regexp i))) (helm-basename i) i) - for type = (car (file-attributes i)) + for type = (and (null helm-ff-tramp-not-fancy) + (car (file-attributes i))) collect (cond ((and helm-ff-tramp-not-fancy (string-match helm-tramp-file-name-regexp i)) @@ -3075,72 +3138,84 @@ utility mdfind.") :requires-pattern 3)) (defun helm-findutils-transformer (candidates _source) - (cl-loop for i in candidates - for type = (car (file-attributes i)) - for abs = (expand-file-name i (helm-default-directory)) - for disp = (if (and helm-ff-transformer-show-only-basename - (not (string-match "[.]\\{1,2\\}$" i))) - (helm-basename i) abs) - collect (cond ((eq t type) - (cons (propertize disp 'face 'helm-ff-directory) abs)) - ((stringp type) - (cons (propertize disp 'face 'helm-ff-symlink) abs)) - (t (cons (propertize disp 'face 'helm-ff-file) abs))))) + (let (non-essential + (default-directory (helm-default-directory))) + (cl-loop for i in candidates + for abs = (expand-file-name + (helm-aif (file-remote-p default-directory) + (concat it i) i)) + for type = (car (file-attributes abs)) + for disp = (if (and helm-ff-transformer-show-only-basename + (not (string-match "[.]\\{1,2\\}$" i))) + (helm-basename abs) abs) + collect (cond ((eq t type) + (cons (propertize disp 'face 'helm-ff-directory) + abs)) + ((stringp type) + (cons (propertize disp 'face 'helm-ff-symlink) + abs)) + (t (cons (propertize disp 'face 'helm-ff-file) + abs)))))) + +(defun helm-find--build-cmd-line () + (require 'find-cmd) + (let* ((default-directory (or (file-remote-p default-directory 'localname) + default-directory)) + (patterns+options (split-string helm-pattern "\\(\\`\\| +\\)\\* +")) + (fold-case (helm-set-case-fold-search (car patterns+options))) + (patterns (split-string (car patterns+options))) + (additional-options (and (cdr patterns+options) + (list (concat (cadr patterns+options) " ")))) + (ignored-dirs ()) + (ignored-files (when helm-findutils-skip-boring-files + (cl-loop for f in completion-ignored-extensions + if (string-match "/$" f) + do (push (replace-match "" nil t f) + ignored-dirs) + else collect (concat "*" f)))) + (path-or-name (if helm-findutils-search-full-path + '(ipath path) '(iname name))) + (name-or-iname (if fold-case + (car path-or-name) (cadr path-or-name)))) + (find-cmd (and ignored-dirs + `(prune (name ,@ignored-dirs))) + (and ignored-files + `(not (name ,@ignored-files))) + `(and ,@(mapcar + (lambda (pattern) + `(,name-or-iname ,(concat "*" pattern "*"))) + patterns) + ,@additional-options)))) (defun helm-find-shell-command-fn () "Asynchronously fetch candidates for `helm-find'. -Additional find options can be sepcified after a \"*\" +Additional find options can be specified after a \"*\" separator." - (require 'find-cmd) - (with-helm-default-directory (helm-default-directory) - (let* (process-connection-type - (patterns+options (split-string helm-pattern "\\(\\`\\| +\\)\\* +")) - (fold-case (helm-set-case-fold-search (car patterns+options))) - (patterns (split-string (car patterns+options))) - (additional-options (and (cdr patterns+options) - (list (concat (cadr patterns+options) " ")))) - (ignored-dirs ()) - (ignored-files (when helm-findutils-skip-boring-files - (cl-loop for f in completion-ignored-extensions - if (string-match "/$" f) - do (push (replace-match "" nil t f) - ignored-dirs) - else collect (concat "*" f)))) - (path-or-name (if helm-findutils-search-full-path - '(ipath path) '(iname name))) - (name-or-iname (if fold-case - (car path-or-name) (cadr path-or-name))) - (cmd (find-cmd (and ignored-dirs - `(prune (name ,@ignored-dirs))) - (and ignored-files - `(not (name ,@ignored-files))) - `(and ,@(mapcar - (lambda (pattern) - `(,name-or-iname ,(concat "*" pattern "*"))) - patterns) - ,@additional-options))) - (proc (start-file-process-shell-command "hfind" helm-buffer cmd))) - (helm-log "Find command:\n%s" cmd) - (prog1 proc - (set-process-sentinel - proc - #'(lambda (process event) - (helm-process-deferred-sentinel-hook - process event (helm-default-directory)) - (if (string= event "finished\n") - (with-helm-window - (setq mode-line-format - '(" " mode-line-buffer-identification " " - (:eval (format "L%s" (helm-candidate-number-at-point))) " " - (:eval (propertize - (format "[Find process finished - (%s results)]" - (max (1- (count-lines - (point-min) (point-max))) - 0)) - 'face 'helm-locate-finish)))) - (force-mode-line-update)) - (helm-log "Error: Find %s" - (replace-regexp-in-string "\n" "" event))))))))) + (let* (process-connection-type + non-essential + (cmd (helm-find--build-cmd-line)) + (proc (start-file-process-shell-command "hfind" helm-buffer cmd))) + (helm-log "Find command:\n%s" cmd) + (prog1 proc + (set-process-sentinel + proc + #'(lambda (process event) + (helm-process-deferred-sentinel-hook + process event (helm-default-directory)) + (if (string= event "finished\n") + (with-helm-window + (setq mode-line-format + '(" " mode-line-buffer-identification " " + (:eval (format "L%s" (helm-candidate-number-at-point))) " " + (:eval (propertize + (format "[Find process finished - (%s results)]" + (max (1- (count-lines + (point-min) (point-max))) + 0)) + 'face 'helm-locate-finish)))) + (force-mode-line-update)) + (helm-log "Error: Find %s" + (replace-regexp-in-string "\n" "" event)))))))) (defun helm-find-1 (dir) (let ((default-directory (file-name-as-directory dir))) @@ -3211,19 +3286,22 @@ Run all sources defined in `helm-for-files-preferred-list'." (unless helm-source-buffers-list (setq helm-source-buffers-list (helm-make-source "Buffers" 'helm-source-buffers))) - (let ((helm-ff-transformer-show-only-basename nil)) - (helm :sources helm-for-files-preferred-list :buffer "*helm for files*"))) + (helm :sources helm-for-files-preferred-list + :ff-transformer-show-only-basename nil + :buffer "*helm for files*")) ;;;###autoload (defun helm-multi-files () - "Same as `helm-for-files' but allow toggling from locate to others sources." + "Preconfigured helm similar to `helm-for-files' but that don't run locate. +Allow toggling from locate to others sources. +This allow seeing first if what you search is in other sources before launching +locate." (interactive) (unless helm-source-buffers-list (setq helm-source-buffers-list (helm-make-source "Buffers" 'helm-source-buffers))) (setq helm-multi-files--toggle-locate nil) (let ((sources (remove 'helm-source-locate helm-for-files-preferred-list)) - (helm-ff-transformer-show-only-basename nil) (old-key (lookup-key helm-map (read-kbd-macro helm-multi-files-toggle-locate-binding)))) @@ -3232,6 +3310,7 @@ Run all sources defined in `helm-for-files-preferred-list'." 'helm-multi-files-toggle-to-locate)) (unwind-protect (helm :sources sources + :ff-transformer-show-only-basename nil :buffer "*helm multi files*") (define-key helm-map (kbd helm-multi-files-toggle-locate-binding) old-key)))) @@ -3240,8 +3319,9 @@ Run all sources defined in `helm-for-files-preferred-list'." (defun helm-recentf () "Preconfigured `helm' for `recentf'." (interactive) - (let ((helm-ff-transformer-show-only-basename nil)) - (helm-other-buffer 'helm-source-recentf "*helm recentf*"))) + (helm :sources 'helm-source-recentf + :ff-transformer-show-only-basename nil + :buffer "*helm recentf*")) (provide 'helm-files) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-font.el b/emacs.d/elpa/helm-20150623.1310/helm-font.el similarity index 100% rename from emacs.d/elpa/helm-20150507.2215/helm-font.el rename to emacs.d/elpa/helm-20150623.1310/helm-font.el diff --git a/emacs.d/elpa/helm-20150507.2215/helm-grep.el b/emacs.d/elpa/helm-20150623.1310/helm-grep.el similarity index 96% rename from emacs.d/elpa/helm-20150507.2215/helm-grep.el rename to emacs.d/elpa/helm-20150623.1310/helm-grep.el index 0bf2264..f1ab097 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-grep.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-grep.el @@ -390,7 +390,7 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") (defun helm-grep-init (cmd-line) "Start an asynchronous grep process with CMD-LINE using ZGREP if non--nil." - (let* ((default-directory (or (expand-file-name helm-ff-default-directory) + (let* ((default-directory (or helm-ff-default-directory (helm-default-directory))) (zgrep (string-match "\\`zgrep" cmd-line)) ;; Use pipe only with grep, zgrep or git-grep. @@ -583,21 +583,23 @@ If N is positive go forward otherwise go backward." (defun helm-goto-precedent-file () "Go to precedent file in helm grep/etags buffers." (interactive) - (let ((etagp (when (string= (assoc-default - 'name (helm-get-current-source)) "Etags") - 'etags))) - (with-helm-window - (helm-goto-next-or-prec-file -1 etagp)))) + (with-helm-alive-p + (let ((etagp (when (string= (assoc-default + 'name (helm-get-current-source)) "Etags") + 'etags))) + (with-helm-window + (helm-goto-next-or-prec-file -1 etagp))))) ;;;###autoload (defun helm-goto-next-file () "Go to precedent file in helm grep/etags buffers." (interactive) - (let ((etagp (when (string= (assoc-default - 'name (helm-get-current-source)) "Etags") - 'etags))) - (with-helm-window - (helm-goto-next-or-prec-file 1 etagp)))) + (with-helm-alive-p + (let ((etagp (when (string= (assoc-default + 'name (helm-get-current-source)) "Etags") + 'etags))) + (with-helm-window + (helm-goto-next-or-prec-file 1 etagp))))) (defun helm-grep-run-default-action () "Run grep default action from `helm-do-grep-1'." @@ -617,7 +619,6 @@ If N is positive go forward otherwise go backward." (with-helm-alive-p (helm-quit-and-execute-action 'helm-grep-other-frame))) -;;;###autoload (defun helm-grep-run-save-buffer () "Run grep save results action from `helm-do-grep-1'." (interactive) @@ -697,17 +698,14 @@ Special commands: "\n")))) (message "Reverting buffer done")))))) -;;;###autoload (defun helm-gm-next-file () (interactive) (helm-goto-next-or-prec-file 1)) -;;;###autoload (defun helm-gm-precedent-file () (interactive) (helm-goto-next-or-prec-file -1)) -;;;###autoload (defun helm-grep-mode-jump () (interactive) (helm-grep-action @@ -723,17 +721,14 @@ Special commands: (forward-line arg)) (error nil)))) -;;;###autoload (defun helm-grep-mode-jump-other-window-forward () (interactive) (helm-grep-mode-jump-other-window-1 1)) -;;;###autoload (defun helm-grep-mode-jump-other-window-backward () (interactive) (helm-grep-mode-jump-other-window-1 -1)) -;;;###autoload (defun helm-grep-mode-jump-other-window () (interactive) (let ((candidate (buffer-substring (point-at-bol) (point-at-eol)))) @@ -834,17 +829,21 @@ These extensions will be added to command line with --include arg of grep." ;; ;; (defvar helm-source-grep nil) -(defun helm-do-grep-1 (targets &optional recurse zgrep exts default-input) +(defun helm-do-grep-1 (targets &optional recurse zgrep exts default-input input) "Launch grep on a list of TARGETS files. When RECURSE is given use -r option of grep and prompt user to set the --include args of grep. -You can give more than one arg separated by space. +You can give more than one arg separated by space at prompt. e.g *.el *.py *.tex. +From lisp use the EXTS argument as a list of extensions as above. If you are using ack-grep, you will be prompted for --type -instead. -If prompt is empty '--exclude `grep-find-ignored-files' is used instead. +instead and EXTS will be ignored. +If prompt is empty `grep-find-ignored-files' are added to --exclude. +Argument DEFAULT-INPUT is use as `default' arg of `helm' and INPUT +is used as `input' arg of `helm', See `helm' docstring. ZGREP when non--nil use zgrep instead, without prompting for a choice -in recurse, search being made on `helm-zgrep-file-extension-regexp'." +in recurse, and ignoring EXTS, search being made on +`helm-zgrep-file-extension-regexp'." (when (and (helm-grep-use-ack-p) helm-ff-default-directory (file-remote-p helm-ff-default-directory)) @@ -924,6 +923,7 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." :sources 'helm-source-grep :buffer (format "*helm %s*" (if zgrep "zgrep" (helm-grep-command recurse))) :default default-input + :input input :keymap helm-grep-map :history 'helm-grep-history :truncate-lines t))) @@ -995,28 +995,32 @@ in recurse, search being made on `helm-zgrep-file-extension-regexp'." (lambda () (or helm-ff-default-directory (helm-default-directory) default-directory))))) - (helm-grep--filter-candidate-1 candidate))) + (if (consp candidate) + (helm-grep--filter-candidate-1 (cdr candidate)) + (helm-grep--filter-candidate-1 candidate)))) (defun helm-grep-highlight-match (str &optional multi-match) "Highlight in string STR all occurences matching `helm-pattern'." (require 'helm-match-plugin) (let (beg end) - (condition-case nil + (condition-case-unless-debug nil (with-temp-buffer (insert str) (goto-char (point-min)) (cl-loop for reg in (if multi-match + ;; (m)occur. (cl-loop for r in (helm-mp-split-pattern helm-pattern) - unless (string-match "\\`!" r) - collect r) - (list helm-pattern)) - do - (while (and (re-search-forward reg nil t) - (> (- (setq end (match-end 0)) - (setq beg (match-beginning 0))) 0)) - (add-text-properties beg end '(face helm-grep-match))) - do (goto-char (point-min))) + unless (string-match "\\`!" r) + collect r) + ;; async sources (grep, gid etc...) + (list helm-input)) + do + (while (and (re-search-forward reg nil t) + (> (- (setq end (match-end 0)) + (setq beg (match-beginning 0))) 0)) + (add-text-properties beg end '(face helm-grep-match))) + do (goto-char (point-min))) (buffer-string)) (error nil)))) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-help.el b/emacs.d/elpa/helm-20150623.1310/helm-help.el similarity index 94% rename from emacs.d/elpa/helm-20150507.2215/helm-help.el rename to emacs.d/elpa/helm-20150623.1310/helm-help.el index 6c8b3c7..d2af029 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-help.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-help.el @@ -17,7 +17,9 @@ ;;; Code: (require 'helm) -(require 'helm-org) + +(defvar helm-org-headings--nofilename) +(declare-function helm-source-org-headings-for-files "helm-org.el") (defgroup helm-help nil @@ -59,21 +61,22 @@ ;;;###autoload (defun helm-documentation (arg) - "Helm documentation. + "Preconfigured helm for helm documentation. With a prefix arg refresh the documentation. Find here the documentation of all sources actually documented." (interactive "P") + (require 'helm-org) (when arg (delete-file helm-documentation-file) (helm-aif (get-file-buffer helm-documentation-file) - (kill-buffer it))) + (kill-buffer it))) (unless (file-exists-p helm-documentation-file) (with-temp-file helm-documentation-file (erase-buffer) (cl-loop for elm in helm-help--string-list - for str = (symbol-value elm) - do (insert (substitute-command-keys - (if (functionp str) (funcall str) str)))))) + for str = (symbol-value elm) + do (insert (substitute-command-keys + (if (functionp str) (funcall str) str)))))) (let ((helm-org-headings--nofilename t)) (helm :sources (helm-source-org-headings-for-files (list helm-documentation-file)) @@ -333,17 +336,24 @@ Italic => A non--file buffer. "\n* Helm Find Files\n ** Helm find files tips: -\n*** Enter `~/' at end of pattern to quickly reach home directory. -*** Enter `/' at end of pattern to quickly reach root of your file system. +*** Quick pattern expansion: -*** Enter `./' at end of pattern to quickly reach `default-directory' (initial start of session). +\n**** Enter `~/' at end of pattern to quickly reach home directory. + +**** Enter `/' at end of pattern to quickly reach root of your file system. + +**** Enter `./' at end of pattern to quickly reach `default-directory' (initial start of session). If you are already in `default-directory' this will move cursor on top. -*** Enter `../' at end of pattern will reach upper directory, moving cursor on top. - NOTE: This different to using `C-l' in that `C-l' don't move cursor on top but stay on previous +**** Enter `../' at end of pattern will reach upper directory, moving cursor on top. + NOTE: This is different to using `C-l' in that `C-l' don't move cursor on top but stay on previous subdir name. +**** Enter any environment var (e.g `$HOME') at end of pattern, it will be expanded. + +**** You can yank any valid filename after pattern, it will be expanded. + *** You can complete with partial basename (start on third char entered) e.g \"fob\" or \"fbr\" will complete \"foobar\" @@ -427,10 +437,26 @@ also using not recursive wilcard (e.g \"*.el\") is perfectly fine for this. This feature (\"**\") is activated by default with the option `helm-file-globstar'. The directory selection with \"**foo/\" like bash shopt globstar option is not supported yet. +*** Copying renaming asynchronously + +If you use async library (if you have installed helm from MELPA you do) you can enable +async for copying/renaming etc... your files by enabling `dired-async-mode'. + +Note that even when async is enabled, running a copy/rename action with a prefix arg +will execute action synchronously, it will follow also the first file of the marked files +in its destination directory. + *** Bookmark your `helm-find-files' session You can bookmark your `helm-find-files' session with `C-x r m'. -You can retrieve later these bookmarks easily by using M-x helm-filtered-bookmarks. +You can retrieve later these bookmarks easily by using M-x helm-filtered-bookmarks +or from the current `helm-find-files' session just hitting `C-x r b'. + +*** Run Gid from `helm-find-files' + +You can navigate to a project containing an ID file created with the `mkid' +command from id-utils, and run the `gid' command which will use the symbol at point +in `helm-current-buffer' as default. \n** Specific commands for `helm-find-files':\n \\ @@ -440,6 +466,7 @@ You can retrieve later these bookmarks easily by using M-x helm-filtered-bookmar \\[helm-ff-run-grep]\t\t->Run Grep (C-u Recursive). \\[helm-ff-run-pdfgrep]\t\t->Run Pdfgrep on marked files. \\[helm-ff-run-zgrep]\t\t->Run zgrep (C-u Recursive). +\\[helm-ff-run-gid]\t\t->Run gid (id-utils). \\[helm-ff-run-etags]\t\t->Run Etags (C-u use thing-at-point `C-u C-u' reload cache) \\[helm-ff-run-rename-file]\t\t->Rename File (C-u Follow). \\[helm-ff-run-query-replace-on-marked]\t\t->Query replace on marked files. @@ -554,6 +581,7 @@ C/\\[helm-cr-empty-string]\t\t->Maybe return empty string (unless `must-match'). ;;;###autoload (defun helm-read-file-name-help () + "Help command for `read-file-name'." (interactive) (let ((helm-help-message helm-read-file-name-help-message)) (helm-help))) @@ -615,6 +643,7 @@ book * -size +1M ;;;###autoload (defun helm-generic-file-help () + "Global help for helm." (interactive) (let ((helm-help-message helm-generic-file-help-message)) (helm-help))) @@ -640,6 +669,16 @@ your regexp is ready to send to remote process, even if helm is handling this by delaying each process at 5s. Or even better don't use tramp at all and mount your remote file system on SSHFS. +* Helm Gid\n +** Helm Gid tips + +Helm gid read the database created with the `mkid' command from id-utils. +The name of the database file can be customized with `helm-gid-db-file-name', it +is usually \"ID\". +Helm Gid use the symbol at point as default-input. +You have access to this command also from `helm-find-files' which allow you to +navigate to another directory to consult its database. + \n** Specific commands for Helm Grep:\n \\ \\[helm-goto-next-file]\t->Next File. @@ -656,6 +695,7 @@ Or even better don't use tramp at all and mount your remote file system on SSHFS ;;;###autoload (defun helm-grep-help () + "Help command for helm grep." (interactive) (let ((helm-help-message helm-grep-help-message)) (helm-help))) @@ -676,6 +716,7 @@ Or even better don't use tramp at all and mount your remote file system on SSHFS ;;;###autoload (defun helm-pdfgrep-help () + "Help command for pdfgrep." (interactive) (let ((helm-help-message helm-pdfgrep-help-message)) (helm-help))) @@ -832,7 +873,14 @@ Multiple regexp matching is allowed, just enter a space to separate your regexps Matching empty lines is supported with the regexp \"^$\", you will get the results with only the buffer-name and the line number, you can of course save and edit these -results. +results (i.e add text to the empty line) . + +*** Automatically matching symbol at point + +You can match automatically the symbol at point, but keeping +the minibuffer empty ready to write into. +This is disabled by default, to enable this you have to add `helm-source-occur' +and `helm-source-moccur' to `helm-sources-using-default-as-input'. *** Jump to the corresponding line in the searched buffer You can do this with `C-j' (persistent-action), to do it repetitively @@ -877,6 +925,7 @@ to modify occurences in your buffer. ;;;###autoload (defun helm-moccur-help () + "Help command for (m)occur." (interactive) (let ((helm-help-message helm-moccur-help-message)) (helm-help))) @@ -899,6 +948,7 @@ to modify occurences in your buffer. ;;;###autoload (defun helm-top-help () + "Help command for top." (interactive) (let ((helm-help-message helm-top-help-message)) (helm-help))) @@ -921,6 +971,7 @@ to modify occurences in your buffer. ;;;###autoload (defun helm-apt-help () + "Help command for helm apt." (interactive) (let ((helm-help-message helm-apt-help-message)) (helm-help))) @@ -954,12 +1005,20 @@ This feature is only available with emacs-25. \\[helm-el-package-show-all]\t->Show all packages. \\[helm-el-package-show-installed]\t->Show installed packages only. \\[helm-el-package-show-uninstalled]\t->Show not installed packages only. +\\[helm-el-package-show-upgrade]\t->Show upgradable packages only. +\\[helm-el-run-package-install]\t->Install package(s). +\\[helm-el-run-package-reinstall]\t->Reinstall package(s). +\\[helm-el-run-package-uninstall]\t->Uninstall package(s). +\\[helm-el-run-package-upgrade]\t->Upgrade package(s). +\\[helm-el-run-package-upgrade-all]\t->Upgrade all packages upgradables. +\\[helm-el-run-visit-homepage]\t->Visit package homepage. \\[helm-el-package-help]\t->Show this help. \n** Helm Map\n \\{helm-map}") ;;;###autoload (defun helm-el-package-help () + "Help command for emacs packages." (interactive) (let ((helm-help-message helm-el-package-help-message)) (helm-help))) @@ -987,6 +1046,7 @@ the amount of prefix args entered. ;;;###autoload (defun helm-M-x-help () + "Help command for `helm-M-x'." (interactive) (let ((helm-help-message helm-M-x-help-message)) (helm-help))) @@ -1006,6 +1066,7 @@ the amount of prefix args entered. ;;;###autoload (defun helm-imenu-help () + "Help command for imenu." (interactive) (let ((helm-help-message helm-imenu-help-message)) (helm-help))) @@ -1027,6 +1088,7 @@ the amount of prefix args entered. ;;;###autoload (defun helm-color-help () + "Help command for color." (interactive) (let ((helm-help-message helm-colors-help-message)) (helm-help))) @@ -1046,6 +1108,7 @@ the amount of prefix args entered. ;;;###autoload (defun helm-semantic-help () + "Help command for semantic." (interactive) (let ((helm-help-message helm-semantic-help-message)) (helm-help))) @@ -1074,6 +1137,7 @@ you don't choose from there a command using helm completion. ;;;###autoload (defun helm-kmacro-help () + "Help command for kmacro." (interactive) (let ((helm-help-message helm-kmacro-help-message)) (helm-help))) diff --git a/emacs.d/elpa/helm-20150623.1310/helm-id-utils.el b/emacs.d/elpa/helm-20150623.1310/helm-id-utils.el new file mode 100644 index 0000000..7b7e922 --- /dev/null +++ b/emacs.d/elpa/helm-20150623.1310/helm-id-utils.el @@ -0,0 +1,116 @@ +;;; helm-id-utils.el --- Helm interface for id-utils. -*- lexical-binding: t -*- + +;; Copyright (C) 2015 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'helm-grep) + +(defgroup helm-id-utils nil + "ID-Utils related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-gid-db-file-name "ID" + "Name of a database file created by `mkid' command from `ID-utils'." + :group 'helm-id-utils + :type 'string) + +(defun helm-gid-candidates-process () + (let ((proc (start-process + "gid" nil "gid" + "-r" helm-pattern))) + (set (make-local-variable 'helm-grep-last-cmd-line) + (format "gid -r %s" helm-pattern)) + (prog1 proc + (set-process-sentinel + proc (lambda (_process event) + (when (string= event "finished\n") + (with-helm-window + (setq mode-line-format + '(" " mode-line-buffer-identification " " + (:eval (format "L%s" (helm-candidate-number-at-point))) " " + (:eval (propertize + (format "[Helm Gid process finished - (%s results)]" + (max (1- (count-lines + (point-min) (point-max))) + 0)) + 'face 'helm-locate-finish)))) + (force-mode-line-update)) + (helm-log "Error: Gid %s" + (replace-regexp-in-string "\n" "" event)))))))) + +(defun helm-gid-filtered-candidate-transformer (candidates _source) + ;; "gid -r" may add dups in some rare cases. + (cl-loop for c in (helm-fast-remove-dups candidates :test 'equal) + collect (helm-grep--filter-candidate-1 c))) + +(defclass helm-gid-source (helm-source-async) + ((header-name + :initform + (lambda (name) + (concat name " [" (helm-attr 'db-dir) "]"))) + (db-dir :initarg :db-dir + :initform nil + :custom string + :documentation " Location of ID file.") + (candidates-process :initform #'helm-gid-candidates-process) + (filtered-candidate-transformer + :initform #'helm-gid-filtered-candidate-transformer) + (candidate-number-limit :initform 99999) + (mode-line :initform helm-grep-mode-line-string) + (action :initform (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 :initform 'helm-grep-persistent-action) + (history :initform 'helm-grep-history) + (nohighlight :initform t) + (requires-pattern :initform 2))) + +;;;###autoload +(defun helm-gid () + "Preconfigured helm for `gid' command line of `ID-Utils'. +Need A database created with the command `mkid' +above `default-directory'. +Need id-utils as dependency which provide `mkid', `gid' etc... +See ." + (interactive) + (let* ((db (locate-dominating-file + default-directory + helm-gid-db-file-name)) + (helm-grep-default-directory-fn + (lambda () default-directory)) + (helm--maybe-use-default-as-input t)) + (cl-assert db nil "No DataBase found, create one with `mkid'") + (helm :sources (helm-make-source "Gid" 'helm-gid-source + :db-dir db) + :buffer "*helm gid*" + :keymap helm-grep-map + :truncate-lines t))) + +(provide 'helm-id-utils) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-id-utils ends here diff --git a/emacs.d/elpa/helm-20150623.1310/helm-imenu.el b/emacs.d/elpa/helm-20150623.1310/helm-imenu.el new file mode 100644 index 0000000..295df05 --- /dev/null +++ b/emacs.d/elpa/helm-20150623.1310/helm-imenu.el @@ -0,0 +1,261 @@ +;;; helm-imenu.el --- Helm interface for Imenu -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto + +;; 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 . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'imenu) +(require 'helm-utils) +(require 'helm-help) + + +(defgroup helm-imenu nil + "Imenu related libraries and applications for helm." + :group 'helm) + +(defcustom helm-imenu-delimiter " / " + "Delimit types of candidates and his value in `helm-buffer'." + :group 'helm-imenu + :type 'string) + +(defcustom helm-imenu-execute-action-at-once-if-one t + "Goto the candidate when only one is remaining." + :group 'helm-imenu + :type 'boolean) + +(defcustom helm-imenu-lynx-style-map t + "Use Arrow keys to jump to occurences." + :group 'helm-imenu + :type 'boolean) + + +;;; keymap +(defvar helm-imenu-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c ?") 'helm-imenu-help) + (define-key map (kbd "M-") 'helm-imenu-next-section) + (define-key map (kbd "M-") 'helm-imenu-previous-section) + (when helm-imenu-lynx-style-map + (define-key map (kbd "") 'helm-maybe-exit-minibuffer) + (define-key map (kbd "") 'helm-execute-persistent-action)) + (delq nil map))) + +(defun helm-imenu-next-or-previous-section (n) + (with-helm-buffer + (let* ((fn (lambda () + (car (split-string (helm-get-selection nil t) + helm-imenu-delimiter)))) + (curtype (funcall fn)) + (move-fn (if (> n 0) #'helm-next-line #'helm-previous-line)) + (stop-fn (if (> n 0) + #'helm-end-of-source-p + #'helm-beginning-of-source-p))) + (catch 'break + (while (not (funcall stop-fn)) + (funcall move-fn) + (unless (string= curtype (funcall fn)) + (throw 'break nil))))))) + +(defun helm-imenu-next-section () + (interactive) + (helm-imenu-next-or-previous-section 1)) + +(defun helm-imenu-previous-section () + (interactive) + (helm-imenu-next-or-previous-section -1)) + + +;;; Internals +(defvar helm-cached-imenu-alist nil) +(make-variable-buffer-local 'helm-cached-imenu-alist) + +(defvar helm-cached-imenu-candidates nil) +(make-variable-buffer-local 'helm-cached-imenu-candidates) + +(defvar helm-cached-imenu-tick nil) +(make-variable-buffer-local 'helm-cached-imenu-tick) + + +(defvar helm-source-imenu nil "See (info \"(emacs)Imenu\")") +(defvar helm-source-imenu-all nil) + +(defclass helm-imenu-source (helm-source-sync) + ((candidates :initform 'helm-imenu-candidates) + (candidate-transformer :initform 'helm-imenu-transformer) + (persistent-action :initform 'helm-imenu-persistent-action) + (persistent-help :initform "Show this entry") + (keymap :initform helm-imenu-map) + (mode-line :initform helm-imenu-mode-line) + (action :initform 'helm-imenu-action))) + +(defcustom helm-imenu-fuzzy-match nil + "Enable fuzzy matching in `helm-source-imenu'." + :group 'helm-imenu + :type 'boolean + :set (lambda (var val) + (set var val) + (setq helm-source-imenu + (helm-make-source "Imenu" 'helm-imenu-source + :fuzzy-match helm-imenu-fuzzy-match)))) + +(defun helm-imenu--maybe-switch-to-buffer (candidate) + (helm-aif (marker-buffer (cdr candidate)) + (unless (eql it (get-buffer helm-current-buffer)) + (switch-to-buffer it)))) + +(defun helm-imenu-action (candidate) + "Default action for `helm-source-imenu'." + (helm-log-run-hook 'helm-goto-line-before-hook) + (helm-imenu--maybe-switch-to-buffer candidate) + (imenu candidate) + ;; If semantic is supported in this buffer + ;; imenu used `semantic-imenu-goto-function' + ;; and position have been highlighted, + ;; no need to highlight again. + (unless (eq imenu-default-goto-function + 'semantic-imenu-goto-function) + (helm-highlight-current-line nil nil nil nil 'pulse))) + +(defun helm-imenu-persistent-action (candidate) + "Default persistent action for `helm-source-imenu'." + (helm-imenu--maybe-switch-to-buffer candidate) + (imenu candidate) + (helm-highlight-current-line)) + +(defun helm-imenu-candidates (&optional buffer) + (with-current-buffer (or buffer helm-current-buffer) + (let ((tick (buffer-modified-tick))) + (if (eq helm-cached-imenu-tick tick) + helm-cached-imenu-candidates + (setq imenu--index-alist nil) + (prog1 (setq helm-cached-imenu-candidates + (let ((index (imenu--make-index-alist t))) + (helm-imenu--candidates-1 + (delete (assoc "*Rescan*" index) index)))) + (setq helm-cached-imenu-tick tick)))))) + +(defun helm-imenu-candidates-in-all-buffers () + (let* ((lst (buffer-list)) + (progress-reporter (make-progress-reporter + "Imenu indexing buffers..." 1 (length lst)))) + (prog1 + (cl-loop for b in lst + for count from 1 + for mm = (with-current-buffer b major-mode) + for cmm = (with-helm-current-buffer major-mode) + when (or (with-helm-current-buffer + (derived-mode-p mm)) + (with-current-buffer b + (derived-mode-p cmm))) + do (progress-reporter-update progress-reporter count) + and + append (with-current-buffer b + (helm-imenu-candidates b))) + (progress-reporter-done progress-reporter)))) + +(defun helm-imenu--candidates-1 (alist) + (cl-loop for elm in alist + nconc (if (imenu--subalist-p elm) + (helm-imenu--candidates-1 + (cl-loop for (e . v) in (cdr elm) collect + (cons (propertize + e 'helm-imenu-type (car elm)) + ;; If value is an integer, convert it + ;; to a marker, otherwise it is a cons cell + ;; and it will be converted on next recursions. + ;; (Issue #1060) [1]. + (if (integerp v) (copy-marker v) v)))) + (and (cdr elm) ; bug in imenu, should not be needed. + (setcdr elm (copy-marker (cdr elm))) ; Same as [1]. + (list elm))))) + +(defun helm-imenu--get-prop (item) + ;; property value of ITEM can have itself + ;; a property value which have itself a property value + ;; ...and so on; Return a list of all these + ;; properties values starting at ITEM. + (let* ((prop (get-text-property 0 'helm-imenu-type item)) + (lst (list prop item))) + (when prop + (while prop + (setq prop (get-text-property 0 'helm-imenu-type prop)) + (and prop (push prop lst))) + lst))) + +(defun helm-imenu-transformer (candidates) + (cl-loop for (k . v) in candidates + for types = (or (helm-imenu--get-prop k) + (list "Function" k)) + for bufname = (buffer-name (marker-buffer v)) + for disp1 = (mapconcat + (lambda (x) + (propertize + x 'face (cond ((string= x "Variables") + 'font-lock-variable-name-face) + ((string= x "Function") + 'font-lock-function-name-face) + ((string= x "Types") + 'font-lock-type-face)))) + types helm-imenu-delimiter) + for disp = (propertize disp1 'help-echo bufname) + collect + (cons disp (cons k v)))) + +;;;###autoload +(defun helm-imenu () + "Preconfigured `helm' for `imenu'." + (interactive) + (unless helm-source-imenu + (setq helm-source-imenu + (helm-make-source "Imenu" 'helm-imenu-source + :fuzzy-match helm-imenu-fuzzy-match))) + (let ((imenu-auto-rescan t) + (str (thing-at-point 'symbol)) + (helm-execute-action-at-once-if-one + helm-imenu-execute-action-at-once-if-one)) + (helm :sources 'helm-source-imenu + :default (list (concat "\\_<" str "\\_>") str) + :buffer "*helm imenu*"))) + +;;;###autoload +(defun helm-imenu-in-all-buffers () + "Preconfigured helm for fetching imenu entries of all buffers." + (interactive) + (unless helm-source-imenu-all + (setq helm-source-imenu-all + (helm-make-source "Imenu in all buffers" 'helm-imenu-source + :candidates 'helm-imenu-candidates-in-all-buffers + :fuzzy-match helm-imenu-fuzzy-match))) + (let ((imenu-auto-rescan t) + (str (thing-at-point 'symbol)) + (helm-execute-action-at-once-if-one + helm-imenu-execute-action-at-once-if-one)) + (helm :sources 'helm-source-imenu-all + :default (list (concat "\\_<" str "\\_>") str) + :buffer "*helm imenu all*"))) + +(provide 'helm-imenu) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-imenu.el ends here diff --git a/emacs.d/elpa/helm-20150507.2215/helm-info.el b/emacs.d/elpa/helm-20150623.1310/helm-info.el similarity index 100% rename from emacs.d/elpa/helm-20150507.2215/helm-info.el rename to emacs.d/elpa/helm-20150623.1310/helm-info.el diff --git a/emacs.d/elpa/helm-20150507.2215/helm-locate.el b/emacs.d/elpa/helm-20150623.1310/helm-locate.el similarity index 96% rename from emacs.d/elpa/helm-20150507.2215/helm-locate.el rename to emacs.d/elpa/helm-20150623.1310/helm-locate.el index 2c50ea6..b7d3f91 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-locate.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-locate.el @@ -97,6 +97,12 @@ the opposite of \"locate\" command." (define-key map (kbd "M-g s") 'helm-ff-run-grep) (define-key map (kbd "M-g z") 'helm-ff-run-zgrep) (define-key map (kbd "M-g p") 'helm-ff-run-pdfgrep) + (define-key map (kbd "M-R") 'helm-ff-run-rename-file) + (define-key map (kbd "M-C") 'helm-ff-run-copy-file) + (define-key map (kbd "M-B") 'helm-ff-run-byte-compile-file) + (define-key map (kbd "M-L") 'helm-ff-run-load-file) + (define-key map (kbd "M-S") 'helm-ff-run-symlink-file) + (define-key map (kbd "M-H") 'helm-ff-run-hardlink-file) (define-key map (kbd "M-D") 'helm-ff-run-delete-file) (define-key map (kbd "C-=") 'helm-ff-run-ediff-file) (define-key map (kbd "C-c =") 'helm-ff-run-ediff-merge-file) @@ -202,8 +208,7 @@ Argument INITIAL-INPUT is a string to use as initial-input. See also `helm-locate'." (when (and db (stringp db)) (setq db (list db))) (helm-locate-set-command) - (let ((helm-ff-transformer-show-only-basename nil) - (helm-locate-command + (let ((helm-locate-command (if db (replace-regexp-in-string "locate" @@ -219,6 +224,7 @@ See also `helm-locate'." (setq helm-file-name-history (mapcar 'helm-basename file-name-history)) (helm :sources 'helm-source-locate :buffer "*helm locate*" + :ff-transformer-show-only-basename nil :input initial-input :default default :history 'helm-file-name-history))) @@ -297,8 +303,7 @@ See also `helm-locate'." ;;;###autoload (defun helm-locate-read-file-name (prompt) - (let* (helm-ff-transformer-show-only-basename - (src `((name . "Locate read fname") + (let* ((src `((name . "Locate read fname") (init . helm-locate-set-command) (candidates-process . helm-locate-init) (action . identity) @@ -309,6 +314,7 @@ See also `helm-locate'." (candidate-number-limit . 9999) (no-matchplugin)))) (or (helm :sources src + :ff-transformer-show-only-basename nil :prompt prompt :buffer "*helm locate read fname*" :resume 'noresume) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-man.el b/emacs.d/elpa/helm-20150623.1310/helm-man.el similarity index 60% rename from emacs.d/elpa/helm-20150507.2215/helm-man.el rename to emacs.d/elpa/helm-20150623.1310/helm-man.el index cdf7c2a..392ad93 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-man.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-man.el @@ -20,8 +20,15 @@ (require 'cl-lib) (require 'helm) +(defvar woman-topic-all-completions) +(defvar woman-manpath) +(defvar woman-path) +(defvar woman-expanded-directory-path) +(declare-function woman-file-name "woman.el" (topic &optional re-cache)) (declare-function woman-file-name-all-completions "woman.el" (topic)) (declare-function Man-getpage-in-background "man.el" (topic)) +(declare-function woman-expand-directory-path "woman.el" (path-dirs path-regexps)) +(declare-function woman-topic-all-completions "woman.el" (path)) (declare-function helm-generic-sort-fn "helm-utils.el" (S1 S2)) (defgroup helm-man nil @@ -35,8 +42,17 @@ (const :tag "Man" Man-getpage-in-background) (const :tag "Woman" woman))) +(defcustom helm-man-format-switches "-l %s" + "Arguments to pass to the `manual-entry' function. +Arguments are passed to `manual-entry' with `format.' +Default use \"-l\" which may not be supported on old man versions, +in this case use \"%s\" as value to pass only the filename as argument. +See Issue #1035" + :group 'helm-man + :type 'string) + ;; Internal -(defvar helm-man-pages nil +(defvar helm-man--pages nil "All man pages on system. Will be calculated the first time you invoke helm with this source.") @@ -50,46 +66,42 @@ source.") (let ((file (helm-comp-read "ManFile: " wfiles :must-match t))) (if (eq helm-man-or-woman-function 'Man-getpage-in-background) - (manual-entry (format "-l %s" file)) - (woman-find-file file))) + (manual-entry (format helm-man-format-switches file)) + (woman-find-file file))) (funcall helm-man-or-woman-function candidate)) ;; If woman is unable to format correctly ;; use man instead. (error (kill-buffer) ; Kill woman buffer. (Man-getpage-in-background candidate))))) +(defun helm-man--init () + (require 'woman) + (require 'helm-utils) + (unless helm-man--pages + (setq woman-expanded-directory-path + (woman-expand-directory-path woman-manpath woman-path)) + (setq woman-topic-all-completions + (woman-topic-all-completions woman-expanded-directory-path)) + (setq helm-man--pages (mapcar 'car woman-topic-all-completions))) + (helm-init-candidates-in-buffer 'global helm-man--pages)) + (defvar helm-source-man-pages - '((name . "Manual Pages") - (init . (lambda () - (require 'woman) - (require 'helm-utils) - (unless helm-man-pages - (setq helm-man-pages - (ignore-errors - (woman-file-name "" t) - (sort (mapcar 'car woman-topic-all-completions) - 'string-lessp)))) - (helm-init-candidates-in-buffer 'global helm-man-pages))) - (candidates-in-buffer) - (persistent-action . ignore) - (filtered-candidate-transformer - . (lambda (candidates _source) - (sort candidates #'helm-generic-sort-fn))) - (action . (("Display Man page" . helm-man-default-action))) - ;; Woman does not work OS X - ;; http://xahlee.org/emacs/modernization_man_page.html - (action-transformer . (lambda (actions candidate) - (if (eq system-type 'darwin) - '(("Display Man page" . man)) - actions))))) + (helm-build-in-buffer-source "Manual Pages" + :init #'helm-man--init + :persistent-action #'ignore + :filtered-candidate-transformer + (lambda (candidates _source) + (sort candidates #'helm-generic-sort-fn)) + :action '(("Display Man page" . helm-man-default-action)))) ;;;###autoload (defun helm-man-woman (arg) "Preconfigured `helm' for Man and Woman pages. With a prefix arg reinitialize the cache." (interactive "P") - (when arg (setq helm-man-pages nil)) - (helm-other-buffer 'helm-source-man-pages "*Helm man woman*")) + (when arg (setq helm-man--pages nil)) + (helm :sources 'helm-source-man-pages + :buffer "*Helm man woman*")) (provide 'helm-man) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-match-plugin.el b/emacs.d/elpa/helm-20150623.1310/helm-match-plugin.el similarity index 100% rename from emacs.d/elpa/helm-20150507.2215/helm-match-plugin.el rename to emacs.d/elpa/helm-20150623.1310/helm-match-plugin.el diff --git a/emacs.d/elpa/helm-20150507.2215/helm-misc.el b/emacs.d/elpa/helm-20150623.1310/helm-misc.el similarity index 95% rename from emacs.d/elpa/helm-20150507.2215/helm-misc.el rename to emacs.d/elpa/helm-20150623.1310/helm-misc.el index 88fee5f..28a26d3 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-misc.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-misc.el @@ -46,6 +46,7 @@ "Face used to colorize home time in `helm-world-time'." :group 'helm-misc) + ;;; Latex completion (defvar LaTeX-math-menu) @@ -142,7 +143,7 @@ current local map, current global map, and all current minor maps." ;;;###autoload (defun helm-browse-menubar () - "Helm interface to the menubar using lacarte.el." + "Preconfigured helm to the menubar using lacarte.el." (interactive) (require 'lacarte) (helm :sources (mapcar @@ -283,23 +284,11 @@ It is added to `extended-command-history'. ;;;###autoload (defun helm-stumpwm-commands() + "Preconfigured helm for stumpwm commands." (interactive) (helm-other-buffer 'helm-source-stumpwm-commands "*helm stumpwm commands*")) -;;;###autoload -(defun helm-mini () - "Preconfigured `helm' lightweight version \(buffer -> recentf\)." - (interactive) - (require 'helm-files) - (unless helm-source-buffers-list - (setq helm-source-buffers-list - (helm-make-source "Buffers" 'helm-source-buffers))) - (let ((helm-ff-transformer-show-only-basename nil)) - (helm :sources helm-mini-default-sources - :buffer "*helm mini*" - :truncate-lines t))) - ;;;###autoload (defun helm-minibuffer-history () "Preconfigured `helm' for `minibuffer-history'." @@ -310,7 +299,7 @@ It is added to `extended-command-history'. ;;;###autoload (defun helm-comint-input-ring () - "Predefined `helm' that provide completion of `comint' history." + "Preconfigured `helm' that provide completion of `comint' history." (interactive) (when (derived-mode-p 'comint-mode) (helm :sources 'helm-source-comint-input-ring diff --git a/emacs.d/elpa/helm-20150507.2215/helm-mode.el b/emacs.d/elpa/helm-20150623.1310/helm-mode.el similarity index 93% rename from emacs.d/elpa/helm-20150507.2215/helm-mode.el rename to emacs.d/elpa/helm-20150623.1310/helm-mode.el index 4dc44f7..d05bb2f 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-mode.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-mode.el @@ -164,54 +164,57 @@ e.g See docstring of `all-completions' for more info. If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." - - (let ((cands - (cond ((vectorp collection) - (all-completions "" collection test)) - ((and (symbolp collection) (boundp collection) - ;; Issue #324 history is let-bounded and given - ;; quoted as hist argument of completing-read. - ;; See example in `rcirc-browse-url'. - (symbolp (symbol-value collection))) - nil) - ;; When collection is a symbol, most of the time - ;; it should be a symbol used as a minibuffer-history. - ;; The value of this symbol in this case return a list - ;; of string which maybe are converted later as symbol - ;; in special cases. - ;; we treat here commandp as a special case as it return t - ;; also with a string unless its last arg is provided. - ;; Also, the history collections generally collect their - ;; elements as string, so intern them to call predicate. - ((and (symbolp collection) (boundp collection) test) - (let ((predicate `(lambda (elm) - (condition-case err - (if (eq (quote ,test) 'commandp) - (funcall (quote ,test) (intern elm)) - (funcall (quote ,test) elm)) - (wrong-type-argument - (funcall (quote ,test) (intern elm))))))) - (all-completions "" (symbol-value collection) predicate))) - ((and (symbolp collection) (boundp collection)) - (all-completions "" (symbol-value collection))) - ;; Normally file completion should not be handled here, - ;; but special cases like `find-file-at-point' do it. - ;; Handle here specially such cases. - ((and (functionp collection) minibuffer-completing-file-name) - (cl-loop for f in (funcall collection helm-pattern test t) - unless (member f '("./" "../")) - if (string-match ffap-url-regexp helm-pattern) - collect f - else - collect (concat (file-name-as-directory - (helm-basedir helm-pattern)) f))) - ((functionp collection) - (funcall collection "" test t)) - ((and alistp test) - (cl-loop for i in collection when (funcall test i) collect i)) - (alistp collection) - (t (all-completions "" collection test))))) - (if sort-fn (sort cands sort-fn) cands))) + ;; Ensure COLLECTION is computed from `helm-current-buffer' + ;; because some functions used as COLLECTION work + ;; only in the context of current-buffer (Issue #1030) . + (with-helm-current-buffer + (let ((cands + (cond ((vectorp collection) + (all-completions "" collection test)) + ((and (symbolp collection) (boundp collection) + ;; Issue #324 history is let-bounded and given + ;; quoted as hist argument of completing-read. + ;; See example in `rcirc-browse-url'. + (symbolp (symbol-value collection))) + nil) + ;; When collection is a symbol, most of the time + ;; it should be a symbol used as a minibuffer-history. + ;; The value of this symbol in this case return a list + ;; of string which maybe are converted later as symbol + ;; in special cases. + ;; we treat here commandp as a special case as it return t + ;; also with a string unless its last arg is provided. + ;; Also, the history collections generally collect their + ;; elements as string, so intern them to call predicate. + ((and (symbolp collection) (boundp collection) test) + (let ((predicate `(lambda (elm) + (condition-case err + (if (eq (quote ,test) 'commandp) + (funcall (quote ,test) (intern elm)) + (funcall (quote ,test) elm)) + (wrong-type-argument + (funcall (quote ,test) (intern elm))))))) + (all-completions "" (symbol-value collection) predicate))) + ((and (symbolp collection) (boundp collection)) + (all-completions "" (symbol-value collection))) + ;; Normally file completion should not be handled here, + ;; but special cases like `find-file-at-point' do it. + ;; Handle here specially such cases. + ((and (functionp collection) minibuffer-completing-file-name) + (cl-loop for f in (funcall collection helm-pattern test t) + unless (member f '("./" "../")) + if (string-match ffap-url-regexp helm-pattern) + collect f + else + collect (concat (file-name-as-directory + (helm-basedir helm-pattern)) f))) + ((functionp collection) + (funcall collection "" test t)) + ((and alistp test) + (cl-loop for i in collection when (funcall test i) collect i)) + (alistp collection) + (t (all-completions "" collection test))))) + (if sort-fn (sort cands sort-fn) cands)))) (defun helm-cr-default-transformer (candidates _source) "Default filter candidate function for `helm-comp-read'." diff --git a/emacs.d/elpa/helm-20150507.2215/helm-net.el b/emacs.d/elpa/helm-20150623.1310/helm-net.el similarity index 84% rename from emacs.d/elpa/helm-20150507.2215/helm-net.el rename to emacs.d/elpa/helm-20150623.1310/helm-net.el index 702a3aa..60c9030 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-net.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-net.el @@ -174,85 +174,41 @@ This is a format string, don't forget the `%s'." ;;; Google Suggestions ;; ;; -;; Internal -(defvar helm-ggs-max-length-real-flag 0) -(defvar helm-ggs-max-length-num-flag 0) - (defun helm-google-suggest-fetch (input) - "Fetch suggestions for INPUT from XML buffer. -Return an alist with elements like (data . number_results)." - (setq helm-ggs-max-length-real-flag 0 - helm-ggs-max-length-num-flag 0) + "Fetch suggestions for INPUT from XML buffer." (let ((request (concat helm-google-suggest-url (url-hexify-string input))) (fetch #'(lambda () (cl-loop - with result-alist = (xml-get-children - (car (xml-parse-region - (point-min) (point-max))) - 'CompleteSuggestion) - for i in result-alist - for data = (cdr (cl-caadr (assoc 'suggestion i))) - for nqueries = (cdr (cl-caadr (assoc 'num_queries i))) - for lqueries = (length (helm-ggs-set-number-result - nqueries)) - for ldata = (length data) - do - (progn - (when (> ldata helm-ggs-max-length-real-flag) - (setq helm-ggs-max-length-real-flag ldata)) - (when (> lqueries helm-ggs-max-length-num-flag) - (setq helm-ggs-max-length-num-flag lqueries))) - collect (cons data nqueries) into cont - finally return cont)))) + with result-alist = (xml-get-children + (car (xml-parse-region + (point-min) (point-max))) + 'CompleteSuggestion) + for i in result-alist collect + (cdr (cl-caadr (assoc 'suggestion i))))))) (if helm-google-suggest-use-curl-p (with-temp-buffer (call-process "curl" nil t nil request) (funcall fetch)) - (with-current-buffer - (url-retrieve-synchronously request) - (funcall fetch))))) + (with-current-buffer + (url-retrieve-synchronously request) + (funcall fetch))))) (defun helm-google-suggest-set-candidates (&optional request-prefix) "Set candidates with result and number of google results found." - (let ((suggestions - (cl-loop with suggested-results = (helm-google-suggest-fetch - (or (and request-prefix - (concat request-prefix - " " helm-pattern)) - helm-pattern)) - for (real . numresult) in suggested-results - ;; Prepare number of results with "," - for fnumresult = (helm-ggs-set-number-result numresult) - ;; Calculate number of spaces to add before fnumresult - ;; if it is smaller than longest result - ;; `helm-ggs-max-length-num-flag'. - ;; e.g 1,234,567 - ;; 345,678 - ;; To be sure it is aligned properly. - for nspaces = (if (< (length fnumresult) - helm-ggs-max-length-num-flag) - (- helm-ggs-max-length-num-flag - (length fnumresult)) - 0) - ;; Add now the spaces before fnumresult. - for align-fnumresult = (concat (make-string nspaces ? ) - fnumresult) - for interval = (- helm-ggs-max-length-real-flag - (length real)) - for spaces = (make-string (+ 2 interval) ? ) - for display = (format "%s%s(%s results)" - real spaces align-fnumresult) - collect (cons display real)))) - (if (cl-loop for (_disp . dat) in suggestions - thereis (equal dat helm-pattern)) + (let ((suggestions (helm-google-suggest-fetch + (or (and request-prefix + (concat request-prefix + " " helm-pattern)) + helm-pattern)))) + (if (member helm-pattern suggestions) suggestions - ;; if there is no suggestion exactly matching the input then - ;; prepend a Search on Google item to the list - (append - suggestions - (list (cons (concat "Search for " "'" helm-input "'" " on Google") - helm-input)))))) + ;; if there is no suggestion exactly matching the input then + ;; prepend a Search on Google item to the list + (append + suggestions + (list (cons (format "Search for '%s' on Google" helm-input) + helm-input)))))) (defun helm-ggs-set-number-result (num) (if num diff --git a/emacs.d/elpa/helm-20150507.2215/helm-org.el b/emacs.d/elpa/helm-20150623.1310/helm-org.el similarity index 97% rename from emacs.d/elpa/helm-20150507.2215/helm-org.el rename to emacs.d/elpa/helm-20150623.1310/helm-org.el index 6570016..41b82f8 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-org.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-org.el @@ -115,6 +115,7 @@ NOTE: This will be slow on large org buffers." ;;;###autoload (defun helm-org-agenda-files-headings () + "Preconfigured helm for org files headings." (interactive) (helm :sources (helm-source-org-headings-for-files (org-agenda-files)) :candidate-number-limit 99999 @@ -122,6 +123,7 @@ NOTE: This will be slow on large org buffers." ;;;###autoload (defun helm-org-in-buffer-headings () + "Preconfigured helm for org buffer headings." (interactive) (let ((helm-org-headings--nofilename t)) (helm :sources (helm-source-org-headings-for-files @@ -131,6 +133,7 @@ NOTE: This will be slow on large org buffers." ;;;###autoload (defun helm-org-capture-templates () + "Preconfigured helm for org templates." (interactive) (helm :sources (helm-source-org-capture-templates) :candidate-number-limit 99999 diff --git a/emacs.d/elpa/helm-20150507.2215/helm-pkg.el b/emacs.d/elpa/helm-20150623.1310/helm-pkg.el similarity index 65% rename from emacs.d/elpa/helm-20150507.2215/helm-pkg.el rename to emacs.d/elpa/helm-20150623.1310/helm-pkg.el index bb6a8d5..421043b 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-pkg.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-pkg.el @@ -1,7 +1,7 @@ -(define-package "helm" "20150507.2215" "Helm is an Emacs incremental and narrowing framework" +(define-package "helm" "20150623.1310" "Helm is an Emacs incremental and narrowing framework" '((emacs "24") (cl-lib "0.5") - (async "1.2")) + (async "1.3")) :url "https://emacs-helm.github.io/helm/") ;; Local Variables: ;; no-byte-compile: t diff --git a/emacs.d/elpa/helm-20150507.2215/helm-plugin.el b/emacs.d/elpa/helm-20150623.1310/helm-plugin.el similarity index 100% rename from emacs.d/elpa/helm-20150507.2215/helm-plugin.el rename to emacs.d/elpa/helm-20150623.1310/helm-plugin.el diff --git a/emacs.d/elpa/helm-20150507.2215/helm-regexp.el b/emacs.d/elpa/helm-20150623.1310/helm-regexp.el similarity index 98% rename from emacs.d/elpa/helm-20150507.2215/helm-regexp.el rename to emacs.d/elpa/helm-20150623.1310/helm-regexp.el index 5b2b2fc..5e6d8af 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-regexp.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-regexp.el @@ -134,7 +134,7 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." (let ((matches (match-data)) (line (buffer-substring s e))) (propertize - (cl-loop with ln = (format "%5d: %s" (line-number-at-pos s) line) + (cl-loop with ln = (format "%5d: %s" (1- (line-number-at-pos s)) line) for i from 0 to (1- (/ (length matches) 2)) concat (format "\n %s'%s'" (format "Group %d: " i) (match-string i)) @@ -223,7 +223,7 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame." (let* ((split (helm-grep-split-line candidate)) (buf (car split)) (lineno (string-to-number (nth 1 split))) - (split-pat (helm-mp-split-pattern helm-pattern))) + (split-pat (helm-mp-split-pattern helm-input))) (cl-case method (buffer (switch-to-buffer buf)) (buffer-other-window (switch-to-buffer-other-window buf)) @@ -298,7 +298,6 @@ Same as `helm-moccur-goto-line' but go in new frame." ("Goto line new frame" . helm-moccur-goto-line-of))) (persistent-action :initform 'helm-moccur-persistent-action) (persistent-help :initform "Go to line") - (recenter :initform t) (resume :initform 'helm-moccur-resume-fn) (candidate-number-limit :initform 9999) (mode-line :initform helm-moccur-mode-line) @@ -394,9 +393,8 @@ Same as `helm-moccur-goto-line' but go in new frame." :input input :truncate-lines t)) -;;;###autoload (defun helm-moccur-run-save-buffer () - "Run grep save results action from `helm-do-grep-1'." + "Run moccur save results action from `helm-moccur'." (interactive) (with-helm-alive-p (helm-quit-and-execute-action 'helm-moccur-save-results))) @@ -464,7 +462,7 @@ Same as `helm-moccur-goto-line' but go in new frame." (let ((inhibit-read-only t)) (erase-buffer) (insert "-*- mode: helm-moccur -*-\n\n" - (format "Moccur Results for `%s':\n\n" helm-pattern)) + (format "Moccur Results for `%s':\n\n" helm-input)) (save-excursion (insert (with-current-buffer helm-buffer (goto-char (point-min)) (forward-line 1) @@ -521,7 +519,7 @@ Special commands: (insert (propertize (car (helm-moccur-filter-one-by-one line)) - 'helm-real-value line) + 'helm-realvalue line) "\n"))))) (message "Reverting buffer done"))))) @@ -561,7 +559,8 @@ Special commands: :buffer "*helm occur*" :history 'helm-grep-history :preselect (and (memq 'helm-source-occur helm-sources-using-default-as-input) - (format "%s:%d:" (buffer-name) (line-number-at-pos (point)))) + (format "%s:%d:" (regexp-quote (buffer-name)) + (line-number-at-pos (point)))) :truncate-lines t)) ;;;###autoload diff --git a/emacs.d/elpa/helm-20150507.2215/helm-ring.el b/emacs.d/elpa/helm-20150623.1310/helm-ring.el similarity index 89% rename from emacs.d/elpa/helm-20150507.2215/helm-ring.el rename to emacs.d/elpa/helm-20150623.1310/helm-ring.el index 2cc122b..96913d7 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-ring.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-ring.el @@ -109,7 +109,7 @@ replace with STR as yanked string." (with-helm-current-buffer (setq kill-ring (delete str kill-ring)) (if (not (eq (helm-attr 'last-command helm-source-kill-ring) 'yank)) - (run-with-timer 0.01 nil `(lambda () (insert-for-yank ,str))) + (insert-for-yank str) ;; from `yank-pop' (let ((inhibit-read-only t) (before (< (point) (mark t)))) @@ -118,7 +118,7 @@ replace with STR as yanked string." (funcall (or yank-undo-function 'delete-region) (mark t) (point))) (setq yank-undo-function nil) (set-marker (mark-marker) (point) helm-current-buffer) - (run-with-timer 0.01 nil `(lambda () (insert-for-yank ,str))) + (insert-for-yank str) ;; Set the window start back where it was in the yank command, ;; if possible. (set-window-start (selected-window) yank-window-start t) @@ -130,8 +130,6 @@ replace with STR as yanked string." (set-marker (mark-marker) (point) helm-current-buffer)))))) (kill-new str))) - - ;;;; ;; DO NOT use these sources with other sources use @@ -167,7 +165,6 @@ replace with STR as yanked string." (helm-highlight-current-line)) :persistent-help "Show this line")) - ;;; Global-mark-ring (defvar helm-source-global-mark-ring (helm-build-sync-source "global-mark-ring" @@ -205,6 +202,42 @@ replace with STR as yanked string." collect gm into recip finally return recip)))) +(defun helm--push-mark (&optional location nomsg activate) + "[Internal] Don't use directly, use instead `helm-push-mark-mode'." + (unless (null (mark t)) + (setq mark-ring (cons (copy-marker (mark-marker)) mark-ring)) + (when (> (length mark-ring) mark-ring-max) + (move-marker (car (nthcdr mark-ring-max mark-ring)) nil) + (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil))) + (set-marker (mark-marker) (or location (point)) (current-buffer)) + ;; Now push the mark on the global mark ring. + (setq global-mark-ring (cons (copy-marker (mark-marker)) + ;; Avoid having multiple entries + ;; for same buffer in `global-mark-ring'. + (cl-loop with mb = (current-buffer) + for m in global-mark-ring + for nmb = (marker-buffer m) + unless (eq mb nmb) + collect m))) + (when (> (length global-mark-ring) global-mark-ring-max) + (move-marker (car (nthcdr global-mark-ring-max global-mark-ring)) nil) + (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil)) + (or nomsg executing-kbd-macro (> (minibuffer-depth) 0) + (message "Mark set")) + (when (or activate (not transient-mark-mode)) + (set-mark (mark t))) + nil) + +;;;###autoload +(define-minor-mode helm-push-mark-mode + "Provide an improved version of `push-mark'. +Modify the behavior of `push-mark' to update +the `global-mark-ring' after each new visit." + :group 'helm-ring + :global t + (if helm-push-mark-mode + (advice-add 'push-mark :override #'helm--push-mark) + (advice-remove 'push-mark #'helm--push-mark))) ;;;; ;;; Insert from register @@ -369,7 +402,7 @@ First call open the kill-ring browser, next calls move to next line." ;;;###autoload (defun helm-execute-kmacro () - "Keyboard macros with helm interface. + "Preconfigured helm for keyboard macros. Define your macros with `f3' and `f4'. See (info \"(emacs) Keyboard Macros\") for detailed infos. This command is useful when used with persistent action." diff --git a/emacs.d/elpa/helm-20150507.2215/helm-semantic.el b/emacs.d/elpa/helm-20150623.1310/helm-semantic.el similarity index 85% rename from emacs.d/elpa/helm-20150507.2215/helm-semantic.el rename to emacs.d/elpa/helm-20150623.1310/helm-semantic.el index 72ab49c..7fcdbee 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-semantic.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-semantic.el @@ -37,12 +37,25 @@ :group 'helm-semantic :type 'boolean) -(defcustom helm-semantic-display-style 'semantic-format-tag-summarize - "Function to present a semantic tag." +(defcustom helm-semantic-display-style + '((python-mode . semantic-format-tag-summarize) + (c-mode . semantic-format-tag-concise-prototype-c-mode) + (emacs-lisp-mode . semantic-format-tag-abbreviate-emacs-lisp-mode)) + "Function to present a semantic tag according to `major-mode'. + +It is an alist where the `car' of each element is a `major-mode' and +the `cdr' a `semantic-format-tag-*' function. + +If no function is found for current `major-mode', fall back to +`semantic-format-tag-summarize' default function. + +You can have more or less informations depending of the `semantic-format-tag-*' +function you choose. + +All the supported functions are prefixed with \"semantic-format-tag-\", +you have completion on these functions with `C-M i' in the customize interface." :group 'helm-semantic - :type '(radio - (const :tag "Default" semantic-format-tag-summarize) - (const :tag "Prototype" semantic-format-tag-prototype))) + :type '(alist :key-type symbol :value-type symbol)) ;;; keymap (defvar helm-semantic-map @@ -59,7 +72,10 @@ (defun helm-semantic--fetch-candidates (tags depth &optional class) "Write the contents of TAGS to the current buffer." - (let ((class class) cur-type) + (let ((class class) cur-type + (stylefn (or (with-helm-current-buffer + (assoc-default major-mode helm-semantic-display-style)) + #'semantic-format-tag-summarize))) (cl-dolist (tag tags) (when (listp tag) (cl-case (setq cur-type (semantic-tag-class tag)) @@ -74,7 +90,7 @@ spaces (if (< depth 2) "" "├►") class) spaces) ;; Save the tag for later - (propertize (funcall helm-semantic-display-style tag nil t) + (propertize (funcall stylefn tag nil t) 'semantic-tag tag) "\n") (and type-p (setq class (car tag))) @@ -86,7 +102,7 @@ ;; Don't do anything with packages or includes for now ((package include) (insert - (propertize (funcall helm-semantic-display-style tag nil t) + (propertize (funcall stylefn tag nil t) 'semantic-tag tag) "\n") ) @@ -108,10 +124,8 @@ (defun helm-semantic--maybe-set-needs-update () (with-helm-current-buffer - (let ((tick (buffer-modified-tick))) - (unless (eq helm-cached-imenu-tick tick) - (setq helm-cached-imenu-tick tick) - (semantic-parse-tree-set-needs-update))))) + (when (semantic-parse-tree-needs-update-p) + (semantic-parse-tree-set-needs-update)))) (defvar helm-source-semantic nil) @@ -163,7 +177,7 @@ If ARG is supplied, pre-select symbol at point instead of current" ;;;###autoload (defun helm-semantic-or-imenu (arg) - "Run `helm' with `semantic' or `imenu'. + "Preconfigured helm for `semantic' or `imenu'. If ARG is supplied, pre-select symbol at point instead of current semantic tag in scope. diff --git a/emacs.d/elpa/helm-20150507.2215/helm-source.el b/emacs.d/elpa/helm-20150623.1310/helm-source.el similarity index 95% rename from emacs.d/elpa/helm-20150507.2215/helm-source.el rename to emacs.d/elpa/helm-20150623.1310/helm-source.el index a55e127..c983991 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-source.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-source.el @@ -172,7 +172,8 @@ :documentation " A string to explain persistent-action of this source. It also accepts a function or a variable name. - It will be displayed in source header.") + It will be displayed in `header-line'. + Have no effect when `helm-echo-input-in-header-line' is non--nil.") (help-message :initarg :help-message @@ -410,14 +411,7 @@ :custom boolean :documentation " Allow helm collecting duplicates candidates.") - - (recenter - :initarg :recenter - :initform nil - :custom boolean - :documentation - " `recenter' after jumping to candidate.") - + (history :initarg :history :initform nil @@ -454,6 +448,7 @@ :custom (choice string function) :documentation " Source local `header-line-format'. + Have no effect when `helm-echo-input-in-header-line' is non--nil. It accepts also variable/function name.") (resume @@ -712,27 +707,32 @@ like `re-search-forward', see below documentation of :search slot.") (set-slot-value source 'action (helm-make-actions - "Find file" 'helm-find-many-files - "Find file as root" 'helm-find-file-as-root - "Find file other window" 'find-file-other-window - "Find file other frame" 'find-file-other-frame - "Open dired in file's directory" 'helm-open-dired - "Grep File(s) `C-u recurse'" 'helm-find-files-grep - "Zgrep File(s) `C-u Recurse'" 'helm-ff-zgrep - "Pdfgrep File(s)" 'helm-ff-pdfgrep - "Insert as org link" 'helm-files-insert-as-org-link - "Checksum File" 'helm-ff-checksum - "Ediff File" 'helm-find-files-ediff-files - "Ediff Merge File" 'helm-find-files-ediff-merge-files + "Find file" 'helm-find-many-files + "Find file as root" 'helm-find-file-as-root + "Find file other window" 'find-file-other-window + "Find file other frame" 'find-file-other-frame + "Open dired in file's directory" 'helm-open-dired + "Grep File(s) `C-u recurse'" 'helm-find-files-grep + "Zgrep File(s) `C-u Recurse'" 'helm-ff-zgrep + "Pdfgrep File(s)" 'helm-ff-pdfgrep + "Insert as org link" 'helm-files-insert-as-org-link + "Checksum File" 'helm-ff-checksum + "Ediff File" 'helm-find-files-ediff-files + "Ediff Merge File" 'helm-find-files-ediff-merge-files "Etags `M-., C-u tap, C-u C-u reload tag file'" 'helm-ff-etags-select - "View file" 'view-file - "Insert file" 'insert-file - "Add marked files to file-cache" 'helm-ff-cache-add-file - "Delete file(s)" 'helm-delete-marked-files - "Open file externally (C-u to choose)" 'helm-open-file-externally - "Open file with default tool" 'helm-open-file-with-default-tool - "Find file in hex dump" 'hexl-find-file)) + "View file" 'view-file + "Insert file" 'insert-file + "Add marked files to file-cache" 'helm-ff-cache-add-file + "Delete file(s)" 'helm-delete-marked-files + "Copy file(s) `M-C, C-u to follow'" 'helm-find-files-copy + "Rename file(s) `M-R, C-u to follow'" 'helm-find-files-rename + "Symlink files(s) `M-S, C-u to follow'" 'helm-find-files-symlink + "Relsymlink file(s) `C-u to follow'" 'helm-find-files-relsymlink + "Hardlink file(s) `M-H, C-u to follow'" 'helm-find-files-hardlink + "Open file externally (C-u to choose)" 'helm-open-file-externally + "Open file with default tool" 'helm-open-file-with-default-tool + "Find file in hex dump" 'hexl-find-file)) (set-slot-value source 'persistent-help "Show this file") (set-slot-value source 'action-transformer '(helm-transform-file-load-el helm-transform-file-browse-url @@ -943,9 +943,9 @@ an eieio class." (helm-append-at-nth actions (quote ,new-action) ,index)) (t actions))))) - (when (symbolp actions) + (when (or (symbolp actions) (functionp actions)) (set-slot-value source 'action (list (cons "Default action" actions)))) - (when (symbolp action-transformers) + (when (or (symbolp action-transformers) (functionp action-transformers)) (setq action-transformers (list action-transformers))) (set-slot-value source diff --git a/emacs.d/elpa/helm-20150507.2215/helm-sys.el b/emacs.d/elpa/helm-20150623.1310/helm-sys.el similarity index 99% rename from emacs.d/elpa/helm-20150507.2215/helm-sys.el rename to emacs.d/elpa/helm-20150623.1310/helm-sys.el index 2c3ce07..86d1a7a 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-sys.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-sys.el @@ -284,6 +284,7 @@ Show actions only on line starting by a PID." ;;;###autoload (defun helm-xrandr-set () + "Preconfigured helm for xrandr." (interactive) (helm :sources 'helm-source-xrandr-change-resolution :buffer "*helm xrandr*")) diff --git a/emacs.d/elpa/helm-20150507.2215/helm-tags.el b/emacs.d/elpa/helm-20150623.1310/helm-tags.el similarity index 100% rename from emacs.d/elpa/helm-20150507.2215/helm-tags.el rename to emacs.d/elpa/helm-20150623.1310/helm-tags.el diff --git a/emacs.d/elpa/helm-20150507.2215/helm-utils.el b/emacs.d/elpa/helm-20150623.1310/helm-utils.el similarity index 96% rename from emacs.d/elpa/helm-20150507.2215/helm-utils.el rename to emacs.d/elpa/helm-20150623.1310/helm-utils.el index 6e5853a..9f76469 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm-utils.el +++ b/emacs.d/elpa/helm-20150623.1310/helm-utils.el @@ -35,10 +35,13 @@ :type 'string :group 'helm-utils) -(defcustom helm-yank-symbol-first nil - "`helm-yank-text-at-point' yanks symbol at point on first -invocation if this is non-nil." - :type 'boolean +(defcustom helm-yank-text-at-point-function nil + "The function used to forward point with `helm-yank-text-at-point'. +With a nil value, fallback to default `forward-word'. +The function should take one arg, an integer like `forward-word'. +NOTE: Using `forward-symbol' here is not very useful as it is already +provided by \\\\[next-history-element]." + :type 'function :group 'helm-utils) (defcustom helm-default-kbsize 1024.0 @@ -66,7 +69,13 @@ It is a float, usually 1024.0 but could be 1000.0 on some systems." (defvar helm-goto-line-before-hook '(helm-save-current-pos-to-mark-ring) "Run before jumping to line. This hook run when jumping from `helm-goto-line', `helm-etags-default-action', -and `helm-imenu-default-action'.") +and `helm-imenu-default-action'. +This allow you to retrieve a previous position after using the different helm +tools for searching (etags, grep, gid, (m)occur etc...). +By default positions are added to `mark-ring' you can also add to register +by using instead (or adding) `helm-save-pos-to-register-before-jump'. +In this case last position is added to the register +`helm-save-pos-before-jump-register'.") (defvar helm-save-pos-before-jump-register ?_ "The register where `helm-save-pos-to-register-before-jump' save position.") @@ -311,28 +320,6 @@ Default is `eq'." finally return (cl-loop for i being the hash-values in cont collect i))) -(defun helm-remove-if-not-match (regexp seq) - "Remove all elements of SEQ that don't match REGEXP." - (cl-loop for s in seq - for str = (cond ((symbolp s) - (symbol-name s)) - ((consp s) - (car s)) - (t s)) - when (string-match-p regexp str) - collect s)) - -(defun helm-remove-if-match (regexp seq) - "Remove all elements of SEQ that match REGEXP." - (cl-loop for s in seq - for str = (cond ((symbolp s) - (symbol-name s)) - ((consp s) - (car s)) - (t s)) - unless (string-match-p regexp str) - collect s)) - (defun helm-handle-winner-boring-buffers () "Add `helm-buffer' to `winner-boring-buffers' when quitting/exiting helm. Add this function to `helm-cleanup-hook' when you don't want to see helm buffers @@ -691,7 +678,7 @@ Useful in dired buffers when there is inserted subdirs." (catch 'empty-line (cl-loop with ov for r in (helm-remove-if-match - "\\`!" (split-string helm-pattern)) + "\\`!" (split-string helm-input)) do (save-excursion (goto-char start-match) (while (condition-case _err @@ -811,8 +798,7 @@ If `helm-yank-symbol-first' is non--nil the first yank grabs the entire symbol." (interactive) (with-helm-current-buffer - (let ((fwd-fn (if helm-yank-symbol-first - 'forward-symbol 'forward-word))) + (let ((fwd-fn (or helm-yank-text-at-point-function #'forward-word))) ;; Start to initial point if C-w have never been hit. (unless helm-yank-point (setq helm-yank-point (point))) (save-excursion diff --git a/emacs.d/elpa/helm-20150507.2215/helm.el b/emacs.d/elpa/helm-20150623.1310/helm.el similarity index 93% rename from emacs.d/elpa/helm-20150507.2215/helm.el rename to emacs.d/elpa/helm-20150623.1310/helm.el index 9e3cb0c..e5d3a83 100644 --- a/emacs.d/elpa/helm-20150507.2215/helm.el +++ b/emacs.d/elpa/helm-20150623.1310/helm.el @@ -34,7 +34,13 @@ (defmacro helm-with-gensyms (symbols &rest body) "Bind the SYMBOLS to fresh uninterned symbols and eval BODY." (declare (indent 1)) - `(let ,(mapcar (lambda (s) `(,s (make-symbol (concat "--" (symbol-name ',s))))) + `(let ,(mapcar (lambda (s) + ;; Use cl-gensym here instead of make-symbol + ;; to ensure a symbol that have a live that go + ;; beyond the live of its macro have different name. + ;; i.e symbols created with `with-helm-temp-hook' + ;; should have random names. + `(,s (cl-gensym (symbol-name ',s)))) symbols) ,@body)) @@ -431,13 +437,13 @@ will reuse the same window scheme than the one of last session unless (defcustom helm-split-window-default-side 'below "The default side to display `helm-buffer'. Must be one acceptable arg for `split-window' SIDE, -that is 'below, 'above, 'left or 'right. +that is `below', `above', `left' or `right'. -Other acceptable values are 'same which always display `helm-buffer' -in current window and 'other that display `helm-buffer' below if only one +Other acceptable values are `same' which always display `helm-buffer' +in current window and `other' that display `helm-buffer' below if only one window or in `other-window-for-scrolling' if available. -A nil value as same effect as 'below. +A nil value as same effect as `below'. If `helm-full-frame' is non--nil, it take precedence on this. See also `helm-split-window-in-side-p' and `helm-always-two-windows' that @@ -461,17 +467,26 @@ NOTE: this have no effect if `helm-split-window-preferred-function' is not "When non--nil helm will use two windows in this frame. That is one window to display `helm-buffer' and one to display `helm-current-buffer'. + Note: this have no effect when `helm-split-window-in-side-p' is non--nil, or when `helm-split-window-default-side' is set to 'same. + When `helm-autoresize-mode' is enabled, setting this to nil -will have no effect until this mode will be disabled." +will have no effect. + +Also when non-nil it overhides the effect of `helm-split-window-default-side' +set to `other'." :group 'helm :type 'boolean) (defcustom helm-sources-using-default-as-input '(helm-source-imenu + helm-source-imenu-all helm-source-info-elisp - helm-source-etags-select) - "List of helm sources that need to use `helm-maybe-use-default-as-input'. + helm-source-etags-select + helm-source-man-pages + helm-source-occur + helm-source-moccur) + "List of helm sources that need to use `helm--maybe-use-default-as-input'. When a source is member of this list, default `thing-at-point' will be used as input." :group 'helm @@ -497,12 +512,6 @@ you want this mode enabled definitely." :group 'helm :type 'boolean) -(defcustom helm-truncate-lines nil - "Truncate long lines when non--nil. -See `truncate-lines'." - :group 'helm - :type 'boolean) - (defcustom helm-move-to-line-cycle-in-source nil "Move to end or beginning of source when reaching top or bottom of source. This happen when using `helm-next/previous-line'." @@ -576,6 +585,12 @@ The default is to enable this by default, the user can toggle the current input method with `toggle-input-method'." :group 'helm :type 'boolean) + +(defcustom helm-echo-input-in-header-line nil + "Send current input in header-line." + :group 'helm + :type 'boolean) + ;;; Faces ;; @@ -689,9 +704,8 @@ can be set here with `helm-set-local-variable'.") (defvar helm-after-initialize-hook nil "Run after helm initialization. -This hook run inside `helm-buffer' once created. -Variables are initialized and the `helm-buffer' is created. -But the `helm-buffer' has no contents.") +This hook run after `helm-buffer' is created but not from `helm-buffer' +so the hook have to specify in which buffer it should run.") (defvar helm-update-hook nil "Run after the helm buffer was updated according the new input pattern. @@ -750,11 +764,6 @@ and before performing action.") "Quit when there is no candidates when non--nil. This variable accepts a function, which is executed if no candidate.") -(defvar helm-maybe-use-default-as-input nil - "Use :default arg of `helm' as input to update display. -Note that if also :input is specified as `helm' arg, it will take -precedence on :default.") - (defvar helm-source-in-each-line-flag nil "Non-nil means add helm-source text-property in each candidate. experimental feature.") @@ -787,6 +796,23 @@ first arg is a string that will be used as name for candidates number, second arg any string to display in mode line. If nil, use default `mode-line-format'.") +(defvar helm-minibuffer-set-up-hook nil + "Hook that run at initialization of minibuffer. +Useful for modifying the settings of minibuffer in helm. + +Here an example to hide minibuffer when using +`helm-echo-input-in-header-line': + + (add-hook 'helm-minibuffer-set-up-hook + (lambda () + (when (with-helm-buffer helm-echo-input-in-header-line) + (text-scale-set -12) + (window--resize-mini-window + (selected-window) -15)))) + +Note that we check `helm-echo-input-in-header-line' value +from `helm-buffer' which allow detecting possible local +value of this var.") ;;; Internal Variables ;; @@ -876,6 +902,17 @@ when `helm' is keyboard-quitted.") (defvar helm--reading-passwd-or-string nil) (defvar helm--in-update nil) (defvar helm--in-fuzzy nil) +(defvar helm--maybe-use-default-as-input nil + "Flag to notify the use of use-default-as-input. +Use only in let-bindings. +Use :default arg of `helm' as input to update display. +Note that if also :input is specified as `helm' arg, it will take +precedence on :default.") +(defvar helm--temp-hooks nil + "Store temporary hooks added by `with-helm-temp-hook'.") +(defvar helm-truncate-lines nil + "[Internal] Don't set this globally, it is used as a local var.") + ;; Utility: logging (defun helm-log (format-string &rest args) @@ -1102,13 +1139,15 @@ not `exit-minibuffer' or unwanted functions." (defmacro with-helm-temp-hook (hook &rest body) "Execute temporarily BODY as a function for HOOK." (declare (indent 1) (debug t)) - (helm-with-gensyms (fun) + (helm-with-gensyms (helm--hook) `(progn - (defun ,fun () + (defun ,helm--hook () (unwind-protect (progn ,@body) - (remove-hook ,hook (quote ,fun)))) - (add-hook ,hook (quote ,fun))))) + (remove-hook ,hook (quote ,helm--hook)) + (fmakunbound (quote ,helm--hook)))) + (push (cons ',helm--hook ,hook) helm--temp-hooks) + (add-hook ,hook (quote ,helm--hook))))) (defmacro with-helm-after-update-hook (&rest body) "Execute BODY at end of `helm-update'." @@ -1255,9 +1294,9 @@ only when predicate helm-ff-candidates-lisp-p return non--nil: (helm-append-at-nth actions (quote ,new-action) ,index)) (t actions))))) - (when (symbolp actions) + (when (or (symbolp actions) (functionp actions)) (helm-attrset 'action (list (cons "Default action" actions)) source)) - (when (symbolp action-transformers) + (when (or (symbolp action-transformers) (functionp action-transformers)) (setq action-transformers (list action-transformers))) (if test-only ; debug (delq nil (append (list transformer) action-transformers)) @@ -1389,7 +1428,19 @@ of \(action-display . function\)." (helm-aif (helm-attr 'action-transformer) (helm-composed-funcall-with-source (helm-get-current-source) it - (helm-attr 'action) (helm-get-selection)) + (helm-attr 'action) + ;; Check if the first given transformer + ;; returns the same set of actions for each + ;; candidate in marked candidates. + ;; If so use the car of marked to determine + ;; the set of actions, otherwise use the selection. + (if (cl-loop with marked = (helm-marked-candidates) + with act = (car (helm-mklist it)) + with acts = (funcall act nil (car marked)) + for c in marked + always (equal (funcall act nil c) acts)) + (car (helm-marked-candidates)) + (helm-get-selection))) (helm-attr 'action)))) (defun helm-get-current-source () @@ -1493,17 +1544,26 @@ Otherwise, return VALUE itself." (defun helm-set-local-variable (&rest args) "Bind each pair in ARGS locally to `helm-buffer'. + Use this to set local vars before calling helm. + +When used from an init or update function +(i.e when `helm-force-update' is running) the variables are set +using `make-local-variable' within the `helm-buffer'. + Usage: helm-set-local-variable ([VAR VALUE]...) Just like `setq' except that the vars are not set sequentially. -IOW Don't use VALUE of previous VAR to eval the VALUE of next VAR. -When helm is alive use `make-local-variable' as usual on `helm-buffer'. +IOW Don't use VALUE of previous VAR to set the VALUE of next VAR. \(fn VAR VALUE ...)" - (setq helm--local-variables - (append (cl-loop for i on args by #'cddr - collect (cons (car i) (cadr i))) - helm--local-variables))) + (if helm-force-updating-p + (with-helm-buffer + (cl-loop for i on args by #'cddr + do (set (make-local-variable (car i)) (cadr i)))) + (setq helm--local-variables + (append (cl-loop for i on args by #'cddr + collect (cons (car i) (cadr i))) + helm--local-variables)))) (defun helm-make-actions (&rest args) "Build an alist with (NAME . ACTION) elements with each pairs in ARGS. @@ -1679,6 +1739,27 @@ This is used in transformers to modify candidates list." str-or-sym (intern str-or-sym))) +(defun helm-remove-if-not-match (regexp seq) + "Remove all elements of SEQ that don't match REGEXP." + (cl-loop for s in seq + for str = (cond ((symbolp s) + (symbol-name s)) + ((consp s) + (car s)) + (t s)) + when (string-match-p regexp str) + collect s)) + +(defun helm-remove-if-match (regexp seq) + "Remove all elements of SEQ that match REGEXP." + (cl-loop for s in seq + for str = (cond ((symbolp s) + (symbol-name s)) + ((consp s) + (car s)) + (t s)) + unless (string-match-p regexp str) + collect s)) ;; Core: entry point ;; `:allow-nest' is not in this list because it is treated before. @@ -1743,7 +1824,7 @@ Initially selected candidate. Specified by exact candidate or a regexp. A default argument that will be inserted in minibuffer \ with \\\\[next-history-element]. When nil or not present `thing-at-point' will be used instead. -If `helm-maybe-use-default-as-input' is non--nil display will be +If `helm--maybe-use-default-as-input' is non--nil display will be updated using :default arg as input unless :input is specified, which in this case will take precedence on :default This is a string or a list, in this case the car of the list will @@ -1850,6 +1931,7 @@ in source. unless (memq key helm-argument-keys) collect (cons sym value))) +(defvar helm--prompt nil) ;;; Core: entry point helper (defun helm-internal (&optional any-sources any-input @@ -1873,11 +1955,12 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'." (helm-log "any-keymap = %S" any-keymap) (helm-log "any-default = %S" any-default) (helm-log "any-history = %S" any-history) + (setq helm--prompt (or any-prompt "pattern: ")) (let ((non-essential t) (input-method-verbose-flag helm-input-method-verbose-flag) (old--cua cua-mode) - (helm-maybe-use-default-as-input - (or helm-maybe-use-default-as-input ; it is let-bounded so use it. + (helm--maybe-use-default-as-input + (or helm--maybe-use-default-as-input ; it is let-bounded so use it. (cl-loop for s in (helm-normalize-sources any-sources) thereis (memq s helm-sources-using-default-as-input))))) ;; cua-mode overhide local helm bindings. @@ -1899,6 +1982,7 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'." (when helm-prevent-escaping-from-minibuffer (helm--remap-mouse-mode 1)) ; Disable mouse bindings. (add-hook 'post-command-hook 'helm--maybe-update-keymap) + (add-hook 'post-command-hook 'helm--update-header-line) (helm-log "show prompt") (unwind-protect (helm-read-pattern-maybe @@ -1913,6 +1997,7 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'." (helm-log (concat "[End session (quit)] " (make-string 34 ?-))) nil)) (remove-hook 'post-command-hook 'helm--maybe-update-keymap) + (remove-hook 'post-command-hook 'helm--update-header-line) (if (fboundp 'advice-add) (progn (advice-remove 'tramp-read-passwd @@ -2050,14 +2135,18 @@ Argument SAVE-OR-RESTORE is one of save or restore." (helm-log "Save position at %S" (cons (point) (window-start))) (setq helm-current-position (cons (point) (window-start)))) (restore - (helm-log "Restore position at %S in buffer %s" - helm-current-position - (buffer-name (current-buffer))) - (goto-char (car helm-current-position)) - ;; Fix this position with the NOFORCE arg of `set-window-start' - ;; otherwise, if there is some other buffer than `helm-current-buffer' - ;; one, position will be lost. - (set-window-start (selected-window) (cdr helm-current-position) t)))) + ;; Maybe `helm-current-buffer' have been deleted + ;; during helm session so check if it is here + ;; otherwise position in underlaying buffer will be lost. + (when (get-buffer-window helm-current-buffer 'visible) + (helm-log "Restore position at %S in buffer %s" + helm-current-position + (buffer-name (current-buffer))) + (goto-char (car helm-current-position)) + ;; Fix this position with the NOFORCE arg of `set-window-start' + ;; otherwise, if there is some other buffer than `helm-current-buffer' + ;; one, position will be lost. + (set-window-start (selected-window) (cdr helm-current-position) t))))) (defun helm-frame-or-window-configuration (save-or-restore) @@ -2160,7 +2249,12 @@ It uses `switch-to-buffer' or `pop-to-buffer' depending of value of (and (eq helm-split-window-default-side 'same) (one-window-p t))) (progn (delete-other-windows) (switch-to-buffer buffer)) - (when (and (or helm-always-two-windows helm-autoresize-mode) + (when (and (or helm-always-two-windows helm-autoresize-mode + (and (not helm-split-window-in-side-p) + (eq (save-selected-window + (funcall helm-split-window-preferred-function + (selected-window))) + (get-buffer-window helm-current-buffer)))) (not (eq helm-split-window-default-side 'same)) (not (minibufferp helm-current-buffer)) (not helm-split-window-in-side-p)) @@ -2282,7 +2376,7 @@ It is intended to use this only in `helm-initial-setup'." (member (assoc-default 'name s) helm-source-filter)) (helm-get-sources)))) - (setq helm-pattern (or (and helm-maybe-use-default-as-input + (setq helm-pattern (or (and helm--maybe-use-default-as-input (or (if (listp any-default) (car any-default) any-default) (with-helm-current-buffer @@ -2338,6 +2432,10 @@ Please don't use it. :keymap (and helm-alive-p helm-map) (unless helm-alive-p (setq helm--minor-mode nil))) +(defun helm--reset-default-pattern () + (setq helm-pattern "") + (setq helm--maybe-use-default-as-input nil)) + (defun helm-read-pattern-maybe (any-prompt any-input any-preselect any-resume any-keymap any-default any-history) @@ -2348,7 +2446,7 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." ;; or contain non--candidate lines (e.g grep exit status) (helm-get-current-source)) (helm-mark-current-line t) - (helm-update any-preselect)) + (helm-update any-preselect)) (with-current-buffer (helm-buffer-get) (let* ((src (helm-get-current-source)) (src-keymap (assoc-default 'keymap src)) @@ -2358,18 +2456,13 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." (timer nil) blink-matching-paren (first-src (car helm-sources)) + (first-src-val (if (symbolp first-src) + (symbol-value first-src) + first-src)) + (source-process-p (or (assq 'candidates-process src) + (assq 'candidates-process first-src-val))) (source-delayed-p (or (assq 'delayed src) - (assq 'delayed (if (symbolp first-src) - (symbol-value first-src) - first-src))))) - ;; Startup with the first keymap found either in current source - ;; or helm arg, otherwise use global value of `helm-map'. - ;; This map will be used as a `minibuffer-local-map'. - ;; Maybe it will be overriden when changing source - ;; by `helm--maybe-update-keymap'. - ;; Note that helm-map have been made buffer-local - ;; in `helm-create-helm-buffer'. - (setq helm-map (or src-keymap any-keymap helm-map)) + (assq 'delayed first-src-val)))) (helm-log "helm-get-candidate-number => %S" (helm-get-candidate-number)) (helm-log "helm-execute-action-at-once-if-one = %S" @@ -2387,11 +2480,21 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." ;; display if no result found with precedent value of `helm-pattern' ;; unless `helm-quit-if-no-candidate' is non--nil, in this case ;; Don't force update with an empty pattern. - ;; Reset also `helm-maybe-use-default-as-input' as this checking + ;; Reset also `helm--maybe-use-default-as-input' as this checking ;; happen only on startup. - (when (and helm-maybe-use-default-as-input (not source-delayed-p)) - (setq helm-pattern "") - (setq helm-maybe-use-default-as-input nil) + (when helm--maybe-use-default-as-input + ;; Store value of `default' temporarily here waiting next update + ;; to allow actions like helm-moccur-action matching pattern + ;; at the place it jump to. + (setq helm-input helm-pattern) + (if (or source-delayed-p source-process-p) + ;; Reset pattern to next update. + (with-helm-after-update-hook + (helm--reset-default-pattern)) + ;; Reset pattern right now. + (helm--reset-default-pattern)) + ;; Ensure force-update when no candidates + ;; when we start with an empty pattern. (and (helm-empty-buffer-p) (null helm-quit-if-no-candidate) (helm-force-update))) @@ -2400,14 +2503,14 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." (cond ((and helm-execute-action-at-once-if-one (not source-delayed-p) (= (helm-get-candidate-number) 1)) - (ignore)) ; Don't enter the minibuffer loop. + (ignore)) ; Don't enter the minibuffer loop. ((and helm-quit-if-no-candidate (not source-delayed-p) (= (helm-get-candidate-number) 0)) (setq helm-quit t) (and (functionp helm-quit-if-no-candidate) (funcall helm-quit-if-no-candidate))) - (t ; Enter now minibuffer and wait for input. + (t ; Enter now minibuffer and wait for input. (let ((tap (or any-default (with-helm-current-buffer (thing-at-point 'symbol))))) @@ -2416,25 +2519,31 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'." #'(lambda () ;; Start minor-mode with global value of helm-map. (helm--minor-mode 1) - ;; Now overhide the global value of helm-map with - ;; the local one. - (setq minor-mode-overriding-map-alist - `((helm--minor-mode - . ,(with-helm-buffer helm-map)))) - (setq timer (run-with-idle-timer - (max helm-input-idle-delay 0.001) 'repeat - #'(lambda () - ;; Stop updating when in persistent action - ;; or when `helm-suspend-update-flag' is - ;; non--nil. - (unless (or helm-in-persistent-action - helm-suspend-update-flag) - (save-selected-window - (helm-check-minibuffer-input) - (helm-print-error-messages))))))) + ;; Now overhide the global value of `helm-map' with + ;; the local one which is in this order: + ;; - The keymap of current source. + ;; - The value passed in ANY-KEYMAP + ;; which will become buffer local. + ;; - Or fallback to the global value of helm-map. + (helm--maybe-update-keymap + (or src-keymap any-keymap helm-map)) + (helm-log-run-hook 'helm-minibuffer-set-up-hook) + (setq timer + (run-with-idle-timer + (max helm-input-idle-delay 0.001) 'repeat + #'(lambda () + ;; Stop updating in persistent action + ;; or when `helm-suspend-update-flag' + ;; is non--nil. + (unless (or helm-in-persistent-action + helm-suspend-update-flag) + (save-selected-window + (helm-check-minibuffer-input) + (helm-print-error-messages))))))) (read-from-minibuffer (or any-prompt "pattern: ") any-input helm-map - nil hist tap helm-inherit-input-method)) + nil hist tap + helm-inherit-input-method)) (when timer (cancel-timer timer) (setq timer nil))))))))) (defun helm-exit-or-quit-maybe () @@ -2509,13 +2618,13 @@ This can be useful for e.g writing quietly a complex regexp." (setq helm--reading-passwd-or-string nil) (setq helm-suspend-update-flag nil))) -(defun helm--maybe-update-keymap () +(defun helm--maybe-update-keymap (&optional map) "Handle differents keymaps in multiples sources. It will override `helm-map' with the local map of current source. If no map is found in current source do nothing (keep previous map)." (with-helm-buffer - (helm-aif (assoc-default 'keymap (helm-get-current-source)) + (helm-aif (or map (assoc-default 'keymap (helm-get-current-source))) ;; We need the timer to leave enough time ;; to helm to setup its buffer when changing source ;; from a recursive minibuffer. @@ -2561,6 +2670,12 @@ WARNING: Do not use this mode yourself, it is internal to helm." ;; Be sure we call this from helm-buffer. (helm-funcall-foreach 'cleanup)) (helm-kill-async-processes) + ;; Remove the temporary hooks added + ;; by `with-helm-temp-hook' that + ;; may not have been consumed. + (when helm--temp-hooks + (cl-loop for (fn . hook) in helm--temp-hooks + do (set hook (delete fn (symbol-value hook))))) ;; When running helm from a dedicated frame ;; with no minibuffer, helm will run in the main frame ;; which have a minibuffer, so be sure to disable @@ -2601,15 +2716,12 @@ WARNING: Do not use this mode yourself, it is internal to helm." "Check INPUT string and update the helm buffer if necessary." ;; First time minibuffer is entered ;; we check value of `helm-pattern' that have been set - ;; in `helm-initial-setup' when `helm-maybe-use-default-as-input' + ;; in `helm-initial-setup' when `helm--maybe-use-default-as-input' ;; is non--nil. After this initial check, reset - ;; `helm-maybe-use-default-as-input' and ignore this. + ;; `helm--maybe-use-default-as-input' and ignore this. ;; This happen only when source is `delayed'. - (when helm-maybe-use-default-as-input ; nil when non--delayed. - (setq input helm-pattern) - (with-helm-after-update-hook (setq helm-pattern "")) - (setq helm-maybe-use-default-as-input nil)) - ;; In delayed sources `helm-pattern' have not been resat yet. + (when helm--maybe-use-default-as-input ; nil when non--delayed. + (setq input helm-pattern)) (unless (equal input helm-pattern) (setq helm-pattern input) (unless (helm-action-window) @@ -2753,7 +2865,8 @@ ARGS is (cand1 cand2 ...) or ((disp1 . real1) (disp2 . real2) ...) (if (and (listp it) (not (functionp it))) ;; Don't treat lambda's as list. (cl-loop for f in it - do (setq ,candidate (funcall f ,candidate))) + do (setq ,candidate (funcall f ,candidate)) + finally return ,candidate) (setq ,candidate (funcall it ,candidate))))) (defun helm--initialize-one-by-one-candidates (candidates source) @@ -2761,9 +2874,8 @@ ARGS is (cand1 cand2 ...) or ((disp1 . real1) (disp2 . real2) ...) Return CANDIDATES when pattern is empty." (helm-aif (and (string= helm-pattern "") (assoc-default 'filter-one-by-one source)) - (cl-loop for cand in candidates - do (helm--maybe-process-filter-one-by-one-candidate cand source) - collect cand) + (cl-loop for cand in candidates collect + (helm--maybe-process-filter-one-by-one-candidate cand source)) candidates)) (defun helm-process-filtered-candidate-transformer-maybe @@ -3585,29 +3697,30 @@ Coerce source with coerce function." "Select an action for the currently selected candidate. If action buffer is selected, back to the helm buffer." (interactive) - (helm-log-run-hook 'helm-select-action-hook) - (setq helm-saved-selection (helm-get-selection)) - (with-selected-frame (with-helm-window (selected-frame)) - (prog1 - (cond ((get-buffer-window helm-action-buffer 'visible) - (set-window-buffer (get-buffer-window helm-action-buffer) - helm-buffer) - (kill-buffer helm-action-buffer) - (helm-display-mode-line (helm-get-current-source)) - (helm-set-pattern helm-input 'noupdate)) - (helm-saved-selection - (setq helm-saved-current-source (helm-get-current-source)) - (let ((actions (helm-get-actions-from-current-source))) - (if (functionp actions) - (message "Sole action: %s" actions) - (helm-show-action-buffer actions) - ;; Be sure the minibuffer is entirely deleted (#907). - (helm--delete-minibuffer-contents-from "") - ;; Make `helm-pattern' differs from the previous value. - (setq helm-pattern 'dummy) - (helm-check-minibuffer-input)))) - (t (message "No Actions available"))) - (run-hooks 'helm-window-configuration-hook)))) + (let ((src (helm-get-current-source))) + (helm-log-run-hook 'helm-select-action-hook) + (setq helm-saved-selection (helm-get-selection)) + (with-selected-frame (with-helm-window (selected-frame)) + (prog1 + (cond ((get-buffer-window helm-action-buffer 'visible) + (set-window-buffer (get-buffer-window helm-action-buffer) + helm-buffer) + (kill-buffer helm-action-buffer) + (helm-set-pattern helm-input 'noupdate)) + (helm-saved-selection + (setq helm-saved-current-source src) + (let ((actions (helm-get-actions-from-current-source))) + (if (functionp actions) + (message "Sole action: %s" actions) + (helm-show-action-buffer actions) + ;; Be sure the minibuffer is entirely deleted (#907). + (helm--delete-minibuffer-contents-from "") + ;; Make `helm-pattern' differs from the previous value. + (setq helm-pattern 'dummy) + (helm-check-minibuffer-input)))) + (t (message "No Actions available"))) + (helm-display-mode-line src) + (run-hooks 'helm-window-configuration-hook))))) (defun helm-show-action-buffer (actions) (with-current-buffer (get-buffer-create helm-action-buffer) @@ -3698,16 +3811,49 @@ Possible value of DIRECTION are 'next or 'previous." helm-mode-line-string))) (setq mode-line-format (default-value 'mode-line-format))) ;; Setup header-line. - (when helm-display-header-line - (let* ((hlstr (helm-interpret-value - (and (listp source) - (assoc-default 'header-line source)) - source)) - (hlend (make-string (max 0 (- (window-width) (length hlstr))) ? ))) - (setq header-line-format - (propertize (concat " " hlstr hlend) 'face 'helm-header))))) + (cond (helm-echo-input-in-header-line + (setq force t) + (helm--set-header-line)) + (helm-display-header-line + (let* ((hlstr (helm-interpret-value + (and (listp source) + (assoc-default 'header-line source)) + source)) + (hlend (make-string (max 0 (- (window-width) (length hlstr))) ? ))) + (setq header-line-format + (propertize (concat " " hlstr hlend) 'face 'helm-header)))))) (when force (force-mode-line-update))) +(defun helm--set-header-line (&optional update) + (with-helm-window + (let* ((comp (with-current-buffer (window-buffer (minibuffer-window)) + (if (get-text-property (point) 'read-only) + "" (helm-minibuffer-completion-contents)))) + (prt (propertize helm--prompt 'face 'minibuffer-prompt)) + (pos (+ (length prt) (length comp)))) + (setq header-line-format + (concat (propertize " " 'display '(space :width left-fringe)) ; [1] + prt (substring-no-properties helm-pattern) " ")) + (condition-case _err + (put-text-property + ;; Increment pos to handle the spaces before prompt and at eol [1]. + (1+ pos) (+ pos 2) 'face 'cursor header-line-format) + (args-out-of-range nil))) + (when update (force-mode-line-update)))) + +(defun helm--update-header-line () + ;; This should be used in `post-command-hook', + ;; nowhere else. + (when (and (with-helm-buffer + helm-echo-input-in-header-line) + ;; Ensure we don't update when pattern + ;; is empty from post-command-hook, otherwise + ;; we loose default-as-input. + ;; This will be done after update + ;; in helm-display-mode-line. + (not (string= helm-pattern ""))) + (helm--set-header-line t))) + (defun helm-show-candidate-number (&optional name) "Used to display candidate number in mode-line. You can specify NAME of candidates e.g \"Buffers\" otherwise @@ -4188,6 +4334,16 @@ before the candidate we want to preselect." (helm-pos-header-line-p) (eobp))))) +(defun helm-beginning-of-source-p (&optional at-point) + "Return non--nil if we are at bob or beginning of source." + (save-excursion + (if (and (helm-pos-multiline-p) (null at-point)) + (null (helm-get-previous-candidate-separator-pos)) + (forward-line (if at-point 0 -1)) + (or (eq (point-at-bol) (point-at-eol)) + (helm-pos-header-line-p) + (bobp))))) + (defun helm-edit-current-selection-internal (func) (with-helm-window (forward-line 0) @@ -4403,6 +4559,7 @@ To customize `helm-candidates-in-buffer' behavior, use `search', (clrhash helm-cib-hash) (cl-dolist (searcher search-fns) (goto-char start-point) + (forward-line 1) ; >>>[1] (setq newmatches nil) (cl-loop with pos-lst with item-count = 0 @@ -4457,13 +4614,22 @@ When using fuzzy matching and negation (i.e \"!\"), this function is always call do (forward-line 1)))) (defun helm--search-from-candidate-buffer-1 (search-fn) - ;; Previously we were adding a newline at bob and at eol - ;; and removing these newlines afterward, it seems it is no more - ;; needed, thus when searching for empty line ("^$") - ;; it was adding the first line as a matched line - ;; which is wrong. + ;; We are adding a newline at bob and at eol + ;; and removing these newlines afterward. + ;; This is a bad hack that should be removed. + ;; To avoid matching the empty line at first line + ;; when searching with e.g occur and "^$" just + ;; forward-line before searching (See >>>[1] above). + (goto-char (point-min)) + (insert "\n") + (goto-char (point-max)) + (insert "\n") (unwind-protect (funcall search-fn) + (goto-char (point-min)) + (delete-char 1) + (goto-char (1- (point-max))) + (delete-char 1) (set-buffer-modified-p nil))) (defun helm-candidate-buffer (&optional create-or-buffer) diff --git a/emacs.d/elpa/helm-projectile-20150427.2348/helm-projectile-autoloads.el b/emacs.d/elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el similarity index 98% rename from emacs.d/elpa/helm-projectile-20150427.2348/helm-projectile-autoloads.el rename to emacs.d/elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el index fa29c1f..53b844d 100644 --- a/emacs.d/elpa/helm-projectile-20150427.2348/helm-projectile-autoloads.el +++ b/emacs.d/elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el @@ -3,8 +3,8 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "helm-projectile" "helm-projectile.el" (21837 -;;;;;; 24207 0 0)) +;;;### (autoloads nil "helm-projectile" "helm-projectile.el" (21898 +;;;;;; 47974 0 0)) ;;; Generated autoloads from helm-projectile.el (defvar helm-projectile-fuzzy-match t "\ diff --git a/emacs.d/elpa/helm-projectile-20150427.2348/helm-projectile-pkg.el b/emacs.d/elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el similarity index 72% rename from emacs.d/elpa/helm-projectile-20150427.2348/helm-projectile-pkg.el rename to emacs.d/elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el index fb30c47..f097838 100644 --- a/emacs.d/elpa/helm-projectile-20150427.2348/helm-projectile-pkg.el +++ b/emacs.d/elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el @@ -1 +1 @@ -(define-package "helm-projectile" "20150427.2348" "Helm integration for Projectile" '((helm "1.4.0") (projectile "0.12.0") (dash "1.5.0") (cl-lib "0.3")) :url "https://github.com/bbatsov/projectile" :keywords '("project" "convenience")) +(define-package "helm-projectile" "20150621.1322" "Helm integration for Projectile" '((helm "1.4.0") (projectile "0.12.0") (dash "1.5.0") (cl-lib "0.3")) :url "https://github.com/bbatsov/projectile" :keywords '("project" "convenience")) diff --git a/emacs.d/elpa/helm-projectile-20150427.2348/helm-projectile.el b/emacs.d/elpa/helm-projectile-20150621.1322/helm-projectile.el similarity index 97% rename from emacs.d/elpa/helm-projectile-20150427.2348/helm-projectile.el rename to emacs.d/elpa/helm-projectile-20150621.1322/helm-projectile.el index 7de8b85..fb51fce 100644 --- a/emacs.d/elpa/helm-projectile-20150427.2348/helm-projectile.el +++ b/emacs.d/elpa/helm-projectile-20150621.1322/helm-projectile.el @@ -4,7 +4,7 @@ ;; Author: Bozhidar Batsov ;; URL: https://github.com/bbatsov/projectile -;; Package-Version: 20150427.2348 +;; Package-Version: 20150621.1322 ;; Created: 2011-31-07 ;; Keywords: project, convenience ;; Version: 0.12.0 @@ -495,11 +495,15 @@ CANDIDATE is the selected file. Used when no file is explicitly marked." ("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-buffers-list-cache (projectile-project-buffer-names)) - (let ((result (cl-loop for b in helm-buffers-list-cache + (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))) @@ -511,7 +515,7 @@ CANDIDATE is the selected file. Used when no file is explicitly marked." ;; 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-buffers-list-cache) + (candidates :initform helm-projectile-buffers-list-cache) (matchplugin :initform nil) (match :initform 'helm-buffers-match-function) (persistent-action :initform 'helm-buffers-list-persistent-action) @@ -717,10 +721,10 @@ If it is nil, or ack/ack-grep not found then use default grep command." 'identity (-union (-map (lambda (path) (concat "--ignore-dir=" (file-name-nondirectory (directory-file-name path)))) - projectile-globally-ignored-directories) + (projectile-ignored-directories)) (-map (lambda (path) (concat "--ignore-file=match:" (shell-quote-argument path))) - projectile-globally-ignored-files)) " ")) + (projectile-ignored-files))) " ")) (helm-ack-grep-executable (cond ((executable-find "ack") "ack") ((executable-find "ack-grep") "ack-grep") @@ -733,12 +737,10 @@ If it is nil, or ack/ack-grep not found then use default grep command." (defun helm-projectile-ag (&optional options) "Helm version of projectile-ag." (interactive (if current-prefix-arg (list (read-string "option: " "" 'helm-ag-command-history)))) - (unless (executable-find "ag") - (error "ag not available")) (if (require 'helm-ag nil 'noerror) (if (projectile-project-p) - (let* ((grep-find-ignored-files (-union projectile-globally-ignored-files grep-find-ignored-files)) - (grep-find-ignored-directories (-union projectile-globally-ignored-directories grep-find-ignored-directories)) + (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) @@ -822,11 +824,8 @@ 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) - (src (if (projectile-project-p) - helm-projectile-sources-list - helm-source-projectile-projects))) - (helm :sources src + (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: " diff --git a/emacs.d/elpa/jedi-20150413.2208/jedi-autoloads.el b/emacs.d/elpa/jedi-20150623.2335/jedi-autoloads.el similarity index 94% rename from emacs.d/elpa/jedi-20150413.2208/jedi-autoloads.el rename to emacs.d/elpa/jedi-20150623.2335/jedi-autoloads.el index c8cbf0e..a402988 100644 --- a/emacs.d/elpa/jedi-20150413.2208/jedi-autoloads.el +++ b/emacs.d/elpa/jedi-20150623.2335/jedi-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "jedi" "jedi.el" (21837 24206 0 0)) +;;;### (autoloads nil "jedi" "jedi.el" (21898 47974 0 0)) ;;; Generated autoloads from jedi.el (autoload 'jedi:ac-setup "jedi" "\ diff --git a/emacs.d/elpa/jedi-20150413.2208/jedi-pkg.el b/emacs.d/elpa/jedi-20150623.2335/jedi-pkg.el similarity index 52% rename from emacs.d/elpa/jedi-20150413.2208/jedi-pkg.el rename to emacs.d/elpa/jedi-20150623.2335/jedi-pkg.el index aaec797..b296f88 100644 --- a/emacs.d/elpa/jedi-20150413.2208/jedi-pkg.el +++ b/emacs.d/elpa/jedi-20150623.2335/jedi-pkg.el @@ -1 +1 @@ -(define-package "jedi" "20150413.2208" "a Python auto-completion for Emacs" '((emacs "24") (jedi-core "0.2.2") (auto-complete "1.4"))) +(define-package "jedi" "20150623.2335" "a Python auto-completion for Emacs" '((emacs "24") (jedi-core "0.2.2") (auto-complete "1.4"))) diff --git a/emacs.d/elpa/jedi-20150413.2208/jedi.el b/emacs.d/elpa/jedi-20150623.2335/jedi.el similarity index 93% rename from emacs.d/elpa/jedi-20150413.2208/jedi.el rename to emacs.d/elpa/jedi-20150623.2335/jedi.el index 0c2a608..3ca2a28 100644 --- a/emacs.d/elpa/jedi-20150413.2208/jedi.el +++ b/emacs.d/elpa/jedi-20150623.2335/jedi.el @@ -4,8 +4,8 @@ ;; Author: Takafumi Arakaki ;; Package-Requires: ((emacs "24") (jedi-core "0.2.2") (auto-complete "1.4")) -;; Version: 0.2.3 -;; Package-Version: 20150413.2208 +;; Version: 0.2.5 +;; Package-Version: 20150623.2335 ;; 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 @@ -100,9 +100,10 @@ in their Emacs configuration." (if jedi:complete-on-dot (define-key map "." 'jedi:dot-complete) (define-key map "." nil))) - (if jedi-mode - (add-hook 'after-change-functions 'jedi:after-change-handler nil t) - (remove-hook 'after-change-functions 'jedi:after-change-handler t))) + (when jedi:install-imenu + (if jedi-mode + (add-hook 'after-change-functions 'jedi:after-change-handler nil t) + (remove-hook 'after-change-functions 'jedi:after-change-handler t)))) ;;;###autoload (setq jedi:setup-function #'jedi:ac-setup diff --git a/emacs.d/elpa/jedi-core-20150507.438/Makefile b/emacs.d/elpa/jedi-core-20150623.2335/Makefile similarity index 99% rename from emacs.d/elpa/jedi-core-20150507.438/Makefile rename to emacs.d/elpa/jedi-core-20150623.2335/Makefile index 2c44031..957e7a0 100644 --- a/emacs.d/elpa/jedi-core-20150507.438/Makefile +++ b/emacs.d/elpa/jedi-core-20150623.2335/Makefile @@ -87,7 +87,7 @@ print-deps: elpa env @echo "----------------------- Dependencies -----------------------" $(EMACS) --version ${VIRTUAL_EMACS} -batch -L . -l jedi.el -f jedi:print-jedi-version - ls -d $(ENV)/*/python*/site-packages/*egg-info + -ls -d $(ENV)/*/python*/site-packages/*egg-info @echo "------------------------------------------------------------" before-test: ${TEST_DEPS} diff --git a/emacs.d/elpa/jedi-core-20150507.438/jedi-core-autoloads.el b/emacs.d/elpa/jedi-core-20150623.2335/jedi-core-autoloads.el similarity index 96% rename from emacs.d/elpa/jedi-core-20150507.438/jedi-core-autoloads.el rename to emacs.d/elpa/jedi-core-20150623.2335/jedi-core-autoloads.el index 5f59746..ab850f2 100644 --- a/emacs.d/elpa/jedi-core-20150507.438/jedi-core-autoloads.el +++ b/emacs.d/elpa/jedi-core-20150623.2335/jedi-core-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "jedi-core" "jedi-core.el" (21837 24206 0 0)) +;;;### (autoloads nil "jedi-core" "jedi-core.el" (21898 47973 0 0)) ;;; Generated autoloads from jedi-core.el (autoload 'jedi:start-dedicated-server "jedi-core" "\ @@ -94,7 +94,7 @@ Blocking version `jedi:install-server'. ;;;*** -;;;### (autoloads nil nil ("jedi-core-pkg.el") (21837 24206 483113 +;;;### (autoloads nil nil ("jedi-core-pkg.el") (21898 47973 718570 ;;;;;; 0)) ;;;*** diff --git a/emacs.d/elpa/jedi-core-20150507.438/jedi-core-pkg.el b/emacs.d/elpa/jedi-core-20150623.2335/jedi-core-pkg.el similarity index 60% rename from emacs.d/elpa/jedi-core-20150507.438/jedi-core-pkg.el rename to emacs.d/elpa/jedi-core-20150623.2335/jedi-core-pkg.el index ac93454..d529f3f 100644 --- a/emacs.d/elpa/jedi-core-20150507.438/jedi-core-pkg.el +++ b/emacs.d/elpa/jedi-core-20150623.2335/jedi-core-pkg.el @@ -1,4 +1,4 @@ -(define-package "jedi-core" "20150507.438" "Common code of jedi.el and company-jedi.el" +(define-package "jedi-core" "20150623.2335" "Common code of jedi.el and company-jedi.el" '((emacs "24") (epc "0.1.0") (python-environment "0.0.2") diff --git a/emacs.d/elpa/jedi-core-20150507.438/jedi-core.el b/emacs.d/elpa/jedi-core-20150623.2335/jedi-core.el similarity index 99% rename from emacs.d/elpa/jedi-core-20150507.438/jedi-core.el rename to emacs.d/elpa/jedi-core-20150623.2335/jedi-core.el index 56e6fc5..12851fd 100644 --- a/emacs.d/elpa/jedi-core-20150507.438/jedi-core.el +++ b/emacs.d/elpa/jedi-core-20150623.2335/jedi-core.el @@ -2,7 +2,7 @@ ;; Author: Takafumi Arakaki ;; Package-Requires: ((emacs "24") (epc "0.1.0") (python-environment "0.0.2") (cl-lib "0.5")) -;; Version: 0.2.3 +;; Version: 0.2.5 ;; This file is NOT part of GNU Emacs. @@ -41,7 +41,7 @@ :group 'completion :prefix "jedi:") -(defconst jedi:version "0.2.1") +(defconst jedi:version "0.2.5") (defvar jedi:source-dir (if load-file-name (file-name-directory load-file-name) @@ -633,7 +633,8 @@ See: https://github.com/tkf/emacs-jedi/issues/54" (concat call_name "(" (mapconcat #'identity params ", ") ")")))) (defun jedi:get-in-function-call--tooltip-show (args) - (when (and args (and (boundp 'ac-completing) (not ac-completing))) + (when (and args (or (not (boundp 'auto-complete-mode)) + (and (boundp 'ac-completing) (not ac-completing)))) (jedi:tooltip-show (apply #'jedi:get-in-function-call--construct-call-signature args)))) diff --git a/emacs.d/elpa/jedi-core-20150507.438/jediepcserver.py b/emacs.d/elpa/jedi-core-20150623.2335/jediepcserver.py similarity index 98% rename from emacs.d/elpa/jedi-core-20150507.438/jediepcserver.py rename to emacs.d/elpa/jedi-core-20150623.2335/jediepcserver.py index e940b5c..5ea4f79 100755 --- a/emacs.d/elpa/jedi-core-20150507.438/jediepcserver.py +++ b/emacs.d/elpa/jedi-core-20150623.2335/jediepcserver.py @@ -31,6 +31,7 @@ import re import itertools import logging import site +import glob jedi = None # I will load it later @@ -133,7 +134,7 @@ def related_names(*args): def definition_to_dict(d): return dict( - doc=d.doc, + doc=d.docstring(), description=d.description, desc_with_module=d.desc_with_module, line_nr=d.line, @@ -272,10 +273,10 @@ def import_jedi(): def add_virtualenv_path(venv): """Add virtualenv's site-packages to `sys.path`.""" venv = os.path.abspath(venv) - path = os.path.join( - venv, 'lib', 'python%d.%d' % sys.version_info[:2], 'site-packages') - sys.path.insert(0, path) - site.addsitedir(path) + paths = glob.glob(os.path.join( + venv, 'lib', 'python*', 'site-packages')) + for path in paths: + site.addsitedir(path) def main(args=None): diff --git a/emacs.d/elpa/jedi-core-20150507.438/setup.py b/emacs.d/elpa/jedi-core-20150623.2335/setup.py similarity index 100% rename from emacs.d/elpa/jedi-core-20150507.438/setup.py rename to emacs.d/elpa/jedi-core-20150623.2335/setup.py diff --git a/emacs.d/elpa/js2-mode-20150503.617/js2-imenu-extras.el b/emacs.d/elpa/js2-mode-20150524.426/js2-imenu-extras.el similarity index 100% rename from emacs.d/elpa/js2-mode-20150503.617/js2-imenu-extras.el rename to emacs.d/elpa/js2-mode-20150524.426/js2-imenu-extras.el diff --git a/emacs.d/elpa/js2-mode-20150503.617/js2-mode-autoloads.el b/emacs.d/elpa/js2-mode-20150524.426/js2-mode-autoloads.el similarity index 79% rename from emacs.d/elpa/js2-mode-20150503.617/js2-mode-autoloads.el rename to emacs.d/elpa/js2-mode-20150524.426/js2-mode-autoloads.el index 82f1bd1..9071709 100644 --- a/emacs.d/elpa/js2-mode-20150503.617/js2-mode-autoloads.el +++ b/emacs.d/elpa/js2-mode-20150524.426/js2-mode-autoloads.el @@ -3,8 +3,8 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "js2-imenu-extras" "js2-imenu-extras.el" (21837 -;;;;;; 24200 0 0)) +;;;### (autoloads nil "js2-imenu-extras" "js2-imenu-extras.el" (21898 +;;;;;; 47968 0 0)) ;;; Generated autoloads from js2-imenu-extras.el (autoload 'js2-imenu-extras-setup "js2-imenu-extras" "\ @@ -19,9 +19,14 @@ Toggle Imenu support for frameworks and structural patterns. ;;;*** -;;;### (autoloads nil "js2-mode" "js2-mode.el" (21837 24200 0 0)) +;;;### (autoloads nil "js2-mode" "js2-mode.el" (21898 47968 0 0)) ;;; Generated autoloads from js2-mode.el +(autoload 'js2-highlight-unused-variables-mode "js2-mode" "\ +Toggle highlight of unused variables. + +\(fn &optional ARG)" t nil) + (autoload 'js2-minor-mode "js2-mode" "\ Minor mode for running js2 as a background linter. This allows you to use a different major mode for JavaScript editing, @@ -37,7 +42,7 @@ Major mode for editing JavaScript code. ;;;*** -;;;### (autoloads nil nil ("js2-mode-pkg.el") (21837 24200 739863 +;;;### (autoloads nil nil ("js2-mode-pkg.el") (21898 47968 67776 ;;;;;; 0)) ;;;*** diff --git a/emacs.d/elpa/js2-mode-20150503.617/js2-mode-pkg.el b/emacs.d/elpa/js2-mode-20150524.426/js2-mode-pkg.el similarity index 74% rename from emacs.d/elpa/js2-mode-20150503.617/js2-mode-pkg.el rename to emacs.d/elpa/js2-mode-20150524.426/js2-mode-pkg.el index 5071f41..7563f81 100644 --- a/emacs.d/elpa/js2-mode-20150503.617/js2-mode-pkg.el +++ b/emacs.d/elpa/js2-mode-20150524.426/js2-mode-pkg.el @@ -1,4 +1,4 @@ -(define-package "js2-mode" "20150503.617" "Improved JavaScript editing mode" +(define-package "js2-mode" "20150524.426" "Improved JavaScript editing mode" '((emacs "24.1") (cl-lib "0.5")) :url "https://github.com/mooz/js2-mode/" :keywords diff --git a/emacs.d/elpa/js2-mode-20150503.617/js2-mode.el b/emacs.d/elpa/js2-mode-20150524.426/js2-mode.el similarity index 98% rename from emacs.d/elpa/js2-mode-20150503.617/js2-mode.el rename to emacs.d/elpa/js2-mode-20150524.426/js2-mode.el index 082a5d0..fbbfeef 100644 --- a/emacs.d/elpa/js2-mode-20150503.617/js2-mode.el +++ b/emacs.d/elpa/js2-mode-20150524.426/js2-mode.el @@ -188,7 +188,8 @@ Set `js2-include-rhino-externs' to t to include them.") (defvar js2-node-externs (mapcar 'symbol-name '(__dirname __filename Buffer clearInterval clearTimeout require - console exports global module process setInterval setTimeout)) + console exports global module process setInterval setTimeout + querystring)) "Node.js externs. Set `js2-include-node-externs' to t to include them.") @@ -1155,6 +1156,11 @@ another file, or you've got a potential bug." :type 'boolean :group 'js2-mode) +(defcustom js2-warn-about-unused-function-arguments nil + "Non-nil to treat function arguments like declared-but-unused variables." + :type 'booleanp + :group 'js2-mode) + (defcustom js2-include-jslint-globals t "Non-nil to include the identifiers from JSLint global declaration (see http://www.jslint.com/lint.html#global) in the @@ -1793,6 +1799,12 @@ the correct number of ARGS must be provided." (js2-msg "msg.undeclared.variable" ; added by js2-mode "Undeclared variable or function '%s'") +(js2-msg "msg.unused.variable" ; added by js2-mode + "Unused variable or function '%s'") + +(js2-msg "msg.uninitialized.variable" ; added by js2-mode + "Variable '%s' referenced but never initialized") + (js2-msg "msg.ref.undefined.prop" "Reference to undefined property '%s'") @@ -7081,6 +7093,160 @@ it is considered declared." (js2-report-warning "msg.undeclared.variable" name pos (- end pos) 'js2-external-variable)))))) +(defun js2--add-or-update-symbol (symbol inition used vars) + "Add or update SYMBOL entry in VARS, an hash table. +SYMBOL is a js2-name-node, INITION either nil, t, or ?P, +respectively meaning that SYMBOL is a mere declaration, an +assignment or a function parameter; when USED is t, the symbol +node is assumed to be an usage and thus added to the list stored +in the cdr of the entry. +" + (let* ((nm (js2-name-node-name symbol)) + (es (js2-node-get-enclosing-scope symbol)) + (ds (js2-get-defining-scope es nm))) + (when (and ds (not (equal nm "arguments"))) + (let* ((sym (js2-scope-get-symbol ds nm)) + (var (gethash sym vars)) + (err-var-p (js2-catch-node-p ds))) + (unless inition + (setq inition err-var-p)) + (if var + (progn + (when (and inition (not (equal (car var) ?P))) + (setcar var inition)) + (when used + (push symbol (cdr var)))) + ;; do not consider the declaration of catch parameter as an usage + (when (and err-var-p used) + (setq used nil)) + (puthash sym (cons inition (if used (list symbol))) vars)))))) + +(defun js2--classify-variables () + "Collect and classify variables declared or used within js2-mode-ast. +Traverse the whole ast tree returning a summary of the variables +usage as an hash-table, keyed by their corresponding symbol table +entry. +Each variable is described by a tuple where the car is a flag +indicating whether the variable has been initialized and the cdr +is a possibly empty list of name nodes where it is used. External +symbols, i.e. those not present in the whole scopes hierarchy, +are ignored." + (let ((vars (make-hash-table :test #'eq :size 100))) + (js2-visit-ast + js2-mode-ast + (lambda (node end-p) + (when (null end-p) + (cond + ((js2-var-init-node-p node) + ;; take note about possibly initialized declarations + (let ((target (js2-var-init-node-target node)) + (initializer (js2-var-init-node-initializer node))) + (when target + (let* ((parent (js2-node-parent node)) + (grandparent (if parent (js2-node-parent parent))) + (inited (not (null initializer)))) + (unless inited + (setq inited + (and grandparent + (js2-for-in-node-p grandparent) + (memq target + (mapcar #'js2-var-init-node-target + (js2-var-decl-node-kids + (js2-for-in-node-iterator grandparent))))))) + (js2--add-or-update-symbol target inited nil vars))))) + + ((js2-assign-node-p node) + ;; take note about assignments + (let ((left (js2-assign-node-left node))) + (when (js2-name-node-p left) + (js2--add-or-update-symbol left t nil vars)))) + + ((js2-prop-get-node-p node) + ;; handle x.y.z nodes, considering only x + (let ((left (js2-prop-get-node-left node))) + (when (js2-name-node-p left) + (js2--add-or-update-symbol left nil t vars)))) + + ((js2-name-node-p node) + ;; take note about used variables + (let ((parent (js2-node-parent node))) + (when parent + (unless (or (and (js2-var-init-node-p parent) ; handled above + (eq node (js2-var-init-node-target parent))) + (and (js2-assign-node-p parent) + (eq node (js2-assign-node-left parent))) + (js2-prop-get-node-p parent)) + (let ((used t) inited) + (cond + ((and (js2-function-node-p parent) + (js2-wrapper-function-p parent)) + (setq inited (if (memq node (js2-function-node-params parent)) ?P t))) + + ((js2-for-in-node-p parent) + (if (eq node (js2-for-in-node-iterator parent)) + (setq inited t used nil))) + + ((js2-function-node-p parent) + (setq inited (if (memq node (js2-function-node-params parent)) ?P t) + used nil))) + + (unless used + (let ((grandparent (js2-node-parent parent))) + (when grandparent + (setq used (js2-return-node-p grandparent))))) + + (js2--add-or-update-symbol node inited used vars)))))))) + t)) + vars)) + +(defun js2--get-name-node (node) + (cond + ((js2-name-node-p node) node) + ((js2-function-node-p node) + (js2-function-node-name node)) + ((js2-class-node-p node) + (js2-class-node-name node)) + ((js2-comp-loop-node-p node) + (js2-comp-loop-node-iterator node)) + (t node))) + +(defun js2--highlight-unused-variable (symbol info) + (let ((name (js2-symbol-name symbol)) + (inited (car info)) + (refs (cdr info)) + pos len) + (unless (and inited refs) + (if refs + (dolist (ref refs) + (setq pos (js2-node-abs-pos ref)) + (setq len (js2-name-node-len ref)) + (js2-report-warning "msg.uninitialized.variable" name pos len + 'js2-warning)) + (when (or js2-warn-about-unused-function-arguments + (not (eq inited ?P))) + (let* ((symn (js2-symbol-ast-node symbol)) + (namen (js2--get-name-node symn))) + (unless (js2-node-top-level-decl-p namen) + (setq pos (js2-node-abs-pos namen)) + (setq len (js2-name-node-len namen)) + (js2-report-warning "msg.unused.variable" name pos len + 'js2-warning)))))))) + +(defun js2-highlight-unused-variables () + "Highlight unused variables." + (let ((vars (js2--classify-variables))) + (maphash #'js2--highlight-unused-variable vars))) + +;;;###autoload +(define-minor-mode js2-highlight-unused-variables-mode + "Toggle highlight of unused variables." + :lighter "" + (if js2-highlight-unused-variables-mode + (add-hook 'js2-post-parse-callbacks + #'js2-highlight-unused-variables nil t) + (remove-hook 'js2-post-parse-callbacks + #'js2-highlight-unused-variables t))) + (defun js2-set-default-externs () "Set the value of `js2-default-externs' based on the various `js2-include-?-externs' variables." @@ -10224,7 +10390,7 @@ We should have just parsed the 'for' keyword before calling this function." pn)) (defun js2-parse-comprehension (pos form) - (let (loops filters expr result) + (let (loops filters expr result last) (unwind-protect (progn (js2-unget-token) @@ -10235,7 +10401,8 @@ We should have just parsed the 'for' keyword before calling this function." (js2-parse-comp-loop loop))) (while (js2-match-token js2-IF) (push (car (js2-parse-condition)) filters)) - (setq expr (js2-parse-assign-expr))) + (setq expr (js2-parse-assign-expr)) + (setq last (car loops))) (dolist (_ loops) (js2-pop-scope))) (setq result (make-js2-comp-node :pos pos @@ -10246,6 +10413,7 @@ We should have just parsed the 'for' keyword before calling this function." :form form)) (apply #'js2-node-add-children result (js2-comp-node-loops result)) (apply #'js2-node-add-children result expr (js2-comp-node-filters result)) + (setf (js2-scope-parent-scope result) last) result)) (defun js2-parse-comp-loop (pn &optional only-of-p) @@ -10439,7 +10607,6 @@ When `js2-is-in-destructuring' is t, forms like {a, b, c} will be permitted." (js2-create-name-node)) ;; Anything else is an error (t (js2-report-error "msg.bad.prop")))) - expr (prop (and previous-token (js2-token-string previous-token))) (property-type (when previous-token (if (= (js2-token-type previous-token) js2-MUL) @@ -10459,19 +10626,21 @@ When `js2-is-in-destructuring' is t, forms like {a, b, c} will be permitted." (js2-parse-getter-setter-prop pos key property-type)) ;; regular prop (t - (prog1 - (setq expr (js2-parse-plain-property key)) + (let ((beg (js2-current-token-beg)) + (end (js2-current-token-end)) + (expr (js2-parse-plain-property key))) (when (and (= tt js2-NAME) (not js2-is-in-destructuring) js2-highlight-external-variables (js2-node-get-prop expr 'SHORTHAND)) (js2-record-name-node key)) - (js2-set-face (js2-current-token-beg) (js2-current-token-end) + (js2-set-face beg end (if (js2-function-node-p (js2-object-prop-node-right expr)) 'font-lock-function-name-face 'font-lock-variable-name-face) - 'record)))))) + 'record) + expr))))) (defun js2-parse-plain-property (prop) "Parse a non-getter/setter property in an object literal. diff --git a/emacs.d/elpa/markdown-mode-20150121.1229/markdown-mode-autoloads.el b/emacs.d/elpa/markdown-mode-20150623.1128/markdown-mode-autoloads.el similarity index 91% rename from emacs.d/elpa/markdown-mode-20150121.1229/markdown-mode-autoloads.el rename to emacs.d/elpa/markdown-mode-20150623.1128/markdown-mode-autoloads.el index 1c4afcd..33e4f51 100644 --- a/emacs.d/elpa/markdown-mode-20150121.1229/markdown-mode-autoloads.el +++ b/emacs.d/elpa/markdown-mode-20150623.1128/markdown-mode-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "markdown-mode" "markdown-mode.el" (21837 24196 +;;;### (autoloads nil "markdown-mode" "markdown-mode.el" (21898 47967 ;;;;;; 0 0)) ;;; Generated autoloads from markdown-mode.el @@ -11,10 +11,13 @@ Major mode for editing Markdown files. \(fn)" t nil) + (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.md\\'" . 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. diff --git a/emacs.d/elpa/markdown-mode-20150121.1229/markdown-mode-pkg.el b/emacs.d/elpa/markdown-mode-20150623.1128/markdown-mode-pkg.el similarity index 70% rename from emacs.d/elpa/markdown-mode-20150121.1229/markdown-mode-pkg.el rename to emacs.d/elpa/markdown-mode-20150623.1128/markdown-mode-pkg.el index 587e2b6..2b7c13c 100644 --- a/emacs.d/elpa/markdown-mode-20150121.1229/markdown-mode-pkg.el +++ b/emacs.d/elpa/markdown-mode-20150623.1128/markdown-mode-pkg.el @@ -1 +1 @@ -(define-package "markdown-mode" "20150121.1229" "Emacs Major mode for Markdown-formatted text files" 'nil :url "http://jblevins.org/projects/markdown-mode/" :keywords '("markdown" "github flavored markdown" "itex")) +(define-package "markdown-mode" "20150623.1128" "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/emacs.d/elpa/markdown-mode-20150121.1229/markdown-mode.el b/emacs.d/elpa/markdown-mode-20150623.1128/markdown-mode.el similarity index 93% rename from emacs.d/elpa/markdown-mode-20150121.1229/markdown-mode.el rename to emacs.d/elpa/markdown-mode-20150623.1128/markdown-mode.el index 46c122e..cab233b 100644 --- a/emacs.d/elpa/markdown-mode-20150121.1229/markdown-mode.el +++ b/emacs.d/elpa/markdown-mode-20150623.1128/markdown-mode.el @@ -1,6 +1,6 @@ ;;; markdown-mode.el --- Emacs Major mode for Markdown-formatted text files -;; Copyright (C) 2007-2014 Jason R. Blevins +;; Copyright (C) 2007-2015 Jason R. Blevins ;; Copyright (C) 2007, 2009 Edward O'Connor ;; Copyright (C) 2007 Conal Elliott ;; Copyright (C) 2008 Greg Bognar @@ -22,12 +22,14 @@ ;; 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: 20150121.1229 +;; Package-Version: 20150623.1128 ;; Keywords: Markdown, GitHub Flavored Markdown, itex ;; URL: http://jblevins.org/projects/markdown-mode/ @@ -63,11 +65,11 @@ ;; * [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 +;; [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). +;; [color-theme-twilight](https://github.com/crafterm/twilight-emacs). ;; ;; markdown-mode is also available in several package managers, including: ;; @@ -215,7 +217,7 @@ ;; 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 @@ -457,9 +459,9 @@ ;; 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][], a -;; live-updating MultiMarkdown previewer which has a command line -;; utility at `/usr/local/bin/mark`. +;; 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 @@ -494,8 +496,8 @@ ;; support by default. Math support can be toggled later using ;; the function `markdown-enable-math'." ;; -;; * `markdown-css-path' - CSS file to link to in XHTML output -;; (default: `""`). +;; * `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 `` @@ -552,7 +554,7 @@ ;; or by using the "Markdown Faces" link at the bottom of the mode ;; customization screen. ;; -;; [Marked]: https://itunes.apple.com/us/app/marked/id448925439?ls=1&mt=12&partnerId=30&siteID=GpHp3Acs1Yo +;; [Marked 2]: https://itunes.apple.com/us/app/marked-2/id890031187?mt=12&uo=4&at=11l5Vs&ct=mm ;;; Extensions: @@ -609,13 +611,13 @@ ;; the code block. You will be prompted for the name of the language, ;; but may press enter to continue without naming a language. ;; -;; For a more complete GitHub Flavored Markdown experience, consider -;; adding README.md to your `auto-mode-alist': -;; -;; (add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode)) +;; Similarly, strike through text is supoorted in GFM mode and can be +;; inserted (and toggled) using `C-c C-s d`. Following the mnemonics +;; for the other style keybindings, the letter `d` coincides with the +;; HTML tag ``. ;; ;; For GFM preview can be powered by setting `markdown-command' to -;; use [Docter][]. This may also be configured to work with [Marked][] +;; use [Docter][]. This may also be configured to work with [Marked 2][] ;; for `markdown-open-command'. ;; ;; [GFM]: http://github.github.com/github-flavored-markdown/ @@ -698,6 +700,16 @@ ;; * 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. ;;; Bugs: @@ -861,10 +873,10 @@ or \\[markdown-enable-math]." :type 'boolean :safe 'booleanp) -(defcustom markdown-css-path "" +(defcustom markdown-css-paths nil "URL of CSS file to link to in the output XHTML." :group 'markdown - :type 'string) + :type 'list) (defcustom markdown-content-type "" "Content type string for the http-equiv header in XHTML output. @@ -911,6 +923,11 @@ and `iso-latin-1'. Use `list-coding-systems' for more choices." (const :tag "Immediately after the current block" immediately) (const :tag "Before next header" header))) +(defcustom markdown-unordered-list-item-prefix " * " + "String inserted before unordered list items." + :group 'markdown + :type 'string) + ;;; Font Lock ================================================================= @@ -922,6 +939,9 @@ and `iso-latin-1'. Use `list-coding-systems' for more choices." (defvar markdown-bold-face 'markdown-bold-face "Face name to use for bold text.") +(defvar markdown-strike-through-face 'markdown-strike-through-face + "Face name to use for strike-through text.") + (defvar markdown-header-delimiter-face 'markdown-header-delimiter-face "Face name to use as a base for header delimiters.") @@ -1012,6 +1032,11 @@ and `iso-latin-1'. Use `list-coding-systems' for more choices." "Face for bold text." :group 'markdown-faces) +(defface markdown-strike-through-face + '((t (:inherit font-lock-variable-name-face :strike-through t))) + "Face for strike-through text." + :group 'markdown-faces) + (defface markdown-header-rule-face '((t (:inherit font-lock-function-name-face :weight bold))) "Base face for headers rules." @@ -1248,6 +1273,15 @@ Group 2 matches the entire expression, including delimiters. Groups 3 and 5 matches the opening and closing delimiters. Group 4 matches the text inside the delimiters.") +(defconst markdown-regex-strike-through + "\\(^\\|[^\\]\\)\\(\\(~~\\)\\([^ \n\t\\]\\|[^ \n\t]\\(?:.\\|\n[^\n]\\)*?[^\\ ]\\)\\(~~\\)\\)" + "Regular expression for matching strike-through text. +Group 1 matches the character before the opening tilde, if any, +ensuring that it is not a backslash escape. +Group 2 matches the entire expression, including delimiters. +Groups 3 and 5 matches the opening and closing delimiters. +Group 4 matches the text inside the delimiters.") + (defconst markdown-regex-gfm-italic "\\(^\\|\\s-\\)\\(\\([*_]\\)\\([^ \\]\\3\\|[^ ]\\(.\\|\n[^\n]\\)*?[^\\ ]\\3\\)\\)" "Regular expression for matching italic text in GitHub Flavored Markdown. @@ -1313,8 +1347,8 @@ on the value of `markdown-wiki-link-alias-first'.") (defvar markdown-mode-font-lock-keywords-basic (list - (cons 'markdown-match-pre-blocks '((0 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))) @@ -1398,6 +1432,10 @@ extension support.") "[[: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 ============================================================= @@ -1457,9 +1495,11 @@ If we are at the last line, then consider the next line to be blank." (defun markdown-prev-line-indent-p () "Return t if the previous line is indented and nil otherwise." (save-excursion - (forward-line -1) - (goto-char (line-beginning-position)) - (if (re-search-forward "^\\s " (line-end-position) t) t))) + (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." @@ -1470,16 +1510,22 @@ If we are at the last line, then consider the next line to be blank." (current-column)))) (defun markdown-prev-line-indent () - "Return the number of leading whitespace characters in the previous line." + "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 - (forward-line -1) - (markdown-cur-line-indent))) + (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 the number of leading whitespace characters in the next line. +Return 0 if line is the last line in the buffer." (save-excursion - (forward-line 1) - (markdown-cur-line-indent))) + (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). @@ -2124,6 +2170,25 @@ insert italic delimiters and place the cursor in between them." (markdown-unwrap-thing-at-point nil 2 4) (markdown-wrap-or-insert delim delim 'word nil nil))))) +(defun markdown-insert-strike-through () + "Insert markup to make a region or word strike-through. +If there is an active region, make the region strike-through. If the point +is at a non-bold word, make the word strike-through. If the point is at a +strike-through word or phrase, remove the strike-through markup. Otherwise, +simply insert bold delimiters and place the cursor in between them." + (interactive) + (let ((delim "~~")) + (if (markdown-use-region-p) + ;; Active region + (let ((bounds (markdown-unwrap-things-in-region + (region-beginning) (region-end) + markdown-regex-strike-through 2 4))) + (markdown-wrap-or-insert delim delim nil (car bounds) (cdr bounds))) + ;; Strike-through markup removal, strike-through word at point, or empty markup insertion + (if (thing-at-point-looking-at markdown-regex-strike-through) + (markdown-unwrap-thing-at-point nil 2 4) + (markdown-wrap-or-insert delim delim 'word nil nil))))) + (defun markdown-insert-code () "Insert markup to make a region or word an inline code fragment. If there is an active region, make the region an inline code @@ -2190,9 +2255,10 @@ example, when a reference label is already defined)." (defun markdown-insert-reference-link-dwim () "Insert a reference link of the form [text][label] at point. If there is an active region, the text in the region will be used -as the link text. If the point is at a word, it will be used as -the link text. Otherwise, the link text will be read from the -minibuffer. The link label will be read from the minibuffer in +as the link text. If the point is at an inline link, it will be +converted to a reference link. If the point is at a word, it will +be used as the link text. Otherwise, the link text will be read from +the minibuffer. The link 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 @@ -2202,20 +2268,31 @@ location determined by `markdown-reference-location'." (interactive) (let* ((defined-labels (mapcar (lambda (x) (substring x 1 -1)) (markdown-get-defined-references))) - (bounds (or (and (markdown-use-region-p) - (cons (region-beginning) (region-end))) - (markdown-bounds-of-thing-at-point 'word))) - (text (if bounds - (buffer-substring (car bounds) (cdr bounds)) - (read-string "Link Text: "))) + (switch (thing-at-point-looking-at markdown-regex-link-inline)) + (bounds (cond ((markdown-use-region-p) + (cons (region-beginning) (region-end))) + (switch + (cons (match-beginning 0) (match-end 0))) + (t + (markdown-bounds-of-thing-at-point 'word)))) + (text (cond (switch (match-string 3)) + (bounds (buffer-substring (car bounds) (cdr bounds))) + (t (read-string "Link Text: ")))) (label (completing-read "Link Label (default: none): " defined-labels nil nil nil 'markdown-reference-label-history nil)) - (ref (markdown-reference-definition - (concat "[" (if (> (length label) 0) label text) "]"))) - (url (unless ref (read-string "Link URL: "))) - (title (when (> (length url) 0) - (read-string "Link Title (optional): ")))) + (ref (save-match-data + (markdown-reference-definition + (concat "[" (if (> (length label) 0) label text) "]")))) + (url (cond (ref nil) + (switch (match-string 5)) + (t (read-string "Link URL: ")))) + (title (cond + ((= (length url) 0) nil) + (switch (if (> (length (match-string 6)) 2) + (substring (match-string 6) 1 -1) + nil)) + (t (read-string "Link Title (optional): "))))) (when bounds (delete-region (car bounds) (cdr bounds))) (markdown-insert-reference-link text label url title))) @@ -2583,23 +2660,37 @@ The footnote text is killed (and added to the kill ring), the footnote marker is deleted. Point has to be either at the footnote marker or in the footnote text." (interactive) - (let (return-pos) - (when (markdown-footnote-text-positions) ; if we're in a footnote text - (markdown-footnote-return) ; we first move to the marker - (setq return-pos 'text)) ; and remember our return position - (let ((marker (markdown-footnote-delete-marker))) - (unless marker - (error "Not at a footnote")) - (let ((text-pos (markdown-footnote-find-text (car marker)))) - (unless text-pos - (error "No text for footnote `%s'" (car marker))) - (goto-char text-pos) - (let ((pos (markdown-footnote-kill-text))) - (setq return-pos - (if (and pos (eq return-pos 'text)) - pos - (cadr marker)))))) - (goto-char return-pos))) + (let ((marker-pos nil) + (skip-deleting-marker nil) + (starting-footnote-text-positions + (markdown-footnote-text-positions))) + (when starting-footnote-text-positions + ;; We're starting in footnote text, so mark our return position and jump + ;; to the marker if possible. + (let ((marker-pos (markdown-footnote-find-marker + (first starting-footnote-text-positions)))) + (if marker-pos + (goto-char (1- marker-pos)) + ;; If there isn't a marker, we still want to kill the text. + (setq skip-deleting-marker t)))) + ;; Either we didn't start in the text, or we started in the text and jumped + ;; to the marker. We want to assume we're at the marker now and error if + ;; we're not. + (unless skip-deleting-marker + (let ((marker (markdown-footnote-delete-marker))) + (unless marker + (error "Not at a footnote")) + ;; Even if we knew the text position before, it changed when we deleted + ;; the label. + (setq marker-pos (second marker)) + (let ((new-text-pos (markdown-footnote-find-text (first marker)))) + (unless new-text-pos + (error "No text for footnote `%s'" (first marker))) + (goto-char new-text-pos)))) + (let ((pos (markdown-footnote-kill-text))) + (goto-char (if starting-footnote-text-positions + pos + marker-pos))))) (defun markdown-footnote-delete-marker () "Delete a footnote marker at point. @@ -2624,7 +2715,8 @@ number)." (string-match (concat "\\[\\" (first fn) "\\]:[[:space:]]*\\(\\(.*\n?\\)*\\)") text) (kill-new (match-string 1 text)) (when (and (markdown-cur-line-blank-p) - (markdown-prev-line-blank-p)) + (markdown-prev-line-blank-p) + (not (bobp))) (delete-region (1- (point)) (point))) (second fn))))) @@ -2696,19 +2788,32 @@ of the footnote id. The end position is directly after the newline that ends the footnote. If point is not in a footnote, NIL is returned instead." (save-excursion - (let ((fn (progn - (backward-paragraph) - ;; if we're in a multiparagraph footnote, we need to back up further - (while (>= (markdown-next-line-indent) 4) - (backward-paragraph)) - (forward-line) - (if (looking-at (concat "^\\[\\(\\^" markdown-footnote-chars "*?\\)\\]:")) - (list (match-string 1) (point)))))) - (when fn - (while (progn - (forward-paragraph) - (>= (markdown-next-line-indent) 4))) - (append fn (list (point))))))) + (let (result) + (move-beginning-of-line 1) + ;; Try to find the label. If we haven't found the label and we're at a blank + ;; or indented line, back up if possible. + (while (and + (not (and (looking-at markdown-regex-footnote-definition) + (setq result (list (match-string 1) (point))))) + (and (not (bobp)) + (or (markdown-cur-line-blank-p) + (>= (markdown-cur-line-indent) 4)))) + (forward-line -1)) + (when result + ; Advance if there is a next line that is either blank or indented. + ; (Need to check if we're on the last line, because + ; markdown-next-line-blank-p returns true for last line in buffer.) + (while (and (/= (line-end-position) (point-max)) + (or (markdown-next-line-blank-p) + (>= (markdown-next-line-indent) 4))) + (forward-line)) + ; Move back while the current line is blank. + (while (markdown-cur-line-blank-p) + (forward-line -1)) + ; Advance to capture this line and a single trailing newline (if there + ; is one). + (forward-line) + (append result (list (point))))))) ;;; Element Removal =========================================================== @@ -2768,6 +2873,10 @@ text to kill ring), and list items." ((thing-at-point-looking-at markdown-regex-italic) (kill-new (match-string 4)) (delete-region (match-beginning 2) (match-end 2))) + ;; Strike-through + ((thing-at-point-looking-at markdown-regex-strike-through) + (kill-new (match-string 4)) + (delete-region (match-beginning 2) (match-end 2))) ;; Footnote marker (add footnote text to kill ring) ((thing-at-point-looking-at markdown-regex-footnote) (markdown-footnote-kill)) @@ -2891,7 +3000,7 @@ Otherwise, do normal delete by repeating (while (< (point) end) (back-to-indentation) (unless (looking-at "[ \t]*$") - (setq mincol (min mincol (current-column)))) + (setq mincol (min mincol (current-column)))) (forward-line 1) )) mincol)) @@ -3242,6 +3351,7 @@ Assumes match data is available for `markdown-regex-italic'." (let ((map (make-sparse-keymap))) (set-keymap-parent map markdown-mode-map) (define-key map (kbd "C-c C-s P") 'markdown-insert-gfm-code-block) + (define-key map (kbd "C-c C-s d") 'markdown-insert-strike-through) map) "Keymap for `gfm-mode'. See also `markdown-mode-map'.") @@ -3279,6 +3389,7 @@ See also `markdown-mode-map'.") "---" ["Bold" markdown-insert-bold] ["Italic" markdown-insert-italic] + ["Strike-through" markdown-insert-strike-through] ["Blockquote" markdown-insert-blockquote] ["Preformatted" markdown-insert-pre] ["Code" markdown-insert-code] @@ -3662,7 +3773,7 @@ increase the indentation by one level." (progn (unless (markdown-cur-line-blank-p) (insert "\n")) - (insert "* ")) + (insert markdown-unordered-list-item-prefix)) ;; Compute indentation for a new list item (setq item-indent (nth 2 bounds)) (setq marker (nth 4 bounds)) @@ -3681,11 +3792,21 @@ increase the indentation by one level." ;; the argument was nil, "new-indent = item-indent" is the same, ;; so we don't need special treatment. Neat. (save-excursion - (while (not (looking-at (concat new-indent "\\([0-9]+\\)\\."))) - (forward-line -1))) - (insert (concat new-indent - (int-to-string (1+ (string-to-number (match-string 1)))) - ". ")))) + (while (and (not (looking-at (concat new-indent "\\([0-9]+\\)\\(\\.[ \t]*\\)"))) + (>= (forward-line -1) 0)))) + (let* ((old-prefix (match-string 1)) + (old-spacing (match-string 2)) + (new-prefix (if old-prefix + (int-to-string (1+ (string-to-number old-prefix))) + "1")) + (space-adjust (- (length old-prefix) (length new-prefix))) + (new-spacing (if (and (match-string 2) + (not (string-match "\t" old-spacing)) + (< space-adjust 0) + (> space-adjust (- 1 (length (match-string 2))))) + (substring (match-string 2) 0 space-adjust) + (or old-spacing ". ")))) + (insert (concat new-indent new-prefix new-spacing))))) ;; Unordered list ((string-match "[\\*\\+-]" marker) (insert new-indent marker))))))) @@ -4149,9 +4270,9 @@ Insert the output in the buffer named OUTPUT-BUFFER-NAME." (setq output-buffer-name (markdown output-buffer-name)) (with-current-buffer output-buffer-name (set-buffer output-buffer-name) - (goto-char (point-min)) (unless (markdown-output-standalone-p) (markdown-add-xhtml-header-and-footer output-buffer-name)) + (goto-char (point-min)) (html-mode)) output-buffer-name) @@ -4166,10 +4287,17 @@ that name." "Determine whether `markdown-command' output is standalone XHTML. Standalone XHTML output is identified by an occurrence of `markdown-xhtml-standalone-regexp' in the first five lines of output." - (re-search-forward - markdown-xhtml-standalone-regexp - (save-excursion (goto-char (point-min)) (forward-line 4) (point)) - t)) + (save-excursion + (goto-char (point-min)) + (re-search-forward + markdown-xhtml-standalone-regexp + (save-excursion (goto-char (point-min)) (forward-line 4) (point)) + t))) + +(defun markdown-stylesheet-link-string (stylesheet-path) + (concat "")) (defun markdown-add-xhtml-header-and-footer (title) "Wrap XHTML header and footer with given TITLE around current buffer." @@ -4193,10 +4321,8 @@ Standalone XHTML output is identified by an occurrence of (coding-system-get buffer-file-coding-system 'mime-charset)) "iso-8859-1")))) - (if (> (length markdown-css-path) 0) - (insert "\n")) + (if (> (length markdown-css-paths) 0) + (insert (mapconcat 'markdown-stylesheet-link-string markdown-css-paths "\n"))) (when (> (length markdown-xhtml-header-content) 0) (insert markdown-xhtml-header-content)) (insert "\n\n\n" @@ -4211,7 +4337,7 @@ Standalone XHTML output is identified by an occurrence of When OUTPUT-BUFFER-NAME is given, insert the output in the buffer with that name." (interactive) - (browse-url-of-buffer (markdown markdown-output-buffer-name))) + (browse-url-of-buffer (markdown-standalone markdown-output-buffer-name))) (defun markdown-export-file-name (&optional extension) "Attempt to generate a filename for Markdown output. @@ -4221,12 +4347,18 @@ output filename based on that filename. Otherwise, return nil." (when (buffer-file-name) (unless extension (setq extension ".html")) - (concat - (cond - ((buffer-file-name) - (file-name-sans-extension (buffer-file-name))) - (t (buffer-name))) - extension))) + (let ((candidate + (concat + (cond + ((buffer-file-name) + (file-name-sans-extension (buffer-file-name))) + (t (buffer-name))) + extension))) + (cond + ((equal candidate (buffer-file-name)) + (concat candidate extension)) + (t + candidate))))) (defun markdown-export (&optional output-file) "Run Markdown on the current buffer, save to file, and return the filename. @@ -4258,7 +4390,7 @@ current filename, but with the extension removed and replaced with .html." (defun markdown-export-and-preview () "Export to XHTML using `markdown-export' and browse the resulting file." (interactive) - (browse-url (markdown-export))) + (browse-url-of-file (markdown-export))) (defun markdown-open () "Open file for the current buffer with `markdown-open-command'." @@ -4522,11 +4654,17 @@ This is an exact copy of `line-number-at-pos' for use in emacs21." (forward-line 0) (1+ (count-lines start (point)))))) -(defun markdown-nobreak-p () - "Return nil if it is acceptable to break the current line at the point." - ;; inside in square brackets (e.g., link anchor text) +(defun markdown-inside-link-text-p () + "Return nil if not currently within link anchor text." (looking-back "\\[[^]]*")) +(defun markdown-line-is-reference-definition-p () + "Return whether the current line is a (non-footnote) reference defition." + (save-excursion + (move-beginning-of-line 1) + (and (looking-at-p markdown-regex-reference-definition) + (not (looking-at-p "[ \t]*\\[^"))))) + (defun markdown-adaptive-fill-function () "Return prefix for filling paragraph or nil if not determined." (cond @@ -4540,9 +4678,25 @@ This is an exact copy of `line-number-at-pos' for use in emacs21." ;; List items ((looking-at markdown-regex-list) (match-string-no-properties 0)) + ((looking-at markdown-regex-footnote-definition) + " ") ; four spaces ;; No match (t nil))) +(defun markdown-fill-forward-paragraph-function (&optional arg) + (let* ((arg (or arg 1)) + (paragraphs-remaining (forward-paragraph arg)) + (start (point))) + (when (< arg 0) + (while (and (not (eobp)) + (progn (move-to-left-margin) (not (eobp))) + (looking-at paragraph-separate)) + (forward-line 1)) + (if (looking-at markdown-regex-list) + (forward-char (length (match-string 0))) + (goto-char start))) + paragraphs-remaining)) + ;;; Extensions ================================================================ @@ -4615,14 +4769,36 @@ if ARG is omitted or nil." (set (make-local-variable 'end-of-defun-function) 'markdown-end-of-defun) ;; Paragraph filling - (set (make-local-variable 'paragraph-start) - "\f\\|[ \t]*$\\|[ \t]*[*+-] \\|[ \t]*[0-9]+\\.[ \t]\\|[ \t]*: ") - (set (make-local-variable 'paragraph-separate) - "\\(?:[ \t\f]*\\|.* \\)$") + (set + ; Should match start of lines that start or seaprate paragraphs + (make-local-variable 'paragraph-start) + (mapconcat 'identity + '( + "\f" ; starts with a literal line-feed + "[ \t\f]*$" ; space-only line + "[ \t]*[*+-][ \t]+" ; unordered list item + "[ \t]*[0-9]+\\.[ \t]+" ; ordered list item + "[ \t]*\\[\\S-*\\]:[ \t]+" ; link ref def + ) + "\\|")) + (set + ; Should match lines that separate paragraphs without being + ; part of any paragraph: + (make-local-variable 'paragraph-separate) + (mapconcat 'identity + '("[ \t\f]*$" ; space-only line + ; The following is not ideal, but the Fill customization + ; options really only handle paragraph-starting prefixes, + ; not paragraph-ending suffixes: + ".* $" ; line ending in two spaces + "[ \t]*\\[\\^\\S-*\\]:[ \t]*$") ; just the start of a footnote def + "\\|")) (set (make-local-variable 'adaptive-fill-first-line-regexp) "\\`[ \t]*>[ \t]*?\\'") (set (make-local-variable 'adaptive-fill-function) 'markdown-adaptive-fill-function) + (set (make-local-variable 'fill-forward-paragraph-function) + 'markdown-fill-forward-paragraph-function) ;; Outline mode (make-local-variable 'outline-regexp) (setq outline-regexp markdown-regex-header) @@ -4630,11 +4806,23 @@ if ARG is omitted or nil." (setq outline-level 'markdown-outline-level) ;; Cause use of ellipses for invisible text. (add-to-invisibility-spec '(outline . t)) - ;; Indentation and filling - (make-local-variable 'fill-nobreak-predicate) - (add-hook 'fill-nobreak-predicate 'markdown-nobreak-p) + + ;; Inhibiting line-breaking: + ;; Separating out each condition into a separate function so that users can + ;; override if desired (with remove-hook) + (add-hook 'fill-nobreak-predicate + 'markdown-inside-link-text-p nil t) + (add-hook 'fill-nobreak-predicate + 'markdown-line-is-reference-definition-p nil t) + + ;; Indentation (setq indent-line-function markdown-indent-function) + ;; Backwards compatibility with markdown-css-path + (when (boundp 'markdown-css-path) + (warn "markdown-css-path is deprecated, see markdown-css-paths.") + (add-to-list 'markdown-css-paths markdown-css-path)) + ;; Prepare hooks for XEmacs compatibility (when (featurep 'xemacs) (make-local-hook 'after-change-functions) @@ -4657,9 +4845,12 @@ if ARG is omitted or nil." ;; do the initial link fontification (markdown-fontify-buffer-wiki-links)) -;;;###autoload(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) -;;;###autoload(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) -;;;###autoload(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode)) +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode)) +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) ;;; GitHub Flavored Markdown Mode ============================================ @@ -4671,7 +4862,8 @@ if ARG is omitted or nil." (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)))) + (4 markdown-pre-face))) + (cons markdown-regex-strike-through '(2 markdown-strike-through-face))) ;; Basic Markdown features (excluding possibly overridden ones) markdown-mode-font-lock-keywords-basic ;; GFM features to match last diff --git a/emacs.d/elpa/monokai-theme-20150112.442/monokai-theme-pkg.el b/emacs.d/elpa/monokai-theme-20150112.442/monokai-theme-pkg.el deleted file mode 100644 index 0713af1..0000000 --- a/emacs.d/elpa/monokai-theme-20150112.442/monokai-theme-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "monokai-theme" "20150112.442" "A fruity color theme for Emacs." 'nil :url "http://github.com/oneKelvinSmith/monokai-emacs") diff --git a/emacs.d/elpa/monokai-theme-20150112.442/monokai-theme-autoloads.el b/emacs.d/elpa/monokai-theme-20150521.2257/monokai-theme-autoloads.el similarity index 88% rename from emacs.d/elpa/monokai-theme-20150112.442/monokai-theme-autoloads.el rename to emacs.d/elpa/monokai-theme-20150521.2257/monokai-theme-autoloads.el index 81db391..d97c9dc 100644 --- a/emacs.d/elpa/monokai-theme-20150112.442/monokai-theme-autoloads.el +++ b/emacs.d/elpa/monokai-theme-20150521.2257/monokai-theme-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "monokai-theme" "monokai-theme.el" (21836 45670 +;;;### (autoloads nil "monokai-theme" "monokai-theme.el" (21898 47967 ;;;;;; 0 0)) ;;; Generated autoloads from monokai-theme.el diff --git a/emacs.d/elpa/monokai-theme-20150521.2257/monokai-theme-pkg.el b/emacs.d/elpa/monokai-theme-20150521.2257/monokai-theme-pkg.el new file mode 100644 index 0000000..970f4e4 --- /dev/null +++ b/emacs.d/elpa/monokai-theme-20150521.2257/monokai-theme-pkg.el @@ -0,0 +1 @@ +(define-package "monokai-theme" "20150521.2257" "A fruity color theme for Emacs." 'nil :url "http://github.com/oneKelvinSmith/monokai-emacs") diff --git a/emacs.d/elpa/monokai-theme-20150112.442/monokai-theme.el b/emacs.d/elpa/monokai-theme-20150521.2257/monokai-theme.el similarity index 99% rename from emacs.d/elpa/monokai-theme-20150112.442/monokai-theme.el rename to emacs.d/elpa/monokai-theme-20150521.2257/monokai-theme.el index be57b81..076cc57 100644 --- a/emacs.d/elpa/monokai-theme-20150112.442/monokai-theme.el +++ b/emacs.d/elpa/monokai-theme-20150521.2257/monokai-theme.el @@ -4,7 +4,7 @@ ;; Author: Kelvin Smith ;; URL: http://github.com/oneKelvinSmith/monokai-emacs -;; Package-Version: 20150112.442 +;; Package-Version: 20150521.2257 ;; Version: 0.2.0 ;; This program is free software; you can redistribute it and/or modify @@ -5339,9 +5339,8 @@ Also affects 'linum-mode' background." ;; highlight-tail `(highlight-tail-colors - ((,monokai-hl . 0)(,green-lc . 20)(,cyan-lc . 30)(,blue-lc . 50) - (,yellow-lc . 60)(,orange-lc . 70)(,magenta-lc . 85)(,monokai-hl . 100))) - + '((,monokai-hl . 0)(,green-lc . 20)(,cyan-lc . 30)(,blue-lc . 50) + (,yellow-lc . 60)(,orange-lc . 70)(,magenta-lc . 85)(,monokai-hl . 100))) ;; vc `(vc-annotate-color-map diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/mc-cycle-cursors.el b/emacs.d/elpa/multiple-cursors-20150528.2303/mc-cycle-cursors.el similarity index 100% rename from emacs.d/elpa/multiple-cursors-20150307.2322/mc-cycle-cursors.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/mc-cycle-cursors.el diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/mc-edit-lines.el b/emacs.d/elpa/multiple-cursors-20150528.2303/mc-edit-lines.el similarity index 100% rename from emacs.d/elpa/multiple-cursors-20150307.2322/mc-edit-lines.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/mc-edit-lines.el diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/mc-hide-unmatched-lines-mode.el b/emacs.d/elpa/multiple-cursors-20150528.2303/mc-hide-unmatched-lines-mode.el similarity index 98% rename from emacs.d/elpa/multiple-cursors-20150307.2322/mc-hide-unmatched-lines-mode.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/mc-hide-unmatched-lines-mode.el index 5221ef8..18e1688 100644 --- a/emacs.d/elpa/multiple-cursors-20150307.2322/mc-hide-unmatched-lines-mode.el +++ b/emacs.d/elpa/multiple-cursors-20150528.2303/mc-hide-unmatched-lines-mode.el @@ -49,7 +49,7 @@ ;;;###autoload (define-minor-mode mc-hide-unmatched-lines-mode - "Minor mode when enabled hides all lines where no cursos (and + "Minor mode when enabled hides all lines where no cursors (and also hum/lines-to-expand below and above) To make use of this mode press \"C-'\" while multiple-cursor-mode is active. You can still edit lines while you are in mc-hide-unmatched-lines diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/mc-mark-more.el b/emacs.d/elpa/multiple-cursors-20150528.2303/mc-mark-more.el similarity index 99% rename from emacs.d/elpa/multiple-cursors-20150307.2322/mc-mark-more.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/mc-mark-more.el index 45a87fc..445f6d3 100644 --- a/emacs.d/elpa/multiple-cursors-20150307.2322/mc-mark-more.el +++ b/emacs.d/elpa/multiple-cursors-20150528.2303/mc-mark-more.el @@ -271,10 +271,10 @@ With zero ARG, skip the last one and mark next." (mc/mark-all-like-this))) ;;;###autoload -(defun mc/mark-all-in-region (beg end) +(defun mc/mark-all-in-region (beg end &optional search) "Find and mark all the parts in the region matching the given search" (interactive "r") - (let ((search (read-from-minibuffer "Mark all in region: ")) + (let ((search (or search (read-from-minibuffer "Mark all in region: "))) (case-fold-search nil)) (if (string= search "") (message "Mark aborted") diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/mc-mark-pop.el b/emacs.d/elpa/multiple-cursors-20150528.2303/mc-mark-pop.el similarity index 100% rename from emacs.d/elpa/multiple-cursors-20150307.2322/mc-mark-pop.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/mc-mark-pop.el diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/mc-separate-operations.el b/emacs.d/elpa/multiple-cursors-20150528.2303/mc-separate-operations.el similarity index 76% rename from emacs.d/elpa/multiple-cursors-20150307.2322/mc-separate-operations.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/mc-separate-operations.el index abbfaee..b587530 100644 --- a/emacs.d/elpa/multiple-cursors-20150307.2322/mc-separate-operations.el +++ b/emacs.d/elpa/multiple-cursors-20150528.2303/mc-separate-operations.el @@ -86,5 +86,36 @@ (setq mc--strings-to-replace (sort (mc--ordered-region-strings) 'string<)) (mc--replace-region-strings)) + +;;;###autoload +(defun mc/vertical-align (character) + "Aligns all cursors vertically with a given CHARACTER to the one with the +highest colum number (the rightest). +Might not behave as intended if more than one cursors are on the same line." + (interactive "c") + (let ((rightest-column (current-column))) + (mc/execute-command-for-all-cursors + (lambda () "get the rightest cursor" + (interactive) + (setq rightest-column (max (current-column) rightest-column)) + )) + (mc/execute-command-for-all-cursors + (lambda () + (interactive) + (let ((missing-spaces (- rightest-column (current-column)))) + (save-excursion (insert (make-string missing-spaces character))) + (forward-char missing-spaces) + ) + )) + ) + ) + +;;;###autoload +(defun mc/vertical-align-with-space () + "Aligns all cursors with whitespace like `mc/vertical-align' does" + (interactive) + (mc/vertical-align 32) + ) + (provide 'mc-separate-operations) ;;; mc-separate-operations.el ends here diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors-autoloads.el b/emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors-autoloads.el similarity index 89% rename from emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors-autoloads.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors-autoloads.el index 319700a..c2ec4f7 100644 --- a/emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors-autoloads.el +++ b/emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "mc-edit-lines" "mc-edit-lines.el" (21801 5303 +;;;### (autoloads nil "mc-edit-lines" "mc-edit-lines.el" (21898 47966 ;;;;;; 0 0)) ;;; Generated autoloads from mc-edit-lines.el @@ -34,11 +34,11 @@ Add one cursor to the beginning of each line in the active region. ;;;*** ;;;### (autoloads nil "mc-hide-unmatched-lines-mode" "mc-hide-unmatched-lines-mode.el" -;;;;;; (21801 5303 0 0)) +;;;;;; (21898 47966 0 0)) ;;; Generated autoloads from mc-hide-unmatched-lines-mode.el (autoload 'mc-hide-unmatched-lines-mode "mc-hide-unmatched-lines-mode" "\ -Minor mode when enabled hides all lines where no cursos (and +Minor mode when enabled hides all lines where no cursors (and also hum/lines-to-expand below and above) To make use of this mode press \"C-'\" while multiple-cursor-mode is active. You can still edit lines while you are in mc-hide-unmatched-lines @@ -48,7 +48,7 @@ mode. To leave this mode press or \"C-g\" ;;;*** -;;;### (autoloads nil "mc-mark-more" "mc-mark-more.el" (21801 5303 +;;;### (autoloads nil "mc-mark-more" "mc-mark-more.el" (21898 47966 ;;;;;; 0 0)) ;;; Generated autoloads from mc-mark-more.el @@ -134,7 +134,7 @@ Find and mark all the parts of the buffer matching the currently active region (autoload 'mc/mark-all-in-region "mc-mark-more" "\ Find and mark all the parts in the region matching the given search -\(fn BEG END)" t nil) +\(fn BEG END &optional SEARCH)" t nil) (autoload 'mc/mark-all-in-region-regexp "mc-mark-more" "\ Find and mark all the parts in the region matching the given regexp @@ -209,7 +209,7 @@ Mark the tag we're in and its pair for renaming. ;;;*** -;;;### (autoloads nil "mc-mark-pop" "mc-mark-pop.el" (21801 5303 +;;;### (autoloads nil "mc-mark-pop" "mc-mark-pop.el" (21898 47966 ;;;;;; 0 0)) ;;; Generated autoloads from mc-mark-pop.el @@ -222,7 +222,7 @@ to the popped mark. ;;;*** ;;;### (autoloads nil "mc-separate-operations" "mc-separate-operations.el" -;;;;;; (21801 5303 0 0)) +;;;;;; (21898 47966 0 0)) ;;; Generated autoloads from mc-separate-operations.el (autoload 'mc/insert-numbers "mc-separate-operations" "\ @@ -238,12 +238,24 @@ Insert increasing numbers for each cursor, starting at 0 or ARG. (autoload 'mc/sort-regions "mc-separate-operations" "\ +\(fn)" t nil) + +(autoload 'mc/vertical-align "mc-separate-operations" "\ +Aligns all cursors vertically with a given CHARACTER to the one with the +highest colum number (the rightest). +Might not behave as intended if more than one cursors are on the same line. + +\(fn CHARACTER)" t nil) + +(autoload 'mc/vertical-align-with-space "mc-separate-operations" "\ +Aligns all cursors with whitespace like `mc/vertical-align' does + \(fn)" t nil) ;;;*** ;;;### (autoloads nil "multiple-cursors-core" "multiple-cursors-core.el" -;;;;;; (21801 5303 0 0)) +;;;;;; (21898 47966 0 0)) ;;; Generated autoloads from multiple-cursors-core.el (autoload 'multiple-cursors-mode "multiple-cursors-core" "\ @@ -254,7 +266,7 @@ Mode while multiple cursors are active. ;;;*** ;;;### (autoloads nil "rectangular-region-mode" "rectangular-region-mode.el" -;;;;;; (21801 5303 0 0)) +;;;;;; (21898 47966 0 0)) ;;; Generated autoloads from rectangular-region-mode.el (autoload 'set-rectangular-region-anchor "rectangular-region-mode" "\ @@ -273,7 +285,7 @@ A mode for creating a rectangular region to edit ;;;*** ;;;### (autoloads nil nil ("mc-cycle-cursors.el" "multiple-cursors-pkg.el" -;;;;;; "multiple-cursors.el") (21801 5303 308589 0)) +;;;;;; "multiple-cursors.el") (21898 47966 449261 0)) ;;;*** diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors-core.el b/emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors-core.el similarity index 99% rename from emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors-core.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors-core.el index 54a993f..8971a42 100644 --- a/emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors-core.el +++ b/emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors-core.el @@ -524,7 +524,7 @@ from being executed if in multiple-cursors-mode." (overlay-put cursor 'kill-ring kill-ring) (overlay-put cursor 'kill-ring-yank-pointer kill-ring-yank-pointer))))))) -(defvar mc/list-file "~/.emacs.d/.mc-lists.el" +(defvar mc/list-file (locate-user-emacs-file ".mc-lists.el") "The position of the file that keeps track of your preferences for running commands with multiple cursors.") diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors-pkg.el b/emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors-pkg.el similarity index 53% rename from emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors-pkg.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors-pkg.el index 0506d6b..a591ef7 100644 --- a/emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors-pkg.el +++ b/emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors-pkg.el @@ -1,4 +1,4 @@ -(define-package "multiple-cursors" "20150307.2322" "Multiple cursors for Emacs." 'nil) +(define-package "multiple-cursors" "20150528.2303" "Multiple cursors for Emacs." 'nil) ;; Local Variables: ;; no-byte-compile: t ;; End: diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors.el b/emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors.el similarity index 100% rename from emacs.d/elpa/multiple-cursors-20150307.2322/multiple-cursors.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/multiple-cursors.el diff --git a/emacs.d/elpa/multiple-cursors-20150307.2322/rectangular-region-mode.el b/emacs.d/elpa/multiple-cursors-20150528.2303/rectangular-region-mode.el similarity index 100% rename from emacs.d/elpa/multiple-cursors-20150307.2322/rectangular-region-mode.el rename to emacs.d/elpa/multiple-cursors-20150528.2303/rectangular-region-mode.el diff --git a/emacs.d/elpa/php-mode-1.5.0/php-mode-autoloads.el b/emacs.d/elpa/php-mode-1.5.0/php-mode-autoloads.el deleted file mode 100644 index 351ac5d..0000000 --- a/emacs.d/elpa/php-mode-1.5.0/php-mode-autoloads.el +++ /dev/null @@ -1,35 +0,0 @@ -;;; php-mode-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) - -;;;### (autoloads nil "php-mode" "../../../../.emacs.d/elpa/php-mode-1.5.0/php-mode.el" -;;;;;; "025ffb038ae62499cd2aa77dc6941e9c") -;;; Generated autoloads from ../../../../.emacs.d/elpa/php-mode-1.5.0/php-mode.el - -(defvar php-file-patterns '("\\.php[s34]?\\'" "\\.phtml\\'" "\\.inc\\'") "\ -List of file patterns for which to automatically invoke `php-mode'.") - -(custom-autoload 'php-file-patterns "php-mode" nil) - -(autoload 'php-mode "php-mode" "\ -Major mode for editing PHP code. - -\\{php-mode-map} - -\(fn)" t nil) - -;;;*** - -;;;### (autoloads nil nil ("../../../../.emacs.d/elpa/php-mode-1.5.0/php-mode-autoloads.el" -;;;;;; "../../../../.emacs.d/elpa/php-mode-1.5.0/php-mode.el") (21570 -;;;;;; 24357 678941 0)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; php-mode-autoloads.el ends here diff --git a/emacs.d/elpa/php-mode-1.5.0/php-mode-pkg.el b/emacs.d/elpa/php-mode-1.5.0/php-mode-pkg.el deleted file mode 100644 index 32ba246..0000000 --- a/emacs.d/elpa/php-mode-1.5.0/php-mode-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "php-mode" "1.5.0" "major mode for editing PHP code" 'nil) diff --git a/emacs.d/elpa/php-mode-1.5.0/php-mode-pkg.elc b/emacs.d/elpa/php-mode-1.5.0/php-mode-pkg.elc deleted file mode 100644 index c7a8c02..0000000 Binary files a/emacs.d/elpa/php-mode-1.5.0/php-mode-pkg.elc and /dev/null differ diff --git a/emacs.d/elpa/php-mode-1.5.0/php-mode.el b/emacs.d/elpa/php-mode-1.5.0/php-mode.el deleted file mode 100644 index d95e771..0000000 --- a/emacs.d/elpa/php-mode-1.5.0/php-mode.el +++ /dev/null @@ -1,1104 +0,0 @@ -;;; php-mode.el --- major mode for editing PHP code - -;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad -;; 2008 Aaron S. Hawley - -;; Maintainer: Aaron S. Hawley -;; Author: Turadg Aleahmad -;; Keywords: php languages oop -;; Created: 1999-05-17 -;; Modified: 2008-11-04 -;; Version: 1.5.0 -;; X-URL: http://php-mode.sourceforge.net/ - -(defconst php-mode-version-number "1.5.0" - "PHP Mode version number.") - -;;; License - -;; 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 -;; of the License, 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, write to the Free Software -;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Usage - -;; Put this file in your Emacs lisp path (eg. site-lisp) and add to -;; your .emacs file: -;; -;; (require 'php-mode) - -;; To use abbrev-mode, add lines like this: -;; (add-hook 'php-mode-hook -;; '(lambda () (define-abbrev php-mode-abbrev-table "ex" "extends"))) - -;; To make php-mode compatible with html-mode, see http://php-mode.sf.net - -;; Many options available under Help:Customize -;; Options specific to php-mode are in -;; Programming/Languages/Php -;; Since it inherits much functionality from c-mode, look there too -;; Programming/Languages/C - -;;; Commentary: - -;; PHP mode is a major mode for editing PHP 3 and 4 source code. It's -;; an extension of C mode; thus it inherits all C mode's navigation -;; functionality. But it colors according to the PHP grammar and indents -;; according to the PEAR coding guidelines. It also includes a couple -;; handy IDE-type features such as documentation search and a source -;; and class browser. - -;;; Contributors: (in chronological order) - -;; Juanjo, Torsten Martinsen, Vinai Kopp, Sean Champ, Doug Marcey, -;; Kevin Blake, Rex McMaster, Mathias Meyer, Boris Folgmann, Roland -;; Rosenfeld, Fred Yankowski, Craig Andrews, John Keller, Ryan -;; Sammartino, ppercot, Valentin Funk, Stig Bakken, Gregory Stark, -;; Chris Morris, Nils Rennebarth, Gerrit Riessen, Eric Mc Sween, -;; Ville Skytta, Giacomo Tesio, Lennart Borgman, Stefan Monnier, -;; Aaron S. Hawley, Ian Eure, Bill Lovett, Dias Badekas, David House - -;;; Changelog: - -;; 1.5 -;; Support function keywords like public, private and the ampersand -;; character for function-based commands. Support abstract, final, -;; static, public, private and protected keywords in Imenu. Fix -;; reversed order of Imenu entries. Use font-lock-preprocessor-face -;; for PHP and ASP tags. Make php-mode-modified a literal value -;; rather than a computed string. Add date and time constants of -;; PHP. (Dias Badekas) Fix false syntax highlighting of keywords -;; because of underscore character. Change HTML indentation warning -;; to match only HTML at the beginning of the line. Fix -;; byte-compiler warnings. Clean-up whitespace and audited style -;; consistency of code. Remove conditional bindings and XEmacs code -;; that likely does nothing. -;; -;; 1.4 -;; Updated GNU GPL to version 3. Ported to Emacs 22 (CC mode -;; 5.31). M-x php-mode-version shows version. Provide end-of-defun -;; beginning-of-defun functionality. Support add-log library. -;; Fix __CLASS__ constant (Ian Eure). Allow imenu to see visibility -;; declarations -- "private", "public", "protected". (Bill Lovett) -;; -;; 1.3 -;; Changed the definition of # using a tip from Stefan -;; Monnier to correct highlighting and indentation. (Lennart Borgman) -;; Changed the highlighting of the HTML part. (Lennart Borgman) -;; -;; See the ChangeLog file included with the source package. - - -;;; Code: - -(require 'speedbar) -(require 'font-lock) -(require 'cc-mode) -(require 'cc-langs) -(require 'custom) -(require 'etags) -(eval-when-compile - (require 'regexp-opt)) - -;; Local variables -(defgroup php nil - "Major mode `php-mode' for editing PHP code." - :prefix "php-" - :group 'languages) - -(defcustom php-default-face 'default - "Default face in `php-mode' buffers." - :type 'face - :group 'php) - -(defcustom php-speedbar-config t - "When set to true automatically configures Speedbar to observe PHP files. -Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s34]?\\)\"" - :type 'boolean - :set (lambda (sym val) - (set-default sym val) - (if (and val (boundp 'speedbar)) - (speedbar-add-supported-extension - "\\.\\(inc\\|php[s34]?\\|phtml\\)"))) - :group 'php) - -(defcustom php-mode-speedbar-open nil - "Normally `php-mode' starts with the speedbar closed. -Turning this on will open it whenever `php-mode' is loaded." - :type 'boolean - :set (lambda (sym val) - (set-default sym val) - (when val - (speedbar 1))) - :group 'php) - -(defvar php-imenu-generic-expression - '( - ("Private Methods" - "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?private\\s-+\\(?:static\\s-+\\)?function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1) - ("Protected Methods" - "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?protected\\s-+\\(?:static\\s-+\\)?function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1) - ("Public Methods" - "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?public\\s-+\\(?:static\\s-+\\)?function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1) - ("Classes" - "^\\s-*class\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*" 1) - ("All Functions" - "^\\s-*\\(?:\\(?:abstract\\|final\\|private\\|protected\\|public\\|static\\)\\s-+\\)*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1) - ) - "Imenu generic expression for PHP Mode. See `imenu-generic-expression'." - ) - -(defcustom php-manual-url "http://www.php.net/manual/en/" - "URL at which to find PHP manual. -You can replace \"en\" with your ISO language code." - :type 'string - :group 'php) - -(defcustom php-search-url "http://www.php.net/" - "URL at which to search for documentation on a word." - :type 'string - :group 'php) - -(defcustom php-completion-file "" - "Path to the file which contains the function names known to PHP." - :type 'string - :group 'php) - -(defcustom php-manual-path "" - "Path to the directory which contains the PHP manual." - :type 'string - :group 'php) - -;;;###autoload -(defcustom php-file-patterns '("\\.php[s34]?\\'" "\\.phtml\\'" "\\.inc\\'") - "List of file patterns for which to automatically invoke `php-mode'." - :type '(repeat (regexp :tag "Pattern")) - :set (lambda (sym val) - (set-default sym val) - (let ((php-file-patterns-temp val)) - (while php-file-patterns-temp - (add-to-list 'auto-mode-alist - (cons (car php-file-patterns-temp) 'php-mode)) - (setq php-file-patterns-temp (cdr php-file-patterns-temp))))) - :group 'php) - -(defcustom php-mode-hook nil - "List of functions to be executed on entry to `php-mode'." - :type 'hook - :group 'php) - -(defcustom php-mode-pear-hook nil - "Hook called when a PHP PEAR file is opened with `php-mode'." - :type 'hook - :group 'php) - -(defcustom php-mode-force-pear nil - "Normally PEAR coding rules are enforced only when the filename contains \"PEAR.\" -Turning this on will force PEAR rules on all PHP files." - :type 'boolean - :group 'php) - -(defconst php-mode-modified "2008-11-04" - "PHP Mode build date.") - -(defun php-mode-version () - "Display string describing the version of PHP mode." - (interactive) - (message "PHP mode %s of %s" - php-mode-version-number php-mode-modified)) - -(defconst php-beginning-of-defun-regexp - "^\\s-*\\(?:\\(?:abstract\\|final\\|private\\|protected\\|public\\|static\\)\\s-+\\)*function\\s-+&?\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" - "Regular expression for a PHP function.") - -(defun php-beginning-of-defun (&optional arg) - "Move to the beginning of the ARGth PHP function from point. -Implements PHP version of `beginning-of-defun-function'." - (interactive "p") - (let ((arg (or arg 1))) - (while (> arg 0) - (re-search-backward php-beginning-of-defun-regexp - nil 'noerror) - (setq arg (1- arg))) - (while (< arg 0) - (end-of-line 1) - (let ((opoint (point))) - (beginning-of-defun 1) - (forward-list 2) - (forward-line 1) - (if (eq opoint (point)) - (re-search-forward php-beginning-of-defun-regexp - nil 'noerror)) - (setq arg (1+ arg)))))) - -(defun php-end-of-defun (&optional arg) - "Move the end of the ARGth PHP function from point. -Implements PHP befsion of `end-of-defun-function' - -See `php-beginning-of-defun'." - (interactive "p") - (php-beginning-of-defun (- (or arg 1)))) - - -(defvar php-warned-bad-indent nil) -(make-variable-buffer-local 'php-warned-bad-indent) - -;; Do it but tell it is not good if html tags in buffer. -(defun php-check-html-for-indentation () - (let ((html-tag-re "^\\s-*") - (here (point))) - (if (not (or (re-search-forward html-tag-re (line-end-position) t) - (re-search-backward html-tag-re (line-beginning-position) t))) - t - (goto-char here) - (setq php-warned-bad-indent t) - (lwarn 'php-indent :warning - "\n\t%s\n\t%s\n\t%s\n" - "Indentation fails badly with mixed HTML and PHP." - "Look for an Emacs Lisp library that supports \"multiple" - "major modes\" like mumamo, mmm-mode or multi-mode.") - nil))) - -(defun php-cautious-indent-region (start end &optional quiet) - (if (or php-warned-bad-indent - (php-check-html-for-indentation)) - (funcall 'c-indent-region start end quiet))) - -(defun php-cautious-indent-line () - (if (or php-warned-bad-indent - (php-check-html-for-indentation)) - (funcall 'c-indent-line))) - -(defconst php-tags '("" "[^_]?") - '(1 font-lock-constant-face)) - - ;; Fontify keywords - (cons - (concat "[^_$]?\\<\\(" php-keywords "\\)\\>[^_]?") - '(1 font-lock-keyword-face)) - - ;; Fontify keywords and targets, and case default tags. - (list "\\<\\(break\\|case\\|continue\\)\\>\\s-+\\(-?\\sw+\\)?" - '(1 font-lock-keyword-face) '(2 font-lock-constant-face t t)) - ;; This must come after the one for keywords and targets. - '(":" ("^\\s-+\\(\\sw+\\)\\s-+\\s-+$" - (beginning-of-line) (end-of-line) - (1 font-lock-constant-face))) - - ;; treat 'print' as keyword only when not used like a function name - '("\\" . font-lock-keyword-face) - - ;; Fontify PHP tag - (cons php-tags-key font-lock-preprocessor-face) - - ;; Fontify ASP-style tag - '("<\\%\\(=\\)?" . font-lock-preprocessor-face) - '("\\%>" . font-lock-preprocessor-face) - - ) - "Subdued level highlighting for PHP mode.") - -(defconst php-font-lock-keywords-2 - (append - php-font-lock-keywords-1 - (list - - ;; class declaration - '("\\<\\(class\\|interface\\)\\s-+\\(\\sw+\\)?" - (1 font-lock-keyword-face) (2 font-lock-type-face nil t)) - ;; handle several words specially, to include following word, - ;; thereby excluding it from unknown-symbol checks later - ;; FIX to handle implementing multiple - ;; currently breaks on "class Foo implements Bar, Baz" - '("\\<\\(new\\|extends\\|implements\\)\\s-+\\$?\\(\\sw+\\)" - (1 font-lock-keyword-face) (2 font-lock-type-face)) - - ;; function declaration - '("\\<\\(function\\)\\s-+&?\\(\\sw+\\)\\s-*(" - (1 font-lock-keyword-face) - (2 font-lock-function-name-face nil t)) - - ;; class hierarchy - '("\\<\\(self\\|parent\\)\\>" (1 font-lock-constant-face nil nil)) - - ;; method and variable features - '("\\<\\(private\\|protected\\|public\\)\\s-+\\$?\\sw+" - (1 font-lock-keyword-face)) - - ;; method features - '("^\\s-*\\(abstract\\|static\\|final\\)\\s-+\\$?\\sw+" - (1 font-lock-keyword-face)) - - ;; variable features - '("^\\s-*\\(static\\|const\\)\\s-+\\$?\\sw+" - (1 font-lock-keyword-face)) - )) - "Medium level highlighting for PHP mode.") - -(defconst php-font-lock-keywords-3 - (append - php-font-lock-keywords-2 - (list - - ;; or for HTML - ;;'(" ]*>" . font-lock-constant-face) - ;;'("]*" . font-lock-constant-face) - ;;'(" - '("<[^>]*\\(>\\)" (1 font-lock-constant-face)) - - ;; HTML tags - '("\\(<[a-z]+\\)[[:space:]]+\\([a-z:]+=\\)[^>]*?" (1 font-lock-constant-face) (2 font-lock-constant-face) ) - '("\"[[:space:]]+\\([a-z:]+=\\)" (1 font-lock-constant-face)) - - ;; HTML entities - ;;'("&\\w+;" . font-lock-variable-name-face) - - ;; warn about '$' immediately after -> - '("\\$\\sw+->\\s-*\\(\\$\\)\\(\\sw+\\)" - (1 font-lock-warning-face) (2 php-default-face)) - - ;; warn about $word.word -- it could be a valid concatenation, - ;; but without any spaces we'll assume $word->word was meant. - '("\\$\\sw+\\(\\.\\)\\sw" - 1 font-lock-warning-face) - - ;; Warn about ==> instead of => - '("==+>" . font-lock-warning-face) - - ;; exclude casts from bare-word treatment (may contain spaces) - `(,(concat "(\\s-*\\(" php-types "\\)\\s-*)") - 1 font-lock-type-face) - - ;; PHP5: function declarations may contain classes as parameters type - `(,(concat "[(,]\\s-*\\(\\sw+\\)\\s-+&?\\$\\sw+\\>") - 1 font-lock-type-face) - - ;; Fontify variables and function calls - '("\\$\\(this\\|that\\)\\W" (1 font-lock-constant-face nil nil)) - `(,(concat "\\$\\(" php-superglobals "\\)\\W") - (1 font-lock-constant-face nil nil)) ;; $_GET & co - '("\\$\\(\\sw+\\)" (1 font-lock-variable-name-face)) ;; $variable - '("->\\(\\sw+\\)" (1 font-lock-variable-name-face t t)) ;; ->variable - '("->\\(\\sw+\\)\\s-*(" . (1 php-default-face t t)) ;; ->function_call - '("\\(\\sw+\\)::\\sw+\\s-*(?" . (1 font-lock-type-face)) ;; class::member - '("::\\(\\sw+\\>[^(]\\)" . (1 php-default-face)) ;; class::constant - '("\\<\\sw+\\s-*[[(]" . php-default-face) ;; word( or word[ - '("\\<[0-9]+" . php-default-face) ;; number (also matches word) - - ;; Warn on any words not already fontified - '("\\<\\sw+\\>" . font-lock-warning-face) - - )) - "Gauchy level highlighting for PHP mode.") - -(provide 'php-mode) - -;;; php-mode.el ends here diff --git a/emacs.d/elpa/php-mode-1.5.0/php-mode.elc b/emacs.d/elpa/php-mode-1.5.0/php-mode.elc deleted file mode 100644 index bdc7f49..0000000 Binary files a/emacs.d/elpa/php-mode-1.5.0/php-mode.elc and /dev/null differ diff --git a/emacs.d/elpa/php-mode-20150623.431/php-mode-autoloads.el b/emacs.d/elpa/php-mode-20150623.431/php-mode-autoloads.el new file mode 100644 index 0000000..90e0500 --- /dev/null +++ b/emacs.d/elpa/php-mode-20150623.431/php-mode-autoloads.el @@ -0,0 +1,34 @@ +;;; php-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) + +;;;### (autoloads nil "php-mode" "php-mode.el" (21898 47965 0 0)) +;;; Generated autoloads from php-mode.el + +(let ((loads (get 'php 'custom-loads))) (if (member '"php-mode" loads) nil (put 'php 'custom-loads (cons '"php-mode" loads)))) + +(defvar php-extra-constants 'nil "\ +A list of additional strings to treat as PHP constants.") + +(custom-autoload 'php-extra-constants "php-mode" nil) + +(add-to-list 'interpreter-mode-alist (cons "php" 'php-mode)) + +(autoload 'php-mode "php-mode" "\ +Major mode for editing PHP code. + +\\{php-mode-map} + +\(fn)" t nil) + +(dolist (pattern '("\\.php[s345t]?\\'" "\\.phtml\\'" "Amkfile" "\\.amk$")) (add-to-list 'auto-mode-alist `(,pattern . php-mode) t)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; php-mode-autoloads.el ends here diff --git a/emacs.d/elpa/php-mode-20150623.431/php-mode-pkg.el b/emacs.d/elpa/php-mode-20150623.431/php-mode-pkg.el new file mode 100644 index 0000000..2c2fe6b --- /dev/null +++ b/emacs.d/elpa/php-mode-20150623.431/php-mode-pkg.el @@ -0,0 +1 @@ +(define-package "php-mode" "20150623.431" "Major mode for editing PHP code" 'nil :url "https://github.com/ejmr/php-mode") diff --git a/emacs.d/elpa/php-mode-20150623.431/php-mode.el b/emacs.d/elpa/php-mode-20150623.431/php-mode.el new file mode 100644 index 0000000..c908372 --- /dev/null +++ b/emacs.d/elpa/php-mode-20150623.431/php-mode.el @@ -0,0 +1,1541 @@ +;;; php-mode.el --- Major mode for editing PHP code + +;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad +;; 2008 Aaron S. Hawley +;; 2011, 2012, 2013, 2014, 2015 Eric James Michael Ritz + +;;; Author: Eric James Michael Ritz +;;; URL: https://github.com/ejmr/php-mode +;; Package-Version: 20150623.431 +;;; Version: 1.17.0 + +(defconst php-mode-version-number "1.17.0" + "PHP Mode version number.") + +(defconst php-mode-modified "2015-06-23" + "PHP Mode build date.") + +;;; License + +;; 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 +;; of the License, 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, write to the Free Software +;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +;; 02110-1301, USA. + +;;; Usage + +;; Put this file in your Emacs lisp path (eg. site-lisp) and add to +;; your .emacs file: +;; +;; (require 'php-mode) + +;; To use abbrev-mode, add lines like this: +;; (add-hook 'php-mode-hook +;; '(lambda () (define-abbrev php-mode-abbrev-table "ex" "extends"))) + +;; To make php-mode compatible with html-mode, see http://php-mode.sf.net + +;; Many options available under Help:Customize +;; Options specific to php-mode are in +;; Programming/Languages/Php +;; Since it inherits much functionality from c-mode, look there too +;; Programming/Languages/C + +;;; Commentary: + +;; PHP mode is a major mode for editing PHP source code. It's an +;; extension of C mode; thus it inherits all C mode's navigation +;; functionality. But it colors according to the PHP grammar and +;; indents according to the PEAR coding guidelines. It also includes +;; a couple handy IDE-type features such as documentation search and a +;; source and class browser. + +;;; Code: + +(require 'cc-mode) +(eval-when-compile + (require 'cc-langs) + (require 'cc-fonts)) + +;; Boilerplate from other `cc-mode' derived modes. See +;; http://cc-mode.sourceforge.net/derived-mode-ex.el for details on how this all +;; fits together. +(eval-and-compile + (c-add-language 'php-mode 'java-mode)) + +(require 'font-lock) +(require 'add-log) +(require 'custom) +(require 'flymake) +(require 'etags) +(require 'speedbar) +(eval-when-compile + (unless (require 'cl-lib nil t) + (require 'cl)) + (require 'regexp-opt) + (defvar c-vsemi-status-unknown-p) + (defvar syntax-propertize-via-font-lock)) + +;; Work around emacs bug#18845, cc-mode expects cl to be loaded +;; while php-mode only uses cl-lib (without compatibility aliases) +(eval-and-compile + (if (and (= emacs-major-version 24) (>= emacs-minor-version 4)) + (require 'cl))) + +;; Use the recommended cl functions in php-mode but alias them to the +;; old names when we detect emacs < 24.3 +(if (and (= emacs-major-version 24) (< emacs-minor-version 3)) + (unless (fboundp 'cl-set-difference) + (defalias 'cl-set-difference 'set-difference))) + + +;; Local variables +;;;###autoload +(defgroup php nil + "Major mode `php-mode' for editing PHP code." + :prefix "php-" + :group 'languages + :link '(url-link :tag "Official Site" "https://github.com/ejmr/php-mode") + :link '(url-link :tag "PHP Mode Wiki" "https://github.com/ejmr/php-mode/wiki")) + +(defcustom php-executable (or (executable-find "php") + "/usr/bin/php") + "The location of the PHP executable." + :type 'string + :group 'php) + +(defcustom php-default-face 'default + "Default face in `php-mode' buffers." + :type 'face + :group 'php) + +(defcustom php-speedbar-config t + "When set to true automatically configures Speedbar to observe PHP files. +Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s345]?\\)\"" + :type 'boolean + :set (lambda (sym val) + (set-default sym val) + (when val + (speedbar-add-supported-extension + "\\.\\(inc\\|php[s345]?\\|phtml\\)"))) + :group 'php) + +(defcustom php-mode-speedbar-open nil + "Normally `php-mode' starts with the speedbar closed. +Turning this on will open it whenever `php-mode' is loaded." + :type 'boolean + :set (lambda (sym val) + (set-default sym val) + (when val + (speedbar 1))) + :group 'php) + +(defcustom php-template-compatibility t + "Should detect presence of html tags." + :type 'boolean + :group 'php) + +(defun php-mode-extra-constants-create-regexp(kwds) + "Create regexp for the list of extra constant keywords KWDS." + (concat "[^_$]?\\<\\(" + (regexp-opt + (append kwds + (when (boundp 'web-mode-extra-php-constants) web-mode-extra-php-constants))) + "\\)\\>[^_]?")) + +(defun php-mode-extra-constants-set(sym value) + "Apply the list of extra constant keywords VALUE. + +This function is called when the custom variable php-extra-constants +is updated. The web-mode-extra-constants list is appended to the list +of constants when set." + ;; remove old keywords + (when (boundp 'php-extra-constants) + (font-lock-remove-keywords + 'php-mode `((,(php-mode-extra-constants-create-regexp php-extra-constants) 1 font-lock-constant-face)))) + ;; add new keywords + (when value + (font-lock-add-keywords + 'php-mode `((,(php-mode-extra-constants-create-regexp value) 1 font-lock-constant-face)))) + (set sym value)) + +(defcustom php-lineup-cascaded-calls nil + "Indent chained method calls to the previous line" + :type 'boolean + :group 'php) + +;;;###autoload +(defcustom php-extra-constants '() + "A list of additional strings to treat as PHP constants." + :type 'list + :set 'php-mode-extra-constants-set + :group 'php) + +(defun php-create-regexp-for-method (visibility) + "Make a regular expression for methods with the given VISIBILITY. + +VISIBILITY must be a string that names the visibility for a PHP +method, e.g. 'public'. The parameter VISIBILITY can itself also +be a regular expression. + +The regular expression this function returns will check for other +keywords that can appear in method signatures, e.g. 'final' and +'static'. The regular expression will have one capture group +which will be the name of the method." + (concat + ;; Initial space with possible 'abstract' or 'final' keywords + "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?" + ;; 'static' keyword may come either before or after visibility + "\\(?:" visibility "\\(?:\\s-+static\\)?\\|\\(?:static\\s-+\\)?" visibility "\\)\\s-+" + ;; Make sure 'function' comes next with some space after + "function\\s-+" + ;; Capture the name as the first group and the regexp and make sure + ;; by the end we see the opening parenthesis for the parameters. + "\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(")) + +(defun php-create-regexp-for-classlike (type) + "Accepts a `type' of a 'classlike' object as a string, such as +'class' or 'interface', and returns a regexp as a string which +can be used to match against definitions for that classlike." + (concat + ;; First see if 'abstract' or 'final' appear, although really these + ;; are not valid for all values of `type' that the function + ;; accepts. + "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?" + ;; The classlike type + type + ;; Its name, which is the first captured group in the regexp. We + ;; allow backslashes in the name to handle namespaces, but again + ;; this is not necessarily correct for all values of `type'. + "\\s-+\\(\\(?:\\sw\\|\\\\\\|\\s_\\)+\\)")) + +(defvar php-imenu-generic-expression + `(("Namespaces" + ,(php-create-regexp-for-classlike "namespace") 1) + ("Classes" + ,(php-create-regexp-for-classlike "class") 1) + ("Interfaces" + ,(php-create-regexp-for-classlike "interface") 1) + ("Traits" + ,(php-create-regexp-for-classlike "trait") 1) + ("All Methods" + ,(php-create-regexp-for-method "\\(?:\\sw\\|\\s_\\)+") 1) + ("Private Methods" + ,(php-create-regexp-for-method "private") 1) + ("Protected Methods" + ,(php-create-regexp-for-method "protected") 1) + ("Public Methods" + ,(php-create-regexp-for-method "public") 1) + ("Anonymous Functions" + "\\<\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*=\\s-*function\\s-*(" 1) + ("Named Functions" + "^\\s-*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1)) + "Imenu generic expression for PHP Mode. See `imenu-generic-expression'.") + +(defcustom php-manual-url "http://www.php.net/manual/en/" + "URL at which to find PHP manual. +You can replace \"en\" with your ISO language code." + :type 'string + :group 'php) + +(defcustom php-search-url "http://www.php.net/" + "URL at which to search for documentation on a word." + :type 'string + :group 'php) + +(defcustom php-completion-file "" + "Path to the file which contains the function names known to PHP." + :type 'string + :group 'php) + +(defcustom php-manual-path "" + "Path to the directory which contains the PHP manual." + :type 'string + :group 'php) + +;;;###autoload +(add-to-list 'interpreter-mode-alist (cons "php" 'php-mode)) + +(defcustom php-mode-hook nil + "List of functions to be executed on entry to `php-mode'." + :type 'hook + :group 'php) + +(defcustom php-mode-pear-hook nil + "Hook called when a PHP PEAR file is opened with `php-mode'." + :type 'hook + :group 'php) + +(defcustom php-mode-drupal-hook nil + "Hook called when a Drupal file is opened with `php-mode'." + :type 'hook + :group 'php) + +(defcustom php-mode-wordpress-hook nil + "Hook called when a WordPress file is opened with `php-mode'." + :type 'hook + :group 'php) + +(defcustom php-mode-symfony2-hook nil + "Hook called when a Symfony2 file is opened with `php-mode'." + :type 'hook + :group 'php) + +(defcustom php-mode-psr2-hook nil + "Hook called when a PSR-2 file is opened with `php-mode'." + :type 'hook + :group 'php) + +(defcustom php-mode-force-pear nil + "Normally PEAR coding rules are enforced only when the filename contains \"PEAR.\" +Turning this on will force PEAR rules on all PHP files." + :type 'boolean + :group 'php) + +(defcustom php-mode-warn-if-mumamo-off t + "Warn once per buffer if you try to indent a buffer without +mumamo-mode turned on. Detects if there are any HTML tags in the +buffer before warning, but this is is not very smart; e.g. if you +have any tags inside a PHP string, it will be fooled." + :type '(choice (const :tag "Warg" t) (const "Don't warn" nil)) + :group 'php) + +(defcustom php-mode-coding-style 'pear + "Select default coding style to use with php-mode. +This variable can take one of the following symbol values: + +`Default' - use a reasonable default style for PHP. + +`PEAR' - use coding styles preferred for PEAR code and modules. + +`Drupal' - use coding styles preferred for working with Drupal projects. + +`WordPress' - use coding styles preferred for working with WordPress projects. + +`Symfony2' - use coding styles preferred for working with Symfony2 projects. + +`PSR-2' - use coding styles preferred for working with projects using PSR-2 standards." + :type '(choice (const :tag "Default" default) + (const :tag "PEAR" pear) + (const :tag "Drupal" drupal) + (const :tag "WordPress" wordpress) + (const :tag "Symfony2" symfony2) + (const :tag "PSR-2" psr2)) + :group 'php + :set 'php-mode-custom-coding-style-set + :initialize 'custom-initialize-default) + +(defun php-mode-custom-coding-style-set (sym value) + (when (eq major-mode 'php-mode) + (set sym value) + (set-default sym value) + (cond ((eq value 'pear) + (php-enable-pear-coding-style)) + ((eq value 'default) + (php-enable-default-coding-style)) + ((eq value 'drupal) + (php-enable-drupal-coding-style)) + ((eq value 'wordpress) + (php-enable-wordpress-coding-style)) + ((eq value 'symfony2) + (php-enable-symfony2-coding-style)) + ((eq value 'psr2) + (php-enable-psr2-coding-style))))) + +(defun php-mode-version () + "Display string describing the version of PHP mode." + (interactive) + (message "PHP mode %s of %s" + php-mode-version-number php-mode-modified)) + +(defvar php-mode-map + (let ((map (make-sparse-keymap))) + ;; (define-key map [menu-bar php] + ;; (cons "PHP" (make-sparse-keymap "PHP"))) + + ;; (define-key map [menu-bar php complete-function] + ;; '("Complete function name" . php-complete-function)) + ;; (define-key map [menu-bar php browse-manual] + ;; '("Browse manual" . php-browse-manual)) + ;; (define-key map [menu-bar php search-documentation] + ;; '("Search documentation" . php-search-documentation)) + + ;; By default PHP mode binds C-M-h to c-mark-function, which it + ;; inherits from cc-mode. But there are situations where + ;; c-mark-function fails to properly mark a function. For + ;; example, if we use c-mark-function within a method definition + ;; then the region will expand beyond the method and into the + ;; class definition itself. + ;; + ;; Changing the default to mark-defun provides behavior that users + ;; are more likely to expect. + (define-key map (kbd "C-M-h") 'mark-defun) + + ;; Many packages based on cc-mode provide the 'C-c C-w' binding + ;; to toggle Subword Mode. See the page + ;; + ;; https://www.gnu.org/software/emacs/manual/html_node/ccmode/Subword-Movement.html + ;; + ;; for more information about Submode Word. + (if (boundp 'subword-mode) + (if subword-mode + (subword-mode nil) + (subword-mode t))) + + ;; We inherit c-beginning-of-defun and c-end-of-defun from CC Mode + ;; but we have two replacement functions specifically for PHP. We + ;; remap the commands themselves and not their default + ;; key-bindings so that our PHP-specific versions will work even + ;; if the user has reconfigured their keys, e.g. if they rebind + ;; c-end-of-defun to something other than C-M-e. + (define-key map [remap c-beginning-of-defun] 'php-beginning-of-defun) + (define-key map [remap c-end-of-defun] 'php-end-of-defun) + + (define-key map [(control c) (control f)] 'php-search-documentation) + (define-key map [(meta tab)] 'php-complete-function) + (define-key map [(control c) (control m)] 'php-browse-manual) + (define-key map [(control .)] 'php-show-arglist) + (define-key map [(control c) (control r)] 'php-send-region) + ;; Use the Emacs standard indentation binding. This may upset c-mode + ;; which does not follow this at the moment, but I see no better + ;; choice. + (define-key map [tab] 'indent-for-tab-command) + map) + "Keymap for `php-mode'") + +(c-lang-defconst c-mode-menu + php (append '(["Complete function name" php-complete-function t] + ["Browse manual" php-browse-manual t] + ["Search documentation" php-search-documentation t] + ["----" t]) + (c-lang-const c-mode-menu))) + +(c-lang-defconst c-at-vsemi-p-fn + php 'php-c-at-vsemi-p) + +(c-lang-defconst c-vsemi-status-unknown-p-fn + php 'php-c-vsemi-status-unknown-p) + +;; Make php-mode recognize opening tags as preprocessor macro's. +;; +;; This is a workaround, the tags must be recognized as something +;; in order for the syntactic guesses of code below the tag +;; to be correct and as a result not break indentation. +;; +;; Note that submatches or \\| here are not expected by cc-mode. +(c-lang-defconst c-opt-cpp-prefix + php "\\s-*<\\?") + +(c-lang-defconst c-identifier-ops + php '( + (left-assoc "\\" "::" "->") + (prefix "\\" "::"))) + +;; Allow '\' when scanning from open brace back to defining +;; construct like class +(c-lang-defconst c-block-prefix-disallowed-chars + php (cl-set-difference (c-lang-const c-block-prefix-disallowed-chars) + '(?\\))) + +;; Allow $ so variables are recognized in cc-mode and remove @. This +;; makes cc-mode highlight variables and their type hints in arglists. +(c-lang-defconst c-symbol-start + php (concat "[" c-alpha "_$]")) + +;; All string literals can possibly span multiple lines +(c-lang-defconst c-multiline-string-start-char + php t) + +(c-lang-defconst c-assignment-operators + ;; falls back to java, so no need to specify the language + php (append (remove ">>>=" (c-lang-const c-assignment-operators)) + '(".="))) + +(c-lang-defconst beginning-of-defun-function + php 'php-beginning-of-defun) + +(c-lang-defconst end-of-defun-function + php 'php-end-of-defun) + +(c-lang-defconst c-primitive-type-kwds + php '("int" "integer" "bool" "boolean" "float" "double" "real" + "string" "object")) + +(c-lang-defconst c-class-decl-kwds + "Keywords introducing declarations where the following block (if any) +contains another declaration level that should be considered a class." + php '("class" "trait" "interface")) + +(c-lang-defconst c-brace-list-decl-kwds + "Keywords introducing declarations where the following block (if +any) is a brace list. + +PHP does not have an \"enum\"-like keyword." + php nil) + +(c-lang-defconst c-typeless-decl-kwds + php (append (c-lang-const c-class-decl-kwds) '("function"))) + +(c-lang-defconst c-modifier-kwds + php '("abstract" "const" "final" "native" "static" "strictfp" + "synchronized" "transient" "volatile")) + +(c-lang-defconst c-protection-kwds + "Access protection label keywords in classes." + php '("private" "protected" "public")) + +(c-lang-defconst c-postfix-decl-spec-kwds + php '("implements" "extends")) + +(c-lang-defconst c-type-list-kwds + php '("new" "use" "implements" "extends" "namespace" "instanceof" "insteadof")) + +(c-lang-defconst c-ref-list-kwds + php nil) + +(c-lang-defconst c-block-stmt-2-kwds + php (append '("elseif" "foreach" "declare") + (remove "synchronized" (c-lang-const c-block-stmt-2-kwds)))) + +(c-lang-defconst c-simple-stmt-kwds + php (append '("include" "include_once" "require" "require_once" + "echo" "print" "die" "exit") + (c-lang-const c-simple-stmt-kwds))) + +(c-lang-defconst c-constant-kwds + php '("true" + "false" + "null")) + +(c-lang-defconst c-lambda-kwds + php '("function")) + +(c-lang-defconst c-other-kwds + "Keywords not accounted for by any other `*-kwds' language constant." + php '( + "__halt_compiler" + "and" + "array" + "callable" + "as" + "break" + "catch all" + "catch" + "clone" + "default" + "empty" + "enddeclare" + "endfor" + "endforeach" + "endif" + "endswitch" + "endwhile" + "eval" + "global" + "isset" + "list" + "or" + "parent" + "static" + "unset" + "var" + "xor" + "yield" + + ;; Below keywords are technically not reserved keywords, but + ;; threated no differently by php-mode from actual reserved + ;; keywords + ;; + ;;; declare directives: + "encoding" + "ticks" + + ;;; self for static references: + "self" + )) + +;; PHP does not have <> templates/generics +(c-lang-defconst c-recognize-<>-arglists + php nil) + +(c-lang-defconst c-enums-contain-decls + php nil) + +(c-lang-defconst c-nonlabel-token-key + "Regexp matching things that can't occur in generic colon labels. + +This overrides cc-mode `c-nonlabel-token-key' to support switching on +double quoted strings and true/false/null. + +Note: this regexp is also applied to goto-labels, a future improvement +might be to handle switch and goto labels differently." + php (concat + ;; All keywords except `c-label-kwds' and `c-constant-kwds'. + (c-make-keywords-re t + (cl-set-difference (c-lang-const c-keywords) + (append (c-lang-const c-label-kwds) + (c-lang-const c-constant-kwds)) + :test 'string-equal)))) + +(defun php-lineup-cascaded-calls (langelem) + "Line up chained methods using `c-lineup-cascaded-calls', +but only if the setting is enabled" + (if php-lineup-cascaded-calls + (c-lineup-cascaded-calls langelem))) + +(c-add-style + "php" + '((c-basic-offset . 4) + (c-doc-comment-style . javadoc) + (c-offsets-alist . ((arglist-close . php-lineup-arglist-close) + (arglist-cont . (first php-lineup-cascaded-calls 0)) + (arglist-cont-nonempty . (first php-lineup-cascaded-calls c-lineup-arglist)) + (arglist-intro . php-lineup-arglist-intro) + (case-label . +) + (class-open . -) + (comment-intro . 0) + (inlambda . 0) + (inline-open . 0) + (label . +) + (statement-cont . (first php-lineup-cascaded-calls php-lineup-string-cont +)) + (substatement-open . 0) + (topmost-intro-cont . (first php-lineup-cascaded-calls +)))))) + +(defun php-enable-default-coding-style () + "Set PHP Mode to use reasonable default formatting." + (interactive) + (c-set-style "php")) + +(c-add-style + "pear" + '("php" + (c-basic-offset . 4) + (c-offsets-alist . ((case-label . 0))))) + +(defun php-enable-pear-coding-style () + "Sets up php-mode to use the coding styles preferred for PEAR +code and modules." + (interactive) + (setq tab-width 4 + indent-tabs-mode nil) + (c-set-style "pear") + + ;; Undo drupal/PSR-2 coding style whitespace effects + (set (make-local-variable 'show-trailing-whitespace) + (default-value 'show-trailing-whitespace))) + +(c-add-style + "drupal" + '("php" + (c-basic-offset . 2))) + +(defun php-enable-drupal-coding-style () + "Makes php-mode use coding styles that are preferable for +working with Drupal." + (interactive) + (setq tab-width 2 + indent-tabs-mode nil + fill-column 78) + (set (make-local-variable 'show-trailing-whitespace) t) + (add-hook 'before-save-hook 'delete-trailing-whitespace nil t) + (c-set-style "drupal")) + +(c-add-style + "wordpress" + '("php" + (c-basic-offset . 4))) + +(defun php-enable-wordpress-coding-style () + "Makes php-mode use coding styles that are preferable for +working with Wordpress." + (interactive) + (setq indent-tabs-mode t + fill-column 78 + tab-width 4 + c-indent-comments-syntactically-p t) + (c-set-style "wordpress") + + ;; Undo drupal/PSR-2 coding style whitespace effects + (set (make-local-variable 'show-trailing-whitespace) + (default-value 'show-trailing-whitespace))) + +(c-add-style + "symfony2" + '("php" + (c-offsets-alist . ((statement-cont . php-lineup-hanging-semicolon))))) + +(defun php-enable-symfony2-coding-style () + "Makes php-mode use coding styles that are preferable for +working with Symfony2." + (interactive) + (setq indent-tabs-mode nil + fill-column 78 + c-indent-comments-syntactically-p t + require-final-newline t) + (c-set-style "symfony2") + + ;; Undo drupal/PSR-2 coding style whitespace effects + (set (make-local-variable 'show-trailing-whitespace) + (default-value 'show-trailing-whitespace))) + +(c-add-style + "psr2" + '("php" + (c-offsets-alist . ((statement-cont . +))))) + +(defun php-enable-psr2-coding-style () + "Makes php-mode comply to the PSR-2 coding style" + (interactive) + (setq indent-tabs-mode nil + fill-column 78 + c-indent-comments-syntactically-p t + require-final-newline t) + (c-set-style "psr2") + + ;; Apply drupal-like coding style whitespace effects + (set (make-local-variable 'require-final-newline) t) + (set (make-local-variable 'show-trailing-whitespace) t) + (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)) + +(defconst php-beginning-of-defun-regexp + "^\\s-*\\(?:\\(?:abstract\\|final\\|private\\|protected\\|public\\|static\\)\\s-+\\)*function\\s-+&?\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" + "Regular expression for a PHP function.") + +(defun php-beginning-of-defun (&optional arg) + "Move to the beginning of the ARGth PHP function from point. +Implements PHP version of `beginning-of-defun-function'." + (interactive "p") + (let ((arg (or arg 1))) + (while (> arg 0) + (re-search-backward php-beginning-of-defun-regexp + nil 'noerror) + (setq arg (1- arg))) + (while (< arg 0) + (end-of-line 1) + (let ((opoint (point))) + (beginning-of-defun 1) + (forward-list 2) + (forward-line 1) + (if (eq opoint (point)) + (re-search-forward php-beginning-of-defun-regexp + nil 'noerror)) + (setq arg (1+ arg)))))) + +(defun php-end-of-defun (&optional arg) + "Move the end of the ARGth PHP function from point. +Implements PHP befsion of `end-of-defun-function' + +See `php-beginning-of-defun'." + (interactive "p") + (php-beginning-of-defun (- (or arg 1)))) + + +(defvar php-warned-bad-indent nil) + +;; Do it but tell it is not good if html tags in buffer. +(defun php-check-html-for-indentation () + (let ((html-tag-re "^\\s-*") + (here (point))) + (goto-char (line-beginning-position)) + (if (or (when (boundp 'mumamo-multi-major-mode) mumamo-multi-major-mode) + ;; Fix-me: no idea how to check for mmm or multi-mode + (save-match-data + (not (or (re-search-forward html-tag-re (line-end-position) t) + (re-search-backward html-tag-re (line-beginning-position) t))))) + (progn + (goto-char here) + t) + (goto-char here) + (setq php-warned-bad-indent t) + (let* ((known-multi-libs '(("mumamo" mumamo (lambda () (nxhtml-mumamo))) + ("mmm-mode" mmm-mode (lambda () (mmm-mode 1))) + ("multi-mode" multi-mode (lambda () (multi-mode 1))) + ("web-mode" web-mode (lambda () (web-mode))))) + (known-names (mapcar (lambda (lib) (car lib)) known-multi-libs)) + (available-multi-libs (delq nil + (mapcar + (lambda (lib) + (when (locate-library (car lib)) lib)) + known-multi-libs))) + (available-names (mapcar (lambda (lib) (car lib)) available-multi-libs)) + (base-msg + (concat + "Indentation fails badly with mixed HTML/PHP in the HTML part in +plain `php-mode'. To get indentation to work you must use an +Emacs library that supports 'multiple major modes' in a buffer. +Parts of the buffer will then be in `php-mode' and parts in for +example `html-mode'. Known such libraries are:\n\t" + (mapconcat 'identity known-names ", ") + "\n" + (if available-multi-libs + (concat + "You have these available in your `load-path':\n\t" + (mapconcat 'identity available-names ", ") + "\n\n" + "Do you want to turn any of those on? ") + "You do not have any of those in your `load-path'."))) + (is-using-multi + (catch 'is-using + (dolist (lib available-multi-libs) + (when (and (boundp (cadr lib)) + (symbol-value (cadr lib))) + (throw 'is-using t)))))) + (unless is-using-multi + (if available-multi-libs + (if (not (y-or-n-p base-msg)) + (message "Did not do indentation, but you can try again now if you want") + (let* ((name + (if (= 1 (length available-multi-libs)) + (car available-names) + ;; Minibuffer window is more than one line, fix that first: + (message "") + (completing-read "Choose multiple major mode support library: " + available-names nil t + (car available-names) + '(available-names . 1) + ))) + (mode (when name + (caddr (assoc name available-multi-libs))))) + (when mode + ;; Minibuffer window is more than one line, fix that first: + (message "") + (load name) + (funcall mode)))) + (lwarn 'php-indent :warning base-msg))) + nil)))) + +(defun php-cautious-indent-region (start end &optional quiet) + (if (or (not php-mode-warn-if-mumamo-off) + php-warned-bad-indent + (php-check-html-for-indentation)) + (funcall 'c-indent-region start end quiet))) + +(defun php-cautious-indent-line () + (if (or (not php-mode-warn-if-mumamo-off) + php-warned-bad-indent + (php-check-html-for-indentation)) + (let ((here (point)) + doit) + (move-beginning-of-line nil) + ;; Don't indent heredoc end mark + (save-match-data + (unless (and (looking-at "[a-zA-Z0-9_]+;\n") + (php-in-string-p)) + (setq doit t))) + (goto-char here) + (when doit + (funcall 'c-indent-line))))) + +(defun php-c-at-vsemi-p (&optional pos) + "Return t on html lines (including php region border), otherwise nil. +POS is a position on the line in question. + +This is was done due to the problem reported here: + + URL `https://answers.launchpad.net/nxhtml/+question/43320'" + (if (not php-template-compatibility) + nil + (setq pos (or pos (point))) + (let ((here (point)) + ret) + (save-match-data + (goto-char pos) + (beginning-of-line) + (setq ret (looking-at + (rx + (or (seq + bol + (0+ space) + "<" + (in "a-z\\?")) + (seq + (0+ not-newline) + (in "a-z\\?") + ">" + (0+ space) + eol)))))) + (goto-char here) + ret))) + +(defun php-c-vsemi-status-unknown-p () + "See `php-c-at-vsemi-p'." + ) + +(defsubst php-in-string-p () + (nth 3 (syntax-ppss))) + +(defsubst php-in-comment-p () + (nth 4 (syntax-ppss))) + +(defsubst php-in-string-or-comment-p () + (nth 8 (syntax-ppss))) + +(defun php-lineup-string-cont (langelem) + "Line up string toward equal sign or dot +e.g. +$str = 'some' + . 'string'; +this ^ lineup" + (save-excursion + (goto-char (cdr langelem)) + (let (ret finish) + (while (and (not finish) (re-search-forward "[=.]" (line-end-position) t)) + (unless (php-in-string-or-comment-p) + (setq finish t + ret (vector (1- (current-column)))))) + ret))) + +(defun php-lineup-arglist-intro (langelem) + (save-excursion + (goto-char (cdr langelem)) + (vector (+ (current-column) c-basic-offset)))) + +(defun php-lineup-arglist-close (langelem) + (save-excursion + (goto-char (cdr langelem)) + (vector (current-column)))) + +(defun php-lineup-arglist (langelem) + (save-excursion + (beginning-of-line) + (if (looking-at-p "\\s-*->") '+ 0))) + +(defun php-lineup-hanging-semicolon (langelem) + (save-excursion + (beginning-of-line) + (if (looking-at-p "\\s-*;\\s-*$") 0 '+))) + +(defconst php-heredoc-start-re + "<<<\\(?:\\w+\\|'\\w+'\\)$" + "Regular expression for the start of a PHP heredoc.") + +(defun php-heredoc-end-re (heredoc-start) + "Build a regular expression for the end of a heredoc started by +the string HEREDOC-START." + ;; Extract just the identifier without <<< and quotes. + (string-match "\\w+" heredoc-start) + (concat "^\\(" (match-string 0 heredoc-start) "\\)\\W")) + +(defun php-syntax-propertize-function (start end) + "Apply propertize rules from START to END." + ;; (defconst php-syntax-propertize-function + ;; (syntax-propertize-rules + ;; (php-heredoc-start-re (0 (ignore (php-heredoc-syntax)))))) + (goto-char start) + (while (and (< (point) end) + (re-search-forward php-heredoc-start-re end t)) + (php-heredoc-syntax)) + (goto-char start) + (while (re-search-forward "['\"]" end t) + (when (php-in-comment-p) + (c-put-char-property (match-beginning 0) + 'syntax-table (string-to-syntax "_"))))) + +(defun php-heredoc-syntax () + "Mark the boundaries of searched heredoc." + (goto-char (match-beginning 0)) + (c-put-char-property (point) 'syntax-table (string-to-syntax "|")) + (if (re-search-forward (php-heredoc-end-re (match-string 0)) nil t) + (goto-char (match-end 1)) + ;; Did not find the delimiter so go to the end of the buffer. + (goto-char (point-max))) + (c-put-char-property (1- (point)) 'syntax-table (string-to-syntax "|"))) + +(defun php-syntax-propertize-extend-region (start end) + "Extend the propertize region if START or END falls inside a +PHP heredoc." + (let ((new-start) + (new-end)) + (goto-char start) + (when (re-search-backward php-heredoc-start-re nil t) + (let ((maybe (point))) + (when (and (re-search-forward + (php-heredoc-end-re (match-string 0)) nil t) + (> (point) start)) + (setq new-start maybe)))) + (goto-char end) + (when (re-search-backward php-heredoc-start-re nil t) + (if (re-search-forward + (php-heredoc-end-re (match-string 0)) nil t) + (when (> (point) end) + (setq new-end (point))) + (setq new-end (point-max)))) + (when (or new-start new-end) + (cons (or new-start start) (or new-end end))))) + +(easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands" + (cons "PHP" (c-lang-const c-mode-menu php))) + +;;;###autoload +(define-derived-mode php-mode c-mode "PHP" + "Major mode for editing PHP code. + +\\{php-mode-map}" + + (c-initialize-cc-mode t) + (c-init-language-vars php-mode) + (c-common-init 'php-mode) + + (modify-syntax-entry ?_ "_" php-mode-syntax-table) + (modify-syntax-entry ?` "\"" php-mode-syntax-table) + (modify-syntax-entry ?\" "\"" php-mode-syntax-table) + (modify-syntax-entry ?# "< b" php-mode-syntax-table) + (modify-syntax-entry ?\n "> b" php-mode-syntax-table) + + (set (make-local-variable 'syntax-propertize-via-font-lock) + '(("\\(\"\\)\\(\\\\.\\|[^\"\n\\]\\)*\\(\"\\)" (1 "\"") (3 "\"")) + ("\\(\'\\)\\(\\\\.\\|[^\'\n\\]\\)*\\(\'\\)" (1 "\"") (3 "\"")))) + + (when (boundp 'syntax-propertize-function) + (add-to-list (make-local-variable 'syntax-propertize-extend-region-functions) + #'php-syntax-propertize-extend-region) + (set (make-local-variable 'syntax-propertize-function) + #'php-syntax-propertize-function)) + + (setq font-lock-maximum-decoration t + imenu-generic-expression php-imenu-generic-expression) + + ;; PHP vars are case-sensitive + (setq case-fold-search t) + + ;; Do not force newline at end of file. Such newlines can cause + ;; trouble if the PHP file is included in another file before calls + ;; to header() or cookie(). + (set (make-local-variable 'require-final-newline) nil) + (set (make-local-variable 'next-line-add-newlines) nil) + + ;; PEAR coding standards + (add-hook 'php-mode-pear-hook 'php-enable-pear-coding-style + nil t) + + ;; ;; Drupal coding standards + (add-hook 'php-mode-drupal-hook 'php-enable-drupal-coding-style + nil t) + + ;; ;; WordPress coding standards + (add-hook 'php-mode-wordpress-hook 'php-enable-wordpress-coding-style + nil t) + + ;; ;; Symfony2 coding standards + (add-hook 'php-mode-symfony2-hook 'php-enable-symfony2-coding-style + nil t) + + ;; ;; PSR-2 coding standards + (add-hook 'php-mode-psr2-hook 'php-enable-psr2-coding-style + nil t) + + (cond ((eq php-mode-coding-style 'pear) + (php-enable-pear-coding-style) + (run-hooks 'php-mode-pear-hook)) + ((eq php-mode-coding-style 'drupal) + (php-enable-drupal-coding-style) + (run-hooks 'php-mode-drupal-hook)) + ((eq php-mode-coding-style 'wordpress) + (php-enable-wordpress-coding-style) + (run-hooks 'php-mode-wordpress-hook)) + ((eq php-mode-coding-style 'symfony2) + (php-enable-symfony2-coding-style) + (run-hooks 'php-mode-symfony2-hook)) + ((eq php-mode-coding-style 'psr2) + (php-enable-psr2-coding-style) + (run-hooks 'php-mode-psr2-hook))) + + (if (or php-mode-force-pear + (and (stringp buffer-file-name) + (string-match "PEAR\\|pear" + (buffer-file-name)) + (string-match "\\.php$" (buffer-file-name)))) + (run-hooks 'php-mode-pear-hook)) + + (setq indent-line-function 'php-cautious-indent-line) + (setq indent-region-function 'php-cautious-indent-region) + (setq c-at-vsemi-p-fn 'php-c-at-vsemi-p) + (setq c-vsemi-status-unknown-p 'php-c-vsemi-status-unknown-p) + + (set (make-local-variable 'syntax-begin-function) + 'c-beginning-of-syntax) + + ;; We map the php-{beginning,end}-of-defun functions so that they + ;; replace the similar commands that we inherit from CC Mode. + ;; Because of our remapping we may not actually need to keep the + ;; following two local variables, but we keep them for now until we + ;; are completely sure their removal will not break any current + ;; behavior or backwards compatibility. + (set (make-local-variable 'beginning-of-defun-function) + 'php-beginning-of-defun) + (set (make-local-variable 'end-of-defun-function) + 'php-end-of-defun) + + (set (make-local-variable 'open-paren-in-column-0-is-defun-start) + nil) + (set (make-local-variable 'defun-prompt-regexp) + "^\\s-*function\\s-+&?\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") + (set (make-local-variable 'add-log-current-defun-header-regexp) + php-beginning-of-defun-regexp)) + +;; Define function name completion function +(defvar php-completion-table nil + "Obarray of tag names defined in current tags table and functions known to PHP.") + +(defun php-complete-function () + "Perform function completion on the text around point. +Completes to the set of names listed in the current tags table +and the standard php functions. +The string to complete is chosen in the same way as the default +for \\[find-tag] (which see)." + (interactive) + (let ((pattern (php-get-pattern)) + beg + completion + (php-functions (php-completion-table))) + (if (not pattern) (message "Nothing to complete") + (if (not (search-backward pattern nil t)) + (message "Can't complete here") + (setq beg (point)) + (forward-char (length pattern)) + (setq completion (try-completion pattern php-functions nil)) + (cond ((eq completion t)) + ((null completion) + (message "Can't find completion for \"%s\"" pattern) + (ding)) + ((not (string= pattern completion)) + (delete-region beg (point)) + (insert completion)) + (t + (message "Making completion list...") + (with-output-to-temp-buffer "*Completions*" + (display-completion-list + (all-completions pattern php-functions))) + (message "Making completion list...%s" "done"))))))) + +(defun php-completion-table () + "Build variable `php-completion-table' on demand. +The table includes the PHP functions and the tags from the +current `tags-file-name'." + (or (and tags-file-name + (save-excursion (tags-verify-table tags-file-name)) + php-completion-table) + (let ((tags-table + (when tags-file-name + (with-current-buffer (get-file-buffer tags-file-name) + (etags-tags-completion-table)))) + (php-table + (cond ((and (not (string= "" php-completion-file)) + (file-readable-p php-completion-file)) + (php-build-table-from-file php-completion-file)) + (php-manual-path + (php-build-table-from-path php-manual-path)) + (t nil)))) + (unless (or php-table tags-table) + (error + (concat "No TAGS file active nor are " + "`php-completion-file' or `php-manual-path' set"))) + (when tags-table + ;; Combine the tables. + (mapatoms (lambda (sym) (intern (symbol-name sym) php-table)) + tags-table)) + (setq php-completion-table php-table)))) + +(defun php-build-table-from-file (filename) + (let ((table (make-vector 1022 0)) + (buf (find-file-noselect filename))) + (with-current-buffer buf + (goto-char (point-min)) + (while (re-search-forward + "^\\([-a-zA-Z0-9_.]+\\)\n" + nil t) + (intern (buffer-substring (match-beginning 1) (match-end 1)) + table))) + (kill-buffer buf) + table)) + +(defun php-build-table-from-path (path) + (let ((table (make-vector 1022 0)) + (files (directory-files + path + nil + "^function\\..+\\.html$"))) + (mapc (lambda (file) + (string-match "\\.\\([-a-zA-Z_0-9]+\\)\\.html$" file) + (intern + (replace-regexp-in-string + "-" "_" (substring file (match-beginning 1) (match-end 1)) t) + table)) + files) + table)) + +;; Find the pattern we want to complete +;; find-tag-default from GNU Emacs etags.el +(defun php-get-pattern () + (save-excursion + (while (looking-at "\\sw\\|\\s_") + (forward-char 1)) + (if (or (re-search-backward "\\sw\\|\\s_" + (save-excursion (beginning-of-line) (point)) + t) + (re-search-forward "\\(\\sw\\|\\s_\\)+" + (save-excursion (end-of-line) (point)) + t)) + (progn (goto-char (match-end 0)) + (buffer-substring-no-properties + (point) + (progn (forward-sexp -1) + (while (looking-at "\\s'") + (forward-char 1)) + (point)))) + nil))) + +(defun php-show-arglist () + (interactive) + (let* ((tagname (php-get-pattern)) + (buf (find-tag-noselect tagname nil nil)) + arglist) + (with-current-buffer buf + (goto-char (point-min)) + (when (re-search-forward + (format "function\\s-+%s\\s-*(\\([^{]*\\))" tagname) + nil t) + (setq arglist (buffer-substring-no-properties + (match-beginning 1) (match-end 1))))) + (if arglist + (message "Arglist for %s: %s" tagname arglist) + (message "Unknown function: %s" tagname)))) + +(defcustom php-search-documentation-browser-function nil + "Function to display PHP documentation in a WWW browser. + +If non-nil, this shadows the value of `browse-url-browser-function' when +calling `php-search-documentation' or `php-search-local-documentation'." + :type '(choice (const :tag "default" nil) function) + :link '(variable-link browse-url-browser-function) + :group 'php) + +(defun php-browse-documentation-url (url) + "Browse a documentation URL using the configured browser function. + +See `php-search-documentation-browser-function'." + (let ((browse-url-browser-function + (or php-search-documentation-browser-function + browse-url-browser-function))) + (browse-url url))) + +(defvar php-search-local-documentation-types + (list "function" "control-structures" "class" "book") + ;; "intro" and "ref" also look interesting, but for all practical purposes + ;; their terms are sub-sets of the "book" terms (with the few exceptions + ;; being very unlikely search terms). + "The set (and priority sequence) of documentation file prefixes +under which to search for files in the local documentation directory.") + +(defvar php-search-local-documentation-words-cache nil) + +(defun php--search-documentation-read-arg () + "Obtain interactive argument for searching documentation." + ;; Cache the list of documentation words available for completion, + ;; based on the defined types-of-interest. + (let ((types-list php-search-local-documentation-types) + (words-cache php-search-local-documentation-words-cache) + (local-manual (and (stringp php-manual-path) + (not (string= php-manual-path ""))))) + (when (and local-manual + (not (assq types-list words-cache))) + ;; Generate the cache on the first run, or if the types changed. + ;; We read the filenames matching our types list in the local + ;; documention directory, and extract the 'middle' component + ;; of each. e.g. "function.array-map.html" => "array_map". + (let* ((types-opt (regexp-opt types-list)) + (pattern (concat "\\`" types-opt "\\.\\(.+\\)\\.html\\'")) + (collection + (mapcar (lambda (filename) (subst-char-in-string + ?- ?_ (replace-regexp-in-string + pattern "\\1" filename))) + (directory-files php-manual-path nil pattern)))) + ;; Replace the entire cache. If the types changed, we don't need + ;; to retain the collection for the previous value. + (setq words-cache (list (cons types-list collection))) + (setq php-search-local-documentation-words-cache words-cache))) + ;; By default we search for (current-word) immediately, without prompting. + ;; With a prefix argument, or if there is no (current-word), we perform a + ;; completing read for a word from the cached collection. + (let* ((default (current-word)) + (prompt (if default + (format "Search PHP docs (%s): " default) + "Search PHP docs: ")) + (collection (and local-manual + (cdr (assq types-list words-cache)))) + (word (if (or current-prefix-arg (not default)) + (completing-read prompt collection nil nil nil nil default) + default))) + ;; Return interactive argument list. + (list word)))) + +(defun php-search-local-documentation (word) + "Search the local PHP documentation (i.e. in `php-manual-path') for +the word at point. The function returns t if the requested documentation +exists, and nil otherwise. + +With a prefix argument, prompt (with completion) for a word to search for." + (interactive (php--search-documentation-read-arg)) + (let ((file (catch 'found + (loop for type in php-search-local-documentation-types do + (let* ((doc-html (format "%s.%s.html" + type + (replace-regexp-in-string + "_" "-" (downcase word)))) + (file (expand-file-name doc-html php-manual-path))) + (when (file-exists-p file) + (throw 'found file))))))) + (when file + (let ((file-url (if (string-prefix-p "file://" file) + file + (concat "file://" file)))) + (php-browse-documentation-url file-url)) + t))) + +(defsubst php-search-web-documentation (word) + (php-browse-documentation-url (concat php-search-url word))) + +;; Define function documentation function +(defun php-search-documentation (word) + "Search PHP documentation for the word at point. + +If `php-manual-path' has a non-empty string value then the command +will first try searching the local documentation. If the requested +documentation does not exist it will fallback to searching the PHP +website. + +With a prefix argument, prompt for a documentation word to search +for. If the local documentation is available, it is used to build +a completion list." + (interactive (php--search-documentation-read-arg)) + (if (and (stringp php-manual-path) + (not (string= php-manual-path ""))) + (or (php-search-local-documentation word) + (php-search-web-documentation word)) + (php-search-web-documentation word))) + +;; Define function for browsing manual +(defun php-browse-manual () + "Bring up manual for PHP." + (interactive) + (browse-url php-manual-url)) + +(defconst php-font-lock-keywords-1 (c-lang-const c-matchers-1 php) + "Basic highlighting for PHP mode.") + +(defconst php-font-lock-keywords-2 (c-lang-const c-matchers-2 php) + "Medium level highlighting for PHP mode.") + +(defconst php-font-lock-keywords-3 + (append + ;; php-mode patterns *before* cc-mode: + ;; only add patterns here if you want to prevent cc-mode from applying + ;; a different face. + '( + ;; Highlight variables, e.g. 'var' in '$var' and '$obj->var', but + ;; not in $obj->var() + ("->\\(\\sw+\\)\\s-*(" 1 'default) + + ;; Highlight special variables + ("\\$\\(this\\|that\\)" 1 font-lock-constant-face) + ("\\(\\$\\|->\\)\\([a-zA-Z0-9_]+\\)" 2 font-lock-variable-name-face) + + ;; Highlight function/method names + ("\\var', but + ;; not in $obj->var() + ("->\\(\\sw+\\)\\s-*(" 1 'default) + + ("\\(\\$\\|->\\)\\([a-zA-Z0-9_]+\\)" 2 font-lock-variable-name-face) + + ;; Highlight all upper-cased symbols as constant + ("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 font-lock-constant-face) + + ;; Highlight all statically accessed class names as constant, + ;; another valid option would be using type-face, but using + ;; constant-face because this is how it works in c++-mode. + ("\\(\\sw+\\)::" 1 font-lock-constant-face) + + ;; Highlight class name after "use .. as" + ("\\" "")) 0 font-lock-preprocessor-face))) + "Detailed highlighting for PHP mode.") + +(defvar php-font-lock-keywords php-font-lock-keywords-3 + "Default expressions to highlight in PHP mode.") + +;;; Provide support for Flymake so that users can see warnings and +;;; errors in real-time as they write code. + +(defun flymake-php-init () + (let* ((temp-file (flymake-init-create-temp-buffer-copy + 'flymake-create-temp-inplace)) + (local-file (file-relative-name + temp-file + (file-name-directory buffer-file-name)))) + (list php-executable (list "-f" local-file "-l")))) + +(add-to-list 'flymake-allowed-file-name-masks + '("\\.php[345s]?$" + flymake-php-init + flymake-simple-cleanup + flymake-get-real-file-name)) + +(add-to-list 'flymake-err-line-patterns + '("\\(Parse\\|Fatal\\) error: \\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)" 3 4 nil 2)) + + +(defun php-send-region (start end) + "Send the region between `start' and `end' to PHP for execution. +The output will appear in the buffer *PHP*." + (interactive "r") + (let ((php-buffer (get-buffer-create "*PHP*")) + (code (buffer-substring start end))) + ;; Calling 'php -r' will fail if we send it code that starts with + ;; '\\|::") + (no-front-space "->\\|::")) + (when (and (eq major-mode 'php-mode) + (or (looking-at-p (concat " \\(" no-behind-space "\\)")) + (save-excursion + (forward-char -2) + (looking-at-p no-front-space)))) + (delete-char 1)))) + +(ad-activate 'fixup-whitespace) + +;; Advice `font-lock-fontify-keywords-region' to support namespace +;; separators in class names. Use word syntax for backslashes when +;; doing keyword fontification, but not when doing syntactic +;; fontification because that breaks \ as escape character in strings. +;; +;; Special care is taken to restore the original syntax, because we +;; want \ not to be word for functions like forward-word. +(defadvice font-lock-fontify-keywords-region (around backslash-as-word activate) + "Fontify keywords with backslash as word character" + (let ((old-syntax (string (char-syntax ?\\)))) + (modify-syntax-entry ?\\ "w") + ad-do-it + (modify-syntax-entry ?\\ old-syntax))) + + +;;;###autoload +(dolist (pattern '("\\.php[s345t]?\\'" "\\.phtml\\'" "Amkfile" "\\.amk$")) + (add-to-list 'auto-mode-alist `(,pattern . php-mode) t)) + +(provide 'php-mode) + +;;; php-mode.el ends here + +;; Local Variables: +;; firestarter: ert-run-tests-interactively +;; End: diff --git a/emacs.d/elpa/pkg-info-20140610.630/pkg-info-pkg.el b/emacs.d/elpa/pkg-info-20140610.630/pkg-info-pkg.el deleted file mode 100644 index c4388cd..0000000 --- a/emacs.d/elpa/pkg-info-20140610.630/pkg-info-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "pkg-info" "20140610.630" "Information about packages" '((epl "0.4")) :url "https://github.com/lunaryorn/pkg-info.el" :keywords '("convenience")) diff --git a/emacs.d/elpa/pkg-info-20140610.630/pkg-info-autoloads.el b/emacs.d/elpa/pkg-info-20150517.443/pkg-info-autoloads.el similarity index 98% rename from emacs.d/elpa/pkg-info-20140610.630/pkg-info-autoloads.el rename to emacs.d/elpa/pkg-info-20150517.443/pkg-info-autoloads.el index 36f0e89..94e9640 100644 --- a/emacs.d/elpa/pkg-info-20140610.630/pkg-info-autoloads.el +++ b/emacs.d/elpa/pkg-info-20150517.443/pkg-info-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "pkg-info" "pkg-info.el" (21570 23222 0 0)) +;;;### (autoloads nil "pkg-info" "pkg-info.el" (21898 47965 0 0)) ;;; Generated autoloads from pkg-info.el (autoload 'pkg-info-library-original-version "pkg-info" "\ diff --git a/emacs.d/elpa/pkg-info-20150517.443/pkg-info-pkg.el b/emacs.d/elpa/pkg-info-20150517.443/pkg-info-pkg.el new file mode 100644 index 0000000..9ddb4aa --- /dev/null +++ b/emacs.d/elpa/pkg-info-20150517.443/pkg-info-pkg.el @@ -0,0 +1 @@ +(define-package "pkg-info" "20150517.443" "Information about packages" '((epl "0.8")) :url "https://github.com/lunaryorn/pkg-info.el" :keywords '("convenience")) diff --git a/emacs.d/elpa/pkg-info-20140610.630/pkg-info.el b/emacs.d/elpa/pkg-info-20150517.443/pkg-info.el similarity index 82% rename from emacs.d/elpa/pkg-info-20140610.630/pkg-info.el rename to emacs.d/elpa/pkg-info-20150517.443/pkg-info.el index 5c36a81..98ecc15 100644 --- a/emacs.d/elpa/pkg-info-20140610.630/pkg-info.el +++ b/emacs.d/elpa/pkg-info-20150517.443/pkg-info.el @@ -1,13 +1,13 @@ ;;; pkg-info.el --- Information about packages -*- lexical-binding: t; -*- -;; Copyright (C) 2013, 2014 Sebastian Wiesner +;; Copyright (C) 2013-2015 Sebastian Wiesner ;; Author: Sebastian Wiesner ;; URL: https://github.com/lunaryorn/pkg-info.el +;; Package-Version: 20150517.443 ;; Keywords: convenience -;; Version: 20140610.630 -;; X-Original-Version: 0.6-cvs -;; Package-Requires: ((epl "0.4")) +;; Version: 0.7-cvs +;; Package-Requires: ((epl "0.8")) ;; This file is not part of GNU Emacs. @@ -41,6 +41,14 @@ ;; ;; `pkg-info-version-info' returns complete version information for a specific ;; package. +;; +;; `pkg-info-get-melpa-recipe' gets the MELPA recipe for a package. +;; +;; `pkg-info-get-melpa-fetcher' gets the fetcher used to build a package on +;; MELPA. +;; +;; `pkg-info-wiki-package-p' determines whether a package was build from +;; EmacsWiki on MELPA. ;;; Code: @@ -48,6 +56,10 @@ (require 'lisp-mnt) (require 'find-func) +(require 'json) ; `json-read' +(require 'url-http) ; `url-http-parse-response' + +(defvar url-http-end-of-headers) ;;; Version information @@ -221,7 +233,7 @@ If SHOW is non-nil, show the version in the minibuffer. Return the version as list, or nil if PACKAGE is not installed." (interactive (list (pkg-info--read-package) t)) (let* ((name (if (stringp package) (intern package) package)) - (package (epl-find-installed-package name))) + (package (car (epl-find-installed-packages name)))) (unless package (error "Can't find installed package %s" name)) (pkg-info--show-version-and-return (epl-package-version package) show))) @@ -269,6 +281,46 @@ version." (pkg-info-format-version lib-version)))) (pkg-info--show-version-and-return version show))) +(defconst pkg-info-melpa-recipe-url "http://melpa.org/recipes.json" + "The URL from which to fetch MELPA recipes.") + +(defvar pkg-info-melpa-recipes nil + "An alist of MELPA recipes.") + +(defun pkg-info-retrieve-melpa-recipes () + "Retrieve MELPA recipes from MELPA archive." + (let ((buffer (url-retrieve-synchronously pkg-info-melpa-recipe-url))) + (with-current-buffer buffer + (unwind-protect + (let ((response-code (url-http-parse-response))) + (unless (equal response-code 200) + (error "Failed to retrieve MELPA recipes from %s (code %s)" + pkg-info-melpa-recipe-url response-code)) + (goto-char url-http-end-of-headers) + (json-read)) + (when (and buffer (buffer-live-p buffer)) + (kill-buffer buffer)))))) + +(defun pkg-info-get-melpa-recipes () + "Get MELPA recipes." + (setq pkg-info-melpa-recipes + (or pkg-info-melpa-recipes + (pkg-info-retrieve-melpa-recipes)))) + +(defun pkg-info-get-melpa-recipe (package) + "Get the MELPA recipe for PACKAGE. + +Return nil if PACKAGE is not on MELPA." + (cdr (assq package (pkg-info-get-melpa-recipes)))) + +(defun pkg-info-get-melpa-fetcher (package) + "Get the MELPA fetcher for PACKAGE." + (cdr (assq 'fetcher (pkg-info-get-melpa-recipe package)))) + +(defun pkg-info-wiki-package-p (package) + "Determine whether PACKAGE is build from the EmacsWiki." + (equal (pkg-info-get-melpa-fetcher package) "wiki")) + (provide 'pkg-info) ;; Local Variables: diff --git a/emacs.d/elpa/polymode-20150508.1633/poly-R.el b/emacs.d/elpa/polymode-20150523.1626/poly-R.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/poly-R.el rename to emacs.d/elpa/polymode-20150523.1626/poly-R.el diff --git a/emacs.d/elpa/polymode-20150508.1633/poly-base.el b/emacs.d/elpa/polymode-20150523.1626/poly-base.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/poly-base.el rename to emacs.d/elpa/polymode-20150523.1626/poly-base.el diff --git a/emacs.d/elpa/polymode-20150508.1633/poly-markdown.el b/emacs.d/elpa/polymode-20150523.1626/poly-markdown.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/poly-markdown.el rename to emacs.d/elpa/polymode-20150523.1626/poly-markdown.el diff --git a/emacs.d/elpa/polymode-20150508.1633/poly-noweb.el b/emacs.d/elpa/polymode-20150523.1626/poly-noweb.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/poly-noweb.el rename to emacs.d/elpa/polymode-20150523.1626/poly-noweb.el diff --git a/emacs.d/elpa/polymode-20150508.1633/poly-org.el b/emacs.d/elpa/polymode-20150523.1626/poly-org.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/poly-org.el rename to emacs.d/elpa/polymode-20150523.1626/poly-org.el diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode-autoloads.el b/emacs.d/elpa/polymode-20150523.1626/polymode-autoloads.el similarity index 90% rename from emacs.d/elpa/polymode-20150508.1633/polymode-autoloads.el rename to emacs.d/elpa/polymode-20150523.1626/polymode-autoloads.el index 6751beb..725bfce 100644 --- a/emacs.d/elpa/polymode-20150508.1633/polymode-autoloads.el +++ b/emacs.d/elpa/polymode-20150523.1626/polymode-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "poly-R" "poly-R.el" (21837 24193 0 0)) +;;;### (autoloads nil "poly-R" "poly-R.el" (21898 47964 0 0)) ;;; Generated autoloads from poly-R.el (autoload 'poly-noweb+r-mode "poly-R") (autoload 'poly-markdown+r-mode "poly-R") @@ -17,27 +17,27 @@ ;;;*** -;;;### (autoloads nil "poly-markdown" "poly-markdown.el" (21837 24193 +;;;### (autoloads nil "poly-markdown" "poly-markdown.el" (21898 47964 ;;;;;; 0 0)) ;;; Generated autoloads from poly-markdown.el (autoload 'poly-markdown-mode "poly-markdown") ;;;*** -;;;### (autoloads nil "poly-noweb" "poly-noweb.el" (21837 24193 0 +;;;### (autoloads nil "poly-noweb" "poly-noweb.el" (21898 47964 0 ;;;;;; 0)) ;;; Generated autoloads from poly-noweb.el (autoload 'poly-noweb-mode "poly-noweb") ;;;*** -;;;### (autoloads nil "poly-org" "poly-org.el" (21837 24193 0 0)) +;;;### (autoloads nil "poly-org" "poly-org.el" (21898 47964 0 0)) ;;; Generated autoloads from poly-org.el (autoload 'poly-org-mode "poly-org") ;;;*** -;;;### (autoloads nil "polymode" "polymode.el" (21837 24193 0 0)) +;;;### (autoloads nil "polymode" "polymode.el" (21898 47964 0 0)) ;;; Generated autoloads from polymode.el (autoload 'define-polymode "polymode" "\ @@ -93,7 +93,7 @@ BODY contains code to be executed after the complete ;;;### (autoloads nil nil ("poly-base.el" "polymode-classes.el" "polymode-common.el" ;;;;;; "polymode-configuration.el" "polymode-export.el" "polymode-methods.el" ;;;;;; "polymode-pkg.el" "polymode-tangle.el" "polymode-weave.el") -;;;;;; (21837 24193 902454 0)) +;;;;;; (21898 47964 603803 0)) ;;;*** diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode-classes.el b/emacs.d/elpa/polymode-20150523.1626/polymode-classes.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/polymode-classes.el rename to emacs.d/elpa/polymode-20150523.1626/polymode-classes.el diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode-common.el b/emacs.d/elpa/polymode-20150523.1626/polymode-common.el similarity index 96% rename from emacs.d/elpa/polymode-20150508.1633/polymode-common.el rename to emacs.d/elpa/polymode-20150523.1626/polymode-common.el index f16e48a..fa0ccb3 100644 --- a/emacs.d/elpa/polymode-20150508.1633/polymode-common.el +++ b/emacs.d/elpa/polymode-20150523.1626/polymode-common.el @@ -9,6 +9,11 @@ (require 'eieio-custom) (require 'format-spec) +(defcustom polymode-display-process-buffers t + "When non-nil, display weaving and exporting process buffers." + :group 'polymode + :type 'boolean) + ;; esential vars (defvar-local pm/polymode nil) (defvar-local pm/chunkmode nil) @@ -254,7 +259,6 @@ user interaction." (command-buff (current-buffer)) (ofile pm--output-file)) (with-current-buffer buffer - (setq pm--process-buffer t) (read-only-mode -1) (erase-buffer) (insert message) @@ -263,22 +267,27 @@ user interaction." (comint-mode) (setq process (get-buffer-process buffer)) (set-process-sentinel process sentinel) - ;; communicate with sentinel + (setq pm--process-buffer t) + ;; for communication with sentinel (set (make-local-variable 'pm--output-file) ofile) (set (make-local-variable 'pm--input-buffer) command-buff) (set-marker (process-mark process) (point-max))) + (when polymode-display-process-buffers + (display-buffer buffer `(nil . ((inhibit-same-window . ,pop-up-windows))))) nil)) (defun pm--run-command-sentinel (process name message) (let ((buff (process-buffer process))) (with-current-buffer buff ;; fixme: remove this later - (sit-for 1) + (sit-for .5) (goto-char (point-min)) (let ((case-fold-search t)) (if (not (re-search-forward "error" nil 'no-error)) pm--output-file - (display-buffer (current-buffer)) + (progn + (display-buffer (current-buffer)) + (message "Done with %s" message)) (error "Bumps while %s (%s)" message name)))))) diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode-configuration.el b/emacs.d/elpa/polymode-20150523.1626/polymode-configuration.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/polymode-configuration.el rename to emacs.d/elpa/polymode-20150523.1626/polymode-configuration.el diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode-export.el b/emacs.d/elpa/polymode-20150523.1626/polymode-export.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/polymode-export.el rename to emacs.d/elpa/polymode-20150523.1626/polymode-export.el diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode-methods.el b/emacs.d/elpa/polymode-20150523.1626/polymode-methods.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/polymode-methods.el rename to emacs.d/elpa/polymode-20150523.1626/polymode-methods.el diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode-pkg.el b/emacs.d/elpa/polymode-20150523.1626/polymode-pkg.el similarity index 74% rename from emacs.d/elpa/polymode-20150508.1633/polymode-pkg.el rename to emacs.d/elpa/polymode-20150523.1626/polymode-pkg.el index 17a9a87..8ca92d7 100644 --- a/emacs.d/elpa/polymode-20150508.1633/polymode-pkg.el +++ b/emacs.d/elpa/polymode-20150523.1626/polymode-pkg.el @@ -1,4 +1,4 @@ -(define-package "polymode" "20150508.1633" "Versatile multiple modes with extensive literate programming support" +(define-package "polymode" "20150523.1626" "Versatile multiple modes with extensive literate programming support" '((emacs "24")) :url "https://github.com/vitoshka/polymode" :keywords '("emacs")) diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode-tangle.el b/emacs.d/elpa/polymode-20150523.1626/polymode-tangle.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/polymode-tangle.el rename to emacs.d/elpa/polymode-20150523.1626/polymode-tangle.el diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode-weave.el b/emacs.d/elpa/polymode-20150523.1626/polymode-weave.el similarity index 100% rename from emacs.d/elpa/polymode-20150508.1633/polymode-weave.el rename to emacs.d/elpa/polymode-20150523.1626/polymode-weave.el diff --git a/emacs.d/elpa/polymode-20150508.1633/polymode.el b/emacs.d/elpa/polymode-20150523.1626/polymode.el similarity index 99% rename from emacs.d/elpa/polymode-20150508.1633/polymode.el rename to emacs.d/elpa/polymode-20150523.1626/polymode.el index cb90314..badd51e 100644 --- a/emacs.d/elpa/polymode-20150508.1633/polymode.el +++ b/emacs.d/elpa/polymode-20150523.1626/polymode.el @@ -248,7 +248,7 @@ Return, how many chucks actually jumped over." if (buffer-local-value 'pm--process-buffer b) return b))) (if buf - (pop-to-buffer buf) + (pop-to-buffer buf `(nil . ((inhibit-same-window . ,pop-up-windows)))) (message "No polymode process buffers found.")))) diff --git a/emacs.d/elpa/popup-20150315.612/popup-pkg.el b/emacs.d/elpa/popup-20150315.612/popup-pkg.el deleted file mode 100644 index 66bff09..0000000 --- a/emacs.d/elpa/popup-20150315.612/popup-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "popup" "20150315.612" "Visual Popup User Interface" '((cl-lib "0.3")) :keywords '("lisp")) diff --git a/emacs.d/elpa/popup-20150315.612/popup-autoloads.el b/emacs.d/elpa/popup-20150609.2145/popup-autoloads.el similarity index 82% rename from emacs.d/elpa/popup-20150315.612/popup-autoloads.el rename to emacs.d/elpa/popup-20150609.2145/popup-autoloads.el index a37e6c1..0617554 100644 --- a/emacs.d/elpa/popup-20150315.612/popup-autoloads.el +++ b/emacs.d/elpa/popup-20150609.2145/popup-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil nil ("popup.el") (21837 24193 397407 0)) +;;;### (autoloads nil nil ("popup.el") (21898 47964 236628 0)) ;;;*** diff --git a/emacs.d/elpa/popup-20150609.2145/popup-pkg.el b/emacs.d/elpa/popup-20150609.2145/popup-pkg.el new file mode 100644 index 0000000..2b02d43 --- /dev/null +++ b/emacs.d/elpa/popup-20150609.2145/popup-pkg.el @@ -0,0 +1 @@ +(define-package "popup" "20150609.2145" "Visual Popup User Interface" '((cl-lib "0.3")) :keywords '("lisp")) diff --git a/emacs.d/elpa/popup-20150315.612/popup.el b/emacs.d/elpa/popup-20150609.2145/popup.el similarity index 97% rename from emacs.d/elpa/popup-20150315.612/popup.el rename to emacs.d/elpa/popup-20150609.2145/popup.el index a4fc744..066c42d 100644 --- a/emacs.d/elpa/popup-20150315.612/popup.el +++ b/emacs.d/elpa/popup-20150609.2145/popup.el @@ -4,8 +4,8 @@ ;; Author: Tomohiro Matsuyama ;; Keywords: lisp -;; Package-Version: 20150315.612 -;; Version: 0.5.2 +;; Package-Version: 20150609.2145 +;; Version: 0.5.3 ;; Package-Requires: ((cl-lib "0.3")) ;; This program is free software; you can redistribute it and/or modify @@ -32,7 +32,7 @@ (require 'cl-lib) -(defconst popup-version "0.5.2") +(defconst popup-version "0.5.3") @@ -920,11 +920,11 @@ Pages up through POPUP." (propertize pattern 'face 'isearch-fail) pattern))) -(defun popup-isearch-update (popup pattern &optional callback) +(defun popup-isearch-update (popup filter pattern &optional callback) (setf (popup-cursor popup) 0 (popup-scroll-top popup) 0 (popup-pattern popup) pattern) - (let ((list (popup-isearch-filter-list pattern (popup-original-list popup)))) + (let ((list (funcall filter pattern (popup-original-list popup)))) (popup-set-filtered-list popup list) (if callback (funcall callback list))) @@ -932,6 +932,7 @@ Pages up through POPUP." (cl-defun popup-isearch (popup &key + (filter 'popup-isearch-filter-list) (cursor-color popup-isearch-cursor-color) (keymap popup-isearch-keymap) callback @@ -939,6 +940,8 @@ Pages up through POPUP." "Start isearch on POPUP. This function is synchronized, meaning event loop waits for quiting of isearch. +FILTER is function with two argumenst to perform popup items filtering. + CURSOR-COLOR is a cursor color during isearch. The default value is `popup-isearch-cursor-color'. @@ -973,10 +976,10 @@ HELP-DELAY is a delay of displaying helps." ((eq binding 'popup-isearch-done) (cl-return nil)) ((eq binding 'popup-isearch-cancel) - (popup-isearch-update popup "" callback) + (popup-isearch-update popup filter "" callback) (cl-return t)) ((eq binding 'popup-isearch-close) - (popup-isearch-update popup "" callback) + (popup-isearch-update popup filter "" callback) (setq unread-command-events (append (listify-key-sequence key) unread-command-events)) (cl-return nil)) @@ -987,7 +990,7 @@ HELP-DELAY is a delay of displaying helps." (setq unread-command-events (append (listify-key-sequence key) unread-command-events)) (cl-return nil))) - (popup-isearch-update popup pattern callback)))) + (popup-isearch-update popup filter pattern callback)))) (if old-cursor-color (set-cursor-color old-cursor-color))))) @@ -1178,6 +1181,7 @@ PROMPT is a prompt string when reading events during event loop." prompt help-delay isearch + isearch-filter isearch-cursor-color isearch-keymap isearch-callback @@ -1186,6 +1190,7 @@ PROMPT is a prompt string when reading events during event loop." (while (popup-live-p menu) (and isearch (popup-isearch menu + :filter isearch-filter :cursor-color isearch-cursor-color :keymap isearch-keymap :callback isearch-callback @@ -1221,6 +1226,7 @@ PROMPT is a prompt string when reading events during event loop." :parent-offset index :help-delay help-delay :isearch isearch + :isearch-filter isearch-filter :isearch-cursor-color isearch-cursor-color :isearch-keymap isearch-keymap :isearch-callback isearch-callback)) @@ -1239,6 +1245,7 @@ PROMPT is a prompt string when reading events during event loop." (popup-menu-show-help menu)) ((eq binding 'popup-isearch) (popup-isearch menu + :filter 'isearch-filter :cursor-color isearch-cursor-color :keymap isearch-keymap :callback isearch-callback @@ -1307,6 +1314,7 @@ PROMPT is a prompt string when reading events during event loop." nowait prompt isearch + (isearch-filter 'popup-isearch-filter-list) (isearch-cursor-color popup-isearch-cursor-color) (isearch-keymap popup-isearch-keymap) isearch-callback @@ -1315,7 +1323,7 @@ PROMPT is a prompt string when reading events during event loop." "Show a popup menu of LIST at POINT. This function returns a value of the selected item. Almost arguments are same as `popup-create' except for KEYMAP, FALLBACK, HELP-DELAY, PROMPT, -ISEARCH, ISEARCH-CURSOR-COLOR, ISEARCH-KEYMAP, and +ISEARCH, ISEARCH-FILTER, ISEARCH-CURSOR-COLOR, ISEARCH-KEYMAP, and ISEARCH-CALLBACK. If KEYMAP is a keymap which is used when processing events during @@ -1336,6 +1344,9 @@ PROMPT is a prompt string when reading events during event loop. If ISEARCH is non-nil, do isearch as soon as displaying the popup menu. +ISEARCH-FILTER is a filtering function taking two arguments: +search pattern and list of items. Returns a list of matching items. + ISEARCH-CURSOR-COLOR is a cursor color during isearch. The default value is `popup-isearch-cursor-color'. @@ -1384,6 +1395,7 @@ If `INITIAL-INDEX' is non-nil, this is an initial index value for :prompt prompt :help-delay help-delay :isearch isearch + :isearch-filter isearch-filter :isearch-cursor-color isearch-cursor-color :isearch-keymap isearch-keymap :isearch-callback isearch-callback))) diff --git a/emacs.d/elpa/powerline-20150427.1512/powerline-autoloads.el b/emacs.d/elpa/powerline-20150602.1413/powerline-autoloads.el similarity index 94% rename from emacs.d/elpa/powerline-20150427.1512/powerline-autoloads.el rename to emacs.d/elpa/powerline-20150602.1413/powerline-autoloads.el index 67e3351..49c9a2e 100644 --- a/emacs.d/elpa/powerline-20150427.1512/powerline-autoloads.el +++ b/emacs.d/elpa/powerline-20150602.1413/powerline-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "powerline" "powerline.el" (21836 46818 0 0)) +;;;### (autoloads nil "powerline" "powerline.el" (21898 47963 0 0)) ;;; Generated autoloads from powerline.el (autoload 'powerline-hud "powerline" "\ @@ -46,8 +46,8 @@ Return empty space using FACE and leaving RESERVE space on the right. ;;;*** -;;;### (autoloads nil "powerline-themes" "powerline-themes.el" (21836 -;;;;;; 46818 0 0)) +;;;### (autoloads nil "powerline-themes" "powerline-themes.el" (21898 +;;;;;; 47963 0 0)) ;;; Generated autoloads from powerline-themes.el (autoload 'powerline-default-theme "powerline-themes" "\ @@ -73,7 +73,7 @@ Setup a nano-like mode-line. ;;;*** ;;;### (autoloads nil nil ("powerline-pkg.el" "powerline-separators.el") -;;;;;; (21836 46818 113946 0)) +;;;;;; (21898 47963 630890 0)) ;;;*** diff --git a/emacs.d/elpa/powerline-20150427.1512/powerline-pkg.el b/emacs.d/elpa/powerline-20150602.1413/powerline-pkg.el similarity index 70% rename from emacs.d/elpa/powerline-20150427.1512/powerline-pkg.el rename to emacs.d/elpa/powerline-20150602.1413/powerline-pkg.el index 712470a..3f159aa 100644 --- a/emacs.d/elpa/powerline-20150427.1512/powerline-pkg.el +++ b/emacs.d/elpa/powerline-20150602.1413/powerline-pkg.el @@ -1,4 +1,4 @@ -(define-package "powerline" "20150427.1512" "Rewrite of Powerline" +(define-package "powerline" "20150602.1413" "Rewrite of Powerline" '((cl-lib "0.2")) :url "http://github.com/milkypostman/powerline/" :keywords '("mode-line")) diff --git a/emacs.d/elpa/powerline-20150427.1512/powerline-separators.el b/emacs.d/elpa/powerline-20150602.1413/powerline-separators.el similarity index 100% rename from emacs.d/elpa/powerline-20150427.1512/powerline-separators.el rename to emacs.d/elpa/powerline-20150602.1413/powerline-separators.el diff --git a/emacs.d/elpa/powerline-20150427.1512/powerline-themes.el b/emacs.d/elpa/powerline-20150602.1413/powerline-themes.el similarity index 100% rename from emacs.d/elpa/powerline-20150427.1512/powerline-themes.el rename to emacs.d/elpa/powerline-20150602.1413/powerline-themes.el diff --git a/emacs.d/elpa/powerline-20150427.1512/powerline.el b/emacs.d/elpa/powerline-20150602.1413/powerline.el similarity index 95% rename from emacs.d/elpa/powerline-20150427.1512/powerline.el rename to emacs.d/elpa/powerline-20150602.1413/powerline.el index a65bf27..530c290 100644 --- a/emacs.d/elpa/powerline-20150427.1512/powerline.el +++ b/emacs.d/elpa/powerline-20150602.1413/powerline.el @@ -108,8 +108,8 @@ This is needed to make sure that text is properly aligned." (defun pl/create-or-get-cache () "Return a frame-local hash table that acts as a memoization cache for powerline. Create one if the frame doesn't have one yet." - (or (frame-parameter nil 'powerline-cache) - (pl/reset-cache))) + (let ((table (frame-parameter nil 'powerline-cache))) + (if (hash-table-p table) table (pl/reset-cache)))) (defun pl/reset-cache () "Reset and return the frame-local hash table used for a memoization cache." @@ -130,9 +130,22 @@ This is needed to make sure that text is properly aligned." ;; ;; see https://github.com/milkypostman/powerline/issues/58 ;; -(defun powerline-delete-cache () - (set-frame-parameter nil 'powerline-cache nil)) -(add-hook 'desktop-save-hook 'powerline-delete-cache) +;; It is better to put the following code into your init file for Emacs 24.4 or later. +;; (require 'frameset) +;; (push '(powerline-cache . :never) frameset-filter-alist) +;; +(defun powerline-delete-cache (&optional frame) + "Set the FRAME cache to nil." + (set-frame-parameter frame 'powerline-cache nil)) + +(defun powerline-desktop-save-delete-cache () + "Set all caches to nil unless `frameset-filter-alist' has :never for powerline-cache." + (unless (and (boundp 'frameset-filter-alist) + (eq (cdr (assq 'powerline-cache frameset-filter-alist)) + :never)) + (dolist (fr (frame-list)) (powerline-delete-cache fr)))) + +(add-hook 'desktop-save-hook 'powerline-desktop-save-delete-cache) ;; from memoize.el @ http://nullprogram.com/blog/2010/07/26/ (defun pl/memoize (func) diff --git a/emacs.d/elpa/projectile-20150428.158/projectile-pkg.el b/emacs.d/elpa/projectile-20150428.158/projectile-pkg.el deleted file mode 100644 index 3058331..0000000 --- a/emacs.d/elpa/projectile-20150428.158/projectile-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "projectile" "20150428.158" "Manage and navigate projects in Emacs easily" '((dash "1.5.0") (pkg-info "0.4")) :url "https://github.com/bbatsov/projectile" :keywords '("project" "convenience")) diff --git a/emacs.d/elpa/projectile-20150428.158/projectile-autoloads.el b/emacs.d/elpa/projectile-20150622.1237/projectile-autoloads.el similarity index 99% rename from emacs.d/elpa/projectile-20150428.158/projectile-autoloads.el rename to emacs.d/elpa/projectile-20150622.1237/projectile-autoloads.el index 8d9e706..80391de 100644 --- a/emacs.d/elpa/projectile-20150428.158/projectile-autoloads.el +++ b/emacs.d/elpa/projectile-20150622.1237/projectile-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "projectile" "projectile.el" (21837 24192 0 +;;;### (autoloads nil "projectile" "projectile.el" (21898 47963 0 ;;;;;; 0)) ;;; Generated autoloads from projectile.el diff --git a/emacs.d/elpa/projectile-20150622.1237/projectile-pkg.el b/emacs.d/elpa/projectile-20150622.1237/projectile-pkg.el new file mode 100644 index 0000000..5bb74ea --- /dev/null +++ b/emacs.d/elpa/projectile-20150622.1237/projectile-pkg.el @@ -0,0 +1 @@ +(define-package "projectile" "20150622.1237" "Manage and navigate projects in Emacs easily" '((dash "1.5.0") (pkg-info "0.4")) :url "https://github.com/bbatsov/projectile" :keywords '("project" "convenience")) diff --git a/emacs.d/elpa/projectile-20150428.158/projectile.el b/emacs.d/elpa/projectile-20150622.1237/projectile.el similarity index 90% rename from emacs.d/elpa/projectile-20150428.158/projectile.el rename to emacs.d/elpa/projectile-20150622.1237/projectile.el index 16da05a..89bceec 100644 --- a/emacs.d/elpa/projectile-20150428.158/projectile.el +++ b/emacs.d/elpa/projectile-20150622.1237/projectile.el @@ -4,7 +4,7 @@ ;; Author: Bozhidar Batsov ;; URL: https://github.com/bbatsov/projectile -;; Package-Version: 20150428.158 +;; Package-Version: 20150622.1237 ;; Keywords: project, convenience ;; Version: 0.13.0-cvs ;; Package-Requires: ((dash "1.5.0") (pkg-info "0.4")) @@ -209,6 +209,7 @@ and `projectile-buffers-with-file-or-process'." "build.gradle" ; Gradle project file "Gemfile" ; Bundler file "requirements.txt" ; Pip file + "setup.py" ; Setuptools file "tox.ini" ; Tox file "package.json" ; npm package file "gulpfile.js" ; Gulp build file @@ -218,16 +219,8 @@ and `projectile-buffers-with-file-or-process'." "Cargo.toml" ; Cargo project file "mix.exs" ; Elixir mix project file ) - "A list of files considered to mark the root of a project." - :group 'projectile - :type '(repeat string)) - -(defcustom projectile-project-root-files-top-down-recurring - '(".svn" ; Svn VCS root dir - "CVS" ; Csv VCS root dir - "Makefile") "A list of files considered to mark the root of a project. -This root files pattern stops at the parentmost match." +The topmost match has precedence." :group 'projectile :type '(repeat string)) @@ -240,8 +233,19 @@ This root files pattern stops at the parentmost match." "_darcs" ; Darcs VCS root dir ) "A list of files considered to mark the root of a project. -This root files pattern overrides discovery of any root files -pattern that would have found a project root in a subdirectory." +The bottommost (parentmost) match has precedence." + :group 'projectile + :type '(repeat string)) + +(defcustom projectile-project-root-files-top-down-recurring + '(".svn" ; Svn VCS root dir + "CVS" ; Csv VCS root dir + "Makefile") + "A list of files considered to mark the root of a project. +The search starts at the top and descends down till a directory +that contains a match file but its parent does not. Thus, it's a +bottommost match in the topmost sequence of directories +containing a root file." :group 'projectile :type '(repeat string)) @@ -406,9 +410,28 @@ synchronized with `projectile-known-projects-file'.") (defcustom projectile-ignored-projects nil "A list of projects not to be added to `projectile-known-projects'." :group 'projectile - :type 'list + :type '(repeat :tag "Project list" directory) :package-version '(projectile . "0.11.0")) +(defcustom projectile-ignored-project-function nil + "Function to decide if a project is added to `projectile-known-projects'. + +Can be either nil, or a function that takes the truename of the +project root as argument and returns non-nil if the project is to +be ignored or nil otherwise. + +This function is only called if the project is not listed in +`projectile-ignored-projects'. + +A suitable candidate would be `file-remote-p' to ignore remote +projects." + :group 'projectile + :type '(choice + (const :tag "Nothing" nil) + (const :tag "Remote files" file-remote-p) + function) + :package-version '(projectile . "0.13.0")) + ;;; Version information @@ -550,10 +573,10 @@ The cache is created both in memory and on the hard drive." (defun projectile-cache-current-file () "Add the currently visited file to the cache." (interactive) - (let* ((current-project (projectile-project-root)) - (abs-current-file (buffer-file-name (current-buffer))) - (current-file (file-relative-name abs-current-file current-project))) + (let ((current-project (projectile-project-root))) (when (gethash (projectile-project-root) projectile-projects-cache) + (let* ((abs-current-file (file-truename (buffer-file-name (current-buffer)))) + (current-file (file-relative-name abs-current-file current-project))) (unless (or (projectile-file-cached-p current-file current-project) (projectile-ignored-directory-p (file-name-directory abs-current-file)) (projectile-ignored-file-p abs-current-file)) @@ -563,7 +586,7 @@ The cache is created both in memory and on the hard drive." (projectile-serialize-cache) (message "File %s added to project %s cache." (propertize current-file 'face 'font-lock-keyword-face) - (propertize current-project 'face 'font-lock-keyword-face)))))) + (propertize current-project 'face 'font-lock-keyword-face))))))) ;; cache opened files automatically to reduce the need for cache invalidation (defun projectile-cache-files-find-file-hook () @@ -624,61 +647,55 @@ which we're looking." ((equal file (setq file (file-name-directory (directory-file-name file)))) (setq file nil)))) - (if root (file-name-as-directory root)))) - -(defun projectile-root-bottom-up (dir &optional list) - "Identify a project root in DIR by looking at `projectile-project-root-files-bottom-up'. -Returns a project root directory path or nil if not found." - (--reduce-from - (or acc - (projectile-locate-dominating-file dir it)) - nil - (or list projectile-project-root-files-bottom-up))) + (and root (expand-file-name (file-name-as-directory root))))) (defun projectile-root-top-down (dir &optional list) - "Identify a project root in DIR by looking at `projectile-project-root-files'. -Returns a project root directory path or nil if not found." + "Identify a project root in DIR by top-down search for files in LIST. +If LIST is nil, use `projectile-project-root-files' instead. +Return the first (topmost) matched directory or nil if not found." (projectile-locate-dominating-file dir (lambda (dir) (--first (projectile-file-exists-p (expand-file-name it dir)) (or list projectile-project-root-files))))) +(defun projectile-root-bottom-up (dir &optional list) + "Identify a project root in DIR by bottom-up search for files in LIST. +If LIST is nil, use `projectile-project-root-files-bottom-up' instead. +Return the first (bottommost) matched directory or nil if not found." + (--some (projectile-locate-dominating-file dir it) + (or list projectile-project-root-files-bottom-up))) + (defun projectile-root-top-down-recurring (dir &optional list) - "Identify a project root in DIR by looking at `projectile-project-root-files-top-down-recurring'. -Returns a project root directory path or nil if not found." - (--reduce-from - (or acc - (projectile-locate-dominating-file - dir - (lambda (dir) - (and (projectile-file-exists-p (expand-file-name it dir)) - (or (string-match locate-dominating-stop-dir-regexp (projectile-parent dir)) - (not (projectile-file-exists-p (expand-file-name it (projectile-parent dir))))))))) - nil - (or list projectile-project-root-files-top-down-recurring))) + "Identify a project root in DIR by recurring top-down search for files in LIST. +If LIST is nil, use `projectile-project-root-files-top-down-recurring' +instead. Return the last (bottommost) matched directory in the +topmost sequence of matched directories. Nil otherwise." + (--some (projectile-locate-dominating-file + dir + (lambda (dir) + (and (projectile-file-exists-p (expand-file-name it dir)) + (or (string-match locate-dominating-stop-dir-regexp (projectile-parent dir)) + (not (projectile-file-exists-p (expand-file-name it (projectile-parent dir)))))))) + (or list projectile-project-root-files-top-down-recurring))) (defun projectile-project-root () "Retrieves the root directory of a project if available. The current directory is assumed to be the project's root otherwise." - (file-truename - (let ((dir (file-truename default-directory))) - (or (--reduce-from - (or acc - (let* ((cache-key (format "%s-%s" it dir)) - (cache-value (gethash cache-key projectile-project-root-cache))) - (if cache-value - (if (eq cache-value 'no-project-root) - nil - cache-value) - (let ((value (funcall it dir))) - (puthash cache-key (or value 'no-project-root) projectile-project-root-cache) - value)))) - nil - projectile-project-root-files-functions) - (if projectile-require-project-root - (error "You're not in a project") - default-directory))))) + (let ((dir default-directory)) + (or (--some (let* ((cache-key (format "%s-%s" it dir)) + (cache-value (gethash cache-key projectile-project-root-cache))) + (if cache-value + (if (eq cache-value 'no-project-root) + nil + cache-value) + (let ((value (funcall it (file-truename dir)))) + (puthash cache-key (or value 'no-project-root) projectile-project-root-cache) + value))) + projectile-project-root-files-functions) + (if projectile-require-project-root + (error "You're not in a project") + default-directory)))) (defun projectile-file-truename (file-name) "Return the truename of FILE-NAME. @@ -697,8 +714,10 @@ A thin wrapper around `file-truename' that handles nil." (let ((project-root (condition-case nil (projectile-project-root) - (error default-directory)))) - (file-name-nondirectory (directory-file-name project-root)))) + (error nil)))) + (if project-root + (file-name-nondirectory (directory-file-name project-root)) + "-"))) ;;; Project indexing @@ -734,12 +753,10 @@ Files are returned as relative paths to the project root." (defun projectile-dir-files-external (root directory) "Get the files for ROOT under DIRECTORY using external tools." - (let ((default-directory directory) - (files-list nil)) - (setq files-list (-map (lambda (f) - (file-relative-name (expand-file-name f directory) root)) - (projectile-get-repo-files))) - files-list)) + (let ((default-directory directory)) + (-map (lambda (file) + (file-relative-name (expand-file-name file directory) root)) + (projectile-get-repo-files)))) (defcustom projectile-git-command "git ls-files -zco --exclude-standard" "Command used by projectile to get the files in a git project." @@ -853,7 +870,8 @@ function is executing." '("." ".." ".svn" ".cvs"))) (progress-reporter-update progress-reporter) (if (file-directory-p it) - (unless (projectile-ignored-directory-p it) + (unless (projectile-ignored-directory-p + (file-name-as-directory it)) (projectile-index-directory it patterns progress-reporter)) (unless (projectile-ignored-file-p it) (list it)))) @@ -934,7 +952,7 @@ opened through use of recentf." (defun projectile-project-buffer-names () "Get a list of project buffer names." - (-map 'buffer-name (projectile-project-buffers))) + (-map #'buffer-name (projectile-project-buffers))) (defun projectile-prepend-project-name (string) "Prepend the current project's name to STRING." @@ -1006,7 +1024,7 @@ Only buffers not visible in windows are returned." (defun projectile-ignored-files () "Return list of ignored files." (-map - 'projectile-expand-root + #'projectile-expand-root (append projectile-globally-ignored-files (projectile-project-ignored-files)))) @@ -1014,9 +1032,9 @@ Only buffers not visible in windows are returned." (defun projectile-ignored-directories () "Return list of ignored directories." (-map - 'file-name-as-directory + #'file-name-as-directory (-map - 'projectile-expand-root + #'projectile-expand-root (append projectile-globally-ignored-directories (projectile-project-ignored-directories))))) @@ -1133,7 +1151,7 @@ https://github.com/abo-abo/swiper"))) (gethash (projectile-project-root) projectile-projects-cache)))) ;; nothing is cached (unless files - (setq files (-mapcat 'projectile-dir-files + (setq files (-mapcat #'projectile-dir-files (projectile-get-project-directories))) ;; cache the resulting list of files (when projectile-enable-caching @@ -1149,8 +1167,8 @@ https://github.com/abo-abo/swiper"))) (defun projectile-current-project-dirs () "Return a list of dirs for the current project." - (-remove 'null (-distinct - (-map 'file-name-directory + (-remove #'null (-distinct + (-map #'file-name-directory (projectile-current-project-files))))) (defun projectile-hash-keys (hash) @@ -1437,16 +1455,6 @@ With a prefix ARG invalidates the cache first." (projectile-current-project-test-files)))) (find-file (expand-file-name file (projectile-project-root))))) -(defcustom projectile-test-files-prefixes '("test_") - "Some common prefixes of test files." - :group 'projectile - :type '(repeat string)) - -(defcustom projectile-test-files-suffices '("_test" "_spec" "Spec" "Test" "-test") - "Some common suffices of test files." - :group 'projectile - :type '(repeat string)) - (defun projectile-test-files (files) "Return only the test FILES." (-filter 'projectile-test-file-p files)) @@ -1454,9 +1462,9 @@ With a prefix ARG invalidates the cache first." (defun projectile-test-file-p (file) "Check if FILE is a test file." (or (--any? (string-prefix-p it (file-name-nondirectory file)) - projectile-test-files-prefixes) - (--any? (string-suffix-p it (file-name-sans-extension file)) - projectile-test-files-suffices))) + (-non-nil (list (funcall projectile-test-prefix-function (projectile-project-type))))) + (--any? (string-suffix-p it (file-name-nondirectory file)) + (-non-nil (list (funcall projectile-test-suffix-function (projectile-project-type))))))) (defun projectile-current-project-test-files () "Return a list of test files for the current project." @@ -1469,12 +1477,14 @@ With a prefix ARG invalidates the cache first." (defvar projectile-ruby-test '("Gemfile" "lib" "test")) (defvar projectile-django '("manage.py")) (defvar projectile-python-pip '("requirements.txt")) -(defvar projectile-python-egg '("setup.py")) +(defvar projectile-python-pkg '("setup.py")) +(defvar projectile-python-tox '("tox.ini")) (defvar projectile-scons '("SConstruct")) (defvar projectile-maven '("pom.xml")) (defvar projectile-gradle '("build.gradle")) (defvar projectile-grails '("application.properties" "grails-app")) -(defvar projectile-lein '("project.clj")) +(defvar projectile-lein-test '("project.clj")) +(defvar projectile-lein-midje '("project.clj" ".midje.clj")) (defvar projectile-rebar '("rebar")) (defvar projectile-sbt '("build.sbt")) (defvar projectile-make '("Makefile")) @@ -1485,26 +1495,35 @@ With a prefix ARG invalidates the cache first." (defvar projectile-r '("DESCRIPTION")) (defun projectile-go () + "Check if a project contains Go source files." (-any? (lambda (file) - (string= (file-name-extension file) "go")) (projectile-current-project-files))) + (string= (file-name-extension file) "go")) + (projectile-current-project-files))) (defcustom projectile-go-function 'projectile-go "Function to determine if project's type is go." :group 'projectile :type 'function) +(defvar-local projectile-project-type nil + "Buffer local var for overriding the auto-detected project type. +Normally you'd set this from .dir-locals.el.") + (defun projectile-project-type () "Determine the project's type based on its structure." (cond + (projectile-project-type projectile-project-type) ((projectile-verify-files projectile-rails-rspec) 'rails-rspec) ((projectile-verify-files projectile-rails-test) 'rails-test) ((projectile-verify-files projectile-ruby-rspec) 'ruby-rspec) ((projectile-verify-files projectile-ruby-test) 'ruby-test) ((projectile-verify-files projectile-django) 'django) + ((projectile-verify-files projectile-python-tox) 'python-tox) ((projectile-verify-files projectile-python-pip)'python) - ((projectile-verify-files projectile-python-egg) 'python) + ((projectile-verify-files projectile-python-pkg) 'python) ((projectile-verify-files projectile-symfony) 'symfony) - ((projectile-verify-files projectile-lein) 'lein) + ((projectile-verify-files projectile-lein-midje) 'lein-midje) + ((projectile-verify-files projectile-lein-test) 'lein-test) ((projectile-verify-files projectile-scons) 'scons) ((projectile-verify-files projectile-maven) 'maven) ((projectile-verify-files projectile-gradle) 'gradle) @@ -1557,6 +1576,34 @@ PROJECT-ROOT is the targeted directory. If nil, use ((projectile-locate-dominating-file project-root ".svn") 'svn) (t 'none))) +(defun projectile--test-name-for-impl-name (impl-file-path) + (let* ((project-type (projectile-project-type)) + (impl-file-name (file-name-sans-extension (file-name-nondirectory impl-file-path))) + (impl-file-ext (file-name-extension impl-file-path)) + (test-prefix (funcall projectile-test-prefix-function project-type)) + (test-suffix (funcall projectile-test-suffix-function project-type))) + (cond + (test-prefix (concat test-prefix impl-file-name "." impl-file-ext)) + (test-suffix (concat impl-file-name test-suffix "." impl-file-ext)) + (t (error "Project type not supported!"))))) + +(defun projectile-create-test-file-for (impl-file-path) + (let* ((test-file (projectile--test-name-for-impl-name impl-file-path)) + (test-dir (replace-regexp-in-string "src/" "test/" (file-name-directory impl-file-path)))) + (unless (file-exists-p (expand-file-name test-file test-dir)) + (progn (unless (file-exists-p test-dir) + (make-directory test-dir :create-parents)) + (concat test-dir test-file))))) + +(defcustom projectile-create-missing-test-files nil + "During toggling, if non-nil enables creating test files if not found. + +When not-nil, every call to projectile-find-implementation-or-test-* +creates test files if not found on the file system. Defaults to nil. +It assumes the test/ folder is at the same level as src/." + :group 'projectile + :type 'boolean) + (defun projectile-find-implementation-or-test (file-name) "Given a FILE-NAME return the matching implementation or test filename." (unless file-name (error "The current buffer is not visiting a file")) @@ -1570,7 +1617,9 @@ PROJECT-ROOT is the targeted directory. If nil, use (let ((test-file (projectile-find-matching-test file-name))) (if test-file (projectile-expand-root test-file) - (error "No matching test file found"))))) + (if projectile-create-missing-test-files + (projectile-create-test-file-for file-name) + (error "No matching test file found")))))) ;;;###autoload (defun projectile-find-implementation-or-test-other-window () @@ -1605,13 +1654,14 @@ PROJECT-ROOT is the targeted directory. If nil, use (defun projectile-test-prefix (project-type) "Find default test files prefix based on PROJECT-TYPE." (cond - ((member project-type '(django python)) "test_"))) + ((member project-type '(django python)) "test_") + ((member project-type '(lein-midje)) "t_"))) (defun projectile-test-suffix (project-type) "Find default test files suffix based on PROJECT-TYPE." (cond ((member project-type '(rails-rspec ruby-rspec)) "_spec") - ((member project-type '(rails-test ruby-test lein go)) "_test") + ((member project-type '(rails-test ruby-test lein-test go)) "_test") ((member project-type '(scons)) "test") ((member project-type '(maven symfony)) "Test") ((member project-type '(gradle grails)) "Spec"))) @@ -1682,7 +1732,7 @@ This is a subset of `grep-read-files', where either a matching entry from (setq alias (car aliases) aliases (cdr aliases)) (if (string-match (mapconcat - 'wildcard-to-regexp + #'wildcard-to-regexp (split-string (cdr alias) nil t) "\\|") fn) @@ -1721,7 +1771,7 @@ to `projectile-grep-default-files'." ;; paths for find-grep should relative and without trailing / (let ((grep-find-ignored-directories (-union (--map (directory-file-name (file-relative-name it root-dir)) - (cdr (projectile-ignored-directories))) + (projectile-ignored-directories)) grep-find-ignored-directories)) (grep-find-ignored-files (-union (-map (lambda (file) @@ -1805,7 +1855,7 @@ regular expression." (defun projectile--tags (completion-table) "Find tags using COMPLETION-TABLE." - (-reject 'null + (-reject #'null (-map (lambda (x) (unless (integerp x) (prin1-to-string x t))) @@ -1886,8 +1936,8 @@ files in the project." " ."))))) (projectile-files-from-cmd cmd directory)) ;; we have to reject directories as a workaround to work with git submodules - (-reject 'file-directory-p - (-map 'projectile-expand-root (projectile-dir-files directory))))) + (-reject #'file-directory-p + (-map #'projectile-expand-root (projectile-dir-files directory))))) (defun projectile-replace (&optional arg) "Replace a string in the project using `tags-query-replace'. @@ -1923,7 +1973,7 @@ to run the replacement." (length buffers) name)) ;; we take care not to kill indirect buffers directly ;; as we might encounter them after their base buffers are killed - (mapc 'kill-buffer (-remove 'buffer-base-buffer buffers))))) + (mapc #'kill-buffer (-remove 'buffer-base-buffer buffers))))) ;;;###autoload (defun projectile-save-project-buffers () @@ -1984,6 +2034,7 @@ For git projects `magit-status-internal' is used if available." (defvar projectile-django-test-cmd "python manage.py test") (defvar projectile-python-compile-cmd "python setup.py build") (defvar projectile-python-test-cmd "python -m unittest discover") +(defvar projectile-python-tox-test-cmd "tox") (defvar projectile-symfony-compile-cmd "app/console server:run") (defvar projectile-symfony-test-cmd "phpunit -c app ") (defvar projectile-scons-compile-cmd "scons") @@ -1996,6 +2047,7 @@ For git projects `magit-status-internal' is used if available." (defvar projectile-grails-test-cmd "grails test-app") (defvar projectile-lein-compile-cmd "lein compile") (defvar projectile-lein-test-cmd "lein test") +(defvar projectile-lein-midje-test-cmd "lein midje") (defvar projectile-rebar-compile-cmd "rebar") (defvar projectile-rebar-test-cmd "rebar eunit") (defvar projectile-sbt-compile-cmd "sbt compile") @@ -2024,6 +2076,7 @@ For git projects `magit-status-internal' is used if available." projectile-django-test-cmd projectile-python-compile-cmd projectile-python-test-cmd + projectile-python-tox-test-cmd projectile-symfony-compile-cmd projectile-symfony-test-cmd projectile-scons-compile-cmd @@ -2032,6 +2085,7 @@ For git projects `magit-status-internal' is used if available." projectile-maven-test-cmd projectile-lein-compile-cmd projectile-lein-test-cmd + projectile-lein-midje-test-cmd projectile-rebar-compile-cmd projectile-rebar-test-cmd projectile-sbt-compile-cmd @@ -2064,7 +2118,7 @@ For git projects `magit-status-internal' is used if available." ((eq project-type 'django) projectile-django-compile-cmd) ((eq project-type 'python) projectile-python-compile-cmd) ((eq project-type 'symfony) projectile-symfony-compile-cmd) - ((eq project-type 'lein) projectile-lein-compile-cmd) + ((member project-type '(lein-test lein-midje)) projectile-lein-compile-cmd) ((eq project-type 'make) projectile-make-compile-cmd) ((eq project-type 'rebar) projectile-rebar-compile-cmd) ((eq project-type 'scons) projectile-scons-compile-cmd) @@ -2086,9 +2140,11 @@ For git projects `magit-status-internal' is used if available." ((member project-type '(rails-rspec ruby-rspec)) projectile-ruby-rspec-cmd) ((member project-type '(rails-test ruby-test)) projectile-ruby-test-cmd) ((eq project-type 'django) projectile-django-test-cmd) + ((eq project-type 'python-tox) projectile-python-tox-test-cmd) ((eq project-type 'python) projectile-python-test-cmd) ((eq project-type 'symfony) projectile-symfony-test-cmd) - ((eq project-type 'lein) projectile-lein-test-cmd) + ((eq project-type 'lein-test) projectile-lein-test-cmd) + ((eq project-type 'lein-midje) projectile-lein-midje-test-cmd) ((eq project-type 'make) projectile-make-test-cmd) ((eq project-type 'rebar) projectile-rebar-test-cmd) ((eq project-type 'scons) projectile-scons-test-cmd) @@ -2130,6 +2186,10 @@ with a prefix ARG." (compilation-read-command default-cmd) default-cmd))) (puthash project-root compilation-cmd projectile-compilation-cmd-map) + (save-some-buffers (not compilation-ask-about-save) + (lambda () + (projectile-project-buffer-p (current-buffer) + project-root))) (compilation-start compilation-cmd))) (defadvice compilation-find-file (around projectile-compilation-find-file) @@ -2290,11 +2350,17 @@ It handles the case of remote files as well. See `projectile-cleanup-known-proje (defun projectile-ignored-projects () "A list of projects that should not be save in `projectile-known-projects'." - (-map 'file-truename projectile-ignored-projects)) + (-map #'file-truename projectile-ignored-projects)) + +(defun projectile-ignored-project-p (project-root) + "Return t if PROJECT-ROOT should not be added to `projectile-known-projects'." + (or (member project-root (projectile-ignored-projects)) + (and (functionp projectile-ignored-project-function) + (funcall projectile-ignored-project-function project-root)))) (defun projectile-add-known-project (project-root) "Add PROJECT-ROOT to the list of known projects." - (unless (member project-root (projectile-ignored-projects)) + (unless (projectile-ignored-project-p project-root) (setq projectile-known-projects (-distinct (cons (abbreviate-file-name project-root) @@ -2484,43 +2550,43 @@ is chosen." ;;; Minor mode (defvar projectile-command-map (let ((map (make-sparse-keymap))) - (define-key map (kbd "4 a") 'projectile-find-other-file-other-window) - (define-key map (kbd "4 b") 'projectile-switch-to-buffer-other-window) - (define-key map (kbd "4 C-o") 'projectile-display-buffer) - (define-key map (kbd "4 d") 'projectile-find-dir-other-window) - (define-key map (kbd "4 f") 'projectile-find-file-other-window) - (define-key map (kbd "4 g") 'projectile-find-file-dwim-other-window) - (define-key map (kbd "4 t") 'projectile-find-implementation-or-test-other-window) - (define-key map (kbd "!") 'projectile-run-shell-command-in-root) - (define-key map (kbd "&") 'projectile-run-async-shell-command-in-root) - (define-key map (kbd "a") 'projectile-find-other-file) - (define-key map (kbd "b") 'projectile-switch-to-buffer) - (define-key map (kbd "c") 'projectile-compile-project) - (define-key map (kbd "d") 'projectile-find-dir) - (define-key map (kbd "D") 'projectile-dired) - (define-key map (kbd "e") 'projectile-recentf) - (define-key map (kbd "f") 'projectile-find-file) - (define-key map (kbd "g") 'projectile-find-file-dwim) - (define-key map (kbd "F") 'projectile-find-file-in-known-projects) - (define-key map (kbd "i") 'projectile-invalidate-cache) - (define-key map (kbd "I") 'projectile-ibuffer) - (define-key map (kbd "j") 'projectile-find-tag) - (define-key map (kbd "k") 'projectile-kill-buffers) - (define-key map (kbd "l") 'projectile-find-file-in-directory) - (define-key map (kbd "m") 'projectile-commander) - (define-key map (kbd "o") 'projectile-multi-occur) - (define-key map (kbd "p") 'projectile-switch-project) - (define-key map (kbd "P") 'projectile-test-project) - (define-key map (kbd "r") 'projectile-replace) - (define-key map (kbd "R") 'projectile-regenerate-tags) - (define-key map (kbd "s g") 'projectile-grep) - (define-key map (kbd "s s") 'projectile-ag) - (define-key map (kbd "S") 'projectile-save-project-buffers) - (define-key map (kbd "t") 'projectile-toggle-between-implementation-and-test) - (define-key map (kbd "T") 'projectile-find-test-file) - (define-key map (kbd "v") 'projectile-vc) - (define-key map (kbd "z") 'projectile-cache-current-file) - (define-key map (kbd "ESC") 'projectile-project-buffers-other-buffer) + (define-key map (kbd "4 a") #'projectile-find-other-file-other-window) + (define-key map (kbd "4 b") #'projectile-switch-to-buffer-other-window) + (define-key map (kbd "4 C-o") #'projectile-display-buffer) + (define-key map (kbd "4 d") #'projectile-find-dir-other-window) + (define-key map (kbd "4 f") #'projectile-find-file-other-window) + (define-key map (kbd "4 g") #'projectile-find-file-dwim-other-window) + (define-key map (kbd "4 t") #'projectile-find-implementation-or-test-other-window) + (define-key map (kbd "!") #'projectile-run-shell-command-in-root) + (define-key map (kbd "&") #'projectile-run-async-shell-command-in-root) + (define-key map (kbd "a") #'projectile-find-other-file) + (define-key map (kbd "b") #'projectile-switch-to-buffer) + (define-key map (kbd "c") #'projectile-compile-project) + (define-key map (kbd "d") #'projectile-find-dir) + (define-key map (kbd "D") #'projectile-dired) + (define-key map (kbd "e") #'projectile-recentf) + (define-key map (kbd "f") #'projectile-find-file) + (define-key map (kbd "g") #'projectile-find-file-dwim) + (define-key map (kbd "F") #'projectile-find-file-in-known-projects) + (define-key map (kbd "i") #'projectile-invalidate-cache) + (define-key map (kbd "I") #'projectile-ibuffer) + (define-key map (kbd "j") #'projectile-find-tag) + (define-key map (kbd "k") #'projectile-kill-buffers) + (define-key map (kbd "l") #'projectile-find-file-in-directory) + (define-key map (kbd "m") #'projectile-commander) + (define-key map (kbd "o") #'projectile-multi-occur) + (define-key map (kbd "p") #'projectile-switch-project) + (define-key map (kbd "P") #'projectile-test-project) + (define-key map (kbd "r") #'projectile-replace) + (define-key map (kbd "R") #'projectile-regenerate-tags) + (define-key map (kbd "s g") #'projectile-grep) + (define-key map (kbd "s s") #'projectile-ag) + (define-key map (kbd "S") #'projectile-save-project-buffers) + (define-key map (kbd "t") #'projectile-toggle-between-implementation-and-test) + (define-key map (kbd "T") #'projectile-find-test-file) + (define-key map (kbd "v") #'projectile-vc) + (define-key map (kbd "z") #'projectile-cache-current-file) + (define-key map (kbd "ESC") #'projectile-project-buffers-other-buffer) map) "Keymap for Projectile commands after `projectile-keymap-prefix'.") (fset 'projectile-command-map projectile-command-map) @@ -2606,18 +2672,18 @@ Otherwise behave as if called interactively. (setq projectile-projects-cache (or (projectile-unserialize projectile-cache-file) (make-hash-table :test 'equal)))) - (add-hook 'find-file-hook 'projectile-cache-files-find-file-hook t t) - (add-hook 'find-file-hook 'projectile-cache-projects-find-file-hook t t) - (add-hook 'projectile-find-dir-hook 'projectile-cache-projects-find-file-hook) - (add-hook 'find-file-hook 'projectile-visit-project-tags-table t t) - (add-hook 'dired-before-readin-hook 'projectile-cache-projects-find-file-hook t t) + (add-hook 'find-file-hook #'projectile-cache-files-find-file-hook t t) + (add-hook 'find-file-hook #'projectile-cache-projects-find-file-hook t t) + (add-hook 'projectile-find-dir-hook #'projectile-cache-projects-find-file-hook) + (add-hook 'find-file-hook #'projectile-visit-project-tags-table t t) + (add-hook 'dired-before-readin-hook #'projectile-cache-projects-find-file-hook t t) (ad-activate 'compilation-find-file) (ad-activate 'delete-file)) (t - (remove-hook 'find-file-hook 'projectile-cache-files-find-file-hook t) - (remove-hook 'find-file-hook 'projectile-cache-projects-find-file-hook t) - (remove-hook 'find-file-hook 'projectile-visit-project-tags-table t) - (remove-hook 'dired-before-readin-hook 'projectile-cache-projects-find-file-hook t) + (remove-hook 'find-file-hook #'projectile-cache-files-find-file-hook t) + (remove-hook 'find-file-hook #'projectile-cache-projects-find-file-hook t) + (remove-hook 'find-file-hook #'projectile-visit-project-tags-table t) + (remove-hook 'dired-before-readin-hook #'projectile-cache-projects-find-file-hook t) (ad-deactivate 'compilation-find-file) (ad-deactivate 'delete-file)))) diff --git a/emacs.d/elpa/web-mode-20141018.216/web-mode-pkg.el b/emacs.d/elpa/web-mode-20141018.216/web-mode-pkg.el deleted file mode 100644 index bfcb1b8..0000000 --- a/emacs.d/elpa/web-mode-20141018.216/web-mode-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "web-mode" "20141018.216" "major mode for editing html templates" 'nil :url "http://web-mode.org" :keywords '("html" "template" "javascript" "css" "web" "php" "django" "erb" "jsp")) diff --git a/emacs.d/elpa/web-mode-20141018.216/web-mode-autoloads.el b/emacs.d/elpa/web-mode-20150618.1109/web-mode-autoloads.el similarity index 87% rename from emacs.d/elpa/web-mode-20141018.216/web-mode-autoloads.el rename to emacs.d/elpa/web-mode-20150618.1109/web-mode-autoloads.el index f08761f..12eba2a 100644 --- a/emacs.d/elpa/web-mode-20141018.216/web-mode-autoloads.el +++ b/emacs.d/elpa/web-mode-20150618.1109/web-mode-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "web-mode" "web-mode.el" (21570 27110 0 0)) +;;;### (autoloads nil "web-mode" "web-mode.el" (21898 47959 0 0)) ;;; Generated autoloads from web-mode.el (autoload 'web-mode "web-mode" "\ diff --git a/emacs.d/elpa/web-mode-20150618.1109/web-mode-pkg.el b/emacs.d/elpa/web-mode-20150618.1109/web-mode-pkg.el new file mode 100644 index 0000000..5e27ff2 --- /dev/null +++ b/emacs.d/elpa/web-mode-20150618.1109/web-mode-pkg.el @@ -0,0 +1 @@ +(define-package "web-mode" "20150618.1109" "major mode for editing web templates" 'nil :url "http://web-mode.org" :keywords '("languages")) diff --git a/emacs.d/elpa/web-mode-20141018.216/web-mode.el b/emacs.d/elpa/web-mode-20150618.1109/web-mode.el similarity index 65% rename from emacs.d/elpa/web-mode-20141018.216/web-mode.el rename to emacs.d/elpa/web-mode-20150618.1109/web-mode.el index ea54456..8bdf22a 100644 --- a/emacs.d/elpa/web-mode-20141018.216/web-mode.el +++ b/emacs.d/elpa/web-mode-20150618.1109/web-mode.el @@ -1,36 +1,39 @@ -;;; web-mode.el --- major mode for editing html templates +;;; web-mode.el --- major mode for editing web templates ;;; -*- coding: utf-8 -*- -;; Copyright 2011-2014 François-Xavier Bois +;; Copyright 2011-2015 François-Xavier Bois -;; Version: 20141018.216 -;; X-Original-Version: 10.0.3 +;; Version: 11.2.9 +;; Package-Version: 20150618.1109 ;; Author: François-Xavier Bois ;; Maintainer: François-Xavier Bois ;; Created: July 2011 -;; Keywords: html template javascript css web php django erb jsp -;; URL: http://web-mode.org +;; Keywords: languages +;; Homepage: http://web-mode.org ;; Repository: http://github.com/fxbois/web-mode ;; License: GNU General Public License >= 2 ;; Distribution: This file is not part of Emacs -;; ========================================================================= -;; This work is sponsored by Kernix : Digital Agency (Web & Mobile) in Paris -;; ========================================================================= +;;============================================================================== +;; WEB-MODE is sponsored by Kernix : Great Digital Agency (Web&Mobile) in Paris +;;============================================================================== ;; Code goes here +;;---- TODO -------------------------------------------------------------------- + +;; v12 : invert path and XX (web-mode-engines-alist, +;; web-mode-content-types-alist) for more consistency + ;;---- CONSTS ------------------------------------------------------------------ -(defconst web-mode-version "10.0.3" +(defconst web-mode-version "11.2.9" "Web Mode version.") ;;---- GROUPS ------------------------------------------------------------------ (defgroup web-mode nil - "Major mode for editing web templates: - html files embedding parts (css/javascript) - and blocks (php, erb, django/twig, smarty, jsp, asp, etc.)" + "Major mode for editing web templates" :group 'languages :prefix "web-" :link '(url-link :tag "Site" "http://web-mode.org") @@ -58,17 +61,25 @@ :type 'integer :group 'web-mode) -(defcustom web-mode-markup-indent-offset 2 +(defcustom web-mode-attr-indent-offset nil + "Html attribute indentation level." + :type 'integer + :group 'web-mode) + +(defcustom web-mode-markup-indent-offset + (if (and (boundp 'standard-indent) standard-indent) standard-indent 2) "Html indentation level." :type 'integer :group 'web-mode) -(defcustom web-mode-css-indent-offset 2 +(defcustom web-mode-css-indent-offset + (if (and (boundp 'standard-indent) standard-indent) standard-indent 2) "CSS indentation level." :type 'integer :group 'web-mode) -(defcustom web-mode-code-indent-offset 2 +(defcustom web-mode-code-indent-offset + (if (and (boundp 'standard-indent) standard-indent) standard-indent 2) "Code (javascript, php, etc.) indentation level." :type 'integer :group 'web-mode) @@ -88,6 +99,11 @@ :type 'boolean :group 'web-mode) +(defcustom web-mode-enable-auto-closing (display-graphic-p) + "Auto-closing." + :type 'boolean + :group 'web-mode) + (defcustom web-mode-enable-auto-pairing (display-graphic-p) "Auto-pairing." :type 'boolean @@ -98,13 +114,18 @@ :type 'boolean :group 'web-mode) -(defcustom web-mode-enable-block-partial-invalidation t - "Partial invalidation in blocks (php and asp at the moment)." +(defcustom web-mode-enable-auto-quoting (display-graphic-p) + "Add double quotes after the character = in a tag." + :type 'boolean + :group 'web-mode) + +(defcustom web-mode-enable-auto-expanding nil + "e.g. s/ expands to |." :type 'boolean :group 'web-mode) -(defcustom web-mode-enable-part-partial-invalidation t - "Partial invalidation in js/css parts." +(defcustom web-mode-enable-control-block-indentation t + "Control blocks increase indentation." :type 'boolean :group 'web-mode) @@ -114,7 +135,7 @@ :group 'web-mode) (defcustom web-mode-enable-current-column-highlight nil - "Show current region." + "Show column for current element." :type 'boolean :group 'web-mode) @@ -140,13 +161,18 @@ See web-mode-part-face." :type 'boolean :group 'web-mode) +(defcustom web-mode-enable-sexp-functions t + "Enable specific sexp functions." + :type 'boolean + :group 'web-mode) + (defcustom web-mode-enable-string-interpolation t "Enable string interpolation fontification (php and erb)." :type 'boolean :group 'web-mode) (defcustom web-mode-enable-heredoc-fontification t - "Enable heredoc fontification. The identifier should contain JS, JAVASCRIPT or HTML." + "Enable heredoc fontification. The identifier should contain JS, JAVASCRIPT, CSS or HTML." :type 'boolean :group 'web-mode) @@ -161,11 +187,11 @@ See web-mode-part-face." :group 'web-mode) (defcustom web-mode-enable-engine-detection nil - "Detect directive like -*- engine: ENGINE -*- at the top of the file." + "Detect such directive -*- engine: ENGINE -*- at the top of the file." :type 'boolean :group 'web-mode) -(defcustom web-mode-enable-comment-keywords nil +(defcustom web-mode-enable-comment-keywords '() "Enable highlight of keywords like FIXME, TODO, etc. in comments." :type 'list :group 'web-mode) @@ -182,12 +208,15 @@ See web-mode-part-face." :type '(choice (const :tag "default (all lines are indented)" 2) (const :tag "text at the beginning of line is not indented" 1))) -(defcustom web-mode-tag-auto-close-style (if (display-graphic-p) 1 0) - "Tag auto-close style: -0=no auto-closing -1=auto-close with and and )." + "Face for html custom tags (e.g. )." :group 'web-mode-faces) (defface web-mode-html-tag-bracket-face @@ -291,7 +320,7 @@ See web-mode-part-face." (((class color) (min-colors 8)) :foreground "Snow3") (((type tty) (class mono)) :inverse-video t) (t :foreground "Snow3")) - "Face for HTML tags angle brackets (< and >)." + "Face for html tags angle brackets (<, > and />)." :group 'web-mode-faces) (defface web-mode-html-attr-name-face @@ -302,7 +331,7 @@ See web-mode-part-face." (((class color) (min-colors 8)) :foreground "Snow3") (((type tty) (class mono)) :inverse-video t) (t :foreground "Snow4")) - "Face for HTML attribute names." + "Face for html attribute names." :group 'web-mode-faces) (defface web-mode-html-attr-custom-face @@ -311,7 +340,7 @@ See web-mode-part-face." :group 'web-mode-faces) (defface web-mode-html-attr-engine-face - '((t :inherit web-mode-html-attr-custom-face)) + '((t :inherit web-mode-block-delimiter-face)) "Face for custom engine attribute names (e.g. ng-*)." :group 'web-mode-faces) @@ -322,7 +351,7 @@ See web-mode-part-face." (defface web-mode-html-attr-value-face '((t :inherit font-lock-string-face)) - "Face for HTML attribute values." + "Face for html attribute values." :group 'web-mode-faces) (defface web-mode-block-attr-name-face @@ -385,6 +414,11 @@ See web-mode-part-face." "Face for function names." :group 'web-mode-faces) +(defface web-mode-filter-face + '((t :inherit font-lock-function-name-face)) + "Face for function names." + :group 'web-mode-faces) + (defface web-mode-function-call-face '((t :inherit font-lock-function-name-face)) "Face for function calls." @@ -513,6 +547,16 @@ Must be used in conjunction with web-mode-enable-block-face." "Face for parts." :group 'web-mode-faces) +(defface web-mode-script-face + '((t :inherit web-mode-part-face)) + "Face for javascript inside a script element." + :group 'web-mode-faces) + +(defface web-mode-style-face + '((t :inherit web-mode-part-face)) + "Face for css inside a style element." + :group 'web-mode-faces) + (defface web-mode-folded-face '((t :underline t)) "Overlay face for folded." @@ -539,7 +583,7 @@ Must be used in conjunction with web-mode-enable-block-face." :group 'web-mode-faces) (defface web-mode-current-column-highlight-face - '((t :background "#292929")) + '((t :background "#3e3c36")) "Overlay face for current column." :group 'web-mode-faces) @@ -561,21 +605,21 @@ Must be used in conjunction with web-mode-enable-block-face." (defvar web-mode-auto-pairs nil) (defvar web-mode-block-regexp nil) (defvar web-mode-chunk-length 64) -(defvar web-mode-closing-blocks nil) (defvar web-mode-column-overlays nil) (defvar web-mode-comments-invisible nil) (defvar web-mode-content-type "") +(defvar web-mode-inhibit-fontification nil) (defvar web-mode-end-tag-overlay nil) (defvar web-mode-engine nil) (defvar web-mode-engine-attr-regexp nil) (defvar web-mode-engine-font-lock-keywords nil) (defvar web-mode-engine-token-regexp nil) (defvar web-mode-expand-initial-pos nil) +(defvar web-mode-expand-initial-scroll nil) (defvar web-mode-expand-previous-state "") (defvar web-mode-font-lock-keywords '(web-mode-font-lock-highlight)) (defvar web-mode-change-beg nil) (defvar web-mode-change-end nil) -(defvar web-mode-hl-line-mode-flag nil) (defvar web-mode-hook nil) (defvar web-mode-inlay-regexp nil) (defvar web-mode-is-scratch nil) @@ -583,24 +627,25 @@ Must be used in conjunction with web-mode-enable-block-face." (defvar web-mode-obarray nil) (defvar web-mode-snippets nil) (defvar web-mode-start-tag-overlay nil) +(defvar web-mode-minor-engine nil) (defvar web-mode-time (current-time)) -(defvar web-mode-pre-elements - '("code" "pre" "textarea")) +(defvar web-mode-pre-elements '("code" "pre" "textarea")) (defvar web-mode-void-elements '("area" "base" "br" "col" "command" "embed" "hr" "img" "input" "keygen" "link" "meta" "param" "source" "track" "wbr")) +(defvar web-mode-part-content-types '("css" "javascript" "json" "jsx")) + +(defvar web-mode-javascript-languages '("javascript" "jsx" "ejs")) + +;; NOTE: without 'syntax-table forward-word fails (bug#377) (defvar web-mode-scan-properties - (list 'tag-beg nil 'tag-end nil 'tag-name nil 'tag-type nil - 'tag-attr nil 'tag-attr-end nil - 'part-side nil 'part-token nil 'part-element nil 'part-expr nil - 'block-side nil 'block-token nil 'block-controls nil - 'block-beg nil 'block-end nil - ;;'face nil - ;;'syntax-table nil - ) + (list 'tag-beg 'tag-end 'tag-name 'tag-type 'tag-attr 'tag-attr-end + 'part-side 'part-token 'part-element 'part-expr + 'block-side 'block-token 'block-controls 'block-beg 'block-end + 'syntax-table) "Text properties used for code regions/tokens and html nodes.") (defvar web-mode-start-tag-regexp "<\\([[:alpha:]][[:alnum:]-]*\\)" @@ -615,66 +660,108 @@ Must be used in conjunction with web-mode-enable-block-face." ("^[ \t]*<\\([@a-z]+\\)[^>]*>? *$" 1 "id=\"\\([a-zA-Z0-9_]+\\)\"" "#" ">")) "Regexps to match imenu items (see http://web-mode.org/doc/imenu.txt)") +(defvar web-mode-indentation-params + '(("lineup-args" . t) + ("lineup-calls" . t) + ("lineup-concats" . t) + )) + (defvar web-mode-engines - '(("angular" . ("angularjs" "angular.js")) - ("asp" . ()) - ("aspx" . ()) - ("blade" . ("laravel")) - ("clip" . ()) - ("closure" . ("soy")) - ("ctemplate" . ("mustache" "handlebars" "hapax" "ngtemplate" "ember" "kite" "meteor" "blaze")) - ("django" . ("dtl" "twig" "swig" "jinja" "jinja2" "erlydtl" "liquid" "clabango" "selmer")) - ("dust" . ("dustjs")) - ("erb" . ("eruby" "erubis" "ejs")) - ("go" . ("gtl")) - ("jsp" . ("grails")) - ("mason" . ("poet")) - ("lsp" . ()) - ("mojolicious" . ()) - ("python" . ()) - ("razor" . ("play" "play2")) - ("underscore" . ("underscore.js")) - ("velocity" . ("vtl" "cheetah")) - ("web2py" . ())) + '(("angular" . ("angularjs" "angular.js")) + ("asp" . ()) + ("aspx" . ()) + ("blade" . ("laravel")) + ("cl-emb" . ()) + ("clip" . ()) + ("closure" . ("soy")) + ("ctemplate" . ("mustache" "handlebars" "hapax" "ngtemplate" "ember" + "kite" "meteor" "blaze" "ractive")) + ("django" . ("dtl" "twig" "swig" "jinja" "erlydtl" "liquid" + "clabango" "selmer" "nunjucks")) + ("dust" . ("dustjs")) + ("ejs" . ()) + ("elixir" . ()) + ("erb" . ("eruby" "erubis")) + ("freemarker" . ()) + ("go" . ("gtl")) + ("jsp" . ("grails")) + ("mako" . ()) + ("mason" . ("poet")) + ("lsp" . ("lisp")) + ("mojolicious" . ()) + ("php" . ()) + ("python" . ()) + ("razor" . ("play" "play2")) + ("template-toolkit" . ()) + ("smarty" . ()) + ("thymeleaf" . ()) + ("underscore" . ("underscore.js")) + ("velocity" . ("vtl" "cheetah" "ssp")) + ("web2py" . ())) "Engine name aliases") (defvar web-mode-content-types '(("css" . "\\.\\(s?css\\|css\\.erb\\)\\'") ("javascript" . "\\.\\(js\\|js\\.erb\\)\\'") - ("json" . "\\.\\(json\\|jsonld\\)\\'") + ("json" . "\\.\\(api\\|json\\|jsonld\\)\\'") ("jsx" . "\\.jsx\\'") + ("xml" . "\\.xml\\'") ("html" . ".")) "content types") (defvar web-mode-engine-attr-regexps - '(("angular" . "ng-")) + '(("angular" . "ng-") + ("thymeleaf" . "th:")) "Engine custom attributes") +(defvar web-mode-last-enabled-feature nil) + +(defvar web-mode-features + '(("css-colorization" . web-mode-enable-css-colorization) + ("element-highlight" . web-mode-enable-current-element-highlight) + ("column-highlight" . web-mode-enable-current-column-highlight) + ("whitespace-fontification" . web-mode-enable-whitespace-fontification) + ("element-tag-fontification" . web-mode-enable-element-tag-fontification) + ("block-face" . web-mode-enable-block-face) + ("part-face" . web-mode-enable-part-face))) + +(defvar web-mode-comment-formats + '(("java" . "/*") + ("javascript" . "/*") + ("php" . "/*") + )) + (defvar web-mode-engine-file-regexps '(("asp" . "\\.asp\\'") ("aspx" . "\\.as[cp]x\\'") ("blade" . "\\.blade\\.php\\'") + ("cl-emb" . "\\.clemb\\'") ("clip" . "\\.ctml\\'") ("closure" . "\\.soy\\'") ("ctemplate" . "\\.\\(chtml\\|mustache\\)\\'") - ("django" . "\\.\\(djhtml\\|tmpl\\|dtl\\|liquid\\)\\'") - ("erb" . "\\.\\(erb\\|rhtml\\|ejs\\|erb\\.html\\)\\'") + ("django" . "\\.\\(djhtml\\|tmpl\\|dtl\\|liquid\\|j2\\)\\'") + ("dust" . "\\.dust\\'") + ("elixir" . "\\.eex\\'") + ("ejs" . "\\.ejs\\'") + ("erb" . "\\.\\(erb\\|rhtml\\|erb\\.html\\)\\'") ("freemarker" . "\\.ftl\\'") ("go" . "\\.go\\(html\\|tmpl\\)\\'") ("handlebars" . "\\.\\(hb\\.html\\|hbs\\)\\'") + ("jinja" . "\\.jinja\\'") ("jsp" . "\\.[gj]sp\\'") ("lsp" . "\\.lsp\\'") ("mako" . "\\.mako?\\'") ("mason" . "\\.mas\\'") ("mojolicious" . "\\.epl?\\'") - ("php" . "\\.\\(php\\|ctp\\|psp\\|inc\\)\\'") + ("php" . "\\.\\(p[hs]p\\|ctp\\|inc\\)\\'") ("python" . "\\.pml\\'") - ("razor" . "\\.\\(cshtml\\|vbhtml\\)\\'") + ("razor" . "\\.\\(cs\\|vb\\)html\\'") ("smarty" . "\\.tpl\\'") ("template-toolkit" . "\\.tt.?\\'") + ("thymeleaf" . "\\.thtml\\'") ("velocity" . "\\.v\\(sl\\|tl\\|m\\)\\'") - ("django" . "twig") + ("django" . "[st]wig") ("razor" . "scala") ) @@ -691,67 +778,89 @@ Must be used in conjunction with web-mode-enable-block-face." "XML chars") (defvar web-mode-html-entities - '(("egrave" . 232) - ("eacute" . 233) - ("ecirc" . 234) - ("euml" . 235) - ("agrave" . 224) - ("aacute" . 225) - ("aelig" . 230) - ("ccedil" . 231) - ("times" . 215) - ("quot" . 34) - ("amp" . 38) - ("lt" . 60) - ("gt" . 62) - ("laquo" . 171) - ("raquo" . 187) - ("lsquo" . 8249) - ("rsquo" . 8250) - ("ldquo" . 8220) - ("rdquo" . 8221) - ("lsaquo" . 8249) - ("rsaquo" . 8250) - ("apos" . 39) - ("frac14" . 188) - ("frac12" . 189) - ("frac34" . 190) - ("para" . 182) - ("middot" . 183) - ("ndash" . 8211) - ("mdash" . 8212) - ("bull" . 8226) - ("hellip" . 8230) - ("trade" . 8482) - ("larr" . 8592) - ("uarr" . 8593) - ("rarr" . 8594) - ("darr" . 8595) - ("harr" . 8596) - ("crarr" . 8629) - ("and" . 8743) - ("or" . 8744) - ("sdot" . 8901))) - -(defvar web-mode-engines-alternate-delimiters - (if (boundp 'web-mode-engines-alternate-delimiters) - web-mode-engines-alternate-delimiters - '()) - "Engine delimiters. Useful for engines that provide alternate delimiters.") - -(defun web-mode-engine-delimiter-open (engine default) - "alternative open delimiter" - (let (delim) - (setq delim (car (cdr (assoc engine web-mode-engines-alternate-delimiters)))) - (or delim default) - )) - -(defun web-mode-engine-delimiter-close (engine default) - "alternative close delimiter" - (let (delim) - (setq delim (cdr (cdr (assoc engine web-mode-engines-alternate-delimiters)))) - (or delim default) - )) + '(("AElig" . 198) ("Aacute" . 193) ("Acirc" . 194) ("Agrave" . 192) + ("Alpha" . 913) ("Aring" . 197) ("Atilde" . 195) ("Auml" . 196) + ("Beta" . 914) + ("Ccedil" . 199) ("Chi" . 935) + ("Dagger" . 8225) ("Delta" . 916) + ("ETH" . 208) ("Eacute" . 201) ("Ecirc" . 202) ("Egrave" . 200) + ("Epsilon" . 917) ("Eta" . 919) ("Euml" . 203) + ("Gamma" . 915) + ("Iacute" . 205) ("Icirc" . 206) ("Igrave" . 204) ("Iota" . 921) + ("Iuml" . 207) + ("Kappa" . 922) + ("Lambda" . 923) + ("Mu" . 924) + ("Ntilde" . 209) ("Nu" . 925) + ("OElig" . 338) ("Oacute" . 211) ("Ocirc" . 212) ("Ograve" . 210) + ("Omega" . 937) ("Omicron" . 927) ("Oslash" . 216) ("Otilde" . 213) + ("Ouml" . 214) + ("Phi" . 934) ("Pi" . 928) ("Prime" . 8243) ("Psi" . 936) + ("Rho" . 929) + ("Scaron" . 352) ("Sigma" . 931) + ("THORN" . 222) ("Tau" . 932) ("Theta" . 920) + ("UArr" . 8657) ("Uacute" . 218) ("Uacute" . 250) ("Ucirc" . 219) + ("Ugrave" . 217) ("Upsih" . 978) + ("Upsilon" . 933) ("Uuml" . 220) ("Uuml" . 252) + ("Xi" . 926) + ("Yacute" . 221) ("Yuml" . 376) + ("Zeta" . 918) + ("aacute" . 225) ("acirc" . 226) ("acute" . 180) ("aelig" . 230) + ("agrave" . 224) ("alefsym" . 8501) ("alpha" . 945) ("amp" . 38) + ("ang" . 8736) ("apos" . 39) ("aring" . 229) ("asymp" . 8776) + ("atilde" . 227) ("auml" . 228) + ("bdquo" . 8222) ("beta" . 946) ("brvbar" . 166) ("bull" . 8226) + ("cap" . 8745) ("ccedil" . 231) ("cedil" . 184) ("cent" . 162) + ("chi" . 967) ("circ" . 710) ("clubs" . 9827) ("cong" . 8773) + ("copy" . 169) ("crarr" . 8629) ("cup" . 8746) ("curren" . 164) + ("dArr" . 8659) ("dagger" . 8224) ("darr" . 8595) ("deg" . 176) + ("delta" . 948) ("diams" . 9830) ("divide" . 247) + ("eacute" . 233) ("ecirc" . 234) ("egrave" . 232) ("empty" . 8709) + ("emsp" . 8195) ("ensp" . 8194) ("epsilon" . 949) ("equiv" . 8801) + ("eta" . 951) ("eth" . 240) ("euml" . 235) ("euro" . 8364) ("exist" . 8707) + ("fnof" . 402) ("forall" . 8704) ("frac12" . 189) ("frac14" . 188) + ("frac34" . 190) ("frasl" . 8260) + ("gamma" . 947) ("ge" . 8805) ("gt" . 62) + ("hArr" . 8660) ("harr" . 8596) ("hearts" . 9829) ("hellip" . 8230) + ("iacute" . 237) ("icirc" . 238) ("iexcl" . 161) ("igrave" . 236) + ("image" . 8465) ("infin" . 8734) ("int" . 8747) ("iota" . 953) + ("iquest" . 191) ("isin" . 8712) ("iuml" . 239) + ("kappa" . 954) + ("lArr" . 8656) ("lambda" . 955) ("lang" . 9001) ("laquo" . 171) + ("larr" . 8592) ("lceil" . 8968) ("ldquo" . 8220) ("le" . 8804) + ("lfloor" . 8970) ("lowast" . 8727) ("loz" . 9674) ("lrm" . 8206) + ("lsaquo" . 8249) ("lsquo" . 8249) ("lt" . 60) + ("macr" . 175) ("mdash" . 8212) ("micro" . 181) ("middot" . 183) + ("minus" . 8722) ("mu" . 956) + ("nabla" . 8711) ("nbsp" . 160) ("ndash" . 8211) ("ne" . 8800) + ("ni" . 8715) ("not" . 172) ("notin" . 8713) ("nsub" . 8836) + ("ntilde" . 241) ("nu" . 957) ("oacute" . 243) ("ocirc" . 244) + ("oelig" . 339) ("ograve" . 242) ("oline" . 8254) ("omega" . 969) + ("omicron" . 959) ("oplus" . 8853) ("or" . 8744) ("ordf" . 170) + ("ordm" . 186) ("oslash" . 248) ("otilde" . 245) ("otimes" . 8855) + ("ouml" . 246) + ("para" . 182) ("part" . 8706) ("permil" . 8240) ("perp" . 8869) + ("phi" . 966) ("pi" . 960) ("piv" . 982) ("plusmn" . 177) ("pound" . 163) + ("prime" . 8242) ("prod" . 8719) ("prop" . 8733) ("psi" . 968) + ("quot" . 34) + ("rArr" . 8658) ("radic" . 8730) ("rang" . 9002) ("raquo" . 187) + ("rarr" . 8594) ("rceil" . 8969) ("rdquo" . 8221) ("real" . 8476) + ("reg" . 174) ("rfloor" . 8971) ("rho" . 961) ("rlm" . 8207) + ("rsaquo" . 8250) ("rsquo" . 8250) ("sbquo" . 8218) + ("scaron" . 353) ("sdot" . 8901) ("sect" . 167) ("shy" . 173) + ("sigma" . 963) ("sigmaf" . 962) ("sim" . 8764) ("spades" . 9824) + ("sub" . 8834) ("sube" . 8838) ("sum" . 8721) ("sup" . 8835) + ("sup1" . 185) ("sup2" . 178) ("sup3" . 179) ("supe" . 8839) + ("szlig" . 223) + ("tau" . 964) ("there4" . 8756) ("theta" . 952) ("thetasym" . 977) + ("thinsp" . 8201) ("thorn" . 254) ("tilde" . 732) ("times" . 215) + ("trade" . 8482) + ("uarr" . 8593) ("ucirc" . 251) ("ugrave" . 249) ("uml" . 168) + ("upsilon" . 965) + ("weierp" . 8472) + ("xi" . 958) + ("yacute" . 253) ("yen" . 165) ("yuml" . 255) + ("zeta" . 950) ("zwj" . 8205) ("zwnj" . 8204))) ;; http://webdesign.about.com/od/localization/l/blhtmlcodes-ascii.htm (defvar web-mode-display-table @@ -760,101 +869,146 @@ Must be used in conjunction with web-mode-enable-block-face." (aset table 10 (vector ?\xB6 ?\n)) ;line feed (aset table 32 (vector ?\xB7)) table) - "Display table used when switching to the internal whitespace mode.") - -(defvar web-mode-engines-closing-blocks - '( - ("php" . (("if" . "") - ("for" . "") - ("foreach" . "") - ("while" . ""))) - ) - "Closing blocks (see web-mode-block-close)") + "Display table used when switching to the whitespace visualization.") + +(defvar web-mode-expanders + '(("a/" . "") + ("b/" . "
|
") + ("c/" . "
") + ("d/" . "
|
") + ("e/" . "|") + ("f/" . "
|
") + ("g/" . "|") + ("h/" . "

|

") + ("i/" . "") + ("j/" . "") + ("l/" . "
  • |
  • ") + ("m/" . "
    |
    ") + ("n/" . "") + ("p/" . "

    |

    ") + ("q/" . "|") + ("s/" . "|") + ("t/" . "|") + ("u/" . "
    • |
    ") + ("x/" . "") + ("2/" . "

    |

    ") + ("3/" . "

    |

    ") + ("?/" . ""))) (defvar web-mode-engines-auto-pairs - '(("angular" . (("{{ " " }}"))) - ("asp" . (("<% " " %>"))) - ("aspx" . (("<% " " %>") - ("<%=" "%>") - ("<%#" "%>") - ("<%$" "%>") - ("<%@" "%>") - ("<%:" "%>") - ("<%-" "- " " --%>"))) - ("blade" . (("{{{" " " " }}}") - ("{{ " " }}") - ("{{-" "- " " --}}"))) - ("ctemplate" . (("{{ " "}}") - ("{{{" "}}}") - ("{~{" "}}") - ("{{~" "{ " "}}}") - ("{{/" "}}") - ("{{#" "}}"))) - ("django" . (("{{ " " }}") - ("{% " " %}") - ("{%-" " " " %}") - ("{# " " #}"))) - ("erb" . (("<% " " %>") - ("<%=" "%>") - ("<%#" "%>") - ("<%-" "%>"))) - ("freemarker" . (("<% " " %>") - ("${ " " }") - ("[% " " %]") - ("[# " " #]") - ("[#-" "- " " --]"))) - ("jsp" . (("<% " " %>") - ("<%-" "- " " %>") - ("<%=" "%>") - ("<%!" "%>") - ("<%@" "%>") - ("${ " " }"))) - ("lsp" . (("<% " " %>") - ("<%%" " " " %>") - ("<%#" " " " %>"))) - ("mako" . (("<% " " %>") - ("<%!" " " " %>") - ("${ " " }"))) - ("mason" . (("<% " " %>"))) - ("mojolicious" . (("<% " " %>") - ("<%=" " " " %>") - ("<%%" " " " %>") - ("<%#" " " "%>"))) - ("php" . (("") - ("") - (""))) - ("underscore" . (("<% " " %>"))) - ("web2py" . (("{{ " " }}") - ("{{=" "}}"))) - (nil . (("")))) - "Engines auto-pairs") + '(("angular" . (("{{ " . " }}"))) + ("asp" . (("<% " . " %>"))) + ("aspx" . (("<% " . " %>") + ("<%=" . "%>") + ("<%#" . "%>") + ("<%$" . "%>") + ("<%@" . "%>") + ("<%:" . "%>") + ("<%-" . "- | --%>"))) + ("blade" . (("{{{" . " | }}}") + ("{{ " . " }}") + ("{!!" . " | !!}") + ("@{{" . " | }}") + ("{{-" . "- | --}}"))) + ("cl-emb" . (("<% " . " %>") + ("<%=" . " | %>") + ("<%#" . " | %>"))) + ("ctemplate" . (("{{ " . "| }}") + ("{{{" . " | }}}") + ("{~{" . " | }}") + ("{{~" . "{ | }}}") + ("{{!" . "-- | --}}") + ("{{/" . "}}") + ("{{#" . "}}"))) + ("django" . (("{{ " . " }}") + ("{% " . " %}") + ("{%-" . " | %}") + ("{# " . " #}"))) + ("elixir" . (("<% " . " %>") + ("<%=" . " | %>") + ("<%%" . " | %>") + ("<%#" . " | %>"))) + ("ejs" . (("<% " . " %>") + ("<%=" . "%>") + ("<%#" . "%>") + ("<%-" . "%>"))) + ("erb" . (("<% " . " %>") + ("<%=" . "%>") + ("<%#" . "%>") + ("<%-" . "%>"))) + ("freemarker" . (("<% " . " %>") + ("${ " . " }") + ("[% " . " %]") + ("[# " . " #]") + ("[#-" . "- | --]"))) + ("jsp" . (("<% " . " %>") + ("<%-" . "- | %>") + ("<%=" . "%>") + ("<%!" . "%>") + ("<%@" . "%>") + ("${ " . " }"))) + ("lsp" . (("<% " . " %>") + ("<%%" . " | %>") + ("<%#" . " | %>"))) + ("mako" . (("<% " . " %>") + ("<%!" . " | %>") + ("${ " . " }"))) + ("mason" . (("<% " . " %>") + ("<& " . " &>"))) + ("mojolicious" . (("<% " . " %>") + ("<%=" . " | %>") + ("<%%" . " | %>") + ("<%#" . " | %>"))) + ("php" . (("") + ("") + (""))) + ("template-toolkit" . (("[% " . " %]") + ("[%-" . " | %]") + ("[%#" . " | %]"))) + ("underscore" . (("<% " . " %>"))) + ("web2py" . (("{{ " . " }}") + ("{{=" . "}}"))) + (nil . ((""))) + )) (defvar web-mode-engines-snippets - '(("erb" . (("if" . ("<% if " . " %>\n\n<% end %>")))) - ("php" . (("if" . ("\n\n")) - ("while" . ("\n\n")) - ("for" . ("\n\n")) - ("foreach" . ("\n\n")) - ("switch" . ("\n\n\n\n\n\n\n")))) - ("django" . (("block" . ("{% block " . " %}\n\n{% endblock %}")) - ("comment" . ("{% comment " . " %}\n\n{% endcomment %}")) - ("cycle" . ("{% cycle " . " as %}\n\n{% endcycle %}")) - ("filter" . ("{% filter " . " %}\n\n{% endfilter %}")) - ("for" . ("{% for " . " in %}\n\n{% endfor %}")) - ("if" . ("{% if " . " %}\n\n{% endif %}")) - ("ifequal" . ("{% ifequal " . " %}\n\n{% endifequal %}")) - ("ifnotequal" . ("{% ifnotequal " . " %}\n\n{% endifnotequal %}")) - ("safe" . ("{% safe " . " %}\n\n{% endsafe %}")) + '(("ejs" . (("for" . "<% for (|) { %>\n\n<% } %>") + ("if" . "<% if (|) { %>\n\n<% } %>") + )) + ("erb" . (("each" . "<% |.each do %>\n\n<% end %>") + ("if" . "<% if | %>\n\n<% end %>") + ("when" . "<% when | %>\n\n<% end %>") + ("unless" . "<% unless | %>\n\n<% end %>") + )) + ("php" . (("if" . "\n\n") + ("while" . "\n\n") + ("for" . "\n\n") + ("foreach" . "\n\n") + ("each" . "\n\n") + ("switch" . "\n\n\n\n\n\n\n") + )) + ("django" . (("block" . "{% block | %}\n\n{% endblock %}") + ("comment" . "{% comment | %}\n\n{% endcomment %}") + ("cycle" . "{% cycle | as %}\n\n{% endcycle %}") + ("filter" . "{% filter | %}\n\n{% endfilter %}") + ("for" . "{% for | in %}\n\n{% endfor %}") + ("if" . "{% if | %}\n\n{% endif %}") + ("ifequal" . "{% ifequal | %}\n\n{% endifequal %}") + ("ifnotequal" . "{% ifnotequal | %}\n\n{% endifnotequal %}") + ("safe" . "{% safe | %}\n\n{% endsafe %}") )) - (nil . (("html5" . ("\n\n\n\n\n\n\n" . "\n\n")) - ("table" . ("\n\n\n\n\n
    " . "
    ")) - ("ul" . ("
      \n
    • " . "
    • \n
    • \n
    ")))) - ) - "Engines snippets") + ("template-toolkit" . (("if" . "[% IF | %]\n\n[% END %]") + )) + (nil . (("html5" . "\n\n\n\n\n\n\n|\n\n") + ("table" . "\n\n\n\n\n
    |
    ") + ("ul" . "
      \n
    • |
    • \n
    • \n
    ") + )) + )) (defvar web-mode-engine-token-regexps (list '("asp" . "//\\|/\\*\\|\"\\|'") + '("ejs" . "//\\|/\\*\\|\"\\|'") '("erb" . "\"\\|'\\|#\\|<<[-]?['\"]?\\([[:alnum:]_]+\\)['\"]?") '("lsp" . "\"\\|#|\\|;") '("mako" . "\"\\|'\\|#") @@ -870,25 +1024,28 @@ Must be used in conjunction with web-mode-enable-block-face." '("angular" . "{{") '("asp" . "<%\\|") - '(1 'web-mode-css-at-rule-face)) - '("\\<\\(all\|braille\\|embossed\\|handheld\\|print\\|projection\\|screen\\|speech\\|tty\\|tv\\|and\\|or\\)\\>" 1 'web-mode-keyword-face) - (cons (concat ":\\(" web-mode-css-pseudo-classes "\\)\\>") - '(1 'web-mode-css-pseudo-class-face)) - '("[[:alnum:]-]+" 0 'web-mode-css-selector-face) - '("\\[.*?\\]\\|(.*?)" 0 nil t t) - '("url(\\(.+?\\))" 1 'web-mode-string-face) + '(0 'web-mode-css-at-rule-face)) + '("\\<\\(all\|braille\\|embossed\\|handheld\\|print\\|projection\\|screen\\|speech\\|tty\\|tv\\|and\\|or\\)\\>" + 1 'web-mode-keyword-face) + '("[^,]+" 0 'web-mode-css-selector-face) + (cons (concat ":\\(" web-mode-css-pseudo-classes "\\)\\(([^)]*)\\)?") + '(0 'web-mode-css-pseudo-class-face t t)) )) (defvar web-mode-declaration-font-lock-keywords (list '("--[[:alnum:]-]+" 0 'web-mode-css-variable-face) '("$[[:alnum:]-]+" 0 'web-mode-css-variable-face) - (cons (concat "@\\(" web-mode-css-at-rules "\\)\\>") '(1 'web-mode-css-at-rule-face)) - '("url(\\([^)]+\\)" 1 'web-mode-string-face) - '("\\([[:alpha:]-]+\\)[ ]?:" 1 'web-mode-css-property-name-face) + (cons (concat "@\\(" web-mode-css-at-rules "\\)\\>") + '(1 'web-mode-css-at-rule-face)) + '("\\([[:alpha:]-]+\\)[ ]?:" 0 'web-mode-css-property-name-face) '("\\([[:alpha:]-]+\\)[ ]?(" 1 'web-mode-css-function-face) '("#[[:alnum:]]\\{1,6\\}" 0 'web-mode-css-color-face t t) '("![ ]?important" 0 'web-mode-css-priority-face t t) - '("\\([[:alnum:]-.]+\\)[ ]+{" 1 'web-mode-css-selector-face) + '("\\([^,]+\\)[ ]+{" 1 'web-mode-css-selector-face) + '("'[^']*'\\|\"[^\"]*\"" 0 'web-mode-string-face t t) )) (defvar web-mode-html-font-lock-keywords @@ -1328,14 +1539,16 @@ Must be used in conjunction with web-mode-enable-block-face." (defvar web-mode-javascript-font-lock-keywords (list + '("@\\([[:alnum:]_]+\\)\\>" 0 'web-mode-keyword-face) (cons (concat "\\<\\(" web-mode-javascript-keywords "\\)\\>") '(0 'web-mode-keyword-face)) (cons (concat "\\<\\(" web-mode-javascript-constants "\\)\\>") '(0 'web-mode-constant-face)) - '("\\<\\(new\\|instanceof\\) \\([[:alnum:]_.]+\\)\\>" 2 'web-mode-type-face) + '("\\<\\(new\\|instanceof\\|class\\|extends\\) \\([[:alnum:]_.]+\\)\\>" 2 'web-mode-type-face) '("\\<\\([[:alnum:]_]+\\):[ ]*function[ ]*(" 1 'web-mode-function-name-face) '("\\<+^]\\([[:alpha:]_]+\\)" 1 'web-mode-block-control-face) + '("{[#:/?@><+^]\\([[:alpha:]_.]+\\)" 1 'web-mode-block-control-face) '(":\\([[:alpha:]]+\\)" 1 'web-mode-keyword-face) - '("\\<\\([[:alpha:]_]+=\\)\\(\"[^\"]*\"\\|[[:alnum:]_]*\\)" + '("\\<\\([[:alnum:]_]+=\\)\\(\"[^\"]*\"\\|[[:alnum:]_]*\\)" (1 'web-mode-block-attr-name-face) (2 'web-mode-block-attr-value-face)) - '("\\\([[:alnum:]_]+\\)" 0 'web-mode-variable-name-face) + '("\\\([[:alnum:]_.]+\\)" 0 'web-mode-variable-name-face) )) (defvar web-mode-template-toolkit-font-lock-keywords @@ -1374,8 +1587,7 @@ Must be used in conjunction with web-mode-enable-block-face." (list (cons (concat "[ ]\\(" web-mode-smarty-keywords "\\)[ ]") '(1 'web-mode-keyword-face)) - (cons (concat (web-mode-engine-delimiter-open "smarty" "{") "/?\\([[:alpha:]_]+\\)") - '(1 'web-mode-block-control-face)) + '("{/?\\([[:alpha:]_]+\\)" 1 'web-mode-block-control-face) '("\\([}{]\\)" 0 'web-mode-block-delimiter-face) '("\\<\\([$]\\)\\([[:alnum:]_]+\\)" (1 nil) (2 'web-mode-variable-name-face)) '("\\<\\(\\sw+\\)[ ]?(" 1 'web-mode-function-call-face) @@ -1408,55 +1620,64 @@ Must be used in conjunction with web-mode-enable-block-face." (defvar web-mode-mako-block-font-lock-keywords (list '("\\<\\(\\sw+\\)[ ]?(" 1 'web-mode-function-call-face) - (cons (concat "\\<\\(" web-mode-python-constants "\\)\\>") '(1 'web-mode-constant-face)) - (cons (concat "\\<\\(" web-mode-python-keywords "\\)\\>") '(1 'web-mode-keyword-face)) - (cons (concat "\\<\\(endfor\\|endif\\|endwhile\\)\\>") '(1 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-python-constants "\\)\\>") + '(1 'web-mode-constant-face)) + (cons (concat "\\<\\(" web-mode-python-keywords "\\)\\>") + '(1 'web-mode-keyword-face)) + (cons (concat "\\<\\(endfor\\|endif\\|endwhile\\)\\>") + '(1 'web-mode-keyword-face)) )) (defvar web-mode-web2py-font-lock-keywords (list '("\\<\\(\\sw+\\)[ ]?(" 1 'web-mode-function-call-face) - (cons (concat "\\<\\(" web-mode-python-constants "\\)\\>") '(1 'web-mode-constant-face)) - (cons (concat "\\<\\(" web-mode-python-keywords "\\)\\>") '(1 'web-mode-keyword-face)) - (cons (concat "\\<\\(block\\|extend\\|super\\|end\\|include\\)\\>") '(1 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-python-constants "\\)\\>") + '(1 'web-mode-constant-face)) + (cons (concat "\\<\\(" web-mode-python-keywords "\\)\\>") + '(1 'web-mode-keyword-face)) + (cons (concat "\\<\\(block\\|extend\\|super\\|end\\|include\\)\\>") + '(1 'web-mode-keyword-face)) )) (defvar web-mode-django-expr-font-lock-keywords (list - '("|[ ]?\\([[:alpha:]_]+\\)\\>" 1 'web-mode-function-call-face) - (cons (concat "\\<\\(" web-mode-django-types "\\)\\>") '(1 'web-mode-type-face)) + '("|[ ]?\\([[:alpha:]_]+\\)\\>" 1 'web-mode-filter-face) + (cons (concat "\\<\\(" web-mode-django-types "\\)\\>") + '(1 'web-mode-type-face)) '("\\<\\([[:alpha:]_]+\\)[ ]?(" 1 'web-mode-function-call-face) '("[[:alnum:]_]+" 0 'web-mode-variable-name-face) )) (defvar web-mode-django-code-font-lock-keywords (list - (cons (concat "\\<\\(" web-mode-django-keywords "\\)\\>") '(1 'web-mode-keyword-face)) - (cons (concat "\\<\\(" web-mode-django-types "\\)\\>") '(1 'web-mode-type-face)) + (cons (concat "{%[ ]*\\(" web-mode-django-control-blocks-regexp "\\)\\>") + '(1 'web-mode-block-control-face)) + '("{%[ ]*\\(end[[:alpha:]]+\\)\\>" 1 'web-mode-block-control-face) ;#504 + (cons (concat "\\<\\(" web-mode-django-keywords "\\)\\>") + '(1 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-django-types "\\)\\>") + '(1 'web-mode-type-face)) '("|[ ]?\\([[:alpha:]_]+\\)\\>" 1 'web-mode-function-call-face) '("\\<\\([[:alpha:]_]+\\)[ ]?(" 1 'web-mode-function-call-face) - '("[[:alnum:]_]+" 0 'web-mode-variable-name-face) + '("[[:alnum:]_.]+" 0 'web-mode-variable-name-face) + '("[[:alnum:]_]+\\([.][[:alnum:]_]+\\)+" 0 'web-mode-variable-name-face t t) )) (defvar web-mode-ctemplate-font-lock-keywords (list - '("{{[#/>][ ]*\\([[:alnum:]_-]+\\)" 1 'web-mode-block-control-face) -;; '(" \\([[:alnum:]_]\\)\\(=\\)\"" (1 'web-mode-variable-name-face)) - '("[[:alnum:]_]" 0 'web-mode-variable-name-face) - '("[ ]+\\([[:alnum:]_]+=\\)" 1 'web-mode-param-name-face t t) - '("[:=]\\([[:alpha:]_]+\\)" 1 'web-mode-function-call-face t t) + '("{[~]?{[#/>]?[ ]*\\([[:alnum:]_-]+\\)" 1 'web-mode-block-control-face) + '("[ \t]+\\([[:alnum:]_]+\\)=\\([[:alnum:]_.]+\\|\"[^\"]+\"\\)" + (1 'web-mode-block-attr-name-face) + (2 'web-mode-block-attr-value-face)) + '("\"[^\"]+\"" 0 'web-mode-block-string-face) )) (defvar web-mode-razor-font-lock-keywords (list '("@\\([[:alnum:]_.]+\\)[ ]*[({]" 1 'web-mode-block-control-face) - (cons (concat "\\<\\(" web-mode-razor-keywords "\\)\\>") '(1 'web-mode-keyword-face)) -;; '("\\([[:alnum:]]+\\):" 1 'web-mode-symbol-face) -;; '("@\\([[:alnum:]_.]+\\)[ ]?(" 1 'web-mode-function-call-face) + (cons (concat "\\<\\(" web-mode-razor-keywords "\\)\\>") + '(1 'web-mode-keyword-face)) '("@\\([[:alnum:]_.]+\\)" 1 'web-mode-variable-name-face) -;; '("<\\([[:alnum:]_]+\\)>" 1 'web-mode-type-face) -;; '("\\<\\([[:alnum:].]+\\)[ ]+[{[:alpha:]]+" 1 'web-mode-type-face) -;; '("[[:alnum:]_]+" 0 'web-mode-variable-name-face) )) (defvar web-mode-closure-font-lock-keywords @@ -1475,7 +1696,7 @@ Must be used in conjunction with web-mode-enable-block-face." (defvar web-mode-go-font-lock-keywords (list - '("{{\\([[:alpha:]]+\\)" 1 'web-mode-block-control-face) + '("{{[ ]*\\([[:alpha:]]+\\)" 1 'web-mode-block-control-face) (cons (concat "\\<\\(" web-mode-go-keywords "\\)\\>") '(1 'web-mode-keyword-face)) (cons (concat "\\<\\(" web-mode-go-functions "\\)\\>") @@ -1511,12 +1732,16 @@ Must be used in conjunction with web-mode-enable-block-face." '("\\<\\([[:alpha:]-]+=\\)\\(\"[^\"]*\"\\)" (1 'web-mode-block-attr-name-face t t) (2 'web-mode-block-attr-value-face t t)) + '("\\<\\([[:alpha:]-]+=\\)\\('[^']*\'\\)" + (1 'web-mode-block-attr-name-face t t) + (2 'web-mode-block-attr-value-face t t)) )) (defvar web-mode-jsp-font-lock-keywords (list '("\\(throws\\|new\\|extends\\)[ ]+\\([[:alnum:].]+\\)" 2 'web-mode-type-face) - (cons (concat "\\<\\(" web-mode-jsp-keywords "\\)\\>") '(0 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-jsp-keywords "\\)\\>") + '(0 'web-mode-keyword-face)) '("\\<\\([[:alnum:]._]+\\)[ ]?(" 1 'web-mode-function-call-face) '("@\\(\\sw*\\)" 1 'web-mode-variable-name-face) '("\\<\\([[:alnum:].]+\\)[ ]+[{[:alpha:]]+" 1 'web-mode-type-face) @@ -1543,7 +1768,8 @@ Must be used in conjunction with web-mode-enable-block-face." (defvar web-mode-aspx-font-lock-keywords (list - (cons (concat "\\<\\(" web-mode-aspx-keywords "\\)\\>") '(0 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-aspx-keywords "\\)\\>") + '(0 'web-mode-keyword-face)) '("\\<\\([[:alnum:].]+\\)[ ]+[[:alpha:]]+" 1 'web-mode-type-face) )) @@ -1592,8 +1818,10 @@ Must be used in conjunction with web-mode-enable-block-face." (list '("[^:]\\(:[[:alnum:]_]+\\)" 1 'web-mode-symbol-face) '("\\([[:alnum:]_]+:\\)[ ]+" 1 'web-mode-symbol-face) - (cons (concat "\\<\\(" web-mode-erb-builtins "\\)\\>") '(0 'web-mode-builtin-face)) - (cons (concat "\\<\\(" web-mode-erb-keywords "\\)\\>") '(0 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-erb-builtins "\\)\\>") + '(0 'web-mode-builtin-face)) + (cons (concat "\\<\\(" web-mode-erb-keywords "\\)\\>") + '(0 'web-mode-keyword-face)) '("\\<\\(self\\|true\\|false\\|nil\\)\\>" 0 'web-mode-variable-name-face) '("[@$]@?\\([[:alnum:]_]+\\)" 0 'web-mode-variable-name-face) '("class[ ]+\\([[:alnum:]_]+\\)" 1 'web-mode-type-face) @@ -1602,17 +1830,31 @@ Must be used in conjunction with web-mode-enable-block-face." '("/[^/]+/" 0 'web-mode-string-face) )) +(defvar web-mode-ejs-font-lock-keywords + web-mode-javascript-font-lock-keywords) + (defvar web-mode-python-font-lock-keywords (list - (cons (concat "\\<\\(" web-mode-python-keywords "\\)\\>") '(0 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-python-keywords "\\)\\>") + '(0 'web-mode-keyword-face)) + )) + +(defvar web-mode-erlang-font-lock-keywords + (list + (cons (concat "\\<\\(" web-mode-erlang-keywords "\\)\\>") + '(0 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-erlang-constants "\\)\\>") + '(0 'web-mode-constant-face)) + '("@\\([[:alnum:]_]+\\)" 0 'web-mode-variable-name-face) + '("[ ]\\(:[[:alnum:]-_]+\\)" 1 'web-mode-symbol-face) )) -(defvar web-mode-mason-font-lock-keywords +(defvar web-mode-mason-code-font-lock-keywords (list (cons (concat "\\<\\(" web-mode-mason-keywords "\\)\\>") '(0 'web-mode-keyword-face)) '("sub[ ]+\\([[:alnum:]_]+\\)" 1 'web-mode-function-name-face) - '(" | \\([hun]+\\) " 1 'web-mode-function-name-face) +;; '(" | \\([hun]+\\) " 1 'web-mode-function-name-face) '("\\<\\([[:alnum:]_]+\\)[ ]?::" 1 'web-mode-type-face) '("\\([@]\\)\\([[:alnum:]#_]*\\)" (1 nil) (2 'web-mode-variable-name-face)) '("\\<\\([$%]\\)\\([[:alnum:]@#_]*\\)" (1 nil) (2 'web-mode-variable-name-face)) @@ -1620,28 +1862,55 @@ Must be used in conjunction with web-mode-enable-block-face." '("\\<\\(\\sw+\\)[ ]?(" 1 'web-mode-function-call-face) '("[[:alnum:]_][ ]?::[ ]?\\([[:alnum:]_]+\\)" 1 'web-mode-variable-name-face) '("->[ ]?\\([[:alnum:]_]+\\)" 1 'web-mode-variable-name-face) - '("\\(method\\|def\\)" 1 'web-mode-block-control-face) '("\\(?:method\\|def\\) \\([[:alnum:]._]+\\)" 1 'web-mode-function-name-face) + '("|[ ]*\\([[:alnum:],]+\\)[ ]*%>" 1 'web-mode-filter-face) + )) + +(defvar web-mode-mason-block-font-lock-keywords + (list + '("<[/]?%\\([[:alpha:]]+\\)" 1 'web-mode-block-control-face) + '("[[:alpha:]]" 0 'web-mode-block-attr-value-face) )) (defvar web-mode-mojolicious-font-lock-keywords (list - (cons (concat "\\<\\(" web-mode-perl-keywords "\\)\\>") '(0 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-perl-keywords "\\)\\>") + '(0 'web-mode-keyword-face)) + '("\\<\\(begin\\|end\\)\\>" 1 'web-mode-constant-face) '("\\<\\([$]\\)\\([[:alnum:]_]*\\)" (1 nil) (2 'web-mode-variable-name-face)) )) (defvar web-mode-lsp-font-lock-keywords (list - (cons (concat "\\<\\(" web-mode-lsp-keywords "\\)\\>") '(0 'web-mode-keyword-face)) - (cons (concat "\\<\\(" web-mode-lsp-constants "\\)\\>") '(1 'web-mode-constant-face)) + (cons (concat "\\<\\(" web-mode-lsp-keywords "\\)\\>") + '(0 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-lsp-constants "\\)\\>") + '(1 'web-mode-constant-face)) '("[ ]\\(:[[:alnum:]-_]+\\)" 1 'web-mode-symbol-face) + '("(defun \\([[:alnum:]-:]+\\)" 1 'web-mode-function-name-face) + '("(defvar \\([[:alnum:]-:]+\\)" 1 'web-mode-variable-name-face) + )) + +(defvar web-mode-cl-emb-font-lock-keywords + (list + (cons (concat "\\<\\(" web-mode-cl-emb-keywords "\\)\\>") + '(0 'web-mode-keyword-face)) + (cons (concat "\\<\\(" web-mode-cl-emb-constants "\\)\\>") + '(0 'web-mode-constant-face)) + '("\\(@\\)" 1 'web-mode-function-call-face) + (list (concat "\\(@" web-mode-cl-emb-keywords "\\)[ ]+\\([[:alnum:]_]+\\)") + '(1 'web-mode-keyword-face) + '(2 'web-mode-variable-name-face)) )) (defvar web-mode-php-font-lock-keywords (list - (cons (concat "\\<\\(" web-mode-php-keywords "\\)\\>") '(0 'web-mode-keyword-face)) - (cons (concat "(\\<\\(" web-mode-php-types "\\)\\>") '(1 'web-mode-type-face)) - (cons (concat "\\<\\(" web-mode-php-constants "\\)\\>") '(0 'web-mode-constant-face)) + (cons (concat "\\<\\(" web-mode-php-keywords "\\)\\>") + '(0 'web-mode-keyword-face)) + (cons (concat "(\\<\\(" web-mode-php-types "\\)\\>") + '(1 'web-mode-type-face)) + (cons (concat "\\<\\(" web-mode-php-constants "\\)\\>") + '(0 'web-mode-constant-face)) '("function[ ]+\\([[:alnum:]_]+\\)" 1 'web-mode-function-name-face) '("\\<\\(\\sw+\\)[ ]?(" 1 'web-mode-function-call-face) '("[[:alnum:]_][ ]?::[ ]?\\([[:alnum:]_]+\\)" 1 'web-mode-constant-face) @@ -1666,9 +1935,12 @@ Must be used in conjunction with web-mode-enable-block-face." '(("angular" . web-mode-angular-font-lock-keywords) ;; ("asp" . web-mode-asp-font-lock-keywords) ("blade" . web-mode-blade-font-lock-keywords) + ("cl-emb" . web-mode-cl-emb-font-lock-keywords) ("closure" . web-mode-closure-font-lock-keywords) ("ctemplate" . web-mode-ctemplate-font-lock-keywords) ("dust" . web-mode-dust-font-lock-keywords) + ("elixir" . web-mode-erlang-font-lock-keywords) + ("ejs" . web-mode-ejs-font-lock-keywords) ("erb" . web-mode-erb-font-lock-keywords) ("go" . web-mode-go-font-lock-keywords) ("lsp" . web-mode-lsp-font-lock-keywords) @@ -1721,7 +1993,7 @@ the environment as needed for ac-sources, right before they're used.") (define-key map [menu-bar wm dom dom-xpa] '(menu-item "XPath" web-mode-dom-xpath)) (define-key map [menu-bar wm dom dom-tra] '(menu-item "Traverse" web-mode-dom-traverse)) (define-key map [menu-bar wm dom dom-err] '(menu-item "Show error(s)" web-mode-dom-errors-show)) - (define-key map [menu-bar wm dom dom-ent] '(menu-item "Replace HTML entities" web-mode-dom-entities-replace)) + (define-key map [menu-bar wm dom dom-ent] '(menu-item "Replace html entities" web-mode-dom-entities-replace)) (define-key map [menu-bar wm dom dom-quo] '(menu-item "Replace dumb quotes" web-mode-dom-quotes-replace)) (define-key map [menu-bar wm dom dom-apo] '(menu-item "Replace apostrophes" web-mode-dom-apostrophes-replace)) (define-key map [menu-bar wm dom dom-nor] '(menu-item "Normalise" web-mode-dom-normalize)) @@ -1734,17 +2006,19 @@ the environment as needed for ac-sources, right before they're used.") (define-key map [menu-bar wm blk blk-clo] '(menu-item "Close" web-mode-block-close)) (define-key map [menu-bar wm blk blk-beg] '(menu-item "Beginning" web-mode-block-beginning)) + (define-key map [menu-bar wm attr attr-ins] '(menu-item "Insert" web-mode-attribute-insert)) (define-key map [menu-bar wm attr attr-end] '(menu-item "End" web-mode-attribute-end)) (define-key map [menu-bar wm attr attr-beg] '(menu-item "Beginning" web-mode-attribute-beginning)) (define-key map [menu-bar wm attr attr-sel] '(menu-item "Select" web-mode-attribute-select)) + (define-key map [menu-bar wm attr attr-kil] '(menu-item "Kill" web-mode-attribute-kill)) (define-key map [menu-bar wm attr attr-nex] '(menu-item "Next" web-mode-attribute-next)) - (define-key map [menu-bar wm attr attr-tra] '(menu-item "Next" web-mode-attribute-transpose)) + (define-key map [menu-bar wm attr attr-pre] '(menu-item "Previous" web-mode-attribute-previous)) + (define-key map [menu-bar wm attr attr-tra] '(menu-item "Transpose" web-mode-attribute-transpose)) (define-key map [menu-bar wm tag tag-beg] '(menu-item "Sort Attributes" web-mode-tag-attributes-sort)) (define-key map [menu-bar wm tag tag-sel] '(menu-item "Select" web-mode-tag-select)) (define-key map [menu-bar wm tag tag-pre] '(menu-item "Previous" web-mode-tag-previous)) (define-key map [menu-bar wm tag tag-nex] '(menu-item "Next" web-mode-tag-next)) - (define-key map [menu-bar wm tag tag-mat] '(menu-item "Match" web-mode-tag-match)) (define-key map [menu-bar wm tag tag-end] '(menu-item "End" web-mode-tag-end)) (define-key map [menu-bar wm tag tag-beg] '(menu-item "Beginning" web-mode-tag-beginning)) @@ -1761,6 +2035,7 @@ the environment as needed for ac-sources, right before they're used.") (define-key map [menu-bar wm elt elt-end] '(menu-item "End" web-mode-element-end)) (define-key map [menu-bar wm elt elt-inn] '(menu-item "Content (select)" web-mode-element-content-select)) (define-key map [menu-bar wm elt elt-clo] '(menu-item "Close" web-mode-element-close)) + (define-key map [menu-bar wm elt elt-ins] '(menu-item "Insert" web-mode-element-insert)) (define-key map [menu-bar wm elt elt-dup] '(menu-item "Clone" web-mode-element-clone)) (define-key map [menu-bar wm elt elt-cfo] '(menu-item "Children fold" web-mode-element-children-fold-or-unfold)) (define-key map [menu-bar wm elt elt-chi] '(menu-item "Child" web-mode-element-child)) @@ -1775,16 +2050,19 @@ the environment as needed for ac-sources, right before they're used.") (define-key map [menu-bar wm sni] '(menu-item "Insert snippet" web-mode-snippet-insert)) ;;-------------------------------------------------------------------------- - ;; "C-c letter" are reserved for users + ;; "C-c " are reserved for users (define-key map (kbd "C-c C-a b") 'web-mode-attribute-beginning) (define-key map (kbd "C-c C-a e") 'web-mode-attribute-end) + (define-key map (kbd "C-c C-a i") 'web-mode-attribute-insert) + (define-key map (kbd "C-c C-a n") 'web-mode-attribute-next) (define-key map (kbd "C-c C-a s") 'web-mode-attribute-select) + (define-key map (kbd "C-c C-a k") 'web-mode-attribute-kill) + (define-key map (kbd "C-c C-a p") 'web-mode-attribute-previous) (define-key map (kbd "C-c C-a t") 'web-mode-attribute-transpose) - (define-key map (kbd "C-c C-a n") 'web-mode-attribute-next) - (define-key map (kbd "C-c C-b c") 'web-mode-block-close) (define-key map (kbd "C-c C-b b") 'web-mode-block-beginning) + (define-key map (kbd "C-c C-b c") 'web-mode-block-close) (define-key map (kbd "C-c C-b e") 'web-mode-block-end) (define-key map (kbd "C-c C-b k") 'web-mode-block-kill) (define-key map (kbd "C-c C-b n") 'web-mode-block-next) @@ -1792,19 +2070,21 @@ the environment as needed for ac-sources, right before they're used.") (define-key map (kbd "C-c C-b s") 'web-mode-block-select) (define-key map (kbd "C-c C-d a") 'web-mode-dom-apostrophes-replace) - (define-key map (kbd "C-c C-d n") 'web-mode-dom-normalize) (define-key map (kbd "C-c C-d d") 'web-mode-dom-errors-show) (define-key map (kbd "C-c C-d e") 'web-mode-dom-entities-replace) + (define-key map (kbd "C-c C-d n") 'web-mode-dom-normalize) (define-key map (kbd "C-c C-d q") 'web-mode-dom-quotes-replace) (define-key map (kbd "C-c C-d t") 'web-mode-dom-traverse) (define-key map (kbd "C-c C-d x") 'web-mode-dom-xpath) + (define-key map (kbd "C-c C-e /") 'web-mode-element-close) + (define-key map (kbd "C-c C-e a") 'web-mode-element-content-select) (define-key map (kbd "C-c C-e b") 'web-mode-element-beginning) (define-key map (kbd "C-c C-e c") 'web-mode-element-clone) (define-key map (kbd "C-c C-e d") 'web-mode-element-child) (define-key map (kbd "C-c C-e e") 'web-mode-element-end) (define-key map (kbd "C-c C-e f") 'web-mode-element-children-fold-or-unfold) - (define-key map (kbd "C-c C-e i") 'web-mode-element-content-select) + (define-key map (kbd "C-c C-e i") 'web-mode-element-insert) (define-key map (kbd "C-c C-e k") 'web-mode-element-kill) (define-key map (kbd "C-c C-e m") 'web-mode-element-mute-blanks) (define-key map (kbd "C-c C-e n") 'web-mode-element-next) @@ -1838,6 +2118,7 @@ the environment as needed for ac-sources, right before they're used.") (define-key map (kbd "C-c C-j") 'web-mode-jshint) (define-key map (kbd "C-c C-m") 'web-mode-mark-and-expand) (define-key map (kbd "C-c C-n") 'web-mode-navigate) + (define-key map (kbd "C-c C-r") 'web-mode-reload) (define-key map (kbd "C-c C-s") 'web-mode-snippet-insert) ;;C-c C-t : tag (define-key map (kbd "C-c C-w") 'web-mode-whitespaces-show) @@ -1852,10 +2133,10 @@ the environment as needed for ac-sources, right before they're used.") (defalias 'web-mode-prog-mode (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode)) + ;; compatibility with emacs < 23.3 (if (fboundp 'with-silent-modifications) (defalias 'web-mode-with-silent-modifications 'with-silent-modifications) (defmacro web-mode-with-silent-modifications (&rest body) - "For compatibility with Emacs pre 23.3" `(let ((old-modified-p (buffer-modified-p)) (inhibit-modification-hooks t) (buffer-undo-list t)) @@ -1863,12 +2144,26 @@ the environment as needed for ac-sources, right before they're used.") ,@body (set-buffer-modified-p old-modified-p))))) + ;; compatibility with emacs < 24.3 (defun web-mode-buffer-narrowed-p () - "For compatibility with Emacs pre 24.3." (if (fboundp 'buffer-narrowed-p) (buffer-narrowed-p) (/= (- (point-max) (point-min)) (buffer-size)))) + ;; compatibility with emacs 22 + (defun web-mode-string-match-p (regexp string &optional start) + "Same as `string-match' except it does not change the match data." + (let ((inhibit-changing-match-data t)) + (string-match regexp string start))) + + (unless (fboundp 'string-match-p) + (fset 'string-match-p (symbol-function 'web-mode-string-match-p))) + + ;; compatibility with emacs < 24.3 + (unless (fboundp 'setq-local) + (defmacro setq-local (var val) + `(set (make-local-variable ',var) ,val))) + ) ;eval-and-compile ;;---- MAJOR MODE -------------------------------------------------------------- @@ -1877,67 +2172,84 @@ the environment as needed for ac-sources, right before they're used.") (define-derived-mode web-mode web-mode-prog-mode "Web" "Major mode for editing web templates." + (make-local-variable 'web-mode-attr-indent-offset) (make-local-variable 'web-mode-auto-pairs) (make-local-variable 'web-mode-block-regexp) - (make-local-variable 'web-mode-engine-open-delimiter-regexps) (make-local-variable 'web-mode-change-beg) (make-local-variable 'web-mode-change-end) + (make-local-variable 'web-mode-code-indent-offset) (make-local-variable 'web-mode-column-overlays) (make-local-variable 'web-mode-comment-style) (make-local-variable 'web-mode-content-type) + (make-local-variable 'web-mode-css-indent-offset) + (make-local-variable 'web-mode-inhibit-fontification) (make-local-variable 'web-mode-display-table) (make-local-variable 'web-mode-enable-block-face) (make-local-variable 'web-mode-enable-inlays) (make-local-variable 'web-mode-enable-part-face) + (make-local-variable 'web-mode-enable-sexp-functions) (make-local-variable 'web-mode-end-tag-overlay) (make-local-variable 'web-mode-engine) (make-local-variable 'web-mode-engine-attr-regexp) (make-local-variable 'web-mode-engine-file-regexps) + (make-local-variable 'web-mode-engine-open-delimiter-regexps) (make-local-variable 'web-mode-engine-token-regexp) (make-local-variable 'web-mode-expand-initial-pos) + (make-local-variable 'web-mode-expand-initial-scroll) (make-local-variable 'web-mode-expand-previous-state) - (make-local-variable 'web-mode-hl-line-mode-flag) (make-local-variable 'web-mode-indent-style) (make-local-variable 'web-mode-is-scratch) (make-local-variable 'web-mode-jshint-errors) + (make-local-variable 'web-mode-last-enabled-feature) + (make-local-variable 'web-mode-markup-indent-offset) + (make-local-variable 'web-mode-sql-indent-offset) (make-local-variable 'web-mode-start-tag-overlay) + (make-local-variable 'web-mode-minor-engine) (make-local-variable 'web-mode-time) + (make-local-variable 'web-mode-django-control-blocks) + (make-local-variable 'web-mode-django-control-blocks-regexp) + + (make-local-variable 'comment-end) + (make-local-variable 'comment-start) (make-local-variable 'fill-paragraph-function) (make-local-variable 'font-lock-beg) (make-local-variable 'font-lock-defaults) + (make-local-variable 'font-lock-extend-region-functions) (make-local-variable 'font-lock-end) (make-local-variable 'font-lock-support-mode) + (make-local-variable 'font-lock-unfontify-region-function) (make-local-variable 'imenu-case-fold-search) (make-local-variable 'imenu-create-index-function) (make-local-variable 'imenu-generic-expression) (make-local-variable 'indent-line-function) (make-local-variable 'parse-sexp-lookup-properties) - (make-local-variable 'text-property-default-nonsticky) +;; (make-local-variable 'syntax-propertize-function) (make-local-variable 'yank-excluded-properties) - ;; required for block-code-beg|end - (add-to-list 'text-property-default-nonsticky '(block-token . t)) -;; (add-to-list 'text-property-default-nonsticky '((block-token . t) -;; (tag-end . t))) + ;; NOTE: required for block-code-beg|end + ;;(make-local-variable 'text-property-default-nonsticky) + ;;(add-to-list 'text-property-default-nonsticky '(block-token . t)) + ;;(message "%S" text-property-default-nonsticky) - (setq fill-paragraph-function 'web-mode-fill-paragraph + (setq comment-end "-->" + comment-start "") + (search-backward " -->")) + ) + ) (defun web-mode-comment (pos) - "Comment line(s) at point." -;; (interactive) - (save-excursion - (let (ctx language sel beg end tmp block-side single-line-block) + (let (ctx language sel beg end tmp block-side single-line-block pos-after content) + + (setq pos-after pos) (setq block-side (get-text-property pos 'block-side)) (setq single-line-block (web-mode-is-single-line-block pos)) (cond - ((and block-side - (intern-soft (concat "web-mode-comment-" web-mode-engine "-block")) - single-line-block) - (funcall (intern (concat "web-mode-comment-" web-mode-engine "-block")) pos)) + ((and single-line-block + block-side + (intern-soft (concat "web-mode-comment-" web-mode-engine "-block"))) + (funcall (intern (concat "web-mode-comment-" web-mode-engine "-block")) pos) + ) (t (setq ctx (web-mode-point-context @@ -7752,110 +8048,155 @@ Pos should be in a tag." (cond (mark-active ) - ((and (string= language "html") + ((and (member language '("html" "xml")) (get-text-property (progn (back-to-indentation) (point)) 'tag-beg)) (web-mode-element-select)) (t (end-of-line) (set-mark (line-beginning-position))) ) ;cond + (setq beg (region-beginning) end (region-end)) + ;;(message "%S %S" beg end) + (when (> (point) (mark)) (exchange-point-and-mark)) - (if (eq (char-before end) ?\n) + (if (and (eq (char-before end) ?\n) + (not (eq (char-after end) ?\n))) (setq end (1- end))) - (setq sel (web-mode-trim (buffer-substring-no-properties beg end))) - (delete-region beg end) - (deactivate-mark) +;; (setq sel (web-mode-trim (buffer-substring-no-properties beg end))) + (setq sel (buffer-substring-no-properties beg end)) - (cond + ;;(web-mode-with-silent-modifications + ;; (delete-region beg end)) + ;;(deactivate-mark) - ((string= language "html") + (cond + ((member language '("html" "xml")) (cond ((and (= web-mode-comment-style 2) (string= web-mode-engine "django")) - (web-mode-insert-and-indent (concat "{# " sel " #}")) - ) - ((and (= web-mode-comment-style 2) (string= web-mode-engine "erb")) - (web-mode-insert-and-indent (concat "<%# " sel " %>")) - ) + (setq content (concat "{# " sel " #}"))) + ((and (= web-mode-comment-style 2) (member web-mode-engine '("ejs" "erb"))) + (setq content (concat "<%# " sel " %>"))) ((and (= web-mode-comment-style 2) (string= web-mode-engine "aspx")) - (web-mode-insert-and-indent (concat "<%-- " sel " --%>")) - ) + (setq content (concat "<%-- " sel " --%>"))) ((and (= web-mode-comment-style 2) (string= web-mode-engine "smarty")) - (web-mode-insert-and-indent (concat - (web-mode-engine-delimiter-open web-mode-engine "{") - "* " - sel - " *" - (web-mode-engine-delimiter-close web-mode-engine "}"))) - ) + (setq content (concat "{* " sel " *}"))) ((and (= web-mode-comment-style 2) (string= web-mode-engine "blade")) - (web-mode-insert-and-indent (concat "{{-- " sel " --}}")) - ) + (setq content (concat "{{-- " sel " --}}"))) ((and (= web-mode-comment-style 2) (string= web-mode-engine "razor")) - (web-mode-insert-and-indent (concat "@* " sel " *@")) - ) + (setq content (concat "@* " sel " *@"))) (t - (web-mode-insert-and-indent (concat "")) - ) - ) - + (setq content (concat "")) + (when (< (length sel) 1) + (search-backward " -->") + (setq pos-after nil)) + )) ) ;case html - ((member language '("php" "javascript" "css")) - (web-mode-insert-and-indent (concat "/* " sel " */"))) + ((member language '("php" "javascript" "java" "jsx")) + (let (alt) + (setq alt (cdr (assoc language web-mode-comment-formats))) + (if (and alt (not (string= alt "/*"))) + (setq content (replace-regexp-in-string "^[ ]*" alt sel)) + ;;(message "before") + (setq content (concat "/* " sel " */")) + ;;(message "after") + ) ;if + ) + ) ((member language '("erb")) - (web-mode-insert-and-indent (replace-regexp-in-string "^" "#" sel))) + (setq content (replace-regexp-in-string "^[ ]*" "#" sel))) ((member language '("asp")) - (web-mode-insert-and-indent (replace-regexp-in-string "^" "''" sel))) + (setq content (replace-regexp-in-string "^[ ]*" "''" sel))) (t - (web-mode-insert-and-indent (concat "/* " sel " */"))) + (setq content (concat "/* " sel " */"))) ) ;cond ) ;t ) ;cond - ) - ) ;save-excursion -;; (message "%S" (point)) -;; (goto-char pos) - ) + ;;(web-mode-with-silent-modifications + (delete-region beg end) + (deactivate-mark) + ;;) + ;;(web-mode-insert-and-indent content) + (let (beg end) + (setq beg (point-at-bol)) + (insert content) + (setq end (point-at-eol)) + (indent-region beg end) + ) + + ;;(when content (web-mode-insert-and-indent content)) + + (when pos-after (goto-char pos-after)) + + ;; (message "END") -(defun web-mode-uncomment (&optional pos) - "Uncomment line(s) at point." + )) + +(defun web-mode-comment-boundaries (&optional pos) (interactive) (unless pos (setq pos (point))) - (let ((beg pos) (end pos) (sub2 "") comment prop) - (cond - ((and (get-text-property pos 'block-side) - (intern-soft (concat "web-mode-uncomment-" web-mode-engine "-block"))) - (funcall (intern (concat "web-mode-uncomment-" web-mode-engine "-block")) pos) - ) - (t + (let ((beg pos) (end pos) prop) + (save-excursion + (goto-char pos) (setq prop (cond ((eq (get-text-property pos 'block-token) 'comment) 'block-token) ((eq (get-text-property pos 'tag-type) 'comment) 'tag-type) ((eq (get-text-property pos 'part-token) 'comment) 'part-token) + (t nil) )) - (if (and (not (bobp)) - (eq (get-text-property pos prop) (get-text-property (1- pos) prop))) - (setq beg (or (previous-single-property-change pos prop) - (point-min)))) - (if (and (not (eobp)) - (eq (get-text-property pos prop) (get-text-property (1+ pos) prop))) - (setq end (or (next-single-property-change pos prop) - (point-max)))) - (when (> (- end beg) 4) + (if (null prop) + (setq beg nil + end nil) + (when (and (not (bobp)) + (eq (get-text-property pos prop) (get-text-property (1- pos) prop))) + (setq beg (or (previous-single-property-change pos prop) (point-min)))) + (when (and (not (eobp)) + (eq (get-text-property pos prop) (get-text-property (1+ pos) prop))) + (setq end (or (next-single-property-change pos prop) (point-max))))) + (when (and beg (string= (buffer-substring-no-properties beg (+ beg 2)) "//")) + (goto-char end) + (while (and (looking-at-p "\n[ ]*//") + (not (eobp))) + (search-forward "//") + (backward-char 2) + ;;(message "%S" (point)) + (setq end (next-single-property-change (point) prop)) + (goto-char end) + ;;(message "%S" (point)) + ) ;while + ) ;when + (when end (setq end (1- end))) + ) ; save-excursion + ;;(message "beg=%S end=%S" beg end) + (if (and beg end) (cons beg end) nil) + )) + +(defun web-mode-uncomment (pos) + (let ((beg pos) (end pos) (sub2 "") comment boundaries) + (save-excursion + (cond + ((and (get-text-property pos 'block-side) + (intern-soft (concat "web-mode-uncomment-" web-mode-engine "-block"))) + (funcall (intern (concat "web-mode-uncomment-" web-mode-engine "-block")) pos)) + ((and (setq boundaries (web-mode-comment-boundaries pos)) + (setq beg (car boundaries)) + (setq end (1+ (cdr boundaries))) + (> (- end beg) 4)) + ;;(message "beg(%S) end(%S)" beg end) (setq comment (buffer-substring-no-properties beg end)) (setq sub2 (substring comment 0 2)) (cond @@ -7866,143 +8207,123 @@ Pos should be in a tag." ((string= sub2 "/*") (setq comment (replace-regexp-in-string "\\(^/\\*[ ]?\\|[ ]?\\*/$\\)" "" comment))) ((string= sub2 "//") - (setq comment (replace-regexp-in-string "\\(^//\\)" "" comment))) - ) + ;;(setq comment (replace-regexp-in-string "\\(^//\\)" "" comment)) + (setq comment (replace-regexp-in-string "\\(//\\)" "" comment))) + ) ;cond (delete-region beg end) (web-mode-insert-and-indent comment) (goto-char beg) - ) ;when - ) ;t - ) ;cond - (indent-according-to-mode) - ;;(indent-for-tab-command) - )) + ) + ) ;cond + (indent-according-to-mode)))) + +(defun web-mode-comment-ejs-block (pos) + (let (beg end) + (setq beg (web-mode-block-beginning-position pos) + end (web-mode-block-end-position pos)) + (web-mode-insert-text-at-pos "//" (+ beg 2)))) (defun web-mode-comment-erb-block (pos) - "Turn an erb block into a comment block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) -;; (message "%S %S" beg end) - (web-mode-insert-text-at-pos "#" (+ beg 2)) - )) + (web-mode-insert-text-at-pos "#" (+ beg 2)))) (defun web-mode-comment-django-block (pos) - "Turn a django block into a comment block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) (web-mode-insert-text-at-pos "#" end) - (web-mode-insert-text-at-pos "#" (1+ beg)) - )) + (web-mode-insert-text-at-pos "#" (1+ beg)))) (defun web-mode-comment-dust-block (pos) - "Turn a dust block into a comment block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) (web-mode-insert-text-at-pos "!" end) - (web-mode-insert-text-at-pos "!" (1+ beg)) - )) + (web-mode-insert-text-at-pos "!" (1+ beg)))) (defun web-mode-comment-aspx-block (pos) - "Turn a aspx block into a comment block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) (web-mode-insert-text-at-pos "#" end) - (web-mode-insert-text-at-pos "#" (1+ beg)) - )) + (web-mode-insert-text-at-pos "#" (1+ beg)))) (defun web-mode-comment-jsp-block (pos) - "Turn a jsp block into a comment block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) - (web-mode-insert-text-at-pos "--" (+ beg 2)) - )) + (web-mode-insert-text-at-pos "--" (+ beg 2)))) (defun web-mode-comment-go-block (pos) - "Turn a go block into a comment block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) - (web-mode-insert-text-at-pos "/" (+ beg 2)) - )) + (web-mode-insert-text-at-pos "/" (+ beg 2)))) (defun web-mode-comment-php-block (pos) - "Turn a php block into a comment block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) (web-mode-insert-text-at-pos "*/" (- end 1)) - (web-mode-insert-text-at-pos "/*" (+ beg (if (web-mode-looking-at "<\\?php" beg) 5 3))) - )) + (web-mode-insert-text-at-pos "/*" (+ beg (if (web-mode-looking-at "<\\?php" beg) 5 3))))) + +(defun web-mode-uncomment-ejs-block (pos) + (let (beg end) + (setq beg (web-mode-block-beginning-position pos) + end (web-mode-block-end-position pos)) + (web-mode-remove-text-at-pos 1 (+ beg 2)))) (defun web-mode-uncomment-erb-block (pos) - "Uncomment an erb block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) - (web-mode-remove-text-at-pos 1 (+ beg 2)) - )) + (web-mode-remove-text-at-pos 1 (+ beg 2)))) (defun web-mode-uncomment-django-block (pos) - "Uncomment a django block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) (web-mode-remove-text-at-pos 2 (1- end)) - (web-mode-remove-text-at-pos 2 beg) - )) + (web-mode-remove-text-at-pos 2 beg))) (defun web-mode-uncomment-dust-block (pos) - "Uncomment a dust block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) (web-mode-remove-text-at-pos 1 (1- end)) - (web-mode-remove-text-at-pos 1 (1+ beg)) - )) + (web-mode-remove-text-at-pos 1 (1+ beg)))) (defun web-mode-uncomment-aspx-block (pos) - "Uncomment a aspx block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) (web-mode-remove-text-at-pos 1 (1- end)) - (web-mode-remove-text-at-pos 1 (1+ beg)) - )) + (web-mode-remove-text-at-pos 1 (1+ beg)))) (defun web-mode-uncomment-jsp-block (pos) - "Uncomment a jsp block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) - (web-mode-remove-text-at-pos 2 (+ beg 2)) - )) + (web-mode-remove-text-at-pos 2 (+ beg 2)))) (defun web-mode-uncomment-go-block (pos) - "Uncomment a go block." (let (beg end) (setq beg (web-mode-block-beginning-position pos) end (web-mode-block-end-position pos)) - (web-mode-remove-text-at-pos 1 (+ beg 2)) - )) + (web-mode-remove-text-at-pos 1 (+ beg 2)))) (defun web-mode-snippet-names () - "Return the snippet names." - (interactive) - (let (codes snippet) + (let (codes) (dolist (snippet web-mode-snippets) (add-to-list 'codes (car snippet) t)) codes)) (defun web-mode-snippet-insert (code) - "Insert snippet." + "Insert a snippet." (interactive - (list (completing-read - "Snippet: " (web-mode-snippet-names)))) + (list (completing-read "Snippet: " (web-mode-snippet-names)))) (let (beg (continue t) (counter 0) @@ -8012,9 +8333,8 @@ Pos should be in a tag." (l (length web-mode-snippets)) pos) (when mark-active - (setq sel (web-mode-trim - (buffer-substring-no-properties - (region-beginning) (region-end)))) + (setq sel (web-mode-trim (buffer-substring-no-properties + (region-beginning) (region-end)))) (delete-region (region-beginning) (region-end))) (while (and continue (< counter l)) (setq snippet (nth counter web-mode-snippets)) @@ -8024,43 +8344,40 @@ Pos should be in a tag." (when snippet (setq snippet (cdr snippet)) (setq beg (point-at-bol)) - (insert (car snippet)) -;; (message "insert[1] (%S)" (point)) - (setq pos (point)) + (insert snippet) + (setq pos (point) + end (point)) + (when (string-match-p "|" snippet) + (search-backward "|") + (delete-char 1) + (setq pos (point) + end (1- end))) (when sel (insert sel) - (setq pos (point))) - (if (cdr snippet) (insert (cdr snippet))) -;; (message "insert[2] (%S)" (point)) + (setq pos (point) + end (+ end (length sel)))) + (goto-char end) (setq end (point-at-eol)) (unless sel (goto-char pos)) (indent-region beg end)) -;; (message "indent : beg(%S) end(%S)" beg end) )) (defun web-mode-looking-at (regexp pos) - "Performs a looking-at at POS." (save-excursion (goto-char pos) - (looking-at regexp) - )) + (looking-at regexp))) (defun web-mode-looking-at-p (regexp pos) - "Performs a looking-at at POS." (save-excursion (goto-char pos) - (looking-at-p regexp) - )) + (looking-at-p regexp))) (defun web-mode-looking-back (regexp pos) - "Performs a looking-at at POS." (save-excursion (goto-char pos) - (looking-back regexp) - )) + (looking-back regexp))) (defun web-mode-insert-text-at-pos (text pos) - "Insert TEXT at POS." (let ((mem web-mode-enable-auto-pairing)) (setq web-mode-enable-auto-pairing nil) (save-excursion @@ -8070,21 +8387,19 @@ Pos should be in a tag." ))) (defun web-mode-remove-text-at-pos (n &optional pos) - "Remove N chars at POS." (unless pos (setq pos (point))) (delete-region pos (+ pos n))) (defun web-mode-insert-and-indent (text) - "Insert and indent text." - (interactive) (let (beg end) (setq beg (point-at-bol)) (insert text) (setq end (point-at-eol)) - (indent-region beg end))) + (indent-region beg end) + )) (defun web-mode-navigate (&optional pos) - "Match tag." + "Move point to the matching opening/closing tag/block." (interactive) (unless pos (setq pos (point))) (let (init) @@ -8107,7 +8422,6 @@ Pos should be in a tag." )) (defun web-mode-block-match (&optional pos) - "Block match" (unless pos (setq pos (point))) (let (pos-ori controls control (counter 1) type (continue t) pair) (setq pos-ori pos) @@ -8126,7 +8440,6 @@ Pos should be in a tag." (setq continue nil)) ((or (and (eq type 'open) (not (web-mode-block-next))) (and (eq type 'close) (not (web-mode-block-previous)))) -;; (message "ici%S" (point)) (setq continue nil) ) ((null (setq controls (web-mode-block-controls-get (point)))) @@ -8160,7 +8473,6 @@ Pos should be in a tag." )) (defun web-mode-tag-match (&optional pos) - "Fetch HTML block." (unless pos (setq pos (point))) (let (regexp) (setq regexp (concat " counter 0) (re-search-backward regexp nil t)) - (when (get-text-property (point) 'tag-beg) + (when (and (get-text-property (point) 'tag-beg) + (member (get-text-property (point) 'tag-type) '(start end))) (setq n (1+ n)) - (if (eq (get-text-property (point) 'tag-type) 'end) - (setq counter (1+ counter)) - (setq counter (1- counter)))) + (cond + ((eq (get-text-property (point) 'tag-type) 'end) + (setq counter (1+ counter))) + (t + (setq counter (1- counter)) + ) + ) + ) ) (if (= n 0) (goto-char pos)) )) (defun web-mode-tag-fetch-closing (regexp pos) - "Fetch closing HTML closing block." (let ((counter 1) (n 0)) (goto-char pos) (web-mode-tag-end) @@ -8213,7 +8529,7 @@ Pos should be in a tag." nil))) (defun web-mode-element-close () - "Close HTML element." + "Close html element." (interactive) (let (jump epp ins tag) (setq epp (web-mode-element-parent-position)) @@ -8262,7 +8578,6 @@ Pos should be in a tag." )) (defun web-mode-detect-content-type () - "Update content type" (cond ((and (string= web-mode-engine "none") (< (point) 16) @@ -8270,135 +8585,222 @@ Pos should be in a tag." (string-match-p "php" (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) - (web-mode-set-engine "php") - ) + (web-mode-set-engine "php")) ((and (string= web-mode-content-type "javascript") (< (point) web-mode-chunk-length) (eq (char-after (point-min)) ?\/) (string-match-p "@jsx" (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) - (web-mode-set-content-type "jsx") - ) - ) ;cond - ) + (web-mode-set-content-type "jsx")) + )) -(defun web-mode-detect-engine () - "Engine detection" - (save-excursion - (let (engine) -;; (message "detect-engine: %S" (point)) - (goto-char (point-min)) - (when (and (re-search-forward "-\\*- engine:[ ]*\\([[:alnum:]-]+\\)[ ]*-\\*-" web-mode-chunk-length t) - (or t - (eq (get-text-property (point) 'part-token) 'comment) - (eq (get-text-property (point) 'block-token) 'comment) - (eq (get-text-property (point) 'tag-type) 'comment))) - (setq engine (web-mode-engine-canonical-name (match-string-no-properties 1)) - web-mode-engine engine) - ) - engine) - )) +(defun web-mode-on-after-change (beg end len) +;; (message "after-change: pos=%d, beg=%d, end=%d, len=%d, ocmd=%S, cmd=%S" (point) beg end len this-original-command this-command) + ;; (backtrace) +;; (message "this-command=%S" this-command) + (when (eq this-original-command 'yank) + (setq web-mode-inhibit-fontification t)) + (when (or (null web-mode-change-beg) (< beg web-mode-change-beg)) + (setq web-mode-change-beg beg)) + (when (or (null web-mode-change-end) (> end web-mode-change-end)) + (setq web-mode-change-end end)) + ) (defun web-mode-complete () "Autocomple at point." (interactive) - (let ((beg (1- (point))) - (end (point)) + (let ((pos (point)) + (char (char-before)) (chunk (buffer-substring-no-properties (- (point) 2) (point))) - (auto-closed nil) - (auto-paired nil)) + (auto-closed nil) + (auto-expanded nil) + (auto-paired nil) + (auto-quoted nil) + expanders) ;;-- auto-closing - (when (and (> web-mode-tag-auto-close-style 0) - (or (and (= web-mode-tag-auto-close-style 2) - (not (get-text-property end 'part-side)) - (string-match-p "[[:alnum:]'\"]>" chunk)) - (string= "= pos 4) + (or (string= "" chunk))) + (not (get-text-property (- pos 2) 'block-side)) + (web-mode-element-close)) + (setq auto-closed t)) ;;-- auto-pairing (when (and web-mode-enable-auto-pairing - (not auto-closed) - (not (get-text-property end 'part-side))) - (let ((i 0) expr p after pos-end (l (length web-mode-auto-pairs))) - (setq pos-end (if (> (+ end 32) (line-end-position)) + (>= pos 4) + (not auto-closed)) + (let ((i 0) expr after pos-end (l (length web-mode-auto-pairs))) + (setq pos-end (if (> (+ pos 32) (line-end-position)) (line-end-position) - (+ end 10))) - (setq chunk (buffer-substring-no-properties (- beg 2) end) - after (buffer-substring-no-properties end pos-end)) + (+ pos 10))) + (setq chunk (buffer-substring-no-properties (- pos 3) pos) + after (buffer-substring-no-properties pos pos-end)) (while (and (< i l) (not auto-paired)) - (setq expr (elt web-mode-auto-pairs i)) - (setq i (1+ i)) - (when (and (string= (elt expr 0) chunk) - (not (string-match-p (or (elt expr 2) (elt expr 1)) after))) + (setq expr (elt web-mode-auto-pairs i) + i (1+ i)) + ;;(message "chunk=%S expr=%S after=%S" chunk expr after) + (when (and (string= (car expr) chunk) + (not (string-match-p (regexp-quote (cdr expr)) after))) (setq auto-paired t) - (insert (elt expr 1)) - (if (not (elt expr 2)) - (goto-char end) - (setq p (point)) - (insert (elt expr 2)) - (goto-char p)) + (insert (cdr expr)) + (if (string-match-p "|" (cdr expr)) + (progn + (search-backward "|") + (delete-char 1)) + (goto-char pos)) ) ;when ) ;while ) ;let - ) ; end auto-pairing + ) + ;;-- auto-expanding + (when (and web-mode-enable-auto-expanding + (not auto-closed) + (not auto-paired) + (eq char ?\/) + (not (get-text-property (1- pos) 'tag-type)) + (not (get-text-property (1- pos) 'part-side)) + (not (get-text-property (1- pos) 'block-side)) + (looking-back "\\(^\\|[[:punct:][:space:]>]\\)./")) + (setq expanders (append web-mode-expanders web-mode-extra-expanders)) + (let ((i 0) pair (l (length expanders))) + (setq chunk (buffer-substring-no-properties (- pos 2) pos)) + ;;(message "%S" chunk) + (while (and (< i l) (not auto-expanded)) + (setq pair (elt expanders i) + i (1+ i)) + (when (string= (car pair) chunk) + (setq auto-expanded t) + (delete-char -2) + (insert (cdr pair)) + (when (string-match-p "|" (cdr pair)) + (search-backward "|") + (delete-char 1)) + ) ;when + ) ;while + ) ; let + ) + + ;;-- auto-quoting + (when (and web-mode-enable-auto-quoting + (>= pos 4) + (not (get-text-property pos 'block-side)) + (not auto-closed) + (not auto-paired) + (not auto-expanded) + (get-text-property (- pos 2) 'tag-attr) + ;;(not (get-text-property pos 'part-element)) + ) + (cond + ((and (eq char ?\=) + (not (looking-at-p "[ ]*[\"']"))) + (insert "\"\"") + (backward-char) + (setq auto-quoted t)) + ((and (eq char ?\") + (not (looking-at-p "[ ]*[\"]"))) + (insert "\"") + (backward-char) + (setq auto-quoted t)) + ((and (eq char ?\") + (eq (char-after) ?\")) + (if (looking-back "=\"\"") + (progn + (delete-char 1) + (backward-char)) + (delete-char 1) + ;;(message "%c" (char-after)) + (if (eq (char-after) ?\s) + (forward-char) + (insert " ")) + ) + ) + ) + ) + ;;-- (cond - ((or auto-closed auto-paired) - (when (and web-mode-change-end (>= (line-end-position) web-mode-change-end)) - (setq web-mode-change-end (line-end-position)) - ;; (message "new change-end=%S" web-mode-change-end) - ) - (list :auto-closed auto-closed :auto-paired auto-paired)) + ((or auto-closed auto-paired auto-expanded auto-quoted) + (when (and web-mode-change-end + (>= (line-end-position) web-mode-change-end)) + (setq web-mode-change-end (line-end-position))) + (list :auto-closed auto-closed + :auto-paired auto-paired + :auto-expanded auto-expanded + :auto-quoted auto-quoted)) (t nil) ) )) -(defun web-mode-on-after-change (beg end len) - "Handles auto-pairing, auto-closing, and region-refresh after buffer alteration." - ;;(message "after-change: pos=%d, beg=%d, end=%d, len=%d, cur=%d, cmd=%S" (point) beg end len (current-column) this-original-command) - ;; (backtrace) - (when (or (null web-mode-change-beg) (< beg web-mode-change-beg)) - (setq web-mode-change-beg beg)) - (when (or (null web-mode-change-end) (> end web-mode-change-end)) - (setq web-mode-change-end end)) - ) - (defun web-mode-on-post-command () - (let (ctx) + (let (ctx n char) + + ;;(message "this-command=%S (%S)" this-command web-mode-expand-previous-state) + ;;(message "%S: %S %S" this-command web-mode-change-beg web-mode-change-end) + + (when (and web-mode-expand-previous-state + (not (member this-command '(web-mode-mark-and-expand + er/expand-region)))) + (when (eq this-command 'keyboard-quit) + (goto-char web-mode-expand-initial-pos)) + (deactivate-mark) + (when web-mode-expand-initial-scroll + (set-window-start (selected-window) web-mode-expand-initial-scroll) + ) + (setq web-mode-expand-previous-state nil + web-mode-expand-initial-pos nil + web-mode-expand-initial-scroll nil)) + + (when (member this-command '(yank)) + (setq web-mode-inhibit-fontification nil) + ;;(web-mode-font-lock-highlight web-mode-change-end) + (when (and web-mode-change-beg web-mode-change-end) + (save-excursion + (font-lock-fontify-region web-mode-change-beg web-mode-change-end) + )) + ) + (when (< (point) 16) (web-mode-detect-content-type)) + (when (and web-mode-enable-engine-detection (or (null web-mode-engine) (string= web-mode-engine "none")) (< (point) web-mode-chunk-length) (web-mode-detect-engine)) (web-mode-on-engine-setted) (web-mode-buffer-highlight)) + + (when (> (point) 1) + (setq char (char-before))) + (cond - ((<= (point) 3) - ) - ((and (member this-command '(self-insert-command)) - (not (get-text-property (point) 'part-side))) - (setq ctx (web-mode-complete)) + + ((null char) ) + + ((and (>= (point) 3) + (member this-command '(self-insert-command)) + (not (member (get-text-property (point) 'part-token) '(comment string)))) + (setq ctx (web-mode-complete))) + ((and web-mode-enable-auto-opening - (member this-command '(newline)) - ;; (not (web-mode-buffer-narrowed-p)) - (or (and (eq (char-before) ?\n) ;;(string= ">\n" chunk) - (eq (char-before (1- (point))) ?\>) - (not (eobp)) - (eq (get-text-property (- (point) 2) 'tag-type) 'start) + (member this-command '(newline electric-newline-and-maybe-indent)) + (or (and (not (eobp)) + (eq (char-after) ?\<) (eq (get-text-property (point) 'tag-type) 'end) - (string= (get-text-property (- (point) 2) 'tag-name) - (get-text-property (point) 'tag-name))) + (looking-back ">\n[ \t]*") + (setq n (length (match-string-no-properties 0))) + (eq (get-text-property (- (point) n) 'tag-type) 'start) + (string= (get-text-property (- (point) n) 'tag-name) + (get-text-property (point) 'tag-name)) + ) (and (get-text-property (1- (point)) 'block-side) (string= web-mode-engine "php") (looking-back "<\\?php[ ]*\n") @@ -8406,21 +8808,18 @@ Pos should be in a tag." (newline-and-indent) (forward-line -1) (indent-according-to-mode) -;; (indent-according-to-mode) -;; (indent-for-tab-command) ) - ;;-- auto-indentation ) ;cond (when (and web-mode-enable-auto-indentation (member this-command '(self-insert-command)) - ;;(not auto-opened) - (or (and ctx (plist-get ctx :auto-closed)) + (or (and ctx + (or (plist-get ctx :auto-closed) + (plist-get ctx :auto-expanded))) (and (> (point) (point-min)) (get-text-property (1- (point)) 'tag-end) (get-text-property (line-beginning-position) 'tag-beg)))) (indent-according-to-mode) -;; (indent-for-tab-command) (when (and web-mode-change-end (> web-mode-change-end (point-max))) (message "post-command: enlarge web-mode-change-end") (setq web-mode-change-end (point-max)) @@ -8432,30 +8831,14 @@ Pos should be in a tag." (when (and web-mode-enable-current-column-highlight (not (web-mode-buffer-narrowed-p))) - (web-mode-column-hide) - (save-excursion - (let (pos column line-to line-from) - (back-to-indentation) - (setq pos (point) - column (current-column) - line-to (web-mode-line-number)) - (when (and (get-text-property (point) 'tag-beg) - (member (get-text-property (point) 'tag-type) '(start end)) - (web-mode-tag-match) - (setq line-from (web-mode-line-number)) -;; (progn (message "cool %S %S" line-from line-to) t) - (not (= line-from line-to))) - (web-mode-column-show column line-from line-to) - ) ;if - ) ;let - ) ;save-excursion - ) + (web-mode-column-show)) + + ;;(message "post-command (%S) (%S)" web-mode-change-end web-mode-change-end) - ;; (message "post-command (%S) (%S)" web-mode-change-end web-mode-change-end) )) (defun web-mode-dom-apostrophes-replace () - "Replace ' with ’." + "Replace char(') with char(’) in the html contents of the buffer." (interactive) (save-excursion (let ((min (point-min)) (max (point-max))) @@ -8464,15 +8847,13 @@ Pos should be in a tag." max (region-end)) (deactivate-mark)) (goto-char min) - (while (web-mode-rsf-content "\\([[:alpha:]]\\)'\\([[:alpha:]]\\)" max) - (replace-match "\\1’\\2") - ) ;while + (while (web-mode-content-rsf "\\([[:alpha:]]\\)'\\([[:alpha:]]\\)" max) + (replace-match "\\1’\\2")) ))) (defun web-mode-dom-entities-encode () - "Replace special chars with HTML entities (e.g. é becomes é)" (save-excursion - (let (regexp ms pair elt (min (point-min)) (max (point-max))) + (let (regexp ms elt (min (point-min)) (max (point-max))) (when mark-active (setq min (region-beginning) max (region-end)) @@ -8483,18 +8864,16 @@ Pos should be in a tag." (setq regexp (concat regexp (char-to-string (cdr pair)))) ) (setq regexp (concat regexp "]")) - (while (web-mode-rsf-content regexp max) + (while (web-mode-content-rsf regexp max) (setq elt (match-string-no-properties 0)) (setq elt (aref elt 0)) (setq elt (car (rassoc elt web-mode-html-entities))) -;; (message "%S" elt) (replace-match (concat "&" elt ";")) ) ;while ))) -;; ½ ½ ½ ½ (defun web-mode-dom-entities-replace () - "Replace HTML entities e.g. entities é é é become é" + "Replace html entities (e.g. é é or é become é)" (interactive) (save-excursion (let (ms pair elt (min (point-min)) (max (point-max))) @@ -8503,32 +8882,29 @@ Pos should be in a tag." max (region-end)) (deactivate-mark)) (goto-char min) - (while (web-mode-rsf-content "&\\([#]?[[:alnum:]]\\{2,8\\}\\);" max) + (while (web-mode-content-rsf "&\\([#]?[[:alnum:]]\\{2,8\\}\\);" max) (setq elt nil) -;; (message "E=%S" (match-string 1)) (setq ms (match-string-no-properties 1)) - (if (eq (aref ms 0) ?\#) - (if (eq (aref ms 1) ?x) - (progn - (setq elt (substring ms 2)) - (setq elt (downcase elt)) - (setq elt (string-to-number elt 16)) - (setq elt (char-to-string elt)) - ) - (setq elt (substring ms 1)) - (setq elt (char-to-string (string-to-number elt))) - ) - (setq pair (assoc ms web-mode-html-entities)) - ;; (message "pos=%S name=%S pair=%S" (point) name pair) - (if pair (setq elt (cdr pair))) - (if elt (setq elt (char-to-string elt))) - ) ;if - (if elt (replace-match elt)) + (cond + ((not (eq (aref ms 0) ?\#)) + (and (setq pair (assoc ms web-mode-html-entities)) + (setq elt (cdr pair)) + (setq elt (char-to-string elt)))) + ((eq (aref ms 1) ?x) + (setq elt (substring ms 2)) + (setq elt (downcase elt)) + (setq elt (string-to-number elt 16)) + (setq elt (char-to-string elt))) + (t + (setq elt (substring ms 1)) + (setq elt (char-to-string (string-to-number elt)))) + ) ;cond + (when elt (replace-match elt)) ) ;while ))) (defun web-mode-dom-xml-replace () - "Replace &, > and < in HTML content." + "Replace &, > and < in html content." (interactive) (save-excursion (let (expr (min (point-min)) (max (point-max))) @@ -8537,7 +8913,7 @@ Pos should be in a tag." max (region-end)) (deactivate-mark)) (goto-char min) - (while (web-mode-rsf-content "[&<>]" max) + (while (web-mode-content-rsf "[&<>]" max) (replace-match (cdr (assq (char-before) web-mode-xml-chars)) t t)) ))) @@ -8552,13 +8928,13 @@ Pos should be in a tag." (deactivate-mark)) (goto-char min) (setq expr (concat (car web-mode-smart-quotes) "\\2" (cdr web-mode-smart-quotes))) - (while (web-mode-rsf-content "\\(\"\\)\\(.\\{1,200\\}\\)\\(\"\\)" max) + (while (web-mode-content-rsf "\\(\"\\)\\(.\\{1,200\\}\\)\\(\"\\)" max) (replace-match expr) ) ;while ))) (defun web-mode-dom-xpath (&optional pos) - "HTML path" + "Display html path." (interactive) (unless pos (setq pos (point))) (save-excursion @@ -8571,7 +8947,6 @@ Pos should be in a tag." ))) (defun web-mode-block-ends-with (regexp &optional pos) - "Check if current block ends with regexp" (unless pos (setq pos (point))) (save-excursion (goto-char pos) @@ -8593,7 +8968,6 @@ Pos should be in a tag." ))) (defun web-mode-block-token-starts-with (regexp &optional pos) - "Check if current token starts with regexp" (unless pos (setq pos (point))) (save-excursion (and (goto-char pos) @@ -8603,7 +8977,6 @@ Pos should be in a tag." )) (defun web-mode-block-starts-with (regexp &optional pos) - "Check if current block starts with regexp" (unless pos (setq pos (point))) (save-excursion (and (web-mode-block-beginning) @@ -8612,7 +8985,6 @@ Pos should be in a tag." )) (defun web-mode-block-skip-blank-backward (&optional pos) - "skip backward" (unless pos (setq pos (point))) (let ((continue t)) (goto-char pos) @@ -8620,30 +8992,30 @@ Pos should be in a tag." (if (and (get-text-property (point) 'block-side) (not (bobp)) (or (member (char-after) '(?\s ?\n)) - (member (get-text-property (point) 'block-token) '(delimiter comment)))) + (member (get-text-property (point) 'block-token) + '(delimiter-beg delimiter-end comment)))) (backward-char) (setq continue nil)) ) ;while (point))) (defun web-mode-block-skip-blank-forward (&optional pos) - "skip forward" (unless pos (setq pos (point))) (let ((continue t)) (goto-char pos) (while continue (if (and (get-text-property (point) 'block-side) (or (member (char-after) '(?\s ?\n ?\t)) - (member (get-text-property (point) 'block-token) '(delimiter comment)))) + (member (get-text-property (point) 'block-token) + '(delimiter-beg delimiter-end comment)))) (forward-char) (setq continue nil)) ) ;while ;; (message "pt=%S" (point)) - (point) - )) + (point))) (defun web-mode-tag-attributes-sort (&optional pos) - "Sort attributes" + "Sort the attributes inside the current html tag." (interactive) (unless pos (setq pos (point))) (save-excursion @@ -8699,8 +9071,29 @@ Pos should be in a tag." ;;(message "attrs=%S" attrs) ))) +(defun web-mode-attribute-insert () + "Insert an attribute inside current tag." + (interactive) + (let (attr attr-name attr-value) + (cond + ((not (eq (get-text-property (point) 'tag-type) 'start)) + (message "attribute-insert ** invalid context **")) + ((not (and (setq attr-name (read-from-minibuffer "Attribute name? ")) + (> (length attr-name) 0))) + (message "attribute-insert ** failure **")) + (t + (setq attr (concat " " attr-name)) + (when (setq attr-value (read-from-minibuffer "Attribute value? ")) + (setq attr (concat attr "=\"" attr-value "\""))) + (web-mode-tag-end) + (re-search-backward "/?>") + (insert attr) + ) + ) ;cond + )) + (defun web-mode-attribute-transpose (&optional pos) - "Transpose attribute" + "Transpose the current html attribute." (interactive) (unless pos (setq pos (point))) (let (ret attr-beg attr-end next-beg next-end tag-end) @@ -8711,12 +9104,12 @@ Pos should be in a tag." (> tag-end next-end)) (setq attr-beg (web-mode-attribute-beginning-position pos) attr-end (web-mode-attribute-end-position pos)) -;; (message "%S %S - %S %S" attr-beg attr-end next-beg next-end) + ;; (message "%S %S - %S %S" attr-beg attr-end next-beg next-end) (transpose-regions attr-beg (1+ attr-end) next-beg (1+ next-end)) ))) (defun web-mode-attribute-select (&optional pos) - "Select attribute." + "Select the current html attribute." (interactive) (unless pos (setq pos (point))) (if (null (get-text-property pos 'tag-attr)) @@ -8728,25 +9121,42 @@ Pos should be in a tag." (point) )) +(defun web-mode-attribute-kill (&optional arg) + "Kill the current html attribute." + (interactive "p") + (unless arg (setq arg 1)) + (while (>= arg 1) + (setq arg (1- arg)) + (web-mode-attribute-select) + (when mark-active + (let ((beg (region-beginning)) (end (region-end))) + (save-excursion + (goto-char end) + (when (looking-at "[ \n\t]*") + (setq end (+ end (length (match-string-no-properties 0))))) + ) ;save-excursion + (kill-region beg end) + ) ;let + ) ;when + ) ;while + ) + (defun web-mode-block-close (&optional pos) - "Close the first opened control block." + "Close the first unclosed control block." (interactive) (unless pos (setq pos (point))) - (let ((continue t) ctx h ctrl n closing-block) + (let ((continue t) + (h (make-hash-table :test 'equal)) ctx ctrl n closing-block) (save-excursion - (setq h (make-hash-table :test 'equal)) (while (and continue (web-mode-block-previous)) -;; (message "ici") (when (setq ctx (web-mode-block-is-control (point))) (setq ctrl (car ctx)) (setq n (gethash ctrl h 0)) (if (cdr ctx) (puthash ctrl (1+ n) h) - (puthash ctrl (1- n) h) - ) + (puthash ctrl (1- n) h)) (when (> (gethash ctrl h) 0) (setq continue nil)) -;; (if ctx (message "(%S) %S : %S" (point) ctrl (gethash ctrl h))) ) ) ;while ) ;save-excursion @@ -8754,34 +9164,49 @@ Pos should be in a tag." (setq closing-block (web-mode-closing-block ctrl))) (insert closing-block) (indent-according-to-mode) -;; (indent-for-tab-command) + ;; (indent-for-tab-command) ) )) (defun web-mode-closing-block (type) - "Return the closing block corresponding to TYPE" (cond - ((string= web-mode-engine "django") - (concat "{% end" type " %}")) - ((string= web-mode-engine "ctemplate") - (concat "{{/" type "}}")) + ((string= web-mode-engine "php") (concat "")) + ((string= web-mode-engine "django") (concat "{% end" type " %}")) + ((string= web-mode-engine "ctemplate") (concat "{{/" type "}}")) ((string= web-mode-engine "blade") - (concat "@end" type)) - ((string= web-mode-engine "dust") - (concat "{/" type "}")) - ((string= web-mode-engine "underscore") - "<% } %>") - ((string= web-mode-engine "erb") - "<% end %>") - (t - (cdr (assoc type web-mode-closing-blocks))) + (if (string= type "section") + (concat "@show") + (concat "@end" type))) + ((string= web-mode-engine "dust") (concat "{/" type "}")) + ((string= web-mode-engine "mako") (concat "% end" type)) + ((string= web-mode-engine "closure") (concat "{/" type "}")) + ((string= web-mode-engine "smarty") (concat "{/" type "}")) + ((string= web-mode-engine "underscore") "<% } %>") + ((string= web-mode-engine "lsp") "<% ) %>") + ((string= web-mode-engine "erb") "<% } %>") + ((string= web-mode-engine "erb") "<% end %>") + ((string= web-mode-engine "go") "{{end}}") + ((string= web-mode-engine "velocity") "#end") + ((string= web-mode-engine "template-toolkit") "[% end %]") + ((member web-mode-engine '("asp" "jsp")) + (if (string-match-p ":" type) (concat "") "<% } %>") + ) + (t nil) + ;;(t (cdr (assoc type web-mode-closing-blocks))) ) ;cond ) ;;---- POSITION ---------------------------------------------------------------- +(defun web-mode-comment-beginning-position (&optional pos) + (unless pos (setq pos (point))) + (car (web-mode-comment-boundaries pos))) + +(defun web-mode-comment-end-position (&optional pos) + (unless pos (setq pos (point))) + (cdr (web-mode-comment-boundaries pos))) + (defun web-mode-opening-paren-position (&optional pos limit) - "Opening paren POS." (save-restriction (unless pos (setq pos (point))) (unless limit (setq limit nil)) @@ -8800,7 +9225,7 @@ Pos should be in a tag." (while (and continue (re-search-backward regexp limit t)) (cond ((> (setq counter (1+ counter)) 500) - (message "opening-paren-position ** crazy loop **") + (message "opening-paren-position ** warning **") (setq continue nil)) ((or (web-mode-is-comment-or-string) (and block-side (not (get-text-property (point) 'block-side)))) @@ -8848,10 +9273,9 @@ Pos should be in a tag." ))) (defun web-mode-closing-delimiter-position (delimiter &optional pos limit) - "Fetch closing delimiter." + (unless pos (setq pos (point))) + (unless limit (setq limit nil)) (save-excursion - (unless pos (setq pos (point))) - (unless limit (setq limit nil)) (goto-char pos) (setq pos nil) (let ((continue t)) @@ -8861,74 +9285,13 @@ Pos should be in a tag." ) ;while pos))) -(defun web-mode-previous-tag-at-bol-pos (pos) - "Line beginning with an HTML tag. BOL is returned or nil." - (save-excursion - (goto-char pos) - (setq pos nil) - (let ((continue t)) - (back-to-indentation) - (if (and (get-text-property (point) 'tag-beg) - ;; (not (member web-mode-content-type '("jsx"))) - (not (get-text-property (point) 'part-side)) - (not (get-text-property (point) 'block-side)) - ) - (setq pos (line-beginning-position)) - (while continue - (forward-line -1) - (setq pos (point)) - (when (bobp) - (setq continue nil)) - (back-to-indentation) - (if (and (get-text-property (point) 'tag-beg) - (not (get-text-property (point) 'part-side)) - (not (get-text-property (point) 'block-side)) - ) - (setq continue nil) - (setq pos nil)) - ) ;while - ) ;if -;; (message "pos=%S" pos) - pos))) - -(defun web-mode-next-tag-at-eol-pos (pos) - "Line ending with an HTML tag. EOL is returned or nil." - (save-excursion - (goto-char pos) - (let ((continue t)) - (while continue - (end-of-line) - (setq pos (point)) - (when (eobp) - (setq continue nil)) - (skip-chars-backward " ") - (if (and (> (point) (point-min)) - (get-text-property (1- (point)) 'tag-end) - (not (and (member (get-text-property (1- (point)) 'tag-name) '("script" "style")) - (eq (get-text-property (1- (point)) 'tag-type) 'start))) - (not (get-text-property (1- (point)) 'part-side)) - (not (get-text-property (1- (point)) 'block-side))) - (progn - ;; (message "point(%S) %S %S %S" - ;; (point) - ;; (get-text-property (1- (point)) 'tag-end) - ;; (get-text-property (1- (point)) 'part-side) - ;; (get-text-property (1- (point)) 'block-side)) - (setq continue nil)) - (setq pos nil)) - (if continue (forward-line)) - ) ;while - pos))) - (defun web-mode-tag-match-position (&optional pos) - "Html tag match position." (unless pos (setq pos (point))) (save-excursion (web-mode-tag-match pos) (if (= pos (point)) nil (point)))) (defun web-mode-tag-beginning-position (&optional pos) - "Beginning position of the current tag. POINT is at <." (unless pos (setq pos (point))) (let (beg) (cond @@ -8946,7 +9309,6 @@ Pos should be in a tag." beg)) (defun web-mode-tag-end-position (&optional pos) - "End position of the current tag. POINT is at >." (unless pos (setq pos (point))) (let (end) (cond @@ -8969,16 +9331,13 @@ Pos should be in a tag." (save-excursion (goto-char pos) (cond - ((eobp) - (setq pos nil)) + ((eobp) nil) (t - (when (get-text-property pos 'tag-beg) - (setq pos (1+ pos))) + (when (get-text-property pos 'tag-beg) (setq pos (1+ pos))) (setq pos (next-single-property-change pos 'tag-beg)) - (when (and pos (> pos limit)) (setq pos nil)) - ) + (if (and pos (<= pos limit)) pos nil)) ) - pos)) + )) (defun web-mode-tag-previous-position (&optional pos limit) (unless pos (setq pos (point))) @@ -8986,21 +9345,14 @@ Pos should be in a tag." (save-excursion (goto-char pos) (cond - ((bobp) - (setq pos nil)) + ((bobp) nil) (t - (when (get-text-property pos 'tag-beg) - (setq pos (1- pos))) - (setq pos (previous-single-property-change pos 'tag-beg)) - (when pos - (setq pos (1- pos)) - (goto-char pos)) - ) + (when (get-text-property pos 'tag-beg) (setq pos (1- pos))) + (web-mode-go (previous-single-property-change pos 'tag-beg) -1)) ) - pos)) + )) (defun web-mode-attribute-beginning-position (&optional pos) - "Beginning position of the current attr." (unless pos (setq pos (point))) (cond ((null (get-text-property pos 'tag-attr)) @@ -9012,7 +9364,6 @@ Pos should be in a tag." )) (defun web-mode-attribute-end-position (&optional pos) - "End position of the current attr." (unless pos (setq pos (point))) (let (end) (cond @@ -9030,7 +9381,6 @@ Pos should be in a tag." end)) (defun web-mode-attribute-next-position (&optional pos) - "Next attribute position." (unless pos (setq pos (point))) (let ((continue t)) (while continue @@ -9045,8 +9395,23 @@ Pos should be in a tag." ) ;while pos)) +(defun web-mode-attribute-previous-position (&optional pos) + (unless pos (setq pos (point))) + (let ((continue t)) + (while continue + (setq pos (previous-single-property-change pos 'tag-attr)) + (cond + ((null pos) + (setq continue nil + pos nil)) + ((get-text-property pos 'tag-attr) + (setq continue nil)) + ) + ) ;while + (when pos (setq pos (web-mode-attribute-beginning-position pos))) + pos)) + (defun web-mode-element-beginning-position (&optional pos) - "Beginning of element pos." (unless pos (setq pos (point))) (cond ((null (get-text-property pos 'tag-type)) @@ -9062,7 +9427,6 @@ Pos should be in a tag." pos) (defun web-mode-element-end-position (&optional pos) - "End of element pos." (unless pos (setq pos (point))) (cond ((null (get-text-property pos 'tag-type)) @@ -9084,7 +9448,6 @@ Pos should be in a tag." pos) (defun web-mode-element-child-position (&optional pos) - "Child element pos." (save-excursion (let (child close) (unless pos (setq pos (point))) @@ -9114,27 +9477,21 @@ Pos should be in a tag." (< (point) close)) (setq child (point)) ) - child - ))) + child))) (defun web-mode-element-parent-position (&optional pos) - "Parent element pos." - (let (n - tag-type - tag-name - (continue t) - (h (make-hash-table :test 'equal))) + (let (n tag-type tag-name (continue t) (tags (make-hash-table :test 'equal))) (save-excursion (if pos (goto-char pos)) (while (and continue (web-mode-tag-previous)) - (setq pos (point)) - (setq tag-type (get-text-property pos 'tag-type) - tag-name (get-text-property pos 'tag-name)) - (setq n (gethash tag-name h 0)) + (setq pos (point) + tag-type (get-text-property pos 'tag-type) + tag-name (get-text-property pos 'tag-name) + n (gethash tag-name tags 0)) (when (member tag-type '(end start)) (if (eq tag-type 'end) - (puthash tag-name (1- n) h) - (puthash tag-name (1+ n) h) + (puthash tag-name (1- n) tags) + (puthash tag-name (1+ n) tags) (when (= n 0) (setq continue nil)) ) ;if ) ;when @@ -9143,6 +9500,25 @@ Pos should be in a tag." (if (null continue) pos nil) )) +(defun web-mode-element-previous-position (&optional pos limit) + (unless pos (setq pos (point))) + (unless limit (setq limit (point-min))) + (save-excursion + (goto-char pos) + (let ((continue (not (bobp))) + (props '(start void comment))) + (while continue + (setq pos (web-mode-tag-previous)) + (cond + ((or (null pos) (< (point) limit)) + (setq continue nil + pos nil)) + ((member (get-text-property (point) 'tag-type) props) + (setq continue nil)) + ) + ) ;while + pos))) + (defun web-mode-element-next-position (&optional pos limit) (unless pos (setq pos (point))) (unless limit (setq limit (point-max))) @@ -9164,10 +9540,9 @@ Pos should be in a tag." pos))) (defun web-mode-part-end-position (&optional pos) - "End position of the current part." (unless pos (setq pos (point))) (cond - ((member web-mode-content-type '("css" "javascript" "json" "jsx")) + ((member web-mode-content-type web-mode-part-content-types) (setq pos (point-max))) ((not (get-text-property pos 'part-side)) (setq pos nil)) @@ -9181,10 +9556,9 @@ Pos should be in a tag." pos) (defun web-mode-part-beginning-position (&optional pos) - "Beginning of part" (unless pos (setq pos (point))) (cond - ((member web-mode-content-type '("css" "javascript" "json" "jsx")) + ((member web-mode-content-type web-mode-part-content-types) (setq pos (point-min))) ((not (get-text-property pos 'part-side)) (setq pos nil)) @@ -9197,154 +9571,520 @@ Pos should be in a tag." ) ;cond pos) -(defun web-mode-part-next-position (&optional pos) - "web-mode-part-next-position" +(defun web-mode-part-next-position (&optional pos) + (unless pos (setq pos (point))) + (cond + ((and (= pos (point-min)) (get-text-property pos 'part-side)) + ) + ((not (get-text-property pos 'part-side)) + (setq pos (next-single-property-change pos 'part-side))) + ((and (setq pos (web-mode-part-end-position pos)) (>= pos (point-max))) + (setq pos nil)) + ((and (setq pos (1+ pos)) (not (get-text-property pos 'part-side))) + (setq pos (next-single-property-change pos 'part-side))) + ) ;cond + pos) + +(defun web-mode-block-match-position (&optional pos) + (unless pos (setq pos (point))) + (save-excursion + (web-mode-block-match pos) + (if (= pos (point)) nil (point)))) + +(defun web-mode-block-control-previous-position (type &optional pos) + (unless pos (setq pos (point))) + (let ((continue t) controls) + (while continue + (setq pos (web-mode-block-previous-position pos)) + (cond + ((null pos) + (setq continue nil + pos nil)) + ((and (setq controls (web-mode-block-controls-get pos)) + (eq (car (car controls)) type)) + (setq continue nil)) + ) ;cond + ) ;while + pos)) + +(defun web-mode-block-opening-paren-position (pos limit) + (save-excursion + (goto-char pos) + (let (c + n + pt + (continue t) + (pairs '((")" . "(") + ("]" . "[") + ("}" . "{"))) + (h (make-hash-table :test 'equal)) + (regexp "[\]\[)(}{]")) + (while (and continue (re-search-backward regexp limit t)) + (unless (web-mode-is-comment-or-string) + (setq c (string (char-after))) + (cond + ((member c '("(" "{" "[")) + (setq n (gethash c h 0)) + (if (= n 0) + (setq continue nil + pt (point)) + (puthash c (1+ n) h) + )) + (t + (setq c (cdr (assoc c pairs))) + (setq n (gethash c h 0)) + (puthash c (1- n) h)) + ) ;cond + ) ;unless + ) ;while + pt))) + +(defun web-mode-block-code-beginning-position (&optional pos) + (unless pos (setq pos (point))) + (when (and (setq pos (web-mode-block-beginning-position pos)) + (eq (get-text-property pos 'block-token) 'delimiter-beg)) + (setq pos (next-single-property-change pos 'block-token))) + pos) + +(defun web-mode-block-beginning-position (&optional pos) + (unless pos (setq pos (point))) + (cond + ((or (and (get-text-property pos 'block-side) (= pos (point-min))) + (get-text-property pos 'block-beg)) + ) + ((and (> pos (point-min)) (get-text-property (1- pos) 'block-beg)) + (setq pos (1- pos))) + ((get-text-property pos 'block-side) + (setq pos (previous-single-property-change pos 'block-beg)) + (setq pos (if (and pos (> pos (point-min))) (1- pos) (point-min)))) + (t + (setq pos nil)) + ) ;cond + pos) + +(defun web-mode-block-string-beginning-position (pos &optional block-beg) + (unless pos (setq pos (point))) + (unless block-beg (setq block-beg (web-mode-block-beginning-position pos))) + (let (char (continue (not (null pos)))) + (while continue + (setq char (char-after pos)) + (cond + ((< pos block-beg) + (setq continue nil + pos block-beg)) + ((and (member (get-text-property pos 'block-token) '(string comment)) + (eq (get-text-property pos 'block-token) (get-text-property (1- pos) 'block-token))) + (setq pos (web-mode-block-token-beginning-position pos)) + ;;(setq pos (1- pos)) + ) + ((member char '(?\) ?\])) + (setq pos (web-mode-block-opening-paren-position pos block-beg)) + (setq pos (1- pos)) + ) + ((member char '(?\( ?\= ?\[ ?\? ?\: ?\; ?\, ?\`)) + (setq continue nil) + (web-mode-looking-at ".[ \t\n]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0)))) + ) + ((web-mode-looking-back "\\<\\(return\\|echo\\|include\\|print\\)[ \n\t]*" pos) + (setq ;;pos (point) + continue nil)) + (t + (setq pos (1- pos))) + ) ;cond + ) ;while + pos)) + +(defun web-mode-block-statement-beginning-position (pos &optional block-beg) + (unless pos (setq pos (point))) + (setq pos (1- pos)) + (unless block-beg (setq block-beg (web-mode-block-beginning-position pos))) + (let (char (continue (not (null pos)))) + (while continue + (setq char (char-after pos)) + (cond + ((< pos block-beg) + (setq continue nil + pos block-beg)) + ((and (member (get-text-property pos 'block-token) '(string comment)) + (eq (get-text-property pos 'block-token) (get-text-property (1- pos) 'block-token))) + (setq pos (web-mode-block-token-beginning-position pos)) + ;;(setq pos (1- pos)) + ) + ((member char '(?\) ?\] ?\})) + (setq pos (web-mode-block-opening-paren-position pos block-beg)) + (setq pos (1- pos)) + ) + ((member char '(?\( ?\[ ?\{ ?\=)) + (setq continue nil) + (web-mode-looking-at ".[ \t\n]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0)))) + ) + ((web-mode-looking-back "\\<\\(return\\|echo\\|include\\|print\\)[ \n\t]*" pos) + (setq ;;pos (point) + continue nil)) + (t + (setq pos (1- pos))) + ) ;cond + ) ;while + pos)) + +(defun web-mode-block-args-beginning-position (pos &optional block-beg) + ;;(unless pos (setq pos (point))) + (unless pos (setq pos (point))) + (setq pos (1- pos)) ; #0512 + (unless block-beg (setq block-beg (web-mode-block-beginning-position pos))) + (let (char (continue (not (null pos)))) + (while continue + (setq char (char-after pos)) + (cond + ((< pos block-beg) + (message "block-args-beginning-position ** failure **") + (setq continue nil + pos block-beg)) + ((and (member (get-text-property pos 'block-token) '(string comment)) + (eq (get-text-property pos 'block-token) (get-text-property (1- pos) 'block-token))) + (setq pos (web-mode-block-token-beginning-position pos))) + ((member char '(?\) ?\] ?\})) + (setq pos (web-mode-opening-paren-position pos block-beg)) + (setq pos (1- pos))) + ((member char '(?\( ?\[ ?\{)) + (setq continue nil) + (web-mode-looking-at ".[ \t\n]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0))))) + ((and (string= web-mode-engine "php") + (web-mode-looking-back "\\<\\(extends\\|implements\\)[ \n\t]*" pos)) + (setq continue nil)) + (t + (setq pos (1- pos))) + ) ;cond + ) ;while + pos)) + +(defun web-mode-block-calls-beginning-position (pos &optional block-beg) (unless pos (setq pos (point))) - (if (get-text-property pos 'part-side) - (if (= pos (point-min)) - (set pos (point-min)) - (setq pos (web-mode-part-end-position pos)) - (when (and pos (> (point-max) pos)) - (setq pos (1+ pos)) - (if (not (get-text-property pos 'part-side)) - (setq pos (next-single-property-change pos 'part-side))) - ) ;when - ) - (setq pos (next-single-property-change pos 'part-side)) - ) - pos) + (unless block-beg (setq block-beg (web-mode-block-beginning-position pos))) + (let (char (continue (not (null pos)))) + (while continue + (setq char (char-after pos)) + (cond + ((< pos block-beg) + (message "block-calls-beginning-position ** failure **") + (setq continue nil + pos block-beg)) + ((and (member (get-text-property pos 'block-token) '(string comment)) + (eq (get-text-property pos 'block-token) (get-text-property (1- pos) 'block-token))) + (setq pos (web-mode-block-token-beginning-position pos))) + ((member char '(?\) ?\])) + (setq pos (web-mode-opening-paren-position pos block-beg)) + (setq pos (1- pos))) + ((member char '(?\( ?\[ ?\{ ?\} ?\= ?\? ?\: ?\; ?\,)) + (setq continue nil) + (web-mode-looking-at ".[ \t\n]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0))))) + ((web-mode-looking-back "\\(return\\|else\\)[ \n\t]*" pos) + (setq ;;pos (point) + continue nil)) + (t + (setq pos (1- pos))) + ) ;cond + ) ;while + pos)) -(defun web-mode-block-match-position (&optional pos) - "Match block position." +(defun web-mode-javascript-string-beginning-position (pos &optional reg-beg) (unless pos (setq pos (point))) - (save-excursion - (web-mode-block-match pos) - (if (= pos (point)) nil (point)))) + (let ((char nil) + (blockside (get-text-property pos 'block-side)) + (i 0) + (continue (not (null pos)))) + (unless reg-beg + (if blockside + (setq reg-beg (web-mode-block-beginning-position pos)) + (setq reg-beg (web-mode-part-beginning-position pos))) + ) + (while continue + (setq char (char-after pos)) + (cond + ((> (setq i (1+ i)) 20000) + (message "javascript-string-beginning-position ** warning (%S) **" pos) + (setq continue nil + pos nil)) + ((null pos) + (message "javascript-string-beginning-position ** invalid pos **") + (setq continue nil)) + ((< pos reg-beg) + (message "javascript-string-beginning-position ** failure **") + (setq continue nil + pos reg-beg)) + ((and blockside + (member (get-text-property pos 'block-token) '(string comment)) + (eq (get-text-property pos 'block-token) (get-text-property (1- pos) 'block-token))) + (setq pos (web-mode-block-token-beginning-position pos))) + ((and (not blockside) + (member (get-text-property pos 'part-token) '(string comment)) + (eq (get-text-property pos 'part-token) (get-text-property (1- pos) 'part-token))) + (setq pos (web-mode-part-token-beginning-position pos))) + ((and (not blockside) + (get-text-property pos 'block-side)) + (when (setq pos (web-mode-block-beginning-position pos)) + (setq pos (1- pos)))) + ((member char '(?\) ?\] ?\})) + (setq pos (web-mode-opening-paren-position pos reg-beg)) + (setq pos (1- pos))) + ((member char '(?\( ?\{ ?\[ ?\= ?\? ?\: ?\; ?\, ?\& ?\|)) + (setq continue nil) + (web-mode-looking-at ".[ \t\n]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0))))) + ((web-mode-looking-back "\\(return\\)[ \n\t]*" pos) + (setq continue nil)) + (t + (setq pos (1- pos))) + ) ;cond + ) ;while + pos)) -(defun web-mode-block-control-previous-position (type &optional pos) - "web-mode-block-control-previous-open" +(defun web-mode-javascript-statement-beginning-position (pos &optional reg-beg) (unless pos (setq pos (point))) - (let ((continue t) controls) + (setq pos (1- pos)) + (let ((char nil) + (blockside (get-text-property pos 'block-side)) + (i 0) + (continue (not (null pos)))) + (unless reg-beg + (if blockside + (setq reg-beg (web-mode-block-beginning-position pos)) + (setq reg-beg (web-mode-part-beginning-position pos))) + ) (while continue - (setq pos (web-mode-block-previous-position pos)) + (setq char (char-after pos)) (cond + ((> (setq i (1+ i)) 20000) + (message "javascript-statement-beginning-position ** warning (%S) **" pos) + (setq continue nil + pos nil)) ((null pos) + (message "javascript-statement-beginning-position ** invalid pos **") + (setq continue nil)) + ((< pos reg-beg) + (message "javascript-statement-beginning-position ** failure **") + (setq continue nil + pos reg-beg)) + ((and blockside + (member (get-text-property pos 'block-token) '(string comment)) + (eq (get-text-property pos 'block-token) (get-text-property (1- pos) 'block-token))) + (setq pos (web-mode-block-token-beginning-position pos))) + ((and (not blockside) + (member (get-text-property pos 'part-token) '(string comment)) + (eq (get-text-property pos 'part-token) (get-text-property (1- pos) 'part-token))) + (setq pos (web-mode-part-token-beginning-position pos))) + ((and (not blockside) + (get-text-property pos 'block-side)) + (when (setq pos (web-mode-block-beginning-position pos)) + (setq pos (1- pos)))) + ((member char '(?\) ?\] ?\})) + (setq pos (web-mode-opening-paren-position pos reg-beg)) + (setq pos (1- pos))) + ((member char '(?\( ?\{ ?\[ ?\=)) + (setq continue nil) + (web-mode-looking-at ".[ \t\n]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0))))) + ((web-mode-looking-back "\\<\\(return\\)[ \n\t]*" pos) + (setq continue nil) + (web-mode-looking-at "[ \t\n]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0))))) + (t + (setq pos (1- pos))) + ) ;cond + ) ;while + pos)) + +(defun web-mode-javascript-args-beginning-position (pos &optional reg-beg) + (unless pos (setq pos (point))) + (setq pos (1- pos)) + (let ((char nil) + (blockside (get-text-property pos 'block-side)) + (i 0) + (continue (not (null pos)))) + (unless reg-beg + (if blockside + (setq reg-beg (web-mode-block-beginning-position pos)) + (setq reg-beg (web-mode-part-beginning-position pos))) + ) + (while continue + (setq char (char-after pos)) + (cond + ((> (setq i (1+ i)) 20000) + (message "javascript-args-beginning-position ** warning (%S) **" pos) (setq continue nil pos nil)) - ((and (setq controls (web-mode-block-controls-get pos)) - (eq (car (car controls)) type)) + ((null pos) + (message "javascript-args-beginning-position ** invalid pos **") (setq continue nil)) + ((< pos reg-beg) + (message "javascript-args-beginning-position ** failure **") + (setq continue nil + pos reg-beg)) + ((and blockside + (member (get-text-property pos 'block-token) '(string comment)) + (eq (get-text-property pos 'block-token) (get-text-property (1- pos) 'block-token))) + (setq pos (web-mode-block-token-beginning-position pos))) + ((and (not blockside) + (member (get-text-property pos 'part-token) '(string comment)) + (eq (get-text-property pos 'part-token) (get-text-property (1- pos) 'part-token))) + (setq pos (web-mode-part-token-beginning-position pos))) + ((and (not blockside) + (get-text-property pos 'block-side)) + (when (setq pos (web-mode-block-beginning-position pos)) + (setq pos (1- pos))) + ) + ((member char '(?\) ?\] ?\})) + (when (setq pos (web-mode-opening-paren-position pos reg-beg)) + (setq pos (1- pos)))) + ((member char '(?\( ?\[ ?\{)) +;; (web-mode-looking-at ".[ \t\n]*" pos) + (web-mode-looking-at ".[ ]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0))) + continue nil) +;; (message "=>%S" pos) + ) + ((web-mode-looking-back "\\<\\(var\\|let\\|return\\|const\\)[ \n\t]+" pos) +;; (web-mode-looking-at "[ \t\n]*" pos) + (web-mode-looking-at "[ \t]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0))) + continue nil)) + (t + (setq pos (1- pos))) ) ;cond ) ;while + ;;(message "=%S" pos) pos)) -(defun web-mode-block-opening-paren-position (pos limit) - "Is opened code line." - (save-excursion - (goto-char pos) - (let (c - n - pt - (continue t) - (pairs '((")" . "(") - ("]" . "[") - ("}" . "{"))) - (h (make-hash-table :test 'equal)) - (regexp "[\]\[)(}{]")) - (while (and continue (re-search-backward regexp limit t)) - (unless (web-mode-is-comment-or-string) - (setq c (string (char-after))) - (cond - ((member c '("(" "{" "[")) - (setq n (gethash c h 0)) - (if (= n 0) - (setq continue nil - pt (point)) - (puthash c (1+ n) h) - )) - (t - (setq c (cdr (assoc c pairs))) - (setq n (gethash c h 0)) - (puthash c (1- n) h)) - ) ;cond - ) ;unless - ) ;while - ;; (message "h=%S pt=%S" h pt) - pt - ))) +(defun web-mode-javascript-calls-beginning-position (pos &optional reg-beg) + (unless pos (setq pos (point))) + (let ((char nil) + (blockside (get-text-property pos 'block-side)) + (i 0) + (continue (not (null pos)))) + (unless reg-beg + (if blockside + (setq reg-beg (web-mode-block-beginning-position pos)) + (setq reg-beg (web-mode-part-beginning-position pos))) + ) + (while continue + (setq char (char-after pos)) + (cond + ((> (setq i (1+ i)) 20000) + (message "javascript-calls-beginning-position ** warning (%S) **" pos) + (setq continue nil + pos nil)) + ((null pos) + (message "javascript-calls-beginning-position ** invalid pos **") + (setq continue nil)) + ((< pos reg-beg) + ;;(message "pos(%S) reg-beg(%S)" pos reg-beg) + ;;(message "javascript-calls-beginning-position ** failure **") + (setq continue nil + pos reg-beg)) + ((and blockside + (member (get-text-property pos 'block-token) '(string comment)) + (eq (get-text-property pos 'block-token) (get-text-property (1- pos) 'block-token))) + (setq pos (web-mode-block-token-beginning-position pos))) + ((and (not blockside) + (member (get-text-property pos 'part-token) '(string comment)) + (eq (get-text-property pos 'part-token) (get-text-property (1- pos) 'part-token))) + (setq pos (web-mode-part-token-beginning-position pos))) + ((and (not blockside) + (get-text-property pos 'block-side)) + (when (setq pos (web-mode-block-beginning-position pos)) + (setq pos (1- pos)))) + ((member char '(?\) ?\] ?\})) + (when (setq pos (web-mode-opening-paren-position pos reg-beg)) + (setq pos (1- pos)))) + ((member char '(?\( ?\{ ?\[ ?\= ?\? ?\: ?\; ?\, ?\& ?\|)) + (setq continue nil) + (web-mode-looking-at ".[ \t\n]*" pos) + (setq pos (+ pos (length (match-string-no-properties 0))))) + ((web-mode-looking-back "\\<\\(return\\|else\\)[ \n\t]*" pos) + (setq continue nil)) + (t + (setq pos (1- pos))) + ) ;cond + ) ;while + pos)) -(defun web-mode-block-code-beginning-position (&optional pos) - "Block beginning position, just after the start delimiter (e.g. just after pos (point-min)) + (not (get-text-property (1- pos) 'part-token)))) + pos) + (t + (setq pos (previous-single-property-change pos 'part-token)) + (if (and pos (> pos (point-min))) pos (point-min))) + )) -(defun web-mode-block-beginning-position (&optional pos) +(defun web-mode-part-token-end-position (&optional pos) (unless pos (setq pos (point))) (cond - ((or (and (get-text-property pos 'block-side) - (= pos (point-min))) - (get-text-property pos 'block-beg)) - ) - ((and (> pos (point-min)) - (get-text-property (1- pos) 'block-beg)) - (setq pos (1- pos)) - ) - ((get-text-property pos 'block-side) - (setq pos (previous-single-property-change pos 'block-beg)) - (setq pos (if (and pos (> pos (point-min))) (1- pos) (point-min))) - ) + ((not (get-text-property pos 'part-token)) + nil) + ((or (= pos (point-max)) + (not (get-text-property (1+ pos) 'part-token))) + pos) (t - (setq pos nil)) - ) ;cond -;; (message "web-mode-block-beginning-position=%S" pos) - pos) + (1- (next-single-property-change pos 'part-token))) + )) (defun web-mode-block-token-beginning-position (&optional pos) (unless pos (setq pos (point))) (cond - ((and (get-text-property pos 'block-token) - (= pos (point-min))) - ) - ((and (> pos (point-min)) - (get-text-property pos 'block-token) - (not (get-text-property (1- pos) 'block-token))) - ;; (setq pos (1- pos)) - ) - ((get-text-property pos 'block-token) + ((not (get-text-property pos 'block-token)) + nil) + ((or (= pos (point-min)) + (and (> pos (point-min)) + (not (get-text-property (1- pos) 'block-token)))) + pos) + (t (setq pos (previous-single-property-change pos 'block-token)) - (setq pos (if (and pos (> pos (point-min))) pos (point-min))) - ) + (if (and pos (> pos (point-min))) pos (point-min))) + )) + +(defun web-mode-block-token-end-position (&optional pos) + (unless pos (setq pos (point))) + (cond + ((not (get-text-property pos 'block-token)) + nil) + ((or (= pos (point-max)) + (not (get-text-property (1+ pos) 'block-token))) + pos) (t - (setq pos nil)) - ) ;cond - ;;(message "web-mode-block-token-beginning-position=%S" pos) - pos) + (1- (next-single-property-change pos 'block-token))) + )) (defun web-mode-block-code-end-position (&optional pos) (unless pos (setq pos (point))) (setq pos (web-mode-block-end-position pos)) (cond - ((and pos - (eq (get-text-property pos 'block-token) 'delimiter) - (eq (get-text-property (1- pos) 'block-token) 'delimiter)) - ;;TODO : danger string enchaine avec delimiter - (setq pos (previous-single-property-change pos 'block-token))) + ((not pos) + nil) + ((and (eq (get-text-property pos 'block-token) 'delimiter-end) + (eq (get-text-property (1- pos) 'block-token) 'delimiter-end)) + (previous-single-property-change pos 'block-token)) ((= pos (1- (point-max))) ;; TODO: comparer plutot avec line-end-position - (setq pos (point-max))) - ) - pos) + (point-max)) + (t + pos) + )) (defun web-mode-block-end-position (&optional pos) - "web-mode-block-end-position" (unless pos (setq pos (point))) (cond ((get-text-property pos 'block-end) pos) ((get-text-property pos 'block-side) -;; (message "pos=%S %S" pos (or (next-single-property-change pos 'block-end) (point-max))) (or (next-single-property-change pos 'block-end) (point-max))) (t @@ -9370,19 +10110,9 @@ Pos should be in a tag." ) ;block-side ((get-text-property (1- pos) 'block-side) (setq pos (web-mode-block-beginning-position (1- pos))) - (cond - ((or (null pos) (= pos (point-min))) - (setq pos nil) - ) - ((and (setq pos (previous-single-property-change pos 'block-beg)) - (> pos (point-min))) - (setq pos (1- pos)) - ) - ) - ) ;block-side + ) (t (setq pos (previous-single-property-change pos 'block-side)) -;; (message "pos(%S)" pos) (cond ((and (null pos) (get-text-property (point-min) 'block-beg)) (setq pos (point-min))) @@ -9399,167 +10129,276 @@ Pos should be in a tag." (cond ((and (get-text-property pos 'block-side) (setq pos (web-mode-block-end-position pos)) - (> (point-max) pos) + (< pos (point-max)) (setq pos (1+ pos))) - (if (get-text-property pos 'block-beg) - pos + (unless (get-text-property pos 'block-beg) (setq pos (next-single-property-change pos 'block-side))) ) (t (setq pos (next-single-property-change pos 'block-side))) ) ;cond - (when (and pos (> pos limit)) - (setq pos nil)) - pos) + (if (and pos (<= pos limit)) pos nil)) -;;---- MOVING ------------------------------------------------------------------ +;;---- EXCURSION --------------------------------------------------------------- -(defun web-mode-closing-paren (limit) - "web-mode-closing-paren" - (let ((pos (web-mode-closing-paren-position (point) limit))) - (if (or (null pos) (> pos limit)) - nil - (goto-char pos) - pos) - )) +(defun web-mode-backward-sexp (n) + (interactive "p") + (if (< n 0) (web-mode-forward-sexp (- n)) + (let (pos) + (dotimes (_ n) + (skip-chars-backward "[:space:]") + (setq pos (point)) + (cond + ((bobp) nil) + ((get-text-property (1- pos) 'block-end) + (backward-char 1) + (web-mode-block-beginning)) + ((get-text-property (1- pos) 'block-token) + (backward-char 1) + (web-mode-block-token-beginning)) + ((get-text-property (1- pos) 'part-token) + (backward-char 1) + (web-mode-part-token-beginning)) + ((get-text-property (1- pos) 'tag-end) + (backward-char 1) + (web-mode-element-beginning)) + ((get-text-property (1- pos) 'tag-attr) + (backward-char 1) + (web-mode-attribute-beginning)) + ((get-text-property (1- pos) 'tag-type) + (backward-char 1) + (web-mode-tag-beginning)) + (t + (let ((forward-sexp-function nil)) + (backward-sexp)) + ) ;case t + ) ;cond + ) ;dotimes + ))) ;let if defun + +(defun web-mode-forward-sexp (n) + (interactive "p") + (if (< n 0) (web-mode-backward-sexp (- n)) + (let (pos) + (dotimes (_ n) + (skip-chars-forward "[:space:]") + (setq pos (point)) + (cond + ((eobp) nil) + ((get-text-property pos 'block-beg) + (web-mode-block-end)) + ((get-text-property pos 'block-token) + (web-mode-block-token-end)) + ((get-text-property pos 'part-token) + (web-mode-part-token-end)) + ((get-text-property pos 'tag-beg) + (web-mode-element-end)) + ((get-text-property pos 'tag-attr) + (web-mode-attribute-end)) + ((get-text-property pos 'tag-type) + (web-mode-tag-end)) + (t + (let ((forward-sexp-function nil)) + (forward-sexp)) + ) ;case t + ) ;cond + ) ;dotimes + ))) ;let if defun + +(defun web-mode-comment-beginning () + "Fetch current comment beg." + (interactive) + (web-mode-go (web-mode-comment-beginning-position (point)))) + +(defun web-mode-comment-end () + "Fetch current comment end." + (interactive) + (web-mode-go (web-mode-comment-end-position (point)) 1)) (defun web-mode-tag-beginning () - "Fetch html tag beg." + "Fetch current html tag beg." (interactive) - (let ((pos (web-mode-tag-beginning-position (point)))) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-tag-beginning-position (point)))) (defun web-mode-tag-end () - "Fetch html tag end." + "Fetch current html tag end." (interactive) - (let ((pos (web-mode-tag-end-position (point)))) - (when pos - (setq pos (1+ pos)) - (goto-char pos)) - pos)) + (web-mode-go (web-mode-tag-end-position (point)) 1)) (defun web-mode-tag-previous () "Fetch previous tag." (interactive) - (let ((pos (web-mode-tag-previous-position (point)))) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-tag-previous-position (point)))) (defun web-mode-tag-next () - "Fetch next tag. Might be HTML comment or server tag (ie. JSP)." + "Fetch next tag. Might be html comment or server tag (e.g. jsp)." (interactive) - (let ((pos (web-mode-tag-next-position (point)))) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-tag-next-position (point)))) (defun web-mode-attribute-beginning () - "Fetch html attribute end." + "Fetch html attribute beginning." (interactive) - (let ((pos (web-mode-attribute-beginning-position (point)))) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-attribute-beginning-position (point)))) (defun web-mode-attribute-end () "Fetch html attribute end." (interactive) - (let ((pos (web-mode-attribute-end-position (point)))) - (when pos - (setq pos (1+ pos)) - (goto-char pos)) - pos)) + (web-mode-go (web-mode-attribute-end-position (point)) 1)) -(defun web-mode-attribute-next () +(defun web-mode-attribute-next (&optional arg) "Fetch next attribute." - (interactive) - (let ((pos (point))) - (setq pos (web-mode-attribute-next-position pos)) - (when pos (goto-char pos)) - pos)) + (interactive "p") + (unless arg (setq arg 1)) + (cond + ((= arg 1) (web-mode-go (web-mode-attribute-next-position (point)))) + ((< arg 1) (web-mode-element-previous (* arg -1))) + (t + (while (>= arg 1) + (setq arg (1- arg)) + (web-mode-go (web-mode-attribute-next-position (point))) + ) + ) + ) + ) + +(defun web-mode-attribute-previous (&optional arg) + "Fetch previous attribute." + (interactive "p") + (unless arg (setq arg 1)) + (unless arg (setq arg 1)) + (cond + ((= arg 1) (web-mode-go (web-mode-attribute-previous-position (point)))) + ((< arg 1) (web-mode-element-next (* arg -1))) + (t + (while (>= arg 1) + (setq arg (1- arg)) + (web-mode-go (web-mode-attribute-previous-position (point))) + ) + ) + ) + ) -(defun web-mode-element-previous () +(defun web-mode-element-previous (&optional arg) "Fetch previous element." - (interactive) - (let ((continue (not (bobp))) - (ret) - (pos (point)) - (props '(start void))) - (while continue - (setq ret (web-mode-tag-previous)) - (when (or (null ret) - (member (get-text-property (point) 'tag-type) props)) - (setq continue nil)) + (interactive "p") + (unless arg (setq arg 1)) + (cond + ((= arg 1) (web-mode-go (web-mode-element-previous-position (point)))) + ((< arg 1) (web-mode-element-next (* arg -1))) + (t + (while (>= arg 1) + (setq arg (1- arg)) + (web-mode-go (web-mode-element-previous-position (point))) ) ;while - (unless ret (goto-char pos)) - ret)) + ) ;t + ) ;cond + ) -(defun web-mode-element-next () +;; (let ((continue (not (bobp))) +;; (ret) +;; (pos (point)) +;; (props '(start void))) +;; (while continue +;; (setq ret (web-mode-tag-previous)) +;; (when (or (null ret) +;; (member (get-text-property (point) 'tag-type) props)) +;; (setq continue nil)) +;; ) ;while +;; (unless ret (goto-char pos)) +;; ret)) + +(defun web-mode-element-next (&optional arg) "Fetch next element." + (interactive "p") + (unless arg (setq arg 1)) + (cond + ((= arg 1) (web-mode-go (web-mode-element-next-position (point)))) + ((< arg 1) (web-mode-element-previous (* arg -1))) + (t + (while (>= arg 1) + (setq arg (1- arg)) + (web-mode-go (web-mode-element-next-position (point))) + ) ;while + ) ;t + ) ;cond + ) + +(defun web-mode-element-sibling-next () + "Fetch next sibling element." (interactive) - (let ((pos (web-mode-element-next-position (point)))) - (when pos (goto-char pos)) - pos)) + (let ((pos (point))) + (save-excursion + (cond + ((not (get-text-property pos 'tag-type)) + (if (and (web-mode-element-parent) + (web-mode-tag-match) + (web-mode-element-next)) + (setq pos (point)) + (setq pos nil)) + ) + ((eq (get-text-property pos 'tag-type) 'start) + (if (and (web-mode-tag-match) + (web-mode-element-next)) + (setq pos (point)) + (setq pos nil)) + ) + ((web-mode-element-next) + (setq pos (point))) + (t + (setq pos nil)) + ) ;cond + ) ;save-excursion + (web-mode-go pos))) -(defun web-mode-element-sibling-next () - "Fetch next element." +(defun web-mode-element-sibling-previous () + "Fetch previous sibling element." (interactive) - (let (parent ret (pos (point))) + (let ((pos (point))) (save-excursion (cond ((not (get-text-property pos 'tag-type)) - (when (and (web-mode-element-parent) - (web-mode-tag-match) - (web-mode-element-next)) - (setq ret (point)) - ) + (if (and (web-mode-element-parent) + (web-mode-tag-previous) + (web-mode-element-beginning)) + (setq pos (point)) + (setq pos nil)) ) ((eq (get-text-property pos 'tag-type) 'start) - (when (and (web-mode-tag-match) - (web-mode-element-next)) - (setq ret (point)) - ) - ) - ((web-mode-element-next) - (setq ret (point)) + (if (and (web-mode-tag-beginning) + (web-mode-tag-previous) + (web-mode-element-beginning)) + (setq pos (point)) + (setq pos nil)) ) + ((and (web-mode-element-beginning) + (web-mode-tag-previous) + (web-mode-element-beginning)) + (setq pos (point))) + (t + (setq pos nil)) ) ;cond - ) ;save - (if ret (goto-char ret)) - )) + ) ;save-excursion + (web-mode-go pos))) (defun web-mode-element-beginning () "Move to beginning of element." (interactive) - (let ((pos (point))) - (setq pos (web-mode-element-beginning-position pos)) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-element-beginning-position (point)))) (defun web-mode-element-end () "Move to end of element." (interactive) - (let ((pos (point))) - (setq pos (web-mode-element-end-position pos)) - (when pos - (setq pos (1+ pos)) - (goto-char pos)) - pos)) + (web-mode-go (web-mode-element-end-position (point)) 1)) (defun web-mode-element-parent () "Fetch parent element." (interactive) - (let ((pos (point))) - (setq pos (web-mode-element-parent-position pos)) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-element-parent-position (point)))) (defun web-mode-element-child () "Fetch child element." (interactive) - (let ((pos (point))) - (setq pos (web-mode-element-child-position pos)) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-element-child-position (point)))) (defun web-mode-dom-traverse () "Traverse html dom tree." @@ -9569,74 +10408,141 @@ Pos should be in a tag." ) ((web-mode-element-sibling-next) ) - ((web-mode-element-parent) - (unless (web-mode-element-sibling-next) - (goto-char (point-min))) - ) + ((and (web-mode-element-parent) + (not (web-mode-element-sibling-next))) + (goto-char (point-min))) + (t + (goto-char (point-min))) ) ;cond ) +(defun web-mode-closing-paren (limit) + (let ((pos (web-mode-closing-paren-position (point) limit))) + (if (or (null pos) (> pos limit)) + nil + (goto-char pos) + pos) + )) + (defun web-mode-part-next () "Move point to the beginning of the next part." (interactive) - (let ((pos (point))) - (setq pos (web-mode-part-next-position pos)) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-part-next-position (point)))) -(defun web-mode-block-opening-paren (limit) - "opening paren" - (let ((pos (point))) - (setq pos (web-mode-block-opening-paren-position pos limit)) - (when pos (goto-char pos)) - )) +(defun web-mode-part-beginning () + "Move point to the beginning of the current part." + (interactive) + (web-mode-go (web-mode-part-beginning-position (point)))) + +(defun web-mode-part-end () + "Move point to the end of the current part." + (interactive) + (web-mode-go (web-mode-part-end-position (point)) 1)) (defun web-mode-block-previous () "Move point to the beginning of the previous block." (interactive) - (let ((pos (point))) - (setq pos (web-mode-block-previous-position pos)) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-block-previous-position (point)))) (defun web-mode-block-next () "Move point to the beginning of the next block." (interactive) - (let ((pos (point))) - (setq pos (web-mode-block-next-position pos)) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-block-next-position (point)))) (defun web-mode-block-beginning () "Move point to the beginning of the current block." (interactive) - (let ((pos (point))) - (setq pos (web-mode-block-beginning-position pos)) - (when pos (goto-char pos)) - pos)) - -(defun web-mode-block-token-beginning () - "Move point to the beginning of the current block token." - (interactive) - (let ((pos (point))) - (setq pos (web-mode-block-token-beginning-position pos)) - (when pos (goto-char pos)) - pos)) + (web-mode-go (web-mode-block-beginning-position (point)))) (defun web-mode-block-end () - "web-mode-block-beg" + "Move point to the end of the current block." (interactive) - (let ((pos (point))) - (setq pos (web-mode-block-end-position pos)) - (when pos - (setq pos (1+ pos)) - (goto-char pos)) - pos)) + (web-mode-go (web-mode-block-end-position (point)) 1)) + +(defun web-mode-block-token-beginning () + (web-mode-go (web-mode-block-token-beginning-position (point)))) + +(defun web-mode-block-token-end () + (web-mode-go (web-mode-block-token-end-position (point)) 1)) + +(defun web-mode-part-token-beginning () + (web-mode-go (web-mode-part-token-beginning-position (point)))) + +(defun web-mode-part-token-end () + (web-mode-go (web-mode-part-token-end-position (point)) 1)) + +(defun web-mode-block-opening-paren (limit) + (web-mode-go (web-mode-block-opening-paren-position (point) limit))) + +(defun web-mode-block-string-beginning (&optional pos block-beg) + (unless pos (setq pos (point))) + (unless block-beg (setq block-beg (web-mode-block-beginning-position pos))) + (web-mode-go (web-mode-block-string-beginning-position pos block-beg))) + +(defun web-mode-block-statement-beginning (&optional pos block-beg) + (unless pos (setq pos (point))) + (unless block-beg (setq block-beg (web-mode-block-beginning-position pos))) + (web-mode-go (web-mode-block-statement-beginning-position pos block-beg))) + +(defun web-mode-block-args-beginning (&optional pos block-beg) + (unless pos (setq pos (point))) + (unless block-beg (setq block-beg (web-mode-block-beginning-position pos))) + (web-mode-go (web-mode-block-args-beginning-position pos block-beg))) + +(defun web-mode-block-calls-beginning (&optional pos block-beg) + (unless pos (setq pos (point))) + (unless block-beg (setq block-beg (web-mode-block-beginning-position pos))) + (web-mode-go (web-mode-block-calls-beginning-position pos block-beg))) + +(defun web-mode-javascript-string-beginning (&optional pos reg-beg) + (unless pos (setq pos (point))) + (unless reg-beg + (if (get-text-property pos 'block-side) + (setq reg-beg (web-mode-block-beginning-position pos)) + (setq reg-beg (web-mode-part-beginning-position pos)))) + (web-mode-go (web-mode-javascript-string-beginning-position pos reg-beg))) + +(defun web-mode-javascript-statement-beginning (&optional pos reg-beg) + (unless pos (setq pos (point))) + (unless reg-beg + (if (get-text-property pos 'block-side) + (setq reg-beg (web-mode-block-beginning-position pos)) + (setq reg-beg (web-mode-part-beginning-position pos)))) + (web-mode-go (web-mode-javascript-statement-beginning-position pos reg-beg))) + +(defun web-mode-javascript-args-beginning (&optional pos reg-beg) + (unless pos (setq pos (point))) + (unless reg-beg + (if (get-text-property pos 'block-side) + (setq reg-beg (web-mode-block-beginning-position pos)) + (setq reg-beg (web-mode-part-beginning-position pos)))) + (web-mode-go (web-mode-javascript-args-beginning-position pos reg-beg))) + +(defun web-mode-javascript-calls-beginning (&optional pos reg-beg) + (unless pos (setq pos (point))) + (unless reg-beg + (if (get-text-property pos 'block-side) + (setq reg-beg (web-mode-block-beginning-position pos)) + (setq reg-beg (web-mode-part-beginning-position pos)))) + (web-mode-go (web-mode-javascript-calls-beginning-position pos reg-beg))) + +(defun web-mode-go (pos &optional offset) + (unless offset (setq offset 0)) + (when pos + (cond + ((and (> offset 0) + (<= (+ pos offset) (point-max))) + (setq pos (+ pos offset))) + ((and (< offset 0) + (>= (+ pos offset) (point-min))) + (setq pos (+ pos offset))) + ) ;cond + (goto-char pos)) + pos) ;;---- SEARCH ------------------------------------------------------------------ (defun web-mode-rsf-balanced (regexp-open regexp-close &optional limit noerror) - "web-mode-rsf-balanced in client." (unless noerror (setq noerror t)) (let ((continue t) (level 1) @@ -9650,7 +10556,6 @@ Pos should be in a tag." (setq continue nil) ) (t -;; (message "%S" (match-string-no-properties 0)) (if (string-match-p regexp-open (match-string-no-properties 0)) (setq level (1+ level)) (setq level (1- level))) @@ -9661,11 +10566,9 @@ Pos should be in a tag." ) ;cond ) ;while (when (not (= level 0)) (goto-char pos)) -;; (message "ret=%S level=%S" ret level) ret)) (defun web-mode-block-sb (expr &optional limit noerror) - "re-search-backward inside a block (outside tokens)." (unless limit (setq limit (web-mode-block-beginning-position (point)))) (unless noerror (setq noerror t)) (let ((continue t) ret) @@ -9679,7 +10582,6 @@ Pos should be in a tag." ret)) (defun web-mode-block-sf (expr &optional limit noerror) - "re-search-backward inside a block (outside tokens)." (unless limit (setq limit (web-mode-block-end-position (point)))) (unless noerror (setq noerror t)) (let ((continue t) ret) @@ -9693,7 +10595,6 @@ Pos should be in a tag." ret)) (defun web-mode-block-rsb (regexp &optional limit noerror) - "re-search-backward inside a block (outside tokens)." (unless limit (setq limit (web-mode-block-beginning-position (point)))) (unless noerror (setq noerror t)) (let ((continue t) ret) @@ -9707,7 +10608,6 @@ Pos should be in a tag." ret)) (defun web-mode-block-rsf (regexp &optional limit noerror) - "re-search-backward inside a block (outside tokens)." (unless limit (setq limit (web-mode-block-end-position (point)))) (unless noerror (setq noerror t)) (let ((continue t) ret) @@ -9721,7 +10621,6 @@ Pos should be in a tag." ret)) (defun web-mode-part-sb (expr &optional limit noerror) - "search-backward inside a part (outside part tokens and blocks)." (unless limit (setq limit (web-mode-part-beginning-position (point)))) (unless noerror (setq noerror t)) (let ((continue t) ret) @@ -9737,7 +10636,6 @@ Pos should be in a tag." ret)) (defun web-mode-part-sf (expr &optional limit noerror) - "search-forward inside a part (outside part tokens and block)." (unless limit (setq limit (web-mode-part-end-position (point)))) (unless noerror (setq noerror t)) (let ((continue t) ret) @@ -9753,7 +10651,6 @@ Pos should be in a tag." ret)) (defun web-mode-part-rsb (regexp &optional limit noerror) - "re-search-backward inside a part (outside part tokens and blocks)." (unless limit (setq limit (web-mode-part-beginning-position (point)))) (unless noerror (setq noerror t)) (let ((continue t) ret) @@ -9769,7 +10666,6 @@ Pos should be in a tag." ret)) (defun web-mode-part-rsf (regexp &optional limit noerror) - "re-search-forward inside a part (outside part tokens and block)." (unless limit (setq limit (web-mode-part-end-position (point)))) (unless noerror (setq noerror t)) (let ((continue t) ret) @@ -9784,8 +10680,41 @@ Pos should be in a tag." ) ;while ret)) +(defun web-mode-javascript-rsb (regexp &optional limit noerror) + (unless limit (setq limit (web-mode-part-beginning-position (point)))) + (unless noerror (setq noerror t)) + (let ((continue t) ret) + (while continue + (setq ret (re-search-backward regexp limit noerror)) + (when (or (null ret) + (and (not (get-text-property (point) 'part-token)) + (not (get-text-property (point) 'part-element)) + (not (get-text-property (point) 'block-side))) + ) + (setq continue nil) + ) ;when + ) ;while + ret)) + +(defun web-mode-javascript-rsf (regexp &optional limit noerror) + (unless limit (setq limit (web-mode-part-end-position (point)))) + (unless noerror (setq noerror t)) + (let ((continue t) ret) + (while continue + (setq ret (re-search-forward regexp limit t)) + (when (or (null ret) + (and (not (get-text-property (point) 'part-token)) + (not (get-text-property (point) 'part-element)) + (not (get-text-property (point) 'block-side)) + ;;(not (get-text-property (point) 'part-element)) + ) + ) + (setq continue nil) + ) ;when + ) ;while + ret)) + (defun web-mode-dom-sf (expr &optional limit noerror) - "search-forward outside blocks." (unless noerror (setq noerror t)) (let ((continue t) ret) (while continue @@ -9797,7 +10726,6 @@ Pos should be in a tag." ret)) (defun web-mode-dom-rsf (regexp &optional limit noerror) - "re-search-forward outside blocks." (unless noerror (setq noerror t)) (let ((continue t) (ret nil)) (while continue @@ -9810,7 +10738,6 @@ Pos should be in a tag." ret)) (defun web-mode-rsb (regexp &optional limit noerror) - "re-search-backward not in comment or string." (unless noerror (setq noerror t)) (let ((continue t) ret) (while continue @@ -9821,7 +10748,6 @@ Pos should be in a tag." ret)) (defun web-mode-rsf (regexp &optional limit noerror) - "re-search-forward not in comment or string." (unless noerror (setq noerror t)) (let ((continue t) ret) (while continue @@ -9833,7 +10759,6 @@ Pos should be in a tag." ret)) (defun web-mode-sb (expr &optional limit noerror) - "re-search-backward not in comment or string." (unless noerror (setq noerror t)) (let ((continue t) ret) (while continue @@ -9844,7 +10769,6 @@ Pos should be in a tag." ret)) (defun web-mode-sf (expr &optional limit noerror) - "re-search-backward not in comment or string." (unless noerror (setq noerror t)) (let ((continue t) ret) (while continue @@ -9854,8 +10778,7 @@ Pos should be in a tag." (setq continue nil))) ret)) -(defun web-mode-rsf-content (regexp &optional limit noerror) - "re-search-forward only in html content." +(defun web-mode-content-rsf (regexp &optional limit noerror) (unless noerror (setq noerror t)) (let ((continue t) ret beg end) (while continue @@ -9868,98 +10791,6 @@ Pos should be in a tag." (setq continue nil))) ret)) -(defun web-mode-is-comment-or-string-line () - "Detect if current line is in a comment or in a string." - (save-excursion - (let ((continue t) (counter 0)) - (beginning-of-line) - (back-to-indentation) - (while (and continue (not (eolp))) - (cond - ((web-mode-is-comment-or-string) - (setq counter (1+ counter))) - ((not (eq ?\s (following-char))) - (setq continue nil - counter 0)) - ) ;cond - (forward-char) - ) ;while - (> counter 0) - ))) - -(defun web-mode-block-is-token-line () - "Detect if current line is a comment or a string." - (save-excursion - (let ((continue t) (counter 0)) - (beginning-of-line) - (back-to-indentation) - (while (and continue (not (eolp))) - (cond - ((web-mode-block-is-token) - (setq counter (1+ counter))) - ((not (eq ?\s (following-char))) - (setq continue nil - counter 0)) - ) ;cond - (forward-char) - ) ;while - (> counter 0) - ))) - -(defun web-mode-is-part-token-or-server (&optional pos) - "Detect if POS is in a comment, a string or in server script." - (unless pos (setq pos (point))) - (not (null (or (get-text-property pos 'block-side) - (member (get-text-property pos 'part-token) '(comment string))))) - ) - -(defun web-mode-is-part-token-line () - "Detect if current line has only client tokens (string/comment) or server blocks." - (save-excursion - (let ((continue t) (counter 0)) - (beginning-of-line) - (while (and continue (not (eolp))) - (if (web-mode-is-part-token-or-server) - (setq counter (1+ counter)) - (when (not (eq ?\s (following-char))) - (setq continue nil - counter 0)) - ) ;if - (forward-char) - ) ;while - (> counter 0) - ))) - -(defun web-mode-is-content (&optional pos) - "Is pos in a html text." - (unless pos (setq pos (point))) - (not (or (get-text-property pos 'part-side) - (get-text-property pos 'tag-type) - (get-text-property pos 'block-side) - ))) - -(defun web-mode-block-is-token (&optional pos) - "Detect if point is in a comment or in a string." - (unless pos (setq pos (point))) - (not (null (get-text-property pos 'block-token))) - ) - -(defun web-mode-is-comment-or-string (&optional pos) - "Detect if point is in a comment or in a string." - (unless pos (setq pos (point))) - (not (null (or (eq (get-text-property pos 'tag-type) 'comment) - (member (get-text-property pos 'block-token) '(comment string)) - (member (get-text-property pos 'part-token) '(comment string))))) - ) - -(defun web-mode-is-comment (&optional pos) - "Detect if point is in a comment." - (unless pos (setq pos (point))) - (not (null (or (eq (get-text-property pos 'tag-type) 'comment) - (eq (get-text-property pos 'block-token) 'comment) - (eq (get-text-property pos 'part-token) 'comment)))) - ) - ;;---- ADVICES ----------------------------------------------------------------- (defadvice ac-start (before web-mode-set-up-ac-sources activate) @@ -9967,10 +10798,11 @@ Pos should be in a tag." (if (equal major-mode 'web-mode) (progn (run-hooks 'web-mode-before-auto-complete-hooks) - (let ((new-web-mode-ac-sources - (assoc (web-mode-language-at-pos) - web-mode-ac-sources-alist))) - (setq ac-sources (cdr new-web-mode-ac-sources)))))) + (when web-mode-ac-sources-alist + (let ((new-web-mode-ac-sources + (assoc (web-mode-language-at-pos) + web-mode-ac-sources-alist))) + (setq ac-sources (cdr new-web-mode-ac-sources))))))) ;;---- MINOR MODE ADDONS ------------------------------------------------------- @@ -9981,7 +10813,7 @@ Pos should be in a tag." (defun web-mode-imenu-index () (interactive) - "return imenu items" + "Returns imenu items." (let (toc-index line) (save-excursion @@ -10052,14 +10884,19 @@ Pos should be in a tag." ;;---- UNIT TESTING ------------------------------------------------------------ (defun web-mode-test () - "Exec web-mode unit tests. See web-mode-tests-directory." + "Executes web-mode unit tests. See `web-mode-tests-directory'." (interactive) (let (files ret regexp) - (setq regexp "^[[:alnum:]][[:alnum:].]+\\'") -;; (setq regexp "a\\.jsx\\'") + (setq regexp "^[[:alnum:]][[:alnum:]._]+\\'") (setq files (directory-files web-mode-tests-directory t regexp)) (dolist (file files) - (setq ret (web-mode-test-process file))) + (cond + ((eq (string-to-char (file-name-nondirectory file)) ?\_) + (delete-file file)) + (t + (setq ret (web-mode-test-process file))) + ) ;cond + ) ;dolist )) (defun web-mode-test-process (file) @@ -10092,31 +10929,36 @@ Pos should be in a tag." ;;---- MISC -------------------------------------------------------------------- (defun web-mode-set-engine (engine) - "set engine" + "Set the engine for the current buffer." (interactive (list (completing-read "Engine: " - (let (engines elt) + (let (engines) (dolist (elt web-mode-engines) (setq engines (append engines (list (car elt))))) engines)))) (setq web-mode-content-type "html" - web-mode-engine engine) + web-mode-engine (web-mode-engine-canonical-name engine) + web-mode-minor-engine engine) (web-mode-on-engine-setted) (web-mode-buffer-highlight)) (defun web-mode-set-content-type (content-type) - "set engine" (setq web-mode-content-type content-type) (web-mode-buffer-highlight)) (defun web-mode-on-engine-setted () - "engine setted" (let (elt elts engines) + (when (string= web-mode-engine "razor") (setq web-mode-enable-block-face t)) (setq web-mode-engine-attr-regexp (cdr (assoc web-mode-engine web-mode-engine-attr-regexps))) (setq web-mode-engine-token-regexp (cdr (assoc web-mode-engine web-mode-engine-token-regexps))) + ;;(message "%S %S" web-mode-engine-attr-regexp web-mode-engine) + + (when (null web-mode-minor-engine) + (setq web-mode-minor-engine "none")) + (setq elt (assoc web-mode-engine web-mode-engine-open-delimiter-regexps)) (if elt (setq web-mode-block-regexp (cdr elt)) @@ -10147,24 +10989,36 @@ Pos should be in a tag." (setq web-mode-snippets (append (list elt) web-mode-snippets))) ) -;; (message "wms=%S" web-mode-snippets) - - (setq web-mode-closing-blocks (cdr (assoc web-mode-engine web-mode-engines-closing-blocks))) - (setq web-mode-engine-font-lock-keywords (symbol-value (cdr (assoc web-mode-engine web-mode-engines-font-lock-keywords)))) + (when (and (string= web-mode-minor-engine "jinja") + (not (member "endtrans" web-mode-django-control-blocks))) + (add-to-list 'web-mode-django-control-blocks "endtrans") + (setq web-mode-django-control-blocks-regexp + (regexp-opt web-mode-django-control-blocks t)) + ) + ;; (message "%S" (symbol-value (cdr (assoc web-mode-engine web-mode-engines-font-lock-keywords)))) )) +(defun web-mode-detect-engine () + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "-\\*- engine:[ ]*\\([[:alnum:]-]+\\)[ ]*-\\*-" web-mode-chunk-length t) + (setq web-mode-minor-engine (match-string-no-properties 1)) + (setq web-mode-engine (web-mode-engine-canonical-name web-mode-minor-engine))) + web-mode-minor-engine)) + (defun web-mode-guess-engine-and-content-type () - "Try to guess the server engine and the content type." (let (buff-name elt found) + (setq buff-name (buffer-file-name)) (unless buff-name (setq buff-name (buffer-name))) (setq web-mode-is-scratch (string= buff-name "*scratch*")) (setq web-mode-content-type nil) + (when (boundp 'web-mode-content-types-alist) (setq found nil) (dolist (elt web-mode-content-types-alist) @@ -10173,6 +11027,7 @@ Pos should be in a tag." found t)) ) ;dolist ) ;when + (unless web-mode-content-type (setq found nil) (dolist (elt web-mode-content-types) @@ -10181,6 +11036,7 @@ Pos should be in a tag." found t)) ) ;dolist ) ;unless + (when (boundp 'web-mode-engines-alist) (setq found nil) (dolist (elt web-mode-engines-alist) @@ -10194,75 +11050,70 @@ Pos should be in a tag." ) ;cond ) ;dolist ) ;when + (unless web-mode-engine (setq found nil) (dolist (elt web-mode-engine-file-regexps) -;; (message "%S %S" (cdr elt) buff-name) + ;;(message "%S %S" (cdr elt) buff-name) (when (and (not found) (string-match-p (cdr elt) buff-name)) (setq web-mode-engine (car elt) found t)) ) ) - (unless web-mode-engine - (setq found nil) - (dolist (elt web-mode-engines) -;; (message "%S %S" (car elt) buff-name) - (when (and (not found) (string-match-p (car elt) buff-name)) - (setq web-mode-engine (car elt) - found t)) - ) - ) - ;; TODO : remplacer par web-mode-engine-canonical-name - (when web-mode-engine - (setq found nil) - (dolist (elt web-mode-engines) -;; (message "%S" elt) - (when (and (not found) (member web-mode-engine (cdr elt))) - (setq web-mode-engine (car elt) - found t)) - ) - ) - (when (and (null found) + + ;; (unless web-mode-engine + ;; (setq found nil) + ;; (dolist (elt web-mode-engines) + ;; (when (and (not found) (string-match-p (car elt) buff-name)) + ;; (setq web-mode-engine (car elt) + ;; found t)) + ;; ) + ;; ) + + (when (and (or (null web-mode-engine) (string= web-mode-engine "none")) (string-match-p "php" (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) - (setq web-mode-engine "php" - found t) - ) + (setq web-mode-engine "php")) + (when (and (string= web-mode-content-type "javascript") (string-match-p "@jsx" - (buffer-substring-no-properties - (point-min) - (if (< (point-max) web-mode-chunk-length) - (point-max) - web-mode-chunk-length) - ))) - (setq web-mode-content-type "jsx") - ) ;when - (when (and web-mode-enable-engine-detection - (or (null web-mode-engine) - (string= web-mode-engine "none"))) - ;;(message "%S %S" web-mode-enable-engine-detection web-mode-engine) + (buffer-substring-no-properties + (point-min) + (if (< (point-max) web-mode-chunk-length) + (point-max) + web-mode-chunk-length) + ))) + (setq web-mode-content-type "jsx")) + + (when web-mode-engine + (setq web-mode-minor-engine web-mode-engine + web-mode-engine (web-mode-engine-canonical-name web-mode-engine)) + ) + + (when (and (or (null web-mode-engine) + (string= web-mode-engine "none")) + web-mode-enable-engine-detection) (web-mode-detect-engine)) + (web-mode-on-engine-setted) + )) (defun web-mode-engine-canonical-name (name) (let (engine) (cond ((null name) - ) + nil) ((assoc name web-mode-engines) - (setq engine name)) + name) (t (dolist (elt web-mode-engines) (when (and (null engine) (member name (cdr elt))) (setq engine (car elt))) ) ;dolist - ) ;t - ) - ;;(message "name=%S engine=%S" name engine) - engine)) + engine) + ))) (defun web-mode-on-after-save () (when web-mode-is-scratch @@ -10271,8 +11122,6 @@ Pos should be in a tag." nil) (defun web-mode-on-exit () - "Exit web-mode." - (interactive) (web-mode-with-silent-modifications (put-text-property (point-min) (point-max) 'invisible nil) (remove-overlays) @@ -10283,21 +11132,16 @@ Pos should be in a tag." "Reload web-mode." (interactive) (web-mode-with-silent-modifications - (put-text-property (point-min) (point-max) 'invisible nil) - (remove-overlays) - (unload-feature 'web-mode t) - (load "web-mode.el") - (setq web-mode-change-beg nil - web-mode-change-end nil) - (web-mode) - (when (fboundp 'web-mode-hook) - (web-mode-hook)) - ) ;silent - ) + (put-text-property (point-min) (point-max) 'invisible nil) + (remove-overlays) + (setq font-lock-unfontify-region-function 'font-lock-default-unfontify-region) + (load "web-mode.el") + (setq web-mode-change-beg nil + web-mode-change-end nil) + (web-mode) + )) (defun web-mode-trace (msg) - "Benchmark." - (interactive) (let (sub) ;; (when (null web-mode-time) (setq web-mode-time (current-time))) (setq sub (time-subtract (current-time) web-mode-time)) @@ -10314,33 +11158,38 @@ Pos should be in a tag." )) (defun web-mode-reveal () - "Display text properties at point" + "Display text properties at point." (interactive) - (let (symbol symbols out) - (setq out (format "[point=%S engine=%S content-type=%S language-at-pos=%S]\n" - (point) - web-mode-engine - web-mode-content-type - (web-mode-language-at-pos (point)))) - (setq symbols (append web-mode-scan-properties '(font-lock-face))) + (let (symbols out) + (setq out (format + "[point=%S engine=%S minor=%S content-type=%S language-at-pos=%S]\n" + (point) + web-mode-engine + web-mode-minor-engine + web-mode-content-type + (web-mode-language-at-pos (point)))) + (setq symbols (append web-mode-scan-properties '(font-lock-face face))) (dolist (symbol symbols) (when symbol (setq out (concat out (format "%s(%S) " (symbol-name symbol) (get-text-property (point) symbol))))) ) (message "%s\n" out) - (message nil) - )) + ;;(message "syntax-class=%S" (syntax-class (syntax-after (point)))) + (message nil))) (defun web-mode-debug () - "Display informations useful for debuging" + "Display informations useful for debugging." (interactive) - (let (modes) + (let ((modes nil) + (customs '(web-mode-enable-current-column-highlight web-mode-enable-current-element-highlight indent-tabs-mode)) + (ignore '(abbrev-mode auto-composition-mode auto-compression-mode auto-encryption-mode auto-insert-mode blink-cursor-mode column-number-mode delete-selection-mode display-time-mode electric-indent-mode file-name-shadow-mode font-lock-mode global-font-lock-mode global-hl-line-mode line-number-mode menu-bar-mode mouse-wheel-mode recentf-mode show-point-mode tool-bar-mode tooltip-mode transient-mark-mode))) (message "\n") (message "--- WEB-MODE DEBUG BEG ---") (message "versions: emacs(%S.%S) web-mode(%S)" emacs-major-version emacs-minor-version web-mode-version) - (message "vars: engine(%S) content-type(%S) file(%S)" + (message "vars: engine(%S) minor(%S) content-type(%S) file(%S)" web-mode-engine + web-mode-minor-engine web-mode-content-type (or (buffer-file-name) (buffer-name))) (message "system: window(%S) config(%S)" window-system system-configuration) @@ -10349,62 +11198,26 @@ Pos should be in a tag." (cdr (assoc 'background-color default-frame-alist))) (mapc (lambda (mode) (condition-case nil - (if (and (symbolp mode) (symbol-value mode)) + (if (and (symbolp mode) (symbol-value mode) (not (member mode ignore))) (add-to-list 'modes mode)) (error nil)) ) ;lambda minor-mode-list) (message "minor modes: %S" modes) + (message "vars:") + (dolist (custom customs) + (message (format "%s=%S " (symbol-name custom) (symbol-value custom)))) (message "--- WEB-MODE DEBUG END ---") (switch-to-buffer "*Messages*") (goto-char (point-max)) (recenter) )) -;;; web-mode.el ends here (provide 'web-mode) +;;; web-mode.el ends here + ;; Local Variables: ;; coding: utf-8 ;; indent-tabs-mode: nil ;; End: - -;;---- TODO -------------------------------------------------------------------- -;;- parameter for function chaining -;;- supprimer 2 flags sur blocks -;;- phphint -;;- tag-name uniquement sur les html tag -;;- Stickiness of Text Properties -;;- screenshot : http://www.cockos.com/licecap/ -;;- tester shortcut A -> pour pomme - -;; (defun web-mode-indent-cycle (regex-line regex-sym block-beg indent-offset) -;; "Returns next position in the indent cycle for REGEX-SYM on -;; positions from the previous line matching REGEX-LINE withing -;; BLOCK-BEGIN. Loops to start at INDENT-OFFSET." -;; (letrec -;; ((match-indices-all (lambda (regex string) -;; (let ((i (string-match-p regex string))) -;; (if i (cons -;; i -;; (mapcar (lambda (x) (+ x i 1)) -;; (funcall match-indices-all regex -;; (substring string (+ i 1))))))))) -;; (filter (lambda (condp lst) -;; (delq nil -;; (mapcar (lambda (x) -;; (and (funcall condp x) x)) lst)))) -;; (this-line (thing-at-point 'line)) -;; (rsb-prev-line (progn -;; (web-mode-rsb regex-line block-beg) -;; (thing-at-point 'line))) -;; (pos-of-this-sym (string-match-p regex-sym this-line)) -;; (prev-sym-locations (funcall match-indices-all regex-sym rsb-prev-line)) -;; (farther-syms (progn -;; (add-to-list 'prev-sym-locations (+ indent-offset web-mode-code-indent-offset)) -;; (funcall filter (lambda (i) (> i pos-of-this-sym)) -;; (sort prev-sym-locations '<))))) -;; (cond ((null farther-syms) indent-offset) -;; ((or web-mode-indent-cycle-left-first -;; (equal last-command 'indent-for-tab-command)) (car farther-syms)) -;; (t (car (last farther-syms))))))