[elpa] master 489378f 1/9: Avoid confusion when an alias matches the current name

2015-09-09 Thread Artur Malabarba
branch: master
commit 489378f718333aa713c50fbb26baae4419eeffe7
Author: Artur Malabarba 
Commit: Artur Malabarba 

Avoid confusion when an alias matches the current name
---
 nameless.el |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/nameless.el b/nameless.el
index 6737aa0..415dfe0 100644
--- a/nameless.el
+++ b/nameless.el
@@ -98,11 +98,12 @@ for it to take effect."
 (defvar nameless-mode)
 (defun nameless--compose-as (display)
   "Compose the matched region and return a face spec."
-  (when nameless-mode
+  (when (and nameless-mode
+ (not (get-text-property (match-beginning 0) 'composition)))
 (let ((compose (save-match-data
  (and nameless-affect-indentation-and-filling
- (or (not (eq nameless-affect-indentation-and-filling 
'outside-strings))
- (not (nth 3 (syntax-ppss)))
+  (or (not (eq nameless-affect-indentation-and-filling 
'outside-strings))
+  (not (nth 3 (syntax-ppss)))
   (dis (concat display nameless-prefix)))
   (when compose
 (compose-region (match-beginning 1)
@@ -128,7 +129,7 @@ for it to take effect."
 \(fn (regexp . display) [(regexp . display) ...])"
   (setq-local font-lock-extra-managed-props
   `(composition display ,@font-lock-extra-managed-props))
-  (let ((kws (mapcar (lambda (x) `(,(nameless--name-regexp (cdr x)) 1 
(nameless--compose-as ,(car x)) prepend)) r)))
+  (let ((kws (mapcar (lambda (x) `(,(nameless--name-regexp (cdr x)) 1 
(nameless--compose-as ,(car x r)))
 (setq nameless--font-lock-keywords kws)
 (font-lock-add-keywords nil kws t))
   (nameless--ensure))
@@ -171,7 +172,8 @@ configured, or if `nameless-current-name' is nil."
(assoc alias nameless-global-aliases))
 (if full-name
 (progn (delete-region l r)
-   (insert full-name "-"))
+   (insert full-name "-")
+   t)
   (unless noerror
 (user-error "No name for alias `%s', see `nameless-aliases'" 
alias
 (if nameless-current-name



[elpa] master c97ac2b 4/9: Merge pull request #4 from cpitclaudel/master

2015-09-09 Thread Artur Malabarba
branch: master
commit c97ac2b9d216e54f37aa4f5724a3f143b931994a
Merge: 89a74bb e0f5357
Author: Artur Malabarba 
Commit: Artur Malabarba 

Merge pull request #4 from cpitclaudel/master

Add a missing 'delete-selection property
---
 nameless.el |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/nameless.el b/nameless.el
index 26b1024..c2837e2 100644
--- a/nameless.el
+++ b/nameless.el
@@ -194,6 +194,8 @@ configured, or if `nameless-current-name' is nil."
 (or (nameless-insert-name 'noerror)
 (call-interactively #'self-insert-command
 
+(put 'nameless-insert-name-or-self-insert 'delete-selection t)
+
 (defun nameless--name-regexp (name)
   "Return a regexp of the current name."
   (concat "\\_<@?\\(" (regexp-quote name) "-\\)\\(\\s_\\|\\sw\\)"))



[elpa] master e0f5357 3/9: Add a missing 'delete-selection property

2015-09-09 Thread Artur Malabarba
branch: master
commit e0f5357e370c39b33ec4cf653a2c81eade6f2583
Author: Clément Pit--Claudel 
Commit: Clément Pit--Claudel 

Add a missing 'delete-selection property

This is needed for delete-selection-mode to work properly:

> Commands which will delete the selection need a 'delete-selection
> property on their symbols; commands which insert text but don't have
> this property won't delete the selection.
---
 nameless.el |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/nameless.el b/nameless.el
index 26b1024..c2837e2 100644
--- a/nameless.el
+++ b/nameless.el
@@ -194,6 +194,8 @@ configured, or if `nameless-current-name' is nil."
 (or (nameless-insert-name 'noerror)
 (call-interactively #'self-insert-command
 
+(put 'nameless-insert-name-or-self-insert 'delete-selection t)
+
 (defun nameless--name-regexp (name)
   "Return a regexp of the current name."
   (concat "\\_<@?\\(" (regexp-quote name) "-\\)\\(\\s_\\|\\sw\\)"))



[elpa] master updated (a1c9e99 -> 8ad76a7)

2015-09-09 Thread Artur Malabarba
malabarba pushed a change to branch master.

  from  a1c9e99   Merge commit '6abd4f4fe740054d433d928d90fb1671cce6719c'
   new  489378f   Avoid confusion when an alias matches the current name
   new  89a74bb   Avoid further confusion when an alias matches the current 
name
   new  e0f5357   Add a missing 'delete-selection property
   new  c97ac2b   Merge pull request #4 from cpitclaudel/master
   new  fe3829f   Improve documentation and change keybind from _ to C-c C--
   new  b580ee6   [Fix #6] Local variables not being used
   new  6fd3a49   Fix doc
   new  6087323   Version bump
   new  8ad76a7   Merge commit '60873230991f7a0cd3175eb578fee34c7e238fb3'


Summary of changes:
 packages/nameless/README.org  |   81 ++---
 packages/nameless/nameless.el |   36 +++
 2 files changed, 104 insertions(+), 13 deletions(-)



[elpa] master 8ad76a7 9/9: Merge commit '60873230991f7a0cd3175eb578fee34c7e238fb3'

2015-09-09 Thread Artur Malabarba
branch: master
commit 8ad76a71b3023cf715c6dbc25cfa64468174c6b7
Merge: a1c9e99 6087323
Author: Artur Malabarba 
Commit: Artur Malabarba 

Merge commit '60873230991f7a0cd3175eb578fee34c7e238fb3'
---
 packages/nameless/README.org  |   81 ++---
 packages/nameless/nameless.el |   36 +++
 2 files changed, 104 insertions(+), 13 deletions(-)

diff --git a/packages/nameless/README.org b/packages/nameless/README.org
index 12d5fe5..75f8835 100644
--- a/packages/nameless/README.org
+++ b/packages/nameless/README.org
@@ -14,7 +14,7 @@ the *right* has ~nameless-mode~ turned on.\\
 To use this package add the following configuration to your Emacs init file.
 
 #+BEGIN_SRC emacs-lisp
-(add-hook 'emacs-lisp-mode-hook #'nameless-mode)
+(add-hook 'emacs-lisp-mode-hook #'nameless-mode-from-hook)
 #+END_SRC
 
 You can configure a string to use instead of ~:~ by setting the
@@ -22,16 +22,85 @@ You can configure a string to use instead of ~:~ by setting 
the
 You can even just hide the prefix completely by setting this variable
 to an empty string.
 
-While the mode is active, the =_= key inserts the package namespace if
-appropriate.
+While the mode is active, the C-c C-- key inserts the
+package namespace if appropriate.
 
 * Configuration
 
+** Quickly typing the namespace
+~nameless-mode~ binds the C-c C-- key to
+~nameless-insert-name~, which immediately inserts the current name for
+you, or even expands aliases to the names they point to.
+
+Let’s say you’re in a file called ~foo-bar.el~.
+#+BEGIN_SRC text
+   C-c C-- → foo-bar-
+fl C-c C-- → font-lock-
+#+END_SRC
+
+There’s also a command called ~nameless-insert-name-or-self-insert~.
+You can bind this to the _ key and make it even faster to
+insert the name.
+** Configuring the namespace name
+Nameless guesses the package name with the ~lm-get-package-name~
+function, but sometimes this might not match the name you want to use.
+
+In these situations, simply set ~nameless-current-name~ as file-local variable.
+To do that, invoke the following command:
+#+BEGIN_SRC text
+M-x add-file-local-variable RET nameless-current-name RET "package-name"
+#+END_SRC
+You can also set the same name for all lisp files in a project by
+setting dir-local variables with ~M-x add-file-local-variable~.
+
+** Requiring other packages as aliases
 Nameless can also be used to “import” other packages as aliases. For
 instance, in the default behaviour, functions in the ~font-lock~
 package (e.g., ~font-lock-add-keywords~) will be displayed with the
 ~fl:~ prefix (e.g., ~fl:add-keywords~).
 
-You can configure your own aliases globally with
-~nameless-global-aliases~, and on a file-local basis with
-~nameless-aliases~.
+You can configure your own aliases globally with ~nameless-global-aliases~.
+#+BEGIN_SRC emacs-lisp
+(setq nameless-global-aliases '(("fl" . "font-lock")
+("s" . "seq")
+("me" . "macroexp")
+("c" . "cider")
+("q" . "queue")))
+#+END_SRC
+
+You can also configure aliases per-file by setting ~nameless-aliases~
+as a file-local variable.
+#+BEGIN_SRC emacs-lisp
+;; Local Variables:
+;; nameless-aliases: (("c" . "cider"))
+;; End:
+#+END_SRC
+/Note that there’s no ~quote~ before ~((c~!/\\
+You can also configure it for a whole project, by setting it as a dir-local 
variable.
+
+** Indentation and paragraph filling
+Hiding parts of symbols could affect the way Emacs indents your code
+and fills your paragraphs. Nameless lets you decide whether you want
+that to happen or not. 
+
+The default behavior is that code is indented according to what you
+see (i.e., according to short symbols), but text inside strings is
+*not*. So text inside strings will be filled in the same way as if you
+didn’t have ~nameless-mode~. Here’s how a docstring might be filled
+with ~nameless-mode~ enabled:
+#+BEGIN_SRC text
+If point is immediately after an alias configured in the name you
+had in `:aliases' or `:global-aliases', replace
+it with the full name for that alias.
+#+END_SRC
+Altough it may look strange that the second line is so short, that’s
+the correct way. When view on a ~*Help*~ buffer, that docstring will
+look like this:
+#+BEGIN_SRC text
+If point is immediately after an alias configured in the name you
+had in `nameless-aliases' or `nameless-global-aliases', replace
+it with the full name for that alias.
+#+END_SRC
+
+To change this behavior, configure the variable
+~nameless-affect-indentation-and-filling~.
diff --git a/packages/nameless/nameless.el b/packages/nameless/nameless.el
index 6737aa0..a0d5177 100644
--- a/packages/nameless/nameless.el
+++ b/packages/nameless/nameless.el
@@ -4,7 +4,7 @@
 
 ;; Author: Artur Malabarba 
 ;; Keywords: convenience, lisp
-;; Version: 0.3.1
+;; Version: 0.4
 ;; Package-Requires: ((emacs "24.4"))
 
 ;; This program is free software; you can redistribute it and/or modify
@

[elpa] master fe3829f 5/9: Improve documentation and change keybind from _ to C-c C--

2015-09-09 Thread Artur Malabarba
branch: master
commit fe3829f89930cd9c129dd753df75a6702301423c
Author: Artur Malabarba 
Commit: Artur Malabarba 

Improve documentation and change keybind from _ to C-c C--

Fix #5
---
 README.org  |   76 +++
 nameless.el |2 +-
 2 files changed, 72 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index 12d5fe5..c65ef3b 100644
--- a/README.org
+++ b/README.org
@@ -22,16 +22,82 @@ You can configure a string to use instead of ~:~ by setting 
the
 You can even just hide the prefix completely by setting this variable
 to an empty string.
 
-While the mode is active, the =_= key inserts the package namespace if
-appropriate.
+While the mode is active, the C-c C-- key inserts the
+package namespace if appropriate.
 
 * Configuration
 
+** Quickly typing the namespace
+~nameless-mode~ binds the C-c C-- key to
+~nameless-insert-name~, which immediately inserts the current name for
+you, or even expands aliases to the names they point to.
+
+Let’s say you’re in a file called ~foo-bar.el~.
+#+BEGIN_SRC text
+   C-c C-- → foo-bar-
+fl C-c C-- → font-lock-
+#+END_SRC
+
+There’s also a command called ~nameless-insert-name-or-self-insert~.
+You can bind this to the _ key and make it even faster to
+insert the name.
+** Configuring the namespace name
+Nameless guesses the package name with the ~lm-get-package-name~
+function, but sometimes this might not match the name you want to use.
+
+In these situations, simply set ~nameless-current-name~ as file-local variable.
+To do that, invoke the following command:
+#+BEGIN_SRC text
+M-x add-file-local-variable RET nameless-current-name RET "package-name"
+#+END_SRC
+You can also set the same name for all lisp files in a project by
+setting dir-local variables with ~M-x add-file-local-variable~.
+
+** Requiring other packages as aliases
 Nameless can also be used to “import” other packages as aliases. For
 instance, in the default behaviour, functions in the ~font-lock~
 package (e.g., ~font-lock-add-keywords~) will be displayed with the
 ~fl:~ prefix (e.g., ~fl:add-keywords~).
 
-You can configure your own aliases globally with
-~nameless-global-aliases~, and on a file-local basis with
-~nameless-aliases~.
+You can configure your own aliases globally with ~nameless-global-aliases~.
+#+BEGIN_SRC emacs-lisp
+(setq nameless-global-aliases '(("fl" . "font-lock")
+("s" . "seq")
+("me" . "macroexp")
+("c" . "cider")
+("q" . "queue")))
+#+END_SRC
+
+You can also configure aliases per-file by setting ~nameless-aliases~ as a 
file-local variable.
+#+BEGIN_SRC emacs-lisp
+;; Local Variables:
+;; nameless-aliases: (quote (("c" . "cider")))
+;; End:
+#+END_SRC
+Or you can configure it for a whole project, by setting it as a dir-local 
variable.
+
+** Indentation and paragraph filling
+Hiding parts of symbols could affect the way Emacs indents your code
+and fills your paragraphs. Nameless lets you decide whether you want
+that to happen or not. 
+
+The default behavior is that code is indented according to what you
+see (i.e., according to short symbols), but text inside strings is
+*not*. So text inside strings will be filled in the same way as if you
+didn’t have ~nameless-mode~. Here’s how a docstring might be filled
+with ~nameless-mode~ enabled:
+#+BEGIN_SRC text
+If point is immediately after an alias configured in the name you
+had in `:aliases' or `:global-aliases', replace
+it with the full name for that alias.
+#+END_SRC
+Altough it may look strange that the second line is so short, that’s
+the correct way. When view on a ~*Help*~ buffer, that docstring will
+look like this:
+#+BEGIN_SRC text
+If point is immediately after an alias configured in the name you
+had in `nameless-aliases' or `nameless-global-aliases', replace
+it with the full name for that alias.
+#+END_SRC
+
+To change this behavior, configure the variable 
~nameless-affect-indentation-and-filling~.
diff --git a/nameless.el b/nameless.el
index c2837e2..83f4533 100644
--- a/nameless.el
+++ b/nameless.el
@@ -211,7 +211,7 @@ Return S."
 ;;; Minor mode
 ;;;###autoload
 (define-minor-mode nameless-mode
-  nil nil " :" '(("_" . nameless-insert-name-or-self-insert))
+  nil nil " :" `((,(kbd "C-c C--") . nameless-insert-name))
   (if nameless-mode
   (if (or nameless-current-name
   (ignore-errors (string-match "\\.el\\'" (lm-get-package-name



[elpa] master 6087323 8/9: Version bump

2015-09-09 Thread Artur Malabarba
branch: master
commit 60873230991f7a0cd3175eb578fee34c7e238fb3
Author: Artur Malabarba 
Commit: Artur Malabarba 

Version bump
---
 nameless.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/nameless.el b/nameless.el
index 82dc1a3..a0d5177 100644
--- a/nameless.el
+++ b/nameless.el
@@ -4,7 +4,7 @@
 
 ;; Author: Artur Malabarba 
 ;; Keywords: convenience, lisp
-;; Version: 0.3.1
+;; Version: 0.4
 ;; Package-Requires: ((emacs "24.4"))
 
 ;; This program is free software; you can redistribute it and/or modify



[elpa] master 89a74bb 2/9: Avoid further confusion when an alias matches the current name

2015-09-09 Thread Artur Malabarba
branch: master
commit 89a74bbffb6ba2c419c039b4422326c1385edcc7
Author: Artur Malabarba 
Commit: Artur Malabarba 

Avoid further confusion when an alias matches the current name
---
 nameless.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/nameless.el b/nameless.el
index 415dfe0..26b1024 100644
--- a/nameless.el
+++ b/nameless.el
@@ -99,7 +99,8 @@ for it to take effect."
 (defun nameless--compose-as (display)
   "Compose the matched region and return a face spec."
   (when (and nameless-mode
- (not (get-text-property (match-beginning 0) 'composition)))
+ (not (get-text-property (match-beginning 1) 'composition))
+ (not (get-text-property (match-beginning 1) 'display)))
 (let ((compose (save-match-data
  (and nameless-affect-indentation-and-filling
   (or (not (eq nameless-affect-indentation-and-filling 
'outside-strings))



[elpa] master b580ee6 6/9: [Fix #6] Local variables not being used

2015-09-09 Thread Artur Malabarba
branch: master
commit b580ee639571abb25a01d12313ce956c9543afaf
Author: Artur Malabarba 
Commit: Artur Malabarba 

[Fix #6] Local variables not being used
---
 README.org  |   11 +++
 nameless.el |   17 +
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index c65ef3b..3e28eb9 100644
--- a/README.org
+++ b/README.org
@@ -68,13 +68,15 @@ You can configure your own aliases globally with 
~nameless-global-aliases~.
 ("q" . "queue")))
 #+END_SRC
 
-You can also configure aliases per-file by setting ~nameless-aliases~ as a 
file-local variable.
+You can also configure aliases per-file by setting ~nameless-aliases~
+as a file-local variable.
 #+BEGIN_SRC emacs-lisp
 ;; Local Variables:
-;; nameless-aliases: (quote (("c" . "cider")))
+;; nameless-aliases: (("c" . "cider"))
 ;; End:
 #+END_SRC
-Or you can configure it for a whole project, by setting it as a dir-local 
variable.
+/Note that there’s no ~quote~ before ~((c~!/\\
+You can also configure it for a whole project, by setting it as a dir-local 
variable.
 
 ** Indentation and paragraph filling
 Hiding parts of symbols could affect the way Emacs indents your code
@@ -100,4 +102,5 @@ had in `nameless-aliases' or `nameless-global-aliases', 
replace
 it with the full name for that alias.
 #+END_SRC
 
-To change this behavior, configure the variable 
~nameless-affect-indentation-and-filling~.
+To change this behavior, configure the variable
+~nameless-affect-indentation-and-filling~.
diff --git a/nameless.el b/nameless.el
index 83f4533..82dc1a3 100644
--- a/nameless.el
+++ b/nameless.el
@@ -72,6 +72,15 @@ This variable takes the same syntax and has the same effect 
as
 those in `nameless-global-aliases'.
 This variable is designed to be used as a file-local or dir-local
 variable.")
+(put 'nameless-aliases 'safe-local-variable
+ (lambda (x) (ignore-errors
+  (let ((safe t))
+(mapc (lambda (cell)
+(unless (and (stringp (car cell))
+ (stringp (cdr cell)))
+  (setq safe nil)))
+  x)
+safe
 
 (defface nameless-face
   '((t :inherit font-lock-type-face))
@@ -138,6 +147,7 @@ for it to take effect."
 
 ;;; Name and regexp
 (defvar-local nameless-current-name nil)
+(put 'nameless-current-name 'safe-local-variable #'stringp)
 
 (defun nameless--in-arglist-p ()
   "Is point inside an arglist?"
@@ -230,5 +240,12 @@ Return S."
 (setq nameless-current-name nil)
 (nameless--remove-keywords)))
 
+;;;###autoload
+(defun nameless-mode-from-hook ()
+  "Turn on `nameless-mode'.
+Designed to be added to `emacs-lisp-mode-hook'.
+Interactively, just invoke `nameless-mode' directly."
+  (add-hook 'find-file-hook #'nameless-mode nil 'local))
+
 (provide 'nameless)
 ;;; nameless.el ends here



[elpa] master 6fd3a49 7/9: Fix doc

2015-09-09 Thread Artur Malabarba
branch: master
commit 6fd3a49636289e783e8debe6791c229e1fb22ab8
Author: Artur Malabarba 
Commit: Artur Malabarba 

Fix doc
---
 README.org |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/README.org b/README.org
index 3e28eb9..75f8835 100644
--- a/README.org
+++ b/README.org
@@ -14,7 +14,7 @@ the *right* has ~nameless-mode~ turned on.\\
 To use this package add the following configuration to your Emacs init file.
 
 #+BEGIN_SRC emacs-lisp
-(add-hook 'emacs-lisp-mode-hook #'nameless-mode)
+(add-hook 'emacs-lisp-mode-hook #'nameless-mode-from-hook)
 #+END_SRC
 
 You can configure a string to use instead of ~:~ by setting the



[elpa] master bc5cdb4 23/38: Simplified property name matching

2015-09-09 Thread Dmitry Gutov
branch: master
commit bc5cdb412d34b3b441f2c817e7e2dd0f9865e5ad
Author: ScottyB 
Commit: ScottyB 

Simplified property name matching
---
 js2-mode.el |   43 ---
 tests/navigation.el |   15 ++-
 2 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 5b4ddc5..ce95353 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12354,17 +12354,15 @@ Supports navigation to 'foo.bar = 3' and 'foo = {bar: 
3}'."
(let ((parent (js2-node-parent node))
  matching-node)
  (unless endp
-   (if (or (and (js2-prop-get-node-p node)
-(not (or (js2-elem-get-node-p parent) (js2-call-node-p 
parent)))
-(setq matching-node (js2-build-prop-name-list node 
list-names)))
- (and (js2-name-node-p node)
-(js2-object-prop-node-p parent)
-(string= (js2-name-node-name node)
- (first list-names
+   (if (and (js2-name-node-p node)(setq matching-node (or
+(js2-build-prop-name-list node list-names)
+  (and (js2-object-prop-node-p parent)
+(string= (js2-name-node-name node)
+ (first list-names))
+ node
(throw 'prop-found matching-node))
t))
 
-
 (defun js2-name-declaration (name)
   "Return the declaration node for node named NAME."
   (let* ((node (js2-root-or-node))
@@ -12392,22 +12390,21 @@ the function."
 node
   (js2-node-get-enclosing-scope node
 
-(defun js2-build-prop-name-list (prop-node list-names)
-  "Compare the names in PROP-NODE to the ones in LIST-NAMES.
+(defun js2-build-prop-name-list (name-node list-names)
+  "Compare the names in NAME-NODE to the ones in LIST-NAMES.
 Returns the matching node to jump to or nil."
-  (let* (temp-node
- match-node)
-(unless (js2-prop-get-node-p prop-node)
-  (error "Node is not a property prop-node"))
-(catch 'not-a-match
-  (while (js2-prop-get-node-p prop-node)
-(setq temp-node (js2-prop-get-node-right prop-node))
-(unless (string= (car list-names) (js2-name-node-name temp-node))
-  (throw 'not-a-match match-node))
-(unless match-node
-  (setq match-node temp-node))
-(pop list-names)
-(setq prop-node (js2-node-parent prop-node))
+  (let ((list-names (reverse list-names))
+(next-prop (js2-node-parent name-node)))
+;; check right side properties
+(when (string= (pop list-names)
+   (js2-name-node-name name-node))
+  ;; check left side properties
+  (while (and list-names
+(js2-prop-get-node-p next-prop)
+(string= (pop list-names)
+ (js2-name-node-name
+  (setq next-prop (js2-prop-get-node-right 
next-prop)))
+(unless list-names name-node)))
 
 (defun js2-get-function-node (name scope)
   "Return node of function named NAME in SCOPE."
diff --git a/tests/navigation.el b/tests/navigation.el
index bbd4861..78b61f2 100644
--- a/tests/navigation.el
+++ b/tests/navigation.el
@@ -22,13 +22,15 @@
 (require 'ert)
 (require 'js2-mode)
 
-(cl-defun js2-navigation-helper (buffer-content expected-point &optional 
(point-offset 1))
+(cl-defun js2-navigation-helper (buffer-content &optional expected-point 
(point-offset 1))
   (with-temp-buffer
 (insert buffer-content)
-(js2-mode)
-(goto-char (or (- (point) point-offset)))
-(js2-jump-to-definition)
-(should (= (point) expected-point
+(let ((start-point (or (- (point) point-offset
+  (js2-mode)
+  (goto-char start-point)
+  (js2-jump-to-definition)
+  (print (format "%d %d" (point) start-point))
+  (should (= (point) (or expected-point start-point))
 
 (ert-deftest js2-jump-to-var ()
   (js2-navigation-helper "var soup = 2; soup" 5))
@@ -41,3 +43,6 @@
 
 (ert-deftest js2-jump-to-object-property ()
   (js2-navigation-helper "var aObject = {prop1: 3, prop2: \"hello\"}; 
aObject.prop1" 16))
+
+;; (ert-deftest js2-jump-to-object-property ()
+;;   (js2-navigation-helper "var aObject = {prop1: 3, prop2: \"hello\"}; 
anotherObject.dprop1"))



[elpa] master 00245fc 06/38: Try to use $EMACS implicitly

2015-09-09 Thread Dmitry Gutov
branch: master
commit 00245fc657901dccbcf13142359ba33daf348ede
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Try to use $EMACS implicitly
---
 .travis.yml |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index ae31ab3..79c9bf8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,4 +23,4 @@ matrix:
   - emacs-snapshot-gtk
 
 script:
-  make test EMACS=${EMACS}
+  make test



[elpa] master c47a894 11/38: Fix #247, indentation inside block comments

2015-09-09 Thread Dmitry Gutov
branch: master
commit c47a894639750fae2508d54ada6467a178c498fc
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Fix #247, indentation inside block comments
---
 js2-old-indent.el |   20 
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/js2-old-indent.el b/js2-old-indent.el
index 9b1c929..efc9053 100644
--- a/js2-old-indent.el
+++ b/js2-old-indent.el
@@ -396,7 +396,7 @@ indentation is aligned to that column."
   (save-excursion
 (back-to-indentation)
 (when (nth 4 parse-status)
-  (cl-return (js2-lineup-comment parse-status)))
+  (cl-return-from js2-proper-indentation (js2--comment-indent 
parse-status)))
 (let* ((at-closing-bracket (looking-at "[]})]"))
(same-indent-p (or at-closing-bracket
   (looking-at "\\_[^:]")
@@ -458,17 +458,13 @@ indentation is aligned to that column."
 
(t 0)
 
-(defun js2-lineup-comment (parse-status)
-  "Indent a multi-line block comment continuation line."
-  (let* ((beg (nth 8 parse-status))
- (first-line (js2-same-line beg))
- (offset (save-excursion
-   (goto-char beg)
-   (if (looking-at "/\\*")
-   (+ 1 (current-column))
- 0
-(unless first-line
-  (indent-line-to offset
+(defun js2--comment-indent (parse-status)
+  "Indentation inside a multi-line block comment continuation line."
+  (save-excursion
+(goto-char (nth 8 parse-status))
+(if (looking-at "/\\*")
+(+ 1 (current-column))
+  0)))
 
 (defun js2-indent-line (&optional bounce-backwards)
   "Indent the current line as JavaScript source text."



[elpa] master c68646a 12/38: Never enable js2-minor-mode in js2-mode

2015-09-09 Thread Dmitry Gutov
branch: master
commit c68646a163f3d47eec1e71af3f42ec01f14174ef
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Never enable js2-minor-mode in js2-mode

#249
---
 js2-mode.el |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 332e8f8..78768da 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -11129,9 +11129,11 @@ such as `js-mode', while retaining the asynchronous 
error/warning
 highlighting features of `js2-mode'."
   :group 'js2-mode
   :lighter " js-lint"
-  (if js2-minor-mode
-  (js2-minor-mode-enter)
-(js2-minor-mode-exit)))
+  (if (derived-mode-p 'js2-mode)
+  (setq js2-minor-mode nil)
+(if js2-minor-mode
+(js2-minor-mode-enter)
+  (js2-minor-mode-exit
 
 (defun js2-minor-mode-enter ()
   "Initialization for `js2-minor-mode'."
@@ -11278,7 +11280,6 @@ Selecting an error will jump it to the corresponding 
source-buffer error.
 ;;;###autoload
 (define-derived-mode js2-mode js-mode "Javascript-IDE"
   "Major mode for editing JavaScript code."
-  ;; Used by comment-region; don't change it.
   (set (make-local-variable 'max-lisp-eval-depth)
(max max-lisp-eval-depth 3000))
   (set (make-local-variable 'indent-line-function) #'js2-indent-line)



[elpa] master a622fb3 04/38: Remove outdated reference

2015-09-09 Thread Dmitry Gutov
branch: master
commit a622fb356951314474059242b7b308c848e55616
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Remove outdated reference
---
 .travis.yml |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 36f5aed..a198e0b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,3 @@
-# https://github.com/rolandwalker/emacs-travis
-
 language: emacs-lisp
 
 sudo: false



[elpa] master 9cdd4c6 10/38: -L .

2015-09-09 Thread Dmitry Gutov
branch: master
commit 9cdd4c6c2bbf14a1e74c0588d3531bbfd2386225
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

-L .
---
 Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index d397be2..08b1e48 100644
--- a/Makefile
+++ b/Makefile
@@ -22,5 +22,5 @@ js2-imenu-extras.elc: js2-mode.elc
${EMACS} $(BATCHFLAGS) -l ./js2-mode.elc -f batch-byte-compile $*.el
 
 test:
-   ${EMACS} $(BATCHFLAGS) -l js2-mode.el -l js2-old-indent.el -l 
tests/parser.el\
+   ${EMACS} $(BATCHFLAGS) -L . -l js2-mode.el -l js2-old-indent.el -l 
tests/parser.el\
  -l tests/indent.el -l tests/externs.el -f ert-run-tests-batch-and-exit



[elpa] master 5e546d3 05/38: Fix indent

2015-09-09 Thread Dmitry Gutov
branch: master
commit 5e546d3d2183ad9ae49853163c29d553e5d440de
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Fix indent
---
 .travis.yml |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index a198e0b..ae31ab3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,13 +14,13 @@ matrix:
 packages:
   - emacs24
   - emacs24-el
-   - env: EMACS=emacs-snapshot
- addons:
-   apt:
- packages:
-   - emacs-snapshot
-   - emacs-snapshot-el
-   - emacs-snapshot-gtk
+  - env: EMACS=emacs-snapshot
+addons:
+  apt:
+packages:
+  - emacs-snapshot
+  - emacs-snapshot-el
+  - emacs-snapshot-gtk
 
 script:
   make test EMACS=${EMACS}



[elpa] master f942b83 26/38: Support jumping to buffers of the same major mode

2015-09-09 Thread Dmitry Gutov
branch: master
commit f942b83f95394d4035e8de6e73b98551e722335a
Author: ScottyB 
Commit: ScottyB 

Support jumping to buffers of the same major mode
---
 js2-mode.el |   66 --
 1 files changed, 41 insertions(+), 25 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index cfcc302..cf99e37 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12299,41 +12299,57 @@ it marks the next defun after the ones already 
marked."
 (unless (js2-ast-root-p fn)
   (narrow-to-region beg (+ beg (js2-node-len fn))
 
-(defun js2-jump-to-definition ()
+(defun js2-jump-to-definition (&optional arg)
   "Jump to the definition of an object's property, variable or function."
-  (interactive)
+  (interactive "P")
   (ring-insert find-tag-marker-ring (point-marker))
   (let* ((node (js2-node-at-point))
  (parent (js2-node-parent node))
- (prop-names (if (js2-prop-get-node-p parent)(reverse 
(js2-prop-names-left node
- (name (or (and prop-names (pop prop-names))
-  (unless (and (js2-object-prop-node-p parent)
-(eq node (js2-object-prop-node-left parent)))
-(js2-name-node-name node))
-  (error "Node is not a supported jump node")))
+ (names (if (js2-prop-get-node-p parent)(reverse (js2-prop-names-left 
node
  node-init)
-(ignore-errors
-  (setq node-init (js2-symbol-ast-node (js2-get-symbol-declaration node 
name)))
-  (when prop-names
-(let ((found-node (js2-var-init-node-initializer (js2-node-parent 
node-init
-  (setq node-init nil)
-  (when (js2-object-node-p found-node)
-(js2-visit-ast
- found-node
- (lambda (node endp)
-   (unless endp
- (when (and (js2-object-prop-node-p node)
-  (string= (car prop-names)
-   (js2-name-node-name 
(js2-object-prop-node-left node
-   (pop prop-names)
-   (unless prop-names (setq node-init node)))
- t)))
+(push (or (and names (pop names))
+ (unless (and (js2-object-prop-node-p parent)
+(eq node (js2-object-prop-node-left parent)))
+   (js2-name-node-name node))
+ (error "Node is not a supported jump node")) names)
+(setq node-init (js2-search-scope node names))
+(unless node-init
+  (switch-to-buffer (catch 'found
+  (unless arg
+(mapc (lambda (b) (if (derived-mode-p 'js2-mode)
+ (with-current-buffer b
+   (setq node-init 
(js2-search-scope js2-mode-ast names))
+   (if node-init
+   (throw 'found b)
+  (buffer-list)))
+  nil)))
 (unless node-init
   (pop-tag-mark)
   (error "No jump location found"))
 (goto-char (js2-node-abs-pos node-init
 
-(defun js2-prop-names-left (name-node)
+(defun js2-search-scope (scope names)
+  "Searches SCOPE for jump location in NAMES."
+  (let (node-init)
+(ignore-errors
+(setq node-init (js2-symbol-ast-node (js2-get-symbol-declaration scope 
(pop names
+(when names
+  (let ((found-node (js2-var-init-node-initializer (js2-node-parent 
node-init
+(setq node-init nil)
+(when (js2-object-node-p found-node)
+  (js2-visit-ast
+   found-node
+   (lambda (node endp)
+ (unless endp
+   (when (and (js2-object-prop-node-p node)
+(string= (car names)
+ (js2-name-node-name 
(js2-object-prop-node-left node
+ (pop names)
+ (unless names (setq node-init node)))
+   t)))
+node-init))
+
+(defun js2-names-left (name-node)
   "Create a list of all of the names in the property NAME-NODE.
 NAME-NODE must have a js2-prop-get-node as parent.  Only adds
 properties to the left of point.  This is so individual jump



[elpa] master 1ee5c45 22/38: Return correct node when searching for the definition of a property.

2015-09-09 Thread Dmitry Gutov
branch: master
commit 1ee5c45ff2c37993da434ba8d0c284eb7ea47e87
Author: ScottyB 
Commit: ScottyB 

Return correct node when searching for the definition of a property.
---
 js2-mode.el |   36 
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 9de30ac..5b4ddc5 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12312,7 +12312,7 @@ it marks the next defun after the ones already marked."
(js2-name-node-name node)
  (error "Node is not a supported jump node")))
  (node-init (if (and prop-names (listp prop-names))
-(js2-find-property prop-names)
+ (js2-find-property prop-names)
   (js2-name-declaration name
 (unless node-init
   (pop-tag-mark)
@@ -12351,18 +12351,20 @@ Supports navigation to 'foo.bar = 3' and 'foo = {bar: 
3}'."
 (js2-visit-ast-root
  js2-mode-ast
  (lambda (node endp)
-   (let ((parent (js2-node-parent node)))
+   (let ((parent (js2-node-parent node))
+ matching-node)
  (unless endp
(if (or (and (js2-prop-get-node-p node)
 (not (or (js2-elem-get-node-p parent) (js2-call-node-p 
parent)))
-(equal list-names (js2-build-prop-name-list node)))
+(setq matching-node (js2-build-prop-name-list node 
list-names)))
  (and (js2-name-node-p node)
 (js2-object-prop-node-p parent)
 (string= (js2-name-node-name node)
  (first list-names
-   (throw 'prop-found node))
+   (throw 'prop-found matching-node))
t))
 
+
 (defun js2-name-declaration (name)
   "Return the declaration node for node named NAME."
   (let* ((node (js2-root-or-node))
@@ -12390,20 +12392,22 @@ the function."
 node
   (js2-node-get-enclosing-scope node
 
-(defun js2-build-prop-name-list (prop-node)
-  "Build a list of names from a PROP-NODE."
-  (let* (names
- left
- left-node)
+(defun js2-build-prop-name-list (prop-node list-names)
+  "Compare the names in PROP-NODE to the ones in LIST-NAMES.
+Returns the matching node to jump to or nil."
+  (let* (temp-node
+ match-node)
 (unless (js2-prop-get-node-p prop-node)
   (error "Node is not a property prop-node"))
-(while (js2-prop-get-node-p prop-node)
-  (push (js2-name-node-name (js2-prop-get-node-right prop-node)) names)
-  (setq left-node (js2-prop-get-node-left prop-node))
-  (when (js2-name-node-p left-node)
-(setq left (js2-name-node-name left-node)))
-  (setq prop-node (js2-node-parent prop-node)))
-(append names `(,left
+(catch 'not-a-match
+  (while (js2-prop-get-node-p prop-node)
+(setq temp-node (js2-prop-get-node-right prop-node))
+(unless (string= (car list-names) (js2-name-node-name temp-node))
+  (throw 'not-a-match match-node))
+(unless match-node
+  (setq match-node temp-node))
+(pop list-names)
+(setq prop-node (js2-node-parent prop-node))
 
 (defun js2-get-function-node (name scope)
   "Return node of function named NAME in SCOPE."



[elpa] master 7184664 20/38: Add a jump to definition command bound to M-.

2015-09-09 Thread Dmitry Gutov
branch: master
commit 71846649a7b8ff2c3888a554a17c578ea68cd847
Author: ScottyB 
Commit: ScottyB 

Add a jump to definition command bound to M-.
---
 js2-mode.el |  119 +++
 tests/navigation.el |   43 ++
 2 files changed, 162 insertions(+), 0 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index b885efd..54c33cc 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -1115,6 +1115,7 @@ information."
 (define-key map (kbd "C-c C-o") #'js2-mode-toggle-element)
 (define-key map (kbd "C-c C-w") #'js2-mode-toggle-warnings-and-errors)
 (define-key map [down-mouse-3] #'js2-down-mouse-3)
+(define-key map (kbd "M-.") #'js2-jump-to-definition)
 
 (define-key map [menu-bar javascript]
   (cons "JavaScript" (make-sparse-keymap "JavaScript")))
@@ -12297,6 +12298,124 @@ it marks the next defun after the ones already 
marked."
 (unless (js2-ast-root-p fn)
   (narrow-to-region beg (+ beg (js2-node-len fn))
 
+(defun js2-jump-to-definition ()
+  "Jump to the definition of an object's property, variable or function."
+  (interactive)
+  (ring-insert find-tag-marker-ring (point-marker))
+  (let* ((node (js2-node-at-point))
+ (parent (js2-node-parent node))
+ (prop-names (if (js2-prop-get-node-p parent)
+ (js2-prop-names-left node)))
+ (name (if (and (js2-name-node-p node)
+ (not (js2-object-prop-node-p parent)))
+   (js2-name-node-name node)
+ (error "Node is not a supported jump node")))
+ (node-init (if (and prop-names (listp prop-names))
+(js2-find-property prop-names)
+  (js2-name-declaration name
+(unless node-init
+  (pop-tag-mark)
+  (error "No jump location found"))
+(goto-char (js2-node-abs-pos node-init
+
+(defun js2-prop-names-left (name-node)
+  "Create a list of all of the names in the property NAME-NODE.
+NAME-NODE must have a js2-prop-get-node as parent.  Only adds
+properties to the left of point.  This is so individual jump
+points can be found for each property in the chain."
+  (let* (name
+ (parent (js2-node-parent name-node))
+ left
+ names)
+(unless (or (js2-prop-get-node-p parent) (js2-name-node-p name-node))
+  (error "Not a name node or doesn't have a prop-get-node as parent"))
+(setq name (js2-name-node-name name-node)
+  left (js2-prop-get-node-left parent))
+(if (and (js2-name-node-p left)
+  (string= name (js2-name-node-name left)))
+(setq names name)
+  (js2-visit-ast
+   parent
+   (lambda (node endp)
+ (unless endp
+   (if (js2-name-node-p node)
+   (push (js2-name-node-name node) names)
+ t
+  names)))
+
+(defun js2-find-property (list-names)
+  "Find the property definition that consists of LIST-NAMES.
+Supports navigation to 'foo.bar = 3' and 'foo = {bar: 3}'."
+  (catch 'prop-found
+(js2-visit-ast-root
+ js2-mode-ast
+ (lambda (node endp)
+   (let ((parent (js2-node-parent node)))
+ (unless endp
+   (if (or (and (js2-prop-get-node-p node)
+(not (or (js2-elem-get-node-p parent) (js2-call-node-p 
parent)))
+(equal list-names (js2-build-prop-name-list node)))
+ (and (js2-name-node-p node)
+(js2-object-prop-node-p parent)
+(string= (js2-name-node-name node)
+ (first list-names
+   (throw 'prop-found node))
+   t))
+
+(defun js2-name-declaration (name)
+  "Return the declaration node for node named NAME."
+  (let* ((node (js2-root-or-node))
+ (scope-def (js2-get-defining-scope node name))
+ (scope (if scope-def (js2-scope-get-symbol scope-def name) nil))
+ (symbol (if scope (js2-symbol-ast-node scope) nil)))
+(if (not symbol)
+(js2-get-function-node name scope-def)
+  symbol)))
+
+(defun js2-get-function-name (fn-node)
+  "Return the name of the function FN-NODE.
+Value may be either function name or the variable name that holds
+the function."
+  (let ((parent (js2-node-parent fn-node)))
+(if (js2-function-node-p fn-node)
+(or (js2-function-name fn-node)
+  (if (js2-var-init-node-p parent)
+  (js2-name-node-name (js2-var-init-node-target parent)))
+
+(defun js2-root-or-node ()
+  "Return the current node or js2-ast-root node."
+  (let ((node (js2-node-at-point)))
+(if (js2-ast-root-p node)
+node
+  (js2-node-get-enclosing-scope node
+
+(defun js2-build-prop-name-list (prop-node)
+  "Build a list of names from a PROP-NODE."
+  (let* (names
+ left
+ left-node)
+(unless (js2-prop-get-node-p prop-node)
+  (error "Node is not a property prop-node"))
+(while (js2-prop-get-node-p prop-node)
+  (p

[elpa] master c9a1cde 01/38: Fix indentation tests, by always loading js2-old-indent

2015-09-09 Thread Dmitry Gutov
branch: master
commit c9a1cde14b9edc4df188db34c8daaf28e3dce743
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Fix indentation tests, by always loading js2-old-indent
---
 Makefile|2 +-
 tests/indent.el |1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index f86786f..d397be2 100644
--- a/Makefile
+++ b/Makefile
@@ -22,5 +22,5 @@ js2-imenu-extras.elc: js2-mode.elc
${EMACS} $(BATCHFLAGS) -l ./js2-mode.elc -f batch-byte-compile $*.el
 
 test:
-   ${EMACS} $(BATCHFLAGS) -l js2-mode.el -l tests/parser.el\
+   ${EMACS} $(BATCHFLAGS) -l js2-mode.el -l js2-old-indent.el -l 
tests/parser.el\
  -l tests/indent.el -l tests/externs.el -f ert-run-tests-batch-and-exit
diff --git a/tests/indent.el b/tests/indent.el
index df69202..27b6c5a 100644
--- a/tests/indent.el
+++ b/tests/indent.el
@@ -22,6 +22,7 @@
 (require 'ert)
 (require 'js2-mode)
 (require 'cl-lib)
+(require 'js2-old-indent)
 
 (defun js2-test-indent (content keep-indent)
   (let ((s (replace-regexp-in-string "^ *|" "" content)))



[elpa] master eba59c5 21/38: Added missing etags dependency

2015-09-09 Thread Dmitry Gutov
branch: master
commit eba59c52de5c1028e11492c1139234d584764f34
Author: ScottyB 
Commit: ScottyB 

Added missing etags dependency
---
 js2-mode.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 54c33cc..9de30ac 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -88,6 +88,7 @@
 (require 'cl-lib)
 (require 'imenu)
 (require 'js)
+(require 'etags)
 
 (eval-and-compile
   (if (version< emacs-version "25.0")



[elpa] master c4f4095 28/38: Only jump if not already at var or function definition

2015-09-09 Thread Dmitry Gutov
branch: master
commit c4f4095c4fd5b8c8afed4e22e94d86d8095552ac
Author: ScottyB 
Commit: ScottyB 

Only jump if not already at var or function definition
---
 js2-mode.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 939e904..81dfb16 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12307,7 +12307,9 @@ it marks the next defun after the ones already marked."
  (parent (js2-node-parent node))
  (names (if (js2-prop-get-node-p parent)(reverse (js2-names-left 
node
  node-init)
-(unless (js2-name-node-p node)
+(unless (and (js2-name-node-p node)
+   (not (js2-var-init-node-p parent))
+   (not (js2-function-node-p parent)))
   (error "Node is not a supported jump node"))
 (push (or (and names (pop names))
  (unless (and (js2-object-prop-node-p parent)



[elpa] master bbb5086 34/38: Remove a space

2015-09-09 Thread Dmitry Gutov
branch: master
commit bbb50866a1fa9994a7b3775da6dfed1464f818c7
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Remove a space
---
 js2-mode.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index b9d5f30..ce0fdd7 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12368,7 +12368,7 @@ i.e. ('name' 'value') = {name : { value: 3}}"
 (while (and temp names (js2-object-node-p temp-object))
   (setq temp (js2-search-object temp-object (pop names)))
   (and (setq node temp)
- (setq temp-object (js2-object-prop-node-right temp) )))
+ (setq temp-object (js2-object-prop-node-right temp
 (unless names node)))
 
 (defun js2-search-scope (node names)



[elpa] master 5beb8ea 13/38: Define js2-re-search-forward as an alias as well

2015-09-09 Thread Dmitry Gutov
branch: master
commit 5beb8ea1b79e9c7898bf16105d04c17ed0ac5281
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Define js2-re-search-forward as an alias as well

Fixes #253
---
 js2-mode.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 78768da..1543677 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -94,7 +94,8 @@
   (require 'js2-old-indent)
 (defvaralias 'js2-basic-offset 'js-indent-level nil)
 (defalias 'js2-proper-indentation 'js--proper-indentation)
-(defalias 'js2-indent-line 'js-indent-line)))
+(defalias 'js2-indent-line 'js-indent-line)
+(defalias 'js2-re-search-forward 'js--re-search-forward)))
 
 ;;; Externs (variables presumed to be defined by the host system)
 



[elpa] master ffa06cb 35/38: Explicitly remap js-find-symbol

2015-09-09 Thread Dmitry Gutov
branch: master
commit ffa06cb870642e8073dd3ddaa8c5954f827ba539
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Explicitly remap js-find-symbol

#159
---
 js2-mode.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index ce0fdd7..975f71f 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -1116,7 +1116,7 @@ information."
 (define-key map (kbd "C-c C-o") #'js2-mode-toggle-element)
 (define-key map (kbd "C-c C-w") #'js2-mode-toggle-warnings-and-errors)
 (define-key map [down-mouse-3] #'js2-down-mouse-3)
-(define-key map (kbd "M-.") #'js2-jump-to-definition)
+(define-key map [remap js-find-symbol] #'js2-jump-to-definition)
 
 (define-key map [menu-bar javascript]
   (cons "JavaScript" (make-sparse-keymap "JavaScript")))



[elpa] master 242af01 14/38: Handle @property like @param, and handle aliases

2015-09-09 Thread Dmitry Gutov
branch: master
commit 242af01793f3e07d7e2fb24ba1ff2c1a7d981beb
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Handle @property like @param, and handle aliases

Fixes #255
---
 js2-mode.el |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 1543677..e4b4a55 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -6819,7 +6819,7 @@ of a simple name.  Called before EXPR has a parent node."
 
 (defconst js2-jsdoc-param-tag-regexp
   (concat "^\\s-*\\*+\\s-*\\(@"
-  "\\(?:param\\|argument\\)"
+  "\\(?:param\\|arg\\(?:ument\\)?\\|prop\\(?:erty\\)?\\)"
   "\\)"
   "\\s-*\\({[^}]+}\\)?" ; optional type
   "\\s-*\\[?\\([[:alnum:]_$\.]+\\)?\\]?"  ; name
@@ -6861,7 +6861,6 @@ of a simple name.  Called before EXPR has a parent node."
  "memberOf"
  "name"
  "namespace"
- "property"
  "since"
  "suppress"
  "this"



[elpa] master 5c9d8b8 37/38: Rephrase

2015-09-09 Thread Dmitry Gutov
branch: master
commit 5c9d8b82dddec2fab370ec8798569c7fc5698093
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Rephrase
---
 NEWS.md |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 798c51a..2984e91 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -9,8 +9,8 @@
   builds), `js2-mode` uses the indentation code from `js-mode`.  Where
   feasible, the user options (and functions) now have aliases, but if
   you're using Emacs 25 and you see an indentation-related setting
-  that stopped working, try setting the one for the `js` group: `M-x
-  customize-group RET js RET`.
+  that stopped working, try looking for a corresponding one in the
+  `js` group: `M-x customize-group RET js RET`.
 
 * New command: `js2-jump-to-definition`. It's bound to `M-.` by
   default, via remapping `js-find-symbol`. To get back to the default



[elpa] master 4bd8df9 09/38: Revert the "containerized build" commits, because Travis still hasn't

2015-09-09 Thread Dmitry Gutov
branch: master
commit 4bd8df9d09295136d3892a2ddac27a6213df4ac9
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Revert the "containerized build" commits, because Travis still hasn't
whitelisted emacs-snapshot.

https://github.com/travis-ci/travis-ci/issues/3804
---
 .travis.yml |   39 ++-
 1 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 2ad5bf2..bb0a9e0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,27 +1,24 @@
-language: emacs-lisp
+# https://github.com/rolandwalker/emacs-travis
 
-sudo: false
+language: emacs-lisp
 
-addons:
-  apt:
-sources:
-  - cassou-emacs
+env:
+  matrix:
+- EMACS=emacs24
+- EMACS=emacs-snapshot
 
-matrix:
-  include:
-- env: EMACS=emacs24
-  addons:
-apt:
-  packages:
-- emacs24
-- emacs24-el
-- env: EMACS=emacs-snapshot
-  addons:
-apt:
-  packages:
-- emacs-snapshot
-- emacs-snapshot-el
-- emacs-snapshot-gtk
+install:
+  - if [ "$EMACS" = "emacs24" ]; then
+sudo add-apt-repository -y ppa:cassou/emacs &&
+sudo apt-get update -qq &&
+sudo apt-get install -qq emacs24 emacs24-el;
+fi
+  - if [ "$EMACS" = "emacs-snapshot" ]; then
+sudo add-apt-repository -y ppa:cassou/emacs &&
+sudo apt-get update -qq &&
+sudo apt-get install -qq emacs-snapshot &&
+sudo apt-get install -qq emacs-snapshot-el emacs-snapshot-gtk;
+fi
 
 script:
   make test EMACS=${EMACS}



[elpa] master 9ad7708 32/38: Add cl- prefix, improve line lengths

2015-09-09 Thread Dmitry Gutov
branch: master
commit 9ad77087eefa1625c5eb980aa59052c28087f411
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Add cl- prefix, improve line lengths
---
 js2-mode.el |   50 --
 1 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 321e52c..235c360 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12307,19 +12307,19 @@ it marks the next defun after the ones already 
marked."
  (parent (js2-node-parent node))
  (names (if (js2-prop-get-node-p parent)
 (reverse (let ((temp (js2-compute-nested-prop-get parent)))
-   (loop for n in temp
- with result = '()
- do (push n result)
- until (equal node n)
- finally return result)
+   (cl-loop for n in temp
+with result = '()
+do (push n result)
+until (equal node n)
+finally return result)
  node-init)
 (unless (and (js2-name-node-p node)
-   (not (js2-var-init-node-p parent))
-   (not (js2-function-node-p parent)))
+ (not (js2-var-init-node-p parent))
+ (not (js2-function-node-p parent)))
   (error "Node is not a supported jump node"))
 (push (or (and names (pop names))
- (unless (and (js2-object-prop-node-p parent)
-(eq node (js2-object-prop-node-left parent)))
+  (unless (and (js2-object-prop-node-p parent)
+   (eq node (js2-object-prop-node-left parent)))
 node)) names)
 (setq node-init (js2-search-scope node names))
 
@@ -12337,7 +12337,7 @@ it marks the next defun after the ones already marked."
(throw 'found b)
  (buffer-list)))
  nil)))
-(setq node-init (if (listp node-init) (first node-init) node-init))
+(setq node-init (if (listp node-init) (car node-init) node-init))
 (unless node-init
   (pop-tag-mark)
   (error "No jump location found"))
@@ -12351,9 +12351,11 @@ it marks the next defun after the ones already marked."
   (cl-loop for elem in (js2-object-node-elems node)
for left = (js2-object-prop-node-left elem)
if (or (and (js2-name-node-p left)
-(equal (js2-name-node-name name-node) (js2-name-node-name 
left)))
- (and (js2-string-node-p left)
-(string= (js2-name-node-name name-node) 
(js2-string-node-value left
+   (equal (js2-name-node-name name-node)
+  (js2-name-node-name left)))
+  (and (js2-string-node-p left)
+   (string= (js2-name-node-name name-node)
+(js2-string-node-value left
return elem))
 
 (defun js2-search-object-for-prop (object prop-names)
@@ -12375,7 +12377,7 @@ i.e. ('name' 'value') = {name : { value: 3}}"
 NAMES is a list of property values to search for. For functions
 and variables NAMES will contain one element."
   (let (node-init
-(val (js2-name-node-name (first names
+(val (js2-name-node-name (car names
 (setq node-init (js2-get-symbol-declaration node val))
 
 (when (> (length names) 1)
@@ -12386,8 +12388,9 @@ and variables NAMES will contain one element."
   (temp-names names))
   (pop temp-names) ;; First element is var name
   (setq node-init (when (js2-var-init-node-p parent)
-(js2-search-object-for-prop 
(js2-var-init-node-initializer parent)
-temp-names)
+(js2-search-object-for-prop
+ (js2-var-init-node-initializer parent)
+ temp-names)
 
   ;; Check all assign nodes
   (js2-visit-ast
@@ -12400,15 +12403,18 @@ and variables NAMES will contain one element."
  (temp-names names))
  (when (js2-prop-get-node-p left)
(let* ((prop-list (js2-compute-nested-prop-get left))
-  (found (loop for prop in prop-list
-   until (not (string= (js2-name-node-name 
(pop temp-names)) (js2-name-node-name prop)))
-   if (not temp-names) return prop))
+  (found (cl-loop for prop in prop-list
+  until (not (string= 
(js2-name-node-name
+   (pop 
temp-names))
+ 

[elpa] master af85699 30/38: Clean up todo in js2-search-scope and fix year typo

2015-09-09 Thread Dmitry Gutov
branch: master
commit af8569926239e73eccb091500f4b6e5c0f5e9d20
Author: ScottyB 
Commit: ScottyB 

Clean up todo in js2-search-scope and fix year typo
---
 js2-mode.el |   16 +++-
 tests/navigation.el |2 +-
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 2d762e0..a42c02c 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12413,15 +12413,13 @@ and variables NAMES will contain one element."
   (prop-names (mapcar 'car prop-list))
   (found (loop for prop in prop-names
until (not (string= (pop temp-names) 
prop))
-   if (not temp-names) return prop)))
-
- ;; todo: clean this up!
- (if found (push (cdr (assoc found prop-list)) node-init)
-   (when (js2-object-node-p right)
- (setq found (js2-search-object-for-prop right 
temp-names)))
-   (if found (push found node-init))
- t)
-node-init))
+   if (not temp-names) return prop))
+  (found-node (if found (cdr (assoc found prop-list))
+(when (js2-object-node-p right)
+  (js2-search-object-for-prop right 
temp-names)
+ (if found-node (push found-node node-init))
+   t
+  node-init))
 
 (defun js2-names-left (name-node)
 "Returns a list of names for a `js2-prop-get-node'.
diff --git a/tests/navigation.el b/tests/navigation.el
index 3a3c240..d7a8314 100644
--- a/tests/navigation.el
+++ b/tests/navigation.el
@@ -1,6 +1,6 @@
 ;;; tests/navigation.el --- Some tests for js2-mode.
 
-;; Copyright (C) 2009, 2011-2013  Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2011-2015  Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 



[elpa] master 5ffca32 38/38: Merge commit '5c9d8b82dddec2fab370ec8798569c7fc5698093' from js2-mode

2015-09-09 Thread Dmitry Gutov
branch: master
commit 5ffca32900b224805cb6e679798d53d999b1dcc0
Merge: 8ad76a7 5c9d8b8
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge commit '5c9d8b82dddec2fab370ec8798569c7fc5698093' from js2-mode
---
 packages/js2-mode/Makefile|2 +-
 packages/js2-mode/NEWS.md |   18 +++
 packages/js2-mode/js2-mode.el |  223 +
 packages/js2-mode/js2-old-indent.el   |   20 ++--
 packages/js2-mode/tests/indent.el |1 +
 packages/js2-mode/tests/navigation.el |   60 +
 packages/js2-mode/tests/parser.el |6 +-
 7 files changed, 258 insertions(+), 72 deletions(-)

diff --git a/packages/js2-mode/Makefile b/packages/js2-mode/Makefile
index f86786f..08b1e48 100644
--- a/packages/js2-mode/Makefile
+++ b/packages/js2-mode/Makefile
@@ -22,5 +22,5 @@ js2-imenu-extras.elc: js2-mode.elc
${EMACS} $(BATCHFLAGS) -l ./js2-mode.elc -f batch-byte-compile $*.el
 
 test:
-   ${EMACS} $(BATCHFLAGS) -l js2-mode.el -l tests/parser.el\
+   ${EMACS} $(BATCHFLAGS) -L . -l js2-mode.el -l js2-old-indent.el -l 
tests/parser.el\
  -l tests/indent.el -l tests/externs.el -f ert-run-tests-batch-and-exit
diff --git a/packages/js2-mode/NEWS.md b/packages/js2-mode/NEWS.md
index 300bc84..2984e91 100644
--- a/packages/js2-mode/NEWS.md
+++ b/packages/js2-mode/NEWS.md
@@ -1,5 +1,23 @@
 # History of user-visible changes
 
+## 20150909
+
+* `js2-mode` now derives from `js-mode`. That means the former
+  function will run `js-mode-hook`, as well as `js2-mode-hook`. The
+  key bindings will default to `js-mode-map` where they're not set in
+  `js2-mode-map`. And in Emacs 25 or later (including the snapshot
+  builds), `js2-mode` uses the indentation code from `js-mode`.  Where
+  feasible, the user options (and functions) now have aliases, but if
+  you're using Emacs 25 and you see an indentation-related setting
+  that stopped working, try looking for a corresponding one in the
+  `js` group: `M-x customize-group RET js RET`.
+
+* New command: `js2-jump-to-definition`. It's bound to `M-.` by
+  default, via remapping `js-find-symbol`. To get back to the default
+  `M-.` binding (e.g. `find-tag`), put this in your init file:
+
+  (eval-after-load 'js (define-key js-mode-map (kbd "M-.") nil))
+
 ## 20150713
 
 * More comprehensive strict mode warnings and syntax errors.
diff --git a/packages/js2-mode/js2-mode.el b/packages/js2-mode/js2-mode.el
index 6ea2461..97f3269 100644
--- a/packages/js2-mode/js2-mode.el
+++ b/packages/js2-mode/js2-mode.el
@@ -7,7 +7,7 @@
 ;; Dmitry Gutov 
 ;; URL:  https://github.com/mooz/js2-mode/
 ;;   http://code.google.com/p/js2-mode/
-;; Version: 20150713
+;; Version: 20150909
 ;; Keywords: languages, javascript
 ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
 
@@ -88,13 +88,15 @@
 (require 'cl-lib)
 (require 'imenu)
 (require 'js)
+(require 'etags)
 
 (eval-and-compile
   (if (version< emacs-version "25.0")
   (require 'js2-old-indent)
 (defvaralias 'js2-basic-offset 'js-indent-level nil)
 (defalias 'js2-proper-indentation 'js--proper-indentation)
-(defalias 'js2-indent-line 'js-indent-line)))
+(defalias 'js2-indent-line 'js-indent-line)
+(defalias 'js2-re-search-forward 'js--re-search-forward)))
 
 ;;; Externs (variables presumed to be defined by the host system)
 
@@ -1114,6 +1116,7 @@ information."
 (define-key map (kbd "C-c C-o") #'js2-mode-toggle-element)
 (define-key map (kbd "C-c C-w") #'js2-mode-toggle-warnings-and-errors)
 (define-key map [down-mouse-3] #'js2-down-mouse-3)
+(define-key map [remap js-find-symbol] #'js2-jump-to-definition)
 
 (define-key map [menu-bar javascript]
   (cons "JavaScript" (make-sparse-keymap "JavaScript")))
@@ -6818,7 +6821,7 @@ of a simple name.  Called before EXPR has a parent node."
 
 (defconst js2-jsdoc-param-tag-regexp
   (concat "^\\s-*\\*+\\s-*\\(@"
-  "\\(?:param\\|argument\\)"
+  "\\(?:param\\|arg\\(?:ument\\)?\\|prop\\(?:erty\\)?\\)"
   "\\)"
   "\\s-*\\({[^}]+}\\)?" ; optional type
   "\\s-*\\[?\\([[:alnum:]_$\.]+\\)?\\]?"  ; name
@@ -6860,7 +6863,6 @@ of a simple name.  Called before EXPR has a parent node."
  "memberOf"
  "name"
  "namespace"
- "property"
  "since"
  "suppress"
  "this"
@@ -7966,46 +7968,42 @@ Scanner should be initialized."
 (js2-node-add-children fn-node pn)
 pn))
 
-(defun js2-define-destruct-symbols-internal
-(node decl-type face &optional ignore-not-in-block name-nodes)
-  "In

[elpa] master bb3f677 08/38: ...

2015-09-09 Thread Dmitry Gutov
branch: master
commit bb3f677e3700e8b5425a9a68094a47714b0c7342
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

...
---
 .travis.yml |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b6a2c2d..2ad5bf2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,4 +24,4 @@ matrix:
 - emacs-snapshot-gtk
 
 script:
-  make test
+  make test EMACS=${EMACS}



[elpa] master e236923 31/38: Removed functions: js2-build-prop-name-list and js2-names-left.

2015-09-09 Thread Dmitry Gutov
branch: master
commit e23692305d25208cd9839e6f9e8e5eea048cda0e
Author: ScottyB 
Commit: ScottyB 

Removed functions: js2-build-prop-name-list and js2-names-left.
---
 js2-mode.el |   75 +++---
 1 files changed, 20 insertions(+), 55 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index a42c02c..321e52c 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12305,7 +12305,13 @@ it marks the next defun after the ones already marked."
   (ring-insert find-tag-marker-ring (point-marker))
   (let* ((node (js2-node-at-point))
  (parent (js2-node-parent node))
- (names (if (js2-prop-get-node-p parent)(reverse (js2-names-left 
node
+ (names (if (js2-prop-get-node-p parent)
+(reverse (let ((temp (js2-compute-nested-prop-get parent)))
+   (loop for n in temp
+ with result = '()
+ do (push n result)
+ until (equal node n)
+ finally return result)
  node-init)
 (unless (and (js2-name-node-p node)
(not (js2-var-init-node-p parent))
@@ -12314,7 +12320,7 @@ it marks the next defun after the ones already marked."
 (push (or (and names (pop names))
  (unless (and (js2-object-prop-node-p parent)
 (eq node (js2-object-prop-node-left parent)))
-   (js2-name-node-name node))) names)
+node)) names)
 (setq node-init (js2-search-scope node names))
 
 ;; todo: display list of results in buffer
@@ -12337,33 +12343,17 @@ it marks the next defun after the ones already 
marked."
   (error "No jump location found"))
 (goto-char (js2-node-abs-pos node-init
 
-(defun js2-build-prop-name-list (prop-node)
-  "Build a list of names from a PROP-NODE."
-  (let* (names
- left
- left-node)
-(unless (js2-prop-get-node-p prop-node)
-  (error "Node is not a property prop-node"))
-(while (js2-prop-get-node-p prop-node)
-  (let ((node (js2-prop-get-node-right prop-node)))
-(push `(,(js2-name-node-name node) . ,node) names)
-(setq left-node (js2-prop-get-node-left prop-node))
-(when (js2-name-node-p left-node)
-  (setq left `(,(js2-name-node-name left-node) . ,left-node)))
-(setq prop-node left-node)))
-(push left names)))
-
-(defun js2-search-object (node name)
-  "Check if object NODE contains element with NAME."
+(defun js2-search-object (node name-node)
+  "Check if object NODE contains element with NAME-NODE."
   (unless (js2-object-node-p node)
 (error "Only run depth search on `js2-object-node'"))
-  ;; Only support name and nodes for the time being
+  ;; Only support name-node and nodes for the time being
   (cl-loop for elem in (js2-object-node-elems node)
for left = (js2-object-prop-node-left elem)
if (or (and (js2-name-node-p left)
-(string= name (js2-name-node-name left)))
+(equal (js2-name-node-name name-node) (js2-name-node-name 
left)))
  (and (js2-string-node-p left)
-(string= name (js2-string-node-value left
+(string= (js2-name-node-name name-node) 
(js2-string-node-value left
return elem))
 
 (defun js2-search-object-for-prop (object prop-names)
@@ -12385,7 +12375,7 @@ i.e. ('name' 'value') = {name : { value: 3}}"
 NAMES is a list of property values to search for. For functions
 and variables NAMES will contain one element."
   (let (node-init
-(val (first names)))
+(val (js2-name-node-name (first names
 (setq node-init (js2-get-symbol-declaration node val))
 
 (when (> (length names) 1)
@@ -12409,42 +12399,17 @@ and variables NAMES will contain one element."
  (right (js2-assign-node-right node))
  (temp-names names))
  (when (js2-prop-get-node-p left)
-   (let* ((prop-list (js2-build-prop-name-list left))
-  (prop-names (mapcar 'car prop-list))
-  (found (loop for prop in prop-names
-   until (not (string= (pop temp-names) 
prop))
+   (let* ((prop-list (js2-compute-nested-prop-get left))
+  (found (loop for prop in prop-list
+   until (not (string= (js2-name-node-name 
(pop temp-names)) (js2-name-node-name prop)))
if (not temp-names) return prop))
-  (found-node (if found (cdr (assoc found prop-list))
-(when (js2-object-node-p right)
-  (js2-search-object-for-prop right 
temp-names)
+  (found-node (or found

[elpa] master updated (8ad76a7 -> 5ffca32)

2015-09-09 Thread Dmitry Gutov
dgutov pushed a change to branch master.

  from  8ad76a7   Merge commit '60873230991f7a0cd3175eb578fee34c7e238fb3'
   new  c9a1cde   Fix indentation tests, by always loading js2-old-indent
   new  f354e9a   Try a containerized Travis build
   new  3a44f30   Hopefully fix the matrix
   new  a622fb3   Remove outdated reference
   new  5e546d3   Fix indent
   new  00245fc   Try to use $EMACS implicitly
   new  c14fdf6   This shit is confusing
   new  bb3f677   ...
   new  4bd8df9   Revert the "containerized build" commits, because Travis 
still hasn't whitelisted emacs-snapshot.
   new  9cdd4c6   -L .
   new  c47a894   Fix #247, indentation inside block comments
   new  c68646a   Never enable js2-minor-mode in js2-mode
   new  5beb8ea   Define js2-re-search-forward as an alias as well
   new  242af01   Handle @property like @param, and handle aliases
   new  a6f2a94   Allow plain parameters after default
   new  fc56c58   js2-define-destruct-symbols-internal: Anticipate 
js2-getter-setter-node
   new  f146f13   js2-define-destruct-symbols-internal: Stop growing 
NAME-NODES exponentially
   new  d0686a0   js2-define-destruct-symbols-internal: Remove, don't need 
it anymore
   new  c8b8e11   js2-define-destruct-symbols: Speed up, theoretically
   new  7184664   Add a jump to definition command bound to M-.
   new  eba59c5   Added missing etags dependency
   new  1ee5c45   Return correct node when searching for the definition of 
a property.
   new  bc5cdb4   Simplified property name matching
   new  579aacb   Simplified method of searching for nodes based on scope
   new  145c5d6   Fixed jumping to object properties
   new  f942b83   Support jumping to buffers of the same major mode
   new  aaf218a   Find definition by locating assignment nodes
   new  c4f4095   Only jump if not already at var or function definition
   new  bb0476c   Clarified js2-search-scope doc string
   new  af85699   Clean up todo in js2-search-scope and fix year typo
   new  e236923   Removed functions: js2-build-prop-name-list and 
js2-names-left.
   new  9ad7708   Add cl- prefix, improve line lengths
   new  75129c1   Use cl-assert instead of error
   new  bbb5086   Remove a space
   new  ffa06cb   Explicitly remap js-find-symbol
   new  58335d4   Add NEWS and bump the version
   new  5c9d8b8   Rephrase
   new  5ffca32   Merge commit '5c9d8b82dddec2fab370ec8798569c7fc5698093' 
from js2-mode


Summary of changes:
 packages/js2-mode/Makefile|2 +-
 packages/js2-mode/NEWS.md |   18 +++
 packages/js2-mode/js2-mode.el |  223 +
 packages/js2-mode/js2-old-indent.el   |   20 ++--
 packages/js2-mode/tests/indent.el |1 +
 packages/js2-mode/tests/navigation.el |   60 +
 packages/js2-mode/tests/parser.el |6 +-
 7 files changed, 258 insertions(+), 72 deletions(-)
 create mode 100644 packages/js2-mode/tests/navigation.el



[elpa] master d0686a0 18/38: js2-define-destruct-symbols-internal: Remove, don't need it anymore

2015-09-09 Thread Dmitry Gutov
branch: master
commit d0686a0715b3230dbdfccb298efccae222824219
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

js2-define-destruct-symbols-internal: Remove, don't need it anymore
---
 js2-mode.el |   22 --
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 95f2967..37a4f2a 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7966,10 +7966,12 @@ Scanner should be initialized."
 (js2-node-add-children fn-node pn)
 pn))
 
-(defun js2-define-destruct-symbols-internal
-(node decl-type face &optional ignore-not-in-block)
-  "Internal version of `js2-define-destruct-symbols'.  The only
-difference is that NAME-NODES is passed down recursively."
+(defun js2-define-destruct-symbols (node decl-type face &optional 
ignore-not-in-block)
+  "Declare and fontify destructuring parameters inside NODE.
+NODE is either `js2-array-node', `js2-object-node', or `js2-name-node'.
+
+Return a list of `js2-name-node' nodes representing the symbols
+declared; probably to check them for errors."
   (let (name-nodes)
 (cond
  ((js2-name-node-p node)
@@ -7986,7 +7988,7 @@ difference is that NAME-NODES is passed down recursively."
 (when (js2-object-prop-node-p elem)
   (setq name-nodes
 (append name-nodes
-(js2-define-destruct-symbols-internal
+(js2-define-destruct-symbols
  ;; In abbreviated destructuring {a, b}, right == left.
  (js2-object-prop-node-right elem)
  decl-type face ignore-not-in-block))
@@ -7995,20 +7997,12 @@ difference is that NAME-NODES is passed down 
recursively."
 (when elem
   (setq name-nodes
 (append name-nodes
-(js2-define-destruct-symbols-internal
+(js2-define-destruct-symbols
  elem decl-type face ignore-not-in-block))
  (t (js2-report-error "msg.no.parm" nil (js2-node-abs-pos node)
   (js2-node-len node
 name-nodes))
 
-(defun js2-define-destruct-symbols (node decl-type face &optional 
ignore-not-in-block)
-  "Declare and fontify destructuring parameters inside NODE.
-NODE is either `js2-array-node', `js2-object-node', or `js2-name-node'.
-
-Return a list of `js2-name-node' nodes representing the symbols
-declared; probably to check them for errors."
-  (js2-define-destruct-symbols-internal node decl-type face 
ignore-not-in-block))
-
 (defvar js2-illegal-strict-identifiers
   '("eval" "arguments")
   "Identifiers not allowed as variables in strict mode.")



[elpa] master bb0476c 29/38: Clarified js2-search-scope doc string

2015-09-09 Thread Dmitry Gutov
branch: master
commit bb0476caf68abff2c1d18eb9bcca38d88d413e29
Author: ScottyB 
Commit: ScottyB 

Clarified js2-search-scope doc string
---
 js2-mode.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 81dfb16..2d762e0 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12381,7 +12381,9 @@ i.e. ('name' 'value') = {name : { value: 3}}"
 (unless names node)))
 
 (defun js2-search-scope (node names)
-  "Searches SCOPE for jump location in NAMES."
+  "Searches NODE scope for jump location matching NAMES.
+NAMES is a list of property values to search for. For functions
+and variables NAMES will contain one element."
   (let (node-init
 (val (first names)))
 (setq node-init (js2-get-symbol-declaration node val))



[elpa] master c8b8e11 19/38: js2-define-destruct-symbols: Speed up, theoretically

2015-09-09 Thread Dmitry Gutov
branch: master
commit c8b8e114160f4ab6cb4e6424ddb015ae36ad7d9c
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

js2-define-destruct-symbols: Speed up, theoretically
---
 js2-mode.el |   26 +-
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 37a4f2a..b885efd 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7982,26 +7982,26 @@ declared; probably to check them for errors."
   (js2-set-face (setq leftpos (js2-node-abs-pos node))
 (+ leftpos (js2-node-len node))
 face 'record))
-(setq name-nodes (list node
+(list node)))
  ((js2-object-node-p node)
   (dolist (elem (js2-object-node-elems node))
 (when (js2-object-prop-node-p elem)
-  (setq name-nodes
-(append name-nodes
-(js2-define-destruct-symbols
- ;; In abbreviated destructuring {a, b}, right == left.
- (js2-object-prop-node-right elem)
- decl-type face ignore-not-in-block))
+  (push (js2-define-destruct-symbols
+ ;; In abbreviated destructuring {a, b}, right == left.
+ (js2-object-prop-node-right elem)
+ decl-type face ignore-not-in-block)
+name-nodes)))
+  (apply #'append (nreverse name-nodes)))
  ((js2-array-node-p node)
   (dolist (elem (js2-array-node-elems node))
 (when elem
-  (setq name-nodes
-(append name-nodes
-(js2-define-destruct-symbols
- elem decl-type face ignore-not-in-block))
+  (push (js2-define-destruct-symbols
+ elem decl-type face ignore-not-in-block)
+name-nodes)))
+  (apply #'append (nreverse name-nodes)))
  (t (js2-report-error "msg.no.parm" nil (js2-node-abs-pos node)
-  (js2-node-len node
-name-nodes))
+  (js2-node-len node))
+nil
 
 (defvar js2-illegal-strict-identifiers
   '("eval" "arguments")



[elpa] master c14fdf6 07/38: This shit is confusing

2015-09-09 Thread Dmitry Gutov
branch: master
commit c14fdf6760ee6764b9c11cf00cfd52853b578ef8
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

This shit is confusing
---
 .travis.yml |   27 ++-
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 79c9bf8..b6a2c2d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,19 +8,20 @@ addons:
   - cassou-emacs
 
 matrix:
-  - env: EMACS=emacs24
-addons:
-  apt:
-packages:
-  - emacs24
-  - emacs24-el
-  - env: EMACS=emacs-snapshot
-addons:
-  apt:
-packages:
-  - emacs-snapshot
-  - emacs-snapshot-el
-  - emacs-snapshot-gtk
+  include:
+- env: EMACS=emacs24
+  addons:
+apt:
+  packages:
+- emacs24
+- emacs24-el
+- env: EMACS=emacs-snapshot
+  addons:
+apt:
+  packages:
+- emacs-snapshot
+- emacs-snapshot-el
+- emacs-snapshot-gtk
 
 script:
   make test



[elpa] master 3a44f30 03/38: Hopefully fix the matrix

2015-09-09 Thread Dmitry Gutov
branch: master
commit 3a44f30eee3eb448391cdb021d4e0f9e3b82b2b4
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Hopefully fix the matrix
---
 .travis.yml |   29 ++---
 1 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 30a5fa4..36f5aed 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,21 +9,20 @@ addons:
 sources:
   - cassou-emacs
 
-env:
-  matrix:
-- env: EMACS=emacs24
-  addons:
-apt:
-  packages:
-- emacs24
-- emacs24-el
-- env: EMACS=emacs-snapshot
-  addons:
-apt:
-  packages:
-- emacs-snapshot
-- emacs-snapshot-el
-- emacs-snapshot-gtk
+matrix:
+  - env: EMACS=emacs24
+addons:
+  apt:
+packages:
+  - emacs24
+  - emacs24-el
+   - env: EMACS=emacs-snapshot
+ addons:
+   apt:
+ packages:
+   - emacs-snapshot
+   - emacs-snapshot-el
+   - emacs-snapshot-gtk
 
 script:
   make test EMACS=${EMACS}



[elpa] master fc56c58 16/38: js2-define-destruct-symbols-internal: Anticipate js2-getter-setter-node

2015-09-09 Thread Dmitry Gutov
branch: master
commit fc56c58b6067943f3b7867126c904d479b979dd4
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

js2-define-destruct-symbols-internal: Anticipate js2-getter-setter-node
---
 js2-mode.el |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index c802a66..8c007fe 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7982,12 +7982,13 @@ difference is that NAME-NODES is passed down 
recursively."
   (setq name-nodes (append name-nodes (list node)
((js2-object-node-p node)
 (dolist (elem (js2-object-node-elems node))
-  (setq name-nodes
-(append name-nodes
-(js2-define-destruct-symbols-internal
- ;; In abbreviated destructuring {a, b}, right == left.
- (js2-object-prop-node-right elem)
- decl-type face ignore-not-in-block name-nodes)
+  (when (js2-object-prop-node-p elem)
+(setq name-nodes
+  (append name-nodes
+  (js2-define-destruct-symbols-internal
+   ;; In abbreviated destructuring {a, b}, right == left.
+   (js2-object-prop-node-right elem)
+   decl-type face ignore-not-in-block name-nodes))
((js2-array-node-p node)
 (dolist (elem (js2-array-node-elems node))
   (when elem



[elpa] master f354e9a 02/38: Try a containerized Travis build

2015-09-09 Thread Dmitry Gutov
branch: master
commit f354e9a58e8a7890f5fd39b1a58fe01e4f76f44e
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Try a containerized Travis build
---
 .travis.yml |   35 ---
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index bb0a9e0..30a5fa4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,23 +2,28 @@
 
 language: emacs-lisp
 
+sudo: false
+
+addons:
+  apt:
+sources:
+  - cassou-emacs
+
 env:
   matrix:
-- EMACS=emacs24
-- EMACS=emacs-snapshot
-
-install:
-  - if [ "$EMACS" = "emacs24" ]; then
-sudo add-apt-repository -y ppa:cassou/emacs &&
-sudo apt-get update -qq &&
-sudo apt-get install -qq emacs24 emacs24-el;
-fi
-  - if [ "$EMACS" = "emacs-snapshot" ]; then
-sudo add-apt-repository -y ppa:cassou/emacs &&
-sudo apt-get update -qq &&
-sudo apt-get install -qq emacs-snapshot &&
-sudo apt-get install -qq emacs-snapshot-el emacs-snapshot-gtk;
-fi
+- env: EMACS=emacs24
+  addons:
+apt:
+  packages:
+- emacs24
+- emacs24-el
+- env: EMACS=emacs-snapshot
+  addons:
+apt:
+  packages:
+- emacs-snapshot
+- emacs-snapshot-el
+- emacs-snapshot-gtk
 
 script:
   make test EMACS=${EMACS}



[elpa] master 145c5d6 25/38: Fixed jumping to object properties

2015-09-09 Thread Dmitry Gutov
branch: master
commit 145c5d6153c9fa11e3da117eb96caacfef7106a9
Author: ScottyB 
Commit: ScottyB 

Fixed jumping to object properties
---
 js2-mode.el |   74 +-
 tests/navigation.el |   12 ++--
 2 files changed, 34 insertions(+), 52 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 56c98ac..cfcc302 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12305,15 +12305,29 @@ it marks the next defun after the ones already 
marked."
   (ring-insert find-tag-marker-ring (point-marker))
   (let* ((node (js2-node-at-point))
  (parent (js2-node-parent node))
- (prop-names (if (js2-prop-get-node-p parent)
- (js2-prop-names-left node)))
- (name (if (and (js2-name-node-p node)
- (not (js2-object-prop-node-p parent)))
-   (js2-name-node-name node)
- (error "Node is not a supported jump node")))
- (node-init (if (and prop-names (listp prop-names))
- (js2-find-property prop-names node)
-  (js2-symbol-ast-node (js2-get-symbol-declaration node 
name)
+ (prop-names (if (js2-prop-get-node-p parent)(reverse 
(js2-prop-names-left node
+ (name (or (and prop-names (pop prop-names))
+  (unless (and (js2-object-prop-node-p parent)
+(eq node (js2-object-prop-node-left parent)))
+(js2-name-node-name node))
+  (error "Node is not a supported jump node")))
+ node-init)
+(ignore-errors
+  (setq node-init (js2-symbol-ast-node (js2-get-symbol-declaration node 
name)))
+  (when prop-names
+(let ((found-node (js2-var-init-node-initializer (js2-node-parent 
node-init
+  (setq node-init nil)
+  (when (js2-object-node-p found-node)
+(js2-visit-ast
+ found-node
+ (lambda (node endp)
+   (unless endp
+ (when (and (js2-object-prop-node-p node)
+  (string= (car prop-names)
+   (js2-name-node-name 
(js2-object-prop-node-left node
+   (pop prop-names)
+   (unless prop-names (setq node-init node)))
+ t)))
 (unless node-init
   (pop-tag-mark)
   (error "No jump location found"))
@@ -12342,7 +12356,8 @@ points can be found for each property in the chain."
(if (js2-name-node-p node)
(push (js2-name-node-name node) names)
  t
-  names)))
+  names)
+(if (listp names) names (list names
 
 (defun js2-get-symbol-declaration (node name)
   "Find definition for NAME from NODE."
@@ -12350,45 +12365,6 @@ points can be found for each property in the chain."
  (or (js2-node-get-enclosing-scope node)
 node) name) name))
 
-(defun js2-find-property (list-names node)
-  "Find the property definition that consists of LIST-NAMES.
-Supports navigation to 'foo.bar = 3' and 'foo = {bar: 3}'. NODE
-is the node at point."
-  (catch 'prop-found
-(js2-visit-ast-root
- js2-mode-ast   ; todo: check for scope
- (lambda (node endp)
-   (let ((parent (js2-node-parent node))
- matching-node)
- (unless endp
-   (if (and (js2-name-node-p node)
-  (setq matching-node (or
-   (js2-build-prop-name-list node 
list-names)
-   (and (js2-object-prop-node-p parent)
-  (string= (js2-name-node-name node)
-   (first list-names))
-  node
-   (throw 'prop-found matching-node))
-   t))
-   )))
-  )
-
-(defun js2-build-prop-name-list (name-node list-names)
-  "Compare the names in NAME-NODE to the ones in LIST-NAMES.
-Returns the matching node to jump to or nil."
-  (let ((list-names (reverse list-names))
-(next-prop (js2-node-parent name-node)))
-;; check right side properties
-(when (string= (pop list-names)
-   (js2-name-node-name name-node))
-  ;; check left side properties
-  (while (and list-names
-(js2-prop-get-node-p next-prop)
-(string= (pop list-names)
- (js2-name-node-name
-  (setq next-prop (js2-prop-get-node-right 
next-prop)))
-(unless list-names name-node)))
-
 (provide 'js2-mode)
 
 ;;; js2-mode.el ends here
diff --git a/tests/navigation.el b/tests/navigation.el
index 6f94d7a..f07d466 100644
--- a/tests/navigation.el
+++ b/tests/navigation.el
@@ -28,7 +28,7 @@
 (let ((start-point (or (- (point) point-offset
   (js2-mode)
   (goto-char start-point)
-  (js2-jump-to-definition)
+  (ig

[elpa] master 58335d4 36/38: Add NEWS and bump the version

2015-09-09 Thread Dmitry Gutov
branch: master
commit 58335d492ae01caf225a029e5b2be272fa12f987
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Add NEWS and bump the version
---
 NEWS.md |   18 ++
 js2-mode.el |2 +-
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 300bc84..798c51a 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,23 @@
 # History of user-visible changes
 
+## 20150909
+
+* `js2-mode` now derives from `js-mode`. That means the former
+  function will run `js-mode-hook`, as well as `js2-mode-hook`. The
+  key bindings will default to `js-mode-map` where they're not set in
+  `js2-mode-map`. And in Emacs 25 or later (including the snapshot
+  builds), `js2-mode` uses the indentation code from `js-mode`.  Where
+  feasible, the user options (and functions) now have aliases, but if
+  you're using Emacs 25 and you see an indentation-related setting
+  that stopped working, try setting the one for the `js` group: `M-x
+  customize-group RET js RET`.
+
+* New command: `js2-jump-to-definition`. It's bound to `M-.` by
+  default, via remapping `js-find-symbol`. To get back to the default
+  `M-.` binding (e.g. `find-tag`), put this in your init file:
+
+  (eval-after-load 'js (define-key js-mode-map (kbd "M-.") nil))
+
 ## 20150713
 
 * More comprehensive strict mode warnings and syntax errors.
diff --git a/js2-mode.el b/js2-mode.el
index 975f71f..926003d 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7,7 +7,7 @@
 ;; Dmitry Gutov 
 ;; URL:  https://github.com/mooz/js2-mode/
 ;;   http://code.google.com/p/js2-mode/
-;; Version: 20150713
+;; Version: 20150909
 ;; Keywords: languages, javascript
 ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
 



[elpa] master 75129c1 33/38: Use cl-assert instead of error

2015-09-09 Thread Dmitry Gutov
branch: master
commit 75129c14c4b5ea4a9a76e189f51a4684fdfd506f
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Use cl-assert instead of error
---
 js2-mode.el |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 235c360..b9d5f30 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12345,8 +12345,7 @@ it marks the next defun after the ones already marked."
 
 (defun js2-search-object (node name-node)
   "Check if object NODE contains element with NAME-NODE."
-  (unless (js2-object-node-p node)
-(error "Only run depth search on `js2-object-node'"))
+  (cl-assert (js2-object-node-p node))
   ;; Only support name-node and nodes for the time being
   (cl-loop for elem in (js2-object-node-elems node)
for left = (js2-object-prop-node-left elem)



[elpa] master aaf218a 27/38: Find definition by locating assignment nodes

2015-09-09 Thread Dmitry Gutov
branch: master
commit aaf218a40225287f053e7f933b5af0d1e72e0f60
Author: ScottyB 
Commit: ScottyB 

Find definition by locating assignment nodes
---
 js2-mode.el |  149 +--
 tests/navigation.el |8 +++-
 2 files changed, 116 insertions(+), 41 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index cf99e37..939e904 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12305,61 +12305,129 @@ it marks the next defun after the ones already 
marked."
   (ring-insert find-tag-marker-ring (point-marker))
   (let* ((node (js2-node-at-point))
  (parent (js2-node-parent node))
- (names (if (js2-prop-get-node-p parent)(reverse (js2-prop-names-left 
node
+ (names (if (js2-prop-get-node-p parent)(reverse (js2-names-left 
node
  node-init)
+(unless (js2-name-node-p node)
+  (error "Node is not a supported jump node"))
 (push (or (and names (pop names))
  (unless (and (js2-object-prop-node-p parent)
 (eq node (js2-object-prop-node-left parent)))
-   (js2-name-node-name node))
- (error "Node is not a supported jump node")) names)
+   (js2-name-node-name node))) names)
 (setq node-init (js2-search-scope node names))
+
+;; todo: display list of results in buffer
+;; todo: group found references by buffer
 (unless node-init
-  (switch-to-buffer (catch 'found
-  (unless arg
-(mapc (lambda (b) (if (derived-mode-p 'js2-mode)
- (with-current-buffer b
-   (setq node-init 
(js2-search-scope js2-mode-ast names))
-   (if node-init
-   (throw 'found b)
-  (buffer-list)))
-  nil)))
+  (switch-to-buffer
+   (catch 'found
+ (unless arg
+   (mapc (lambda (b)
+   (with-current-buffer b
+ (when (derived-mode-p 'js2-mode)
+   (setq node-init (js2-search-scope js2-mode-ast names))
+   (if node-init
+   (throw 'found b)
+ (buffer-list)))
+ nil)))
+(setq node-init (if (listp node-init) (first node-init) node-init))
 (unless node-init
   (pop-tag-mark)
   (error "No jump location found"))
 (goto-char (js2-node-abs-pos node-init
 
-(defun js2-search-scope (scope names)
+(defun js2-build-prop-name-list (prop-node)
+  "Build a list of names from a PROP-NODE."
+  (let* (names
+ left
+ left-node)
+(unless (js2-prop-get-node-p prop-node)
+  (error "Node is not a property prop-node"))
+(while (js2-prop-get-node-p prop-node)
+  (let ((node (js2-prop-get-node-right prop-node)))
+(push `(,(js2-name-node-name node) . ,node) names)
+(setq left-node (js2-prop-get-node-left prop-node))
+(when (js2-name-node-p left-node)
+  (setq left `(,(js2-name-node-name left-node) . ,left-node)))
+(setq prop-node left-node)))
+(push left names)))
+
+(defun js2-search-object (node name)
+  "Check if object NODE contains element with NAME."
+  (unless (js2-object-node-p node)
+(error "Only run depth search on `js2-object-node'"))
+  ;; Only support name and nodes for the time being
+  (cl-loop for elem in (js2-object-node-elems node)
+   for left = (js2-object-prop-node-left elem)
+   if (or (and (js2-name-node-p left)
+(string= name (js2-name-node-name left)))
+ (and (js2-string-node-p left)
+(string= name (js2-string-node-value left
+   return elem))
+
+(defun js2-search-object-for-prop (object prop-names)
+  "Return node in OBJECT that matches PROP-NAMES or nil.
+PROP-NAMES is a list of values representing a path to a value in OBJECT.
+i.e. ('name' 'value') = {name : { value: 3}}"
+  (let (node
+(temp-object object)
+(temp t) ;temporay node
+(names prop-names))
+(while (and temp names (js2-object-node-p temp-object))
+  (setq temp (js2-search-object temp-object (pop names)))
+  (and (setq node temp)
+ (setq temp-object (js2-object-prop-node-right temp) )))
+(unless names node)))
+
+(defun js2-search-scope (node names)
   "Searches SCOPE for jump location in NAMES."
-  (let (node-init)
-(ignore-errors
-(setq node-init (js2-symbol-ast-node (js2-get-symbol-declaration scope 
(pop names
-(when names
-  (let ((found-node (js2-var-init-node-initializer (js2-node-parent 
node-init
-(setq node-init nil)
-(when (js2-object-node-p found-node)
-  (js2-visit-ast
-   found-node
-   (lambda (node endp)
- (unless endp
-   (when (and (j

[elpa] master f146f13 17/38: js2-define-destruct-symbols-internal: Stop growing NAME-NODES exponentially

2015-09-09 Thread Dmitry Gutov
branch: master
commit f146f13a26df8c1f4fb5f7520fc5e1be5734d017
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

js2-define-destruct-symbols-internal: Stop growing NAME-NODES exponentially

Fixes #259
---
 js2-mode.el |   61 ++-
 1 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 8c007fe..95f2967 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7967,38 +7967,39 @@ Scanner should be initialized."
 pn))
 
 (defun js2-define-destruct-symbols-internal
-(node decl-type face &optional ignore-not-in-block name-nodes)
+(node decl-type face &optional ignore-not-in-block)
   "Internal version of `js2-define-destruct-symbols'.  The only
 difference is that NAME-NODES is passed down recursively."
-  (cond
-   ((js2-name-node-p node)
-(let (leftpos)
-  (js2-define-symbol decl-type (js2-name-node-name node)
- node ignore-not-in-block)
-  (when face
-(js2-set-face (setq leftpos (js2-node-abs-pos node))
-  (+ leftpos (js2-node-len node))
-  face 'record))
-  (setq name-nodes (append name-nodes (list node)
-   ((js2-object-node-p node)
-(dolist (elem (js2-object-node-elems node))
-  (when (js2-object-prop-node-p elem)
-(setq name-nodes
-  (append name-nodes
-  (js2-define-destruct-symbols-internal
-   ;; In abbreviated destructuring {a, b}, right == left.
-   (js2-object-prop-node-right elem)
-   decl-type face ignore-not-in-block name-nodes))
-   ((js2-array-node-p node)
-(dolist (elem (js2-array-node-elems node))
-  (when elem
-(setq name-nodes
-  (append name-nodes
-  (js2-define-destruct-symbols-internal
-   elem decl-type face ignore-not-in-block name-nodes))
-   (t (js2-report-error "msg.no.parm" nil (js2-node-abs-pos node)
-(js2-node-len node
-  name-nodes)
+  (let (name-nodes)
+(cond
+ ((js2-name-node-p node)
+  (let (leftpos)
+(js2-define-symbol decl-type (js2-name-node-name node)
+   node ignore-not-in-block)
+(when face
+  (js2-set-face (setq leftpos (js2-node-abs-pos node))
+(+ leftpos (js2-node-len node))
+face 'record))
+(setq name-nodes (list node
+ ((js2-object-node-p node)
+  (dolist (elem (js2-object-node-elems node))
+(when (js2-object-prop-node-p elem)
+  (setq name-nodes
+(append name-nodes
+(js2-define-destruct-symbols-internal
+ ;; In abbreviated destructuring {a, b}, right == left.
+ (js2-object-prop-node-right elem)
+ decl-type face ignore-not-in-block))
+ ((js2-array-node-p node)
+  (dolist (elem (js2-array-node-elems node))
+(when elem
+  (setq name-nodes
+(append name-nodes
+(js2-define-destruct-symbols-internal
+ elem decl-type face ignore-not-in-block))
+ (t (js2-report-error "msg.no.parm" nil (js2-node-abs-pos node)
+  (js2-node-len node
+name-nodes))
 
 (defun js2-define-destruct-symbols (node decl-type face &optional 
ignore-not-in-block)
   "Declare and fontify destructuring parameters inside NODE.



[elpa] master a6f2a94 15/38: Allow plain parameters after default

2015-09-09 Thread Dmitry Gutov
branch: master
commit a6f2a9410a441c272084e629b4307905f37431d1
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Allow plain parameters after default

https://bugzilla.mozilla.org/show_bug.cgi?id=777060
Fixes #257
---
 js2-mode.el |   17 -
 tests/parser.el |6 ++
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index e4b4a55..c802a66 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -8041,7 +8041,7 @@ represented by FN-NODE at POS."
  (eq (js2-current-token-type) js2-NAME)))
   params param
   param-name-nodes new-param-name-nodes
-  default-found rest-param-at)
+  rest-param-at)
   (when paren-free-arrow
 (js2-unget-token))
   (cl-loop for tt = (js2-peek-token)
@@ -8051,8 +8051,6 @@ represented by FN-NODE at POS."
 ((and (not paren-free-arrow)
   (or (= tt js2-LB) (= tt js2-LC)))
  (js2-get-token)
- (when default-found
-   (js2-report-error "msg.no.default.after.default.param"))
  (setq param (js2-parse-destruct-primary-expr)
new-param-name-nodes (js2-define-destruct-symbols
  param js2-LP 'js2-function-param))
@@ -8074,14 +8072,8 @@ represented by FN-NODE at POS."
  (js2-check-strict-function-params param-name-nodes (list 
param))
  (setq param-name-nodes (append param-name-nodes (list param)))
  ;; default parameter value
- (when (or (and default-found
-(not rest-param-at)
-(js2-must-match js2-ASSIGN
-
"msg.no.default.after.default.param"
-(js2-node-pos param)
-(js2-node-len param)))
-   (and (>= js2-language-version 200)
-(js2-match-token js2-ASSIGN)))
+ (when (and (>= js2-language-version 200)
+(js2-match-token js2-ASSIGN))
(cl-assert (not paren-free-arrow))
(let* ((pos (js2-node-pos param))
   (tt (js2-current-token-type))
@@ -8091,8 +8083,7 @@ represented by FN-NODE at POS."
   (len (- (js2-node-end right) pos)))
  (setq param (make-js2-assign-node
   :type tt :pos pos :len len :op-pos op-pos
-  :left left :right right)
-   default-found t)
+  :left left :right right))
  (js2-node-add-children param left right)))
  (push param params)))
(when (and rest-param-at (> (length params) (1+ rest-param-at)))
diff --git a/tests/parser.el b/tests/parser.el
index bfc5653..dc8c001 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -226,12 +226,10 @@ the test."
   "function foo(a = 1, b = a + 1) {\n}")
 
 (js2-deftest-parse function-with-no-default-after-default
-  "function foo(a = 1, b) {\n}"
-  :syntax-error "b")
+  "function foo(a = 1, b) {\n}")
 
 (js2-deftest-parse function-with-destruct-after-default
-  "function foo(a = 1, {b, c}) {\n}"
-  :syntax-error "{")
+  "function foo(a = 1, {b, c}) {\n}")
 
 (js2-deftest-parse function-with-rest-parameter
   "function foo(a, b, ...rest) {\n}")



[elpa] master 579aacb 24/38: Simplified method of searching for nodes based on scope

2015-09-09 Thread Dmitry Gutov
branch: master
commit 579aacb69ff4598caa54e00642cd1b9e71a40405
Author: ScottyB 
Commit: ScottyB 

Simplified method of searching for nodes based on scope
---
 js2-mode.el |   73 +++---
 tests/navigation.el |2 +-
 2 files changed, 23 insertions(+), 52 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index ce95353..56c98ac 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12312,8 +12312,8 @@ it marks the next defun after the ones already marked."
(js2-name-node-name node)
  (error "Node is not a supported jump node")))
  (node-init (if (and prop-names (listp prop-names))
- (js2-find-property prop-names)
-  (js2-name-declaration name
+ (js2-find-property prop-names node)
+  (js2-symbol-ast-node (js2-get-symbol-declaration node 
name)
 (unless node-init
   (pop-tag-mark)
   (error "No jump location found"))
@@ -12344,51 +12344,34 @@ points can be found for each property in the chain."
  t
   names)))
 
-(defun js2-find-property (list-names)
+(defun js2-get-symbol-declaration (node name)
+  "Find definition for NAME from NODE."
+  (js2-scope-get-symbol (js2-get-defining-scope
+ (or (js2-node-get-enclosing-scope node)
+node) name) name))
+
+(defun js2-find-property (list-names node)
   "Find the property definition that consists of LIST-NAMES.
-Supports navigation to 'foo.bar = 3' and 'foo = {bar: 3}'."
+Supports navigation to 'foo.bar = 3' and 'foo = {bar: 3}'. NODE
+is the node at point."
   (catch 'prop-found
 (js2-visit-ast-root
- js2-mode-ast
+ js2-mode-ast   ; todo: check for scope
  (lambda (node endp)
(let ((parent (js2-node-parent node))
  matching-node)
  (unless endp
-   (if (and (js2-name-node-p node)(setq matching-node (or
-(js2-build-prop-name-list node list-names)
-  (and (js2-object-prop-node-p parent)
-(string= (js2-name-node-name node)
- (first list-names))
- node
+   (if (and (js2-name-node-p node)
+  (setq matching-node (or
+   (js2-build-prop-name-list node 
list-names)
+   (and (js2-object-prop-node-p parent)
+  (string= (js2-name-node-name node)
+   (first list-names))
+  node
(throw 'prop-found matching-node))
-   t))
-
-(defun js2-name-declaration (name)
-  "Return the declaration node for node named NAME."
-  (let* ((node (js2-root-or-node))
- (scope-def (js2-get-defining-scope node name))
- (scope (if scope-def (js2-scope-get-symbol scope-def name) nil))
- (symbol (if scope (js2-symbol-ast-node scope) nil)))
-(if (not symbol)
-(js2-get-function-node name scope-def)
-  symbol)))
-
-(defun js2-get-function-name (fn-node)
-  "Return the name of the function FN-NODE.
-Value may be either function name or the variable name that holds
-the function."
-  (let ((parent (js2-node-parent fn-node)))
-(if (js2-function-node-p fn-node)
-(or (js2-function-name fn-node)
-  (if (js2-var-init-node-p parent)
-  (js2-name-node-name (js2-var-init-node-target parent)))
-
-(defun js2-root-or-node ()
-  "Return the current node or js2-ast-root node."
-  (let ((node (js2-node-at-point)))
-(if (js2-ast-root-p node)
-node
-  (js2-node-get-enclosing-scope node
+   t))
+   )))
+  )
 
 (defun js2-build-prop-name-list (name-node list-names)
   "Compare the names in NAME-NODE to the ones in LIST-NAMES.
@@ -12406,18 +12389,6 @@ Returns the matching node to jump to or nil."
   (setq next-prop (js2-prop-get-node-right 
next-prop)))
 (unless list-names name-node)))
 
-(defun js2-get-function-node (name scope)
-  "Return node of function named NAME in SCOPE."
-  (catch 'function-found
-(js2-visit-ast
- scope
- (lambda (node end-p)
-   (when (and (not end-p)
-   (string= name (js2-get-function-name node)))
- (throw 'function-found node))
-   t))
-nil))
-
 (provide 'js2-mode)
 
 ;;; js2-mode.el ends here
diff --git a/tests/navigation.el b/tests/navigation.el
index 78b61f2..6f94d7a 100644
--- a/tests/navigation.el
+++ b/tests/navigation.el
@@ -44,5 +44,5 @@
 (ert-deftest js2-jump-to-object-property ()
   (js2-navigation-helper "var aObject = {prop1: 3, prop2: \"hello\"}; 
aObject.prop1" 16))
 
-;; (ert-deftest js2-jump-to-object-property ()
+;; (ert-deftest js2-no-jump-to-object-property ()
 ;;   (js2-navigation-helper "var aObject = {prop1

[elpa] master cde5d9a: Undo some breakage

2015-09-09 Thread Dmitry Gutov
branch: master
commit cde5d9a13dedb3c6bcc217893bd6d049f5db638b
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Undo some breakage
---
 packages/js2-mode/js2-mode.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/js2-mode/js2-mode.el b/packages/js2-mode/js2-mode.el
index 97f3269..926003d 100644
--- a/packages/js2-mode/js2-mode.el
+++ b/packages/js2-mode/js2-mode.el
@@ -10391,7 +10391,7 @@ EXPR is the first expression after the opening 
left-bracket.
 POS is the beginning of the LB token preceding EXPR.
 We should have just parsed the 'for' keyword before calling this function."
   (let ((current-scope js2-current-scope)
-loops filter result)
+loops first filter result)
 (unwind-protect
 (progn
   (while (js2-match-token js2-FOR)
@@ -10400,7 +10400,7 @@ We should have just parsed the 'for' keyword before 
calling this function."
   (push loop loops)
   (js2-parse-comp-loop loop)))
   ;; First loop takes expr scope's parent.
-  (setf (js2-scope-parent-scope (car (last loops)))
+  (setf (js2-scope-parent-scope (setq first (car (last loops
 (js2-scope-parent-scope current-scope))
   ;; Set expr scope's parent to the last loop.
   (setf (js2-scope-parent-scope current-scope) (car loops))



[elpa] master updated (cde5d9a -> a454a24)

2015-09-09 Thread Dmitry Gutov
dgutov pushed a change to branch master.

  from  cde5d9a   Undo some breakage
   new  38a83db   Add documentation for diff-hl-dired-status-files.
   new  d188525   Merge pull request #37 from holocronweaver/documentation
   new  5bfb314   Move diff-hl-margin-side after diff-hl-margin-mode 
definition
   new  eb92f0e   Merge pull request #39 from 
jamessan/diff-hl-margin-load-error
   new  d6b7d82   Support the "next" Magit version
   new  733ad33   silence byte-compiler
   new  1743a80   Merge pull request #42 from tarsius/silentio
   new  75d4bdc   Remove CR characters
   new  84d5110   Bump the copyright years
   new  4959c6e   Autoload diff-hl-dired-mode-unless-remote
   new  934fef0   Promote diff-hl-margin-side to diff-hl-side
   new  28263c7   Handle narrowing (fixes #48)
   new  12def16   Allow bitmap width only up to 16 (#49)
   new  bf27c41   vc-disable-async-diff: Don't bind when it's undefined
   new  7ea8159   Define diff-hl-command-map without destroying existing 
bindings
   new  028b2bf   Merge pull request #51 from tarsius/keep-bindings
   new  c79dc5b   Allow diffing on-the-fly
   new  45ac71d   Revert "Allow diffing on-the-fly"
   new  66e521a   Add diff-hl-flydiff as a separate file
   new  327e01c   Add commentary to diff-hl-flydiff
   new  0db7160   Change version predicate for vc-git polyfilling
   new  3e64ed5   #'diff-hl-flydiff/overlay-modified → #'ignored
   new  e0f8fe1   Require nadvice at toplevel
   new  34d2802   No need to remove diff-hl-edit from hooks
   new  3fa2b54   Prefer using /dev/shm for temporary files
   new  15aa2b8   Fix usage of "ignored"
   new  2209370   Ensure working revisions are never stale
   new  4bd5166   Update copyright year(s) for diff-hl-flydiff
   new  3ab3aae   Fix *another* usage of "ignored"
   new  6ab3ebe   Stop duplicating code in diff-hl-changes
   new  2992efd   Simplify diff-hl-flydiff/modified-p advice
   new  418dbc7   Update docs to reflect new diff-hl-flydiff-mode
   new  f300548   Merge pull request #50 from PythonNut/master
   new  2d40373   Update diff-hl-flydiff/vc-git-mode-line-string as per 
Emacs master
   new  1558064   Reword the recent README changes
   new  8d313db   Use --strip-trailing-cr
   new  7428f4a   Reduce warnings during byte-compilation; don't error b-c 
in <24.4
   new  a16b225   One fewer version check
   new  5068da4   Reindent
   new  e576ee2   Make diff-hl-flydiff-delay customizable
   new  7fa7f09   Bump the version
   new  a454a24   Merge commit '7fa7f099c7008d521dbbb57a1546f11535544536' 
from diff-hl


Summary of changes:
 packages/diff-hl/README.md  |   14 +-
 packages/diff-hl/diff-hl-dired.el   |   11 +-
 packages/diff-hl/diff-hl-flydiff.el |  182 ++
 packages/diff-hl/diff-hl-margin.el  |   18 +-
 packages/diff-hl/diff-hl.el | 1068 ++-
 5 files changed, 751 insertions(+), 542 deletions(-)
 create mode 100644 packages/diff-hl/diff-hl-flydiff.el



[elpa] master 5bfb314 03/42: Move diff-hl-margin-side after diff-hl-margin-mode definition

2015-09-09 Thread Dmitry Gutov
branch: master
commit 5bfb31484ec30b3984bb87184a7dd3da5c8c5c81
Author: James McCoy 
Commit: James McCoy 

Move diff-hl-margin-side after diff-hl-margin-mode definition

This fixes a “Symbol's value as variable is void” error when loading
diff-hl-margin.el.
---
 diff-hl-margin.el |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/diff-hl-margin.el b/diff-hl-margin.el
index 26fa7ad..4f4 100644
--- a/diff-hl-margin.el
+++ b/diff-hl-margin.el
@@ -44,16 +44,6 @@
   "Highlight buffer changes on margin"
   :group 'diff-hl)
 
-(defcustom diff-hl-margin-side 'left
-  "Which margin to use for indicators."
-  :type '(choice (const left)
- (const right))
-  :set (lambda (var value)
- (let ((on diff-hl-margin-mode))
-   (when on (diff-hl-margin-mode -1))
-   (set-default var value)
-   (when on (diff-hl-margin-mode 1)
-
 ;;;###autoload
 (define-minor-mode diff-hl-margin-mode
   "Toggle displaying `diff-hl-mode' highlights on the margin."
@@ -96,6 +86,16 @@ You probably shouldn't use this function directly."
   (dolist (win (get-buffer-window-list))
 (set-window-buffer win (current-buffer
 
+(defcustom diff-hl-margin-side 'left
+  "Which margin to use for indicators."
+  :type '(choice (const left)
+ (const right))
+  :set (lambda (var value)
+ (let ((on diff-hl-margin-mode))
+   (when on (diff-hl-margin-mode -1))
+   (set-default var value)
+   (when on (diff-hl-margin-mode 1)
+
 (defun diff-hl-margin-minor-mode-off ()
   (diff-hl-margin-minor-mode -1))
 



[elpa] master 38a83db 01/42: Add documentation for diff-hl-dired-status-files.

2015-09-09 Thread Dmitry Gutov
branch: master
commit 38a83dbae60bf7508e829c53db0a7f934a408cb9
Author: Jesse Johnson 
Commit: Jesse Johnson 

Add documentation for diff-hl-dired-status-files.
---
 diff-hl-dired.el |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/diff-hl-dired.el b/diff-hl-dired.el
index 09cf851..efb4b83 100644
--- a/diff-hl-dired.el
+++ b/diff-hl-dired.el
@@ -126,10 +126,12 @@
   (append dirs-alist files-alist))
  )
 
-(defun diff-hl-dired-status-files (backend dir files uf)
+(defun diff-hl-dired-status-files (backend dir files update-function)
+   "Using version control BACKEND, return list of (FILE STATE EXTRA) entries
+for DIR containing FILES. Call UPDATE-FUNCTION as entries are added."
   (if (version< "25" emacs-version)
-  (vc-call-backend backend 'dir-status-files dir files uf)
-(vc-call-backend backend 'dir-status-files dir files nil uf)))
+  (vc-call-backend backend 'dir-status-files dir files update-function)
+(vc-call-backend backend 'dir-status-files dir files nil update-function)))
 
 (when (version< emacs-version "24.4.51.5")
   ;; Work around http://debbugs.gnu.org/19386



[elpa] master 4959c6e 10/42: Autoload diff-hl-dired-mode-unless-remote

2015-09-09 Thread Dmitry Gutov
branch: master
commit 4959c6e259ec30cfc8ae536404817390cae70901
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Autoload diff-hl-dired-mode-unless-remote
---
 diff-hl-dired.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/diff-hl-dired.el b/diff-hl-dired.el
index efb4b83..663d293 100644
--- a/diff-hl-dired.el
+++ b/diff-hl-dired.el
@@ -1,6 +1,6 @@
 ;;; diff-hl-dired.el --- Highlight changed files in Dired -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2012-2014  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2015  Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -163,6 +163,7 @@ for DIR containing FILES. Call UPDATE-FUNCTION as entries 
are added."
 
 (defalias 'diff-hl-dired-clear 'diff-hl-remove-overlays)
 
+;;;###autoload
 (defun diff-hl-dired-mode-unless-remote ()
   (unless (file-remote-p default-directory)
 (diff-hl-dired-mode)))



[elpa] master 1743a80 07/42: Merge pull request #42 from tarsius/silentio

2015-09-09 Thread Dmitry Gutov
branch: master
commit 1743a80ecc573a0658a98256ea470a366e1e3796
Merge: d6b7d82 733ad33
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #42 from tarsius/silentio

silence byte-compiler
---
 diff-hl-margin.el |2 ++
 diff-hl.el|3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/diff-hl-margin.el b/diff-hl-margin.el
index 4f4..4b359a3 100644
--- a/diff-hl-margin.el
+++ b/diff-hl-margin.el
@@ -38,6 +38,8 @@
 (require 'diff-hl)
 (require 'diff-hl-dired)
 
+(defvar diff-hl-margin-side)
+
 (defvar diff-hl-margin-old-highlight-function nil)
 
 (defgroup diff-hl-margin nil
diff --git a/diff-hl.el b/diff-hl.el
index a3e5447..64f2d75 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -59,7 +59,8 @@
   (require 'cl-lib)
   (require 'vc-git)
   (require 'vc-hg)
-  (require 'face-remap))
+  (require 'face-remap)
+  (declare-function smartrep-define-key 'smartrep))
 
 (defgroup diff-hl nil
   "VC diff highlighting on the side of a window"



[elpa] master d6b7d82 05/42: Support the "next" Magit version

2015-09-09 Thread Dmitry Gutov
branch: master
commit d6b7d82fb618d9ed59b31de1dc3846776f023fc5
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Support the "next" Magit version

Closes #41
---
 README.md  |2 +-
 diff-hl.el |4 
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/README.md b/README.md
index 325f53e..0f9fe64 100644
--- a/README.md
+++ b/README.md
@@ -87,4 +87,4 @@ Magit
 -
 
 If you have a recent enough version installed, it defines
-`magit-revert-buffer-hook`, which we use.
+`magit-revert-buffer-hook` (or `magit-not-reverted-hook`), which we use.
diff --git a/diff-hl.el b/diff-hl.el
index 22a877a..a3e5447 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -453,6 +453,9 @@ in the source file, or the last line of the hunk above it."
 ;; doesn't care about changed VC state.
 ;; https://github.com/magit/magit/issues/603
 (add-hook 'magit-revert-buffer-hook 'diff-hl-update nil t)
+;; Magit 2+ doesn't do the above and calls this instead,
+;; but only when it doesn't call `revert-buffer':
+(add-hook 'magit-not-reverted-hook 'diff-hl-update nil t)
 (add-hook 'auto-revert-mode-hook 'diff-hl-update nil t)
 (add-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps nil t))
 (remove-hook 'after-save-hook 'diff-hl-update t)
@@ -461,6 +464,7 @@ in the source file, or the last line of the hunk above it."
 (remove-hook 'vc-checkin-hook 'diff-hl-update t)
 (remove-hook 'after-revert-hook 'diff-hl-update t)
 (remove-hook 'magit-revert-buffer-hook 'diff-hl-update t)
+(remove-hook 'magit-not-reverted-hook 'diff-hl-update t)
 (remove-hook 'auto-revert-mode-hook 'diff-hl-update t)
 (remove-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps t)
 (diff-hl-remove-overlays)))



[elpa] master 934fef0 11/42: Promote diff-hl-margin-side to diff-hl-side

2015-09-09 Thread Dmitry Gutov
branch: master
commit 934fef05ce831bf4d3d87308be830080b77339c0
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Promote diff-hl-margin-side to diff-hl-side

Closes #45
---
 diff-hl-margin.el |   16 +++-
 diff-hl.el|   32 +++-
 2 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/diff-hl-margin.el b/diff-hl-margin.el
index c040ae7..32aa123 100644
--- a/diff-hl-margin.el
+++ b/diff-hl-margin.el
@@ -38,8 +38,6 @@
 (require 'diff-hl)
 (require 'diff-hl-dired)
 
-(defvar diff-hl-margin-side)
-
 (defvar diff-hl-margin-old-highlight-function nil)
 
 (defgroup diff-hl-margin nil
@@ -74,7 +72,7 @@
   "Toggle displaying `diff-hl-mode' highlights on the margin locally.
 You probably shouldn't use this function directly."
   :lighter ""
-  (let ((width-var (intern (format "%s-margin-width" diff-hl-margin-side
+  (let ((width-var (intern (format "%s-margin-width" diff-hl-side
 (if diff-hl-margin-minor-mode
 (progn
   (set (make-local-variable 'diff-hl-margin-old-highlight-function)
@@ -88,15 +86,7 @@ You probably shouldn't use this function directly."
   (dolist (win (get-buffer-window-list))
 (set-window-buffer win (current-buffer
 
-(defcustom diff-hl-margin-side 'left
-  "Which margin to use for indicators."
-  :type '(choice (const left)
- (const right))
-  :set (lambda (var value)
- (let ((on diff-hl-margin-mode))
-   (when on (diff-hl-margin-mode -1))
-   (set-default var value)
-   (when on (diff-hl-margin-mode 1)
+(define-obsolete-variable-alias 'diff-hl-margin-side 'diff-hl-side "1.7.1")
 
 (defun diff-hl-margin-minor-mode-off ()
   (diff-hl-margin-minor-mode -1))
@@ -116,7 +106,7 @@ You probably shouldn't use this function directly."
(intern (format "diff-hl-%s" 
type)
 
 (defun diff-hl-highlight-on-margin (ovl type _shape)
-  (let ((spec (cdr (assoc (cons type diff-hl-margin-side)
+  (let ((spec (cdr (assoc (cons type diff-hl-side)
   diff-hl-margin-spec-cache
 (overlay-put ovl 'before-string spec)))
 
diff --git a/diff-hl.el b/diff-hl.el
index b0e360c..8057833 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -5,7 +5,7 @@
 ;; Author:   Dmitry Gutov 
 ;; URL:  https://github.com/dgutov/diff-hl
 ;; Keywords: vc, diff
-;; Version:  1.7.0
+;; Version:  1.7.1
 ;; Package-Requires: ((cl-lib "0.2"))
 
 ;; This file is part of GNU Emacs.
@@ -25,9 +25,9 @@
 
 ;;; Commentary:
 
-;; `diff-hl-mode' highlights uncommitted changes on the left side of
-;; the window (using the fringe, by default), allows you to jump
-;; between the hunks and revert them selectively.
+;; `diff-hl-mode' highlights uncommitted changes on the side of the
+;; window (using the fringe, by default), allows you to jump between
+;; the hunks and revert them selectively.
 
 ;; Provided commands:
 ;;
@@ -117,6 +117,16 @@
   :group 'diff-hl
   :type 'function)
 
+(defcustom diff-hl-side 'left
+  "Which side to use for indicators."
+  :type '(choice (const left)
+ (const right))
+  :set (lambda (var value)
+ (let ((on (bound-and-true-p global-diff-hl-mode)))
+   (when on (global-diff-hl-mode -1))
+   (set-default var value)
+   (when on (global-diff-hl-mode 1)
+
 (defvar diff-hl-reference-revision nil
   "Revision to diff against.  nil means the most recent one.")
 
@@ -130,7 +140,7 @@
(if (floatp spacing)
(truncate (* (frame-char-height) spacing))
  spacing)))
- (w (frame-parameter nil 'left-fringe))
+ (w (frame-parameter nil (intern (format "%s-fringe" diff-hl-side
  (middle (make-vector h (expt 2 (1- w
  (ones (1- (expt 2 w)))
  (top (copy-sequence middle))
@@ -169,13 +179,16 @@
 
 (defvar diff-hl-spec-cache (make-hash-table :test 'equal))
 
-(defun diff-hl-fringe-spec (type pos)
-  (let* ((key (list type pos diff-hl-fringe-bmp-function))
+(defun diff-hl-fringe-spec (type pos side)
+  (let* ((key (list type pos side
+diff-hl-fringe-face-function
+diff-hl-fringe-bmp-function))
  (val (gethash key diff-hl-spec-cache)))
 (unless val
   (let* ((face-sym (funcall diff-hl-fringe-face-function type pos))
  (bmp-sym (funcall diff-hl-fringe-bmp-function type pos)))
-(setq val (propertize " " 'display `((left-fringe ,bmp-sym 
,face-sym
+(setq val (propertize " " 'display `((,(intern (format "%s-fringe" 
side))
+  ,bmp-sym ,face-sym
 (puthash key val diff-hl-spec-cache)))
 val))
 
@@ -285,7 +298,8 @@
 o))
 
 (defun diff-hl-highlight-on-fringe (ovl type shape)
-  (overlay-put ovl 'before-string (diff-hl-fringe-spec type shape)))
+  (overlay-put ovl 'before-string (diff-hl-fringe-spec type shape
+ 

[elpa] master bf27c41 15/42: vc-disable-async-diff: Don't bind when it's undefined

2015-09-09 Thread Dmitry Gutov
branch: master
commit bf27c418695214a77cc369b8069f8b9c27d0eb1f
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

vc-disable-async-diff: Don't bind when it's undefined

Fixes #47
---
 diff-hl.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index 5b6510d..8f2221a 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -213,7 +213,8 @@
  (vc-hg-diff-switches nil)
  (vc-svn-diff-switches nil)
  (vc-diff-switches '("-U0"))
- (vc-disable-async-diff t))
+ ,@(when (boundp 'vc-disable-async-diff)
+ '((vc-disable-async-diff t
  ,body))
 
 (defun diff-hl-changes ()



[elpa] master 7ea8159 16/42: Define diff-hl-command-map without destroying existing bindings

2015-09-09 Thread Dmitry Gutov
branch: master
commit 7ea8159acb41adb743342bcab9d8a2efa50868b9
Author: Jonas Bernoulli 
Commit: Jonas Bernoulli 

Define diff-hl-command-map without destroying existing bindings

Keymaps are usually defined using `defvar' which has the advantage that
it only sets a variables value if that is not defined yet.  As a result
re-evaluating (i.e. during development) a buffer that contains such a
definition does not reset the value, which would lose all user
customization.

Unfortunately `define-prefix-command' does not do that.  So use `defvar'
to define the variable and then also store the in the function cell
using `fset'.
---
 diff-hl.el |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index 8f2221a..18b92c7 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -437,13 +437,13 @@ in the source file, or the last line of the hunk above 
it."
   (interactive)
   (diff-hl-next-hunk t))
 
-(define-prefix-command 'diff-hl-command-map)
-
-(let ((map diff-hl-command-map))
-  (define-key map "n" 'diff-hl-revert-hunk)
-  (define-key map "[" 'diff-hl-previous-hunk)
-  (define-key map "]" 'diff-hl-next-hunk)
-  map)
+(defvar diff-hl-command-map
+  (let ((map (make-sparse-keymap)))
+(define-key map "n" 'diff-hl-revert-hunk)
+(define-key map "[" 'diff-hl-previous-hunk)
+(define-key map "]" 'diff-hl-next-hunk)
+map))
+(fset 'diff-hl-command-map diff-hl-command-map)
 
 ;;;###autoload
 (define-minor-mode diff-hl-mode



[elpa] master c79dc5b 13/42: Allow diffing on-the-fly

2015-09-09 Thread Dmitry Gutov
branch: master
commit c79dc5b53485ab6156b9f76c1faa01e824c6b06b
Author: PythonNut 
Commit: PythonNut 

Allow diffing on-the-fly
---
 diff-hl.el |  238 ---
 1 files changed, 161 insertions(+), 77 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index 17106c1..aaf1dfe 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -209,89 +209,155 @@
 
 (defmacro diff-hl-with-diff-switches (body)
   `(let ((vc-git-diff-switches nil)
- (vc-hg-diff-switches nil)
- (vc-svn-diff-switches nil)
- (vc-diff-switches '("-U0"))
- (vc-disable-async-diff t))
+  (vc-hg-diff-switches nil)
+  (vc-svn-diff-switches nil)
+  (vc-diff-switches '("-U0"))
+  (vc-disable-async-diff t))
  ,body))
 
+(defun diff-hl-make-temp-file-name (file rev &optional manual)
+  "Return a backup file name for REV or the current version of FILE.
+If MANUAL is non-nil it means that a name for backups created by
+the user should be returned."
+  (let* ((auto-save-file-name-transforms
+   `((".*" ,temporary-file-directory t
+(expand-file-name
+  (concat (make-auto-save-file-name)
+".~" (subst-char-in-string
+   ?/ ?_ rev)
+(unless manual ".") "~")
+  temporary-file-directory)))
+
+(defun diff-hl-create-revision (file revision)
+  "Read REVISION of FILE into a buffer and return the buffer."
+  (let ((automatic-backup (diff-hl-make-temp-file-name file revision))
+ (filebuf (get-file-buffer file))
+ (filename (diff-hl-make-temp-file-name file revision 'manual)))
+(unless (file-exists-p filename)
+  (if (file-exists-p automatic-backup)
+(rename-file automatic-backup filename nil)
+(with-current-buffer filebuf
+  (let ((failed t)
+ (coding-system-for-read 'no-conversion)
+ (coding-system-for-write 'no-conversion))
+(unwind-protect
+  (with-temp-file filename
+(let ((outbuf (current-buffer)))
+  ;; Change buffer to get local value of
+  ;; vc-checkout-switches.
+  (with-current-buffer filebuf
+(vc-call find-revision file revision outbuf
+  (setq failed nil)
+  (when (and failed (file-exists-p filename))
+(delete-file filename)))
+filename))
+
+(defun diff-hl-diff-buffer-with-revision (revision)
+  "View the differences between BUFFER and its associated file.
+This requires the external program `diff' to be in your `exec-path'."
+  (interactive)
+  (vc-ensure-vc-buffer)
+  (with-current-buffer (get-buffer (current-buffer))
+(let ((rev (diff-hl-create-revision
+ buffer-file-name
+ (or revision
+   (vc-working-revision buffer-file-name
+ (vc-responsible-backend buffer-file-name)
+ t
+   (temporary-file-directory
+ (if (file-directory-p "/dev/shm/")
+   "/dev/shm/"
+   temporary-file-directory)))
+  (diff-hl-with-diff-switches
+(diff-no-select rev (current-buffer) "-U 0" 'noasync
+  (get-buffer-create " *diff-hl-diff*"))
+
+(defvar diff-hl-modified-tick 0)
+(defvar diff-hl-flydiff-timer)
+(make-variable-buffer-local 'diff-hl-modified-tick)
+
 (defun diff-hl-changes ()
   (let* ((file buffer-file-name)
  (backend (vc-backend file)))
 (when backend
   (let ((state (vc-state file backend)))
 (cond
- ((or (eq state 'edited)
-  (and (eq state 'up-to-date)
-   ;; VC state is stale in after-revert-hook.
-   (or revert-buffer-in-progress-p
-   ;; Diffing against an older revision.
-   diff-hl-reference-revision)))
-  (let* ((buf-name " *diff-hl* ")
- diff-auto-refine-mode
- res)
-(diff-hl-with-diff-switches
- (vc-call-backend backend 'diff (list file)
-  diff-hl-reference-revision nil
-  buf-name))
-(with-current-buffer buf-name
-  (goto-char (point-min))
-  (unless (eobp)
-(ignore-errors
-  (diff-beginning-of-hunk t))
-(while (looking-at diff-hunk-header-re-unified)
-  (let ((line (string-to-number (match-string 3)))
-(len (let ((m (match-string 4)))
-   (if m (string-to-number m) 1)))
-(beg (point)))
-(diff-end-of-hunk)
-(let* ((inserts (diff-count-matches "^\\+" beg (point)))
-   (deletes (diff-count-matches "^-" beg (point)))
-   (type (cond ((zerop deletes) 'insert)
-   ((zerop inse

[elpa] master 028b2bf 17/42: Merge pull request #51 from tarsius/keep-bindings

2015-09-09 Thread Dmitry Gutov
branch: master
commit 028b2bf405069d7231e25f2cbf322be0955e6976
Merge: bf27c41 7ea8159
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #51 from tarsius/keep-bindings

Define diff-hl-command-map without destroying existing bindings
---
 diff-hl.el |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index 8f2221a..18b92c7 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -437,13 +437,13 @@ in the source file, or the last line of the hunk above 
it."
   (interactive)
   (diff-hl-next-hunk t))
 
-(define-prefix-command 'diff-hl-command-map)
-
-(let ((map diff-hl-command-map))
-  (define-key map "n" 'diff-hl-revert-hunk)
-  (define-key map "[" 'diff-hl-previous-hunk)
-  (define-key map "]" 'diff-hl-next-hunk)
-  map)
+(defvar diff-hl-command-map
+  (let ((map (make-sparse-keymap)))
+(define-key map "n" 'diff-hl-revert-hunk)
+(define-key map "[" 'diff-hl-previous-hunk)
+(define-key map "]" 'diff-hl-next-hunk)
+map))
+(fset 'diff-hl-command-map diff-hl-command-map)
 
 ;;;###autoload
 (define-minor-mode diff-hl-mode



[elpa] master 34d2802 24/42: No need to remove diff-hl-edit from hooks

2015-09-09 Thread Dmitry Gutov
branch: master
commit 34d2802acaad29daf42a7e2fcc3943aa8de9a282
Author: PythonNut 
Commit: PythonNut 

No need to remove diff-hl-edit from hooks
---
 diff-hl-flydiff.el |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index c1cfe64..d3b5c01 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -182,7 +182,6 @@ This requires the external program `diff' to be in your 
`exec-path'."
   (advice-add 'diff-hl-changes :override #'diff-hl-flydiff/changes)
   (advice-add 'diff-hl-overlay-modified :override #'ignored)
 
-  (remove-hook 'after-change-functions #'diff-hl-edit t)
   (setq diff-hl-flydiff-timer
 (run-with-idle-timer 0.3 t #'diff-hl-update t)))
 
@@ -190,8 +189,6 @@ This requires the external program `diff' to be in your 
`exec-path'."
 (advice-remove 'diff-hl-changes #'diff-hl-flydiff/changes)
 (advice-remove 'diff-hl-overlay-modified #'ignored)
 
-(cancel-timer diff-hl-flydiff-timer)
-(when diff-hl-mode
-  (add-hook 'after-change-functions 'diff-hl-edit nil t
+(cancel-timer diff-hl-flydiff-timer)))
 
 (provide 'diff-hl-flydiff)



[elpa] master 75d4bdc 08/42: Remove CR characters

2015-09-09 Thread Dmitry Gutov
branch: master
commit 75d4bdc4537239e29c7b673e240f75cf62448db3
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Remove CR characters
---
 diff-hl.el | 1050 ++--
 1 files changed, 525 insertions(+), 525 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index 64f2d75..d412a70 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -1,525 +1,525 @@
-;;; diff-hl.el --- Highlight uncommitted changes -*- lexical-binding: t -*-
-
-;; Copyright (C) 2012-2014  Free Software Foundation, Inc.
-
-;; Author:   Dmitry Gutov 
-;; URL:  https://github.com/dgutov/diff-hl
-;; Keywords: vc, diff
-;; Version:  1.7.0
-;; Package-Requires: ((cl-lib "0.2"))
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see .
-
-;;; Commentary:
-
-;; `diff-hl-mode' highlights uncommitted changes on the left side of
-;; the window (using the fringe, by default), allows you to jump
-;; between the hunks and revert them selectively.
-
-;; Provided commands:
-;;
-;; `diff-hl-diff-goto-hunk'  C-x v =
-;; `diff-hl-revert-hunk' C-x v n
-;; `diff-hl-previous-hunk'   C-x v [
-;; `diff-hl-next-hunk'   C-x v ]
-;;
-;; The mode takes advantage of `smartrep' if it is installed.
-
-;; Add either of the following to your init file.
-;;
-;; To use it in all buffers:
-;;
-;; (global-diff-hl-mode)
-;;
-;; Only in `prog-mode' buffers, with `vc-dir' integration:
-;;
-;; (add-hook 'prog-mode-hook 'turn-on-diff-hl-mode)
-;; (add-hook 'vc-dir-mode-hook 'turn-on-diff-hl-mode)
-
-;;; Code:
-
-(require 'fringe)
-(require 'diff-mode)
-(require 'vc)
-(require 'vc-dir)
-(eval-when-compile
-  (require 'cl-lib)
-  (require 'vc-git)
-  (require 'vc-hg)
-  (require 'face-remap)
-  (declare-function smartrep-define-key 'smartrep))
-
-(defgroup diff-hl nil
-  "VC diff highlighting on the side of a window"
-  :group 'vc)
-
-(defface diff-hl-insert
-  '((default :inherit diff-added)
-(((class color)) :foreground "green4"))
-  "Face used to highlight inserted lines."
-  :group 'diff-hl)
-
-(defface diff-hl-delete
-  '((default :inherit diff-removed)
-(((class color)) :foreground "red3"))
-  "Face used to highlight deleted lines."
-  :group 'diff-hl)
-
-(defface diff-hl-change
-  '((default :foreground "blue3")
-(((class color) (min-colors 88) (background light))
- :background "#ff")
-(((class color) (min-colors 88) (background dark))
- :background "#55"))
-  "Face used to highlight changed lines."
-  :group 'diff-hl)
-
-(defcustom diff-hl-command-prefix (kbd "C-x v")
-  "The prefix for all `diff-hl' commands."
-  :group 'diff-hl
-  :type 'string)
-
-(defcustom diff-hl-draw-borders t
-  "Non-nil to draw borders around fringe indicators."
-  :group 'diff-hl
-  :type 'boolean)
-
-(defcustom diff-hl-highlight-function 'diff-hl-highlight-on-fringe
-  "Function to highlight the current line. Its arguments are
-  overlay, change type and position within a hunk."
-  :group 'diff-hl
-  :type 'function)
-
-(defcustom diff-hl-fringe-bmp-function 'diff-hl-fringe-bmp-from-pos
-  "Function to choose the fringe bitmap for a given change type
-  and position within a hunk.  Should accept two arguments."
-  :group 'diff-hl
-  :type '(choice (const diff-hl-fringe-bmp-from-pos)
- (const diff-hl-fringe-bmp-from-type)
- function))
-
-(defcustom diff-hl-fringe-face-function 'diff-hl-fringe-face-from-type
-  "Function to choose the fringe face for a given change type
-  and position within a hunk.  Should accept two arguments."
-  :group 'diff-hl
-  :type 'function)
-
-(defvar diff-hl-reference-revision nil
-  "Revision to diff against.  nil means the most recent one.")
-
-(defun diff-hl-define-bitmaps ()
-  (let* ((scale (if (and (boundp 'text-scale-mode-amount)
- (numberp text-scale-mode-amount))
-(expt text-scale-mode-step text-scale-mode-amount)
-  1))
- (spacing (or (and (display-graphic-p) (default-value 'line-spacing)) 
0))
- (h (+ (ceiling (* (frame-char-height) scale))
-   (if (floatp spacing)
-   (truncate (* (frame-char-height) spacing))
- spacing)))
- (w (frame-parameter nil 'left-fringe))
- (middle (make-vector h (expt 2 (1- w
- (ones (1- (expt 2 w)))
- (top (copy-sequence middle))
- (bottom (

[elpa] master 0db7160 21/42: Change version predicate for vc-git polyfilling

2015-09-09 Thread Dmitry Gutov
branch: master
commit 0db71602079f1902908ca2b896f575818d6da1c0
Author: PythonNut 
Commit: PythonNut 

Change version predicate for vc-git polyfilling
---
 diff-hl-flydiff.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 2335074..b464ec6 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -32,7 +32,7 @@
 (make-variable-buffer-local 'diff-hl-flydiff-modified-tick)
 
 ;; Polyfill concrete revisions for vc-git-working-revision in Emacs 24.4, 24.5
-(when (version<= emacs-version "24.5")
+(when (version<= emacs-version "25.0")
   (with-eval-after-load 'vc-git
 (defun vc-git--symbolic-ref (file)
   (or



[elpa] master 4bd5166 28/42: Update copyright year(s) for diff-hl-flydiff

2015-09-09 Thread Dmitry Gutov
branch: master
commit 4bd5166326b430a24fc1f9ea5e2113216ea34476
Author: PythonNut 
Commit: PythonNut 

Update copyright year(s) for diff-hl-flydiff
---
 diff-hl-flydiff.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 04bf1b9..44c0985 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2012-2013  Free Software Foundation, Inc.
+;; Copyright (C) 2015 Free Software Foundation, Inc.
 
 ;; Author:   Jonathan Hayase 
 ;; URL:  https://github.com/dgutov/diff-hl



[elpa] master 3ab3aae 29/42: Fix *another* usage of "ignored"

2015-09-09 Thread Dmitry Gutov
branch: master
commit 3ab3aae34077bdef5ed0d1f01e877a9baca0b6fa
Author: PythonNut 
Commit: PythonNut 

Fix *another* usage of "ignored"
---
 diff-hl-flydiff.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 44c0985..1c58a52 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -183,7 +183,7 @@ This requires the external program `diff' to be in your 
`exec-path'."
 (progn
   (advice-add 'diff-hl-update :around #'diff-hl-flydiff/update)
   (advice-add 'diff-hl-changes :override #'diff-hl-flydiff/changes)
-  (advice-add 'diff-hl-overlay-modified :override #'ignored)
+  (advice-add 'diff-hl-overlay-modified :override #'ignore)
 
   (setq diff-hl-flydiff-timer
 (run-with-idle-timer 0.3 t #'diff-hl-update t)))



[elpa] master e0f8fe1 23/42: Require nadvice at toplevel

2015-09-09 Thread Dmitry Gutov
branch: master
commit e0f8fe106187ffa1f1034b7fb3b72c10f9010c6c
Author: PythonNut 
Commit: PythonNut 

Require nadvice at toplevel
---
 diff-hl-flydiff.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 4cd2bad..c1cfe64 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -26,6 +26,7 @@
 ;;; Code:
 
 (require 'diff-hl)
+(require 'nadvice)
 
 (defvar diff-hl-flydiff-modified-tick 0)
 (defvar diff-hl-flydiff-timer)
@@ -177,7 +178,6 @@ This requires the external program `diff' to be in your 
`exec-path'."
   :global t
   (if diff-hl-flydiff-mode
 (progn
-  (require 'nadvice)
   (advice-add 'diff-hl-update :around #'diff-hl-flydiff/update)
   (advice-add 'diff-hl-changes :override #'diff-hl-flydiff/changes)
   (advice-add 'diff-hl-overlay-modified :override #'ignored)



[elpa] master 15aa2b8 26/42: Fix usage of "ignored"

2015-09-09 Thread Dmitry Gutov
branch: master
commit 15aa2b8ad5af74cc1033a34e025101d77b17d3a7
Author: PythonNut 
Commit: PythonNut 

Fix usage of "ignored"
---
 diff-hl-flydiff.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 0b7781e..c065831 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -188,7 +188,7 @@ This requires the external program `diff' to be in your 
`exec-path'."
 
 (advice-remove 'diff-hl-update #'diff-hl-flydiff/update)
 (advice-remove 'diff-hl-changes #'diff-hl-flydiff/changes)
-(advice-remove 'diff-hl-overlay-modified #'ignored)
+(advice-remove 'diff-hl-overlay-modified #'ignore)
 
 (cancel-timer diff-hl-flydiff-timer)))
 



[elpa] master 3fa2b54 25/42: Prefer using /dev/shm for temporary files

2015-09-09 Thread Dmitry Gutov
branch: master
commit 3fa2b547a75fdaf7166cdd1fe71920d3aaf0364d
Author: PythonNut 
Commit: PythonNut 

Prefer using /dev/shm for temporary files
---
 diff-hl-flydiff.el |   17 +
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index d3b5c01..0b7781e 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -109,14 +109,15 @@ This requires the external program `diff' to be in your 
`exec-path'."
   (interactive)
   (vc-ensure-vc-buffer)
   (with-current-buffer (get-buffer (current-buffer))
-(let ((rev (diff-hl-flydiff-create-revision
- buffer-file-name
- (vc-working-revision buffer-file-name
-   (vc-responsible-backend buffer-file-name
-   (temporary-file-directory
- (if (file-directory-p "/dev/shm/")
-   "/dev/shm/"
-   temporary-file-directory)))
+(let* ((file buffer-file-name)
+(temporary-file-directory
+  (if (file-directory-p "/dev/shm/")
+"/dev/shm/"
+temporary-file-directory))
+(rev (diff-hl-flydiff-create-revision
+   file
+   (vc-working-revision file
+ (vc-responsible-backend file)
   (diff-no-select rev (current-buffer) "-U 0" 'noasync
 (get-buffer-create " *diff-hl-diff*")
 



[elpa] master 66e521a 19/42: Add diff-hl-flydiff as a separate file

2015-09-09 Thread Dmitry Gutov
branch: master
commit 66e521a749697c0a6e52f74c4181d53b9563fd6d
Author: PythonNut 
Commit: PythonNut 

Add diff-hl-flydiff as a separate file
---
 diff-hl-flydiff.el |  200 
 1 files changed, 200 insertions(+), 0 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
new file mode 100644
index 000..3d7c2c7
--- /dev/null
+++ b/diff-hl-flydiff.el
@@ -0,0 +1,200 @@
+;; Copyright (C) 2012-2013  Free Software Foundation, Inc.
+
+;; Author:   Jonathan Hayase 
+;; URL:  https://github.com/dgutov/diff-hl
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see .
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'diff-hl)
+
+(defvar diff-hl-flydiff-modified-tick 0)
+(defvar diff-hl-flydiff-timer)
+(make-variable-buffer-local 'diff-hl-flydiff-modified-tick)
+
+;; Polyfill concrete revisions for vc-git-working-revision in Emacs 24.4, 24.5
+(when (version<= emacs-version "24.5")
+  (with-eval-after-load 'vc-git
+(defun vc-git--symbolic-ref (file)
+  (or
+(vc-file-getprop file 'vc-git-symbolic-ref)
+(let* (process-file-side-effects
+(str (vc-git--run-command-string nil "symbolic-ref" "HEAD")))
+  (vc-file-setprop file 'vc-git-symbolic-ref
+(if str
+  (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
+(match-string 2 str)
+str))
+
+(defun diff-hl-flydiff/vc-git-working-revision (_file)
+  "Git-specific version of `vc-working-revision'."
+  (let (process-file-side-effects)
+(vc-git--rev-parse "HEAD")))
+
+(defun diff-hl-flydiff/vc-git-mode-line-string (file)
+  "Return a string for `vc-mode-line' to put in the mode line for FILE."
+  (let* ((rev (vc-working-revision file))
+  (disp-rev (or (vc-git--symbolic-ref file)
+  (substring rev 0 7)))
+  (def-ml (vc-default-mode-line-string 'Git file))
+  (help-echo (get-text-property 0 'help-echo def-ml)))
+(propertize (replace-regexp-in-string (concat rev "\\'") disp-rev 
def-ml t t)
+  'help-echo (concat help-echo "\nCurrent revision: " rev
+
+(advice-add 'vc-git-working-revision :override
+  #'diff-hl-flydiff/vc-git-working-revision)
+(advice-add 'vc-git-mode-line-string :override
+  #'diff-hl-flydiff/vc-git-mode-line-string)))
+
+(defun diff-hl-flydiff-make-temp-file-name (file rev &optional manual)
+  "Return a backup file name for REV or the current version of FILE.
+If MANUAL is non-nil it means that a name for backups created by
+the user should be returned."
+  (let* ((auto-save-file-name-transforms
+   `((".*" ,temporary-file-directory t
+(expand-file-name
+  (concat (make-auto-save-file-name)
+".~" (subst-char-in-string
+   ?/ ?_ rev)
+(unless manual ".") "~")
+  temporary-file-directory)))
+
+(defun diff-hl-flydiff-create-revision (file revision)
+  "Read REVISION of FILE into a buffer and return the buffer."
+  (let ((automatic-backup (diff-hl-flydiff-make-temp-file-name file revision))
+ (filebuf (get-file-buffer file))
+ (filename (diff-hl-flydiff-make-temp-file-name file revision 
'manual)))
+(unless (file-exists-p filename)
+  (if (file-exists-p automatic-backup)
+(rename-file automatic-backup filename nil)
+(with-current-buffer filebuf
+  (let ((failed t)
+ (coding-system-for-read 'no-conversion)
+ (coding-system-for-write 'no-conversion))
+(unwind-protect
+  (with-temp-file filename
+(let ((outbuf (current-buffer)))
+  ;; Change buffer to get local value of
+  ;; vc-checkout-switches.
+  (with-current-buffer filebuf
+(vc-call find-revision file revision outbuf
+  (setq failed nil)
+  (when (and failed (file-exists-p filename))
+(delete-file filename)))
+filename))
+
+(defun diff-hl-flydiff-buffer-with-head ()
+  "View the differences between BUFFER and its associated file.
+This requires the external program `diff' to be in your `exec-path'."
+  (interactive)
+  (vc-ensure-vc-buffer)
+  (with-current-buffer (get-buffer (current-buffer))
+(let ((rev (diff

[elpa] master 45ac71d 18/42: Revert "Allow diffing on-the-fly"

2015-09-09 Thread Dmitry Gutov
branch: master
commit 45ac71dd6ba6decc9f990e784a543329559c09a4
Author: PythonNut 
Commit: PythonNut 

Revert "Allow diffing on-the-fly"

This reverts commit c79dc5b53485ab6156b9f76c1faa01e824c6b06b.
---
 diff-hl.el |  238 +++
 1 files changed, 77 insertions(+), 161 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index aaf1dfe..17106c1 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -209,155 +209,89 @@
 
 (defmacro diff-hl-with-diff-switches (body)
   `(let ((vc-git-diff-switches nil)
-  (vc-hg-diff-switches nil)
-  (vc-svn-diff-switches nil)
-  (vc-diff-switches '("-U0"))
-  (vc-disable-async-diff t))
+ (vc-hg-diff-switches nil)
+ (vc-svn-diff-switches nil)
+ (vc-diff-switches '("-U0"))
+ (vc-disable-async-diff t))
  ,body))
 
-(defun diff-hl-make-temp-file-name (file rev &optional manual)
-  "Return a backup file name for REV or the current version of FILE.
-If MANUAL is non-nil it means that a name for backups created by
-the user should be returned."
-  (let* ((auto-save-file-name-transforms
-   `((".*" ,temporary-file-directory t
-(expand-file-name
-  (concat (make-auto-save-file-name)
-".~" (subst-char-in-string
-   ?/ ?_ rev)
-(unless manual ".") "~")
-  temporary-file-directory)))
-
-(defun diff-hl-create-revision (file revision)
-  "Read REVISION of FILE into a buffer and return the buffer."
-  (let ((automatic-backup (diff-hl-make-temp-file-name file revision))
- (filebuf (get-file-buffer file))
- (filename (diff-hl-make-temp-file-name file revision 'manual)))
-(unless (file-exists-p filename)
-  (if (file-exists-p automatic-backup)
-(rename-file automatic-backup filename nil)
-(with-current-buffer filebuf
-  (let ((failed t)
- (coding-system-for-read 'no-conversion)
- (coding-system-for-write 'no-conversion))
-(unwind-protect
-  (with-temp-file filename
-(let ((outbuf (current-buffer)))
-  ;; Change buffer to get local value of
-  ;; vc-checkout-switches.
-  (with-current-buffer filebuf
-(vc-call find-revision file revision outbuf
-  (setq failed nil)
-  (when (and failed (file-exists-p filename))
-(delete-file filename)))
-filename))
-
-(defun diff-hl-diff-buffer-with-revision (revision)
-  "View the differences between BUFFER and its associated file.
-This requires the external program `diff' to be in your `exec-path'."
-  (interactive)
-  (vc-ensure-vc-buffer)
-  (with-current-buffer (get-buffer (current-buffer))
-(let ((rev (diff-hl-create-revision
- buffer-file-name
- (or revision
-   (vc-working-revision buffer-file-name
- (vc-responsible-backend buffer-file-name)
- t
-   (temporary-file-directory
- (if (file-directory-p "/dev/shm/")
-   "/dev/shm/"
-   temporary-file-directory)))
-  (diff-hl-with-diff-switches
-(diff-no-select rev (current-buffer) "-U 0" 'noasync
-  (get-buffer-create " *diff-hl-diff*"))
-
-(defvar diff-hl-modified-tick 0)
-(defvar diff-hl-flydiff-timer)
-(make-variable-buffer-local 'diff-hl-modified-tick)
-
 (defun diff-hl-changes ()
   (let* ((file buffer-file-name)
  (backend (vc-backend file)))
 (when backend
   (let ((state (vc-state file backend)))
 (cond
-  ((or
- (and
-   diff-hl-flydiff-mode
-   (buffer-modified-p))
- (eq state 'edited)
- (and (eq state 'up-to-date)
-   ;; VC state is stale in after-revert-hook.
-   (or revert-buffer-in-progress-p
- ;; Diffing against an older revision.
- diff-hl-reference-revision)))
-(let (diff-auto-refine-mode res)
-  (with-current-buffer (diff-hl-diff-buffer-with-revision
- diff-hl-reference-revision)
-(goto-char (point-min))
-(unless (eobp)
-  (ignore-errors
-(diff-beginning-of-hunk t))
-  (while (looking-at diff-hunk-header-re-unified)
-(let ((line (string-to-number (match-string 3)))
-   (len (let ((m (match-string 4)))
-  (if m (string-to-number m) 1)))
-   (beg (point)))
-  (diff-end-of-hunk)
-  (let* ((inserts (diff-count-matches "^\\+" beg (point)))
-  (deletes (diff-count-matches "^-" beg (point)))
-  (type (cond ((zerop deletes) 'insert)
- 

[elpa] master f300548 33/42: Merge pull request #50 from PythonNut/master

2015-09-09 Thread Dmitry Gutov
branch: master
commit f30054876d5fb5c7c320b60b32f8557ee79c4cde
Merge: 028b2bf 418dbc7
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #50 from PythonNut/master

[WIP] Allow diffing on-the-fly
---
 README.md  |6 +--
 diff-hl-flydiff.el |  169 
 diff-hl.el |   33 ++
 3 files changed, 189 insertions(+), 19 deletions(-)

diff --git a/README.md b/README.md
index a0d5168..20274bb 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@ The package also contains auxiliary modes:
 * `diff-hl-margin-mode` changes the highlighting function to
   use the margin instead of the fringe.
 * `diff-hl-amend-mode` shifts the reference revision back by one.
+* `diff-hl-flydiff-mode` enables diffing unsaved changes
 
 Check out the Commentary section in each respective file for the usage
 instructions.
@@ -46,11 +47,6 @@ Emacs 24+. On OS X, Emacs 24.3 or higher is recommended.
 Notes
 =
 
-* Since it uses the corresponding VC diff command, it's only accurate when the
-  buffer is in saved state. Highlighting changes "on the fly" might be better,
-  maybe we can do something similar to `highlight-markup-buffers` with a hidden
-  buffer containing the unmodified copy.
-
 * We conflict with other modes when they put indicators on the fringe,
   such as [Flycheck](https://github.com/flycheck/flycheck). This is
   rarely a significant problem, since if you're using such a mode,
diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
new file mode 100644
index 000..b5f6b4c
--- /dev/null
+++ b/diff-hl-flydiff.el
@@ -0,0 +1,169 @@
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author:   Jonathan Hayase 
+;; URL:  https://github.com/dgutov/diff-hl
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see .
+
+;;; Commentary:
+
+;; This mode enables diffing on-the-fly (i.e. without saving the buffer first)
+;; Toggle in all buffers with M-x diff-hl-flydiff-mode
+
+;;; Code:
+
+(require 'diff-hl)
+(require 'nadvice)
+
+(defvar diff-hl-flydiff-modified-tick 0)
+(defvar diff-hl-flydiff-timer)
+(make-variable-buffer-local 'diff-hl-flydiff-modified-tick)
+
+;; Polyfill concrete revisions for vc-git-working-revision in Emacs 24.4, 24.5
+(when (version<= emacs-version "25.0")
+  (with-eval-after-load 'vc-git
+(defun vc-git--symbolic-ref (file)
+  (or
+(vc-file-getprop file 'vc-git-symbolic-ref)
+(let* (process-file-side-effects
+(str (vc-git--run-command-string nil "symbolic-ref" "HEAD")))
+  (vc-file-setprop file 'vc-git-symbolic-ref
+(if str
+  (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
+(match-string 2 str)
+str))
+
+(defun diff-hl-flydiff/vc-git-working-revision (_file)
+  "Git-specific version of `vc-working-revision'."
+  (let (process-file-side-effects)
+(vc-git--rev-parse "HEAD")))
+
+(defun diff-hl-flydiff/vc-git-mode-line-string (file)
+  "Return a string for `vc-mode-line' to put in the mode line for FILE."
+  (let* ((rev (vc-working-revision file))
+  (disp-rev (or (vc-git--symbolic-ref file)
+  (substring rev 0 7)))
+  (def-ml (vc-default-mode-line-string 'Git file))
+  (help-echo (get-text-property 0 'help-echo def-ml)))
+(propertize (replace-regexp-in-string (concat rev "\\'") disp-rev 
def-ml t t)
+  'help-echo (concat help-echo "\nCurrent revision: " rev
+
+(advice-add 'vc-git-working-revision :override
+  #'diff-hl-flydiff/vc-git-working-revision)
+(advice-add 'vc-git-mode-line-string :override
+  #'diff-hl-flydiff/vc-git-mode-line-string)))
+
+(defun diff-hl-flydiff/working-revision (file)
+  "Like vc-working-revision, but always up-to-date"
+  (vc-file-setprop file 'vc-working-revision
+(vc-call-backend (vc-backend file) 'working-revision file)))
+
+(defun diff-hl-flydiff-make-temp-file-name (file rev &optional manual)
+  "Return a backup file name for REV or the current version of FILE.
+If MANUAL is non-nil it means that a name for backups created by
+the user should be returned."
+  (let* ((auto-save-file-name-transforms
+   `((".*" ,temporary-file-directory t
+(expand-file-name
+  (concat (make-auto-save-file-nam

[elpa] master eb92f0e 04/42: Merge pull request #39 from jamessan/diff-hl-margin-load-error

2015-09-09 Thread Dmitry Gutov
branch: master
commit eb92f0e99c0de4d51b80d307fdb92e0533ff9e74
Merge: d188525 5bfb314
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #39 from jamessan/diff-hl-margin-load-error

Move diff-hl-margin-side after diff-hl-margin-mode definition
---
 diff-hl-margin.el |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/diff-hl-margin.el b/diff-hl-margin.el
index 26fa7ad..4f4 100644
--- a/diff-hl-margin.el
+++ b/diff-hl-margin.el
@@ -44,16 +44,6 @@
   "Highlight buffer changes on margin"
   :group 'diff-hl)
 
-(defcustom diff-hl-margin-side 'left
-  "Which margin to use for indicators."
-  :type '(choice (const left)
- (const right))
-  :set (lambda (var value)
- (let ((on diff-hl-margin-mode))
-   (when on (diff-hl-margin-mode -1))
-   (set-default var value)
-   (when on (diff-hl-margin-mode 1)
-
 ;;;###autoload
 (define-minor-mode diff-hl-margin-mode
   "Toggle displaying `diff-hl-mode' highlights on the margin."
@@ -96,6 +86,16 @@ You probably shouldn't use this function directly."
   (dolist (win (get-buffer-window-list))
 (set-window-buffer win (current-buffer
 
+(defcustom diff-hl-margin-side 'left
+  "Which margin to use for indicators."
+  :type '(choice (const left)
+ (const right))
+  :set (lambda (var value)
+ (let ((on diff-hl-margin-mode))
+   (when on (diff-hl-margin-mode -1))
+   (set-default var value)
+   (when on (diff-hl-margin-mode 1)
+
 (defun diff-hl-margin-minor-mode-off ()
   (diff-hl-margin-minor-mode -1))
 



[elpa] master 8d313db 36/42: Use --strip-trailing-cr

2015-09-09 Thread Dmitry Gutov
branch: master
commit 8d313db758db8484a7ab487aa9a92b654f204344
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Use --strip-trailing-cr

#50
---
 diff-hl-flydiff.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 02169cc..b89401d 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -122,7 +122,7 @@ This requires the external program `diff' to be in your 
`exec-path'."
temporary-file-directory))
 (rev (diff-hl-flydiff-create-revision file
(diff-hl-flydiff/working-revision file
-  (diff-no-select rev (current-buffer) "-U 0" 'noasync
+  (diff-no-select rev (current-buffer) "-U 0 --strip-trailing-cr" 'noasync
 (get-buffer-create " *diff-hl-diff*")
 
 (defun diff-hl-flydiff/update (old-fun &optional auto)



[elpa] master a454a24 42/42: Merge commit '7fa7f099c7008d521dbbb57a1546f11535544536' from diff-hl

2015-09-09 Thread Dmitry Gutov
branch: master
commit a454a247a9c98b5a5c6eaee3957a9378e8aa483e
Merge: cde5d9a 7fa7f09
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge commit '7fa7f099c7008d521dbbb57a1546f11535544536' from diff-hl
---
 packages/diff-hl/README.md  |   14 +-
 packages/diff-hl/diff-hl-dired.el   |   11 +-
 packages/diff-hl/diff-hl-flydiff.el |  182 ++
 packages/diff-hl/diff-hl-margin.el  |   18 +-
 packages/diff-hl/diff-hl.el | 1068 ++-
 5 files changed, 751 insertions(+), 542 deletions(-)

diff --git a/packages/diff-hl/README.md b/packages/diff-hl/README.md
index 325f53e..ab8c9d8 100644
--- a/packages/diff-hl/README.md
+++ b/packages/diff-hl/README.md
@@ -15,6 +15,8 @@ The package also contains auxiliary modes:
 * `diff-hl-margin-mode` changes the highlighting function to
   use the margin instead of the fringe.
 * `diff-hl-amend-mode` shifts the reference revision back by one.
+* `diff-hl-flydiff-mode` implements highlighting changes on the fly.
+  It requires Emacs 24.4 or newer.
 
 Check out the Commentary section in each respective file for the usage
 instructions.
@@ -46,10 +48,9 @@ Emacs 24+. On OS X, Emacs 24.3 or higher is recommended.
 Notes
 =
 
-* Since it uses the corresponding VC diff command, it's only accurate when the
-  buffer is in saved state. Highlighting changes "on the fly" might be better,
-  maybe we can do something similar to `highlight-markup-buffers` with a hidden
-  buffer containing the unmodified copy.
+* By default `diff-hl-mode` uses the corresponding VC diff command, so
+  it's only accurate when the buffer is in saved state. Check out
+  `diff-hl-flydiff-mode`, it aims to handle unsaved buffers as well.
 
 * We conflict with other modes when they put indicators on the fringe,
   such as [Flycheck](https://github.com/flycheck/flycheck). This is
@@ -63,6 +64,9 @@ Notes
 
 * Frame-local and buffer-local values of `line-spacing` are not supported.
 
+* Fringe width up to 16 works best (because we can't define a bitmap
+  with width above that number).
+
 * [emacs-git-gutter](https://github.com/syohex/emacs-git-gutter) shows
   indicators in the margin by default, allows you to customize how the
   indicators look more easily, and has a "stage hunk" command.
@@ -87,4 +91,4 @@ Magit
 -
 
 If you have a recent enough version installed, it defines
-`magit-revert-buffer-hook`, which we use.
+`magit-revert-buffer-hook` (or `magit-not-reverted-hook`), which we use.
diff --git a/packages/diff-hl/diff-hl-dired.el 
b/packages/diff-hl/diff-hl-dired.el
index 09cf851..663d293 100644
--- a/packages/diff-hl/diff-hl-dired.el
+++ b/packages/diff-hl/diff-hl-dired.el
@@ -1,6 +1,6 @@
 ;;; diff-hl-dired.el --- Highlight changed files in Dired -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2012-2014  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2015  Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -126,10 +126,12 @@
   (append dirs-alist files-alist))
  )
 
-(defun diff-hl-dired-status-files (backend dir files uf)
+(defun diff-hl-dired-status-files (backend dir files update-function)
+   "Using version control BACKEND, return list of (FILE STATE EXTRA) entries
+for DIR containing FILES. Call UPDATE-FUNCTION as entries are added."
   (if (version< "25" emacs-version)
-  (vc-call-backend backend 'dir-status-files dir files uf)
-(vc-call-backend backend 'dir-status-files dir files nil uf)))
+  (vc-call-backend backend 'dir-status-files dir files update-function)
+(vc-call-backend backend 'dir-status-files dir files nil update-function)))
 
 (when (version< emacs-version "24.4.51.5")
   ;; Work around http://debbugs.gnu.org/19386
@@ -161,6 +163,7 @@
 
 (defalias 'diff-hl-dired-clear 'diff-hl-remove-overlays)
 
+;;;###autoload
 (defun diff-hl-dired-mode-unless-remote ()
   (unless (file-remote-p default-directory)
 (diff-hl-dired-mode)))
diff --git a/packages/diff-hl/diff-hl-flydiff.el 
b/packages/diff-hl/diff-hl-flydiff.el
new file mode 100644
index 000..53d31f7
--- /dev/null
+++ b/packages/diff-hl/diff-hl-flydiff.el
@@ -0,0 +1,182 @@
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author:   Jonathan Hayase 
+;; URL:  https://github.com/dgutov/diff-hl
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see .
+
+;;; Commentary:
+
+;; 

[elpa] master d188525 02/42: Merge pull request #37 from holocronweaver/documentation

2015-09-09 Thread Dmitry Gutov
branch: master
commit d18852545a3aa236d7dd73b8e9f8bac0e4ec2d48
Merge: 6ea154f 38a83db
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #37 from holocronweaver/documentation

Add documentation for diff-hl-dired-status-files.
---
 diff-hl-dired.el |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/diff-hl-dired.el b/diff-hl-dired.el
index 09cf851..efb4b83 100644
--- a/diff-hl-dired.el
+++ b/diff-hl-dired.el
@@ -126,10 +126,12 @@
   (append dirs-alist files-alist))
  )
 
-(defun diff-hl-dired-status-files (backend dir files uf)
+(defun diff-hl-dired-status-files (backend dir files update-function)
+   "Using version control BACKEND, return list of (FILE STATE EXTRA) entries
+for DIR containing FILES. Call UPDATE-FUNCTION as entries are added."
   (if (version< "25" emacs-version)
-  (vc-call-backend backend 'dir-status-files dir files uf)
-(vc-call-backend backend 'dir-status-files dir files nil uf)))
+  (vc-call-backend backend 'dir-status-files dir files update-function)
+(vc-call-backend backend 'dir-status-files dir files nil update-function)))
 
 (when (version< emacs-version "24.4.51.5")
   ;; Work around http://debbugs.gnu.org/19386



[elpa] master 733ad33 06/42: silence byte-compiler

2015-09-09 Thread Dmitry Gutov
branch: master
commit 733ad3361c6402b3ae0b630d502d813fc2ea4352
Author: Jonas Bernoulli 
Commit: Jonas Bernoulli 

silence byte-compiler
---
 diff-hl-margin.el |2 ++
 diff-hl.el|3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/diff-hl-margin.el b/diff-hl-margin.el
index 4f4..4b359a3 100644
--- a/diff-hl-margin.el
+++ b/diff-hl-margin.el
@@ -38,6 +38,8 @@
 (require 'diff-hl)
 (require 'diff-hl-dired)
 
+(defvar diff-hl-margin-side)
+
 (defvar diff-hl-margin-old-highlight-function nil)
 
 (defgroup diff-hl-margin nil
diff --git a/diff-hl.el b/diff-hl.el
index a3e5447..64f2d75 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -59,7 +59,8 @@
   (require 'cl-lib)
   (require 'vc-git)
   (require 'vc-hg)
-  (require 'face-remap))
+  (require 'face-remap)
+  (declare-function smartrep-define-key 'smartrep))
 
 (defgroup diff-hl nil
   "VC diff highlighting on the side of a window"



[elpa] master 7fa7f09 41/42: Bump the version

2015-09-09 Thread Dmitry Gutov
branch: master
commit 7fa7f099c7008d521dbbb57a1546f11535544536
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Bump the version
---
 diff-hl.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index ec3d435..8790352 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -5,7 +5,7 @@
 ;; Author:   Dmitry Gutov 
 ;; URL:  https://github.com/dgutov/diff-hl
 ;; Keywords: vc, diff
-;; Version:  1.7.1
+;; Version:  1.8.0
 ;; Package-Requires: ((cl-lib "0.2"))
 
 ;; This file is part of GNU Emacs.



[elpa] master a16b225 38/42: One fewer version check

2015-09-09 Thread Dmitry Gutov
branch: master
commit a16b225e15f3b875b5ed35f9e92b590924dfe03a
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

One fewer version check

Closes #54
---
 diff-hl-flydiff.el |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 17ab769..0c421ce 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -27,9 +27,8 @@
 
 (require 'diff-hl)
 (require 'diff)
-(if (version< emacs-version "24.4")
-(error "`diff-hl-flydiff-mode' requires Emacs 24.4 or newer")
-  (require 'nadvice))
+(unless (require 'nadvice nil t)
+  (error "`diff-hl-flydiff-mode' requires Emacs 24.4 or newer"))
 
 (defvar diff-hl-flydiff-modified-tick 0)
 (defvar diff-hl-flydiff-timer)



[elpa] master 7428f4a 37/42: Reduce warnings during byte-compilation; don't error b-c in <24.4

2015-09-09 Thread Dmitry Gutov
branch: master
commit 7428f4aab0060e77fac1945aa2aa86be7c6c9b94
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Reduce warnings during byte-compilation; don't error b-c in <24.4

#54
---
 diff-hl-flydiff.el |   65 +++
 1 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index b89401d..17ab769 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -26,47 +26,50 @@
 ;;; Code:
 
 (require 'diff-hl)
-(require 'nadvice)
+(require 'diff)
+(if (version< emacs-version "24.4")
+(error "`diff-hl-flydiff-mode' requires Emacs 24.4 or newer")
+  (require 'nadvice))
 
 (defvar diff-hl-flydiff-modified-tick 0)
 (defvar diff-hl-flydiff-timer)
 (make-variable-buffer-local 'diff-hl-flydiff-modified-tick)
 
+(defun diff-hl-flydiff/vc-git--symbolic-ref (file)
+  (or
+   (vc-file-getprop file 'vc-git-symbolic-ref)
+   (let* (process-file-side-effects
+  (str (vc-git--run-command-string nil "symbolic-ref" "HEAD")))
+ (vc-file-setprop file 'vc-git-symbolic-ref
+  (if str
+  (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
+  (match-string 2 str)
+str))
+
+(defun diff-hl-flydiff/vc-git-working-revision (_file)
+  "Git-specific version of `vc-working-revision'."
+  (let (process-file-side-effects)
+(vc-git--rev-parse "HEAD")))
+
+(defun diff-hl-flydiff/vc-git-mode-line-string (file)
+  "Return a string for `vc-mode-line' to put in the mode line for FILE."
+  (let* ((rev (vc-working-revision file))
+ (disp-rev (or (diff-hl-flydiff/vc-git--symbolic-ref file)
+   (substring rev 0 7)))
+ (def-ml (vc-default-mode-line-string 'Git file))
+ (help-echo (get-text-property 0 'help-echo def-ml))
+ (face   (get-text-property 0 'face def-ml)))
+(propertize (replace-regexp-in-string (concat rev "\\'") disp-rev def-ml t 
t)
+'face face
+'help-echo (concat help-echo "\nCurrent revision: " rev
+
 ;; Polyfill concrete revisions for vc-git-working-revision in Emacs 24.4, 24.5
 (when (version<= emacs-version "25.0")
   (with-eval-after-load 'vc-git
-(defun vc-git--symbolic-ref (file)
-  (or
-(vc-file-getprop file 'vc-git-symbolic-ref)
-(let* (process-file-side-effects
-(str (vc-git--run-command-string nil "symbolic-ref" "HEAD")))
-  (vc-file-setprop file 'vc-git-symbolic-ref
-(if str
-  (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
-(match-string 2 str)
-str))
-
-(defun diff-hl-flydiff/vc-git-working-revision (_file)
-  "Git-specific version of `vc-working-revision'."
-  (let (process-file-side-effects)
-(vc-git--rev-parse "HEAD")))
-
-(defun diff-hl-flydiff/vc-git-mode-line-string (file)
-  "Return a string for `vc-mode-line' to put in the mode line for FILE."
-  (let* ((rev (vc-working-revision file))
-  (disp-rev (or (vc-git--symbolic-ref file)
-  (substring rev 0 7)))
-  (def-ml (vc-default-mode-line-string 'Git file))
-  (help-echo (get-text-property 0 'help-echo def-ml))
-  (face   (get-text-property 0 'face def-ml)))
-(propertize (replace-regexp-in-string (concat rev "\\'") disp-rev 
def-ml t t)
-'face face
-'help-echo (concat help-echo "\nCurrent revision: " rev
-
 (advice-add 'vc-git-working-revision :override
-  #'diff-hl-flydiff/vc-git-working-revision)
+#'diff-hl-flydiff/vc-git-working-revision)
 (advice-add 'vc-git-mode-line-string :override
-  #'diff-hl-flydiff/vc-git-mode-line-string)))
+#'diff-hl-flydiff/vc-git-mode-line-string)))
 
 (defun diff-hl-flydiff/working-revision (file)
   "Like vc-working-revision, but always up-to-date"



[elpa] master 84d5110 09/42: Bump the copyright years

2015-09-09 Thread Dmitry Gutov
branch: master
commit 84d5110e2a8ded2db6ca487f48abdb57262334de
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Bump the copyright years
---
 diff-hl-margin.el |2 +-
 diff-hl.el|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/diff-hl-margin.el b/diff-hl-margin.el
index 4b359a3..c040ae7 100644
--- a/diff-hl-margin.el
+++ b/diff-hl-margin.el
@@ -1,6 +1,6 @@
 ;;; diff-hl-margin.el --- Highlight buffer changes on margins -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2012-2014  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2015  Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/diff-hl.el b/diff-hl.el
index d412a70..b0e360c 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -1,6 +1,6 @@
 ;;; diff-hl.el --- Highlight uncommitted changes -*- lexical-binding: t -*-
 
-;; Copyright (C) 2012-2014  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2015  Free Software Foundation, Inc.
 
 ;; Author:   Dmitry Gutov 
 ;; URL:  https://github.com/dgutov/diff-hl



[elpa] master 28263c7 12/42: Handle narrowing (fixes #48)

2015-09-09 Thread Dmitry Gutov
branch: master
commit 28263c711bcfb2d955b42e10d4e27d828c209dcc
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Handle narrowing (fixes #48)
---
 diff-hl.el |   64 ++-
 1 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index 8057833..17106c1 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -265,31 +265,33 @@
 (current-line 1))
 (diff-hl-remove-overlays)
 (save-excursion
-  (goto-char (point-min))
-  (dolist (c changes)
-(cl-destructuring-bind (line len type) c
-  (forward-line (- line current-line))
-  (setq current-line line)
-  (let ((hunk-beg (point)))
-(while (cl-plusp len)
-  (diff-hl-add-highlighting
-   type
-   (cond
-((not diff-hl-draw-borders) 'empty)
-((and (= len 1) (= line current-line)) 'single)
-((= len 1) 'bottom)
-((= line current-line) 'top)
-(t 'middle)))
-  (forward-line 1)
-  (cl-incf current-line)
-  (cl-decf len))
-(let ((h (make-overlay hunk-beg (point)))
-  (hook '(diff-hl-overlay-modified)))
-  (overlay-put h 'diff-hl t)
-  (overlay-put h 'diff-hl-hunk t)
-  (overlay-put h 'modification-hooks hook)
-  (overlay-put h 'insert-in-front-hooks hook)
-  (overlay-put h 'insert-behind-hooks hook
+  (save-restriction
+(widen)
+(goto-char (point-min))
+(dolist (c changes)
+  (cl-destructuring-bind (line len type) c
+(forward-line (- line current-line))
+(setq current-line line)
+(let ((hunk-beg (point)))
+  (while (cl-plusp len)
+(diff-hl-add-highlighting
+  type
+ (cond
+  ((not diff-hl-draw-borders) 'empty)
+  ((and (= len 1) (= line current-line)) 'single)
+  ((= len 1) 'bottom)
+  ((= line current-line) 'top)
+  (t 'middle)))
+(forward-line 1)
+(cl-incf current-line)
+(cl-decf len))
+  (let ((h (make-overlay hunk-beg (point)))
+(hook '(diff-hl-overlay-modified)))
+(overlay-put h 'diff-hl t)
+(overlay-put h 'diff-hl-hunk t)
+(overlay-put h 'modification-hooks hook)
+(overlay-put h 'insert-in-front-hooks hook)
+(overlay-put h 'insert-behind-hooks hook)
 
 (defun diff-hl-add-highlighting (type shape)
   (let ((o (make-overlay (point) (point
@@ -301,17 +303,17 @@
   (overlay-put ovl 'before-string (diff-hl-fringe-spec type shape
diff-hl-side)))
 
-(defun diff-hl-remove-overlays ()
-  (dolist (o (overlays-in (point-min) (point-max)))
-(when (overlay-get o 'diff-hl) (delete-overlay o
+(defun diff-hl-remove-overlays (&optional beg end)
+  (save-restriction
+(widen)
+(dolist (o (overlays-in (or beg (point-min)) (or end (point-max
+  (when (overlay-get o 'diff-hl) (delete-overlay o)
 
 (defun diff-hl-overlay-modified (ov after-p _beg _end &optional _length)
   "Delete the hunk overlay and all our line overlays inside it."
   (unless after-p
 (when (overlay-buffer ov)
-  (save-restriction
-(narrow-to-region (overlay-start ov) (overlay-end ov))
-(diff-hl-remove-overlays))
+  (diff-hl-remove-overlays (overlay-start ov) (overlay-end ov))
   (delete-overlay ov
 
 (defvar diff-hl-timer nil)



[elpa] master 418dbc7 32/42: Update docs to reflect new diff-hl-flydiff-mode

2015-09-09 Thread Dmitry Gutov
branch: master
commit 418dbc77fb6d05cee27b8d6c47bdb179a489f373
Author: PythonNut 
Commit: PythonNut 

Update docs to reflect new diff-hl-flydiff-mode
---
 README.md |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 0f9fe64..4a71d5e 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@ The package also contains auxiliary modes:
 * `diff-hl-margin-mode` changes the highlighting function to
   use the margin instead of the fringe.
 * `diff-hl-amend-mode` shifts the reference revision back by one.
+* `diff-hl-flydiff-mode` enables diffing unsaved changes
 
 Check out the Commentary section in each respective file for the usage
 instructions.
@@ -46,11 +47,6 @@ Emacs 24+. On OS X, Emacs 24.3 or higher is recommended.
 Notes
 =
 
-* Since it uses the corresponding VC diff command, it's only accurate when the
-  buffer is in saved state. Highlighting changes "on the fly" might be better,
-  maybe we can do something similar to `highlight-markup-buffers` with a hidden
-  buffer containing the unmodified copy.
-
 * We conflict with other modes when they put indicators on the fringe,
   such as [Flycheck](https://github.com/flycheck/flycheck). This is
   rarely a significant problem, since if you're using such a mode,



[elpa] master e576ee2 40/42: Make diff-hl-flydiff-delay customizable

2015-09-09 Thread Dmitry Gutov
branch: master
commit e576ee2b7122e92a502d6173472516f51a787e6c
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Make diff-hl-flydiff-delay customizable
---
 diff-hl-flydiff.el |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 8ede0b5..53d31f7 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -30,6 +30,14 @@
 (unless (require 'nadvice nil t)
   (error "`diff-hl-flydiff-mode' requires Emacs 24.4 or newer"))
 
+(defgroup diff-hl-flydiff nil
+  "Highlight changes on the fly"
+  :group 'diff-hl)
+
+(defcustom diff-hl-flydiff-delay 0.3
+  "The idle delay in seconds before highlighting is updated."
+  :type 'number)
+
 (defvar diff-hl-flydiff-modified-tick 0)
 (defvar diff-hl-flydiff-timer)
 (make-variable-buffer-local 'diff-hl-flydiff-modified-tick)
@@ -160,7 +168,7 @@ This requires the external program `diff' to be in your 
`exec-path'."
 #'diff-hl-flydiff/update-modified-tick)
 
 (setq diff-hl-flydiff-timer
-  (run-with-idle-timer 0.3 t #'diff-hl-update t)))
+  (run-with-idle-timer diff-hl-flydiff-delay t #'diff-hl-update 
t)))
 
 (advice-remove 'diff-hl-update #'diff-hl-flydiff/update)
 (advice-remove 'diff-hl-overlay-modified #'ignore)



[elpa] master 2d40373 34/42: Update diff-hl-flydiff/vc-git-mode-line-string as per Emacs master

2015-09-09 Thread Dmitry Gutov
branch: master
commit 2d4037320fcc602692f8619ca4e1b5adff5648de
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Update diff-hl-flydiff/vc-git-mode-line-string as per Emacs master
---
 diff-hl-flydiff.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index b5f6b4c..02169cc 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -57,9 +57,11 @@
   (disp-rev (or (vc-git--symbolic-ref file)
   (substring rev 0 7)))
   (def-ml (vc-default-mode-line-string 'Git file))
-  (help-echo (get-text-property 0 'help-echo def-ml)))
+  (help-echo (get-text-property 0 'help-echo def-ml))
+  (face   (get-text-property 0 'face def-ml)))
 (propertize (replace-regexp-in-string (concat rev "\\'") disp-rev 
def-ml t t)
-  'help-echo (concat help-echo "\nCurrent revision: " rev
+'face face
+'help-echo (concat help-echo "\nCurrent revision: " rev
 
 (advice-add 'vc-git-working-revision :override
   #'diff-hl-flydiff/vc-git-working-revision)



[elpa] master 6ab3ebe 30/42: Stop duplicating code in diff-hl-changes

2015-09-09 Thread Dmitry Gutov
branch: master
commit 6ab3ebe6a05795f4ae31b71dbb75dede5775ece8
Author: PythonNut 
Commit: PythonNut 

Stop duplicating code in diff-hl-changes
---
 diff-hl-flydiff.el |   77 +++-
 diff-hl.el |   33 +-
 2 files changed, 47 insertions(+), 63 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 1c58a52..6215ab7 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -108,17 +108,16 @@ the user should be returned."
 (delete-file filename)))
 filename))
 
-(defun diff-hl-flydiff-buffer-with-head ()
+(defun diff-hl-flydiff-buffer-with-head (file &optional backend)
   "View the differences between BUFFER and its associated file.
 This requires the external program `diff' to be in your `exec-path'."
   (interactive)
   (vc-ensure-vc-buffer)
   (with-current-buffer (get-buffer (current-buffer))
-(let* ((file buffer-file-name)
-(temporary-file-directory
-  (if (file-directory-p "/dev/shm/")
-"/dev/shm/"
-temporary-file-directory))
+(let* ((temporary-file-directory
+ (if (file-directory-p "/dev/shm/")
+   "/dev/shm/"
+   temporary-file-directory))
 (rev (diff-hl-flydiff-create-revision file
(diff-hl-flydiff/working-revision file
   (diff-no-select rev (current-buffer) "-U 0" 'noasync
@@ -132,47 +131,18 @@ This requires the external program `diff' to be in your 
`exec-path'."
   (not (buffer-modified-p
 (funcall old-fun)))
 
-(defun diff-hl-flydiff/changes (&rest args)
-  (let* ((file buffer-file-name)
-  (backend (vc-backend file)))
-(when backend
-  (let ((state (vc-state file backend)))
-(cond
-  ((or
- (buffer-modified-p)
- (eq state 'edited)
- (and (eq state 'up-to-date)
-   ;; VC state is stale in after-revert-hook.
-   (or revert-buffer-in-progress-p
- ;; Diffing against an older revision.
- diff-hl-reference-revision)))
-(let (diff-auto-refine-mode res)
-  (with-current-buffer (diff-hl-flydiff-buffer-with-head)
-(goto-char (point-min))
-(unless (eobp)
-  (ignore-errors
-(diff-beginning-of-hunk t))
-  (while (looking-at diff-hunk-header-re-unified)
-(let ((line (string-to-number (match-string 3)))
-   (len (let ((m (match-string 4)))
-  (if m (string-to-number m) 1)))
-   (beg (point)))
-  (diff-end-of-hunk)
-  (let* ((inserts (diff-count-matches "^\\+" beg (point)))
-  (deletes (diff-count-matches "^-" beg (point)))
-  (type (cond ((zerop deletes) 'insert)
-  ((zerop inserts) 'delete)
-  (t 'change
-(when (eq type 'delete)
-  (setq len 1)
-  (cl-incf line))
-(push (list line len type) res))
-  (setq diff-hl-flydiff-modified-tick (buffer-modified-tick))
-  (nreverse res)))
-  ((eq state 'added)
-`((1 ,(line-number-at-pos (point-max)) insert)))
-  ((eq state 'removed)
-`((1 ,(line-number-at-pos (point-max)) delete
+(defun diff-hl-flydiff/modified-p (state)
+  (or
+(buffer-modified-p)
+(eq state 'edited)
+(and (eq state 'up-to-date)
+  ;; VC state is stale in after-revert-hook.
+  (or revert-buffer-in-progress-p
+;; Diffing against an older revision.
+diff-hl-reference-revision
+
+(defun diff-hl-flydiff/update-modified-tick (&rest args)
+  (setq diff-hl-flydiff-modified-tick (buffer-modified-tick)))
 
 ;;;###autoload
 (define-minor-mode diff-hl-flydiff-mode
@@ -182,16 +152,25 @@ This requires the external program `diff' to be in your 
`exec-path'."
   (if diff-hl-flydiff-mode
 (progn
   (advice-add 'diff-hl-update :around #'diff-hl-flydiff/update)
-  (advice-add 'diff-hl-changes :override #'diff-hl-flydiff/changes)
   (advice-add 'diff-hl-overlay-modified :override #'ignore)
 
+  (advice-add 'diff-hl-modified-p :override
+#'diff-hl-flydiff/modified-p)
+  (advice-add 'diff-hl-changes-buffer :override
+#'diff-hl-flydiff-buffer-with-head)
+  (advice-add 'diff-hl-change :after
+#'diff-hl-flydiff/update-modified-tick)
+
   (setq diff-hl-flydiff-timer
 (run-with-idle-timer 0.3 t #'diff-hl-update t)))
 
 (advice-remove 'diff-hl-update #'diff-hl-flydiff/update)
-(advice-remove 'diff-hl-changes #'diff-hl-flydiff/changes)
 (advice-remove 'diff-hl-overlay-modified 

[elpa] master 2992efd 31/42: Simplify diff-hl-flydiff/modified-p advice

2015-09-09 Thread Dmitry Gutov
branch: master
commit 2992efd07244df5ff8c1833e9c3e3716ecb2de93
Author: PythonNut 
Commit: PythonNut 

Simplify diff-hl-flydiff/modified-p advice
---
 diff-hl-flydiff.el |   11 ++-
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 6215ab7..b5f6b4c 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -132,14 +132,7 @@ This requires the external program `diff' to be in your 
`exec-path'."
 (funcall old-fun)))
 
 (defun diff-hl-flydiff/modified-p (state)
-  (or
-(buffer-modified-p)
-(eq state 'edited)
-(and (eq state 'up-to-date)
-  ;; VC state is stale in after-revert-hook.
-  (or revert-buffer-in-progress-p
-;; Diffing against an older revision.
-diff-hl-reference-revision
+  (buffer-modified-p))
 
 (defun diff-hl-flydiff/update-modified-tick (&rest args)
   (setq diff-hl-flydiff-modified-tick (buffer-modified-tick)))
@@ -154,7 +147,7 @@ This requires the external program `diff' to be in your 
`exec-path'."
   (advice-add 'diff-hl-update :around #'diff-hl-flydiff/update)
   (advice-add 'diff-hl-overlay-modified :override #'ignore)
 
-  (advice-add 'diff-hl-modified-p :override
+  (advice-add 'diff-hl-modified-p :before-until
 #'diff-hl-flydiff/modified-p)
   (advice-add 'diff-hl-changes-buffer :override
 #'diff-hl-flydiff-buffer-with-head)



[elpa] master 5068da4 39/42: Reindent

2015-09-09 Thread Dmitry Gutov
branch: master
commit 5068da46753d7f239ff892802d15ad34509c7676
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Reindent
---
 diff-hl-flydiff.el |   83 ++-
 diff-hl.el |   18 +-
 2 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 0c421ce..8ede0b5 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -73,40 +73,40 @@
 (defun diff-hl-flydiff/working-revision (file)
   "Like vc-working-revision, but always up-to-date"
   (vc-file-setprop file 'vc-working-revision
-(vc-call-backend (vc-backend file) 'working-revision file)))
+   (vc-call-backend (vc-backend file) 'working-revision file)))
 
 (defun diff-hl-flydiff-make-temp-file-name (file rev &optional manual)
   "Return a backup file name for REV or the current version of FILE.
 If MANUAL is non-nil it means that a name for backups created by
 the user should be returned."
   (let* ((auto-save-file-name-transforms
-   `((".*" ,temporary-file-directory t
+  `((".*" ,temporary-file-directory t
 (expand-file-name
-  (concat (make-auto-save-file-name)
-".~" (subst-char-in-string
-   ?/ ?_ rev)
-(unless manual ".") "~")
-  temporary-file-directory)))
+ (concat (make-auto-save-file-name)
+ ".~" (subst-char-in-string
+   ?/ ?_ rev)
+ (unless manual ".") "~")
+ temporary-file-directory)))
 
 (defun diff-hl-flydiff-create-revision (file revision)
   "Read REVISION of FILE into a buffer and return the buffer."
   (let ((automatic-backup (diff-hl-flydiff-make-temp-file-name file revision))
- (filebuf (get-file-buffer file))
- (filename (diff-hl-flydiff-make-temp-file-name file revision 
'manual)))
+(filebuf (get-file-buffer file))
+(filename (diff-hl-flydiff-make-temp-file-name file revision 'manual)))
 (unless (file-exists-p filename)
   (if (file-exists-p automatic-backup)
-(rename-file automatic-backup filename nil)
+  (rename-file automatic-backup filename nil)
 (with-current-buffer filebuf
   (let ((failed t)
- (coding-system-for-read 'no-conversion)
- (coding-system-for-write 'no-conversion))
+(coding-system-for-read 'no-conversion)
+(coding-system-for-write 'no-conversion))
 (unwind-protect
-  (with-temp-file filename
-(let ((outbuf (current-buffer)))
-  ;; Change buffer to get local value of
-  ;; vc-checkout-switches.
-  (with-current-buffer filebuf
-(vc-call find-revision file revision outbuf
+(with-temp-file filename
+  (let ((outbuf (current-buffer)))
+;; Change buffer to get local value of
+;; vc-checkout-switches.
+(with-current-buffer filebuf
+  (vc-call find-revision file revision outbuf
   (setq failed nil)
   (when (and failed (file-exists-p filename))
 (delete-file filename)))
@@ -119,20 +119,21 @@ This requires the external program `diff' to be in your 
`exec-path'."
   (vc-ensure-vc-buffer)
   (with-current-buffer (get-buffer (current-buffer))
 (let* ((temporary-file-directory
- (if (file-directory-p "/dev/shm/")
-   "/dev/shm/"
-   temporary-file-directory))
-(rev (diff-hl-flydiff-create-revision file
-   (diff-hl-flydiff/working-revision file
+(if (file-directory-p "/dev/shm/")
+"/dev/shm/"
+  temporary-file-directory))
+   (rev (diff-hl-flydiff-create-revision
+ file
+ (diff-hl-flydiff/working-revision file
   (diff-no-select rev (current-buffer) "-U 0 --strip-trailing-cr" 'noasync
-(get-buffer-create " *diff-hl-diff*")
+  (get-buffer-create " *diff-hl-diff*")
 
 (defun diff-hl-flydiff/update (old-fun &optional auto)
   (unless (and auto
-(or
-  (= diff-hl-flydiff-modified-tick (buffer-modified-tick))
-  (file-remote-p default-directory)
-  (not (buffer-modified-p
+   (or
+(= diff-hl-flydiff-modified-tick (buffer-modified-tick))
+(file-remote-p default-directory)
+(not (buffer-modified-p
 (funcall old-fun)))
 
 (defun diff-hl-flydiff/modified-p (state)
@@ -147,19 +148,19 @@ This requires the external program `diff' to be in your 
`exec-path'."
   :lighter ""
   :global t
   (if diff-hl-flydiff-mode
-(progn
-  (advice-add 'diff-hl-update :around #'diff-hl-flydiff/update)
-  (advice-add 'diff-hl-overlay-modified :override #'ignore)
-
-  (advice-add 'diff-hl-modifie

[elpa] master 1558064 35/42: Reword the recent README changes

2015-09-09 Thread Dmitry Gutov
branch: master
commit 15580640b3078405455faf0228a13eed3212f188
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Reword the recent README changes
---
 README.md |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/README.md b/README.md
index 20274bb..ab8c9d8 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,8 @@ The package also contains auxiliary modes:
 * `diff-hl-margin-mode` changes the highlighting function to
   use the margin instead of the fringe.
 * `diff-hl-amend-mode` shifts the reference revision back by one.
-* `diff-hl-flydiff-mode` enables diffing unsaved changes
+* `diff-hl-flydiff-mode` implements highlighting changes on the fly.
+  It requires Emacs 24.4 or newer.
 
 Check out the Commentary section in each respective file for the usage
 instructions.
@@ -47,6 +48,10 @@ Emacs 24+. On OS X, Emacs 24.3 or higher is recommended.
 Notes
 =
 
+* By default `diff-hl-mode` uses the corresponding VC diff command, so
+  it's only accurate when the buffer is in saved state. Check out
+  `diff-hl-flydiff-mode`, it aims to handle unsaved buffers as well.
+
 * We conflict with other modes when they put indicators on the fringe,
   such as [Flycheck](https://github.com/flycheck/flycheck). This is
   rarely a significant problem, since if you're using such a mode,



[elpa] master 3e64ed5 22/42: #'diff-hl-flydiff/overlay-modified → #'ignored

2015-09-09 Thread Dmitry Gutov
branch: master
commit 3e64ed5d420363ff564b58682f06b71aa848a652
Author: PythonNut 
Commit: PythonNut 

#'diff-hl-flydiff/overlay-modified → #'ignored
---
 diff-hl-flydiff.el |   14 --
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index b464ec6..4cd2bad 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -170,8 +170,6 @@ This requires the external program `diff' to be in your 
`exec-path'."
   ((eq state 'removed)
 `((1 ,(line-number-at-pos (point-max)) delete
 
-(defun diff-hl-flydiff/overlay-modified (&rest args))
-
 ;;;###autoload
 (define-minor-mode diff-hl-flydiff-mode
   "Highlight diffs on-the-fly"
@@ -180,12 +178,9 @@ This requires the external program `diff' to be in your 
`exec-path'."
   (if diff-hl-flydiff-mode
 (progn
   (require 'nadvice)
-  (advice-add 'diff-hl-update :around
-#'diff-hl-flydiff/update)
-  (advice-add 'diff-hl-changes :override
-#'diff-hl-flydiff/changes)
-  (advice-add 'diff-hl-overlay-modified :override
-#'diff-hl-flydiff/overlay-modified)
+  (advice-add 'diff-hl-update :around #'diff-hl-flydiff/update)
+  (advice-add 'diff-hl-changes :override #'diff-hl-flydiff/changes)
+  (advice-add 'diff-hl-overlay-modified :override #'ignored)
 
   (remove-hook 'after-change-functions #'diff-hl-edit t)
   (setq diff-hl-flydiff-timer
@@ -193,8 +188,7 @@ This requires the external program `diff' to be in your 
`exec-path'."
 
 (advice-remove 'diff-hl-update #'diff-hl-flydiff/update)
 (advice-remove 'diff-hl-changes #'diff-hl-flydiff/changes)
-(advice-remove 'diff-hl-overlay-modified
-  #'diff-hl-flydiff/overlay-modified)
+(advice-remove 'diff-hl-overlay-modified #'ignored)
 
 (cancel-timer diff-hl-flydiff-timer)
 (when diff-hl-mode



[elpa] master 12def16 14/42: Allow bitmap width only up to 16 (#49)

2015-09-09 Thread Dmitry Gutov
branch: master
commit 12def16fbf7fb1a574d4a7d86a213f061f985dbf
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Allow bitmap width only up to 16 (#49)
---
 README.md  |3 +++
 diff-hl.el |3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/README.md b/README.md
index 0f9fe64..a0d5168 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,9 @@ Notes
 
 * Frame-local and buffer-local values of `line-spacing` are not supported.
 
+* Fringe width up to 16 works best (because we can't define a bitmap
+  with width above that number).
+
 * [emacs-git-gutter](https://github.com/syohex/emacs-git-gutter) shows
   indicators in the margin by default, allows you to customize how the
   indicators look more easily, and has a "stage hunk" command.
diff --git a/diff-hl.el b/diff-hl.el
index 17106c1..5b6510d 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -140,7 +140,8 @@
(if (floatp spacing)
(truncate (* (frame-char-height) spacing))
  spacing)))
- (w (frame-parameter nil (intern (format "%s-fringe" diff-hl-side
+ (w (min (frame-parameter nil (intern (format "%s-fringe" 
diff-hl-side)))
+ 16))
  (middle (make-vector h (expt 2 (1- w
  (ones (1- (expt 2 w)))
  (top (copy-sequence middle))



[elpa] master 327e01c 20/42: Add commentary to diff-hl-flydiff

2015-09-09 Thread Dmitry Gutov
branch: master
commit 327e01c7117cfa64523797646e2e08b3d0aa2988
Author: PythonNut 
Commit: PythonNut 

Add commentary to diff-hl-flydiff
---
 diff-hl-flydiff.el |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index 3d7c2c7..2335074 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -20,6 +20,9 @@
 
 ;;; Commentary:
 
+;; This mode enables diffing on-the-fly (i.e. without saving the buffer first)
+;; Toggle in all buffers with M-x diff-hl-flydiff-mode
+
 ;;; Code:
 
 (require 'diff-hl)



[elpa] master 2209370 27/42: Ensure working revisions are never stale

2015-09-09 Thread Dmitry Gutov
branch: master
commit 2209370e6bfd0471f07d5198589102b3dbfe85a7
Author: PythonNut 
Commit: PythonNut 

Ensure working revisions are never stale
---
 diff-hl-flydiff.el |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index c065831..04bf1b9 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -66,6 +66,11 @@
 (advice-add 'vc-git-mode-line-string :override
   #'diff-hl-flydiff/vc-git-mode-line-string)))
 
+(defun diff-hl-flydiff/working-revision (file)
+  "Like vc-working-revision, but always up-to-date"
+  (vc-file-setprop file 'vc-working-revision
+(vc-call-backend (vc-backend file) 'working-revision file)))
+
 (defun diff-hl-flydiff-make-temp-file-name (file rev &optional manual)
   "Return a backup file name for REV or the current version of FILE.
 If MANUAL is non-nil it means that a name for backups created by
@@ -114,14 +119,11 @@ This requires the external program `diff' to be in your 
`exec-path'."
   (if (file-directory-p "/dev/shm/")
 "/dev/shm/"
 temporary-file-directory))
-(rev (diff-hl-flydiff-create-revision
-   file
-   (vc-working-revision file
- (vc-responsible-backend file)
+(rev (diff-hl-flydiff-create-revision file
+   (diff-hl-flydiff/working-revision file
   (diff-no-select rev (current-buffer) "-U 0" 'noasync
 (get-buffer-create " *diff-hl-diff*")
 
-
 (defun diff-hl-flydiff/update (old-fun &optional auto)
   (unless (and auto
 (or



[elpa] master b8a46cb: Add support to build packages from Emacs repo

2015-09-09 Thread Fabi�n Ezequiel Gallina
branch: master
commit b8a46cb0a540bea942cc59d0664c8f73268366e0
Author: Fabián Ezequiel Gallina 
Commit: Fabián Ezequiel Gallina 

Add support to build packages from Emacs repo

* externals-list: Add docs about :core packages.
* admin/archive-contents.el (archive-add/remove/update-externals):
Sync core packages defined in externals-list.
---
 .gitignore|1 +
 admin/archive-contents.el |  214 +++--
 externals-list|   21 -
 3 files changed, 186 insertions(+), 50 deletions(-)

diff --git a/.gitignore b/.gitignore
index 25fcb3f..6b309aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
 \#*\#
 ChangeLog
 core
+emacs/
 packages/*/*-autoloads.el
 packages/*/*-pkg.el
 
diff --git a/admin/archive-contents.el b/admin/archive-contents.el
index c53f4ba..acfe34d 100755
--- a/admin/archive-contents.el
+++ b/admin/archive-contents.el
@@ -558,54 +558,176 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
 ;;; Maintain external packages.
 
 (defconst archive--elpa-git-url "git://git.sv.gnu.org/emacs/elpa")
+(defconst archive--emacs-git-url "git://git.sv.gnu.org/emacs.git")
+
+(defun archive--sync-emacs-repo ()
+  "Clone and sync Emacs repository."
+  (let ((reference (expand-file-name
+(or (getenv "EMACS_CLONE_REFERENCE") "../emacs/master")))
+(emacs-repo-root (expand-file-name "emacs")))
+(when (and (file-exists-p emacs-repo-root)
+   (not (file-exists-p
+ (expand-file-name "README" emacs-repo-root
+  (message "Cleaning stalled Emacs clone: %s" emacs-repo-root)
+  (delete-directory emacs-repo-root t))
+(cond ((file-exists-p emacs-repo-root)
+   (let ((default-directory emacs-repo-root))
+ (message "Running git pull in %S" default-directory)
+ (call-process "git" nil t nil "pull")))
+  ((file-exists-p reference)
+   (message "Emacs repository reference found: %s" reference)
+   (call-process
+"git" nil t nil
+"clone" archive--emacs-git-url
+"--reference" reference
+emacs-repo-root))
+  (t
+   (error
+(concat "Emacs repository not found at: %s\n"
+"Point EMACS_CLONE_REFERENCE environment variable to an "
+"existing checkout.") reference)
+
+(defun archive--cleanup-packages (externals-list)
+  "Cleanup packages not registered in the EXTERNALS-LIST."
+  (let ((default-directory (expand-file-name "packages/")))
+(dolist (dir (directory-files "."))
+  (cond
+   ((member dir '("." "..")) nil)
+   ((assoc dir externals-list) nil)
+   ((file-directory-p (expand-file-name (format "%s/.git" dir)))
+(let ((status
+   (with-temp-buffer
+ (let ((default-directory (file-name-as-directory
+   (expand-file-name dir
+   (call-process "git" nil t nil "status" "--porcelain")
+   (buffer-string)
+  (if (zerop (length status))
+  (progn (delete-directory dir 'recursive t)
+ (message "Deleted all of %s" dir))
+(message "Keeping leftover unclean %s:\n%s" dir status
+   ((not (zerop (call-process "git" nil nil nil
+  "ls-files" "--error-unmatch" dir)))
+(message "Deleted untracked package %s" dir)
+(delete-directory dir 'recursive t))
+
+(defun archive--external-package-sync (name)
+  "Sync external package named NAME."
+  (let ((default-directory (expand-file-name "packages/")))
+(cond ((not (file-exists-p name))
+   (let* ((branch (concat "externals/" name))
+  (output
+   (with-temp-buffer
+ ;; FIXME: Use git-new-workdir!
+ (call-process "git" nil t nil "clone"
+   "--reference" ".." "--single-branch"
+   "--branch" branch
+   archive--elpa-git-url name)
+ (buffer-string
+ (message "Cloning branch %s:\n%s" name output)))
+  ((not (file-directory-p (concat name "/.git")))
+   (message "%s is in the way of an external, please remove!" name))
+  (t
+   (let ((default-directory (file-name-as-directory
+ (expand-file-name name
+ (with-temp-buffer
+   (message "Running git pull in %S" default-directory)
+   (call-process "git" nil t nil "pull")
+   (message "Updated %s:%s" name (buffer-string
+
+(defun archive--core-package-empty-dest-p (dest)
+  "Return non-nil if DEST is an empty variant."
+  (member dest (list "" "." nil)))
+
+(defun archive--core-package-copy-file
+(source dest emacs-repo-root package-