[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d39b956 059/173: Introduce company-indent-or-complete-comm
From: |
Dmitry Gutov |
Subject: |
[elpa] master d39b956 059/173: Introduce company-indent-or-complete-common |
Date: |
Thu, 23 Jun 2016 00:28:38 +0000 (UTC) |
branch: master
commit d39b956539d378b55723d11990ee54f1b8cf6586
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Introduce company-indent-or-complete-common
As requested in https://github.com/clojure-emacs/cider/pull/1185/
---
NEWS.md | 1 +
company.el | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/NEWS.md b/NEWS.md
index 319e959..b452544 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
## Next
+* New command `company-indent-or-complete-common`.
* Backend command `doc-buffer` now can also return a cons of buffer and window
start position.
* Backend command `ignore-case` has been documented.
diff --git a/company.el b/company.el
index 5c00dbb..169882e 100644
--- a/company.el
+++ b/company.el
@@ -1955,6 +1955,20 @@ With ARG, move by that many elements."
(current-prefix-arg arg))
(call-interactively 'company-select-next))))))
+(defun company-indent-or-complete-common ()
+ "Indent the current line or region, or complete the common part."
+ (interactive)
+ (cond
+ ((use-region-p)
+ (indent-region (region-beginning) (region-end)))
+ ((let ((old-point (point))
+ (old-tick (buffer-chars-modified-tick))
+ (tab-always-indent t))
+ (call-interactively #'indent-for-tab-command)
+ (when (and (eq old-point (point))
+ (eq old-tick (buffer-chars-modified-tick)))
+ (company-complete-common))))))
+
(defun company-complete ()
"Insert the common part of all candidates or the current selection.
The first time this is called, the common part is inserted, the second
- [elpa] master 7779820 092/173: Remove completions without annotations when considering duplicates, (continued)
- [elpa] master 7779820 092/173: Remove completions without annotations when considering duplicates, Dmitry Gutov, 2016/06/22
- [elpa] master f1ca92f 042/173: Update NEWS [ci skip], Dmitry Gutov, 2016/06/22
- [elpa] master f45b11e 033/173: Don't replace the default argument values with `argN` anymore, Dmitry Gutov, 2016/06/22
- [elpa] master 35f4178 043/173: Allow including window-start in the doc-buffer return value, Dmitry Gutov, 2016/06/22
- [elpa] master b0a946d 052/173: company-clang--start-process: Only erase buffer when there's no existing process, Dmitry Gutov, 2016/06/22
- [elpa] master 5e29e41 003/173: company-files--grab-existing-name: Check if the file is remote, Dmitry Gutov, 2016/06/22
- [elpa] master 7579ced 055/173: Fix a bug reference, Dmitry Gutov, 2016/06/22
- [elpa] master 05987e6 056/173: Fix #362 (arbitrary jumping of point), Dmitry Gutov, 2016/06/22
- [elpa] master 679846a 065/173: Makefile: allow package and elpa targets to run without git, Dmitry Gutov, 2016/06/22
- [elpa] master 33f7bbc 077/173: Fix some compilation warnings, Dmitry Gutov, 2016/06/22
- [elpa] master d39b956 059/173: Introduce company-indent-or-complete-common,
Dmitry Gutov <=
- [elpa] master 478f124 087/173: company-dabbrev-code-modes: Improve Customize labels, Dmitry Gutov, 2016/06/22
- [elpa] master 4a6eea9 089/173: Use company-dabbrev-char-regexp more consistently (#433), Dmitry Gutov, 2016/06/22
- [elpa] master a3858be 086/173: Ignore trigger key prefixes that are shorter than symbol-at-point, Dmitry Gutov, 2016/06/22
- [elpa] master 3726fe2 093/173: [ci skip] Use the "generic" language, Dmitry Gutov, 2016/06/22
- [elpa] master 946c798 095/173: Handle empty list of candidates, Dmitry Gutov, 2016/06/22
- [elpa] master c656b25 079/173: Merge pull request #418 from PythonNut/master, Dmitry Gutov, 2016/06/22
- [elpa] master 931e758 101/173: Fix the workaround, Dmitry Gutov, 2016/06/22
- [elpa] master 049b0e6 048/173: company--begin-new: Check the value of c, Dmitry Gutov, 2016/06/22
- [elpa] master 250ca1c 088/173: Add company-etags-everywhere, Dmitry Gutov, 2016/06/22
- [elpa] master 21da29b 082/173: Update copyright, Dmitry Gutov, 2016/06/22