[elpa] master 0d69d15 3/4: Squashed 'packages/gnorb/' changes from 4e7039a..a387d85

2015-04-23 Thread Eric Abrahamsen
branch: master
commit 0d69d15d20b69f439c1a1ed451e06f77b1252b3e
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

Squashed 'packages/gnorb/' changes from 4e7039a..a387d85

a387d85 Bump version to 1.1.0

git-subtree-dir: packages/gnorb
git-subtree-split: a387d8515871d9f06b193a461745697eb25f3872
---
 NEWS |   10 ++
 gnorb.el |2 +-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index 59bc343..623f685 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,15 @@
 GNU Emacs Gnorb NEWS -- history of user-visible changes.  -*- org -*-
 
+* Version 1.1.0 [2015-04-23 Thu]
+** New trigger actions
+Two new trigger actions allow you to capture a new sibling or child
+heading relative to the heading you're triggering.
+** Persistent Gnorb groups
+Give a prefix argument to `gnorb-org-view' to create a named,
+persistent group containing tracked headings.
+** Gnorb registry usage reports
+Call `gnorb-report-tracking-usage' to see how much of the Gnus
+registry Gnorb is occupying, and run cleaning routines.
 * Version 1.0.1 [2014-10-22 Wed]
 ** Deleting associations
 It's now possible to delete associations between messages and
diff --git a/gnorb.el b/gnorb.el
index cb7d908..35db4f6 100644
--- a/gnorb.el
+++ b/gnorb.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2014  Free Software Foundation, Inc.
 
-;; Version: 1.0.1
+;; Version: 1.1.0
 ;; Package-Requires: ((cl-lib "0.5"))
 
 ;; Maintainer: Eric Abrahamsen 



[elpa] master f9b63e4 4/4: Merge commit '0d69d15d20b69f439c1a1ed451e06f77b1252b3e' from gnorb

2015-04-23 Thread Eric Abrahamsen
branch: master
commit f9b63e405daf25088fa663c3a1c65f66701b914a
Merge: 57629db 0d69d15
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

Merge commit '0d69d15d20b69f439c1a1ed451e06f77b1252b3e' from gnorb
---
 packages/gnorb/NEWS |   10 ++
 packages/gnorb/gnorb.el |2 +-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/packages/gnorb/NEWS b/packages/gnorb/NEWS
index 59bc343..623f685 100644
--- a/packages/gnorb/NEWS
+++ b/packages/gnorb/NEWS
@@ -1,5 +1,15 @@
 GNU Emacs Gnorb NEWS -- history of user-visible changes.  -*- org -*-
 
+* Version 1.1.0 [2015-04-23 Thu]
+** New trigger actions
+Two new trigger actions allow you to capture a new sibling or child
+heading relative to the heading you're triggering.
+** Persistent Gnorb groups
+Give a prefix argument to `gnorb-org-view' to create a named,
+persistent group containing tracked headings.
+** Gnorb registry usage reports
+Call `gnorb-report-tracking-usage' to see how much of the Gnus
+registry Gnorb is occupying, and run cleaning routines.
 * Version 1.0.1 [2014-10-22 Wed]
 ** Deleting associations
 It's now possible to delete associations between messages and
diff --git a/packages/gnorb/gnorb.el b/packages/gnorb/gnorb.el
index 0c9557e..ead6ac3 100644
--- a/packages/gnorb/gnorb.el
+++ b/packages/gnorb/gnorb.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2014  Free Software Foundation, Inc.
 
-;; Version: 1.0.1
+;; Version: 1.1.0
 ;; Package-Requires: ((cl-lib "0.5"))
 
 ;; Maintainer: Eric Abrahamsen 



[elpa] master updated (c7a6156 -> f9b63e4)

2015-04-23 Thread Eric Abrahamsen
girzel pushed a change to branch master.

  from  c7a6156   Merge commit 'e2452a3e77ef6ea6b193292d2c0bbbe93dd4b078' 
from swiper
   new  3e5c11a   Squashed 'packages/gnorb/' changes from 321b23b..4e7039a
   new  57629db   Merge commit '3e5c11a13981a1ff613cb4442ad644285c44e481' 
from gnorb
   new  0d69d15   Squashed 'packages/gnorb/' changes from 4e7039a..a387d85
   new  f9b63e4   Merge commit '0d69d15d20b69f439c1a1ed451e06f77b1252b3e' 
from gnorb


Summary of changes:
 packages/gnorb/NEWS  |   10 ++
 packages/gnorb/README.org|   29 -
 packages/gnorb/gnorb-bbdb.el |   37 ++---
 packages/gnorb/gnorb-gnus.el |  288 ++
 packages/gnorb/gnorb-org.el  |   46 ---
 packages/gnorb/gnorb-registry.el |  132 ++---
 packages/gnorb/gnorb-utils.el|  162 +++---
 packages/gnorb/gnorb.el  |   10 +-
 packages/gnorb/gnorb.info|  199 ++-
 packages/gnorb/gnorb.org |  108 +++
 packages/gnorb/gnorb.texi|  132 +
 packages/gnorb/nngnorb.el|   34 +++--
 12 files changed, 839 insertions(+), 348 deletions(-)



[elpa] master 57629db 2/4: Merge commit '3e5c11a13981a1ff613cb4442ad644285c44e481' from gnorb

2015-04-23 Thread Eric Abrahamsen
branch: master
commit 57629db9a7dc542f17f553ce362dacd01db70279
Merge: c7a6156 3e5c11a
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

Merge commit '3e5c11a13981a1ff613cb4442ad644285c44e481' from gnorb
---
 packages/gnorb/README.org|   29 -
 packages/gnorb/gnorb-bbdb.el |   37 ++---
 packages/gnorb/gnorb-gnus.el |  288 ++
 packages/gnorb/gnorb-org.el  |   46 ---
 packages/gnorb/gnorb-registry.el |  132 ++---
 packages/gnorb/gnorb-utils.el|  162 +++---
 packages/gnorb/gnorb.el  |8 +-
 packages/gnorb/gnorb.info|  199 ++-
 packages/gnorb/gnorb.org |  108 +++
 packages/gnorb/gnorb.texi|  132 +
 packages/gnorb/nngnorb.el|   34 +++--
 11 files changed, 828 insertions(+), 347 deletions(-)

diff --git a/packages/gnorb/README.org b/packages/gnorb/README.org
index 1f8f82f..9e2f9bd 100644
--- a/packages/gnorb/README.org
+++ b/packages/gnorb/README.org
@@ -16,7 +16,31 @@ mini mailboxes.
 *Note for previous users*: If you were using Gnorb from Github before
 it shifted to the Elpa repository, the email tracking mechanism has
 changed, please see the manual for details.
+** Known bugs/issues
+*** Gnus Registry
+Prior to late December, 2014, the Gnus registry had some issues with
+preserving "precious" entries while pruning.
 
+When the registry approaches its maximum size it will delete excess
+entries, a process referred to as "pruning". "Precious" entries are
+those that contain important information: they should not be pruned.
+
+Gnorb uses the registry to track associations between messages and Org
+headings, and marks those entries as precious. The entire process of
+tracking, in fact, relies on these entries being preserved, and Gnorb
+goes to some lengths to protect this information. Older versions of
+the registry could nevertheless delete those entries.
+
+These issues are fixed circa the end of December, 2014, around "Ma
+Gnus v0.12", whatever that means. If you think there's a possibility
+your registry is full, and associations are being deleted, you might
+consider upgrading to a recent Gnus.
+*** Multiple Associations
+Gnorb theoretically supports email messages being associated with
+multiple Org headings. In practice, however, this situation hasn't
+been thought through completely, and you may experience weirdness. If
+you do, and you have some ideas about how it should be handled, please
+contact the author and suggest them.
 ** Installation
 
 It's easiest to install Gnorb from Elpa: run `list-packages' and look
@@ -60,7 +84,10 @@ composing messages from... Or maybe it's just a case of NIH.
 Provide an Org Agenda command that does an email search for messages
 received in the visible date span, or day under point, etc. Make it
 work in the calendar, as well?
-*** TODO Capture to child/subtree trigger actions
+*** DONE Capture to child/subtree trigger actions
+:LOGBOOK:
+- State "DONE"   from "TODO"   [2015-03-17 Tue 17:42]
+:END:
 Add trigger actions that create new sibling or child headings on the
 original Org heading.
 *** TODO Gnus message tagging
diff --git a/packages/gnorb/gnorb-bbdb.el b/packages/gnorb/gnorb-bbdb.el
index 572a4b9..eb2f6eb 100644
--- a/packages/gnorb/gnorb-bbdb.el
+++ b/packages/gnorb/gnorb-bbdb.el
@@ -150,8 +150,6 @@ be composed, just as in `gnus-posting-styles'.
 An example value might look like:"
   :group 'gnorb-bbdb)
 
-(defvar message-mode-hook)
-
 (when (fboundp 'bbdb-record-xfield-string)
   (fset (intern (format "bbdb-read-xfield-%s"
gnorb-bbdb-org-tag-field))
@@ -207,6 +205,8 @@ Org tags are stored in the `gnorb-bbdb-org-tags-field'."
 (insert
  (bbdb-indent-string (concat val "\n") indent)))
 
+(defvar message-mode-hook)
+
 ;;;###autoload
 (defun gnorb-bbdb-mail (records &optional subject n verbose)
   "\\Acts just like `bbdb-mail', except runs
@@ -392,14 +392,16 @@ both, use \"C-u\" before the \"*\"."
 (mapconcat
  'identity
  (delete-dups
-  (cl-mapcan (lambda (r)
-(bbdb-record-xfield-split r gnorb-bbdb-org-tag-field))
-  records))
+  (cl-mapcan
+   (lambda (r)
+ (bbdb-record-xfield-split r gnorb-bbdb-org-tag-field))
+   records))
  "|")))
 (if tag-string
;; C-u = all headings, not just todos
-   (org-tags-view (not (equal current-prefix-arg '(4)))
-   tag-string)
+   (if (equal current-prefix-arg '(4))
+   (org-tags-view nil tag-string)
+ (org-tags-view t tag-string))
   (error "No org-tags field present"
 
 ;;;###autoload
@@ -424,9 +426,9 @@ a prefix arg and \"*\", the prefix arg must come first."
 (when (equal current-prefix-arg '(4))
   (setq search-string
(read-from-minibuffer
-(format "%s search string: " (cl-fi

[elpa] master 3e5c11a 1/4: Squashed 'packages/gnorb/' changes from 321b23b..4e7039a

2015-04-23 Thread Eric Abrahamsen
branch: master
commit 3e5c11a13981a1ff613cb4442ad644285c44e481
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

Squashed 'packages/gnorb/' changes from 321b23b..4e7039a

4e7039a Various compiler-inspired improvements
9b2b269 Use with-eval-after-load not eval-after-load
86fa893 Fix up all cl-lib calls
a59dac2 Use hook for determining Gnorb summary minor mode
4d3de61 Various documentation improvements
acb91c5 Fix doc error
6fd368d Provide more format marks in summary buffers
d9a1d89 Remove unused let variable
3f9c534 Report Gnorb email tracking usage
0f18c45 Allow persistent nnir search groups
2d30b0c Reset window conf after nnir-run-gnorb
160f43a New function for returning all tracked messages
9efae5a Fix call to cl-subseq
ce764a5 fixup with new quick reply command
b0fe9ae New command `gnorb-gnus-quick-reply'
5897188 Capture to child/sibling is done
4f99dd7 Handle conditions where `registry-search' returns nil
b951675 Merge capture-to-child branch
13bb840 Hint which heading will be triggered
c13f4df Better check for capture cleanup
dfa0043 Safer usage of cl-subseq
94fe1b8 Incorporate changes from Stefan M
d2e1e11 Mention registry bugs in README
a4089f8 Fix completing-read in message disassociation
9c910c9 Re-raise errors in the triggering process
648f5a7 Remove process mark after bulk association
84ff7a7 Don't let attach errors derail the trigger process
819b1e5 Suggest binding gnorb-org-view in Org Agenda
9d64acb Update gnorb-registry-capture to use convenience funcs
cc7d45b Be more careful handling org tags on BBDB records
f585c03 condition-case the incoming trigger process
821a6b2 Allow bulk association of messages
4b19c83 New function for pruning dead associations
09679fa Misspelled function name
41c6778 nngnorb should be a virtual server
6e6ee46 Zap another with-eval-after-load
c3279d2 Fix tracking messages from virtual groups
9220a10 Docstring fix
c8b80c5 Bugfix for gnorb-gnus-view
8c333ee Merge pull request #20 from totherme/master
3801ad7 Check both gnus version and emacs version.
94f6897 Don't use with-eval-after-load
fd91084 Remove incorrect "fix" for Gnus 5.13
8a9c167 Fix the cl-lib loading stuff

git-subtree-dir: packages/gnorb
git-subtree-split: 4e7039a15b47244e7bd2c580d8bce976a6116b5a
---
 README.org|   29 ++-
 gnorb-bbdb.el |   41 -
 gnorb-gnus.el |  280 -
 gnorb-org.el  |   60 +++
 gnorb-registry.el |  118 +++---
 gnorb-utils.el|  169 ++--
 gnorb.el  |   11 +-
 gnorb.info|  199 +-
 gnorb.org |  108 +++--
 gnorb.texi|  132 +++--
 nngnorb.el|   36 ---
 11 files changed, 834 insertions(+), 349 deletions(-)

diff --git a/README.org b/README.org
index 1f8f82f..9e2f9bd 100644
--- a/README.org
+++ b/README.org
@@ -16,7 +16,31 @@ mini mailboxes.
 *Note for previous users*: If you were using Gnorb from Github before
 it shifted to the Elpa repository, the email tracking mechanism has
 changed, please see the manual for details.
+** Known bugs/issues
+*** Gnus Registry
+Prior to late December, 2014, the Gnus registry had some issues with
+preserving "precious" entries while pruning.
 
+When the registry approaches its maximum size it will delete excess
+entries, a process referred to as "pruning". "Precious" entries are
+those that contain important information: they should not be pruned.
+
+Gnorb uses the registry to track associations between messages and Org
+headings, and marks those entries as precious. The entire process of
+tracking, in fact, relies on these entries being preserved, and Gnorb
+goes to some lengths to protect this information. Older versions of
+the registry could nevertheless delete those entries.
+
+These issues are fixed circa the end of December, 2014, around "Ma
+Gnus v0.12", whatever that means. If you think there's a possibility
+your registry is full, and associations are being deleted, you might
+consider upgrading to a recent Gnus.
+*** Multiple Associations
+Gnorb theoretically supports email messages being associated with
+multiple Org headings. In practice, however, this situation hasn't
+been thought through completely, and you may experience weirdness. If
+you do, and you have some ideas about how it should be handled, please
+contact the author and suggest them.
 ** Installation
 
 It's easiest to install Gnorb from Elpa: run `list-packages' and look
@@ -60,7 +84,10 @@ composing messages from... Or maybe it's just a case of NIH.
 Provide an Org Agenda command that does an email search for messages
 received in the visible date span, or day under point, etc. Make it
 work in the calendar, as well?
-*** TODO Capture to 

[elpa] master c10ba4b 12/12: Merge commit '725e12a51e837ed75361f9f2258a887cacb120cd' from swiper

2015-04-23 Thread Oleh Krehel
branch: master
commit c10ba4bc0ffd0dc1c2acb0443e52044adb2cdeed
Merge: f9b63e4 725e12a
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit '725e12a51e837ed75361f9f2258a887cacb120cd' from swiper
---
 packages/swiper/counsel.el |   17 ++--
 packages/swiper/ivy.el |   60 ---
 packages/swiper/swiper.el  |8 -
 3 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/packages/swiper/counsel.el b/packages/swiper/counsel.el
index a99bda8..f41608d 100644
--- a/packages/swiper/counsel.el
+++ b/packages/swiper/counsel.el
@@ -229,15 +229,14 @@
   (ivy--dynamic-function (when (> counsel--git-grep-count 2)
'counsel-git-grep-function))
   (ivy--persistent-action (lambda (x)
-(setq lst (split-string x ":"))
-(find-file (expand-file-name (car lst) 
counsel--git-grep-dir))
-(goto-char (point-min))
-(forward-line (1- (string-to-number 
(cadr lst
-(setq swiper--window (selected-window))
-(swiper--cleanup)
-(swiper--add-overlays (ivy--regex 
ivy-text
-  (val (ivy-read "pattern: " 'counsel-git-grep-function))
-  lst)
+(let ((lst (split-string x ":")))
+  (find-file (expand-file-name (car 
lst) counsel--git-grep-dir))
+  (goto-char (point-min))
+  (forward-line (1- (string-to-number 
(cadr lst
+  (setq swiper--window 
(selected-window))
+  (swiper--cleanup)
+  (swiper--add-overlays (ivy--regex 
ivy-text)
+  (val (ivy-read "pattern: " 'counsel-git-grep-function)))
  (when val
(funcall ivy--persistent-action val)))
 (swiper--cleanup)))
diff --git a/packages/swiper/ivy.el b/packages/swiper/ivy.el
index 6fca361..ed9d3f9 100644
--- a/packages/swiper/ivy.el
+++ b/packages/swiper/ivy.el
@@ -166,6 +166,8 @@ When non-nil, it should contain one %d.")
 (defvar ivy--regex-function 'ivy--regex
   "Current function for building a regex.")
 
+(defvar Info-current-file)
+
 ;;** Commands
 (defun ivy-done ()
   "Exit the minibuffer with the selected candidate."
@@ -173,16 +175,9 @@ When non-nil, it should contain one %d.")
   (delete-minibuffer-contents)
   (when (cond (ivy--directory
(insert
-(cond ((string= ivy-text "")
-   (if (equal ivy--current "./")
-   ivy--directory
- (if (string-match "\\*" ivy--current)
- ivy--current
-   (expand-file-name ivy--current ivy--directory
-  ((zerop ivy--length)
-   (expand-file-name ivy-text ivy--directory))
-  (t
-   (expand-file-name ivy--current ivy--directory
+(if (zerop ivy--length)
+(expand-file-name ivy-text ivy--directory)
+  (expand-file-name ivy--current ivy--directory)))
(setq ivy-exit 'done))
   ((zerop ivy--length)
(if (memq ivy-require-match
@@ -214,21 +209,16 @@ When ARG is t, exit with current text, ignoring the 
candidates."
   (if arg
   (ivy-immediate-done)
 (let (dir)
-  (cond ((and ivy--directory
-  (= 0 ivy--index)
-  (= 0 (length ivy-text)))
- (ivy-done))
-
-((and ivy--directory
-  (cl-plusp ivy--length)
-  (file-directory-p
-   (setq dir (expand-file-name
-  ivy--current ivy--directory
- (ivy--cd dir)
- (ivy--exhibit))
-
-(t
- (ivy-done))
+  (if (and ivy--directory
+   (not (string= ivy--current "./"))
+   (cl-plusp ivy--length)
+   (file-directory-p
+(setq dir (expand-file-name
+   ivy--current ivy--directory
+  (progn
+(ivy--cd dir)
+(ivy--exhibit))
+(ivy-done)
 
 (defun ivy-immediate-done ()
   "Exit the minibuffer with the current input."
@@ -343,7 +333,9 @@ On error (read-only), call `ivy-on-del-error-function'."
   (if (and ivy--directory (= (minibuffer-prompt-end) (point)))
   (progn
 (ivy--cd (file-name-directory
-  (directory-file-name ivy--directory)))
+  (directory-file-name
+   (expand-file-name
+ 

[elpa] master 7032df7 06/12: counsel.el (counsel-git-grep): Fixup

2015-04-23 Thread Oleh Krehel
branch: master
commit 7032df7c6d3d195d0e943201e08641816c14185e
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-git-grep): Fixup
---
 counsel.el |   17 -
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/counsel.el b/counsel.el
index a99bda8..f41608d 100644
--- a/counsel.el
+++ b/counsel.el
@@ -229,15 +229,14 @@
   (ivy--dynamic-function (when (> counsel--git-grep-count 2)
'counsel-git-grep-function))
   (ivy--persistent-action (lambda (x)
-(setq lst (split-string x ":"))
-(find-file (expand-file-name (car lst) 
counsel--git-grep-dir))
-(goto-char (point-min))
-(forward-line (1- (string-to-number 
(cadr lst
-(setq swiper--window (selected-window))
-(swiper--cleanup)
-(swiper--add-overlays (ivy--regex 
ivy-text
-  (val (ivy-read "pattern: " 'counsel-git-grep-function))
-  lst)
+(let ((lst (split-string x ":")))
+  (find-file (expand-file-name (car 
lst) counsel--git-grep-dir))
+  (goto-char (point-min))
+  (forward-line (1- (string-to-number 
(cadr lst
+  (setq swiper--window 
(selected-window))
+  (swiper--cleanup)
+  (swiper--add-overlays (ivy--regex 
ivy-text)
+  (val (ivy-read "pattern: " 'counsel-git-grep-function)))
  (when val
(funcall ivy--persistent-action val)))
 (swiper--cleanup)))



[elpa] master cf3ac8f 04/12: ivy.el (ivy-done): Update wrt globs

2015-04-23 Thread Oleh Krehel
branch: master
commit cf3ac8f0e401d573ba17027eee00627dfeda8537
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-done): Update wrt globs

Re #55
---
 ivy.el |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index 89c6e51..9019296 100644
--- a/ivy.el
+++ b/ivy.el
@@ -171,12 +171,12 @@ When non-nil, it should contain one %d.")
   (delete-minibuffer-contents)
   (when (cond (ivy--directory
(insert
-(cond ((string= ivy-text "")
+(cond ((string-match "\\*" ivy--current)
+   ivy--current)
+  ((string= ivy-text "")
(if (equal ivy--current "./")
ivy--directory
- (if (string-match "\\*" ivy--current)
- ivy--current
-   (expand-file-name ivy--current ivy--directory
+ (expand-file-name ivy--current ivy--directory)))
   ((zerop ivy--length)
(if (string-match "\\*" ivy-text)
ivy-text
@@ -678,6 +678,8 @@ When GREEDY is non-nil, join words in a greedy way."
   ;; get out of the prompt area
   (constrain-to-field nil (point-max)
 
+(defvar inhibit-message)
+
 (defun ivy--exhibit ()
   "Insert Ivy completions display.
 Should be run via minibuffer `post-command-hook'."



[elpa] master 013fe04 02/12: swiper.el (swiper--ivy): Check for stand-alone ivy

2015-04-23 Thread Oleh Krehel
branch: master
commit 013fe040df63d3e38c3c1d5bf096f2f727c6312c
Author: Oleh Krehel 
Commit: Oleh Krehel 

swiper.el (swiper--ivy): Check for stand-alone ivy

Re #54
---
 swiper.el |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/swiper.el b/swiper.el
index c58f20f..290260e 100644
--- a/swiper.el
+++ b/swiper.el
@@ -172,6 +172,9 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
   "`isearch' with an overview using `ivy'.
 When non-nil, INITIAL-INPUT is the initial search pattern."
   (interactive)
+  (unless (eq (length (help-function-arglist 'ivy-read)) 4)
+(warn "You seem to be using the outdated stand-alone \"ivy\" package.
+Please remove it and update the \"swiper\" package."))
   (swiper--init)
   (let ((candidates (swiper--candidates))
 (preselect (format



[elpa] master 37b7d39 03/12: swiper.el (swiper-query-replace): Fix

2015-04-23 Thread Oleh Krehel
branch: master
commit 37b7d39e98bb5f8c30224101086a510b2481df33
Author: Oleh Krehel 
Commit: Oleh Krehel 

swiper.el (swiper-query-replace): Fix
---
 swiper.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/swiper.el b/swiper.el
index 290260e..347f486 100644
--- a/swiper.el
+++ b/swiper.el
@@ -92,7 +92,7 @@
 (lambda ()
   (with-selected-window swiper--window
 (perform-replace from to
- t t t
+ t t nil
   (swiper--cleanup)
   (exit-minibuffer
 



[elpa] master 9470e76 09/12: Avoid sorting org refile candidates

2015-04-23 Thread Oleh Krehel
branch: master
commit 9470e76e1af2f9a600f715eb99d84e8c8645fd7a
Author: Oleh Krehel 
Commit: Oleh Krehel 

Avoid sorting org refile candidates

* ivy.el (ivy-read): Update.
---
 ivy.el |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index 55a6152..97cdb41 100644
--- a/ivy.el
+++ b/ivy.el
@@ -465,9 +465,10 @@ When SORT is t, refer to `ivy-sort-functions-alist' for 
sorting."
   (when (and (setq sort-fn (cdr sort-fn))
  (not (eq collection 'read-file-name-internal)))
 (setq coll (cl-sort coll sort-fn)))
-(if (and (setq sort-fn (cdr (assoc t ivy-sort-functions-alist)))
- (<= (length coll) ivy-sort-max-size))
-(setq coll (cl-sort (copy-sequence coll) sort-fn)
+(unless (eq history 'org-refile-history)
+  (if (and (setq sort-fn (cdr (assoc t ivy-sort-functions-alist)))
+   (<= (length coll) ivy-sort-max-size))
+  (setq coll (cl-sort (copy-sequence coll) sort-fn))
 (when preselect
   (unless (or require-match
   (member preselect coll))



[elpa] master a70b734 05/12: ivy.el (ivy-backward-delete-char): Expand `ivy--directory'

2015-04-23 Thread Oleh Krehel
branch: master
commit a70b734cb3e21553479b5ba96fb531524e648b33
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-backward-delete-char): Expand `ivy--directory'

This avoids the situation of getting a nil for "~/".

Re #57
---
 ivy.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index 9019296..c270294 100644
--- a/ivy.el
+++ b/ivy.el
@@ -343,7 +343,9 @@ On error (read-only), call `ivy-on-del-error-function'."
   (if (and ivy--directory (= (minibuffer-prompt-end) (point)))
   (progn
 (ivy--cd (file-name-directory
-  (directory-file-name ivy--directory)))
+  (directory-file-name
+   (expand-file-name
+ivy--directory
 (ivy--exhibit))
 (condition-case nil
 (backward-delete-char 1)



[elpa] master 725e12a 11/12: ivy.el (Info-current-file): Declare

2015-04-23 Thread Oleh Krehel
branch: master
commit 725e12a51e837ed75361f9f2258a887cacb120cd
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (Info-current-file): Declare
---
 ivy.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 53e8057..7d6e99e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -164,6 +164,8 @@ When non-nil, it should contain one %d.")
 (defvar ivy--regex-function 'ivy--regex
   "Current function for building a regex.")
 
+(defvar Info-current-file)
+
 ;;** Commands
 (defun ivy-done ()
   "Exit the minibuffer with the selected candidate."
@@ -402,8 +404,8 @@ Directories come first."
 
 ;;** Entry Point
 (cl-defun ivy-read (prompt collection
-   &key predicate require-match initial-input
-   history preselect keymap update-fn sort)
+&key predicate require-match initial-input
+  history preselect keymap update-fn sort)
   "Read a string in the minibuffer, with completion.
 
 PROMPT is a string to prompt with; normally it ends in a colon



[elpa] master 444f57e 01/12: ivy.el (ivy-done): Don't expand globs

2015-04-23 Thread Oleh Krehel
branch: master
commit 444f57e6b7b454a66ee6fd91ae38f3ae6301bd27
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-done): Don't expand globs

Re #55
---
 ivy.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index 07ea004..89c6e51 100644
--- a/ivy.el
+++ b/ivy.el
@@ -178,7 +178,9 @@ When non-nil, it should contain one %d.")
  ivy--current
(expand-file-name ivy--current ivy--directory
   ((zerop ivy--length)
-   (expand-file-name ivy-text ivy--directory))
+   (if (string-match "\\*" ivy-text)
+   ivy-text
+ (expand-file-name ivy-text ivy--directory)))
   (t
(expand-file-name ivy--current ivy--directory
(setq ivy-exit 'done))



[elpa] master 886d908 08/12: Exclude jabber-chat-mode from font-lock

2015-04-23 Thread Oleh Krehel
branch: master
commit 886d9080618cdf0dfc93090c61ced77e4686cdb2
Author: Oleh Krehel 
Commit: Oleh Krehel 

Exclude jabber-chat-mode from font-lock

* swiper.el (swiper-font-lock-ensure): Update.
---
 swiper.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/swiper.el b/swiper.el
index 347f486..114acb1 100644
--- a/swiper.el
+++ b/swiper.el
@@ -114,7 +114,8 @@
  gnus-group-mode
  emms-playlist-mode erc-mode
  org-agenda-mode
- dired-mode)))
+ dired-mode
+ jabber-chat-mode)))
 (unless (> (buffer-size) 10)
   (if (fboundp 'font-lock-ensure)
   (font-lock-ensure)



[elpa] master updated (f9b63e4 -> c10ba4b)

2015-04-23 Thread Oleh Krehel
abo_abo pushed a change to branch master.

  from  f9b63e4   Merge commit '0d69d15d20b69f439c1a1ed451e06f77b1252b3e' 
from gnorb
   new  444f57e   ivy.el (ivy-done): Don't expand globs
   new  013fe04   swiper.el (swiper--ivy): Check for stand-alone ivy
   new  37b7d39   swiper.el (swiper-query-replace): Fix
   new  cf3ac8f   ivy.el (ivy-done): Update wrt globs
   new  a70b734   ivy.el (ivy-backward-delete-char): Expand `ivy--directory'
   new  7032df7   counsel.el (counsel-git-grep): Fixup
   new  c3e38fb   Remove globbing heuristics for file name completion
   new  886d908   Exclude jabber-chat-mode from font-lock
   new  9470e76   Avoid sorting org refile candidates
   new  9b315e8   Use "//" to move to root instead of "/" as before
   new  725e12a   ivy.el (Info-current-file): Declare
   new  c10ba4b   Merge commit '725e12a51e837ed75361f9f2258a887cacb120cd' 
from swiper


Summary of changes:
 packages/swiper/counsel.el |   17 ++--
 packages/swiper/ivy.el |   60 ---
 packages/swiper/swiper.el  |8 -
 3 files changed, 42 insertions(+), 43 deletions(-)



[elpa] master c3e38fb 07/12: Remove globbing heuristics for file name completion

2015-04-23 Thread Oleh Krehel
branch: master
commit c3e38fb04f9b953908e04df03c884af29e195797
Author: Oleh Krehel 
Commit: Oleh Krehel 

Remove globbing heuristics for file name completion

* ivy.el (ivy-done): Simplify.
(ivy-alt-done): Simplify.

If you want to exit with the current text, ignoring candidates, use
`ivy-immediate-done' instead. Works for globs as well.

Fixes #55
---
 ivy.el |   40 +---
 1 files changed, 13 insertions(+), 27 deletions(-)

diff --git a/ivy.el b/ivy.el
index c270294..55a6152 100644
--- a/ivy.el
+++ b/ivy.el
@@ -171,18 +171,9 @@ When non-nil, it should contain one %d.")
   (delete-minibuffer-contents)
   (when (cond (ivy--directory
(insert
-(cond ((string-match "\\*" ivy--current)
-   ivy--current)
-  ((string= ivy-text "")
-   (if (equal ivy--current "./")
-   ivy--directory
- (expand-file-name ivy--current ivy--directory)))
-  ((zerop ivy--length)
-   (if (string-match "\\*" ivy-text)
-   ivy-text
- (expand-file-name ivy-text ivy--directory)))
-  (t
-   (expand-file-name ivy--current ivy--directory
+(if (zerop ivy--length)
+(expand-file-name ivy-text ivy--directory)
+  (expand-file-name ivy--current ivy--directory)))
(setq ivy-exit 'done))
   ((zerop ivy--length)
(if (memq ivy-require-match
@@ -214,21 +205,16 @@ When ARG is t, exit with current text, ignoring the 
candidates."
   (if arg
   (ivy-immediate-done)
 (let (dir)
-  (cond ((and ivy--directory
-  (= 0 ivy--index)
-  (= 0 (length ivy-text)))
- (ivy-done))
-
-((and ivy--directory
-  (cl-plusp ivy--length)
-  (file-directory-p
-   (setq dir (expand-file-name
-  ivy--current ivy--directory
- (ivy--cd dir)
- (ivy--exhibit))
-
-(t
- (ivy-done))
+  (if (and ivy--directory
+   (not (string= ivy--current "./"))
+   (cl-plusp ivy--length)
+   (file-directory-p
+(setq dir (expand-file-name
+   ivy--current ivy--directory
+  (progn
+(ivy--cd dir)
+(ivy--exhibit))
+(ivy-done)
 
 (defun ivy-immediate-done ()
   "Exit the minibuffer with the current input."



[elpa] master 9b315e8 10/12: Use "//" to move to root instead of "/" as before

2015-04-23 Thread Oleh Krehel
branch: master
commit 9b315e8409779b29df8c0f39c0006fd0cb589c04
Author: Oleh Krehel 
Commit: Oleh Krehel 

Use "//" to move to root instead of "/" as before

ivy.el (ivy--exhibit): Update.

This improves the situation with tramp and generally avoids losing the
current directory by pressing "/" by accident.

Fixes #59
---
 ivy.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index 97cdb41..53e8057 100644
--- a/ivy.el
+++ b/ivy.el
@@ -688,7 +688,8 @@ Should be run via minibuffer `post-command-hook'."
   (if (string-match "/$" ivy-text)
   (if (member ivy-text ivy--all-candidates)
   (ivy--cd (expand-file-name ivy-text ivy--directory))
-(ivy--cd "/"))
+(when (string-match "//$" ivy-text)
+  (ivy--cd "/")))
 (if (string-match "~$" ivy-text)
 (ivy--cd (expand-file-name "~/")
 (ivy--insert-minibuffer



[elpa] master 02fea21 06/22: Merge pull request #213 from lelit/typos

2015-04-23 Thread Dmitry Gutov
branch: master
commit 02fea21b88f5f55c8c2601b425e105e08db3a61e
Merge: dfad0d5 bf454ef
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #213 from lelit/typos

Fix typos in comments and docstrings
---
 js2-mode.el |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 4045c94..cb9b454 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -1384,7 +1384,7 @@ the correct number of ARGS must be provided."
  "Invalid assignment left-hand side.")
 
 (js2-msg "msg.bad.decr"
- "Invalid decerement operand.")
+ "Invalid decrement operand.")
 
 (js2-msg "msg.bad.incr"
  "Invalid increment operand.")
@@ -5366,7 +5366,7 @@ Returns logical OR of END_* flags."
   (let* ((rv js2-END_DROPS_OFF)
  (kids (js2-block-node-kids node))
  (n (car kids)))
-;; Check each statment.  If the statement can continue onto the next
+;; Check each statement.  If the statement can continue onto the next
 ;; one (i.e. END_DROPS_OFF is set), then check the next statement.
 (while (and n (js2-flag-set-p rv js2-END_DROPS_OFF))
   (js2-clear-flag rv js2-END_DROPS_OFF)
@@ -6779,7 +6779,7 @@ Shown at or above `js2-highlight-level' 3.")
 
 (defun js2-parse-highlight-member-expr-node (node)
   "Perform syntax highlighting of EcmaScript built-in properties.
-The variable `js2-highlight-level' governs this highighting."
+The variable `js2-highlight-level' governs this highlighting."
   (let (face target prop name pos end parent call-p callee)
 (cond
  ;; case 1:  simple name, e.g. foo
@@ -9161,7 +9161,7 @@ Returns the parsed `js2-var-decl-node' expression node."
 (defun js2-parse-let (pos &optional stmt-p)
   "Parse a let expression or statement.
 A let-expression is of the form `let (vars) expr'.
-A let-statment is of the form `let (vars) {statements}'.
+A let-statement is of the form `let (vars) {statements}'.
 The third form of let is a variable declaration list, handled
 by `js2-parse-variables'."
   (let ((pn (make-js2-let-node :pos pos))
@@ -12075,7 +12075,7 @@ move backward across N balanced expressions."
(when (setq child (js2-node-closest-child node (point) rp))
  (setq pos (js2-node-abs-end child)))
  (setq pos (1+ rp
- ;; No parens or child nodes, looks for the end of the curren node.
+ ;; No parens or child nodes, looks for the end of the current 
node.
  (cl-incf pos (js2-node-len
(if (js2-expr-stmt-node-p (js2-node-parent node))
;; Stop after the semicolon.



[elpa] master fae5776 01/22: Check that the let declaration comes before the reference

2015-04-23 Thread Dmitry Gutov
branch: master
commit fae57760064e25fd1b307a8f6b117c41eae45320
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Check that the let declaration comes before the reference

Implementing, more or less, the ES6 "temporal dead zone" for let.


https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#Temporal_dead_zone_and_errors_with_let
https://bugzilla.mozilla.org/show_bug.cgi?id=1001090
---
 js2-mode.el |   18 --
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 8133903..bef5e61 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -2313,19 +2313,25 @@ Returns nil if there is no enclosing scope node."
   (setq parent (js2-node-parent parent)))
 parent))
 
-(defun js2-get-defining-scope (scope name)
+(defun js2-get-defining-scope (scope name &optional point)
   "Search up scope chain from SCOPE looking for NAME, a string or symbol.
-Returns `js2-scope' in which NAME is defined, or nil if not found."
+Returns `js2-scope' in which NAME is defined, or nil if not found.
+
+If POINT is non-nil, and if the found declaration type is
+`js2-LET', also check that the declaration node is before POINT."
   (let ((sym (if (symbolp name)
  name
(intern name)))
-table
 result
 (continue t))
 (while (and scope continue)
   (if (or
-   (and (setq table (js2-scope-symbol-table scope))
-(assq sym table))
+   (let ((entry (cdr (assq sym (js2-scope-symbol-table scope)
+ (and entry
+  (or (not point)
+  (not (eq js2-LET (js2-symbol-decl-type entry)))
+  (>= point
+  (js2-node-abs-pos (js2-symbol-ast-node entry))
(and (eq sym 'arguments)
 (js2-function-node-p scope)))
   (setq continue nil
@@ -7034,7 +7040,7 @@ it is considered declared."
 (unless (or (member name js2-global-externs)
 (member name js2-default-externs)
 (member name js2-additional-externs)
-(js2-get-defining-scope scope name))
+(js2-get-defining-scope scope name pos))
   (js2-report-warning "msg.undeclared.variable" name pos (- end pos)
   'js2-external-variable
 (setq js2-recorded-identifiers nil)))



[elpa] master dfad0d5 04/22: Merge pull request #211 from cowboyd/no-semicolon-warning-on-function-export

2015-04-23 Thread Dmitry Gutov
branch: master
commit dfad0d56bb27e8500780063b0cfef2bd4d1814e7
Merge: dd2106b 28853c9
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #211 from cowboyd/no-semicolon-warning-on-function-export

do auto semicolon insert on function exports
---
 js2-mode.el |   11 ---
 tests/parser.el |   10 ++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 2fd0630..4045c94 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -8094,7 +8094,8 @@ node are given relative start positions and correct 
lengths."
 js2-ERROR
 js2-SEMI
 js2-CLASS
-js2-FUNCTION)
+js2-FUNCTION
+js2-EXPORT)
   "List of tokens that don't do automatic semicolon insertion.")
 
 (defconst js2-autoinsert-semi-and-warn
@@ -8529,9 +8530,13 @@ invalid export statements."
 (when from-clause
   (push from-clause children))
 (when declaration
-  (push declaration children))
+  (push declaration children)
+  (when (not (js2-function-node-p declaration))
+(js2-auto-insert-semicolon declaration)))
 (when default
-  (push default children))
+  (push default children)
+  (when (not (js2-function-node-p default))
+(js2-auto-insert-semicolon default)))
 (let ((node (make-js2-export-node
   :pos beg
   :len (- (js2-current-token-end) beg)
diff --git a/tests/parser.el b/tests/parser.el
index b4f2d8f..8c44028 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -608,6 +608,16 @@ the test."
 (should export-node)
 (should (js2-export-node-default export-node
 
+(js2-deftest export-function-no-semicolon "export default function foo() {}"
+  (js2-mode)
+  (should (equal nil js2-parsed-warnings)))
+(js2-deftest export-default-function-no-semicolon "export function foo() {}"
+  (js2-mode)
+  (should (equal nil js2-parsed-warnings)))
+(js2-deftest export-anything-else-does-require-a-semicolon "export var obj = 
{}"
+  (js2-mode)
+  (should (not (equal nil js2-parsed-warnings
+
 (js2-deftest-parse parse-export-rexport "export * from 'other/lib';")
 (js2-deftest-parse parse-export-export-named-list "export {foo, bar as bang};")
 (js2-deftest-parse parse-re-export-named-list "export {foo, bar as bang} from 
'other/lib';")



[elpa] master 3b76567 12/22: Fix js2-node-get-enclosing-scope

2015-04-23 Thread Dmitry Gutov
branch: master
commit 3b765677df64dd1ec5692b52cf6382910ccf293b
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fix js2-node-get-enclosing-scope

Previously this function discriminated against nodes that did not have
parents.  For such nodes, nil should have been returned, but instead an
error was emitted because a parentless node would produce the initial
parent nil, which would cause js2-node-parent to blow up.  This fixes
that.
---
 js2-mode.el |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 5424ff0..41bc507 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -2307,10 +2307,9 @@ If any given node in NODES is nil, doesn't record that 
link."
 (defun js2-node-get-enclosing-scope (node)
   "Return the innermost `js2-scope' node surrounding NODE.
 Returns nil if there is no enclosing scope node."
-  (let ((parent (js2-node-parent node)))
-(while (not (js2-scope-p parent))
-  (setq parent (js2-node-parent parent)))
-parent))
+  (while (and (setq node (js2-node-parent node))
+  (not (js2-scope-p node
+  node)
 
 (defun js2-get-defining-scope (scope name &optional point)
   "Search up scope chain from SCOPE looking for NAME, a string or symbol.



[elpa] master 458d3fe 14/22: Merge pull request #221 from jacksonrayhamilton/enclosing-scope

2015-04-23 Thread Dmitry Gutov
branch: master
commit 458d3feef14b0ab1040c70b59771e4b443ec36e2
Merge: a184642 3b76567
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #221 from jacksonrayhamilton/enclosing-scope

Fix js2-node-get-enclosing-scope
---
 js2-mode.el |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 46ef97d..627a615 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -2307,10 +2307,9 @@ If any given node in NODES is nil, doesn't record that 
link."
 (defun js2-node-get-enclosing-scope (node)
   "Return the innermost `js2-scope' node surrounding NODE.
 Returns nil if there is no enclosing scope node."
-  (let ((parent (js2-node-parent node)))
-(while (not (js2-scope-p parent))
-  (setq parent (js2-node-parent parent)))
-parent))
+  (while (and (setq node (js2-node-parent node))
+  (not (js2-scope-p node
+  node)
 
 (defun js2-get-defining-scope (scope name &optional point)
   "Search up scope chain from SCOPE looking for NAME, a string or symbol.



[elpa] master d4d9c54 17/22: js2-pretty-multiline-declarations: Add 'dynamic option

2015-04-23 Thread Dmitry Gutov
branch: master
commit d4d9c54030ebc0a452c20adcfdef5852fef7bade
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

js2-pretty-multiline-declarations: Add 'dynamic option
---
 js2-mode.el |   65 ++
 tests/indent.el |   27 ++
 2 files changed, 87 insertions(+), 5 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index c8f47e6..3df192e 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -263,14 +263,37 @@ js2-mode also binds `js2-bounce-indent-backwards' to 
Shift-Tab."
   b = 20,
   c = 30;
 
-If the value is not `all', and the first assigned value in
+If the value is t, and the first assigned value in the
 declaration is a function/array/object literal spanning several
 lines, it won't be indented additionally:
 
   var o = {   var bar = 2,
 foo: 3  vs.   o = {
   },foo: 3
-  bar = 2;};"
+  bar = 2;};
+
+If the value is `all', it will always be indented additionally:
+
+  var o = {
+foo: 3
+  };
+
+  var o = {
+foo: 3
+  },
+  bar = 2;
+
+If the value is `dynamic', it will be indented additionally only
+if the declaration contains more than one variable:
+
+  var o = {
+foo: 3
+  };
+
+  var o = {
+foo: 3
+  },
+  bar = 2;"
   :group 'js2-mode
   :type 'symbol)
 (js2-mark-safe-local 'js2-pretty-multiline-declarations 'symbolp)
@@ -10780,6 +10803,40 @@ In particular, return the buffer position of the first 
`for' kwd."
   (goto-char for-kwd)
   (current-column
 
+(defun js2-maybe-goto-declaration-keyword-end (bracket)
+  "Helper function for `js2-proper-indentation'.
+Depending on the value of `js2-pretty-multiline-declarations',
+move point to the end of a variable declaration keyword so that
+indentation is aligned to that column."
+  (cond
+   ((eq js2-pretty-multiline-declarations 'all)
+(when (looking-at js2-declaration-keyword-re)
+  (goto-char (1+ (match-end 0)
+   ((eq js2-pretty-multiline-declarations 'dynamic)
+(let (declaration-keyword-end
+  at-closing-bracket-p
+  comma-p)
+  (when (looking-at js2-declaration-keyword-re)
+;; Preserve the match data lest it somehow be overridden.
+(setq declaration-keyword-end (match-end 0))
+(save-excursion
+  (goto-char bracket)
+  (setq at-closing-bracket-p
+;; Handle scan errors gracefully.
+(condition-case nil
+(progn
+  ;; Use the regular `forward-sexp-function' because the
+  ;; normal one for this mode uses the AST.
+  (let (forward-sexp-function)
+(forward-sexp))
+  t)
+  (error nil)))
+  (when at-closing-bracket-p
+(js2-forward-sws)
+(setq comma-p (looking-at-p ","
+(when comma-p
+  (goto-char (1+ declaration-keyword-end
+
 (defun js2-proper-indentation (parse-status)
   "Return the proper indentation for the current line."
   (save-excursion
@@ -10823,9 +10880,7 @@ In particular, return the buffer position of the first 
`for' kwd."
 (looking-at ")"))
 (backward-list))
   (back-to-indentation)
-  (and (eq js2-pretty-multiline-declarations 'all)
-   (looking-at js2-declaration-keyword-re)
-   (goto-char (1+ (match-end 0
+  (js2-maybe-goto-declaration-keyword-end bracket)
   (setq indent
 (cond (same-indent-p
(current-column))
diff --git a/tests/indent.el b/tests/indent.el
index b720984..df69202 100644
--- a/tests/indent.el
+++ b/tests/indent.el
@@ -112,3 +112,30 @@
   |  are kept
   |unchanged!`"
   :keep-indent t)
+
+(js2-deftest-indent no-multiline-decl-first-arg-function-dynamic
+  "var foo = function() {
+  |  return 7;
+  |};"
+  :bind ((js2-pretty-multiline-declarations 'dynamic)))
+
+(js2-deftest-indent multiline-decl-first-arg-function-indent-dynamic
+  "var foo = function() {
+  |  return 7;
+  |},
+  |bar = 8;"
+  :bind ((js2-pretty-multiline-declarations 'dynamic)))
+
+(js2-deftest-indent multiline-decl-first-arg-function-indent-dynamic-comment
+  "var foo = function() {
+  |  return 7;
+  |}/* MUAHAHAHA, ah ha! */,
+  |bar = 8;"
+  :bind ((js2-pretty-multiline-declarations 'dynamic)))
+
+(js2-deftest-indent multiline-decl-first-arg-function-indent-dynamic-scan-error
+  "var foo = function() {
+  |  return 7;
+  |  ,
+  |  bar = 8;"
+  :bind ((js2-pretty-multiline-declarations 'dynamic)))



[elpa] master 7bf479a 08/22: Fix js2-paren-node length

2015-04-23 Thread Dmitry Gutov
branch: master
commit 7bf479a75bd279005ac76a7919b57001a13f8ea3
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Fix js2-paren-node length

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

diff --git a/js2-mode.el b/js2-mode.el
index c7c5f22..7314c28 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -9272,11 +9272,10 @@ If NODE is non-nil, it is the AST node associated with 
the symbol."
   (let* ((js2-in-for-init nil)
  (expr (js2-parse-expr))
  (pn (make-js2-paren-node :pos px-pos
-  :expr expr
-  :len (- (js2-current-token-end)
-  px-pos
+  :expr expr)))
 (js2-node-add-children pn (js2-paren-node-expr pn))
 (js2-must-match js2-RP "msg.no.paren")
+(setf (js2-node-len pn) (- (js2-current-token-end) px-pos))
 pn)
 
 (defun js2-parse-expr (&optional oneshot)



[elpa] master dd2106b 02/22: Merge branch 'let-temporal-dz'

2015-04-23 Thread Dmitry Gutov
branch: master
commit dd2106bfb2675eeb0005b7cc73a3efdb75827965
Merge: 7558a96 fae5776
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge branch 'let-temporal-dz'
---
 js2-mode.el |   18 --
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 6ab7cb9..2fd0630 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -2313,19 +2313,25 @@ Returns nil if there is no enclosing scope node."
   (setq parent (js2-node-parent parent)))
 parent))
 
-(defun js2-get-defining-scope (scope name)
+(defun js2-get-defining-scope (scope name &optional point)
   "Search up scope chain from SCOPE looking for NAME, a string or symbol.
-Returns `js2-scope' in which NAME is defined, or nil if not found."
+Returns `js2-scope' in which NAME is defined, or nil if not found.
+
+If POINT is non-nil, and if the found declaration type is
+`js2-LET', also check that the declaration node is before POINT."
   (let ((sym (if (symbolp name)
  name
(intern name)))
-table
 result
 (continue t))
 (while (and scope continue)
   (if (or
-   (and (setq table (js2-scope-symbol-table scope))
-(assq sym table))
+   (let ((entry (cdr (assq sym (js2-scope-symbol-table scope)
+ (and entry
+  (or (not point)
+  (not (eq js2-LET (js2-symbol-decl-type entry)))
+  (>= point
+  (js2-node-abs-pos (js2-symbol-ast-node entry))
(and (eq sym 'arguments)
 (js2-function-node-p scope)))
   (setq continue nil
@@ -7034,7 +7040,7 @@ it is considered declared."
 (unless (or (member name js2-global-externs)
 (member name js2-default-externs)
 (member name js2-additional-externs)
-(js2-get-defining-scope scope name))
+(js2-get-defining-scope scope name pos))
   (js2-report-warning "msg.undeclared.variable" name pos (- end pos)
   'js2-external-variable
 (setq js2-recorded-identifiers nil)))



[elpa] master 90a9056 10/22: ...or any following one

2015-04-23 Thread Dmitry Gutov
branch: master
commit 90a905698cebcb9ce3adae86ab4d6733c511c831
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

...or any following one

Likewise, js2-match-token scanned the next token with the wrong modifier.

Instead of adding an optional argument, I've opted to use
js2-get-prop-name-token, in order not to duplicate the version check.

#216
---
 js2-mode.el |   14 +++---
 tests/parser.el |3 +++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 1a7a852..5424ff0 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -10367,13 +10367,13 @@ If ONLY-OF-P is non-nil, only the 'for (foo of bar)' 
form is allowed."
   (if elem (js2-node-set-prop elem 'STATIC t)
 (js2-report-error "msg.unexpected.static")))
   ;; Handle commas, depending on class-p.
-  (let ((comma (js2-match-token js2-COMMA)))
-(if class-p
-(if comma
-(js2-report-error "msg.class.unexpected.comma"))
-  (if comma
-  (setq after-comma (js2-current-token-end))
-(setq continue nil
+  (let ((tok (js2-get-prop-name-token)))
+(if (eq tok js2-COMMA)
+(if class-p
+(js2-report-error "msg.class.unexpected.comma")
+  (setq after-comma (js2-current-token-end)))
+  (js2-unget-token)
+  (unless class-p (setq continue nil
   ;; Append any parsed element.
   (if elem (push elem elems)))   ; end loop
 (js2-must-match js2-RC "msg.no.brace.prop")
diff --git a/tests/parser.el b/tests/parser.el
index 4c9b467..d791d3f 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -683,6 +683,9 @@ the test."
 (js2-deftest-parse parse-super-keyword
   "class Foo {\n  constructor() {  super(42);\n}\n  foo() {  
super.foo();\n}\n}")
 
+(js2-deftest-parse parse-class-keywordlike-method
+  "class C {\n  delete() {}\n  if() {}\n}")
+
 ;;; Scopes
 
 (js2-deftest ast-symbol-table-includes-fn-node "function foo() {}"



[elpa] master ac93b9e 21/22: Address two FIXMEs; fix a regression flagged by tests

2015-04-23 Thread Dmitry Gutov
branch: master
commit ac93b9eef9b6ac44d187b9688d68a7a5f205b3fe
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Address two FIXMEs; fix a regression flagged by tests
---
 js2-mode.el |   21 +++--
 1 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 9bfaa54..2dd5d9d 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -10165,7 +10165,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)
@@ -10174,7 +10174,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))
@@ -11626,13 +11626,6 @@ The last element is optional.  When present, use 
instead of FACE."
 (when (overlay-get o 'js2-error)
   (delete-overlay o))
 
-(defun js2-error-at-point (&optional pos)
-  "Return non-nil if there's an error overlay at POS.
-Defaults to point."
-  (cl-loop with pos = (or pos (point))
-   for o in (overlays-at pos)
-   thereis (overlay-get o 'js2-error)))
-
 (defun js2-mode-apply-deferred-properties ()
   "Apply fontifications and other text properties recorded during parsing."
   (when (cl-plusp js2-highlight-level)
@@ -11702,9 +11695,6 @@ was found on `point-entered' or in 
`cursor-sensor-functions'."
(not (current-message)))
   (message msg
 
-;; FIXME: Why do we keep this?
-(define-obsolete-function-alias 'js2-echo-help #'js2-echo-error "forever")
-
 (defun js2-line-break (&optional _soft)
   "Break line at point and indent, continuing comment if within one.
 If inside a string, and `js2-concat-multiline-strings' is not
@@ -11761,12 +11751,7 @@ PARSE-STATUS is as documented in `parse-partial-sexp'."
 ;; comment.
 (setq needs-close
   (or
-   ;; FIXME: Why not (get-char-property  'js2-error) instead?
-   (if (fboundp 'cursor-sensor-mode)
-   (equal (get-text-property (1- (point)) 'cursor-sensor-functions)
-  '(js2-echo-error))
- (eq (get-text-property (1- (point)) 'point-entered)
- 'js2-echo-error))
+   (get-char-property (1- (point)) 'js2-error)
;; The heuristic above doesn't work well when we're
;; creating a comment and there's another one downstream,
;; as our parser thinks this one ends at the end of the



[elpa] master ee4a202 18/22: Merge pull request #195 from jacksonrayhamilton/pretty-multiline-declarations

2015-04-23 Thread Dmitry Gutov
branch: master
commit ee4a202e063d271f0d98452c2976347dd6f66f52
Merge: 4de6f03 d4d9c54
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #195 from 
jacksonrayhamilton/pretty-multiline-declarations

js2-pretty-multiline-declarations: Add 'dynamic option
---
 js2-mode.el |   65 ++
 tests/indent.el |   27 ++
 2 files changed, 87 insertions(+), 5 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index c8f47e6..3df192e 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -263,14 +263,37 @@ js2-mode also binds `js2-bounce-indent-backwards' to 
Shift-Tab."
   b = 20,
   c = 30;
 
-If the value is not `all', and the first assigned value in
+If the value is t, and the first assigned value in the
 declaration is a function/array/object literal spanning several
 lines, it won't be indented additionally:
 
   var o = {   var bar = 2,
 foo: 3  vs.   o = {
   },foo: 3
-  bar = 2;};"
+  bar = 2;};
+
+If the value is `all', it will always be indented additionally:
+
+  var o = {
+foo: 3
+  };
+
+  var o = {
+foo: 3
+  },
+  bar = 2;
+
+If the value is `dynamic', it will be indented additionally only
+if the declaration contains more than one variable:
+
+  var o = {
+foo: 3
+  };
+
+  var o = {
+foo: 3
+  },
+  bar = 2;"
   :group 'js2-mode
   :type 'symbol)
 (js2-mark-safe-local 'js2-pretty-multiline-declarations 'symbolp)
@@ -10780,6 +10803,40 @@ In particular, return the buffer position of the first 
`for' kwd."
   (goto-char for-kwd)
   (current-column
 
+(defun js2-maybe-goto-declaration-keyword-end (bracket)
+  "Helper function for `js2-proper-indentation'.
+Depending on the value of `js2-pretty-multiline-declarations',
+move point to the end of a variable declaration keyword so that
+indentation is aligned to that column."
+  (cond
+   ((eq js2-pretty-multiline-declarations 'all)
+(when (looking-at js2-declaration-keyword-re)
+  (goto-char (1+ (match-end 0)
+   ((eq js2-pretty-multiline-declarations 'dynamic)
+(let (declaration-keyword-end
+  at-closing-bracket-p
+  comma-p)
+  (when (looking-at js2-declaration-keyword-re)
+;; Preserve the match data lest it somehow be overridden.
+(setq declaration-keyword-end (match-end 0))
+(save-excursion
+  (goto-char bracket)
+  (setq at-closing-bracket-p
+;; Handle scan errors gracefully.
+(condition-case nil
+(progn
+  ;; Use the regular `forward-sexp-function' because the
+  ;; normal one for this mode uses the AST.
+  (let (forward-sexp-function)
+(forward-sexp))
+  t)
+  (error nil)))
+  (when at-closing-bracket-p
+(js2-forward-sws)
+(setq comma-p (looking-at-p ","
+(when comma-p
+  (goto-char (1+ declaration-keyword-end
+
 (defun js2-proper-indentation (parse-status)
   "Return the proper indentation for the current line."
   (save-excursion
@@ -10823,9 +10880,7 @@ In particular, return the buffer position of the first 
`for' kwd."
 (looking-at ")"))
 (backward-list))
   (back-to-indentation)
-  (and (eq js2-pretty-multiline-declarations 'all)
-   (looking-at js2-declaration-keyword-re)
-   (goto-char (1+ (match-end 0
+  (js2-maybe-goto-declaration-keyword-end bracket)
   (setq indent
 (cond (same-indent-p
(current-column))
diff --git a/tests/indent.el b/tests/indent.el
index b720984..df69202 100644
--- a/tests/indent.el
+++ b/tests/indent.el
@@ -112,3 +112,30 @@
   |  are kept
   |unchanged!`"
   :keep-indent t)
+
+(js2-deftest-indent no-multiline-decl-first-arg-function-dynamic
+  "var foo = function() {
+  |  return 7;
+  |};"
+  :bind ((js2-pretty-multiline-declarations 'dynamic)))
+
+(js2-deftest-indent multiline-decl-first-arg-function-indent-dynamic
+  "var foo = function() {
+  |  return 7;
+  |},
+  |bar = 8;"
+  :bind ((js2-pretty-multiline-declarations 'dynamic)))
+
+(js2-deftest-indent multiline-decl-first-arg-function-indent-dynamic-comment
+  "var foo = function() {
+  |  return 7;
+  |}/* MUAHAHAHA, ah ha! */,
+  |bar = 8;"
+  :bind ((js2-pretty-multiline-declarations 'dynamic)))
+
+(js2-deftest-indent multiline-decl-first-arg-function-indent-dynamic-scan-error
+  "var foo = function() {
+  |  return 7;
+  |  ,
+  |  bar = 8;"
+  :bind ((js2-pretty-multiline-declarations 'dynamic)))



[elpa] master a184642 13/22: Merge pull request #220 from jacksonrayhamilton/comment-length

2015-04-23 Thread Dmitry Gutov
branch: master
commit a184642287eb71bd0ff0c115146987ebe65613c8
Merge: 90a9056 bc61ce0
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge pull request #220 from jacksonrayhamilton/comment-length

Fix off-by-one error for comment node length
---
 js2-mode.el |7 +--
 tests/parser.el |   12 
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 5424ff0..46ef97d 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -6163,8 +6163,11 @@ its relevant fields and puts it into `js2-ti-tokens'."
  (setf (js2-token-beg token) (- js2-ts-cursor 2))
  (js2-skip-line)
  (setf (js2-token-comment-type token) 'line)
- ;; include newline so highlighting goes to end of 
window
- (cl-incf (js2-token-end token))
+ ;; include newline so highlighting goes to end of
+ ;; window, if there actually is a newline; if we
+ ;; hit eof, then implicitly there isn't
+ (unless js2-ts-hit-eof
+   (cl-incf (js2-token-end token)))
  (throw 'return js2-COMMENT))
;; is it a /* comment?
(when (js2-match-char ?*)
diff --git a/tests/parser.el b/tests/parser.el
index d791d3f..0dd1502 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -793,3 +793,15 @@ the test."
 (js2-deftest function-without-parens-error "function b {}"
   ;; Should finish the parse.
   (js2-mode))
+
+;;; Comments
+
+(js2-deftest comment-node-length "//"
+  (js2-mode)
+  (let ((node (js2-node-at-point (point-min
+(should (= (js2-node-len node) 2
+
+(js2-deftest comment-node-length-newline "//\n"
+  (js2-mode)
+  (let ((node (js2-node-at-point (point-min
+(should (= (js2-node-len node) 3



[elpa] master bf454ef 05/22: Fix typos in comments and docstrings

2015-04-23 Thread Dmitry Gutov
branch: master
commit bf454ef70e49f84766c289c2b5e110bf8c644c24
Author: Lele Gaifax 
Commit: Lele Gaifax 

Fix typos in comments and docstrings
---
 js2-mode.el |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 4045c94..cb9b454 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -1384,7 +1384,7 @@ the correct number of ARGS must be provided."
  "Invalid assignment left-hand side.")
 
 (js2-msg "msg.bad.decr"
- "Invalid decerement operand.")
+ "Invalid decrement operand.")
 
 (js2-msg "msg.bad.incr"
  "Invalid increment operand.")
@@ -5366,7 +5366,7 @@ Returns logical OR of END_* flags."
   (let* ((rv js2-END_DROPS_OFF)
  (kids (js2-block-node-kids node))
  (n (car kids)))
-;; Check each statment.  If the statement can continue onto the next
+;; Check each statement.  If the statement can continue onto the next
 ;; one (i.e. END_DROPS_OFF is set), then check the next statement.
 (while (and n (js2-flag-set-p rv js2-END_DROPS_OFF))
   (js2-clear-flag rv js2-END_DROPS_OFF)
@@ -6779,7 +6779,7 @@ Shown at or above `js2-highlight-level' 3.")
 
 (defun js2-parse-highlight-member-expr-node (node)
   "Perform syntax highlighting of EcmaScript built-in properties.
-The variable `js2-highlight-level' governs this highighting."
+The variable `js2-highlight-level' governs this highlighting."
   (let (face target prop name pos end parent call-p callee)
 (cond
  ;; case 1:  simple name, e.g. foo
@@ -9161,7 +9161,7 @@ Returns the parsed `js2-var-decl-node' expression node."
 (defun js2-parse-let (pos &optional stmt-p)
   "Parse a let expression or statement.
 A let-expression is of the form `let (vars) expr'.
-A let-statment is of the form `let (vars) {statements}'.
+A let-statement is of the form `let (vars) {statements}'.
 The third form of let is a variable declaration list, handled
 by `js2-parse-variables'."
   (let ((pn (make-js2-let-node :pos pos))
@@ -12075,7 +12075,7 @@ move backward across N balanced expressions."
(when (setq child (js2-node-closest-child node (point) rp))
  (setq pos (js2-node-abs-end child)))
  (setq pos (1+ rp
- ;; No parens or child nodes, looks for the end of the curren node.
+ ;; No parens or child nodes, looks for the end of the current 
node.
  (cl-incf pos (js2-node-len
(if (js2-expr-stmt-node-p (js2-node-parent node))
;; Stop after the semicolon.



[elpa] master 2bb4db0 15/22: Assign quote syntax to backquotes

2015-04-23 Thread Dmitry Gutov
branch: master
commit 2bb4db0898da30a149fa656dd4a68cb7e670e785
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Assign quote syntax to backquotes

Fixes #222
---
 js2-mode.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 627a615..35f24ba 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -1273,6 +1273,7 @@ First match-group is the leading whitespace.")
 (defvar js2-mode-syntax-table
   (let ((table (make-syntax-table)))
 (c-populate-syntax-table table)
+(modify-syntax-entry ?` "\"" table)
 table)
   "Syntax table used in `js2-mode' buffers.")
 



[elpa] master updated (c10ba4b -> 54df259)

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

  from  c10ba4b   Merge commit '725e12a51e837ed75361f9f2258a887cacb120cd' 
from swiper
   new  fae5776   Check that the let declaration comes before the reference
   new  dd2106b   Merge branch 'let-temporal-dz'
   new  28853c9   do auto semicolon insert on function exports
   new  dfad0d5   Merge pull request #211 from 
cowboyd/no-semicolon-warning-on-function-export
   new  bf454ef   Fix typos in comments and docstrings
   new  02fea21   Merge pull request #213 from lelit/typos
   new  4d8ec67   Rely on bogus scopes less
   new  7bf479a   Fix js2-paren-node length
   new  4a1b4e8   Parse without error first method in a class with keyword 
name
   new  90a9056   ...or any following one
   new  bc61ce0   Fix off-by-one error for comment node length
   new  a184642   Merge pull request #220 from 
jacksonrayhamilton/comment-length
   new  3b76567   Fix js2-node-get-enclosing-scope
   new  458d3fe   Merge pull request #221 from 
jacksonrayhamilton/enclosing-scope
   new  2bb4db0   Assign quote syntax to backquotes
   new  4de6f03   Don't indent in multiline strings
   new  d4d9c54   js2-pretty-multiline-declarations: Add 'dynamic option
   new  ee4a202   Merge pull request #195 from 
jacksonrayhamilton/pretty-multiline-declarations
   new  9790b97   * js2-mode.el (js2-mode): Use cursor-sensor-mode if 
available.
   new  022ef95   Merge commit '9790b9781aa8ca1d4bdf94d06d4e8ff2e68d37e8' 
into js2-mode-master
   new  ac93b9e   Address two FIXMEs; fix a regression flagged by tests
   new  54df259   Merge commit 'ac93b9eef9b6ac44d187b9688d68a7a5f205b3fe' 
from js2-mode


Summary of changes:
 packages/js2-mode/js2-mode.el |  362 ++---
 packages/js2-mode/tests/indent.el |   45 -
 packages/js2-mode/tests/parser.el |   39 
 3 files changed, 295 insertions(+), 151 deletions(-)



[elpa] master 4d8ec67 07/22: Rely on bogus scopes less

2015-04-23 Thread Dmitry Gutov
branch: master
commit 4d8ec67305e63de22312dce8e06bf96d06db863b
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Rely on bogus scopes less
---
 js2-mode.el |  149 +--
 tests/parser.el |   14 +
 2 files changed, 93 insertions(+), 70 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index cb9b454..c7c5f22 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -8551,6 +8551,7 @@ invalid export statements."
   "Parse a for, for-in or for each-in statement.
 Last matched token must be js2-FOR."
   (let ((for-pos (js2-current-token-beg))
+(tmp-scope (make-js2-scope))
 pn is-for-each is-for-in-or-of is-for-of
 in-pos each-pos tmp-pos
 init  ; Node init is also foo in 'foo in object'.
@@ -8568,78 +8569,83 @@ Last matched token must be js2-FOR."
 (if (js2-must-match js2-LP "msg.no.paren.for")
 (setq lp (- (js2-current-token-beg) for-pos)))
 (setq tt (js2-get-token))
-;; 'for' makes local scope
-(js2-push-scope (make-js2-scope))
+;; Capture identifiers inside parens.  We can't create the node
+;; (and use it as the current scope) until we know its type.
+(js2-push-scope tmp-scope)
 (unwind-protect
-;; parse init clause
-(let ((js2-in-for-init t))  ; set as dynamic variable
-  (cond
-   ((= tt js2-SEMI)
-(js2-unget-token)
-(setq init (make-js2-empty-expr-node)))
-   ((or (= tt js2-VAR) (= tt js2-LET))
-(setq init (js2-parse-variables tt (js2-current-token-beg
-   (t
-(js2-unget-token)
-(setq init (js2-parse-expr)
-  (if (or (js2-match-token js2-IN)
-  (and (>= js2-language-version 200)
-   (js2-match-contextual-kwd "of")
-   (setq is-for-of t)))
-  (setq is-for-in-or-of t
-in-pos (- (js2-current-token-beg) for-pos)
-;; scope of iteration target object is not the scope we've 
created above.
-;; stash current scope temporary.
-cond (let ((js2-current-scope (js2-scope-parent-scope 
js2-current-scope)))
-   (js2-parse-expr)))  ; object over which we're iterating
-;; else ordinary for loop - parse cond and incr
-(js2-must-match js2-SEMI "msg.no.semi.for")
-(setq cond (if (= (js2-peek-token) js2-SEMI)
-   (make-js2-empty-expr-node) ; no loop condition
- (js2-parse-expr)))
-(js2-must-match js2-SEMI "msg.no.semi.for.cond")
-(setq tmp-pos (js2-current-token-end)
-  incr (if (= (js2-peek-token) js2-RP)
-   (make-js2-empty-expr-node :pos tmp-pos)
- (js2-parse-expr
-  (if (js2-must-match js2-RP "msg.no.paren.for.ctrl")
-  (setq rp (- (js2-current-token-beg) for-pos)))
-  (if (not is-for-in-or-of)
-  (setq pn (make-js2-for-node :init init
-  :condition cond
-  :update incr
-  :lp lp
-  :rp rp))
-;; cond could be null if 'in obj' got eaten by the init node.
-(if (js2-infix-node-p init)
-;; it was (foo in bar) instead of (var foo in bar)
-(setq cond (js2-infix-node-right init)
-  init (js2-infix-node-left init))
-  (if (and (js2-var-decl-node-p init)
-   (> (length (js2-var-decl-node-kids init)) 1))
-  (js2-report-error "msg.mult.index")))
-(setq pn (make-js2-for-in-node :iterator init
-   :object cond
-   :in-pos in-pos
-   :foreach-p is-for-each
-   :each-pos each-pos
-   :forof-p is-for-of
-   :lp lp
-   :rp rp)))
-  (unwind-protect
-  (progn
-(js2-enter-loop pn)
-;; We have to parse the body -after- creating the loop node,
-;; so that the loop node appears in the js2-loop-set, allowing
-;; break/continue statements to find the enclosing loop.
-(setf body (js2-parse-statement)
-  (js2-loop-node-body pn) body
-  (js2-node-pos pn) for-pos
-  (js2-node-len pn) (- (js2-node-end body) for-pos))
-(js2-node-add-children pn init cond incr body))
-;; finally
-(js2-exit-loop))
+(progn
+  ;; parse init clause
+  (let ((js2-in-for-init t))  ; set as dynamic variable
+(cond
+ ((= tt js2-SEMI)
+  (js2-unget-token)
+  (setq init (make-js2-empty-expr-node)))
+ ((or (= tt js2-VAR) (= tt js2-LET))
+   

[elpa] master 28853c9 03/22: do auto semicolon insert on function exports

2015-04-23 Thread Dmitry Gutov
branch: master
commit 28853c91a2a15d0414da5cdb05f755fa658317f7
Author: Charles Lowell 
Commit: Charles Lowell 

do auto semicolon insert on function exports
---
 js2-mode.el |   11 ---
 tests/parser.el |   10 ++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 2fd0630..4045c94 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -8094,7 +8094,8 @@ node are given relative start positions and correct 
lengths."
 js2-ERROR
 js2-SEMI
 js2-CLASS
-js2-FUNCTION)
+js2-FUNCTION
+js2-EXPORT)
   "List of tokens that don't do automatic semicolon insertion.")
 
 (defconst js2-autoinsert-semi-and-warn
@@ -8529,9 +8530,13 @@ invalid export statements."
 (when from-clause
   (push from-clause children))
 (when declaration
-  (push declaration children))
+  (push declaration children)
+  (when (not (js2-function-node-p declaration))
+(js2-auto-insert-semicolon declaration)))
 (when default
-  (push default children))
+  (push default children)
+  (when (not (js2-function-node-p default))
+(js2-auto-insert-semicolon default)))
 (let ((node (make-js2-export-node
   :pos beg
   :len (- (js2-current-token-end) beg)
diff --git a/tests/parser.el b/tests/parser.el
index b4f2d8f..8c44028 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -608,6 +608,16 @@ the test."
 (should export-node)
 (should (js2-export-node-default export-node
 
+(js2-deftest export-function-no-semicolon "export default function foo() {}"
+  (js2-mode)
+  (should (equal nil js2-parsed-warnings)))
+(js2-deftest export-default-function-no-semicolon "export function foo() {}"
+  (js2-mode)
+  (should (equal nil js2-parsed-warnings)))
+(js2-deftest export-anything-else-does-require-a-semicolon "export var obj = 
{}"
+  (js2-mode)
+  (should (not (equal nil js2-parsed-warnings
+
 (js2-deftest-parse parse-export-rexport "export * from 'other/lib';")
 (js2-deftest-parse parse-export-export-named-list "export {foo, bar as bang};")
 (js2-deftest-parse parse-re-export-named-list "export {foo, bar as bang} from 
'other/lib';")



[elpa] master 022ef95 20/22: Merge commit '9790b9781aa8ca1d4bdf94d06d4e8ff2e68d37e8' into js2-mode-master

2015-04-23 Thread Dmitry Gutov
branch: master
commit 022ef9577e8270d0562b6dd7e283104018e6f318
Merge: ee4a202 9790b97
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge commit '9790b9781aa8ca1d4bdf94d06d4e8ff2e68d37e8' into js2-mode-master
---
 js2-mode.el |   66 +-
 1 files changed, 46 insertions(+), 20 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 3df192e..9bfaa54 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -2534,7 +2534,7 @@ NAME can be a Lisp symbol or string.  SYMBOL is a 
`js2-symbol'."
(:include js2-node)
(:constructor nil)
(:constructor make-js2-export-node (&key (type js2-EXPORT)
-(pos) 
(js2-current-token-beg)
+(pos 
(js2-current-token-beg))
 len
 exports-list
 from-clause
@@ -2792,7 +2792,7 @@ different, visit the extern-name."
 (when (not (equal local-name extern-name))
   (js2-visit-ast extern-name v
 
-(defun js2-print-extern-binding (n i)
+(defun js2-print-extern-binding (n _i)
   "Print a representation of a single extern binding. E.g. 'foo' or
 'foo as bar'."
   (let ((local-name (js2-export-binding-node-local-name n))
@@ -5898,7 +5898,7 @@ its relevant fields and puts it into `js2-ti-tokens'."
   (let (identifier-start
 is-unicode-escape-start c
 contains-escape escape-val str result base
-quote-char look-for-slash continue tt
+look-for-slash continue tt
 (token (js2-new-token 0)))
 (setq
  tt
@@ -6654,6 +6654,7 @@ its relevant fields and puts it into `js2-ti-tokens'."
   (remove-text-properties beg end '(font-lock-face nil
 help-echo nil
 point-entered nil
+cursor-sensor-functions nil
 c-in-sws nil)))
 
 (defconst js2-ecma-global-props
@@ -9975,8 +9976,7 @@ For instance, @[expr], @*::[expr], or ns::[expr]."
   "Parse a literal (leaf) expression of some sort.
 Includes complex literals such as functions, object-literals,
 array-literals, array comprehensions and regular expressions."
-  (let (pn  ; parent node  (usually return value)
-tt)
+  (let (tt)
 (setq tt (js2-current-token-type))
 (cond
  ((= tt js2-CLASS)
@@ -10165,7 +10165,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 first filter result)
+loops filter result)
 (unwind-protect
 (progn
   (while (js2-match-token js2-FOR)
@@ -10174,7 +10174,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 (setq first (car (last loops
+  (setf (js2-scope-parent-scope (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))
@@ -11422,6 +11422,7 @@ Selecting an error will jump it to the corresponding 
source-buffer error.
   (add-to-invisibility-spec '(js2-outline . t))
   (set (make-local-variable 'line-move-ignore-invisible) t)
   (set (make-local-variable 'forward-sexp-function) #'js2-mode-forward-sexp)
+  (when (fboundp 'cursor-sensor-mode) (cursor-sensor-mode 1))
 
   (setq js2-mode-functions-hidden nil
 js2-mode-comments-hidden nil
@@ -11559,25 +11560,35 @@ buffer will only rebuild its `js2-mode-ast' if the 
buffer is dirty."
   (setq js2-mode-node-overlay (make-overlay beg end))
   (overlay-put js2-mode-node-overlay 'font-lock-face 'highlight))
 (with-silent-modifications
-  (put-text-property beg end 'point-left #'js2-mode-hide-overlay))
+  (if (fboundp 'cursor-sensor-mode)
+  (put-text-property beg end 'cursor-sensor-functions
+ '(js2-mode-hide-overlay))
+(put-text-property beg end 'point-left #'js2-mode-hide-overlay)))
 (message "%s, parent: %s"
  (js2-node-short-name node)
  (if (js2-node-parent node)
  (js2-node-short-name (js2-node-parent node))
"nil"))
 
-(defun js2-mode-hide-overlay (&optional _p1 p2)
-  "Remove the debugging overlay when the point moves.
-P1 and P2 are the old and new values of point, respectively."
+(defun js2-mode-hide-overlay (&optional arg1 arg2 _arg3)
+  "

[elpa] master bc61ce0 11/22: Fix off-by-one error for comment node length

2015-04-23 Thread Dmitry Gutov
branch: master
commit bc61ce03600bc3a00e0922ca3546ec7098a7abf5
Author: Jackson Ray Hamilton 
Commit: Jackson Ray Hamilton 

Fix off-by-one error for comment node length
---
 js2-mode.el |7 +--
 tests/parser.el |   12 
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 5424ff0..46ef97d 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -6163,8 +6163,11 @@ its relevant fields and puts it into `js2-ti-tokens'."
  (setf (js2-token-beg token) (- js2-ts-cursor 2))
  (js2-skip-line)
  (setf (js2-token-comment-type token) 'line)
- ;; include newline so highlighting goes to end of 
window
- (cl-incf (js2-token-end token))
+ ;; include newline so highlighting goes to end of
+ ;; window, if there actually is a newline; if we
+ ;; hit eof, then implicitly there isn't
+ (unless js2-ts-hit-eof
+   (cl-incf (js2-token-end token)))
  (throw 'return js2-COMMENT))
;; is it a /* comment?
(when (js2-match-char ?*)
diff --git a/tests/parser.el b/tests/parser.el
index d791d3f..0dd1502 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -793,3 +793,15 @@ the test."
 (js2-deftest function-without-parens-error "function b {}"
   ;; Should finish the parse.
   (js2-mode))
+
+;;; Comments
+
+(js2-deftest comment-node-length "//"
+  (js2-mode)
+  (let ((node (js2-node-at-point (point-min
+(should (= (js2-node-len node) 2
+
+(js2-deftest comment-node-length-newline "//\n"
+  (js2-mode)
+  (let ((node (js2-node-at-point (point-min
+(should (= (js2-node-len node) 3



[elpa] master 9790b97 19/22: * js2-mode.el (js2-mode): Use cursor-sensor-mode if available.

2015-04-23 Thread Dmitry Gutov
branch: master
commit 9790b9781aa8ca1d4bdf94d06d4e8ff2e68d37e8
Author: Stefan Monnier 
Commit: Stefan Monnier 

* js2-mode.el (js2-mode): Use cursor-sensor-mode if available.

(js2-export-node): Fix apparent paren typo.
(js2-get-token-internal-1): Remove unused var `quote-char'.
(js2-clear-face): Also remove cursor-sensor-functions.
(js2-parse-primary-expr): Remove unused var `pn'.
(js2-parse-legacy-array-comp): Remove unused var `first'.
(js2-mode-show-node, js2-mode-show-warn-or-err): Use cursor-sensor-functions
if available.
(js2-mode-hide-overlay, js2-echo-error): Adapt to new calling convention.
(js2-echo-help): Declare obsolete.
(js2-mode-extend-comment): Look for the appropriate property.
---
 js2-mode.el |   66 +-
 1 files changed, 46 insertions(+), 20 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 6ab7cb9..5bc0770 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -2506,7 +2506,7 @@ NAME can be a Lisp symbol or string.  SYMBOL is a 
`js2-symbol'."
(:include js2-node)
(:constructor nil)
(:constructor make-js2-export-node (&key (type js2-EXPORT)
-(pos) 
(js2-current-token-beg)
+(pos 
(js2-current-token-beg))
 len
 exports-list
 from-clause
@@ -2764,7 +2764,7 @@ different, visit the extern-name."
 (when (not (equal local-name extern-name))
   (js2-visit-ast extern-name v
 
-(defun js2-print-extern-binding (n i)
+(defun js2-print-extern-binding (n _i)
   "Print a representation of a single extern binding. E.g. 'foo' or
 'foo as bar'."
   (let ((local-name (js2-export-binding-node-local-name n))
@@ -5870,7 +5870,7 @@ its relevant fields and puts it into `js2-ti-tokens'."
   (let (identifier-start
 is-unicode-escape-start c
 contains-escape escape-val str result base
-quote-char look-for-slash continue tt
+look-for-slash continue tt
 (token (js2-new-token 0)))
 (setq
  tt
@@ -6623,6 +6623,7 @@ its relevant fields and puts it into `js2-ti-tokens'."
   (remove-text-properties beg end '(font-lock-face nil
 help-echo nil
 point-entered nil
+cursor-sensor-functions nil
 c-in-sws nil)))
 
 (defconst js2-ecma-global-props
@@ -9934,8 +9935,7 @@ For instance, @[expr], @*::[expr], or ns::[expr]."
   "Parse a literal (leaf) expression of some sort.
 Includes complex literals such as functions, object-literals,
 array-literals, array comprehensions and regular expressions."
-  (let (pn  ; parent node  (usually return value)
-tt)
+  (let (tt)
 (setq tt (js2-current-token-type))
 (cond
  ((= tt js2-CLASS)
@@ -10124,7 +10124,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 first filter result)
+loops filter result)
 (unwind-protect
 (progn
   (while (js2-match-token js2-FOR)
@@ -10133,7 +10133,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 (setq first (car (last loops
+  (setf (js2-scope-parent-scope (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))
@@ -11339,6 +11339,7 @@ Selecting an error will jump it to the corresponding 
source-buffer error.
   (add-to-invisibility-spec '(js2-outline . t))
   (set (make-local-variable 'line-move-ignore-invisible) t)
   (set (make-local-variable 'forward-sexp-function) #'js2-mode-forward-sexp)
+  (when (fboundp 'cursor-sensor-mode) (cursor-sensor-mode 1))
 
   (setq js2-mode-functions-hidden nil
 js2-mode-comments-hidden nil
@@ -11476,25 +11477,35 @@ buffer will only rebuild its `js2-mode-ast' if the 
buffer is dirty."
   (setq js2-mode-node-overlay (make-overlay beg end))
   (overlay-put js2-mode-node-overlay 'font-lock-face 'highlight))
 (with-silent-modifications
-  (put-text-property beg end 'point-left #'js2-mode-hide-overlay))
+  (if (fboundp 'cursor-sensor-mode)
+  (put-text-property beg end 'cursor-sensor-functions
+ '(js2-mode-hide-ove

[elpa] master 54df259 22/22: Merge commit 'ac93b9eef9b6ac44d187b9688d68a7a5f205b3fe' from js2-mode

2015-04-23 Thread Dmitry Gutov
branch: master
commit 54df2598550c8040def7aec80d04847458d990df
Merge: c10ba4b ac93b9e
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge commit 'ac93b9eef9b6ac44d187b9688d68a7a5f205b3fe' from js2-mode

Conflicts:
packages/js2-mode/js2-mode.el
---
 packages/js2-mode/js2-mode.el |  362 ++---
 packages/js2-mode/tests/indent.el |   45 -
 packages/js2-mode/tests/parser.el |   39 
 3 files changed, 295 insertions(+), 151 deletions(-)

diff --git a/packages/js2-mode/js2-mode.el b/packages/js2-mode/js2-mode.el
index 5bc0770..4fc2823 100644
--- a/packages/js2-mode/js2-mode.el
+++ b/packages/js2-mode/js2-mode.el
@@ -263,14 +263,37 @@ js2-mode also binds `js2-bounce-indent-backwards' to 
Shift-Tab."
   b = 20,
   c = 30;
 
-If the value is not `all', and the first assigned value in
+If the value is t, and the first assigned value in the
 declaration is a function/array/object literal spanning several
 lines, it won't be indented additionally:
 
   var o = {   var bar = 2,
 foo: 3  vs.   o = {
   },foo: 3
-  bar = 2;};"
+  bar = 2;};
+
+If the value is `all', it will always be indented additionally:
+
+  var o = {
+foo: 3
+  };
+
+  var o = {
+foo: 3
+  },
+  bar = 2;
+
+If the value is `dynamic', it will be indented additionally only
+if the declaration contains more than one variable:
+
+  var o = {
+foo: 3
+  };
+
+  var o = {
+foo: 3
+  },
+  bar = 2;"
   :group 'js2-mode
   :type 'symbol)
 (js2-mark-safe-local 'js2-pretty-multiline-declarations 'symbolp)
@@ -650,11 +673,10 @@ which doesn't seem particularly useful, but Rhino permits 
it."
 (defvar js2-ARROW 162) ; function arrow (=>)
 (defvar js2-CLASS 163)
 (defvar js2-EXTENDS 164)
-(defvar js2-STATIC 165)
-(defvar js2-SUPER 166)
-(defvar js2-TEMPLATE_HEAD 167); part of template literal before 
substitution
-(defvar js2-NO_SUBS_TEMPLATE 168) ; template literal without substitutions
-(defvar js2-TAGGED_TEMPLATE 169)  ; tagged template literal
+(defvar js2-SUPER 165)
+(defvar js2-TEMPLATE_HEAD 166); part of template literal before 
substitution
+(defvar js2-NO_SUBS_TEMPLATE 167) ; template literal without substitutions
+(defvar js2-TAGGED_TEMPLATE 168)  ; tagged template literal
 
 (defconst js2-num-tokens (1+ js2-TAGGED_TEMPLATE))
 
@@ -1274,6 +1296,7 @@ First match-group is the leading whitespace.")
 (defvar js2-mode-syntax-table
   (let ((table (make-syntax-table)))
 (c-populate-syntax-table table)
+(modify-syntax-entry ?` "\"" table)
 table)
   "Syntax table used in `js2-mode' buffers.")
 
@@ -1384,7 +1407,7 @@ the correct number of ARGS must be provided."
  "Invalid assignment left-hand side.")
 
 (js2-msg "msg.bad.decr"
- "Invalid decerement operand.")
+ "Invalid decrement operand.")
 
 (js2-msg "msg.bad.incr"
  "Invalid increment operand.")
@@ -2308,24 +2331,29 @@ If any given node in NODES is nil, doesn't record that 
link."
 (defun js2-node-get-enclosing-scope (node)
   "Return the innermost `js2-scope' node surrounding NODE.
 Returns nil if there is no enclosing scope node."
-  (let ((parent (js2-node-parent node)))
-(while (not (js2-scope-p parent))
-  (setq parent (js2-node-parent parent)))
-parent))
+  (while (and (setq node (js2-node-parent node))
+  (not (js2-scope-p node
+  node)
 
-(defun js2-get-defining-scope (scope name)
+(defun js2-get-defining-scope (scope name &optional point)
   "Search up scope chain from SCOPE looking for NAME, a string or symbol.
-Returns `js2-scope' in which NAME is defined, or nil if not found."
+Returns `js2-scope' in which NAME is defined, or nil if not found.
+
+If POINT is non-nil, and if the found declaration type is
+`js2-LET', also check that the declaration node is before POINT."
   (let ((sym (if (symbolp name)
  name
(intern name)))
-table
 result
 (continue t))
 (while (and scope continue)
   (if (or
-   (and (setq table (js2-scope-symbol-table scope))
-(assq sym table))
+   (let ((entry (cdr (assq sym (js2-scope-symbol-table scope)
+ (and entry
+  (or (not point)
+  (not (eq js2-LET (js2-symbol-decl-type entry)))
+  (>= point
+  (js2-node-abs-pos (js2-symbol-ast-node entry))
(and (eq sym 'arguments)
 (js2-function-node-p scope)))
   (setq continue nil
@@ -5360,7 +5388,7 @@ Returns logical OR of END_* flags."
   (let* ((rv js2-END_DROPS_OFF)
  (kids (js2-block-node-kids node))
  (n (car kids)))
-;; Check each statment.  If the statement can continue onto the next
+;; Check each statement.  If the statement can continue onto the next
 ;

[elpa] master 4a1b4e8 09/22: Parse without error first method in a class with keyword name

2015-04-23 Thread Dmitry Gutov
branch: master
commit 4a1b4e8d089724445c01278247a6bfebe1d54009
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Parse without error first method in a class with keyword name

Make 'static' just a reserved word, for now. Traceur calls it that anyway.

Using js2-match-token was a problem because it stored a wrong token in
js2-ti-tokens (read without the modifier).

Fixes #216
---
 js2-mode.el |   24 ++--
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 7314c28..1a7a852 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -650,11 +650,10 @@ which doesn't seem particularly useful, but Rhino permits 
it."
 (defvar js2-ARROW 162) ; function arrow (=>)
 (defvar js2-CLASS 163)
 (defvar js2-EXTENDS 164)
-(defvar js2-STATIC 165)
-(defvar js2-SUPER 166)
-(defvar js2-TEMPLATE_HEAD 167); part of template literal before 
substitution
-(defvar js2-NO_SUBS_TEMPLATE 168) ; template literal without substitutions
-(defvar js2-TAGGED_TEMPLATE 169)  ; tagged template literal
+(defvar js2-SUPER 165)
+(defvar js2-TEMPLATE_HEAD 166); part of template literal before 
substitution
+(defvar js2-NO_SUBS_TEMPLATE 167) ; template literal without substitutions
+(defvar js2-TAGGED_TEMPLATE 168)  ; tagged template literal
 
 (defconst js2-num-tokens (1+ js2-TAGGED_TEMPLATE))
 
@@ -5690,7 +5689,7 @@ into temp buffers."
 let
 new null
 return
-static super switch
+super switch
 this throw true try typeof
 var void
 while with
@@ -5711,7 +5710,7 @@ into temp buffers."
js2-LET
js2-NEW js2-NULL
js2-RETURN
-   js2-STATIC js2-SUPER js2-SWITCH
+   js2-SUPER js2-SWITCH
js2-THIS js2-THROW js2-TRUE js2-TRY js2-TYPEOF
js2-VAR
js2-WHILE js2-WITH
@@ -5736,7 +5735,7 @@ The values are default faces to use for highlighting the 
keywords.")
 
 ;; FIXME: Support strict mode-only future reserved words, after we know
 ;; which parts scopes are in strict mode, and which are not.
-(defconst js2-reserved-words '(class enum export extends import super)
+(defconst js2-reserved-words '(class enum export extends import static super)
   "Future reserved keywords in ECMAScript 5.1.")
 
 (defconst js2-keyword-names
@@ -10321,9 +10320,14 @@ If ONLY-OF-P is non-nil, only the 'for (foo of bar)' 
form is allowed."
 (continue t)
 tt elems elem after-comma)
 (while continue
-  (setq static (and class-p (js2-match-token js2-STATIC))
-tt (js2-get-prop-name-token)
+  (setq tt (js2-get-prop-name-token)
+static nil
 elem nil)
+  (when (and class-p (= js2-NAME tt)
+ (string= "static" (js2-current-token-string)))
+(js2-record-face 'font-lock-keyword-face)
+(setq static t
+  tt (js2-get-prop-name-token)))
   (cond
;; {foo: ...}, {'foo': ...}, {foo, bar, ...},
;; {get foo() {...}}, {set foo(x) {...}}, or {foo(x) {...}}



[elpa] master 4de6f03 16/22: Don't indent in multiline strings

2015-04-23 Thread Dmitry Gutov
branch: master
commit 4de6f035be0fdf76034917e526d7ae8fd06bc76b
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Don't indent in multiline strings

Fixes #227
---
 js2-mode.el |   34 ++
 tests/indent.el |   18 ++
 2 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 35f24ba..c8f47e6 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -4,22 +4,24 @@ If so, we don't ever want to use bounce-indent."
   offset (- (point) (save-excursion
   (back-to-indentation)
   (point
-(js2-with-underscore-as-word-syntax
- (if (nth 4 parse-status)
- (js2-lineup-comment parse-status)
-   (setq indent-col (js2-proper-indentation parse-status))
-   ;; See comments below about `js2-mode-last-indented-line'.
-   (cond
-;; bounce-indenting is disabled during electric-key indent.
-;; It doesn't work well on first line of buffer.
-((and js2-bounce-indent-p
-  (not (js2-same-line (point-min)))
-  (not (js2-1-line-comment-continuation-p)))
- (js2-bounce-indent indent-col parse-status bounce-backwards))
-;; just indent to the guesser's likely spot
-(t (indent-line-to indent-col
- (when (cl-plusp offset)
-   (forward-char offset)
+;; Don't touch multiline strings.
+(unless (nth 3 parse-status)
+  (js2-with-underscore-as-word-syntax
+(if (nth 4 parse-status)
+(js2-lineup-comment parse-status)
+  (setq indent-col (js2-proper-indentation parse-status))
+  ;; See comments below about `js2-mode-last-indented-line'.
+  (cond
+   ;; bounce-indenting is disabled during electric-key indent.
+   ;; It doesn't work well on first line of buffer.
+   ((and js2-bounce-indent-p
+ (not (js2-same-line (point-min)))
+ (not (js2-1-line-comment-continuation-p)))
+(js2-bounce-indent indent-col parse-status bounce-backwards))
+   ;; just indent to the guesser's likely spot
+   (t (indent-line-to indent-col
+(when (cl-plusp offset)
+  (forward-char offset))
 
 (defun js2-indent-region (start end)
   "Indent the region, but don't use bounce indenting."
diff --git a/tests/indent.el b/tests/indent.el
index affbd58..b720984 100644
--- a/tests/indent.el
+++ b/tests/indent.el
@@ -23,22 +23,25 @@
 (require 'js2-mode)
 (require 'cl-lib)
 
-(defun js2-test-indent (content)
+(defun js2-test-indent (content keep-indent)
   (let ((s (replace-regexp-in-string "^ *|" "" content)))
 (with-temp-buffer
-  (insert (replace-regexp-in-string "^ *" "" s))
+  (insert
+   (if keep-indent
+   s
+ (replace-regexp-in-string "^ *" "" s)))
   (js2-mode)
   (indent-region (point-min) (point-max))
   (should (string= s (buffer-substring-no-properties
   (point-min) (point)))
 
-(cl-defmacro js2-deftest-indent (name content &key bind)
+(cl-defmacro js2-deftest-indent (name content &key bind keep-indent)
   `(ert-deftest ,(intern (format "js2-%s" name)) ()
  (let ,(append '((js2-basic-offset 2)
  (js2-pretty-multiline-declarations t)
  (inhibit-point-motion-hooks t))
bind)
-   (js2-test-indent ,content
+   (js2-test-indent ,content ,keep-indent
 
 (put 'js2-deftest-indent 'lisp-indent-function 'defun)
 
@@ -102,3 +105,10 @@
   |  default: 'donkey',
   |  tee: 'ornery'
   |};")
+
+(js2-deftest-indent multiline-string-noop
+  "`multiline string
+  |   contents
+  |  are kept
+  |unchanged!`"
+  :keep-indent t)