[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 125dcbb 1/2: New option company-files-chop-trai
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 125dcbb 1/2: New option company-files-chop-trailing-slash |
Date: |
Wed, 5 May 2021 10:57:06 -0400 (EDT) |
branch: externals/company
commit 125dcbb68aebc2076633e66c87f9f5908f544557
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
New option company-files-chop-trailing-slash
Resolves #1042
---
NEWS.md | 1 +
company-files.el | 13 +++++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 2fad254..78b90dd 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
## Next
+* New user option `company-files-chop-trailing-slash'.
* Improved visual responsiveness with async backends
([#1073](https://github.com/company-mode/company-mode/issues/1073)). New user
option `company-async-redisplay-delay`.
diff --git a/company-files.el b/company-files.el
index 88da2bf..902ea5e 100644
--- a/company-files.el
+++ b/company-files.el
@@ -1,6 +1,6 @@
;;; company-files.el --- company-mode completion backend for file names
-;; Copyright (C) 2009-2011, 2014-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011, 2014-2021 Free Software Foundation, Inc.
;; Author: Nikolaj Schumacher
@@ -38,6 +38,14 @@ The values should use the same format as
`completion-ignored-extensions'."
:type '(const string)
:package-version '(company . "0.9.1"))
+(defcustom company-files-chop-trailing-slash t
+ "Non-nil to remove the trailing slash after inserting directory name.
+
+This way it's easy to continue completion by typing `/' again.
+
+Set this to nil to disable that behavior."
+ :type 'boolean)
+
(defun company-files--directory-files (dir prefix)
;; Don't use directory-files. It produces directories without trailing /.
(condition-case err
@@ -128,7 +136,8 @@ The values should use the same format as
`completion-ignored-extensions'."
(string-prefix-p (car old) (car new))))
(defun company-files--post-completion (arg)
- (when (company-files--trailing-slash-p arg)
+ (when (and company-files-chop-trailing-slash
+ (company-files--trailing-slash-p arg))
(delete-char -1)))
;;;###autoload