[elpa] master a61b7e3: * xclip/xclip.el: Add new `emacs` method

2018-12-12 Thread Stefan Monnier
branch: master
commit a61b7e3278b70d85b25204ab47556bbea9507e60
Author: Stefan Monnier 
Commit: Stefan Monnier 

* xclip/xclip.el: Add new `emacs` method

(xclip-method): Add `emacs`.
(xclip--hidden-frame): New var and function.
(xclip-set-selection, xclip-get-selection): Use it to handle `emacs`.
(xclip-mode): Silence byte-compiler warning for `xclip--setup`.
---
 packages/xclip/xclip.el | 161 +---
 1 file changed, 97 insertions(+), 64 deletions(-)

diff --git a/packages/xclip/xclip.el b/packages/xclip/xclip.el
index fa52546..b142475 100644
--- a/packages/xclip/xclip.el
+++ b/packages/xclip/xclip.el
@@ -5,7 +5,7 @@
 ;; Author: Leo Liu 
 ;; Keywords: convenience, tools
 ;; Created: 2007-12-30
-;; Version: 1.6
+;; Version: 1.7
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -25,13 +25,17 @@
 ;; This package allows Emacs to copy to and paste from the GUI clipboard
 ;; when running in text terminal.
 ;;
-;; It relies on external command-line tools for that, which you may need
+;; It can use external command-line tools for that, which you may need
 ;; to install in order for the package to work.
 ;; More specifically, it can use the following tools:
 ;; - Under X11: `xclip' or `xsel' (http://xclip.sourceforge.net and
 ;;   http://www.vergenet.net/~conrad/software/xsel/ respectively).
 ;; - MacOS: `pbpaste/pbcopy'
 ;; - Cygwin: `getclip/putclip'
+;; - Emacs: It can also use Emacs's built-in GUI support to talk to the GUI.
+;;   This requires an Emacs built with GUI support.
+;;   It uses `make-frame-on-display' which has been tested to work under X11,
+;;   but it's not known whether it works under MacOS or Windows.
 ;;
 ;; To use, just add (xclip-mode 1) to your ~/.emacs or do `M-x clip-mode'
 ;; after which the usual kill/yank commands will use the GUI selections
@@ -65,18 +69,22 @@ If non-nil `xclip-program' is ignored.")
 (make-obsolete 'xclip-use-pbcopy&paste 'xclip-method "xclip-1.5")
 
 (defcustom xclip-method
-   (if xclip-use-pbcopy&paste 'pbpaste
- (or
-  (and (executable-find "xclip") 'xclip)
-  (and (executable-find "xsel") 'xsel)
-  (and (eq system-type 'cygwin) (executable-find "getclip") 'getclip)
-  'xclip))
+  (or
+   (and xclip-use-pbcopy&paste 'pbpaste)
+   (and (eq system-type 'cygwin) (executable-find "getclip") 'getclip)
+   (and (executable-find "xclip") 'xclip)
+   (and (executable-find "xsel") 'xsel)
+   (and (fboundp 'x-create-frame) (getenv "DISPLAY") 'emacs)
+   'xclip)
   "Method to use to access the GUI's clipboard.
 Can be one of `pbpaste' for MacOS, `xclip' or `xsel' for X11,
-and `getclip' under Cygwin."
+and `getclip' under Cygwin, or `emacs' to use Emacs's GUI code for that."
   :type '(choice
   (const :tag "MacOS: pbcopy/pbpaste" pbpaste)
-  (const :tag "X11: xclip" xclip)))
+  (const :tag "Cygwin: getclip/putclip" getclip)
+  (const :tag "X11: xclip" xclip)
+  (const :tag "X11: xsel" xsel)
+  (const :tag "X11: Emacs" emacs)))
 
 (defcustom xclip-program (symbol-name xclip-method)
   "Name of the clipboard access command."
@@ -88,76 +96,101 @@ and `getclip' under Cygwin."
   "TYPE is a symbol: primary, secondary and clipboard.
 
 See also `x-set-selection'."
-  (let* ((process-connection-type nil)
- (proc
-  (pcase xclip-method
-(`pbpaste
- (when (memq type '(clipboard CLIPBOARD))
-   (start-process
-"pbcopy" nil
-(replace-regexp-in-string "\\(.*\\)pbpaste" "\\1pbcopy"
-  xclip-program 'fixedcase
-(`getclip
- (when (memq type '(clipboard CLIPBOARD))
-   (start-process
-"putclip" nil
-(replace-regexp-in-string "\\(.*\\)getclip" "\\1putclip"
-  xclip-program 'fixedcase
-(`xclip
- (when (getenv "DISPLAY")
-   (start-process "xclip" nil xclip-program
-  "-selection" (symbol-name type
-(`xsel
- (when (and (getenv "DISPLAY")
-(memq type '(clipboard CLIPBOARD
- primary PRIMARY
- secondary SECONDARY)))
-   (start-process
-"xsel" nil xclip-program
-"-i" (concat "--" (downcase (symbol-name type))
-(method (error "Unknown `xclip-method': %S" method)
-(when proc
-  (process-send-string proc data)
-  (process-send-eof proc))
-data))
+  (if (eq xclip-method 'emacs)
+  (with-selected-frame (xclip--hidden-frame)
+(let ((xclip-mode nil)) ;;Just out of paranoia.
+  (gui-backend-set-selection type data)))
+(let* ((process-connection-type 

[elpa] master d00bbba 4/8: company-clang: Skip over identity preprocessor #defines

2018-12-12 Thread Dmitry Gutov
branch: master
commit d00bbbac3be99d042024734fc417ecad253a52e4
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

company-clang: Skip over identity preprocessor #defines

Fixes #841
---
 NEWS.md  |  5 +
 company-clang.el | 11 ++-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 0d715c6..d2c0ac6 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,10 @@
 # History of user-visible changes
 
+## Next
+
+* `company-clang` removes identity preprocessor #defines from completions
+  ([#841](https://github.com/company-mode/company-mode/issues/841)).
+
 ## 2018-12-08 (0.9.8)
 
 * CAPF backend fixed to use the right `:exit-function`. It can now safely be a
diff --git a/company-clang.el b/company-clang.el
index 962db1e..d43eebb 100644
--- a/company-clang.el
+++ b/company-clang.el
@@ -134,11 +134,12 @@ or automatically through a custom 
`company-clang-prefix-guesser'."
   (when (string-match ":" match)
 (setq match (substring match 0 (match-beginning 0)
 (let ((meta (match-string-no-properties 2)))
-  (when (and meta (not (string= match meta)))
-(put-text-property 0 1 'meta
-   (company-clang--strip-formatting meta)
-   match)))
-(push match lines)))
+  (unless (equal match meta)
+(when meta
+  (put-text-property 0 1 'meta
+ (company-clang--strip-formatting meta)
+ match))
+(push match lines)
 lines))
 
 (defun company-clang--meta (candidate)



[elpa] master d461e05 8/8: Merge commit 'ac82e875e144b227e926c09c53def9b0c059115c' from company

2018-12-12 Thread Dmitry Gutov
branch: master
commit d461e05ded00825f4692d1d7c2eb5cd6206d8290
Merge: a61b7e3 ac82e87
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge commit 'ac82e875e144b227e926c09c53def9b0c059115c' from company
---
 packages/company/NEWS.md  | 11 ++-
 packages/company/company-capf.el  |  4 +---
 packages/company/company-clang.el | 11 ++-
 packages/company/company.el   | 12 +---
 4 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/packages/company/NEWS.md b/packages/company/NEWS.md
index 753bd6e..72f86d7 100644
--- a/packages/company/NEWS.md
+++ b/packages/company/NEWS.md
@@ -1,8 +1,17 @@
 # History of user-visible changes
 
+## 2018-12-13 (0.9.9)
+
+* Fix for the changes in the previous release.
+* New hook `company-after-completion-hook`.
+* `company-clang` removes identity preprocessor #defines from completions
+  ([#841](https://github.com/company-mode/company-mode/issues/841)).
+
 ## 2018-12-08 (0.9.8)
 
-* CAPF backend fixed to use the right `:exit-function`
+* CAPF backend fixed to use the right `:exit-function`. It can now safely be a
+  closure with lexical context capturing the buffer state at the moment when 
the
+  completion table was returned
   ([#845](https://github.com/company-mode/company-mode/pull/845)).
 
 ## 2018-11-06 (0.9.7)
diff --git a/packages/company/company-capf.el b/packages/company/company-capf.el
index 311dd24..64b3de9 100644
--- a/packages/company/company-capf.el
+++ b/packages/company/company-capf.el
@@ -77,9 +77,7 @@ that accompanied the completion table that's currently is 
use.")
 
 (defun company-capf--save-current-data (data)
   (setq company-capf--current-completion-data data)
-  (add-hook 'company-completion-cancelled-hook
-#'company-capf--clear-current-data nil t)
-  (add-hook 'company-completion-finished-hook
+  (add-hook 'company-after-completion-hook
 #'company-capf--clear-current-data nil t))
 
 (defun company-capf--clear-current-data (_ignored)
diff --git a/packages/company/company-clang.el 
b/packages/company/company-clang.el
index 962db1e..d43eebb 100644
--- a/packages/company/company-clang.el
+++ b/packages/company/company-clang.el
@@ -134,11 +134,12 @@ or automatically through a custom 
`company-clang-prefix-guesser'."
   (when (string-match ":" match)
 (setq match (substring match 0 (match-beginning 0)
 (let ((meta (match-string-no-properties 2)))
-  (when (and meta (not (string= match meta)))
-(put-text-property 0 1 'meta
-   (company-clang--strip-formatting meta)
-   match)))
-(push match lines)))
+  (unless (equal match meta)
+(when meta
+  (put-text-property 0 1 'meta
+ (company-clang--strip-formatting meta)
+ match))
+(push match lines)
 lines))
 
 (defun company-clang--meta (candidate)
diff --git a/packages/company/company.el b/packages/company/company.el
index 458aeeb..47f353e 100644
--- a/packages/company/company.el
+++ b/packages/company/company.el
@@ -5,7 +5,7 @@
 ;; Author: Nikolaj Schumacher
 ;; Maintainer: Dmitry Gutov 
 ;; URL: http://company-mode.github.io/
-;; Version: 0.9.8
+;; Version: 0.9.9
 ;; Keywords: abbrev, convenience, matching
 ;; Package-Requires: ((emacs "24.3"))
 
@@ -511,6 +511,11 @@ If you indend to use it to post-process candidates from a 
specific
 backend, consider using the `post-completion' command instead."
   :type 'hook)
 
+(defcustom company-after-completion-hook nil
+  "Hook run at the end of completion, successful or not.
+The hook is called with one argument which is either a string or a symbol."
+  :type 'hook)
+
 (defcustom company-minimum-prefix-length 3
   "The minimum prefix length for idle completion."
   :type '(integer :tag "prefix length"))
@@ -1430,7 +1435,7 @@ prefix match (same case) will be prioritized."
(not company-candidates)
(let ((company-idle-delay 'now))
  (condition-case-unless-debug err
- (progn
+ (let ((inhibit-quit nil))
(company--perform)
;; Return non-nil if active.
company-candidates)
@@ -1637,7 +1642,8 @@ prefix match (same case) will be prioritized."
   (let ((company-backend backend))
 (run-hook-with-args 'company-completion-finished-hook result)
 (company-call-backend 'post-completion result))
-(run-hook-with-args 'company-completion-cancelled-hook result
+(run-hook-with-args 'company-completion-cancelled-hook result))
+  (run-hook-with-args 'company-after-completion-hook result)))
   ;; Make return value explicit.
   nil)
 



[elpa] master aabf0a3 5/8: Fix the exit-function fix

2018-12-12 Thread Dmitry Gutov
branch: master
commit aabf0a35df3d1507b9341bdf7a5afa3ee9f18c17
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Fix the exit-function fix

#845


https://github.com/company-mode/company-mode/commit/526aa5b3cffb93e07313ace7a3902be19f46eddf#r31656876
---
 company-capf.el | 4 +---
 company.el  | 8 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/company-capf.el b/company-capf.el
index 311dd24..64b3de9 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -77,9 +77,7 @@ that accompanied the completion table that's currently is 
use.")
 
 (defun company-capf--save-current-data (data)
   (setq company-capf--current-completion-data data)
-  (add-hook 'company-completion-cancelled-hook
-#'company-capf--clear-current-data nil t)
-  (add-hook 'company-completion-finished-hook
+  (add-hook 'company-after-completion-hook
 #'company-capf--clear-current-data nil t))
 
 (defun company-capf--clear-current-data (_ignored)
diff --git a/company.el b/company.el
index 5676583..b86574c 100644
--- a/company.el
+++ b/company.el
@@ -511,6 +511,11 @@ If you indend to use it to post-process candidates from a 
specific
 backend, consider using the `post-completion' command instead."
   :type 'hook)
 
+(defcustom company-after-completion-hook nil
+  "Hook run at the end of completion, successful or not.
+The hook is called with one argument which is either a string or a symbol."
+  :type 'hook)
+
 (defcustom company-minimum-prefix-length 3
   "The minimum prefix length for idle completion."
   :type '(integer :tag "prefix length"))
@@ -1637,7 +1642,8 @@ prefix match (same case) will be prioritized."
   (let ((company-backend backend))
 (run-hook-with-args 'company-completion-finished-hook result)
 (company-call-backend 'post-completion result))
-(run-hook-with-args 'company-completion-cancelled-hook result
+(run-hook-with-args 'company-completion-cancelled-hook result))
+  (run-hook-with-args 'company-after-completion-hook result)))
   ;; Make return value explicit.
   nil)
 



[elpa] master ac82e87 7/8: Release 0.9.9

2018-12-12 Thread Dmitry Gutov
branch: master
commit ac82e875e144b227e926c09c53def9b0c059115c
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Release 0.9.9
---
 NEWS.md| 2 +-
 company.el | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 2e88ddf..72f86d7 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,6 @@
 # History of user-visible changes
 
-## Next
+## 2018-12-13 (0.9.9)
 
 * Fix for the changes in the previous release.
 * New hook `company-after-completion-hook`.
diff --git a/company.el b/company.el
index b86574c..1e91d06 100644
--- a/company.el
+++ b/company.el
@@ -5,7 +5,7 @@
 ;; Author: Nikolaj Schumacher
 ;; Maintainer: Dmitry Gutov 
 ;; URL: http://company-mode.github.io/
-;; Version: 0.9.8
+;; Version: 0.9.9
 ;; Keywords: abbrev, convenience, matching
 ;; Package-Requires: ((emacs "24.3"))
 



[elpa] master b4a8690 3/8: Reindent

2018-12-12 Thread Dmitry Gutov
branch: master
commit b4a8690b4410d007332544edf0eaa966fee222fa
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Reindent
---
 NEWS.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index c5991dd..0d715c6 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -3,9 +3,9 @@
 ## 2018-12-08 (0.9.8)
 
 * CAPF backend fixed to use the right `:exit-function`. It can now safely be a
-closure with lexical context capturing the buffer state at the moment when the
-completion table was returned
-([#845](https://github.com/company-mode/company-mode/pull/845)).
+  closure with lexical context capturing the buffer state at the moment when 
the
+  completion table was returned
+  ([#845](https://github.com/company-mode/company-mode/pull/845)).
 
 ## 2018-11-06 (0.9.7)
 



[elpa] master c18bd7e 2/8: #845 Make a longer NEWS entry

2018-12-12 Thread Dmitry Gutov
branch: master
commit c18bd7ea82b74ec090761fea1ead489f6cd675c6
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

#845 Make a longer NEWS entry
---
 NEWS.md | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 753bd6e..c5991dd 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,8 +2,10 @@
 
 ## 2018-12-08 (0.9.8)
 
-* CAPF backend fixed to use the right `:exit-function`
-  ([#845](https://github.com/company-mode/company-mode/pull/845)).
+* CAPF backend fixed to use the right `:exit-function`. It can now safely be a
+closure with lexical context capturing the buffer state at the moment when the
+completion table was returned
+([#845](https://github.com/company-mode/company-mode/pull/845)).
 
 ## 2018-11-06 (0.9.7)
 



[elpa] master 388eec5 1/8: Bind inhibit-quit to nil inside an idle timer

2018-12-12 Thread Dmitry Gutov
branch: master
commit 388eec511a7543d77a325dd68081e6e951f64d1f
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Bind inhibit-quit to nil inside an idle timer
---
 company.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/company.el b/company.el
index 3e32fa1..5676583 100644
--- a/company.el
+++ b/company.el
@@ -1430,7 +1430,7 @@ prefix match (same case) will be prioritized."
(not company-candidates)
(let ((company-idle-delay 'now))
  (condition-case-unless-debug err
- (progn
+ (let ((inhibit-quit nil))
(company--perform)
;; Return non-nil if active.
company-candidates)



[elpa] master updated (a61b7e3 -> d461e05)

2018-12-12 Thread Dmitry Gutov
dgutov pushed a change to branch master.

  from  a61b7e3   * xclip/xclip.el: Add new `emacs` method
   new  388eec5   Bind inhibit-quit to nil inside an idle timer
   new  c18bd7e   #845 Make a longer NEWS entry
   new  b4a8690   Reindent
   new  d00bbba   company-clang: Skip over identity preprocessor #defines
   new  aabf0a3   Fix the exit-function fix
   new  8407ff3   Add the new entries
   new  ac82e87   Release 0.9.9
   new  d461e05   Merge commit 'ac82e875e144b227e926c09c53def9b0c059115c' 
from company


Summary of changes:
 packages/company/NEWS.md  | 11 ++-
 packages/company/company-capf.el  |  4 +---
 packages/company/company-clang.el | 11 ++-
 packages/company/company.el   | 12 +---
 4 files changed, 26 insertions(+), 12 deletions(-)



[elpa] master 8407ff3 6/8: Add the new entries

2018-12-12 Thread Dmitry Gutov
branch: master
commit 8407ff3569250913d7358fc6bc7d79d0b336a40f
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Add the new entries
---
 NEWS.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/NEWS.md b/NEWS.md
index d2c0ac6..2e88ddf 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
 
 ## Next
 
+* Fix for the changes in the previous release.
+* New hook `company-after-completion-hook`.
 * `company-clang` removes identity preprocessor #defines from completions
   ([#841](https://github.com/company-mode/company-mode/issues/841)).