[elpa] externals/exwm ddbbeda: Fix 2 multi-monitor issues

2016-04-07 Thread Chris Feng
branch: externals/exwm
commit ddbbeda285b3b671ace99f1688e6bd3c3f84c742
Author: Chris Feng 
Commit: Chris Feng 

Fix 2 multi-monitor issues

* exwm-workspace.el (exwm-workspace--on-focus-in, exwm-workspace--init):
Handle unexpected frame switch in `focus-in-hook'.

* exwm-floating.el (exwm-floating--set-floating): If the absolute position
is (0, 0) then the relative position is also the same.
---
 exwm-floating.el  |4 +++-
 exwm-workspace.el |   12 
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index a67bc19..770976d 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -91,7 +91,9 @@
  (frame-geometry (frame-parameter original-frame 'exwm-geometry)))
 (exwm--log "Floating geometry (original, absolute): %dx%d%+d%+d"
width height x y)
-(when frame-geometry
+(when (and frame-geometry
+   (/= x 0)
+   (/= y 0))
   (setq x (- x (slot-value frame-geometry 'x))
 y (- y (slot-value frame-geometry 'y
 (exwm--log "Floating geometry (original, relative): %dx%d%+d%+d"
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 8dd6284..60cf9dd 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -229,6 +229,16 @@ The optional FORCE option is for internal use only."
 (xcb:flush exwm--connection))
   (run-hooks 'exwm-workspace-switch-hook
 
+(defun exwm-workspace--on-focus-in ()
+  "Handle unexpected frame switch."
+  ;; `focus-in-hook' is run by `handle-switch-frame'.
+  (unless (eq this-command #'handle-switch-frame)
+(let ((index (cl-position (selected-frame) exwm-workspace--list)))
+  (exwm--log "Focus on workspace %s" index)
+  (when (and index (/= index exwm-workspace-current-index))
+(exwm--log "Workspace was switched unexpectedly")
+(exwm-workspace-switch index)
+
 (defvar exwm-floating-border-width)
 (defvar exwm-floating-border-color)
 
@@ -679,6 +689,8 @@ The optional FORCE option is for internal use only."
 (add-hook 'minibuffer-exit-hook #'exwm-workspace--on-minibuffer-exit)
 (run-with-idle-timer 0 t #'exwm-workspace--on-echo-area-dirty)
 (add-hook 'echo-area-clear-hook #'exwm-workspace--on-echo-area-clear)
+;; Handle unexpected frame switch.
+(add-hook 'focus-in-hook #'exwm-workspace--on-focus-in)
 ;; Create workspace frames.
 (dotimes (_ exwm-workspace-number)
   (push (make-frame `((window-system . x)



[elpa] javaimp_devel 4b918c0: in progress

2016-04-07 Thread Filipp Gunbin
branch: javaimp_devel
commit 4b918c0bc257c6d3f608c7514051826051b0cc42
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

in progress
---
 packages/javaimp/javaimp.el |  371 ++-
 1 files changed, 152 insertions(+), 219 deletions(-)

diff --git a/packages/javaimp/javaimp.el b/packages/javaimp/javaimp.el
index fcca837..a2ab7c4 100644
--- a/packages/javaimp/javaimp.el
+++ b/packages/javaimp/javaimp.el
@@ -12,7 +12,7 @@
 ;; Allows to manage Java import statements in Maven projects.
 ;;
 ;;   Quick start: customize `javaimp-import-group-alist', `javaimp-jdk-home'
-;; and call `javaimp-maven-visit-root', then in a Java buffer visiting a
+;; and call `javaimp-maven-visit-project', then in a Java buffer visiting a
 ;; file under that module or one of its submodules call
 ;; `javaimp-organize-imports' or `javaimp-add-import'.  `javaimp-add-import'
 ;; will provide you a helpful completion, and the default value (the one
@@ -56,7 +56,7 @@
 ;;  
 ;; Details on commands.
 ;;
-;;   `javaimp-maven-visit-root' is the first command you should issue to
+;;   `javaimp-maven-visit-project' is the first command you should issue to
 ;; use this module.  It reads the pom structure recursively and records
 ;; which files belong to which module.  Maven help:effective-pom command is
 ;; used to do that.
@@ -74,7 +74,7 @@
 ;;   '("\\`\\(my\\.company\\.\\|my\\.company2\\.\\)" . 80))
 ;; 
 ;; (setq javaimp-jdk-home (getenv "JAVA_HOME"))
-;; (setq javaimp-include-current-project-classes t)
+;; (setq javaimp-include-current-module-classes t)
 ;; (setq javaimp-additional-source-dirs '("generated-sources/thrift"))
 ;; 
 ;; (add-hook 'java-mode-hook
@@ -85,10 +85,10 @@
 ;; 
 ;; TODO before version 1.0:
 ;; 
-;; - correct submodule tree for each top-level project (now top-level projects
-;; hold linear submodule list and this prevents modification checking for 
parent
-;; poms).  If a project doesn't have any children, then it should be in the 
list
-;; by itself.
+;; - correct submodule tree for each top-level project (now top-level
+;; projects hold linear submodule list and this prevents modification
+;; checking for parent poms).  Each project should represented as (NAME
+;; OBJECT . CHILDREN).
 ;; 
 ;; - cl-defstruct for data
 ;; 
@@ -102,17 +102,26 @@
 ;; calling `cygpath'.  See https://cygwin.com/ml/cygwin/2013-03/msg00228.html.
 ;;
 ;; - include  into module info
+;;
+;; - each module's parent should be set according to its "parent" node
+;; 
+;; - when a module has a parent but do not inherits, its jars are not added
+;;
+;; - save/restore state
+;;
+;; - API functions should check pom file modifications and refresh if needed
 ;; 
 
 ;;; Code:
 
+(require 'cl-macs)
 (require 'seq)
 
 
 ;;; User options
 
 (defgroup javaimp ()
-  "Add and reorder Java import statements in Maven projects.")
+  "Add and reorder Java import statements in Maven projects")
 
 (defcustom javaimp-import-group-alist '(("\\`javax?\\." . 10))
   "Specifies how to group classes and how to order resulting
@@ -130,7 +139,10 @@ The order of classes which were not matched is defined by
 `javaimp-import-group-alist'")
 
 (defcustom javaimp-jdk-home nil
-  "Path to the JDK")
+  "Path to the JDK.  If you have JAVA_HOME environment variable
+set up, this variable can be set like this:
+
+(setq javaimp-jdk-home (getenv \"JAVA_HOME\"))")
 
 (defcustom javaimp-additional-source-dirs nil
   "List of directories where additional (e.g. generated)
@@ -152,13 +164,14 @@ supported yet.")
 (defcustom javaimp-mvn-program "mvn"
   "Path to the `mvn' program")
 
-(defcustom javaimp-cygpath-program "cygpath"
+(defcustom javaimp-cygpath-program
+  (if (eq system-type 'cygwin) "cygpath")
   "Path to the `cygpath' program")
 
 (defcustom javaimp-jar-program "jar"
   "Path to the `jar' program")
 
-(defcustom javaimp-include-current-project-classes t
+(defcustom javaimp-include-current-module-classes t
   "If non-nil, current project's classes are included into completion
 alternatives.
 
@@ -167,11 +180,11 @@ Only top-level classes are included.")
 
 ;;; Variables and constants
 
-(defvar javaimp-maven-root-modules nil
-  "Loaded root Maven modules")
+(defvar javaimp-project-forest nil
+  "Visited projects")
 
-(defvar javaimp-jar-classes-cache nil
-  "Jar classes cache")
+(defvar javaimp-jar-cache nil
+  "Cache for jar contents")
 
 (defconst javaimp-debug-buf-name "*javaimp-debug*")
 
@@ -195,121 +208,60 @@ Only top-level classes are included.")
   (car (cddr el)))
 
 
-;;; Data representation
-
-;; FIXME: use cl-defstruct!
-
-;; Module
-
-(defsubst javaimp-make-mod (artifact pom-file source-dir test-source-dir 
build-dir
-pom-file-mod-ts jars-list parent parent-ts 
final-name)
-  (list artifact pom-file source-dir test-source-dir build-dir
-   pom-file-mod-ts jars-list parent parent-ts final-name))
-
-(defsubst javaimp-get-mod-artifact (module)
-  (nth 0 module))
-
-(defsubst javaimp-get-mod-pom-file

[elpa] javaimp_devel 327e1ba: in progress

2016-04-07 Thread Filipp Gunbin
branch: javaimp_devel
commit 327e1bacb65b9fc9029022454f733f27a25cde4c
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

in progress
---
 packages/javaimp/javaimp.el |  240 ++
 1 files changed, 148 insertions(+), 92 deletions(-)

diff --git a/packages/javaimp/javaimp.el b/packages/javaimp/javaimp.el
index a2ab7c4..6a50e76 100644
--- a/packages/javaimp/javaimp.el
+++ b/packages/javaimp/javaimp.el
@@ -208,13 +208,21 @@ Only top-level classes are included.")
   (car (cddr el)))
 
 
+;; Cygwin
+
+(defun javaimp-cygpath-convert-maybe (path)
+  (if (eq system-type 'cygwin) 
+  (car (process-lines javaimp-cygpath-program "-u" path))
+path))
+
+
 ;; Structs
 
 (cl-defstruct javaimp-node
   parent children contents)
 
 (cl-defstruct javaimp-module
-  id file file-ts final-name
+  id parent-id file file-ts final-name packaging
   source-dir test-source-dir build-dir
   dep-jars)
 
@@ -232,9 +240,9 @@ Only top-level classes are included.")
   file file-ts classes)
 
 
-;;; Loading Maven projects
+;;; Maven
 
-;; TODO if it's already there?
+;; TODO what if it's already there?
 
 ;;;###autoload
 (defun javaimp-maven-visit-project (path)
@@ -245,28 +253,42 @@ directory containing pom.xml."
   (concat (file-name-as-directory path) "pom.xml"
 (unless (file-readable-p file)
   (error "Cannot read file: %s" file))
-(push (javaimp-maven-load-tree file) javaimp-project-forest)
+(let ((tree (javaimp--maven-load-tree file)))
+  (if tree
+ (push tree javaimp-project-forest)))
 (message "Loaded tree for %s" file)))
 
-(defun javaimp-maven-load-tree (file)
-  ;; TODO 
-  "Creates a tree of Maven projects starting from FILE"
-  (let* ((effective-pom (javaimp-parse-effective-pom pom))
-(project-elts
- (cond ((assq 'projects effective-pom) ;project contains  
tag(s)
-(javaimp-xml-child-list (assq 'projects effective-pom) 
'project))
-   ((assq 'project effective-pom) ;single-module project
-(list (assq 'project effective-pom)))
-   (t
-(error "Cannot find projects in XML tree"
-(modules-alist (javaimp-maven-process-projects project-elts)))
-(javaimp-fill-pom-file-paths modules-alist pom)
-modules-alist))
-
-(defun javaimp-parse-effective-pom (pom)
+(defun javaimp--maven-load-tree (file)
+  "Invokes `mvn help:effective-pom' on FILE and using its output
+creates a tree of Maven projects starting from FILE.  Children
+which link to the parent via the  element are inheriting
+children and are also included.  Subordinate modules with no
+inheritance are not included."
+  (let ((xml-tree (javaimp--maven-read-effective-pom file)))
+(cond ((assq 'project xml-tree)
+  ;; no real children
+  (let ((project-elt (assq 'project xml-tree)))
+(message "Independent submodules: %s"
+ (mapconcat #'javaimp-xml-first-child
+(javaimp--maven-get-module-elts project-elt)
+", "))
+(let ((module (javaimp--maven-parse-module project-elt)))
+  (javaimp--build-tree (javaimp-module-id module) nil (list 
module)
+ ((assq 'projects xml-tree)
+  ;; we have are inheriting children - they and their children, if
+  ;; any, are listed in a linear list
+  (let* ((project-elts (javaimp-xml-child-list
+(assq 'projects xml-tree) 'project))
+ (all-modules (mapcar #'javaimp--maven-parse-module 
project-elts)))
+(javaimp--build-tree (javaimp-module-id (car all-modules)) nil 
all-modules)))
+ (t
+  ;; neither  nor  - error
+  (error "Invalid `help:effective-pom' output")
+
+(defun javaimp--maven-read-effective-pom (pom)
   "Calls `mvn help:effective:pom and returns XML parse tree"
   (message "Loading root pom %s..." pom)
-  (javaimp-call-mvn
+  (javaimp--maven-call
pom "help:effective-pom"
(lambda ()
  (let ((xml-start-pos
@@ -285,44 +307,45 @@ directory containing pom.xml."
(match-end 0)
(xml-parse-region xml-start-pos xml-end-pos)
 
+(defun javaimp--maven-call (pom-file target handler)
+  "Runs Maven target TARGET on POM-FILE, then calls HANDLER in
+the temporary buffer and returns its result"
+  (message "Calling \"mvn %s\" on pom: %s" target pom-file)
+  (with-temp-buffer
+(let* ((pom-file (javaimp-cygpath-convert-maybe pom-file))
+  (status
+   ;; FIXME check Maven output on Gnu/Linux
+   (let ((coding-system-for-read
+  (if (eq system-type 'cygwin) 'utf-8-dos)))
+ (process-file javaimp-mvn-program nil t nil "-f" pom-file 
target)))
+  (b (current-buffer)))
+  (with-current-buffer (get-buffer-create javaimp-debug-buf-name)
+   (erase-buffer)
+   (insert-buffer-substring b))
+  (or (and