[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/14: Set company-added-newline to t if the buffer was modified
From: |
Dmitry Gutov |
Subject: |
[elpa] 01/14: Set company-added-newline to t if the buffer was modified |
Date: |
Tue, 18 Feb 2014 05:51:00 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 9f465f9918f531777f4aaf099411fa8166947bc4
Author: Dmitry Gutov <address@hidden>
Date: Thu Feb 6 07:03:26 2014 +0200
Set company-added-newline to t if the buffer was modified
Fixes #58
---
company.el | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/company.el b/company.el
index c2df4cf..0b7ab89 100644
--- a/company.el
+++ b/company.el
@@ -1177,9 +1177,11 @@ Keywords and function definition names are ignored."
(or (and company-candidates (company--continue))
(and (company--should-complete) (company--begin-new)))
(when company-candidates
- (when (and company-end-of-buffer-workaround (eobp))
- (save-excursion (insert "\n"))
- (setq company-added-newline (buffer-chars-modified-tick)))
+ (let ((modified (buffer-modified-p)))
+ (when (and company-end-of-buffer-workaround (eobp))
+ (save-excursion (insert "\n"))
+ (setq company-added-newline
+ (or modified (buffer-chars-modified-tick)))))
(setq company-point (point)
company--point-max (point-max))
(company-ensure-emulation-alist)
@@ -1192,7 +1194,8 @@ Keywords and function definition names are ignored."
(let ((tick (buffer-chars-modified-tick)))
(delete-region (1- (point-max)) (point-max))
(equal tick company-added-newline))
- ;; Only set unmodified when tick remained the same since insert.
+ ;; Only set unmodified when tick remained the same since insert,
+ ;; and the buffer wasn't modified before.
(set-buffer-modified-p nil))
(when company-prefix
(if (stringp result)
- [elpa] branch master updated (2e6b4f6 -> cae1efc), Dmitry Gutov, 2014/02/18
- [elpa] 04/14: Fix scrolling up from the last item, Dmitry Gutov, 2014/02/18
- [elpa] 06/14: Introduce company-dabbrev-downcase, Dmitry Gutov, 2014/02/18
- [elpa] 01/14: Set company-added-newline to t if the buffer was modified,
Dmitry Gutov <=
- [elpa] 02/14: Don't `company-cancel' twice, Dmitry Gutov, 2014/02/18
- [elpa] 05/14: Fix out-of-bounds error on truncated anno fontification, Dmitry Gutov, 2014/02/18
- [elpa] 07/14: company-capf: fix when company-point is nil, Dmitry Gutov, 2014/02/18
- [elpa] 03/14: New user option, company-continue-commands, Dmitry Gutov, 2014/02/18
- [elpa] 08/14: company--capf-data: Check that the cdr is cons, not data itself, Dmitry Gutov, 2014/02/18
- [elpa] 09/14: company-capf common-part: look up font-lock-face, Dmitry Gutov, 2014/02/18
- [elpa] 10/14: company-capf: cache the capf data, Dmitry Gutov, 2014/02/18
- [elpa] 14/14: Merge commit '119822078ee3024c2d27017d45ef4578fa36040f' from company, Dmitry Gutov, 2014/02/18
- [elpa] 12/14: company-continue-commands: change the default value, Dmitry Gutov, 2014/02/18
- [elpa] 13/14: Bump the version, Dmitry Gutov, 2014/02/18