[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b885ada 2/2: Merge branch 'master' of git://bzr.sv.gnu.org
From: |
Michael Albinus |
Subject: |
[elpa] master b885ada 2/2: Merge branch 'master' of git://bzr.sv.gnu.org/emacs/elpa |
Date: |
Mon, 06 Apr 2015 14:07:34 +0000 |
branch: master
commit b885adac363e09626a84a9631d27bade2151f42a
Merge: b59bae3 6b29e32
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Merge branch 'master' of git://bzr.sv.gnu.org/emacs/elpa
---
packages/aggressive-indent/README.md | 7 +-
packages/aggressive-indent/aggressive-indent.el | 12 +-
packages/javaimp/javaimp.el | 124 ++++++++++++++++-------
packages/websocket/websocket.el | 90 ++++++++++-------
4 files changed, 153 insertions(+), 80 deletions(-)
diff --git a/packages/aggressive-indent/README.md
b/packages/aggressive-indent/README.md
index 8abb380..b5006f5 100644
--- a/packages/aggressive-indent/README.md
+++ b/packages/aggressive-indent/README.md
@@ -1,6 +1,5 @@
-aggressive-indent-mode
+aggressive-indent-mode
[![Melpa](http://melpa.org/packages/aggressive-indent-badge.svg)](http://melpa.org/#/aggressive-indent)
[![Melpa-Stable](http://stable.melpa.org/packages/aggressive-indent-badge.svg)](http://stable.melpa.org/#/aggressive-indent)
======================
-(_[Wanna say thank you?](https://gratipay.com/Malabarba/)_)
`electric-indent-mode` is enough to keep your code nicely aligned when
all you do is type. However, once you start shifting blocks around,
@@ -62,3 +61,7 @@ following clause:
'(and (derived-mode-p 'c++-mode)
(null (string-match "\\([;{}]\\|\\b\\(if\\|for\\|while\\)\\b\\)"
(thing-at-point 'line)))))
+
+## Contribute ##
+
+[![Gratipay](https://cdn.rawgit.com/gratipay/gratipay-badge/2.1.3/dist/gratipay.png)](https://gratipay.com/Malabarba)
diff --git a/packages/aggressive-indent/aggressive-indent.el
b/packages/aggressive-indent/aggressive-indent.el
index d1f70d4..45f3323 100644
--- a/packages/aggressive-indent/aggressive-indent.el
+++ b/packages/aggressive-indent/aggressive-indent.el
@@ -4,7 +4,7 @@
;; Author: Artur Malabarba <address@hidden>
;; URL: http://github.com/Malabarba/aggressive-indent-mode
-;; Version: 1.0
+;; Version: 1.0.1
;; Package-Requires: ((emacs "24.1") (names "20150125.9") (cl-lib "0.5"))
;; Keywords: indent lisp maint tools
;; Prefix: aggressive-indent
@@ -88,22 +88,21 @@
;;; Code:
(require 'cl-lib)
+(eval-when-compile (require 'names))
;;;###autoload
(define-namespace aggressive-indent-
:group indent
-(defconst version (eval-when-compile
- (require 'lisp-mnt)
- (lm-version))
- "Version of the aggressive-indent.el package.")
(defun bug-report ()
"Opens github issues page in a web browser. Please send any bugs you find.
Please include your Emacs and `aggressive-indent' versions."
(interactive)
+ (require 'lisp-mnt)
(message "Your `aggressive-indent-version' is: %s, and your emacs version
is: %s.
Please include this in your report!"
- version emacs-version)
+ (lm-version (find-library-name "aggressive-indent"))
+ emacs-version)
(browse-url
"https://github.com/Bruce-Connor/aggressive-indent-mode/issues/new"))
@@ -120,6 +119,7 @@ Please include this in your report!"
bibtex-mode
cider-repl-mode
coffee-mode
+ comint-mode
conf-mode
Custom-mode
diff-mode
diff --git a/packages/javaimp/javaimp.el b/packages/javaimp/javaimp.el
index ca1a710..68ec76b 100644
--- a/packages/javaimp/javaimp.el
+++ b/packages/javaimp/javaimp.el
@@ -40,6 +40,10 @@
;;
;; `javaimp-jdk-home' is a path for JDK. It is used to scan JDK jars.
;; Usually you will need to set this.
+;;
+;; `javaimp-additional-source-dirs' is a list specifying directories where
+;; additional (e.g. generated) source files reside. Each directory is a
+;; relative path from ${project.build.directory} project property value.
;;
;; `javaimp-mvn-program' defines path of the `mvn' program. Use if it's
;; not on `exec-path'.
@@ -65,9 +69,13 @@
;; Sample setup (put this into your .emacs):
;;
;; (require 'javaimp)
-;; (add-to-list
-;; 'javaimp-import-group-alist '("\\`\\(ru\\.yota\\.\\|tv\\.okko\\.\\)" .
80))
-;; (setq javaimp-jdk-home "/opt/java")
+;;
+;; (add-to-list 'javaimp-import-group-alist
'("\\`\\(ru\\.yota\\.\\|tv\\.okko\\.\\)" . 80))
+;;
+;; (setq javaimp-jdk-home (getenv "JAVA_HOME"))
+;; (setq javaimp-include-current-project-classes t)
+;; (setq javaimp-additional-source-dirs '("generated-sources/thrift"))
+;;
;; (add-hook 'java-mode-hook
;; (lambda ()
;; (local-set-key "\C-ci" 'javaimp-add-import)
@@ -94,10 +102,14 @@
"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 groups in the
-imports list. Each element should be of the form `(CLASSNAME-REGEXP
-. ORDER)' where `CLASSNAME-REGEXP' is a regexp matching the fully qualified
-class name. The order of classes which were not matched is defined by
+ "Specifies how to group classes and how to order resulting
+groups in the imports list.
+
+Each element should be of the form `(CLASSNAME-REGEXP . ORDER)'
+where `CLASSNAME-REGEXP' is a regexp matching the fully qualified
+class name.
+
+The order of classes which were not matched is defined by
`javaimp-import-default-order'.")
(defcustom javaimp-import-default-order 50
@@ -107,6 +119,23 @@ class name. The order of classes which were not matched
is defined by
(defcustom javaimp-jdk-home nil
"Path to the JDK")
+(defcustom javaimp-additional-source-dirs nil
+ "List of directories where additional (e.g. generated)
+source files reside.
+
+Each directory is a relative path from ${project.build.directory} project
+property value.
+
+Typically you would check documentation for a Maven plugin, look
+at the parameter's default value there and add it to this list.
+
+E.g. \"${project.build.directory}/generated-sources/<plugin_name>\"
+becomes \"generated-sources/<plugin_name>\" (note the absence
+of the leading slash.
+
+Custom values set in plugin configuration in pom.xml are not
+supported yet.")
+
(defcustom javaimp-mvn-program "mvn"
"Path to the `mvn' program")
@@ -117,8 +146,10 @@ class name. The order of classes which were not matched
is defined by
"Path to the `jar' program")
(defcustom javaimp-include-current-project-classes t
- "If non-nil, current project's classes are included into
- completion alternatives. Only top-level classes are included.")
+ "If non-nil, current project's classes are included into completion
+alternatives.
+
+Only top-level classes are included.")
;;; Variables and constants
@@ -152,11 +183,13 @@ class name. The order of classes which were not matched
is defined by
;; A module is represented as a list of the form `(ARTIFACT POM-FILE
-;; SOURCE-DIR TEST-SOURCE-DIR POM-FILE-MOD-TS PARENT PARENT-TS)'.
+;; SOURCE-DIR TEST-SOURCE-DIR BUILD-DIR POM-FILE-MOD-TS PARENT PARENT-TS)'.
-(defsubst javaimp-make-mod (artifact pom-file source-dir test-source-dir
- pom-file-mod-ts jars-list parent parent-ts)
- (list artifact pom-file source-dir test-source-dir
+(defsubst javaimp-make-mod (artifact pom-file source-dir
+ test-source-dir build-dir
+ pom-file-mod-ts jars-list
+ parent parent-ts)
+ (list artifact pom-file source-dir test-source-dir build-dir
pom-file-mod-ts jars-list parent parent-ts))
(defsubst javaimp-get-mod-artifact (module)
@@ -171,25 +204,28 @@ class name. The order of classes which were not matched
is defined by
(defsubst javaimp-get-mod-test-source-dir (module)
(nth 3 module))
-(defsubst javaimp-get-mod-pom-mod-ts (module)
+(defsubst javaimp-get-mod-build-dir (module)
(nth 4 module))
+
+(defsubst javaimp-get-mod-pom-mod-ts (module)
+ (nth 5 module))
(defsubst javaimp-set-mod-pom-mod-ts (module value)
- (setcar (nthcdr 4 module) value))
+ (setcar (nthcdr 5 module) value))
(defsubst javaimp-get-mod-pom-deps (module)
- (nth 5 module))
+ (nth 6 module))
(defsubst javaimp-set-mod-pom-deps (module value)
- (setcar (nthcdr 5 module) value))
+ (setcar (nthcdr 6 module) value))
(defsubst javaimp-get-mod-parent (module)
- (nth 6 module))
+ (nth 7 module))
(defsubst javaimp-set-mod-parent (module value)
- (setcar (nthcdr 6 module) value))
+ (setcar (nthcdr 7 module) value))
(defsubst javaimp-get-mod-parent-ts (module)
- (nth 7 module))
+ (nth 8 module))
(defsubst javaimp-set-mod-parent-ts (module value)
- (setcar (nthcdr 7 module) value))
+ (setcar (nthcdr 8 module) value))
;; An artifact is represented as a list: (GROUP-ID ARTIFACT-ID VERSION).
@@ -268,7 +304,7 @@ PATH. PATH should point to a directory."
(list (assq 'project xml-tree)))
(t
(error "Cannot find projects in mvn output"))))
-
+
(defun javaimp-maven-load-module-tree (pom)
"Returns an alist of all Maven modules in a hierarchy starting
with POM"
@@ -320,6 +356,8 @@ with POM"
(test-source-dir (javaimp-xml-first-child
(javaimp-xml-child 'testSourceDirectory
build)))
+ (build-dir (javaimp-xml-first-child
+ (javaimp-xml-child 'directory build)))
(parent (javaimp-make-artifact-from-xml
(javaimp-xml-child 'parent proj))))
(push (javaimp-make-mod
@@ -335,6 +373,11 @@ with POM"
(car (process-lines javaimp-cygpath-program "-u"
test-source-dir))
test-source-dir))
+ (file-name-as-directory
+ (if (eq system-type 'cygwin)
+ (car (process-lines javaimp-cygpath-program "-u"
+ build-dir))
+ build-dir))
nil nil parent nil)
result)))))
@@ -394,8 +437,8 @@ the temporary buffer and returns its result"
(process-file javaimp-mvn-program nil t nil "-f" pom-file
target)))
(output-buf (current-buffer)))
(with-current-buffer (get-buffer-create javaimp-debug-buf-name)
- (erase-buffer)
- (insert-buffer-substring output-buf))
+ (erase-buffer)
+ (insert-buffer-substring output-buf))
(unless (and (numberp status) (= status 0))
(error "Maven target \"%s\" failed with status \"%s\""
target status))
@@ -431,7 +474,7 @@ the temporary buffer and returns its result"
(or (null last-ts) ; reading for the first time?
(not (equal (float-time curr-ts) (float-time last-ts)))
(javaimp-any-file-ts-updated (cdr files))))))
-
+
(defun javaimp-get-dep-jars-cached (module parent)
"Returns a list of dependency jar file paths for a MODULE.
Both MODULE and PARENT poms are checked for updates because
@@ -443,9 +486,9 @@ MODULE."
(when parent
(cons
(javaimp-get-mod-pom-file parent)
- ;; here we check the saved parent ts because it
- ;; matters what version we had when we were
- ;; reloading this pom the last time
+ ;; here we check the saved parent ts because it
+ ;; matters what version we had when we were
+ ;; reloading this pom the last time
(javaimp-get-mod-parent-ts module))))))
;; (re-)fetch dependencies
(javaimp-set-mod-pom-deps
@@ -491,7 +534,7 @@ directory"
(push (replace-regexp-in-string "[/$]" "." (match-string 1))
result))
result)))
-
+
(defun javaimp-collect-jar-classes (jar-paths)
(let (result jar)
(dolist (jar-path jar-paths result)
@@ -515,7 +558,7 @@ directory"
(car modules))
(t
(javaimp-get-module (cdr modules) predicate))))
-
+
(defun javaimp-get-module-by-file (file)
(javaimp-get-module-from-root
javaimp-maven-root-modules
@@ -528,7 +571,7 @@ directory"
javaimp-maven-root-modules
(lambda (mod)
(equal (javaimp-get-mod-artifact mod) artifact))))
-
+
;;; Adding and organizing imports
@@ -561,11 +604,20 @@ module."
"Scans current project and returns a list of top-level classes in both the
source directory and test source directory"
(let ((src-dir (javaimp-get-mod-source-dir module))
- (test-src-dir (javaimp-get-mod-test-source-dir module)))
- (append (and (file-accessible-directory-p src-dir)
- (javaimp-get-directory-classes src-dir nil))
- (and (file-accessible-directory-p test-src-dir)
- (javaimp-get-directory-classes test-src-dir nil)))))
+ (test-src-dir (javaimp-get-mod-test-source-dir module))
+ (build-dir (javaimp-get-mod-build-dir module)))
+ (append
+ (and javaimp-additional-source-dirs
+ (seq-mapcat
+ (lambda (rel-dir)
+ (let ((dir (file-name-as-directory (concat build-dir rel-dir))))
+ (and (file-accessible-directory-p dir)
+ (javaimp-get-directory-classes dir nil))))
+ javaimp-additional-source-dirs))
+ (and (file-accessible-directory-p test-src-dir)
+ (javaimp-get-directory-classes test-src-dir nil))
+ (and (file-accessible-directory-p src-dir)
+ (javaimp-get-directory-classes src-dir nil)))))
(defun javaimp-get-directory-classes (dir prefix)
"Returns the list of classes found in the directory DIR. PREFIX is the
diff --git a/packages/websocket/websocket.el b/packages/websocket/websocket.el
index 969e70b..1e1baa3 100644
--- a/packages/websocket/websocket.el
+++ b/packages/websocket/websocket.el
@@ -5,7 +5,7 @@
;; Author: Andrew Hyatt <ahyatt at gmail dot com>
;; Maintainer: Andrew Hyatt <ahyatt at gmail dot com>
;; Keywords: Communication, Websocket, Server
-;; Version: 1.3
+;; Version: 1.4
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
@@ -99,7 +99,7 @@ same for the protocols.
accept-string
(inflight-input nil))
-(defvar websocket-version "1.3"
+(defvar websocket-version "1.4"
"Version numbers of this version of websocket.el.")
(defvar websocket-debug nil
@@ -235,7 +235,11 @@ approximately 537M long."
(if (= nbytes 8)
(progn
(let ((hi-32bits (lsh val -32))
- (low-32bits (logand #xffffffff val)))
+ ;; Test for systems that don't have > 32 bits, and
+ ;; for those systems just return the value.
+ (low-32bits (if (= 0 (expt 2 32))
+ val
+ (logand #xffffffff val))))
(when (or (> hi-32bits 0) (> (lsh low-32bits -29) 0))
(signal 'websocket-frame-too-large val))
(bindat-pack `((:val vec 2 u32))
@@ -296,35 +300,40 @@ We mask the frame or not, depending on SHOULD-MASK."
(let* ((opcode (websocket-frame-opcode frame))
(payload (websocket-frame-payload frame))
(fin (websocket-frame-completep frame))
- (payloadp (memq opcode '(continuation text binary)))
+ (payloadp (and payload
+ (memq opcode '(continuation ping pong text binary))))
(mask-key (when should-mask (websocket-genbytes 4))))
(apply 'unibyte-string
- (append (list
- (logior (cond ((eq opcode 'continuation) 0)
- ((eq opcode 'text) 1)
- ((eq opcode 'binary) 2)
- ((eq opcode 'close) 8)
- ((eq opcode 'ping) 9)
- ((eq opcode 'pong) 10))
- (if fin 128 0)))
- (when payloadp
- (list
- (logior
- (if should-mask 128 0)
- (cond ((< (length payload) 126) (length payload))
- ((< (length payload) 65536) 126)
- (t 127)))))
- (when (and payloadp (>= (length payload) 126))
- (append (websocket-to-bytes (length payload)
- (cond ((< (length payload) 126) 1)
- ((< (length payload) 65536) 2)
- (t 8))) nil))
- (when (and payloadp should-mask)
- (append mask-key nil))
- (when payloadp
- (append (if should-mask (websocket-mask mask-key payload)
- payload)
- nil))))))
+ (let ((val (append (list
+ (logior (cond ((eq opcode 'continuation) 0)
+ ((eq opcode 'text) 1)
+ ((eq opcode 'binary) 2)
+ ((eq opcode 'close) 8)
+ ((eq opcode 'ping) 9)
+ ((eq opcode 'pong) 10))
+ (if fin 128 0)))
+ (when payloadp
+ (list
+ (logior
+ (if should-mask 128 0)
+ (cond ((< (length payload) 126) (length
payload))
+ ((< (length payload) 65536) 126)
+ (t 127)))))
+ (when (and payloadp (>= (length payload) 126))
+ (append (websocket-to-bytes
+ (length payload)
+ (cond ((< (length payload) 126) 1)
+ ((< (length payload) 65536) 2)
+ (t 8))) nil))
+ (when (and payloadp should-mask)
+ (append mask-key nil))
+ (when payloadp
+ (append (if should-mask (websocket-mask mask-key
payload)
+ payload)
+ nil)))))
+ ;; We have to make sure the non-payload data is a full 32-bit
frame
+ (if (= 1 (length val))
+ (append val '(0)) val)))))
(defun websocket-read-frame (s)
"Read from string S a `websocket-frame' struct with the contents.
@@ -334,7 +343,7 @@ the frame finishes. If the frame is not completed, return
NIL."
(websocket-ensure-length s 1)
(let* ((opcode (websocket-get-opcode s))
(fin (logand 128 (websocket-get-bytes s 1)))
- (payloadp (memq opcode '(continuation text binary)))
+ (payloadp (memq opcode '(continuation text binary ping pong)))
(payload-len (when payloadp
(websocket-get-payload-len (substring s 1))))
(maskp (and
@@ -475,7 +484,10 @@ has connection termination."
lex-ws lex-frame)))
((eq opcode 'ping)
(lambda () (websocket-send lex-ws
- (make-websocket-frame :opcode 'pong
:completep t))))
+ (make-websocket-frame
+ :opcode 'pong
+ :payload (websocket-frame-payload
lex-frame)
+ :completep t))))
((eq opcode 'close)
(lambda () (delete-process (websocket-conn lex-ws))))
(t (lambda ()))))))
@@ -506,10 +518,16 @@ has connection termination."
(defun websocket-check (frame)
"Check FRAME for correctness, returning true if correct."
- (and (equal (not (memq (websocket-frame-opcode frame)
- '(continuation text binary)))
- (and (not (websocket-frame-payload frame))
- (websocket-frame-completep frame)))))
+ (or
+ ;; Text, binary, and continuation frames need payloads
+ (and (memq (websocket-frame-opcode frame) '(text binary continuation))
+ (websocket-frame-payload frame))
+ ;; Pings and pongs may optionally have them
+ (memq (websocket-frame-opcode frame) '(ping pong))
+ ;; And close shouldn't have any payload, and should always be complete.
+ (and (eq (websocket-frame-opcode frame) 'close)
+ (not (websocket-frame-payload frame))
+ (websocket-frame-completep frame))))
(defun websocket-send (websocket frame)
"To the WEBSOCKET server, send the FRAME.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master b885ada 2/2: Merge branch 'master' of git://bzr.sv.gnu.org/emacs/elpa,
Michael Albinus <=